sprae 8.1.3 → 9.0.0
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/core.js +127 -0
- package/directive/aria.js +10 -0
- package/directive/class.js +17 -0
- package/directive/data.js +10 -0
- package/directive/default.js +148 -0
- package/directive/each.js +64 -0
- package/directive/fx.js +6 -0
- package/directive/html.js +11 -0
- package/directive/if.js +40 -0
- package/directive/ref.js +10 -0
- package/directive/scope.js +11 -0
- package/directive/style.js +16 -0
- package/directive/text.js +12 -0
- package/directive/value.js +31 -0
- package/dist/sprae.js +633 -861
- package/dist/sprae.min.js +1 -1
- package/package.json +18 -13
- package/readme.md +373 -210
- package/sprae.js +14 -0
- package/dist/sprae.auto.js +0 -976
- package/dist/sprae.auto.min.js +0 -1
- package/src/core.js +0 -82
- package/src/directives.js +0 -447
- package/src/domdiff.js +0 -71
- package/src/index.js +0 -6
- package/src/state.proxy.js +0 -150
- package/src/state.signals-proxy.js +0 -151
- package/src/state.signals.js +0 -82
- package/src/util.js +0 -13
package/dist/sprae.auto.js
DELETED
|
@@ -1,976 +0,0 @@
|
|
|
1
|
-
(() => {
|
|
2
|
-
// node_modules/@preact/signals-core/dist/signals-core.module.js
|
|
3
|
-
function i() {
|
|
4
|
-
throw new Error("Cycle detected");
|
|
5
|
-
}
|
|
6
|
-
var t = Symbol.for("preact-signals");
|
|
7
|
-
function r() {
|
|
8
|
-
if (!(v > 1)) {
|
|
9
|
-
var i2, t2 = false;
|
|
10
|
-
while (void 0 !== f) {
|
|
11
|
-
var r2 = f;
|
|
12
|
-
f = void 0;
|
|
13
|
-
e++;
|
|
14
|
-
while (void 0 !== r2) {
|
|
15
|
-
var n2 = r2.o;
|
|
16
|
-
r2.o = void 0;
|
|
17
|
-
r2.f &= -3;
|
|
18
|
-
if (!(8 & r2.f) && l(r2))
|
|
19
|
-
try {
|
|
20
|
-
r2.c();
|
|
21
|
-
} catch (r3) {
|
|
22
|
-
if (!t2) {
|
|
23
|
-
i2 = r3;
|
|
24
|
-
t2 = true;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
r2 = n2;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
e = 0;
|
|
31
|
-
v--;
|
|
32
|
-
if (t2)
|
|
33
|
-
throw i2;
|
|
34
|
-
} else
|
|
35
|
-
v--;
|
|
36
|
-
}
|
|
37
|
-
function n(i2) {
|
|
38
|
-
if (v > 0)
|
|
39
|
-
return i2();
|
|
40
|
-
v++;
|
|
41
|
-
try {
|
|
42
|
-
return i2();
|
|
43
|
-
} finally {
|
|
44
|
-
r();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
var o = void 0;
|
|
48
|
-
var h = 0;
|
|
49
|
-
function s(i2) {
|
|
50
|
-
if (h > 0)
|
|
51
|
-
return i2();
|
|
52
|
-
var t2 = o;
|
|
53
|
-
o = void 0;
|
|
54
|
-
h++;
|
|
55
|
-
try {
|
|
56
|
-
return i2();
|
|
57
|
-
} finally {
|
|
58
|
-
h--;
|
|
59
|
-
o = t2;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
var f = void 0;
|
|
63
|
-
var v = 0;
|
|
64
|
-
var e = 0;
|
|
65
|
-
var u = 0;
|
|
66
|
-
function c(i2) {
|
|
67
|
-
if (void 0 !== o) {
|
|
68
|
-
var t2 = i2.n;
|
|
69
|
-
if (void 0 === t2 || t2.t !== o) {
|
|
70
|
-
t2 = { i: 0, S: i2, p: o.s, n: void 0, t: o, e: void 0, x: void 0, r: t2 };
|
|
71
|
-
if (void 0 !== o.s)
|
|
72
|
-
o.s.n = t2;
|
|
73
|
-
o.s = t2;
|
|
74
|
-
i2.n = t2;
|
|
75
|
-
if (32 & o.f)
|
|
76
|
-
i2.S(t2);
|
|
77
|
-
return t2;
|
|
78
|
-
} else if (-1 === t2.i) {
|
|
79
|
-
t2.i = 0;
|
|
80
|
-
if (void 0 !== t2.n) {
|
|
81
|
-
t2.n.p = t2.p;
|
|
82
|
-
if (void 0 !== t2.p)
|
|
83
|
-
t2.p.n = t2.n;
|
|
84
|
-
t2.p = o.s;
|
|
85
|
-
t2.n = void 0;
|
|
86
|
-
o.s.n = t2;
|
|
87
|
-
o.s = t2;
|
|
88
|
-
}
|
|
89
|
-
return t2;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
function d(i2) {
|
|
94
|
-
this.v = i2;
|
|
95
|
-
this.i = 0;
|
|
96
|
-
this.n = void 0;
|
|
97
|
-
this.t = void 0;
|
|
98
|
-
}
|
|
99
|
-
d.prototype.brand = t;
|
|
100
|
-
d.prototype.h = function() {
|
|
101
|
-
return true;
|
|
102
|
-
};
|
|
103
|
-
d.prototype.S = function(i2) {
|
|
104
|
-
if (this.t !== i2 && void 0 === i2.e) {
|
|
105
|
-
i2.x = this.t;
|
|
106
|
-
if (void 0 !== this.t)
|
|
107
|
-
this.t.e = i2;
|
|
108
|
-
this.t = i2;
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
d.prototype.U = function(i2) {
|
|
112
|
-
if (void 0 !== this.t) {
|
|
113
|
-
var t2 = i2.e, r2 = i2.x;
|
|
114
|
-
if (void 0 !== t2) {
|
|
115
|
-
t2.x = r2;
|
|
116
|
-
i2.e = void 0;
|
|
117
|
-
}
|
|
118
|
-
if (void 0 !== r2) {
|
|
119
|
-
r2.e = t2;
|
|
120
|
-
i2.x = void 0;
|
|
121
|
-
}
|
|
122
|
-
if (i2 === this.t)
|
|
123
|
-
this.t = r2;
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
d.prototype.subscribe = function(i2) {
|
|
127
|
-
var t2 = this;
|
|
128
|
-
return O(function() {
|
|
129
|
-
var r2 = t2.value, n2 = 32 & this.f;
|
|
130
|
-
this.f &= -33;
|
|
131
|
-
try {
|
|
132
|
-
i2(r2);
|
|
133
|
-
} finally {
|
|
134
|
-
this.f |= n2;
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
|
-
d.prototype.valueOf = function() {
|
|
139
|
-
return this.value;
|
|
140
|
-
};
|
|
141
|
-
d.prototype.toString = function() {
|
|
142
|
-
return this.value + "";
|
|
143
|
-
};
|
|
144
|
-
d.prototype.toJSON = function() {
|
|
145
|
-
return this.value;
|
|
146
|
-
};
|
|
147
|
-
d.prototype.peek = function() {
|
|
148
|
-
return this.v;
|
|
149
|
-
};
|
|
150
|
-
Object.defineProperty(d.prototype, "value", { get: function() {
|
|
151
|
-
var i2 = c(this);
|
|
152
|
-
if (void 0 !== i2)
|
|
153
|
-
i2.i = this.i;
|
|
154
|
-
return this.v;
|
|
155
|
-
}, set: function(t2) {
|
|
156
|
-
if (o instanceof _)
|
|
157
|
-
!function() {
|
|
158
|
-
throw new Error("Computed cannot have side-effects");
|
|
159
|
-
}();
|
|
160
|
-
if (t2 !== this.v) {
|
|
161
|
-
if (e > 100)
|
|
162
|
-
i();
|
|
163
|
-
this.v = t2;
|
|
164
|
-
this.i++;
|
|
165
|
-
u++;
|
|
166
|
-
v++;
|
|
167
|
-
try {
|
|
168
|
-
for (var n2 = this.t; void 0 !== n2; n2 = n2.x)
|
|
169
|
-
n2.t.N();
|
|
170
|
-
} finally {
|
|
171
|
-
r();
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
} });
|
|
175
|
-
function a(i2) {
|
|
176
|
-
return new d(i2);
|
|
177
|
-
}
|
|
178
|
-
function l(i2) {
|
|
179
|
-
for (var t2 = i2.s; void 0 !== t2; t2 = t2.n)
|
|
180
|
-
if (t2.S.i !== t2.i || !t2.S.h() || t2.S.i !== t2.i)
|
|
181
|
-
return true;
|
|
182
|
-
return false;
|
|
183
|
-
}
|
|
184
|
-
function y(i2) {
|
|
185
|
-
for (var t2 = i2.s; void 0 !== t2; t2 = t2.n) {
|
|
186
|
-
var r2 = t2.S.n;
|
|
187
|
-
if (void 0 !== r2)
|
|
188
|
-
t2.r = r2;
|
|
189
|
-
t2.S.n = t2;
|
|
190
|
-
t2.i = -1;
|
|
191
|
-
if (void 0 === t2.n) {
|
|
192
|
-
i2.s = t2;
|
|
193
|
-
break;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
function w(i2) {
|
|
198
|
-
var t2 = i2.s, r2 = void 0;
|
|
199
|
-
while (void 0 !== t2) {
|
|
200
|
-
var n2 = t2.p;
|
|
201
|
-
if (-1 === t2.i) {
|
|
202
|
-
t2.S.U(t2);
|
|
203
|
-
if (void 0 !== n2)
|
|
204
|
-
n2.n = t2.n;
|
|
205
|
-
if (void 0 !== t2.n)
|
|
206
|
-
t2.n.p = n2;
|
|
207
|
-
} else
|
|
208
|
-
r2 = t2;
|
|
209
|
-
t2.S.n = t2.r;
|
|
210
|
-
if (void 0 !== t2.r)
|
|
211
|
-
t2.r = void 0;
|
|
212
|
-
t2 = n2;
|
|
213
|
-
}
|
|
214
|
-
i2.s = r2;
|
|
215
|
-
}
|
|
216
|
-
function _(i2) {
|
|
217
|
-
d.call(this, void 0);
|
|
218
|
-
this.x = i2;
|
|
219
|
-
this.s = void 0;
|
|
220
|
-
this.g = u - 1;
|
|
221
|
-
this.f = 4;
|
|
222
|
-
}
|
|
223
|
-
(_.prototype = new d()).h = function() {
|
|
224
|
-
this.f &= -3;
|
|
225
|
-
if (1 & this.f)
|
|
226
|
-
return false;
|
|
227
|
-
if (32 == (36 & this.f))
|
|
228
|
-
return true;
|
|
229
|
-
this.f &= -5;
|
|
230
|
-
if (this.g === u)
|
|
231
|
-
return true;
|
|
232
|
-
this.g = u;
|
|
233
|
-
this.f |= 1;
|
|
234
|
-
if (this.i > 0 && !l(this)) {
|
|
235
|
-
this.f &= -2;
|
|
236
|
-
return true;
|
|
237
|
-
}
|
|
238
|
-
var i2 = o;
|
|
239
|
-
try {
|
|
240
|
-
y(this);
|
|
241
|
-
o = this;
|
|
242
|
-
var t2 = this.x();
|
|
243
|
-
if (16 & this.f || this.v !== t2 || 0 === this.i) {
|
|
244
|
-
this.v = t2;
|
|
245
|
-
this.f &= -17;
|
|
246
|
-
this.i++;
|
|
247
|
-
}
|
|
248
|
-
} catch (i3) {
|
|
249
|
-
this.v = i3;
|
|
250
|
-
this.f |= 16;
|
|
251
|
-
this.i++;
|
|
252
|
-
}
|
|
253
|
-
o = i2;
|
|
254
|
-
w(this);
|
|
255
|
-
this.f &= -2;
|
|
256
|
-
return true;
|
|
257
|
-
};
|
|
258
|
-
_.prototype.S = function(i2) {
|
|
259
|
-
if (void 0 === this.t) {
|
|
260
|
-
this.f |= 36;
|
|
261
|
-
for (var t2 = this.s; void 0 !== t2; t2 = t2.n)
|
|
262
|
-
t2.S.S(t2);
|
|
263
|
-
}
|
|
264
|
-
d.prototype.S.call(this, i2);
|
|
265
|
-
};
|
|
266
|
-
_.prototype.U = function(i2) {
|
|
267
|
-
if (void 0 !== this.t) {
|
|
268
|
-
d.prototype.U.call(this, i2);
|
|
269
|
-
if (void 0 === this.t) {
|
|
270
|
-
this.f &= -33;
|
|
271
|
-
for (var t2 = this.s; void 0 !== t2; t2 = t2.n)
|
|
272
|
-
t2.S.U(t2);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
_.prototype.N = function() {
|
|
277
|
-
if (!(2 & this.f)) {
|
|
278
|
-
this.f |= 6;
|
|
279
|
-
for (var i2 = this.t; void 0 !== i2; i2 = i2.x)
|
|
280
|
-
i2.t.N();
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
_.prototype.peek = function() {
|
|
284
|
-
if (!this.h())
|
|
285
|
-
i();
|
|
286
|
-
if (16 & this.f)
|
|
287
|
-
throw this.v;
|
|
288
|
-
return this.v;
|
|
289
|
-
};
|
|
290
|
-
Object.defineProperty(_.prototype, "value", { get: function() {
|
|
291
|
-
if (1 & this.f)
|
|
292
|
-
i();
|
|
293
|
-
var t2 = c(this);
|
|
294
|
-
this.h();
|
|
295
|
-
if (void 0 !== t2)
|
|
296
|
-
t2.i = this.i;
|
|
297
|
-
if (16 & this.f)
|
|
298
|
-
throw this.v;
|
|
299
|
-
return this.v;
|
|
300
|
-
} });
|
|
301
|
-
function p(i2) {
|
|
302
|
-
return new _(i2);
|
|
303
|
-
}
|
|
304
|
-
function g(i2) {
|
|
305
|
-
var t2 = i2.u;
|
|
306
|
-
i2.u = void 0;
|
|
307
|
-
if ("function" == typeof t2) {
|
|
308
|
-
v++;
|
|
309
|
-
var n2 = o;
|
|
310
|
-
o = void 0;
|
|
311
|
-
try {
|
|
312
|
-
t2();
|
|
313
|
-
} catch (t3) {
|
|
314
|
-
i2.f &= -2;
|
|
315
|
-
i2.f |= 8;
|
|
316
|
-
b(i2);
|
|
317
|
-
throw t3;
|
|
318
|
-
} finally {
|
|
319
|
-
o = n2;
|
|
320
|
-
r();
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
function b(i2) {
|
|
325
|
-
for (var t2 = i2.s; void 0 !== t2; t2 = t2.n)
|
|
326
|
-
t2.S.U(t2);
|
|
327
|
-
i2.x = void 0;
|
|
328
|
-
i2.s = void 0;
|
|
329
|
-
g(i2);
|
|
330
|
-
}
|
|
331
|
-
function x(i2) {
|
|
332
|
-
if (o !== this)
|
|
333
|
-
throw new Error("Out-of-order effect");
|
|
334
|
-
w(this);
|
|
335
|
-
o = i2;
|
|
336
|
-
this.f &= -2;
|
|
337
|
-
if (8 & this.f)
|
|
338
|
-
b(this);
|
|
339
|
-
r();
|
|
340
|
-
}
|
|
341
|
-
function E(i2) {
|
|
342
|
-
this.x = i2;
|
|
343
|
-
this.u = void 0;
|
|
344
|
-
this.s = void 0;
|
|
345
|
-
this.o = void 0;
|
|
346
|
-
this.f = 32;
|
|
347
|
-
}
|
|
348
|
-
E.prototype.c = function() {
|
|
349
|
-
var i2 = this.S();
|
|
350
|
-
try {
|
|
351
|
-
if (8 & this.f)
|
|
352
|
-
return;
|
|
353
|
-
if (void 0 === this.x)
|
|
354
|
-
return;
|
|
355
|
-
var t2 = this.x();
|
|
356
|
-
if ("function" == typeof t2)
|
|
357
|
-
this.u = t2;
|
|
358
|
-
} finally {
|
|
359
|
-
i2();
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
E.prototype.S = function() {
|
|
363
|
-
if (1 & this.f)
|
|
364
|
-
i();
|
|
365
|
-
this.f |= 1;
|
|
366
|
-
this.f &= -9;
|
|
367
|
-
g(this);
|
|
368
|
-
y(this);
|
|
369
|
-
v++;
|
|
370
|
-
var t2 = o;
|
|
371
|
-
o = this;
|
|
372
|
-
return x.bind(this, t2);
|
|
373
|
-
};
|
|
374
|
-
E.prototype.N = function() {
|
|
375
|
-
if (!(2 & this.f)) {
|
|
376
|
-
this.f |= 2;
|
|
377
|
-
this.o = f;
|
|
378
|
-
f = this;
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
E.prototype.d = function() {
|
|
382
|
-
this.f |= 8;
|
|
383
|
-
if (!(1 & this.f))
|
|
384
|
-
b(this);
|
|
385
|
-
};
|
|
386
|
-
function O(i2) {
|
|
387
|
-
var t2 = new E(i2);
|
|
388
|
-
try {
|
|
389
|
-
t2.c();
|
|
390
|
-
} catch (i3) {
|
|
391
|
-
t2.d();
|
|
392
|
-
throw i3;
|
|
393
|
-
}
|
|
394
|
-
return t2.d.bind(t2);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
// src/state.signals-proxy.js
|
|
398
|
-
var _dispose = Symbol.dispose ||= Symbol("dispose");
|
|
399
|
-
var _signals = Symbol("signals");
|
|
400
|
-
var _change = Symbol("length");
|
|
401
|
-
var sandbox = {
|
|
402
|
-
Array,
|
|
403
|
-
Object,
|
|
404
|
-
Number,
|
|
405
|
-
String,
|
|
406
|
-
Boolean,
|
|
407
|
-
Date,
|
|
408
|
-
console,
|
|
409
|
-
window,
|
|
410
|
-
document,
|
|
411
|
-
history,
|
|
412
|
-
navigator,
|
|
413
|
-
location,
|
|
414
|
-
screen,
|
|
415
|
-
localStorage,
|
|
416
|
-
sessionStorage,
|
|
417
|
-
alert,
|
|
418
|
-
prompt,
|
|
419
|
-
confirm,
|
|
420
|
-
fetch,
|
|
421
|
-
performance,
|
|
422
|
-
setTimeout,
|
|
423
|
-
setInterval,
|
|
424
|
-
requestAnimationFrame
|
|
425
|
-
};
|
|
426
|
-
var isObject = (v2) => v2?.constructor === Object;
|
|
427
|
-
var lastProp;
|
|
428
|
-
function createState(values, parent) {
|
|
429
|
-
if (!isObject(values) && !Array.isArray(values))
|
|
430
|
-
return values;
|
|
431
|
-
if (values[_signals] && !parent)
|
|
432
|
-
return values;
|
|
433
|
-
const initSignals = values[_signals];
|
|
434
|
-
const isArr = Array.isArray(values), _len = a(isArr ? values.length : Object.values(values).length), signals = parent ? Object.create((parent = createState(parent))[_signals]) : Array.isArray(values) ? [] : {}, proto = signals.constructor.prototype;
|
|
435
|
-
if (parent)
|
|
436
|
-
for (let key in parent)
|
|
437
|
-
parent[key];
|
|
438
|
-
const state = new Proxy(values, {
|
|
439
|
-
has() {
|
|
440
|
-
return true;
|
|
441
|
-
},
|
|
442
|
-
get(values2, key) {
|
|
443
|
-
if (isArr)
|
|
444
|
-
if (key === "length")
|
|
445
|
-
return proto[lastProp] ? _len.peek() : _len.value;
|
|
446
|
-
else
|
|
447
|
-
lastProp = key;
|
|
448
|
-
if (proto[key])
|
|
449
|
-
return proto[key];
|
|
450
|
-
if (key === _signals)
|
|
451
|
-
return signals;
|
|
452
|
-
if (key === _change)
|
|
453
|
-
return _len.value;
|
|
454
|
-
const s2 = signals[key] || initSignal(key);
|
|
455
|
-
if (s2)
|
|
456
|
-
return s2.value;
|
|
457
|
-
return sandbox[key];
|
|
458
|
-
},
|
|
459
|
-
set(values2, key, v2) {
|
|
460
|
-
if (isArr) {
|
|
461
|
-
if (key === "length") {
|
|
462
|
-
n(() => {
|
|
463
|
-
for (let i2 = v2, l2 = signals.length; i2 < l2; i2++)
|
|
464
|
-
delete state[i2];
|
|
465
|
-
_len.value = signals.length = values2.length = v2;
|
|
466
|
-
});
|
|
467
|
-
return true;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
let newProp = false;
|
|
471
|
-
const s2 = signals[key] || initSignal(key, v2) || (newProp = true, a());
|
|
472
|
-
const cur = s2.peek();
|
|
473
|
-
if (v2 === cur)
|
|
474
|
-
;
|
|
475
|
-
else if (s2._set)
|
|
476
|
-
s2._set(v2);
|
|
477
|
-
else if (Array.isArray(v2) && Array.isArray(cur)) {
|
|
478
|
-
s(() => n(() => {
|
|
479
|
-
let i2 = 0, l2 = v2.length, vals = values2[key];
|
|
480
|
-
for (; i2 < l2; i2++)
|
|
481
|
-
cur[i2] = vals[i2] = v2[i2];
|
|
482
|
-
cur.length = l2;
|
|
483
|
-
}));
|
|
484
|
-
} else {
|
|
485
|
-
s2.value = createState(values2[key] = v2);
|
|
486
|
-
}
|
|
487
|
-
if (isArr) {
|
|
488
|
-
if (key >= _len.peek())
|
|
489
|
-
_len.value = signals.length = values2.length = Number(key) + 1;
|
|
490
|
-
} else if (newProp) {
|
|
491
|
-
_len.value++;
|
|
492
|
-
}
|
|
493
|
-
return true;
|
|
494
|
-
},
|
|
495
|
-
deleteProperty(values2, key) {
|
|
496
|
-
const s2 = signals[key];
|
|
497
|
-
if (s2) {
|
|
498
|
-
const { _del } = s2;
|
|
499
|
-
delete s2._del;
|
|
500
|
-
delete signals[key];
|
|
501
|
-
_del?.();
|
|
502
|
-
}
|
|
503
|
-
delete values2[key];
|
|
504
|
-
if (!isArr)
|
|
505
|
-
_len.value--;
|
|
506
|
-
return true;
|
|
507
|
-
}
|
|
508
|
-
});
|
|
509
|
-
for (let key in values)
|
|
510
|
-
signals[key] = initSignals?.[key] ?? initSignal(key);
|
|
511
|
-
function initSignal(key) {
|
|
512
|
-
if (values.hasOwnProperty(key)) {
|
|
513
|
-
const desc = Object.getOwnPropertyDescriptor(values, key);
|
|
514
|
-
if (desc?.get) {
|
|
515
|
-
(signals[key] = p(desc.get.bind(state)))._set = desc.set?.bind(state);
|
|
516
|
-
return signals[key];
|
|
517
|
-
}
|
|
518
|
-
return signals[key] = desc.value?.peek ? desc.value : a(createState(desc.value));
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
return state;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
// src/util.js
|
|
525
|
-
var queueMicrotask = Promise.prototype.then.bind(Promise.resolve());
|
|
526
|
-
|
|
527
|
-
// src/directives.js
|
|
528
|
-
var primary = {};
|
|
529
|
-
var secondary = {};
|
|
530
|
-
primary["if"] = (el, expr, state) => {
|
|
531
|
-
let holder = document.createTextNode(""), clauses = [parseExpr(el, expr, ":if")], els = [el], cur = el;
|
|
532
|
-
while (cur = el.nextElementSibling) {
|
|
533
|
-
if (cur.hasAttribute(":else")) {
|
|
534
|
-
cur.removeAttribute(":else");
|
|
535
|
-
if (expr = cur.getAttribute(":if")) {
|
|
536
|
-
cur.removeAttribute(":if"), cur.remove();
|
|
537
|
-
els.push(cur);
|
|
538
|
-
clauses.push(parseExpr(el, expr, ":else :if"));
|
|
539
|
-
} else {
|
|
540
|
-
cur.remove();
|
|
541
|
-
els.push(cur);
|
|
542
|
-
clauses.push(() => 1);
|
|
543
|
-
}
|
|
544
|
-
} else
|
|
545
|
-
break;
|
|
546
|
-
}
|
|
547
|
-
el.replaceWith(cur = holder);
|
|
548
|
-
const dispose = O(() => {
|
|
549
|
-
let i2 = clauses.findIndex((f2) => f2(state));
|
|
550
|
-
if (els[i2] != cur) {
|
|
551
|
-
;
|
|
552
|
-
(cur[_each] || cur).replaceWith(cur = els[i2] || holder);
|
|
553
|
-
sprae(cur, state);
|
|
554
|
-
}
|
|
555
|
-
});
|
|
556
|
-
return () => {
|
|
557
|
-
for (const el2 of els)
|
|
558
|
-
el2[_dispose]?.();
|
|
559
|
-
dispose();
|
|
560
|
-
};
|
|
561
|
-
};
|
|
562
|
-
var _each = Symbol(":each");
|
|
563
|
-
primary["each"] = (tpl, expr, state) => {
|
|
564
|
-
const each = parseForExpression(expr);
|
|
565
|
-
if (!each)
|
|
566
|
-
return exprError(new Error(), tpl, expr, ":each");
|
|
567
|
-
const [itemVar, idxVar, itemsExpr] = each;
|
|
568
|
-
const holder = tpl[_each] = document.createTextNode("");
|
|
569
|
-
tpl.replaceWith(holder);
|
|
570
|
-
const evaluate = parseExpr(tpl, itemsExpr, ":each");
|
|
571
|
-
let curItems, signals;
|
|
572
|
-
O(() => {
|
|
573
|
-
let srcItems = evaluate(state), newItems, keys2;
|
|
574
|
-
let prevl = curItems?.length || 0;
|
|
575
|
-
if (!srcItems)
|
|
576
|
-
newItems = [];
|
|
577
|
-
else if (typeof srcItems === "number")
|
|
578
|
-
newItems = Array.from({ length: srcItems }, (_2, i2) => i2);
|
|
579
|
-
else if (Array.isArray(srcItems))
|
|
580
|
-
newItems = srcItems;
|
|
581
|
-
else if (typeof srcItems === "object") {
|
|
582
|
-
keys2 = Object.keys(srcItems);
|
|
583
|
-
newItems = Object.values(srcItems);
|
|
584
|
-
srcItems[_change];
|
|
585
|
-
} else {
|
|
586
|
-
exprError(Error("Bad items value"), tpl, expr, ":each", srcItems);
|
|
587
|
-
}
|
|
588
|
-
s(() => n(() => {
|
|
589
|
-
if (!curItems || !curItems[_signals]) {
|
|
590
|
-
for (let i2 = 0; i2 < prevl; i2++)
|
|
591
|
-
signals[i2]?._del();
|
|
592
|
-
curItems = newItems, signals = curItems[_signals] || [];
|
|
593
|
-
if (keys2)
|
|
594
|
-
prevl = 0;
|
|
595
|
-
} else {
|
|
596
|
-
let newl = newItems.length, i2 = 0;
|
|
597
|
-
for (; i2 < newl; i2++)
|
|
598
|
-
curItems[i2] = newItems[i2];
|
|
599
|
-
curItems.length = newl;
|
|
600
|
-
}
|
|
601
|
-
}));
|
|
602
|
-
return O(() => {
|
|
603
|
-
let newl = newItems.length;
|
|
604
|
-
if (prevl !== newl)
|
|
605
|
-
s(() => n(() => {
|
|
606
|
-
for (let i2 = prevl; i2 < newl; i2++) {
|
|
607
|
-
const idx = keys2?.[i2] ?? i2;
|
|
608
|
-
const el = tpl.cloneNode(true), scope = createState({
|
|
609
|
-
[itemVar]: signals[i2] ?? curItems[i2],
|
|
610
|
-
[idxVar]: idx
|
|
611
|
-
}, state);
|
|
612
|
-
holder.before(el);
|
|
613
|
-
sprae(el, scope);
|
|
614
|
-
const { _del } = signals[i2] ||= {};
|
|
615
|
-
signals[i2]._del = () => {
|
|
616
|
-
delete curItems[i2];
|
|
617
|
-
_del?.();
|
|
618
|
-
el[_dispose](), el.remove();
|
|
619
|
-
};
|
|
620
|
-
}
|
|
621
|
-
prevl = newl;
|
|
622
|
-
}));
|
|
623
|
-
});
|
|
624
|
-
});
|
|
625
|
-
return () => n(() => {
|
|
626
|
-
for (let _i of signals)
|
|
627
|
-
_i?._del();
|
|
628
|
-
signals.length = 0;
|
|
629
|
-
curItems.length = 0;
|
|
630
|
-
});
|
|
631
|
-
};
|
|
632
|
-
primary["with"] = (el, expr, rootState) => {
|
|
633
|
-
let evaluate = parseExpr(el, expr, ":with");
|
|
634
|
-
const localState = evaluate(rootState);
|
|
635
|
-
let state = createState(localState, rootState);
|
|
636
|
-
sprae(el, state);
|
|
637
|
-
return el[_dispose];
|
|
638
|
-
};
|
|
639
|
-
primary["ref"] = (el, expr, state) => {
|
|
640
|
-
state[expr] = el;
|
|
641
|
-
};
|
|
642
|
-
function parseForExpression(expression) {
|
|
643
|
-
let forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
|
644
|
-
let stripParensRE = /^\s*\(|\)\s*$/g;
|
|
645
|
-
let forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
|
646
|
-
let inMatch = expression.match(forAliasRE);
|
|
647
|
-
if (!inMatch)
|
|
648
|
-
return;
|
|
649
|
-
let items = inMatch[2].trim();
|
|
650
|
-
let item = inMatch[1].replace(stripParensRE, "").trim();
|
|
651
|
-
let iteratorMatch = item.match(forIteratorRE);
|
|
652
|
-
if (iteratorMatch)
|
|
653
|
-
return [
|
|
654
|
-
item.replace(forIteratorRE, "").trim(),
|
|
655
|
-
iteratorMatch[1].trim(),
|
|
656
|
-
items
|
|
657
|
-
];
|
|
658
|
-
return [item, "", items];
|
|
659
|
-
}
|
|
660
|
-
secondary["render"] = (el, expr, state) => {
|
|
661
|
-
let evaluate = parseExpr(el, expr, ":render"), tpl = evaluate(state);
|
|
662
|
-
if (!tpl)
|
|
663
|
-
exprError(new Error("Template not found"), el, expr, ":render");
|
|
664
|
-
let content = tpl.content.cloneNode(true);
|
|
665
|
-
el.replaceChildren(content);
|
|
666
|
-
sprae(el, state);
|
|
667
|
-
return el[_dispose];
|
|
668
|
-
};
|
|
669
|
-
secondary["id"] = (el, expr, state) => {
|
|
670
|
-
let evaluate = parseExpr(el, expr, ":id");
|
|
671
|
-
const update = (v2) => el.id = v2 || v2 === 0 ? v2 : "";
|
|
672
|
-
return O(() => update(evaluate(state)));
|
|
673
|
-
};
|
|
674
|
-
secondary["class"] = (el, expr, state) => {
|
|
675
|
-
let evaluate = parseExpr(el, expr, ":class");
|
|
676
|
-
let initClassName = el.getAttribute("class");
|
|
677
|
-
return O(() => {
|
|
678
|
-
let v2 = evaluate(state);
|
|
679
|
-
let className = [initClassName];
|
|
680
|
-
if (v2) {
|
|
681
|
-
if (typeof v2 === "string")
|
|
682
|
-
className.push(v2);
|
|
683
|
-
else if (Array.isArray(v2))
|
|
684
|
-
className.push(...v2);
|
|
685
|
-
else
|
|
686
|
-
className.push(...Object.entries(v2).map(([k, v3]) => v3 ? k : ""));
|
|
687
|
-
}
|
|
688
|
-
if (className = className.filter(Boolean).join(" "))
|
|
689
|
-
el.setAttribute("class", className);
|
|
690
|
-
else
|
|
691
|
-
el.removeAttribute("class");
|
|
692
|
-
});
|
|
693
|
-
};
|
|
694
|
-
secondary["style"] = (el, expr, state) => {
|
|
695
|
-
let evaluate = parseExpr(el, expr, ":style");
|
|
696
|
-
let initStyle = el.getAttribute("style") || "";
|
|
697
|
-
if (!initStyle.endsWith(";"))
|
|
698
|
-
initStyle += "; ";
|
|
699
|
-
return O(() => {
|
|
700
|
-
let v2 = evaluate(state);
|
|
701
|
-
if (typeof v2 === "string")
|
|
702
|
-
el.setAttribute("style", initStyle + v2);
|
|
703
|
-
else {
|
|
704
|
-
s(() => {
|
|
705
|
-
el.setAttribute("style", initStyle);
|
|
706
|
-
for (let k in v2)
|
|
707
|
-
if (typeof v2[k] !== "symbol")
|
|
708
|
-
el.style.setProperty(k, v2[k]);
|
|
709
|
-
});
|
|
710
|
-
}
|
|
711
|
-
});
|
|
712
|
-
};
|
|
713
|
-
secondary["text"] = (el, expr, state) => {
|
|
714
|
-
let evaluate = parseExpr(el, expr, ":text");
|
|
715
|
-
return O(() => {
|
|
716
|
-
let value = evaluate(state);
|
|
717
|
-
el.textContent = value == null ? "" : value;
|
|
718
|
-
});
|
|
719
|
-
};
|
|
720
|
-
secondary[""] = (el, expr, state) => {
|
|
721
|
-
let evaluate = parseExpr(el, expr, ":");
|
|
722
|
-
if (evaluate)
|
|
723
|
-
return O(() => {
|
|
724
|
-
let value = evaluate(state);
|
|
725
|
-
for (let key in value)
|
|
726
|
-
attr(el, dashcase(key), value[key]);
|
|
727
|
-
});
|
|
728
|
-
};
|
|
729
|
-
secondary["value"] = (el, expr, state) => {
|
|
730
|
-
let evaluate = parseExpr(el, expr, ":value");
|
|
731
|
-
let from, to;
|
|
732
|
-
let update = el.type === "text" || el.type === "" ? (value) => el.setAttribute("value", el.value = value == null ? "" : value) : el.tagName === "TEXTAREA" || el.type === "text" || el.type === "" ? (value) => (from = el.selectionStart, to = el.selectionEnd, el.setAttribute("value", el.value = value == null ? "" : value), from && el.setSelectionRange(from, to)) : el.type === "checkbox" ? (value) => (el.value = value ? "on" : "", attr(el, "checked", value)) : el.type === "select-one" ? (value) => {
|
|
733
|
-
for (let option in el.options)
|
|
734
|
-
option.removeAttribute("selected");
|
|
735
|
-
el.value = value;
|
|
736
|
-
el.selectedOptions[0]?.setAttribute("selected", "");
|
|
737
|
-
} : (value) => el.value = value;
|
|
738
|
-
return O(() => {
|
|
739
|
-
update(evaluate(state));
|
|
740
|
-
});
|
|
741
|
-
};
|
|
742
|
-
var directives_default = (el, expr, state, name) => {
|
|
743
|
-
let evt = name.startsWith("on") && name.slice(2);
|
|
744
|
-
let evaluate = parseExpr(el, expr, ":" + name);
|
|
745
|
-
if (!evaluate)
|
|
746
|
-
return;
|
|
747
|
-
if (evt) {
|
|
748
|
-
let off, dispose = O(() => {
|
|
749
|
-
if (off)
|
|
750
|
-
off(), off = null;
|
|
751
|
-
let value = evaluate(state);
|
|
752
|
-
if (value)
|
|
753
|
-
off = on(el, evt, value);
|
|
754
|
-
});
|
|
755
|
-
return () => (off?.(), dispose());
|
|
756
|
-
}
|
|
757
|
-
return O(() => {
|
|
758
|
-
attr(el, name, evaluate(state));
|
|
759
|
-
});
|
|
760
|
-
};
|
|
761
|
-
var on = (el, e2, fn) => {
|
|
762
|
-
if (!fn)
|
|
763
|
-
return;
|
|
764
|
-
const ctx = { evt: "", target: el, test: () => true };
|
|
765
|
-
ctx.evt = (e2.startsWith("on") ? e2.slice(2) : e2).replace(
|
|
766
|
-
/\.(\w+)?-?([-\w]+)?/g,
|
|
767
|
-
(match, mod, param = "") => (ctx.test = mods[mod]?.(ctx, ...param.split("-")) || ctx.test, "")
|
|
768
|
-
);
|
|
769
|
-
const { evt, target, test, defer, stop, prevent, ...opts } = ctx;
|
|
770
|
-
if (defer)
|
|
771
|
-
fn = defer(fn);
|
|
772
|
-
const cb = (e3) => test(e3) && (stop && e3.stopPropagation(), prevent && e3.preventDefault(), fn.call(target, e3));
|
|
773
|
-
target.addEventListener(evt, cb, opts);
|
|
774
|
-
return () => target.removeEventListener(evt, cb, opts);
|
|
775
|
-
};
|
|
776
|
-
var mods = {
|
|
777
|
-
prevent(ctx) {
|
|
778
|
-
ctx.prevent = true;
|
|
779
|
-
},
|
|
780
|
-
stop(ctx) {
|
|
781
|
-
ctx.stop = true;
|
|
782
|
-
},
|
|
783
|
-
once(ctx) {
|
|
784
|
-
ctx.once = true;
|
|
785
|
-
},
|
|
786
|
-
passive(ctx) {
|
|
787
|
-
ctx.passive = true;
|
|
788
|
-
},
|
|
789
|
-
capture(ctx) {
|
|
790
|
-
ctx.capture = true;
|
|
791
|
-
},
|
|
792
|
-
window(ctx) {
|
|
793
|
-
ctx.target = window;
|
|
794
|
-
},
|
|
795
|
-
document(ctx) {
|
|
796
|
-
ctx.target = document;
|
|
797
|
-
},
|
|
798
|
-
throttle(ctx, limit) {
|
|
799
|
-
ctx.defer = (fn) => throttle(fn, limit ? Number(limit) || 0 : 108);
|
|
800
|
-
},
|
|
801
|
-
debounce(ctx, wait) {
|
|
802
|
-
ctx.defer = (fn) => debounce(fn, wait ? Number(wait) || 0 : 108);
|
|
803
|
-
},
|
|
804
|
-
outside: (ctx) => (e2) => {
|
|
805
|
-
let target = ctx.target;
|
|
806
|
-
if (target.contains(e2.target))
|
|
807
|
-
return false;
|
|
808
|
-
if (e2.target.isConnected === false)
|
|
809
|
-
return false;
|
|
810
|
-
if (target.offsetWidth < 1 && target.offsetHeight < 1)
|
|
811
|
-
return false;
|
|
812
|
-
return true;
|
|
813
|
-
},
|
|
814
|
-
self: (ctx) => (e2) => e2.target === ctx.target,
|
|
815
|
-
ctrl: (ctx, ...param) => (e2) => keys.ctrl(e2) && param.every((p2) => keys[p2] ? keys[p2](e2) : e2.key === p2),
|
|
816
|
-
shift: (ctx, ...param) => (e2) => keys.shift(e2) && param.every((p2) => keys[p2] ? keys[p2](e2) : e2.key === p2),
|
|
817
|
-
alt: (ctx, ...param) => (e2) => keys.alt(e2) && param.every((p2) => keys[p2] ? keys[p2](e2) : e2.key === p2),
|
|
818
|
-
meta: (ctx, ...param) => (e2) => keys.meta(e2) && param.every((p2) => keys[p2] ? keys[p2](e2) : e2.key === p2),
|
|
819
|
-
arrow: (ctx) => keys.arrow,
|
|
820
|
-
enter: (ctx) => keys.enter,
|
|
821
|
-
escape: (ctx) => keys.escape,
|
|
822
|
-
tab: (ctx) => keys.tab,
|
|
823
|
-
space: (ctx) => keys.space,
|
|
824
|
-
backspace: (ctx) => keys.backspace,
|
|
825
|
-
delete: (ctx) => keys.delete,
|
|
826
|
-
digit: (ctx) => keys.digit,
|
|
827
|
-
letter: (ctx) => keys.letter,
|
|
828
|
-
character: (ctx) => keys.character
|
|
829
|
-
};
|
|
830
|
-
var keys = {
|
|
831
|
-
ctrl: (e2) => e2.ctrlKey || e2.key === "Control" || e2.key === "Ctrl",
|
|
832
|
-
shift: (e2) => e2.shiftKey || e2.key === "Shift",
|
|
833
|
-
alt: (e2) => e2.altKey || e2.key === "Alt",
|
|
834
|
-
meta: (e2) => e2.metaKey || e2.key === "Meta" || e2.key === "Command",
|
|
835
|
-
arrow: (e2) => e2.key.startsWith("Arrow"),
|
|
836
|
-
enter: (e2) => e2.key === "Enter",
|
|
837
|
-
escape: (e2) => e2.key.startsWith("Esc"),
|
|
838
|
-
tab: (e2) => e2.key === "Tab",
|
|
839
|
-
space: (e2) => e2.key === "\xA0" || e2.key === "Space" || e2.key === " ",
|
|
840
|
-
backspace: (e2) => e2.key === "Backspace",
|
|
841
|
-
delete: (e2) => e2.key === "Delete",
|
|
842
|
-
digit: (e2) => /^\d$/.test(e2.key),
|
|
843
|
-
letter: (e2) => /^[a-zA-Z]$/.test(e2.key),
|
|
844
|
-
character: (e2) => /^\S$/.test(e2.key)
|
|
845
|
-
};
|
|
846
|
-
var throttle = (fn, limit) => {
|
|
847
|
-
let pause, planned, block = (e2) => {
|
|
848
|
-
pause = true;
|
|
849
|
-
setTimeout(() => {
|
|
850
|
-
pause = false;
|
|
851
|
-
if (planned)
|
|
852
|
-
return planned = false, block(e2), fn(e2);
|
|
853
|
-
}, limit);
|
|
854
|
-
};
|
|
855
|
-
return (e2) => {
|
|
856
|
-
if (pause)
|
|
857
|
-
return planned = true;
|
|
858
|
-
block(e2);
|
|
859
|
-
return fn(e2);
|
|
860
|
-
};
|
|
861
|
-
};
|
|
862
|
-
var debounce = (fn, wait) => {
|
|
863
|
-
let timeout;
|
|
864
|
-
return (e2) => {
|
|
865
|
-
clearTimeout(timeout);
|
|
866
|
-
timeout = setTimeout(() => {
|
|
867
|
-
timeout = null;
|
|
868
|
-
fn(e2);
|
|
869
|
-
}, wait);
|
|
870
|
-
};
|
|
871
|
-
};
|
|
872
|
-
var attr = (el, name, v2) => {
|
|
873
|
-
if (v2 == null || v2 === false)
|
|
874
|
-
el.removeAttribute(name);
|
|
875
|
-
else
|
|
876
|
-
el.setAttribute(name, v2 === true ? "" : typeof v2 === "number" || typeof v2 === "string" ? v2 : "");
|
|
877
|
-
};
|
|
878
|
-
var evaluatorMemo = {};
|
|
879
|
-
function parseExpr(el, expression, dir) {
|
|
880
|
-
let evaluate = evaluatorMemo[expression];
|
|
881
|
-
if (!evaluate) {
|
|
882
|
-
try {
|
|
883
|
-
evaluate = evaluatorMemo[expression] = new Function(`__scope`, `with (__scope) { let __; return ${expression.trim()} };`);
|
|
884
|
-
} catch (e2) {
|
|
885
|
-
return exprError(e2, el, expression, dir);
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
return (state) => {
|
|
889
|
-
let result;
|
|
890
|
-
try {
|
|
891
|
-
result = evaluate.call(el, state);
|
|
892
|
-
} catch (e2) {
|
|
893
|
-
return exprError(e2, el, expression, dir);
|
|
894
|
-
}
|
|
895
|
-
return result;
|
|
896
|
-
};
|
|
897
|
-
}
|
|
898
|
-
function exprError(error, element, expression, directive) {
|
|
899
|
-
Object.assign(error, { element, expression });
|
|
900
|
-
console.warn(`\u2234 ${error.message}
|
|
901
|
-
|
|
902
|
-
${directive}=${expression ? `"${expression}"
|
|
903
|
-
|
|
904
|
-
` : ""}`, element);
|
|
905
|
-
queueMicrotask(() => {
|
|
906
|
-
throw error;
|
|
907
|
-
}, 0);
|
|
908
|
-
}
|
|
909
|
-
function dashcase(str) {
|
|
910
|
-
return str.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g, (match) => "-" + match.toLowerCase());
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
// src/core.js
|
|
914
|
-
sprae.globals = sandbox;
|
|
915
|
-
var memo = /* @__PURE__ */ new WeakMap();
|
|
916
|
-
function sprae(container, values) {
|
|
917
|
-
if (!container.children)
|
|
918
|
-
return;
|
|
919
|
-
if (memo.has(container))
|
|
920
|
-
return n(() => Object.assign(memo.get(container), values));
|
|
921
|
-
const state = createState(values || {});
|
|
922
|
-
const disposes = [];
|
|
923
|
-
const init = (el, parent = el.parentNode) => {
|
|
924
|
-
for (let name in primary) {
|
|
925
|
-
let attrName = ":" + name;
|
|
926
|
-
if (el.hasAttribute?.(attrName)) {
|
|
927
|
-
let expr = el.getAttribute(attrName);
|
|
928
|
-
el.removeAttribute(attrName);
|
|
929
|
-
disposes.push(primary[name](el, expr, state, name));
|
|
930
|
-
if (memo.has(el))
|
|
931
|
-
return;
|
|
932
|
-
if (el.parentNode !== parent)
|
|
933
|
-
return false;
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
if (el.attributes) {
|
|
937
|
-
for (let i2 = 0; i2 < el.attributes.length; ) {
|
|
938
|
-
let attr2 = el.attributes[i2], prefix = attr2.name[0];
|
|
939
|
-
if (prefix === ":" || prefix === "@") {
|
|
940
|
-
el.removeAttribute(attr2.name);
|
|
941
|
-
let expr = prefix === "@" ? `${attr2.value.includes("await") ? "async" : ""} event=>{${attr2.value}}` : attr2.value, names = attr2.name.slice(1).split(prefix);
|
|
942
|
-
for (let name of names) {
|
|
943
|
-
if (prefix === "@")
|
|
944
|
-
name = `on` + name;
|
|
945
|
-
let dir = secondary[name] || directives_default;
|
|
946
|
-
disposes.push(dir(el, expr, state, name));
|
|
947
|
-
}
|
|
948
|
-
} else
|
|
949
|
-
i2++;
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
for (let i2 = 0, child; child = el.children[i2]; i2++) {
|
|
953
|
-
if (init(child, el) === false)
|
|
954
|
-
i2--;
|
|
955
|
-
}
|
|
956
|
-
};
|
|
957
|
-
init(container);
|
|
958
|
-
if (memo.has(container))
|
|
959
|
-
return state;
|
|
960
|
-
memo.set(container, state);
|
|
961
|
-
if (disposes.length)
|
|
962
|
-
Object.defineProperty(container, _dispose, {
|
|
963
|
-
value: () => {
|
|
964
|
-
while (disposes.length)
|
|
965
|
-
disposes.shift()?.();
|
|
966
|
-
memo.delete(container);
|
|
967
|
-
}
|
|
968
|
-
});
|
|
969
|
-
return state;
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
// src/index.js
|
|
973
|
-
var src_default = sprae;
|
|
974
|
-
if (document.currentScript)
|
|
975
|
-
sprae(document.documentElement);
|
|
976
|
-
})();
|