diff --git a/AliceJS.d.ts b/AliceJS.d.ts index ce5b1bd..37763a6 100644 --- a/AliceJS.d.ts +++ b/AliceJS.d.ts @@ -1,5 +1,7 @@ declare namespace JSX { - export type IntrinsicElements = { [index: string]: any }; + export type IntrinsicElements = { + [index: string]: any + }; } declare function h( @@ -26,19 +28,28 @@ declare var styled: { new: typeof css, rule: typeof rule }; type DLCSS = string; +declare var $el: HTMLElement; + interface Element { - $: DLComponent + $: OuterComponentTypes & { [index: string | symbol]: any } } interface DLElement extends Element { - $: T + $: T & OuterComponentTypes } -declare var $el: HTMLElement; +type ComponentElement any> = DLElement>; -type DLComponent = { - css: DLCSS, +type OuterComponentTypes = { root: Element, children: Element[], +} +type InnerComponentTypes = { + css: DLCSS, mount?: () => void, -} & T; +} +type ComponentTypes = OuterComponentTypes & InnerComponentTypes; + +type Component = ((this: Public & Private & ComponentTypes, _props: Public) => DLElement); + + diff --git a/css.js b/css.js index e1bb3b4..1db8c2e 100644 --- a/css.js +++ b/css.js @@ -20,10 +20,10 @@ function scopify_css(uid, css) { return cssParsed; } function tagcss(strings, values, isblock) { - const uid = `dream-${Array(16) + const uid = `dl${Array(5) .fill(0) .map(() => { - return Math.floor(Math.random() * 16).toString(16); + return Math.floor(Math.random() * 36).toString(36); }) .join("")}`;