marko 6.0.59 → 6.0.61
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/debug/dom.js +278 -296
- package/dist/debug/dom.mjs +278 -296
- package/dist/debug/html.js +219 -219
- package/dist/debug/html.mjs +169 -169
- package/dist/dom/abort-signal.d.ts +2 -2
- package/dist/dom/control-flow.d.ts +8 -8
- package/dist/dom/controllable.d.ts +11 -11
- package/dist/dom/dom.d.ts +17 -18
- package/dist/dom/event.d.ts +1 -1
- package/dist/dom/queue.d.ts +1 -1
- package/dist/dom/renderer.d.ts +4 -4
- package/dist/dom/resume.d.ts +3 -3
- package/dist/dom/signals.d.ts +14 -14
- package/dist/dom/template.d.ts +1 -1
- package/dist/dom.d.ts +10 -10
- package/dist/dom.js +254 -265
- package/dist/dom.mjs +254 -265
- package/dist/html/attrs.d.ts +14 -14
- package/dist/html/compat.d.ts +5 -5
- package/dist/html/content.d.ts +4 -4
- package/dist/html/dynamic-tag.d.ts +3 -3
- package/dist/html/template.d.ts +1 -1
- package/dist/html/writer.d.ts +26 -26
- package/dist/html.d.ts +5 -5
- package/dist/html.js +210 -210
- package/dist/html.mjs +160 -160
- package/dist/translator/index.js +501 -483
- package/dist/translator/util/runtime.d.ts +8 -8
- package/dist/translator/util/signals.d.ts +1 -1
- package/package.json +1 -1
package/dist/debug/dom.mjs
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
// src/common/attr-tag.ts
|
2
2
|
var empty = [];
|
3
3
|
var rest = true ? Symbol("Attribute Tag") : Symbol();
|
4
|
-
function attrTag(
|
5
|
-
|
6
|
-
|
7
|
-
return
|
4
|
+
function attrTag(attrs) {
|
5
|
+
attrs[Symbol.iterator] = attrTagIterator;
|
6
|
+
attrs[rest] = empty;
|
7
|
+
return attrs;
|
8
8
|
}
|
9
|
-
function attrTags(first,
|
9
|
+
function attrTags(first, attrs) {
|
10
10
|
if (first) {
|
11
11
|
if (first[rest] === empty) {
|
12
|
-
first[rest] = [
|
12
|
+
first[rest] = [attrs];
|
13
13
|
} else {
|
14
|
-
first[rest].push(
|
14
|
+
first[rest].push(attrs);
|
15
15
|
}
|
16
16
|
return first;
|
17
17
|
}
|
18
|
-
return attrTag(
|
18
|
+
return attrTag(attrs);
|
19
19
|
}
|
20
20
|
function* attrTagIterator() {
|
21
21
|
yield this;
|
@@ -48,14 +48,14 @@ function forTo(to, from, step, cb) {
|
|
48
48
|
function classValue(classValue2) {
|
49
49
|
return toDelimitedString(classValue2, " ", stringifyClassObject);
|
50
50
|
}
|
51
|
-
function stringifyClassObject(name,
|
52
|
-
return
|
51
|
+
function stringifyClassObject(name, value) {
|
52
|
+
return value ? name : "";
|
53
53
|
}
|
54
54
|
function styleValue(styleValue2) {
|
55
55
|
return toDelimitedString(styleValue2, ";", stringifyStyleObject);
|
56
56
|
}
|
57
|
-
function stringifyStyleObject(name,
|
58
|
-
return
|
57
|
+
function stringifyStyleObject(name, value) {
|
58
|
+
return value || value === 0 ? name + ":" + value : "";
|
59
59
|
}
|
60
60
|
function toDelimitedString(val, delimiter, stringify) {
|
61
61
|
let str = "";
|
@@ -90,13 +90,13 @@ function isEventHandler(name) {
|
|
90
90
|
function getEventHandlerName(name) {
|
91
91
|
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
92
92
|
}
|
93
|
-
function normalizeDynamicRenderer(
|
94
|
-
return
|
93
|
+
function normalizeDynamicRenderer(value) {
|
94
|
+
return value ? value.content || value.default || value : void 0;
|
95
95
|
}
|
96
96
|
|
97
97
|
// src/dom/event.ts
|
98
98
|
var defaultDelegator = createDelegator();
|
99
|
-
function
|
99
|
+
function _on(element, type, handler) {
|
100
100
|
if (element["$" + type] === void 0) {
|
101
101
|
defaultDelegator(element, type, handleDelegated);
|
102
102
|
}
|
@@ -211,57 +211,57 @@ function walk(startNode, walkCodes, branch) {
|
|
211
211
|
walkInternal(0, walkCodes, branch);
|
212
212
|
}
|
213
213
|
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
214
|
-
let
|
214
|
+
let value;
|
215
215
|
let storedMultiplier = 0;
|
216
216
|
let currentMultiplier = 0;
|
217
217
|
let currentScopeIndex = 0;
|
218
218
|
for (; currentWalkIndex < walkCodes.length; ) {
|
219
|
-
|
219
|
+
value = walkCodes.charCodeAt(currentWalkIndex++);
|
220
220
|
currentMultiplier = storedMultiplier;
|
221
221
|
storedMultiplier = 0;
|
222
|
-
if (
|
222
|
+
if (value === 32 /* Get */) {
|
223
223
|
const node = walker.currentNode;
|
224
224
|
scope[true ? getDebugKey(currentScopeIndex, walker.currentNode) : currentScopeIndex] = node;
|
225
225
|
scope["Getter:" /* Getter */ + (true ? getDebugKey(currentScopeIndex++, walker.currentNode) : currentScopeIndex++)] = () => node;
|
226
|
-
} else if (
|
226
|
+
} else if (value === 37 /* Replace */ || value === 49 /* DynamicTagWithVar */) {
|
227
227
|
walker.currentNode.replaceWith(
|
228
228
|
walker.currentNode = scope[true ? getDebugKey(currentScopeIndex++, "#text") : currentScopeIndex++] = new Text()
|
229
229
|
);
|
230
|
-
if (
|
230
|
+
if (value === 49 /* DynamicTagWithVar */) {
|
231
231
|
scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope(scope);
|
232
232
|
}
|
233
|
-
} else if (
|
233
|
+
} else if (value === 38 /* EndChild */) {
|
234
234
|
return currentWalkIndex;
|
235
|
-
} else if (
|
235
|
+
} else if (value === 47 /* BeginChild */ || value === 48 /* BeginChildWithVar */) {
|
236
236
|
currentWalkIndex = walkInternal(
|
237
237
|
currentWalkIndex,
|
238
238
|
walkCodes,
|
239
239
|
scope[true ? getDebugKey(currentScopeIndex++, "#childScope") : currentScopeIndex++] = createScope(scope.$global, scope.___closestBranch)
|
240
240
|
);
|
241
|
-
if (
|
241
|
+
if (value === 48 /* BeginChildWithVar */) {
|
242
242
|
scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope(scope);
|
243
243
|
}
|
244
|
-
} else if (
|
245
|
-
|
246
|
-
while (
|
244
|
+
} else if (value < 91 /* NextEnd */ + 1) {
|
245
|
+
value = 20 /* Next */ * currentMultiplier + value - 67 /* Next */;
|
246
|
+
while (value--) {
|
247
247
|
walker.nextNode();
|
248
248
|
}
|
249
|
-
} else if (
|
250
|
-
|
251
|
-
while (
|
249
|
+
} else if (value < 106 /* OverEnd */ + 1) {
|
250
|
+
value = 10 /* Over */ * currentMultiplier + value - 97 /* Over */;
|
251
|
+
while (value--) {
|
252
252
|
walker.nextSibling();
|
253
253
|
}
|
254
|
-
} else if (
|
255
|
-
|
256
|
-
while (
|
254
|
+
} else if (value < 116 /* OutEnd */ + 1) {
|
255
|
+
value = 10 /* Out */ * currentMultiplier + value - 107 /* Out */;
|
256
|
+
while (value--) {
|
257
257
|
walker.parentNode();
|
258
258
|
}
|
259
259
|
walker.nextSibling();
|
260
260
|
} else {
|
261
|
-
if (
|
262
|
-
throw new Error(`Unknown walk code: ${
|
261
|
+
if (value < 117 /* Multiplier */ || value > 126 /* MultiplierEnd */) {
|
262
|
+
throw new Error(`Unknown walk code: ${value}`);
|
263
263
|
}
|
264
|
-
storedMultiplier = currentMultiplier * 10 /* Multiplier */ +
|
264
|
+
storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value - 117 /* Multiplier */;
|
265
265
|
}
|
266
266
|
}
|
267
267
|
}
|
@@ -477,24 +477,24 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
477
477
|
}
|
478
478
|
}
|
479
479
|
var isResuming;
|
480
|
-
function
|
480
|
+
function _resume(id, obj) {
|
481
481
|
registeredValues[id] = obj;
|
482
482
|
return obj;
|
483
483
|
}
|
484
|
-
function
|
485
|
-
registeredValues[id] = (scope) => (
|
484
|
+
function _var_resume(id, signal) {
|
485
|
+
registeredValues[id] = (scope) => (value) => signal(scope, value);
|
486
486
|
return signal;
|
487
487
|
}
|
488
488
|
function getRegisteredWithScope(id, scope) {
|
489
489
|
const val = registeredValues[id];
|
490
490
|
return scope ? val(scope) : val;
|
491
491
|
}
|
492
|
-
function
|
493
|
-
return
|
492
|
+
function _el(id, key) {
|
493
|
+
return _resume(id, (scope) => () => scope[key]());
|
494
494
|
}
|
495
495
|
|
496
496
|
// src/dom/controllable.ts
|
497
|
-
function
|
497
|
+
function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
|
498
498
|
setCheckboxValue(
|
499
499
|
scope,
|
500
500
|
nodeAccessor,
|
@@ -503,7 +503,7 @@ function controllable_input_checked(scope, nodeAccessor, checked, checkedChange)
|
|
503
503
|
checkedChange
|
504
504
|
);
|
505
505
|
}
|
506
|
-
function
|
506
|
+
function _attr_input_checked_script(scope, nodeAccessor) {
|
507
507
|
const el = scope[nodeAccessor];
|
508
508
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
509
509
|
const checkedChange = scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor];
|
@@ -515,18 +515,18 @@ function controllable_input_checked_effect(scope, nodeAccessor) {
|
|
515
515
|
}
|
516
516
|
});
|
517
517
|
}
|
518
|
-
function
|
518
|
+
function _attr_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValueChange, value) {
|
519
519
|
scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] = checkedValue;
|
520
|
-
|
520
|
+
_attr(scope[nodeAccessor], "value", value);
|
521
521
|
setCheckboxValue(
|
522
522
|
scope,
|
523
523
|
nodeAccessor,
|
524
524
|
1 /* InputCheckedValue */,
|
525
|
-
Array.isArray(checkedValue) ? checkedValue.includes(
|
525
|
+
Array.isArray(checkedValue) ? checkedValue.includes(value) : checkedValue === value,
|
526
526
|
checkedValueChange
|
527
527
|
);
|
528
528
|
}
|
529
|
-
function
|
529
|
+
function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
530
530
|
const el = scope[nodeAccessor];
|
531
531
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
532
532
|
const checkedValueChange = scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor];
|
@@ -549,13 +549,13 @@ function controllable_input_checkedValue_effect(scope, nodeAccessor) {
|
|
549
549
|
}
|
550
550
|
});
|
551
551
|
}
|
552
|
-
function
|
552
|
+
function _attr_input_value(scope, nodeAccessor, value, valueChange) {
|
553
553
|
const el = scope[nodeAccessor];
|
554
|
-
const normalizedValue = normalizeStrProp(
|
554
|
+
const normalizedValue = normalizeStrProp(value);
|
555
555
|
scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor] = valueChange;
|
556
556
|
if (valueChange) {
|
557
557
|
scope["ControlledType:" /* ControlledType */ + nodeAccessor] = 0 /* InputChecked */;
|
558
|
-
scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] =
|
558
|
+
scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] = value;
|
559
559
|
if (el.isConnected) {
|
560
560
|
setValueAndUpdateSelection(el, normalizedValue);
|
561
561
|
} else {
|
@@ -566,7 +566,7 @@ function controllable_input_value(scope, nodeAccessor, value2, valueChange) {
|
|
566
566
|
el.defaultValue = normalizedValue;
|
567
567
|
}
|
568
568
|
}
|
569
|
-
function
|
569
|
+
function _attr_input_value_script(scope, nodeAccessor) {
|
570
570
|
const el = scope[nodeAccessor];
|
571
571
|
if (isResuming) {
|
572
572
|
scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] = el.defaultValue;
|
@@ -585,24 +585,24 @@ function controllable_input_value_effect(scope, nodeAccessor) {
|
|
585
585
|
}
|
586
586
|
});
|
587
587
|
}
|
588
|
-
function
|
588
|
+
function _attr_select_value(scope, nodeAccessor, value, valueChange) {
|
589
589
|
scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor] = valueChange;
|
590
590
|
if (valueChange) {
|
591
591
|
scope["ControlledType:" /* ControlledType */ + nodeAccessor] = 3 /* SelectValue */;
|
592
|
-
scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] =
|
592
|
+
scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] = value;
|
593
593
|
} else {
|
594
594
|
scope["ControlledType:" /* ControlledType */ + nodeAccessor] = 5 /* None */;
|
595
595
|
}
|
596
596
|
pendingEffects.unshift(
|
597
597
|
() => setSelectOptions(
|
598
598
|
scope[nodeAccessor],
|
599
|
-
|
599
|
+
value,
|
600
600
|
valueChange
|
601
601
|
),
|
602
602
|
scope
|
603
603
|
);
|
604
604
|
}
|
605
|
-
function
|
605
|
+
function _attr_select_value_script(scope, nodeAccessor) {
|
606
606
|
const el = scope[nodeAccessor];
|
607
607
|
const onChange = () => {
|
608
608
|
const valueChange = scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor];
|
@@ -621,8 +621,8 @@ function controllable_select_value_effect(scope, nodeAccessor) {
|
|
621
621
|
};
|
622
622
|
if (!el._) {
|
623
623
|
new MutationObserver(() => {
|
624
|
-
const
|
625
|
-
if (Array.isArray(
|
624
|
+
const value = scope["ControlledValue:" /* ControlledValue */ + nodeAccessor];
|
625
|
+
if (Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((value2, i) => value2 != el.selectedOptions[i].value) : el.value != value) {
|
626
626
|
onChange();
|
627
627
|
}
|
628
628
|
}).observe(el, {
|
@@ -632,10 +632,10 @@ function controllable_select_value_effect(scope, nodeAccessor) {
|
|
632
632
|
}
|
633
633
|
syncControllable(el, "input", hasSelectChanged, onChange);
|
634
634
|
}
|
635
|
-
function setSelectOptions(el,
|
636
|
-
if (Array.isArray(
|
635
|
+
function setSelectOptions(el, value, valueChange) {
|
636
|
+
if (Array.isArray(value)) {
|
637
637
|
for (const opt of el.options) {
|
638
|
-
const selected =
|
638
|
+
const selected = value.includes(opt.value);
|
639
639
|
if (valueChange) {
|
640
640
|
opt.selected = selected;
|
641
641
|
} else {
|
@@ -643,7 +643,7 @@ function setSelectOptions(el, value2, valueChange) {
|
|
643
643
|
}
|
644
644
|
}
|
645
645
|
} else {
|
646
|
-
const normalizedValue = normalizeStrProp(
|
646
|
+
const normalizedValue = normalizeStrProp(value);
|
647
647
|
if (valueChange) {
|
648
648
|
el.value = normalizedValue;
|
649
649
|
} else {
|
@@ -653,7 +653,7 @@ function setSelectOptions(el, value2, valueChange) {
|
|
653
653
|
}
|
654
654
|
}
|
655
655
|
}
|
656
|
-
function
|
656
|
+
function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
|
657
657
|
scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor] = openChange;
|
658
658
|
if (openChange) {
|
659
659
|
scope["ControlledType:" /* ControlledType */ + nodeAccessor] = 4 /* DetailsOrDialogOpen */;
|
@@ -662,7 +662,7 @@ function controllable_detailsOrDialog_open(scope, nodeAccessor, open, openChange
|
|
662
662
|
}
|
663
663
|
scope[nodeAccessor].open = scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] = normalizeBoolProp(open);
|
664
664
|
}
|
665
|
-
function
|
665
|
+
function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
666
666
|
const el = scope[nodeAccessor];
|
667
667
|
const hasChanged = () => el.open !== scope["ControlledValue:" /* ControlledValue */ + nodeAccessor];
|
668
668
|
syncControllable(
|
@@ -681,13 +681,13 @@ function controllable_detailsOrDialog_open_effect(scope, nodeAccessor) {
|
|
681
681
|
);
|
682
682
|
}
|
683
683
|
var inputType = "";
|
684
|
-
function setValueAndUpdateSelection(el,
|
685
|
-
if (el.value !==
|
684
|
+
function setValueAndUpdateSelection(el, value) {
|
685
|
+
if (el.value !== value) {
|
686
686
|
const updatedPosition = resolveCursorPosition(
|
687
687
|
inputType,
|
688
688
|
el.getRootNode().activeElement === el && el.selectionStart,
|
689
689
|
el.value,
|
690
|
-
el.value =
|
690
|
+
el.value = value
|
691
691
|
);
|
692
692
|
if (~updatedPosition) {
|
693
693
|
el.setSelectionRange(updatedPosition, updatedPosition);
|
@@ -751,11 +751,11 @@ function hasSelectChanged(el) {
|
|
751
751
|
function hasFormElementChanged(el) {
|
752
752
|
return el.options ? hasSelectChanged(el) : hasValueChanged(el) || hasCheckboxChanged(el);
|
753
753
|
}
|
754
|
-
function normalizeStrProp(
|
755
|
-
return normalizeAttrValue(
|
754
|
+
function normalizeStrProp(value) {
|
755
|
+
return normalizeAttrValue(value) || "";
|
756
756
|
}
|
757
|
-
function normalizeBoolProp(
|
758
|
-
return
|
757
|
+
function normalizeBoolProp(value) {
|
758
|
+
return value != null && value !== false;
|
759
759
|
}
|
760
760
|
function updateList(arr, val, push) {
|
761
761
|
const index = arr.indexOf(val);
|
@@ -767,9 +767,9 @@ function toValueProp(it) {
|
|
767
767
|
|
768
768
|
// src/dom/parse-html.ts
|
769
769
|
var parsers = {};
|
770
|
-
function parseHTML(
|
770
|
+
function parseHTML(html, ns) {
|
771
771
|
const parser = parsers[ns] ||= document.createElementNS(ns, "template");
|
772
|
-
parser.innerHTML =
|
772
|
+
parser.innerHTML = html;
|
773
773
|
return parser.content || parser;
|
774
774
|
}
|
775
775
|
|
@@ -817,7 +817,7 @@ function triggerMacroTask() {
|
|
817
817
|
}
|
818
818
|
|
819
819
|
// src/dom/signals.ts
|
820
|
-
function
|
820
|
+
function _let(valueAccessor, fn) {
|
821
821
|
if (true) {
|
822
822
|
var id = +valueAccessor.slice(
|
823
823
|
valueAccessor.lastIndexOf("/") + 1
|
@@ -828,42 +828,42 @@ function state(valueAccessor, fn) {
|
|
828
828
|
);
|
829
829
|
}
|
830
830
|
const valueChangeAccessor = "TagVariableChange:" /* TagVariableChange */ + valueAccessor;
|
831
|
-
const update = (scope,
|
832
|
-
if (scope[valueAccessor] !==
|
833
|
-
scope[valueAccessor] =
|
834
|
-
fn(scope,
|
831
|
+
const update = (scope, value) => {
|
832
|
+
if (scope[valueAccessor] !== value) {
|
833
|
+
scope[valueAccessor] = value;
|
834
|
+
fn(scope, value);
|
835
835
|
}
|
836
836
|
};
|
837
|
-
return (scope,
|
837
|
+
return (scope, value, valueChange) => {
|
838
838
|
if (rendering) {
|
839
|
-
if ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !==
|
840
|
-
scope[valueAccessor] =
|
841
|
-
fn(scope,
|
839
|
+
if ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !== value || !(valueAccessor in scope)) {
|
840
|
+
scope[valueAccessor] = value;
|
841
|
+
fn(scope, value);
|
842
842
|
}
|
843
843
|
} else if (scope[valueChangeAccessor]) {
|
844
|
-
scope[valueChangeAccessor](
|
844
|
+
scope[valueChangeAccessor](value);
|
845
845
|
} else {
|
846
846
|
schedule();
|
847
847
|
queueRender(
|
848
848
|
scope,
|
849
849
|
update,
|
850
850
|
true ? id : valueAccessor,
|
851
|
-
|
851
|
+
value
|
852
852
|
);
|
853
853
|
}
|
854
|
-
return
|
854
|
+
return value;
|
855
855
|
};
|
856
856
|
}
|
857
|
-
function
|
857
|
+
function _const(valueAccessor, fn = () => {
|
858
858
|
}) {
|
859
|
-
return (scope,
|
860
|
-
if (!(valueAccessor in scope) || scope[valueAccessor] !==
|
861
|
-
scope[valueAccessor] =
|
862
|
-
fn(scope,
|
859
|
+
return (scope, value) => {
|
860
|
+
if (!(valueAccessor in scope) || scope[valueAccessor] !== value) {
|
861
|
+
scope[valueAccessor] = value;
|
862
|
+
fn(scope, value);
|
863
863
|
}
|
864
864
|
};
|
865
865
|
}
|
866
|
-
function
|
866
|
+
function _or(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "___id") {
|
867
867
|
return (scope) => {
|
868
868
|
if (scope.___creating) {
|
869
869
|
if (scope[id] === void 0) {
|
@@ -876,7 +876,7 @@ function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__
|
|
876
876
|
}
|
877
877
|
};
|
878
878
|
}
|
879
|
-
function
|
879
|
+
function _for_closure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
880
880
|
const childSignal = closure(valueAccessor, fn);
|
881
881
|
const loopScopeAccessor = "LoopScopeArray:" /* LoopScopeArray */ + ownerLoopNodeAccessor;
|
882
882
|
const loopScopeMapAccessor = "LoopScopeMap:" /* LoopScopeMap */ + ownerLoopNodeAccessor;
|
@@ -902,7 +902,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
902
902
|
ownerSignal._ = childSignal;
|
903
903
|
return ownerSignal;
|
904
904
|
}
|
905
|
-
function
|
905
|
+
function _if_closure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
|
906
906
|
const childSignal = closure(valueAccessor, fn);
|
907
907
|
const scopeAccessor = "ConditionalScope:" /* ConditionalScope */ + ownerConditionalNodeAccessor;
|
908
908
|
const branchAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + ownerConditionalNodeAccessor;
|
@@ -919,13 +919,13 @@ function subscribeToScopeSet(ownerScope, accessor, scope) {
|
|
919
919
|
const subscribers = ownerScope[accessor] ||= /* @__PURE__ */ new Set();
|
920
920
|
if (!subscribers.has(scope)) {
|
921
921
|
subscribers.add(scope);
|
922
|
-
|
922
|
+
$signal(scope, -1).addEventListener(
|
923
923
|
"abort",
|
924
924
|
() => ownerScope[accessor].delete(scope)
|
925
925
|
);
|
926
926
|
}
|
927
927
|
}
|
928
|
-
function
|
928
|
+
function _closure(...closureSignals) {
|
929
929
|
const [{ ___scopeInstancesAccessor, ___signalIndexAccessor }] = closureSignals;
|
930
930
|
for (let i = closureSignals.length; i--; ) {
|
931
931
|
closureSignals[i].___index = i;
|
@@ -944,7 +944,7 @@ function dynamicClosure(...closureSignals) {
|
|
944
944
|
}
|
945
945
|
};
|
946
946
|
}
|
947
|
-
function
|
947
|
+
function _closure_get(valueAccessor, fn, getOwnerScope) {
|
948
948
|
const childSignal = closure(valueAccessor, fn, getOwnerScope);
|
949
949
|
const closureSignal = ((scope) => {
|
950
950
|
scope[closureSignal.___signalIndexAccessor] = closureSignal.___index;
|
@@ -967,22 +967,22 @@ function closure(valueAccessor, fn, getOwnerScope) {
|
|
967
967
|
);
|
968
968
|
};
|
969
969
|
}
|
970
|
-
function
|
971
|
-
scope[childAccessor]["#TagVariable" /* TagVariable */] = (
|
970
|
+
function _var(scope, childAccessor, signal) {
|
971
|
+
scope[childAccessor]["#TagVariable" /* TagVariable */] = (value) => signal(scope, value);
|
972
972
|
}
|
973
|
-
var
|
974
|
-
function
|
973
|
+
var _return = (scope, value) => scope["#TagVariable" /* TagVariable */]?.(value);
|
974
|
+
function _return_change(scope, changeHandler) {
|
975
975
|
scope["#TagVariableChange" /* TagVariableChange */] = changeHandler;
|
976
976
|
}
|
977
|
-
var
|
977
|
+
var _var_change = (scope, value) => scope["#TagVariableChange" /* TagVariableChange */]?.(value);
|
978
978
|
var tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
979
|
-
function
|
979
|
+
function _id({ $global }) {
|
980
980
|
const id = tagIdsByGlobal.get($global) || 0;
|
981
981
|
tagIdsByGlobal.set($global, id + 1);
|
982
982
|
return "c" + $global.runtimeId + $global.renderId + id.toString(36);
|
983
983
|
}
|
984
|
-
function
|
985
|
-
|
984
|
+
function _script(id, fn) {
|
985
|
+
_resume(id, fn);
|
986
986
|
return (scope) => {
|
987
987
|
queueEffect(scope, fn);
|
988
988
|
};
|
@@ -1000,7 +1000,7 @@ function* traverseAllHoisted(scope, path, curIndex = path.length - 1) {
|
|
1000
1000
|
}
|
1001
1001
|
}
|
1002
1002
|
}
|
1003
|
-
function
|
1003
|
+
function _hoist(...path) {
|
1004
1004
|
return (scope) => {
|
1005
1005
|
const getOne = (...args) => iterator().next().value(...args);
|
1006
1006
|
const iterator = getOne[Symbol.iterator] = () => traverseAllHoisted(scope, path);
|
@@ -1039,7 +1039,7 @@ function setupBranch(renderer, branch) {
|
|
1039
1039
|
}
|
1040
1040
|
return branch;
|
1041
1041
|
}
|
1042
|
-
function
|
1042
|
+
function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
|
1043
1043
|
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "";
|
1044
1044
|
setup = setup ? setup._ || setup : void 0;
|
1045
1045
|
params ||= void 0;
|
@@ -1066,16 +1066,16 @@ function createContent(id, template, walks, setup, params, dynamicScopesAccessor
|
|
1066
1066
|
};
|
1067
1067
|
};
|
1068
1068
|
}
|
1069
|
-
function
|
1070
|
-
return
|
1069
|
+
function _content_resume(id, template, walks, setup, params, dynamicScopesAccessor) {
|
1070
|
+
return _resume(
|
1071
1071
|
id,
|
1072
|
-
|
1072
|
+
_content(id, template, walks, setup, params, dynamicScopesAccessor)
|
1073
1073
|
);
|
1074
1074
|
}
|
1075
|
-
function
|
1075
|
+
function _content_closures(renderer, closureFns) {
|
1076
1076
|
const closureSignals = {};
|
1077
1077
|
for (const key in closureFns) {
|
1078
|
-
closureSignals[key] =
|
1078
|
+
closureSignals[key] = _const(key, closureFns[key]);
|
1079
1079
|
}
|
1080
1080
|
return (owner, closureValues) => {
|
1081
1081
|
const instance = renderer(owner);
|
@@ -1084,12 +1084,12 @@ function localClosures(renderer, closureFns) {
|
|
1084
1084
|
return instance;
|
1085
1085
|
};
|
1086
1086
|
}
|
1087
|
-
function
|
1088
|
-
return
|
1087
|
+
function _content_branch(template, walks, setup, params) {
|
1088
|
+
return _content("", template, walks, setup, params)();
|
1089
1089
|
}
|
1090
1090
|
var cloneCache = {};
|
1091
|
-
function createCloneableHTML(
|
1092
|
-
const { firstChild, lastChild } = parseHTML(
|
1091
|
+
function createCloneableHTML(html, ns) {
|
1092
|
+
const { firstChild, lastChild } = parseHTML(html, ns);
|
1093
1093
|
const parent = document.createElementNS(ns, "t");
|
1094
1094
|
insertChildNodes(parent, null, firstChild, lastChild);
|
1095
1095
|
return firstChild === lastChild && firstChild.nodeType < 8 /* Comment */ ? (branch, walks) => {
|
@@ -1107,53 +1107,53 @@ function createCloneableHTML(html2, ns) {
|
|
1107
1107
|
}
|
1108
1108
|
|
1109
1109
|
// src/dom/dom.ts
|
1110
|
-
function
|
1111
|
-
setAttribute(element, name, normalizeAttrValue(
|
1110
|
+
function _attr(element, name, value) {
|
1111
|
+
setAttribute(element, name, normalizeAttrValue(value));
|
1112
1112
|
}
|
1113
|
-
function setAttribute(element, name,
|
1114
|
-
if (element.getAttribute(name) !=
|
1115
|
-
if (
|
1113
|
+
function setAttribute(element, name, value) {
|
1114
|
+
if (element.getAttribute(name) != value) {
|
1115
|
+
if (value === void 0) {
|
1116
1116
|
element.removeAttribute(name);
|
1117
1117
|
} else {
|
1118
|
-
element.setAttribute(name,
|
1118
|
+
element.setAttribute(name, value);
|
1119
1119
|
}
|
1120
1120
|
}
|
1121
1121
|
}
|
1122
|
-
function
|
1123
|
-
setAttribute(element, "class", classValue(
|
1122
|
+
function _attr_class(element, value) {
|
1123
|
+
setAttribute(element, "class", classValue(value) || void 0);
|
1124
1124
|
}
|
1125
|
-
function
|
1125
|
+
function _attr_class_items(element, items) {
|
1126
1126
|
for (const key in items) {
|
1127
|
-
|
1127
|
+
_attr_class_item(element, key, items[key]);
|
1128
1128
|
}
|
1129
1129
|
}
|
1130
|
-
function
|
1131
|
-
element.classList.toggle(name, !!
|
1130
|
+
function _attr_class_item(element, name, value) {
|
1131
|
+
element.classList.toggle(name, !!value);
|
1132
1132
|
}
|
1133
|
-
function
|
1134
|
-
setAttribute(element, "style", styleValue(
|
1133
|
+
function _attr_style(element, value) {
|
1134
|
+
setAttribute(element, "style", styleValue(value) || void 0);
|
1135
1135
|
}
|
1136
|
-
function
|
1136
|
+
function _attr_style_items(element, items) {
|
1137
1137
|
for (const key in items) {
|
1138
|
-
|
1138
|
+
_attr_style_item(element, key, items[key]);
|
1139
1139
|
}
|
1140
1140
|
}
|
1141
|
-
function
|
1142
|
-
element.style.setProperty(name,
|
1141
|
+
function _attr_style_item(element, name, value) {
|
1142
|
+
element.style.setProperty(name, value || value === 0 ? value + "" : "");
|
1143
1143
|
}
|
1144
|
-
function
|
1145
|
-
const normalizedValue = normalizeString(
|
1144
|
+
function _text(node, value) {
|
1145
|
+
const normalizedValue = normalizeString(value);
|
1146
1146
|
if (node.data !== normalizedValue) {
|
1147
1147
|
node.data = normalizedValue;
|
1148
1148
|
}
|
1149
1149
|
}
|
1150
|
-
function
|
1151
|
-
const normalizedValue = normalizeString(
|
1150
|
+
function _text_content(node, value) {
|
1151
|
+
const normalizedValue = normalizeString(value);
|
1152
1152
|
if (node.textContent !== normalizedValue) {
|
1153
1153
|
node.textContent = normalizedValue;
|
1154
1154
|
}
|
1155
1155
|
}
|
1156
|
-
function
|
1156
|
+
function _attrs(scope, nodeAccessor, nextAttrs) {
|
1157
1157
|
const el = scope[nodeAccessor];
|
1158
1158
|
for (let i = el.attributes.length; i--; ) {
|
1159
1159
|
const { name } = el.attributes.item(i);
|
@@ -1163,14 +1163,14 @@ function attrs(scope, nodeAccessor, nextAttrs) {
|
|
1163
1163
|
}
|
1164
1164
|
attrsInternal(scope, nodeAccessor, nextAttrs);
|
1165
1165
|
}
|
1166
|
-
function
|
1167
|
-
|
1168
|
-
|
1166
|
+
function _attrs_content(scope, nodeAccessor, nextAttrs) {
|
1167
|
+
_attrs(scope, nodeAccessor, nextAttrs);
|
1168
|
+
_attr_content(scope, nodeAccessor, nextAttrs?.content);
|
1169
1169
|
}
|
1170
|
-
function hasAttrAlias(element,
|
1171
|
-
return
|
1170
|
+
function hasAttrAlias(element, attr, nextAttrs) {
|
1171
|
+
return attr === "checked" && element.tagName === "INPUT" && "checkedValue" in nextAttrs;
|
1172
1172
|
}
|
1173
|
-
function
|
1173
|
+
function _attrs_partial(scope, nodeAccessor, nextAttrs, skip) {
|
1174
1174
|
const el = scope[nodeAccessor];
|
1175
1175
|
const partial = {};
|
1176
1176
|
for (let i = el.attributes.length; i--; ) {
|
@@ -1184,9 +1184,9 @@ function partialAttrs(scope, nodeAccessor, nextAttrs, skip) {
|
|
1184
1184
|
}
|
1185
1185
|
attrsInternal(scope, nodeAccessor, partial);
|
1186
1186
|
}
|
1187
|
-
function
|
1188
|
-
|
1189
|
-
|
1187
|
+
function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip) {
|
1188
|
+
_attrs_partial(scope, nodeAccessor, nextAttrs, skip);
|
1189
|
+
_attr_content(scope, nodeAccessor, nextAttrs?.content);
|
1190
1190
|
}
|
1191
1191
|
function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
1192
1192
|
const el = scope[nodeAccessor];
|
@@ -1195,14 +1195,14 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
1195
1195
|
switch (el.tagName) {
|
1196
1196
|
case "INPUT":
|
1197
1197
|
if ("checked" in nextAttrs || "checkedChange" in nextAttrs) {
|
1198
|
-
|
1198
|
+
_attr_input_checked(
|
1199
1199
|
scope,
|
1200
1200
|
nodeAccessor,
|
1201
1201
|
nextAttrs.checked,
|
1202
1202
|
nextAttrs.checkedChange
|
1203
1203
|
);
|
1204
1204
|
} else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs) {
|
1205
|
-
|
1205
|
+
_attr_input_checkedValue(
|
1206
1206
|
scope,
|
1207
1207
|
nodeAccessor,
|
1208
1208
|
nextAttrs.checkedValue,
|
@@ -1210,7 +1210,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
1210
1210
|
nextAttrs.value
|
1211
1211
|
);
|
1212
1212
|
} else if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
1213
|
-
|
1213
|
+
_attr_input_value(
|
1214
1214
|
scope,
|
1215
1215
|
nodeAccessor,
|
1216
1216
|
nextAttrs.value,
|
@@ -1223,7 +1223,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
1223
1223
|
break;
|
1224
1224
|
case "SELECT":
|
1225
1225
|
if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
1226
|
-
|
1226
|
+
_attr_select_value(
|
1227
1227
|
scope,
|
1228
1228
|
nodeAccessor,
|
1229
1229
|
nextAttrs.value,
|
@@ -1234,7 +1234,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
1234
1234
|
break;
|
1235
1235
|
case "TEXTAREA":
|
1236
1236
|
if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
1237
|
-
|
1237
|
+
_attr_input_value(
|
1238
1238
|
scope,
|
1239
1239
|
nodeAccessor,
|
1240
1240
|
nextAttrs.value,
|
@@ -1246,7 +1246,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
1246
1246
|
case "DETAILS":
|
1247
1247
|
case "DIALOG":
|
1248
1248
|
if ("open" in nextAttrs || "openChange" in nextAttrs) {
|
1249
|
-
|
1249
|
+
_attr_details_or_dialog_open(
|
1250
1250
|
scope,
|
1251
1251
|
nodeAccessor,
|
1252
1252
|
nextAttrs.open,
|
@@ -1257,27 +1257,27 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
1257
1257
|
break;
|
1258
1258
|
}
|
1259
1259
|
for (const name in nextAttrs) {
|
1260
|
-
const
|
1260
|
+
const value = nextAttrs[name];
|
1261
1261
|
switch (name) {
|
1262
1262
|
case "class":
|
1263
|
-
|
1263
|
+
_attr_class(el, value);
|
1264
1264
|
break;
|
1265
1265
|
case "style":
|
1266
|
-
|
1266
|
+
_attr_style(el, value);
|
1267
1267
|
break;
|
1268
1268
|
default: {
|
1269
1269
|
if (isEventHandler(name)) {
|
1270
|
-
(events ||= scope["EventAttributes:" /* EventAttributes */ + nodeAccessor] = {})[getEventHandlerName(name)] =
|
1270
|
+
(events ||= scope["EventAttributes:" /* EventAttributes */ + nodeAccessor] = {})[getEventHandlerName(name)] = value;
|
1271
1271
|
} else if (!(skip?.test(name) || name === "content" && el.tagName !== "META")) {
|
1272
|
-
|
1272
|
+
_attr(el, name, value);
|
1273
1273
|
}
|
1274
1274
|
break;
|
1275
1275
|
}
|
1276
1276
|
}
|
1277
1277
|
}
|
1278
1278
|
}
|
1279
|
-
function
|
1280
|
-
const content = normalizeClientRender(
|
1279
|
+
function _attr_content(scope, nodeAccessor, value) {
|
1280
|
+
const content = normalizeClientRender(value);
|
1281
1281
|
const rendererAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + nodeAccessor;
|
1282
1282
|
if (scope[rendererAccessor] !== (scope[rendererAccessor] = content?.___id)) {
|
1283
1283
|
setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch);
|
@@ -1290,36 +1290,36 @@ function insertContent(scope, nodeAccessor, value2) {
|
|
1290
1290
|
}
|
1291
1291
|
}
|
1292
1292
|
}
|
1293
|
-
function
|
1293
|
+
function _attrs_script(scope, nodeAccessor) {
|
1294
1294
|
const el = scope[nodeAccessor];
|
1295
1295
|
const events = scope["EventAttributes:" /* EventAttributes */ + nodeAccessor];
|
1296
1296
|
switch (scope["ControlledType:" /* ControlledType */ + nodeAccessor]) {
|
1297
1297
|
case 0 /* InputChecked */:
|
1298
|
-
|
1298
|
+
_attr_input_checked_script(scope, nodeAccessor);
|
1299
1299
|
break;
|
1300
1300
|
case 1 /* InputCheckedValue */:
|
1301
|
-
|
1301
|
+
_attr_input_checkedValue_script(scope, nodeAccessor);
|
1302
1302
|
break;
|
1303
1303
|
case 2 /* InputValue */:
|
1304
|
-
|
1304
|
+
_attr_input_value_script(scope, nodeAccessor);
|
1305
1305
|
break;
|
1306
1306
|
case 3 /* SelectValue */:
|
1307
|
-
|
1307
|
+
_attr_select_value_script(scope, nodeAccessor);
|
1308
1308
|
break;
|
1309
1309
|
case 4 /* DetailsOrDialogOpen */:
|
1310
|
-
|
1310
|
+
_attr_details_or_dialog_open_script(scope, nodeAccessor);
|
1311
1311
|
break;
|
1312
1312
|
}
|
1313
1313
|
for (const name in events) {
|
1314
|
-
|
1314
|
+
_on(el, name, events[name]);
|
1315
1315
|
}
|
1316
1316
|
}
|
1317
|
-
function
|
1317
|
+
function _html(scope, value, accessor) {
|
1318
1318
|
const firstChild = scope[accessor];
|
1319
1319
|
const parentNode = firstChild.parentNode;
|
1320
1320
|
const lastChild = scope["DynamicPlaceholderLastChild:" /* DynamicPlaceholderLastChild */ + accessor] || firstChild;
|
1321
1321
|
const newContent = parseHTML(
|
1322
|
-
|
1322
|
+
value || value === 0 ? value + "" : "",
|
1323
1323
|
parentNode.namespaceURI
|
1324
1324
|
);
|
1325
1325
|
insertChildNodes(
|
@@ -1330,43 +1330,27 @@ function html(scope, value2, accessor) {
|
|
1330
1330
|
);
|
1331
1331
|
removeChildNodes(firstChild, lastChild);
|
1332
1332
|
}
|
1333
|
-
function normalizeClientRender(
|
1334
|
-
const renderer = normalizeDynamicRenderer(
|
1333
|
+
function normalizeClientRender(value) {
|
1334
|
+
const renderer = normalizeDynamicRenderer(value);
|
1335
1335
|
if (renderer) {
|
1336
1336
|
if (renderer.___id) {
|
1337
1337
|
return renderer;
|
1338
1338
|
} else if (true) {
|
1339
1339
|
throw new Error(
|
1340
|
-
`Invalid \`content\` attribute. Received ${typeof
|
1340
|
+
`Invalid \`content\` attribute. Received ${typeof value}`
|
1341
1341
|
);
|
1342
1342
|
}
|
1343
1343
|
}
|
1344
1344
|
}
|
1345
|
-
function
|
1346
|
-
|
1347
|
-
|
1348
|
-
const node = scope[nodeIndex];
|
1349
|
-
if (prevProps) {
|
1350
|
-
for (const name in prevProps) {
|
1351
|
-
if (!(name in nextProps)) {
|
1352
|
-
node[name] = void 0;
|
1353
|
-
}
|
1354
|
-
}
|
1355
|
-
}
|
1356
|
-
for (const name in nextProps) {
|
1357
|
-
node[name] = nextProps[name];
|
1345
|
+
function normalizeAttrValue(value) {
|
1346
|
+
if (value || value === 0) {
|
1347
|
+
return value === true ? "" : value + "";
|
1358
1348
|
}
|
1359
|
-
scope[index + "-"] = nextProps;
|
1360
1349
|
}
|
1361
|
-
function
|
1362
|
-
|
1363
|
-
return value2 === true ? "" : value2 + "";
|
1364
|
-
}
|
1365
|
-
}
|
1366
|
-
function normalizeString(value2) {
|
1367
|
-
return value2 || value2 === 0 ? value2 + "" : "\u200D";
|
1350
|
+
function normalizeString(value) {
|
1351
|
+
return value || value === 0 ? value + "" : "\u200D";
|
1368
1352
|
}
|
1369
|
-
function
|
1353
|
+
function _lifecycle(scope, index, thisObj) {
|
1370
1354
|
const instance = scope[index];
|
1371
1355
|
if (instance) {
|
1372
1356
|
Object.assign(instance, thisObj);
|
@@ -1374,10 +1358,7 @@ function lifecycle(scope, index, thisObj) {
|
|
1374
1358
|
} else {
|
1375
1359
|
scope[index] = thisObj;
|
1376
1360
|
thisObj.onMount?.();
|
1377
|
-
|
1378
|
-
scope,
|
1379
|
-
"LifecycleAbortController:" /* LifecycleAbortController */ + index
|
1380
|
-
).onabort = () => thisObj.onDestroy?.();
|
1361
|
+
$signal(scope, "LifecycleAbortController:" /* LifecycleAbortController */ + index).onabort = () => thisObj.onDestroy?.();
|
1381
1362
|
}
|
1382
1363
|
}
|
1383
1364
|
function removeChildNodes(startNode, endNode) {
|
@@ -1572,7 +1553,7 @@ function longestIncreasingSubsequence(a) {
|
|
1572
1553
|
}
|
1573
1554
|
|
1574
1555
|
// src/dom/control-flow.ts
|
1575
|
-
function
|
1556
|
+
function _await(nodeAccessor, renderer) {
|
1576
1557
|
const promiseAccessor = "Promise:" /* Promise */ + nodeAccessor;
|
1577
1558
|
const branchAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
|
1578
1559
|
return (scope, promise) => {
|
@@ -1617,7 +1598,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1617
1598
|
tempDetachBranch(awaitBranch);
|
1618
1599
|
}
|
1619
1600
|
const thisPromise = scope[promiseAccessor] = promise.then(
|
1620
|
-
(
|
1601
|
+
(data) => {
|
1621
1602
|
if (thisPromise === scope[promiseAccessor]) {
|
1622
1603
|
scope[promiseAccessor] = 0;
|
1623
1604
|
schedule();
|
@@ -1643,7 +1624,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1643
1624
|
);
|
1644
1625
|
referenceNode.remove();
|
1645
1626
|
}
|
1646
|
-
renderer.___params?.(awaitBranch, [
|
1627
|
+
renderer.___params?.(awaitBranch, [data]);
|
1647
1628
|
if (tryWithPlaceholder) {
|
1648
1629
|
placeholderShown.add(pendingEffects);
|
1649
1630
|
if (!--tryWithPlaceholder.___pendingAsyncCount) {
|
@@ -1677,14 +1658,14 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1677
1658
|
);
|
1678
1659
|
};
|
1679
1660
|
}
|
1680
|
-
function
|
1661
|
+
function _try(nodeAccessor, content) {
|
1681
1662
|
const branchAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
|
1682
1663
|
return (scope, input) => {
|
1683
1664
|
if (!scope[branchAccessor]) {
|
1684
1665
|
setConditionalRenderer(
|
1685
1666
|
scope,
|
1686
1667
|
nodeAccessor,
|
1687
|
-
|
1668
|
+
content,
|
1688
1669
|
createAndSetupBranch
|
1689
1670
|
);
|
1690
1671
|
}
|
@@ -1723,7 +1704,7 @@ function renderCatch(scope, error) {
|
|
1723
1704
|
);
|
1724
1705
|
}
|
1725
1706
|
}
|
1726
|
-
function
|
1707
|
+
function _if(nodeAccessor, ...branches) {
|
1727
1708
|
const branchAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + nodeAccessor;
|
1728
1709
|
enableBranches();
|
1729
1710
|
return (scope, newBranch) => {
|
@@ -1738,9 +1719,9 @@ function conditional(nodeAccessor, ...branches) {
|
|
1738
1719
|
};
|
1739
1720
|
}
|
1740
1721
|
function patchDynamicTag(fn) {
|
1741
|
-
|
1722
|
+
_dynamic_tag = fn(_dynamic_tag);
|
1742
1723
|
}
|
1743
|
-
var
|
1724
|
+
var _dynamic_tag = function dynamicTag(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
1744
1725
|
const childScopeAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
|
1745
1726
|
const rendererAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + nodeAccessor;
|
1746
1727
|
enableBranches();
|
@@ -1754,7 +1735,7 @@ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, input
|
|
1754
1735
|
createBranchWithTagNameOrRenderer
|
1755
1736
|
);
|
1756
1737
|
if (getTagVar) {
|
1757
|
-
|
1738
|
+
_var(scope, childScopeAccessor, getTagVar());
|
1758
1739
|
}
|
1759
1740
|
if (typeof normalizedRenderer === "string") {
|
1760
1741
|
if (getContent) {
|
@@ -1785,7 +1766,7 @@ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, input
|
|
1785
1766
|
const childScope = scope[childScopeAccessor];
|
1786
1767
|
const args = getInput?.();
|
1787
1768
|
if (typeof normalizedRenderer === "string") {
|
1788
|
-
(getContent ?
|
1769
|
+
(getContent ? _attrs : _attrs_content)(
|
1789
1770
|
childScope,
|
1790
1771
|
true ? `#${normalizedRenderer}/0` : 0,
|
1791
1772
|
(inputIsArgs ? args[0] : args) || {}
|
@@ -1840,7 +1821,7 @@ function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2)
|
|
1840
1821
|
referenceNode.remove();
|
1841
1822
|
}
|
1842
1823
|
}
|
1843
|
-
function
|
1824
|
+
function _for_of(nodeAccessor, renderer) {
|
1844
1825
|
return loop(
|
1845
1826
|
nodeAccessor,
|
1846
1827
|
renderer,
|
@@ -1856,14 +1837,14 @@ function loopOf(nodeAccessor, renderer) {
|
|
1856
1837
|
}
|
1857
1838
|
);
|
1858
1839
|
}
|
1859
|
-
function
|
1840
|
+
function _for_in(nodeAccessor, renderer) {
|
1860
1841
|
return loop(
|
1861
1842
|
nodeAccessor,
|
1862
1843
|
renderer,
|
1863
|
-
([obj, by = byFirstArg], cb) => forIn(obj, (key,
|
1844
|
+
([obj, by = byFirstArg], cb) => forIn(obj, (key, value) => cb(by(key, value), [key, value]))
|
1864
1845
|
);
|
1865
1846
|
}
|
1866
|
-
function
|
1847
|
+
function _for_to(nodeAccessor, renderer) {
|
1867
1848
|
return loop(
|
1868
1849
|
nodeAccessor,
|
1869
1850
|
renderer,
|
@@ -1873,7 +1854,7 @@ function loopTo(nodeAccessor, renderer) {
|
|
1873
1854
|
function loop(nodeAccessor, renderer, forEach) {
|
1874
1855
|
const params = renderer.___params;
|
1875
1856
|
enableBranches();
|
1876
|
-
return (scope,
|
1857
|
+
return (scope, value) => {
|
1877
1858
|
const referenceNode = scope[nodeAccessor];
|
1878
1859
|
const oldMap = scope["LoopScopeMap:" /* LoopScopeMap */ + nodeAccessor];
|
1879
1860
|
const oldArray = oldMap ? scope["LoopScopeArray:" /* LoopScopeArray */ + nodeAccessor] || [
|
@@ -1882,7 +1863,7 @@ function loop(nodeAccessor, renderer, forEach) {
|
|
1882
1863
|
const parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].___startNode.parentNode : referenceNode;
|
1883
1864
|
const newMap = scope["LoopScopeMap:" /* LoopScopeMap */ + nodeAccessor] = /* @__PURE__ */ new Map();
|
1884
1865
|
const newArray = scope["LoopScopeArray:" /* LoopScopeArray */ + nodeAccessor] = [];
|
1885
|
-
forEach(
|
1866
|
+
forEach(value, (key, args) => {
|
1886
1867
|
const branch = oldMap?.get(key) || createAndSetupBranch(scope.$global, renderer, scope, parentNode);
|
1887
1868
|
params?.(branch, args);
|
1888
1869
|
newMap.set(key, branch);
|
@@ -1936,17 +1917,17 @@ var pendingEffects = [];
|
|
1936
1917
|
var pendingScopes = [];
|
1937
1918
|
var rendering;
|
1938
1919
|
var scopeKeyOffset = 1e3;
|
1939
|
-
function queueRender(scope, signal, signalKey,
|
1920
|
+
function queueRender(scope, signal, signalKey, value, scopeKey = scope.___id) {
|
1940
1921
|
const key = scopeKey * scopeKeyOffset + signalKey;
|
1941
1922
|
const existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
|
1942
1923
|
if (existingRender) {
|
1943
|
-
existingRender.___value =
|
1924
|
+
existingRender.___value = value;
|
1944
1925
|
} else {
|
1945
1926
|
const render = {
|
1946
1927
|
___key: key,
|
1947
1928
|
___scope: scope,
|
1948
1929
|
___signal: signal,
|
1949
|
-
___value:
|
1930
|
+
___value: value
|
1950
1931
|
};
|
1951
1932
|
let i = pendingRenders.push(render) - 1;
|
1952
1933
|
while (i) {
|
@@ -2036,8 +2017,8 @@ function runRenders() {
|
|
2036
2017
|
pendingScopes = [];
|
2037
2018
|
}
|
2038
2019
|
var runRender = (render) => render.___signal(render.___scope, render.___value);
|
2039
|
-
var
|
2040
|
-
|
2020
|
+
var _enable_catch = () => {
|
2021
|
+
_enable_catch = () => {
|
2041
2022
|
};
|
2042
2023
|
enableBranches();
|
2043
2024
|
const handlePendingTry = (fn, scope, branch) => {
|
@@ -2076,14 +2057,14 @@ var enableCatch = () => {
|
|
2076
2057
|
};
|
2077
2058
|
|
2078
2059
|
// src/dom/abort-signal.ts
|
2079
|
-
function
|
2060
|
+
function $signalReset(scope, id) {
|
2080
2061
|
const ctrl = scope.___abortControllers?.[id];
|
2081
2062
|
if (ctrl) {
|
2082
2063
|
queueEffect(ctrl, abort);
|
2083
2064
|
scope.___abortControllers[id] = void 0;
|
2084
2065
|
}
|
2085
2066
|
}
|
2086
|
-
function
|
2067
|
+
function $signal(scope, id) {
|
2087
2068
|
if (scope.___closestBranch) {
|
2088
2069
|
(scope.___closestBranch.___abortScopes ||= /* @__PURE__ */ new Set()).add(scope);
|
2089
2070
|
}
|
@@ -2105,13 +2086,13 @@ var compat = {
|
|
2105
2086
|
patchDynamicTag,
|
2106
2087
|
queueEffect,
|
2107
2088
|
init(warp10Noop) {
|
2108
|
-
|
2089
|
+
_resume(SET_SCOPE_REGISTER_ID, (branch) => {
|
2109
2090
|
classIdToBranch.set(branch.m5c, branch);
|
2110
2091
|
});
|
2111
|
-
|
2092
|
+
_resume(RENDER_BODY_ID, warp10Noop);
|
2112
2093
|
},
|
2113
2094
|
registerRenderer(fn) {
|
2114
|
-
|
2095
|
+
_resume(RENDERER_REGISTER_ID, fn);
|
2115
2096
|
},
|
2116
2097
|
isRenderer(renderer) {
|
2117
2098
|
return renderer.___clone;
|
@@ -2133,17 +2114,17 @@ var compat = {
|
|
2133
2114
|
destroyBranch(this.scope);
|
2134
2115
|
}
|
2135
2116
|
},
|
2136
|
-
resolveRegistered(
|
2137
|
-
if (Array.isArray(
|
2117
|
+
resolveRegistered(value, $global) {
|
2118
|
+
if (Array.isArray(value) && typeof value[0] === "string") {
|
2138
2119
|
return getRegisteredWithScope(
|
2139
|
-
|
2140
|
-
|
2120
|
+
value[0],
|
2121
|
+
value.length === 2 && self[$global.runtimeId]?.[$global.renderId]?.s[value[1]]
|
2141
2122
|
);
|
2142
2123
|
}
|
2143
|
-
return
|
2124
|
+
return value;
|
2144
2125
|
},
|
2145
2126
|
createRenderer(params, clone) {
|
2146
|
-
const renderer =
|
2127
|
+
const renderer = _content_branch(0, 0, 0, params);
|
2147
2128
|
renderer.___clone = (branch) => {
|
2148
2129
|
const cloned = clone();
|
2149
2130
|
branch.___startNode = cloned.startNode;
|
@@ -2185,8 +2166,8 @@ var compat = {
|
|
2185
2166
|
};
|
2186
2167
|
|
2187
2168
|
// src/dom/template.ts
|
2188
|
-
var
|
2189
|
-
const renderer =
|
2169
|
+
var _template = (id, template, walks, setup, inputSignal) => {
|
2170
|
+
const renderer = _content(
|
2190
2171
|
id,
|
2191
2172
|
template,
|
2192
2173
|
walks,
|
@@ -2202,7 +2183,7 @@ var createTemplate = (id, template, walks, setup, inputSignal) => {
|
|
2202
2183
|
);
|
2203
2184
|
};
|
2204
2185
|
}
|
2205
|
-
return
|
2186
|
+
return _resume(id, renderer);
|
2206
2187
|
};
|
2207
2188
|
function mount(input = {}, reference, position) {
|
2208
2189
|
let branch;
|
@@ -2276,7 +2257,7 @@ function mount(input = {}, reference, position) {
|
|
2276
2257
|
return curValue;
|
2277
2258
|
},
|
2278
2259
|
set value(newValue) {
|
2279
|
-
|
2260
|
+
_var_change(branch, newValue);
|
2280
2261
|
},
|
2281
2262
|
update(newInput) {
|
2282
2263
|
if (args) {
|
@@ -2293,75 +2274,76 @@ function mount(input = {}, reference, position) {
|
|
2293
2274
|
};
|
2294
2275
|
}
|
2295
2276
|
export {
|
2296
|
-
|
2277
|
+
$signal,
|
2278
|
+
$signalReset,
|
2279
|
+
_attr,
|
2280
|
+
_attr_class,
|
2281
|
+
_attr_class_item,
|
2282
|
+
_attr_class_items,
|
2283
|
+
_attr_content,
|
2284
|
+
_attr_details_or_dialog_open as _attr_details_open,
|
2285
|
+
_attr_details_or_dialog_open_script as _attr_details_open_script,
|
2286
|
+
_attr_details_or_dialog_open as _attr_dialog_open,
|
2287
|
+
_attr_details_or_dialog_open_script as _attr_dialog_open_script,
|
2288
|
+
_attr_input_checked,
|
2289
|
+
_attr_input_checkedValue,
|
2290
|
+
_attr_input_checkedValue_script,
|
2291
|
+
_attr_input_checked_script,
|
2292
|
+
_attr_input_value,
|
2293
|
+
_attr_input_value_script,
|
2294
|
+
_attr_select_value,
|
2295
|
+
_attr_select_value_script,
|
2296
|
+
_attr_style,
|
2297
|
+
_attr_style_item,
|
2298
|
+
_attr_style_items,
|
2299
|
+
_attr_input_value as _attr_textarea_value,
|
2300
|
+
_attr_input_value_script as _attr_textarea_value_script,
|
2301
|
+
_attrs,
|
2302
|
+
_attrs_content,
|
2303
|
+
_attrs_partial,
|
2304
|
+
_attrs_partial_content,
|
2305
|
+
_attrs_script,
|
2306
|
+
_await,
|
2307
|
+
_closure,
|
2308
|
+
_closure_get,
|
2309
|
+
_const,
|
2310
|
+
_content,
|
2311
|
+
_content_branch,
|
2312
|
+
_content_closures,
|
2313
|
+
_content_resume,
|
2314
|
+
_dynamic_tag,
|
2315
|
+
_el,
|
2316
|
+
_enable_catch,
|
2317
|
+
_for_closure,
|
2318
|
+
_for_in,
|
2319
|
+
_for_of,
|
2320
|
+
_for_to,
|
2321
|
+
_hoist,
|
2322
|
+
_html,
|
2323
|
+
_id,
|
2324
|
+
_if,
|
2325
|
+
_if_closure,
|
2326
|
+
_let,
|
2327
|
+
_lifecycle,
|
2328
|
+
_on,
|
2329
|
+
_or,
|
2330
|
+
_resume,
|
2331
|
+
_return,
|
2332
|
+
_return_change,
|
2333
|
+
_script,
|
2334
|
+
_template,
|
2335
|
+
_text,
|
2336
|
+
_text_content,
|
2337
|
+
_try,
|
2338
|
+
_var,
|
2339
|
+
_var_change,
|
2340
|
+
_var_resume,
|
2297
2341
|
attrTag,
|
2298
2342
|
attrTags,
|
2299
|
-
attrs,
|
2300
|
-
attrsAndContent,
|
2301
|
-
attrsEvents,
|
2302
|
-
awaitTag,
|
2303
|
-
classAttr,
|
2304
|
-
classItem,
|
2305
|
-
classItems,
|
2306
2343
|
compat,
|
2307
|
-
conditional,
|
2308
|
-
conditionalClosure,
|
2309
|
-
controllable_detailsOrDialog_open,
|
2310
|
-
controllable_detailsOrDialog_open_effect,
|
2311
|
-
controllable_input_checked,
|
2312
|
-
controllable_input_checkedValue,
|
2313
|
-
controllable_input_checkedValue_effect,
|
2314
|
-
controllable_input_checked_effect,
|
2315
|
-
controllable_input_value,
|
2316
|
-
controllable_input_value_effect,
|
2317
|
-
controllable_select_value,
|
2318
|
-
controllable_select_value_effect,
|
2319
|
-
controllable_input_value as controllable_textarea_value,
|
2320
|
-
controllable_input_value_effect as controllable_textarea_value_effect,
|
2321
|
-
createContent,
|
2322
|
-
createRenderer,
|
2323
|
-
createTemplate,
|
2324
|
-
createTry,
|
2325
|
-
data,
|
2326
|
-
dynamicClosure,
|
2327
|
-
dynamicClosureRead,
|
2328
|
-
dynamicTag,
|
2329
|
-
effect,
|
2330
|
-
enableCatch,
|
2331
2344
|
forIn,
|
2332
2345
|
forOf,
|
2333
2346
|
forTo,
|
2334
|
-
getAbortSignal,
|
2335
|
-
hoist,
|
2336
|
-
html,
|
2337
2347
|
init,
|
2338
|
-
|
2339
|
-
intersection,
|
2340
|
-
lifecycle,
|
2341
|
-
localClosures,
|
2342
|
-
loopClosure,
|
2343
|
-
loopIn,
|
2344
|
-
loopOf,
|
2345
|
-
loopTo,
|
2346
|
-
nextTagId,
|
2347
|
-
nodeRef,
|
2348
|
-
on,
|
2349
|
-
partialAttrs,
|
2350
|
-
partialAttrsAndContent,
|
2351
|
-
props,
|
2352
|
-
register,
|
2353
|
-
registerBoundSignal,
|
2354
|
-
registerContent,
|
2355
|
-
resetAbortSignal,
|
2356
|
-
run,
|
2357
|
-
setTagVar,
|
2358
|
-
setTagVarChange,
|
2359
|
-
state,
|
2360
|
-
styleAttr,
|
2361
|
-
styleItem,
|
2362
|
-
styleItems,
|
2363
|
-
tagVarSignal,
|
2364
|
-
tagVarSignalChange,
|
2365
|
-
textContent,
|
2366
|
-
value
|
2348
|
+
run
|
2367
2349
|
};
|