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.js
CHANGED
|
@@ -79,6 +79,7 @@ __export(dom_exports, {
|
|
|
79
79
|
_on: () => _on,
|
|
80
80
|
_or: () => _or,
|
|
81
81
|
_resume: () => _resume,
|
|
82
|
+
_resume_dynamic_tag: () => _resume_dynamic_tag,
|
|
82
83
|
_return: () => _return,
|
|
83
84
|
_return_change: () => _return_change,
|
|
84
85
|
_script: () => _script,
|
|
@@ -147,6 +148,55 @@ function _assert_hoist(value) {
|
|
|
147
148
|
);
|
|
148
149
|
}
|
|
149
150
|
}
|
|
151
|
+
function assertExclusiveAttrs(attrs, onError = throwErr) {
|
|
152
|
+
if (attrs) {
|
|
153
|
+
let exclusiveAttrs;
|
|
154
|
+
if (attrs.checkedChange) {
|
|
155
|
+
(exclusiveAttrs ||= []).push("checkedChange");
|
|
156
|
+
}
|
|
157
|
+
if (attrs.checkedValue) {
|
|
158
|
+
(exclusiveAttrs ||= []).push("checkedValue");
|
|
159
|
+
if (attrs.checked) {
|
|
160
|
+
exclusiveAttrs.push("checked");
|
|
161
|
+
}
|
|
162
|
+
} else if (attrs.checkedValueChange) {
|
|
163
|
+
(exclusiveAttrs ||= []).push("checkedValueChange");
|
|
164
|
+
if (attrs.checked) {
|
|
165
|
+
exclusiveAttrs.push("checked");
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (attrs.valueChange) {
|
|
169
|
+
(exclusiveAttrs ||= []).push("valueChange");
|
|
170
|
+
}
|
|
171
|
+
if (exclusiveAttrs && exclusiveAttrs.length > 1) {
|
|
172
|
+
onError(
|
|
173
|
+
`The attributes ${joinWithAnd(exclusiveAttrs)} are mutually exclusive.`
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function assertValidTagName(tagName) {
|
|
179
|
+
if (!/^[a-z][a-z0-9._-]*$/i.test(tagName)) {
|
|
180
|
+
throw new Error(
|
|
181
|
+
`Invalid tag name: "${tagName}". Tag names must start with a letter and contain only letters, numbers, periods, hyphens, and underscores.`
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function throwErr(msg) {
|
|
186
|
+
throw new Error(msg);
|
|
187
|
+
}
|
|
188
|
+
function joinWithAnd(a) {
|
|
189
|
+
switch (a.length) {
|
|
190
|
+
case 0:
|
|
191
|
+
return "";
|
|
192
|
+
case 1:
|
|
193
|
+
return a[0];
|
|
194
|
+
case 2:
|
|
195
|
+
return `${a[0]} and ${a[1]}`;
|
|
196
|
+
default:
|
|
197
|
+
return `${a.slice(0, -1).join(", ")}, and ${a[a.length - 1]}`;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
150
200
|
|
|
151
201
|
// src/common/for.ts
|
|
152
202
|
function forIn(obj, cb) {
|
|
@@ -237,6 +287,11 @@ function normalizeDynamicRenderer(value) {
|
|
|
237
287
|
}
|
|
238
288
|
}
|
|
239
289
|
|
|
290
|
+
// src/common/meta.ts
|
|
291
|
+
var DEFAULT_RUNTIME_ID = "M";
|
|
292
|
+
var DEFAULT_RENDER_ID = "_";
|
|
293
|
+
var DYNAMIC_TAG_SCRIPT_REGISTER_ID = true ? "_dynamicTagScript" : "d";
|
|
294
|
+
|
|
240
295
|
// src/dom/event.ts
|
|
241
296
|
var defaultDelegator = createDelegator();
|
|
242
297
|
function _on(element, type, handler) {
|
|
@@ -305,18 +360,14 @@ function stripSpacesAndPunctuation(str) {
|
|
|
305
360
|
return str.replace(/[^\p{L}\p{N}]/gu, "");
|
|
306
361
|
}
|
|
307
362
|
|
|
308
|
-
// src/common/meta.ts
|
|
309
|
-
var DEFAULT_RUNTIME_ID = "M";
|
|
310
|
-
var DEFAULT_RENDER_ID = "_";
|
|
311
|
-
|
|
312
363
|
// src/dom/scope.ts
|
|
313
364
|
var nextScopeId = 1e6;
|
|
314
365
|
function createScope($global, closestBranch) {
|
|
315
366
|
const scope = {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
$global
|
|
367
|
+
["#Id" /* Id */]: nextScopeId++,
|
|
368
|
+
["#Creating" /* Creating */]: 1,
|
|
369
|
+
["#ClosestBranch" /* ClosestBranch */]: closestBranch,
|
|
370
|
+
["$global" /* Global */]: $global
|
|
320
371
|
};
|
|
321
372
|
pendingScopes.push(scope);
|
|
322
373
|
return scope;
|
|
@@ -325,41 +376,51 @@ function skipScope() {
|
|
|
325
376
|
return nextScopeId++;
|
|
326
377
|
}
|
|
327
378
|
function findBranchWithKey(scope, key) {
|
|
328
|
-
let branch = scope
|
|
379
|
+
let branch = scope["#ClosestBranch" /* ClosestBranch */];
|
|
329
380
|
while (branch && !branch[key]) {
|
|
330
|
-
branch = branch
|
|
381
|
+
branch = branch["#ParentBranch" /* ParentBranch */];
|
|
331
382
|
}
|
|
332
383
|
return branch;
|
|
333
384
|
}
|
|
334
385
|
function destroyBranch(branch) {
|
|
335
|
-
branch
|
|
386
|
+
branch["#ParentBranch" /* ParentBranch */]?.["#BranchScopes" /* BranchScopes */]?.delete(
|
|
387
|
+
branch
|
|
388
|
+
);
|
|
336
389
|
destroyNestedBranches(branch);
|
|
337
390
|
}
|
|
338
391
|
function destroyNestedBranches(branch) {
|
|
339
|
-
branch
|
|
340
|
-
branch
|
|
341
|
-
branch
|
|
342
|
-
for (const id in scope
|
|
392
|
+
branch["#Destroyed" /* Destroyed */] = 1;
|
|
393
|
+
branch["#BranchScopes" /* BranchScopes */]?.forEach(destroyNestedBranches);
|
|
394
|
+
branch["#AbortScopes" /* AbortScopes */]?.forEach((scope) => {
|
|
395
|
+
for (const id in scope["#AbortControllers" /* AbortControllers */]) {
|
|
343
396
|
$signalReset(scope, id);
|
|
344
397
|
}
|
|
345
398
|
});
|
|
346
399
|
}
|
|
347
400
|
function removeAndDestroyBranch(branch) {
|
|
348
401
|
destroyBranch(branch);
|
|
349
|
-
removeChildNodes(
|
|
402
|
+
removeChildNodes(
|
|
403
|
+
branch["#StartNode" /* StartNode */],
|
|
404
|
+
branch["#EndNode" /* EndNode */]
|
|
405
|
+
);
|
|
350
406
|
}
|
|
351
407
|
function insertBranchBefore(branch, parentNode, nextSibling) {
|
|
352
408
|
insertChildNodes(
|
|
353
409
|
parentNode,
|
|
354
410
|
nextSibling,
|
|
355
|
-
branch
|
|
356
|
-
branch
|
|
411
|
+
branch["#StartNode" /* StartNode */],
|
|
412
|
+
branch["#EndNode" /* EndNode */]
|
|
357
413
|
);
|
|
358
414
|
}
|
|
359
415
|
function tempDetachBranch(branch) {
|
|
360
416
|
const fragment = new DocumentFragment();
|
|
361
|
-
fragment.namespaceURI = branch.
|
|
362
|
-
insertChildNodes(
|
|
417
|
+
fragment.namespaceURI = branch["#StartNode" /* StartNode */].parentNode.namespaceURI;
|
|
418
|
+
insertChildNodes(
|
|
419
|
+
fragment,
|
|
420
|
+
null,
|
|
421
|
+
branch["#StartNode" /* StartNode */],
|
|
422
|
+
branch["#EndNode" /* EndNode */]
|
|
423
|
+
);
|
|
363
424
|
}
|
|
364
425
|
|
|
365
426
|
// src/dom/walker.ts
|
|
@@ -370,6 +431,7 @@ function walk(startNode, walkCodes, branch) {
|
|
|
370
431
|
}
|
|
371
432
|
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
372
433
|
let value;
|
|
434
|
+
let id;
|
|
373
435
|
let storedMultiplier = 0;
|
|
374
436
|
let currentMultiplier = 0;
|
|
375
437
|
let currentScopeIndex = 0;
|
|
@@ -379,14 +441,14 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
|
379
441
|
storedMultiplier = 0;
|
|
380
442
|
if (value === 32 /* Get */) {
|
|
381
443
|
const node = walker.currentNode;
|
|
382
|
-
scope[true ? getDebugKey(currentScopeIndex
|
|
383
|
-
scope["Getter:" /* Getter */ +
|
|
444
|
+
scope[id = true ? getDebugKey(currentScopeIndex++, node) : decodeAccessor(currentScopeIndex++)] = node;
|
|
445
|
+
scope["Getter:" /* Getter */ + id] = () => node;
|
|
384
446
|
} else if (value === 37 /* Replace */ || value === 49 /* DynamicTagWithVar */) {
|
|
385
447
|
walker.currentNode.replaceWith(
|
|
386
|
-
walker.currentNode = scope[true ? getDebugKey(currentScopeIndex++, "#text") : currentScopeIndex++] = new Text()
|
|
448
|
+
walker.currentNode = scope[true ? getDebugKey(currentScopeIndex++, "#text") : decodeAccessor(currentScopeIndex++)] = new Text()
|
|
387
449
|
);
|
|
388
450
|
if (value === 49 /* DynamicTagWithVar */) {
|
|
389
|
-
scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope();
|
|
451
|
+
scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : decodeAccessor(currentScopeIndex++)] = skipScope();
|
|
390
452
|
}
|
|
391
453
|
} else if (value === 38 /* EndChild */) {
|
|
392
454
|
return currentWalkIndex;
|
|
@@ -394,10 +456,13 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
|
394
456
|
currentWalkIndex = walkInternal(
|
|
395
457
|
currentWalkIndex,
|
|
396
458
|
walkCodes,
|
|
397
|
-
scope[true ? getDebugKey(currentScopeIndex++, "#childScope") : currentScopeIndex++] = createScope(
|
|
459
|
+
scope[true ? getDebugKey(currentScopeIndex++, "#childScope") : decodeAccessor(currentScopeIndex++)] = createScope(
|
|
460
|
+
scope["$global" /* Global */],
|
|
461
|
+
scope["#ClosestBranch" /* ClosestBranch */]
|
|
462
|
+
)
|
|
398
463
|
);
|
|
399
464
|
if (value === 48 /* BeginChildWithVar */) {
|
|
400
|
-
scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope();
|
|
465
|
+
scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : decodeAccessor(currentScopeIndex++)] = skipScope();
|
|
401
466
|
}
|
|
402
467
|
} else if (value < 91 /* NextEnd */ + 1) {
|
|
403
468
|
value = 20 /* Next */ * currentMultiplier + value - 67 /* Next */;
|
|
@@ -480,17 +545,17 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
480
545
|
while (startVisit.previousSibling && ~visits.indexOf(
|
|
481
546
|
startVisit = startVisit.previousSibling
|
|
482
547
|
)) ;
|
|
483
|
-
branch
|
|
548
|
+
branch["#EndNode" /* EndNode */] = branch["#StartNode" /* StartNode */] = startVisit;
|
|
484
549
|
if (visitType === "'" /* BranchEndNativeTag */) {
|
|
485
|
-
branch[true ? getDebugKey(0, startVisit) :
|
|
550
|
+
branch[true ? getDebugKey(0, startVisit) : "a"] = startVisit;
|
|
486
551
|
}
|
|
487
552
|
} else {
|
|
488
553
|
startVisit = branchStarts.pop();
|
|
489
554
|
if (parent !== startVisit.parentNode) {
|
|
490
555
|
parent.prepend(startVisit);
|
|
491
556
|
}
|
|
492
|
-
branch
|
|
493
|
-
branch
|
|
557
|
+
branch["#StartNode" /* StartNode */] = startVisit;
|
|
558
|
+
branch["#EndNode" /* EndNode */] = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
|
|
494
559
|
}
|
|
495
560
|
while (i-- && orphanBranches[i] > branchId) {
|
|
496
561
|
branchParents.set(orphanBranches[i], branchId);
|
|
@@ -521,12 +586,12 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
521
586
|
}
|
|
522
587
|
},
|
|
523
588
|
___scope(scope) {
|
|
524
|
-
scope
|
|
589
|
+
scope["#ClosestBranch" /* ClosestBranch */] = scopeLookup[scope["#ClosestBranchId" /* ClosestBranchId */] || branchParents.get(scopeId)];
|
|
525
590
|
if (branchParents.has(scopeId)) {
|
|
526
|
-
if (scope
|
|
527
|
-
((scope
|
|
591
|
+
if (scope["#ClosestBranch" /* ClosestBranch */]) {
|
|
592
|
+
((scope["#ParentBranch" /* ParentBranch */] = scope["#ClosestBranch" /* ClosestBranch */])["#BranchScopes" /* BranchScopes */] ||= /* @__PURE__ */ new Set()).add(scope);
|
|
528
593
|
}
|
|
529
|
-
scope
|
|
594
|
+
scope["#ClosestBranch" /* ClosestBranch */] = scope;
|
|
530
595
|
}
|
|
531
596
|
}
|
|
532
597
|
};
|
|
@@ -558,7 +623,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
558
623
|
visitType = visitText[lastTokenIndex++];
|
|
559
624
|
if (scopeId = +nextToken()) {
|
|
560
625
|
visitScope = scopeLookup[scopeId] ||= {
|
|
561
|
-
|
|
626
|
+
["#Id" /* Id */]: scopeId
|
|
562
627
|
};
|
|
563
628
|
}
|
|
564
629
|
if (visitType === "*" /* Node */) {
|
|
@@ -573,7 +638,7 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
573
638
|
} else if (typeof serialized === "number") {
|
|
574
639
|
registeredValues[lastEffect](
|
|
575
640
|
scopeLookup[serialized] ||= {
|
|
576
|
-
|
|
641
|
+
["#Id" /* Id */]: scopeId
|
|
577
642
|
}
|
|
578
643
|
);
|
|
579
644
|
} else {
|
|
@@ -586,8 +651,8 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
586
651
|
lastScopeId += scope;
|
|
587
652
|
} else {
|
|
588
653
|
scopeId = ++lastScopeId;
|
|
589
|
-
scope
|
|
590
|
-
scope
|
|
654
|
+
scope["$global" /* Global */] = $global;
|
|
655
|
+
scope["#Id" /* Id */] = scopeId;
|
|
591
656
|
if (scopeLookup[scopeId] !== scope) {
|
|
592
657
|
scopeLookup[scopeId] = Object.assign(
|
|
593
658
|
scope,
|
|
@@ -597,9 +662,6 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
597
662
|
if (branchesEnabled) {
|
|
598
663
|
branches.___scope(scope);
|
|
599
664
|
}
|
|
600
|
-
if (true) {
|
|
601
|
-
scope.___debugId = "server-" + scopeId;
|
|
602
|
-
}
|
|
603
665
|
}
|
|
604
666
|
}
|
|
605
667
|
}
|
|
@@ -625,20 +687,22 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
|
625
687
|
}
|
|
626
688
|
}
|
|
627
689
|
var isResuming;
|
|
690
|
+
function getRegisteredWithScope(id, scope) {
|
|
691
|
+
const val = registeredValues[id];
|
|
692
|
+
return scope ? val(scope) : val;
|
|
693
|
+
}
|
|
628
694
|
function _resume(id, obj) {
|
|
629
|
-
registeredValues[id] = obj;
|
|
630
|
-
return obj;
|
|
695
|
+
return registeredValues[id] = obj;
|
|
631
696
|
}
|
|
632
697
|
function _var_resume(id, signal) {
|
|
633
|
-
|
|
698
|
+
_resume(id, (scope) => (value) => signal(scope, value));
|
|
634
699
|
return signal;
|
|
635
700
|
}
|
|
636
|
-
function
|
|
637
|
-
const
|
|
638
|
-
return scope
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
return _resume(id, (scope) => () => scope[key]());
|
|
701
|
+
function _el(id, accessor) {
|
|
702
|
+
const getterAccessor = "Getter:" /* Getter */ + (true ? accessor : decodeAccessor2(accessor));
|
|
703
|
+
return _resume(id, (scope) => () => {
|
|
704
|
+
return scope[getterAccessor]();
|
|
705
|
+
});
|
|
642
706
|
}
|
|
643
707
|
|
|
644
708
|
// src/dom/controllable.ts
|
|
@@ -965,48 +1029,45 @@ function triggerMacroTask() {
|
|
|
965
1029
|
}
|
|
966
1030
|
|
|
967
1031
|
// src/dom/signals.ts
|
|
968
|
-
function _let(
|
|
1032
|
+
function _let(id, fn) {
|
|
1033
|
+
const valueAccessor = true ? id.slice(0, id.lastIndexOf("/")) : decodeAccessor3(id);
|
|
1034
|
+
const valueChangeAccessor = "TagVariableChange:" /* TagVariableChange */ + valueAccessor;
|
|
969
1035
|
if (true) {
|
|
970
|
-
|
|
971
|
-
valueAccessor.lastIndexOf("/") + 1
|
|
972
|
-
);
|
|
973
|
-
valueAccessor = valueAccessor.slice(
|
|
974
|
-
0,
|
|
975
|
-
valueAccessor.lastIndexOf("/")
|
|
976
|
-
);
|
|
1036
|
+
id = +valueAccessor.slice(valueAccessor.lastIndexOf("/") + 1);
|
|
977
1037
|
}
|
|
978
|
-
const valueChangeAccessor = "TagVariableChange:" /* TagVariableChange */ + valueAccessor;
|
|
979
1038
|
return (scope, value, valueChange) => {
|
|
980
1039
|
if (rendering) {
|
|
981
|
-
if ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !== value || scope
|
|
1040
|
+
if ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !== value || scope["#Creating" /* Creating */]) {
|
|
982
1041
|
scope[valueAccessor] = value;
|
|
983
|
-
fn
|
|
1042
|
+
fn?.(scope);
|
|
984
1043
|
}
|
|
985
1044
|
} else if (scope[valueChangeAccessor]) {
|
|
986
1045
|
scope[valueChangeAccessor](value);
|
|
987
1046
|
} else if (scope[valueAccessor] !== (scope[valueAccessor] = value) && fn) {
|
|
988
1047
|
schedule();
|
|
989
|
-
queueRender(scope, fn,
|
|
1048
|
+
queueRender(scope, fn, id);
|
|
990
1049
|
}
|
|
991
1050
|
return value;
|
|
992
1051
|
};
|
|
993
1052
|
}
|
|
994
|
-
function _const(valueAccessor, fn
|
|
995
|
-
|
|
1053
|
+
function _const(valueAccessor, fn) {
|
|
1054
|
+
if (false) valueAccessor = decodeAccessor3(valueAccessor);
|
|
996
1055
|
return (scope, value) => {
|
|
997
1056
|
if (!(valueAccessor in scope) || scope[valueAccessor] !== value) {
|
|
998
1057
|
scope[valueAccessor] = value;
|
|
999
|
-
fn(scope);
|
|
1058
|
+
fn?.(scope);
|
|
1000
1059
|
}
|
|
1001
1060
|
};
|
|
1002
1061
|
}
|
|
1003
|
-
function _or(id, fn, defaultPending = 1, scopeIdAccessor = /*
|
|
1062
|
+
function _or(id, fn, defaultPending = 1, scopeIdAccessor = "#Id" /* Id */) {
|
|
1004
1063
|
return (scope) => {
|
|
1005
|
-
if (scope
|
|
1006
|
-
if (
|
|
1064
|
+
if (scope["#Creating" /* Creating */]) {
|
|
1065
|
+
if (id in scope) {
|
|
1066
|
+
if (!--scope[id]) {
|
|
1067
|
+
fn(scope);
|
|
1068
|
+
}
|
|
1069
|
+
} else {
|
|
1007
1070
|
scope[id] = defaultPending;
|
|
1008
|
-
} else if (!--scope[id]) {
|
|
1009
|
-
fn(scope);
|
|
1010
1071
|
}
|
|
1011
1072
|
} else {
|
|
1012
1073
|
queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
|
@@ -1014,6 +1075,8 @@ function _or(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "___id
|
|
|
1014
1075
|
};
|
|
1015
1076
|
}
|
|
1016
1077
|
function _for_closure(ownerLoopNodeAccessor, fn) {
|
|
1078
|
+
if (false)
|
|
1079
|
+
ownerLoopNodeAccessor = decodeAccessor3(ownerLoopNodeAccessor);
|
|
1017
1080
|
const loopScopeAccessor = "LoopScopeArray:" /* LoopScopeArray */ + ownerLoopNodeAccessor;
|
|
1018
1081
|
const loopScopeMapAccessor = "LoopScopeMap:" /* LoopScopeMap */ + ownerLoopNodeAccessor;
|
|
1019
1082
|
const ownerSignal = (ownerScope) => {
|
|
@@ -1024,14 +1087,14 @@ function _for_closure(ownerLoopNodeAccessor, fn) {
|
|
|
1024
1087
|
ownerScope,
|
|
1025
1088
|
() => {
|
|
1026
1089
|
for (const scope of scopes) {
|
|
1027
|
-
if (!scope
|
|
1090
|
+
if (!scope["#Creating" /* Creating */] && !scope["#Destroyed" /* Destroyed */]) {
|
|
1028
1091
|
fn(scope);
|
|
1029
1092
|
}
|
|
1030
1093
|
}
|
|
1031
1094
|
},
|
|
1032
1095
|
-1,
|
|
1033
1096
|
0,
|
|
1034
|
-
firstScope
|
|
1097
|
+
firstScope["#Id" /* Id */]
|
|
1035
1098
|
);
|
|
1036
1099
|
}
|
|
1037
1100
|
};
|
|
@@ -1039,11 +1102,15 @@ function _for_closure(ownerLoopNodeAccessor, fn) {
|
|
|
1039
1102
|
return ownerSignal;
|
|
1040
1103
|
}
|
|
1041
1104
|
function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
|
|
1105
|
+
if (false)
|
|
1106
|
+
ownerConditionalNodeAccessor = decodeAccessor3(
|
|
1107
|
+
ownerConditionalNodeAccessor
|
|
1108
|
+
);
|
|
1042
1109
|
const scopeAccessor = "ConditionalScope:" /* ConditionalScope */ + ownerConditionalNodeAccessor;
|
|
1043
1110
|
const branchAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + ownerConditionalNodeAccessor;
|
|
1044
1111
|
const ownerSignal = (scope) => {
|
|
1045
1112
|
const ifScope = scope[scopeAccessor];
|
|
1046
|
-
if (ifScope && !ifScope
|
|
1113
|
+
if (ifScope && !ifScope["#Creating" /* Creating */] && (scope[branchAccessor] || 0) === branch) {
|
|
1047
1114
|
queueRender(ifScope, fn, -1);
|
|
1048
1115
|
}
|
|
1049
1116
|
};
|
|
@@ -1068,7 +1135,7 @@ function _closure(...closureSignals) {
|
|
|
1068
1135
|
return (scope) => {
|
|
1069
1136
|
if (scope[___scopeInstancesAccessor]) {
|
|
1070
1137
|
for (const childScope of scope[___scopeInstancesAccessor]) {
|
|
1071
|
-
if (!childScope
|
|
1138
|
+
if (!childScope["#Creating" /* Creating */]) {
|
|
1072
1139
|
queueRender(
|
|
1073
1140
|
childScope,
|
|
1074
1141
|
closureSignals[childScope[___signalIndexAccessor]],
|
|
@@ -1080,6 +1147,7 @@ function _closure(...closureSignals) {
|
|
|
1080
1147
|
};
|
|
1081
1148
|
}
|
|
1082
1149
|
function _closure_get(valueAccessor, fn, getOwnerScope) {
|
|
1150
|
+
if (false) valueAccessor = decodeAccessor3(valueAccessor);
|
|
1083
1151
|
const closureSignal = ((scope) => {
|
|
1084
1152
|
scope[closureSignal.___signalIndexAccessor] = closureSignal.___index;
|
|
1085
1153
|
fn(scope);
|
|
@@ -1101,7 +1169,7 @@ function _child_setup(setup) {
|
|
|
1101
1169
|
return setup;
|
|
1102
1170
|
}
|
|
1103
1171
|
function _var(scope, childAccessor, signal) {
|
|
1104
|
-
scope[childAccessor]["#TagVariable" /* TagVariable */] = (value) => signal(scope, value);
|
|
1172
|
+
scope[true ? childAccessor : decodeAccessor3(childAccessor)]["#TagVariable" /* TagVariable */] = (value) => signal(scope, value);
|
|
1105
1173
|
}
|
|
1106
1174
|
var _return = (scope, value) => scope["#TagVariable" /* TagVariable */]?.(value);
|
|
1107
1175
|
function _return_change(scope, changeHandler) {
|
|
@@ -1116,7 +1184,7 @@ var _var_change = true ? (scope, value, name = "This") => {
|
|
|
1116
1184
|
scope["#TagVariableChange" /* TagVariableChange */](value);
|
|
1117
1185
|
} : (scope, value) => scope["#TagVariableChange" /* TagVariableChange */]?.(value);
|
|
1118
1186
|
var tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
|
1119
|
-
function _id({ $global }) {
|
|
1187
|
+
function _id({ ["$global" /* Global */]: $global }) {
|
|
1120
1188
|
const id = tagIdsByGlobal.get($global) || 0;
|
|
1121
1189
|
tagIdsByGlobal.set($global, id + 1);
|
|
1122
1190
|
return "c" + $global.runtimeId + $global.renderId + id.toString(36);
|
|
@@ -1150,6 +1218,8 @@ function* traverseAllHoisted(scope, path, curIndex = path.length - 1) {
|
|
|
1150
1218
|
}
|
|
1151
1219
|
}
|
|
1152
1220
|
function _hoist(...path) {
|
|
1221
|
+
if (false)
|
|
1222
|
+
path = path.map((p) => typeof p === "string" ? p : decodeAccessor3(p));
|
|
1153
1223
|
return (scope) => {
|
|
1154
1224
|
const getOne = (...args) => iterator().next().value?.(...args);
|
|
1155
1225
|
const iterator = getOne[Symbol.iterator] = () => traverseAllHoisted(scope, path);
|
|
@@ -1160,15 +1230,15 @@ function _hoist(...path) {
|
|
|
1160
1230
|
// src/dom/renderer.ts
|
|
1161
1231
|
function createBranch($global, renderer, parentScope, parentNode) {
|
|
1162
1232
|
const branch = createScope($global);
|
|
1163
|
-
const parentBranch = parentScope?.
|
|
1233
|
+
const parentBranch = parentScope?.["#ClosestBranch" /* ClosestBranch */];
|
|
1164
1234
|
branch["_" /* Owner */] = renderer.___owner || parentScope;
|
|
1165
|
-
branch
|
|
1235
|
+
branch["#ClosestBranch" /* ClosestBranch */] = branch;
|
|
1166
1236
|
if (parentBranch) {
|
|
1167
|
-
branch
|
|
1168
|
-
(parentBranch
|
|
1237
|
+
branch["#ParentBranch" /* ParentBranch */] = parentBranch;
|
|
1238
|
+
(parentBranch["#BranchScopes" /* BranchScopes */] ||= /* @__PURE__ */ new Set()).add(branch);
|
|
1169
1239
|
}
|
|
1170
1240
|
if (true) {
|
|
1171
|
-
branch
|
|
1241
|
+
branch["#Renderer" /* Renderer */] = renderer;
|
|
1172
1242
|
}
|
|
1173
1243
|
renderer.___clone?.(
|
|
1174
1244
|
branch,
|
|
@@ -1199,7 +1269,7 @@ function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
|
|
|
1199
1269
|
))(branch, walks);
|
|
1200
1270
|
} : (branch) => {
|
|
1201
1271
|
walk(
|
|
1202
|
-
branch
|
|
1272
|
+
branch["#StartNode" /* StartNode */] = branch["#EndNode" /* EndNode */] = new Text(),
|
|
1203
1273
|
walks,
|
|
1204
1274
|
branch
|
|
1205
1275
|
);
|
|
@@ -1224,7 +1294,7 @@ function _content_resume(id, template, walks, setup, params, dynamicScopesAccess
|
|
|
1224
1294
|
function _content_closures(renderer, closureFns) {
|
|
1225
1295
|
const closureSignals = {};
|
|
1226
1296
|
for (const key in closureFns) {
|
|
1227
|
-
closureSignals[key] = _const(key, closureFns[key]);
|
|
1297
|
+
closureSignals[key] = _const(true ? key : +key, closureFns[key]);
|
|
1228
1298
|
}
|
|
1229
1299
|
return (owner, closureValues) => {
|
|
1230
1300
|
const instance = renderer(owner);
|
|
@@ -1243,15 +1313,15 @@ function createCloneableHTML(html, ns) {
|
|
|
1243
1313
|
insertChildNodes(parent, null, firstChild, lastChild);
|
|
1244
1314
|
return firstChild === lastChild && firstChild.nodeType < 8 /* Comment */ ? (branch, walks) => {
|
|
1245
1315
|
walk(
|
|
1246
|
-
branch
|
|
1316
|
+
branch["#StartNode" /* StartNode */] = branch["#EndNode" /* EndNode */] = firstChild.cloneNode(true),
|
|
1247
1317
|
walks,
|
|
1248
1318
|
branch
|
|
1249
1319
|
);
|
|
1250
1320
|
} : (branch, walks) => {
|
|
1251
1321
|
const clone = parent.cloneNode(true);
|
|
1252
1322
|
walk(clone.firstChild, walks, branch);
|
|
1253
|
-
branch
|
|
1254
|
-
branch
|
|
1323
|
+
branch["#StartNode" /* StartNode */] = clone.firstChild;
|
|
1324
|
+
branch["#EndNode" /* EndNode */] = clone.lastChild;
|
|
1255
1325
|
};
|
|
1256
1326
|
}
|
|
1257
1327
|
|
|
@@ -1310,6 +1380,9 @@ function _attrs(scope, nodeAccessor, nextAttrs) {
|
|
|
1310
1380
|
el.removeAttribute(name);
|
|
1311
1381
|
}
|
|
1312
1382
|
}
|
|
1383
|
+
if (true) {
|
|
1384
|
+
assertExclusiveAttrs(nextAttrs);
|
|
1385
|
+
}
|
|
1313
1386
|
attrsInternal(scope, nodeAccessor, nextAttrs);
|
|
1314
1387
|
}
|
|
1315
1388
|
function _attrs_content(scope, nodeAccessor, nextAttrs) {
|
|
@@ -1331,6 +1404,9 @@ function _attrs_partial(scope, nodeAccessor, nextAttrs, skip) {
|
|
|
1331
1404
|
for (const key in nextAttrs) {
|
|
1332
1405
|
if (!skip[key]) partial[key] = nextAttrs[key];
|
|
1333
1406
|
}
|
|
1407
|
+
if (true) {
|
|
1408
|
+
assertExclusiveAttrs({ ...nextAttrs, ...skip });
|
|
1409
|
+
}
|
|
1334
1410
|
attrsInternal(scope, nodeAccessor, partial);
|
|
1335
1411
|
}
|
|
1336
1412
|
function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip) {
|
|
@@ -1575,7 +1651,7 @@ function reconcile(parent, oldBranches, newBranches, afterReference) {
|
|
|
1575
1651
|
if (oldStart > oldEnd) {
|
|
1576
1652
|
if (newStart <= newEnd) {
|
|
1577
1653
|
k = newEnd + 1;
|
|
1578
|
-
nextSibling = k < newBranches.length ? newBranches[k]
|
|
1654
|
+
nextSibling = k < newBranches.length ? newBranches[k]["#StartNode" /* StartNode */] : afterReference;
|
|
1579
1655
|
do {
|
|
1580
1656
|
insertBranchBefore(newBranches[newStart++], parent, nextSibling);
|
|
1581
1657
|
} while (newStart <= newEnd);
|
|
@@ -1633,13 +1709,13 @@ function reconcile(parent, oldBranches, newBranches, afterReference) {
|
|
|
1633
1709
|
if (sources[i] === -1) {
|
|
1634
1710
|
pos = i + newStart;
|
|
1635
1711
|
newBranch = newBranches[pos++];
|
|
1636
|
-
nextSibling = pos < k ? newBranches[pos]
|
|
1712
|
+
nextSibling = pos < k ? newBranches[pos]["#StartNode" /* StartNode */] : afterReference;
|
|
1637
1713
|
insertBranchBefore(newBranch, parent, nextSibling);
|
|
1638
1714
|
} else {
|
|
1639
1715
|
if (j < 0 || i !== seq[j]) {
|
|
1640
1716
|
pos = i + newStart;
|
|
1641
1717
|
newBranch = newBranches[pos++];
|
|
1642
|
-
nextSibling = pos < k ? newBranches[pos]
|
|
1718
|
+
nextSibling = pos < k ? newBranches[pos]["#StartNode" /* StartNode */] : afterReference;
|
|
1643
1719
|
insertBranchBefore(newBranch, parent, nextSibling);
|
|
1644
1720
|
} else {
|
|
1645
1721
|
--j;
|
|
@@ -1652,7 +1728,7 @@ function reconcile(parent, oldBranches, newBranches, afterReference) {
|
|
|
1652
1728
|
if (sources[i] === -1) {
|
|
1653
1729
|
pos = i + newStart;
|
|
1654
1730
|
newBranch = newBranches[pos++];
|
|
1655
|
-
nextSibling = pos < k ? newBranches[pos]
|
|
1731
|
+
nextSibling = pos < k ? newBranches[pos]["#StartNode" /* StartNode */] : afterReference;
|
|
1656
1732
|
insertBranchBefore(newBranch, parent, nextSibling);
|
|
1657
1733
|
}
|
|
1658
1734
|
}
|
|
@@ -1703,6 +1779,7 @@ function longestIncreasingSubsequence(a) {
|
|
|
1703
1779
|
|
|
1704
1780
|
// src/dom/control-flow.ts
|
|
1705
1781
|
function _await(nodeAccessor, renderer) {
|
|
1782
|
+
if (false) nodeAccessor = decodeAccessor4(nodeAccessor);
|
|
1706
1783
|
const promiseAccessor = "Promise:" /* Promise */ + nodeAccessor;
|
|
1707
1784
|
const branchAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
|
|
1708
1785
|
enableBranches();
|
|
@@ -1715,22 +1792,22 @@ function _await(nodeAccessor, renderer) {
|
|
|
1715
1792
|
let awaitBranch = scope[branchAccessor];
|
|
1716
1793
|
if (tryWithPlaceholder) {
|
|
1717
1794
|
placeholderShown.add(pendingEffects);
|
|
1718
|
-
if (!scope[promiseAccessor] && (tryWithPlaceholder
|
|
1795
|
+
if (!scope[promiseAccessor] && (tryWithPlaceholder["#PendingAsyncCount" /* PendingAsyncCount */] = (tryWithPlaceholder["#PendingAsyncCount" /* PendingAsyncCount */] || 0) + 1) === 1) {
|
|
1719
1796
|
requestAnimationFrame(
|
|
1720
|
-
() => tryWithPlaceholder
|
|
1797
|
+
() => tryWithPlaceholder["#PendingAsyncCount" /* PendingAsyncCount */] && runEffects(
|
|
1721
1798
|
prepareEffects(
|
|
1722
1799
|
() => queueRender(
|
|
1723
1800
|
tryWithPlaceholder,
|
|
1724
1801
|
() => {
|
|
1725
1802
|
insertBranchBefore(
|
|
1726
1803
|
tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */] = createAndSetupBranch(
|
|
1727
|
-
scope
|
|
1804
|
+
scope["$global" /* Global */],
|
|
1728
1805
|
tryWithPlaceholder["#PlaceholderContent" /* PlaceholderContent */],
|
|
1729
1806
|
tryWithPlaceholder["_" /* Owner */],
|
|
1730
|
-
tryWithPlaceholder.
|
|
1807
|
+
tryWithPlaceholder["#StartNode" /* StartNode */].parentNode
|
|
1731
1808
|
),
|
|
1732
|
-
tryWithPlaceholder.
|
|
1733
|
-
tryWithPlaceholder
|
|
1809
|
+
tryWithPlaceholder["#StartNode" /* StartNode */].parentNode,
|
|
1810
|
+
tryWithPlaceholder["#StartNode" /* StartNode */]
|
|
1734
1811
|
);
|
|
1735
1812
|
tempDetachBranch(tryWithPlaceholder);
|
|
1736
1813
|
},
|
|
@@ -1741,9 +1818,9 @@ function _await(nodeAccessor, renderer) {
|
|
|
1741
1818
|
);
|
|
1742
1819
|
}
|
|
1743
1820
|
} else if (awaitBranch && !scope[promiseAccessor]) {
|
|
1744
|
-
awaitBranch.
|
|
1821
|
+
awaitBranch["#StartNode" /* StartNode */].parentNode.insertBefore(
|
|
1745
1822
|
referenceNode,
|
|
1746
|
-
awaitBranch
|
|
1823
|
+
awaitBranch["#StartNode" /* StartNode */]
|
|
1747
1824
|
);
|
|
1748
1825
|
tempDetachBranch(awaitBranch);
|
|
1749
1826
|
}
|
|
@@ -1758,13 +1835,13 @@ function _await(nodeAccessor, renderer) {
|
|
|
1758
1835
|
if (awaitBranch) {
|
|
1759
1836
|
if (!tryWithPlaceholder) {
|
|
1760
1837
|
referenceNode.replaceWith(
|
|
1761
|
-
awaitBranch.
|
|
1838
|
+
awaitBranch["#StartNode" /* StartNode */].parentNode
|
|
1762
1839
|
);
|
|
1763
1840
|
}
|
|
1764
1841
|
} else {
|
|
1765
1842
|
insertBranchBefore(
|
|
1766
1843
|
awaitBranch = scope[branchAccessor] = createAndSetupBranch(
|
|
1767
|
-
scope
|
|
1844
|
+
scope["$global" /* Global */],
|
|
1768
1845
|
renderer,
|
|
1769
1846
|
scope,
|
|
1770
1847
|
referenceNode.parentNode
|
|
@@ -1777,20 +1854,20 @@ function _await(nodeAccessor, renderer) {
|
|
|
1777
1854
|
renderer.___params?.(awaitBranch, [data]);
|
|
1778
1855
|
if (tryWithPlaceholder) {
|
|
1779
1856
|
placeholderShown.add(pendingEffects);
|
|
1780
|
-
if (!--tryWithPlaceholder
|
|
1857
|
+
if (!--tryWithPlaceholder["#PendingAsyncCount" /* PendingAsyncCount */]) {
|
|
1781
1858
|
const placeholderBranch = tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */];
|
|
1782
1859
|
tryWithPlaceholder["#PlaceholderBranch" /* PlaceholderBranch */] = 0;
|
|
1783
1860
|
if (placeholderBranch) {
|
|
1784
|
-
placeholderBranch.
|
|
1785
|
-
tryWithPlaceholder.
|
|
1786
|
-
placeholderBranch
|
|
1861
|
+
placeholderBranch["#StartNode" /* StartNode */].parentNode.insertBefore(
|
|
1862
|
+
tryWithPlaceholder["#StartNode" /* StartNode */].parentNode,
|
|
1863
|
+
placeholderBranch["#StartNode" /* StartNode */]
|
|
1787
1864
|
);
|
|
1788
1865
|
removeAndDestroyBranch(placeholderBranch);
|
|
1789
1866
|
}
|
|
1790
1867
|
queueEffect(tryWithPlaceholder, (scope2) => {
|
|
1791
|
-
const pendingEffects2 = scope2
|
|
1868
|
+
const pendingEffects2 = scope2["#Effects" /* Effects */];
|
|
1792
1869
|
if (pendingEffects2) {
|
|
1793
|
-
scope2
|
|
1870
|
+
scope2["#Effects" /* Effects */] = [];
|
|
1794
1871
|
runEffects(pendingEffects2, true);
|
|
1795
1872
|
}
|
|
1796
1873
|
});
|
|
@@ -1803,7 +1880,8 @@ function _await(nodeAccessor, renderer) {
|
|
|
1803
1880
|
},
|
|
1804
1881
|
(error) => {
|
|
1805
1882
|
if (thisPromise === scope[promiseAccessor]) {
|
|
1806
|
-
if (tryWithPlaceholder)
|
|
1883
|
+
if (tryWithPlaceholder)
|
|
1884
|
+
tryWithPlaceholder["#PendingAsyncCount" /* PendingAsyncCount */] = 0;
|
|
1807
1885
|
scope[promiseAccessor] = 0;
|
|
1808
1886
|
schedule();
|
|
1809
1887
|
queueRender(scope, renderCatch, -1, error);
|
|
@@ -1813,6 +1891,7 @@ function _await(nodeAccessor, renderer) {
|
|
|
1813
1891
|
};
|
|
1814
1892
|
}
|
|
1815
1893
|
function _try(nodeAccessor, content) {
|
|
1894
|
+
if (false) nodeAccessor = decodeAccessor4(nodeAccessor);
|
|
1816
1895
|
const branchAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
|
|
1817
1896
|
return (scope, input) => {
|
|
1818
1897
|
if (!scope[branchAccessor]) {
|
|
@@ -1841,7 +1920,7 @@ function renderCatch(scope, error) {
|
|
|
1841
1920
|
const owner = tryWithCatch["_" /* Owner */];
|
|
1842
1921
|
const placeholderBranch = tryWithCatch["#PlaceholderBranch" /* PlaceholderBranch */];
|
|
1843
1922
|
if (placeholderBranch) {
|
|
1844
|
-
tryWithCatch
|
|
1923
|
+
tryWithCatch["#PendingAsyncCount" /* PendingAsyncCount */] = 0;
|
|
1845
1924
|
owner["ConditionalScope:" /* ConditionalScope */ + tryWithCatch["#BranchAccessor" /* BranchAccessor */]] = placeholderBranch;
|
|
1846
1925
|
destroyBranch(tryWithCatch);
|
|
1847
1926
|
}
|
|
@@ -1859,6 +1938,7 @@ function renderCatch(scope, error) {
|
|
|
1859
1938
|
}
|
|
1860
1939
|
}
|
|
1861
1940
|
function _if(nodeAccessor, ...branches) {
|
|
1941
|
+
if (false) nodeAccessor = decodeAccessor4(nodeAccessor);
|
|
1862
1942
|
const branchAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + nodeAccessor;
|
|
1863
1943
|
enableBranches();
|
|
1864
1944
|
return (scope, newBranch) => {
|
|
@@ -1876,6 +1956,7 @@ function patchDynamicTag(fn) {
|
|
|
1876
1956
|
_dynamic_tag = fn(_dynamic_tag);
|
|
1877
1957
|
}
|
|
1878
1958
|
var _dynamic_tag = function dynamicTag(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1959
|
+
if (false) nodeAccessor = decodeAccessor4(nodeAccessor);
|
|
1879
1960
|
const childScopeAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
|
|
1880
1961
|
const rendererAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + nodeAccessor;
|
|
1881
1962
|
enableBranches();
|
|
@@ -1889,14 +1970,14 @@ var _dynamic_tag = function dynamicTag(nodeAccessor, getContent, getTagVar, inpu
|
|
|
1889
1970
|
createBranchWithTagNameOrRenderer
|
|
1890
1971
|
);
|
|
1891
1972
|
if (getTagVar) {
|
|
1892
|
-
|
|
1973
|
+
scope[childScopeAccessor]["#TagVariable" /* TagVariable */] = (value) => getTagVar()(scope, value);
|
|
1893
1974
|
}
|
|
1894
1975
|
if (typeof normalizedRenderer === "string") {
|
|
1895
1976
|
if (getContent) {
|
|
1896
1977
|
const content = getContent(scope);
|
|
1897
1978
|
setConditionalRenderer(
|
|
1898
1979
|
scope[childScopeAccessor],
|
|
1899
|
-
true ? `#${normalizedRenderer}/0` :
|
|
1980
|
+
true ? `#${normalizedRenderer}/0` : "a",
|
|
1900
1981
|
content,
|
|
1901
1982
|
createAndSetupBranch
|
|
1902
1983
|
);
|
|
@@ -1904,7 +1985,7 @@ var _dynamic_tag = function dynamicTag(nodeAccessor, getContent, getTagVar, inpu
|
|
|
1904
1985
|
subscribeToScopeSet(
|
|
1905
1986
|
content.___owner,
|
|
1906
1987
|
content.___accessor,
|
|
1907
|
-
scope[childScopeAccessor]["ConditionalScope:" /* ConditionalScope */ + (true ? `#${normalizedRenderer}/0` :
|
|
1988
|
+
scope[childScopeAccessor]["ConditionalScope:" /* ConditionalScope */ + (true ? `#${normalizedRenderer}/0` : "a")]
|
|
1908
1989
|
);
|
|
1909
1990
|
}
|
|
1910
1991
|
}
|
|
@@ -1922,9 +2003,12 @@ var _dynamic_tag = function dynamicTag(nodeAccessor, getContent, getTagVar, inpu
|
|
|
1922
2003
|
if (typeof normalizedRenderer === "string") {
|
|
1923
2004
|
(getContent ? _attrs : _attrs_content)(
|
|
1924
2005
|
childScope,
|
|
1925
|
-
true ? `#${normalizedRenderer}/0` :
|
|
2006
|
+
true ? `#${normalizedRenderer}/0` : "a",
|
|
1926
2007
|
(inputIsArgs ? args[0] : args) || {}
|
|
1927
2008
|
);
|
|
2009
|
+
if (childScope["EventAttributes:" /* EventAttributes */ + (true ? `#${normalizedRenderer}/0` : "a")] || childScope["ControlledHandler:" /* ControlledHandler */ + (true ? `#${normalizedRenderer}/0` : "a")]) {
|
|
2010
|
+
queueEffect(childScope, dynamicTagScript);
|
|
2011
|
+
}
|
|
1928
2012
|
} else {
|
|
1929
2013
|
for (const accessor in normalizedRenderer.___localClosures) {
|
|
1930
2014
|
normalizedRenderer.___localClosures[accessor](
|
|
@@ -1950,11 +2034,20 @@ var _dynamic_tag = function dynamicTag(nodeAccessor, getContent, getTagVar, inpu
|
|
|
1950
2034
|
}
|
|
1951
2035
|
};
|
|
1952
2036
|
};
|
|
2037
|
+
function _resume_dynamic_tag() {
|
|
2038
|
+
_resume(DYNAMIC_TAG_SCRIPT_REGISTER_ID, dynamicTagScript);
|
|
2039
|
+
}
|
|
2040
|
+
function dynamicTagScript(branch) {
|
|
2041
|
+
_attrs_script(
|
|
2042
|
+
branch,
|
|
2043
|
+
true ? `#${branch["#Renderer" /* Renderer */]}/0` : "a"
|
|
2044
|
+
);
|
|
2045
|
+
}
|
|
1953
2046
|
function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
|
|
1954
2047
|
const referenceNode = scope[nodeAccessor];
|
|
1955
2048
|
const prevBranch = scope["ConditionalScope:" /* ConditionalScope */ + nodeAccessor];
|
|
1956
|
-
const parentNode = referenceNode.nodeType > 1 /* Element */ ? (prevBranch?.
|
|
1957
|
-
const newBranch = scope["ConditionalScope:" /* ConditionalScope */ + nodeAccessor] = newRenderer && createBranch2(scope
|
|
2049
|
+
const parentNode = referenceNode.nodeType > 1 /* Element */ ? (prevBranch?.["#StartNode" /* StartNode */] || referenceNode).parentNode : referenceNode;
|
|
2050
|
+
const newBranch = scope["ConditionalScope:" /* ConditionalScope */ + nodeAccessor] = newRenderer && createBranch2(scope["$global" /* Global */], newRenderer, scope, parentNode);
|
|
1958
2051
|
if (referenceNode === parentNode) {
|
|
1959
2052
|
if (prevBranch) {
|
|
1960
2053
|
destroyBranch(prevBranch);
|
|
@@ -1965,9 +2058,16 @@ function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2)
|
|
|
1965
2058
|
}
|
|
1966
2059
|
} else if (prevBranch) {
|
|
1967
2060
|
if (newBranch) {
|
|
1968
|
-
insertBranchBefore(
|
|
2061
|
+
insertBranchBefore(
|
|
2062
|
+
newBranch,
|
|
2063
|
+
parentNode,
|
|
2064
|
+
prevBranch["#StartNode" /* StartNode */]
|
|
2065
|
+
);
|
|
1969
2066
|
} else {
|
|
1970
|
-
parentNode.insertBefore(
|
|
2067
|
+
parentNode.insertBefore(
|
|
2068
|
+
referenceNode,
|
|
2069
|
+
prevBranch["#StartNode" /* StartNode */]
|
|
2070
|
+
);
|
|
1971
2071
|
}
|
|
1972
2072
|
removeAndDestroyBranch(prevBranch);
|
|
1973
2073
|
} else if (newBranch) {
|
|
@@ -2014,6 +2114,7 @@ function _for_until(nodeAccessor, renderer) {
|
|
|
2014
2114
|
}
|
|
2015
2115
|
function loop(nodeAccessor, renderer, forEach) {
|
|
2016
2116
|
const params = renderer.___params;
|
|
2117
|
+
if (false) nodeAccessor = decodeAccessor4(nodeAccessor);
|
|
2017
2118
|
enableBranches();
|
|
2018
2119
|
return (scope, value) => {
|
|
2019
2120
|
const referenceNode = scope[nodeAccessor];
|
|
@@ -2021,7 +2122,7 @@ function loop(nodeAccessor, renderer, forEach) {
|
|
|
2021
2122
|
const oldArray = oldMap ? scope["LoopScopeArray:" /* LoopScopeArray */ + nodeAccessor] || [
|
|
2022
2123
|
...oldMap.values()
|
|
2023
2124
|
] : [];
|
|
2024
|
-
const parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].
|
|
2125
|
+
const parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0]["#StartNode" /* StartNode */].parentNode : referenceNode;
|
|
2025
2126
|
const newMap = scope["LoopScopeMap:" /* LoopScopeMap */ + nodeAccessor] = /* @__PURE__ */ new Map();
|
|
2026
2127
|
const newArray = scope["LoopScopeArray:" /* LoopScopeArray */ + nodeAccessor] = [];
|
|
2027
2128
|
forEach(value, (key, args) => {
|
|
@@ -2033,7 +2134,12 @@ function loop(nodeAccessor, renderer, forEach) {
|
|
|
2033
2134
|
);
|
|
2034
2135
|
}
|
|
2035
2136
|
}
|
|
2036
|
-
const branch = oldMap?.get(key) || createAndSetupBranch(
|
|
2137
|
+
const branch = oldMap?.get(key) || createAndSetupBranch(
|
|
2138
|
+
scope["$global" /* Global */],
|
|
2139
|
+
renderer,
|
|
2140
|
+
scope,
|
|
2141
|
+
parentNode
|
|
2142
|
+
);
|
|
2037
2143
|
params?.(branch, args);
|
|
2038
2144
|
newMap.set(key, branch);
|
|
2039
2145
|
newArray.push(branch);
|
|
@@ -2041,7 +2147,7 @@ function loop(nodeAccessor, renderer, forEach) {
|
|
|
2041
2147
|
let afterReference = null;
|
|
2042
2148
|
if (referenceNode !== parentNode) {
|
|
2043
2149
|
if (oldArray.length) {
|
|
2044
|
-
afterReference = oldArray[oldArray.length - 1].
|
|
2150
|
+
afterReference = oldArray[oldArray.length - 1]["#EndNode" /* EndNode */].nextSibling;
|
|
2045
2151
|
if (!newArray.length) {
|
|
2046
2152
|
parentNode.insertBefore(referenceNode, afterReference);
|
|
2047
2153
|
}
|
|
@@ -2054,6 +2160,9 @@ function loop(nodeAccessor, renderer, forEach) {
|
|
|
2054
2160
|
};
|
|
2055
2161
|
}
|
|
2056
2162
|
function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
|
|
2163
|
+
if (typeof tagNameOrRenderer === "string") {
|
|
2164
|
+
assertValidTagName(tagNameOrRenderer);
|
|
2165
|
+
}
|
|
2057
2166
|
const branch = createBranch(
|
|
2058
2167
|
$global,
|
|
2059
2168
|
tagNameOrRenderer,
|
|
@@ -2061,7 +2170,7 @@ function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentSco
|
|
|
2061
2170
|
parentNode
|
|
2062
2171
|
);
|
|
2063
2172
|
if (typeof tagNameOrRenderer === "string") {
|
|
2064
|
-
branch[true ? `#${tagNameOrRenderer}/0` :
|
|
2173
|
+
branch[true ? `#${tagNameOrRenderer}/0` : "a"] = branch["#StartNode" /* StartNode */] = branch["#EndNode" /* EndNode */] = document.createElementNS(
|
|
2065
2174
|
tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI,
|
|
2066
2175
|
tagNameOrRenderer
|
|
2067
2176
|
);
|
|
@@ -2086,7 +2195,7 @@ var pendingEffects = [];
|
|
|
2086
2195
|
var pendingScopes = [];
|
|
2087
2196
|
var rendering;
|
|
2088
2197
|
var scopeKeyOffset = 1e3;
|
|
2089
|
-
function queueRender(scope, signal, signalKey, value, scopeKey = scope
|
|
2198
|
+
function queueRender(scope, signal, signalKey, value, scopeKey = scope["#Id" /* Id */]) {
|
|
2090
2199
|
const key = scopeKey * scopeKeyOffset + signalKey;
|
|
2091
2200
|
const existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
|
|
2092
2201
|
if (existingRender) {
|
|
@@ -2173,12 +2282,12 @@ function runRenders() {
|
|
|
2173
2282
|
}
|
|
2174
2283
|
pendingRenders[i] = item;
|
|
2175
2284
|
}
|
|
2176
|
-
if (!render.___scope
|
|
2285
|
+
if (!render.___scope["#ClosestBranch" /* ClosestBranch */]?.["#Destroyed" /* Destroyed */]) {
|
|
2177
2286
|
runRender(render);
|
|
2178
2287
|
}
|
|
2179
2288
|
}
|
|
2180
2289
|
for (const scope of pendingScopes) {
|
|
2181
|
-
scope
|
|
2290
|
+
scope["#Creating" /* Creating */] = 0;
|
|
2182
2291
|
}
|
|
2183
2292
|
pendingScopes = [];
|
|
2184
2293
|
}
|
|
@@ -2189,10 +2298,10 @@ var _enable_catch = () => {
|
|
|
2189
2298
|
enableBranches();
|
|
2190
2299
|
const handlePendingTry = (fn, scope, branch) => {
|
|
2191
2300
|
while (branch) {
|
|
2192
|
-
if (branch
|
|
2193
|
-
return (branch
|
|
2301
|
+
if (branch["#PendingAsyncCount" /* PendingAsyncCount */]) {
|
|
2302
|
+
return (branch["#Effects" /* Effects */] ||= []).push(fn, scope);
|
|
2194
2303
|
}
|
|
2195
|
-
branch = branch
|
|
2304
|
+
branch = branch["#ParentBranch" /* ParentBranch */];
|
|
2196
2305
|
}
|
|
2197
2306
|
};
|
|
2198
2307
|
runEffects = /* @__PURE__ */ ((runEffects2) => (effects, checkPending = placeholderShown.has(effects)) => {
|
|
@@ -2204,8 +2313,8 @@ var _enable_catch = () => {
|
|
|
2204
2313
|
for (; i < effects.length; ) {
|
|
2205
2314
|
fn = effects[i++];
|
|
2206
2315
|
scope = effects[i++];
|
|
2207
|
-
branch = scope
|
|
2208
|
-
if (!branch?.
|
|
2316
|
+
branch = scope["#ClosestBranch" /* ClosestBranch */];
|
|
2317
|
+
if (!branch?.["#Destroyed" /* Destroyed */] && !(checkPending && handlePendingTry(fn, scope, branch))) {
|
|
2209
2318
|
fn(scope);
|
|
2210
2319
|
}
|
|
2211
2320
|
}
|
|
@@ -2224,17 +2333,17 @@ var _enable_catch = () => {
|
|
|
2224
2333
|
|
|
2225
2334
|
// src/dom/abort-signal.ts
|
|
2226
2335
|
function $signalReset(scope, id) {
|
|
2227
|
-
const ctrl = scope
|
|
2336
|
+
const ctrl = scope["#AbortControllers" /* AbortControllers */]?.[id];
|
|
2228
2337
|
if (ctrl) {
|
|
2229
2338
|
queueEffect(ctrl, abort);
|
|
2230
|
-
scope
|
|
2339
|
+
scope["#AbortControllers" /* AbortControllers */][id] = void 0;
|
|
2231
2340
|
}
|
|
2232
2341
|
}
|
|
2233
2342
|
function $signal(scope, id) {
|
|
2234
|
-
if (scope
|
|
2235
|
-
(scope
|
|
2343
|
+
if (scope["#ClosestBranch" /* ClosestBranch */]) {
|
|
2344
|
+
(scope["#ClosestBranch" /* ClosestBranch */]["#AbortScopes" /* AbortScopes */] ||= /* @__PURE__ */ new Set()).add(scope);
|
|
2236
2345
|
}
|
|
2237
|
-
return ((scope
|
|
2346
|
+
return ((scope["#AbortControllers" /* AbortControllers */] ||= {})[id] ||= new AbortController()).signal;
|
|
2238
2347
|
}
|
|
2239
2348
|
function abort(ctrl) {
|
|
2240
2349
|
ctrl.abort();
|
|
@@ -2264,11 +2373,11 @@ var compat = {
|
|
|
2264
2373
|
return renderer.___clone;
|
|
2265
2374
|
},
|
|
2266
2375
|
getStartNode(branch) {
|
|
2267
|
-
return branch
|
|
2376
|
+
return branch["#StartNode" /* StartNode */];
|
|
2268
2377
|
},
|
|
2269
2378
|
setScopeNodes(branch, startNode, endNode) {
|
|
2270
|
-
branch
|
|
2271
|
-
branch
|
|
2379
|
+
branch["#StartNode" /* StartNode */] = startNode;
|
|
2380
|
+
branch["#EndNode" /* EndNode */] = endNode;
|
|
2272
2381
|
},
|
|
2273
2382
|
runComponentEffects() {
|
|
2274
2383
|
if (this.effects) {
|
|
@@ -2293,8 +2402,8 @@ var compat = {
|
|
|
2293
2402
|
const renderer = _content_branch(0, 0, 0, params);
|
|
2294
2403
|
renderer.___clone = (branch) => {
|
|
2295
2404
|
const cloned = clone();
|
|
2296
|
-
branch
|
|
2297
|
-
branch
|
|
2405
|
+
branch["#StartNode" /* StartNode */] = cloned.startNode;
|
|
2406
|
+
branch["#EndNode" /* EndNode */] = cloned.endNode;
|
|
2298
2407
|
};
|
|
2299
2408
|
return renderer;
|
|
2300
2409
|
},
|
|
@@ -2325,7 +2434,10 @@ var compat = {
|
|
|
2325
2434
|
renderer.___params?.(branch, renderer._ ? args[0] : args);
|
|
2326
2435
|
});
|
|
2327
2436
|
if (created) {
|
|
2328
|
-
return toInsertNode(
|
|
2437
|
+
return toInsertNode(
|
|
2438
|
+
branch["#StartNode" /* StartNode */],
|
|
2439
|
+
branch["#EndNode" /* EndNode */]
|
|
2440
|
+
);
|
|
2329
2441
|
}
|
|
2330
2442
|
}
|
|
2331
2443
|
};
|
|
@@ -2411,8 +2523,8 @@ function mount(input = {}, reference, position) {
|
|
|
2411
2523
|
insertChildNodes(
|
|
2412
2524
|
parentNode,
|
|
2413
2525
|
nextSibling,
|
|
2414
|
-
branch
|
|
2415
|
-
branch
|
|
2526
|
+
branch["#StartNode" /* StartNode */],
|
|
2527
|
+
branch["#EndNode" /* EndNode */]
|
|
2416
2528
|
);
|
|
2417
2529
|
runEffects(effects);
|
|
2418
2530
|
return {
|