essor 0.0.10 → 0.0.11
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 -30
- package/dist/essor.cjs.js.map +1 -1
- package/dist/essor.d.cts +1 -1
- package/dist/essor.d.ts +1 -1
- package/dist/essor.dev.cjs.js +66 -33
- package/dist/essor.dev.esm.js +66 -33
- package/dist/essor.esm.js +7 -7
- package/dist/essor.esm.js.map +1 -1
- package/package.json +4 -4
package/dist/essor.dev.cjs.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* essor v0.0.
|
|
4
|
+
* essor v0.0.11
|
|
5
5
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
6
6
|
* @license MIT
|
|
7
7
|
**/
|
|
8
8
|
|
|
9
9
|
// src/version.ts
|
|
10
|
-
var essor_version = "0.0.
|
|
10
|
+
var essor_version = "0.0.11";
|
|
11
11
|
|
|
12
12
|
// ../shared/dist/shared.js
|
|
13
13
|
var isObject = (val) => val !== null && typeof val === "object";
|
|
@@ -84,6 +84,8 @@ function isHTMLElement(obj) {
|
|
|
84
84
|
return obj && typeof obj === "object" && obj.nodeType === 1 && typeof obj.nodeName === "string";
|
|
85
85
|
}
|
|
86
86
|
var _toString = Object.prototype.toString;
|
|
87
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
88
|
+
var hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
87
89
|
var hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
|
|
88
90
|
var noop2 = Function.prototype;
|
|
89
91
|
function startsWith2(str, searchString) {
|
|
@@ -287,12 +289,6 @@ var REACTIVE_MARKER = Symbol("useReactive");
|
|
|
287
289
|
function isReactive(obj) {
|
|
288
290
|
return obj && obj[REACTIVE_MARKER] === true;
|
|
289
291
|
}
|
|
290
|
-
function unReactive(obj) {
|
|
291
|
-
if (!isReactive(obj)) {
|
|
292
|
-
return obj;
|
|
293
|
-
}
|
|
294
|
-
return __spreadValues({}, obj);
|
|
295
|
-
}
|
|
296
292
|
function createArrayProxy(initialValue) {
|
|
297
293
|
arrayMethods.forEach((method) => {
|
|
298
294
|
const originalMethod = Array.prototype[method];
|
|
@@ -317,6 +313,28 @@ function useReactive(initialValue, exclude) {
|
|
|
317
313
|
function shallowReactive(initialValue, exclude) {
|
|
318
314
|
return reactive(initialValue, exclude, true);
|
|
319
315
|
}
|
|
316
|
+
function unReactive(target) {
|
|
317
|
+
if (!isObject2(target)) {
|
|
318
|
+
return target;
|
|
319
|
+
}
|
|
320
|
+
if (!isReactive(target)) {
|
|
321
|
+
return target;
|
|
322
|
+
}
|
|
323
|
+
const unReactiveObj = Array.isArray(target) ? [] : {};
|
|
324
|
+
for (const key in target) {
|
|
325
|
+
if (hasOwn(target, key)) {
|
|
326
|
+
const value = target[key];
|
|
327
|
+
if (isReactive(value)) {
|
|
328
|
+
unReactiveObj[key] = unReactive(value);
|
|
329
|
+
} else if (isSignal(value)) {
|
|
330
|
+
unReactiveObj[key] = value.peek();
|
|
331
|
+
} else {
|
|
332
|
+
unReactiveObj[key] = value;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
return unReactiveObj;
|
|
337
|
+
}
|
|
320
338
|
function reactive(initialValue, exclude, shallow = false) {
|
|
321
339
|
if (!isObject2(initialValue)) {
|
|
322
340
|
return initialValue;
|
|
@@ -791,6 +809,15 @@ function convertToHtmlTag(tagName) {
|
|
|
791
809
|
return `<${tagName}></${tagName}>`;
|
|
792
810
|
}
|
|
793
811
|
}
|
|
812
|
+
function generateShortId() {
|
|
813
|
+
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
814
|
+
let result = "";
|
|
815
|
+
const charactersLength = characters.length;
|
|
816
|
+
for (let i = 0; i < 8; i++) {
|
|
817
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
818
|
+
}
|
|
819
|
+
return result;
|
|
820
|
+
}
|
|
794
821
|
function patchChildren(parent, childrenMap, nextChildren, before) {
|
|
795
822
|
const result = /* @__PURE__ */ new Map();
|
|
796
823
|
const children = Array.from(childrenMap.values());
|
|
@@ -884,14 +911,19 @@ function mapKeys(children) {
|
|
|
884
911
|
return result;
|
|
885
912
|
}
|
|
886
913
|
function getKey(node, index) {
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
914
|
+
if (isJsxElement(node)) {
|
|
915
|
+
const jsxKey = node.key;
|
|
916
|
+
if (jsxKey !== void 0 && jsxKey !== null) {
|
|
917
|
+
return String(jsxKey);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
return `_$${index}$`;
|
|
890
921
|
}
|
|
891
922
|
var TemplateNode = class _TemplateNode {
|
|
892
|
-
constructor(template2, props) {
|
|
923
|
+
constructor(template2, props, key) {
|
|
893
924
|
this.template = template2;
|
|
894
925
|
this.props = props;
|
|
926
|
+
this.key = key;
|
|
895
927
|
this.treeMap = /* @__PURE__ */ new Map();
|
|
896
928
|
this.mounted = false;
|
|
897
929
|
this.nodes = [];
|
|
@@ -910,24 +942,6 @@ var TemplateNode = class _TemplateNode {
|
|
|
910
942
|
}
|
|
911
943
|
removeEventListener() {
|
|
912
944
|
}
|
|
913
|
-
unmount() {
|
|
914
|
-
this.trackMap.forEach((track2) => {
|
|
915
|
-
var _a, _b;
|
|
916
|
-
(_a = track2.cleanup) == null ? void 0 : _a.call(track2);
|
|
917
|
-
(_b = track2.lastNodes) == null ? void 0 : _b.forEach((node) => {
|
|
918
|
-
if (track2.isRoot) {
|
|
919
|
-
removeChild(node);
|
|
920
|
-
} else if (node instanceof _TemplateNode) {
|
|
921
|
-
node.unmount();
|
|
922
|
-
}
|
|
923
|
-
});
|
|
924
|
-
});
|
|
925
|
-
this.trackMap.clear();
|
|
926
|
-
this.treeMap.clear();
|
|
927
|
-
this.nodes.forEach((node) => removeChild(node));
|
|
928
|
-
this.nodes = [];
|
|
929
|
-
this.mounted = false;
|
|
930
|
-
}
|
|
931
945
|
mount(parent, before) {
|
|
932
946
|
var _a;
|
|
933
947
|
this.parent = parent;
|
|
@@ -935,6 +949,7 @@ var TemplateNode = class _TemplateNode {
|
|
|
935
949
|
this.nodes.forEach((node) => insertChild(parent, node, before));
|
|
936
950
|
return this.nodes;
|
|
937
951
|
}
|
|
952
|
+
this.key = this.key || generateShortId();
|
|
938
953
|
const cloneNode = this.template.content.cloneNode(true);
|
|
939
954
|
const firstChild = cloneNode.firstChild;
|
|
940
955
|
if ((_a = firstChild == null ? void 0 : firstChild.hasAttribute) == null ? void 0 : _a.call(firstChild, "_svg_")) {
|
|
@@ -950,6 +965,24 @@ var TemplateNode = class _TemplateNode {
|
|
|
950
965
|
this.mounted = true;
|
|
951
966
|
return this.nodes;
|
|
952
967
|
}
|
|
968
|
+
unmount() {
|
|
969
|
+
this.trackMap.forEach((track2) => {
|
|
970
|
+
var _a, _b;
|
|
971
|
+
(_a = track2.cleanup) == null ? void 0 : _a.call(track2);
|
|
972
|
+
(_b = track2.lastNodes) == null ? void 0 : _b.forEach((node) => {
|
|
973
|
+
if (track2.isRoot) {
|
|
974
|
+
removeChild(node);
|
|
975
|
+
} else if (node instanceof _TemplateNode) {
|
|
976
|
+
node.unmount();
|
|
977
|
+
}
|
|
978
|
+
});
|
|
979
|
+
});
|
|
980
|
+
this.trackMap.clear();
|
|
981
|
+
this.treeMap.clear();
|
|
982
|
+
this.nodes.forEach((node) => removeChild(node));
|
|
983
|
+
this.nodes = [];
|
|
984
|
+
this.mounted = false;
|
|
985
|
+
}
|
|
953
986
|
mapNodeTree(parent, tree) {
|
|
954
987
|
let index = 1;
|
|
955
988
|
this.treeMap.set(0, parent);
|
|
@@ -1165,17 +1198,17 @@ if (globalThis) {
|
|
|
1165
1198
|
globalThis.__essor_version__ = essor_version;
|
|
1166
1199
|
}
|
|
1167
1200
|
/**
|
|
1168
|
-
* @estjs/shared v0.0.
|
|
1201
|
+
* @estjs/shared v0.0.11
|
|
1169
1202
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
1170
1203
|
* @license MIT
|
|
1171
1204
|
**/
|
|
1172
1205
|
/**
|
|
1173
|
-
* @estjs/signal v0.0.
|
|
1206
|
+
* @estjs/signal v0.0.11
|
|
1174
1207
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
1175
1208
|
* @license MIT
|
|
1176
1209
|
**/
|
|
1177
1210
|
/**
|
|
1178
|
-
* @estjs/template v0.0.
|
|
1211
|
+
* @estjs/template v0.0.11
|
|
1179
1212
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
1180
1213
|
* @license MIT
|
|
1181
1214
|
**/
|
package/dist/essor.dev.esm.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* essor v0.0.
|
|
2
|
+
* essor v0.0.11
|
|
3
3
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
6
|
|
|
7
7
|
// src/version.ts
|
|
8
|
-
var essor_version = "0.0.
|
|
8
|
+
var essor_version = "0.0.11";
|
|
9
9
|
|
|
10
10
|
// ../shared/dist/shared.js
|
|
11
11
|
var isObject = (val) => val !== null && typeof val === "object";
|
|
@@ -82,6 +82,8 @@ function isHTMLElement(obj) {
|
|
|
82
82
|
return obj && typeof obj === "object" && obj.nodeType === 1 && typeof obj.nodeName === "string";
|
|
83
83
|
}
|
|
84
84
|
var _toString = Object.prototype.toString;
|
|
85
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
86
|
+
var hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
85
87
|
var hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
|
|
86
88
|
var noop2 = Function.prototype;
|
|
87
89
|
function startsWith2(str, searchString) {
|
|
@@ -285,12 +287,6 @@ var REACTIVE_MARKER = Symbol("useReactive");
|
|
|
285
287
|
function isReactive(obj) {
|
|
286
288
|
return obj && obj[REACTIVE_MARKER] === true;
|
|
287
289
|
}
|
|
288
|
-
function unReactive(obj) {
|
|
289
|
-
if (!isReactive(obj)) {
|
|
290
|
-
return obj;
|
|
291
|
-
}
|
|
292
|
-
return __spreadValues({}, obj);
|
|
293
|
-
}
|
|
294
290
|
function createArrayProxy(initialValue) {
|
|
295
291
|
arrayMethods.forEach((method) => {
|
|
296
292
|
const originalMethod = Array.prototype[method];
|
|
@@ -315,6 +311,28 @@ function useReactive(initialValue, exclude) {
|
|
|
315
311
|
function shallowReactive(initialValue, exclude) {
|
|
316
312
|
return reactive(initialValue, exclude, true);
|
|
317
313
|
}
|
|
314
|
+
function unReactive(target) {
|
|
315
|
+
if (!isObject2(target)) {
|
|
316
|
+
return target;
|
|
317
|
+
}
|
|
318
|
+
if (!isReactive(target)) {
|
|
319
|
+
return target;
|
|
320
|
+
}
|
|
321
|
+
const unReactiveObj = Array.isArray(target) ? [] : {};
|
|
322
|
+
for (const key in target) {
|
|
323
|
+
if (hasOwn(target, key)) {
|
|
324
|
+
const value = target[key];
|
|
325
|
+
if (isReactive(value)) {
|
|
326
|
+
unReactiveObj[key] = unReactive(value);
|
|
327
|
+
} else if (isSignal(value)) {
|
|
328
|
+
unReactiveObj[key] = value.peek();
|
|
329
|
+
} else {
|
|
330
|
+
unReactiveObj[key] = value;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return unReactiveObj;
|
|
335
|
+
}
|
|
318
336
|
function reactive(initialValue, exclude, shallow = false) {
|
|
319
337
|
if (!isObject2(initialValue)) {
|
|
320
338
|
return initialValue;
|
|
@@ -789,6 +807,15 @@ function convertToHtmlTag(tagName) {
|
|
|
789
807
|
return `<${tagName}></${tagName}>`;
|
|
790
808
|
}
|
|
791
809
|
}
|
|
810
|
+
function generateShortId() {
|
|
811
|
+
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
812
|
+
let result = "";
|
|
813
|
+
const charactersLength = characters.length;
|
|
814
|
+
for (let i = 0; i < 8; i++) {
|
|
815
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
816
|
+
}
|
|
817
|
+
return result;
|
|
818
|
+
}
|
|
792
819
|
function patchChildren(parent, childrenMap, nextChildren, before) {
|
|
793
820
|
const result = /* @__PURE__ */ new Map();
|
|
794
821
|
const children = Array.from(childrenMap.values());
|
|
@@ -882,14 +909,19 @@ function mapKeys(children) {
|
|
|
882
909
|
return result;
|
|
883
910
|
}
|
|
884
911
|
function getKey(node, index) {
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
912
|
+
if (isJsxElement(node)) {
|
|
913
|
+
const jsxKey = node.key;
|
|
914
|
+
if (jsxKey !== void 0 && jsxKey !== null) {
|
|
915
|
+
return String(jsxKey);
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
return `_$${index}$`;
|
|
888
919
|
}
|
|
889
920
|
var TemplateNode = class _TemplateNode {
|
|
890
|
-
constructor(template2, props) {
|
|
921
|
+
constructor(template2, props, key) {
|
|
891
922
|
this.template = template2;
|
|
892
923
|
this.props = props;
|
|
924
|
+
this.key = key;
|
|
893
925
|
this.treeMap = /* @__PURE__ */ new Map();
|
|
894
926
|
this.mounted = false;
|
|
895
927
|
this.nodes = [];
|
|
@@ -908,24 +940,6 @@ var TemplateNode = class _TemplateNode {
|
|
|
908
940
|
}
|
|
909
941
|
removeEventListener() {
|
|
910
942
|
}
|
|
911
|
-
unmount() {
|
|
912
|
-
this.trackMap.forEach((track2) => {
|
|
913
|
-
var _a, _b;
|
|
914
|
-
(_a = track2.cleanup) == null ? void 0 : _a.call(track2);
|
|
915
|
-
(_b = track2.lastNodes) == null ? void 0 : _b.forEach((node) => {
|
|
916
|
-
if (track2.isRoot) {
|
|
917
|
-
removeChild(node);
|
|
918
|
-
} else if (node instanceof _TemplateNode) {
|
|
919
|
-
node.unmount();
|
|
920
|
-
}
|
|
921
|
-
});
|
|
922
|
-
});
|
|
923
|
-
this.trackMap.clear();
|
|
924
|
-
this.treeMap.clear();
|
|
925
|
-
this.nodes.forEach((node) => removeChild(node));
|
|
926
|
-
this.nodes = [];
|
|
927
|
-
this.mounted = false;
|
|
928
|
-
}
|
|
929
943
|
mount(parent, before) {
|
|
930
944
|
var _a;
|
|
931
945
|
this.parent = parent;
|
|
@@ -933,6 +947,7 @@ var TemplateNode = class _TemplateNode {
|
|
|
933
947
|
this.nodes.forEach((node) => insertChild(parent, node, before));
|
|
934
948
|
return this.nodes;
|
|
935
949
|
}
|
|
950
|
+
this.key = this.key || generateShortId();
|
|
936
951
|
const cloneNode = this.template.content.cloneNode(true);
|
|
937
952
|
const firstChild = cloneNode.firstChild;
|
|
938
953
|
if ((_a = firstChild == null ? void 0 : firstChild.hasAttribute) == null ? void 0 : _a.call(firstChild, "_svg_")) {
|
|
@@ -948,6 +963,24 @@ var TemplateNode = class _TemplateNode {
|
|
|
948
963
|
this.mounted = true;
|
|
949
964
|
return this.nodes;
|
|
950
965
|
}
|
|
966
|
+
unmount() {
|
|
967
|
+
this.trackMap.forEach((track2) => {
|
|
968
|
+
var _a, _b;
|
|
969
|
+
(_a = track2.cleanup) == null ? void 0 : _a.call(track2);
|
|
970
|
+
(_b = track2.lastNodes) == null ? void 0 : _b.forEach((node) => {
|
|
971
|
+
if (track2.isRoot) {
|
|
972
|
+
removeChild(node);
|
|
973
|
+
} else if (node instanceof _TemplateNode) {
|
|
974
|
+
node.unmount();
|
|
975
|
+
}
|
|
976
|
+
});
|
|
977
|
+
});
|
|
978
|
+
this.trackMap.clear();
|
|
979
|
+
this.treeMap.clear();
|
|
980
|
+
this.nodes.forEach((node) => removeChild(node));
|
|
981
|
+
this.nodes = [];
|
|
982
|
+
this.mounted = false;
|
|
983
|
+
}
|
|
951
984
|
mapNodeTree(parent, tree) {
|
|
952
985
|
let index = 1;
|
|
953
986
|
this.treeMap.set(0, parent);
|
|
@@ -1163,17 +1196,17 @@ if (globalThis) {
|
|
|
1163
1196
|
globalThis.__essor_version__ = essor_version;
|
|
1164
1197
|
}
|
|
1165
1198
|
/**
|
|
1166
|
-
* @estjs/shared v0.0.
|
|
1199
|
+
* @estjs/shared v0.0.11
|
|
1167
1200
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
1168
1201
|
* @license MIT
|
|
1169
1202
|
**/
|
|
1170
1203
|
/**
|
|
1171
|
-
* @estjs/signal v0.0.
|
|
1204
|
+
* @estjs/signal v0.0.11
|
|
1172
1205
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
1173
1206
|
* @license MIT
|
|
1174
1207
|
**/
|
|
1175
1208
|
/**
|
|
1176
|
-
* @estjs/template v0.0.
|
|
1209
|
+
* @estjs/template v0.0.11
|
|
1177
1210
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
1178
1211
|
* @license MIT
|
|
1179
1212
|
**/
|
package/dist/essor.esm.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* essor v0.0.
|
|
2
|
+
* essor v0.0.11
|
|
3
3
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
6
|
-
var rt="0.0.10";var st=t=>t!==null&&typeof t=="object";var D=Array.isArray;function K(t){return typeof t=="string"}function ot(t){return t==null}var d=t=>typeof t=="function";function B(t){return t===!1||t===null||t===void 0}function q(t){return Array.isArray(t)?t.flat():[t]}function v(t,e){return K(t)?t.indexOf(e)===0:!1}var it=t=>t.replaceAll(/[A-Z]+/g,(e,n)=>`${n>0?"-":""}${e.toLocaleLowerCase()}`);var ct=t=>t.charAt(0).toUpperCase()+t.slice(1);var kt=Object.defineProperty,at=Object.getOwnPropertySymbols,At=Object.prototype.hasOwnProperty,Ot=Object.prototype.propertyIsEnumerable,ut=(t,e,n)=>e in t?kt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,C=(t,e)=>{for(var n in e||(e={}))At.call(e,n)&&ut(t,n,e[n]);if(at)for(var n of at(e))Ot.call(e,n)&&ut(t,n,e[n]);return t},J=t=>t!==null&&typeof t=="object",dt=Array.isArray;function jt(t){return typeof t=="string"}function xt(t){return t===null}function $t(t){return P.call(t)==="[object Set]"}function Pt(t){return P.call(t)==="[object WeakMap]"}function Lt(t){return P.call(t)==="[object WeakSet]"}function Rt(t){return P.call(t)==="[object Map]"}var U=t=>typeof t=="function",lt=t=>["string","number","boolean","symbol","undefined"].includes(typeof t)||xt(t);function ft(t){return t?t&&typeof t=="object"&&t.nodeType===1&&typeof t.nodeName=="string":!1}var P=Object.prototype.toString,L=(t,e)=>t!==e&&(t===t||e===e),Wt=Function.prototype;function Ht(t,e){return jt(t)?t.indexOf(e)===0:!1}function x(t,e){return Array.isArray(e)?e.includes(t):U(e)?e(t):!1}function ht(t,...e){console.warn.apply(console,[`[Essor warn]: ${t}`].concat(e));}var b=null,_=null,G=new WeakMap,Z=new WeakMap,Q=new Set,z=new WeakMap,Ft=["push","pop","shift","unshift","splice","sort","reverse"];function R(t,e){if(!b&&!_)return;let n=Z.get(t);n||(n=new Map,Z.set(t,n));let r=n.get(e);r||(r=new Set,n.set(e,r)),b&&r.add(b);let o=G.get(t);o||(o=new Map,G.set(t,o));let s=o.get(e);s||(s=new Set,o.set(e,s)),_&&s.add(_);}function E(t,e){let n=Z.get(t);if(!n)return;let r=n.get(e);r&&r.forEach(s=>Q.has(s)&&s());let o=G.get(t);if(o){let s=o.get(e);s&&s.forEach(c=>c.run());}}var Y=class{constructor(t,e=!1){this._value=t,this._shallow=e;}get value(){return R(this,"_sv"),this.__triggerObject(),this._value}__triggerObject(){!lt(this._value)&&!ft(this._value)&&!this._shallow&&T(this._value);}set value(t){p(t)&&(console.warn("Signal cannot be set to another signal, use .peek() instead"),t=t.peek()),L(t,this._value)&&(this._value=t,!lt(this._value)&&!ft(this._value)&&this.__triggerObject(),E(this,"_sv"));}peek(){return this._value}};function W(t){return p(t)?t:new Y(t)}function ae(t){return new Y(t,!0)}function p(t){return t instanceof Y}var mt=class{constructor(t){this.fn=t;let e=_;_=this,this._value=this.fn(),_=e;}peek(){return this._value}run(){let t=this.fn();L(t,this._value)&&(this._value=t,E(this,"_cv"));}get value(){return R(this,"_cv"),this._value}};function It(t){return new mt(t)}function pt(t){return t instanceof mt}function w(t){function e(){let n=b;b=e,t(),b=n;}return Q.add(e),e(),()=>{Q.delete(e),b=null;}}function vt(t,e){return Object.entries(t).reduce((r,[o,s])=>(r[o]=x(o,e)||p(s)?s:W(s),r),{})}function Dt(t,e){return t?p(t)?t.peek():dt(t)?t.map(n=>Dt(n,e)):J(t)?Object.entries(t).reduce((n,[r,o])=>(x(r,e)?n[r]=o:n[r]=p(o)?o.peek():S(o)?Kt(o):o,n),{}):t:{}}var gt=Symbol("useReactive");function S(t){return t&&t[gt]===!0}function Kt(t){return S(t)?C({},t):t}function Bt(t){Ft.forEach(e=>{let n=Array.prototype[e];R(t,"length"),Object.defineProperty(t,e,{value(...r){let o=n.apply(this,r);return ["push","pop","shift","unshift","splice","sort","reverse"].includes(e)&&E(t,"length"),o},enumerable:!1,writable:!0,configurable:!0});});}function T(t,e){return bt(t,e,!1)}function ue(t,e){return bt(t,e,!0)}function bt(t,e,n=!1){if(!J(t)||S(t))return t;if(z.has(t))return z.get(t);if(Array.isArray(t)&&Bt(t),$t(t)||Rt(t)||Lt(t)||Pt(t))return t;let r={get(s,c,i){if(c===gt||Ht(c,"_"))return !0;let a=Reflect.get(s,c,i),l=p(a)?a.value:a;return x(c,e)?l:(R(s,c),J(l)&&!n?T(l):l)},set(s,c,i,a){if(x(c,e))return Reflect.set(s,c,i,a),!0;let l=Reflect.get(s,c,a);p(l)&&(l=l.value),p(i)&&(i=i.value);let u=Reflect.set(s,c,i,a);return L(i,l)&&E(s,c),u},deleteProperty(s,c){let i=Reflect.get(s,c),a=Reflect.deleteProperty(s,c);return i!==void 0&&E(s,c),a}},o=new Proxy(t,r);return z.set(t,o),o}function qt(t,e,n){return zt(t,e,n)}function zt(t,e,n){let r;p(t)||pt(t)?r=()=>t.value:S(t)?r=()=>C({},t):dt(t)?r=()=>t.map(i=>p(i)||pt(i)?i.value:S(i)?C({},i):U(i)?i():ht("Invalid source",i)):U(t)?r=t:(ht("Invalid source type",t),r=Wt);let o,s=()=>{let i=r();(n!=null&&n.deep||L(i,o))&&(e&&e(i,o),o=i);},c=w(s);return n!=null&&n.immediate&&s(),c}var $=0,X=new Map;function Jt(t){let{state:e,getters:n,actions:r}=t,o=C({},e!=null?e:{}),s=T(e!=null?e:{}),c=[],i=[],l=C({state:s},{patch$(u){Object.assign(s,u),c.forEach(f=>f(s)),i.forEach(f=>f(s));},subscribe$(u){c.push(u);},unsubscribe$(u){let f=c.indexOf(u);f!==-1&&c.splice(f,1);},onAction$(u){i.push(u);},reset$(){Object.assign(s,o);}});for(let u in n){let f=n[u];f&&qt(It(f.bind(s,s)),h=>{l[u]=h;});}for(let u in r){let f=r[u];f&&(l[u]=f.bind(s));}return X.set($,l),++$,l}function le(t){return function(){return X.has($)?X.get($):Jt(t)}}var V=class k{constructor(e,n){this.template=e,this.props=n,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=vt(n,r=>v(r,"on")||v(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 r;(r=this.hooks[e])==null||r.add(n);}getContext(e){return k.context[e]}setContext(e,n){k.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);}mount(e,n){var r,o,s,c;if(!d(this.template))throw new Error("Template must be a function");if(this.isConnected)return (o=(r=this.rootNode)==null?void 0:r.mount(e,n))!=null?o:[];k.ref=this,this.rootNode=this.template(T(this.proxyProps,["children"])),k.ref=null,this.mounted=!0;let i=(c=(s=this.rootNode)==null?void 0:s.mount(e,n))!=null?c:[];return this.hooks.mounted.forEach(a=>a()),this.patchProps(this.props),i}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());}getNodeTrack(e,n){let r=this.trackMap.get(e);return r||(r={cleanup:()=>{}},this.trackMap.set(e,r)),n||r.cleanup(),r}patchProps(e){var n,r,o,s,c;for(let[i,a]of Object.entries(e))if(v(i,"on")&&((n=this.rootNode)!=null&&n.nodes)){let l=i.slice(2).toLowerCase(),u=a,f=m(this.rootNode.nodes[0],l,u);this.emitter.add(f);}else if(i==="ref")p(a)?e[i].value=(r=this.rootNode)==null?void 0:r.nodes[0]:d(a)&&e[i]((o=this.rootNode)==null?void 0:o.nodes[0]);else if(v(i,"update"))e[i]=p(a)?a.value:a;else if(i!=="children"){let l=(c=(s=this.proxyProps)[i])!=null?c:s[i]=W(a),u=this.getNodeTrack(i);u.cleanup=w(()=>{l.value=d(a)?a():a;});}this.props=e;}};V.ref=null;V.context={};var N=V;function ge(t,e){return K(t)&&(Xt(t)&&(t=Yt(t),e={1:e}),t===""&&(e={0:e}),t=Ut(t)),d(t)?new N(t,e):new St(t,e)}function g(t){return t instanceof N||t instanceof St}function Ut(t){t=Qt(t);let e=document.createElement("template");return e.innerHTML=t,e}function be(t){return t.children}var Ct="area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr",Gt="a,abbr,acronym,address,applet,area,article,aside,audio,b,base,basefont,bdi,bdo,bgsound,big,blink,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,command,content,data,datalist,dd,del,details,dfn,dialog,dir,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,kbd,keygen,label,legend,li,link,listing,main,map,mark,marquee,menu,menuitem,meta,meter,nav,nobr,noframes,noscript,object,ol,optgroup,option,output,p,param,picture,plaintext,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,section,select,shadow,small,source,spacer,span,strike,strong,style,sub,summary,sup,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr,xmp";function yt(t){if(g(t)||t instanceof Node)return t;let e=B(t)?"":String(t);return document.createTextNode(e)}function y(t,e,n=null){let r=g(n)?n.firstChild:n;g(e)?e.mount(t,r):r?r.before(e):t.append(e);}function A(t){g(t)?t.unmount():t.parentNode&&t.remove();}function Et(t,e,n){y(t,e,n),A(n);}function Nt(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((r,[o,s])=>r+(s?` ${o}`:""),"").trim());return}if(e==="style"){if(typeof n=="string")t.style.cssText=n;else if(n&&typeof n=="object"){let r=n;Object.keys(r).forEach(o=>{t.style.setProperty(it(o),String(r[o]));});}return}B(n)?t.removeAttribute(e):n===!0?t.setAttribute(e,""):t instanceof HTMLInputElement?t.value=String(n):t.setAttribute(e,String(n));}function Zt(t,e){if(t instanceof HTMLInputElement)switch(t.type){case"checkbox":return m(t,"change",()=>{e(!!t.checked);});case"date":return m(t,"change",()=>{e(t.value?t.value:"");});case"file":return m(t,"change",()=>{t.files&&e(t.files);});case"number":return m(t,"input",()=>{let n=Number.parseFloat(t.value);e(Number.isNaN(n)?"":String(n));});case"radio":return m(t,"change",()=>{e(t.checked?t.value:"");});case"text":return m(t,"input",()=>{e(t.value);})}if(t instanceof HTMLSelectElement)return m(t,"change",()=>{e(t.value);});if(t instanceof HTMLTextAreaElement)return m(t,"input",()=>{e(t.value);})}var _t=Promise.resolve();function ye(t){return t?_t.then(t):_t}function m(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function Qt(t){let e=Ct.split(","),n=[],r=[],o=/<\/?([\da-z-]+)([^>]*)>/gi,s=0;for(;;){let c=o.exec(t);if(!c)break;let[i,a]=c,l=i[1]==="/";if(r.push(t.slice(s,c.index)),s=c.index+i.length,l){for(;n.length>0&&n[n.length-1]!==a;){let u=n.pop();u&&r.push(`</${u}>`);}n.length>0&&n.pop();}else e.includes(a)||n.push(a);r.push(i);}for(r.push(t.slice(s));n.length>0;){let c=n.pop();c&&r.push(`</${c}>`);}return r.join("")}function Xt(t){return Gt.split(",").includes(t)}function Yt(t){return Ct.split(",").includes(t)?`<${t}/>`:`<${t}></${t}>`}function Vt(t,e,n,r){let o=new Map,s=Array.from(e.values()),c=s.length;if(e.size>0&&n.length===0){if(t.childNodes.length===c+(r?1:0))t.innerHTML="",r&&y(t,r);else {let u=document.createRange(),f=s[0],h=g(f)?f.firstChild:f;u.setStartBefore(h),r?u.setEndBefore(r):u.setEndAfter(t),u.deleteContents();}return s.forEach(u=>{g(u)&&u.unmount();}),o}let i=[],a=ee(n),l=0;for(let[u,f]of n.entries()){let h=s[l],M=H(h,u);for(;h&&!a.has(M);)A(h),e.delete(M),h=s[++l],M=H(h,u);let et=H(f,u),I=e.get(et);if(I&&(f=te(t,I,f)),h)if(h===I)l++;else {let nt=document.createComment("");y(t,nt,h),i.push([nt,f]);}else y(t,f,r);o.set(et,f);}return i.forEach(([u,f])=>Et(t,f,u)),e.forEach((u,f)=>{u.isConnected&&!o.has(f)&&A(u);}),o}function te(t,e,n){return e===n?e:g(e)&&g(n)&&e.template===n.template?(n.inheritNode(e),n):e instanceof Text&&n instanceof Text?(e.textContent!==n.textContent&&(e.textContent=n.textContent),e):(Et(t,n,e),n)}function ee(t){let e=new Map;for(let[n,r]of t.entries()){let o=H(r,n);e.set(o,r);}return e}function H(t,e){let n=t instanceof Element?t.id:void 0,r=n===""?void 0:n;return r!=null?r:`_$${e}$`}var St=class Tt{constructor(e,n){this.template=e,this.props=n,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,r;(n=e.cleanup)==null||n.call(e),(r=e.lastNodes)==null||r.forEach(o=>{e.isRoot?A(o):o instanceof Tt&&o.unmount();});}),this.trackMap.clear(),this.treeMap.clear(),this.nodes.forEach(e=>A(e)),this.nodes=[],this.mounted=!1;}mount(e,n){var r;if(this.parent=e,this.isConnected)return this.nodes.forEach(c=>y(e,c,n)),this.nodes;let o=this.template.content.cloneNode(!0),s=o.firstChild;return (r=s==null?void 0:s.hasAttribute)!=null&&r.call(s,"_svg_")&&(s.remove(),s==null||s.childNodes.forEach(c=>{o.append(c);})),this.nodes=Array.from(o.childNodes),this.mapNodeTree(e,o),y(e,o,n),this.patchNodes(this.props),this.mounted=!0,this.nodes}mapNodeTree(e,n){let r=1;this.treeMap.set(0,e);let o=s=>{s.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&this.treeMap.set(r++,s);let c=s.firstChild;for(;c;)o(c),c=c.nextSibling;};o(n);}patchNodes(e){for(let n in e){let r=Number(n),o=this.treeMap.get(r);if(o){let s=this.props[n];this.patchNode(n,o,s,r===0);}}this.props=e;}getNodeTrack(e,n,r){var o;let s=this.trackMap.get(e);return s||(s={cleanup:()=>{}},n&&(s.lastNodes=new Map),r&&(s.isRoot=!0),this.trackMap.set(e,s)),(o=s.cleanup)==null||o.call(s),s}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,r,o){for(let s in r)if(s==="children"&&r.children)if(D(r.children))r.children.filter(Boolean).forEach((c,i)=>{var a;let[l,u]=D(c)?c:[c,null],f=ot(u)?null:(a=this.treeMap.get(u))!=null?a:null,h=`${e}:${s}:${i}`,M=this.getNodeTrack(h,!0,o);Mt(M,n,l,f);});else {let c=`${e}:${s}:0`,i=this.getNodeTrack(c,!0,o);Mt(i,n,r.children,null);}else if(s==="ref")p(r[s])?r[s].value=n:d(r[s])&&r[s](n);else if(v(s,"on")){let c=s.slice(2).toLocaleLowerCase(),i=this.getNodeTrack(`${e}:${s}`),a=r[s];i.cleanup=m(n,c,a);}else if(!v(s,"update")){let c=this.getNodeTrack(`${e}:${s}`),i=r[s],a=p(i)?i:W(i);wt(c,n,s,a.value);let l=w(()=>{a.value=p(i)?i.value:i,wt(c,n,s,a.value);}),u,f=`update${ct(s)}`;r[f]&&(u=Zt(n,h=>{r[f](h);})),c.cleanup=()=>{l&&l(),u&&u();};}}};function wt(t,e,n,r){let o=e;o.setAttribute&&(d(r)?t.cleanup=w(()=>{Nt(o,n,r());}):Nt(o,n,r));}function Mt(t,e,n,r){d(n)?t.cleanup=w(()=>{let o=q(n()).map(yt);t.lastNodes=Vt(e,t.lastNodes,o,r);}):q(n).forEach((o,s)=>{let c=yt(o);t.lastNodes.set(String(s),c),y(e,c,r);});}function Ne(t){var e;F("onMounted"),(e=N.ref)==null||e.addHook("mounted",t);}function _e(t){var e;F("onDestroy"),(e=N.ref)==null||e.addHook("destroy",t);}function F(t){N.ref||console.error(`"${t}" can only be called within the component function body
|
|
7
|
-
and cannot be used in asynchronous or deferred calls.`);}function
|
|
8
|
-
* @estjs/shared v0.0.
|
|
6
|
+
var rt="0.0.11";var st=t=>t!==null&&typeof t=="object";var K=Array.isArray;function B(t){return typeof t=="string"}function ot(t){return t==null}var d=t=>typeof t=="function";function q(t){return t===!1||t===null||t===void 0}function z(t){return Array.isArray(t)?t.flat():[t]}function g(t,e){return B(t)?t.indexOf(e)===0:!1}var it=t=>t.replaceAll(/[A-Z]+/g,(e,n)=>`${n>0?"-":""}${e.toLocaleLowerCase()}`);var ct=t=>t.charAt(0).toUpperCase()+t.slice(1);var Ot=Object.defineProperty,at=Object.getOwnPropertySymbols,At=Object.prototype.hasOwnProperty,jt=Object.prototype.propertyIsEnumerable,ut=(t,e,n)=>e in t?Ot(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,j=(t,e)=>{for(var n in e||(e={}))At.call(e,n)&&ut(t,n,e[n]);if(at)for(var n of at(e))jt.call(e,n)&&ut(t,n,e[n]);return t},x=t=>t!==null&&typeof t=="object",dt=Array.isArray;function xt(t){return typeof t=="string"}function Pt(t){return t===null}function $t(t){return L.call(t)==="[object Set]"}function Lt(t){return L.call(t)==="[object WeakMap]"}function Rt(t){return L.call(t)==="[object WeakSet]"}function Wt(t){return L.call(t)==="[object Map]"}var U=t=>typeof t=="function",lt=t=>["string","number","boolean","symbol","undefined"].includes(typeof t)||Pt(t);function ft(t){return t?t&&typeof t=="object"&&t.nodeType===1&&typeof t.nodeName=="string":!1}var L=Object.prototype.toString,Ht=Object.prototype.hasOwnProperty,Ft=(t,e)=>Ht.call(t,e),R=(t,e)=>t!==e&&(t===t||e===e),It=Function.prototype;function Dt(t,e){return xt(t)?t.indexOf(e)===0:!1}function P(t,e){return Array.isArray(e)?e.includes(t):U(e)?e(t):!1}function ht(t,...e){console.warn.apply(console,[`[Essor warn]: ${t}`].concat(e));}var b=null,_=null,G=new WeakMap,Z=new WeakMap,Q=new Set,J=new WeakMap,Kt=["push","pop","shift","unshift","splice","sort","reverse"];function W(t,e){if(!b&&!_)return;let n=Z.get(t);n||(n=new Map,Z.set(t,n));let r=n.get(e);r||(r=new Set,n.set(e,r)),b&&r.add(b);let o=G.get(t);o||(o=new Map,G.set(t,o));let s=o.get(e);s||(s=new Set,o.set(e,s)),_&&s.add(_);}function E(t,e){let n=Z.get(t);if(!n)return;let r=n.get(e);r&&r.forEach(s=>Q.has(s)&&s());let o=G.get(t);if(o){let s=o.get(e);s&&s.forEach(c=>c.run());}}var Y=class{constructor(t,e=!1){this._value=t,this._shallow=e;}get value(){return W(this,"_sv"),this.__triggerObject(),this._value}__triggerObject(){!lt(this._value)&&!ft(this._value)&&!this._shallow&&k(this._value);}set value(t){h(t)&&(console.warn("Signal cannot be set to another signal, use .peek() instead"),t=t.peek()),R(t,this._value)&&(this._value=t,!lt(this._value)&&!ft(this._value)&&this.__triggerObject(),E(this,"_sv"));}peek(){return this._value}};function H(t){return h(t)?t:new Y(t)}function fe(t){return new Y(t,!0)}function h(t){return t instanceof Y}var mt=class{constructor(t){this.fn=t;let e=_;_=this,this._value=this.fn(),_=e;}peek(){return this._value}run(){let t=this.fn();R(t,this._value)&&(this._value=t,E(this,"_cv"));}get value(){return W(this,"_cv"),this._value}};function Bt(t){return new mt(t)}function pt(t){return t instanceof mt}function M(t){function e(){let n=b;b=e,t(),b=n;}return Q.add(e),e(),()=>{Q.delete(e),b=null;}}function vt(t,e){return Object.entries(t).reduce((r,[o,s])=>(r[o]=P(o,e)||h(s)?s:H(s),r),{})}function qt(t,e){return t?h(t)?t.peek():dt(t)?t.map(n=>qt(n,e)):x(t)?Object.entries(t).reduce((n,[r,o])=>(P(r,e)?n[r]=o:n[r]=h(o)?o.peek():w(o)?bt(o):o,n),{}):t:{}}var gt=Symbol("useReactive");function w(t){return t&&t[gt]===!0}function zt(t){Kt.forEach(e=>{let n=Array.prototype[e];W(t,"length"),Object.defineProperty(t,e,{value(...r){let o=n.apply(this,r);return ["push","pop","shift","unshift","splice","sort","reverse"].includes(e)&&E(t,"length"),o},enumerable:!1,writable:!0,configurable:!0});});}function k(t,e){return yt(t,e,!1)}function he(t,e){return yt(t,e,!0)}function bt(t){if(!x(t)||!w(t))return t;let e=Array.isArray(t)?[]:{};for(let n in t)if(Ft(t,n)){let r=t[n];w(r)?e[n]=bt(r):h(r)?e[n]=r.peek():e[n]=r;}return e}function yt(t,e,n=!1){if(!x(t)||w(t))return t;if(J.has(t))return J.get(t);if(Array.isArray(t)&&zt(t),$t(t)||Wt(t)||Rt(t)||Lt(t))return t;let r={get(s,c,i){if(c===gt||Dt(c,"_"))return !0;let a=Reflect.get(s,c,i),l=h(a)?a.value:a;return P(c,e)?l:(W(s,c),x(l)&&!n?k(l):l)},set(s,c,i,a){if(P(c,e))return Reflect.set(s,c,i,a),!0;let l=Reflect.get(s,c,a);h(l)&&(l=l.value),h(i)&&(i=i.value);let u=Reflect.set(s,c,i,a);return R(i,l)&&E(s,c),u},deleteProperty(s,c){let i=Reflect.get(s,c),a=Reflect.deleteProperty(s,c);return i!==void 0&&E(s,c),a}},o=new Proxy(t,r);return J.set(t,o),o}function Jt(t,e,n){return Ut(t,e,n)}function Ut(t,e,n){let r;h(t)||pt(t)?r=()=>t.value:w(t)?r=()=>j({},t):dt(t)?r=()=>t.map(i=>h(i)||pt(i)?i.value:w(i)?j({},i):U(i)?i():ht("Invalid source",i)):U(t)?r=t:(ht("Invalid source type",t),r=It);let o,s=()=>{let i=r();(n!=null&&n.deep||R(i,o))&&(e&&e(i,o),o=i);},c=M(s);return n!=null&&n.immediate&&s(),c}var $=0,X=new Map;function Gt(t){let{state:e,getters:n,actions:r}=t,o=j({},e!=null?e:{}),s=k(e!=null?e:{}),c=[],i=[],l=j({state:s},{patch$(u){Object.assign(s,u),c.forEach(f=>f(s)),i.forEach(f=>f(s));},subscribe$(u){c.push(u);},unsubscribe$(u){let f=c.indexOf(u);f!==-1&&c.splice(f,1);},onAction$(u){i.push(u);},reset$(){Object.assign(s,o);}});for(let u in n){let f=n[u];f&&Jt(Bt(f.bind(s,s)),p=>{l[u]=p;});}for(let u in r){let f=r[u];f&&(l[u]=f.bind(s));}return X.set($,l),++$,l}function pe(t){return function(){return X.has($)?X.get($):Gt(t)}}var V=class S{constructor(e,n){this.template=e,this.props=n,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=vt(n,r=>g(r,"on")||g(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 r;(r=this.hooks[e])==null||r.add(n);}getContext(e){return S.context[e]}setContext(e,n){S.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);}mount(e,n){var r,o,s,c;if(!d(this.template))throw new Error("Template must be a function");if(this.isConnected)return (o=(r=this.rootNode)==null?void 0:r.mount(e,n))!=null?o:[];S.ref=this,this.rootNode=this.template(k(this.proxyProps,["children"])),S.ref=null,this.mounted=!0;let i=(c=(s=this.rootNode)==null?void 0:s.mount(e,n))!=null?c:[];return this.hooks.mounted.forEach(a=>a()),this.patchProps(this.props),i}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());}getNodeTrack(e,n){let r=this.trackMap.get(e);return r||(r={cleanup:()=>{}},this.trackMap.set(e,r)),n||r.cleanup(),r}patchProps(e){var n,r,o,s,c;for(let[i,a]of Object.entries(e))if(g(i,"on")&&((n=this.rootNode)!=null&&n.nodes)){let l=i.slice(2).toLowerCase(),u=a,f=m(this.rootNode.nodes[0],l,u);this.emitter.add(f);}else if(i==="ref")h(a)?e[i].value=(r=this.rootNode)==null?void 0:r.nodes[0]:d(a)&&e[i]((o=this.rootNode)==null?void 0:o.nodes[0]);else if(g(i,"update"))e[i]=h(a)?a.value:a;else if(i!=="children"){let l=(c=(s=this.proxyProps)[i])!=null?c:s[i]=H(a),u=this.getNodeTrack(i);u.cleanup=M(()=>{l.value=d(a)?a():a;});}this.props=e;}};V.ref=null;V.context={};var N=V;function Ne(t,e){return B(t)&&(Vt(t)&&(t=te(t),e={1:e}),t===""&&(e={0:e}),t=Zt(t)),d(t)?new N(t,e):new St(t,e)}function v(t){return t instanceof N||t instanceof St}function Zt(t){t=Yt(t);let e=document.createElement("template");return e.innerHTML=t,e}function _e(t){return t.children}var Et="area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr",Qt="a,abbr,acronym,address,applet,area,article,aside,audio,b,base,basefont,bdi,bdo,bgsound,big,blink,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,command,content,data,datalist,dd,del,details,dfn,dialog,dir,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,kbd,keygen,label,legend,li,link,listing,main,map,mark,marquee,menu,menuitem,meta,meter,nav,nobr,noframes,noscript,object,ol,optgroup,option,output,p,param,picture,plaintext,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,section,select,shadow,small,source,spacer,span,strike,strong,style,sub,summary,sup,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr,xmp";function Nt(t){if(v(t)||t instanceof Node)return t;let e=q(t)?"":String(t);return document.createTextNode(e)}function y(t,e,n=null){let r=v(n)?n.firstChild:n;v(e)?e.mount(t,r):r?r.before(e):t.append(e);}function T(t){v(t)?t.unmount():t.parentNode&&t.remove();}function kt(t,e,n){y(t,e,n),T(n);}function _t(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((r,[o,s])=>r+(s?` ${o}`:""),"").trim());return}if(e==="style"){if(typeof n=="string")t.style.cssText=n;else if(n&&typeof n=="object"){let r=n;Object.keys(r).forEach(o=>{t.style.setProperty(it(o),String(r[o]));});}return}q(n)?t.removeAttribute(e):n===!0?t.setAttribute(e,""):t instanceof HTMLInputElement?t.value=String(n):t.setAttribute(e,String(n));}function Xt(t,e){if(t instanceof HTMLInputElement)switch(t.type){case"checkbox":return m(t,"change",()=>{e(!!t.checked);});case"date":return m(t,"change",()=>{e(t.value?t.value:"");});case"file":return m(t,"change",()=>{t.files&&e(t.files);});case"number":return m(t,"input",()=>{let n=Number.parseFloat(t.value);e(Number.isNaN(n)?"":String(n));});case"radio":return m(t,"change",()=>{e(t.checked?t.value:"");});case"text":return m(t,"input",()=>{e(t.value);})}if(t instanceof HTMLSelectElement)return m(t,"change",()=>{e(t.value);});if(t instanceof HTMLTextAreaElement)return m(t,"input",()=>{e(t.value);})}var wt=Promise.resolve();function we(t){return t?wt.then(t):wt}function m(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}function Yt(t){let e=Et.split(","),n=[],r=[],o=/<\/?([\da-z-]+)([^>]*)>/gi,s=0;for(;;){let c=o.exec(t);if(!c)break;let[i,a]=c,l=i[1]==="/";if(r.push(t.slice(s,c.index)),s=c.index+i.length,l){for(;n.length>0&&n[n.length-1]!==a;){let u=n.pop();u&&r.push(`</${u}>`);}n.length>0&&n.pop();}else e.includes(a)||n.push(a);r.push(i);}for(r.push(t.slice(s));n.length>0;){let c=n.pop();c&&r.push(`</${c}>`);}return r.join("")}function Vt(t){return Qt.split(",").includes(t)}function te(t){return Et.split(",").includes(t)?`<${t}/>`:`<${t}></${t}>`}function ee(){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="",n=t.length;for(let r=0;r<8;r++)e+=t.charAt(Math.floor(Math.random()*n));return e}function ne(t,e,n,r){let o=new Map,s=Array.from(e.values()),c=s.length;if(e.size>0&&n.length===0){if(t.childNodes.length===c+(r?1:0))t.innerHTML="",r&&y(t,r);else {let u=document.createRange(),f=s[0],p=v(f)?f.firstChild:f;u.setStartBefore(p),r?u.setEndBefore(r):u.setEndAfter(t),u.deleteContents();}return s.forEach(u=>{v(u)&&u.unmount();}),o}let i=[],a=se(n),l=0;for(let[u,f]of n.entries()){let p=s[l],C=F(p,u);for(;p&&!a.has(C);)T(p),e.delete(C),p=s[++l],C=F(p,u);let et=F(f,u),D=e.get(et);if(D&&(f=re(t,D,f)),p)if(p===D)l++;else {let nt=document.createComment("");y(t,nt,p),i.push([nt,f]);}else y(t,f,r);o.set(et,f);}return i.forEach(([u,f])=>kt(t,f,u)),e.forEach((u,f)=>{u.isConnected&&!o.has(f)&&T(u);}),o}function re(t,e,n){return e===n?e:v(e)&&v(n)&&e.template===n.template?(n.inheritNode(e),n):e instanceof Text&&n instanceof Text?(e.textContent!==n.textContent&&(e.textContent=n.textContent),e):(kt(t,n,e),n)}function se(t){let e=new Map;for(let[n,r]of t.entries()){let o=F(r,n);e.set(o,r);}return e}function F(t,e){if(v(t)){let n=t.key;if(n!=null)return String(n)}return `_$${e}$`}var St=class Tt{constructor(e,n,r){this.template=e,this.props=n,this.key=r,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(){}mount(e,n){var r;if(this.parent=e,this.isConnected)return this.nodes.forEach(c=>y(e,c,n)),this.nodes;this.key=this.key||ee();let o=this.template.content.cloneNode(!0),s=o.firstChild;return (r=s==null?void 0:s.hasAttribute)!=null&&r.call(s,"_svg_")&&(s.remove(),s==null||s.childNodes.forEach(c=>{o.append(c);})),this.nodes=Array.from(o.childNodes),this.mapNodeTree(e,o),y(e,o,n),this.patchNodes(this.props),this.mounted=!0,this.nodes}unmount(){this.trackMap.forEach(e=>{var n,r;(n=e.cleanup)==null||n.call(e),(r=e.lastNodes)==null||r.forEach(o=>{e.isRoot?T(o):o instanceof Tt&&o.unmount();});}),this.trackMap.clear(),this.treeMap.clear(),this.nodes.forEach(e=>T(e)),this.nodes=[],this.mounted=!1;}mapNodeTree(e,n){let r=1;this.treeMap.set(0,e);let o=s=>{s.nodeType!==Node.DOCUMENT_FRAGMENT_NODE&&this.treeMap.set(r++,s);let c=s.firstChild;for(;c;)o(c),c=c.nextSibling;};o(n);}patchNodes(e){for(let n in e){let r=Number(n),o=this.treeMap.get(r);if(o){let s=this.props[n];this.patchNode(n,o,s,r===0);}}this.props=e;}getNodeTrack(e,n,r){var o;let s=this.trackMap.get(e);return s||(s={cleanup:()=>{}},n&&(s.lastNodes=new Map),r&&(s.isRoot=!0),this.trackMap.set(e,s)),(o=s.cleanup)==null||o.call(s),s}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,r,o){for(let s in r)if(s==="children"&&r.children)if(K(r.children))r.children.filter(Boolean).forEach((c,i)=>{var a;let[l,u]=K(c)?c:[c,null],f=ot(u)?null:(a=this.treeMap.get(u))!=null?a:null,p=`${e}:${s}:${i}`,C=this.getNodeTrack(p,!0,o);Ct(C,n,l,f);});else {let c=`${e}:${s}:0`,i=this.getNodeTrack(c,!0,o);Ct(i,n,r.children,null);}else if(s==="ref")h(r[s])?r[s].value=n:d(r[s])&&r[s](n);else if(g(s,"on")){let c=s.slice(2).toLocaleLowerCase(),i=this.getNodeTrack(`${e}:${s}`),a=r[s];i.cleanup=m(n,c,a);}else if(!g(s,"update")){let c=this.getNodeTrack(`${e}:${s}`),i=r[s],a=h(i)?i:H(i);Mt(c,n,s,a.value);let l=M(()=>{a.value=h(i)?i.value:i,Mt(c,n,s,a.value);}),u,f=`update${ct(s)}`;r[f]&&(u=Xt(n,p=>{r[f](p);})),c.cleanup=()=>{l&&l(),u&&u();};}}};function Mt(t,e,n,r){let o=e;o.setAttribute&&(d(r)?t.cleanup=M(()=>{_t(o,n,r());}):_t(o,n,r));}function Ct(t,e,n,r){d(n)?t.cleanup=M(()=>{let o=z(n()).map(Nt);t.lastNodes=ne(e,t.lastNodes,o,r);}):z(n).forEach((o,s)=>{let c=Nt(o);t.lastNodes.set(String(s),c),y(e,c,r);});}function Me(t){var e;I("onMounted"),(e=N.ref)==null||e.addHook("mounted",t);}function Ce(t){var e;I("onDestroy"),(e=N.ref)==null||e.addHook("destroy",t);}function I(t){N.ref||console.error(`"${t}" can only be called within the component function body
|
|
7
|
+
and cannot be used in asynchronous or deferred calls.`);}function Ee(t,e){var n;I("useProvide"),(n=N.ref)==null||n.setContext(t,e);}function ke(t,e){var n;return I("useInject"),((n=N.ref)==null?void 0:n.getContext(t))||e}function oe(t){return Object.entries(t).map(([e,n])=>`${e}=${JSON.stringify(escape(String(n)))}`).join(" ")}function tt(t,e){if(d(t))return t(e);let n=Array.isArray(t)?t.reduce((s,c,i)=>(s[i+1]={template:c},s),{}):t,r={},o={};if(st(n))for(let[s,c]of Object.entries(n)){let i=e[s];if(i){for(let a in i)g(a,"on")&&d(i[a])&&delete i[a];if(i.children){for(let[a,l]of i.children)r[l]||(r[l]=[]),r[l].push(a);delete i.children;}}o[s]={template:c.template,props:i};}return Object.entries(o).map(([s,{template:c,props:i}])=>{let a=c;return i&&(a+=` ${oe(i)}`),r[s]&&(a+=r[s].map(l=>tt(l,i)).join("")),a}).join("")}function Se(t,e){return tt(t,e)}function Te(t,e,n={}){e.innerHTML=tt(t,n);}globalThis&&(globalThis.__essor_version__=rt);/**
|
|
8
|
+
* @estjs/shared v0.0.11
|
|
9
9
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
10
10
|
* @license MIT
|
|
11
11
|
**/
|
|
12
12
|
/**
|
|
13
|
-
* @estjs/signal v0.0.
|
|
13
|
+
* @estjs/signal v0.0.11
|
|
14
14
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
15
15
|
* @license MIT
|
|
16
16
|
**/
|
|
17
17
|
/**
|
|
18
|
-
* @estjs/template v0.0.
|
|
18
|
+
* @estjs/template v0.0.11
|
|
19
19
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
20
20
|
* @license MIT
|
|
21
21
|
**/
|
|
22
22
|
|
|
23
|
-
export { N as ComponentNode,
|
|
23
|
+
export { N as ComponentNode, _e as Fragment, St as TemplateNode, pe as createStore, rt as essor_version, Ne as h, pt as isComputed, v as isJsxElement, w as isReactive, h as isSignal, we as nextTick, Ce as onDestroy, Me as onMount, Te as renderSSG, tt as renderTemplate, Se as renderToString, he as shallowReactive, fe as shallowSignal, vt as signalObject, Zt as template, bt as unReactive, qt as unSignal, Bt as useComputed, M as useEffect, ke as useInject, Ee as useProvide, k as useReactive, H as useSignal, Jt as useWatch };
|
|
24
24
|
//# sourceMappingURL=essor.esm.js.map
|
|
25
25
|
//# sourceMappingURL=essor.esm.js.map
|