@estjs/template 0.0.14-beta.14 → 0.0.14-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/template.cjs.js +2 -2
- package/dist/template.cjs.js.map +1 -1
- package/dist/template.d.cts +4 -18
- package/dist/template.d.ts +4 -18
- package/dist/template.dev.cjs.js +11 -54
- package/dist/template.dev.esm.js +11 -53
- package/dist/template.esm.js +3 -3
- package/dist/template.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/template.dev.cjs.js
CHANGED
|
@@ -4,7 +4,7 @@ var shared = require('@estjs/shared');
|
|
|
4
4
|
var signal = require('@estjs/signal');
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @estjs/template v0.0.14-beta.
|
|
7
|
+
* @estjs/template v0.0.14-beta.16
|
|
8
8
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
9
9
|
* @license MIT
|
|
10
10
|
**/
|
|
@@ -184,10 +184,10 @@ var SSGNode = class extends LifecycleContext {
|
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
186
|
renderChild(child) {
|
|
187
|
-
if (
|
|
188
|
-
return this.renderChild(child(this.props));
|
|
189
|
-
} else if (signal.isSignal(child)) {
|
|
187
|
+
if (signal.isSignal(child)) {
|
|
190
188
|
return `<!--${1 /* TEXT_COMPONENT */}-${componentIndex}-->${child.value}<!$>`;
|
|
189
|
+
} else if (shared.isFunction(child)) {
|
|
190
|
+
return this.renderChild(child(this.props));
|
|
191
191
|
} else if (isSSGNode(child)) {
|
|
192
192
|
const childResult = child.mount();
|
|
193
193
|
return shared.isFunction(childResult) ? childResult(this.props) : extractSignal(childResult);
|
|
@@ -319,45 +319,6 @@ function addEventListener(node, eventName, handler) {
|
|
|
319
319
|
node.addEventListener(eventName, handler);
|
|
320
320
|
return () => node.removeEventListener(eventName, handler);
|
|
321
321
|
}
|
|
322
|
-
function closeHtmlTags(input) {
|
|
323
|
-
if (!input) {
|
|
324
|
-
return input;
|
|
325
|
-
}
|
|
326
|
-
const tagStack = [];
|
|
327
|
-
const output = [];
|
|
328
|
-
const tagPattern = /<\/?([\da-z-]+)([^>]*)>/gi;
|
|
329
|
-
let lastIndex = 0;
|
|
330
|
-
while (true) {
|
|
331
|
-
const match = tagPattern.exec(input);
|
|
332
|
-
if (!match) break;
|
|
333
|
-
const [fullMatch, tagName] = match;
|
|
334
|
-
const isEndTag = fullMatch[1] === "/";
|
|
335
|
-
output.push(input.slice(lastIndex, match.index));
|
|
336
|
-
lastIndex = match.index + fullMatch.length;
|
|
337
|
-
if (isEndTag) {
|
|
338
|
-
while (tagStack.length > 0 && tagStack[tagStack.length - 1] !== tagName) {
|
|
339
|
-
const unclosedTag = tagStack.pop();
|
|
340
|
-
if (unclosedTag) {
|
|
341
|
-
output.push(`</${unclosedTag}>`);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
if (tagStack.length > 0) {
|
|
345
|
-
tagStack.pop();
|
|
346
|
-
}
|
|
347
|
-
} else if (!SELF_CLOSING_TAGS.includes(tagName)) {
|
|
348
|
-
tagStack.push(tagName);
|
|
349
|
-
}
|
|
350
|
-
output.push(fullMatch);
|
|
351
|
-
}
|
|
352
|
-
output.push(input.slice(lastIndex));
|
|
353
|
-
while (tagStack.length > 0) {
|
|
354
|
-
const unclosedTag = tagStack.pop();
|
|
355
|
-
if (unclosedTag) {
|
|
356
|
-
output.push(`</${unclosedTag}>`);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
return output.join("");
|
|
360
|
-
}
|
|
361
322
|
function convertToHtmlTag(tagName) {
|
|
362
323
|
return SELF_CLOSING_TAGS.includes(tagName) ? `<${tagName}/>` : `<${tagName}></${tagName}>`;
|
|
363
324
|
}
|
|
@@ -899,7 +860,7 @@ function isJsxElement(node) {
|
|
|
899
860
|
}
|
|
900
861
|
function createTemplate(html) {
|
|
901
862
|
const template = document.createElement("template");
|
|
902
|
-
template.innerHTML =
|
|
863
|
+
template.innerHTML = html;
|
|
903
864
|
return template;
|
|
904
865
|
}
|
|
905
866
|
function Fragment(template, props) {
|
|
@@ -931,18 +892,15 @@ function assertInsideComponent(hookName, key) {
|
|
|
931
892
|
);
|
|
932
893
|
}
|
|
933
894
|
}
|
|
934
|
-
function
|
|
935
|
-
assertInsideComponent("
|
|
895
|
+
function provide(key, value) {
|
|
896
|
+
assertInsideComponent("provide", key);
|
|
936
897
|
LifecycleContext.ref && LifecycleContext.ref.setContext(key, value);
|
|
937
898
|
}
|
|
938
|
-
function
|
|
899
|
+
function inject(key, defaultValue) {
|
|
939
900
|
var _a;
|
|
940
|
-
assertInsideComponent("
|
|
901
|
+
assertInsideComponent("inject", key);
|
|
941
902
|
return (_a = LifecycleContext.ref && LifecycleContext.ref.getContext(key)) != null ? _a : defaultValue;
|
|
942
903
|
}
|
|
943
|
-
function useRef() {
|
|
944
|
-
return signal.shallowSignal(null);
|
|
945
|
-
}
|
|
946
904
|
|
|
947
905
|
// src/server.ts
|
|
948
906
|
function renderToString(component, props) {
|
|
@@ -971,13 +929,12 @@ function ssg(component, props) {
|
|
|
971
929
|
exports.Fragment = Fragment;
|
|
972
930
|
exports.h = h;
|
|
973
931
|
exports.hydrate = hydrate;
|
|
932
|
+
exports.inject = inject;
|
|
974
933
|
exports.isComponent = isComponent;
|
|
975
934
|
exports.isJsxElement = isJsxElement;
|
|
976
935
|
exports.onDestroy = onDestroy;
|
|
977
936
|
exports.onMount = onMount;
|
|
937
|
+
exports.provide = provide;
|
|
978
938
|
exports.renderToString = renderToString;
|
|
979
939
|
exports.ssg = ssg;
|
|
980
940
|
exports.template = createTemplate;
|
|
981
|
-
exports.useInject = useInject;
|
|
982
|
-
exports.useProvide = useProvide;
|
|
983
|
-
exports.useRef = useRef;
|
package/dist/template.dev.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isString, isFunction, isArray, isSymbol, escape, startsWith, capitalize, isNil, isPlainObject, isHTMLElement, coerceArray, isFalsy, kebabCase } from '@estjs/shared';
|
|
2
|
-
import {
|
|
2
|
+
import { isSignal, signalObject, reactive, signal, effect, shallowSignal } from '@estjs/signal';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @estjs/template v0.0.14-beta.
|
|
5
|
+
* @estjs/template v0.0.14-beta.16
|
|
6
6
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
7
7
|
* @license MIT
|
|
8
8
|
**/
|
|
@@ -182,10 +182,10 @@ var SSGNode = class extends LifecycleContext {
|
|
|
182
182
|
});
|
|
183
183
|
}
|
|
184
184
|
renderChild(child) {
|
|
185
|
-
if (
|
|
186
|
-
return this.renderChild(child(this.props));
|
|
187
|
-
} else if (isSignal(child)) {
|
|
185
|
+
if (isSignal(child)) {
|
|
188
186
|
return `<!--${1 /* TEXT_COMPONENT */}-${componentIndex}-->${child.value}<!$>`;
|
|
187
|
+
} else if (isFunction(child)) {
|
|
188
|
+
return this.renderChild(child(this.props));
|
|
189
189
|
} else if (isSSGNode(child)) {
|
|
190
190
|
const childResult = child.mount();
|
|
191
191
|
return isFunction(childResult) ? childResult(this.props) : extractSignal(childResult);
|
|
@@ -317,45 +317,6 @@ function addEventListener(node, eventName, handler) {
|
|
|
317
317
|
node.addEventListener(eventName, handler);
|
|
318
318
|
return () => node.removeEventListener(eventName, handler);
|
|
319
319
|
}
|
|
320
|
-
function closeHtmlTags(input) {
|
|
321
|
-
if (!input) {
|
|
322
|
-
return input;
|
|
323
|
-
}
|
|
324
|
-
const tagStack = [];
|
|
325
|
-
const output = [];
|
|
326
|
-
const tagPattern = /<\/?([\da-z-]+)([^>]*)>/gi;
|
|
327
|
-
let lastIndex = 0;
|
|
328
|
-
while (true) {
|
|
329
|
-
const match = tagPattern.exec(input);
|
|
330
|
-
if (!match) break;
|
|
331
|
-
const [fullMatch, tagName] = match;
|
|
332
|
-
const isEndTag = fullMatch[1] === "/";
|
|
333
|
-
output.push(input.slice(lastIndex, match.index));
|
|
334
|
-
lastIndex = match.index + fullMatch.length;
|
|
335
|
-
if (isEndTag) {
|
|
336
|
-
while (tagStack.length > 0 && tagStack[tagStack.length - 1] !== tagName) {
|
|
337
|
-
const unclosedTag = tagStack.pop();
|
|
338
|
-
if (unclosedTag) {
|
|
339
|
-
output.push(`</${unclosedTag}>`);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
if (tagStack.length > 0) {
|
|
343
|
-
tagStack.pop();
|
|
344
|
-
}
|
|
345
|
-
} else if (!SELF_CLOSING_TAGS.includes(tagName)) {
|
|
346
|
-
tagStack.push(tagName);
|
|
347
|
-
}
|
|
348
|
-
output.push(fullMatch);
|
|
349
|
-
}
|
|
350
|
-
output.push(input.slice(lastIndex));
|
|
351
|
-
while (tagStack.length > 0) {
|
|
352
|
-
const unclosedTag = tagStack.pop();
|
|
353
|
-
if (unclosedTag) {
|
|
354
|
-
output.push(`</${unclosedTag}>`);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
return output.join("");
|
|
358
|
-
}
|
|
359
320
|
function convertToHtmlTag(tagName) {
|
|
360
321
|
return SELF_CLOSING_TAGS.includes(tagName) ? `<${tagName}/>` : `<${tagName}></${tagName}>`;
|
|
361
322
|
}
|
|
@@ -897,7 +858,7 @@ function isJsxElement(node) {
|
|
|
897
858
|
}
|
|
898
859
|
function createTemplate(html) {
|
|
899
860
|
const template = document.createElement("template");
|
|
900
|
-
template.innerHTML =
|
|
861
|
+
template.innerHTML = html;
|
|
901
862
|
return template;
|
|
902
863
|
}
|
|
903
864
|
function Fragment(template, props) {
|
|
@@ -929,18 +890,15 @@ function assertInsideComponent(hookName, key) {
|
|
|
929
890
|
);
|
|
930
891
|
}
|
|
931
892
|
}
|
|
932
|
-
function
|
|
933
|
-
assertInsideComponent("
|
|
893
|
+
function provide(key, value) {
|
|
894
|
+
assertInsideComponent("provide", key);
|
|
934
895
|
LifecycleContext.ref && LifecycleContext.ref.setContext(key, value);
|
|
935
896
|
}
|
|
936
|
-
function
|
|
897
|
+
function inject(key, defaultValue) {
|
|
937
898
|
var _a;
|
|
938
|
-
assertInsideComponent("
|
|
899
|
+
assertInsideComponent("inject", key);
|
|
939
900
|
return (_a = LifecycleContext.ref && LifecycleContext.ref.getContext(key)) != null ? _a : defaultValue;
|
|
940
901
|
}
|
|
941
|
-
function useRef() {
|
|
942
|
-
return shallowSignal(null);
|
|
943
|
-
}
|
|
944
902
|
|
|
945
903
|
// src/server.ts
|
|
946
904
|
function renderToString(component, props) {
|
|
@@ -966,4 +924,4 @@ function ssg(component, props) {
|
|
|
966
924
|
return h(component, props);
|
|
967
925
|
}
|
|
968
926
|
|
|
969
|
-
export { Fragment, h, hydrate, isComponent, isJsxElement, onDestroy, onMount, renderToString, ssg, createTemplate as template
|
|
927
|
+
export { Fragment, h, hydrate, inject, isComponent, isJsxElement, onDestroy, onMount, provide, renderToString, ssg, createTemplate as template };
|
package/dist/template.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {isString,isFunction,isArray,escape,startsWith,capitalize,isNil,isPlainObject,isHTMLElement,coerceArray,isFalsy,kebabCase}from'@estjs/shared';import {
|
|
2
|
-
* @estjs/template v0.0.14-beta.
|
|
1
|
+
import {isString,isFunction,isArray,escape,startsWith,capitalize,isNil,isPlainObject,isHTMLElement,coerceArray,isFalsy,kebabCase}from'@estjs/shared';import {isSignal,signalObject,reactive,signal,effect,shallowSignal}from'@estjs/signal';/**
|
|
2
|
+
* @estjs/template v0.0.14-beta.16
|
|
3
3
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
|
-
var P="on",L="update",E="children",H="",q="0",W="1";var A="ref",O=" __PLACEHOLDER__ ";var F=class{constructor(){this.renderMode=0;}get isSSG(){return this.renderMode===1}get isSSR(){return this.renderMode===2}get isClient(){return this.renderMode===0}setSSR(){this.renderMode=2;}setSSG(){this.renderMode=1;}setClient(){this.renderMode=0;}},m=new F,Q=new Map;function Z(o,e){Q.set(o,{index:e});}function ee(o){var e;return (e=Q.get(o))==null?void 0:e.index}var y=class y{constructor(){this.hooks={mounted:new Set,destroy:new Set};}addEventListener(){}removeEventListener(){}addHook(e,t){var n;(n=this.hooks[e])==null||n.add(t);}getContext(e){return y.context[e]}setContext(e,t){y.context[e]=t;}initRef(){y.ref=this;}removeRef(){y.ref=null;}clearHooks(){Object.values(this.hooks).forEach(e=>e.clear());}};y.ref=null,y.context={};var u=y;function _(o){return o instanceof M}var C=1,M=class extends u{constructor(t,n={},r){super();this.template=t;this.props=n;this.key=r;Z(t,C),this.templates=this.processTemplate();}processTemplate(){if(isArray(this.template)){let t=this.template.join(O);return this.processHtmlString(t).split(O)}return []}processHtmlString(t){return t.replaceAll(/(<[^>]+>)|([^<]+)/g,(n,r,i)=>r?r.includes("data-ci")?n:r.replace(/<\s*([\da-z]+)(\s[^>]*)?>/i,(s,c,a)=>`<${c} data-ci="${C}"${a||""}>`):i&&i.replace(O,"").trim()?`<!--0-${C}-->${i}<!$>`:n)}mount(){this.initRef();let t=this.render();return this.removeRef(),t}render(){if(isFunction(this.template)){let t=this.template(this.props);return _(t)?t.mount():String(t)}return this.renderTemplate()}renderTemplate(){return Object.entries(this.props).forEach(([t,n])=>{let r=n.children;this.normalizeProps(n);let i=this.templates.findIndex(s=>s.includes(`data-hk="${t}"`));r&&this.renderChildren(r,i),this.templates[i]=this.templates[i].replace(`data-hk="${t}"`,`data-hk="${t}" ${this.generateAttributes(n)}`);}),this.templates.join("")}normalizeProps(t){Object.entries(t).forEach(([n,r])=>{n===E||isFunction(r)?delete t[n]:isSignal(r)&&(t[n]=r.value);});}generateAttributes(t){return Object.entries(t).filter(([n,r])=>n!==E&&!isFunction(r)).map(([n,r])=>`${n}="${escape(String(r))}"`).join(" ")}renderChildren(t,n){t.forEach(([r])=>{C++;let i=this.renderChild(r);this.templates[n]+=i;});}renderChild(t){if(isFunction(t))return this.renderChild(t(this.props));if(isSignal(t))return `<!--1-${C}-->${t.value}<!$>`;if(_(t)){let n=t.mount();return isFunction(n)?n(this.props):$(n)}else return `<!--1-${C}-->${t}<!$>`}};var ne="area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr".split(",");function J(o){if(f(o)||o instanceof Node||_(o))return o;let e=isFalsy(o)?"":String(o);return document.createTextNode(e)}function T(o,e,t=null){let n=f(t)?t.firstChild:t,r=m.isSSR;f(e)?e.mount(o,n):n&&!r?n.before(e):r||o.append(e);}function S(o){f(o)?o.unmount():o.parentNode&&o.remove();}function V(o,e,t){T(o,e,t),S(t);}function Y(o,e,t){e==="class"?Se(o,t):e==="style"?ye(o,t):xe(o,e,t);}function Se(o,e){typeof e=="string"?o.className=e:isArray(e)?o.className=e.join(" "):e&&typeof e=="object"&&(o.className=Object.entries(e).reduce((t,[n,r])=>t+(r?` ${n}`:""),"").trim());}function ye(o,e){typeof e=="string"?o.style.cssText=e:e&&typeof e=="object"&&Object.entries(e).forEach(([n,r])=>{o.style.setProperty(kebabCase(n),String(r));});}function xe(o,e,t){isFalsy(t)?o.removeAttribute(e):t===!0?o.setAttribute(e,""):o instanceof HTMLInputElement&&e==="value"?o.value=String(t):o.setAttribute(e,String(t));}function re(o,e){if(o instanceof HTMLInputElement)switch(o.type){case"checkbox":return h(o,"change",()=>{e(!!o.checked);});case"date":return h(o,"change",()=>{e(o.value?o.value:"");});case"file":return h(o,"change",()=>{o.files&&e(o.files);});case"number":return h(o,"input",()=>{let t=Number.parseFloat(o.value);e(Number.isNaN(t)?"":String(t));});case"radio":return h(o,"change",()=>{e(o.checked?o.value:"");});case"text":return h(o,"input",()=>{e(o.value);})}if(o instanceof HTMLSelectElement)return h(o,"change",()=>{e(o.value);});if(o instanceof HTMLTextAreaElement)return h(o,"input",()=>{e(o.value);})}function h(o,e,t){return o.addEventListener(e,t),()=>o.removeEventListener(e,t)}function ie(o){if(!o)return o;let e=[],t=[],n=/<\/?([\da-z-]+)([^>]*)>/gi,r=0;for(;;){let i=n.exec(o);if(!i)break;let[s,c]=i,a=s[1]==="/";if(t.push(o.slice(r,i.index)),r=i.index+s.length,a){for(;e.length>0&&e[e.length-1]!==c;){let l=e.pop();l&&t.push(`</${l}>`);}e.length>0&&e.pop();}else ne.includes(c)||e.push(c);t.push(s);}for(t.push(o.slice(r));e.length>0;){let i=e.pop();i&&t.push(`</${i}>`);}return t.join("")}function se(o){return ne.includes(o)?`<${o}/>`:`<${o}></${o}>`}function $(o){return isSignal(o)?o.value:o}var k=class extends u{constructor(t,n,r){super();this.template=t;this.props=n;this.key=r;this.emitter=new Set;this.rootNode=null;this.trackMap=new Map;this.key||(this.key=n&&n.key),this.proxyProps=this.createProxyProps(n);}createProxyProps(t){return t?signalObject(t,n=>startsWith(n,P)||startsWith(n,L)||n===E):{}}get firstChild(){var t,n;return (n=(t=this.rootNode)==null?void 0:t.firstChild)!=null?n:null}get isConnected(){var t,n;return (n=(t=this.rootNode)==null?void 0:t.isConnected)!=null?n:!1}mount(t,n){var i,s,c,a;if(!isFunction(this.template))throw new Error("Template must be a function");if(this.isConnected)return (s=(i=this.rootNode)==null?void 0:i.mount(t,n))!=null?s:[];this.initRef(),this.rootNode=this.template(reactive(this.proxyProps,[E]));let r=(a=(c=this.rootNode)==null?void 0:c.mount(t,n))!=null?a:[];return this.callMountHooks(),this.patchProps(this.props),this.removeRef(),r}unmount(){var t;this.callDestroyHooks(),this.clearHooks(),(t=this.rootNode)==null||t.unmount(),this.rootNode=null,this.proxyProps={},this.clearEmitter();}callMountHooks(){this.hooks.mounted.forEach(t=>t());}callDestroyHooks(){this.hooks.destroy.forEach(t=>t());}clearEmitter(){for(let t of this.emitter)t();this.emitter.clear();}inheritNode(t){Object.assign(this.proxyProps,t.proxyProps),this.rootNode=t.rootNode,this.trackMap=t.trackMap,this.hooks=t.hooks;let n=this.props;this.props=t.props,this.patchProps(n);}getNodeTrack(t){let n=this.trackMap.get(t);return n||(n={cleanup:()=>{}},this.trackMap.set(t,n)),n.cleanup(),n}patchProps(t){var n;if(t){for(let[r,i]of Object.entries(t))startsWith(r,P)&&((n=this.rootNode)!=null&&n.firstChild)?this.patchEventListener(r,i):r===A?this.patchRef(i):startsWith(r,L)?this.patchUpdateHandler(r,i):r!==E&&this.patchNormalProp(r,i);this.props=t;}}patchEventListener(t,n){let r=t.slice(2).toLowerCase(),i=h(this.rootNode.nodes[0],r,n);this.emitter.add(i);}patchRef(t){var n,r;t.value=(r=(n=this.rootNode)==null?void 0:n.firstChild)!=null?r:null;}patchUpdateHandler(t,n){this.props[t]=$(n);}patchNormalProp(t,n){var s,c;let r=(c=(s=this.proxyProps)[t])!=null?c:s[t]=signal(n),i=this.getNodeTrack(t);i.cleanup=effect(()=>{r.value=isFunction(n)?n():n;});}};function ae(o,e,t,n){let r=new Map,i=Array.from(e.values());if(i.length&&t.length===0)return ke(o,i,n),r;let s=[],c=Le(t),a=0;for(let[l,p]of t.entries()){let d=i[a],b=v(d,l);for(;d&&!c.has(b);)S(d),e.delete(b),d=i[++a],b=v(d,l);let B=v(p,l),G=e.get(B);if(G&&(p=Pe(o,G,p)),d)if(d===G)a++;else {let z=document.createComment("");T(o,z,d),s.push([z,p]);}else T(o,p,n);r.set(B,p);}return s.forEach(([l,p])=>{V(o,p,l);}),e.forEach((l,p)=>{l.isConnected&&!r.has(p)&&S(l);}),r}function ke(o,e,t){if(o.childNodes.length===e.length+(t?1:0))o.innerHTML="",t&&T(o,t);else {let n=document.createRange(),r=e[0],i=f(r)?r.firstChild:r;n.setStartBefore(i),t?n.setEndBefore(t):n.setEndAfter(o),n.deleteContents();}e.forEach(n=>{f(n)&&n.unmount();});}function Pe(o,e,t){return e===t?e:f(e)&&f(t)&&e.template===t.template?(t.inheritNode(e),t):e instanceof Text&&t instanceof Text?(e.textContent!==t.textContent&&(e.textContent=t.textContent),e):(V(o,t,e),t)}function Le(o){let e=new Map;for(let[t,n]of o.entries()){let r=v(n,t);e.set(r,n);}return e}function v(o,e){if(f(o)){let t=o.key;if(t!=null)return String(t)}return `_$${e}$`}var x=class{constructor(e,t,n){this.template=e;this.props=t;this.key=n;this.treeMap=new Map;this.mounted=!1;this.nodes=[];this.trackMap=new Map;this.bindValueKeys=[];this.parent=null;m.isSSR&&(this.componentIndex=ee(this.template));}get firstChild(){var e;return (e=this.nodes[0])!=null?e:null}get isConnected(){return this.mounted}addEventListener(){}removeEventListener(){}mount(e,t){var i;if(this.parent=e,this.isConnected)return this.nodes.forEach(s=>T(e,s,t)),this.nodes;isArray(this.template)&&(this.template=R(this.template.join("")));let n=this.template.content.cloneNode(!0),r=n.firstChild;return (i=r==null?void 0:r.hasAttribute)!=null&&i.call(r,"_svg_")&&(r.remove(),r.childNodes.forEach(s=>{n.append(s);})),this.nodes=Array.from(n.childNodes),m.isSSR?this.mapSSGNodeTree(e):this.mapNodeTree(e,n),T(e,n,t),this.patchProps(this.props),this.mounted=!0,this.nodes}unmount(){this.trackMap.forEach(e=>{e.cleanup&&e.cleanup();}),this.trackMap.clear(),this.treeMap.clear(),this.nodes.forEach(e=>S(e)),this.nodes=[],this.mounted=!1;}inheritNode(e){this.mounted=e.mounted,this.nodes=e.nodes,this.trackMap=e.trackMap,this.treeMap=e.treeMap;let t=this.props;this.props=e.props,this.patchProps(t);}mapSSGNodeTree(e){this.treeMap.set(0,e),this.walkNodeTree(e,this.handleSSGNode.bind(this));}mapNodeTree(e,t){let n=1;this.treeMap.set(0,e);let r=[e],i=s=>{s.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&(this.treeMap.set(n++,s),r.push(s));};this.walkNodeTree(t,i);}walkNodeTree(e,t){e.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&t(e);let n=e.firstChild;for(;n;)this.walkNodeTree(n,t),n=n.nextSibling;}handleSSGNode(e){var t;if(e.nodeType===Node.COMMENT_NODE){let[n,r]=((t=e.textContent)==null?void 0:t.split("-"))||[];if(0===+n&&+r===this.componentIndex){let i=e.nextSibling;this.treeMap.set(+r,i);}}else if(e.nodeType!==Node.TEXT_NODE){let{ci:n="-1",hk:r}=(e==null?void 0:e.dataset)||{};r&&+n===this.componentIndex&&this.treeMap.set(+r,e);}}patchProps(e){e&&(Object.entries(e).forEach(([t,n])=>{let r=Number(t),i=this.treeMap.get(r);i&&this.patchProp(t,i,n,r===0);}),this.props=e);}patchProp(e,t,n,r){n&&Object.entries(n).forEach(([i,s])=>{if(i===E&&s)this.patchChildren(e,t,s,r);else if(i===A)n[i].value=t;else if(startsWith(i,P))this.patchEventListener(e,t,i,s);else {if(this.bindValueKeys.includes(i))return;let c=this.getBindUpdateValue(n,e,i);this.patchAttribute(e,t,i,s,c);}});}getBindUpdateValue(e,t,n){let r=`${L}${capitalize(n)}`;if(r&&e[r]&&isFunction(e[r]))return this.bindValueKeys.push(r),e[r]}patchChildren(e,t,n,r){if(isArray(n))n.filter(Boolean).forEach((i,s)=>{var b;let[c,a]=isArray(i)?i:[i,null],l=isNil(a)?null:(b=this.treeMap.get(a))!=null?b:null,p=`${e}:${E}:${s}`,d=this.getNodeTrack(p,!0,r);this.patchChild(d,t,c,l);});else {let i=`${e}:${E}:0`,s=this.getNodeTrack(i,!0,r);this.patchChild(s,t,n,null);}}patchEventListener(e,t,n,r){let i=n.slice(2).toLowerCase(),s=this.getNodeTrack(`${e}:${n}`);s.cleanup=h(t,i,r);}patchAttribute(e,t,n,r,i){let s=this.getNodeTrack(`${e}:${n}`),c=isFunction(r)?r():r,a=isSignal(c)?c:shallowSignal(c);Y(t,n,a.value);let l=effect(()=>{let d=isFunction(r)?r():r;isPlainObject(d)&&isPlainObject(a.peek())&&JSON.stringify(a.value)===JSON.stringify(d)||(a.value=isSignal(d)?d.value:d,Y(t,n,a.value));}),p;i&&isHTMLElement(t)&&(p=re(t,d=>{i(d);})),s.cleanup=()=>{l&&l(),p&&p();};}getNodeTrack(e,t,n){let r=this.trackMap.get(e);return r||(r={cleanup:()=>{}},t&&(r.lastNodes=new Map),n&&(r.isRoot=!0),this.trackMap.set(e,r)),r.cleanup&&r.cleanup(),r}patchChild(e,t,n,r){isFunction(n)?e.cleanup=effect(()=>{let i=coerceArray(n()).map(J);m.isSSR?e.lastNodes=this.reconcileChildren(t,i,r):e.lastNodes=ae(t,e.lastNodes,i,r);}):coerceArray(n).forEach((i,s)=>{let c=J(i),a=v(c,s);m.isSSR?e.lastNodes=this.reconcileChildren(t,[c],r):(e.lastNodes.set(a,c),T(t,c,r));});}reconcileChildren(e,t,n){let r=new Map,i=Array.from(e.childNodes).filter(s=>{var c,a;return s.nodeType===Node.TEXT_NODE&&((c=s.previousSibling)==null?void 0:c.nodeType)===Node.COMMENT_NODE&&((a=s.nextSibling)==null?void 0:a.nodeType)===Node.COMMENT_NODE});return t.forEach((s,c)=>{let a=v(s,c);s.nodeType===Node.TEXT_NODE?i.forEach(l=>{s.textContent===l.textContent&&e.replaceChild(s,l);}):T(e,s,n),r.set(a,s);}),r}};var K=class extends x{unmount(){this.trackMap.forEach(e=>{e.lastNodes&&e.lastNodes.forEach(t=>{S(t);}),e.cleanup&&e.cleanup();}),this.trackMap.clear(),this.treeMap.clear(),this.nodes.forEach(e=>{S(e);}),this.nodes=[],this.mounted=!1;}};function X(o,e,t){if(o===H)return me(o,e);if(isString(o)){let n=se(o);return e={[W]:e},new x(R(n),e,t)}return isFunction(o)?new k(o,e,t):new x(o,e,t)}function je(o){return o instanceof k}function f(o){return o instanceof k||o instanceof x}function R(o){let e=document.createElement("template");return e.innerHTML=ie(o),e}function me(o,e){return e.children&&(e={[q]:{children:isArray(e.children)?e.children.filter(Boolean):[e.children]}}),o===H&&(o=R(H)),new K(o,e)}function Xe(o){u.ref&&u.ref.addHook("mounted",o);}function De(o){u.ref&&u.ref.addHook("destroy",o);}function Ge(o,e){u.ref&&u.ref.setContext(o,e);}function Fe(o,e){var t;return (t=u.ref&&u.ref.getContext(o))!=null?t:e}function Je(){return shallowSignal(null)}function Ve(o,e){m.setSSG();let n=new M(o,e||{}).mount();return m.setClient(),n}function Ye(o,e){let t=typeof e=="string"?document.querySelector(e):e;if(!t)throw new Error(`Could not find container: ${e}`);m.setSSR(),X(o).mount(t),m.setClient();}function Ue(o,e){return m.isSSG?new M(o,e):X(o,e)}export{me as Fragment,X as h,Ye as hydrate,je as isComponent,f as isJsxElement,De as onDestroy,Xe as onMount,Ve as renderToString,Ue as ssg,R as template,Fe as useInject,Ge as useProvide,Je as useRef};//# sourceMappingURL=template.esm.js.map
|
|
6
|
+
var P="on",L="update",g="children",H="",z="0",W="1";var A="ref",O=" __PLACEHOLDER__ ";var F=class{constructor(){this.renderMode=0;}get isSSG(){return this.renderMode===1}get isSSR(){return this.renderMode===2}get isClient(){return this.renderMode===0}setSSR(){this.renderMode=2;}setSSG(){this.renderMode=1;}setClient(){this.renderMode=0;}},m=new F,Q=new Map;function Z(n,e){Q.set(n,{index:e});}function ee(n){var e;return (e=Q.get(n))==null?void 0:e.index}var y=class y{constructor(){this.hooks={mounted:new Set,destroy:new Set};}addEventListener(){}removeEventListener(){}addHook(e,t){var o;(o=this.hooks[e])==null||o.add(t);}getContext(e){return y.context[e]}setContext(e,t){y.context[e]=t;}initRef(){y.ref=this;}removeRef(){y.ref=null;}clearHooks(){Object.values(this.hooks).forEach(e=>e.clear());}};y.ref=null,y.context={};var u=y;function _(n){return n instanceof M}var C=1,M=class extends u{constructor(t,o={},r){super();this.template=t;this.props=o;this.key=r;Z(t,C),this.templates=this.processTemplate();}processTemplate(){if(isArray(this.template)){let t=this.template.join(O);return this.processHtmlString(t).split(O)}return []}processHtmlString(t){return t.replaceAll(/(<[^>]+>)|([^<]+)/g,(o,r,i)=>r?r.includes("data-ci")?o:r.replace(/<\s*([\da-z]+)(\s[^>]*)?>/i,(s,c,a)=>`<${c} data-ci="${C}"${a||""}>`):i&&i.replace(O,"").trim()?`<!--0-${C}-->${i}<!$>`:o)}mount(){this.initRef();let t=this.render();return this.removeRef(),t}render(){if(isFunction(this.template)){let t=this.template(this.props);return _(t)?t.mount():String(t)}return this.renderTemplate()}renderTemplate(){return Object.entries(this.props).forEach(([t,o])=>{let r=o.children;this.normalizeProps(o);let i=this.templates.findIndex(s=>s.includes(`data-hk="${t}"`));r&&this.renderChildren(r,i),this.templates[i]=this.templates[i].replace(`data-hk="${t}"`,`data-hk="${t}" ${this.generateAttributes(o)}`);}),this.templates.join("")}normalizeProps(t){Object.entries(t).forEach(([o,r])=>{o===g||isFunction(r)?delete t[o]:isSignal(r)&&(t[o]=r.value);});}generateAttributes(t){return Object.entries(t).filter(([o,r])=>o!==g&&!isFunction(r)).map(([o,r])=>`${o}="${escape(String(r))}"`).join(" ")}renderChildren(t,o){t.forEach(([r])=>{C++;let i=this.renderChild(r);this.templates[o]+=i;});}renderChild(t){if(isSignal(t))return `<!--1-${C}-->${t.value}<!$>`;if(isFunction(t))return this.renderChild(t(this.props));if(_(t)){let o=t.mount();return isFunction(o)?o(this.props):$(o)}else return `<!--1-${C}-->${t}<!$>`}};var ge="area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr".split(",");function J(n){if(f(n)||n instanceof Node||_(n))return n;let e=isFalsy(n)?"":String(n);return document.createTextNode(e)}function T(n,e,t=null){let o=f(t)?t.firstChild:t,r=m.isSSR;f(e)?e.mount(n,o):o&&!r?o.before(e):r||n.append(e);}function S(n){f(n)?n.unmount():n.parentNode&&n.remove();}function V(n,e,t){T(n,e,t),S(t);}function Y(n,e,t){e==="class"?Te(n,t):e==="style"?Se(n,t):ye(n,e,t);}function Te(n,e){typeof e=="string"?n.className=e:isArray(e)?n.className=e.join(" "):e&&typeof e=="object"&&(n.className=Object.entries(e).reduce((t,[o,r])=>t+(r?` ${o}`:""),"").trim());}function Se(n,e){typeof e=="string"?n.style.cssText=e:e&&typeof e=="object"&&Object.entries(e).forEach(([o,r])=>{n.style.setProperty(kebabCase(o),String(r));});}function ye(n,e,t){isFalsy(t)?n.removeAttribute(e):t===!0?n.setAttribute(e,""):n instanceof HTMLInputElement&&e==="value"?n.value=String(t):n.setAttribute(e,String(t));}function ne(n,e){if(n instanceof HTMLInputElement)switch(n.type){case"checkbox":return h(n,"change",()=>{e(!!n.checked);});case"date":return h(n,"change",()=>{e(n.value?n.value:"");});case"file":return h(n,"change",()=>{n.files&&e(n.files);});case"number":return h(n,"input",()=>{let t=Number.parseFloat(n.value);e(Number.isNaN(t)?"":String(t));});case"radio":return h(n,"change",()=>{e(n.checked?n.value:"");});case"text":return h(n,"input",()=>{e(n.value);})}if(n instanceof HTMLSelectElement)return h(n,"change",()=>{e(n.value);});if(n instanceof HTMLTextAreaElement)return h(n,"input",()=>{e(n.value);})}function h(n,e,t){return n.addEventListener(e,t),()=>n.removeEventListener(e,t)}function re(n){return ge.includes(n)?`<${n}/>`:`<${n}></${n}>`}function $(n){return isSignal(n)?n.value:n}var k=class extends u{constructor(t,o,r){super();this.template=t;this.props=o;this.key=r;this.emitter=new Set;this.rootNode=null;this.trackMap=new Map;this.key||(this.key=o&&o.key),this.proxyProps=this.createProxyProps(o);}createProxyProps(t){return t?signalObject(t,o=>startsWith(o,P)||startsWith(o,L)||o===g):{}}get firstChild(){var t,o;return (o=(t=this.rootNode)==null?void 0:t.firstChild)!=null?o:null}get isConnected(){var t,o;return (o=(t=this.rootNode)==null?void 0:t.isConnected)!=null?o:!1}mount(t,o){var i,s,c,a;if(!isFunction(this.template))throw new Error("Template must be a function");if(this.isConnected)return (s=(i=this.rootNode)==null?void 0:i.mount(t,o))!=null?s:[];this.initRef(),this.rootNode=this.template(reactive(this.proxyProps,[g]));let r=(a=(c=this.rootNode)==null?void 0:c.mount(t,o))!=null?a:[];return this.callMountHooks(),this.patchProps(this.props),this.removeRef(),r}unmount(){var t;this.callDestroyHooks(),this.clearHooks(),(t=this.rootNode)==null||t.unmount(),this.rootNode=null,this.proxyProps={},this.clearEmitter();}callMountHooks(){this.hooks.mounted.forEach(t=>t());}callDestroyHooks(){this.hooks.destroy.forEach(t=>t());}clearEmitter(){for(let t of this.emitter)t();this.emitter.clear();}inheritNode(t){Object.assign(this.proxyProps,t.proxyProps),this.rootNode=t.rootNode,this.trackMap=t.trackMap,this.hooks=t.hooks;let o=this.props;this.props=t.props,this.patchProps(o);}getNodeTrack(t){let o=this.trackMap.get(t);return o||(o={cleanup:()=>{}},this.trackMap.set(t,o)),o.cleanup(),o}patchProps(t){var o;if(t){for(let[r,i]of Object.entries(t))startsWith(r,P)&&((o=this.rootNode)!=null&&o.firstChild)?this.patchEventListener(r,i):r===A?this.patchRef(i):startsWith(r,L)?this.patchUpdateHandler(r,i):r!==g&&this.patchNormalProp(r,i);this.props=t;}}patchEventListener(t,o){let r=t.slice(2).toLowerCase(),i=h(this.rootNode.nodes[0],r,o);this.emitter.add(i);}patchRef(t){var o,r;t.value=(r=(o=this.rootNode)==null?void 0:o.firstChild)!=null?r:null;}patchUpdateHandler(t,o){this.props[t]=$(o);}patchNormalProp(t,o){var s,c;let r=(c=(s=this.proxyProps)[t])!=null?c:s[t]=signal(o),i=this.getNodeTrack(t);i.cleanup=effect(()=>{r.value=isFunction(o)?o():o;});}};function se(n,e,t,o){let r=new Map,i=Array.from(e.values());if(i.length&&t.length===0)return Me(n,i,o),r;let s=[],c=Pe(t),a=0;for(let[d,p]of t.entries()){let l=i[a],b=v(l,d);for(;l&&!c.has(b);)S(l),e.delete(b),l=i[++a],b=v(l,d);let B=v(p,d),G=e.get(B);if(G&&(p=ke(n,G,p)),l)if(l===G)a++;else {let q=document.createComment("");T(n,q,l),s.push([q,p]);}else T(n,p,o);r.set(B,p);}return s.forEach(([d,p])=>{V(n,p,d);}),e.forEach((d,p)=>{d.isConnected&&!r.has(p)&&S(d);}),r}function Me(n,e,t){if(n.childNodes.length===e.length+(t?1:0))n.innerHTML="",t&&T(n,t);else {let o=document.createRange(),r=e[0],i=f(r)?r.firstChild:r;o.setStartBefore(i),t?o.setEndBefore(t):o.setEndAfter(n),o.deleteContents();}e.forEach(o=>{f(o)&&o.unmount();});}function ke(n,e,t){return e===t?e:f(e)&&f(t)&&e.template===t.template?(t.inheritNode(e),t):e instanceof Text&&t instanceof Text?(e.textContent!==t.textContent&&(e.textContent=t.textContent),e):(V(n,t,e),t)}function Pe(n){let e=new Map;for(let[t,o]of n.entries()){let r=v(o,t);e.set(r,o);}return e}function v(n,e){if(f(n)){let t=n.key;if(t!=null)return String(t)}return `_$${e}$`}var x=class{constructor(e,t,o){this.template=e;this.props=t;this.key=o;this.treeMap=new Map;this.mounted=!1;this.nodes=[];this.trackMap=new Map;this.bindValueKeys=[];this.parent=null;m.isSSR&&(this.componentIndex=ee(this.template));}get firstChild(){var e;return (e=this.nodes[0])!=null?e:null}get isConnected(){return this.mounted}addEventListener(){}removeEventListener(){}mount(e,t){var i;if(this.parent=e,this.isConnected)return this.nodes.forEach(s=>T(e,s,t)),this.nodes;isArray(this.template)&&(this.template=w(this.template.join("")));let o=this.template.content.cloneNode(!0),r=o.firstChild;return (i=r==null?void 0:r.hasAttribute)!=null&&i.call(r,"_svg_")&&(r.remove(),r.childNodes.forEach(s=>{o.append(s);})),this.nodes=Array.from(o.childNodes),m.isSSR?this.mapSSGNodeTree(e):this.mapNodeTree(e,o),T(e,o,t),this.patchProps(this.props),this.mounted=!0,this.nodes}unmount(){this.trackMap.forEach(e=>{e.cleanup&&e.cleanup();}),this.trackMap.clear(),this.treeMap.clear(),this.nodes.forEach(e=>S(e)),this.nodes=[],this.mounted=!1;}inheritNode(e){this.mounted=e.mounted,this.nodes=e.nodes,this.trackMap=e.trackMap,this.treeMap=e.treeMap;let t=this.props;this.props=e.props,this.patchProps(t);}mapSSGNodeTree(e){this.treeMap.set(0,e),this.walkNodeTree(e,this.handleSSGNode.bind(this));}mapNodeTree(e,t){let o=1;this.treeMap.set(0,e);let r=[e],i=s=>{s.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&(this.treeMap.set(o++,s),r.push(s));};this.walkNodeTree(t,i);}walkNodeTree(e,t){e.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&t(e);let o=e.firstChild;for(;o;)this.walkNodeTree(o,t),o=o.nextSibling;}handleSSGNode(e){var t;if(e.nodeType===Node.COMMENT_NODE){let[o,r]=((t=e.textContent)==null?void 0:t.split("-"))||[];if(0===+o&&+r===this.componentIndex){let i=e.nextSibling;this.treeMap.set(+r,i);}}else if(e.nodeType!==Node.TEXT_NODE){let{ci:o="-1",hk:r}=(e==null?void 0:e.dataset)||{};r&&+o===this.componentIndex&&this.treeMap.set(+r,e);}}patchProps(e){e&&(Object.entries(e).forEach(([t,o])=>{let r=Number(t),i=this.treeMap.get(r);i&&this.patchProp(t,i,o,r===0);}),this.props=e);}patchProp(e,t,o,r){o&&Object.entries(o).forEach(([i,s])=>{if(i===g&&s)this.patchChildren(e,t,s,r);else if(i===A)o[i].value=t;else if(startsWith(i,P))this.patchEventListener(e,t,i,s);else {if(this.bindValueKeys.includes(i))return;let c=this.getBindUpdateValue(o,e,i);this.patchAttribute(e,t,i,s,c);}});}getBindUpdateValue(e,t,o){let r=`${L}${capitalize(o)}`;if(r&&e[r]&&isFunction(e[r]))return this.bindValueKeys.push(r),e[r]}patchChildren(e,t,o,r){if(isArray(o))o.filter(Boolean).forEach((i,s)=>{var b;let[c,a]=isArray(i)?i:[i,null],d=isNil(a)?null:(b=this.treeMap.get(a))!=null?b:null,p=`${e}:${g}:${s}`,l=this.getNodeTrack(p,!0,r);this.patchChild(l,t,c,d);});else {let i=`${e}:${g}:0`,s=this.getNodeTrack(i,!0,r);this.patchChild(s,t,o,null);}}patchEventListener(e,t,o,r){let i=o.slice(2).toLowerCase(),s=this.getNodeTrack(`${e}:${o}`);s.cleanup=h(t,i,r);}patchAttribute(e,t,o,r,i){let s=this.getNodeTrack(`${e}:${o}`),c=isFunction(r)?r():r,a=isSignal(c)?c:shallowSignal(c);Y(t,o,a.value);let d=effect(()=>{let l=isFunction(r)?r():r;isPlainObject(l)&&isPlainObject(a.peek())&&JSON.stringify(a.value)===JSON.stringify(l)||(a.value=isSignal(l)?l.value:l,Y(t,o,a.value));}),p;i&&isHTMLElement(t)&&(p=ne(t,l=>{i(l);})),s.cleanup=()=>{d&&d(),p&&p();};}getNodeTrack(e,t,o){let r=this.trackMap.get(e);return r||(r={cleanup:()=>{}},t&&(r.lastNodes=new Map),o&&(r.isRoot=!0),this.trackMap.set(e,r)),r.cleanup&&r.cleanup(),r}patchChild(e,t,o,r){isFunction(o)?e.cleanup=effect(()=>{let i=coerceArray(o()).map(J);m.isSSR?e.lastNodes=this.reconcileChildren(t,i,r):e.lastNodes=se(t,e.lastNodes,i,r);}):coerceArray(o).forEach((i,s)=>{let c=J(i),a=v(c,s);m.isSSR?e.lastNodes=this.reconcileChildren(t,[c],r):(e.lastNodes.set(a,c),T(t,c,r));});}reconcileChildren(e,t,o){let r=new Map,i=Array.from(e.childNodes).filter(s=>{var c,a;return s.nodeType===Node.TEXT_NODE&&((c=s.previousSibling)==null?void 0:c.nodeType)===Node.COMMENT_NODE&&((a=s.nextSibling)==null?void 0:a.nodeType)===Node.COMMENT_NODE});return t.forEach((s,c)=>{let a=v(s,c);s.nodeType===Node.TEXT_NODE?i.forEach(d=>{s.textContent===d.textContent&&e.replaceChild(s,d);}):T(e,s,o),r.set(a,s);}),r}};var K=class extends x{unmount(){this.trackMap.forEach(e=>{e.lastNodes&&e.lastNodes.forEach(t=>{S(t);}),e.cleanup&&e.cleanup();}),this.trackMap.clear(),this.treeMap.clear(),this.nodes.forEach(e=>{S(e);}),this.nodes=[],this.mounted=!1;}};function X(n,e,t){if(n===H)return pe(n,e);if(isString(n)){let o=re(n);return e={[W]:e},new x(w(o),e,t)}return isFunction(n)?new k(n,e,t):new x(n,e,t)}function Ie(n){return n instanceof k}function f(n){return n instanceof k||n instanceof x}function w(n){let e=document.createElement("template");return e.innerHTML=n,e}function pe(n,e){return e.children&&(e={[z]:{children:isArray(e.children)?e.children.filter(Boolean):[e.children]}}),n===H&&(n=w(H)),new K(n,e)}function je(n){u.ref&&u.ref.addHook("mounted",n);}function Ke(n){u.ref&&u.ref.addHook("destroy",n);}function Xe(n,e){u.ref&&u.ref.setContext(n,e);}function De(n,e){var t;return (t=u.ref&&u.ref.getContext(n))!=null?t:e}function Ge(n,e){m.setSSG();let o=new M(n,e||{}).mount();return m.setClient(),o}function Fe(n,e){let t=typeof e=="string"?document.querySelector(e):e;if(!t)throw new Error(`Could not find container: ${e}`);m.setSSR(),X(n).mount(t),m.setClient();}function Je(n,e){return m.isSSG?new M(n,e):X(n,e)}export{pe as Fragment,X as h,Fe as hydrate,De as inject,Ie as isComponent,f as isJsxElement,Ke as onDestroy,je as onMount,Xe as provide,Ge as renderToString,Je as ssg,w as template};//# sourceMappingURL=template.esm.js.map
|
|
7
7
|
//# sourceMappingURL=template.esm.js.map
|