@orago/dodo 0.0.19 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../dodo.cjs");let t=require("@orago/kiwi/utilities");function n(e,t){if(t!=null){e.update(t);for(let n in t){let r=t[n];if(n.startsWith(`on:`)&&typeof r==`function`){let t=n.slice(3).toLowerCase();e.events.on(t,r)}}}}var r=class r extends e.Dodo{static getChildren(t){return t==null?[]:(t?.children!=null&&(t.children=Array.isArray(t.children)?e.DodoUtil.flattenElements(t.children??[]):e.DodoUtil.flattenElements([t.children])),t.children??[])}static{this.useProps=e=>t=>n(t,e)}static{this.useSource=e=>i=>{e!=null&&(typeof e?.class==`string`&&(e.class=(0,t.formatClasses)([e.class])),n(i,e),i.content(...r.getChildren(e)))}}constructor(e,t){super(e),this.use([r.useSource(t)])}};function i(t,n,i){return typeof t==`function`?new t(n):e.oo(t).use([r.useSource(n)])}const a=i;function o(...t){let n=document.createDocumentFragment(),r=e.DodoUtil.flattenElements(t);for(let e of r)n.appendChild(e);return n}const s=o,c=(e,t,n,r,a,o)=>i(e,t,n);exports.DodoJSX=r,exports.Fragment=s,exports.JsxFragment=o,exports.dodoJsxApply=n,exports.jsx=i,exports.jsxDEV=c,exports.jsxs=a;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../dodo.cjs");let t=require("@orago/kiwi/utilities");function n(e,t){if(t!=null){e.update(t);for(let n in t){let r=t[n];if(n.startsWith(`on:`)&&typeof r==`function`){let t=n.slice(3).toLowerCase();e.events.on(t,r)}}}}var r=class r extends e.Dodo{static getChildren(t){return t==null?[]:(t?.children!=null&&(t.children=Array.isArray(t.children)?e.DodoUtil.flattenElements(t.children??[]):e.DodoUtil.flattenElements([t.children])),t.children??[])}static{this.useProps=e=>t=>n(t,e)}static{this.useSource=e=>i=>{e!=null&&(typeof e?.class==`string`&&(e.class=(0,t.formatClasses)([e.class])),n(i,e),i.content(...r.getChildren(e)))}}constructor(e,t){super(e),this.use([r.useSource(t)])}};function i(t,n,i){return typeof t==`function`?new t(n):e.oo(t).use([r.useSource(n)])}const a=i;function o(...t){let n=document.createDocumentFragment(),r=e.DodoUtil.flattenElements(t);for(let e of r)n.appendChild(e);return n}const s=o,c=(e,t,n,r,a,o)=>i(e,t,n);exports.DodoJsx=r,exports.Fragment=s,exports.JsxFragment=o,exports.dodoJsxApply=n,exports.jsx=i,exports.jsxDEV=c,exports.jsxs=a;
2
2
  //# sourceMappingURL=jsx-runtime.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsx-runtime.cjs","names":["Dodo","DodoUtil","formatClasses","oo"],"sources":["../../src/util/jsx-runtime.ts"],"sourcesContent":["// polyfill for jsx\r\nimport { formatClasses } from \"@orago/kiwi/utilities\";\r\nimport {\r\n\tAppendable,\r\n\tChildList,\r\n\tDodo,\r\n\tDodoUpdate,\r\n\tDodoUtil,\r\n\too,\r\n} from \"../dodo.js\";\r\n\r\nexport type DodoJsxProps = DodoUpdate & {\r\n\t[K in keyof HTMLElementEventMap as `on:${K}`]?: (\r\n\t\tthis: Dodo,\r\n\t\tev: HTMLElementEventMap[K],\r\n\t) => any;\r\n};\r\n\r\nexport type DodoJsxSource =\r\n\t| (Omit<DodoJsxProps, \"class\"> & {\r\n\t\t\tchildren?: Appendable | ChildList;\r\n\t\t\tclass?: string | string[];\r\n\t })\r\n\t| undefined;\r\n\r\ndeclare global {\r\n\tnamespace JSX {\r\n\t\texport type Element = ReturnType<typeof oo>;\r\n\t\texport type IntrinsicElements = {\r\n\t\t\t[K in keyof HTMLElementTagNameMap]: DodoJsxSource;\r\n\t\t};\r\n\t}\r\n}\r\n\r\nexport function dodoJsxApply(dodo: Dodo, update?: DodoJsxProps) {\r\n\tif (update == undefined) return;\r\n\tdodo.update(update);\r\n\r\n\tconst on_pre: string = \"on:\";\r\n\tfor (const key in update) {\r\n\t\tconst p = update[key as keyof typeof update];\r\n\t\tif (key.startsWith(on_pre) && typeof p === \"function\") {\r\n\t\t\tconst event = key.slice(on_pre.length).toLowerCase();\r\n\t\t\tdodo.events.on(event, p as EventListener);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport class DodoJSX extends Dodo {\r\n\tstatic getChildren(props?: DodoJsxSource): ChildList {\r\n\t\tif (props == undefined) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\r\n\t\tif (props?.children != undefined) {\r\n\t\t\tif (Array.isArray(props.children)) {\r\n\t\t\t\tprops.children = DodoUtil.flattenElements(props.children ?? []);\r\n\t\t\t} else {\r\n\t\t\t\tprops.children = DodoUtil.flattenElements([props.children]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn props.children ?? [];\r\n\t}\r\n\r\n\tstatic useProps = (update?: DodoJsxProps) => (dodo: Dodo) =>\r\n\t\tdodoJsxApply(dodo, update);\r\n\r\n\tstatic useSource = (props?: DodoJsxSource) => (dodo: Dodo) => {\r\n\t\tif (props == undefined) return;\r\n\t\tif (typeof props?.class == \"string\") {\r\n\t\t\tprops.class = formatClasses([props.class]);\r\n\t\t}\r\n\r\n\t\tdodoJsxApply(dodo, props as DodoJsxProps);\r\n\t\tdodo.content(...DodoJSX.getChildren(props));\r\n\t};\r\n\r\n\tconstructor(type: keyof HTMLElementTagNameMap, source?: DodoJsxSource) {\r\n\t\tsuper(type);\r\n\t\tthis.use([DodoJSX.useSource(source)]);\r\n\t}\r\n}\r\n\r\nexport function jsx(type: any, props: DodoJsxSource, key: any) {\r\n\tif (typeof type === \"function\") {\r\n\t\treturn new type(props);\r\n\t}\r\n\r\n\treturn oo(type).use([DodoJSX.useSource(props)]);\r\n}\r\n\r\nexport const jsxs = jsx;\r\n\r\nexport function JsxFragment(...children: ChildList): DocumentFragment {\r\n\tconst frag = document.createDocumentFragment();\r\n\tconst items = DodoUtil.flattenElements(children);\r\n\tfor (const item of items) frag.appendChild(item);\r\n\treturn frag;\r\n}\r\nexport const Fragment = JsxFragment;\r\n\r\nexport const jsxDEV = (\r\n\ttype: any,\r\n\tprops: DodoJsxProps,\r\n\tkey: any,\r\n\tisStatic: any,\r\n\tsource: any,\r\n\tself: any,\r\n) => {\r\n\treturn jsx(type, props, key);\r\n};\r\n"],"mappings":"yIAkCA,SAAgB,EAAa,EAAY,EAAuB,CAC3D,MAAU,KACd,GAAK,OAAO,CAAM,EAGlB,IAAK,IAAM,KAAO,EAAQ,CACzB,IAAM,EAAI,EAAO,GACjB,GAAI,EAAI,WAAW,KAAM,GAAK,OAAO,GAAM,WAAY,CACtD,IAAM,EAAQ,EAAI,MAAM,CAAa,CAAC,CAAC,YAAY,EACnD,EAAK,OAAO,GAAG,EAAO,CAAkB,CACzC,CACD,CATkB,CAUnB,CAEA,IAAa,EAAb,MAAa,UAAgBA,EAAAA,IAAK,CACjC,OAAO,YAAY,EAAkC,CAapD,OAZI,GAAS,KACL,CAAC,GAGL,GAAO,UAAY,OACtB,AAGC,EAAM,SAHH,MAAM,QAAQ,EAAM,QAAQ,EACdC,EAAAA,SAAS,gBAAgB,EAAM,UAAY,CAAC,CAAC,EAE7CA,EAAAA,SAAS,gBAAgB,CAAC,EAAM,QAAQ,CAAC,GAIrD,EAAM,UAAY,CAAC,EAC3B,QAEmB,KAAA,SAAA,GAA2B,GAC7C,EAAa,EAAM,CAAM,SAEN,KAAA,UAAA,GAA2B,GAAe,CACzD,GAAS,OACT,OAAO,GAAO,OAAS,WAC1B,EAAM,OAAA,EAAQC,EAAAA,cAAAA,CAAc,CAAC,EAAM,KAAK,CAAC,GAG1C,EAAa,EAAM,CAAqB,EACxC,EAAK,QAAQ,GAAG,EAAQ,YAAY,CAAK,CAAC,EAC3C,EAEA,YAAY,EAAmC,EAAwB,CACtE,MAAM,CAAI,EACV,KAAK,IAAI,CAAC,EAAQ,UAAU,CAAM,CAAC,CAAC,CACrC,CACD,EAEA,SAAgB,EAAI,EAAW,EAAsB,EAAU,CAK9D,OAJI,OAAO,GAAS,WACZ,IAAI,EAAK,CAAK,EAGfC,EAAAA,GAAG,CAAI,CAAC,CAAC,IAAI,CAAC,EAAQ,UAAU,CAAK,CAAC,CAAC,CAC/C,CAEA,MAAa,EAAO,EAEpB,SAAgB,EAAY,GAAG,EAAuC,CACrE,IAAM,EAAO,SAAS,uBAAuB,EACvC,EAAQF,EAAAA,SAAS,gBAAgB,CAAQ,EAC/C,IAAK,IAAM,KAAQ,EAAO,EAAK,YAAY,CAAI,EAC/C,OAAO,CACR,CACA,MAAa,EAAW,EAEX,GACZ,EACA,EACA,EACA,EACA,EACA,IAEO,EAAI,EAAM,EAAO,CAAG"}
1
+ {"version":3,"file":"jsx-runtime.cjs","names":["Dodo","DodoUtil","formatClasses","oo"],"sources":["../../src/util/jsx-runtime.ts"],"sourcesContent":["// polyfill for jsx\r\nimport { formatClasses } from \"@orago/kiwi/utilities\";\r\nimport {\r\n\tAppendable,\r\n\tChildList,\r\n\tDodo,\r\n\tDodoUpdate,\r\n\tDodoUtil,\r\n\too,\r\n} from \"../dodo.js\";\r\n\r\nexport type DodoJsxProps = DodoUpdate & {\r\n\t[K in keyof HTMLElementEventMap as `on:${K}`]?: (\r\n\t\tthis: Dodo,\r\n\t\tev: HTMLElementEventMap[K],\r\n\t) => any;\r\n};\r\n\r\nexport type DodoJsxSource =\r\n\t| (Omit<DodoJsxProps, \"class\"> & {\r\n\t\t\tchildren?: Appendable | ChildList;\r\n\t\t\tclass?: string | string[];\r\n\t })\r\n\t| undefined;\r\n\r\ndeclare global {\r\n\tnamespace JSX {\r\n\t\texport type Element = ReturnType<typeof oo>;\r\n\t\texport type IntrinsicElements = {\r\n\t\t\t[K in keyof HTMLElementTagNameMap]: DodoJsxSource;\r\n\t\t};\r\n\t}\r\n}\r\n\r\nexport function dodoJsxApply(dodo: Dodo, update?: DodoJsxProps) {\r\n\tif (update == undefined) return;\r\n\tdodo.update(update);\r\n\r\n\tconst on_pre: string = \"on:\";\r\n\tfor (const key in update) {\r\n\t\tconst p = update[key as keyof typeof update];\r\n\t\tif (key.startsWith(on_pre) && typeof p === \"function\") {\r\n\t\t\tconst event = key.slice(on_pre.length).toLowerCase();\r\n\t\t\tdodo.events.on(event, p as EventListener);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport class DodoJsx extends Dodo {\r\n\tstatic getChildren(props?: DodoJsxSource): ChildList {\r\n\t\tif (props == undefined) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\r\n\t\tif (props?.children != undefined) {\r\n\t\t\tif (Array.isArray(props.children)) {\r\n\t\t\t\tprops.children = DodoUtil.flattenElements(props.children ?? []);\r\n\t\t\t} else {\r\n\t\t\t\tprops.children = DodoUtil.flattenElements([props.children]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn props.children ?? [];\r\n\t}\r\n\r\n\tstatic useProps = (update?: DodoJsxProps) => (dodo: Dodo) =>\r\n\t\tdodoJsxApply(dodo, update);\r\n\r\n\tstatic useSource = (props?: DodoJsxSource) => (dodo: Dodo) => {\r\n\t\tif (props == undefined) return;\r\n\t\tif (typeof props?.class == \"string\") {\r\n\t\t\tprops.class = formatClasses([props.class]);\r\n\t\t}\r\n\r\n\t\tdodoJsxApply(dodo, props as DodoJsxProps);\r\n\t\tdodo.content(...DodoJsx.getChildren(props));\r\n\t};\r\n\r\n\tconstructor(type: keyof HTMLElementTagNameMap, source?: DodoJsxSource) {\r\n\t\tsuper(type);\r\n\t\tthis.use([DodoJsx.useSource(source)]);\r\n\t}\r\n}\r\n\r\nexport function jsx(type: any, props: DodoJsxSource, key: any) {\r\n\tif (typeof type === \"function\") {\r\n\t\treturn new type(props);\r\n\t}\r\n\r\n\treturn oo(type).use([DodoJsx.useSource(props)]);\r\n}\r\n\r\nexport const jsxs = jsx;\r\n\r\nexport function JsxFragment(...children: ChildList): DocumentFragment {\r\n\tconst frag = document.createDocumentFragment();\r\n\tconst items = DodoUtil.flattenElements(children);\r\n\tfor (const item of items) frag.appendChild(item);\r\n\treturn frag;\r\n}\r\nexport const Fragment = JsxFragment;\r\n\r\nexport const jsxDEV = (\r\n\ttype: any,\r\n\tprops: DodoJsxProps,\r\n\tkey: any,\r\n\tisStatic: any,\r\n\tsource: any,\r\n\tself: any,\r\n) => {\r\n\treturn jsx(type, props, key);\r\n};\r\n"],"mappings":"yIAkCA,SAAgB,EAAa,EAAY,EAAuB,CAC3D,MAAU,KACd,GAAK,OAAO,CAAM,EAGlB,IAAK,IAAM,KAAO,EAAQ,CACzB,IAAM,EAAI,EAAO,GACjB,GAAI,EAAI,WAAW,KAAM,GAAK,OAAO,GAAM,WAAY,CACtD,IAAM,EAAQ,EAAI,MAAM,CAAa,CAAC,CAAC,YAAY,EACnD,EAAK,OAAO,GAAG,EAAO,CAAkB,CACzC,CACD,CATkB,CAUnB,CAEA,IAAa,EAAb,MAAa,UAAgBA,EAAAA,IAAK,CACjC,OAAO,YAAY,EAAkC,CAapD,OAZI,GAAS,KACL,CAAC,GAGL,GAAO,UAAY,OACtB,AAGC,EAAM,SAHH,MAAM,QAAQ,EAAM,QAAQ,EACdC,EAAAA,SAAS,gBAAgB,EAAM,UAAY,CAAC,CAAC,EAE7CA,EAAAA,SAAS,gBAAgB,CAAC,EAAM,QAAQ,CAAC,GAIrD,EAAM,UAAY,CAAC,EAC3B,QAEmB,KAAA,SAAA,GAA2B,GAC7C,EAAa,EAAM,CAAM,SAEN,KAAA,UAAA,GAA2B,GAAe,CACzD,GAAS,OACT,OAAO,GAAO,OAAS,WAC1B,EAAM,OAAA,EAAQC,EAAAA,cAAAA,CAAc,CAAC,EAAM,KAAK,CAAC,GAG1C,EAAa,EAAM,CAAqB,EACxC,EAAK,QAAQ,GAAG,EAAQ,YAAY,CAAK,CAAC,EAC3C,EAEA,YAAY,EAAmC,EAAwB,CACtE,MAAM,CAAI,EACV,KAAK,IAAI,CAAC,EAAQ,UAAU,CAAM,CAAC,CAAC,CACrC,CACD,EAEA,SAAgB,EAAI,EAAW,EAAsB,EAAU,CAK9D,OAJI,OAAO,GAAS,WACZ,IAAI,EAAK,CAAK,EAGfC,EAAAA,GAAG,CAAI,CAAC,CAAC,IAAI,CAAC,EAAQ,UAAU,CAAK,CAAC,CAAC,CAC/C,CAEA,MAAa,EAAO,EAEpB,SAAgB,EAAY,GAAG,EAAuC,CACrE,IAAM,EAAO,SAAS,uBAAuB,EACvC,EAAQF,EAAAA,SAAS,gBAAgB,CAAQ,EAC/C,IAAK,IAAM,KAAQ,EAAO,EAAK,YAAY,CAAI,EAC/C,OAAO,CACR,CACA,MAAa,EAAW,EAEX,GACZ,EACA,EACA,EACA,EACA,EACA,IAEO,EAAI,EAAM,EAAO,CAAG"}
@@ -12,7 +12,7 @@ declare global {
12
12
  }
13
13
  }
14
14
  declare function dodoJsxApply(dodo: Dodo, update?: DodoJsxProps): void;
15
- declare class DodoJSX extends Dodo {
15
+ declare class DodoJsx extends Dodo {
16
16
  static getChildren(props?: DodoJsxSource): ChildList;
17
17
  static useProps: (update?: DodoJsxProps) => (dodo: Dodo) => void;
18
18
  static useSource: (props?: DodoJsxSource) => (dodo: Dodo) => void;
@@ -24,5 +24,5 @@ declare function JsxFragment(...children: ChildList): DocumentFragment;
24
24
  declare const Fragment: typeof JsxFragment;
25
25
  declare const jsxDEV: (type: any, props: DodoJsxProps, key: any, isStatic: any, source: any, self: any) => any;
26
26
  //#endregion
27
- export { DodoJSX, DodoJsxProps, DodoJsxSource, Fragment, JsxFragment, dodoJsxApply, jsx, jsxDEV, jsxs };
27
+ export { DodoJsx, DodoJsxProps, DodoJsxSource, Fragment, JsxFragment, dodoJsxApply, jsx, jsxDEV, jsxs };
28
28
  //# sourceMappingURL=jsx-runtime.d.ts.map
@@ -1,2 +1,2 @@
1
- import{Dodo as e,DodoUtil as t,oo as n}from"../dodo.mjs";import{formatClasses as r}from"@orago/kiwi/utilities";function i(e,t){if(t!=null){e.update(t);for(let n in t){let r=t[n];if(n.startsWith(`on:`)&&typeof r==`function`){let t=n.slice(3).toLowerCase();e.events.on(t,r)}}}}var a=class n extends e{static getChildren(e){return e==null?[]:(e?.children!=null&&(e.children=Array.isArray(e.children)?t.flattenElements(e.children??[]):t.flattenElements([e.children])),e.children??[])}static{this.useProps=e=>t=>i(t,e)}static{this.useSource=e=>t=>{e!=null&&(typeof e?.class==`string`&&(e.class=r([e.class])),i(t,e),t.content(...n.getChildren(e)))}}constructor(e,t){super(e),this.use([n.useSource(t)])}};function o(e,t,r){return typeof e==`function`?new e(t):n(e).use([a.useSource(t)])}const s=o;function c(...e){let n=document.createDocumentFragment(),r=t.flattenElements(e);for(let e of r)n.appendChild(e);return n}const l=c,u=(e,t,n,r,i,a)=>o(e,t,n);export{a as DodoJSX,l as Fragment,c as JsxFragment,i as dodoJsxApply,o as jsx,u as jsxDEV,s as jsxs};
1
+ import{Dodo as e,DodoUtil as t,oo as n}from"../dodo.mjs";import{formatClasses as r}from"@orago/kiwi/utilities";function i(e,t){if(t!=null){e.update(t);for(let n in t){let r=t[n];if(n.startsWith(`on:`)&&typeof r==`function`){let t=n.slice(3).toLowerCase();e.events.on(t,r)}}}}var a=class n extends e{static getChildren(e){return e==null?[]:(e?.children!=null&&(e.children=Array.isArray(e.children)?t.flattenElements(e.children??[]):t.flattenElements([e.children])),e.children??[])}static{this.useProps=e=>t=>i(t,e)}static{this.useSource=e=>t=>{e!=null&&(typeof e?.class==`string`&&(e.class=r([e.class])),i(t,e),t.content(...n.getChildren(e)))}}constructor(e,t){super(e),this.use([n.useSource(t)])}};function o(e,t,r){return typeof e==`function`?new e(t):n(e).use([a.useSource(t)])}const s=o;function c(...e){let n=document.createDocumentFragment(),r=t.flattenElements(e);for(let e of r)n.appendChild(e);return n}const l=c,u=(e,t,n,r,i,a)=>o(e,t,n);export{a as DodoJsx,l as Fragment,c as JsxFragment,i as dodoJsxApply,o as jsx,u as jsxDEV,s as jsxs};
2
2
  //# sourceMappingURL=jsx-runtime.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsx-runtime.mjs","names":[],"sources":["../../src/util/jsx-runtime.ts"],"sourcesContent":["// polyfill for jsx\r\nimport { formatClasses } from \"@orago/kiwi/utilities\";\r\nimport {\r\n\tAppendable,\r\n\tChildList,\r\n\tDodo,\r\n\tDodoUpdate,\r\n\tDodoUtil,\r\n\too,\r\n} from \"../dodo.js\";\r\n\r\nexport type DodoJsxProps = DodoUpdate & {\r\n\t[K in keyof HTMLElementEventMap as `on:${K}`]?: (\r\n\t\tthis: Dodo,\r\n\t\tev: HTMLElementEventMap[K],\r\n\t) => any;\r\n};\r\n\r\nexport type DodoJsxSource =\r\n\t| (Omit<DodoJsxProps, \"class\"> & {\r\n\t\t\tchildren?: Appendable | ChildList;\r\n\t\t\tclass?: string | string[];\r\n\t })\r\n\t| undefined;\r\n\r\ndeclare global {\r\n\tnamespace JSX {\r\n\t\texport type Element = ReturnType<typeof oo>;\r\n\t\texport type IntrinsicElements = {\r\n\t\t\t[K in keyof HTMLElementTagNameMap]: DodoJsxSource;\r\n\t\t};\r\n\t}\r\n}\r\n\r\nexport function dodoJsxApply(dodo: Dodo, update?: DodoJsxProps) {\r\n\tif (update == undefined) return;\r\n\tdodo.update(update);\r\n\r\n\tconst on_pre: string = \"on:\";\r\n\tfor (const key in update) {\r\n\t\tconst p = update[key as keyof typeof update];\r\n\t\tif (key.startsWith(on_pre) && typeof p === \"function\") {\r\n\t\t\tconst event = key.slice(on_pre.length).toLowerCase();\r\n\t\t\tdodo.events.on(event, p as EventListener);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport class DodoJSX extends Dodo {\r\n\tstatic getChildren(props?: DodoJsxSource): ChildList {\r\n\t\tif (props == undefined) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\r\n\t\tif (props?.children != undefined) {\r\n\t\t\tif (Array.isArray(props.children)) {\r\n\t\t\t\tprops.children = DodoUtil.flattenElements(props.children ?? []);\r\n\t\t\t} else {\r\n\t\t\t\tprops.children = DodoUtil.flattenElements([props.children]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn props.children ?? [];\r\n\t}\r\n\r\n\tstatic useProps = (update?: DodoJsxProps) => (dodo: Dodo) =>\r\n\t\tdodoJsxApply(dodo, update);\r\n\r\n\tstatic useSource = (props?: DodoJsxSource) => (dodo: Dodo) => {\r\n\t\tif (props == undefined) return;\r\n\t\tif (typeof props?.class == \"string\") {\r\n\t\t\tprops.class = formatClasses([props.class]);\r\n\t\t}\r\n\r\n\t\tdodoJsxApply(dodo, props as DodoJsxProps);\r\n\t\tdodo.content(...DodoJSX.getChildren(props));\r\n\t};\r\n\r\n\tconstructor(type: keyof HTMLElementTagNameMap, source?: DodoJsxSource) {\r\n\t\tsuper(type);\r\n\t\tthis.use([DodoJSX.useSource(source)]);\r\n\t}\r\n}\r\n\r\nexport function jsx(type: any, props: DodoJsxSource, key: any) {\r\n\tif (typeof type === \"function\") {\r\n\t\treturn new type(props);\r\n\t}\r\n\r\n\treturn oo(type).use([DodoJSX.useSource(props)]);\r\n}\r\n\r\nexport const jsxs = jsx;\r\n\r\nexport function JsxFragment(...children: ChildList): DocumentFragment {\r\n\tconst frag = document.createDocumentFragment();\r\n\tconst items = DodoUtil.flattenElements(children);\r\n\tfor (const item of items) frag.appendChild(item);\r\n\treturn frag;\r\n}\r\nexport const Fragment = JsxFragment;\r\n\r\nexport const jsxDEV = (\r\n\ttype: any,\r\n\tprops: DodoJsxProps,\r\n\tkey: any,\r\n\tisStatic: any,\r\n\tsource: any,\r\n\tself: any,\r\n) => {\r\n\treturn jsx(type, props, key);\r\n};\r\n"],"mappings":"+GAkCA,SAAgB,EAAa,EAAY,EAAuB,CAC3D,MAAU,KACd,GAAK,OAAO,CAAM,EAGlB,IAAK,IAAM,KAAO,EAAQ,CACzB,IAAM,EAAI,EAAO,GACjB,GAAI,EAAI,WAAW,KAAM,GAAK,OAAO,GAAM,WAAY,CACtD,IAAM,EAAQ,EAAI,MAAM,CAAa,CAAC,CAAC,YAAY,EACnD,EAAK,OAAO,GAAG,EAAO,CAAkB,CACzC,CACD,CATkB,CAUnB,CAEA,IAAa,EAAb,MAAa,UAAgB,CAAK,CACjC,OAAO,YAAY,EAAkC,CAapD,OAZI,GAAS,KACL,CAAC,GAGL,GAAO,UAAY,OACtB,AAGC,EAAM,SAHH,MAAM,QAAQ,EAAM,QAAQ,EACd,EAAS,gBAAgB,EAAM,UAAY,CAAC,CAAC,EAE7C,EAAS,gBAAgB,CAAC,EAAM,QAAQ,CAAC,GAIrD,EAAM,UAAY,CAAC,EAC3B,QAEmB,KAAA,SAAA,GAA2B,GAC7C,EAAa,EAAM,CAAM,SAEN,KAAA,UAAA,GAA2B,GAAe,CACzD,GAAS,OACT,OAAO,GAAO,OAAS,WAC1B,EAAM,MAAQ,EAAc,CAAC,EAAM,KAAK,CAAC,GAG1C,EAAa,EAAM,CAAqB,EACxC,EAAK,QAAQ,GAAG,EAAQ,YAAY,CAAK,CAAC,EAC3C,EAEA,YAAY,EAAmC,EAAwB,CACtE,MAAM,CAAI,EACV,KAAK,IAAI,CAAC,EAAQ,UAAU,CAAM,CAAC,CAAC,CACrC,CACD,EAEA,SAAgB,EAAI,EAAW,EAAsB,EAAU,CAK9D,OAJI,OAAO,GAAS,WACZ,IAAI,EAAK,CAAK,EAGf,EAAG,CAAI,CAAC,CAAC,IAAI,CAAC,EAAQ,UAAU,CAAK,CAAC,CAAC,CAC/C,CAEA,MAAa,EAAO,EAEpB,SAAgB,EAAY,GAAG,EAAuC,CACrE,IAAM,EAAO,SAAS,uBAAuB,EACvC,EAAQ,EAAS,gBAAgB,CAAQ,EAC/C,IAAK,IAAM,KAAQ,EAAO,EAAK,YAAY,CAAI,EAC/C,OAAO,CACR,CACA,MAAa,EAAW,EAEX,GACZ,EACA,EACA,EACA,EACA,EACA,IAEO,EAAI,EAAM,EAAO,CAAG"}
1
+ {"version":3,"file":"jsx-runtime.mjs","names":[],"sources":["../../src/util/jsx-runtime.ts"],"sourcesContent":["// polyfill for jsx\r\nimport { formatClasses } from \"@orago/kiwi/utilities\";\r\nimport {\r\n\tAppendable,\r\n\tChildList,\r\n\tDodo,\r\n\tDodoUpdate,\r\n\tDodoUtil,\r\n\too,\r\n} from \"../dodo.js\";\r\n\r\nexport type DodoJsxProps = DodoUpdate & {\r\n\t[K in keyof HTMLElementEventMap as `on:${K}`]?: (\r\n\t\tthis: Dodo,\r\n\t\tev: HTMLElementEventMap[K],\r\n\t) => any;\r\n};\r\n\r\nexport type DodoJsxSource =\r\n\t| (Omit<DodoJsxProps, \"class\"> & {\r\n\t\t\tchildren?: Appendable | ChildList;\r\n\t\t\tclass?: string | string[];\r\n\t })\r\n\t| undefined;\r\n\r\ndeclare global {\r\n\tnamespace JSX {\r\n\t\texport type Element = ReturnType<typeof oo>;\r\n\t\texport type IntrinsicElements = {\r\n\t\t\t[K in keyof HTMLElementTagNameMap]: DodoJsxSource;\r\n\t\t};\r\n\t}\r\n}\r\n\r\nexport function dodoJsxApply(dodo: Dodo, update?: DodoJsxProps) {\r\n\tif (update == undefined) return;\r\n\tdodo.update(update);\r\n\r\n\tconst on_pre: string = \"on:\";\r\n\tfor (const key in update) {\r\n\t\tconst p = update[key as keyof typeof update];\r\n\t\tif (key.startsWith(on_pre) && typeof p === \"function\") {\r\n\t\t\tconst event = key.slice(on_pre.length).toLowerCase();\r\n\t\t\tdodo.events.on(event, p as EventListener);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nexport class DodoJsx extends Dodo {\r\n\tstatic getChildren(props?: DodoJsxSource): ChildList {\r\n\t\tif (props == undefined) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\r\n\t\tif (props?.children != undefined) {\r\n\t\t\tif (Array.isArray(props.children)) {\r\n\t\t\t\tprops.children = DodoUtil.flattenElements(props.children ?? []);\r\n\t\t\t} else {\r\n\t\t\t\tprops.children = DodoUtil.flattenElements([props.children]);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn props.children ?? [];\r\n\t}\r\n\r\n\tstatic useProps = (update?: DodoJsxProps) => (dodo: Dodo) =>\r\n\t\tdodoJsxApply(dodo, update);\r\n\r\n\tstatic useSource = (props?: DodoJsxSource) => (dodo: Dodo) => {\r\n\t\tif (props == undefined) return;\r\n\t\tif (typeof props?.class == \"string\") {\r\n\t\t\tprops.class = formatClasses([props.class]);\r\n\t\t}\r\n\r\n\t\tdodoJsxApply(dodo, props as DodoJsxProps);\r\n\t\tdodo.content(...DodoJsx.getChildren(props));\r\n\t};\r\n\r\n\tconstructor(type: keyof HTMLElementTagNameMap, source?: DodoJsxSource) {\r\n\t\tsuper(type);\r\n\t\tthis.use([DodoJsx.useSource(source)]);\r\n\t}\r\n}\r\n\r\nexport function jsx(type: any, props: DodoJsxSource, key: any) {\r\n\tif (typeof type === \"function\") {\r\n\t\treturn new type(props);\r\n\t}\r\n\r\n\treturn oo(type).use([DodoJsx.useSource(props)]);\r\n}\r\n\r\nexport const jsxs = jsx;\r\n\r\nexport function JsxFragment(...children: ChildList): DocumentFragment {\r\n\tconst frag = document.createDocumentFragment();\r\n\tconst items = DodoUtil.flattenElements(children);\r\n\tfor (const item of items) frag.appendChild(item);\r\n\treturn frag;\r\n}\r\nexport const Fragment = JsxFragment;\r\n\r\nexport const jsxDEV = (\r\n\ttype: any,\r\n\tprops: DodoJsxProps,\r\n\tkey: any,\r\n\tisStatic: any,\r\n\tsource: any,\r\n\tself: any,\r\n) => {\r\n\treturn jsx(type, props, key);\r\n};\r\n"],"mappings":"+GAkCA,SAAgB,EAAa,EAAY,EAAuB,CAC3D,MAAU,KACd,GAAK,OAAO,CAAM,EAGlB,IAAK,IAAM,KAAO,EAAQ,CACzB,IAAM,EAAI,EAAO,GACjB,GAAI,EAAI,WAAW,KAAM,GAAK,OAAO,GAAM,WAAY,CACtD,IAAM,EAAQ,EAAI,MAAM,CAAa,CAAC,CAAC,YAAY,EACnD,EAAK,OAAO,GAAG,EAAO,CAAkB,CACzC,CACD,CATkB,CAUnB,CAEA,IAAa,EAAb,MAAa,UAAgB,CAAK,CACjC,OAAO,YAAY,EAAkC,CAapD,OAZI,GAAS,KACL,CAAC,GAGL,GAAO,UAAY,OACtB,AAGC,EAAM,SAHH,MAAM,QAAQ,EAAM,QAAQ,EACd,EAAS,gBAAgB,EAAM,UAAY,CAAC,CAAC,EAE7C,EAAS,gBAAgB,CAAC,EAAM,QAAQ,CAAC,GAIrD,EAAM,UAAY,CAAC,EAC3B,QAEmB,KAAA,SAAA,GAA2B,GAC7C,EAAa,EAAM,CAAM,SAEN,KAAA,UAAA,GAA2B,GAAe,CACzD,GAAS,OACT,OAAO,GAAO,OAAS,WAC1B,EAAM,MAAQ,EAAc,CAAC,EAAM,KAAK,CAAC,GAG1C,EAAa,EAAM,CAAqB,EACxC,EAAK,QAAQ,GAAG,EAAQ,YAAY,CAAK,CAAC,EAC3C,EAEA,YAAY,EAAmC,EAAwB,CACtE,MAAM,CAAI,EACV,KAAK,IAAI,CAAC,EAAQ,UAAU,CAAM,CAAC,CAAC,CACrC,CACD,EAEA,SAAgB,EAAI,EAAW,EAAsB,EAAU,CAK9D,OAJI,OAAO,GAAS,WACZ,IAAI,EAAK,CAAK,EAGf,EAAG,CAAI,CAAC,CAAC,IAAI,CAAC,EAAQ,UAAU,CAAK,CAAC,CAAC,CAC/C,CAEA,MAAa,EAAO,EAEpB,SAAgB,EAAY,GAAG,EAAuC,CACrE,IAAM,EAAO,SAAS,uBAAuB,EACvC,EAAQ,EAAS,gBAAgB,CAAQ,EAC/C,IAAK,IAAM,KAAQ,EAAO,EAAK,YAAY,CAAI,EAC/C,OAAO,CACR,CACA,MAAa,EAAW,EAEX,GACZ,EACA,EACA,EACA,EACA,EACA,IAEO,EAAI,EAAM,EAAO,CAAG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orago/dodo",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "Dear Orago's Dom Objects",
5
5
  "main": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -46,7 +46,7 @@ export function dodoJsxApply(dodo: Dodo, update?: DodoJsxProps) {
46
46
  }
47
47
  }
48
48
 
49
- export class DodoJSX extends Dodo {
49
+ export class DodoJsx extends Dodo {
50
50
  static getChildren(props?: DodoJsxSource): ChildList {
51
51
  if (props == undefined) {
52
52
  return [];
@@ -73,12 +73,12 @@ export class DodoJSX extends Dodo {
73
73
  }
74
74
 
75
75
  dodoJsxApply(dodo, props as DodoJsxProps);
76
- dodo.content(...DodoJSX.getChildren(props));
76
+ dodo.content(...DodoJsx.getChildren(props));
77
77
  };
78
78
 
79
79
  constructor(type: keyof HTMLElementTagNameMap, source?: DodoJsxSource) {
80
80
  super(type);
81
- this.use([DodoJSX.useSource(source)]);
81
+ this.use([DodoJsx.useSource(source)]);
82
82
  }
83
83
  }
84
84
 
@@ -87,7 +87,7 @@ export function jsx(type: any, props: DodoJsxSource, key: any) {
87
87
  return new type(props);
88
88
  }
89
89
 
90
- return oo(type).use([DodoJSX.useSource(props)]);
90
+ return oo(type).use([DodoJsx.useSource(props)]);
91
91
  }
92
92
 
93
93
  export const jsxs = jsx;