defuss 1.2.0 → 1.2.2

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.
@@ -1231,5 +1231,7 @@ declare const jsx: (type: VNodeType | Function | any, attributes: (JSX.HTMLAttri
1231
1231
  declare const getRenderer: (document: Document) => DomAbstractionImpl;
1232
1232
  declare const renderIsomorphic: (virtualNode: VNode | undefined | string | Array<VNode | undefined | string>, parentDomElement: Element | Document | Dequery | undefined, globals: Globals) => Array<Element | Text | undefined> | Element | Text | undefined;
1233
1233
  declare const Fragment: (props: VNode) => VNodeChildren | undefined;
1234
+ declare const jsxs: (type: VNodeType | Function | any, attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null, ...children: Array<VNodeChildren> | VNodeChildren) => Array<VNode> | VNode;
1235
+ declare const jsxDEV: (type: VNodeType | Function | any, attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null, ...children: Array<VNodeChildren> | VNodeChildren) => Array<VNode> | VNode;
1234
1236
 
1235
- export { type CSSProperties as C, type Dequery as D, type FontFaceProperties as F, type Globals as G, type KeyFrameProperties as K, type Props as P, type RenderInput as R, type UpdateFn as U, type VRef as V, type RenderResult as a, type Ref as b, type VAttributes as c, type VNodeAttributes as d, type VNode as e, type VNodeType as f, type VNodeKey as g, type VNodeRefObject as h, type VNodeRefCallback as i, type VNodeRef as j, type VNodeChild as k, type VNodeChildren as l, type Children as m, type DomAbstractionImpl as n, type RenderNodeInput as o, type RenderResultNode as p, jsx as q, getRenderer as r, renderIsomorphic as s, Fragment as t };
1237
+ export { type CSSProperties as C, type Dequery as D, type FontFaceProperties as F, type Globals as G, type KeyFrameProperties as K, type Props as P, type RenderInput as R, type UpdateFn as U, type VRef as V, type RenderResult as a, type Ref as b, type VAttributes as c, type VNodeAttributes as d, type VNode as e, type VNodeType as f, type VNodeKey as g, type VNodeRefObject as h, type VNodeRefCallback as i, type VNodeRef as j, type VNodeChild as k, type VNodeChildren as l, type Children as m, type DomAbstractionImpl as n, type RenderNodeInput as o, type RenderResultNode as p, jsx as q, getRenderer as r, renderIsomorphic as s, Fragment as t, jsxs as u, jsxDEV as v };
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var l=Object.defineProperty;var n=(t,e)=>l(t,"name",{value:e,configurable:!0});var o=require("./render/index.cjs");const g=n((t,e)=>{t.classList.contains(e)||t.classList.add(e)},"addSingleClass"),f=n((t,e)=>r=>{if(Array.isArray(r))for(let s=0;s<r.length;s++)g(t,r[s]);else g(t,r);return e},"addClass"),u=n((t,e)=>{t.classList.contains(e)&&t.classList.remove(e)},"removeSingleClass"),h=n((t,e)=>r=>{if(Array.isArray(r))for(let s=0;s<r.length;s++)u(t,r[s]);else u(t,r);return e},"removeClass"),p=n((t,e)=>r=>(t.classList.toggle(r),e),"toggleClass"),m=n(t=>e=>t.classList.contains(e),"hasClass"),v=n((t,e)=>(r,s)=>typeof s>"u"?t.getAttribute(r):(t.setAttribute(r,s),e),"attr"),w=n((t,e)=>r=>{const s=t.type==="checkbox";return typeof r>"u"?s?t.checked:t.value:(s?t.checked=r:t.value=r,e)},"val"),d=n((t,e)=>()=>(t.innerHTML="",e),"empty"),y=n((t,e)=>r=>(typeof r=="string"?t.innerHTML=r:(d(t,e)(),t.appendChild(o.renderIsomorphic(r,t,globalThis))),e),"html"),C=n((t,e)=>r=>(t.textContent=r,e),"text"),S=n((t,e)=>()=>(t.parentNode&&t.parentNode.removeChild(t),e),"remove"),I=n(t=>e=>{let r=e;return e instanceof Node||(r=o.renderIsomorphic(e,t,globalThis)),t.parentNode&&t.parentNode.replaceChild(r,t),r},"replaceWith"),b=n((t,e)=>(r,s)=>(t.removeEventListener(r,s),e),"off"),x=n((t,e)=>(r,s)=>(t.addEventListener(r,s),e),"on"),A=n(t=>{let e={},r=t?.current||t;return typeof t=="string"&&(r=document.querySelector(t)),e={el:r,attr:v(r,e),val:w(r,e),empty:d(r,e),html:y(r,e),text:C(r,e),remove:S(r,e),replaceWith:I(r),addClass:f(r,e),removeClass:h(r,e),toggleClass:p(r,e),hasClass:m(r),on:x(r,e),off:b(r,e)},e},"$"),L=n(()=>{const t=new Map;return{clear:n(()=>{t.clear()},"clear"),getItem:n(e=>t.get(String(e))??null,"getItem"),removeItem:n(e=>{t.delete(String(e))},"removeItem"),setItem:n((e,r)=>{t.set(String(e),r)},"setItem")}},"newInMemoryGenericStorageBackend"),P=L();class i{static{n(this,"WebStorageProvider")}storage;constructor(e){this.storage=e||P}get(e,r,s){const a=this.storage.getItem(e);if(a===null)return r;let c=JSON.parse(a);return s&&(c=s(e,c)),c}set(e,r,s){s&&(r=s(e,r)),this.storage.setItem(e,JSON.stringify(r))}remove(e){this.storage.removeItem(e)}removeAll(){this.storage.clear()}get backendApi(){return this.storage}}const k=n((t,e)=>{switch(t){case"session":return new i(window.sessionStorage);case"local":return new i(window.localStorage)}return new i},"getPersistenceProvider$1"),E=n((t,e)=>new i,"getPersistenceProvider"),W=n(()=>typeof window>"u"||typeof window.document>"u","isServer"),_=n((t="local",e)=>W()?E():k(t),"cache");exports.Fragment=o.Fragment,exports.getRenderer=o.getRenderer,exports.jsx=o.jsx,exports.renderIsomorphic=o.renderIsomorphic,exports.$=A,exports.cache=_;
1
+ "use strict";var l=Object.defineProperty;var n=(t,e)=>l(t,"name",{value:e,configurable:!0});var o=require("./render/index.cjs");const g=n((t,e)=>{t.classList.contains(e)||t.classList.add(e)},"addSingleClass"),f=n((t,e)=>r=>{if(Array.isArray(r))for(let s=0;s<r.length;s++)g(t,r[s]);else g(t,r);return e},"addClass"),u=n((t,e)=>{t.classList.contains(e)&&t.classList.remove(e)},"removeSingleClass"),h=n((t,e)=>r=>{if(Array.isArray(r))for(let s=0;s<r.length;s++)u(t,r[s]);else u(t,r);return e},"removeClass"),p=n((t,e)=>r=>(t.classList.toggle(r),e),"toggleClass"),m=n(t=>e=>t.classList.contains(e),"hasClass"),v=n((t,e)=>(r,s)=>typeof s>"u"?t.getAttribute(r):(t.setAttribute(r,s),e),"attr"),w=n((t,e)=>r=>{const s=t.type==="checkbox";return typeof r>"u"?s?t.checked:t.value:(s?t.checked=r:t.value=r,e)},"val"),d=n((t,e)=>()=>(t.innerHTML="",e),"empty"),y=n((t,e)=>r=>(typeof r=="string"?t.innerHTML=r:(d(t,e)(),t.appendChild(o.renderIsomorphic(r,t,globalThis))),e),"html"),C=n((t,e)=>r=>(t.textContent=r,e),"text"),S=n((t,e)=>()=>(t.parentNode&&t.parentNode.removeChild(t),e),"remove"),x=n(t=>e=>{let r=e;return e instanceof Node||(r=o.renderIsomorphic(e,t,globalThis)),t.parentNode&&t.parentNode.replaceChild(r,t),r},"replaceWith"),I=n((t,e)=>(r,s)=>(t.removeEventListener(r,s),e),"off"),b=n((t,e)=>(r,s)=>(t.addEventListener(r,s),e),"on"),A=n(t=>{let e={},r=t?.current||t;return typeof t=="string"&&(r=document.querySelector(t)),e={el:r,attr:v(r,e),val:w(r,e),empty:d(r,e),html:y(r,e),text:C(r,e),remove:S(r,e),replaceWith:x(r),addClass:f(r,e),removeClass:h(r,e),toggleClass:p(r,e),hasClass:m(r),on:b(r,e),off:I(r,e)},e},"$"),L=n(()=>{const t=new Map;return{clear:n(()=>{t.clear()},"clear"),getItem:n(e=>t.get(String(e))??null,"getItem"),removeItem:n(e=>{t.delete(String(e))},"removeItem"),setItem:n((e,r)=>{t.set(String(e),r)},"setItem")}},"newInMemoryGenericStorageBackend"),j=L();class i{static{n(this,"WebStorageProvider")}storage;constructor(e){this.storage=e||j}get(e,r,s){const a=this.storage.getItem(e);if(a===null)return r;let c=JSON.parse(a);return s&&(c=s(e,c)),c}set(e,r,s){s&&(r=s(e,r)),this.storage.setItem(e,JSON.stringify(r))}remove(e){this.storage.removeItem(e)}removeAll(){this.storage.clear()}get backendApi(){return this.storage}}const E=n((t,e)=>{switch(t){case"session":return new i(window.sessionStorage);case"local":return new i(window.localStorage)}return new i},"getPersistenceProvider$1"),P=n((t,e)=>new i,"getPersistenceProvider"),k=n(()=>typeof window>"u"||typeof window.document>"u","isServer"),V=n((t="local",e)=>k()?P():E(t),"cache");exports.Fragment=o.Fragment,exports.getRenderer=o.getRenderer,exports.jsx=o.jsx,exports.jsxDEV=o.jsxDEV,exports.jsxs=o.jsxs,exports.renderIsomorphic=o.renderIsomorphic,exports.$=A,exports.cache=V;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/dequery/css.ts","../src/dequery/dom.ts","../src/dequery/query.ts","../src/cache/isomporphic/memory.ts","../src/cache/client/index.ts","../src/cache/server/index.ts","../src/cache/runtime.ts","../src/cache/index.ts"],"sourcesContent":["import type { Dequery } from \"./types.js\";\n\nexport const addSingleClass = (el: Element, className: string) => {\n if (!el.classList.contains(className)) {\n el.classList.add(className);\n }\n};\n\nexport const addClass = (el: Element, impl: Dequery) => (className: Array<string> | string) => {\n if (Array.isArray(className)) {\n for (let i = 0; i < className.length; i++) {\n addSingleClass(el, className[i]);\n }\n } else {\n addSingleClass(el, className);\n }\n return impl;\n};\n\nexport const removeSingleClass = (el: Element, className: string) => {\n if (el.classList.contains(className)) {\n el.classList.remove(className);\n }\n};\n\nexport const removeClass = (el: Element, impl: Dequery) => (className: Array<string> | string) => {\n if (Array.isArray(className)) {\n for (let i = 0; i < className.length; i++) {\n removeSingleClass(el, className[i]);\n }\n } else {\n removeSingleClass(el, className);\n }\n return impl;\n};\n\nexport const toggleClass = (el: Element, impl: Dequery) => (className: string) => {\n el.classList.toggle(className);\n return impl;\n};\n\nexport const hasClass = (el: Element) => (className: string) => el.classList.contains(className);","import { renderIsomorphic, type Globals } from \"../render/index.js\";\nimport type { RenderInput } from \"../render/types.js\";\nimport type { Dequery } from \"./types.js\";\n\nexport const attr = (el: Element, impl: Dequery) => (name: string, value?: any) => {\n if (typeof value === 'undefined') return el.getAttribute(name);\n el.setAttribute(name, value);\n return impl;\n};\n\nexport const val = (el: Element, impl: Dequery) => (value?: any) => {\n const isCheckbox = (el as any).type === 'checkbox';\n if (typeof value === 'undefined') {\n return isCheckbox ? (el as any).checked : (el as any).value;\n }\n if (isCheckbox) {\n (el as any).checked = value;\n } else {\n (el as any).value = value;\n }\n return impl;\n};\n\nexport const empty = (el: Element, impl: Dequery) => () => {\n el.innerHTML = '';\n return impl;\n};\n\nexport const html = (el: Element, impl: Dequery) => (vdomOrHTML: RenderInput|string) => {\n\n if (typeof vdomOrHTML === 'string') {\n el.innerHTML = vdomOrHTML;\n } else {\n // remove all children\n empty(el, impl)();\n el.appendChild(renderIsomorphic(vdomOrHTML, el, globalThis as Globals) as Node);\n }\n return impl;\n};\n\nexport const text = (el: Element, impl: Dequery) => (text: string) => {\n el.textContent = text;\n return impl;\n};\n\nexport const remove = (el: Element, impl: Dequery) => () => {\n if (el.parentNode) el.parentNode.removeChild(el);\n return impl;\n};\n\nexport const replaceWith = (el: Element) => (vdomOrNode: RenderInput|Node) => {\n\n // assume it's a Node\n let newEl: Node = vdomOrNode as Node;\n\n // but if it's not, lets construct one from VDOM\n if (!(vdomOrNode instanceof Node)) {\n newEl = renderIsomorphic(vdomOrNode, el, globalThis as Globals) as Node;\n }\n\n // replace the old element with the new one\n if (el.parentNode) {\n el.parentNode.replaceChild(newEl, el);\n }\n return newEl;\n};\n\nexport const off = (target: Element | Window, impl: Dequery) => (eventName: string, handler: EventListener) => {\n target.removeEventListener(eventName, handler);\n return impl;\n};\n\nexport const on = (target: Element | Window, impl: Dequery) => (eventName: string, handler: EventListener) => {\n target.addEventListener(eventName, handler);\n return impl;\n};","import type { Ref } from \"../render/types.js\";\nimport { addClass, hasClass, removeClass, toggleClass } from \"./css.js\";\nimport { attr, val, empty, html, remove, replaceWith, on, off, text } from \"./dom.js\";\nimport type { Dequery } from \"./types.js\";\n\nexport const $ = (elOrRef: Element|Ref|string): Dequery => {\n\n let impl: Dequery = {} as Dequery;\n\n // unwrap the Ref's current value if it exists\n let el: Element = (elOrRef as Ref)?.current || elOrRef;\n\n // if it's a string, assume it's a selector\n if (typeof elOrRef === 'string') {\n el = document.querySelector(elOrRef) as Element;\n }\n\n impl = {\n el,\n attr: attr(el, impl),\n val: val(el, impl),\n empty: empty(el, impl),\n html: html(el, impl),\n text: text(el, impl),\n remove: remove(el, impl),\n replaceWith: replaceWith(el),\n addClass: addClass(el, impl),\n removeClass: removeClass(el, impl),\n toggleClass: toggleClass(el, impl),\n hasClass: hasClass(el),\n on: on(el, impl),\n off: off(el, impl),\n };\n return impl;\n};","import type { PersistenceProviderImpl } from '../provider.js'\nimport type { GenericLocalStorage } from './generic.js'\nimport type { MiddlewareFn } from '../provider.js'\n\nexport type MemoryProviderOptions = {}\n\nexport const newInMemoryGenericStorageBackend = <T = string>(): GenericLocalStorage<T> => {\n const cache = new Map<string, T>()\n return {\n clear: (): void => {\n cache.clear()\n },\n\n getItem: (key: string): T | null => {\n return cache.get(String(key)) ?? null\n },\n\n removeItem: (key: string): void => {\n cache.delete(String(key))\n },\n\n setItem: (key: string, value: T): void => {\n cache.set(String(key), value)\n },\n }\n}\n\n/** global in-memory storage backend */\nexport const memory = newInMemoryGenericStorageBackend()\n\n/** a simple, serverless and high-performance key/value storage engine */\nexport class WebStorageProvider<T> implements PersistenceProviderImpl<T> {\n protected storage: GenericLocalStorage<string>;\n\n constructor(storage?: GenericLocalStorage<string>) {\n this.storage = storage || memory;\n }\n\n get(key: string, defaultValue: T, middlewareFn?: MiddlewareFn<T>): T {\n const rawValue = this.storage.getItem(key);\n\n if (rawValue === null) return defaultValue;\n\n let value: T = JSON.parse(rawValue);\n\n if (middlewareFn) {\n value = middlewareFn(key, value);\n }\n return value;\n }\n\n set(key: string, value: T, middlewareFn?: MiddlewareFn<T>): void {\n if (middlewareFn) {\n value = middlewareFn(key, value);\n }\n this.storage.setItem(key, JSON.stringify(value));\n }\n\n remove(key: string): void {\n this.storage.removeItem(key);\n }\n\n removeAll(): void {\n this.storage.clear();\n }\n\n get backendApi(): GenericLocalStorage<string> {\n return this.storage;\n }\n}\n\nexport interface MemoryStorage<T> extends PersistenceProviderImpl<T> {\n backendApi: Omit<Omit<Storage, 'key'>, 'length'>\n}\n\nexport interface WebStorage<T> extends PersistenceProviderImpl<T> {\n backendApi: Storage\n}\n","import { WebStorageProvider } from '../isomporphic/memory.js'\nimport type { PersistenceProvider, PersistenceProviderImpl, PersistenceProviderOptions } from '../provider.js'\n\n/** returns the default persistence provider for each runtime environment */\nexport const getPersistenceProvider = <T>(\n provider: PersistenceProvider,\n _options?: PersistenceProviderOptions,\n): PersistenceProviderImpl<T> => {\n switch (provider) {\n case 'session':\n return new WebStorageProvider<T>(window.sessionStorage)\n case 'local':\n return new WebStorageProvider<T>(window.localStorage)\n }\n return new WebStorageProvider<T>() // memory\n}\n","import { WebStorageProvider } from '../isomporphic/memory.js'\nimport type { PersistenceProvider, PersistenceProviderImpl, PersistenceProviderOptions } from '../provider.js'\n\n/** returns the default persistence provider for each runtime environment */\nexport const getPersistenceProvider = <T>(\n _provider: PersistenceProvider,\n _options?: PersistenceProviderOptions,\n): PersistenceProviderImpl<T> => {\n return new WebStorageProvider<T>()\n}\n","//export const isBrowser = (): boolean => typeof window !== \"undefined\" && typeof window.document !== \"undefined\";\n\nexport const isServer = (): boolean => typeof window === \"undefined\" || typeof window.document === \"undefined\";\n\n//export const isWebWorker = (): boolean => typeof self === \"object\" && self.constructor?.name === \"DedicatedWorkerGlobalScope\";","import type { PersistenceProvider, PersistenceProviderImpl, PersistenceProviderOptions } from './provider.js'\nimport { getPersistenceProvider as getPersistenceProviderClient } from './client/index.js'\nimport { getPersistenceProvider as getPersistenceProviderServer } from './server/index.js'\nimport { isServer } from './runtime.js'\n\n/** returns the persistence provider (isomorphic) */\nexport const cache = <T>(\n provider: PersistenceProvider = 'local',\n options?: PersistenceProviderOptions,\n): PersistenceProviderImpl<T> => {\n if (isServer()) {\n return getPersistenceProviderServer(provider, options)\n } else {\n return getPersistenceProviderClient(provider, options)\n }\n}\n\nexport * from './provider.js'\n"],"names":["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AC1D;AACA;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/dequery/css.ts","../src/dequery/dom.ts","../src/dequery/query.ts","../src/cache/isomporphic/memory.ts","../src/cache/client/index.ts","../src/cache/server/index.ts","../src/cache/runtime.ts","../src/cache/index.ts"],"sourcesContent":["import type { Dequery } from \"./types.js\";\n\nexport const addSingleClass = (el: Element, className: string) => {\n if (!el.classList.contains(className)) {\n el.classList.add(className);\n }\n};\n\nexport const addClass = (el: Element, impl: Dequery) => (className: Array<string> | string) => {\n if (Array.isArray(className)) {\n for (let i = 0; i < className.length; i++) {\n addSingleClass(el, className[i]);\n }\n } else {\n addSingleClass(el, className);\n }\n return impl;\n};\n\nexport const removeSingleClass = (el: Element, className: string) => {\n if (el.classList.contains(className)) {\n el.classList.remove(className);\n }\n};\n\nexport const removeClass = (el: Element, impl: Dequery) => (className: Array<string> | string) => {\n if (Array.isArray(className)) {\n for (let i = 0; i < className.length; i++) {\n removeSingleClass(el, className[i]);\n }\n } else {\n removeSingleClass(el, className);\n }\n return impl;\n};\n\nexport const toggleClass = (el: Element, impl: Dequery) => (className: string) => {\n el.classList.toggle(className);\n return impl;\n};\n\nexport const hasClass = (el: Element) => (className: string) => el.classList.contains(className);","import { renderIsomorphic, type Globals } from \"../render/index.js\";\nimport type { RenderInput } from \"../render/types.js\";\nimport type { Dequery } from \"./types.js\";\n\nexport const attr = (el: Element, impl: Dequery) => (name: string, value?: any) => {\n if (typeof value === 'undefined') return el.getAttribute(name);\n el.setAttribute(name, value);\n return impl;\n};\n\nexport const val = (el: Element, impl: Dequery) => (value?: any) => {\n const isCheckbox = (el as any).type === 'checkbox';\n if (typeof value === 'undefined') {\n return isCheckbox ? (el as any).checked : (el as any).value;\n }\n if (isCheckbox) {\n (el as any).checked = value;\n } else {\n (el as any).value = value;\n }\n return impl;\n};\n\nexport const empty = (el: Element, impl: Dequery) => () => {\n el.innerHTML = '';\n return impl;\n};\n\nexport const html = (el: Element, impl: Dequery) => (vdomOrHTML: RenderInput|string) => {\n\n if (typeof vdomOrHTML === 'string') {\n el.innerHTML = vdomOrHTML;\n } else {\n // remove all children\n empty(el, impl)();\n el.appendChild(renderIsomorphic(vdomOrHTML, el, globalThis as Globals) as Node);\n }\n return impl;\n};\n\nexport const text = (el: Element, impl: Dequery) => (text: string) => {\n el.textContent = text;\n return impl;\n};\n\nexport const remove = (el: Element, impl: Dequery) => () => {\n if (el.parentNode) el.parentNode.removeChild(el);\n return impl;\n};\n\nexport const replaceWith = (el: Element) => (vdomOrNode: RenderInput|Node) => {\n\n // assume it's a Node\n let newEl: Node = vdomOrNode as Node;\n\n // but if it's not, lets construct one from VDOM\n if (!(vdomOrNode instanceof Node)) {\n newEl = renderIsomorphic(vdomOrNode, el, globalThis as Globals) as Node;\n }\n\n // replace the old element with the new one\n if (el.parentNode) {\n el.parentNode.replaceChild(newEl, el);\n }\n return newEl;\n};\n\nexport const off = (target: Element | Window, impl: Dequery) => (eventName: string, handler: EventListener) => {\n target.removeEventListener(eventName, handler);\n return impl;\n};\n\nexport const on = (target: Element | Window, impl: Dequery) => (eventName: string, handler: EventListener) => {\n target.addEventListener(eventName, handler);\n return impl;\n};","import type { Ref } from \"../render/types.js\";\nimport { addClass, hasClass, removeClass, toggleClass } from \"./css.js\";\nimport { attr, val, empty, html, remove, replaceWith, on, off, text } from \"./dom.js\";\nimport type { Dequery } from \"./types.js\";\n\nexport const $ = (elOrRef: Element|Ref|string): Dequery => {\n\n let impl: Dequery = {} as Dequery;\n\n // unwrap the Ref's current value if it exists\n let el: Element = (elOrRef as Ref)?.current || elOrRef;\n\n // if it's a string, assume it's a selector\n if (typeof elOrRef === 'string') {\n el = document.querySelector(elOrRef) as Element;\n }\n\n impl = {\n el,\n attr: attr(el, impl),\n val: val(el, impl),\n empty: empty(el, impl),\n html: html(el, impl),\n text: text(el, impl),\n remove: remove(el, impl),\n replaceWith: replaceWith(el),\n addClass: addClass(el, impl),\n removeClass: removeClass(el, impl),\n toggleClass: toggleClass(el, impl),\n hasClass: hasClass(el),\n on: on(el, impl),\n off: off(el, impl),\n };\n return impl;\n};","import type { PersistenceProviderImpl } from '../provider.js'\nimport type { GenericLocalStorage } from './generic.js'\nimport type { MiddlewareFn } from '../provider.js'\n\nexport type MemoryProviderOptions = {}\n\nexport const newInMemoryGenericStorageBackend = <T = string>(): GenericLocalStorage<T> => {\n const cache = new Map<string, T>()\n return {\n clear: (): void => {\n cache.clear()\n },\n\n getItem: (key: string): T | null => {\n return cache.get(String(key)) ?? null\n },\n\n removeItem: (key: string): void => {\n cache.delete(String(key))\n },\n\n setItem: (key: string, value: T): void => {\n cache.set(String(key), value)\n },\n }\n}\n\n/** global in-memory storage backend */\nexport const memory = newInMemoryGenericStorageBackend()\n\n/** a simple, serverless and high-performance key/value storage engine */\nexport class WebStorageProvider<T> implements PersistenceProviderImpl<T> {\n protected storage: GenericLocalStorage<string>;\n\n constructor(storage?: GenericLocalStorage<string>) {\n this.storage = storage || memory;\n }\n\n get(key: string, defaultValue: T, middlewareFn?: MiddlewareFn<T>): T {\n const rawValue = this.storage.getItem(key);\n\n if (rawValue === null) return defaultValue;\n\n let value: T = JSON.parse(rawValue);\n\n if (middlewareFn) {\n value = middlewareFn(key, value);\n }\n return value;\n }\n\n set(key: string, value: T, middlewareFn?: MiddlewareFn<T>): void {\n if (middlewareFn) {\n value = middlewareFn(key, value);\n }\n this.storage.setItem(key, JSON.stringify(value));\n }\n\n remove(key: string): void {\n this.storage.removeItem(key);\n }\n\n removeAll(): void {\n this.storage.clear();\n }\n\n get backendApi(): GenericLocalStorage<string> {\n return this.storage;\n }\n}\n\nexport interface MemoryStorage<T> extends PersistenceProviderImpl<T> {\n backendApi: Omit<Omit<Storage, 'key'>, 'length'>\n}\n\nexport interface WebStorage<T> extends PersistenceProviderImpl<T> {\n backendApi: Storage\n}\n","import { WebStorageProvider } from '../isomporphic/memory.js'\nimport type { PersistenceProvider, PersistenceProviderImpl, PersistenceProviderOptions } from '../provider.js'\n\n/** returns the default persistence provider for each runtime environment */\nexport const getPersistenceProvider = <T>(\n provider: PersistenceProvider,\n _options?: PersistenceProviderOptions,\n): PersistenceProviderImpl<T> => {\n switch (provider) {\n case 'session':\n return new WebStorageProvider<T>(window.sessionStorage)\n case 'local':\n return new WebStorageProvider<T>(window.localStorage)\n }\n return new WebStorageProvider<T>() // memory\n}\n","import { WebStorageProvider } from '../isomporphic/memory.js'\nimport type { PersistenceProvider, PersistenceProviderImpl, PersistenceProviderOptions } from '../provider.js'\n\n/** returns the default persistence provider for each runtime environment */\nexport const getPersistenceProvider = <T>(\n _provider: PersistenceProvider,\n _options?: PersistenceProviderOptions,\n): PersistenceProviderImpl<T> => {\n return new WebStorageProvider<T>()\n}\n","//export const isBrowser = (): boolean => typeof window !== \"undefined\" && typeof window.document !== \"undefined\";\n\nexport const isServer = (): boolean => typeof window === \"undefined\" || typeof window.document === \"undefined\";\n\n//export const isWebWorker = (): boolean => typeof self === \"object\" && self.constructor?.name === \"DedicatedWorkerGlobalScope\";","import type { PersistenceProvider, PersistenceProviderImpl, PersistenceProviderOptions } from './provider.js'\nimport { getPersistenceProvider as getPersistenceProviderClient } from './client/index.js'\nimport { getPersistenceProvider as getPersistenceProviderServer } from './server/index.js'\nimport { isServer } from './runtime.js'\n\n/** returns the persistence provider (isomorphic) */\nexport const cache = <T>(\n provider: PersistenceProvider = 'local',\n options?: PersistenceProviderOptions,\n): PersistenceProviderImpl<T> => {\n if (isServer()) {\n return getPersistenceProviderServer(provider, options)\n } else {\n return getPersistenceProviderClient(provider, options)\n }\n}\n\nexport * from './provider.js'\n"],"names":["renderIsomorphic","getPersistenceProvider","getPersistenceProviderServer","getPersistenceProviderClient"],"mappings":";;;;AACO,MAAM,cAAc,GAAG,CAAC,EAAE,EAAE,SAAS,KAAK;AACjD,EAAE,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;AACzC,IAAI,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC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AE,MAAM,CAAC,GAAG,EAAE;AACd,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;AAChC;AACA,EAAE,SAAS,GAAG;AACd,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;AACxB;AACA,EAAE,IAAI,UAAU,GAAG;AACnB,IAAI,OAAO,IAAI,CAAC,OAAO;AACvB;AACA;;AC9CO,MAAMC,wBAAsB,GAAG,CAAC,QAAQ,EAAE,QAAQ,KAAK;AAC9D,EAAE,QAAQ,QAAQ;AAClB,IAAI,KAAK,SAAS;AAClB,MAAM,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,cAAc,CAAC;AAC1D,IAAI,KAAK,OAAO;AAChB,MAAM,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,YAAY,CAAC;AACxD;AACA,EAAE,OAAO,IAAI,kBAAkB,EAAE;AACjC,CAAC;;ACRM,MAAM,sBAAsB,GAAG,CAAC,SAAS,EAAE,QAAQ,KAAK;AAC/D,EAAE,OAAO,IAAI,kBAAkB,EAAE;AACjC,CAAC;;ACHM,MAAM,QAAQ,GAAG,MAAM,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW;;ACGzF,MAAC,KAAK,GAAG,CAAC,QAAQ,GAAG,OAAO,EAAE,OAAO,KAAK;AACtD,EAAE,IAAI,QAAQ,EAAE,EAAE;AAClB,IAAI,OAAOC,sBAA4B,CAAkB,CAAC;AAC1D,GAAG,MAAM;AACT,IAAI,OAAOC,wBAA4B,CAAC,QAAiB,CAAC;AAC1D;AACA;;;;;;;;;;;"}
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { b as Ref, D as Dequery } from './index-CmIVEYfz.js';
2
- export { C as CSSProperties, m as Children, n as DomAbstractionImpl, F as FontFaceProperties, t as Fragment, G as Globals, K as KeyFrameProperties, P as Props, R as RenderInput, o as RenderNodeInput, a as RenderResult, p as RenderResultNode, U as UpdateFn, c as VAttributes, e as VNode, d as VNodeAttributes, k as VNodeChild, l as VNodeChildren, g as VNodeKey, j as VNodeRef, i as VNodeRefCallback, h as VNodeRefObject, f as VNodeType, V as VRef, r as getRenderer, q as jsx, s as renderIsomorphic } from './index-CmIVEYfz.js';
1
+ import { b as Ref, D as Dequery } from './index-Bg6gfvFM.js';
2
+ export { C as CSSProperties, m as Children, n as DomAbstractionImpl, F as FontFaceProperties, t as Fragment, G as Globals, K as KeyFrameProperties, P as Props, R as RenderInput, o as RenderNodeInput, a as RenderResult, p as RenderResultNode, U as UpdateFn, c as VAttributes, e as VNode, d as VNodeAttributes, k as VNodeChild, l as VNodeChildren, g as VNodeKey, j as VNodeRef, i as VNodeRefCallback, h as VNodeRefObject, f as VNodeType, V as VRef, r as getRenderer, q as jsx, v as jsxDEV, u as jsxs, s as renderIsomorphic } from './index-Bg6gfvFM.js';
3
3
  import * as CSS from 'csstype';
4
4
  export { CSS };
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { b as Ref, D as Dequery } from './index-CmIVEYfz.js';
2
- export { C as CSSProperties, m as Children, n as DomAbstractionImpl, F as FontFaceProperties, t as Fragment, G as Globals, K as KeyFrameProperties, P as Props, R as RenderInput, o as RenderNodeInput, a as RenderResult, p as RenderResultNode, U as UpdateFn, c as VAttributes, e as VNode, d as VNodeAttributes, k as VNodeChild, l as VNodeChildren, g as VNodeKey, j as VNodeRef, i as VNodeRefCallback, h as VNodeRefObject, f as VNodeType, V as VRef, r as getRenderer, q as jsx, s as renderIsomorphic } from './index-CmIVEYfz.js';
1
+ import { b as Ref, D as Dequery } from './index-Bg6gfvFM.js';
2
+ export { C as CSSProperties, m as Children, n as DomAbstractionImpl, F as FontFaceProperties, t as Fragment, G as Globals, K as KeyFrameProperties, P as Props, R as RenderInput, o as RenderNodeInput, a as RenderResult, p as RenderResultNode, U as UpdateFn, c as VAttributes, e as VNode, d as VNodeAttributes, k as VNodeChild, l as VNodeChildren, g as VNodeKey, j as VNodeRef, i as VNodeRefCallback, h as VNodeRefObject, f as VNodeType, V as VRef, r as getRenderer, q as jsx, v as jsxDEV, u as jsxs, s as renderIsomorphic } from './index-Bg6gfvFM.js';
3
3
  import * as CSS from 'csstype';
4
4
  export { CSS };
5
5
 
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- var d=Object.defineProperty;var n=(t,e)=>d(t,"name",{value:e,configurable:!0});import{renderIsomorphic as c}from"./render/index.mjs";import{Fragment as j,getRenderer as q,jsx as B}from"./render/index.mjs";const g=n((t,e)=>{t.classList.contains(e)||t.classList.add(e)},"addSingleClass"),f=n((t,e)=>r=>{if(Array.isArray(r))for(let s=0;s<r.length;s++)g(t,r[s]);else g(t,r);return e},"addClass"),u=n((t,e)=>{t.classList.contains(e)&&t.classList.remove(e)},"removeSingleClass"),p=n((t,e)=>r=>{if(Array.isArray(r))for(let s=0;s<r.length;s++)u(t,r[s]);else u(t,r);return e},"removeClass"),h=n((t,e)=>r=>(t.classList.toggle(r),e),"toggleClass"),m=n(t=>e=>t.classList.contains(e),"hasClass"),v=n((t,e)=>(r,s)=>typeof s>"u"?t.getAttribute(r):(t.setAttribute(r,s),e),"attr"),w=n((t,e)=>r=>{const s=t.type==="checkbox";return typeof r>"u"?s?t.checked:t.value:(s?t.checked=r:t.value=r,e)},"val"),l=n((t,e)=>()=>(t.innerHTML="",e),"empty"),y=n((t,e)=>r=>(typeof r=="string"?t.innerHTML=r:(l(t,e)(),t.appendChild(c(r,t,globalThis))),e),"html"),C=n((t,e)=>r=>(t.textContent=r,e),"text"),S=n((t,e)=>()=>(t.parentNode&&t.parentNode.removeChild(t),e),"remove"),b=n(t=>e=>{let r=e;return e instanceof Node||(r=c(e,t,globalThis)),t.parentNode&&t.parentNode.replaceChild(r,t),r},"replaceWith"),x=n((t,e)=>(r,s)=>(t.removeEventListener(r,s),e),"off"),A=n((t,e)=>(r,s)=>(t.addEventListener(r,s),e),"on"),I=n(t=>{let e={},r=t?.current||t;return typeof t=="string"&&(r=document.querySelector(t)),e={el:r,attr:v(r,e),val:w(r,e),empty:l(r,e),html:y(r,e),text:C(r,e),remove:S(r,e),replaceWith:b(r),addClass:f(r,e),removeClass:p(r,e),toggleClass:h(r,e),hasClass:m(r),on:A(r,e),off:x(r,e)},e},"$"),L=n(()=>{const t=new Map;return{clear:n(()=>{t.clear()},"clear"),getItem:n(e=>t.get(String(e))??null,"getItem"),removeItem:n(e=>{t.delete(String(e))},"removeItem"),setItem:n((e,r)=>{t.set(String(e),r)},"setItem")}},"newInMemoryGenericStorageBackend"),P=L();class o{static{n(this,"WebStorageProvider")}storage;constructor(e){this.storage=e||P}get(e,r,s){const a=this.storage.getItem(e);if(a===null)return r;let i=JSON.parse(a);return s&&(i=s(e,i)),i}set(e,r,s){s&&(r=s(e,r)),this.storage.setItem(e,JSON.stringify(r))}remove(e){this.storage.removeItem(e)}removeAll(){this.storage.clear()}get backendApi(){return this.storage}}const k=n((t,e)=>{switch(t){case"session":return new o(window.sessionStorage);case"local":return new o(window.localStorage)}return new o},"getPersistenceProvider$1"),E=n((t,e)=>new o,"getPersistenceProvider"),W=n(()=>typeof window>"u"||typeof window.document>"u","isServer"),_=n((t="local",e)=>W()?E():k(t),"cache");export{I as $,j as Fragment,_ as cache,q as getRenderer,B as jsx,c as renderIsomorphic};
1
+ var d=Object.defineProperty;var n=(t,e)=>d(t,"name",{value:e,configurable:!0});import{renderIsomorphic as c}from"./render/index.mjs";import{Fragment as V,getRenderer as $,jsx as q,jsxDEV as B,jsxs as D}from"./render/index.mjs";const g=n((t,e)=>{t.classList.contains(e)||t.classList.add(e)},"addSingleClass"),f=n((t,e)=>r=>{if(Array.isArray(r))for(let s=0;s<r.length;s++)g(t,r[s]);else g(t,r);return e},"addClass"),u=n((t,e)=>{t.classList.contains(e)&&t.classList.remove(e)},"removeSingleClass"),p=n((t,e)=>r=>{if(Array.isArray(r))for(let s=0;s<r.length;s++)u(t,r[s]);else u(t,r);return e},"removeClass"),h=n((t,e)=>r=>(t.classList.toggle(r),e),"toggleClass"),m=n(t=>e=>t.classList.contains(e),"hasClass"),v=n((t,e)=>(r,s)=>typeof s>"u"?t.getAttribute(r):(t.setAttribute(r,s),e),"attr"),w=n((t,e)=>r=>{const s=t.type==="checkbox";return typeof r>"u"?s?t.checked:t.value:(s?t.checked=r:t.value=r,e)},"val"),l=n((t,e)=>()=>(t.innerHTML="",e),"empty"),y=n((t,e)=>r=>(typeof r=="string"?t.innerHTML=r:(l(t,e)(),t.appendChild(c(r,t,globalThis))),e),"html"),C=n((t,e)=>r=>(t.textContent=r,e),"text"),S=n((t,e)=>()=>(t.parentNode&&t.parentNode.removeChild(t),e),"remove"),x=n(t=>e=>{let r=e;return e instanceof Node||(r=c(e,t,globalThis)),t.parentNode&&t.parentNode.replaceChild(r,t),r},"replaceWith"),b=n((t,e)=>(r,s)=>(t.removeEventListener(r,s),e),"off"),A=n((t,e)=>(r,s)=>(t.addEventListener(r,s),e),"on"),I=n(t=>{let e={},r=t?.current||t;return typeof t=="string"&&(r=document.querySelector(t)),e={el:r,attr:v(r,e),val:w(r,e),empty:l(r,e),html:y(r,e),text:C(r,e),remove:S(r,e),replaceWith:x(r),addClass:f(r,e),removeClass:p(r,e),toggleClass:h(r,e),hasClass:m(r),on:A(r,e),off:b(r,e)},e},"$"),L=n(()=>{const t=new Map;return{clear:n(()=>{t.clear()},"clear"),getItem:n(e=>t.get(String(e))??null,"getItem"),removeItem:n(e=>{t.delete(String(e))},"removeItem"),setItem:n((e,r)=>{t.set(String(e),r)},"setItem")}},"newInMemoryGenericStorageBackend"),P=L();class o{static{n(this,"WebStorageProvider")}storage;constructor(e){this.storage=e||P}get(e,r,s){const a=this.storage.getItem(e);if(a===null)return r;let i=JSON.parse(a);return s&&(i=s(e,i)),i}set(e,r,s){s&&(r=s(e,r)),this.storage.setItem(e,JSON.stringify(r))}remove(e){this.storage.removeItem(e)}removeAll(){this.storage.clear()}get backendApi(){return this.storage}}const k=n((t,e)=>{switch(t){case"session":return new o(window.sessionStorage);case"local":return new o(window.localStorage)}return new o},"getPersistenceProvider$1"),E=n((t,e)=>new o,"getPersistenceProvider"),j=n(()=>typeof window>"u"||typeof window.document>"u","isServer"),W=n((t="local",e)=>j()?E():k(t),"cache");export{I as $,V as Fragment,W as cache,$ as getRenderer,q as jsx,B as jsxDEV,D as jsxs,c as renderIsomorphic};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1,2 +1,2 @@
1
- "use strict";var o=Object.defineProperty;var i=(e,n)=>o(e,"name",{value:n,configurable:!0});var r=require("./index.cjs");const t=i((e,n=document.documentElement)=>r.renderIsomorphic(e,n,window),"render"),d=i(e=>new XMLSerializer().serializeToString(e),"renderToString");exports.Fragment=r.Fragment,exports.getRenderer=r.getRenderer,exports.jsx=r.jsx,exports.renderIsomorphic=r.renderIsomorphic,exports.render=t,exports.renderToString=d;
1
+ "use strict";var i=Object.defineProperty;var s=(r,n)=>i(r,"name",{value:n,configurable:!0});var e=require("./index.cjs");const o=s((r,n=document.documentElement)=>e.renderIsomorphic(r,n,window),"render"),t=s(r=>new XMLSerializer().serializeToString(r),"renderToString");exports.Fragment=e.Fragment,exports.getRenderer=e.getRenderer,exports.jsx=e.jsx,exports.jsxDEV=e.jsxDEV,exports.jsxs=e.jsxs,exports.renderIsomorphic=e.renderIsomorphic,exports.render=o,exports.renderToString=t;
2
2
  //# sourceMappingURL=client.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.cjs","sources":["../../src/render/client.ts"],"sourcesContent":["import type { Dequery } from '../dequery/types.js'\nimport { renderIsomorphic } from './isomorph.js'\nimport type { RenderInput, RenderResult } from './types.js'\n\nexport const render = <T extends RenderInput>(\n virtualNode: T,\n parentDomElement: Element | Document | Dequery = document.documentElement,\n): RenderResult<T> => renderIsomorphic(virtualNode, parentDomElement, window) as any\n\nexport const renderToString = (el: Node) => new XMLSerializer().serializeToString(el)\n\nexport * from './index.js'\n"],"names":["renderIsomorphic"],"mappings":";;;;AAEY,MAAC,MAAM,GAAG,CAAC,WAAW,EAAE,gBAAgB,GAAG,QAAQ,CAAC,eAAe,KAAKA,sBAAgB,CAAC,WAAW,EAAE,gBAAgB,EAAE,MAAM;AAC9H,MAAC,cAAc,GAAG,CAAC,EAAE,KAAK,IAAI,aAAa,EAAE,CAAC,iBAAiB,CAAC,EAAE;;;;;;;;;"}
1
+ {"version":3,"file":"client.cjs","sources":["../../src/render/client.ts"],"sourcesContent":["import type { Dequery } from '../dequery/types.js'\nimport { renderIsomorphic } from './isomorph.js'\nimport type { RenderInput, RenderResult } from './types.js'\n\nexport const render = <T extends RenderInput>(\n virtualNode: T,\n parentDomElement: Element | Document | Dequery = document.documentElement,\n): RenderResult<T> => renderIsomorphic(virtualNode, parentDomElement, window) as any\n\nexport const renderToString = (el: Node) => new XMLSerializer().serializeToString(el)\n\nexport * from './index.js'\n"],"names":["renderIsomorphic"],"mappings":";;;;AAEY,MAAC,MAAM,GAAG,CAAC,WAAW,EAAE,gBAAgB,GAAG,QAAQ,CAAC,eAAe,KAAKA,sBAAgB,CAAC,WAAW,EAAE,gBAAgB,EAAE,MAAM;AAC9H,MAAC,cAAc,GAAG,CAAC,EAAE,KAAK,IAAI,aAAa,EAAE,CAAC,iBAAiB,CAAC,EAAE;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
- import { R as RenderInput, D as Dequery, a as RenderResult } from '../index-CmIVEYfz.js';
2
- export { C as CSSProperties, m as Children, n as DomAbstractionImpl, F as FontFaceProperties, t as Fragment, G as Globals, K as KeyFrameProperties, P as Props, b as Ref, o as RenderNodeInput, p as RenderResultNode, U as UpdateFn, c as VAttributes, e as VNode, d as VNodeAttributes, k as VNodeChild, l as VNodeChildren, g as VNodeKey, j as VNodeRef, i as VNodeRefCallback, h as VNodeRefObject, f as VNodeType, V as VRef, r as getRenderer, q as jsx, s as renderIsomorphic } from '../index-CmIVEYfz.js';
1
+ import { R as RenderInput, D as Dequery, a as RenderResult } from '../index-Bg6gfvFM.js';
2
+ export { C as CSSProperties, m as Children, n as DomAbstractionImpl, F as FontFaceProperties, t as Fragment, G as Globals, K as KeyFrameProperties, P as Props, b as Ref, o as RenderNodeInput, p as RenderResultNode, U as UpdateFn, c as VAttributes, e as VNode, d as VNodeAttributes, k as VNodeChild, l as VNodeChildren, g as VNodeKey, j as VNodeRef, i as VNodeRefCallback, h as VNodeRefObject, f as VNodeType, V as VRef, r as getRenderer, q as jsx, v as jsxDEV, u as jsxs, s as renderIsomorphic } from '../index-Bg6gfvFM.js';
3
3
  import * as CSS from 'csstype';
4
4
  export { CSS };
5
5
 
@@ -1,5 +1,5 @@
1
- import { R as RenderInput, D as Dequery, a as RenderResult } from '../index-CmIVEYfz.js';
2
- export { C as CSSProperties, m as Children, n as DomAbstractionImpl, F as FontFaceProperties, t as Fragment, G as Globals, K as KeyFrameProperties, P as Props, b as Ref, o as RenderNodeInput, p as RenderResultNode, U as UpdateFn, c as VAttributes, e as VNode, d as VNodeAttributes, k as VNodeChild, l as VNodeChildren, g as VNodeKey, j as VNodeRef, i as VNodeRefCallback, h as VNodeRefObject, f as VNodeType, V as VRef, r as getRenderer, q as jsx, s as renderIsomorphic } from '../index-CmIVEYfz.js';
1
+ import { R as RenderInput, D as Dequery, a as RenderResult } from '../index-Bg6gfvFM.js';
2
+ export { C as CSSProperties, m as Children, n as DomAbstractionImpl, F as FontFaceProperties, t as Fragment, G as Globals, K as KeyFrameProperties, P as Props, b as Ref, o as RenderNodeInput, p as RenderResultNode, U as UpdateFn, c as VAttributes, e as VNode, d as VNodeAttributes, k as VNodeChild, l as VNodeChildren, g as VNodeKey, j as VNodeRef, i as VNodeRefCallback, h as VNodeRefObject, f as VNodeType, V as VRef, r as getRenderer, q as jsx, v as jsxDEV, u as jsxs, s as renderIsomorphic } from '../index-Bg6gfvFM.js';
3
3
  import * as CSS from 'csstype';
4
4
  export { CSS };
5
5
 
@@ -1,2 +1,2 @@
1
- var t=Object.defineProperty;var n=(e,r)=>t(e,"name",{value:r,configurable:!0});import{renderIsomorphic as o}from"./index.mjs";import{Fragment as p,getRenderer as a,jsx as l}from"./index.mjs";const i=n((e,r=document.documentElement)=>o(e,r,window),"render"),m=n(e=>new XMLSerializer().serializeToString(e),"renderToString");export{p as Fragment,a as getRenderer,l as jsx,i as render,o as renderIsomorphic,m as renderToString};
1
+ var t=Object.defineProperty;var n=(e,r)=>t(e,"name",{value:r,configurable:!0});import{renderIsomorphic as o}from"./index.mjs";import{Fragment as g,getRenderer as p,jsx as a,jsxDEV as j,jsxs as l}from"./index.mjs";const i=n((e,r=document.documentElement)=>o(e,r,window),"render"),m=n(e=>new XMLSerializer().serializeToString(e),"renderToString");export{g as Fragment,p as getRenderer,a as jsx,j as jsxDEV,l as jsxs,i as render,o as renderIsomorphic,m as renderToString};
2
2
  //# sourceMappingURL=client.mjs.map
@@ -1,2 +1,2 @@
1
- "use strict";var A=Object.defineProperty;var i=(r,n)=>A(r,"name",{value:n,configurable:!0});const h="class",T="xlink",u="xmlns",a="ref",g={[u]:"http://www.w3.org/2000/xmlns/",[T]:"http://www.w3.org/1999/xlink",svg:"http://www.w3.org/2000/svg"},S=i(r=>r&&typeof r=="object"&&!r.attributes&&!r.type&&!r.children,"isJSXComment"),w=i(r=>r.filter(n=>!S(n)),"filterComments"),x=i(function(r){this.update=r},"onUpdateFn"),C=i((r,n,...t)=>(t=w([].concat.apply([],t)),n={...n},r==="fragment"?w(t):typeof r=="function"?(n.ref&&(n.ref.onUpdate=x.bind(n.ref)),r({children:t,...n})):{type:r,attributes:n,children:t}),"jsx"),y=i(r=>{const n={hasElNamespace:i(t=>t.namespaceURI===g.svg,"hasElNamespace"),hasSvgNamespace:i((t,e)=>n.hasElNamespace(t)&&e!=="STYLE"&&e!=="SCRIPT","hasSvgNamespace"),createElementOrElements:i((t,e)=>Array.isArray(t)?n.createChildElements(t,e):typeof t<"u"?n.createElement(t,e):n.createTextNode("",e),"createElementOrElements"),createElement:i((t,e)=>{let s;return t.type.toUpperCase()==="SVG"||e&&n.hasSvgNamespace(e,t.type.toUpperCase())?s=r.createElementNS(g.svg,t.type):s=r.createElement(t.type),t.attributes&&("dangerouslySetInnerHTML"in t.attributes&&(s.innerHTML=t.attributes.dangerouslySetInnerHTML?.__html,delete t.attributes.dangerouslySetInnerHTML),n.setAttributes(t.attributes,s)),t.children&&n.createChildElements(t.children,s),e&&(e.appendChild(s),typeof s.$onMount=="function"&&s.$onMount()),s},"createElement"),createTextNode:i((t,e)=>{const s=r.createTextNode(t.toString());return e&&e.appendChild(s),s},"createTextNode"),createChildElements:i((t,e)=>{const s=[];for(let o=0;o<t.length;o++){const c=t[o];c===null||typeof c!="object"&&typeof c!="function"?s.push(n.createTextNode((typeof c>"u"||c===null?"":c).toString(),e)):s.push(n.createElement(c,e))}return s},"createChildElements"),setAttribute:i((t,e,s)=>{if(typeof e>"u")return;if(t===a&&typeof e!="function"?e.current=s:t===a&&typeof e=="function"&&e(s),t.startsWith("on")&&typeof e=="function"){let c=t.substring(2).toLowerCase();const f=c.indexOf("capture"),p=f>-1;c==="mount"&&(s.$onMount=e),p&&(c=c.substring(0,f)),s.addEventListener(c,e,p);return}t==="className"&&(t=h),t===h&&Array.isArray(e)&&(e=e.join(" "));const o=t.match(/[A-Z]/)?.index;if(n.hasElNamespace(s)&&o){const c=t.substring(0,o).toLowerCase(),f=t.substring(o,t.length).toLowerCase(),p=g[c]||null;s.setAttributeNS(p,c===T||c==="xmlns"?`${c}:${f}`:t,e)}else if(t==="style"&&typeof e!="string"){const c=Object.keys(e);for(let f=0;f<c.length;f++)s.style[c[f]]=e[c[f]]}else typeof e=="boolean"?s[t]=e:s.setAttribute(t,e)},"setAttribute"),setAttributes:i((t,e)=>{const s=Object.keys(t);for(let o=0;o<s.length;o++)n.setAttribute(s[o],t[s[o]],e)},"setAttributes")};return n},"getRenderer"),b=i((r,n,t)=>{const e=n.el||n;return typeof r=="string"?y(t.window.document).createTextNode(r,e):y(t.window.document).createElementOrElements(r,e)},"renderIsomorphic"),d=i(r=>r.children,"Fragment");exports.Fragment=d,exports.getRenderer=y,exports.jsx=C,exports.renderIsomorphic=b;
1
+ "use strict";var u=Object.defineProperty;var o=(r,n)=>u(r,"name",{value:n,configurable:!0});const T="class",a="xlink",x="xmlns",w="ref",g={[x]:"http://www.w3.org/2000/xmlns/",[a]:"http://www.w3.org/1999/xlink",svg:"http://www.w3.org/2000/svg"},S=o(r=>r&&typeof r=="object"&&!r.attributes&&!r.type&&!r.children,"isJSXComment"),A=o(r=>r.filter(n=>!S(n)),"filterComments"),C=o(function(r){this.update=r},"onUpdateFn"),y=o((r,n,...t)=>(t=A([].concat.apply([],t)),n={...n},r==="fragment"?A(t):typeof r=="function"?(n.ref&&(n.ref.onUpdate=C.bind(n.ref)),r({children:t,...n})):{type:r,attributes:n,children:t}),"jsx"),h=o(r=>{const n={hasElNamespace:o(t=>t.namespaceURI===g.svg,"hasElNamespace"),hasSvgNamespace:o((t,e)=>n.hasElNamespace(t)&&e!=="STYLE"&&e!=="SCRIPT","hasSvgNamespace"),createElementOrElements:o((t,e)=>Array.isArray(t)?n.createChildElements(t,e):typeof t<"u"?n.createElement(t,e):n.createTextNode("",e),"createElementOrElements"),createElement:o((t,e)=>{let s;return t.type.toUpperCase()==="SVG"||e&&n.hasSvgNamespace(e,t.type.toUpperCase())?s=r.createElementNS(g.svg,t.type):s=r.createElement(t.type),t.attributes&&("dangerouslySetInnerHTML"in t.attributes&&(s.innerHTML=t.attributes.dangerouslySetInnerHTML?.__html,delete t.attributes.dangerouslySetInnerHTML),n.setAttributes(t.attributes,s)),t.children&&n.createChildElements(t.children,s),e&&(e.appendChild(s),typeof s.$onMount=="function"&&s.$onMount()),s},"createElement"),createTextNode:o((t,e)=>{const s=r.createTextNode(t.toString());return e&&e.appendChild(s),s},"createTextNode"),createChildElements:o((t,e)=>{const s=[];for(let i=0;i<t.length;i++){const c=t[i];c===null||typeof c!="object"&&typeof c!="function"?s.push(n.createTextNode((typeof c>"u"||c===null?"":c).toString(),e)):s.push(n.createElement(c,e))}return s},"createChildElements"),setAttribute:o((t,e,s)=>{if(typeof e>"u")return;if(t===w&&typeof e!="function"?e.current=s:t===w&&typeof e=="function"&&e(s),t.startsWith("on")&&typeof e=="function"){let c=t.substring(2).toLowerCase();const f=c.indexOf("capture"),p=f>-1;c==="mount"&&(s.$onMount=e),p&&(c=c.substring(0,f)),s.addEventListener(c,e,p);return}t==="className"&&(t=T),t===T&&Array.isArray(e)&&(e=e.join(" "));const i=t.match(/[A-Z]/)?.index;if(n.hasElNamespace(s)&&i){const c=t.substring(0,i).toLowerCase(),f=t.substring(i,t.length).toLowerCase(),p=g[c]||null;s.setAttributeNS(p,c===a||c==="xmlns"?`${c}:${f}`:t,e)}else if(t==="style"&&typeof e!="string"){const c=Object.keys(e);for(let f=0;f<c.length;f++)s.style[c[f]]=e[c[f]]}else typeof e=="boolean"?s[t]=e:s.setAttribute(t,e)},"setAttribute"),setAttributes:o((t,e)=>{const s=Object.keys(t);for(let i=0;i<s.length;i++)n.setAttribute(s[i],t[s[i]],e)},"setAttributes")};return n},"getRenderer"),E=o((r,n,t)=>{const e=n.el||n;return typeof r=="string"?h(t.window.document).createTextNode(r,e):h(t.window.document).createElementOrElements(r,e)},"renderIsomorphic"),b=o(r=>r.children,"Fragment"),d=y,l=y;exports.Fragment=b,exports.getRenderer=h,exports.jsx=y,exports.jsxDEV=l,exports.jsxs=d,exports.renderIsomorphic=E;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../src/render/isomorph.ts"],"sourcesContent":["import type { Dequery } from '../dequery/types.js'\nimport type { VNodeChild, VNodeChildren, VNode, VNodeType, Ref, VNodeAttributes, DomAbstractionImpl, Globals } from './types.js'\n\nconst CLASS_ATTRIBUTE_NAME = 'class'\nconst XLINK_ATTRIBUTE_NAME = 'xlink'\nconst XMLNS_ATTRIBUTE_NAME = 'xmlns'\nconst REF_ATTRIBUTE_NAME = 'ref'\n\nconst nsMap = {\n [XMLNS_ATTRIBUTE_NAME]: 'http://www.w3.org/2000/xmlns/',\n [XLINK_ATTRIBUTE_NAME]: 'http://www.w3.org/1999/xlink',\n svg: 'http://www.w3.org/2000/svg',\n}\n\n// If a JSX comment is written, it looks like: { /* this */ }\n// Therefore, it turns into: {}, which is detected here\nconst isJSXComment = (node: VNode): boolean =>\n /* v8 ignore next */\n node && typeof node === 'object' && !node.attributes && !node.type && !node.children\n\n// Filters comments and undefines like: ['a', 'b', false, {}] to: ['a', 'b', false]\nconst filterComments = (children: Array<VNode> | Array<VNodeChild>) =>\n children.filter((child: VNodeChild) => !isJSXComment(child as VNode))\n\nconst onUpdateFn = function (this: Ref, callback: Function) {\n this.update = callback as any\n}\n\nexport const jsx = (\n // if it is a function, it is a component\n type: VNodeType | Function | any,\n attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null,\n ...children: Array<VNodeChildren> | VNodeChildren\n): Array<VNode> | VNode => {\n children = filterComments(\n // Implementation to flatten virtual node children structures like:\n // [<p>1</p>, [<p>2</p>,<p>3</p>]] to: [<p>1</p>,<p>2</p>,<p>3</p>]\n ([] as Array<VNodeChildren>).concat.apply([], children as any) as Array<VNodeChildren>,\n )\n\n // clone attributes as well\n attributes = { ...attributes }\n\n // effectively unwrap by directly returning the children\n if (type === 'fragment') {\n return filterComments(children) as Array<VNode>\n }\n\n // it's a component, divide and conquer children\n if (typeof type === 'function') {\n if (attributes.ref) {\n // references an onUpdate assignment function to be called inside of the functional component\n // to register an \"update\" function that can be called from the outside (ref.current.update(state?))\n ;(attributes.ref as Ref)!.onUpdate = onUpdateFn.bind(attributes.ref as Ref) as any\n }\n\n return type({\n children,\n ...attributes,\n })\n }\n\n // @ts-ignore as type allows for Function here, but internally we wouldn't\n // want to deal with Function, only \"string\". However, in this method it is indeed possible\n return {\n type,\n attributes: attributes as any,\n children,\n }\n}\n\nexport const getRenderer = (document: Document): DomAbstractionImpl => {\n // DOM abstraction layer for manipulation\n const renderer = {\n hasElNamespace: (domElement: Element | Document): boolean => (domElement as Element).namespaceURI === nsMap.svg,\n\n hasSvgNamespace: (parentElement: Element | Document, type: string): boolean =>\n renderer.hasElNamespace(parentElement) && type !== 'STYLE' && type !== 'SCRIPT',\n\n createElementOrElements: (\n virtualNode: VNode | undefined | Array<VNode | undefined | string>,\n parentDomElement?: Element | Document,\n ): Array<Element | Text | undefined> | Element | Text | undefined => {\n if (Array.isArray(virtualNode)) {\n return renderer.createChildElements(virtualNode, parentDomElement)\n }\n if (typeof virtualNode !== 'undefined') {\n return renderer.createElement(virtualNode, parentDomElement)\n }\n // undefined virtualNode -> e.g. when a tsx variable is used in markup which is undefined\n return renderer.createTextNode('', parentDomElement)\n },\n\n createElement: (virtualNode: VNode, parentDomElement?: Element | Document): Element | undefined => {\n let newEl: Element\n\n if (\n virtualNode.type.toUpperCase() === 'SVG' ||\n (parentDomElement && renderer.hasSvgNamespace(parentDomElement, virtualNode.type.toUpperCase()))\n ) {\n newEl = document.createElementNS(nsMap.svg, virtualNode.type as string)\n } else {\n newEl = document.createElement(virtualNode.type as string)\n }\n\n if (virtualNode.attributes) {\n // dangerouslySetInnerHTML={{ __html: '<... />' }}\n if ('dangerouslySetInnerHTML' in virtualNode.attributes) {\n newEl.innerHTML = virtualNode.attributes.dangerouslySetInnerHTML?.__html\n delete virtualNode.attributes.dangerouslySetInnerHTML \n }\n renderer.setAttributes(virtualNode.attributes, newEl as Element)\n }\n\n if (virtualNode.children) {\n renderer.createChildElements(virtualNode.children, newEl as Element)\n }\n\n if (parentDomElement) {\n parentDomElement.appendChild(newEl)\n\n // check for a lifecycle \"onMount\" hook and call it\n if (typeof (newEl as any).$onMount === 'function') {\n ;(newEl as any).$onMount!()\n }\n }\n return newEl as Element\n },\n\n createTextNode: (text: string, domElement?: Element | Document): Text => {\n const node = document.createTextNode(text.toString())\n\n if (domElement) {\n domElement.appendChild(node)\n }\n return node\n },\n\n createChildElements: (\n virtualChildren: VNodeChildren,\n domElement?: Element | Document,\n ): Array<Element | Text | undefined> => {\n const children: Array<Element | Text | undefined> = []\n\n for (let i = 0; i < virtualChildren.length; i++) {\n const virtualChild = virtualChildren[i]\n if (virtualChild === null || (typeof virtualChild !== 'object' && typeof virtualChild !== 'function')) {\n children.push(\n renderer.createTextNode(\n (typeof virtualChild === 'undefined' || virtualChild === null ? '' : virtualChild!).toString(),\n domElement,\n ),\n )\n } else {\n children.push(renderer.createElement(virtualChild as VNode, domElement))\n }\n }\n return children\n },\n\n setAttribute: (name: string, value: any, domElement: Element) => {\n // attributes not set (undefined) are ignored; use null value to reset an attributes state\n if (typeof value === 'undefined') return\n\n // save ref as { current: DOMElement } in ref object\n // allows for ref={someRef}\n if (name === REF_ATTRIBUTE_NAME && typeof value !== 'function') {\n value.current = domElement\n } else if (name === REF_ATTRIBUTE_NAME && typeof value === 'function') {\n // allow for functional ref's like: render(<div ref={(el) => console.log('got el', el)} />)\n value(domElement)\n }\n\n if (name.startsWith('on') && typeof value === 'function') {\n let eventName = name.substring(2).toLowerCase()\n const capturePos = eventName.indexOf('capture')\n const doCapture = capturePos > -1\n\n if (eventName === 'mount') {\n ;(domElement as any).$onMount = value\n }\n\n // onClickCapture={...} support\n if (doCapture) {\n eventName = eventName.substring(0, capturePos)\n }\n domElement.addEventListener(eventName, value, doCapture)\n return\n }\n\n // transforms className=\"...\" -> class=\"...\"\n // allows for React TSX to work seamlessly\n if (name === 'className') {\n name = CLASS_ATTRIBUTE_NAME\n }\n\n // transforms class={['a', 'b']} into class=\"a b\"\n if (name === CLASS_ATTRIBUTE_NAME && Array.isArray(value)) {\n value = value.join(' ')\n }\n\n const nsEndIndex = name.match(/[A-Z]/)?.index\n if (renderer.hasElNamespace(domElement) && nsEndIndex) {\n const ns = name.substring(0, nsEndIndex).toLowerCase()\n const attrName = name.substring(nsEndIndex, name.length).toLowerCase()\n const namespace = nsMap[ns as keyof typeof nsMap] || null\n domElement.setAttributeNS(\n namespace,\n ns === XLINK_ATTRIBUTE_NAME || ns === 'xmlns' ? `${ns}:${attrName}` : name,\n value,\n )\n } else if (name === 'style' && typeof value !== 'string') {\n const propNames = Object.keys(value)\n\n // allows for style={{ margin: 10 }} etc.\n for (let i = 0; i < propNames.length; i++) {\n ;(domElement as HTMLElement).style[propNames[i] as any] = value[propNames[i]]\n }\n } else if (typeof value === 'boolean') {\n // for cases like <button checked={false} />\n ;(domElement as any)[name] = value\n } else {\n // for any other case\n domElement.setAttribute(name, value)\n }\n },\n\n setAttributes: (attributes: VNodeAttributes, domElement: Element) => {\n const attrNames = Object.keys(attributes)\n for (let i = 0; i < attrNames.length; i++) {\n renderer.setAttribute(attrNames[i], attributes[attrNames[i]], domElement)\n }\n },\n }\n return renderer\n}\n\nexport const renderIsomorphic = (\n virtualNode: VNode | undefined | string | Array<VNode | undefined | string>,\n parentDomElement: Element | Document | Dequery | undefined,\n globals: Globals,\n): Array<Element | Text | undefined> | Element | Text | undefined => {\n\n const parentEl = (parentDomElement as Dequery).el as Element || parentDomElement\n\n if (typeof virtualNode === 'string') {\n return getRenderer(globals.window.document).createTextNode(virtualNode, parentEl)\n }\n return getRenderer(globals.window.document).createElementOrElements(virtualNode, parentEl)\n}\n\nexport const Fragment = (props: VNode) => props.children\n\nexport default {\n jsx,\n Fragment,\n renderIsomorphic,\n getRenderer,\n onUpdateFn,\n};"],"names":[],"mappings":";;AACA,MAAM,oBAAoB,GAAG,OAAO;AACpC,MAAM,oBAAoB,GAAG,OAAO;AACpC,MAAM,oBAAoB,GAAG,OAAO;AACpC,MAAM,kBAAkB,GAAG,KAAK;AAChC,MAAM,KAAK,GAAG;AACd,EAAE,CAAC,oBAAoB,GAAG,+BAA+B;AACzD,EAAE,CAAC,oBAAoB,GAAG,8BAA8B;AACxD,EAAE,GAAG,EAAE;AACP,CAAC;AACD,MAAM,YAAY,GAAG,CAAC,IAAI;AAC1B;AACA,EAAE,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI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;AACL,IAAI,aAAa,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK;AAC/C,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;AAC/C,MAAM,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACjD,QAAQ,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC;AACjF;AACA;AACA,GAAG;AACH,EAAE,OAAO,QAAQ;AACjB;AACY,MAAC,gBAAgB,GAAG,CAAC,WAAW,EAAE,gBAAgB,EAAE,OAAO,KAAK;AAC5E,EAAE,MAAM,QAAQ,GAAG,gBAAgB,CAAC,EAAE,IAAI,gBAAgB;AAC1D,EAAE,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;AACvC,IAAI,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,WAAW,EAAE,QAAQ,CAAC;AACrF;AACA,EAAE,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,uBAAuB,CAAC,WAAW,EAAE,QAAQ,CAAC;AAC5F;AACY,MAAC,QAAQ,GAAG,CAAC,KAAK,KAAK,KAAK,CAAC;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../src/render/isomorph.ts"],"sourcesContent":["import type { Dequery } from '../dequery/types.js'\nimport type { VNodeChild, VNodeChildren, VNode, VNodeType, Ref, VNodeAttributes, DomAbstractionImpl, Globals } from './types.js'\n\nconst CLASS_ATTRIBUTE_NAME = 'class'\nconst XLINK_ATTRIBUTE_NAME = 'xlink'\nconst XMLNS_ATTRIBUTE_NAME = 'xmlns'\nconst REF_ATTRIBUTE_NAME = 'ref'\n\nconst nsMap = {\n [XMLNS_ATTRIBUTE_NAME]: 'http://www.w3.org/2000/xmlns/',\n [XLINK_ATTRIBUTE_NAME]: 'http://www.w3.org/1999/xlink',\n svg: 'http://www.w3.org/2000/svg',\n}\n\n// If a JSX comment is written, it looks like: { /* this */ }\n// Therefore, it turns into: {}, which is detected here\nconst isJSXComment = (node: VNode): boolean =>\n /* v8 ignore next */\n node && typeof node === 'object' && !node.attributes && !node.type && !node.children\n\n// Filters comments and undefines like: ['a', 'b', false, {}] to: ['a', 'b', false]\nconst filterComments = (children: Array<VNode> | Array<VNodeChild>) =>\n children.filter((child: VNodeChild) => !isJSXComment(child as VNode))\n\nconst onUpdateFn = function (this: Ref, callback: Function) {\n this.update = callback as any\n}\n\nexport const jsx = (\n // if it is a function, it is a component\n type: VNodeType | Function | any,\n attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null,\n ...children: Array<VNodeChildren> | VNodeChildren\n): Array<VNode> | VNode => {\n children = filterComments(\n // Implementation to flatten virtual node children structures like:\n // [<p>1</p>, [<p>2</p>,<p>3</p>]] to: [<p>1</p>,<p>2</p>,<p>3</p>]\n ([] as Array<VNodeChildren>).concat.apply([], children as any) as Array<VNodeChildren>,\n )\n\n // clone attributes as well\n attributes = { ...attributes }\n\n // effectively unwrap by directly returning the children\n if (type === 'fragment') {\n return filterComments(children) as Array<VNode>\n }\n\n // it's a component, divide and conquer children\n if (typeof type === 'function') {\n if (attributes.ref) {\n // references an onUpdate assignment function to be called inside of the functional component\n // to register an \"update\" function that can be called from the outside (ref.current.update(state?))\n ;(attributes.ref as Ref)!.onUpdate = onUpdateFn.bind(attributes.ref as Ref) as any\n }\n\n return type({\n children,\n ...attributes,\n })\n }\n\n // @ts-ignore as type allows for Function here, but internally we wouldn't\n // want to deal with Function, only \"string\". However, in this method it is indeed possible\n return {\n type,\n attributes: attributes as any,\n children,\n }\n}\n\nexport const getRenderer = (document: Document): DomAbstractionImpl => {\n // DOM abstraction layer for manipulation\n const renderer = {\n hasElNamespace: (domElement: Element | Document): boolean => (domElement as Element).namespaceURI === nsMap.svg,\n\n hasSvgNamespace: (parentElement: Element | Document, type: string): boolean =>\n renderer.hasElNamespace(parentElement) && type !== 'STYLE' && type !== 'SCRIPT',\n\n createElementOrElements: (\n virtualNode: VNode | undefined | Array<VNode | undefined | string>,\n parentDomElement?: Element | Document,\n ): Array<Element | Text | undefined> | Element | Text | undefined => {\n if (Array.isArray(virtualNode)) {\n return renderer.createChildElements(virtualNode, parentDomElement)\n }\n if (typeof virtualNode !== 'undefined') {\n return renderer.createElement(virtualNode, parentDomElement)\n }\n // undefined virtualNode -> e.g. when a tsx variable is used in markup which is undefined\n return renderer.createTextNode('', parentDomElement)\n },\n\n createElement: (virtualNode: VNode, parentDomElement?: Element | Document): Element | undefined => {\n let newEl: Element\n\n if (\n virtualNode.type.toUpperCase() === 'SVG' ||\n (parentDomElement && renderer.hasSvgNamespace(parentDomElement, virtualNode.type.toUpperCase()))\n ) {\n newEl = document.createElementNS(nsMap.svg, virtualNode.type as string)\n } else {\n newEl = document.createElement(virtualNode.type as string)\n }\n\n if (virtualNode.attributes) {\n // dangerouslySetInnerHTML={{ __html: '<... />' }}\n if ('dangerouslySetInnerHTML' in virtualNode.attributes) {\n newEl.innerHTML = virtualNode.attributes.dangerouslySetInnerHTML?.__html\n delete virtualNode.attributes.dangerouslySetInnerHTML \n }\n renderer.setAttributes(virtualNode.attributes, newEl as Element)\n }\n\n if (virtualNode.children) {\n renderer.createChildElements(virtualNode.children, newEl as Element)\n }\n\n if (parentDomElement) {\n parentDomElement.appendChild(newEl)\n\n // check for a lifecycle \"onMount\" hook and call it\n if (typeof (newEl as any).$onMount === 'function') {\n ;(newEl as any).$onMount!()\n }\n }\n return newEl as Element\n },\n\n createTextNode: (text: string, domElement?: Element | Document): Text => {\n const node = document.createTextNode(text.toString())\n\n if (domElement) {\n domElement.appendChild(node)\n }\n return node\n },\n\n createChildElements: (\n virtualChildren: VNodeChildren,\n domElement?: Element | Document,\n ): Array<Element | Text | undefined> => {\n const children: Array<Element | Text | undefined> = []\n\n for (let i = 0; i < virtualChildren.length; i++) {\n const virtualChild = virtualChildren[i]\n if (virtualChild === null || (typeof virtualChild !== 'object' && typeof virtualChild !== 'function')) {\n children.push(\n renderer.createTextNode(\n (typeof virtualChild === 'undefined' || virtualChild === null ? '' : virtualChild!).toString(),\n domElement,\n ),\n )\n } else {\n children.push(renderer.createElement(virtualChild as VNode, domElement))\n }\n }\n return children\n },\n\n setAttribute: (name: string, value: any, domElement: Element) => {\n // attributes not set (undefined) are ignored; use null value to reset an attributes state\n if (typeof value === 'undefined') return\n\n // save ref as { current: DOMElement } in ref object\n // allows for ref={someRef}\n if (name === REF_ATTRIBUTE_NAME && typeof value !== 'function') {\n value.current = domElement\n } else if (name === REF_ATTRIBUTE_NAME && typeof value === 'function') {\n // allow for functional ref's like: render(<div ref={(el) => console.log('got el', el)} />)\n value(domElement)\n }\n\n if (name.startsWith('on') && typeof value === 'function') {\n let eventName = name.substring(2).toLowerCase()\n const capturePos = eventName.indexOf('capture')\n const doCapture = capturePos > -1\n\n if (eventName === 'mount') {\n ;(domElement as any).$onMount = value\n }\n\n // onClickCapture={...} support\n if (doCapture) {\n eventName = eventName.substring(0, capturePos)\n }\n domElement.addEventListener(eventName, value, doCapture)\n return\n }\n\n // transforms className=\"...\" -> class=\"...\"\n // allows for React TSX to work seamlessly\n if (name === 'className') {\n name = CLASS_ATTRIBUTE_NAME\n }\n\n // transforms class={['a', 'b']} into class=\"a b\"\n if (name === CLASS_ATTRIBUTE_NAME && Array.isArray(value)) {\n value = value.join(' ')\n }\n\n const nsEndIndex = name.match(/[A-Z]/)?.index\n if (renderer.hasElNamespace(domElement) && nsEndIndex) {\n const ns = name.substring(0, nsEndIndex).toLowerCase()\n const attrName = name.substring(nsEndIndex, name.length).toLowerCase()\n const namespace = nsMap[ns as keyof typeof nsMap] || null\n domElement.setAttributeNS(\n namespace,\n ns === XLINK_ATTRIBUTE_NAME || ns === 'xmlns' ? `${ns}:${attrName}` : name,\n value,\n )\n } else if (name === 'style' && typeof value !== 'string') {\n const propNames = Object.keys(value)\n\n // allows for style={{ margin: 10 }} etc.\n for (let i = 0; i < propNames.length; i++) {\n ;(domElement as HTMLElement).style[propNames[i] as any] = value[propNames[i]]\n }\n } else if (typeof value === 'boolean') {\n // for cases like <button checked={false} />\n ;(domElement as any)[name] = value\n } else {\n // for any other case\n domElement.setAttribute(name, value)\n }\n },\n\n setAttributes: (attributes: VNodeAttributes, domElement: Element) => {\n const attrNames = Object.keys(attributes)\n for (let i = 0; i < attrNames.length; i++) {\n renderer.setAttribute(attrNames[i], attributes[attrNames[i]], domElement)\n }\n },\n }\n return renderer\n}\n\nexport const renderIsomorphic = (\n virtualNode: VNode | undefined | string | Array<VNode | undefined | string>,\n parentDomElement: Element | Document | Dequery | undefined,\n globals: Globals,\n): Array<Element | Text | undefined> | Element | Text | undefined => {\n\n const parentEl = (parentDomElement as Dequery).el as Element || parentDomElement\n\n if (typeof virtualNode === 'string') {\n return getRenderer(globals.window.document).createTextNode(virtualNode, parentEl)\n }\n return getRenderer(globals.window.document).createElementOrElements(virtualNode, parentEl)\n}\n\nexport const Fragment = (props: VNode) => props.children\nexport const jsxs = jsx\nexport const jsxDEV = jsx\n\nexport default {\n jsx,\n Fragment,\n renderIsomorphic,\n getRenderer,\n onUpdateFn,\n\n // implementing the full standard\n // https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md\n jsxs,\n jsxDEV,\n};"],"names":[],"mappings":";;AACA,MAAM,oBAAoB,GAAG,OAAO;AACpC,MAAM,oBAAoB,GAAG,OAAO;AACpC,MAAM,oBAAoB,GAAG,OAAO;AACpC,MAAM,kBAAkB,GAAG,KAAK;AAChC,MAAM,KAAK,GAAG;AACd,EAAE,CAAC,oBAAoB,GAAG,+BAA+B;AACzD,EAAE,CAAC,oBAAoB,GAAG,8BAA8B;AACxD,EAAE,GAAG,EAAE;AACP,CAAC;AACD,MAAM,YAAY,GAAG,CAAC,IAAI;AAC1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K;AAChC,OAAO,MAAM;AACb,QAAQ,UAAU,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC;AAC5C;AACA,KAAK;AACL,IAAI,aAAa,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK;AAC/C,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;AAC/C,MAAM,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACjD,QAAQ,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC;AACjF;AACA;AACA,GAAG;AACH,EAAE,OAAO,QAAQ;AACjB;AACY,MAAC,gBAAgB,GAAG,CAAC,WAAW,EAAE,gBAAgB,EAAE,OAAO,KAAK;AAC5E,EAAE,MAAM,QAAQ,GAAG,gBAAgB,CAAC,EAAE,IAAI,gBAAgB;AAC1D,EAAE,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;AACvC,IAAI,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,WAAW,EAAE,QAAQ,CAAC;AACrF;AACA,EAAE,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,uBAAuB,CAAC,WAAW,EAAE,QAAQ,CAAC;AAC5F;AACY,MAAC,QAAQ,GAAG,CAAC,KAAK,KAAK,KAAK,CAAC;AAC7B,MAAC,IAAI,GAAG;AACR,MAAC,MAAM,GAAG;;;;;;;;;"}
@@ -1,3 +1,3 @@
1
- export { C as CSSProperties, m as Children, n as DomAbstractionImpl, F as FontFaceProperties, t as Fragment, G as Globals, K as KeyFrameProperties, P as Props, b as Ref, R as RenderInput, o as RenderNodeInput, a as RenderResult, p as RenderResultNode, U as UpdateFn, c as VAttributes, e as VNode, d as VNodeAttributes, k as VNodeChild, l as VNodeChildren, g as VNodeKey, j as VNodeRef, i as VNodeRefCallback, h as VNodeRefObject, f as VNodeType, V as VRef, r as getRenderer, q as jsx, s as renderIsomorphic } from '../index-CmIVEYfz.js';
1
+ export { C as CSSProperties, m as Children, n as DomAbstractionImpl, F as FontFaceProperties, t as Fragment, G as Globals, K as KeyFrameProperties, P as Props, b as Ref, R as RenderInput, o as RenderNodeInput, a as RenderResult, p as RenderResultNode, U as UpdateFn, c as VAttributes, e as VNode, d as VNodeAttributes, k as VNodeChild, l as VNodeChildren, g as VNodeKey, j as VNodeRef, i as VNodeRefCallback, h as VNodeRefObject, f as VNodeType, V as VRef, r as getRenderer, q as jsx, v as jsxDEV, u as jsxs, s as renderIsomorphic } from '../index-Bg6gfvFM.js';
2
2
  import * as CSS from 'csstype';
3
3
  export { CSS };
@@ -1,3 +1,3 @@
1
- export { C as CSSProperties, m as Children, n as DomAbstractionImpl, F as FontFaceProperties, t as Fragment, G as Globals, K as KeyFrameProperties, P as Props, b as Ref, R as RenderInput, o as RenderNodeInput, a as RenderResult, p as RenderResultNode, U as UpdateFn, c as VAttributes, e as VNode, d as VNodeAttributes, k as VNodeChild, l as VNodeChildren, g as VNodeKey, j as VNodeRef, i as VNodeRefCallback, h as VNodeRefObject, f as VNodeType, V as VRef, r as getRenderer, q as jsx, s as renderIsomorphic } from '../index-CmIVEYfz.js';
1
+ export { C as CSSProperties, m as Children, n as DomAbstractionImpl, F as FontFaceProperties, t as Fragment, G as Globals, K as KeyFrameProperties, P as Props, b as Ref, R as RenderInput, o as RenderNodeInput, a as RenderResult, p as RenderResultNode, U as UpdateFn, c as VAttributes, e as VNode, d as VNodeAttributes, k as VNodeChild, l as VNodeChildren, g as VNodeKey, j as VNodeRef, i as VNodeRefCallback, h as VNodeRefObject, f as VNodeType, V as VRef, r as getRenderer, q as jsx, v as jsxDEV, u as jsxs, s as renderIsomorphic } from '../index-Bg6gfvFM.js';
2
2
  import * as CSS from 'csstype';
3
3
  export { CSS };
@@ -1,2 +1,2 @@
1
- var a=Object.defineProperty;var i=(r,s)=>a(r,"name",{value:s,configurable:!0});const h="class",T="xlink",u="xmlns",w="ref",y={[u]:"http://www.w3.org/2000/xmlns/",[T]:"http://www.w3.org/1999/xlink",svg:"http://www.w3.org/2000/svg"},S=i(r=>r&&typeof r=="object"&&!r.attributes&&!r.type&&!r.children,"isJSXComment"),A=i(r=>r.filter(s=>!S(s)),"filterComments"),x=i(function(r){this.update=r},"onUpdateFn"),C=i((r,s,...t)=>(t=A([].concat.apply([],t)),s={...s},r==="fragment"?A(t):typeof r=="function"?(s.ref&&(s.ref.onUpdate=x.bind(s.ref)),r({children:t,...s})):{type:r,attributes:s,children:t}),"jsx"),g=i(r=>{const s={hasElNamespace:i(t=>t.namespaceURI===y.svg,"hasElNamespace"),hasSvgNamespace:i((t,e)=>s.hasElNamespace(t)&&e!=="STYLE"&&e!=="SCRIPT","hasSvgNamespace"),createElementOrElements:i((t,e)=>Array.isArray(t)?s.createChildElements(t,e):typeof t<"u"?s.createElement(t,e):s.createTextNode("",e),"createElementOrElements"),createElement:i((t,e)=>{let n;return t.type.toUpperCase()==="SVG"||e&&s.hasSvgNamespace(e,t.type.toUpperCase())?n=r.createElementNS(y.svg,t.type):n=r.createElement(t.type),t.attributes&&("dangerouslySetInnerHTML"in t.attributes&&(n.innerHTML=t.attributes.dangerouslySetInnerHTML?.__html,delete t.attributes.dangerouslySetInnerHTML),s.setAttributes(t.attributes,n)),t.children&&s.createChildElements(t.children,n),e&&(e.appendChild(n),typeof n.$onMount=="function"&&n.$onMount()),n},"createElement"),createTextNode:i((t,e)=>{const n=r.createTextNode(t.toString());return e&&e.appendChild(n),n},"createTextNode"),createChildElements:i((t,e)=>{const n=[];for(let o=0;o<t.length;o++){const c=t[o];c===null||typeof c!="object"&&typeof c!="function"?n.push(s.createTextNode((typeof c>"u"||c===null?"":c).toString(),e)):n.push(s.createElement(c,e))}return n},"createChildElements"),setAttribute:i((t,e,n)=>{if(typeof e>"u")return;if(t===w&&typeof e!="function"?e.current=n:t===w&&typeof e=="function"&&e(n),t.startsWith("on")&&typeof e=="function"){let c=t.substring(2).toLowerCase();const f=c.indexOf("capture"),p=f>-1;c==="mount"&&(n.$onMount=e),p&&(c=c.substring(0,f)),n.addEventListener(c,e,p);return}t==="className"&&(t=h),t===h&&Array.isArray(e)&&(e=e.join(" "));const o=t.match(/[A-Z]/)?.index;if(s.hasElNamespace(n)&&o){const c=t.substring(0,o).toLowerCase(),f=t.substring(o,t.length).toLowerCase(),p=y[c]||null;n.setAttributeNS(p,c===T||c==="xmlns"?`${c}:${f}`:t,e)}else if(t==="style"&&typeof e!="string"){const c=Object.keys(e);for(let f=0;f<c.length;f++)n.style[c[f]]=e[c[f]]}else typeof e=="boolean"?n[t]=e:n.setAttribute(t,e)},"setAttribute"),setAttributes:i((t,e)=>{const n=Object.keys(t);for(let o=0;o<n.length;o++)s.setAttribute(n[o],t[n[o]],e)},"setAttributes")};return s},"getRenderer"),b=i((r,s,t)=>{const e=s.el||s;return typeof r=="string"?g(t.window.document).createTextNode(r,e):g(t.window.document).createElementOrElements(r,e)},"renderIsomorphic"),l=i(r=>r.children,"Fragment");export{l as Fragment,g as getRenderer,C as jsx,b as renderIsomorphic};
1
+ var u=Object.defineProperty;var o=(r,n)=>u(r,"name",{value:n,configurable:!0});const T="class",w="xlink",x="xmlns",A="ref",y={[x]:"http://www.w3.org/2000/xmlns/",[w]:"http://www.w3.org/1999/xlink",svg:"http://www.w3.org/2000/svg"},S=o(r=>r&&typeof r=="object"&&!r.attributes&&!r.type&&!r.children,"isJSXComment"),a=o(r=>r.filter(n=>!S(n)),"filterComments"),C=o(function(r){this.update=r},"onUpdateFn"),g=o((r,n,...t)=>(t=a([].concat.apply([],t)),n={...n},r==="fragment"?a(t):typeof r=="function"?(n.ref&&(n.ref.onUpdate=C.bind(n.ref)),r({children:t,...n})):{type:r,attributes:n,children:t}),"jsx"),h=o(r=>{const n={hasElNamespace:o(t=>t.namespaceURI===y.svg,"hasElNamespace"),hasSvgNamespace:o((t,e)=>n.hasElNamespace(t)&&e!=="STYLE"&&e!=="SCRIPT","hasSvgNamespace"),createElementOrElements:o((t,e)=>Array.isArray(t)?n.createChildElements(t,e):typeof t<"u"?n.createElement(t,e):n.createTextNode("",e),"createElementOrElements"),createElement:o((t,e)=>{let s;return t.type.toUpperCase()==="SVG"||e&&n.hasSvgNamespace(e,t.type.toUpperCase())?s=r.createElementNS(y.svg,t.type):s=r.createElement(t.type),t.attributes&&("dangerouslySetInnerHTML"in t.attributes&&(s.innerHTML=t.attributes.dangerouslySetInnerHTML?.__html,delete t.attributes.dangerouslySetInnerHTML),n.setAttributes(t.attributes,s)),t.children&&n.createChildElements(t.children,s),e&&(e.appendChild(s),typeof s.$onMount=="function"&&s.$onMount()),s},"createElement"),createTextNode:o((t,e)=>{const s=r.createTextNode(t.toString());return e&&e.appendChild(s),s},"createTextNode"),createChildElements:o((t,e)=>{const s=[];for(let i=0;i<t.length;i++){const c=t[i];c===null||typeof c!="object"&&typeof c!="function"?s.push(n.createTextNode((typeof c>"u"||c===null?"":c).toString(),e)):s.push(n.createElement(c,e))}return s},"createChildElements"),setAttribute:o((t,e,s)=>{if(typeof e>"u")return;if(t===A&&typeof e!="function"?e.current=s:t===A&&typeof e=="function"&&e(s),t.startsWith("on")&&typeof e=="function"){let c=t.substring(2).toLowerCase();const f=c.indexOf("capture"),p=f>-1;c==="mount"&&(s.$onMount=e),p&&(c=c.substring(0,f)),s.addEventListener(c,e,p);return}t==="className"&&(t=T),t===T&&Array.isArray(e)&&(e=e.join(" "));const i=t.match(/[A-Z]/)?.index;if(n.hasElNamespace(s)&&i){const c=t.substring(0,i).toLowerCase(),f=t.substring(i,t.length).toLowerCase(),p=y[c]||null;s.setAttributeNS(p,c===w||c==="xmlns"?`${c}:${f}`:t,e)}else if(t==="style"&&typeof e!="string"){const c=Object.keys(e);for(let f=0;f<c.length;f++)s.style[c[f]]=e[c[f]]}else typeof e=="boolean"?s[t]=e:s.setAttribute(t,e)},"setAttribute"),setAttributes:o((t,e)=>{const s=Object.keys(t);for(let i=0;i<s.length;i++)n.setAttribute(s[i],t[s[i]],e)},"setAttributes")};return n},"getRenderer"),b=o((r,n,t)=>{const e=n.el||n;return typeof r=="string"?h(t.window.document).createTextNode(r,e):h(t.window.document).createElementOrElements(r,e)},"renderIsomorphic"),E=o(r=>r.children,"Fragment"),l=g,M=g;export{E as Fragment,h as getRenderer,g as jsx,M as jsxDEV,l as jsxs,b as renderIsomorphic};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/render/isomorph.ts"],"sourcesContent":["import type { Dequery } from '../dequery/types.js'\nimport type { VNodeChild, VNodeChildren, VNode, VNodeType, Ref, VNodeAttributes, DomAbstractionImpl, Globals } from './types.js'\n\nconst CLASS_ATTRIBUTE_NAME = 'class'\nconst XLINK_ATTRIBUTE_NAME = 'xlink'\nconst XMLNS_ATTRIBUTE_NAME = 'xmlns'\nconst REF_ATTRIBUTE_NAME = 'ref'\n\nconst nsMap = {\n [XMLNS_ATTRIBUTE_NAME]: 'http://www.w3.org/2000/xmlns/',\n [XLINK_ATTRIBUTE_NAME]: 'http://www.w3.org/1999/xlink',\n svg: 'http://www.w3.org/2000/svg',\n}\n\n// If a JSX comment is written, it looks like: { /* this */ }\n// Therefore, it turns into: {}, which is detected here\nconst isJSXComment = (node: VNode): boolean =>\n /* v8 ignore next */\n node && typeof node === 'object' && !node.attributes && !node.type && !node.children\n\n// Filters comments and undefines like: ['a', 'b', false, {}] to: ['a', 'b', false]\nconst filterComments = (children: Array<VNode> | Array<VNodeChild>) =>\n children.filter((child: VNodeChild) => !isJSXComment(child as VNode))\n\nconst onUpdateFn = function (this: Ref, callback: Function) {\n this.update = callback as any\n}\n\nexport const jsx = (\n // if it is a function, it is a component\n type: VNodeType | Function | any,\n attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null,\n ...children: Array<VNodeChildren> | VNodeChildren\n): Array<VNode> | VNode => {\n children = filterComments(\n // Implementation to flatten virtual node children structures like:\n // [<p>1</p>, [<p>2</p>,<p>3</p>]] to: [<p>1</p>,<p>2</p>,<p>3</p>]\n ([] as Array<VNodeChildren>).concat.apply([], children as any) as Array<VNodeChildren>,\n )\n\n // clone attributes as well\n attributes = { ...attributes }\n\n // effectively unwrap by directly returning the children\n if (type === 'fragment') {\n return filterComments(children) as Array<VNode>\n }\n\n // it's a component, divide and conquer children\n if (typeof type === 'function') {\n if (attributes.ref) {\n // references an onUpdate assignment function to be called inside of the functional component\n // to register an \"update\" function that can be called from the outside (ref.current.update(state?))\n ;(attributes.ref as Ref)!.onUpdate = onUpdateFn.bind(attributes.ref as Ref) as any\n }\n\n return type({\n children,\n ...attributes,\n })\n }\n\n // @ts-ignore as type allows for Function here, but internally we wouldn't\n // want to deal with Function, only \"string\". However, in this method it is indeed possible\n return {\n type,\n attributes: attributes as any,\n children,\n }\n}\n\nexport const getRenderer = (document: Document): DomAbstractionImpl => {\n // DOM abstraction layer for manipulation\n const renderer = {\n hasElNamespace: (domElement: Element | Document): boolean => (domElement as Element).namespaceURI === nsMap.svg,\n\n hasSvgNamespace: (parentElement: Element | Document, type: string): boolean =>\n renderer.hasElNamespace(parentElement) && type !== 'STYLE' && type !== 'SCRIPT',\n\n createElementOrElements: (\n virtualNode: VNode | undefined | Array<VNode | undefined | string>,\n parentDomElement?: Element | Document,\n ): Array<Element | Text | undefined> | Element | Text | undefined => {\n if (Array.isArray(virtualNode)) {\n return renderer.createChildElements(virtualNode, parentDomElement)\n }\n if (typeof virtualNode !== 'undefined') {\n return renderer.createElement(virtualNode, parentDomElement)\n }\n // undefined virtualNode -> e.g. when a tsx variable is used in markup which is undefined\n return renderer.createTextNode('', parentDomElement)\n },\n\n createElement: (virtualNode: VNode, parentDomElement?: Element | Document): Element | undefined => {\n let newEl: Element\n\n if (\n virtualNode.type.toUpperCase() === 'SVG' ||\n (parentDomElement && renderer.hasSvgNamespace(parentDomElement, virtualNode.type.toUpperCase()))\n ) {\n newEl = document.createElementNS(nsMap.svg, virtualNode.type as string)\n } else {\n newEl = document.createElement(virtualNode.type as string)\n }\n\n if (virtualNode.attributes) {\n // dangerouslySetInnerHTML={{ __html: '<... />' }}\n if ('dangerouslySetInnerHTML' in virtualNode.attributes) {\n newEl.innerHTML = virtualNode.attributes.dangerouslySetInnerHTML?.__html\n delete virtualNode.attributes.dangerouslySetInnerHTML \n }\n renderer.setAttributes(virtualNode.attributes, newEl as Element)\n }\n\n if (virtualNode.children) {\n renderer.createChildElements(virtualNode.children, newEl as Element)\n }\n\n if (parentDomElement) {\n parentDomElement.appendChild(newEl)\n\n // check for a lifecycle \"onMount\" hook and call it\n if (typeof (newEl as any).$onMount === 'function') {\n ;(newEl as any).$onMount!()\n }\n }\n return newEl as Element\n },\n\n createTextNode: (text: string, domElement?: Element | Document): Text => {\n const node = document.createTextNode(text.toString())\n\n if (domElement) {\n domElement.appendChild(node)\n }\n return node\n },\n\n createChildElements: (\n virtualChildren: VNodeChildren,\n domElement?: Element | Document,\n ): Array<Element | Text | undefined> => {\n const children: Array<Element | Text | undefined> = []\n\n for (let i = 0; i < virtualChildren.length; i++) {\n const virtualChild = virtualChildren[i]\n if (virtualChild === null || (typeof virtualChild !== 'object' && typeof virtualChild !== 'function')) {\n children.push(\n renderer.createTextNode(\n (typeof virtualChild === 'undefined' || virtualChild === null ? '' : virtualChild!).toString(),\n domElement,\n ),\n )\n } else {\n children.push(renderer.createElement(virtualChild as VNode, domElement))\n }\n }\n return children\n },\n\n setAttribute: (name: string, value: any, domElement: Element) => {\n // attributes not set (undefined) are ignored; use null value to reset an attributes state\n if (typeof value === 'undefined') return\n\n // save ref as { current: DOMElement } in ref object\n // allows for ref={someRef}\n if (name === REF_ATTRIBUTE_NAME && typeof value !== 'function') {\n value.current = domElement\n } else if (name === REF_ATTRIBUTE_NAME && typeof value === 'function') {\n // allow for functional ref's like: render(<div ref={(el) => console.log('got el', el)} />)\n value(domElement)\n }\n\n if (name.startsWith('on') && typeof value === 'function') {\n let eventName = name.substring(2).toLowerCase()\n const capturePos = eventName.indexOf('capture')\n const doCapture = capturePos > -1\n\n if (eventName === 'mount') {\n ;(domElement as any).$onMount = value\n }\n\n // onClickCapture={...} support\n if (doCapture) {\n eventName = eventName.substring(0, capturePos)\n }\n domElement.addEventListener(eventName, value, doCapture)\n return\n }\n\n // transforms className=\"...\" -> class=\"...\"\n // allows for React TSX to work seamlessly\n if (name === 'className') {\n name = CLASS_ATTRIBUTE_NAME\n }\n\n // transforms class={['a', 'b']} into class=\"a b\"\n if (name === CLASS_ATTRIBUTE_NAME && Array.isArray(value)) {\n value = value.join(' ')\n }\n\n const nsEndIndex = name.match(/[A-Z]/)?.index\n if (renderer.hasElNamespace(domElement) && nsEndIndex) {\n const ns = name.substring(0, nsEndIndex).toLowerCase()\n const attrName = name.substring(nsEndIndex, name.length).toLowerCase()\n const namespace = nsMap[ns as keyof typeof nsMap] || null\n domElement.setAttributeNS(\n namespace,\n ns === XLINK_ATTRIBUTE_NAME || ns === 'xmlns' ? `${ns}:${attrName}` : name,\n value,\n )\n } else if (name === 'style' && typeof value !== 'string') {\n const propNames = Object.keys(value)\n\n // allows for style={{ margin: 10 }} etc.\n for (let i = 0; i < propNames.length; i++) {\n ;(domElement as HTMLElement).style[propNames[i] as any] = value[propNames[i]]\n }\n } else if (typeof value === 'boolean') {\n // for cases like <button checked={false} />\n ;(domElement as any)[name] = value\n } else {\n // for any other case\n domElement.setAttribute(name, value)\n }\n },\n\n setAttributes: (attributes: VNodeAttributes, domElement: Element) => {\n const attrNames = Object.keys(attributes)\n for (let i = 0; i < attrNames.length; i++) {\n renderer.setAttribute(attrNames[i], attributes[attrNames[i]], domElement)\n }\n },\n }\n return renderer\n}\n\nexport const renderIsomorphic = (\n virtualNode: VNode | undefined | string | Array<VNode | undefined | string>,\n parentDomElement: Element | Document | Dequery | undefined,\n globals: Globals,\n): Array<Element | Text | undefined> | Element | Text | undefined => {\n\n const parentEl = (parentDomElement as Dequery).el as Element || parentDomElement\n\n if (typeof virtualNode === 'string') {\n return getRenderer(globals.window.document).createTextNode(virtualNode, parentEl)\n }\n return getRenderer(globals.window.document).createElementOrElements(virtualNode, parentEl)\n}\n\nexport const Fragment = (props: VNode) => props.children\n\nexport default {\n jsx,\n Fragment,\n renderIsomorphic,\n getRenderer,\n onUpdateFn,\n};"],"names":[],"mappings":"AACA,MAAM,oBAAoB,GAAG,OAAO;AACpC,MAAM,oBAAoB,GAAG,OAAO;AACpC,MAAM,oBAAoB,GAAG,OAAO;AACpC,MAAM,kBAAkB,GAAG,KAAK;AAChC,MAAM,KAAK,GAAG;AACd,EAAE,CAAC,oBAAoB,GAAG,+BAA+B;AACzD,EAAE,CAAC,oBAAoB,GAAG,8BAA8B;AACxD,EAAE,GAAG,EAAE;AACP,CAAC;AACD,MAAM,YAAY,GAAG,CAAC,IAAI;AAC1B;AACA,EAAE,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC;AAC9E,CAAC;AACD,MAAM,cAAc,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;AACrF,MAAM,UAAU,GAAG,SAAS,QAAQ,EAAE;AACtC,EAAE,IAAI,CAAC,MAAM,GAAG,QAAQ;AACxB,CAAC;AACW,MAAC,GAAG,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,QAAQ,KAAK;AACtD,EAAE,QAAQ,GAAG,cAAc;AAC3B;AACA;AACA,IAAI,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,QAAQ;AAChC,GAAG;AACH,EAAE,UAAU,GAAG,EAAE,GAAG,UAAU,EAAE;AAChC,EAAE,IAAI,IAAI,KAAK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B;AAC1D,EAAE,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;AACvC,IAAI,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,WAAW,EAAE,QAAQ,CAAC;AACrF;AACA,EAAE,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,uBAAuB,CAAC,WAAW,EAAE,QAAQ,CAAC;AAC5F;AACY,MAAC,QAAQ,GAAG,CAAC,KAAK,KAAK,KAAK,CAAC;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/render/isomorph.ts"],"sourcesContent":["import type { Dequery } from '../dequery/types.js'\nimport type { VNodeChild, VNodeChildren, VNode, VNodeType, Ref, VNodeAttributes, DomAbstractionImpl, Globals } from './types.js'\n\nconst CLASS_ATTRIBUTE_NAME = 'class'\nconst XLINK_ATTRIBUTE_NAME = 'xlink'\nconst XMLNS_ATTRIBUTE_NAME = 'xmlns'\nconst REF_ATTRIBUTE_NAME = 'ref'\n\nconst nsMap = {\n [XMLNS_ATTRIBUTE_NAME]: 'http://www.w3.org/2000/xmlns/',\n [XLINK_ATTRIBUTE_NAME]: 'http://www.w3.org/1999/xlink',\n svg: 'http://www.w3.org/2000/svg',\n}\n\n// If a JSX comment is written, it looks like: { /* this */ }\n// Therefore, it turns into: {}, which is detected here\nconst isJSXComment = (node: VNode): boolean =>\n /* v8 ignore next */\n node && typeof node === 'object' && !node.attributes && !node.type && !node.children\n\n// Filters comments and undefines like: ['a', 'b', false, {}] to: ['a', 'b', false]\nconst filterComments = (children: Array<VNode> | Array<VNodeChild>) =>\n children.filter((child: VNodeChild) => !isJSXComment(child as VNode))\n\nconst onUpdateFn = function (this: Ref, callback: Function) {\n this.update = callback as any\n}\n\nexport const jsx = (\n // if it is a function, it is a component\n type: VNodeType | Function | any,\n attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null,\n ...children: Array<VNodeChildren> | VNodeChildren\n): Array<VNode> | VNode => {\n children = filterComments(\n // Implementation to flatten virtual node children structures like:\n // [<p>1</p>, [<p>2</p>,<p>3</p>]] to: [<p>1</p>,<p>2</p>,<p>3</p>]\n ([] as Array<VNodeChildren>).concat.apply([], children as any) as Array<VNodeChildren>,\n )\n\n // clone attributes as well\n attributes = { ...attributes }\n\n // effectively unwrap by directly returning the children\n if (type === 'fragment') {\n return filterComments(children) as Array<VNode>\n }\n\n // it's a component, divide and conquer children\n if (typeof type === 'function') {\n if (attributes.ref) {\n // references an onUpdate assignment function to be called inside of the functional component\n // to register an \"update\" function that can be called from the outside (ref.current.update(state?))\n ;(attributes.ref as Ref)!.onUpdate = onUpdateFn.bind(attributes.ref as Ref) as any\n }\n\n return type({\n children,\n ...attributes,\n })\n }\n\n // @ts-ignore as type allows for Function here, but internally we wouldn't\n // want to deal with Function, only \"string\". However, in this method it is indeed possible\n return {\n type,\n attributes: attributes as any,\n children,\n }\n}\n\nexport const getRenderer = (document: Document): DomAbstractionImpl => {\n // DOM abstraction layer for manipulation\n const renderer = {\n hasElNamespace: (domElement: Element | Document): boolean => (domElement as Element).namespaceURI === nsMap.svg,\n\n hasSvgNamespace: (parentElement: Element | Document, type: string): boolean =>\n renderer.hasElNamespace(parentElement) && type !== 'STYLE' && type !== 'SCRIPT',\n\n createElementOrElements: (\n virtualNode: VNode | undefined | Array<VNode | undefined | string>,\n parentDomElement?: Element | Document,\n ): Array<Element | Text | undefined> | Element | Text | undefined => {\n if (Array.isArray(virtualNode)) {\n return renderer.createChildElements(virtualNode, parentDomElement)\n }\n if (typeof virtualNode !== 'undefined') {\n return renderer.createElement(virtualNode, parentDomElement)\n }\n // undefined virtualNode -> e.g. when a tsx variable is used in markup which is undefined\n return renderer.createTextNode('', parentDomElement)\n },\n\n createElement: (virtualNode: VNode, parentDomElement?: Element | Document): Element | undefined => {\n let newEl: Element\n\n if (\n virtualNode.type.toUpperCase() === 'SVG' ||\n (parentDomElement && renderer.hasSvgNamespace(parentDomElement, virtualNode.type.toUpperCase()))\n ) {\n newEl = document.createElementNS(nsMap.svg, virtualNode.type as string)\n } else {\n newEl = document.createElement(virtualNode.type as string)\n }\n\n if (virtualNode.attributes) {\n // dangerouslySetInnerHTML={{ __html: '<... />' }}\n if ('dangerouslySetInnerHTML' in virtualNode.attributes) {\n newEl.innerHTML = virtualNode.attributes.dangerouslySetInnerHTML?.__html\n delete virtualNode.attributes.dangerouslySetInnerHTML \n }\n renderer.setAttributes(virtualNode.attributes, newEl as Element)\n }\n\n if (virtualNode.children) {\n renderer.createChildElements(virtualNode.children, newEl as Element)\n }\n\n if (parentDomElement) {\n parentDomElement.appendChild(newEl)\n\n // check for a lifecycle \"onMount\" hook and call it\n if (typeof (newEl as any).$onMount === 'function') {\n ;(newEl as any).$onMount!()\n }\n }\n return newEl as Element\n },\n\n createTextNode: (text: string, domElement?: Element | Document): Text => {\n const node = document.createTextNode(text.toString())\n\n if (domElement) {\n domElement.appendChild(node)\n }\n return node\n },\n\n createChildElements: (\n virtualChildren: VNodeChildren,\n domElement?: Element | Document,\n ): Array<Element | Text | undefined> => {\n const children: Array<Element | Text | undefined> = []\n\n for (let i = 0; i < virtualChildren.length; i++) {\n const virtualChild = virtualChildren[i]\n if (virtualChild === null || (typeof virtualChild !== 'object' && typeof virtualChild !== 'function')) {\n children.push(\n renderer.createTextNode(\n (typeof virtualChild === 'undefined' || virtualChild === null ? '' : virtualChild!).toString(),\n domElement,\n ),\n )\n } else {\n children.push(renderer.createElement(virtualChild as VNode, domElement))\n }\n }\n return children\n },\n\n setAttribute: (name: string, value: any, domElement: Element) => {\n // attributes not set (undefined) are ignored; use null value to reset an attributes state\n if (typeof value === 'undefined') return\n\n // save ref as { current: DOMElement } in ref object\n // allows for ref={someRef}\n if (name === REF_ATTRIBUTE_NAME && typeof value !== 'function') {\n value.current = domElement\n } else if (name === REF_ATTRIBUTE_NAME && typeof value === 'function') {\n // allow for functional ref's like: render(<div ref={(el) => console.log('got el', el)} />)\n value(domElement)\n }\n\n if (name.startsWith('on') && typeof value === 'function') {\n let eventName = name.substring(2).toLowerCase()\n const capturePos = eventName.indexOf('capture')\n const doCapture = capturePos > -1\n\n if (eventName === 'mount') {\n ;(domElement as any).$onMount = value\n }\n\n // onClickCapture={...} support\n if (doCapture) {\n eventName = eventName.substring(0, capturePos)\n }\n domElement.addEventListener(eventName, value, doCapture)\n return\n }\n\n // transforms className=\"...\" -> class=\"...\"\n // allows for React TSX to work seamlessly\n if (name === 'className') {\n name = CLASS_ATTRIBUTE_NAME\n }\n\n // transforms class={['a', 'b']} into class=\"a b\"\n if (name === CLASS_ATTRIBUTE_NAME && Array.isArray(value)) {\n value = value.join(' ')\n }\n\n const nsEndIndex = name.match(/[A-Z]/)?.index\n if (renderer.hasElNamespace(domElement) && nsEndIndex) {\n const ns = name.substring(0, nsEndIndex).toLowerCase()\n const attrName = name.substring(nsEndIndex, name.length).toLowerCase()\n const namespace = nsMap[ns as keyof typeof nsMap] || null\n domElement.setAttributeNS(\n namespace,\n ns === XLINK_ATTRIBUTE_NAME || ns === 'xmlns' ? `${ns}:${attrName}` : name,\n value,\n )\n } else if (name === 'style' && typeof value !== 'string') {\n const propNames = Object.keys(value)\n\n // allows for style={{ margin: 10 }} etc.\n for (let i = 0; i < propNames.length; i++) {\n ;(domElement as HTMLElement).style[propNames[i] as any] = value[propNames[i]]\n }\n } else if (typeof value === 'boolean') {\n // for cases like <button checked={false} />\n ;(domElement as any)[name] = value\n } else {\n // for any other case\n domElement.setAttribute(name, value)\n }\n },\n\n setAttributes: (attributes: VNodeAttributes, domElement: Element) => {\n const attrNames = Object.keys(attributes)\n for (let i = 0; i < attrNames.length; i++) {\n renderer.setAttribute(attrNames[i], attributes[attrNames[i]], domElement)\n }\n },\n }\n return renderer\n}\n\nexport const renderIsomorphic = (\n virtualNode: VNode | undefined | string | Array<VNode | undefined | string>,\n parentDomElement: Element | Document | Dequery | undefined,\n globals: Globals,\n): Array<Element | Text | undefined> | Element | Text | undefined => {\n\n const parentEl = (parentDomElement as Dequery).el as Element || parentDomElement\n\n if (typeof virtualNode === 'string') {\n return getRenderer(globals.window.document).createTextNode(virtualNode, parentEl)\n }\n return getRenderer(globals.window.document).createElementOrElements(virtualNode, parentEl)\n}\n\nexport const Fragment = (props: VNode) => props.children\nexport const jsxs = jsx\nexport const jsxDEV = jsx\n\nexport default {\n jsx,\n Fragment,\n renderIsomorphic,\n getRenderer,\n onUpdateFn,\n\n // implementing the full standard\n // https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md\n jsxs,\n jsxDEV,\n};"],"names":[],"mappings":"AACA,MAAM,oBAAoB,GAAG,OAAO;AACpC,MAAM,oBAAoB,GAAG,OAAO;AACpC,MAAM,oBAAoB,GAAG,OAAO;AACpC,MAAM,kBAAkB,GAAG,KAAK;AAChC,MAAM,KAAK,GAAG;AACd,EAAE,CAAC,oBAAoB,GAAG,+BAA+B;AACzD,EAAE,CAAC,oBAAoB,GAAG,8BAA8B;AACxD,EAAE,GAAG,EAAE;AACP,CAAC;AACD,MAAM,YAAY,GAAG,CAAC,IAAI;AAC1B;AACA,EAAE,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC;AAC9E,CAAC;AACD,MAAM,cAAc,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;AACrF,MAAM,UAAU,GAAG,SAAS,QAAQ,EAAE;AACtC,EAAE,IAAI,CAAC,MAAM,GAAG,QAAQ;AACxB,CAAC;AACW,MAAC,GAAG,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,QAAQ,KAAK;AACtD,EAAE,QAAQ,GAAG,cAAc;AAC3B;AACA;AACA,IAAI,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,QA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,gBAAgB,EAAE,OAAO,KAAK;AAC5E,EAAE,MAAM,QAAQ,GAAG,gBAAgB,CAAC,EAAE,IAAI,gBAAgB;AAC1D,EAAE,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;AACvC,IAAI,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,WAAW,EAAE,QAAQ,CAAC;AACrF;AACA,EAAE,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,uBAAuB,CAAC,WAAW,EAAE,QAAQ,CAAC;AAC5F;AACY,MAAC,QAAQ,GAAG,CAAC,KAAK,KAAK,KAAK,CAAC;AAC7B,MAAC,IAAI,GAAG;AACR,MAAC,MAAM,GAAG;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";var i=Object.defineProperty;var o=(e,r)=>i(e,"name",{value:r,configurable:!0});var g=require("linkedom"),n=require("./index.cjs");const m=o((e,r,t={})=>{const l=t.browserGlobals?t.browserGlobals:c(),a=d(t.createRoot,l);return r||(r=s(a)),n.renderIsomorphic(e,r,l)},"render"),s=o(e=>{const r=e.createElement("html");return e.appendChild(r),e.documentElement},"createRoot"),c=o(e=>g.parseHTML(e||""),"getBrowserGlobals"),d=o((e=!1,r)=>{const t=(r||c()).document;return e&&s(t),t},"getDocument"),u=o(e=>e.toString(),"renderToString");exports.Fragment=n.Fragment,exports.getRenderer=n.getRenderer,exports.jsx=n.jsx,exports.renderIsomorphic=n.renderIsomorphic,exports.createRoot=s,exports.getBrowserGlobals=c,exports.getDocument=d,exports.render=m,exports.renderToString=u;
1
+ "use strict";var i=Object.defineProperty;var s=(e,r)=>i(e,"name",{value:r,configurable:!0});var g=require("linkedom"),o=require("./index.cjs");const m=s((e,r,t={})=>{const l=t.browserGlobals?t.browserGlobals:c(),a=d(t.createRoot,l);return r||(r=n(a)),o.renderIsomorphic(e,r,l)},"render"),n=s(e=>{const r=e.createElement("html");return e.appendChild(r),e.documentElement},"createRoot"),c=s(e=>g.parseHTML(e||""),"getBrowserGlobals"),d=s((e=!1,r)=>{const t=(r||c()).document;return e&&n(t),t},"getDocument"),u=s(e=>e.toString(),"renderToString");exports.Fragment=o.Fragment,exports.getRenderer=o.getRenderer,exports.jsx=o.jsx,exports.jsxDEV=o.jsxDEV,exports.jsxs=o.jsxs,exports.renderIsomorphic=o.renderIsomorphic,exports.createRoot=n,exports.getBrowserGlobals=c,exports.getDocument=d,exports.render=m,exports.renderToString=u;
2
2
  //# sourceMappingURL=server.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.cjs","sources":["../../src/render/server.ts"],"sourcesContent":["import { parseHTML } from 'linkedom'\nimport { renderIsomorphic } from './isomorph.js'\nimport type { RenderInput, RenderResult, Globals } from './types.js'\nimport type { Dequery } from '../dequery/types.js'\n\nexport interface RenderOptions {\n /** choose an arbitrary server-side DOM / Document implementation; this library defaults to 'linkedom'; default: undefined */\n browserGlobals?: Globals\n\n /** creates a synthetic <html> root element in case you want to render in isolation; default: false; also happens when parentDomElement isn't present */\n createRoot?: boolean\n}\n\nexport const render = <T extends RenderInput>(\n virtualNode: T,\n parentDomElement?: Element | Dequery,\n options: RenderOptions = {},\n): RenderResult<T> => {\n const browserGlobals = options.browserGlobals ? options.browserGlobals : getBrowserGlobals()\n const document = getDocument(options.createRoot, browserGlobals)\n\n if (!parentDomElement) {\n parentDomElement = createRoot(document)\n }\n return renderIsomorphic(virtualNode, parentDomElement, browserGlobals) as any\n}\n\nexport const createRoot = (document: Document): Element => {\n const htmlElement = document.createElement('html')\n document.appendChild(htmlElement)\n return document.documentElement\n}\n\nexport const getBrowserGlobals = (initialHtml?: string): Globals => parseHTML(initialHtml || '')\n\nexport const getDocument = (shouldCreateRoot = false, browserGlobals?: Globals): Document => {\n const document = (browserGlobals || getBrowserGlobals()).document\n if (shouldCreateRoot) {\n createRoot(document)\n return document\n }\n return document\n}\n\nexport const renderToString = (el: Node) => el.toString()\n\nexport * from './index.js'\n"],"names":["renderIsomorphic","parseHTML"],"mappings":";;;;;AAGY,MAAC,MAAM,GAAG,CAAC,WAAW,EAAE,gBAAgB,EAAE,OAAO,GAAG,EAAE,KAAK;AACvE,EAAE,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,GAAG,iBAAiB,EAAE;AAC9F,EAAE,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC;AAClE,EAAE,IAAI,CAAC,gBAAgB,EAAE;AACzB,IAAI,gBAAgB,GAAG,UAAU,CAAC,QAAQ,CAAC;AAC3C;AACA,EAAE,OAAOA,sBAAgB,CAAC,WAAW,EAAE,gBAAgB,EAAE,cAAc,CAAC;AACxE;AACY,MAAC,UAAU,GAAG,CAAC,QAAQ,KAAK;AACxC,EAAE,MAAM,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC;AACpD,EAAE,QAAQ,CAAC,WAAW,CAAC,WAAW,CAAC;AACnC,EAAE,OAAO,QAAQ,CAAC,eAAe;AACjC;AACY,MAAC,iBAAiB,GAAG,CAAC,WAAW,KAAKC,kBAAS,CAAC,WAAW,IAAI,EAAE;AACjE,MAAC,WAAW,GAAG,CAAC,gBAAgB,GAAG,KAAK,EAAE,cAAc,KAAK;AACzE,EAAE,MAAM,QAAQ,GAAG,CAAC,cAAc,IAAI,iBAAiB,EAAE,EAAE,QAAQ;AACnE,EAAE,IAAI,gBAAgB,EAAE;AACxB,IAAI,UAAU,CAAC,QAAQ,CAAC;AACxB,IAAI,OAAO,QAAQ;AACnB;AACA,EAAE,OAAO,QAAQ;AACjB;AACY,MAAC,cAAc,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,QAAQ;;;;;;;;;;;;"}
1
+ {"version":3,"file":"server.cjs","sources":["../../src/render/server.ts"],"sourcesContent":["import { parseHTML } from 'linkedom'\nimport { renderIsomorphic } from './isomorph.js'\nimport type { RenderInput, RenderResult, Globals } from './types.js'\nimport type { Dequery } from '../dequery/types.js'\n\nexport interface RenderOptions {\n /** choose an arbitrary server-side DOM / Document implementation; this library defaults to 'linkedom'; default: undefined */\n browserGlobals?: Globals\n\n /** creates a synthetic <html> root element in case you want to render in isolation; default: false; also happens when parentDomElement isn't present */\n createRoot?: boolean\n}\n\nexport const render = <T extends RenderInput>(\n virtualNode: T,\n parentDomElement?: Element | Dequery,\n options: RenderOptions = {},\n): RenderResult<T> => {\n const browserGlobals = options.browserGlobals ? options.browserGlobals : getBrowserGlobals()\n const document = getDocument(options.createRoot, browserGlobals)\n\n if (!parentDomElement) {\n parentDomElement = createRoot(document)\n }\n return renderIsomorphic(virtualNode, parentDomElement, browserGlobals) as any\n}\n\nexport const createRoot = (document: Document): Element => {\n const htmlElement = document.createElement('html')\n document.appendChild(htmlElement)\n return document.documentElement\n}\n\nexport const getBrowserGlobals = (initialHtml?: string): Globals => parseHTML(initialHtml || '')\n\nexport const getDocument = (shouldCreateRoot = false, browserGlobals?: Globals): Document => {\n const document = (browserGlobals || getBrowserGlobals()).document\n if (shouldCreateRoot) {\n createRoot(document)\n return document\n }\n return document\n}\n\nexport const renderToString = (el: Node) => el.toString()\n\nexport * from './index.js'\n"],"names":["renderIsomorphic","parseHTML"],"mappings":";;;;;AAGY,MAAC,MAAM,GAAG,CAAC,WAAW,EAAE,gBAAgB,EAAE,OAAO,GAAG,EAAE,KAAK;AACvE,EAAE,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,GAAG,iBAAiB,EAAE;AAC9F,EAAE,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,UAAU,EAAE,cAAc,CAAC;AAClE,EAAE,IAAI,CAAC,gBAAgB,EAAE;AACzB,IAAI,gBAAgB,GAAG,UAAU,CAAC,QAAQ,CAAC;AAC3C;AACA,EAAE,OAAOA,sBAAgB,CAAC,WAAW,EAAE,gBAAgB,EAAE,cAAc,CAAC;AACxE;AACY,MAAC,UAAU,GAAG,CAAC,QAAQ,KAAK;AACxC,EAAE,MAAM,WAAW,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC;AACpD,EAAE,QAAQ,CAAC,WAAW,CAAC,WAAW,CAAC;AACnC,EAAE,OAAO,QAAQ,CAAC,eAAe;AACjC;AACY,MAAC,iBAAiB,GAAG,CAAC,WAAW,KAAKC,kBAAS,CAAC,WAAW,IAAI,EAAE;AACjE,MAAC,WAAW,GAAG,CAAC,gBAAgB,GAAG,KAAK,EAAE,cAAc,KAAK;AACzE,EAAE,MAAM,QAAQ,GAAG,CAAC,cAAc,IAAI,iBAAiB,EAAE,EAAE,QAAQ;AACnE,EAAE,IAAI,gBAAgB,EAAE;AACxB,IAAI,UAAU,CAAC,QAAQ,CAAC;AACxB,IAAI,OAAO,QAAQ;AACnB;AACA,EAAE,OAAO,QAAQ;AACjB;AACY,MAAC,cAAc,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,QAAQ;;;;;;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
- import { G as Globals, R as RenderInput, D as Dequery, a as RenderResult } from '../index-CmIVEYfz.js';
2
- export { C as CSSProperties, m as Children, n as DomAbstractionImpl, F as FontFaceProperties, t as Fragment, K as KeyFrameProperties, P as Props, b as Ref, o as RenderNodeInput, p as RenderResultNode, U as UpdateFn, c as VAttributes, e as VNode, d as VNodeAttributes, k as VNodeChild, l as VNodeChildren, g as VNodeKey, j as VNodeRef, i as VNodeRefCallback, h as VNodeRefObject, f as VNodeType, V as VRef, r as getRenderer, q as jsx, s as renderIsomorphic } from '../index-CmIVEYfz.js';
1
+ import { G as Globals, R as RenderInput, D as Dequery, a as RenderResult } from '../index-Bg6gfvFM.js';
2
+ export { C as CSSProperties, m as Children, n as DomAbstractionImpl, F as FontFaceProperties, t as Fragment, K as KeyFrameProperties, P as Props, b as Ref, o as RenderNodeInput, p as RenderResultNode, U as UpdateFn, c as VAttributes, e as VNode, d as VNodeAttributes, k as VNodeChild, l as VNodeChildren, g as VNodeKey, j as VNodeRef, i as VNodeRefCallback, h as VNodeRefObject, f as VNodeType, V as VRef, r as getRenderer, q as jsx, v as jsxDEV, u as jsxs, s as renderIsomorphic } from '../index-Bg6gfvFM.js';
3
3
  import * as CSS from 'csstype';
4
4
  export { CSS };
5
5
 
@@ -1,5 +1,5 @@
1
- import { G as Globals, R as RenderInput, D as Dequery, a as RenderResult } from '../index-CmIVEYfz.js';
2
- export { C as CSSProperties, m as Children, n as DomAbstractionImpl, F as FontFaceProperties, t as Fragment, K as KeyFrameProperties, P as Props, b as Ref, o as RenderNodeInput, p as RenderResultNode, U as UpdateFn, c as VAttributes, e as VNode, d as VNodeAttributes, k as VNodeChild, l as VNodeChildren, g as VNodeKey, j as VNodeRef, i as VNodeRefCallback, h as VNodeRefObject, f as VNodeType, V as VRef, r as getRenderer, q as jsx, s as renderIsomorphic } from '../index-CmIVEYfz.js';
1
+ import { G as Globals, R as RenderInput, D as Dequery, a as RenderResult } from '../index-Bg6gfvFM.js';
2
+ export { C as CSSProperties, m as Children, n as DomAbstractionImpl, F as FontFaceProperties, t as Fragment, K as KeyFrameProperties, P as Props, b as Ref, o as RenderNodeInput, p as RenderResultNode, U as UpdateFn, c as VAttributes, e as VNode, d as VNodeAttributes, k as VNodeChild, l as VNodeChildren, g as VNodeKey, j as VNodeRef, i as VNodeRefCallback, h as VNodeRefObject, f as VNodeType, V as VRef, r as getRenderer, q as jsx, v as jsxDEV, u as jsxs, s as renderIsomorphic } from '../index-Bg6gfvFM.js';
3
3
  import * as CSS from 'csstype';
4
4
  export { CSS };
5
5
 
@@ -1,2 +1,2 @@
1
- var d=Object.defineProperty;var o=(r,e)=>d(r,"name",{value:e,configurable:!0});import{parseHTML as b}from"linkedom";import{renderIsomorphic as l}from"./index.mjs";import{Fragment as G,getRenderer as x,jsx as R}from"./index.mjs";const u=o((r,e,t={})=>{const c=t.browserGlobals?t.browserGlobals:s(),a=m(t.createRoot,c);return e||(e=n(a)),l(r,e,c)},"render"),n=o(r=>{const e=r.createElement("html");return r.appendChild(e),r.documentElement},"createRoot"),s=o(r=>b(r||""),"getBrowserGlobals"),m=o((r=!1,e)=>{const t=(e||s()).document;return r&&n(t),t},"getDocument"),f=o(r=>r.toString(),"renderToString");export{G as Fragment,n as createRoot,s as getBrowserGlobals,m as getDocument,x as getRenderer,R as jsx,u as render,l as renderIsomorphic,f as renderToString};
1
+ var d=Object.defineProperty;var o=(r,e)=>d(r,"name",{value:e,configurable:!0});import{parseHTML as b}from"linkedom";import{renderIsomorphic as l}from"./index.mjs";import{Fragment as w,getRenderer as G,jsx as j,jsxDEV as R,jsxs as E}from"./index.mjs";const u=o((r,e,t={})=>{const c=t.browserGlobals?t.browserGlobals:n(),a=m(t.createRoot,c);return e||(e=s(a)),l(r,e,c)},"render"),s=o(r=>{const e=r.createElement("html");return r.appendChild(e),r.documentElement},"createRoot"),n=o(r=>b(r||""),"getBrowserGlobals"),m=o((r=!1,e)=>{const t=(e||n()).document;return r&&s(t),t},"getDocument"),f=o(r=>r.toString(),"renderToString");export{w as Fragment,s as createRoot,n as getBrowserGlobals,m as getDocument,G as getRenderer,j as jsx,R as jsxDEV,E as jsxs,u as render,l as renderIsomorphic,f as renderToString};
2
2
  //# sourceMappingURL=server.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "defuss",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"