essor 0.0.8 → 0.0.10-beta.21
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/LICENSE +20 -20
- package/dist/essor.cjs.js +50 -30
- package/dist/essor.cjs.js.map +1 -1
- package/dist/essor.d.cts +4 -2439
- package/dist/essor.d.ts +4 -2439
- package/dist/essor.dev.cjs.js +234 -486
- package/dist/essor.dev.esm.js +232 -485
- package/dist/essor.esm.js +22 -3
- package/dist/essor.esm.js.map +1 -1
- package/package.json +4 -3
- package/types/component.d.ts +0 -18
- package/types/index.d.ts +0 -3
- package/types/jsx.d.ts +0 -2182
- package/types/node.d.ts +0 -16
package/dist/essor.dev.esm.js
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* essor v0.0.10-beta.20
|
|
3
|
+
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
4
|
+
* @license MIT
|
|
5
|
+
**/
|
|
6
|
+
|
|
7
|
+
// src/version.ts
|
|
8
|
+
var essor_version = "0.0.10-beta.20";
|
|
9
|
+
|
|
10
|
+
// ../shared/dist/essor-shared.js
|
|
11
|
+
var isObject = (val) => val !== null && typeof val === "object";
|
|
12
|
+
var isArray = Array.isArray;
|
|
13
|
+
function isString(val) {
|
|
14
|
+
return typeof val === "string";
|
|
15
|
+
}
|
|
16
|
+
function isNil(x) {
|
|
17
|
+
return x === null || x === void 0;
|
|
18
|
+
}
|
|
19
|
+
var isFunction = (val) => typeof val === "function";
|
|
20
|
+
function isFalsy(x) {
|
|
21
|
+
return x === false || x === null || x === void 0;
|
|
22
|
+
}
|
|
23
|
+
function coerceArray(data) {
|
|
24
|
+
return Array.isArray(data) ? data.flat() : [data];
|
|
25
|
+
}
|
|
26
|
+
function startsWith(str, searchString) {
|
|
27
|
+
if (!isString(str)) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
return str.indexOf(searchString) === 0;
|
|
31
|
+
}
|
|
32
|
+
var kebabCase = (string) => {
|
|
33
|
+
return string.replaceAll(/[A-Z]+/g, (match, offset) => {
|
|
34
|
+
return `${offset > 0 ? "-" : ""}${match.toLocaleLowerCase()}`;
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
var capitalizeFirstLetter = (inputString) => {
|
|
38
|
+
return inputString.charAt(0).toUpperCase() + inputString.slice(1);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// ../signal/dist/signal.dev.esm.js
|
|
1
42
|
var __defProp = Object.defineProperty;
|
|
2
43
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
44
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
@@ -14,156 +55,47 @@ var __spreadValues = (a, b) => {
|
|
|
14
55
|
}
|
|
15
56
|
return a;
|
|
16
57
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// ../shared/dist/essor-shared.js
|
|
22
|
-
var isObject = (val) => val !== null && typeof val === "object";
|
|
23
|
-
var isArray = Array.isArray;
|
|
24
|
-
function isString(val) {
|
|
58
|
+
var isObject2 = (val) => val !== null && typeof val === "object";
|
|
59
|
+
var isArray2 = Array.isArray;
|
|
60
|
+
function isString2(val) {
|
|
25
61
|
return typeof val === "string";
|
|
26
62
|
}
|
|
27
63
|
function isNull(val) {
|
|
28
64
|
return val === null;
|
|
29
65
|
}
|
|
30
|
-
function
|
|
31
|
-
return
|
|
66
|
+
function isSet(val) {
|
|
67
|
+
return _toString.call(val) === "[object Set]";
|
|
32
68
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
69
|
+
function isWeakMap(val) {
|
|
70
|
+
return _toString.call(val) === "[object WeakMap]";
|
|
71
|
+
}
|
|
72
|
+
function isWeakSet(val) {
|
|
73
|
+
return _toString.call(val) === "[object WeakSet]";
|
|
36
74
|
}
|
|
75
|
+
function isMap(val) {
|
|
76
|
+
return _toString.call(val) === "[object Map]";
|
|
77
|
+
}
|
|
78
|
+
var isFunction2 = (val) => typeof val === "function";
|
|
37
79
|
var isPrimitive = (val) => ["string", "number", "boolean", "symbol", "undefined"].includes(typeof val) || isNull(val);
|
|
38
80
|
function isHTMLElement(obj) {
|
|
39
81
|
if (!obj) return false;
|
|
40
82
|
return obj && typeof obj === "object" && obj.nodeType === 1 && typeof obj.nodeName === "string";
|
|
41
83
|
}
|
|
42
|
-
|
|
43
|
-
return Array.isArray(data) ? data.flat() : [data];
|
|
44
|
-
}
|
|
84
|
+
var _toString = Object.prototype.toString;
|
|
45
85
|
var hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue);
|
|
46
|
-
var
|
|
47
|
-
function
|
|
48
|
-
if (!
|
|
86
|
+
var noop2 = Function.prototype;
|
|
87
|
+
function startsWith2(str, searchString) {
|
|
88
|
+
if (!isString2(str)) {
|
|
49
89
|
return false;
|
|
50
90
|
}
|
|
51
91
|
return str.indexOf(searchString) === 0;
|
|
52
92
|
}
|
|
53
|
-
function deepClone(obj, hash = /* @__PURE__ */ new WeakMap()) {
|
|
54
|
-
if (obj === null || typeof obj !== "object") {
|
|
55
|
-
return obj;
|
|
56
|
-
}
|
|
57
|
-
if (hash.has(obj)) {
|
|
58
|
-
return hash.get(obj);
|
|
59
|
-
}
|
|
60
|
-
if (obj instanceof Date) {
|
|
61
|
-
return new Date(obj);
|
|
62
|
-
}
|
|
63
|
-
if (obj instanceof RegExp) {
|
|
64
|
-
return new RegExp(obj);
|
|
65
|
-
}
|
|
66
|
-
if (obj instanceof Map) {
|
|
67
|
-
const mapClone = /* @__PURE__ */ new Map();
|
|
68
|
-
hash.set(obj, mapClone);
|
|
69
|
-
obj.forEach((value, key) => {
|
|
70
|
-
mapClone.set(deepClone(key, hash), deepClone(value, hash));
|
|
71
|
-
});
|
|
72
|
-
return mapClone;
|
|
73
|
-
}
|
|
74
|
-
if (obj instanceof Set) {
|
|
75
|
-
const setClone = /* @__PURE__ */ new Set();
|
|
76
|
-
hash.set(obj, setClone);
|
|
77
|
-
obj.forEach((value) => {
|
|
78
|
-
setClone.add(deepClone(value, hash));
|
|
79
|
-
});
|
|
80
|
-
return setClone;
|
|
81
|
-
}
|
|
82
|
-
const cloneObj = Array.isArray(obj) ? [] : {};
|
|
83
|
-
hash.set(obj, cloneObj);
|
|
84
|
-
const keys = Object.keys(obj);
|
|
85
|
-
for (const key of keys) {
|
|
86
|
-
cloneObj[key] = deepClone(obj[key], hash);
|
|
87
|
-
}
|
|
88
|
-
return cloneObj;
|
|
89
|
-
}
|
|
90
|
-
function deepEqual(a, b, seen = /* @__PURE__ */ new WeakMap()) {
|
|
91
|
-
if (isPrimitive(a) && isPrimitive(b)) {
|
|
92
|
-
return a === b;
|
|
93
|
-
}
|
|
94
|
-
if (a === b) {
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
if (a == null || b == null || typeof a !== "object" || typeof b !== "object") {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
if (a.constructor !== b.constructor) {
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
if (seen.has(a)) {
|
|
104
|
-
return seen.get(a) === b;
|
|
105
|
-
}
|
|
106
|
-
seen.set(a, b);
|
|
107
|
-
if (Array.isArray(a)) {
|
|
108
|
-
if (a.length !== b.length) {
|
|
109
|
-
return false;
|
|
110
|
-
}
|
|
111
|
-
for (const [i, element] of a.entries()) {
|
|
112
|
-
if (!deepEqual(element, b[i], seen)) {
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return true;
|
|
117
|
-
}
|
|
118
|
-
if (a instanceof Map) {
|
|
119
|
-
if (a.size !== b.size) {
|
|
120
|
-
return false;
|
|
121
|
-
}
|
|
122
|
-
for (const [key, value] of a) {
|
|
123
|
-
if (!b.has(key) || !deepEqual(value, b.get(key), seen)) {
|
|
124
|
-
return false;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
if (a instanceof Set) {
|
|
130
|
-
if (a.size !== b.size) {
|
|
131
|
-
return false;
|
|
132
|
-
}
|
|
133
|
-
const arrA = Array.from(a).sort();
|
|
134
|
-
const arrB = Array.from(b).sort();
|
|
135
|
-
for (const [i, element] of arrA.entries()) {
|
|
136
|
-
if (!deepEqual(element, arrB[i], seen)) {
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return true;
|
|
141
|
-
}
|
|
142
|
-
const keysA = Object.keys(a);
|
|
143
|
-
const keysB = new Set(Object.keys(b));
|
|
144
|
-
if (keysA.length !== keysB.size) {
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
for (const key of keysA) {
|
|
148
|
-
if (!keysB.has(key) || !deepEqual(a[key], b[key], seen)) {
|
|
149
|
-
return false;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return true;
|
|
153
|
-
}
|
|
154
93
|
function isExclude(key, exclude) {
|
|
155
|
-
return Array.isArray(exclude) ? exclude.includes(key) :
|
|
94
|
+
return Array.isArray(exclude) ? exclude.includes(key) : isFunction2(exclude) ? exclude(key) : false;
|
|
95
|
+
}
|
|
96
|
+
function warn(msg, ...args) {
|
|
97
|
+
console.warn.apply(console, [`[Essor warn]: ${msg}`].concat(args));
|
|
156
98
|
}
|
|
157
|
-
var kebabCase = (string) => {
|
|
158
|
-
return string.replaceAll(/[A-Z]+/g, (match, offset) => {
|
|
159
|
-
return `${offset > 0 ? "-" : ""}${match.toLocaleLowerCase()}`;
|
|
160
|
-
});
|
|
161
|
-
};
|
|
162
|
-
var capitalizeFirstLetter = (inputString) => {
|
|
163
|
-
return inputString.charAt(0).toUpperCase() + inputString.slice(1);
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
// src/signal/signal.ts
|
|
167
99
|
var activeEffect = null;
|
|
168
100
|
var activeComputed = null;
|
|
169
101
|
var computedMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -214,32 +146,30 @@ function trigger(target, key) {
|
|
|
214
146
|
}
|
|
215
147
|
}
|
|
216
148
|
var Signal = class {
|
|
217
|
-
constructor(value) {
|
|
149
|
+
constructor(value, shallow = false) {
|
|
218
150
|
this._value = value;
|
|
151
|
+
this._shallow = shallow;
|
|
219
152
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
return this._value;
|
|
224
|
-
}
|
|
225
|
-
toString() {
|
|
226
|
-
track(this, "_sv");
|
|
227
|
-
this.__triggerObject();
|
|
228
|
-
return String(this._value);
|
|
229
|
-
}
|
|
230
|
-
toJSON() {
|
|
231
|
-
return this._value;
|
|
232
|
-
}
|
|
153
|
+
/**
|
|
154
|
+
* Get the current value of the Signal and track its usage.
|
|
155
|
+
*/
|
|
233
156
|
get value() {
|
|
234
157
|
track(this, "_sv");
|
|
235
158
|
this.__triggerObject();
|
|
236
159
|
return this._value;
|
|
237
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Trigger reactivity for non-primitive and non-HTMLElement values.
|
|
163
|
+
* Recursively applies reactivity to nested objects.
|
|
164
|
+
*/
|
|
238
165
|
__triggerObject() {
|
|
239
|
-
if (!isPrimitive(this._value) && !isHTMLElement(this._value)) {
|
|
166
|
+
if (!isPrimitive(this._value) && !isHTMLElement(this._value) && !this._shallow) {
|
|
240
167
|
useReactive(this._value);
|
|
241
168
|
}
|
|
242
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* Set a new value to the Signal and trigger updates if the value has changed.
|
|
172
|
+
*/
|
|
243
173
|
set value(newValue) {
|
|
244
174
|
if (isSignal(newValue)) {
|
|
245
175
|
console.warn("Signal cannot be set to another signal, use .peek() instead");
|
|
@@ -253,12 +183,12 @@ var Signal = class {
|
|
|
253
183
|
trigger(this, "_sv");
|
|
254
184
|
}
|
|
255
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Peek at the current value of the Signal without tracking it.
|
|
188
|
+
*/
|
|
256
189
|
peek() {
|
|
257
190
|
return this._value;
|
|
258
191
|
}
|
|
259
|
-
update() {
|
|
260
|
-
trigger(this, "_sv");
|
|
261
|
-
}
|
|
262
192
|
};
|
|
263
193
|
function useSignal(value) {
|
|
264
194
|
if (isSignal(value)) {
|
|
@@ -266,6 +196,9 @@ function useSignal(value) {
|
|
|
266
196
|
}
|
|
267
197
|
return new Signal(value);
|
|
268
198
|
}
|
|
199
|
+
function shallowSignal(value) {
|
|
200
|
+
return new Signal(value, true);
|
|
201
|
+
}
|
|
269
202
|
function isSignal(value) {
|
|
270
203
|
return value instanceof Signal;
|
|
271
204
|
}
|
|
@@ -277,9 +210,15 @@ var Computed = class {
|
|
|
277
210
|
this._value = this.fn();
|
|
278
211
|
activeComputed = prev;
|
|
279
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Get the current computed value without tracking it.
|
|
215
|
+
*/
|
|
280
216
|
peek() {
|
|
281
217
|
return this._value;
|
|
282
218
|
}
|
|
219
|
+
/**
|
|
220
|
+
* Run the computed function and update the value if it has changed.
|
|
221
|
+
*/
|
|
283
222
|
run() {
|
|
284
223
|
const newValue = this.fn();
|
|
285
224
|
if (hasChanged(newValue, this._value)) {
|
|
@@ -287,6 +226,9 @@ var Computed = class {
|
|
|
287
226
|
trigger(this, "_cv");
|
|
288
227
|
}
|
|
289
228
|
}
|
|
229
|
+
/**
|
|
230
|
+
* Get the current computed value and track its usage.
|
|
231
|
+
*/
|
|
290
232
|
get value() {
|
|
291
233
|
track(this, "_cv");
|
|
292
234
|
return this._value;
|
|
@@ -324,15 +266,15 @@ function unSignal(signal, exclude) {
|
|
|
324
266
|
if (isSignal(signal)) {
|
|
325
267
|
return signal.peek();
|
|
326
268
|
}
|
|
327
|
-
if (
|
|
269
|
+
if (isArray2(signal)) {
|
|
328
270
|
return signal.map((value) => unSignal(value, exclude));
|
|
329
271
|
}
|
|
330
|
-
if (
|
|
272
|
+
if (isObject2(signal)) {
|
|
331
273
|
return Object.entries(signal).reduce((acc, [key, value]) => {
|
|
332
274
|
if (isExclude(key, exclude)) {
|
|
333
275
|
acc[key] = value;
|
|
334
276
|
} else {
|
|
335
|
-
acc[key] = isSignal(value) ? value.peek() : value;
|
|
277
|
+
acc[key] = isSignal(value) ? value.peek() : isReactive(value) ? unReactive(value) : value;
|
|
336
278
|
}
|
|
337
279
|
return acc;
|
|
338
280
|
}, {});
|
|
@@ -349,8 +291,32 @@ function unReactive(obj) {
|
|
|
349
291
|
}
|
|
350
292
|
return __spreadValues({}, obj);
|
|
351
293
|
}
|
|
294
|
+
function createArrayProxy(initialValue) {
|
|
295
|
+
arrayMethods.forEach((method) => {
|
|
296
|
+
const originalMethod = Array.prototype[method];
|
|
297
|
+
track(initialValue, "length");
|
|
298
|
+
Object.defineProperty(initialValue, method, {
|
|
299
|
+
value(...args) {
|
|
300
|
+
const result = originalMethod.apply(this, args);
|
|
301
|
+
if (["push", "pop", "shift", "unshift", "splice", "sort", "reverse"].includes(method)) {
|
|
302
|
+
trigger(initialValue, "length");
|
|
303
|
+
}
|
|
304
|
+
return result;
|
|
305
|
+
},
|
|
306
|
+
enumerable: false,
|
|
307
|
+
writable: true,
|
|
308
|
+
configurable: true
|
|
309
|
+
});
|
|
310
|
+
});
|
|
311
|
+
}
|
|
352
312
|
function useReactive(initialValue, exclude) {
|
|
353
|
-
|
|
313
|
+
return reactive(initialValue, exclude, false);
|
|
314
|
+
}
|
|
315
|
+
function shallowReactive(initialValue, exclude) {
|
|
316
|
+
return reactive(initialValue, exclude, true);
|
|
317
|
+
}
|
|
318
|
+
function reactive(initialValue, exclude, shallow = false) {
|
|
319
|
+
if (!isObject2(initialValue)) {
|
|
354
320
|
return initialValue;
|
|
355
321
|
}
|
|
356
322
|
if (isReactive(initialValue)) {
|
|
@@ -360,33 +326,21 @@ function useReactive(initialValue, exclude) {
|
|
|
360
326
|
return reactiveMap.get(initialValue);
|
|
361
327
|
}
|
|
362
328
|
if (Array.isArray(initialValue)) {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
[method]: {
|
|
368
|
-
value(...args) {
|
|
369
|
-
const result = originalMethod.apply(this, args);
|
|
370
|
-
trigger(initialValue, "length");
|
|
371
|
-
return result;
|
|
372
|
-
},
|
|
373
|
-
enumerable: false,
|
|
374
|
-
configurable: true,
|
|
375
|
-
writable: true
|
|
376
|
-
}
|
|
377
|
-
});
|
|
378
|
-
});
|
|
329
|
+
createArrayProxy(initialValue);
|
|
330
|
+
}
|
|
331
|
+
if (isSet(initialValue) || isMap(initialValue) || isWeakSet(initialValue) || isWeakMap(initialValue)) {
|
|
332
|
+
return initialValue;
|
|
379
333
|
}
|
|
380
334
|
const handler = {
|
|
381
335
|
get(target, key, receiver) {
|
|
382
|
-
if (key === REACTIVE_MARKER ||
|
|
336
|
+
if (key === REACTIVE_MARKER || startsWith2(key, "_")) return true;
|
|
383
337
|
const getValue = Reflect.get(target, key, receiver);
|
|
384
338
|
const value = isSignal(getValue) ? getValue.value : getValue;
|
|
385
339
|
if (isExclude(key, exclude)) {
|
|
386
340
|
return value;
|
|
387
341
|
}
|
|
388
342
|
track(target, key);
|
|
389
|
-
if (
|
|
343
|
+
if (isObject2(value) && !shallow) {
|
|
390
344
|
return useReactive(value);
|
|
391
345
|
}
|
|
392
346
|
return value;
|
|
@@ -422,46 +376,34 @@ function useReactive(initialValue, exclude) {
|
|
|
422
376
|
reactiveMap.set(initialValue, proxy);
|
|
423
377
|
return proxy;
|
|
424
378
|
}
|
|
425
|
-
|
|
426
|
-
// src/warning.ts
|
|
427
|
-
function warn(msg, ...args) {
|
|
428
|
-
console.warn.apply(console, [`[Essor warn]: ${msg}`].concat(args));
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
// src/signal/watch.ts
|
|
432
379
|
function useWatch(source, cb, options) {
|
|
433
380
|
return doWatch(source, cb, options);
|
|
434
381
|
}
|
|
435
382
|
function doWatch(source, cb, options) {
|
|
436
383
|
let getter;
|
|
437
|
-
const deep = options == null ? void 0 : options.deep;
|
|
438
384
|
if (isSignal(source) || isComputed(source)) {
|
|
439
385
|
getter = () => source.value;
|
|
440
386
|
} else if (isReactive(source)) {
|
|
441
387
|
getter = () => __spreadValues({}, source);
|
|
442
|
-
} else if (
|
|
388
|
+
} else if (isArray2(source)) {
|
|
443
389
|
getter = () => source.map((s) => {
|
|
444
390
|
if (isSignal(s) || isComputed(s)) return s.value;
|
|
445
391
|
if (isReactive(s)) return __spreadValues({}, s);
|
|
446
|
-
if (
|
|
392
|
+
if (isFunction2(s)) return s();
|
|
447
393
|
return warn("Invalid source", s);
|
|
448
394
|
});
|
|
449
|
-
} else if (
|
|
395
|
+
} else if (isFunction2(source)) {
|
|
450
396
|
getter = source;
|
|
451
397
|
} else {
|
|
452
398
|
warn("Invalid source type", source);
|
|
453
|
-
getter =
|
|
454
|
-
}
|
|
455
|
-
if (cb && deep) {
|
|
456
|
-
const baseGetter = getter;
|
|
457
|
-
getter = () => traverse(baseGetter());
|
|
399
|
+
getter = noop2;
|
|
458
400
|
}
|
|
459
401
|
let oldValue;
|
|
460
402
|
const effectFn = () => {
|
|
461
|
-
const newValue =
|
|
462
|
-
if (
|
|
403
|
+
const newValue = getter();
|
|
404
|
+
if ((options == null ? void 0 : options.deep) || hasChanged(newValue, oldValue)) {
|
|
463
405
|
cb && cb(newValue, oldValue);
|
|
464
|
-
oldValue =
|
|
406
|
+
oldValue = newValue;
|
|
465
407
|
}
|
|
466
408
|
};
|
|
467
409
|
const stop = useEffect(effectFn);
|
|
@@ -470,35 +412,12 @@ function doWatch(source, cb, options) {
|
|
|
470
412
|
}
|
|
471
413
|
return stop;
|
|
472
414
|
}
|
|
473
|
-
function traverse(value, seen = /* @__PURE__ */ new Set()) {
|
|
474
|
-
if (!isObject(value) || seen.has(value)) return value;
|
|
475
|
-
seen.add(value);
|
|
476
|
-
if (isArray(value)) {
|
|
477
|
-
value.forEach((item) => traverse(item, seen));
|
|
478
|
-
} else if (value instanceof Map) {
|
|
479
|
-
value.forEach((v, k) => {
|
|
480
|
-
traverse(k, seen);
|
|
481
|
-
traverse(v, seen);
|
|
482
|
-
});
|
|
483
|
-
} else if (value instanceof Set) {
|
|
484
|
-
value.forEach((v) => traverse(v, seen));
|
|
485
|
-
} else {
|
|
486
|
-
Object.keys(value).forEach((key) => {
|
|
487
|
-
traverse(value[key], seen);
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
return value;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
// src/signal/store.ts
|
|
494
415
|
var _id = 0;
|
|
495
416
|
var StoreMap = /* @__PURE__ */ new Map();
|
|
496
417
|
function createOptionsStore(options) {
|
|
497
418
|
const { state, getters, actions } = options;
|
|
498
419
|
const initState = __spreadValues({}, state != null ? state : {});
|
|
499
|
-
const reactiveState = useReactive(state != null ? state : {}
|
|
500
|
-
return isFunction(val);
|
|
501
|
-
});
|
|
420
|
+
const reactiveState = useReactive(state != null ? state : {});
|
|
502
421
|
const subscriptions = [];
|
|
503
422
|
const actionCallbacks = [];
|
|
504
423
|
const default_actions = {
|
|
@@ -529,7 +448,9 @@ function createOptionsStore(options) {
|
|
|
529
448
|
for (const key in getters) {
|
|
530
449
|
const getter = getters[key];
|
|
531
450
|
if (getter) {
|
|
532
|
-
|
|
451
|
+
useWatch(useComputed(getter.bind(reactiveState, reactiveState)), (value) => {
|
|
452
|
+
store[key] = value;
|
|
453
|
+
});
|
|
533
454
|
}
|
|
534
455
|
}
|
|
535
456
|
for (const key in actions) {
|
|
@@ -551,8 +472,8 @@ function createStore(options) {
|
|
|
551
472
|
};
|
|
552
473
|
}
|
|
553
474
|
|
|
554
|
-
//
|
|
555
|
-
var _ComponentNode = class
|
|
475
|
+
// ../template/dist/template.dev.esm.js
|
|
476
|
+
var _ComponentNode = class _ComponentNode2 {
|
|
556
477
|
constructor(template2, props) {
|
|
557
478
|
this.template = template2;
|
|
558
479
|
this.props = props;
|
|
@@ -588,10 +509,10 @@ var _ComponentNode = class _ComponentNode {
|
|
|
588
509
|
(_a = this.hooks[hook]) == null ? void 0 : _a.add(cb);
|
|
589
510
|
}
|
|
590
511
|
getContext(context) {
|
|
591
|
-
return
|
|
512
|
+
return _ComponentNode2.context[context];
|
|
592
513
|
}
|
|
593
514
|
setContext(context, value) {
|
|
594
|
-
|
|
515
|
+
_ComponentNode2.context[context] = value;
|
|
595
516
|
}
|
|
596
517
|
inheritNode(node) {
|
|
597
518
|
this.context = node.context;
|
|
@@ -603,17 +524,6 @@ var _ComponentNode = class _ComponentNode {
|
|
|
603
524
|
this.props = node.props;
|
|
604
525
|
this.patchProps(props);
|
|
605
526
|
}
|
|
606
|
-
unmount() {
|
|
607
|
-
var _a;
|
|
608
|
-
this.hooks.destroy.forEach((handler) => handler());
|
|
609
|
-
Object.values(this.hooks).forEach((set) => set.clear());
|
|
610
|
-
(_a = this.rootNode) == null ? void 0 : _a.unmount();
|
|
611
|
-
this.rootNode = null;
|
|
612
|
-
this.proxyProps = {};
|
|
613
|
-
this.mounted = false;
|
|
614
|
-
this.emitter.forEach((emitter) => emitter());
|
|
615
|
-
_ComponentNode.context = {};
|
|
616
|
-
}
|
|
617
527
|
mount(parent, before) {
|
|
618
528
|
var _a, _b, _c, _d;
|
|
619
529
|
if (!isFunction(this.template)) {
|
|
@@ -622,15 +532,25 @@ var _ComponentNode = class _ComponentNode {
|
|
|
622
532
|
if (this.isConnected) {
|
|
623
533
|
return (_b = (_a = this.rootNode) == null ? void 0 : _a.mount(parent, before)) != null ? _b : [];
|
|
624
534
|
}
|
|
625
|
-
|
|
535
|
+
_ComponentNode2.ref = this;
|
|
626
536
|
this.rootNode = this.template(useReactive(this.proxyProps, ["children"]));
|
|
627
|
-
|
|
537
|
+
_ComponentNode2.ref = null;
|
|
628
538
|
this.mounted = true;
|
|
629
539
|
const mountedNode = (_d = (_c = this.rootNode) == null ? void 0 : _c.mount(parent, before)) != null ? _d : [];
|
|
630
540
|
this.hooks.mounted.forEach((handler) => handler());
|
|
631
541
|
this.patchProps(this.props);
|
|
632
542
|
return mountedNode;
|
|
633
543
|
}
|
|
544
|
+
unmount() {
|
|
545
|
+
var _a;
|
|
546
|
+
this.hooks.destroy.forEach((handler) => handler());
|
|
547
|
+
Object.values(this.hooks).forEach((set) => set.clear());
|
|
548
|
+
(_a = this.rootNode) == null ? void 0 : _a.unmount();
|
|
549
|
+
this.rootNode = null;
|
|
550
|
+
this.proxyProps = {};
|
|
551
|
+
this.mounted = false;
|
|
552
|
+
this.emitter.forEach((emitter) => emitter());
|
|
553
|
+
}
|
|
634
554
|
getNodeTrack(trackKey, suppressCleanupCall) {
|
|
635
555
|
let track2 = this.trackMap.get(trackKey);
|
|
636
556
|
if (!track2) {
|
|
@@ -673,8 +593,6 @@ var _ComponentNode = class _ComponentNode {
|
|
|
673
593
|
_ComponentNode.ref = null;
|
|
674
594
|
_ComponentNode.context = {};
|
|
675
595
|
var ComponentNode = _ComponentNode;
|
|
676
|
-
|
|
677
|
-
// src/template/template.ts
|
|
678
596
|
function h(_template, props) {
|
|
679
597
|
if (isString(_template)) {
|
|
680
598
|
if (isHtmlTagName(_template)) {
|
|
@@ -704,8 +622,8 @@ function template(html) {
|
|
|
704
622
|
function Fragment(props) {
|
|
705
623
|
return props.children;
|
|
706
624
|
}
|
|
707
|
-
|
|
708
|
-
|
|
625
|
+
var selfClosingTags = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
|
|
626
|
+
var htmlTags = "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";
|
|
709
627
|
function coerceNode(data) {
|
|
710
628
|
if (isJsxElement(data) || data instanceof Node) {
|
|
711
629
|
return data;
|
|
@@ -764,43 +682,43 @@ function setAttribute(element, attr, value) {
|
|
|
764
682
|
} else if (value === true) {
|
|
765
683
|
element.setAttribute(attr, "");
|
|
766
684
|
} else {
|
|
767
|
-
element
|
|
685
|
+
if (element instanceof HTMLInputElement) {
|
|
686
|
+
element.value = String(value);
|
|
687
|
+
} else {
|
|
688
|
+
element.setAttribute(attr, String(value));
|
|
689
|
+
}
|
|
768
690
|
}
|
|
769
691
|
}
|
|
770
692
|
function binNode(node, setter) {
|
|
771
693
|
if (node instanceof HTMLInputElement) {
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
if (node.type === "text") {
|
|
801
|
-
return addEventListener(node, "input", () => {
|
|
802
|
-
setter(node.value);
|
|
803
|
-
});
|
|
694
|
+
switch (node.type) {
|
|
695
|
+
case "checkbox":
|
|
696
|
+
return addEventListener(node, "change", () => {
|
|
697
|
+
setter(Boolean(node.checked));
|
|
698
|
+
});
|
|
699
|
+
case "date":
|
|
700
|
+
return addEventListener(node, "change", () => {
|
|
701
|
+
setter(node.value ? node.value : "");
|
|
702
|
+
});
|
|
703
|
+
case "file":
|
|
704
|
+
return addEventListener(node, "change", () => {
|
|
705
|
+
if (node.files) {
|
|
706
|
+
setter(node.files);
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
case "number":
|
|
710
|
+
return addEventListener(node, "input", () => {
|
|
711
|
+
const value = Number.parseFloat(node.value);
|
|
712
|
+
setter(Number.isNaN(value) ? "" : String(value));
|
|
713
|
+
});
|
|
714
|
+
case "radio":
|
|
715
|
+
return addEventListener(node, "change", () => {
|
|
716
|
+
setter(node.checked ? node.value : "");
|
|
717
|
+
});
|
|
718
|
+
case "text":
|
|
719
|
+
return addEventListener(node, "input", () => {
|
|
720
|
+
setter(node.value);
|
|
721
|
+
});
|
|
804
722
|
}
|
|
805
723
|
}
|
|
806
724
|
if (node instanceof HTMLSelectElement) {
|
|
@@ -822,164 +740,8 @@ function addEventListener(node, eventName, handler) {
|
|
|
822
740
|
node.addEventListener(eventName, handler);
|
|
823
741
|
return () => node.removeEventListener(eventName, handler);
|
|
824
742
|
}
|
|
825
|
-
var selfClosingTags = [
|
|
826
|
-
"area",
|
|
827
|
-
"base",
|
|
828
|
-
"br",
|
|
829
|
-
"col",
|
|
830
|
-
"embed",
|
|
831
|
-
"hr",
|
|
832
|
-
"img",
|
|
833
|
-
"input",
|
|
834
|
-
"link",
|
|
835
|
-
"meta",
|
|
836
|
-
"param",
|
|
837
|
-
"source",
|
|
838
|
-
"track",
|
|
839
|
-
"wbr"
|
|
840
|
-
];
|
|
841
|
-
var htmlTags = [
|
|
842
|
-
"a",
|
|
843
|
-
"abbr",
|
|
844
|
-
"acronym",
|
|
845
|
-
"address",
|
|
846
|
-
"applet",
|
|
847
|
-
"area",
|
|
848
|
-
"article",
|
|
849
|
-
"aside",
|
|
850
|
-
"audio",
|
|
851
|
-
"b",
|
|
852
|
-
"base",
|
|
853
|
-
"basefont",
|
|
854
|
-
"bdi",
|
|
855
|
-
"bdo",
|
|
856
|
-
"bgsound",
|
|
857
|
-
"big",
|
|
858
|
-
"blink",
|
|
859
|
-
"blockquote",
|
|
860
|
-
"body",
|
|
861
|
-
"br",
|
|
862
|
-
"button",
|
|
863
|
-
"canvas",
|
|
864
|
-
"caption",
|
|
865
|
-
"center",
|
|
866
|
-
"cite",
|
|
867
|
-
"code",
|
|
868
|
-
"col",
|
|
869
|
-
"colgroup",
|
|
870
|
-
"command",
|
|
871
|
-
"content",
|
|
872
|
-
"data",
|
|
873
|
-
"datalist",
|
|
874
|
-
"dd",
|
|
875
|
-
"del",
|
|
876
|
-
"details",
|
|
877
|
-
"dfn",
|
|
878
|
-
"dialog",
|
|
879
|
-
"dir",
|
|
880
|
-
"div",
|
|
881
|
-
"dl",
|
|
882
|
-
"dt",
|
|
883
|
-
"em",
|
|
884
|
-
"embed",
|
|
885
|
-
"fieldset",
|
|
886
|
-
"figcaption",
|
|
887
|
-
"figure",
|
|
888
|
-
"font",
|
|
889
|
-
"footer",
|
|
890
|
-
"form",
|
|
891
|
-
"frame",
|
|
892
|
-
"frameset",
|
|
893
|
-
"h1",
|
|
894
|
-
"h2",
|
|
895
|
-
"h3",
|
|
896
|
-
"h4",
|
|
897
|
-
"h5",
|
|
898
|
-
"h6",
|
|
899
|
-
"head",
|
|
900
|
-
"header",
|
|
901
|
-
"hgroup",
|
|
902
|
-
"hr",
|
|
903
|
-
"html",
|
|
904
|
-
"i",
|
|
905
|
-
"iframe",
|
|
906
|
-
"image",
|
|
907
|
-
"img",
|
|
908
|
-
"input",
|
|
909
|
-
"ins",
|
|
910
|
-
"kbd",
|
|
911
|
-
"keygen",
|
|
912
|
-
"label",
|
|
913
|
-
"legend",
|
|
914
|
-
"li",
|
|
915
|
-
"link",
|
|
916
|
-
"listing",
|
|
917
|
-
"main",
|
|
918
|
-
"map",
|
|
919
|
-
"mark",
|
|
920
|
-
"marquee",
|
|
921
|
-
"menu",
|
|
922
|
-
"menuitem",
|
|
923
|
-
"meta",
|
|
924
|
-
"meter",
|
|
925
|
-
"nav",
|
|
926
|
-
"nobr",
|
|
927
|
-
"noframes",
|
|
928
|
-
"noscript",
|
|
929
|
-
"object",
|
|
930
|
-
"ol",
|
|
931
|
-
"optgroup",
|
|
932
|
-
"option",
|
|
933
|
-
"output",
|
|
934
|
-
"p",
|
|
935
|
-
"param",
|
|
936
|
-
"picture",
|
|
937
|
-
"plaintext",
|
|
938
|
-
"pre",
|
|
939
|
-
"progress",
|
|
940
|
-
"q",
|
|
941
|
-
"rb",
|
|
942
|
-
"rp",
|
|
943
|
-
"rt",
|
|
944
|
-
"rtc",
|
|
945
|
-
"ruby",
|
|
946
|
-
"s",
|
|
947
|
-
"samp",
|
|
948
|
-
"script",
|
|
949
|
-
"section",
|
|
950
|
-
"select",
|
|
951
|
-
"shadow",
|
|
952
|
-
"small",
|
|
953
|
-
"source",
|
|
954
|
-
"spacer",
|
|
955
|
-
"span",
|
|
956
|
-
"strike",
|
|
957
|
-
"strong",
|
|
958
|
-
"style",
|
|
959
|
-
"sub",
|
|
960
|
-
"summary",
|
|
961
|
-
"sup",
|
|
962
|
-
"table",
|
|
963
|
-
"tbody",
|
|
964
|
-
"td",
|
|
965
|
-
"template",
|
|
966
|
-
"textarea",
|
|
967
|
-
"tfoot",
|
|
968
|
-
"th",
|
|
969
|
-
"thead",
|
|
970
|
-
"time",
|
|
971
|
-
"title",
|
|
972
|
-
"tr",
|
|
973
|
-
"track",
|
|
974
|
-
"tt",
|
|
975
|
-
"u",
|
|
976
|
-
"ul",
|
|
977
|
-
"var",
|
|
978
|
-
"video",
|
|
979
|
-
"wbr",
|
|
980
|
-
"xmp"
|
|
981
|
-
];
|
|
982
743
|
function closeHtmlTags(input) {
|
|
744
|
+
const selfClosingTagList = selfClosingTags.split(",");
|
|
983
745
|
const tagStack = [];
|
|
984
746
|
const output = [];
|
|
985
747
|
const tagPattern = /<\/?([\da-z-]+)([^>]*)>/gi;
|
|
@@ -987,7 +749,7 @@ function closeHtmlTags(input) {
|
|
|
987
749
|
while (true) {
|
|
988
750
|
const match = tagPattern.exec(input);
|
|
989
751
|
if (!match) break;
|
|
990
|
-
const [fullMatch, tagName
|
|
752
|
+
const [fullMatch, tagName] = match;
|
|
991
753
|
const isEndTag = fullMatch[1] === "/";
|
|
992
754
|
output.push(input.slice(lastIndex, match.index));
|
|
993
755
|
lastIndex = match.index + fullMatch.length;
|
|
@@ -1000,16 +762,11 @@ function closeHtmlTags(input) {
|
|
|
1000
762
|
}
|
|
1001
763
|
if (tagStack.length > 0) {
|
|
1002
764
|
tagStack.pop();
|
|
1003
|
-
output.push(fullMatch);
|
|
1004
|
-
}
|
|
1005
|
-
} else {
|
|
1006
|
-
if (selfClosingTags.includes(tagName)) {
|
|
1007
|
-
output.push(fullMatch);
|
|
1008
|
-
} else {
|
|
1009
|
-
tagStack.push(tagName);
|
|
1010
|
-
output.push(`<${tagName}${attributes}>`);
|
|
1011
765
|
}
|
|
766
|
+
} else if (!selfClosingTagList.includes(tagName)) {
|
|
767
|
+
tagStack.push(tagName);
|
|
1012
768
|
}
|
|
769
|
+
output.push(fullMatch);
|
|
1013
770
|
}
|
|
1014
771
|
output.push(input.slice(lastIndex));
|
|
1015
772
|
while (tagStack.length > 0) {
|
|
@@ -1020,18 +777,18 @@ function closeHtmlTags(input) {
|
|
|
1020
777
|
}
|
|
1021
778
|
return output.join("");
|
|
1022
779
|
}
|
|
1023
|
-
function isHtmlTagName(
|
|
1024
|
-
|
|
780
|
+
function isHtmlTagName(tagName) {
|
|
781
|
+
const htmlTagsList = htmlTags.split(",");
|
|
782
|
+
return htmlTagsList.includes(tagName);
|
|
1025
783
|
}
|
|
1026
|
-
function convertToHtmlTag(
|
|
1027
|
-
|
|
1028
|
-
|
|
784
|
+
function convertToHtmlTag(tagName) {
|
|
785
|
+
const selfClosingTagList = selfClosingTags.split(",");
|
|
786
|
+
if (selfClosingTagList.includes(tagName)) {
|
|
787
|
+
return `<${tagName}/>`;
|
|
1029
788
|
} else {
|
|
1030
|
-
return `<${
|
|
789
|
+
return `<${tagName}></${tagName}>`;
|
|
1031
790
|
}
|
|
1032
791
|
}
|
|
1033
|
-
|
|
1034
|
-
// src/template/patch.ts
|
|
1035
792
|
function patchChildren(parent, childrenMap, nextChildren, before) {
|
|
1036
793
|
const result = /* @__PURE__ */ new Map();
|
|
1037
794
|
const children = Array.from(childrenMap.values());
|
|
@@ -1129,8 +886,6 @@ function getKey(node, index) {
|
|
|
1129
886
|
const result = id === "" ? void 0 : id;
|
|
1130
887
|
return result != null ? result : `_$${index}$`;
|
|
1131
888
|
}
|
|
1132
|
-
|
|
1133
|
-
// src/template/template-node.ts
|
|
1134
889
|
var TemplateNode = class _TemplateNode {
|
|
1135
890
|
constructor(template2, props) {
|
|
1136
891
|
this.template = template2;
|
|
@@ -1324,8 +1079,6 @@ function patchChild(track2, parent, child, before) {
|
|
|
1324
1079
|
});
|
|
1325
1080
|
}
|
|
1326
1081
|
}
|
|
1327
|
-
|
|
1328
|
-
// src/template/hooks.ts
|
|
1329
1082
|
function onMount(cb) {
|
|
1330
1083
|
var _a;
|
|
1331
1084
|
throwIfOutsideComponent("onMounted");
|
|
@@ -1354,42 +1107,21 @@ function useInject(key, defaultValue) {
|
|
|
1354
1107
|
throwIfOutsideComponent("useInject");
|
|
1355
1108
|
return ((_a = ComponentNode.ref) == null ? void 0 : _a.getContext(key)) || defaultValue;
|
|
1356
1109
|
}
|
|
1357
|
-
function
|
|
1358
|
-
let refValue = null;
|
|
1359
|
-
return new Proxy({}, {
|
|
1360
|
-
get(target, key) {
|
|
1361
|
-
if (key === "__is_ref") {
|
|
1362
|
-
return true;
|
|
1363
|
-
}
|
|
1364
|
-
return refValue;
|
|
1365
|
-
},
|
|
1366
|
-
set(target, prop, value) {
|
|
1367
|
-
if (prop === "current") {
|
|
1368
|
-
refValue = value;
|
|
1369
|
-
return true;
|
|
1370
|
-
}
|
|
1371
|
-
refValue = value;
|
|
1372
|
-
return true;
|
|
1373
|
-
}
|
|
1374
|
-
});
|
|
1375
|
-
}
|
|
1376
|
-
|
|
1377
|
-
// src/server/index.ts
|
|
1378
|
-
function jsonToAttrs(json) {
|
|
1110
|
+
function convertJsonToAttributes(json) {
|
|
1379
1111
|
return Object.entries(json).map(([key, value]) => `${key}=${JSON.stringify(escape(String(value)))}`).join(" ");
|
|
1380
1112
|
}
|
|
1381
1113
|
function renderTemplate(template2, props) {
|
|
1382
1114
|
if (isFunction(template2)) {
|
|
1383
1115
|
return template2(props);
|
|
1384
1116
|
}
|
|
1385
|
-
const
|
|
1117
|
+
const templateCollection = Array.isArray(template2) ? template2.reduce((acc, tmpl, index) => {
|
|
1386
1118
|
acc[index + 1] = { template: tmpl };
|
|
1387
1119
|
return acc;
|
|
1388
1120
|
}, {}) : template2;
|
|
1389
|
-
const
|
|
1390
|
-
const
|
|
1391
|
-
if (isObject(
|
|
1392
|
-
for (const [key, tmpl] of Object.entries(
|
|
1121
|
+
const childNodesMap = {};
|
|
1122
|
+
const processedTemplates = {};
|
|
1123
|
+
if (isObject(templateCollection)) {
|
|
1124
|
+
for (const [key, tmpl] of Object.entries(templateCollection)) {
|
|
1393
1125
|
const prop = props[key];
|
|
1394
1126
|
if (prop) {
|
|
1395
1127
|
for (const propKey in prop) {
|
|
@@ -1399,30 +1131,30 @@ function renderTemplate(template2, props) {
|
|
|
1399
1131
|
}
|
|
1400
1132
|
if (prop.children) {
|
|
1401
1133
|
for (const [child, idx] of prop.children) {
|
|
1402
|
-
if (!
|
|
1403
|
-
|
|
1134
|
+
if (!childNodesMap[idx]) childNodesMap[idx] = [];
|
|
1135
|
+
childNodesMap[idx].push(child);
|
|
1404
1136
|
}
|
|
1405
1137
|
delete prop.children;
|
|
1406
1138
|
}
|
|
1407
1139
|
}
|
|
1408
|
-
|
|
1140
|
+
processedTemplates[key] = { template: tmpl.template, props: prop };
|
|
1409
1141
|
}
|
|
1410
1142
|
}
|
|
1411
|
-
return Object.entries(
|
|
1412
|
-
let
|
|
1143
|
+
return Object.entries(processedTemplates).map(([key, { template: tmpl, props: prop }]) => {
|
|
1144
|
+
let renderedString = tmpl;
|
|
1413
1145
|
if (prop) {
|
|
1414
|
-
|
|
1146
|
+
renderedString += ` ${convertJsonToAttributes(prop)}`;
|
|
1415
1147
|
}
|
|
1416
|
-
if (
|
|
1417
|
-
|
|
1148
|
+
if (childNodesMap[key]) {
|
|
1149
|
+
renderedString += childNodesMap[key].map((child) => renderTemplate(child, prop)).join("");
|
|
1418
1150
|
}
|
|
1419
|
-
return
|
|
1151
|
+
return renderedString;
|
|
1420
1152
|
}).join("");
|
|
1421
1153
|
}
|
|
1422
1154
|
function renderToString(component, props) {
|
|
1423
1155
|
return renderTemplate(component, props);
|
|
1424
1156
|
}
|
|
1425
|
-
function
|
|
1157
|
+
function renderSSG(component, root, props = {}) {
|
|
1426
1158
|
root.innerHTML = renderTemplate(component, props);
|
|
1427
1159
|
}
|
|
1428
1160
|
|
|
@@ -1430,5 +1162,20 @@ function ssgRender(component, root, props = {}) {
|
|
|
1430
1162
|
if (globalThis) {
|
|
1431
1163
|
globalThis.__essor_version__ = essor_version;
|
|
1432
1164
|
}
|
|
1165
|
+
/**
|
|
1166
|
+
* @estjs/shared v0.0.10-beta.20
|
|
1167
|
+
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
1168
|
+
* @license MIT
|
|
1169
|
+
**/
|
|
1170
|
+
/**
|
|
1171
|
+
* @estjs/signal v0.0.10-beta.20
|
|
1172
|
+
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
1173
|
+
* @license MIT
|
|
1174
|
+
**/
|
|
1175
|
+
/**
|
|
1176
|
+
* @estjs/template v0.0.10-beta.20
|
|
1177
|
+
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
1178
|
+
* @license MIT
|
|
1179
|
+
**/
|
|
1433
1180
|
|
|
1434
|
-
export { ComponentNode, Fragment, TemplateNode, createStore, essor_version, h, isComputed, isJsxElement, isReactive, isSignal, nextTick, onDestroy, onMount, renderTemplate, renderToString,
|
|
1181
|
+
export { ComponentNode, Fragment, TemplateNode, createStore, essor_version, h, isComputed, isJsxElement, isReactive, isSignal, nextTick, onDestroy, onMount, renderSSG, renderTemplate, renderToString, shallowReactive, shallowSignal, signalObject, template, unReactive, unSignal, useComputed, useEffect, useInject, useProvide, useReactive, useSignal, useWatch };
|