essor 0.0.6-beta.2 → 0.0.6-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/essor.cjs.js +30 -26
- package/dist/essor.cjs.js.map +1 -1
- package/dist/essor.d.cts +32 -14
- package/dist/essor.d.ts +32 -14
- package/dist/essor.dev.cjs.js +113 -65
- package/dist/essor.dev.esm.js +110 -66
- package/dist/essor.esm.js +3 -3
- package/dist/essor.esm.js.map +1 -1
- package/package.json +2 -3
- package/types/jsx.d.ts +1 -1
package/dist/essor.dev.esm.js
CHANGED
|
@@ -14,6 +14,7 @@ var __spreadValues = (a, b) => {
|
|
|
14
14
|
}
|
|
15
15
|
return a;
|
|
16
16
|
};
|
|
17
|
+
var isFunction = (val) => typeof val === "function";
|
|
17
18
|
|
|
18
19
|
// src/signal/signal.ts
|
|
19
20
|
var activeEffect = null;
|
|
@@ -135,24 +136,67 @@ function useEffect(fn) {
|
|
|
135
136
|
activeEffect = null;
|
|
136
137
|
};
|
|
137
138
|
}
|
|
138
|
-
function
|
|
139
|
+
function shouldExclude(key, exclude) {
|
|
140
|
+
return Array.isArray(exclude) ? exclude.includes(key) : isFunction(exclude) ? exclude(key) : false;
|
|
141
|
+
}
|
|
142
|
+
function signalObject(initialValues, exclude) {
|
|
139
143
|
const signals = Object.entries(initialValues).reduce((acc, [key, value]) => {
|
|
140
|
-
acc[key] = isSignal(value) ? value : useSignal(value);
|
|
144
|
+
acc[key] = shouldExclude(key, exclude) || isSignal(value) ? value : useSignal(value);
|
|
141
145
|
return acc;
|
|
142
146
|
}, {});
|
|
143
147
|
return signals;
|
|
144
148
|
}
|
|
145
|
-
function
|
|
149
|
+
function unSignal(signal, exclude) {
|
|
146
150
|
if (!signal)
|
|
147
151
|
return {};
|
|
148
152
|
if (isSignal(signal)) {
|
|
149
153
|
return signal.peek();
|
|
150
154
|
}
|
|
151
155
|
return Object.entries(signal).reduce((acc, [key, value]) => {
|
|
152
|
-
|
|
156
|
+
if (shouldExclude(key, exclude)) {
|
|
157
|
+
acc[key] = value;
|
|
158
|
+
} else {
|
|
159
|
+
acc[key] = isSignal(value) ? value.peek() : value;
|
|
160
|
+
}
|
|
153
161
|
return acc;
|
|
154
162
|
}, {});
|
|
155
163
|
}
|
|
164
|
+
var REACTIVE_MARKER = Symbol("reactive");
|
|
165
|
+
function isReactive(obj) {
|
|
166
|
+
return obj && obj[REACTIVE_MARKER] === true;
|
|
167
|
+
}
|
|
168
|
+
function unReactive(obj) {
|
|
169
|
+
if (!isReactive(obj)) {
|
|
170
|
+
return obj;
|
|
171
|
+
}
|
|
172
|
+
const copy = Object.assign({}, obj);
|
|
173
|
+
delete copy[REACTIVE_MARKER];
|
|
174
|
+
return copy;
|
|
175
|
+
}
|
|
176
|
+
function reactive(initialValue) {
|
|
177
|
+
if (isReactive(initialValue)) {
|
|
178
|
+
return initialValue;
|
|
179
|
+
}
|
|
180
|
+
const signalObj = signalObject(initialValue);
|
|
181
|
+
const handler = {
|
|
182
|
+
get(target, key, receiver) {
|
|
183
|
+
track(target, key);
|
|
184
|
+
const value = Reflect.get(target, key, receiver);
|
|
185
|
+
return isSignal(value) ? value.value : value;
|
|
186
|
+
},
|
|
187
|
+
set(target, key, value, receiver) {
|
|
188
|
+
const oldValue = Reflect.get(target, key, receiver);
|
|
189
|
+
if (oldValue !== value) {
|
|
190
|
+
Reflect.set(target, key, useSignal(value), receiver);
|
|
191
|
+
trigger(target, key);
|
|
192
|
+
}
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
const reactiveProxy = new Proxy(signalObj, handler);
|
|
197
|
+
reactiveProxy[REACTIVE_MARKER] = true;
|
|
198
|
+
return reactiveProxy;
|
|
199
|
+
}
|
|
156
200
|
|
|
157
201
|
// src/signal/store.ts
|
|
158
202
|
var _id = 0;
|
|
@@ -160,14 +204,14 @@ var StoreMap = /* @__PURE__ */ new Map();
|
|
|
160
204
|
function createOptionsStore(options) {
|
|
161
205
|
const { state, getters, actions } = options;
|
|
162
206
|
const initState = __spreadValues({}, state != null ? state : {});
|
|
163
|
-
const
|
|
207
|
+
const reactiveState = reactive(state != null ? state : {});
|
|
164
208
|
const subscriptions = [];
|
|
165
209
|
const actionCallbacks = [];
|
|
166
210
|
const default_actions = {
|
|
167
211
|
patch$(payload) {
|
|
168
|
-
Object.assign(
|
|
169
|
-
subscriptions.forEach((callback) => callback(
|
|
170
|
-
actionCallbacks.forEach((callback) => callback(
|
|
212
|
+
Object.assign(reactiveState, payload);
|
|
213
|
+
subscriptions.forEach((callback) => callback(reactiveState));
|
|
214
|
+
actionCallbacks.forEach((callback) => callback(reactiveState));
|
|
171
215
|
},
|
|
172
216
|
subscribe$(callback) {
|
|
173
217
|
subscriptions.push(callback);
|
|
@@ -182,42 +226,44 @@ function createOptionsStore(options) {
|
|
|
182
226
|
actionCallbacks.push(callback);
|
|
183
227
|
},
|
|
184
228
|
reset$() {
|
|
185
|
-
|
|
229
|
+
Object.assign(reactiveState, initState);
|
|
186
230
|
}
|
|
187
231
|
};
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
};
|
|
232
|
+
const gettersStates = {};
|
|
233
|
+
const actionStates = {};
|
|
191
234
|
for (const key in getters) {
|
|
192
235
|
const getter = getters[key];
|
|
193
236
|
if (getter) {
|
|
194
|
-
|
|
195
|
-
return getter.call(
|
|
237
|
+
gettersStates[key] = useComputed(() => {
|
|
238
|
+
return getter.call(reactiveState, reactiveState);
|
|
196
239
|
});
|
|
197
240
|
}
|
|
198
241
|
}
|
|
199
242
|
for (const key in actions) {
|
|
200
243
|
const action = actions[key];
|
|
201
244
|
if (action) {
|
|
202
|
-
|
|
245
|
+
actionStates[key] = action.bind(reactiveState);
|
|
203
246
|
}
|
|
204
247
|
}
|
|
205
|
-
StoreMap.set(_id,
|
|
248
|
+
StoreMap.set(_id, reactiveState);
|
|
206
249
|
++_id;
|
|
207
250
|
return new Proxy(
|
|
208
251
|
{},
|
|
209
252
|
{
|
|
210
253
|
get(_, key) {
|
|
211
254
|
if (key === "state") {
|
|
212
|
-
return
|
|
255
|
+
return reactiveState;
|
|
256
|
+
}
|
|
257
|
+
if (key in gettersStates) {
|
|
258
|
+
return gettersStates[key].value;
|
|
213
259
|
}
|
|
214
|
-
if (key in
|
|
215
|
-
return
|
|
260
|
+
if (key in actionStates) {
|
|
261
|
+
return actionStates[key];
|
|
216
262
|
}
|
|
217
263
|
if (key in default_actions) {
|
|
218
264
|
return default_actions[key];
|
|
219
265
|
}
|
|
220
|
-
return
|
|
266
|
+
return reactiveState[key];
|
|
221
267
|
}
|
|
222
268
|
}
|
|
223
269
|
);
|
|
@@ -235,13 +281,16 @@ function createStore(options) {
|
|
|
235
281
|
function coerceArray(data) {
|
|
236
282
|
return Array.isArray(data) ? data.flat() : [data];
|
|
237
283
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
284
|
+
function startsWith(str, searchString) {
|
|
285
|
+
return str.indexOf(searchString) === 0;
|
|
286
|
+
}
|
|
287
|
+
var isObject2 = (val) => val !== null && typeof val === "object";
|
|
288
|
+
var isArray2 = Array.isArray;
|
|
289
|
+
function isNil2(x) {
|
|
241
290
|
return x === null || x === void 0;
|
|
242
291
|
}
|
|
243
|
-
var
|
|
244
|
-
function
|
|
292
|
+
var isFunction2 = (val) => typeof val === "function";
|
|
293
|
+
function isFalsy2(x) {
|
|
245
294
|
return x === false || x === null || x === void 0 || x === "";
|
|
246
295
|
}
|
|
247
296
|
var kebabCase = (string) => {
|
|
@@ -266,7 +315,10 @@ var _ComponentNode = class _ComponentNode {
|
|
|
266
315
|
destroy: /* @__PURE__ */ new Set()
|
|
267
316
|
};
|
|
268
317
|
this.trackMap = /* @__PURE__ */ new Map();
|
|
269
|
-
this.proxyProps = signalObject(
|
|
318
|
+
this.proxyProps = signalObject(
|
|
319
|
+
props,
|
|
320
|
+
(key2) => startsWith(key2, "on") || startsWith(key2, "update:")
|
|
321
|
+
);
|
|
270
322
|
}
|
|
271
323
|
addEventListener() {
|
|
272
324
|
}
|
|
@@ -313,7 +365,7 @@ var _ComponentNode = class _ComponentNode {
|
|
|
313
365
|
}
|
|
314
366
|
mount(parent, before) {
|
|
315
367
|
var _a, _b, _c, _d;
|
|
316
|
-
if (!
|
|
368
|
+
if (!isFunction2(this.template)) {
|
|
317
369
|
throw new Error("Template must be a function");
|
|
318
370
|
}
|
|
319
371
|
if (this.isConnected) {
|
|
@@ -343,19 +395,19 @@ var _ComponentNode = class _ComponentNode {
|
|
|
343
395
|
patchProps(props) {
|
|
344
396
|
var _a, _b, _c, _d, _e;
|
|
345
397
|
for (const [key, prop] of Object.entries(props)) {
|
|
346
|
-
if (key
|
|
398
|
+
if (startsWith(key, "on") && ((_a = this.rootNode) == null ? void 0 : _a.nodes)) {
|
|
347
399
|
const event = key.slice(2).toLowerCase();
|
|
348
400
|
const listener = prop;
|
|
349
401
|
const cleanup = addEventListener(this.rootNode.nodes[0], event, listener);
|
|
350
402
|
this.emitter.add(cleanup);
|
|
351
|
-
} else if (key.indexOf("bind:") === 0) {
|
|
352
|
-
this.proxyProps[key] = useSignal(prop);
|
|
353
403
|
} else if (key === "ref") {
|
|
354
404
|
if (isSignal(prop)) {
|
|
355
405
|
props[key].value = (_b = this.rootNode) == null ? void 0 : _b.nodes[0];
|
|
356
|
-
} else {
|
|
357
|
-
props[key]
|
|
406
|
+
} else if (isFunction2(prop)) {
|
|
407
|
+
props[key]((_c = this.rootNode) == null ? void 0 : _c.nodes[0]);
|
|
358
408
|
}
|
|
409
|
+
} else if (startsWith(key, "update:")) {
|
|
410
|
+
props[key] = isSignal(prop) ? prop.value : prop;
|
|
359
411
|
} else {
|
|
360
412
|
const newValue = (_e = (_d = this.proxyProps)[key]) != null ? _e : _d[key] = useSignal(prop);
|
|
361
413
|
const track2 = this.getNodeTrack(key);
|
|
@@ -373,7 +425,7 @@ var ComponentNode = _ComponentNode;
|
|
|
373
425
|
|
|
374
426
|
// src/template/template.ts
|
|
375
427
|
function h(template2, props, key) {
|
|
376
|
-
return
|
|
428
|
+
return isFunction2(template2) ? new ComponentNode(template2, props, key) : new TemplateNode(template2, props, key);
|
|
377
429
|
}
|
|
378
430
|
function isJsxElement(node) {
|
|
379
431
|
return node instanceof ComponentNode || node instanceof TemplateNode;
|
|
@@ -392,7 +444,7 @@ function coerceNode(data) {
|
|
|
392
444
|
if (isJsxElement(data) || data instanceof Node) {
|
|
393
445
|
return data;
|
|
394
446
|
}
|
|
395
|
-
const text =
|
|
447
|
+
const text = isFalsy2(data) ? "" : String(data);
|
|
396
448
|
return document.createTextNode(text);
|
|
397
449
|
}
|
|
398
450
|
function insertChild(parent, child, before = null) {
|
|
@@ -441,7 +493,7 @@ function setAttribute(element, attr, value) {
|
|
|
441
493
|
}
|
|
442
494
|
return;
|
|
443
495
|
}
|
|
444
|
-
if (
|
|
496
|
+
if (isFalsy2(value)) {
|
|
445
497
|
element.removeAttribute(attr);
|
|
446
498
|
} else if (value === true) {
|
|
447
499
|
element.setAttribute(attr, "");
|
|
@@ -723,7 +775,7 @@ var TemplateNode = class _TemplateNode {
|
|
|
723
775
|
patchNode(key, node, props, isRoot) {
|
|
724
776
|
for (const attr in props) {
|
|
725
777
|
if (attr === "children" && props.children) {
|
|
726
|
-
if (!
|
|
778
|
+
if (!isArray2(props.children)) {
|
|
727
779
|
const trackKey = `${key}:${attr}:${0}`;
|
|
728
780
|
const track2 = this.getNodeTrack(trackKey, true, isRoot);
|
|
729
781
|
patchChild(track2, node, props.children, null);
|
|
@@ -733,8 +785,8 @@ var TemplateNode = class _TemplateNode {
|
|
|
733
785
|
if (!item) {
|
|
734
786
|
return;
|
|
735
787
|
}
|
|
736
|
-
const [child, path] =
|
|
737
|
-
const before =
|
|
788
|
+
const [child, path] = isArray2(item) ? item : [item, null];
|
|
789
|
+
const before = isNil2(path) ? null : (_a = this.treeMap.get(path)) != null ? _a : null;
|
|
738
790
|
const trackKey = `${key}:${attr}:${index}`;
|
|
739
791
|
const track2 = this.getNodeTrack(trackKey, true, isRoot);
|
|
740
792
|
patchChild(track2, node, child, before);
|
|
@@ -743,31 +795,15 @@ var TemplateNode = class _TemplateNode {
|
|
|
743
795
|
} else if (attr === "ref") {
|
|
744
796
|
if (isSignal(props[attr])) {
|
|
745
797
|
props[attr].value = node;
|
|
746
|
-
} else {
|
|
747
|
-
props[attr]
|
|
798
|
+
} else if (isFunction2(props[attr])) {
|
|
799
|
+
props[attr](node);
|
|
748
800
|
}
|
|
749
|
-
} else if (attr
|
|
801
|
+
} else if (startsWith(attr, "on")) {
|
|
750
802
|
const eventName = attr.slice(2).toLocaleLowerCase();
|
|
751
803
|
const track2 = this.getNodeTrack(`${key}:${attr}`);
|
|
752
804
|
const listener = props[attr];
|
|
753
805
|
track2.cleanup = addEventListener(node, eventName, listener);
|
|
754
|
-
} else if (attr
|
|
755
|
-
const bindKey = attr.slice(5).toLocaleLowerCase();
|
|
756
|
-
const val = props[attr];
|
|
757
|
-
const track2 = this.getNodeTrack(`${key}:${attr}`);
|
|
758
|
-
const triggerValue = isSignal(val) ? val : useSignal(val);
|
|
759
|
-
const cleanup = useEffect(() => {
|
|
760
|
-
triggerValue.value = isSignal(val) ? val.value : val;
|
|
761
|
-
node[bindKey] = triggerValue.value;
|
|
762
|
-
});
|
|
763
|
-
const cleanupBind = binNode(node, (value) => {
|
|
764
|
-
props[`update:${bindKey}`](value);
|
|
765
|
-
});
|
|
766
|
-
track2.cleanup = () => {
|
|
767
|
-
cleanup == null ? void 0 : cleanup();
|
|
768
|
-
cleanupBind == null ? void 0 : cleanupBind();
|
|
769
|
-
};
|
|
770
|
-
} else if (attr.indexOf("update:") !== 0) {
|
|
806
|
+
} else if (!startsWith(attr, "update:")) {
|
|
771
807
|
const track2 = this.getNodeTrack(`${key}:${attr}`);
|
|
772
808
|
const val = props[attr];
|
|
773
809
|
const triggerValue = isSignal(val) ? val : useSignal(val);
|
|
@@ -775,8 +811,16 @@ var TemplateNode = class _TemplateNode {
|
|
|
775
811
|
triggerValue.value = isSignal(val) ? val.value : val;
|
|
776
812
|
patchAttribute(track2, node, attr, triggerValue.value);
|
|
777
813
|
});
|
|
814
|
+
let cleanupBind;
|
|
815
|
+
const updateKey = `update:${attr}`;
|
|
816
|
+
if (props[updateKey]) {
|
|
817
|
+
cleanupBind = binNode(node, (value) => {
|
|
818
|
+
props[updateKey](value);
|
|
819
|
+
});
|
|
820
|
+
}
|
|
778
821
|
track2.cleanup = () => {
|
|
779
|
-
cleanup
|
|
822
|
+
cleanup && cleanup();
|
|
823
|
+
cleanupBind && cleanupBind();
|
|
780
824
|
};
|
|
781
825
|
}
|
|
782
826
|
}
|
|
@@ -787,7 +831,7 @@ function patchAttribute(track2, node, attr, data) {
|
|
|
787
831
|
if (!element.setAttribute) {
|
|
788
832
|
return;
|
|
789
833
|
}
|
|
790
|
-
if (
|
|
834
|
+
if (isFunction2(data)) {
|
|
791
835
|
track2.cleanup = useEffect(() => {
|
|
792
836
|
setAttribute(element, attr, data());
|
|
793
837
|
});
|
|
@@ -796,7 +840,7 @@ function patchAttribute(track2, node, attr, data) {
|
|
|
796
840
|
}
|
|
797
841
|
}
|
|
798
842
|
function patchChild(track2, parent, child, before) {
|
|
799
|
-
if (
|
|
843
|
+
if (isFunction2(child)) {
|
|
800
844
|
track2.cleanup = useEffect(() => {
|
|
801
845
|
const nextNodes = coerceArray(child()).map(coerceNode);
|
|
802
846
|
track2.lastNodes = patchChildren(parent, track2.lastNodes, nextNodes, before);
|
|
@@ -860,7 +904,7 @@ function useRef() {
|
|
|
860
904
|
}
|
|
861
905
|
|
|
862
906
|
// src/version.ts
|
|
863
|
-
var __essor_version = "0.0.6-beta.
|
|
907
|
+
var __essor_version = "0.0.6-beta.3";
|
|
864
908
|
|
|
865
909
|
// src/server/index.ts
|
|
866
910
|
function ssrtmpl(templates = []) {
|
|
@@ -873,17 +917,17 @@ function jsonToAttrs(json) {
|
|
|
873
917
|
return Object.entries(json).map(([key, value]) => `${key}=${JSON.stringify(value)}`).join(" ");
|
|
874
918
|
}
|
|
875
919
|
function ssr(template2, props) {
|
|
876
|
-
if (
|
|
920
|
+
if (isFunction2(template2)) {
|
|
877
921
|
return template2(props);
|
|
878
922
|
}
|
|
879
923
|
const childrenMap = {};
|
|
880
924
|
const newTemplate = {};
|
|
881
|
-
if (
|
|
925
|
+
if (isObject2(template2)) {
|
|
882
926
|
Object.entries(template2).forEach(([key, tmpl]) => {
|
|
883
927
|
const prop = props[key];
|
|
884
928
|
if (prop) {
|
|
885
929
|
Object.keys(prop).forEach((propKey) => {
|
|
886
|
-
if (
|
|
930
|
+
if (startsWith(propKey, "on") && isFunction2(prop[propKey])) {
|
|
887
931
|
delete prop[propKey];
|
|
888
932
|
}
|
|
889
933
|
});
|
|
@@ -916,4 +960,4 @@ function hydrate(component, root) {
|
|
|
916
960
|
component.mount(root);
|
|
917
961
|
}
|
|
918
962
|
|
|
919
|
-
export { ComponentNode, Fragment, TemplateNode, __essor_version, createStore, h, hydrate, isComputed, isJsxElement, isSignal, nextTick, onDestroy, onMount, renderToString, signalObject, ssr, ssrtmpl, template, useComputed, useEffect, useInject, useProvide, useRef, useSignal };
|
|
963
|
+
export { ComponentNode, Fragment, TemplateNode, __essor_version, createStore, h, hydrate, isComputed, isJsxElement, isReactive, isSignal, nextTick, onDestroy, onMount, reactive, renderToString, signalObject, ssr, ssrtmpl, template, unReactive, unSignal, useComputed, useEffect, useInject, useProvide, useRef, useSignal };
|
package/dist/essor.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var ce=Object.defineProperty;var Z=Object.getOwnPropertySymbols;var ue=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable;var q=(t,e,n)=>e in t?ce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Q=(t,e)=>{for(var n in e||(e={}))ue.call(e,n)&&q(t,n,e[n]);if(Z)for(var n of Z(e))le.call(e,n)&&q(t,n,e[n]);return t};var C=null,j=null,F=new Set,K=new WeakMap,R=new Set;function A(t,e){let n=K.get(t);n||(n=new Map,K.set(t,n));let o=n.get(e);o||(o=new Set,n.set(e,o)),C&&o.add(C),j&&F.add(j);}function Y(t,e){F.size>0&&F.forEach(r=>r.run());let n=K.get(t);if(!n)return;let o=n.get(e);o&&o.forEach(r=>R.has(r)&&r());}var L=class{constructor(e){this._value=e;}valueOf(){return A(this,"value"),this._value}toString(){return A(this,"value"),String(this._value)}toJSON(){return this._value}get value(){return A(this,"value"),this._value}set value(e){this._value!==e&&(this._value=e,Y(this,"value"));}peek(){return this._value}update(){Y(this,"value");}};function N(t){return f(t)?t:new L(t)}function f(t){return t instanceof L}var $=class{constructor(e){this.fn=e;let n=j;j=this,A(this,"_value"),this._value=this.fn(),j=n;}peek(){return this._value}run(){let e=this.fn();e!==this._value&&(this._value=e);}get value(){return A(this,"_value"),this._value}};function J(t){return new $(t)}function pe(t){return t instanceof $}function x(t){function e(){let n=C;C=e,t(),C=n;}return R.add(e),e(),()=>{R.delete(e),C=null;}}function k(t){return Object.entries(t).reduce((n,[o,r])=>(n[o]=f(r)?r:N(r),n),{})}function P(t){return t?f(t)?t.peek():Object.entries(t).reduce((e,[n,o])=>(e[n]=f(o)?o.peek():o,e),{}):{}}var O=0,G=new Map;function fe(t){let{state:e,getters:n,actions:o}=t,r=Q({},e!=null?e:{}),i=k(e!=null?e:{}),s=[],a=[],p={patch$(c){Object.assign(i,k(c)),s.forEach(u=>u(P(i))),a.forEach(u=>u(P(i)));},subscribe$(c){s.push(c);},unsubscribe$(c){let u=s.indexOf(c);u!==-1&&s.splice(u,1);},onAction$(c){a.push(c);},reset$(){p.patch$(r);}},l={_id:`store_${O}`};for(let c in n){let u=n[c];u&&(l[c]=J(()=>u.call(i)));}for(let c in o){let u=o[c];u&&(l[c]=u.bind(i));}return G.set(O,N),++O,new Proxy({},{get(c,u){return u==="state"?P(i):u in l?l[u]:u in p?p[u]:i[u].value}})}function de(t){return function(){return G.has(O)?G.get(O):fe(t)}}function I(t){return Array.isArray(t)?t.flat():[t]}var ee=t=>t!==null&&typeof t=="object";var X=Array.isArray;function te(t){return t==null}var v=t=>typeof t=="function";function V(t){return t===!1||t===null||t===void 0||t===""}var ne=t=>t.replaceAll(/[A-Z]+/g,(e,n)=>`${n>0?"-":""}${e.toLocaleLowerCase()}`);var b=class b{constructor(e,n,o){this.template=e;this.props=n;this.key=o;this.proxyProps={};this.context={};this.emitter=new Set;this.mounted=!1;this.rootNode=null;this.hooks={mounted:new Set,destroy:new Set};this.trackMap=new Map;this.proxyProps=k(n);}addEventListener(){}removeEventListener(){}get firstChild(){var e,n;return (n=(e=this.rootNode)==null?void 0:e.firstChild)!=null?n:null}get isConnected(){var e,n;return (n=(e=this.rootNode)==null?void 0:e.isConnected)!=null?n:!1}addHook(e,n){var o;(o=this.hooks[e])==null||o.add(n);}getContext(e){return b.context[e]}setContext(e,n){b.context[e]=n;}inheritNode(e){this.context=e.context,this.hooks=e.hooks,Object.assign(this.proxyProps,e.proxyProps),this.rootNode=e.rootNode,this.trackMap=e.trackMap;let n=this.props;this.props=e.props,this.patchProps(n);}unmount(){var e;this.hooks.destroy.forEach(n=>n()),Object.values(this.hooks).forEach(n=>n.clear()),(e=this.rootNode)==null||e.unmount(),this.rootNode=null,this.proxyProps={},this.mounted=!1,this.emitter.forEach(n=>n()),b.context={};}mount(e,n){var r,i,s,a;if(!v(this.template))throw new Error("Template must be a function");if(this.isConnected)return (i=(r=this.rootNode)==null?void 0:r.mount(e,n))!=null?i:[];b.ref=this,this.rootNode=this.template(this.proxyProps),b.ref=null,this.mounted=!0;let o=(a=(s=this.rootNode)==null?void 0:s.mount(e,n))!=null?a:[];return this.hooks.mounted.forEach(p=>p()),this.patchProps(this.props),o}getNodeTrack(e,n){let o=this.trackMap.get(e);return o||(o={cleanup:()=>{}},this.trackMap.set(e,o)),n||o.cleanup(),o}patchProps(e){var n,o,r,i,s;for(let[a,p]of Object.entries(e))if(a.indexOf("on")===0&&((n=this.rootNode)!=null&&n.nodes)){let l=a.slice(2).toLowerCase(),c=p,u=g(this.rootNode.nodes[0],l,c);this.emitter.add(u);}else if(a.indexOf("bind:")===0)this.proxyProps[a]=N(p);else if(a==="ref")f(p)?e[a].value=(o=this.rootNode)==null?void 0:o.nodes[0]:e[a]=(r=this.rootNode)==null?void 0:r.nodes[0];else {let l=(s=(i=this.proxyProps)[a])!=null?s:i[a]=N(p),c=this.getNodeTrack(a);c.cleanup=x(()=>{l.value=p;});}this.props=e;}};b.ref=null,b.context={};var h=b;function me(t,e,n){return v(t)?new h(t,e,n):new M(t,e,n)}function y(t){return t instanceof h||t instanceof M}function he(t){let e=document.createElement("template");return e.innerHTML=t,e}function ge(t){return t.children}function D(t){if(y(t)||t instanceof Node)return t;let e=V(t)?"":String(t);return document.createTextNode(e)}function T(t,e,n=null){let o=y(n)?n.firstChild:n;y(e)?e.mount(t,o):o?o.before(e):t.append(e);}function S(t){y(t)?t.unmount():t.parentNode&&t.remove();}function z(t,e,n){T(t,e,n),S(n);}function B(t,e,n){if(e==="class"){typeof n=="string"?t.className=n:Array.isArray(n)?t.className=n.join(" "):n&&typeof n=="object"&&(t.className=Object.entries(n).reduce((o,[r,i])=>o+(i?` ${r}`:""),"").trim());return}if(e==="style"){if(typeof n=="string")t.style.cssText=n;else if(n&&typeof n=="object"){let o=n;Object.keys(o).forEach(r=>{t.style.setProperty(ne(r),String(o[r]));});}return}V(n)?t.removeAttribute(e):n===!0?t.setAttribute(e,""):t.setAttribute(e,String(n));}function re(t,e){if(t instanceof HTMLInputElement){if(t.type==="checkbox")return g(t,"change",()=>{e(!!t.checked);});if(t.type==="date")return g(t,"change",()=>{e(t.value?t.value:"");});if(t.type==="file")return g(t,"change",()=>{t.files&&e(t.files);});if(t.type==="number")return g(t,"input",()=>{let n=Number.parseFloat(t.value);e(Number.isNaN(n)?"":String(n));});if(t.type==="radio")return g(t,"change",()=>{e(t.checked?t.value:"");});if(t.type==="text")return g(t,"input",()=>{e(t.value);})}if(t instanceof HTMLSelectElement)return g(t,"change",()=>{e(t.value);});if(t instanceof HTMLTextAreaElement)return g(t,"input",()=>{e(t.value);})}var oe=Promise.resolve();function ye(t){return t?oe.then(t):oe}function g(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function ie(t,e,n,o){let r=new Map,i=e.values(),s=t.childNodes.length;if(e.size>0&&n.length===0){if(s===e.size+(o?1:0)){let l=t;l.innerHTML="",o&&T(t,o);}else {let l=document.createRange(),c=i.next().value,u=y(c)?c.firstChild:c;l.setStartBefore(u),o?l.setEndBefore(o):l.setEndAfter(t),l.deleteContents();}return e.forEach(l=>{y(l)&&l.unmount();}),r}let a=[],p=ve(n);for(let[l,c]of n.entries()){let u=i.next().value,E=_(u,l);for(;u&&!p.has(E);)S(u),e.delete(E),u=i.next().value,E=_(u,l);let w=_(c,l),U=e.get(w);if(U&&(c=Ne(t,U,c)),u)if(u){let W=document.createComment("");T(t,W,u),a.push([W,c]);}else T(t,c,o);else T(t,c,o);r.set(w,c);}return a.forEach(([l,c])=>z(t,c,l)),e.forEach((l,c)=>{l.isConnected&&!r.has(c)&&S(l);}),r}function Ne(t,e,n){return e===n?e:y(e)&&y(n)&&e.template===n.template?(n.inheritNode(e),n):e instanceof Text&&n instanceof Text?(e.textContent!==n.textContent&&(e.textContent=n.textContent),e):(z(t,n,e),n)}function ve(t){let e=new Map;for(let[n,o]of t.entries()){let r=_(o,n);e.set(r,o);}return e}function _(t,e){let n=t instanceof Element?t.id:void 0,o=n===""?void 0:n;return o!=null?o:`_$${e}$`}var M=class t{constructor(e,n,o){this.template=e;this.props=n;this.key=o;this.treeMap=new Map;this.mounted=!1;this.nodes=[];this.provides={};this.trackMap=new Map;this.parent=null;}get firstChild(){var e;return (e=this.nodes[0])!=null?e:null}get isConnected(){return this.mounted}addEventListener(){}removeEventListener(){}unmount(){this.trackMap.forEach(e=>{var n,o;(n=e.cleanup)==null||n.call(e),(o=e.lastNodes)==null||o.forEach(r=>{e.isRoot?S(r):r instanceof t&&r.unmount();});}),this.trackMap.clear(),this.treeMap.clear(),this.nodes.forEach(e=>S(e)),this.nodes=[],this.mounted=!1;}mount(e,n){var i;if(this.parent=e,this.isConnected)return this.nodes.forEach(s=>T(e,s,n)),this.nodes;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==null||r.childNodes.forEach(s=>{o.append(s);})),this.nodes=Array.from(o.childNodes),this.mapNodeTree(e,o),T(e,o,n),this.patchNodes(this.props),this.mounted=!0,this.nodes}mapNodeTree(e,n){let o=1;this.treeMap.set(0,e);let r=i=>{i.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&this.treeMap.set(o++,i);let s=i.firstChild;for(;s;)r(s),s=s.nextSibling;};r(n);}patchNodes(e){for(let n in e){let o=Number(n),r=this.treeMap.get(o);if(r){let i=this.props[n];this.patchNode(n,r,i,o===0);}}this.props=e;}getNodeTrack(e,n,o){var i;let r=this.trackMap.get(e);return r||(r={cleanup:()=>{}},n&&(r.lastNodes=new Map),o&&(r.isRoot=!0),this.trackMap.set(e,r)),(i=r.cleanup)==null||i.call(r),r}inheritNode(e){this.mounted=e.mounted,this.nodes=e.nodes,this.trackMap=e.trackMap,this.treeMap=e.treeMap;let n=this.props;this.props=e.props,this.patchNodes(n);}patchNode(e,n,o,r){for(let i in o)if(i==="children"&&o.children)if(X(o.children))o.children.forEach((s,a)=>{var w;if(!s)return;let[p,l]=X(s)?s:[s,null],c=te(l)?null:(w=this.treeMap.get(l))!=null?w:null,u=`${e}:${i}:${a}`,E=this.getNodeTrack(u,!0,r);se(E,n,p,c);});else {let s=`${e}:${i}:0`,a=this.getNodeTrack(s,!0,r);se(a,n,o.children,null);}else if(i==="ref")f(o[i])?o[i].value=n:o[i]=n;else if(i.indexOf("on")===0){let s=i.slice(2).toLocaleLowerCase(),a=this.getNodeTrack(`${e}:${i}`),p=o[i];a.cleanup=g(n,s,p);}else if(i.indexOf("bind:")===0){let s=i.slice(5).toLocaleLowerCase(),a=o[i],p=this.getNodeTrack(`${e}:${i}`),l=f(a)?a:N(a),c=x(()=>{l.value=f(a)?a.value:a,n[s]=l.value;}),u=re(n,E=>{o[`update:${s}`](E);});p.cleanup=()=>{c==null||c(),u==null||u();};}else if(i.indexOf("update:")!==0){let s=this.getNodeTrack(`${e}:${i}`),a=o[i],p=f(a)?a:N(a),l=x(()=>{p.value=f(a)?a.value:a,Te(s,n,i,p.value);});s.cleanup=()=>{l==null||l();};}}};function Te(t,e,n,o){let r=e;r.setAttribute&&(v(o)?t.cleanup=x(()=>{B(r,n,o());}):B(r,n,o));}function se(t,e,n,o){v(n)?t.cleanup=x(()=>{let r=I(n()).map(D);t.lastNodes=ie(e,t.lastNodes,r,o);}):I(n).forEach((r,i)=>{let s=D(r);t.lastNodes.set(String(i),s),T(e,s,o);});}function be(t){var e;H("onMounted"),(e=h.ref)==null||e.addHook("mounted",t);}function xe(t){var e;H("onDestroy"),(e=h.ref)==null||e.addHook("destroy",t);}function H(t){if(!h.ref)throw new Error(`"${t}" can only be called within the component function body
|
|
2
|
-
and cannot be used in asynchronous or deferred calls.`)}function
|
|
1
|
+
var de=Object.defineProperty;var te=Object.getOwnPropertySymbols;var me=Object.prototype.hasOwnProperty,he=Object.prototype.propertyIsEnumerable;var ne=(t,e,n)=>e in t?de(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,oe=(t,e)=>{for(var n in e||(e={}))me.call(e,n)&&ne(t,n,e[n]);if(te)for(var n of te(e))he.call(e,n)&&ne(t,n,e[n]);return t};var F=t=>typeof t=="function";var k=null,j=null,H=new Set,K=new WeakMap,J=new Set;function M(t,e){let n=K.get(t);n||(n=new Map,K.set(t,n));let o=n.get(e);o||(o=new Set,n.set(e,o)),k&&o.add(k),j&&H.add(j);}function G(t,e){H.size>0&&H.forEach(r=>r.run());let n=K.get(t);if(!n)return;let o=n.get(e);o&&o.forEach(r=>J.has(r)&&r());}var O=class{constructor(e){this._value=e;}valueOf(){return M(this,"value"),this._value}toString(){return M(this,"value"),String(this._value)}toJSON(){return this._value}get value(){return M(this,"value"),this._value}set value(e){this._value!==e&&(this._value=e,G(this,"value"));}peek(){return this._value}update(){G(this,"value");}};function E(t){return h(t)?t:new O(t)}function h(t){return t instanceof O}var L=class{constructor(e){this.fn=e;let n=j;j=this,M(this,"_value"),this._value=this.fn(),j=n;}peek(){return this._value}run(){let e=this.fn();e!==this._value&&(this._value=e);}get value(){return M(this,"_value"),this._value}};function I(t){return new L(t)}function ye(t){return t instanceof L}function S(t){function e(){let n=k;k=e,t(),k=n;}return J.add(e),e(),()=>{J.delete(e),k=null;}}function re(t,e){return Array.isArray(e)?e.includes(t):F(e)?e(t):!1}function P(t,e){return Object.entries(t).reduce((o,[r,i])=>(o[r]=re(r,e)||h(i)?i:E(i),o),{})}function ve(t,e){return t?h(t)?t.peek():Object.entries(t).reduce((n,[o,r])=>(re(o,e)?n[o]=r:n[o]=h(r)?r.peek():r,n),{}):{}}var X=Symbol("reactive");function V(t){return t&&t[X]===!0}function Ne(t){if(!V(t))return t;let e=Object.assign({},t);return delete e[X],e}function D(t){if(V(t))return t;let e=P(t),n={get(r,i,s){M(r,i);let a=Reflect.get(r,i,s);return h(a)?a.value:a},set(r,i,s,a){return Reflect.get(r,i,a)!==s&&(Reflect.set(r,i,E(s),a),G(r,i)),!0}},o=new Proxy(e,n);return o[X]=!0,o}var R=0,W=new Map;function be(t){let{state:e,getters:n,actions:o}=t,r=oe({},e!=null?e:{}),i=D(e!=null?e:{}),s=[],a=[],f={patch$(u){Object.assign(i,u),s.forEach(p=>p(i)),a.forEach(p=>p(i));},subscribe$(u){s.push(u);},unsubscribe$(u){let p=s.indexOf(u);p!==-1&&s.splice(p,1);},onAction$(u){a.push(u);},reset$(){Object.assign(i,r);}},c={},l={};for(let u in n){let p=n[u];p&&(c[u]=I(()=>p.call(i,i)));}for(let u in o){let p=o[u];p&&(l[u]=p.bind(i));}return W.set(R,i),++R,new Proxy({},{get(u,p){return p==="state"?i:p in c?c[p].value:p in l?l[p]:p in f?f[p]:i[p]}})}function Te(t){return function(){return W.has(R)?W.get(R):be(t)}}function z(t){return Array.isArray(t)?t.flat():[t]}function b(t,e){return t.indexOf(e)===0}var ie=t=>t!==null&&typeof t=="object";var B=Array.isArray;function se(t){return t==null}var g=t=>typeof t=="function";function U(t){return t===!1||t===null||t===void 0||t===""}var ae=t=>t.replaceAll(/[A-Z]+/g,(e,n)=>`${n>0?"-":""}${e.toLocaleLowerCase()}`);var x=class x{constructor(e,n,o){this.template=e;this.props=n;this.key=o;this.proxyProps={};this.context={};this.emitter=new Set;this.mounted=!1;this.rootNode=null;this.hooks={mounted:new Set,destroy:new Set};this.trackMap=new Map;this.proxyProps=P(n,r=>b(r,"on")||b(r,"update:"));}addEventListener(){}removeEventListener(){}get firstChild(){var e,n;return (n=(e=this.rootNode)==null?void 0:e.firstChild)!=null?n:null}get isConnected(){var e,n;return (n=(e=this.rootNode)==null?void 0:e.isConnected)!=null?n:!1}addHook(e,n){var o;(o=this.hooks[e])==null||o.add(n);}getContext(e){return x.context[e]}setContext(e,n){x.context[e]=n;}inheritNode(e){this.context=e.context,this.hooks=e.hooks,Object.assign(this.proxyProps,e.proxyProps),this.rootNode=e.rootNode,this.trackMap=e.trackMap;let n=this.props;this.props=e.props,this.patchProps(n);}unmount(){var e;this.hooks.destroy.forEach(n=>n()),Object.values(this.hooks).forEach(n=>n.clear()),(e=this.rootNode)==null||e.unmount(),this.rootNode=null,this.proxyProps={},this.mounted=!1,this.emitter.forEach(n=>n()),x.context={};}mount(e,n){var r,i,s,a;if(!g(this.template))throw new Error("Template must be a function");if(this.isConnected)return (i=(r=this.rootNode)==null?void 0:r.mount(e,n))!=null?i:[];x.ref=this,this.rootNode=this.template(this.proxyProps),x.ref=null,this.mounted=!0;let o=(a=(s=this.rootNode)==null?void 0:s.mount(e,n))!=null?a:[];return this.hooks.mounted.forEach(f=>f()),this.patchProps(this.props),o}getNodeTrack(e,n){let o=this.trackMap.get(e);return o||(o={cleanup:()=>{}},this.trackMap.set(e,o)),n||o.cleanup(),o}patchProps(e){var n,o,r,i,s;for(let[a,f]of Object.entries(e))if(b(a,"on")&&((n=this.rootNode)!=null&&n.nodes)){let c=a.slice(2).toLowerCase(),l=f,u=v(this.rootNode.nodes[0],c,l);this.emitter.add(u);}else if(a==="ref")h(f)?e[a].value=(o=this.rootNode)==null?void 0:o.nodes[0]:g(f)&&e[a]((r=this.rootNode)==null?void 0:r.nodes[0]);else if(b(a,"update:"))e[a]=h(f)?f.value:f;else {let c=(s=(i=this.proxyProps)[a])!=null?s:i[a]=E(f),l=this.getNodeTrack(a);l.cleanup=S(()=>{c.value=f;});}this.props=e;}};x.ref=null,x.context={};var y=x;function xe(t,e,n){return g(t)?new y(t,e,n):new A(t,e,n)}function N(t){return t instanceof y||t instanceof A}function Ee(t){let e=document.createElement("template");return e.innerHTML=t,e}function Se(t){return t.children}function Z(t){if(N(t)||t instanceof Node)return t;let e=U(t)?"":String(t);return document.createTextNode(e)}function T(t,e,n=null){let o=N(n)?n.firstChild:n;N(e)?e.mount(t,o):o?o.before(e):t.append(e);}function C(t){N(t)?t.unmount():t.parentNode&&t.remove();}function q(t,e,n){T(t,e,n),C(n);}function Q(t,e,n){if(e==="class"){typeof n=="string"?t.className=n:Array.isArray(n)?t.className=n.join(" "):n&&typeof n=="object"&&(t.className=Object.entries(n).reduce((o,[r,i])=>o+(i?` ${r}`:""),"").trim());return}if(e==="style"){if(typeof n=="string")t.style.cssText=n;else if(n&&typeof n=="object"){let o=n;Object.keys(o).forEach(r=>{t.style.setProperty(ae(r),String(o[r]));});}return}U(n)?t.removeAttribute(e):n===!0?t.setAttribute(e,""):t.setAttribute(e,String(n));}function ue(t,e){if(t instanceof HTMLInputElement){if(t.type==="checkbox")return v(t,"change",()=>{e(!!t.checked);});if(t.type==="date")return v(t,"change",()=>{e(t.value?t.value:"");});if(t.type==="file")return v(t,"change",()=>{t.files&&e(t.files);});if(t.type==="number")return v(t,"input",()=>{let n=Number.parseFloat(t.value);e(Number.isNaN(n)?"":String(n));});if(t.type==="radio")return v(t,"change",()=>{e(t.checked?t.value:"");});if(t.type==="text")return v(t,"input",()=>{e(t.value);})}if(t instanceof HTMLSelectElement)return v(t,"change",()=>{e(t.value);});if(t instanceof HTMLTextAreaElement)return v(t,"input",()=>{e(t.value);})}var ce=Promise.resolve();function Ce(t){return t?ce.then(t):ce}function v(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function le(t,e,n,o){let r=new Map,i=e.values(),s=t.childNodes.length;if(e.size>0&&n.length===0){if(s===e.size+(o?1:0)){let c=t;c.innerHTML="",o&&T(t,o);}else {let c=document.createRange(),l=i.next().value,u=N(l)?l.firstChild:l;c.setStartBefore(u),o?c.setEndBefore(o):c.setEndAfter(t),c.deleteContents();}return e.forEach(c=>{N(c)&&c.unmount();}),r}let a=[],f=Me(n);for(let[c,l]of n.entries()){let u=i.next().value,p=_(u,c);for(;u&&!f.has(p);)C(u),e.delete(p),u=i.next().value,p=_(u,c);let w=_(l,c),Y=e.get(w);if(Y&&(l=ke(t,Y,l)),u)if(u){let ee=document.createComment("");T(t,ee,u),a.push([ee,l]);}else T(t,l,o);else T(t,l,o);r.set(w,l);}return a.forEach(([c,l])=>q(t,l,c)),e.forEach((c,l)=>{c.isConnected&&!r.has(l)&&C(c);}),r}function ke(t,e,n){return e===n?e:N(e)&&N(n)&&e.template===n.template?(n.inheritNode(e),n):e instanceof Text&&n instanceof Text?(e.textContent!==n.textContent&&(e.textContent=n.textContent),e):(q(t,n,e),n)}function Me(t){let e=new Map;for(let[n,o]of t.entries()){let r=_(o,n);e.set(r,o);}return e}function _(t,e){let n=t instanceof Element?t.id:void 0,o=n===""?void 0:n;return o!=null?o:`_$${e}$`}var A=class t{constructor(e,n,o){this.template=e;this.props=n;this.key=o;this.treeMap=new Map;this.mounted=!1;this.nodes=[];this.provides={};this.trackMap=new Map;this.parent=null;}get firstChild(){var e;return (e=this.nodes[0])!=null?e:null}get isConnected(){return this.mounted}addEventListener(){}removeEventListener(){}unmount(){this.trackMap.forEach(e=>{var n,o;(n=e.cleanup)==null||n.call(e),(o=e.lastNodes)==null||o.forEach(r=>{e.isRoot?C(r):r instanceof t&&r.unmount();});}),this.trackMap.clear(),this.treeMap.clear(),this.nodes.forEach(e=>C(e)),this.nodes=[],this.mounted=!1;}mount(e,n){var i;if(this.parent=e,this.isConnected)return this.nodes.forEach(s=>T(e,s,n)),this.nodes;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==null||r.childNodes.forEach(s=>{o.append(s);})),this.nodes=Array.from(o.childNodes),this.mapNodeTree(e,o),T(e,o,n),this.patchNodes(this.props),this.mounted=!0,this.nodes}mapNodeTree(e,n){let o=1;this.treeMap.set(0,e);let r=i=>{i.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&this.treeMap.set(o++,i);let s=i.firstChild;for(;s;)r(s),s=s.nextSibling;};r(n);}patchNodes(e){for(let n in e){let o=Number(n),r=this.treeMap.get(o);if(r){let i=this.props[n];this.patchNode(n,r,i,o===0);}}this.props=e;}getNodeTrack(e,n,o){var i;let r=this.trackMap.get(e);return r||(r={cleanup:()=>{}},n&&(r.lastNodes=new Map),o&&(r.isRoot=!0),this.trackMap.set(e,r)),(i=r.cleanup)==null||i.call(r),r}inheritNode(e){this.mounted=e.mounted,this.nodes=e.nodes,this.trackMap=e.trackMap,this.treeMap=e.treeMap;let n=this.props;this.props=e.props,this.patchNodes(n);}patchNode(e,n,o,r){for(let i in o)if(i==="children"&&o.children)if(B(o.children))o.children.forEach((s,a)=>{var w;if(!s)return;let[f,c]=B(s)?s:[s,null],l=se(c)?null:(w=this.treeMap.get(c))!=null?w:null,u=`${e}:${i}:${a}`,p=this.getNodeTrack(u,!0,r);pe(p,n,f,l);});else {let s=`${e}:${i}:0`,a=this.getNodeTrack(s,!0,r);pe(a,n,o.children,null);}else if(i==="ref")h(o[i])?o[i].value=n:g(o[i])&&o[i](n);else if(b(i,"on")){let s=i.slice(2).toLocaleLowerCase(),a=this.getNodeTrack(`${e}:${i}`),f=o[i];a.cleanup=v(n,s,f);}else if(!b(i,"update:")){let s=this.getNodeTrack(`${e}:${i}`),a=o[i],f=h(a)?a:E(a),c=S(()=>{f.value=h(a)?a.value:a,Ae(s,n,i,f.value);}),l,u=`update:${i}`;o[u]&&(l=ue(n,p=>{o[u](p);})),s.cleanup=()=>{c&&c(),l&&l();};}}};function Ae(t,e,n,o){let r=e;r.setAttribute&&(g(o)?t.cleanup=S(()=>{Q(r,n,o());}):Q(r,n,o));}function pe(t,e,n,o){g(n)?t.cleanup=S(()=>{let r=z(n()).map(Z);t.lastNodes=le(e,t.lastNodes,r,o);}):z(n).forEach((r,i)=>{let s=Z(r);t.lastNodes.set(String(i),s),T(e,s,o);});}function we(t){var e;$("onMounted"),(e=y.ref)==null||e.addHook("mounted",t);}function je(t){var e;$("onDestroy"),(e=y.ref)==null||e.addHook("destroy",t);}function $(t){if(!y.ref)throw new Error(`"${t}" can only be called within the component function body
|
|
2
|
+
and cannot be used in asynchronous or deferred calls.`)}function Oe(t,e){var n;$("useProvide"),(n=y.ref)==null||n.setContext(t,e);}function Le(t,e){var n;return $("useInject"),((n=y.ref)==null?void 0:n.getContext(t))||e}function Pe(){let t=null;return new Proxy({},{get(e,n){return n==="__is_ref"?!0:t},set(e,n,o){return t=o,!0}})}var Bt="0.0.6-beta.3";function Qt(t=[]){return t.reduce((e,n,o)=>(e[o+1]={template:n},e),{})}function Re(t){return Object.entries(t).map(([e,n])=>`${e}=${JSON.stringify(n)}`).join(" ")}function fe(t,e){if(g(t))return t(e);let n={},o={};return ie(t)&&Object.entries(t).forEach(([r,i])=>{let s=e[r];s&&(Object.keys(s).forEach(a=>{b(a,"on")&&g(s[a])&&delete s[a];}),s.children&&(s.children.forEach(([a,f])=>{n[f]=[...n[f]||[],a];}),delete s.children)),o[r]={template:i.template,prop:s};}),Object.entries(o).map(([r,{template:i,prop:s}])=>{let a=i;return s&&(a+=` ${Re(s)}`),n[r]&&(a+=n[r].map(f=>fe(f,s)).join("")),a}).join("")}function Yt(t,e){return fe(t,e)}function en(t,e){e.innerHTML="",t.mount(e);}
|
|
3
3
|
|
|
4
|
-
export {
|
|
4
|
+
export { y as ComponentNode, Se as Fragment, A as TemplateNode, Bt as __essor_version, Te as createStore, xe as h, en as hydrate, ye as isComputed, N as isJsxElement, V as isReactive, h as isSignal, Ce as nextTick, je as onDestroy, we as onMount, D as reactive, Yt as renderToString, P as signalObject, fe as ssr, Qt as ssrtmpl, Ee as template, Ne as unReactive, ve as unSignal, I as useComputed, S as useEffect, Le as useInject, Oe as useProvide, Pe as useRef, E as useSignal };
|
|
5
5
|
//# sourceMappingURL=out.js.map
|
|
6
6
|
//# sourceMappingURL=essor.esm.js.map
|