|
|
|
@ -1,5 +1,6 @@
|
|
|
|
import { custom_event, append, append_hydration, insert, insert_hydration, detach, listen, attr } from './dom';
|
|
|
|
import { custom_event, append, append_hydration, insert, insert_hydration, detach, listen, attr } from './dom';
|
|
|
|
import { SvelteComponent } from './Component';
|
|
|
|
import { SvelteComponent } from './Component';
|
|
|
|
|
|
|
|
import { is_void } from '../../shared/utils/names';
|
|
|
|
|
|
|
|
|
|
|
|
export function dispatch_dev<T=any>(type: string, detail?: T) {
|
|
|
|
export function dispatch_dev<T=any>(type: string, detail?: T) {
|
|
|
|
document.dispatchEvent(custom_event(type, { version: '__VERSION__', ...detail }, { bubbles: true }));
|
|
|
|
document.dispatchEvent(custom_event(type, { version: '__VERSION__', ...detail }, { bubbles: true }));
|
|
|
|
@ -107,10 +108,14 @@ export function validate_slots(name, slot, keys) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export function validate_dynamic_element(tag: unknown) {
|
|
|
|
export function validate_dynamic_element(tag: unknown, has_children: boolean) {
|
|
|
|
if (tag && typeof tag !== 'string') {
|
|
|
|
const is_string = typeof tag === 'string';
|
|
|
|
|
|
|
|
if (tag && !is_string) {
|
|
|
|
throw new Error('<svelte:element> expects "this" attribute to be a string.');
|
|
|
|
throw new Error('<svelte:element> expects "this" attribute to be a string.');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_string && is_void(tag as string) && has_children) {
|
|
|
|
|
|
|
|
throw new Error(`<${tag}> element is self-closing and cannot have content.`);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type Props = Record<string, any>;
|
|
|
|
type Props = Record<string, any>;
|
|
|
|
|