defuss 1.0.1 → 1.1.0

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.
package/README.md CHANGED
@@ -1,89 +1,231 @@
1
- <h1 align="center">defuss</h1>
1
+ <h1 align="center">
2
2
 
3
- > Explicit simplicity for the web.
3
+ <img src="assets/defuss_mascott.png" width="100px" />
4
4
 
5
- <h2 align="center">The Complexity Problem</h2>
5
+ <p align="center">
6
+ <code>defuss</code>
7
+ </p>
6
8
 
7
- Modern web frontend development is complex, but it must not be.
8
- While others pile layers of complexity, changing APIs like underwear
9
- and drive poor developers crazy, `defuss` brings back the feeling
10
- of simple web development.
9
+ <sup align="center">
11
10
 
12
- <h2 align="center">Features</h2>
11
+ Simplify & Succeed
13
12
 
14
- - ✅ Does render JSX/TSX on client and server - DOM (`render`) and HTML (`renderToString`)
15
- - ✅ Allows to render `Function`al components like `<Foo />`
16
- - ✅ Supports every JSX feature you know, including Fragments `<></>`, Refs `ref={}` and `onMount={fn}`
17
- - ✅ Allows to render a whole HTML document server-side, starting with `<html>`
18
- - ✅ Available as a simple API
19
- - Supports `dangerouslySetInnerHTML={{ __html: '<... />' }`
20
- - ✅ Just `1113 byte` nano sized (ESM, gizpped) on client
21
- - ✅ Just `1254 byte` nano sized (ESM, gizpped) on server
22
- - ✅ Tree-shakable and side-effect free
13
+ </sup>
14
+
15
+ </h1>
16
+
17
+
18
+ > `defuss` is a simple, tiny and modern web framework. It stops **complexity**, promotes **explicit code**, and brings back the **joy** of building for the web! 😊
19
+
20
+ <h2 align="center">
21
+
22
+ Packages
23
+
24
+ </h2>
25
+
26
+ **💡 Can you imagine?:** The most important parts of `defuss`, the `defuss/render` and `defuss/dequery` are written in only ~500 Lines of Code all-in! That's why a **production** build is only **2 KiB** in size.
27
+
28
+ <h3 align="center">
29
+
30
+ `defuss/render`
31
+
32
+ </h3>
33
+
34
+ The JSX renderer is a core technology of `defuss`. It turns JSX-based HTML/SVG markup like `<div />` and functional components markup like `<MyComponent />` into a lightweight, JSON-based virtual DOM, then renders it via SSR on the server, and the native DOM API in the browser.
35
+
36
+ Would you have thought that one can squeeze this into only ~320 lines of readable and well documented code?
37
+
38
+ #### Features:
39
+
40
+ - ✅ `defuss`' JSX is similar to React/Preact/Solid.js JSX code.
41
+ - ✅ It works in-browser and on the server (SSR).
42
+ - ✅ `Function`al components like `<Foo />` are fully supported.
43
+ - ✅ Fragments `<> <div /><div /> </>` are supported.
44
+ - ✅ Refs `ref={btn}` and referencing via `btn.current` is supported.
45
+ - ✅ Lifecycle hooks like `onMount={(el) => console.log(el, 'Button added to the DOM!')}` are supported.
46
+ - ✅ Supports `innerHTML` mutaton using `dangerouslySetInnerHTML={{ __html: '<... />' }`.
47
+ - ✅ It can render whole HTML documents on server-side (SSR), starting with `<html>`.
48
+ - ✅ Extremely simple, fast, memory-efficient, and isomorphic implementation.
49
+ - ✅ Comes with an API of just three functions: `jsx`, `render`, `renderToString`.
50
+ - ✅ Works with `Vite`, `Astro` and vanilla JavaScript projects.
51
+ - ✅ It's tiny! Written in ~320 LoC. ~`2 KiB` all-in (client, gzip).
52
+ - ✅ Tree-shakable and side-effect free.
53
+ - ✅ Written in modern TypeScript.
54
+ - ✅ 100% Unit Test coverage.
55
+
56
+ <img src="assets/defuss_renderer_coverage_report.png" />
57
+
58
+ #### How does the `defuss/render` it work?
59
+
60
+ A modern build tool like `Vite` (`Astro` builds on `Vite`) watches for changes in your codebase. When you change your code in your code editor, it will tell a transpiler (e.g. `esbuild`, `swc`, `tsc` or `babel`) to read the changed code file and turn it into valid JavaScript code for the target runtime (a browser, Node.js, etc.). When this is done, it will pass all JavaScript code to a bundler to create final, optimized products of code.
61
+
62
+ Build tools like `Vite` (and also `Astro`) allow developers to hook into that process and inject 3rd party plugins. `defuss/render` is such a plugin. It will use `esbuild` or `babel` to turn the JSX dialect code (think: `<MyComponent foo="bar" />` or `<div></div>`) into a tree of `jsx` function calls (think: `tsx(MyComponent, { foo: "bar" })`).
63
+
64
+ The `jsx` function then creates a "virtual DOM" from this, which simply is a JSON object tree that represents the exact same information the JSX stated: `{ "type": MyComponent, "attributes": { "foo": "bar", "children": [] } }` or `{ "type": "div", "attributes": {}, "children": []}`. It will call the functional Components like this: `MyComponent({ ...attributes })` until eventually, only HTML elements remain.
65
+
66
+ The resulting JSON object tree that describes a HTML tree will then *replace* the JSX code in the original JavaScript source code file, turning *invalid* JavaScript code, that no browser, Node.js & co. can handle (because it contains JSX dialect), into perfectly valid JavaScript code. Of course, a user still can't see any element rendered. We're still at the "code transpilation" stage.
67
+
68
+ Rendering and presenting can only happen in the browser, because only the browser is able to display HTML elements to the user.
69
+
70
+ Therefore, the browser can either:
71
+
72
+ - Receive such a JSON-serialized VDOM tree together with some runtime code so that the `render` function can create a native DOM element for each node in the virtual, JSON-serialized DOM tree. This native DOM tree starts with one or many top-level DOM elements that are then added somewhere in the web page using the `appendChild` API, or
73
+
74
+ - Receive a serialized HTML string that the browser can *implicity* render, just like a static website. To do that, the virtual DOM must be pre-rendered on the server-side (SSR use-case). However, the `render` function cannot use the native DOM API on the server, because it is not available. Therefore `linkedom`, a DOM API implementation that works on the server and emulates a native DOM API, is used. When done, `renderToString` is called for every resulting top-level DOM element to turn it into a HTML string a browser can display directly.
75
+
76
+ ---
77
+ ---
78
+
79
+
80
+ <h3 align="center">
81
+
82
+ `defuss/cache`
83
+
84
+ </h3>
85
+
86
+ Using `localStorage` and `sessionStorage` for caching might seem straightforward, but there are several challenges to consider. Modern browsers have private modes with security and quota limitations, which can lead to errors when attempting to write data. Additionally, in server-side rendering (SSR) environments, these APIs are unavailable, necessitating a fallback mechanism.
87
+
88
+ All of these challenges can be addressed in just a few lines of clear and well-documented code.
89
+
90
+ #### Features:
91
+
92
+ - ✅ Write to storage using simple key/value API
93
+ - ✅ Middleware function API allows to hook what is read and written
94
+ - ✅ Isomorphic, works in-browser and in Node.js
95
+ - ✅ Supports `localStorage`
96
+ - ✅ Supports `sessionStorage`
97
+ - ✅ Supports in-memory as an automatic fallback
98
+ - ✅ Exposes the backend API reference of each storage provider for low-level API access
99
+ - ✅ Tree-shakable, side-effect free
23
100
  - ✅ First class TypeScript support
101
+ - ✅ Zero dependencies
24
102
  - ✅ 100% Unit Test coverage
25
103
 
26
- <img src="./coverage_report.png" />
104
+ <img src="assets/defuss_cache_coverage_report.png" />
105
+
106
+ #### How to use `defuss/cache`?
27
107
 
28
- <h2 align="center">Example usage</h2>
108
+ ```ts
109
+ import { cache } from 'defuss'
29
110
 
30
- <h3 align="center">Setup</h3>
111
+ const demoCache = cache('memory') // alternatives: 'local' | 'session' |
31
112
 
32
- - yarn: `yarn add @jsheaven/render`
33
- - npm: `npm install @jsheaven/render`
113
+ // store a value
114
+ demoCache.set('abc', 123)
34
115
 
35
- <h3 align="center">ESM</h3>
116
+ // read a previously stored value, if not existing, return the default (0)
117
+ const valueStored = demoCache.get('abc', 0)
36
118
 
37
- Configure the following values in your `tsconfig.json` or likewise,
38
- in the configuration options of your favourite bundler:
119
+ // remove a single value
120
+ demoCache.remove('abc')
39
121
 
40
- ```json
41
- {
42
- ...
43
- "jsx": "react",
44
- "jsxFactory": "tsx",
45
- "jsxFragmentFactory": "Fragment",
46
- ...
47
- }
122
+ // delete all values
123
+ demoCache.removeAll()
48
124
  ```
49
125
 
50
- This will make sure that the JSX syntax is correctly transformed into a
51
- JavaScript object tree (AOT, at compile time) that can be rendered by this library
52
- at runtime (SSG, SSR or even, if desired, in-browser).
126
+ #### How does the `defuss/cache` work?
53
127
 
54
- <h4 align="center">Server-side usage:</h4>
128
+ The `defuss/cache` module provides a unified API for caching across different environments, using `localStorage`, `sessionStorage`, and in-memory storage.
129
+
130
+ - **What**: It offers a simple key/value API for storage operations, supports middleware for custom read/write logic, and provides a fallback to in-memory storage when `localStorage` or `sessionStorage` are unavailable.
131
+
132
+ - **Why**: This design ensures compatibility in both browser and server-side environments, addressing limitations like private mode restrictions and SSR unavailability of web storage APIs.
133
+
134
+ - **Where**:
135
+ - In the browser, it uses `localStorage` and `sessionStorage` through the [`WebStorageProvider`](./src/cache/client/index.ts) class.
136
+ - On the server, it defaults to in-memory storage, ensuring that caching is always possible regardless of the environment, as seen in the [`server/index.ts`](./src/cache/server/index.ts).
137
+ - The logic for determining the storage provider is encapsulated in the [`getPersistenceProvider`](./src/cache/client/index.ts) function, which selects the appropriate storage mechanism based on the runtime context.
138
+
139
+ ---
140
+ ---
141
+
142
+ <h3 align="center">
143
+
144
+ `defuss/dequery`
145
+
146
+ </h3>
147
+
148
+ As `defuss/render` only renders **once** _(and therefore is static)_, we need an elegant way to change the DOM in case of user interaction. The `dequery` package implements a thin abstraction API around the official DOM APIs that resembles the classic, chaining `jQuery` API.
149
+
150
+ #### Features:
151
+
152
+ - ✅ Ultra-fast: Usually uses `ref` instead of DOM CSS selector queries
153
+ - ✅ Querys elements using native CSS selectors (`document.querySelector`)
154
+ - ✅ Works well with direct element references
155
+ - ✅ Can render HTML and VDOM
156
+ - ✅ Caches results in property `.el`
157
+ - ✅ Supports the most important jQuery methods
158
+ - ✅ It's tiny! Only ~175 LoC
159
+ - ✅ Zero dependencies
160
+ - ✅ First class TypeScript support
161
+ - ✅ Unit Test coverage almost 100%
55
162
 
56
- ```tsx
57
- import { render, renderToString, tsx, Fragment } from '@jsheaven/render/dist/server.esm.js'
58
-
59
- // HTMLElement
60
- const dom: Node = render(
61
- <html>
62
- <head></head>
63
- <body></body>
64
- </html>,
65
- )
66
-
67
- // <html><head></head><body></body></html>
68
- const html: string = renderToString(dom)
69
- ```
70
163
 
71
- <h4 align="center">Client-side/in-browser usage:</h4>
164
+ <h2 align="center">API docs</h2>
165
+
166
+ This is how using `defuss/dequery` looks like:
72
167
 
73
168
  ```tsx
74
- import { render, renderToString, tsx, Fragment } from '@jsheaven/render/dist/client.esm.js'
169
+ import { $, type Ref, jsx, type Props } from "defuss";
170
+
171
+ interface SomeCustomInputProps extends Props {
172
+ name: string;
173
+ }
75
174
 
76
- // HTMLParagraphElement
77
- const dom: Node = render(<p>Some paragraph</p>)
175
+ const SomeCustomInput = ({ name }: SomeCustomInputProps) => {
78
176
 
79
- // <p>Some paragraph</p>
80
- const html: string = renderToString(dom)
177
+ const inputRef: Ref = {};
178
+
179
+ const onBlur = () => {
180
+ $(inputRef).val(Math.random());
181
+ console.log('Value after blur:', $(inputRef.current).val());
182
+ }
183
+ return <input ref={inputRef} name={name} onBlur={onBlur} />
184
+ }
81
185
  ```
82
186
 
83
- <h3 align="center">CommonJS</h3>
84
187
 
85
- ```ts
86
- const { render, renderToString, tsx } = require('@jsheaven/render/client.cjs.js')
188
+ <h3 align="center">Selector</h3>
87
189
 
88
- // same API like ESM variant
89
- ```
190
+ Method | Examples
191
+ ------------- |-------------
192
+ `$(ref: Ref)` | Get an element by `Ref` reference: `$(ref)`
193
+ `$(el: Element)` | Get an element by `Element` reference: `$(el)`
194
+ `$(cssSelector: string)` | Get an element by CSS selector: `$("#app")`
195
+
196
+ <h3 align="center">DOM manipulation</h3>
197
+
198
+ Method | Examples
199
+ ------------- |-------------
200
+ `attr` | Get an attribute of a checkbox: `$(formInputRef).attr('tabIndex')`
201
+ `attr` | Set an attribute of an input element: `$(formInputRef).attr('tabIndex', '2')`
202
+ `val` | Get a value of a checkbox: `$(formInputRef).val()`
203
+ `val` | Set the value of an input element: `$(formInputRef).val(2)`
204
+ `html` | Render VDOM and replace the DOM *children* of an element: `$(formInputRef).html(<div>Something else</div>)` or `$(formInputRef).html("<div>HTML string</div>")`
205
+ `replaceWith` | Render DOM and replace the DOM element *itself* with it: `$(formInputRef).replaceWith(<div>Something else</div>)` or `$(formInputRef).html("<div>HTML string</div>")`
206
+ `empty` | Remove all children of an element: `$(formInputRef).empty()`
207
+ `remove` | Remove the element itself from it's DOM parent node: `$(formInputRef).remove()`
208
+
209
+ <h3 align="center">DOM events</h3>
210
+
211
+ Method | Examples
212
+ ------------- |-------------
213
+ `on` | Add a DOM event listener programmatically: `$(formInputRef).on('click', (evt: MouseEvent) => { console.log('clicked on', evt.target) })`
214
+ `off` | Remove a DOM event listener programmatically: `$(window).on('resize', (evt: ResizeEvent) => { console.log('browser resized!', window.innerWidth) })`
215
+
216
+ <h3 align="center">CSS</h3>
217
+
218
+ Method | Examples
219
+ ------------- |-------------
220
+ `addClass` | Add one CSS class: `$(formInputRef).addClass('outlined')`
221
+ `addClass` | Add many CSS classes: `$(formInputRef).addClass(['button', 'mobile'])`
222
+ `removeClass` | Remove one CSS class: `$(formInputRef).removeClass('outlined')`
223
+ `removeClass` | Remove many CSS classes: `$(formInputRef).removeClass(['button', 'mobile'])`
224
+ `toggleClass` | Toggles a CSS class: `$(formInputRef).toggleClass('button')`
225
+ `hasClass` | Returns `true` if the CSS class can be found on the element: `$(formInputRef).hasClass('button')`
226
+
227
+ ---
228
+
229
+ <img src="assets/defuss_comic.png" />
230
+
231
+ <caption><i><b>Come visit us on defuss island!</b></i></caption>
Binary file
Binary file
package/dist/index.cjs CHANGED
@@ -1 +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",w="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"),A=i(r=>r.filter(n=>!S(n)),"filterComments"),x=i(function(r){this.update=r},"onUpdateFn"),C=i((r,n,...t)=>(t=A([].concat.apply([],t)),n={...n},r==="fragment"?A(t):typeof r=="function"?(n.ref&&(n.ref.onUpdate=x.bind(n.ref)),r({children:t,...n})):{type:r,attributes:n,children:t}),"tsx"),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===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=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)=>typeof r=="string"?y(t.window.document).createTextNode(r,n):y(t.window.document).createElementOrElements(r,n),"renderIsomorphic"),d=i(r=>r.children,"Fragment");exports.Fragment=d,exports.getRenderer=y,exports.renderIsomorphic=b,exports.tsx=C;
1
+ "use strict";var l=Object.defineProperty;var n=(t,e)=>l(t,"name",{value:e,configurable:!0});var o=require("./isomorph-B8_6gYlu.cjs");const g=n((t,e)=>{t.classList.contains(e)||t.classList.add(e)},"addSingleClass"),h=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"),f=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"),A=n((t,e)=>(r,s)=>(t.addEventListener(r,s),e),"on"),L=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:h(r,e),removeClass:f(r,e),toggleClass:p(r,e),hasClass:m(r),on:A(r,e),off:b(r,e)},e},"$"),x=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=x();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.$=L,exports.cache=_;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +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":["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,SAAS,CAAC;AAC/B;AACA,CAAC;AACM,MAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,IAAI,KAAK,CAAC,SAAS,KAAK;AACrD,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;AAChC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC/C,MAAM,cAAc,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AACtC;AACA,GAAG,MAAM;AACT,IAAI,cAAc,CAAC,EAAE,EAAE,SAAS,CAAC;AACjC;AACA,EAAE,OAAO,IAAI;AACb,CAAC;AACM,MAAM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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,3 +1,31 @@
1
- export { C as CSSProperties, q as Fragment, G as Globals, P as Props, p as getRenderer, r as renderIsomorphic, t as tsx } from './index-CAFQcOCj.js';
1
+ import { R as Ref, D as Dequery } from './isomorph-Bb7X9ghB.js';
2
+ export { C as CSSProperties, k as Children, l as DomAbstractionImpl, F as FontFaceProperties, t as Fragment, G as Globals, K as KeyFrameProperties, P as Props, n as RenderInput, m as RenderNodeInput, p as RenderResult, o as RenderResultNode, U as UpdateFn, a as VAttributes, c as VNode, b as VNodeAttributes, i as VNodeChild, j as VNodeChildren, e as VNodeKey, h as VNodeRef, g as VNodeRefCallback, f as VNodeRefObject, d as VNodeType, V as VRef, r as getRenderer, q as jsx, s as renderIsomorphic } from './isomorph-Bb7X9ghB.js';
2
3
  import * as CSS from 'csstype';
3
4
  export { CSS };
5
+
6
+ declare const $: (elOrRef: Element | Ref | string) => Dequery;
7
+
8
+ type MemoryProviderOptions = {};
9
+ interface MemoryStorage<T> extends PersistenceProviderImpl<T> {
10
+ backendApi: Omit<Omit<Storage, 'key'>, 'length'>;
11
+ }
12
+ interface WebStorage<T> extends PersistenceProviderImpl<T> {
13
+ backendApi: Storage;
14
+ }
15
+
16
+ type MiddlewareFn<T> = (key: string, value: T) => T;
17
+ /** a simple key/value persistence interface */
18
+ interface PersistenceProviderImpl<T> {
19
+ get: (key: string, defaultValue: T, middlewareFn?: MiddlewareFn<T>) => T;
20
+ set: (key: string, value: T, middlewareFn?: MiddlewareFn<T>) => void;
21
+ remove: (key: string) => void;
22
+ removeAll: () => void;
23
+ backendApi: any;
24
+ }
25
+ type PersistenceProvider = 'session' | 'local' | 'memory';
26
+ type PersistenceProviderOptions = MemoryProviderOptions;
27
+
28
+ /** returns the persistence provider (isomorphic) */
29
+ declare const cache: <T>(provider?: PersistenceProvider, options?: PersistenceProviderOptions) => PersistenceProviderImpl<T>;
30
+
31
+ export { $, Dequery, type MemoryStorage, type MiddlewareFn, type PersistenceProvider, type PersistenceProviderImpl, type PersistenceProviderOptions, Ref, type WebStorage, cache };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,31 @@
1
- export { C as CSSProperties, q as Fragment, G as Globals, P as Props, p as getRenderer, r as renderIsomorphic, t as tsx } from './index-CAFQcOCj.js';
1
+ import { R as Ref, D as Dequery } from './isomorph-Bb7X9ghB.js';
2
+ export { C as CSSProperties, k as Children, l as DomAbstractionImpl, F as FontFaceProperties, t as Fragment, G as Globals, K as KeyFrameProperties, P as Props, n as RenderInput, m as RenderNodeInput, p as RenderResult, o as RenderResultNode, U as UpdateFn, a as VAttributes, c as VNode, b as VNodeAttributes, i as VNodeChild, j as VNodeChildren, e as VNodeKey, h as VNodeRef, g as VNodeRefCallback, f as VNodeRefObject, d as VNodeType, V as VRef, r as getRenderer, q as jsx, s as renderIsomorphic } from './isomorph-Bb7X9ghB.js';
2
3
  import * as CSS from 'csstype';
3
4
  export { CSS };
5
+
6
+ declare const $: (elOrRef: Element | Ref | string) => Dequery;
7
+
8
+ type MemoryProviderOptions = {};
9
+ interface MemoryStorage<T> extends PersistenceProviderImpl<T> {
10
+ backendApi: Omit<Omit<Storage, 'key'>, 'length'>;
11
+ }
12
+ interface WebStorage<T> extends PersistenceProviderImpl<T> {
13
+ backendApi: Storage;
14
+ }
15
+
16
+ type MiddlewareFn<T> = (key: string, value: T) => T;
17
+ /** a simple key/value persistence interface */
18
+ interface PersistenceProviderImpl<T> {
19
+ get: (key: string, defaultValue: T, middlewareFn?: MiddlewareFn<T>) => T;
20
+ set: (key: string, value: T, middlewareFn?: MiddlewareFn<T>) => void;
21
+ remove: (key: string) => void;
22
+ removeAll: () => void;
23
+ backendApi: any;
24
+ }
25
+ type PersistenceProvider = 'session' | 'local' | 'memory';
26
+ type PersistenceProviderOptions = MemoryProviderOptions;
27
+
28
+ /** returns the persistence provider (isomorphic) */
29
+ declare const cache: <T>(provider?: PersistenceProvider, options?: PersistenceProviderOptions) => PersistenceProviderImpl<T>;
30
+
31
+ export { $, Dequery, type MemoryStorage, type MiddlewareFn, type PersistenceProvider, type PersistenceProviderImpl, type PersistenceProviderOptions, Ref, type WebStorage, cache };
package/dist/index.mjs CHANGED
@@ -1 +1,2 @@
1
- var a=Object.defineProperty;var i=(r,n)=>a(r,"name",{value:n,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(n=>!S(n)),"filterComments"),x=i(function(r){this.update=r},"onUpdateFn"),C=i((r,n,...t)=>(t=A([].concat.apply([],t)),n={...n},r==="fragment"?A(t):typeof r=="function"?(n.ref&&(n.ref.onUpdate=x.bind(n.ref)),r({children:t,...n})):{type:r,attributes:n,children:t}),"tsx"),g=i(r=>{const n={hasElNamespace:i(t=>t.namespaceURI===y.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(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:i((t,e)=>{const s=r.createTextNode(t.toString());return e&&e.appendChild(s),s},"createTextNode"),createChildElements:i((t,e)=>{const s=[];for(let f=0;f<t.length;f++){const c=t[f];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===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 o=c.indexOf("capture"),p=o>-1;c==="mount"&&(s.$onMount=e),p&&(c=c.substring(0,o)),s.addEventListener(c,e,p);return}t==="className"&&(t=h),t===h&&Array.isArray(e)&&(e=e.join(" "));const f=t.match(/[A-Z]/)?.index;if(n.hasElNamespace(s)&&f){const c=t.substring(0,f).toLowerCase(),o=t.substring(f,t.length).toLowerCase(),p=y[c]||null;s.setAttributeNS(p,c===T||c==="xmlns"?`${c}:${o}`:t,e)}else if(t==="style"&&typeof e!="string"){const c=Object.keys(e);for(let o=0;o<c.length;o++)s.style[c[o]]=e[c[o]]}else typeof e=="boolean"?s[t]=e:s.setAttribute(t,e)},"setAttribute"),setAttributes:i((t,e)=>{const s=Object.keys(t);for(let f=0;f<s.length;f++)n.setAttribute(s[f],t[s[f]],e)},"setAttributes")};return n},"getRenderer"),b=i((r,n,t)=>typeof r=="string"?g(t.window.document).createTextNode(r,n):g(t.window.document).createElementOrElements(r,n),"renderIsomorphic"),M=i(r=>r.children,"Fragment");export{M as Fragment,g as getRenderer,b as renderIsomorphic,C as tsx};
1
+ var d=Object.defineProperty;var n=(t,e)=>d(t,"name",{value:e,configurable:!0});import{r as c}from"./isomorph-SrrsCkou.mjs";import{F as $,g as q,j as B}from"./isomorph-SrrsCkou.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 $,$ as Fragment,_ as cache,q as getRenderer,B as jsx,c as renderIsomorphic};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","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":["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,SAAS,CAAC;AAC/B;AACA,CAAC;AACM,MAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,IAAI,KAAK,CAAC,SAAS,KAAK;AACrD,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;AAChC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AAC/C,MAAM,cAAc,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AACtC;AACA,GAAG,MAAM;AACT,IAAI,cAAc,CAAC,EAAE,EAAE,SAAS,CAAC;AACjC;AACA,EAAE,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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;;;;"}
@@ -0,0 +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;
2
+ //# sourceMappingURL=isomorph-B8_6gYlu.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isomorph-B8_6gYlu.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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