@fluixi/dom 1.0.0-alpha.82 → 1.0.0-alpha.83

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.
Files changed (81) hide show
  1. package/dist/cdn/dom-client.cjs +1 -1
  2. package/dist/cdn/dom-client.global.js +1 -1
  3. package/dist/cdn/dom-client.mjs +1 -1
  4. package/dist/cdn/dom.cjs +1 -1
  5. package/dist/cdn/dom.global.js +1 -1
  6. package/dist/cdn/dom.mjs +1 -1
  7. package/dist/index.cjs +1 -1
  8. package/dist/index.mjs +1 -1
  9. package/dist/lib/dom/dynamic-element.cjs +1 -1
  10. package/dist/lib/dom/dynamic-element.js +1 -1
  11. package/dist/lib/dom/dynamic-element.mjs +1 -1
  12. package/dist/lib/dom/hydration.cjs +1 -1
  13. package/dist/lib/dom/hydration.mjs +1 -1
  14. package/dist/lib/dom/index.cjs +1 -1
  15. package/dist/lib/dom/index.mjs +1 -1
  16. package/dist/lib/dom/integration.cjs +1 -1
  17. package/dist/lib/dom/integration.d.ts.map +1 -1
  18. package/dist/lib/dom/integration.js +13 -4
  19. package/dist/lib/dom/integration.mjs +1 -1
  20. package/dist/lib/dom/island.cjs +1 -1
  21. package/dist/lib/dom/island.js +1 -1
  22. package/dist/lib/dom/island.mjs +1 -1
  23. package/dist/lib/dom/runtime.cjs +1 -1
  24. package/dist/lib/dom/runtime.d.ts +11 -2
  25. package/dist/lib/dom/runtime.d.ts.map +1 -1
  26. package/dist/lib/dom/runtime.js +142 -24
  27. package/dist/lib/dom/runtime.mjs +1 -1
  28. package/dist/lib/dom/server/host.cjs +1 -1
  29. package/dist/lib/dom/server/host.d.ts +8 -2
  30. package/dist/lib/dom/server/host.d.ts.map +1 -1
  31. package/dist/lib/dom/server/host.js +31 -9
  32. package/dist/lib/dom/server/host.mjs +1 -1
  33. package/dist/lib/dom/server/index.cjs +1 -1
  34. package/dist/lib/dom/server/index.mjs +1 -1
  35. package/dist/lib/dom/server/nodes.cjs +1 -1
  36. package/dist/lib/dom/server/nodes.mjs +1 -1
  37. package/dist/lib/dom/server/parse-template.cjs +1 -1
  38. package/dist/lib/dom/server/parse-template.mjs +1 -1
  39. package/dist/lib/dom/server/render.cjs +1 -1
  40. package/dist/lib/dom/server/render.js +2 -2
  41. package/dist/lib/dom/server/render.mjs +1 -1
  42. package/dist/lib/dom/server/serialize.cjs +1 -1
  43. package/dist/lib/dom/server/serialize.mjs +1 -1
  44. package/dist/lib/dom/server-renderer.cjs +1 -1
  45. package/dist/lib/dom/server-renderer.mjs +1 -1
  46. package/dist/lib/dom/versions.cjs +1 -1
  47. package/dist/lib/dom/versions.mjs +1 -1
  48. package/dist/lib/flow/class-map.cjs +1 -1
  49. package/dist/lib/flow/class-map.js +1 -1
  50. package/dist/lib/flow/class-map.mjs +1 -1
  51. package/dist/lib/flow/client-only.cjs +1 -1
  52. package/dist/lib/flow/client-only.js +1 -1
  53. package/dist/lib/flow/client-only.mjs +1 -1
  54. package/dist/lib/flow/dynamic.cjs +1 -1
  55. package/dist/lib/flow/dynamic.js +1 -1
  56. package/dist/lib/flow/dynamic.mjs +1 -1
  57. package/dist/lib/flow/error-boundary.cjs +1 -1
  58. package/dist/lib/flow/error-boundary.js +1 -1
  59. package/dist/lib/flow/error-boundary.mjs +1 -1
  60. package/dist/lib/flow/index.cjs +1 -1
  61. package/dist/lib/flow/index.mjs +1 -1
  62. package/dist/lib/flow/portal.cjs +1 -1
  63. package/dist/lib/flow/portal.mjs +1 -1
  64. package/dist/lib/flow/show.cjs +1 -1
  65. package/dist/lib/flow/show.d.ts.map +1 -1
  66. package/dist/lib/flow/show.js +8 -3
  67. package/dist/lib/flow/show.mjs +1 -1
  68. package/dist/lib/flow/style-map.cjs +1 -1
  69. package/dist/lib/flow/style-map.js +1 -1
  70. package/dist/lib/flow/style-map.mjs +1 -1
  71. package/dist/lib/flow/switch.cjs +1 -1
  72. package/dist/lib/flow/switch.js +1 -1
  73. package/dist/lib/flow/switch.mjs +1 -1
  74. package/dist/lib/index.cjs +1 -1
  75. package/dist/lib/index.mjs +1 -1
  76. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  77. package/dist/version.generated.cjs +1 -1
  78. package/dist/version.generated.d.ts +1 -1
  79. package/dist/version.generated.js +1 -1
  80. package/dist/version.generated.mjs +1 -1
  81. package/package.json +3 -3
@@ -1 +1 @@
1
- "use strict";var i=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var c=(e,r)=>{for(var t in r)i(e,t,{get:r[t],enumerable:!0})},y=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of s(r))!f.call(e,n)&&n!==t&&i(e,n,{get:()=>r[n],enumerable:!(a=d(r,n))||a.enumerable});return e};var m=e=>y(i({},"__esModule",{value:!0}),e);var g={};c(g,{SERVER_NODE:()=>o,getServerNodes:()=>x,isDomElement:()=>N,isDomNode:()=>S,isDomText:()=>E,isServer:()=>l,registerServerNodes:()=>v,setServerMode:()=>p});module.exports=m(g);var l=typeof document>"u";function p(e){l=e}var o=Symbol.for("fluixi.server-node"),u=null;function v(e){u=e}function x(){if(!u)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return u}function S(e){return e!=null&&e[o]===!0?!0:typeof Node<"u"&&e instanceof Node}function N(e){return e!=null&&e[o]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function E(e){return e!=null&&e[o]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}
1
+ "use strict";var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var f=(e,r)=>{for(var t in r)i(e,t,{get:r[t],enumerable:!0})},c=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of d(r))!l.call(e,n)&&n!==t&&i(e,n,{get:()=>r[n],enumerable:!(a=u(r,n))||a.enumerable});return e};var y=e=>c(i({},"__esModule",{value:!0}),e);var g={};f(g,{SERVER_NODE:()=>s,getServerNodes:()=>b,isDomElement:()=>T,isDomNode:()=>N,isDomText:()=>E,isServer:()=>p,registerServerNodes:()=>x,setServerMode:()=>S});module.exports=y(g);var s=Symbol.for("fluixi.server-node"),m=Symbol.for("fluixi.dom.server-host"),v=globalThis,o=v[m]??={server:typeof document>"u",nodes:null};function p(){return o.server}function S(e){o.server=e}function x(e){o.nodes=e}function b(){if(!o.nodes)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return o.nodes}function N(e){return e!=null&&e[s]===!0?!0:typeof Node<"u"&&e instanceof Node}function T(e){return e!=null&&e[s]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function E(e){return e!=null&&e[s]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}
@@ -1,6 +1,12 @@
1
- export declare let isServer: boolean;
2
- export declare function setServerMode(on: boolean): void;
3
1
  export declare const SERVER_NODE: unique symbol;
2
+ /**
3
+ * Whether nodes should be built as strings rather than DOM.
4
+ *
5
+ * A function rather than a live binding: a second copy of this module would keep its own
6
+ * binding, and the two would disagree for the whole of a render.
7
+ */
8
+ export declare function isServer(): boolean;
9
+ export declare function setServerMode(on: boolean): void;
4
10
  export interface ServerNodeFactory {
5
11
  createElement(tag: string, isSVG: boolean): any;
6
12
  createText(value: string): any;
@@ -1 +1 @@
1
- {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../../../src/lib/dom/server/host.ts"],"names":[],"mappings":"AAKA,eAAO,IAAI,QAAQ,SAAkC,CAAC;AACtD,wBAAgB,aAAa,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAE/C;AAID,eAAO,MAAM,WAAW,EAAE,OAAO,MAAyC,CAAC;AAE3E,MAAM,WAAW,iBAAiB;IAChC,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,GAAG,CAAC;IAChD,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC;IAC/B,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC;IAClC,0DAA0D;IAC1D,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;IAC7B,gFAAgF;IAChF,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,GAAG,CAAC;CAClD;AAID,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAEpE;AAED,wBAAgB,cAAc,IAAI,iBAAiB,CAKlD;AAID,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,IAAI,IAAI,CAG3C;AACD,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,IAAI,OAAO,CAGjD;AACD,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,IAAI,IAAI,CAG3C"}
1
+ {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../../../src/lib/dom/server/host.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,WAAW,EAAE,OAAO,MAAyC,CAAC;AAuB3E;;;;;GAKG;AACH,wBAAgB,QAAQ,IAAI,OAAO,CAElC;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAE/C;AAED,MAAM,WAAW,iBAAiB;IAChC,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,GAAG,CAAC;IAChD,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC;IAC/B,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC;IAClC,0DAA0D;IAC1D,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;IAC7B,gFAAgF;IAChF,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,GAAG,CAAC;CAClD;AAID,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAEpE;AAED,wBAAgB,cAAc,IAAI,iBAAiB,CAKlD;AAID,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,IAAI,IAAI,CAG3C;AACD,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,IAAI,OAAO,CAGjD;AACD,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,IAAI,IAAI,CAG3C"}
@@ -1,23 +1,45 @@
1
1
  // The server seam the runtime imports from. Deliberately class-free so the
2
2
  // ServerNode classes in ./nodes.ts stay out of client bundles — they get pulled
3
3
  // in (and registered) only when @fluixi/dom/server loads.
4
- // Live binding; renderToString and jsdom tests flip it via setServerMode.
5
- export let isServer = typeof document === 'undefined';
6
- export function setServerMode(on) {
7
- isServer = on;
8
- }
9
4
  // Stamped on every server node so the guards below can spot one without an
10
5
  // instanceof against the (unbundled) classes.
11
6
  export const SERVER_NODE = Symbol.for('fluixi.server-node');
12
- let _nodes = null;
7
+ // The mode and the node factory hang off the realm, not off this module.
8
+ //
9
+ // This file can exist twice. Each dist entry is bundled on its own, so `index.mjs` and
10
+ // `lib/dom/server-renderer.mjs` both carry a copy, and a bundler pulling in `@fluixi/dom`
11
+ // and `@fluixi/dom/server` gets two. With the flag as a module variable, renderToString
12
+ // flipped one and createNativeElement read the other, so a string render built real DOM
13
+ // and the serializer walked a NamedNodeMap expecting a Map. It only showed in a build:
14
+ // a dev server resolves both specifiers to the same source file.
15
+ const STATE = Symbol.for('fluixi.dom.server-host');
16
+ const realm = globalThis;
17
+ const state = (realm[STATE] ??= {
18
+ server: typeof document === 'undefined',
19
+ nodes: null,
20
+ });
21
+ /**
22
+ * Whether nodes should be built as strings rather than DOM.
23
+ *
24
+ * A function rather than a live binding: a second copy of this module would keep its own
25
+ * binding, and the two would disagree for the whole of a render.
26
+ */
27
+ export function isServer() {
28
+ return state.server;
29
+ }
30
+ export function setServerMode(on) {
31
+ state.server = on;
32
+ }
33
+ // Shared for the same reason as the mode: the subpath registers the factory and the main
34
+ // entry is the one that asks for it, and those can be two copies of this file.
13
35
  export function registerServerNodes(factory) {
14
- _nodes = factory;
36
+ state.nodes = factory;
15
37
  }
16
38
  export function getServerNodes() {
17
- if (!_nodes) {
39
+ if (!state.nodes) {
18
40
  throw new Error('[fluixi] server render ran before @fluixi/dom/server loaded');
19
41
  }
20
- return _nodes;
42
+ return state.nodes;
21
43
  }
22
44
  // Brand check for server nodes, instanceof for real DOM. On the client the brand
23
45
  // branch just misses.
@@ -1 +1 @@
1
- var t=typeof document>"u";function o(e){t=e}var n=Symbol.for("fluixi.server-node"),r=null;function i(e){r=e}function u(){if(!r)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return r}function a(e){return e!=null&&e[n]===!0?!0:typeof Node<"u"&&e instanceof Node}function l(e){return e!=null&&e[n]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function d(e){return e!=null&&e[n]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}export{n as SERVER_NODE,u as getServerNodes,l as isDomElement,a as isDomNode,d as isDomText,t as isServer,i as registerServerNodes,o as setServerMode};
1
+ var n=Symbol.for("fluixi.server-node"),o=Symbol.for("fluixi.dom.server-host"),t=globalThis,r=t[o]??={server:typeof document>"u",nodes:null};function s(){return r.server}function i(e){r.server=e}function a(e){r.nodes=e}function u(){if(!r.nodes)throw new Error("[fluixi] server render ran before @fluixi/dom/server loaded");return r.nodes}function d(e){return e!=null&&e[n]===!0?!0:typeof Node<"u"&&e instanceof Node}function l(e){return e!=null&&e[n]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function f(e){return e!=null&&e[n]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}export{n as SERVER_NODE,u as getServerNodes,l as isDomElement,d as isDomNode,f as isDomText,s as isServer,a as registerServerNodes,i as setServerMode};
@@ -1 +1 @@
1
- "use strict";var _=Object.defineProperty;var xe=Object.getOwnPropertyDescriptor;var ve=Object.getOwnPropertyNames;var Ne=Object.prototype.hasOwnProperty;var we=(e,n)=>{for(var t in n)_(e,t,{get:n[t],enumerable:!0})},Se=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of ve(n))!Ne.call(e,s)&&s!==t&&_(e,s,{get:()=>n[s],enumerable:!(r=xe(n,s))||r.enumerable});return e};var ye=e=>Se(_({},"__esModule",{value:!0}),e);var Me={};we(Me,{FX_DATA_ID:()=>E,ServerComment:()=>v,ServerElement:()=>m,ServerNode:()=>g,ServerText:()=>h,createRequestContext:()=>C,escapeFxJson:()=>O,getLocals:()=>le,getRequestContext:()=>w,getRequestEvent:()=>z,getRequestLocals:()=>X,getServerData:()=>re,isDomElement:()=>B,isDomNode:()=>G,isDomText:()=>K,isServer:()=>S,isServerNodeValue:()=>Y,renderToString:()=>fe,renderToStringAsync:()=>he,runWithRequestContext:()=>q,serializeNode:()=>f,serializeResourceData:()=>J,setDataRedactor:()=>ge,setRequestStore:()=>ue,setServerMode:()=>N});module.exports=ye(Me);var S=typeof document>"u";function N(e){S=e}var b=Symbol.for("fluixi.server-node"),Te=null;function U(e){Te=e}function G(e){return e!=null&&e[b]===!0?!0:typeof Node<"u"&&e instanceof Node}function B(e){return e!=null&&e[b]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function K(e){return e!=null&&e[b]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var k=1,I=3,j=8,Q;Q=b;var g=class{constructor(){this[Q]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>=0?n.childNodes[t+1]??null:null}get previousSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>0?n.childNodes[t-1]??null:null}get parentElement(){return this.parentNode}appendChild(n){return n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes.push(n),n}insertBefore(n,t){if(t==null)return this.appendChild(n);n.parentNode&&n.parentNode.removeChild(n);let r=this.childNodes.indexOf(t);return n.parentNode=this,r<0?this.childNodes.push(n):this.childNodes.splice(r,0,n),n}removeChild(n){let t=this.childNodes.indexOf(n);return t>=0&&this.childNodes.splice(t,1),n.parentNode=null,n}replaceChild(n,t){let r=this.childNodes.indexOf(t);return r>=0&&(n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes[r]=n,t.parentNode=null),t}addEventListener(){}removeEventListener(){}},h=class e extends g{constructor(t){super();this.nodeType=I;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}get textContent(){return this.data}set textContent(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},A=class e extends g{constructor(t){super();this.nodeType=k;this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new e(this.rawOuterHTML)}},v=class e extends g{constructor(t){super();this.nodeType=j;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},L=class{constructor(){this.cssText=""}setProperty(n,t){this[n]=t}removeProperty(n){delete this[n]}},$=class{constructor(n){this.el=n}list(){let n=this.el.getAttribute("class");return n?n.split(/\s+/).filter(Boolean):[]}write(n){n.length?this.el.setAttribute("class",n.join(" ")):this.el.removeAttribute("class")}add(...n){let t=this.list();for(let r of n)t.includes(r)||t.push(r);this.write(t)}remove(...n){this.write(this.list().filter(t=>!n.includes(t)))}contains(n){return this.list().includes(n)}toggle(n,t){let r=this.contains(n),s=t===void 0?!r:t;return s?this.add(n):this.remove(n),s}},m=class e extends g{constructor(t,r=!1){super();this.nodeType=k;this.attributes=new Map;this.style=new L;this.classList=new $(this);this.rawHTML=null;this.localName=t.toLowerCase(),this.tagName=r?t:t.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(t,r){this.attributes.set(t,String(r))}removeAttribute(t){this.attributes.delete(t)}getAttribute(t){return this.attributes.has(t)?this.attributes.get(t):null}hasAttribute(t){return this.attributes.has(t)}get id(){return this.getAttribute("id")??""}set id(t){t==null?this.removeAttribute("id"):this.setAttribute("id",t)}get className(){return this.getAttribute("class")??""}set className(t){t==null?this.removeAttribute("class"):this.setAttribute("class",t)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(t){t==null?this.removeAttribute("for"):this.setAttribute("for",t)}set value(t){t==null?this.removeAttribute("value"):this.setAttribute("value",String(t))}set checked(t){t?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(t){t?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(t){}get textContent(){return this.childNodes.map(t=>t.textContent??"").join("")}set textContent(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,t!=null&&t!==""&&this.appendChild(new h(String(t)))}set innerText(t){this.textContent=t}set innerHTML(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=t==null?"":String(t)}cloneNode(t=!1){let r=new e(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,t)for(let s of this.childNodes)r.appendChild(s.cloneNode(!0));return r}};function Y(e){return e instanceof g}var Re=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ee=/&/g,te=/</g,ne=/>/g,be=/"/g;function H(e){return e.replace(ee,"&amp;").replace(te,"&lt;").replace(ne,"&gt;")}function Z(e){return e.replace(ee,"&amp;").replace(be,"&quot;").replace(te,"&lt;").replace(ne,"&gt;")}function Ee(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())}function Ce(e){if(!e)return"";let n=[];e.cssText&&n.push(e.cssText.trim().replace(/;\s*$/,""));for(let t of Object.keys(e)){if(t==="cssText")continue;let r=e[t];r==null||r===""||n.push(`${Ee(t)}: ${r}`)}return n.join("; ")}function qe(e){let n="",t=Ce(e.style);for(let[r,s]of e.attributes)r==="style"&&t||(n+=` ${r}="${Z(s)}"`);if(t){let r=e.attributes.get("style"),s=r?`${r.replace(/;\s*$/,"")}; ${t}`:t;n+=` style="${Z(s)}"`}return n}function f(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return H(e);if(typeof e=="number")return H(String(e));if(typeof e=="function")return f(e());if(Array.isArray(e))return e.map(f).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case I:return H(e.data??"");case j:return`<!--${e.data??""}-->`;case k:{let n=e.localName,t=`<${n}${qe(e)}>`;if(Re.has(n))return t;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(f).join("");return`${t}${r}</${n}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(f).join(""):""}var E="__FX_DATA__";function O(e){return e.replace(/[<>&\u2028\u2029]/g,n=>"\\u"+n.charCodeAt(0).toString(16).padStart(4,"0"))}var F;function re(){let e=globalThis.__FX_DATA__;if(e)return e;if(F!==void 0)return F;let n=null;if(typeof document<"u"){let t=document.getElementById(E)?.textContent;if(t)try{n=JSON.parse(t)}catch{n=null}}return F=n}var P=require("@fluixi/reactive/signal"),c=require("@fluixi/reactive/signal");var Ae=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ke={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function se(e){return e.replace(/&(#?\w+);/g,(n,t)=>ke[t]??n)}var d=class extends Error{};function oe(e,n=!1){let t=0,r=[],s=[],a=o=>{let u=s[s.length-1];u?u.appendChild(o):r.push(o)};for(;t<e.length;){let o=e.indexOf("<",t);if(o===-1){p(e.slice(t));break}if(o>t&&p(e.slice(t,o)),e.startsWith("<!--",o)){let u=e.indexOf("-->",o);if(u===-1)throw new d(`unterminated comment at ${o}`);a(new v(e.slice(o+4,u))),t=u+3;continue}if(e[o+1]==="/"){let u=e.indexOf(">",o);if(u===-1)throw new d(`unterminated closing tag at ${o}`);let T=e.slice(o+2,u).trim().toLowerCase(),x=s.pop();if(!x||x.localName!==T)throw new d(`</${T}> does not close <${x?.localName??"nothing"}>`);t=u+1;continue}t=y(o)}if(s.length>0)throw new d(`unclosed <${s[s.length-1].localName}>`);let l=r[0];if(r.length!==1||!(l instanceof m))throw new d(`expected exactly one root element, got ${r.length}`);return l;function p(o){o!==""&&a(new h(se(o)))}function y(o){let u=/[\s/>]/.exec(e.slice(o+1));if(!u)throw new d(`unterminated tag at ${o}`);let T=e.slice(o+1,o+1+u.index).toLowerCase(),x=new m(T,n),i=o+1+u.index;for(;i<e.length;){for(;i<e.length&&/\s/.test(e[i]);)i++;if(e[i]===">"){i++;break}if(e[i]==="/"&&e[i+1]===">"){i+=2;break}let me=i;for(;i<e.length&&!/[\s=/>]/.test(e[i]);)i++;let R=e.slice(me,i);if(R==="")throw new d(`malformed attribute at ${i}`);if(e[i]==="="){if(e[i+1]!=='"')throw new d(`attribute ${R} must have a double-quoted value`);let M=e.indexOf('"',i+2);if(M===-1)throw new d(`unterminated value for ${R}`);x.setAttribute(R,se(e.slice(i+2,M))),i=M+1}else x.setAttribute(R,"")}return a(x),Ae.has(T)||s.push(x),i}}var D,ae={getStore:()=>D,run(e,n){let t=D;D=e;try{return n()}finally{D=t}}},V=ae;function ue(e){V=e??ae}function C(e={}){e.locals||(e.locals=e.request?X(e.request):{});let n=0,t=0,r=null,s=new Map,a=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${n++}`,nextResourceId:()=>{if(r===null)return`r${t++}`;let l=s.get(r)??0;return s.set(r,l+1),`${r}:r${l}`},nextIslandNamespace:l=>{let p=a.get(l)??0;return a.set(l,p+1),`${l}#${p}`},withResourceScope(l,p){let y=r;r=l;try{return p()}finally{r=y}},pending:new Set,data:new Map}}function q(e,n){return V.run(e,n)}function w(){return V.getStore()}function z(){return w()?.event}function le(){let e=z();return e?(e.locals||(e.locals={}),e.locals):{}}var ie=new WeakMap;function X(e){let n=ie.get(e);return n||(n={},ie.set(e,n)),n}var ce=!1;function pe(){ce||(ce=!0,U({createElement:(e,n)=>new m(e,n),createText:e=>new h(e),createRaw:e=>new A(e),parseTemplate:(e,n)=>oe(e,n),createComment:e=>new v(e)}))}function fe(e,n={}){let t=S;pe(),N(!0);let r=C(n.event);try{return q(r,()=>(0,P.createRoot)(s=>{try{let a=typeof e=="function"?e():e;return f(a)}finally{s()}}))}finally{N(t)}}var de=!1;function Oe(){de||(de=!0,(0,c.setResourceTracker)(e=>{w()?.pending.add(e)}),(0,c.setResourceIdSource)(()=>w()?.nextResourceId()??""),(0,c.setResourceDataSink)((e,n)=>{e&&w()?.data.set(e,n)}))}var W=null;function ge(e){W=e}function J(e){if(e.data.size===0)return"";let n={};for(let[r,s]of e.data){let a=s;if(W)try{a=W(s,r)}catch{continue}a!==void 0&&(typeof a=="function"||typeof a=="symbol"||(n[r]=a))}if(Object.keys(n).length===0)return"";let t=O(JSON.stringify(n));return t==="{}"?"":`<script type="application/json" id="${E}">${t}<\/script>`}var De=50;async function he(e,n={}){let t=S;pe(),N(!0),Oe();let r=C(n.event);try{return await q(r,async()=>{n.preload&&await n.preload(n.event);let s,a=null,l=()=>{};(0,P.createRoot)(u=>{l=u,a=(0,c.getOwner)(),s=typeof e=="function"?e():e});let p=()=>{try{(0,c.runWithOwner)(a,()=>f(s))}catch{}};p();let y=0;for(;r.pending.size>0&&y++<De;){let u=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(u),await(0,c.flush)(),p()}let o=(0,c.runWithOwner)(a,()=>f(s))+J(r);return l(),o})}finally{N(t)}}
1
+ "use strict";var L=Object.defineProperty;var xe=Object.getOwnPropertyDescriptor;var Ne=Object.getOwnPropertyNames;var Se=Object.prototype.hasOwnProperty;var we=(e,n)=>{for(var t in n)L(e,t,{get:n[t],enumerable:!0})},ye=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of Ne(n))!Se.call(e,s)&&s!==t&&L(e,s,{get:()=>n[s],enumerable:!(r=xe(n,s))||r.enumerable});return e};var Te=e=>ye(L({},"__esModule",{value:!0}),e);var _e={};we(_e,{FX_DATA_ID:()=>E,ServerComment:()=>x,ServerElement:()=>m,ServerNode:()=>g,ServerText:()=>h,createRequestContext:()=>C,escapeFxJson:()=>O,getLocals:()=>ce,getRequestContext:()=>S,getRequestEvent:()=>X,getRequestLocals:()=>P,getServerData:()=>se,isDomElement:()=>K,isDomNode:()=>B,isDomText:()=>Q,isServer:()=>R,isServerNodeValue:()=>Z,renderToString:()=>ge,renderToStringAsync:()=>me,runWithRequestContext:()=>q,serializeNode:()=>f,serializeResourceData:()=>U,setDataRedactor:()=>he,setRequestStore:()=>le,setServerMode:()=>N});module.exports=Te(_e);var b=Symbol.for("fluixi.server-node"),be=Symbol.for("fluixi.dom.server-host"),Re=globalThis,_=Re[be]??={server:typeof document>"u",nodes:null};function R(){return _.server}function N(e){_.server=e}function G(e){_.nodes=e}function B(e){return e!=null&&e[b]===!0?!0:typeof Node<"u"&&e instanceof Node}function K(e){return e!=null&&e[b]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function Q(e){return e!=null&&e[b]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var k=1,I=3,j=8,Y;Y=b;var g=class{constructor(){this[Y]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>=0?n.childNodes[t+1]??null:null}get previousSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>0?n.childNodes[t-1]??null:null}get parentElement(){return this.parentNode}appendChild(n){return n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes.push(n),n}insertBefore(n,t){if(t==null)return this.appendChild(n);n.parentNode&&n.parentNode.removeChild(n);let r=this.childNodes.indexOf(t);return n.parentNode=this,r<0?this.childNodes.push(n):this.childNodes.splice(r,0,n),n}removeChild(n){let t=this.childNodes.indexOf(n);return t>=0&&this.childNodes.splice(t,1),n.parentNode=null,n}replaceChild(n,t){let r=this.childNodes.indexOf(t);return r>=0&&(n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes[r]=n,t.parentNode=null),t}addEventListener(){}removeEventListener(){}},h=class e extends g{constructor(t){super();this.nodeType=I;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}get textContent(){return this.data}set textContent(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},A=class e extends g{constructor(t){super();this.nodeType=k;this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new e(this.rawOuterHTML)}},x=class e extends g{constructor(t){super();this.nodeType=j;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},$=class{constructor(){this.cssText=""}setProperty(n,t){this[n]=t}removeProperty(n){delete this[n]}},H=class{constructor(n){this.el=n}list(){let n=this.el.getAttribute("class");return n?n.split(/\s+/).filter(Boolean):[]}write(n){n.length?this.el.setAttribute("class",n.join(" ")):this.el.removeAttribute("class")}add(...n){let t=this.list();for(let r of n)t.includes(r)||t.push(r);this.write(t)}remove(...n){this.write(this.list().filter(t=>!n.includes(t)))}contains(n){return this.list().includes(n)}toggle(n,t){let r=this.contains(n),s=t===void 0?!r:t;return s?this.add(n):this.remove(n),s}},m=class e extends g{constructor(t,r=!1){super();this.nodeType=k;this.attributes=new Map;this.style=new $;this.classList=new H(this);this.rawHTML=null;this.localName=t.toLowerCase(),this.tagName=r?t:t.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(t,r){this.attributes.set(t,String(r))}removeAttribute(t){this.attributes.delete(t)}getAttribute(t){return this.attributes.has(t)?this.attributes.get(t):null}hasAttribute(t){return this.attributes.has(t)}get id(){return this.getAttribute("id")??""}set id(t){t==null?this.removeAttribute("id"):this.setAttribute("id",t)}get className(){return this.getAttribute("class")??""}set className(t){t==null?this.removeAttribute("class"):this.setAttribute("class",t)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(t){t==null?this.removeAttribute("for"):this.setAttribute("for",t)}set value(t){t==null?this.removeAttribute("value"):this.setAttribute("value",String(t))}set checked(t){t?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(t){t?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(t){}get textContent(){return this.childNodes.map(t=>t.textContent??"").join("")}set textContent(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,t!=null&&t!==""&&this.appendChild(new h(String(t)))}set innerText(t){this.textContent=t}set innerHTML(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=t==null?"":String(t)}cloneNode(t=!1){let r=new e(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,t)for(let s of this.childNodes)r.appendChild(s.cloneNode(!0));return r}};function Z(e){return e instanceof g}var Ee=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),te=/&/g,ne=/</g,re=/>/g,Ce=/"/g;function F(e){return e.replace(te,"&amp;").replace(ne,"&lt;").replace(re,"&gt;")}function ee(e){return e.replace(te,"&amp;").replace(Ce,"&quot;").replace(ne,"&lt;").replace(re,"&gt;")}function qe(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())}function Ae(e){if(!e)return"";let n=[];e.cssText&&n.push(e.cssText.trim().replace(/;\s*$/,""));for(let t of Object.keys(e)){if(t==="cssText")continue;let r=e[t];r==null||r===""||n.push(`${qe(t)}: ${r}`)}return n.join("; ")}function ke(e){let n="",t=Ae(e.style);for(let[r,s]of e.attributes)r==="style"&&t||(n+=` ${r}="${ee(s)}"`);if(t){let r=e.attributes.get("style"),s=r?`${r.replace(/;\s*$/,"")}; ${t}`:t;n+=` style="${ee(s)}"`}return n}function f(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return F(e);if(typeof e=="number")return F(String(e));if(typeof e=="function")return f(e());if(Array.isArray(e))return e.map(f).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case I:return F(e.data??"");case j:return`<!--${e.data??""}-->`;case k:{let n=e.localName,t=`<${n}${ke(e)}>`;if(Ee.has(n))return t;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(f).join("");return`${t}${r}</${n}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(f).join(""):""}var E="__FX_DATA__";function O(e){return e.replace(/[<>&\u2028\u2029]/g,n=>"\\u"+n.charCodeAt(0).toString(16).padStart(4,"0"))}var V;function se(){let e=globalThis.__FX_DATA__;if(e)return e;if(V!==void 0)return V;let n=null;if(typeof document<"u"){let t=document.getElementById(E)?.textContent;if(t)try{n=JSON.parse(t)}catch{n=null}}return V=n}var J=require("@fluixi/reactive/signal"),c=require("@fluixi/reactive/signal");var Oe=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),De={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function oe(e){return e.replace(/&(#?\w+);/g,(n,t)=>De[t]??n)}var d=class extends Error{};function ie(e,n=!1){let t=0,r=[],s=[],a=o=>{let u=s[s.length-1];u?u.appendChild(o):r.push(o)};for(;t<e.length;){let o=e.indexOf("<",t);if(o===-1){p(e.slice(t));break}if(o>t&&p(e.slice(t,o)),e.startsWith("<!--",o)){let u=e.indexOf("-->",o);if(u===-1)throw new d(`unterminated comment at ${o}`);a(new x(e.slice(o+4,u))),t=u+3;continue}if(e[o+1]==="/"){let u=e.indexOf(">",o);if(u===-1)throw new d(`unterminated closing tag at ${o}`);let y=e.slice(o+2,u).trim().toLowerCase(),v=s.pop();if(!v||v.localName!==y)throw new d(`</${y}> does not close <${v?.localName??"nothing"}>`);t=u+1;continue}t=w(o)}if(s.length>0)throw new d(`unclosed <${s[s.length-1].localName}>`);let l=r[0];if(r.length!==1||!(l instanceof m))throw new d(`expected exactly one root element, got ${r.length}`);return l;function p(o){o!==""&&a(new h(oe(o)))}function w(o){let u=/[\s/>]/.exec(e.slice(o+1));if(!u)throw new d(`unterminated tag at ${o}`);let y=e.slice(o+1,o+1+u.index).toLowerCase(),v=new m(y,n),i=o+1+u.index;for(;i<e.length;){for(;i<e.length&&/\s/.test(e[i]);)i++;if(e[i]===">"){i++;break}if(e[i]==="/"&&e[i+1]===">"){i+=2;break}let ve=i;for(;i<e.length&&!/[\s=/>]/.test(e[i]);)i++;let T=e.slice(ve,i);if(T==="")throw new d(`malformed attribute at ${i}`);if(e[i]==="="){if(e[i+1]!=='"')throw new d(`attribute ${T} must have a double-quoted value`);let M=e.indexOf('"',i+2);if(M===-1)throw new d(`unterminated value for ${T}`);v.setAttribute(T,oe(e.slice(i+2,M))),i=M+1}else v.setAttribute(T,"")}return a(v),Oe.has(y)||s.push(v),i}}var D,ue={getStore:()=>D,run(e,n){let t=D;D=e;try{return n()}finally{D=t}}},z=ue;function le(e){z=e??ue}function C(e={}){e.locals||(e.locals=e.request?P(e.request):{});let n=0,t=0,r=null,s=new Map,a=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${n++}`,nextResourceId:()=>{if(r===null)return`r${t++}`;let l=s.get(r)??0;return s.set(r,l+1),`${r}:r${l}`},nextIslandNamespace:l=>{let p=a.get(l)??0;return a.set(l,p+1),`${l}#${p}`},withResourceScope(l,p){let w=r;r=l;try{return p()}finally{r=w}},pending:new Set,data:new Map}}function q(e,n){return z.run(e,n)}function S(){return z.getStore()}function X(){return S()?.event}function ce(){let e=X();return e?(e.locals||(e.locals={}),e.locals):{}}var ae=new WeakMap;function P(e){let n=ae.get(e);return n||(n={},ae.set(e,n)),n}var de=!1;function fe(){de||(de=!0,G({createElement:(e,n)=>new m(e,n),createText:e=>new h(e),createRaw:e=>new A(e),parseTemplate:(e,n)=>ie(e,n),createComment:e=>new x(e)}))}function ge(e,n={}){let t=R();fe(),N(!0);let r=C(n.event);try{return q(r,()=>(0,J.createRoot)(s=>{try{let a=typeof e=="function"?e():e;return f(a)}finally{s()}}))}finally{N(t)}}var pe=!1;function Me(){pe||(pe=!0,(0,c.setResourceTracker)(e=>{S()?.pending.add(e)}),(0,c.setResourceIdSource)(()=>S()?.nextResourceId()??""),(0,c.setResourceDataSink)((e,n)=>{e&&S()?.data.set(e,n)}))}var W=null;function he(e){W=e}function U(e){if(e.data.size===0)return"";let n={};for(let[r,s]of e.data){let a=s;if(W)try{a=W(s,r)}catch{continue}a!==void 0&&(typeof a=="function"||typeof a=="symbol"||(n[r]=a))}if(Object.keys(n).length===0)return"";let t=O(JSON.stringify(n));return t==="{}"?"":`<script type="application/json" id="${E}">${t}<\/script>`}var Le=50;async function me(e,n={}){let t=R();fe(),N(!0),Me();let r=C(n.event);try{return await q(r,async()=>{n.preload&&await n.preload(n.event);let s,a=null,l=()=>{};(0,J.createRoot)(u=>{l=u,a=(0,c.getOwner)(),s=typeof e=="function"?e():e});let p=()=>{try{(0,c.runWithOwner)(a,()=>f(s))}catch{}};p();let w=0;for(;r.pending.size>0&&w++<Le;){let u=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(u),await(0,c.flush)(),p()}let o=(0,c.runWithOwner)(a,()=>f(s))+U(r);return l(),o})}finally{N(t)}}
@@ -1 +1 @@
1
- var T=typeof document>"u";function v(e){T=e}var R=Symbol.for("fluixi.server-node"),ie=null;function V(e){ie=e}function ae(e){return e!=null&&e[R]===!0?!0:typeof Node<"u"&&e instanceof Node}function ue(e){return e!=null&&e[R]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function le(e){return e!=null&&e[R]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var E=1,_=3,L=8,z;z=R;var g=class{constructor(){this[z]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>=0?n.childNodes[t+1]??null:null}get previousSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>0?n.childNodes[t-1]??null:null}get parentElement(){return this.parentNode}appendChild(n){return n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes.push(n),n}insertBefore(n,t){if(t==null)return this.appendChild(n);n.parentNode&&n.parentNode.removeChild(n);let r=this.childNodes.indexOf(t);return n.parentNode=this,r<0?this.childNodes.push(n):this.childNodes.splice(r,0,n),n}removeChild(n){let t=this.childNodes.indexOf(n);return t>=0&&this.childNodes.splice(t,1),n.parentNode=null,n}replaceChild(n,t){let r=this.childNodes.indexOf(t);return r>=0&&(n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes[r]=n,t.parentNode=null),t}addEventListener(){}removeEventListener(){}},h=class e extends g{constructor(t){super();this.nodeType=_;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}get textContent(){return this.data}set textContent(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},b=class e extends g{constructor(t){super();this.nodeType=E;this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new e(this.rawOuterHTML)}},x=class e extends g{constructor(t){super();this.nodeType=L;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},D=class{constructor(){this.cssText=""}setProperty(n,t){this[n]=t}removeProperty(n){delete this[n]}},M=class{constructor(n){this.el=n}list(){let n=this.el.getAttribute("class");return n?n.split(/\s+/).filter(Boolean):[]}write(n){n.length?this.el.setAttribute("class",n.join(" ")):this.el.removeAttribute("class")}add(...n){let t=this.list();for(let r of n)t.includes(r)||t.push(r);this.write(t)}remove(...n){this.write(this.list().filter(t=>!n.includes(t)))}contains(n){return this.list().includes(n)}toggle(n,t){let r=this.contains(n),s=t===void 0?!r:t;return s?this.add(n):this.remove(n),s}},m=class e extends g{constructor(t,r=!1){super();this.nodeType=E;this.attributes=new Map;this.style=new D;this.classList=new M(this);this.rawHTML=null;this.localName=t.toLowerCase(),this.tagName=r?t:t.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(t,r){this.attributes.set(t,String(r))}removeAttribute(t){this.attributes.delete(t)}getAttribute(t){return this.attributes.has(t)?this.attributes.get(t):null}hasAttribute(t){return this.attributes.has(t)}get id(){return this.getAttribute("id")??""}set id(t){t==null?this.removeAttribute("id"):this.setAttribute("id",t)}get className(){return this.getAttribute("class")??""}set className(t){t==null?this.removeAttribute("class"):this.setAttribute("class",t)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(t){t==null?this.removeAttribute("for"):this.setAttribute("for",t)}set value(t){t==null?this.removeAttribute("value"):this.setAttribute("value",String(t))}set checked(t){t?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(t){t?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(t){}get textContent(){return this.childNodes.map(t=>t.textContent??"").join("")}set textContent(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,t!=null&&t!==""&&this.appendChild(new h(String(t)))}set innerText(t){this.textContent=t}set innerHTML(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=t==null?"":String(t)}cloneNode(t=!1){let r=new e(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,t)for(let s of this.childNodes)r.appendChild(s.cloneNode(!0));return r}};function ce(e){return e instanceof g}var de=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),W=/&/g,P=/</g,J=/>/g,pe=/"/g;function $(e){return e.replace(W,"&amp;").replace(P,"&lt;").replace(J,"&gt;")}function X(e){return e.replace(W,"&amp;").replace(pe,"&quot;").replace(P,"&lt;").replace(J,"&gt;")}function fe(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())}function ge(e){if(!e)return"";let n=[];e.cssText&&n.push(e.cssText.trim().replace(/;\s*$/,""));for(let t of Object.keys(e)){if(t==="cssText")continue;let r=e[t];r==null||r===""||n.push(`${fe(t)}: ${r}`)}return n.join("; ")}function he(e){let n="",t=ge(e.style);for(let[r,s]of e.attributes)r==="style"&&t||(n+=` ${r}="${X(s)}"`);if(t){let r=e.attributes.get("style"),s=r?`${r.replace(/;\s*$/,"")}; ${t}`:t;n+=` style="${X(s)}"`}return n}function p(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return $(e);if(typeof e=="number")return $(String(e));if(typeof e=="function")return p(e());if(Array.isArray(e))return e.map(p).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case _:return $(e.data??"");case L:return`<!--${e.data??""}-->`;case E:{let n=e.localName,t=`<${n}${he(e)}>`;if(de.has(n))return t;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(p).join("");return`${t}${r}</${n}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(p).join(""):""}var C="__FX_DATA__";function j(e){return e.replace(/[<>&\u2028\u2029]/g,n=>"\\u"+n.charCodeAt(0).toString(16).padStart(4,"0"))}var I;function me(){let e=globalThis.__FX_DATA__;if(e)return e;if(I!==void 0)return I;let n=null;if(typeof document<"u"){let t=document.getElementById(C)?.textContent;if(t)try{n=JSON.parse(t)}catch{n=null}}return I=n}import{createRoot as ne}from"@fluixi/reactive/signal";import{setResourceTracker as Se,setResourceIdSource as ye,setResourceDataSink as Te,getOwner as Re,runWithOwner as Z,flush as be}from"@fluixi/reactive/signal";var xe=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ve={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function U(e){return e.replace(/&(#?\w+);/g,(n,t)=>ve[t]??n)}var c=class extends Error{};function G(e,n=!1){let t=0,r=[],s=[],a=o=>{let u=s[s.length-1];u?u.appendChild(o):r.push(o)};for(;t<e.length;){let o=e.indexOf("<",t);if(o===-1){d(e.slice(t));break}if(o>t&&d(e.slice(t,o)),e.startsWith("<!--",o)){let u=e.indexOf("-->",o);if(u===-1)throw new c(`unterminated comment at ${o}`);a(new x(e.slice(o+4,u))),t=u+3;continue}if(e[o+1]==="/"){let u=e.indexOf(">",o);if(u===-1)throw new c(`unterminated closing tag at ${o}`);let S=e.slice(o+2,u).trim().toLowerCase(),f=s.pop();if(!f||f.localName!==S)throw new c(`</${S}> does not close <${f?.localName??"nothing"}>`);t=u+1;continue}t=w(o)}if(s.length>0)throw new c(`unclosed <${s[s.length-1].localName}>`);let l=r[0];if(r.length!==1||!(l instanceof m))throw new c(`expected exactly one root element, got ${r.length}`);return l;function d(o){o!==""&&a(new h(U(o)))}function w(o){let u=/[\s/>]/.exec(e.slice(o+1));if(!u)throw new c(`unterminated tag at ${o}`);let S=e.slice(o+1,o+1+u.index).toLowerCase(),f=new m(S,n),i=o+1+u.index;for(;i<e.length;){for(;i<e.length&&/\s/.test(e[i]);)i++;if(e[i]===">"){i++;break}if(e[i]==="/"&&e[i+1]===">"){i+=2;break}let oe=i;for(;i<e.length&&!/[\s=/>]/.test(e[i]);)i++;let y=e.slice(oe,i);if(y==="")throw new c(`malformed attribute at ${i}`);if(e[i]==="="){if(e[i+1]!=='"')throw new c(`attribute ${y} must have a double-quoted value`);let O=e.indexOf('"',i+2);if(O===-1)throw new c(`unterminated value for ${y}`);f.setAttribute(y,U(e.slice(i+2,O))),i=O+1}else f.setAttribute(y,"")}return a(f),xe.has(S)||s.push(f),i}}var q,K={getStore:()=>q,run(e,n){let t=q;q=e;try{return n()}finally{q=t}}},H=K;function Ne(e){H=e??K}function A(e={}){e.locals||(e.locals=e.request?Y(e.request):{});let n=0,t=0,r=null,s=new Map,a=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${n++}`,nextResourceId:()=>{if(r===null)return`r${t++}`;let l=s.get(r)??0;return s.set(r,l+1),`${r}:r${l}`},nextIslandNamespace:l=>{let d=a.get(l)??0;return a.set(l,d+1),`${l}#${d}`},withResourceScope(l,d){let w=r;r=l;try{return d()}finally{r=w}},pending:new Set,data:new Map}}function k(e,n){return H.run(e,n)}function N(){return H.getStore()}function Q(){return N()?.event}function we(){let e=Q();return e?(e.locals||(e.locals={}),e.locals):{}}var B=new WeakMap;function Y(e){let n=B.get(e);return n||(n={},B.set(e,n)),n}var ee=!1;function re(){ee||(ee=!0,V({createElement:(e,n)=>new m(e,n),createText:e=>new h(e),createRaw:e=>new b(e),parseTemplate:(e,n)=>G(e,n),createComment:e=>new x(e)}))}function Ee(e,n={}){let t=T;re(),v(!0);let r=A(n.event);try{return k(r,()=>ne(s=>{try{let a=typeof e=="function"?e():e;return p(a)}finally{s()}}))}finally{v(t)}}var te=!1;function Ce(){te||(te=!0,Se(e=>{N()?.pending.add(e)}),ye(()=>N()?.nextResourceId()??""),Te((e,n)=>{e&&N()?.data.set(e,n)}))}var F=null;function qe(e){F=e}function se(e){if(e.data.size===0)return"";let n={};for(let[r,s]of e.data){let a=s;if(F)try{a=F(s,r)}catch{continue}a!==void 0&&(typeof a=="function"||typeof a=="symbol"||(n[r]=a))}if(Object.keys(n).length===0)return"";let t=j(JSON.stringify(n));return t==="{}"?"":`<script type="application/json" id="${C}">${t}<\/script>`}var Ae=50;async function ke(e,n={}){let t=T;re(),v(!0),Ce();let r=A(n.event);try{return await k(r,async()=>{n.preload&&await n.preload(n.event);let s,a=null,l=()=>{};ne(u=>{l=u,a=Re(),s=typeof e=="function"?e():e});let d=()=>{try{Z(a,()=>p(s))}catch{}};d();let w=0;for(;r.pending.size>0&&w++<Ae;){let u=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(u),await be(),d()}let o=Z(a,()=>p(s))+se(r);return l(),o})}finally{v(t)}}export{C as FX_DATA_ID,x as ServerComment,m as ServerElement,g as ServerNode,h as ServerText,A as createRequestContext,j as escapeFxJson,we as getLocals,N as getRequestContext,Q as getRequestEvent,Y as getRequestLocals,me as getServerData,ue as isDomElement,ae as isDomNode,le as isDomText,T as isServer,ce as isServerNodeValue,Ee as renderToString,ke as renderToStringAsync,k as runWithRequestContext,p as serializeNode,se as serializeResourceData,qe as setDataRedactor,Ne as setRequestStore,v as setServerMode};
1
+ var T=Symbol.for("fluixi.server-node"),ae=Symbol.for("fluixi.dom.server-host"),ue=globalThis,D=ue[ae]??={server:typeof document>"u",nodes:null};function b(){return D.server}function x(e){D.server=e}function z(e){D.nodes=e}function le(e){return e!=null&&e[T]===!0?!0:typeof Node<"u"&&e instanceof Node}function ce(e){return e!=null&&e[T]===!0?e.nodeType===1:typeof Element<"u"&&e instanceof Element}function de(e){return e!=null&&e[T]===!0?e.nodeType===3:typeof Text<"u"&&e instanceof Text}var E=1,_=3,$=8,X;X=T;var g=class{constructor(){this[X]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>=0?n.childNodes[t+1]??null:null}get previousSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>0?n.childNodes[t-1]??null:null}get parentElement(){return this.parentNode}appendChild(n){return n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes.push(n),n}insertBefore(n,t){if(t==null)return this.appendChild(n);n.parentNode&&n.parentNode.removeChild(n);let r=this.childNodes.indexOf(t);return n.parentNode=this,r<0?this.childNodes.push(n):this.childNodes.splice(r,0,n),n}removeChild(n){let t=this.childNodes.indexOf(n);return t>=0&&this.childNodes.splice(t,1),n.parentNode=null,n}replaceChild(n,t){let r=this.childNodes.indexOf(t);return r>=0&&(n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes[r]=n,t.parentNode=null),t}addEventListener(){}removeEventListener(){}},h=class e extends g{constructor(t){super();this.nodeType=_;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}get textContent(){return this.data}set textContent(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},R=class e extends g{constructor(t){super();this.nodeType=E;this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new e(this.rawOuterHTML)}},v=class e extends g{constructor(t){super();this.nodeType=$;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},M=class{constructor(){this.cssText=""}setProperty(n,t){this[n]=t}removeProperty(n){delete this[n]}},L=class{constructor(n){this.el=n}list(){let n=this.el.getAttribute("class");return n?n.split(/\s+/).filter(Boolean):[]}write(n){n.length?this.el.setAttribute("class",n.join(" ")):this.el.removeAttribute("class")}add(...n){let t=this.list();for(let r of n)t.includes(r)||t.push(r);this.write(t)}remove(...n){this.write(this.list().filter(t=>!n.includes(t)))}contains(n){return this.list().includes(n)}toggle(n,t){let r=this.contains(n),s=t===void 0?!r:t;return s?this.add(n):this.remove(n),s}},m=class e extends g{constructor(t,r=!1){super();this.nodeType=E;this.attributes=new Map;this.style=new M;this.classList=new L(this);this.rawHTML=null;this.localName=t.toLowerCase(),this.tagName=r?t:t.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(t,r){this.attributes.set(t,String(r))}removeAttribute(t){this.attributes.delete(t)}getAttribute(t){return this.attributes.has(t)?this.attributes.get(t):null}hasAttribute(t){return this.attributes.has(t)}get id(){return this.getAttribute("id")??""}set id(t){t==null?this.removeAttribute("id"):this.setAttribute("id",t)}get className(){return this.getAttribute("class")??""}set className(t){t==null?this.removeAttribute("class"):this.setAttribute("class",t)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(t){t==null?this.removeAttribute("for"):this.setAttribute("for",t)}set value(t){t==null?this.removeAttribute("value"):this.setAttribute("value",String(t))}set checked(t){t?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(t){t?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(t){}get textContent(){return this.childNodes.map(t=>t.textContent??"").join("")}set textContent(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,t!=null&&t!==""&&this.appendChild(new h(String(t)))}set innerText(t){this.textContent=t}set innerHTML(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=t==null?"":String(t)}cloneNode(t=!1){let r=new e(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,t)for(let s of this.childNodes)r.appendChild(s.cloneNode(!0));return r}};function pe(e){return e instanceof g}var fe=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),W=/&/g,J=/</g,U=/>/g,ge=/"/g;function H(e){return e.replace(W,"&amp;").replace(J,"&lt;").replace(U,"&gt;")}function P(e){return e.replace(W,"&amp;").replace(ge,"&quot;").replace(J,"&lt;").replace(U,"&gt;")}function he(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())}function me(e){if(!e)return"";let n=[];e.cssText&&n.push(e.cssText.trim().replace(/;\s*$/,""));for(let t of Object.keys(e)){if(t==="cssText")continue;let r=e[t];r==null||r===""||n.push(`${he(t)}: ${r}`)}return n.join("; ")}function ve(e){let n="",t=me(e.style);for(let[r,s]of e.attributes)r==="style"&&t||(n+=` ${r}="${P(s)}"`);if(t){let r=e.attributes.get("style"),s=r?`${r.replace(/;\s*$/,"")}; ${t}`:t;n+=` style="${P(s)}"`}return n}function p(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return H(e);if(typeof e=="number")return H(String(e));if(typeof e=="function")return p(e());if(Array.isArray(e))return e.map(p).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case _:return H(e.data??"");case $:return`<!--${e.data??""}-->`;case E:{let n=e.localName,t=`<${n}${ve(e)}>`;if(fe.has(n))return t;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(p).join("");return`${t}${r}</${n}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(p).join(""):""}var C="__FX_DATA__";function j(e){return e.replace(/[<>&\u2028\u2029]/g,n=>"\\u"+n.charCodeAt(0).toString(16).padStart(4,"0"))}var I;function xe(){let e=globalThis.__FX_DATA__;if(e)return e;if(I!==void 0)return I;let n=null;if(typeof document<"u"){let t=document.getElementById(C)?.textContent;if(t)try{n=JSON.parse(t)}catch{n=null}}return I=n}import{createRoot as re}from"@fluixi/reactive/signal";import{setResourceTracker as Te,setResourceIdSource as be,setResourceDataSink as Re,getOwner as Ee,runWithOwner as ee,flush as Ce}from"@fluixi/reactive/signal";var Ne=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Se={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function G(e){return e.replace(/&(#?\w+);/g,(n,t)=>Se[t]??n)}var c=class extends Error{};function B(e,n=!1){let t=0,r=[],s=[],a=o=>{let u=s[s.length-1];u?u.appendChild(o):r.push(o)};for(;t<e.length;){let o=e.indexOf("<",t);if(o===-1){d(e.slice(t));break}if(o>t&&d(e.slice(t,o)),e.startsWith("<!--",o)){let u=e.indexOf("-->",o);if(u===-1)throw new c(`unterminated comment at ${o}`);a(new v(e.slice(o+4,u))),t=u+3;continue}if(e[o+1]==="/"){let u=e.indexOf(">",o);if(u===-1)throw new c(`unterminated closing tag at ${o}`);let w=e.slice(o+2,u).trim().toLowerCase(),f=s.pop();if(!f||f.localName!==w)throw new c(`</${w}> does not close <${f?.localName??"nothing"}>`);t=u+1;continue}t=S(o)}if(s.length>0)throw new c(`unclosed <${s[s.length-1].localName}>`);let l=r[0];if(r.length!==1||!(l instanceof m))throw new c(`expected exactly one root element, got ${r.length}`);return l;function d(o){o!==""&&a(new h(G(o)))}function S(o){let u=/[\s/>]/.exec(e.slice(o+1));if(!u)throw new c(`unterminated tag at ${o}`);let w=e.slice(o+1,o+1+u.index).toLowerCase(),f=new m(w,n),i=o+1+u.index;for(;i<e.length;){for(;i<e.length&&/\s/.test(e[i]);)i++;if(e[i]===">"){i++;break}if(e[i]==="/"&&e[i+1]===">"){i+=2;break}let ie=i;for(;i<e.length&&!/[\s=/>]/.test(e[i]);)i++;let y=e.slice(ie,i);if(y==="")throw new c(`malformed attribute at ${i}`);if(e[i]==="="){if(e[i+1]!=='"')throw new c(`attribute ${y} must have a double-quoted value`);let O=e.indexOf('"',i+2);if(O===-1)throw new c(`unterminated value for ${y}`);f.setAttribute(y,G(e.slice(i+2,O))),i=O+1}else f.setAttribute(y,"")}return a(f),Ne.has(w)||s.push(f),i}}var q,Q={getStore:()=>q,run(e,n){let t=q;q=e;try{return n()}finally{q=t}}},F=Q;function we(e){F=e??Q}function A(e={}){e.locals||(e.locals=e.request?Z(e.request):{});let n=0,t=0,r=null,s=new Map,a=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${n++}`,nextResourceId:()=>{if(r===null)return`r${t++}`;let l=s.get(r)??0;return s.set(r,l+1),`${r}:r${l}`},nextIslandNamespace:l=>{let d=a.get(l)??0;return a.set(l,d+1),`${l}#${d}`},withResourceScope(l,d){let S=r;r=l;try{return d()}finally{r=S}},pending:new Set,data:new Map}}function k(e,n){return F.run(e,n)}function N(){return F.getStore()}function Y(){return N()?.event}function ye(){let e=Y();return e?(e.locals||(e.locals={}),e.locals):{}}var K=new WeakMap;function Z(e){let n=K.get(e);return n||(n={},K.set(e,n)),n}var te=!1;function se(){te||(te=!0,z({createElement:(e,n)=>new m(e,n),createText:e=>new h(e),createRaw:e=>new R(e),parseTemplate:(e,n)=>B(e,n),createComment:e=>new v(e)}))}function qe(e,n={}){let t=b();se(),x(!0);let r=A(n.event);try{return k(r,()=>re(s=>{try{let a=typeof e=="function"?e():e;return p(a)}finally{s()}}))}finally{x(t)}}var ne=!1;function Ae(){ne||(ne=!0,Te(e=>{N()?.pending.add(e)}),be(()=>N()?.nextResourceId()??""),Re((e,n)=>{e&&N()?.data.set(e,n)}))}var V=null;function ke(e){V=e}function oe(e){if(e.data.size===0)return"";let n={};for(let[r,s]of e.data){let a=s;if(V)try{a=V(s,r)}catch{continue}a!==void 0&&(typeof a=="function"||typeof a=="symbol"||(n[r]=a))}if(Object.keys(n).length===0)return"";let t=j(JSON.stringify(n));return t==="{}"?"":`<script type="application/json" id="${C}">${t}<\/script>`}var Oe=50;async function De(e,n={}){let t=b();se(),x(!0),Ae();let r=A(n.event);try{return await k(r,async()=>{n.preload&&await n.preload(n.event);let s,a=null,l=()=>{};re(u=>{l=u,a=Ee(),s=typeof e=="function"?e():e});let d=()=>{try{ee(a,()=>p(s))}catch{}};d();let S=0;for(;r.pending.size>0&&S++<Oe;){let u=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(u),await Ce(),d()}let o=ee(a,()=>p(s))+oe(r);return l(),o})}finally{x(t)}}export{C as FX_DATA_ID,v as ServerComment,m as ServerElement,g as ServerNode,h as ServerText,A as createRequestContext,j as escapeFxJson,ye as getLocals,N as getRequestContext,Y as getRequestEvent,Z as getRequestLocals,xe as getServerData,ce as isDomElement,le as isDomNode,de as isDomText,b as isServer,pe as isServerNodeValue,qe as renderToString,De as renderToStringAsync,k as runWithRequestContext,p as serializeNode,oe as serializeResourceData,ke as setDataRedactor,we as setRequestStore,x as setServerMode};
@@ -1 +1 @@
1
- "use strict";var a=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var T=(s,t)=>{for(var e in t)a(s,e,{get:t[e],enumerable:!0})},y=(s,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of b(t))!x.call(s,n)&&n!==e&&a(s,n,{get:()=>t[n],enumerable:!(r=m(t,n))||r.enumerable});return s};var S=s=>y(a({},"__esModule",{value:!0}),s);var E={};T(E,{NODE_COMMENT:()=>v,NODE_ELEMENT:()=>g,NODE_TEXT:()=>f,ServerComment:()=>u,ServerElement:()=>c,ServerNode:()=>i,ServerRaw:()=>d,ServerStyle:()=>l,ServerText:()=>o,isServerNodeValue:()=>w});module.exports=S(E);var p=Symbol.for("fluixi.server-node");var g=1,f=3,v=8,N;N=p;var i=class{constructor(){this[N]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let t=this.parentNode;if(!t)return null;let e=t.childNodes.indexOf(this);return e>=0?t.childNodes[e+1]??null:null}get previousSibling(){let t=this.parentNode;if(!t)return null;let e=t.childNodes.indexOf(this);return e>0?t.childNodes[e-1]??null:null}get parentElement(){return this.parentNode}appendChild(t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes.push(t),t}insertBefore(t,e){if(e==null)return this.appendChild(t);t.parentNode&&t.parentNode.removeChild(t);let r=this.childNodes.indexOf(e);return t.parentNode=this,r<0?this.childNodes.push(t):this.childNodes.splice(r,0,t),t}removeChild(t){let e=this.childNodes.indexOf(t);return e>=0&&this.childNodes.splice(e,1),t.parentNode=null,t}replaceChild(t,e){let r=this.childNodes.indexOf(e);return r>=0&&(t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes[r]=t,e.parentNode=null),e}addEventListener(){}removeEventListener(){}},o=class s extends i{constructor(e){super();this.nodeType=f;this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e==null?"":String(e)}get textContent(){return this.data}set textContent(e){this.data=e==null?"":String(e)}cloneNode(){return new s(this.data)}},d=class s extends i{constructor(e){super();this.nodeType=g;this.rawOuterHTML=e}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new s(this.rawOuterHTML)}},u=class s extends i{constructor(e){super();this.nodeType=v;this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e==null?"":String(e)}cloneNode(){return new s(this.data)}},l=class{constructor(){this.cssText=""}setProperty(t,e){this[t]=e}removeProperty(t){delete this[t]}},h=class{constructor(t){this.el=t}list(){let t=this.el.getAttribute("class");return t?t.split(/\s+/).filter(Boolean):[]}write(t){t.length?this.el.setAttribute("class",t.join(" ")):this.el.removeAttribute("class")}add(...t){let e=this.list();for(let r of t)e.includes(r)||e.push(r);this.write(e)}remove(...t){this.write(this.list().filter(e=>!t.includes(e)))}contains(t){return this.list().includes(t)}toggle(t,e){let r=this.contains(t),n=e===void 0?!r:e;return n?this.add(t):this.remove(t),n}},c=class s extends i{constructor(e,r=!1){super();this.nodeType=g;this.attributes=new Map;this.style=new l;this.classList=new h(this);this.rawHTML=null;this.localName=e.toLowerCase(),this.tagName=r?e:e.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(e,r){this.attributes.set(e,String(r))}removeAttribute(e){this.attributes.delete(e)}getAttribute(e){return this.attributes.has(e)?this.attributes.get(e):null}hasAttribute(e){return this.attributes.has(e)}get id(){return this.getAttribute("id")??""}set id(e){e==null?this.removeAttribute("id"):this.setAttribute("id",e)}get className(){return this.getAttribute("class")??""}set className(e){e==null?this.removeAttribute("class"):this.setAttribute("class",e)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(e){e==null?this.removeAttribute("for"):this.setAttribute("for",e)}set value(e){e==null?this.removeAttribute("value"):this.setAttribute("value",String(e))}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(e){e?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(e){}get textContent(){return this.childNodes.map(e=>e.textContent??"").join("")}set textContent(e){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,e!=null&&e!==""&&this.appendChild(new o(String(e)))}set innerText(e){this.textContent=e}set innerHTML(e){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=e==null?"":String(e)}cloneNode(e=!1){let r=new s(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,e)for(let n of this.childNodes)r.appendChild(n.cloneNode(!0));return r}};function w(s){return s instanceof i}
1
+ "use strict";var a=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var x=(s,t)=>{for(var e in t)a(s,e,{get:t[e],enumerable:!0})},S=(s,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of b(t))!T.call(s,n)&&n!==e&&a(s,n,{get:()=>t[n],enumerable:!(r=m(t,n))||r.enumerable});return s};var y=s=>S(a({},"__esModule",{value:!0}),s);var C={};x(C,{NODE_COMMENT:()=>v,NODE_ELEMENT:()=>g,NODE_TEXT:()=>f,ServerComment:()=>u,ServerElement:()=>c,ServerNode:()=>i,ServerRaw:()=>d,ServerStyle:()=>l,ServerText:()=>o,isServerNodeValue:()=>A});module.exports=y(C);var p=Symbol.for("fluixi.server-node"),w=Symbol.for("fluixi.dom.server-host"),E=globalThis,L=E[w]??={server:typeof document>"u",nodes:null};var g=1,f=3,v=8,N;N=p;var i=class{constructor(){this[N]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let t=this.parentNode;if(!t)return null;let e=t.childNodes.indexOf(this);return e>=0?t.childNodes[e+1]??null:null}get previousSibling(){let t=this.parentNode;if(!t)return null;let e=t.childNodes.indexOf(this);return e>0?t.childNodes[e-1]??null:null}get parentElement(){return this.parentNode}appendChild(t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes.push(t),t}insertBefore(t,e){if(e==null)return this.appendChild(t);t.parentNode&&t.parentNode.removeChild(t);let r=this.childNodes.indexOf(e);return t.parentNode=this,r<0?this.childNodes.push(t):this.childNodes.splice(r,0,t),t}removeChild(t){let e=this.childNodes.indexOf(t);return e>=0&&this.childNodes.splice(e,1),t.parentNode=null,t}replaceChild(t,e){let r=this.childNodes.indexOf(e);return r>=0&&(t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes[r]=t,e.parentNode=null),e}addEventListener(){}removeEventListener(){}},o=class s extends i{constructor(e){super();this.nodeType=f;this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e==null?"":String(e)}get textContent(){return this.data}set textContent(e){this.data=e==null?"":String(e)}cloneNode(){return new s(this.data)}},d=class s extends i{constructor(e){super();this.nodeType=g;this.rawOuterHTML=e}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new s(this.rawOuterHTML)}},u=class s extends i{constructor(e){super();this.nodeType=v;this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e==null?"":String(e)}cloneNode(){return new s(this.data)}},l=class{constructor(){this.cssText=""}setProperty(t,e){this[t]=e}removeProperty(t){delete this[t]}},h=class{constructor(t){this.el=t}list(){let t=this.el.getAttribute("class");return t?t.split(/\s+/).filter(Boolean):[]}write(t){t.length?this.el.setAttribute("class",t.join(" ")):this.el.removeAttribute("class")}add(...t){let e=this.list();for(let r of t)e.includes(r)||e.push(r);this.write(e)}remove(...t){this.write(this.list().filter(e=>!t.includes(e)))}contains(t){return this.list().includes(t)}toggle(t,e){let r=this.contains(t),n=e===void 0?!r:e;return n?this.add(t):this.remove(t),n}},c=class s extends i{constructor(e,r=!1){super();this.nodeType=g;this.attributes=new Map;this.style=new l;this.classList=new h(this);this.rawHTML=null;this.localName=e.toLowerCase(),this.tagName=r?e:e.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(e,r){this.attributes.set(e,String(r))}removeAttribute(e){this.attributes.delete(e)}getAttribute(e){return this.attributes.has(e)?this.attributes.get(e):null}hasAttribute(e){return this.attributes.has(e)}get id(){return this.getAttribute("id")??""}set id(e){e==null?this.removeAttribute("id"):this.setAttribute("id",e)}get className(){return this.getAttribute("class")??""}set className(e){e==null?this.removeAttribute("class"):this.setAttribute("class",e)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(e){e==null?this.removeAttribute("for"):this.setAttribute("for",e)}set value(e){e==null?this.removeAttribute("value"):this.setAttribute("value",String(e))}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(e){e?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(e){}get textContent(){return this.childNodes.map(e=>e.textContent??"").join("")}set textContent(e){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,e!=null&&e!==""&&this.appendChild(new o(String(e)))}set innerText(e){this.textContent=e}set innerHTML(e){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=e==null?"":String(e)}cloneNode(e=!1){let r=new s(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,e)for(let n of this.childNodes)r.appendChild(n.cloneNode(!0));return r}};function A(s){return s instanceof i}
@@ -1 +1 @@
1
- var d=Symbol.for("fluixi.server-node");var p=1,N=3,f=8,g;g=d;var n=class{constructor(){this[g]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let t=this.parentNode;if(!t)return null;let e=t.childNodes.indexOf(this);return e>=0?t.childNodes[e+1]??null:null}get previousSibling(){let t=this.parentNode;if(!t)return null;let e=t.childNodes.indexOf(this);return e>0?t.childNodes[e-1]??null:null}get parentElement(){return this.parentNode}appendChild(t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes.push(t),t}insertBefore(t,e){if(e==null)return this.appendChild(t);t.parentNode&&t.parentNode.removeChild(t);let r=this.childNodes.indexOf(e);return t.parentNode=this,r<0?this.childNodes.push(t):this.childNodes.splice(r,0,t),t}removeChild(t){let e=this.childNodes.indexOf(t);return e>=0&&this.childNodes.splice(e,1),t.parentNode=null,t}replaceChild(t,e){let r=this.childNodes.indexOf(e);return r>=0&&(t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes[r]=t,e.parentNode=null),e}addEventListener(){}removeEventListener(){}},o=class s extends n{constructor(e){super();this.nodeType=N;this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e==null?"":String(e)}get textContent(){return this.data}set textContent(e){this.data=e==null?"":String(e)}cloneNode(){return new s(this.data)}},u=class s extends n{constructor(e){super();this.nodeType=p;this.rawOuterHTML=e}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new s(this.rawOuterHTML)}},h=class s extends n{constructor(e){super();this.nodeType=f;this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e==null?"":String(e)}cloneNode(){return new s(this.data)}},l=class{constructor(){this.cssText=""}setProperty(t,e){this[t]=e}removeProperty(t){delete this[t]}},a=class{constructor(t){this.el=t}list(){let t=this.el.getAttribute("class");return t?t.split(/\s+/).filter(Boolean):[]}write(t){t.length?this.el.setAttribute("class",t.join(" ")):this.el.removeAttribute("class")}add(...t){let e=this.list();for(let r of t)e.includes(r)||e.push(r);this.write(e)}remove(...t){this.write(this.list().filter(e=>!t.includes(e)))}contains(t){return this.list().includes(t)}toggle(t,e){let r=this.contains(t),i=e===void 0?!r:e;return i?this.add(t):this.remove(t),i}},c=class s extends n{constructor(e,r=!1){super();this.nodeType=p;this.attributes=new Map;this.style=new l;this.classList=new a(this);this.rawHTML=null;this.localName=e.toLowerCase(),this.tagName=r?e:e.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(e,r){this.attributes.set(e,String(r))}removeAttribute(e){this.attributes.delete(e)}getAttribute(e){return this.attributes.has(e)?this.attributes.get(e):null}hasAttribute(e){return this.attributes.has(e)}get id(){return this.getAttribute("id")??""}set id(e){e==null?this.removeAttribute("id"):this.setAttribute("id",e)}get className(){return this.getAttribute("class")??""}set className(e){e==null?this.removeAttribute("class"):this.setAttribute("class",e)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(e){e==null?this.removeAttribute("for"):this.setAttribute("for",e)}set value(e){e==null?this.removeAttribute("value"):this.setAttribute("value",String(e))}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(e){e?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(e){}get textContent(){return this.childNodes.map(e=>e.textContent??"").join("")}set textContent(e){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,e!=null&&e!==""&&this.appendChild(new o(String(e)))}set innerText(e){this.textContent=e}set innerHTML(e){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=e==null?"":String(e)}cloneNode(e=!1){let r=new s(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,e)for(let i of this.childNodes)r.appendChild(i.cloneNode(!0));return r}};function b(s){return s instanceof n}export{f as NODE_COMMENT,p as NODE_ELEMENT,N as NODE_TEXT,h as ServerComment,c as ServerElement,n as ServerNode,u as ServerRaw,l as ServerStyle,o as ServerText,b as isServerNodeValue};
1
+ var d=Symbol.for("fluixi.server-node"),N=Symbol.for("fluixi.dom.server-host"),f=globalThis,b=f[N]??={server:typeof document>"u",nodes:null};var p=1,v=3,m=8,g;g=d;var n=class{constructor(){this[g]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let t=this.parentNode;if(!t)return null;let e=t.childNodes.indexOf(this);return e>=0?t.childNodes[e+1]??null:null}get previousSibling(){let t=this.parentNode;if(!t)return null;let e=t.childNodes.indexOf(this);return e>0?t.childNodes[e-1]??null:null}get parentElement(){return this.parentNode}appendChild(t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes.push(t),t}insertBefore(t,e){if(e==null)return this.appendChild(t);t.parentNode&&t.parentNode.removeChild(t);let r=this.childNodes.indexOf(e);return t.parentNode=this,r<0?this.childNodes.push(t):this.childNodes.splice(r,0,t),t}removeChild(t){let e=this.childNodes.indexOf(t);return e>=0&&this.childNodes.splice(e,1),t.parentNode=null,t}replaceChild(t,e){let r=this.childNodes.indexOf(e);return r>=0&&(t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes[r]=t,e.parentNode=null),e}addEventListener(){}removeEventListener(){}},o=class s extends n{constructor(e){super();this.nodeType=v;this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e==null?"":String(e)}get textContent(){return this.data}set textContent(e){this.data=e==null?"":String(e)}cloneNode(){return new s(this.data)}},u=class s extends n{constructor(e){super();this.nodeType=p;this.rawOuterHTML=e}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new s(this.rawOuterHTML)}},h=class s extends n{constructor(e){super();this.nodeType=m;this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e==null?"":String(e)}cloneNode(){return new s(this.data)}},l=class{constructor(){this.cssText=""}setProperty(t,e){this[t]=e}removeProperty(t){delete this[t]}},a=class{constructor(t){this.el=t}list(){let t=this.el.getAttribute("class");return t?t.split(/\s+/).filter(Boolean):[]}write(t){t.length?this.el.setAttribute("class",t.join(" ")):this.el.removeAttribute("class")}add(...t){let e=this.list();for(let r of t)e.includes(r)||e.push(r);this.write(e)}remove(...t){this.write(this.list().filter(e=>!t.includes(e)))}contains(t){return this.list().includes(t)}toggle(t,e){let r=this.contains(t),i=e===void 0?!r:e;return i?this.add(t):this.remove(t),i}},c=class s extends n{constructor(e,r=!1){super();this.nodeType=p;this.attributes=new Map;this.style=new l;this.classList=new a(this);this.rawHTML=null;this.localName=e.toLowerCase(),this.tagName=r?e:e.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(e,r){this.attributes.set(e,String(r))}removeAttribute(e){this.attributes.delete(e)}getAttribute(e){return this.attributes.has(e)?this.attributes.get(e):null}hasAttribute(e){return this.attributes.has(e)}get id(){return this.getAttribute("id")??""}set id(e){e==null?this.removeAttribute("id"):this.setAttribute("id",e)}get className(){return this.getAttribute("class")??""}set className(e){e==null?this.removeAttribute("class"):this.setAttribute("class",e)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(e){e==null?this.removeAttribute("for"):this.setAttribute("for",e)}set value(e){e==null?this.removeAttribute("value"):this.setAttribute("value",String(e))}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(e){e?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(e){}get textContent(){return this.childNodes.map(e=>e.textContent??"").join("")}set textContent(e){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,e!=null&&e!==""&&this.appendChild(new o(String(e)))}set innerText(e){this.textContent=e}set innerHTML(e){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=e==null?"":String(e)}cloneNode(e=!1){let r=new s(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,e)for(let i of this.childNodes)r.appendChild(i.cloneNode(!0));return r}};function S(s){return s instanceof n}export{m as NODE_COMMENT,p as NODE_ELEMENT,v as NODE_TEXT,h as ServerComment,c as ServerElement,n as ServerNode,u as ServerRaw,l as ServerStyle,o as ServerText,S as isServerNodeValue};
@@ -1 +1 @@
1
- "use strict";var m=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var k=(n,t)=>{for(var e in t)m(n,e,{get:t[e],enumerable:!0})},V=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of L(t))!M.call(n,o)&&o!==e&&m(n,o,{get:()=>t[o],enumerable:!(r=O(t,o))||r.enumerable});return n};var H=n=>V(m({},"__esModule",{value:!0}),n);var _={};k(_,{TemplateParseError:()=>a,parseTemplate:()=>j});module.exports=H(_);var T=Symbol.for("fluixi.server-node");var $=1,D=3,R=8,y;y=T;var h=class{constructor(){this[y]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let t=this.parentNode;if(!t)return null;let e=t.childNodes.indexOf(this);return e>=0?t.childNodes[e+1]??null:null}get previousSibling(){let t=this.parentNode;if(!t)return null;let e=t.childNodes.indexOf(this);return e>0?t.childNodes[e-1]??null:null}get parentElement(){return this.parentNode}appendChild(t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes.push(t),t}insertBefore(t,e){if(e==null)return this.appendChild(t);t.parentNode&&t.parentNode.removeChild(t);let r=this.childNodes.indexOf(e);return t.parentNode=this,r<0?this.childNodes.push(t):this.childNodes.splice(r,0,t),t}removeChild(t){let e=this.childNodes.indexOf(t);return e>=0&&this.childNodes.splice(e,1),t.parentNode=null,t}replaceChild(t,e){let r=this.childNodes.indexOf(e);return r>=0&&(t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes[r]=t,e.parentNode=null),e}addEventListener(){}removeEventListener(){}},g=class n extends h{constructor(e){super();this.nodeType=D;this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e==null?"":String(e)}get textContent(){return this.data}set textContent(e){this.data=e==null?"":String(e)}cloneNode(){return new n(this.data)}};var f=class n extends h{constructor(e){super();this.nodeType=R;this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e==null?"":String(e)}cloneNode(){return new n(this.data)}},w=class{constructor(){this.cssText=""}setProperty(t,e){this[t]=e}removeProperty(t){delete this[t]}},b=class{constructor(t){this.el=t}list(){let t=this.el.getAttribute("class");return t?t.split(/\s+/).filter(Boolean):[]}write(t){t.length?this.el.setAttribute("class",t.join(" ")):this.el.removeAttribute("class")}add(...t){let e=this.list();for(let r of t)e.includes(r)||e.push(r);this.write(e)}remove(...t){this.write(this.list().filter(e=>!t.includes(e)))}contains(t){return this.list().includes(t)}toggle(t,e){let r=this.contains(t),o=e===void 0?!r:e;return o?this.add(t):this.remove(t),o}},p=class n extends h{constructor(e,r=!1){super();this.nodeType=$;this.attributes=new Map;this.style=new w;this.classList=new b(this);this.rawHTML=null;this.localName=e.toLowerCase(),this.tagName=r?e:e.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(e,r){this.attributes.set(e,String(r))}removeAttribute(e){this.attributes.delete(e)}getAttribute(e){return this.attributes.has(e)?this.attributes.get(e):null}hasAttribute(e){return this.attributes.has(e)}get id(){return this.getAttribute("id")??""}set id(e){e==null?this.removeAttribute("id"):this.setAttribute("id",e)}get className(){return this.getAttribute("class")??""}set className(e){e==null?this.removeAttribute("class"):this.setAttribute("class",e)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(e){e==null?this.removeAttribute("for"):this.setAttribute("for",e)}set value(e){e==null?this.removeAttribute("value"):this.setAttribute("value",String(e))}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(e){e?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(e){}get textContent(){return this.childNodes.map(e=>e.textContent??"").join("")}set textContent(e){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,e!=null&&e!==""&&this.appendChild(new g(String(e)))}set innerText(e){this.textContent=e}set innerHTML(e){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=e==null?"":String(e)}cloneNode(e=!1){let r=new n(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,e)for(let o of this.childNodes)r.appendChild(o.cloneNode(!0));return r}};var F=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),I={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function E(n){return n.replace(/&(#?\w+);/g,(t,e)=>I[e]??t)}var a=class extends Error{};function j(n,t=!1){let e=0,r=[],o=[],N=s=>{let l=o[o.length-1];l?l.appendChild(s):r.push(s)};for(;e<n.length;){let s=n.indexOf("<",e);if(s===-1){S(n.slice(e));break}if(s>e&&S(n.slice(e,s)),n.startsWith("<!--",s)){let l=n.indexOf("-->",s);if(l===-1)throw new a(`unterminated comment at ${s}`);N(new f(n.slice(s+4,l))),e=l+3;continue}if(n[s+1]==="/"){let l=n.indexOf(">",s);if(l===-1)throw new a(`unterminated closing tag at ${s}`);let u=n.slice(s+2,l).trim().toLowerCase(),d=o.pop();if(!d||d.localName!==u)throw new a(`</${u}> does not close <${d?.localName??"nothing"}>`);e=l+1;continue}e=C(s)}if(o.length>0)throw new a(`unclosed <${o[o.length-1].localName}>`);let x=r[0];if(r.length!==1||!(x instanceof p))throw new a(`expected exactly one root element, got ${r.length}`);return x;function S(s){s!==""&&N(new g(E(s)))}function C(s){let l=/[\s/>]/.exec(n.slice(s+1));if(!l)throw new a(`unterminated tag at ${s}`);let u=n.slice(s+1,s+1+l.index).toLowerCase(),d=new p(u,t),i=s+1+l.index;for(;i<n.length;){for(;i<n.length&&/\s/.test(n[i]);)i++;if(n[i]===">"){i++;break}if(n[i]==="/"&&n[i+1]===">"){i+=2;break}let A=i;for(;i<n.length&&!/[\s=/>]/.test(n[i]);)i++;let c=n.slice(A,i);if(c==="")throw new a(`malformed attribute at ${i}`);if(n[i]==="="){if(n[i+1]!=='"')throw new a(`attribute ${c} must have a double-quoted value`);let v=n.indexOf('"',i+2);if(v===-1)throw new a(`unterminated value for ${c}`);d.setAttribute(c,E(n.slice(i+2,v))),i=v+1}else d.setAttribute(c,"")}return N(d),F.has(u)||o.push(d),i}}
1
+ "use strict";var b=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var k=(n,t)=>{for(var e in t)b(n,e,{get:t[e],enumerable:!0})},H=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of L(t))!M.call(n,o)&&o!==e&&b(n,o,{get:()=>t[o],enumerable:!(r=O(t,o))||r.enumerable});return n};var V=n=>H(b({},"__esModule",{value:!0}),n);var U={};k(U,{TemplateParseError:()=>l,parseTemplate:()=>G});module.exports=V(U);var T=Symbol.for("fluixi.server-node"),$=Symbol.for("fluixi.dom.server-host"),D=globalThis,B=D[$]??={server:typeof document>"u",nodes:null};var R=1,F=3,I=8,y;y=T;var h=class{constructor(){this[y]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let t=this.parentNode;if(!t)return null;let e=t.childNodes.indexOf(this);return e>=0?t.childNodes[e+1]??null:null}get previousSibling(){let t=this.parentNode;if(!t)return null;let e=t.childNodes.indexOf(this);return e>0?t.childNodes[e-1]??null:null}get parentElement(){return this.parentNode}appendChild(t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes.push(t),t}insertBefore(t,e){if(e==null)return this.appendChild(t);t.parentNode&&t.parentNode.removeChild(t);let r=this.childNodes.indexOf(e);return t.parentNode=this,r<0?this.childNodes.push(t):this.childNodes.splice(r,0,t),t}removeChild(t){let e=this.childNodes.indexOf(t);return e>=0&&this.childNodes.splice(e,1),t.parentNode=null,t}replaceChild(t,e){let r=this.childNodes.indexOf(e);return r>=0&&(t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes[r]=t,e.parentNode=null),e}addEventListener(){}removeEventListener(){}},g=class n extends h{constructor(e){super();this.nodeType=F;this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e==null?"":String(e)}get textContent(){return this.data}set textContent(e){this.data=e==null?"":String(e)}cloneNode(){return new n(this.data)}};var f=class n extends h{constructor(e){super();this.nodeType=I;this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e==null?"":String(e)}cloneNode(){return new n(this.data)}},m=class{constructor(){this.cssText=""}setProperty(t,e){this[t]=e}removeProperty(t){delete this[t]}},w=class{constructor(t){this.el=t}list(){let t=this.el.getAttribute("class");return t?t.split(/\s+/).filter(Boolean):[]}write(t){t.length?this.el.setAttribute("class",t.join(" ")):this.el.removeAttribute("class")}add(...t){let e=this.list();for(let r of t)e.includes(r)||e.push(r);this.write(e)}remove(...t){this.write(this.list().filter(e=>!t.includes(e)))}contains(t){return this.list().includes(t)}toggle(t,e){let r=this.contains(t),o=e===void 0?!r:e;return o?this.add(t):this.remove(t),o}},p=class n extends h{constructor(e,r=!1){super();this.nodeType=R;this.attributes=new Map;this.style=new m;this.classList=new w(this);this.rawHTML=null;this.localName=e.toLowerCase(),this.tagName=r?e:e.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(e,r){this.attributes.set(e,String(r))}removeAttribute(e){this.attributes.delete(e)}getAttribute(e){return this.attributes.has(e)?this.attributes.get(e):null}hasAttribute(e){return this.attributes.has(e)}get id(){return this.getAttribute("id")??""}set id(e){e==null?this.removeAttribute("id"):this.setAttribute("id",e)}get className(){return this.getAttribute("class")??""}set className(e){e==null?this.removeAttribute("class"):this.setAttribute("class",e)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(e){e==null?this.removeAttribute("for"):this.setAttribute("for",e)}set value(e){e==null?this.removeAttribute("value"):this.setAttribute("value",String(e))}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(e){e?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(e){}get textContent(){return this.childNodes.map(e=>e.textContent??"").join("")}set textContent(e){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,e!=null&&e!==""&&this.appendChild(new g(String(e)))}set innerText(e){this.textContent=e}set innerHTML(e){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=e==null?"":String(e)}cloneNode(e=!1){let r=new n(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,e)for(let o of this.childNodes)r.appendChild(o.cloneNode(!0));return r}};var j=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),q={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function E(n){return n.replace(/&(#?\w+);/g,(t,e)=>q[e]??t)}var l=class extends Error{};function G(n,t=!1){let e=0,r=[],o=[],N=s=>{let a=o[o.length-1];a?a.appendChild(s):r.push(s)};for(;e<n.length;){let s=n.indexOf("<",e);if(s===-1){S(n.slice(e));break}if(s>e&&S(n.slice(e,s)),n.startsWith("<!--",s)){let a=n.indexOf("-->",s);if(a===-1)throw new l(`unterminated comment at ${s}`);N(new f(n.slice(s+4,a))),e=a+3;continue}if(n[s+1]==="/"){let a=n.indexOf(">",s);if(a===-1)throw new l(`unterminated closing tag at ${s}`);let u=n.slice(s+2,a).trim().toLowerCase(),d=o.pop();if(!d||d.localName!==u)throw new l(`</${u}> does not close <${d?.localName??"nothing"}>`);e=a+1;continue}e=C(s)}if(o.length>0)throw new l(`unclosed <${o[o.length-1].localName}>`);let x=r[0];if(r.length!==1||!(x instanceof p))throw new l(`expected exactly one root element, got ${r.length}`);return x;function S(s){s!==""&&N(new g(E(s)))}function C(s){let a=/[\s/>]/.exec(n.slice(s+1));if(!a)throw new l(`unterminated tag at ${s}`);let u=n.slice(s+1,s+1+a.index).toLowerCase(),d=new p(u,t),i=s+1+a.index;for(;i<n.length;){for(;i<n.length&&/\s/.test(n[i]);)i++;if(n[i]===">"){i++;break}if(n[i]==="/"&&n[i+1]===">"){i+=2;break}let A=i;for(;i<n.length&&!/[\s=/>]/.test(n[i]);)i++;let c=n.slice(A,i);if(c==="")throw new l(`malformed attribute at ${i}`);if(n[i]==="="){if(n[i+1]!=='"')throw new l(`attribute ${c} must have a double-quoted value`);let v=n.indexOf('"',i+2);if(v===-1)throw new l(`unterminated value for ${c}`);d.setAttribute(c,E(n.slice(i+2,v))),i=v+1}else d.setAttribute(c,"")}return N(d),j.has(u)||o.push(d),i}}
@@ -1 +1 @@
1
- var S=Symbol.for("fluixi.server-node");var A=1,O=3,L=8,T;T=S;var h=class{constructor(){this[T]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let t=this.parentNode;if(!t)return null;let e=t.childNodes.indexOf(this);return e>=0?t.childNodes[e+1]??null:null}get previousSibling(){let t=this.parentNode;if(!t)return null;let e=t.childNodes.indexOf(this);return e>0?t.childNodes[e-1]??null:null}get parentElement(){return this.parentNode}appendChild(t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes.push(t),t}insertBefore(t,e){if(e==null)return this.appendChild(t);t.parentNode&&t.parentNode.removeChild(t);let r=this.childNodes.indexOf(e);return t.parentNode=this,r<0?this.childNodes.push(t):this.childNodes.splice(r,0,t),t}removeChild(t){let e=this.childNodes.indexOf(t);return e>=0&&this.childNodes.splice(e,1),t.parentNode=null,t}replaceChild(t,e){let r=this.childNodes.indexOf(e);return r>=0&&(t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes[r]=t,e.parentNode=null),e}addEventListener(){}removeEventListener(){}},g=class n extends h{constructor(e){super();this.nodeType=O;this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e==null?"":String(e)}get textContent(){return this.data}set textContent(e){this.data=e==null?"":String(e)}cloneNode(){return new n(this.data)}};var f=class n extends h{constructor(e){super();this.nodeType=L;this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e==null?"":String(e)}cloneNode(){return new n(this.data)}},m=class{constructor(){this.cssText=""}setProperty(t,e){this[t]=e}removeProperty(t){delete this[t]}},w=class{constructor(t){this.el=t}list(){let t=this.el.getAttribute("class");return t?t.split(/\s+/).filter(Boolean):[]}write(t){t.length?this.el.setAttribute("class",t.join(" ")):this.el.removeAttribute("class")}add(...t){let e=this.list();for(let r of t)e.includes(r)||e.push(r);this.write(e)}remove(...t){this.write(this.list().filter(e=>!t.includes(e)))}contains(t){return this.list().includes(t)}toggle(t,e){let r=this.contains(t),l=e===void 0?!r:e;return l?this.add(t):this.remove(t),l}},p=class n extends h{constructor(e,r=!1){super();this.nodeType=A;this.attributes=new Map;this.style=new m;this.classList=new w(this);this.rawHTML=null;this.localName=e.toLowerCase(),this.tagName=r?e:e.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(e,r){this.attributes.set(e,String(r))}removeAttribute(e){this.attributes.delete(e)}getAttribute(e){return this.attributes.has(e)?this.attributes.get(e):null}hasAttribute(e){return this.attributes.has(e)}get id(){return this.getAttribute("id")??""}set id(e){e==null?this.removeAttribute("id"):this.setAttribute("id",e)}get className(){return this.getAttribute("class")??""}set className(e){e==null?this.removeAttribute("class"):this.setAttribute("class",e)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(e){e==null?this.removeAttribute("for"):this.setAttribute("for",e)}set value(e){e==null?this.removeAttribute("value"):this.setAttribute("value",String(e))}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(e){e?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(e){}get textContent(){return this.childNodes.map(e=>e.textContent??"").join("")}set textContent(e){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,e!=null&&e!==""&&this.appendChild(new g(String(e)))}set innerText(e){this.textContent=e}set innerHTML(e){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=e==null?"":String(e)}cloneNode(e=!1){let r=new n(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,e)for(let l of this.childNodes)r.appendChild(l.cloneNode(!0));return r}};var M=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),k={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function y(n){return n.replace(/&(#?\w+);/g,(t,e)=>k[e]??t)}var a=class extends Error{};function R(n,t=!1){let e=0,r=[],l=[],N=s=>{let o=l[l.length-1];o?o.appendChild(s):r.push(s)};for(;e<n.length;){let s=n.indexOf("<",e);if(s===-1){x(n.slice(e));break}if(s>e&&x(n.slice(e,s)),n.startsWith("<!--",s)){let o=n.indexOf("-->",s);if(o===-1)throw new a(`unterminated comment at ${s}`);N(new f(n.slice(s+4,o))),e=o+3;continue}if(n[s+1]==="/"){let o=n.indexOf(">",s);if(o===-1)throw new a(`unterminated closing tag at ${s}`);let u=n.slice(s+2,o).trim().toLowerCase(),d=l.pop();if(!d||d.localName!==u)throw new a(`</${u}> does not close <${d?.localName??"nothing"}>`);e=o+1;continue}e=E(s)}if(l.length>0)throw new a(`unclosed <${l[l.length-1].localName}>`);let b=r[0];if(r.length!==1||!(b instanceof p))throw new a(`expected exactly one root element, got ${r.length}`);return b;function x(s){s!==""&&N(new g(y(s)))}function E(s){let o=/[\s/>]/.exec(n.slice(s+1));if(!o)throw new a(`unterminated tag at ${s}`);let u=n.slice(s+1,s+1+o.index).toLowerCase(),d=new p(u,t),i=s+1+o.index;for(;i<n.length;){for(;i<n.length&&/\s/.test(n[i]);)i++;if(n[i]===">"){i++;break}if(n[i]==="/"&&n[i+1]===">"){i+=2;break}let C=i;for(;i<n.length&&!/[\s=/>]/.test(n[i]);)i++;let c=n.slice(C,i);if(c==="")throw new a(`malformed attribute at ${i}`);if(n[i]==="="){if(n[i+1]!=='"')throw new a(`attribute ${c} must have a double-quoted value`);let v=n.indexOf('"',i+2);if(v===-1)throw new a(`unterminated value for ${c}`);d.setAttribute(c,y(n.slice(i+2,v))),i=v+1}else d.setAttribute(c,"")}return N(d),M.has(u)||l.push(d),i}}export{a as TemplateParseError,R as parseTemplate};
1
+ var S=Symbol.for("fluixi.server-node"),A=Symbol.for("fluixi.dom.server-host"),O=globalThis,$=O[A]??={server:typeof document>"u",nodes:null};var L=1,M=3,k=8,T;T=S;var h=class{constructor(){this[T]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let t=this.parentNode;if(!t)return null;let e=t.childNodes.indexOf(this);return e>=0?t.childNodes[e+1]??null:null}get previousSibling(){let t=this.parentNode;if(!t)return null;let e=t.childNodes.indexOf(this);return e>0?t.childNodes[e-1]??null:null}get parentElement(){return this.parentNode}appendChild(t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes.push(t),t}insertBefore(t,e){if(e==null)return this.appendChild(t);t.parentNode&&t.parentNode.removeChild(t);let r=this.childNodes.indexOf(e);return t.parentNode=this,r<0?this.childNodes.push(t):this.childNodes.splice(r,0,t),t}removeChild(t){let e=this.childNodes.indexOf(t);return e>=0&&this.childNodes.splice(e,1),t.parentNode=null,t}replaceChild(t,e){let r=this.childNodes.indexOf(e);return r>=0&&(t.parentNode&&t.parentNode.removeChild(t),t.parentNode=this,this.childNodes[r]=t,e.parentNode=null),e}addEventListener(){}removeEventListener(){}},g=class n extends h{constructor(e){super();this.nodeType=M;this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e==null?"":String(e)}get textContent(){return this.data}set textContent(e){this.data=e==null?"":String(e)}cloneNode(){return new n(this.data)}};var f=class n extends h{constructor(e){super();this.nodeType=k;this.data=e}get nodeValue(){return this.data}set nodeValue(e){this.data=e==null?"":String(e)}cloneNode(){return new n(this.data)}},b=class{constructor(){this.cssText=""}setProperty(t,e){this[t]=e}removeProperty(t){delete this[t]}},m=class{constructor(t){this.el=t}list(){let t=this.el.getAttribute("class");return t?t.split(/\s+/).filter(Boolean):[]}write(t){t.length?this.el.setAttribute("class",t.join(" ")):this.el.removeAttribute("class")}add(...t){let e=this.list();for(let r of t)e.includes(r)||e.push(r);this.write(e)}remove(...t){this.write(this.list().filter(e=>!t.includes(e)))}contains(t){return this.list().includes(t)}toggle(t,e){let r=this.contains(t),a=e===void 0?!r:e;return a?this.add(t):this.remove(t),a}},p=class n extends h{constructor(e,r=!1){super();this.nodeType=L;this.attributes=new Map;this.style=new b;this.classList=new m(this);this.rawHTML=null;this.localName=e.toLowerCase(),this.tagName=r?e:e.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(e,r){this.attributes.set(e,String(r))}removeAttribute(e){this.attributes.delete(e)}getAttribute(e){return this.attributes.has(e)?this.attributes.get(e):null}hasAttribute(e){return this.attributes.has(e)}get id(){return this.getAttribute("id")??""}set id(e){e==null?this.removeAttribute("id"):this.setAttribute("id",e)}get className(){return this.getAttribute("class")??""}set className(e){e==null?this.removeAttribute("class"):this.setAttribute("class",e)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(e){e==null?this.removeAttribute("for"):this.setAttribute("for",e)}set value(e){e==null?this.removeAttribute("value"):this.setAttribute("value",String(e))}set checked(e){e?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(e){e?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(e){}get textContent(){return this.childNodes.map(e=>e.textContent??"").join("")}set textContent(e){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,e!=null&&e!==""&&this.appendChild(new g(String(e)))}set innerText(e){this.textContent=e}set innerHTML(e){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=e==null?"":String(e)}cloneNode(e=!1){let r=new n(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,e)for(let a of this.childNodes)r.appendChild(a.cloneNode(!0));return r}};var H=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),V={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function y(n){return n.replace(/&(#?\w+);/g,(t,e)=>V[e]??t)}var l=class extends Error{};function j(n,t=!1){let e=0,r=[],a=[],N=s=>{let o=a[a.length-1];o?o.appendChild(s):r.push(s)};for(;e<n.length;){let s=n.indexOf("<",e);if(s===-1){x(n.slice(e));break}if(s>e&&x(n.slice(e,s)),n.startsWith("<!--",s)){let o=n.indexOf("-->",s);if(o===-1)throw new l(`unterminated comment at ${s}`);N(new f(n.slice(s+4,o))),e=o+3;continue}if(n[s+1]==="/"){let o=n.indexOf(">",s);if(o===-1)throw new l(`unterminated closing tag at ${s}`);let u=n.slice(s+2,o).trim().toLowerCase(),d=a.pop();if(!d||d.localName!==u)throw new l(`</${u}> does not close <${d?.localName??"nothing"}>`);e=o+1;continue}e=E(s)}if(a.length>0)throw new l(`unclosed <${a[a.length-1].localName}>`);let w=r[0];if(r.length!==1||!(w instanceof p))throw new l(`expected exactly one root element, got ${r.length}`);return w;function x(s){s!==""&&N(new g(y(s)))}function E(s){let o=/[\s/>]/.exec(n.slice(s+1));if(!o)throw new l(`unterminated tag at ${s}`);let u=n.slice(s+1,s+1+o.index).toLowerCase(),d=new p(u,t),i=s+1+o.index;for(;i<n.length;){for(;i<n.length&&/\s/.test(n[i]);)i++;if(n[i]===">"){i++;break}if(n[i]==="/"&&n[i+1]===">"){i+=2;break}let C=i;for(;i<n.length&&!/[\s=/>]/.test(n[i]);)i++;let c=n.slice(C,i);if(c==="")throw new l(`malformed attribute at ${i}`);if(n[i]==="="){if(n[i+1]!=='"')throw new l(`attribute ${c} must have a double-quoted value`);let v=n.indexOf('"',i+2);if(v===-1)throw new l(`unterminated value for ${c}`);d.setAttribute(c,y(n.slice(i+2,v))),i=v+1}else d.setAttribute(c,"")}return N(d),H.has(u)||a.push(d),i}}export{l as TemplateParseError,j as parseTemplate};
@@ -1 +1 @@
1
- "use strict";var k=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var ie=Object.prototype.hasOwnProperty;var oe=(e,n)=>{for(var t in n)k(e,t,{get:n[t],enumerable:!0})},ae=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of se(n))!ie.call(e,s)&&s!==t&&k(e,s,{get:()=>n[s],enumerable:!(r=re(n,s))||r.enumerable});return e};var ue=e=>ae(k({},"__esModule",{value:!0}),e);var be={};oe(be,{renderToString:()=>we,renderToStringAsync:()=>Te,serializeResourceData:()=>te,setDataRedactor:()=>ye});module.exports=ue(be);var j=require("@fluixi/reactive/signal"),c=require("@fluixi/reactive/signal");var T=typeof document>"u";function S(e){T=e}var H=Symbol.for("fluixi.server-node"),le=null;function F(e){le=e}var R=1,M=3,_=8,V;V=H;var x=class{constructor(){this[V]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>=0?n.childNodes[t+1]??null:null}get previousSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>0?n.childNodes[t-1]??null:null}get parentElement(){return this.parentNode}appendChild(n){return n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes.push(n),n}insertBefore(n,t){if(t==null)return this.appendChild(n);n.parentNode&&n.parentNode.removeChild(n);let r=this.childNodes.indexOf(t);return n.parentNode=this,r<0?this.childNodes.push(n):this.childNodes.splice(r,0,n),n}removeChild(n){let t=this.childNodes.indexOf(n);return t>=0&&this.childNodes.splice(t,1),n.parentNode=null,n}replaceChild(n,t){let r=this.childNodes.indexOf(t);return r>=0&&(n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes[r]=n,t.parentNode=null),t}addEventListener(){}removeEventListener(){}},h=class e extends x{constructor(t){super();this.nodeType=M;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}get textContent(){return this.data}set textContent(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},b=class e extends x{constructor(t){super();this.nodeType=R;this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new e(this.rawOuterHTML)}},v=class e extends x{constructor(t){super();this.nodeType=_;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},q=class{constructor(){this.cssText=""}setProperty(n,t){this[n]=t}removeProperty(n){delete this[n]}},O=class{constructor(n){this.el=n}list(){let n=this.el.getAttribute("class");return n?n.split(/\s+/).filter(Boolean):[]}write(n){n.length?this.el.setAttribute("class",n.join(" ")):this.el.removeAttribute("class")}add(...n){let t=this.list();for(let r of n)t.includes(r)||t.push(r);this.write(t)}remove(...n){this.write(this.list().filter(t=>!n.includes(t)))}contains(n){return this.list().includes(n)}toggle(n,t){let r=this.contains(n),s=t===void 0?!r:t;return s?this.add(n):this.remove(n),s}},m=class e extends x{constructor(t,r=!1){super();this.nodeType=R;this.attributes=new Map;this.style=new q;this.classList=new O(this);this.rawHTML=null;this.localName=t.toLowerCase(),this.tagName=r?t:t.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(t,r){this.attributes.set(t,String(r))}removeAttribute(t){this.attributes.delete(t)}getAttribute(t){return this.attributes.has(t)?this.attributes.get(t):null}hasAttribute(t){return this.attributes.has(t)}get id(){return this.getAttribute("id")??""}set id(t){t==null?this.removeAttribute("id"):this.setAttribute("id",t)}get className(){return this.getAttribute("class")??""}set className(t){t==null?this.removeAttribute("class"):this.setAttribute("class",t)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(t){t==null?this.removeAttribute("for"):this.setAttribute("for",t)}set value(t){t==null?this.removeAttribute("value"):this.setAttribute("value",String(t))}set checked(t){t?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(t){t?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(t){}get textContent(){return this.childNodes.map(t=>t.textContent??"").join("")}set textContent(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,t!=null&&t!==""&&this.appendChild(new h(String(t)))}set innerText(t){this.textContent=t}set innerHTML(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=t==null?"":String(t)}cloneNode(t=!1){let r=new e(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,t)for(let s of this.childNodes)r.appendChild(s.cloneNode(!0));return r}};var ce=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),z=/&/g,P=/</g,W=/>/g,de=/"/g;function L(e){return e.replace(z,"&amp;").replace(P,"&lt;").replace(W,"&gt;")}function X(e){return e.replace(z,"&amp;").replace(de,"&quot;").replace(P,"&lt;").replace(W,"&gt;")}function fe(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())}function pe(e){if(!e)return"";let n=[];e.cssText&&n.push(e.cssText.trim().replace(/;\s*$/,""));for(let t of Object.keys(e)){if(t==="cssText")continue;let r=e[t];r==null||r===""||n.push(`${fe(t)}: ${r}`)}return n.join("; ")}function ge(e){let n="",t=pe(e.style);for(let[r,s]of e.attributes)r==="style"&&t||(n+=` ${r}="${X(s)}"`);if(t){let r=e.attributes.get("style"),s=r?`${r.replace(/;\s*$/,"")}; ${t}`:t;n+=` style="${X(s)}"`}return n}function g(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return L(e);if(typeof e=="number")return L(String(e));if(typeof e=="function")return g(e());if(Array.isArray(e))return e.map(g).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case M:return L(e.data??"");case _:return`<!--${e.data??""}-->`;case R:{let n=e.localName,t=`<${n}${ge(e)}>`;if(ce.has(n))return t;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(g).join("");return`${t}${r}</${n}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(g).join(""):""}var he=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),me={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function U(e){return e.replace(/&(#?\w+);/g,(n,t)=>me[t]??n)}var d=class extends Error{};function G(e,n=!1){let t=0,r=[],s=[],a=i=>{let u=s[s.length-1];u?u.appendChild(i):r.push(i)};for(;t<e.length;){let i=e.indexOf("<",t);if(i===-1){f(e.slice(t));break}if(i>t&&f(e.slice(t,i)),e.startsWith("<!--",i)){let u=e.indexOf("-->",i);if(u===-1)throw new d(`unterminated comment at ${i}`);a(new v(e.slice(i+4,u))),t=u+3;continue}if(e[i+1]==="/"){let u=e.indexOf(">",i);if(u===-1)throw new d(`unterminated closing tag at ${i}`);let N=e.slice(i+2,u).trim().toLowerCase(),p=s.pop();if(!p||p.localName!==N)throw new d(`</${N}> does not close <${p?.localName??"nothing"}>`);t=u+1;continue}t=w(i)}if(s.length>0)throw new d(`unclosed <${s[s.length-1].localName}>`);let l=r[0];if(r.length!==1||!(l instanceof m))throw new d(`expected exactly one root element, got ${r.length}`);return l;function f(i){i!==""&&a(new h(U(i)))}function w(i){let u=/[\s/>]/.exec(e.slice(i+1));if(!u)throw new d(`unterminated tag at ${i}`);let N=e.slice(i+1,i+1+u.index).toLowerCase(),p=new m(N,n),o=i+1+u.index;for(;o<e.length;){for(;o<e.length&&/\s/.test(e[o]);)o++;if(e[o]===">"){o++;break}if(e[o]==="/"&&e[o+1]===">"){o+=2;break}let ne=o;for(;o<e.length&&!/[\s=/>]/.test(e[o]);)o++;let y=e.slice(ne,o);if(y==="")throw new d(`malformed attribute at ${o}`);if(e[o]==="="){if(e[o+1]!=='"')throw new d(`attribute ${y} must have a double-quoted value`);let A=e.indexOf('"',o+2);if(A===-1)throw new d(`unterminated value for ${y}`);p.setAttribute(y,U(e.slice(o+2,A))),o=A+1}else p.setAttribute(y,"")}return a(p),he.has(N)||s.push(p),o}}var J="__FX_DATA__";function B(e){return e.replace(/[<>&\u2028\u2029]/g,n=>"\\u"+n.charCodeAt(0).toString(16).padStart(4,"0"))}var E,xe={getStore:()=>E,run(e,n){let t=E;E=e;try{return n()}finally{E=t}}},Q=xe;function $(e={}){e.locals||(e.locals=e.request?ve(e.request):{});let n=0,t=0,r=null,s=new Map,a=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${n++}`,nextResourceId:()=>{if(r===null)return`r${t++}`;let l=s.get(r)??0;return s.set(r,l+1),`${r}:r${l}`},nextIslandNamespace:l=>{let f=a.get(l)??0;return a.set(l,f+1),`${l}#${f}`},withResourceScope(l,f){let w=r;r=l;try{return f()}finally{r=w}},pending:new Set,data:new Map}}function D(e,n){return Q.run(e,n)}function C(){return Q.getStore()}var K=new WeakMap;function ve(e){let n=K.get(e);return n||(n={},K.set(e,n)),n}var Y=!1;function ee(){Y||(Y=!0,F({createElement:(e,n)=>new m(e,n),createText:e=>new h(e),createRaw:e=>new b(e),parseTemplate:(e,n)=>G(e,n),createComment:e=>new v(e)}))}function we(e,n={}){let t=T;ee(),S(!0);let r=$(n.event);try{return D(r,()=>(0,j.createRoot)(s=>{try{let a=typeof e=="function"?e():e;return g(a)}finally{s()}}))}finally{S(t)}}var Z=!1;function Ne(){Z||(Z=!0,(0,c.setResourceTracker)(e=>{C()?.pending.add(e)}),(0,c.setResourceIdSource)(()=>C()?.nextResourceId()??""),(0,c.setResourceDataSink)((e,n)=>{e&&C()?.data.set(e,n)}))}var I=null;function ye(e){I=e}function te(e){if(e.data.size===0)return"";let n={};for(let[r,s]of e.data){let a=s;if(I)try{a=I(s,r)}catch{continue}a!==void 0&&(typeof a=="function"||typeof a=="symbol"||(n[r]=a))}if(Object.keys(n).length===0)return"";let t=B(JSON.stringify(n));return t==="{}"?"":`<script type="application/json" id="${J}">${t}<\/script>`}var Se=50;async function Te(e,n={}){let t=T;ee(),S(!0),Ne();let r=$(n.event);try{return await D(r,async()=>{n.preload&&await n.preload(n.event);let s,a=null,l=()=>{};(0,j.createRoot)(u=>{l=u,a=(0,c.getOwner)(),s=typeof e=="function"?e():e});let f=()=>{try{(0,c.runWithOwner)(a,()=>g(s))}catch{}};f();let w=0;for(;r.pending.size>0&&w++<Se;){let u=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(u),await(0,c.flush)(),f()}let i=(0,c.runWithOwner)(a,()=>g(s))+te(r);return l(),i})}finally{S(t)}}
1
+ "use strict";var A=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ie=Object.prototype.hasOwnProperty;var ae=(e,n)=>{for(var t in n)A(e,t,{get:n[t],enumerable:!0})},ue=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of oe(n))!ie.call(e,s)&&s!==t&&A(e,s,{get:()=>n[s],enumerable:!(r=se(n,s))||r.enumerable});return e};var le=e=>ue(A({},"__esModule",{value:!0}),e);var Ee={};ae(Ee,{renderToString:()=>ye,renderToStringAsync:()=>Re,serializeResourceData:()=>ne,setDataRedactor:()=>Te});module.exports=le(Ee);var j=require("@fluixi/reactive/signal"),c=require("@fluixi/reactive/signal");var F=Symbol.for("fluixi.server-node"),ce=Symbol.for("fluixi.dom.server-host"),de=globalThis,k=de[ce]??={server:typeof document>"u",nodes:null};function q(){return k.server}function S(e){k.server=e}function V(e){k.nodes=e}var b=1,_=3,L=8,X;X=F;var v=class{constructor(){this[X]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>=0?n.childNodes[t+1]??null:null}get previousSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>0?n.childNodes[t-1]??null:null}get parentElement(){return this.parentNode}appendChild(n){return n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes.push(n),n}insertBefore(n,t){if(t==null)return this.appendChild(n);n.parentNode&&n.parentNode.removeChild(n);let r=this.childNodes.indexOf(t);return n.parentNode=this,r<0?this.childNodes.push(n):this.childNodes.splice(r,0,n),n}removeChild(n){let t=this.childNodes.indexOf(n);return t>=0&&this.childNodes.splice(t,1),n.parentNode=null,n}replaceChild(n,t){let r=this.childNodes.indexOf(t);return r>=0&&(n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes[r]=n,t.parentNode=null),t}addEventListener(){}removeEventListener(){}},h=class e extends v{constructor(t){super();this.nodeType=_;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}get textContent(){return this.data}set textContent(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},T=class e extends v{constructor(t){super();this.nodeType=b;this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new e(this.rawOuterHTML)}},x=class e extends v{constructor(t){super();this.nodeType=L;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},O=class{constructor(){this.cssText=""}setProperty(n,t){this[n]=t}removeProperty(n){delete this[n]}},M=class{constructor(n){this.el=n}list(){let n=this.el.getAttribute("class");return n?n.split(/\s+/).filter(Boolean):[]}write(n){n.length?this.el.setAttribute("class",n.join(" ")):this.el.removeAttribute("class")}add(...n){let t=this.list();for(let r of n)t.includes(r)||t.push(r);this.write(t)}remove(...n){this.write(this.list().filter(t=>!n.includes(t)))}contains(n){return this.list().includes(n)}toggle(n,t){let r=this.contains(n),s=t===void 0?!r:t;return s?this.add(n):this.remove(n),s}},m=class e extends v{constructor(t,r=!1){super();this.nodeType=b;this.attributes=new Map;this.style=new O;this.classList=new M(this);this.rawHTML=null;this.localName=t.toLowerCase(),this.tagName=r?t:t.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(t,r){this.attributes.set(t,String(r))}removeAttribute(t){this.attributes.delete(t)}getAttribute(t){return this.attributes.has(t)?this.attributes.get(t):null}hasAttribute(t){return this.attributes.has(t)}get id(){return this.getAttribute("id")??""}set id(t){t==null?this.removeAttribute("id"):this.setAttribute("id",t)}get className(){return this.getAttribute("class")??""}set className(t){t==null?this.removeAttribute("class"):this.setAttribute("class",t)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(t){t==null?this.removeAttribute("for"):this.setAttribute("for",t)}set value(t){t==null?this.removeAttribute("value"):this.setAttribute("value",String(t))}set checked(t){t?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(t){t?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(t){}get textContent(){return this.childNodes.map(t=>t.textContent??"").join("")}set textContent(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,t!=null&&t!==""&&this.appendChild(new h(String(t)))}set innerText(t){this.textContent=t}set innerHTML(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=t==null?"":String(t)}cloneNode(t=!1){let r=new e(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,t)for(let s of this.childNodes)r.appendChild(s.cloneNode(!0));return r}};var fe=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),P=/&/g,W=/</g,U=/>/g,pe=/"/g;function $(e){return e.replace(P,"&amp;").replace(W,"&lt;").replace(U,"&gt;")}function z(e){return e.replace(P,"&amp;").replace(pe,"&quot;").replace(W,"&lt;").replace(U,"&gt;")}function ge(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())}function he(e){if(!e)return"";let n=[];e.cssText&&n.push(e.cssText.trim().replace(/;\s*$/,""));for(let t of Object.keys(e)){if(t==="cssText")continue;let r=e[t];r==null||r===""||n.push(`${ge(t)}: ${r}`)}return n.join("; ")}function me(e){let n="",t=he(e.style);for(let[r,s]of e.attributes)r==="style"&&t||(n+=` ${r}="${z(s)}"`);if(t){let r=e.attributes.get("style"),s=r?`${r.replace(/;\s*$/,"")}; ${t}`:t;n+=` style="${z(s)}"`}return n}function g(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return $(e);if(typeof e=="number")return $(String(e));if(typeof e=="function")return g(e());if(Array.isArray(e))return e.map(g).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case _:return $(e.data??"");case L:return`<!--${e.data??""}-->`;case b:{let n=e.localName,t=`<${n}${me(e)}>`;if(fe.has(n))return t;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(g).join("");return`${t}${r}</${n}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(g).join(""):""}var ve=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),xe={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function G(e){return e.replace(/&(#?\w+);/g,(n,t)=>xe[t]??n)}var d=class extends Error{};function J(e,n=!1){let t=0,r=[],s=[],a=o=>{let u=s[s.length-1];u?u.appendChild(o):r.push(o)};for(;t<e.length;){let o=e.indexOf("<",t);if(o===-1){f(e.slice(t));break}if(o>t&&f(e.slice(t,o)),e.startsWith("<!--",o)){let u=e.indexOf("-->",o);if(u===-1)throw new d(`unterminated comment at ${o}`);a(new x(e.slice(o+4,u))),t=u+3;continue}if(e[o+1]==="/"){let u=e.indexOf(">",o);if(u===-1)throw new d(`unterminated closing tag at ${o}`);let N=e.slice(o+2,u).trim().toLowerCase(),p=s.pop();if(!p||p.localName!==N)throw new d(`</${N}> does not close <${p?.localName??"nothing"}>`);t=u+1;continue}t=w(o)}if(s.length>0)throw new d(`unclosed <${s[s.length-1].localName}>`);let l=r[0];if(r.length!==1||!(l instanceof m))throw new d(`expected exactly one root element, got ${r.length}`);return l;function f(o){o!==""&&a(new h(G(o)))}function w(o){let u=/[\s/>]/.exec(e.slice(o+1));if(!u)throw new d(`unterminated tag at ${o}`);let N=e.slice(o+1,o+1+u.index).toLowerCase(),p=new m(N,n),i=o+1+u.index;for(;i<e.length;){for(;i<e.length&&/\s/.test(e[i]);)i++;if(e[i]===">"){i++;break}if(e[i]==="/"&&e[i+1]===">"){i+=2;break}let re=i;for(;i<e.length&&!/[\s=/>]/.test(e[i]);)i++;let y=e.slice(re,i);if(y==="")throw new d(`malformed attribute at ${i}`);if(e[i]==="="){if(e[i+1]!=='"')throw new d(`attribute ${y} must have a double-quoted value`);let C=e.indexOf('"',i+2);if(C===-1)throw new d(`unterminated value for ${y}`);p.setAttribute(y,G(e.slice(i+2,C))),i=C+1}else p.setAttribute(y,"")}return a(p),ve.has(N)||s.push(p),i}}var B="__FX_DATA__";function K(e){return e.replace(/[<>&\u2028\u2029]/g,n=>"\\u"+n.charCodeAt(0).toString(16).padStart(4,"0"))}var R,we={getStore:()=>R,run(e,n){let t=R;R=e;try{return n()}finally{R=t}}},Y=we;function D(e={}){e.locals||(e.locals=e.request?Ne(e.request):{});let n=0,t=0,r=null,s=new Map,a=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${n++}`,nextResourceId:()=>{if(r===null)return`r${t++}`;let l=s.get(r)??0;return s.set(r,l+1),`${r}:r${l}`},nextIslandNamespace:l=>{let f=a.get(l)??0;return a.set(l,f+1),`${l}#${f}`},withResourceScope(l,f){let w=r;r=l;try{return f()}finally{r=w}},pending:new Set,data:new Map}}function H(e,n){return Y.run(e,n)}function E(){return Y.getStore()}var Q=new WeakMap;function Ne(e){let n=Q.get(e);return n||(n={},Q.set(e,n)),n}var Z=!1;function te(){Z||(Z=!0,V({createElement:(e,n)=>new m(e,n),createText:e=>new h(e),createRaw:e=>new T(e),parseTemplate:(e,n)=>J(e,n),createComment:e=>new x(e)}))}function ye(e,n={}){let t=q();te(),S(!0);let r=D(n.event);try{return H(r,()=>(0,j.createRoot)(s=>{try{let a=typeof e=="function"?e():e;return g(a)}finally{s()}}))}finally{S(t)}}var ee=!1;function Se(){ee||(ee=!0,(0,c.setResourceTracker)(e=>{E()?.pending.add(e)}),(0,c.setResourceIdSource)(()=>E()?.nextResourceId()??""),(0,c.setResourceDataSink)((e,n)=>{e&&E()?.data.set(e,n)}))}var I=null;function Te(e){I=e}function ne(e){if(e.data.size===0)return"";let n={};for(let[r,s]of e.data){let a=s;if(I)try{a=I(s,r)}catch{continue}a!==void 0&&(typeof a=="function"||typeof a=="symbol"||(n[r]=a))}if(Object.keys(n).length===0)return"";let t=K(JSON.stringify(n));return t==="{}"?"":`<script type="application/json" id="${B}">${t}<\/script>`}var be=50;async function Re(e,n={}){let t=q();te(),S(!0),Se();let r=D(n.event);try{return await H(r,async()=>{n.preload&&await n.preload(n.event);let s,a=null,l=()=>{};(0,j.createRoot)(u=>{l=u,a=(0,c.getOwner)(),s=typeof e=="function"?e():e});let f=()=>{try{(0,c.runWithOwner)(a,()=>g(s))}catch{}};f();let w=0;for(;r.pending.size>0&&w++<be;){let u=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(u),await(0,c.flush)(),f()}let o=(0,c.runWithOwner)(a,()=>g(s))+ne(r);return l(),o})}finally{S(t)}}
@@ -29,7 +29,7 @@ function ensureServerNodes() {
29
29
  import { escapeFxJson, FX_DATA_ID } from './fx-data.js';
30
30
  import { createRequestContext, runWithRequestContext, getRequestContext, } from './request-context.js';
31
31
  export function renderToString(app, options = {}) {
32
- const prev = isServer;
32
+ const prev = isServer();
33
33
  ensureServerNodes();
34
34
  setServerMode(true);
35
35
  const ctx = createRequestContext(options.event);
@@ -125,7 +125,7 @@ const MAX_ASYNC_ROUNDS = 50;
125
125
  * stable; then serialize. Resolves Suspense boundaries to their content.
126
126
  */
127
127
  export async function renderToStringAsync(app, options = {}) {
128
- const prev = isServer;
128
+ const prev = isServer();
129
129
  ensureServerNodes();
130
130
  setServerMode(true);
131
131
  ensureResourceHooks();
@@ -1 +1 @@
1
- import{createRoot as Y}from"@fluixi/reactive/signal";import{setResourceTracker as de,setResourceIdSource as fe,setResourceDataSink as pe,getOwner as ge,runWithOwner as B,flush as he}from"@fluixi/reactive/signal";var S=typeof document>"u";function y(e){S=e}var D=Symbol.for("fluixi.server-node"),te=null;function I(e){te=e}var b=1,q=3,O=8,j;j=D;var m=class{constructor(){this[j]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>=0?n.childNodes[t+1]??null:null}get previousSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>0?n.childNodes[t-1]??null:null}get parentElement(){return this.parentNode}appendChild(n){return n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes.push(n),n}insertBefore(n,t){if(t==null)return this.appendChild(n);n.parentNode&&n.parentNode.removeChild(n);let r=this.childNodes.indexOf(t);return n.parentNode=this,r<0?this.childNodes.push(n):this.childNodes.splice(r,0,n),n}removeChild(n){let t=this.childNodes.indexOf(n);return t>=0&&this.childNodes.splice(t,1),n.parentNode=null,n}replaceChild(n,t){let r=this.childNodes.indexOf(t);return r>=0&&(n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes[r]=n,t.parentNode=null),t}addEventListener(){}removeEventListener(){}},g=class e extends m{constructor(t){super();this.nodeType=q;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}get textContent(){return this.data}set textContent(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},T=class e extends m{constructor(t){super();this.nodeType=b;this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new e(this.rawOuterHTML)}},x=class e extends m{constructor(t){super();this.nodeType=O;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},A=class{constructor(){this.cssText=""}setProperty(n,t){this[n]=t}removeProperty(n){delete this[n]}},k=class{constructor(n){this.el=n}list(){let n=this.el.getAttribute("class");return n?n.split(/\s+/).filter(Boolean):[]}write(n){n.length?this.el.setAttribute("class",n.join(" ")):this.el.removeAttribute("class")}add(...n){let t=this.list();for(let r of n)t.includes(r)||t.push(r);this.write(t)}remove(...n){this.write(this.list().filter(t=>!n.includes(t)))}contains(n){return this.list().includes(n)}toggle(n,t){let r=this.contains(n),s=t===void 0?!r:t;return s?this.add(n):this.remove(n),s}},h=class e extends m{constructor(t,r=!1){super();this.nodeType=b;this.attributes=new Map;this.style=new A;this.classList=new k(this);this.rawHTML=null;this.localName=t.toLowerCase(),this.tagName=r?t:t.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(t,r){this.attributes.set(t,String(r))}removeAttribute(t){this.attributes.delete(t)}getAttribute(t){return this.attributes.has(t)?this.attributes.get(t):null}hasAttribute(t){return this.attributes.has(t)}get id(){return this.getAttribute("id")??""}set id(t){t==null?this.removeAttribute("id"):this.setAttribute("id",t)}get className(){return this.getAttribute("class")??""}set className(t){t==null?this.removeAttribute("class"):this.setAttribute("class",t)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(t){t==null?this.removeAttribute("for"):this.setAttribute("for",t)}set value(t){t==null?this.removeAttribute("value"):this.setAttribute("value",String(t))}set checked(t){t?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(t){t?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(t){}get textContent(){return this.childNodes.map(t=>t.textContent??"").join("")}set textContent(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,t!=null&&t!==""&&this.appendChild(new g(String(t)))}set innerText(t){this.textContent=t}set innerHTML(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=t==null?"":String(t)}cloneNode(t=!1){let r=new e(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,t)for(let s of this.childNodes)r.appendChild(s.cloneNode(!0));return r}};var ne=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),F=/&/g,V=/</g,X=/>/g,re=/"/g;function M(e){return e.replace(F,"&amp;").replace(V,"&lt;").replace(X,"&gt;")}function H(e){return e.replace(F,"&amp;").replace(re,"&quot;").replace(V,"&lt;").replace(X,"&gt;")}function se(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())}function ie(e){if(!e)return"";let n=[];e.cssText&&n.push(e.cssText.trim().replace(/;\s*$/,""));for(let t of Object.keys(e)){if(t==="cssText")continue;let r=e[t];r==null||r===""||n.push(`${se(t)}: ${r}`)}return n.join("; ")}function oe(e){let n="",t=ie(e.style);for(let[r,s]of e.attributes)r==="style"&&t||(n+=` ${r}="${H(s)}"`);if(t){let r=e.attributes.get("style"),s=r?`${r.replace(/;\s*$/,"")}; ${t}`:t;n+=` style="${H(s)}"`}return n}function p(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return M(e);if(typeof e=="number")return M(String(e));if(typeof e=="function")return p(e());if(Array.isArray(e))return e.map(p).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case q:return M(e.data??"");case O:return`<!--${e.data??""}-->`;case b:{let n=e.localName,t=`<${n}${oe(e)}>`;if(ne.has(n))return t;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(p).join("");return`${t}${r}</${n}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(p).join(""):""}var ae=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ue={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function z(e){return e.replace(/&(#?\w+);/g,(n,t)=>ue[t]??n)}var c=class extends Error{};function P(e,n=!1){let t=0,r=[],s=[],a=i=>{let u=s[s.length-1];u?u.appendChild(i):r.push(i)};for(;t<e.length;){let i=e.indexOf("<",t);if(i===-1){d(e.slice(t));break}if(i>t&&d(e.slice(t,i)),e.startsWith("<!--",i)){let u=e.indexOf("-->",i);if(u===-1)throw new c(`unterminated comment at ${i}`);a(new x(e.slice(i+4,u))),t=u+3;continue}if(e[i+1]==="/"){let u=e.indexOf(">",i);if(u===-1)throw new c(`unterminated closing tag at ${i}`);let w=e.slice(i+2,u).trim().toLowerCase(),f=s.pop();if(!f||f.localName!==w)throw new c(`</${w}> does not close <${f?.localName??"nothing"}>`);t=u+1;continue}t=v(i)}if(s.length>0)throw new c(`unclosed <${s[s.length-1].localName}>`);let l=r[0];if(r.length!==1||!(l instanceof h))throw new c(`expected exactly one root element, got ${r.length}`);return l;function d(i){i!==""&&a(new g(z(i)))}function v(i){let u=/[\s/>]/.exec(e.slice(i+1));if(!u)throw new c(`unterminated tag at ${i}`);let w=e.slice(i+1,i+1+u.index).toLowerCase(),f=new h(w,n),o=i+1+u.index;for(;o<e.length;){for(;o<e.length&&/\s/.test(e[o]);)o++;if(e[o]===">"){o++;break}if(e[o]==="/"&&e[o+1]===">"){o+=2;break}let ee=o;for(;o<e.length&&!/[\s=/>]/.test(e[o]);)o++;let N=e.slice(ee,o);if(N==="")throw new c(`malformed attribute at ${o}`);if(e[o]==="="){if(e[o+1]!=='"')throw new c(`attribute ${N} must have a double-quoted value`);let C=e.indexOf('"',o+2);if(C===-1)throw new c(`unterminated value for ${N}`);f.setAttribute(N,z(e.slice(o+2,C))),o=C+1}else f.setAttribute(N,"")}return a(f),ae.has(w)||s.push(f),o}}var W="__FX_DATA__";function U(e){return e.replace(/[<>&\u2028\u2029]/g,n=>"\\u"+n.charCodeAt(0).toString(16).padStart(4,"0"))}var R,le={getStore:()=>R,run(e,n){let t=R;R=e;try{return n()}finally{R=t}}},J=le;function _(e={}){e.locals||(e.locals=e.request?ce(e.request):{});let n=0,t=0,r=null,s=new Map,a=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${n++}`,nextResourceId:()=>{if(r===null)return`r${t++}`;let l=s.get(r)??0;return s.set(r,l+1),`${r}:r${l}`},nextIslandNamespace:l=>{let d=a.get(l)??0;return a.set(l,d+1),`${l}#${d}`},withResourceScope(l,d){let v=r;r=l;try{return d()}finally{r=v}},pending:new Set,data:new Map}}function L(e,n){return J.run(e,n)}function E(){return J.getStore()}var G=new WeakMap;function ce(e){let n=G.get(e);return n||(n={},G.set(e,n)),n}var K=!1;function Z(){K||(K=!0,I({createElement:(e,n)=>new h(e,n),createText:e=>new g(e),createRaw:e=>new T(e),parseTemplate:(e,n)=>P(e,n),createComment:e=>new x(e)}))}function Ie(e,n={}){let t=S;Z(),y(!0);let r=_(n.event);try{return L(r,()=>Y(s=>{try{let a=typeof e=="function"?e():e;return p(a)}finally{s()}}))}finally{y(t)}}var Q=!1;function me(){Q||(Q=!0,de(e=>{E()?.pending.add(e)}),fe(()=>E()?.nextResourceId()??""),pe((e,n)=>{e&&E()?.data.set(e,n)}))}var $=null;function je(e){$=e}function xe(e){if(e.data.size===0)return"";let n={};for(let[r,s]of e.data){let a=s;if($)try{a=$(s,r)}catch{continue}a!==void 0&&(typeof a=="function"||typeof a=="symbol"||(n[r]=a))}if(Object.keys(n).length===0)return"";let t=U(JSON.stringify(n));return t==="{}"?"":`<script type="application/json" id="${W}">${t}<\/script>`}var ve=50;async function He(e,n={}){let t=S;Z(),y(!0),me();let r=_(n.event);try{return await L(r,async()=>{n.preload&&await n.preload(n.event);let s,a=null,l=()=>{};Y(u=>{l=u,a=ge(),s=typeof e=="function"?e():e});let d=()=>{try{B(a,()=>p(s))}catch{}};d();let v=0;for(;r.pending.size>0&&v++<ve;){let u=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(u),await he(),d()}let i=B(a,()=>p(s))+xe(r);return l(),i})}finally{y(t)}}export{Ie as renderToString,He as renderToStringAsync,xe as serializeResourceData,je as setDataRedactor};
1
+ import{createRoot as Z}from"@fluixi/reactive/signal";import{setResourceTracker as pe,setResourceIdSource as ge,setResourceDataSink as he,getOwner as me,runWithOwner as K,flush as ve}from"@fluixi/reactive/signal";var H=Symbol.for("fluixi.server-node"),ne=Symbol.for("fluixi.dom.server-host"),re=globalThis,C=re[ne]??={server:typeof document>"u",nodes:null};function A(){return C.server}function y(e){C.server=e}function I(e){C.nodes=e}var T=1,O=3,M=8,j;j=H;var m=class{constructor(){this[j]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>=0?n.childNodes[t+1]??null:null}get previousSibling(){let n=this.parentNode;if(!n)return null;let t=n.childNodes.indexOf(this);return t>0?n.childNodes[t-1]??null:null}get parentElement(){return this.parentNode}appendChild(n){return n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes.push(n),n}insertBefore(n,t){if(t==null)return this.appendChild(n);n.parentNode&&n.parentNode.removeChild(n);let r=this.childNodes.indexOf(t);return n.parentNode=this,r<0?this.childNodes.push(n):this.childNodes.splice(r,0,n),n}removeChild(n){let t=this.childNodes.indexOf(n);return t>=0&&this.childNodes.splice(t,1),n.parentNode=null,n}replaceChild(n,t){let r=this.childNodes.indexOf(t);return r>=0&&(n.parentNode&&n.parentNode.removeChild(n),n.parentNode=this,this.childNodes[r]=n,t.parentNode=null),t}addEventListener(){}removeEventListener(){}},g=class e extends m{constructor(t){super();this.nodeType=O;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}get textContent(){return this.data}set textContent(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},S=class e extends m{constructor(t){super();this.nodeType=T;this.rawOuterHTML=t}get textContent(){return this.rawOuterHTML.replace(/<[^>]*>/g,"")}cloneNode(){return new e(this.rawOuterHTML)}},v=class e extends m{constructor(t){super();this.nodeType=M;this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t==null?"":String(t)}cloneNode(){return new e(this.data)}},k=class{constructor(){this.cssText=""}setProperty(n,t){this[n]=t}removeProperty(n){delete this[n]}},q=class{constructor(n){this.el=n}list(){let n=this.el.getAttribute("class");return n?n.split(/\s+/).filter(Boolean):[]}write(n){n.length?this.el.setAttribute("class",n.join(" ")):this.el.removeAttribute("class")}add(...n){let t=this.list();for(let r of n)t.includes(r)||t.push(r);this.write(t)}remove(...n){this.write(this.list().filter(t=>!n.includes(t)))}contains(n){return this.list().includes(n)}toggle(n,t){let r=this.contains(n),s=t===void 0?!r:t;return s?this.add(n):this.remove(n),s}},h=class e extends m{constructor(t,r=!1){super();this.nodeType=T;this.attributes=new Map;this.style=new k;this.classList=new q(this);this.rawHTML=null;this.localName=t.toLowerCase(),this.tagName=r?t:t.toUpperCase(),this.isSVG=r,this.namespaceURI=r?"http://www.w3.org/2000/svg":null}setAttribute(t,r){this.attributes.set(t,String(r))}removeAttribute(t){this.attributes.delete(t)}getAttribute(t){return this.attributes.has(t)?this.attributes.get(t):null}hasAttribute(t){return this.attributes.has(t)}get id(){return this.getAttribute("id")??""}set id(t){t==null?this.removeAttribute("id"):this.setAttribute("id",t)}get className(){return this.getAttribute("class")??""}set className(t){t==null?this.removeAttribute("class"):this.setAttribute("class",t)}get htmlFor(){return this.getAttribute("for")??""}set htmlFor(t){t==null?this.removeAttribute("for"):this.setAttribute("for",t)}set value(t){t==null?this.removeAttribute("value"):this.setAttribute("value",String(t))}set checked(t){t?this.setAttribute("checked",""):this.removeAttribute("checked")}set selected(t){t?this.setAttribute("selected",""):this.removeAttribute("selected")}set indeterminate(t){}get textContent(){return this.childNodes.map(t=>t.textContent??"").join("")}set textContent(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=null,t!=null&&t!==""&&this.appendChild(new g(String(t)))}set innerText(t){this.textContent=t}set innerHTML(t){for(let r of this.childNodes)r.parentNode=null;this.childNodes=[],this.rawHTML=t==null?"":String(t)}cloneNode(t=!1){let r=new e(this.localName,this.isSVG);if(r.attributes=new Map(this.attributes),r.style.cssText=this.style.cssText,r.rawHTML=this.rawHTML,t)for(let s of this.childNodes)r.appendChild(s.cloneNode(!0));return r}};var se=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),V=/&/g,X=/</g,z=/>/g,oe=/"/g;function _(e){return e.replace(V,"&amp;").replace(X,"&lt;").replace(z,"&gt;")}function F(e){return e.replace(V,"&amp;").replace(oe,"&quot;").replace(X,"&lt;").replace(z,"&gt;")}function ie(e){return e.startsWith("--")?e:e.replace(/[A-Z]/g,n=>"-"+n.toLowerCase())}function ae(e){if(!e)return"";let n=[];e.cssText&&n.push(e.cssText.trim().replace(/;\s*$/,""));for(let t of Object.keys(e)){if(t==="cssText")continue;let r=e[t];r==null||r===""||n.push(`${ie(t)}: ${r}`)}return n.join("; ")}function ue(e){let n="",t=ae(e.style);for(let[r,s]of e.attributes)r==="style"&&t||(n+=` ${r}="${F(s)}"`);if(t){let r=e.attributes.get("style"),s=r?`${r.replace(/;\s*$/,"")}; ${t}`:t;n+=` style="${F(s)}"`}return n}function p(e){if(e==null||e===!1||e===!0)return"";if(typeof e=="string")return _(e);if(typeof e=="number")return _(String(e));if(typeof e=="function")return p(e());if(Array.isArray(e))return e.map(p).join("");if(typeof e.rawOuterHTML=="string")return e.rawOuterHTML;switch(e.nodeType){case O:return _(e.data??"");case M:return`<!--${e.data??""}-->`;case T:{let n=e.localName,t=`<${n}${ue(e)}>`;if(se.has(n))return t;let r=e.rawHTML!=null?e.rawHTML:(e.childNodes??[]).map(p).join("");return`${t}${r}</${n}>`}}return Array.isArray(e.childNodes)?e.childNodes.map(p).join(""):""}var le=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ce={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'"};function P(e){return e.replace(/&(#?\w+);/g,(n,t)=>ce[t]??n)}var c=class extends Error{};function W(e,n=!1){let t=0,r=[],s=[],a=o=>{let u=s[s.length-1];u?u.appendChild(o):r.push(o)};for(;t<e.length;){let o=e.indexOf("<",t);if(o===-1){d(e.slice(t));break}if(o>t&&d(e.slice(t,o)),e.startsWith("<!--",o)){let u=e.indexOf("-->",o);if(u===-1)throw new c(`unterminated comment at ${o}`);a(new v(e.slice(o+4,u))),t=u+3;continue}if(e[o+1]==="/"){let u=e.indexOf(">",o);if(u===-1)throw new c(`unterminated closing tag at ${o}`);let w=e.slice(o+2,u).trim().toLowerCase(),f=s.pop();if(!f||f.localName!==w)throw new c(`</${w}> does not close <${f?.localName??"nothing"}>`);t=u+1;continue}t=x(o)}if(s.length>0)throw new c(`unclosed <${s[s.length-1].localName}>`);let l=r[0];if(r.length!==1||!(l instanceof h))throw new c(`expected exactly one root element, got ${r.length}`);return l;function d(o){o!==""&&a(new g(P(o)))}function x(o){let u=/[\s/>]/.exec(e.slice(o+1));if(!u)throw new c(`unterminated tag at ${o}`);let w=e.slice(o+1,o+1+u.index).toLowerCase(),f=new h(w,n),i=o+1+u.index;for(;i<e.length;){for(;i<e.length&&/\s/.test(e[i]);)i++;if(e[i]===">"){i++;break}if(e[i]==="/"&&e[i+1]===">"){i+=2;break}let te=i;for(;i<e.length&&!/[\s=/>]/.test(e[i]);)i++;let N=e.slice(te,i);if(N==="")throw new c(`malformed attribute at ${i}`);if(e[i]==="="){if(e[i+1]!=='"')throw new c(`attribute ${N} must have a double-quoted value`);let E=e.indexOf('"',i+2);if(E===-1)throw new c(`unterminated value for ${N}`);f.setAttribute(N,P(e.slice(i+2,E))),i=E+1}else f.setAttribute(N,"")}return a(f),le.has(w)||s.push(f),i}}var U="__FX_DATA__";function G(e){return e.replace(/[<>&\u2028\u2029]/g,n=>"\\u"+n.charCodeAt(0).toString(16).padStart(4,"0"))}var b,de={getStore:()=>b,run(e,n){let t=b;b=e;try{return n()}finally{b=t}}},B=de;function L(e={}){e.locals||(e.locals=e.request?fe(e.request):{});let n=0,t=0,r=null,s=new Map,a=new Map;return{event:e,routeData:new Map,matchedRoute:new Map,nextId:()=>`s${n++}`,nextResourceId:()=>{if(r===null)return`r${t++}`;let l=s.get(r)??0;return s.set(r,l+1),`${r}:r${l}`},nextIslandNamespace:l=>{let d=a.get(l)??0;return a.set(l,d+1),`${l}#${d}`},withResourceScope(l,d){let x=r;r=l;try{return d()}finally{r=x}},pending:new Set,data:new Map}}function $(e,n){return B.run(e,n)}function R(){return B.getStore()}var J=new WeakMap;function fe(e){let n=J.get(e);return n||(n={},J.set(e,n)),n}var Q=!1;function ee(){Q||(Q=!0,I({createElement:(e,n)=>new h(e,n),createText:e=>new g(e),createRaw:e=>new S(e),parseTemplate:(e,n)=>W(e,n),createComment:e=>new v(e)}))}function je(e,n={}){let t=A();ee(),y(!0);let r=L(n.event);try{return $(r,()=>Z(s=>{try{let a=typeof e=="function"?e():e;return p(a)}finally{s()}}))}finally{y(t)}}var Y=!1;function xe(){Y||(Y=!0,pe(e=>{R()?.pending.add(e)}),ge(()=>R()?.nextResourceId()??""),he((e,n)=>{e&&R()?.data.set(e,n)}))}var D=null;function Fe(e){D=e}function we(e){if(e.data.size===0)return"";let n={};for(let[r,s]of e.data){let a=s;if(D)try{a=D(s,r)}catch{continue}a!==void 0&&(typeof a=="function"||typeof a=="symbol"||(n[r]=a))}if(Object.keys(n).length===0)return"";let t=G(JSON.stringify(n));return t==="{}"?"":`<script type="application/json" id="${U}">${t}<\/script>`}var Ne=50;async function Ve(e,n={}){let t=A();ee(),y(!0),xe();let r=L(n.event);try{return await $(r,async()=>{n.preload&&await n.preload(n.event);let s,a=null,l=()=>{};Z(u=>{l=u,a=me(),s=typeof e=="function"?e():e});let d=()=>{try{K(a,()=>p(s))}catch{}};d();let x=0;for(;r.pending.size>0&&x++<Ne;){let u=Array.from(r.pending);r.pending.clear(),await Promise.allSettled(u),await ve(),d()}let o=K(a,()=>p(s))+we(r);return l(),o})}finally{y(t)}}export{je as renderToString,Ve as renderToStringAsync,we as serializeResourceData,Fe as setDataRedactor};
@@ -1 +1 @@
1
- "use strict";var o=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var b=(t,e)=>{for(var r in e)o(t,r,{get:e[r],enumerable:!0})},x=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of T(e))!y.call(t,s)&&s!==r&&o(t,s,{get:()=>e[s],enumerable:!(n=v(e,s))||n.enumerable});return t};var S=t=>x(o({},"__esModule",{value:!0}),t);var O={};b(O,{serializeNode:()=>i});module.exports=S(O);var a=Symbol.for("fluixi.server-node");var c=1,h=3,p=8,d;d=a;var u=class{constructor(){this[d]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let e=this.parentNode;if(!e)return null;let r=e.childNodes.indexOf(this);return r>=0?e.childNodes[r+1]??null:null}get previousSibling(){let e=this.parentNode;if(!e)return null;let r=e.childNodes.indexOf(this);return r>0?e.childNodes[r-1]??null:null}get parentElement(){return this.parentNode}appendChild(e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=this,this.childNodes.push(e),e}insertBefore(e,r){if(r==null)return this.appendChild(e);e.parentNode&&e.parentNode.removeChild(e);let n=this.childNodes.indexOf(r);return e.parentNode=this,n<0?this.childNodes.push(e):this.childNodes.splice(n,0,e),e}removeChild(e){let r=this.childNodes.indexOf(e);return r>=0&&this.childNodes.splice(r,1),e.parentNode=null,e}replaceChild(e,r){let n=this.childNodes.indexOf(r);return n>=0&&(e.parentNode&&e.parentNode.removeChild(e),e.parentNode=this,this.childNodes[n]=e,r.parentNode=null),r}addEventListener(){}removeEventListener(){}};var w=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),f=/&/g,N=/</g,m=/>/g,E=/"/g;function l(t){return t.replace(f,"&amp;").replace(N,"&lt;").replace(m,"&gt;")}function g(t){return t.replace(f,"&amp;").replace(E,"&quot;").replace(N,"&lt;").replace(m,"&gt;")}function A(t){return t.startsWith("--")?t:t.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function M(t){if(!t)return"";let e=[];t.cssText&&e.push(t.cssText.trim().replace(/;\s*$/,""));for(let r of Object.keys(t)){if(r==="cssText")continue;let n=t[r];n==null||n===""||e.push(`${A(r)}: ${n}`)}return e.join("; ")}function C(t){let e="",r=M(t.style);for(let[n,s]of t.attributes)n==="style"&&r||(e+=` ${n}="${g(s)}"`);if(r){let n=t.attributes.get("style"),s=n?`${n.replace(/;\s*$/,"")}; ${r}`:r;e+=` style="${g(s)}"`}return e}function i(t){if(t==null||t===!1||t===!0)return"";if(typeof t=="string")return l(t);if(typeof t=="number")return l(String(t));if(typeof t=="function")return i(t());if(Array.isArray(t))return t.map(i).join("");if(typeof t.rawOuterHTML=="string")return t.rawOuterHTML;switch(t.nodeType){case h:return l(t.data??"");case p:return`<!--${t.data??""}-->`;case c:{let e=t.localName,r=`<${e}${C(t)}>`;if(w.has(e))return r;let n=t.rawHTML!=null?t.rawHTML:(t.childNodes??[]).map(i).join("");return`${r}${n}</${e}>`}}return Array.isArray(t.childNodes)?t.childNodes.map(i).join(""):""}
1
+ "use strict";var o=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var y=(t,e)=>{for(var r in e)o(t,r,{get:e[r],enumerable:!0})},S=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of T(e))!b.call(t,n)&&n!==r&&o(t,n,{get:()=>e[n],enumerable:!(s=v(e,n))||s.enumerable});return t};var x=t=>S(o({},"__esModule",{value:!0}),t);var H={};y(H,{serializeNode:()=>i});module.exports=x(H);var a=Symbol.for("fluixi.server-node"),w=Symbol.for("fluixi.dom.server-host"),E=globalThis,D=E[w]??={server:typeof document>"u",nodes:null};var c=1,h=3,p=8,d;d=a;var u=class{constructor(){this[d]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let e=this.parentNode;if(!e)return null;let r=e.childNodes.indexOf(this);return r>=0?e.childNodes[r+1]??null:null}get previousSibling(){let e=this.parentNode;if(!e)return null;let r=e.childNodes.indexOf(this);return r>0?e.childNodes[r-1]??null:null}get parentElement(){return this.parentNode}appendChild(e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=this,this.childNodes.push(e),e}insertBefore(e,r){if(r==null)return this.appendChild(e);e.parentNode&&e.parentNode.removeChild(e);let s=this.childNodes.indexOf(r);return e.parentNode=this,s<0?this.childNodes.push(e):this.childNodes.splice(s,0,e),e}removeChild(e){let r=this.childNodes.indexOf(e);return r>=0&&this.childNodes.splice(r,1),e.parentNode=null,e}replaceChild(e,r){let s=this.childNodes.indexOf(r);return s>=0&&(e.parentNode&&e.parentNode.removeChild(e),e.parentNode=this,this.childNodes[s]=e,r.parentNode=null),r}addEventListener(){}removeEventListener(){}};var A=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),f=/&/g,N=/</g,m=/>/g,M=/"/g;function l(t){return t.replace(f,"&amp;").replace(N,"&lt;").replace(m,"&gt;")}function g(t){return t.replace(f,"&amp;").replace(M,"&quot;").replace(N,"&lt;").replace(m,"&gt;")}function C(t){return t.startsWith("--")?t:t.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function O(t){if(!t)return"";let e=[];t.cssText&&e.push(t.cssText.trim().replace(/;\s*$/,""));for(let r of Object.keys(t)){if(r==="cssText")continue;let s=t[r];s==null||s===""||e.push(`${C(r)}: ${s}`)}return e.join("; ")}function L(t){let e="",r=O(t.style);for(let[s,n]of t.attributes)s==="style"&&r||(e+=` ${s}="${g(n)}"`);if(r){let s=t.attributes.get("style"),n=s?`${s.replace(/;\s*$/,"")}; ${r}`:r;e+=` style="${g(n)}"`}return e}function i(t){if(t==null||t===!1||t===!0)return"";if(typeof t=="string")return l(t);if(typeof t=="number")return l(String(t));if(typeof t=="function")return i(t());if(Array.isArray(t))return t.map(i).join("");if(typeof t.rawOuterHTML=="string")return t.rawOuterHTML;switch(t.nodeType){case h:return l(t.data??"");case p:return`<!--${t.data??""}-->`;case c:{let e=t.localName,r=`<${e}${L(t)}>`;if(A.has(e))return r;let s=t.rawHTML!=null?t.rawHTML:(t.childNodes??[]).map(i).join("");return`${r}${s}</${e}>`}}return Array.isArray(t.childNodes)?t.childNodes.map(i).join(""):""}
@@ -1 +1 @@
1
- var l=Symbol.for("fluixi.server-node");var d=1,c=3,h=8,u;u=l;var a=class{constructor(){this[u]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let e=this.parentNode;if(!e)return null;let r=e.childNodes.indexOf(this);return r>=0?e.childNodes[r+1]??null:null}get previousSibling(){let e=this.parentNode;if(!e)return null;let r=e.childNodes.indexOf(this);return r>0?e.childNodes[r-1]??null:null}get parentElement(){return this.parentNode}appendChild(e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=this,this.childNodes.push(e),e}insertBefore(e,r){if(r==null)return this.appendChild(e);e.parentNode&&e.parentNode.removeChild(e);let n=this.childNodes.indexOf(r);return e.parentNode=this,n<0?this.childNodes.push(e):this.childNodes.splice(n,0,e),e}removeChild(e){let r=this.childNodes.indexOf(e);return r>=0&&this.childNodes.splice(r,1),e.parentNode=null,e}replaceChild(e,r){let n=this.childNodes.indexOf(r);return n>=0&&(e.parentNode&&e.parentNode.removeChild(e),e.parentNode=this,this.childNodes[n]=e,r.parentNode=null),r}addEventListener(){}removeEventListener(){}};var m=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),g=/&/g,f=/</g,N=/>/g,v=/"/g;function o(t){return t.replace(g,"&amp;").replace(f,"&lt;").replace(N,"&gt;")}function p(t){return t.replace(g,"&amp;").replace(v,"&quot;").replace(f,"&lt;").replace(N,"&gt;")}function T(t){return t.startsWith("--")?t:t.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function y(t){if(!t)return"";let e=[];t.cssText&&e.push(t.cssText.trim().replace(/;\s*$/,""));for(let r of Object.keys(t)){if(r==="cssText")continue;let n=t[r];n==null||n===""||e.push(`${T(r)}: ${n}`)}return e.join("; ")}function b(t){let e="",r=y(t.style);for(let[n,i]of t.attributes)n==="style"&&r||(e+=` ${n}="${p(i)}"`);if(r){let n=t.attributes.get("style"),i=n?`${n.replace(/;\s*$/,"")}; ${r}`:r;e+=` style="${p(i)}"`}return e}function s(t){if(t==null||t===!1||t===!0)return"";if(typeof t=="string")return o(t);if(typeof t=="number")return o(String(t));if(typeof t=="function")return s(t());if(Array.isArray(t))return t.map(s).join("");if(typeof t.rawOuterHTML=="string")return t.rawOuterHTML;switch(t.nodeType){case c:return o(t.data??"");case h:return`<!--${t.data??""}-->`;case d:{let e=t.localName,r=`<${e}${b(t)}>`;if(m.has(e))return r;let n=t.rawHTML!=null?t.rawHTML:(t.childNodes??[]).map(s).join("");return`${r}${n}</${e}>`}}return Array.isArray(t.childNodes)?t.childNodes.map(s).join(""):""}export{s as serializeNode};
1
+ var l=Symbol.for("fluixi.server-node"),m=Symbol.for("fluixi.dom.server-host"),v=globalThis,w=v[m]??={server:typeof document>"u",nodes:null};var d=1,c=3,h=8,u;u=l;var a=class{constructor(){this[u]=!0;this.parentNode=null;this.childNodes=[]}get firstChild(){return this.childNodes[0]??null}get lastChild(){return this.childNodes[this.childNodes.length-1]??null}get nextSibling(){let e=this.parentNode;if(!e)return null;let r=e.childNodes.indexOf(this);return r>=0?e.childNodes[r+1]??null:null}get previousSibling(){let e=this.parentNode;if(!e)return null;let r=e.childNodes.indexOf(this);return r>0?e.childNodes[r-1]??null:null}get parentElement(){return this.parentNode}appendChild(e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=this,this.childNodes.push(e),e}insertBefore(e,r){if(r==null)return this.appendChild(e);e.parentNode&&e.parentNode.removeChild(e);let s=this.childNodes.indexOf(r);return e.parentNode=this,s<0?this.childNodes.push(e):this.childNodes.splice(s,0,e),e}removeChild(e){let r=this.childNodes.indexOf(e);return r>=0&&this.childNodes.splice(r,1),e.parentNode=null,e}replaceChild(e,r){let s=this.childNodes.indexOf(r);return s>=0&&(e.parentNode&&e.parentNode.removeChild(e),e.parentNode=this,this.childNodes[s]=e,r.parentNode=null),r}addEventListener(){}removeEventListener(){}};var T=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),g=/&/g,f=/</g,N=/>/g,b=/"/g;function o(t){return t.replace(g,"&amp;").replace(f,"&lt;").replace(N,"&gt;")}function p(t){return t.replace(g,"&amp;").replace(b,"&quot;").replace(f,"&lt;").replace(N,"&gt;")}function y(t){return t.startsWith("--")?t:t.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function S(t){if(!t)return"";let e=[];t.cssText&&e.push(t.cssText.trim().replace(/;\s*$/,""));for(let r of Object.keys(t)){if(r==="cssText")continue;let s=t[r];s==null||s===""||e.push(`${y(r)}: ${s}`)}return e.join("; ")}function x(t){let e="",r=S(t.style);for(let[s,i]of t.attributes)s==="style"&&r||(e+=` ${s}="${p(i)}"`);if(r){let s=t.attributes.get("style"),i=s?`${s.replace(/;\s*$/,"")}; ${r}`:r;e+=` style="${p(i)}"`}return e}function n(t){if(t==null||t===!1||t===!0)return"";if(typeof t=="string")return o(t);if(typeof t=="number")return o(String(t));if(typeof t=="function")return n(t());if(Array.isArray(t))return t.map(n).join("");if(typeof t.rawOuterHTML=="string")return t.rawOuterHTML;switch(t.nodeType){case c:return o(t.data??"");case h:return`<!--${t.data??""}-->`;case d:{let e=t.localName,r=`<${e}${x(t)}>`;if(T.has(e))return r;let s=t.rawHTML!=null?t.rawHTML:(t.childNodes??[]).map(n).join("");return`${r}${s}</${e}>`}}return Array.isArray(t.childNodes)?t.childNodes.map(n).join(""):""}export{n as serializeNode};