defuss 1.2.2 → 1.2.4
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/dist/{index-Bg6gfvFM.d.ts → index-BILpZg_l.d.ts} +3 -3
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/render/client.d.cts +2 -2
- package/dist/render/client.d.ts +2 -2
- package/dist/render/index.cjs +1 -1
- package/dist/render/index.cjs.map +1 -1
- package/dist/render/index.d.cts +1 -1
- package/dist/render/index.d.ts +1 -1
- package/dist/render/index.mjs +1 -1
- package/dist/render/index.mjs.map +1 -1
- package/dist/render/server.d.cts +2 -2
- package/dist/render/server.d.ts +2 -2
- package/package.json +11 -1
|
@@ -1227,11 +1227,11 @@ interface Dequery {
|
|
|
1227
1227
|
off(eventName: string, handler: EventListener): Dequery;
|
|
1228
1228
|
}
|
|
1229
1229
|
|
|
1230
|
-
declare const jsx: (type: VNodeType | Function | any, attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null
|
|
1230
|
+
declare const jsx: (type: VNodeType | Function | any, attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null) => Array<VNode> | VNode;
|
|
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
|
|
1235
|
-
declare const jsxDEV: (type: VNodeType | Function | any, attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null
|
|
1234
|
+
declare const jsxs: (type: VNodeType | Function | any, attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null) => Array<VNode> | VNode;
|
|
1235
|
+
declare const jsxDEV: (type: VNodeType | Function | any, attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null) => Array<VNode> | VNode;
|
|
1236
1236
|
|
|
1237
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.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as Ref, D as Dequery } from './index-
|
|
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-
|
|
1
|
+
import { b as Ref, D as Dequery } from './index-BILpZg_l.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-BILpZg_l.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-
|
|
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-
|
|
1
|
+
import { b as Ref, D as Dequery } from './index-BILpZg_l.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-BILpZg_l.js';
|
|
3
3
|
import * as CSS from 'csstype';
|
|
4
4
|
export { CSS };
|
|
5
5
|
|
package/dist/render/client.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RenderInput, D as Dequery, a as RenderResult } from '../index-
|
|
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-
|
|
1
|
+
import { R as RenderInput, D as Dequery, a as RenderResult } from '../index-BILpZg_l.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-BILpZg_l.js';
|
|
3
3
|
import * as CSS from 'csstype';
|
|
4
4
|
export { CSS };
|
|
5
5
|
|
package/dist/render/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RenderInput, D as Dequery, a as RenderResult } from '../index-
|
|
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-
|
|
1
|
+
import { R as RenderInput, D as Dequery, a as RenderResult } from '../index-BILpZg_l.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-BILpZg_l.js';
|
|
3
3
|
import * as CSS from 'csstype';
|
|
4
4
|
export { CSS };
|
|
5
5
|
|
package/dist/render/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var A=Object.defineProperty;var i=(r,n)=>A(r,"name",{value:n,configurable:!0});const l="class",T="xlink",x="xmlns",d="ref",h={[x]:"http://www.w3.org/2000/xmlns/",[T]:"http://www.w3.org/1999/xlink",svg:"http://www.w3.org/2000/svg"},a=i(r=>r&&typeof r=="object"&&!r.attributes&&!r.type&&!r.children,"isJSXComment"),w=i(r=>r.filter(n=>!a(n)),"filterComments"),u=i(function(r){this.update=r},"onUpdateFn"),g=i((r,n)=>{n={...n};let e=(n?.children?[].concat(n.children):[]).filter(Boolean);return delete n?.children,e=w([].concat.apply([],e)),r==="fragment"?w(e):typeof r=="function"?(n.ref&&(n.ref.onUpdate=u.bind(n.ref)),r({children:e,...n})):{type:r,attributes:n,children:e}},"jsx"),y=i(r=>{const n={hasElNamespace:i(e=>e.namespaceURI===h.svg,"hasElNamespace"),hasSvgNamespace:i((e,t)=>n.hasElNamespace(e)&&t!=="STYLE"&&t!=="SCRIPT","hasSvgNamespace"),createElementOrElements:i((e,t)=>Array.isArray(e)?n.createChildElements(e,t):typeof e<"u"?n.createElement(e,t):n.createTextNode("",t),"createElementOrElements"),createElement:i((e,t)=>{let s;return e.type.toUpperCase()==="SVG"||t&&n.hasSvgNamespace(t,e.type.toUpperCase())?s=r.createElementNS(h.svg,e.type):s=r.createElement(e.type),e.attributes&&(n.setAttributes(e.attributes,s),e.attributes.dangerouslySetInnerHTML&&(s.innerHTML=e.attributes.dangerouslySetInnerHTML.__html)),e.children&&n.createChildElements(e.children,s),t&&(t.appendChild(s),typeof s.$onMount=="function"&&s.$onMount()),s},"createElement"),createTextNode:i((e,t)=>{const s=r.createTextNode(e.toString());return t&&t.appendChild(s),s},"createTextNode"),createChildElements:i((e,t)=>{const s=[];for(let o=0;o<e.length;o++){const c=e[o];c===null||typeof c!="object"&&typeof c!="function"?s.push(n.createTextNode((typeof c>"u"||c===null?"":c).toString(),t)):s.push(n.createElement(c,t))}return s},"createChildElements"),setAttribute:i((e,t,s)=>{if(typeof t>"u"||e==="dangerouslySetInnerHTML")return;if(e===d&&typeof t!="function"?t.current=s:e===d&&typeof t=="function"&&t(s),e.startsWith("on")&&typeof t=="function"){let c=e.substring(2).toLowerCase();const f=c.indexOf("capture"),p=f>-1;c==="mount"&&(s.$onMount=t),p&&(c=c.substring(0,f)),s.addEventListener(c,t,p);return}e==="className"&&(e=l),e===l&&Array.isArray(t)&&(t=t.join(" "));const o=e.match(/[A-Z]/)?.index;if(n.hasElNamespace(s)&&o){const c=e.substring(0,o).toLowerCase(),f=e.substring(o,e.length).toLowerCase(),p=h[c]||null;s.setAttributeNS(p,c===T||c==="xmlns"?`${c}:${f}`:e,t)}else if(e==="style"&&typeof t!="string"){const c=Object.keys(t);for(let f=0;f<c.length;f++)s.style[c[f]]=t[c[f]]}else typeof t=="boolean"?s[e]=t:s.setAttribute(e,t)},"setAttribute"),setAttributes:i((e,t)=>{const s=Object.keys(e);for(let o=0;o<s.length;o++)n.setAttribute(s[o],e[s[o]],t)},"setAttributes")};return n},"getRenderer"),S=i((r,n,e)=>{const t=n.el||n;return typeof r=="string"?y(e.window.document).createTextNode(r,t):y(e.window.document).createElementOrElements(r,t)},"renderIsomorphic"),C=i(r=>r.children,"Fragment"),E=g,I=g;exports.Fragment=C,exports.getRenderer=y,exports.jsx=g,exports.jsxDEV=I,exports.jsxs=E,exports.renderIsomorphic=S;
|
|
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\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/create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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
|
+
{"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 type: VNodeType | Function | any,\n attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null,\n): Array<VNode> | VNode => {\n\n // clone attributes as well\n attributes = { ...attributes }\n\n // extract children from attributes and ensure it's always an array\n let children: Array<VNodeChild> = (attributes?.children ? [].concat(attributes.children) : []).filter(Boolean);\n delete attributes?.children;\n\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 // 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 return {\n type,\n attributes,\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 renderer.setAttributes(virtualNode.attributes, newEl as Element)\n\n // Apply dangerouslySetInnerHTML if provided\n if (virtualNode.attributes.dangerouslySetInnerHTML) {\n newEl.innerHTML = virtualNode.attributes.dangerouslySetInnerHTML.__html;\n }\n }\n\n if (virtualNode.children) {\n renderer.createChildElements(virtualNode.children, newEl as Element)\n }\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 if (name === 'dangerouslySetInnerHTML') 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,KAAK;AACzC,EAAE,UAAU,GAAG,EAAE,GAAG,UAAU,EAAE;AAChC,EAAE,IAAI,QAAQ,GAAG,CAAC,UAAU,EAAE,QAAQ,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC;AAC7F,EAAE,OAAO,UAAU,EAAE,QAAQ;AAC7B,EAAE,QAAQ,GAAG,cAAc;AAC3B;AACA;AACA,IAAI,EAAE,CAAC,MAAM,CA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AAK;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;;;;;;;;;"}
|
package/dist/render/index.d.cts
CHANGED
|
@@ -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, v as jsxDEV, u as jsxs, s as renderIsomorphic } from '../index-
|
|
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-BILpZg_l.js';
|
|
2
2
|
import * as CSS from 'csstype';
|
|
3
3
|
export { CSS };
|
package/dist/render/index.d.ts
CHANGED
|
@@ -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, v as jsxDEV, u as jsxs, s as renderIsomorphic } from '../index-
|
|
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-BILpZg_l.js';
|
|
2
2
|
import * as CSS from 'csstype';
|
|
3
3
|
export { CSS };
|
package/dist/render/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var A=Object.defineProperty;var i=(r,n)=>A(r,"name",{value:n,configurable:!0});const l="class",T="xlink",a="xmlns",d="ref",h={[a]:"http://www.w3.org/2000/xmlns/",[T]:"http://www.w3.org/1999/xlink",svg:"http://www.w3.org/2000/svg"},x=i(r=>r&&typeof r=="object"&&!r.attributes&&!r.type&&!r.children,"isJSXComment"),w=i(r=>r.filter(n=>!x(n)),"filterComments"),u=i(function(r){this.update=r},"onUpdateFn"),y=i((r,n)=>{n={...n};let t=(n?.children?[].concat(n.children):[]).filter(Boolean);return delete n?.children,t=w([].concat.apply([],t)),r==="fragment"?w(t):typeof r=="function"?(n.ref&&(n.ref.onUpdate=u.bind(n.ref)),r({children:t,...n})):{type:r,attributes:n,children:t}},"jsx"),g=i(r=>{const n={hasElNamespace:i(t=>t.namespaceURI===h.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(h.svg,t.type):s=r.createElement(t.type),t.attributes&&(n.setAttributes(t.attributes,s),t.attributes.dangerouslySetInnerHTML&&(s.innerHTML=t.attributes.dangerouslySetInnerHTML.__html)),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"||t==="dangerouslySetInnerHTML")return;if(t===d&&typeof e!="function"?e.current=s:t===d&&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=l),t===l&&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=h[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"),S=i((r,n,t)=>{const e=n.el||n;return typeof r=="string"?g(t.window.document).createTextNode(r,e):g(t.window.document).createElementOrElements(r,e)},"renderIsomorphic"),C=i(r=>r.children,"Fragment"),E=y,M=y;export{C as Fragment,g as getRenderer,y as jsx,M as jsxDEV,E as jsxs,S 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\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,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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
|
+
{"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 type: VNodeType | Function | any,\n attributes: (JSX.HTMLAttributes & JSX.SVGAttributes & Record<string, any>) | null,\n): Array<VNode> | VNode => {\n\n // clone attributes as well\n attributes = { ...attributes }\n\n // extract children from attributes and ensure it's always an array\n let children: Array<VNodeChild> = (attributes?.children ? [].concat(attributes.children) : []).filter(Boolean);\n delete attributes?.children;\n\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 // 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 return {\n type,\n attributes,\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 renderer.setAttributes(virtualNode.attributes, newEl as Element)\n\n // Apply dangerouslySetInnerHTML if provided\n if (virtualNode.attributes.dangerouslySetInnerHTML) {\n newEl.innerHTML = virtualNode.attributes.dangerouslySetInnerHTML.__html;\n }\n }\n\n if (virtualNode.children) {\n renderer.createChildElements(virtualNode.children, newEl as Element)\n }\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 if (name === 'dangerouslySetInnerHTML') 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,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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;;;;"}
|
package/dist/render/server.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as Globals, R as RenderInput, D as Dequery, a as RenderResult } from '../index-
|
|
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-
|
|
1
|
+
import { G as Globals, R as RenderInput, D as Dequery, a as RenderResult } from '../index-BILpZg_l.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-BILpZg_l.js';
|
|
3
3
|
import * as CSS from 'csstype';
|
|
4
4
|
export { CSS };
|
|
5
5
|
|
package/dist/render/server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as Globals, R as RenderInput, D as Dequery, a as RenderResult } from '../index-
|
|
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-
|
|
1
|
+
import { G as Globals, R as RenderInput, D as Dequery, a as RenderResult } from '../index-BILpZg_l.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-BILpZg_l.js';
|
|
3
3
|
import * as CSS from 'csstype';
|
|
4
4
|
export { CSS };
|
|
5
5
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "defuss",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -66,6 +66,16 @@
|
|
|
66
66
|
"types": "./dist/render/index.d.ts",
|
|
67
67
|
"default": "./dist/render/index.mjs"
|
|
68
68
|
}
|
|
69
|
+
},
|
|
70
|
+
"./jsx-dev-runtime": {
|
|
71
|
+
"require": {
|
|
72
|
+
"types": "./dist/render/index.d.ts",
|
|
73
|
+
"default": "./dist/render/index.cjs"
|
|
74
|
+
},
|
|
75
|
+
"import": {
|
|
76
|
+
"types": "./dist/render/index.d.ts",
|
|
77
|
+
"default": "./dist/render/index.mjs"
|
|
78
|
+
}
|
|
69
79
|
}
|
|
70
80
|
},
|
|
71
81
|
"main": "./dist/index.cjs",
|