marko 6.0.101 → 6.0.103
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/common/accessor.d.ts +37 -22
- package/dist/common/accessor.debug.d.ts +18 -3
- package/dist/common/errors.d.ts +4 -0
- package/dist/common/helpers.d.ts +1 -0
- package/dist/common/meta.d.ts +1 -0
- package/dist/common/types.d.ts +20 -17
- package/dist/debug/dom.js +253 -141
- package/dist/debug/dom.mjs +253 -141
- package/dist/debug/html.js +65 -4
- package/dist/debug/html.mjs +65 -4
- package/dist/dom/abort-signal.d.ts +1 -1
- package/dist/dom/control-flow.d.ts +7 -6
- package/dist/dom/queue.d.ts +1 -1
- package/dist/dom/reconcile.d.ts +1 -1
- package/dist/dom/renderer.d.ts +3 -3
- package/dist/dom/resume.d.ts +3 -3
- package/dist/dom/scope.d.ts +2 -2
- package/dist/dom/signals.d.ts +8 -8
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +250 -204
- package/dist/dom.mjs +250 -204
- package/dist/html/writer.d.ts +1 -1
- package/dist/html.js +32 -31
- package/dist/html.mjs +32 -31
- package/dist/translator/index.js +281 -209
- package/dist/translator/util/references.d.ts +2 -2
- package/dist/translator/util/scope-read.d.ts +1 -1
- package/dist/translator/util/signals.d.ts +0 -1
- package/dist/translator/util/tag-name-type.d.ts +1 -1
- package/package.json +1 -1
package/dist/debug/dom.mjs
CHANGED
|
@@ -44,6 +44,55 @@ function _assert_hoist(value) {
|
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
function assertExclusiveAttrs(attrs, onError = throwErr) {
|
|
48
|
+
if (attrs) {
|
|
49
|
+
let exclusiveAttrs;
|
|
50
|
+
if (attrs.checkedChange) {
|
|
51
|
+
(exclusiveAttrs ||= []).push("checkedChange");
|
|
52
|
+
}
|
|
53
|
+
if (attrs.checkedValue) {
|
|
54
|
+
(exclusiveAttrs ||= []).push("checkedValue");
|
|
55
|
+
if (attrs.checked) {
|
|
56
|
+
exclusiveAttrs.push("checked");
|
|
57
|
+
}
|
|
58
|
+
} else if (attrs.checkedValueChange) {
|
|
59
|
+
(exclusiveAttrs ||= []).push("checkedValueChange");
|
|
60
|
+
if (attrs.checked) {
|
|
61
|
+
exclusiveAttrs.push("checked");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (attrs.valueChange) {
|
|
65
|
+
(exclusiveAttrs ||= []).push("valueChange");
|
|
66
|
+
}
|
|
67
|
+
if (exclusiveAttrs && exclusiveAttrs.length > 1) {
|
|
68
|
+
onError(
|
|
69
|
+
`The attributes ${joinWithAnd(exclusiveAttrs)} are mutually exclusive.`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function assertValidTagName(tagName) {
|
|
75
|
+
if (!/^[a-z][a-z0-9._-]*$/i.test(tagName)) {
|
|
76
|
+
throw new Error(
|
|
77
|
+
`Invalid tag name: "${tagName}". Tag names must start with a letter and contain only letters, numbers, periods, hyphens, and underscores.`
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function throwErr(msg) {
|
|
82
|
+
throw new Error(msg);
|
|
83
|
+
}
|
|
84
|
+
function joinWithAnd(a) {
|
|
85
|
+
switch (a.length) {
|
|
86
|
+
case 0:
|
|
87
|
+
return "";
|
|
88
|
+
case 1:
|
|
89
|
+
return a[0];
|
|
90
|
+
case 2:
|
|
91
|
+
return `${a[0]} and ${a[1]}`;
|
|
92
|
+
default:
|
|
93
|
+
return `${a.slice(0, -1).join(", ")}, and ${a[a.length - 1]}`;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
47
96
|
|
|
48
97
|
// src/common/for.ts
|
|
49
98
|
function forIn(obj, cb) {
|
|
@@ -134,6 +183,11 @@ function normalizeDynamicRenderer(value) {
|
|
|
134
183
|
}
|
|
135
184
|
}
|
|
136
185
|
|
|
186
|
+
// src/common/meta.ts
|
|
187
|
+
var DEFAULT_RUNTIME_ID = "M";
|
|
188
|
+
var DEFAULT_RENDER_ID = "_";
|
|
189
|
+
var DYNAMIC_TAG_SCRIPT_REGISTER_ID = true ? "_dynamicTagScript" : "d";
|
|
190
|
+
|
|
137
191
|
// src/dom/event.ts
|
|
138
192
|
var defaultDelegator = createDelegator();
|
|
139
193
|
function _on(element, type, handler) {
|
|
@@ -202,18 +256,14 @@ function stripSpacesAndPunctuation(str) {
|
|
|
202
256
|
return str.replace(/[^\p{L}\p{N}]/gu, "");
|
|
203
257
|
}
|
|
204
258
|
|
|
205
|
-
// src/common/meta.ts
|
|
206
|
-
var DEFAULT_RUNTIME_ID = "M";
|
|
207
|
-
var DEFAULT_RENDER_ID = "_";
|
|
208
|
-
|
|
209
259
|
// src/dom/scope.ts
|
|
210
260
|
var nextScopeId = 1e6;
|
|
211
261
|
function createScope($global, closestBranch) {
|
|
212
262
|
const scope = {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
$global
|
|
263
|
+
["#Id" /* Id */]: nextScopeId++,
|
|
264
|
+
["#Creating" /* Creating */]: 1,
|
|
265
|
+
["#ClosestBranch" /* ClosestBranch */]: closestBranch,
|
|
266
|
+
["$global" /* Global */]: $global
|
|
217
267
|
};
|
|
218
268
|
pendingScopes.push(scope);
|
|
219
269
|
return scope;
|
|
@@ -222,41 +272,51 @@ function skipScope() {
|
|
|
222
272
|
return nextScopeId++;
|
|
223
273
|
}
|
|
224
274
|
function findBranchWithKey(scope, key) {
|
|
225
|
-
let branch = scope
|
|
275
|
+
let branch = scope["#ClosestBranch" /* ClosestBranch */];
|
|
226
276
|
while (branch && !branch[key]) {
|
|
227
|
-
branch = branch
|
|
277
|
+
branch = branch["#ParentBranch" /* ParentBranch */];
|
|
228
278
|
}
|
|
229
279
|
return branch;
|
|
230
280
|
}
|
|
231
281
|
function destroyBranch(branch) {
|
|
232
|
-
branch
|
|
282
|
+
branch["#ParentBranch" /* ParentBranch */]?.["#BranchScopes" /* BranchScopes */]?.delete(
|
|
283
|
+
branch
|
|
284
|
+
);
|
|
233
285
|
destroyNestedBranches(branch);
|
|
234
286
|
}
|
|
235
287
|
function destroyNestedBranches(branch) {
|
|
236
|
-
branch
|
|
237
|
-
branch
|
|
238
|
-
branch
|
|
239
|
-
for (const id in scope
|
|
288
|
+
branch["#Destroyed" /* Destroyed */] = 1;
|
|
289
|
+
branch["#BranchScopes" /* BranchScopes */]?.forEach(destroyNestedBranches);
|
|
290
|
+
branch["#AbortScopes" /* AbortScopes */]?.forEach((scope) => {
|
|
291
|
+
for (const id in scope["#AbortControllers" /* AbortControllers */]) {
|
|
240
292
|
$signalReset(scope, id);
|
|
241
293
|
}
|
|
242
294
|
});
|
|
243
295
|
}
|
|
244
296
|
function removeAndDestroyBranch(branch) {
|
|
245
297
|
destroyBranch(branch);
|
|
246
|
-
removeChildNodes(
|
|
298
|
+
removeChildNodes(
|
|
299
|
+
branch["#StartNode" /* StartNode */],
|
|
300
|
+
branch["#EndNode" /* EndNode */]
|
|
301
|
+
);
|
|
247
302
|
}
|
|
248
303
|
function insertBranchBefore(branch, parentNode, nextSibling) {
|
|
249
304
|
insertChildNodes(
|
|
250
305
|
parentNode,
|
|
251
306
|
nextSibling,
|
|
252
|
-
branch
|
|
253
|
-
branch
|
|
307
|
+
branch["#StartNode" /* StartNode */],
|
|
308
|
+
branch["#EndNode" /* EndNode */]
|
|
254
309
|
);
|
|
255
310
|
}
|
|
256
311
|
function tempDetachBranch(branch) {
|
|
257
312
|
const fragment = new DocumentFragment();
|
|
258
|
-
fragment.namespaceURI = branch.
|
|
259
|
-
insertChildNodes(
|
|
313
|
+
fragment.namespaceURI = branch["#StartNode" /* StartNode */].parentNode.namespaceURI;
|
|
314
|
+
insertChildNodes(
|
|
315
|
+
fragment,
|
|
316
|
+
null,
|
|
317
|
+
branch["#StartNode" /* StartNode */],
|
|
318
|
+
branch["#EndNode" /* EndNode */]
|
|
319
|
+
);
|
|
260
320
|
}
|
|
261
321
|
|
|
262
322
|
// src/dom/walker.ts
|
|
@@ -267,6 +327,7 @@ function walk(startNode, walkCodes, branch) {
|
|
|
267
327
|
}
|
|
268
328
|
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
269
329
|
let value;
|
|
330
|
+
let id;
|
|
270
331
|
let storedMultiplier = 0;
|
|
271
332
|
let currentMultiplier = 0;
|
|
272
333
|
let currentScopeIndex = 0;
|
|
@@ -276,14 +337,14 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
|
276
337
|
storedMultiplier = 0;
|
|
277
338
|
if (value === 32 /* Get */) {
|
|
278
339
|
const node = walker.currentNode;
|
|
279
|
-
scope[true ? getDebugKey(currentScopeIndex
|
|
280
|
-
scope["Getter:" /* Getter */ +
|
|
340
|
+
scope[id = true ? getDebugKey(currentScopeIndex++, node) : decodeAccessor(currentScopeIndex++)] = node;
|
|
341
|
+
scope["Getter:" /* Getter */ + id] = () => node;
|
|
281
342
|
} else if (value === 37 /* Replace */ || value === 49 /* DynamicTagWithVar */) {
|
|
282
343
|
walker.currentNode.replaceWith(
|
|
283
|
-
walker.currentNode = scope[true ? getDebugKey(currentScopeIndex++, "#text") : currentScopeIndex++] = new Text()
|
|
344
|
+
walker.currentNode = scope[true ? getDebugKey(currentScopeIndex++, "#text") : decodeAccessor(currentScopeIndex++)] = new Text()
|
|
284
345
|
);
|
|
285
346
|
if (value === 49 /* DynamicTagWithVar */) {
|
|
286
|
-
scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope();
|
|
347
|
+
scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : decodeAccessor(currentScopeIndex++)] = skipScope();
|
|
287
348
|
}
|
|
288
349
|
} else if (value === 38 /* EndChild */) {
|
|
289
350
|
return currentWalkIndex;
|
|
@@ -291,10 +352,13 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
|
291
352
|
currentWalkIndex = walkInternal(
|
|
292
353
|
currentWalkIndex,
|
|
293
354
|
walkCodes,
|
|
294
|
-
scope[true ? getDebugKey(currentScopeIndex++, "#childScope") : currentScopeIndex++] = createScope(
|
|
355
|
+
scope[true ? getDebugKey(currentScopeIndex++, "#childScope") : decodeAccessor(currentScopeIndex++)] = createScope(
|
|
356
|
+
scope["$global" /* Global */],
|
|
357
|
+
scope["#ClosestBranch" /* ClosestBranch */]
|
|
358
|
+
)
|
|
295
359
|
);
|
|
296
360
|
if (value === 48 /* BeginChildWithVar */) {
|
|
297
|
-
scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope();
|
|
361
|
+
scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : decodeAccessor(currentScopeIndex++)] = skipScope();
|
|
298
362
|
}
|
|
299
363
|
} else if (value < 91 /* NextEnd */ + 1) {
|
|
300
364
|
value = 20 /* Next */ * currentMultiplier + value - 67 /* Next */;
|
|
@@ -377,17 +441,17 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
377
441
|
while (startVisit.previousSibling && ~visits.indexOf(
|
|
378
442
|
startVisit = startVisit.previousSibling
|
|
379
443
|
)) ;
|
|
380
|
-
branch
|
|
444
|
+
branch["#EndNode" /* EndNode */] = branch["#StartNode" /* StartNode */] = startVisit;
|
|
381
445
|
if (visitType === "'" /* BranchEndNativeTag */) {
|
|
382
|
-
branch[true ? getDebugKey(0, startVisit) :
|
|
446
|
+
branch[true ? getDebugKey(0, startVisit) : "a"] = startVisit;
|
|
383
447
|
}
|
|
384
448
|
} else {
|
|
385
449
|
startVisit = branchStarts.pop();
|
|
386
450
|
if (parent !== startVisit.parentNode) {
|
|
387
451
|
parent.prepend(startVisit);
|
|
388
452
|
}
|
|
389
|
-
branch
|
|
390
|
-
branch
|
|
453
|
+
branch["#StartNode" /* StartNode */] = startVisit;
|
|
454
|
+
branch["#EndNode" /* EndNode */] = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
|
|
391
455
|
}
|
|
392
456
|
while (i-- && orphanBranches[i] > branchId) {
|
|
393
457
|
branchParents.set(orphanBranches[i], branchId);
|
|
@@ -418,12 +482,12 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
418
482
|
}
|
|
419
483
|
},
|
|
420
484
|
___scope(scope) {
|
|
421
|
-
scope
|
|
485
|
+
scope["#ClosestBranch" /* ClosestBranch */] = scopeLookup[scope["#ClosestBranchId" /* ClosestBranchId */] || branchParents.get(scopeId)];
|
|
422
486
|
if (branchParents.has(scopeId)) {
|
|
423
|
-
if (scope
|
|
424
|
-
((scope
|
|
487
|
+
if (scope["#ClosestBranch" /* ClosestBranch */]) {
|
|
488
|
+
((scope["#ParentBranch" /* ParentBranch */] = scope["#ClosestBranch" /* ClosestBranch */])["#BranchScopes" /* BranchScopes */] ||= /* @__PURE__ */ new Set()).add(scope);
|
|
425
489
|
}
|
|
426
|
-
scope
|
|
490
|
+
scope["#ClosestBranch" /* ClosestBranch */] = scope;
|
|
427
491
|
}
|
|
428
492
|
}
|
|
429
493
|
};
|
|
@@ -455,7 +519,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
455
519
|
visitType = visitText[lastTokenIndex++];
|
|
456
520
|
if (scopeId = +nextToken()) {
|
|
457
521
|
visitScope = scopeLookup[scopeId] ||= {
|
|
458
|
-
|
|
522
|
+
["#Id" /* Id */]: scopeId
|
|
459
523
|
};
|
|
460
524
|
}
|
|
461
525
|
if (visitType === "*" /* Node */) {
|
|
@@ -470,7 +534,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
470
534
|
} else if (typeof serialized === "number") {
|
|
471
535
|
registeredValues[lastEffect](
|
|
472
536
|
scopeLookup[serialized] ||= {
|
|
473
|
-
|
|
537
|
+
["#Id" /* Id */]: scopeId
|
|
474
538
|
}
|
|
475
539
|
);
|
|
476
540
|
} else {
|
|
@@ -483,8 +547,8 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
483
547
|
lastScopeId += scope;
|
|
484
548
|
} else {
|
|
485
549
|
scopeId = ++lastScopeId;
|
|
486
|
-
scope
|
|
487
|
-
scope
|
|
550
|
+
scope["$global" /* Global */] = $global;
|
|
551
|
+
scope["#Id" /* Id */] = scopeId;
|
|
488
552
|
if (scopeLookup[scopeId] !== scope) {
|
|
489
553
|
scopeLookup[scopeId] = Object.assign(
|
|
490
554
|
scope,
|
|
@@ -494,9 +558,6 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
494
558
|
if (branchesEnabled) {
|
|
495
559
|
branches.___scope(scope);
|
|
496
560
|
}
|
|
497
|
-
if (true) {
|
|
498
|
-
scope.___debugId = "server-" + scopeId;
|
|
499
|
-
}
|
|
500
561
|
}
|
|
501
562
|
}
|
|
502
563
|
}
|
|
@@ -522,20 +583,22 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
522
583
|
}
|
|
523
584
|
}
|
|
524
585
|
var isResuming;
|
|
586
|
+
function getRegisteredWithScope(id, scope) {
|
|
587
|
+
const val = registeredValues[id];
|
|
588
|
+
return scope ? val(scope) : val;
|
|
589
|
+
}
|
|
525
590
|
function _resume(id, obj) {
|
|
526
|
-
registeredValues[id] = obj;
|
|
527
|
-
return obj;
|
|
591
|
+
return registeredValues[id] = obj;
|
|
528
592
|
}
|
|
529
593
|
function _var_resume(id, signal) {
|
|
530
|
-
|
|
594
|
+
_resume(id, (scope) => (value) => signal(scope, value));
|
|
531
595
|
return signal;
|
|
532
596
|
}
|
|
533
|
-
function
|
|
534
|
-
const
|
|
535
|
-
return scope
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
return _resume(id, (scope) => () => scope[key]());
|
|
597
|
+
function _el(id, accessor) {
|
|
598
|
+
const getterAccessor = "Getter:" /* Getter */ + (true ? accessor : decodeAccessor2(accessor));
|
|
599
|
+
return _resume(id, (scope) => () => {
|
|
600
|
+
return scope[getterAccessor]();
|
|
601
|
+
});
|
|
539
602
|
}
|
|
540
603
|
|
|
541
604
|
// src/dom/controllable.ts
|
|
@@ -862,48 +925,45 @@ function triggerMacroTask() {
|
|
|
862
925
|
}
|
|
863
926
|
|
|
864
927
|
// src/dom/signals.ts
|
|
865
|
-
function _let(
|
|
928
|
+
function _let(id, fn) {
|
|
929
|
+
const valueAccessor = true ? id.slice(0, id.lastIndexOf("/")) : decodeAccessor3(id);
|
|
930
|
+
const valueChangeAccessor = "TagVariableChange:" /* TagVariableChange */ + valueAccessor;
|
|
866
931
|
if (true) {
|
|
867
|
-
|
|
868
|
-
valueAccessor.lastIndexOf("/") + 1
|
|
869
|
-
);
|
|
870
|
-
valueAccessor = valueAccessor.slice(
|
|
871
|
-
0,
|
|
872
|
-
valueAccessor.lastIndexOf("/")
|
|
873
|
-
);
|
|
932
|
+
id = +valueAccessor.slice(valueAccessor.lastIndexOf("/") + 1);
|
|
874
933
|
}
|
|
875
|
-
const valueChangeAccessor = "TagVariableChange:" /* TagVariableChange */ + valueAccessor;
|
|
876
934
|
return (scope, value, valueChange) => {
|
|
877
935
|
if (rendering) {
|
|
878
|
-
if ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !== value || scope
|
|
936
|
+
if ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !== value || scope["#Creating" /* Creating */]) {
|
|
879
937
|
scope[valueAccessor] = value;
|
|
880
|
-
fn
|
|
938
|
+
fn?.(scope);
|
|
881
939
|
}
|
|
882
940
|
} else if (scope[valueChangeAccessor]) {
|
|
883
941
|
scope[valueChangeAccessor](value);
|
|
884
942
|
} else if (scope[valueAccessor] !== (scope[valueAccessor] = value) && fn) {
|
|
885
943
|
schedule();
|
|
886
|
-
queueRender(scope, fn,
|
|
944
|
+
queueRender(scope, fn, id);
|
|
887
945
|
}
|
|
888
946
|
return value;
|
|
889
947
|
};
|
|
890
948
|
}
|
|
891
|
-
function _const(valueAccessor, fn
|
|
892
|
-
|
|
949
|
+
function _const(valueAccessor, fn) {
|
|
950
|
+
if (false) valueAccessor = decodeAccessor3(valueAccessor);
|
|
893
951
|
return (scope, value) => {
|
|
894
952
|
if (!(valueAccessor in scope) || scope[valueAccessor] !== value) {
|
|
895
953
|
scope[valueAccessor] = value;
|
|
896
|
-
fn(scope);
|
|
954
|
+
fn?.(scope);
|
|
897
955
|
}
|
|
898
956
|
};
|
|
899
957
|
}
|
|
900
|
-
function _or(id, fn, defaultPending = 1, scopeIdAccessor = /*
|
|
958
|
+
function _or(id, fn, defaultPending = 1, scopeIdAccessor = "#Id" /* Id */) {
|
|
901
959
|
return (scope) => {
|
|
902
|
-
if (scope
|
|
903
|
-
if (
|
|
960
|
+
if (scope["#Creating" /* Creating */]) {
|
|
961
|
+
if (id in scope) {
|
|
962
|
+
if (!--scope[id]) {
|
|
963
|
+
fn(scope);
|
|
964
|
+
}
|
|
965
|
+
} else {
|
|
904
966
|
scope[id] = defaultPending;
|
|
905
|
-
} else if (!--scope[id]) {
|
|
906
|
-
fn(scope);
|
|
907
967
|
}
|
|
908
968
|
} else {
|
|
909
969
|
queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
|
@@ -911,6 +971,8 @@ function _or(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "___id
|
|
|
911
971
|
};
|
|
912
972
|
}
|
|
913
973
|
function _for_closure(ownerLoopNodeAccessor, fn) {
|
|
974
|
+
if (false)
|
|
975
|
+
ownerLoopNodeAccessor = decodeAccessor3(ownerLoopNodeAccessor);
|
|
914
976
|
const loopScopeAccessor = "LoopScopeArray:" /* LoopScopeArray */ + ownerLoopNodeAccessor;
|
|
915
977
|
const loopScopeMapAccessor = "LoopScopeMap:" /* LoopScopeMap */ + ownerLoopNodeAccessor;
|
|
916
978
|
const ownerSignal = (ownerScope) => {
|
|
@@ -921,14 +983,14 @@ function _for_closure(ownerLoopNodeAccessor, fn) {
|
|
|
921
983
|
ownerScope,
|
|
922
984
|
() => {
|
|
923
985
|
for (const scope of scopes) {
|
|
924
|
-
if (!scope
|
|
986
|
+
if (!scope["#Creating" /* Creating */] && !scope["#Destroyed" /* Destroyed */]) {
|
|
925
987
|
fn(scope);
|
|
926
988
|
}
|
|
927
989
|
}
|
|
928
990
|
},
|
|
929
991
|
-1,
|
|
930
992
|
0,
|
|
931
|
-
firstScope
|
|
993
|
+
firstScope["#Id" /* Id */]
|
|
932
994
|
);
|
|
933
995
|
}
|
|
934
996
|
};
|
|
@@ -936,11 +998,15 @@ function _for_closure(ownerLoopNodeAccessor, fn) {
|
|
|
936
998
|
return ownerSignal;
|
|
937
999
|
}
|
|
938
1000
|
function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
|
|
1001
|
+
if (false)
|
|
1002
|
+
ownerConditionalNodeAccessor = decodeAccessor3(
|
|
1003
|
+
ownerConditionalNodeAccessor
|
|
1004
|
+
);
|
|
939
1005
|
const scopeAccessor = "ConditionalScope:" /* ConditionalScope */ + ownerConditionalNodeAccessor;
|
|
940
1006
|
const branchAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + ownerConditionalNodeAccessor;
|
|
941
1007
|
const ownerSignal = (scope) => {
|
|
942
1008
|
const ifScope = scope[scopeAccessor];
|
|
943
|
-
if (ifScope && !ifScope
|
|
1009
|
+
if (ifScope && !ifScope["#Creating" /* Creating */] && (scope[branchAccessor] || 0) === branch) {
|
|
944
1010
|
queueRender(ifScope, fn, -1);
|
|
945
1011
|
}
|
|
946
1012
|
};
|
|
@@ -965,7 +1031,7 @@ function _closure(...closureSignals) {
|
|
|
965
1031
|
return (scope) => {
|
|
966
1032
|
if (scope[___scopeInstancesAccessor]) {
|
|
967
1033
|
for (const childScope of scope[___scopeInstancesAccessor]) {
|
|
968
|
-
if (!childScope
|
|
1034
|
+
if (!childScope["#Creating" /* Creating */]) {
|
|
969
1035
|
queueRender(
|
|
970
1036
|
childScope,
|
|
971
1037
|
closureSignals[childScope[___signalIndexAccessor]],
|
|
@@ -977,6 +1043,7 @@ function _closure(...closureSignals) {
|
|
|
977
1043
|
};
|
|
978
1044
|
}
|
|
979
1045
|
function _closure_get(valueAccessor, fn, getOwnerScope) {
|
|
1046
|
+
if (false) valueAccessor = decodeAccessor3(valueAccessor);
|
|
980
1047
|
const closureSignal = ((scope) => {
|
|
981
1048
|
scope[closureSignal.___signalIndexAccessor] = closureSignal.___index;
|
|
982
1049
|
fn(scope);
|
|
@@ -998,7 +1065,7 @@ function _child_setup(setup) {
|
|
|
998
1065
|
return setup;
|
|
999
1066
|
}
|
|
1000
1067
|
function _var(scope, childAccessor, signal) {
|
|
1001
|
-
scope[childAccessor]["#TagVariable" /* TagVariable */] = (value) => signal(scope, value);
|
|
1068
|
+
scope[true ? childAccessor : decodeAccessor3(childAccessor)]["#TagVariable" /* TagVariable */] = (value) => signal(scope, value);
|
|
1002
1069
|
}
|
|
1003
1070
|
var _return = (scope, value) => scope["#TagVariable" /* TagVariable */]?.(value);
|
|
1004
1071
|
function _return_change(scope, changeHandler) {
|
|
@@ -1013,7 +1080,7 @@ var _var_change = true ? (scope, value, name = "This") => {
|
|
|
1013
1080
|
scope["#TagVariableChange" /* TagVariableChange */](value);
|
|
1014
1081
|
} : (scope, value) => scope["#TagVariableChange" /* TagVariableChange */]?.(value);
|
|
1015
1082
|
var tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
|
1016
|
-
function _id({ $global }) {
|
|
1083
|
+
function _id({ ["$global" /* Global */]: $global }) {
|
|
1017
1084
|
const id = tagIdsByGlobal.get($global) || 0;
|
|
1018
1085
|
tagIdsByGlobal.set($global, id + 1);
|
|
1019
1086
|
return "c" + $global.runtimeId + $global.renderId + id.toString(36);
|
|
@@ -1047,6 +1114,8 @@ function* traverseAllHoisted(scope, path, curIndex = path.length - 1) {
|
|
|
1047
1114
|
}
|
|
1048
1115
|
}
|
|
1049
1116
|
function _hoist(...path) {
|
|
1117
|
+
if (false)
|
|
1118
|
+
path = path.map((p) => typeof p === "string" ? p : decodeAccessor3(p));
|
|
1050
1119
|
return (scope) => {
|
|
1051
1120
|
const getOne = (...args) => iterator().next().value?.(...args);
|
|
1052
1121
|
const iterator = getOne[Symbol.iterator] = () => traverseAllHoisted(scope, path);
|
|
@@ -1057,15 +1126,15 @@ function _hoist(...path) {
|
|
|
1057
1126
|
// src/dom/renderer.ts
|
|
1058
1127
|
function createBranch($global, renderer, parentScope, parentNode) {
|
|
1059
1128
|
const branch = createScope($global);
|
|
1060
|
-
const parentBranch = parentScope?.
|
|
1129
|
+
const parentBranch = parentScope?.["#ClosestBranch" /* ClosestBranch */];
|
|
1061
1130
|
branch["_" /* Owner */] = renderer.___owner || parentScope;
|
|
1062
|
-
branch
|
|
1131
|
+
branch["#ClosestBranch" /* ClosestBranch */] = branch;
|
|
1063
1132
|
if (parentBranch) {
|
|
1064
|
-
branch
|
|
1065
|
-
(parentBranch
|
|
1133
|
+
branch["#ParentBranch" /* ParentBranch */] = parentBranch;
|
|
1134
|
+
(parentBranch["#BranchScopes" /* BranchScopes */] ||= /* @__PURE__ */ new Set()).add(branch);
|
|
1066
1135
|
}
|
|
1067
1136
|
if (true) {
|
|
1068
|
-
branch
|
|
1137
|
+
branch["#Renderer" /* Renderer */] = renderer;
|
|
1069
1138
|
}
|
|
1070
1139
|
renderer.___clone?.(
|
|
1071
1140
|
branch,
|
|
@@ -1096,7 +1165,7 @@ function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
|
|
|
1096
1165
|
))(branch, walks);
|
|
1097
1166
|
} : (branch) => {
|
|
1098
1167
|
walk(
|
|
1099
|
-
branch
|
|
1168
|
+
branch["#StartNode" /* StartNode */] = branch["#EndNode" /* EndNode */] = new Text(),
|
|
1100
1169
|
walks,
|
|
1101
1170
|
branch
|
|
1102
1171
|
);
|
|
@@ -1121,7 +1190,7 @@ function _content_resume(id, template, walks, setup, params, dynamicScopesAccess
|
|
|
1121
1190
|
function _content_closures(renderer, closureFns) {
|
|
1122
1191
|
const closureSignals = {};
|
|
1123
1192
|
for (const key in closureFns) {
|
|
1124
|
-
closureSignals[key] = _const(key, closureFns[key]);
|
|
1193
|
+
closureSignals[key] = _const(true ? key : +key, closureFns[key]);
|
|
1125
1194
|
}
|
|
1126
1195
|
return (owner, closureValues) => {
|
|
1127
1196
|
const instance = renderer(owner);
|
|
@@ -1140,15 +1209,15 @@ function createCloneableHTML(html, ns) {
|
|
|
1140
1209
|
insertChildNodes(parent, null, firstChild, lastChild);
|
|
1141
1210
|
return firstChild === lastChild && firstChild.nodeType < 8 /* Comment */ ? (branch, walks) => {
|
|
1142
1211
|
walk(
|
|
1143
|
-
branch
|
|
1212
|
+
branch["#StartNode" /* StartNode */] = branch["#EndNode" /* EndNode */] = firstChild.cloneNode(true),
|
|
1144
1213
|
walks,
|
|
1145
1214
|
branch
|
|
1146
1215
|
);
|
|
1147
1216
|
} : (branch, walks) => {
|
|
1148
1217
|
const clone = parent.cloneNode(true);
|
|
1149
1218
|
walk(clone.firstChild, walks, branch);
|
|
1150
|
-
branch
|
|
1151
|
-
branch
|
|
1219
|
+
branch["#StartNode" /* StartNode */] = clone.firstChild;
|
|
1220
|
+
branch["#EndNode" /* EndNode */] = clone.lastChild;
|
|
1152
1221
|
};
|
|
1153
1222
|
}
|
|
1154
1223
|
|
|
@@ -1207,6 +1276,9 @@ function _attrs(scope, nodeAccessor, nextAttrs) {
|
|
|
1207
1276
|
el.removeAttribute(name);
|
|
1208
1277
|
}
|
|
1209
1278
|
}
|
|
1279
|
+
if (true) {
|
|
1280
|
+
assertExclusiveAttrs(nextAttrs);
|
|
1281
|
+
}
|
|
1210
1282
|
attrsInternal(scope, nodeAccessor, nextAttrs);
|
|
1211
1283
|
}
|
|
1212
1284
|
function _attrs_content(scope, nodeAccessor, nextAttrs) {
|
|
@@ -1228,6 +1300,9 @@ function _attrs_partial(scope, nodeAccessor, nextAttrs, skip) {
|
|
|
1228
1300
|
for (const key in nextAttrs) {
|
|
1229
1301
|
if (!skip[key]) partial[key] = nextAttrs[key];
|
|
1230
1302
|
}
|
|
1303
|
+
if (true) {
|
|
1304
|
+
assertExclusiveAttrs({ ...nextAttrs, ...skip });
|
|
1305
|
+
}
|
|
1231
1306
|
attrsInternal(scope, nodeAccessor, partial);
|
|
1232
1307
|
}
|
|
1233
1308
|
function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip) {
|
|
@@ -1472,7 +1547,7 @@ function reconcile(parent, oldBranches, newBranches, afterReference) {
|
|
|
1472
1547
|
if (oldStart > oldEnd) {
|
|
1473
1548
|
if (newStart <= newEnd) {
|
|
1474
1549
|
k = newEnd + 1;
|
|
1475
|
-
nextSibling = k < newBranches.length ? newBranches[k]
|
|
1550
|
+
nextSibling = k < newBranches.length ? newBranches[k]["#StartNode" /* StartNode */] : afterReference;
|
|
1476
1551
|
do {
|
|
1477
1552
|
insertBranchBefore(newBranches[newStart++], parent, nextSibling);
|
|
1478
1553
|
} while (newStart <= newEnd);
|
|
@@ -1530,13 +1605,13 @@ function reconcile(parent, oldBranches, newBranches, afterReference) {
|
|
|
1530
1605
|
if (sources[i] === -1) {
|
|
1531
1606
|
pos = i + newStart;
|
|
1532
1607
|
newBranch = newBranches[pos++];
|
|
1533
|
-
nextSibling = pos < k ? newBranches[pos]
|
|
1608
|
+
nextSibling = pos < k ? newBranches[pos]["#StartNode" /* StartNode */] : afterReference;
|
|
1534
1609
|
insertBranchBefore(newBranch, parent, nextSibling);
|
|
1535
1610
|
} else {
|
|
1536
1611
|
if (j < 0 || i !== seq[j]) {
|
|
1537
1612
|
pos = i + newStart;
|
|
1538
1613
|
newBranch = newBranches[pos++];
|
|
1539
|
-
nextSibling = pos < k ? newBranches[pos]
|
|
1614
|
+
nextSibling = pos < k ? newBranches[pos]["#StartNode" /* StartNode */] : afterReference;
|
|
1540
1615
|
insertBranchBefore(newBranch, parent, nextSibling);
|
|
1541
1616
|
} else {
|
|
1542
1617
|
--j;
|
|
@@ -1549,7 +1624,7 @@ function reconcile(parent, oldBranches, newBranches, afterReference) {
|
|
|
1549
1624
|
if (sources[i] === -1) {
|
|
1550
1625
|
pos = i + newStart;
|
|
1551
1626
|
newBranch = newBranches[pos++];
|
|
1552
|
-
nextSibling = pos < k ? newBranches[pos]
|
|
1627
|
+
nextSibling = pos < k ? newBranches[pos]["#StartNode" /* StartNode */] : afterReference;
|
|
1553
1628
|
insertBranchBefore(newBranch, parent, nextSibling);
|
|
1554
1629
|
}
|
|
1555
1630
|
}
|
|
@@ -1600,6 +1675,7 @@ function longestIncreasingSubsequence(a) {
|
|
|
1600
1675
|
|
|
1601
1676
|
// src/dom/control-flow.ts
|
|
1602
1677
|
function _await(nodeAccessor, renderer) {
|
|
1678
|
+
if (false) nodeAccessor = decodeAccessor4(nodeAccessor);
|
|
1603
1679
|
const promiseAccessor = "Promise:" /* Promise */ + nodeAccessor;
|
|
1604
1680
|
const branchAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
|
|
1605
1681
|
enableBranches();
|
|
@@ -1612,22 +1688,22 @@ function _await(nodeAccessor, renderer) {
|
|
|
1612
1688
|
let awaitBranch = scope[branchAccessor];
|
|
1613
1689
|
if (tryWithPlaceholder) {
|
|
1614
1690
|
placeholderShown.add(pendingEffects);
|
|
1615
|
-
if (!scope[promiseAccessor] && (tryWithPlaceholder
|
|
1691
|
+
if (!scope[promiseAccessor] && (tryWithPlaceholder["#PendingAsyncCount" /* PendingAsyncCount */] = (tryWithPlaceholder["#PendingAsyncCount" /* PendingAsyncCount */] || 0) + 1) === 1) {
|
|
1616
1692
|
requestAnimationFrame(
|
|
1617
|
-
() => tryWithPlaceholder
|
|
1693
|
+
() => tryWithPlaceholder["#PendingAsyncCount" /* PendingAsyncCount */] && runEffects(
|
|
1618
1694
|
prepareEffects(
|
|
1619
1695
|
() => queueRender(
|
|
1620
1696
|
tryWithPlaceholder,
|
|
1621
1697
|
() => {
|
|
1622
1698
|
insertBranchBefore(
|
|
1623
1699
|
tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */] = createAndSetupBranch(
|
|
1624
|
-
scope
|
|
1700
|
+
scope["$global" /* Global */],
|
|
1625
1701
|
tryWithPlaceholder["#PlaceholderContent" /* PlaceholderContent */],
|
|
1626
1702
|
tryWithPlaceholder["_" /* Owner */],
|
|
1627
|
-
tryWithPlaceholder.
|
|
1703
|
+
tryWithPlaceholder["#StartNode" /* StartNode */].parentNode
|
|
1628
1704
|
),
|
|
1629
|
-
tryWithPlaceholder.
|
|
1630
|
-
tryWithPlaceholder
|
|
1705
|
+
tryWithPlaceholder["#StartNode" /* StartNode */].parentNode,
|
|
1706
|
+
tryWithPlaceholder["#StartNode" /* StartNode */]
|
|
1631
1707
|
);
|
|
1632
1708
|
tempDetachBranch(tryWithPlaceholder);
|
|
1633
1709
|
},
|
|
@@ -1638,9 +1714,9 @@ function _await(nodeAccessor, renderer) {
|
|
|
1638
1714
|
);
|
|
1639
1715
|
}
|
|
1640
1716
|
} else if (awaitBranch && !scope[promiseAccessor]) {
|
|
1641
|
-
awaitBranch.
|
|
1717
|
+
awaitBranch["#StartNode" /* StartNode */].parentNode.insertBefore(
|
|
1642
1718
|
referenceNode,
|
|
1643
|
-
awaitBranch
|
|
1719
|
+
awaitBranch["#StartNode" /* StartNode */]
|
|
1644
1720
|
);
|
|
1645
1721
|
tempDetachBranch(awaitBranch);
|
|
1646
1722
|
}
|
|
@@ -1655,13 +1731,13 @@ function _await(nodeAccessor, renderer) {
|
|
|
1655
1731
|
if (awaitBranch) {
|
|
1656
1732
|
if (!tryWithPlaceholder) {
|
|
1657
1733
|
referenceNode.replaceWith(
|
|
1658
|
-
awaitBranch.
|
|
1734
|
+
awaitBranch["#StartNode" /* StartNode */].parentNode
|
|
1659
1735
|
);
|
|
1660
1736
|
}
|
|
1661
1737
|
} else {
|
|
1662
1738
|
insertBranchBefore(
|
|
1663
1739
|
awaitBranch = scope[branchAccessor] = createAndSetupBranch(
|
|
1664
|
-
scope
|
|
1740
|
+
scope["$global" /* Global */],
|
|
1665
1741
|
renderer,
|
|
1666
1742
|
scope,
|
|
1667
1743
|
referenceNode.parentNode
|
|
@@ -1674,20 +1750,20 @@ function _await(nodeAccessor, renderer) {
|
|
|
1674
1750
|
renderer.___params?.(awaitBranch, [data]);
|
|
1675
1751
|
if (tryWithPlaceholder) {
|
|
1676
1752
|
placeholderShown.add(pendingEffects);
|
|
1677
|
-
if (!--tryWithPlaceholder
|
|
1753
|
+
if (!--tryWithPlaceholder["#PendingAsyncCount" /* PendingAsyncCount */]) {
|
|
1678
1754
|
const placeholderBranch = tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */];
|
|
1679
1755
|
tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */] = 0;
|
|
1680
1756
|
if (placeholderBranch) {
|
|
1681
|
-
placeholderBranch.
|
|
1682
|
-
tryWithPlaceholder.
|
|
1683
|
-
placeholderBranch
|
|
1757
|
+
placeholderBranch["#StartNode" /* StartNode */].parentNode.insertBefore(
|
|
1758
|
+
tryWithPlaceholder["#StartNode" /* StartNode */].parentNode,
|
|
1759
|
+
placeholderBranch["#StartNode" /* StartNode */]
|
|
1684
1760
|
);
|
|
1685
1761
|
removeAndDestroyBranch(placeholderBranch);
|
|
1686
1762
|
}
|
|
1687
1763
|
queueEffect(tryWithPlaceholder, (scope2) => {
|
|
1688
|
-
const pendingEffects2 = scope2
|
|
1764
|
+
const pendingEffects2 = scope2["#Effects" /* Effects */];
|
|
1689
1765
|
if (pendingEffects2) {
|
|
1690
|
-
scope2
|
|
1766
|
+
scope2["#Effects" /* Effects */] = [];
|
|
1691
1767
|
runEffects(pendingEffects2, true);
|
|
1692
1768
|
}
|
|
1693
1769
|
});
|
|
@@ -1700,7 +1776,8 @@ function _await(nodeAccessor, renderer) {
|
|
|
1700
1776
|
},
|
|
1701
1777
|
(error) => {
|
|
1702
1778
|
if (thisPromise === scope[promiseAccessor]) {
|
|
1703
|
-
if (tryWithPlaceholder)
|
|
1779
|
+
if (tryWithPlaceholder)
|
|
1780
|
+
tryWithPlaceholder["#PendingAsyncCount" /* PendingAsyncCount */] = 0;
|
|
1704
1781
|
scope[promiseAccessor] = 0;
|
|
1705
1782
|
schedule();
|
|
1706
1783
|
queueRender(scope, renderCatch, -1, error);
|
|
@@ -1710,6 +1787,7 @@ function _await(nodeAccessor, renderer) {
|
|
|
1710
1787
|
};
|
|
1711
1788
|
}
|
|
1712
1789
|
function _try(nodeAccessor, content) {
|
|
1790
|
+
if (false) nodeAccessor = decodeAccessor4(nodeAccessor);
|
|
1713
1791
|
const branchAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
|
|
1714
1792
|
return (scope, input) => {
|
|
1715
1793
|
if (!scope[branchAccessor]) {
|
|
@@ -1738,7 +1816,7 @@ function renderCatch(scope, error) {
|
|
|
1738
1816
|
const owner = tryWithCatch["_" /* Owner */];
|
|
1739
1817
|
const placeholderBranch = tryWithCatch["#PlaceholderBranch" /* PlaceholderBranch */];
|
|
1740
1818
|
if (placeholderBranch) {
|
|
1741
|
-
tryWithCatch
|
|
1819
|
+
tryWithCatch["#PendingAsyncCount" /* PendingAsyncCount */] = 0;
|
|
1742
1820
|
owner["ConditionalScope:" /* ConditionalScope */ + tryWithCatch["#BranchAccessor" /* BranchAccessor */]] = placeholderBranch;
|
|
1743
1821
|
destroyBranch(tryWithCatch);
|
|
1744
1822
|
}
|
|
@@ -1756,6 +1834,7 @@ function renderCatch(scope, error) {
|
|
|
1756
1834
|
}
|
|
1757
1835
|
}
|
|
1758
1836
|
function _if(nodeAccessor, ...branches) {
|
|
1837
|
+
if (false) nodeAccessor = decodeAccessor4(nodeAccessor);
|
|
1759
1838
|
const branchAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + nodeAccessor;
|
|
1760
1839
|
enableBranches();
|
|
1761
1840
|
return (scope, newBranch) => {
|
|
@@ -1773,6 +1852,7 @@ function patchDynamicTag(fn) {
|
|
|
1773
1852
|
_dynamic_tag = fn(_dynamic_tag);
|
|
1774
1853
|
}
|
|
1775
1854
|
var _dynamic_tag = function dynamicTag(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1855
|
+
if (false) nodeAccessor = decodeAccessor4(nodeAccessor);
|
|
1776
1856
|
const childScopeAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
|
|
1777
1857
|
const rendererAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + nodeAccessor;
|
|
1778
1858
|
enableBranches();
|
|
@@ -1786,14 +1866,14 @@ var _dynamic_tag = function dynamicTag(nodeAccessor, getContent, getTagVar, inpu
|
|
|
1786
1866
|
createBranchWithTagNameOrRenderer
|
|
1787
1867
|
);
|
|
1788
1868
|
if (getTagVar) {
|
|
1789
|
-
|
|
1869
|
+
scope[childScopeAccessor]["#TagVariable" /* TagVariable */] = (value) => getTagVar()(scope, value);
|
|
1790
1870
|
}
|
|
1791
1871
|
if (typeof normalizedRenderer === "string") {
|
|
1792
1872
|
if (getContent) {
|
|
1793
1873
|
const content = getContent(scope);
|
|
1794
1874
|
setConditionalRenderer(
|
|
1795
1875
|
scope[childScopeAccessor],
|
|
1796
|
-
true ? `#${normalizedRenderer}/0` :
|
|
1876
|
+
true ? `#${normalizedRenderer}/0` : "a",
|
|
1797
1877
|
content,
|
|
1798
1878
|
createAndSetupBranch
|
|
1799
1879
|
);
|
|
@@ -1801,7 +1881,7 @@ var _dynamic_tag = function dynamicTag(nodeAccessor, getContent, getTagVar, inpu
|
|
|
1801
1881
|
subscribeToScopeSet(
|
|
1802
1882
|
content.___owner,
|
|
1803
1883
|
content.___accessor,
|
|
1804
|
-
scope[childScopeAccessor]["ConditionalScope:" /* ConditionalScope */ + (true ? `#${normalizedRenderer}/0` :
|
|
1884
|
+
scope[childScopeAccessor]["ConditionalScope:" /* ConditionalScope */ + (true ? `#${normalizedRenderer}/0` : "a")]
|
|
1805
1885
|
);
|
|
1806
1886
|
}
|
|
1807
1887
|
}
|
|
@@ -1819,9 +1899,12 @@ var _dynamic_tag = function dynamicTag(nodeAccessor, getContent, getTagVar, inpu
|
|
|
1819
1899
|
if (typeof normalizedRenderer === "string") {
|
|
1820
1900
|
(getContent ? _attrs : _attrs_content)(
|
|
1821
1901
|
childScope,
|
|
1822
|
-
true ? `#${normalizedRenderer}/0` :
|
|
1902
|
+
true ? `#${normalizedRenderer}/0` : "a",
|
|
1823
1903
|
(inputIsArgs ? args[0] : args) || {}
|
|
1824
1904
|
);
|
|
1905
|
+
if (childScope["EventAttributes:" /* EventAttributes */ + (true ? `#${normalizedRenderer}/0` : "a")] || childScope["ControlledHandler:" /* ControlledHandler */ + (true ? `#${normalizedRenderer}/0` : "a")]) {
|
|
1906
|
+
queueEffect(childScope, dynamicTagScript);
|
|
1907
|
+
}
|
|
1825
1908
|
} else {
|
|
1826
1909
|
for (const accessor in normalizedRenderer.___localClosures) {
|
|
1827
1910
|
normalizedRenderer.___localClosures[accessor](
|
|
@@ -1847,11 +1930,20 @@ var _dynamic_tag = function dynamicTag(nodeAccessor, getContent, getTagVar, inpu
|
|
|
1847
1930
|
}
|
|
1848
1931
|
};
|
|
1849
1932
|
};
|
|
1933
|
+
function _resume_dynamic_tag() {
|
|
1934
|
+
_resume(DYNAMIC_TAG_SCRIPT_REGISTER_ID, dynamicTagScript);
|
|
1935
|
+
}
|
|
1936
|
+
function dynamicTagScript(branch) {
|
|
1937
|
+
_attrs_script(
|
|
1938
|
+
branch,
|
|
1939
|
+
true ? `#${branch["#Renderer" /* Renderer */]}/0` : "a"
|
|
1940
|
+
);
|
|
1941
|
+
}
|
|
1850
1942
|
function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
|
|
1851
1943
|
const referenceNode = scope[nodeAccessor];
|
|
1852
1944
|
const prevBranch = scope["ConditionalScope:" /* ConditionalScope */ + nodeAccessor];
|
|
1853
|
-
const parentNode = referenceNode.nodeType > 1 /* Element */ ? (prevBranch?.
|
|
1854
|
-
const newBranch = scope["ConditionalScope:" /* ConditionalScope */ + nodeAccessor] = newRenderer && createBranch2(scope
|
|
1945
|
+
const parentNode = referenceNode.nodeType > 1 /* Element */ ? (prevBranch?.["#StartNode" /* StartNode */] || referenceNode).parentNode : referenceNode;
|
|
1946
|
+
const newBranch = scope["ConditionalScope:" /* ConditionalScope */ + nodeAccessor] = newRenderer && createBranch2(scope["$global" /* Global */], newRenderer, scope, parentNode);
|
|
1855
1947
|
if (referenceNode === parentNode) {
|
|
1856
1948
|
if (prevBranch) {
|
|
1857
1949
|
destroyBranch(prevBranch);
|
|
@@ -1862,9 +1954,16 @@ function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2)
|
|
|
1862
1954
|
}
|
|
1863
1955
|
} else if (prevBranch) {
|
|
1864
1956
|
if (newBranch) {
|
|
1865
|
-
insertBranchBefore(
|
|
1957
|
+
insertBranchBefore(
|
|
1958
|
+
newBranch,
|
|
1959
|
+
parentNode,
|
|
1960
|
+
prevBranch["#StartNode" /* StartNode */]
|
|
1961
|
+
);
|
|
1866
1962
|
} else {
|
|
1867
|
-
parentNode.insertBefore(
|
|
1963
|
+
parentNode.insertBefore(
|
|
1964
|
+
referenceNode,
|
|
1965
|
+
prevBranch["#StartNode" /* StartNode */]
|
|
1966
|
+
);
|
|
1868
1967
|
}
|
|
1869
1968
|
removeAndDestroyBranch(prevBranch);
|
|
1870
1969
|
} else if (newBranch) {
|
|
@@ -1911,6 +2010,7 @@ function _for_until(nodeAccessor, renderer) {
|
|
|
1911
2010
|
}
|
|
1912
2011
|
function loop(nodeAccessor, renderer, forEach) {
|
|
1913
2012
|
const params = renderer.___params;
|
|
2013
|
+
if (false) nodeAccessor = decodeAccessor4(nodeAccessor);
|
|
1914
2014
|
enableBranches();
|
|
1915
2015
|
return (scope, value) => {
|
|
1916
2016
|
const referenceNode = scope[nodeAccessor];
|
|
@@ -1918,7 +2018,7 @@ function loop(nodeAccessor, renderer, forEach) {
|
|
|
1918
2018
|
const oldArray = oldMap ? scope["LoopScopeArray:" /* LoopScopeArray */ + nodeAccessor] || [
|
|
1919
2019
|
...oldMap.values()
|
|
1920
2020
|
] : [];
|
|
1921
|
-
const parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].
|
|
2021
|
+
const parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0]["#StartNode" /* StartNode */].parentNode : referenceNode;
|
|
1922
2022
|
const newMap = scope["LoopScopeMap:" /* LoopScopeMap */ + nodeAccessor] = /* @__PURE__ */ new Map();
|
|
1923
2023
|
const newArray = scope["LoopScopeArray:" /* LoopScopeArray */ + nodeAccessor] = [];
|
|
1924
2024
|
forEach(value, (key, args) => {
|
|
@@ -1930,7 +2030,12 @@ function loop(nodeAccessor, renderer, forEach) {
|
|
|
1930
2030
|
);
|
|
1931
2031
|
}
|
|
1932
2032
|
}
|
|
1933
|
-
const branch = oldMap?.get(key) || createAndSetupBranch(
|
|
2033
|
+
const branch = oldMap?.get(key) || createAndSetupBranch(
|
|
2034
|
+
scope["$global" /* Global */],
|
|
2035
|
+
renderer,
|
|
2036
|
+
scope,
|
|
2037
|
+
parentNode
|
|
2038
|
+
);
|
|
1934
2039
|
params?.(branch, args);
|
|
1935
2040
|
newMap.set(key, branch);
|
|
1936
2041
|
newArray.push(branch);
|
|
@@ -1938,7 +2043,7 @@ function loop(nodeAccessor, renderer, forEach) {
|
|
|
1938
2043
|
let afterReference = null;
|
|
1939
2044
|
if (referenceNode !== parentNode) {
|
|
1940
2045
|
if (oldArray.length) {
|
|
1941
|
-
afterReference = oldArray[oldArray.length - 1].
|
|
2046
|
+
afterReference = oldArray[oldArray.length - 1]["#EndNode" /* EndNode */].nextSibling;
|
|
1942
2047
|
if (!newArray.length) {
|
|
1943
2048
|
parentNode.insertBefore(referenceNode, afterReference);
|
|
1944
2049
|
}
|
|
@@ -1951,6 +2056,9 @@ function loop(nodeAccessor, renderer, forEach) {
|
|
|
1951
2056
|
};
|
|
1952
2057
|
}
|
|
1953
2058
|
function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
|
|
2059
|
+
if (typeof tagNameOrRenderer === "string") {
|
|
2060
|
+
assertValidTagName(tagNameOrRenderer);
|
|
2061
|
+
}
|
|
1954
2062
|
const branch = createBranch(
|
|
1955
2063
|
$global,
|
|
1956
2064
|
tagNameOrRenderer,
|
|
@@ -1958,7 +2066,7 @@ function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentSco
|
|
|
1958
2066
|
parentNode
|
|
1959
2067
|
);
|
|
1960
2068
|
if (typeof tagNameOrRenderer === "string") {
|
|
1961
|
-
branch[true ? `#${tagNameOrRenderer}/0` :
|
|
2069
|
+
branch[true ? `#${tagNameOrRenderer}/0` : "a"] = branch["#StartNode" /* StartNode */] = branch["#EndNode" /* EndNode */] = document.createElementNS(
|
|
1962
2070
|
tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI,
|
|
1963
2071
|
tagNameOrRenderer
|
|
1964
2072
|
);
|
|
@@ -1983,7 +2091,7 @@ var pendingEffects = [];
|
|
|
1983
2091
|
var pendingScopes = [];
|
|
1984
2092
|
var rendering;
|
|
1985
2093
|
var scopeKeyOffset = 1e3;
|
|
1986
|
-
function queueRender(scope, signal, signalKey, value, scopeKey = scope
|
|
2094
|
+
function queueRender(scope, signal, signalKey, value, scopeKey = scope["#Id" /* Id */]) {
|
|
1987
2095
|
const key = scopeKey * scopeKeyOffset + signalKey;
|
|
1988
2096
|
const existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
|
|
1989
2097
|
if (existingRender) {
|
|
@@ -2070,12 +2178,12 @@ function runRenders() {
|
|
|
2070
2178
|
}
|
|
2071
2179
|
pendingRenders[i] = item;
|
|
2072
2180
|
}
|
|
2073
|
-
if (!render.___scope
|
|
2181
|
+
if (!render.___scope["#ClosestBranch" /* ClosestBranch */]?.["#Destroyed" /* Destroyed */]) {
|
|
2074
2182
|
runRender(render);
|
|
2075
2183
|
}
|
|
2076
2184
|
}
|
|
2077
2185
|
for (const scope of pendingScopes) {
|
|
2078
|
-
scope
|
|
2186
|
+
scope["#Creating" /* Creating */] = 0;
|
|
2079
2187
|
}
|
|
2080
2188
|
pendingScopes = [];
|
|
2081
2189
|
}
|
|
@@ -2086,10 +2194,10 @@ var _enable_catch = () => {
|
|
|
2086
2194
|
enableBranches();
|
|
2087
2195
|
const handlePendingTry = (fn, scope, branch) => {
|
|
2088
2196
|
while (branch) {
|
|
2089
|
-
if (branch
|
|
2090
|
-
return (branch
|
|
2197
|
+
if (branch["#PendingAsyncCount" /* PendingAsyncCount */]) {
|
|
2198
|
+
return (branch["#Effects" /* Effects */] ||= []).push(fn, scope);
|
|
2091
2199
|
}
|
|
2092
|
-
branch = branch
|
|
2200
|
+
branch = branch["#ParentBranch" /* ParentBranch */];
|
|
2093
2201
|
}
|
|
2094
2202
|
};
|
|
2095
2203
|
runEffects = /* @__PURE__ */ ((runEffects2) => (effects, checkPending = placeholderShown.has(effects)) => {
|
|
@@ -2101,8 +2209,8 @@ var _enable_catch = () => {
|
|
|
2101
2209
|
for (; i < effects.length; ) {
|
|
2102
2210
|
fn = effects[i++];
|
|
2103
2211
|
scope = effects[i++];
|
|
2104
|
-
branch = scope
|
|
2105
|
-
if (!branch?.
|
|
2212
|
+
branch = scope["#ClosestBranch" /* ClosestBranch */];
|
|
2213
|
+
if (!branch?.["#Destroyed" /* Destroyed */] && !(checkPending && handlePendingTry(fn, scope, branch))) {
|
|
2106
2214
|
fn(scope);
|
|
2107
2215
|
}
|
|
2108
2216
|
}
|
|
@@ -2121,17 +2229,17 @@ var _enable_catch = () => {
|
|
|
2121
2229
|
|
|
2122
2230
|
// src/dom/abort-signal.ts
|
|
2123
2231
|
function $signalReset(scope, id) {
|
|
2124
|
-
const ctrl = scope
|
|
2232
|
+
const ctrl = scope["#AbortControllers" /* AbortControllers */]?.[id];
|
|
2125
2233
|
if (ctrl) {
|
|
2126
2234
|
queueEffect(ctrl, abort);
|
|
2127
|
-
scope
|
|
2235
|
+
scope["#AbortControllers" /* AbortControllers */][id] = void 0;
|
|
2128
2236
|
}
|
|
2129
2237
|
}
|
|
2130
2238
|
function $signal(scope, id) {
|
|
2131
|
-
if (scope
|
|
2132
|
-
(scope
|
|
2239
|
+
if (scope["#ClosestBranch" /* ClosestBranch */]) {
|
|
2240
|
+
(scope["#ClosestBranch" /* ClosestBranch */]["#AbortScopes" /* AbortScopes */] ||= /* @__PURE__ */ new Set()).add(scope);
|
|
2133
2241
|
}
|
|
2134
|
-
return ((scope
|
|
2242
|
+
return ((scope["#AbortControllers" /* AbortControllers */] ||= {})[id] ||= new AbortController()).signal;
|
|
2135
2243
|
}
|
|
2136
2244
|
function abort(ctrl) {
|
|
2137
2245
|
ctrl.abort();
|
|
@@ -2161,11 +2269,11 @@ var compat = {
|
|
|
2161
2269
|
return renderer.___clone;
|
|
2162
2270
|
},
|
|
2163
2271
|
getStartNode(branch) {
|
|
2164
|
-
return branch
|
|
2272
|
+
return branch["#StartNode" /* StartNode */];
|
|
2165
2273
|
},
|
|
2166
2274
|
setScopeNodes(branch, startNode, endNode) {
|
|
2167
|
-
branch
|
|
2168
|
-
branch
|
|
2275
|
+
branch["#StartNode" /* StartNode */] = startNode;
|
|
2276
|
+
branch["#EndNode" /* EndNode */] = endNode;
|
|
2169
2277
|
},
|
|
2170
2278
|
runComponentEffects() {
|
|
2171
2279
|
if (this.effects) {
|
|
@@ -2190,8 +2298,8 @@ var compat = {
|
|
|
2190
2298
|
const renderer = _content_branch(0, 0, 0, params);
|
|
2191
2299
|
renderer.___clone = (branch) => {
|
|
2192
2300
|
const cloned = clone();
|
|
2193
|
-
branch
|
|
2194
|
-
branch
|
|
2301
|
+
branch["#StartNode" /* StartNode */] = cloned.startNode;
|
|
2302
|
+
branch["#EndNode" /* EndNode */] = cloned.endNode;
|
|
2195
2303
|
};
|
|
2196
2304
|
return renderer;
|
|
2197
2305
|
},
|
|
@@ -2222,7 +2330,10 @@ var compat = {
|
|
|
2222
2330
|
renderer.___params?.(branch, renderer._ ? args[0] : args);
|
|
2223
2331
|
});
|
|
2224
2332
|
if (created) {
|
|
2225
|
-
return toInsertNode(
|
|
2333
|
+
return toInsertNode(
|
|
2334
|
+
branch["#StartNode" /* StartNode */],
|
|
2335
|
+
branch["#EndNode" /* EndNode */]
|
|
2336
|
+
);
|
|
2226
2337
|
}
|
|
2227
2338
|
}
|
|
2228
2339
|
};
|
|
@@ -2308,8 +2419,8 @@ function mount(input = {}, reference, position) {
|
|
|
2308
2419
|
insertChildNodes(
|
|
2309
2420
|
parentNode,
|
|
2310
2421
|
nextSibling,
|
|
2311
|
-
branch
|
|
2312
|
-
branch
|
|
2422
|
+
branch["#StartNode" /* StartNode */],
|
|
2423
|
+
branch["#EndNode" /* EndNode */]
|
|
2313
2424
|
);
|
|
2314
2425
|
runEffects(effects);
|
|
2315
2426
|
return {
|
|
@@ -2393,6 +2504,7 @@ export {
|
|
|
2393
2504
|
_on,
|
|
2394
2505
|
_or,
|
|
2395
2506
|
_resume,
|
|
2507
|
+
_resume_dynamic_tag,
|
|
2396
2508
|
_return,
|
|
2397
2509
|
_return_change,
|
|
2398
2510
|
_script,
|