marko 6.0.60 → 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 +500 -482
- 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.js
CHANGED
@@ -20,98 +20,99 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
20
20
|
// src/dom.ts
|
21
21
|
var dom_exports = {};
|
22
22
|
__export(dom_exports, {
|
23
|
-
|
23
|
+
$signal: () => $signal,
|
24
|
+
$signalReset: () => $signalReset,
|
25
|
+
_attr: () => _attr,
|
26
|
+
_attr_class: () => _attr_class,
|
27
|
+
_attr_class_item: () => _attr_class_item,
|
28
|
+
_attr_class_items: () => _attr_class_items,
|
29
|
+
_attr_content: () => _attr_content,
|
30
|
+
_attr_details_open: () => _attr_details_or_dialog_open,
|
31
|
+
_attr_details_open_script: () => _attr_details_or_dialog_open_script,
|
32
|
+
_attr_dialog_open: () => _attr_details_or_dialog_open,
|
33
|
+
_attr_dialog_open_script: () => _attr_details_or_dialog_open_script,
|
34
|
+
_attr_input_checked: () => _attr_input_checked,
|
35
|
+
_attr_input_checkedValue: () => _attr_input_checkedValue,
|
36
|
+
_attr_input_checkedValue_script: () => _attr_input_checkedValue_script,
|
37
|
+
_attr_input_checked_script: () => _attr_input_checked_script,
|
38
|
+
_attr_input_value: () => _attr_input_value,
|
39
|
+
_attr_input_value_script: () => _attr_input_value_script,
|
40
|
+
_attr_select_value: () => _attr_select_value,
|
41
|
+
_attr_select_value_script: () => _attr_select_value_script,
|
42
|
+
_attr_style: () => _attr_style,
|
43
|
+
_attr_style_item: () => _attr_style_item,
|
44
|
+
_attr_style_items: () => _attr_style_items,
|
45
|
+
_attr_textarea_value: () => _attr_input_value,
|
46
|
+
_attr_textarea_value_script: () => _attr_input_value_script,
|
47
|
+
_attrs: () => _attrs,
|
48
|
+
_attrs_content: () => _attrs_content,
|
49
|
+
_attrs_partial: () => _attrs_partial,
|
50
|
+
_attrs_partial_content: () => _attrs_partial_content,
|
51
|
+
_attrs_script: () => _attrs_script,
|
52
|
+
_await: () => _await,
|
53
|
+
_closure: () => _closure,
|
54
|
+
_closure_get: () => _closure_get,
|
55
|
+
_const: () => _const,
|
56
|
+
_content: () => _content,
|
57
|
+
_content_branch: () => _content_branch,
|
58
|
+
_content_closures: () => _content_closures,
|
59
|
+
_content_resume: () => _content_resume,
|
60
|
+
_dynamic_tag: () => _dynamic_tag,
|
61
|
+
_el: () => _el,
|
62
|
+
_enable_catch: () => _enable_catch,
|
63
|
+
_for_closure: () => _for_closure,
|
64
|
+
_for_in: () => _for_in,
|
65
|
+
_for_of: () => _for_of,
|
66
|
+
_for_to: () => _for_to,
|
67
|
+
_hoist: () => _hoist,
|
68
|
+
_html: () => _html,
|
69
|
+
_id: () => _id,
|
70
|
+
_if: () => _if,
|
71
|
+
_if_closure: () => _if_closure,
|
72
|
+
_let: () => _let,
|
73
|
+
_lifecycle: () => _lifecycle,
|
74
|
+
_on: () => _on,
|
75
|
+
_or: () => _or,
|
76
|
+
_resume: () => _resume,
|
77
|
+
_return: () => _return,
|
78
|
+
_return_change: () => _return_change,
|
79
|
+
_script: () => _script,
|
80
|
+
_template: () => _template,
|
81
|
+
_text: () => _text,
|
82
|
+
_text_content: () => _text_content,
|
83
|
+
_try: () => _try,
|
84
|
+
_var: () => _var,
|
85
|
+
_var_change: () => _var_change,
|
86
|
+
_var_resume: () => _var_resume,
|
24
87
|
attrTag: () => attrTag,
|
25
88
|
attrTags: () => attrTags,
|
26
|
-
attrs: () => attrs,
|
27
|
-
attrsAndContent: () => attrsAndContent,
|
28
|
-
attrsEvents: () => attrsEvents,
|
29
|
-
awaitTag: () => awaitTag,
|
30
|
-
classAttr: () => classAttr,
|
31
|
-
classItem: () => classItem,
|
32
|
-
classItems: () => classItems,
|
33
89
|
compat: () => compat,
|
34
|
-
conditional: () => conditional,
|
35
|
-
conditionalClosure: () => conditionalClosure,
|
36
|
-
controllable_detailsOrDialog_open: () => controllable_detailsOrDialog_open,
|
37
|
-
controllable_detailsOrDialog_open_effect: () => controllable_detailsOrDialog_open_effect,
|
38
|
-
controllable_input_checked: () => controllable_input_checked,
|
39
|
-
controllable_input_checkedValue: () => controllable_input_checkedValue,
|
40
|
-
controllable_input_checkedValue_effect: () => controllable_input_checkedValue_effect,
|
41
|
-
controllable_input_checked_effect: () => controllable_input_checked_effect,
|
42
|
-
controllable_input_value: () => controllable_input_value,
|
43
|
-
controllable_input_value_effect: () => controllable_input_value_effect,
|
44
|
-
controllable_select_value: () => controllable_select_value,
|
45
|
-
controllable_select_value_effect: () => controllable_select_value_effect,
|
46
|
-
controllable_textarea_value: () => controllable_input_value,
|
47
|
-
controllable_textarea_value_effect: () => controllable_input_value_effect,
|
48
|
-
createContent: () => createContent,
|
49
|
-
createRenderer: () => createRenderer,
|
50
|
-
createTemplate: () => createTemplate,
|
51
|
-
createTry: () => createTry,
|
52
|
-
data: () => data,
|
53
|
-
dynamicClosure: () => dynamicClosure,
|
54
|
-
dynamicClosureRead: () => dynamicClosureRead,
|
55
|
-
dynamicTag: () => dynamicTag,
|
56
|
-
effect: () => effect,
|
57
|
-
enableCatch: () => enableCatch,
|
58
90
|
forIn: () => forIn,
|
59
91
|
forOf: () => forOf,
|
60
92
|
forTo: () => forTo,
|
61
|
-
getAbortSignal: () => getAbortSignal,
|
62
|
-
hoist: () => hoist,
|
63
|
-
html: () => html,
|
64
93
|
init: () => init,
|
65
|
-
|
66
|
-
intersection: () => intersection,
|
67
|
-
lifecycle: () => lifecycle,
|
68
|
-
localClosures: () => localClosures,
|
69
|
-
loopClosure: () => loopClosure,
|
70
|
-
loopIn: () => loopIn,
|
71
|
-
loopOf: () => loopOf,
|
72
|
-
loopTo: () => loopTo,
|
73
|
-
nextTagId: () => nextTagId,
|
74
|
-
nodeRef: () => nodeRef,
|
75
|
-
on: () => on,
|
76
|
-
partialAttrs: () => partialAttrs,
|
77
|
-
partialAttrsAndContent: () => partialAttrsAndContent,
|
78
|
-
props: () => props,
|
79
|
-
register: () => register,
|
80
|
-
registerBoundSignal: () => registerBoundSignal,
|
81
|
-
registerContent: () => registerContent,
|
82
|
-
resetAbortSignal: () => resetAbortSignal,
|
83
|
-
run: () => run,
|
84
|
-
setTagVar: () => setTagVar,
|
85
|
-
setTagVarChange: () => setTagVarChange,
|
86
|
-
state: () => state,
|
87
|
-
styleAttr: () => styleAttr,
|
88
|
-
styleItem: () => styleItem,
|
89
|
-
styleItems: () => styleItems,
|
90
|
-
tagVarSignal: () => tagVarSignal,
|
91
|
-
tagVarSignalChange: () => tagVarSignalChange,
|
92
|
-
textContent: () => textContent,
|
93
|
-
value: () => value
|
94
|
+
run: () => run
|
94
95
|
});
|
95
96
|
module.exports = __toCommonJS(dom_exports);
|
96
97
|
|
97
98
|
// src/common/attr-tag.ts
|
98
99
|
var empty = [];
|
99
100
|
var rest = true ? Symbol("Attribute Tag") : Symbol();
|
100
|
-
function attrTag(
|
101
|
-
|
102
|
-
|
103
|
-
return
|
101
|
+
function attrTag(attrs) {
|
102
|
+
attrs[Symbol.iterator] = attrTagIterator;
|
103
|
+
attrs[rest] = empty;
|
104
|
+
return attrs;
|
104
105
|
}
|
105
|
-
function attrTags(first,
|
106
|
+
function attrTags(first, attrs) {
|
106
107
|
if (first) {
|
107
108
|
if (first[rest] === empty) {
|
108
|
-
first[rest] = [
|
109
|
+
first[rest] = [attrs];
|
109
110
|
} else {
|
110
|
-
first[rest].push(
|
111
|
+
first[rest].push(attrs);
|
111
112
|
}
|
112
113
|
return first;
|
113
114
|
}
|
114
|
-
return attrTag(
|
115
|
+
return attrTag(attrs);
|
115
116
|
}
|
116
117
|
function* attrTagIterator() {
|
117
118
|
yield this;
|
@@ -144,14 +145,14 @@ function forTo(to, from, step, cb) {
|
|
144
145
|
function classValue(classValue2) {
|
145
146
|
return toDelimitedString(classValue2, " ", stringifyClassObject);
|
146
147
|
}
|
147
|
-
function stringifyClassObject(name,
|
148
|
-
return
|
148
|
+
function stringifyClassObject(name, value) {
|
149
|
+
return value ? name : "";
|
149
150
|
}
|
150
151
|
function styleValue(styleValue2) {
|
151
152
|
return toDelimitedString(styleValue2, ";", stringifyStyleObject);
|
152
153
|
}
|
153
|
-
function stringifyStyleObject(name,
|
154
|
-
return
|
154
|
+
function stringifyStyleObject(name, value) {
|
155
|
+
return value || value === 0 ? name + ":" + value : "";
|
155
156
|
}
|
156
157
|
function toDelimitedString(val, delimiter, stringify) {
|
157
158
|
let str = "";
|
@@ -186,13 +187,13 @@ function isEventHandler(name) {
|
|
186
187
|
function getEventHandlerName(name) {
|
187
188
|
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
188
189
|
}
|
189
|
-
function normalizeDynamicRenderer(
|
190
|
-
return
|
190
|
+
function normalizeDynamicRenderer(value) {
|
191
|
+
return value ? value.content || value.default || value : void 0;
|
191
192
|
}
|
192
193
|
|
193
194
|
// src/dom/event.ts
|
194
195
|
var defaultDelegator = createDelegator();
|
195
|
-
function
|
196
|
+
function _on(element, type, handler) {
|
196
197
|
if (element["$" + type] === void 0) {
|
197
198
|
defaultDelegator(element, type, handleDelegated);
|
198
199
|
}
|
@@ -307,57 +308,57 @@ function walk(startNode, walkCodes, branch) {
|
|
307
308
|
walkInternal(0, walkCodes, branch);
|
308
309
|
}
|
309
310
|
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
310
|
-
let
|
311
|
+
let value;
|
311
312
|
let storedMultiplier = 0;
|
312
313
|
let currentMultiplier = 0;
|
313
314
|
let currentScopeIndex = 0;
|
314
315
|
for (; currentWalkIndex < walkCodes.length; ) {
|
315
|
-
|
316
|
+
value = walkCodes.charCodeAt(currentWalkIndex++);
|
316
317
|
currentMultiplier = storedMultiplier;
|
317
318
|
storedMultiplier = 0;
|
318
|
-
if (
|
319
|
+
if (value === 32 /* Get */) {
|
319
320
|
const node = walker.currentNode;
|
320
321
|
scope[true ? getDebugKey(currentScopeIndex, walker.currentNode) : currentScopeIndex] = node;
|
321
322
|
scope["Getter:" /* Getter */ + (true ? getDebugKey(currentScopeIndex++, walker.currentNode) : currentScopeIndex++)] = () => node;
|
322
|
-
} else if (
|
323
|
+
} else if (value === 37 /* Replace */ || value === 49 /* DynamicTagWithVar */) {
|
323
324
|
walker.currentNode.replaceWith(
|
324
325
|
walker.currentNode = scope[true ? getDebugKey(currentScopeIndex++, "#text") : currentScopeIndex++] = new Text()
|
325
326
|
);
|
326
|
-
if (
|
327
|
+
if (value === 49 /* DynamicTagWithVar */) {
|
327
328
|
scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope(scope);
|
328
329
|
}
|
329
|
-
} else if (
|
330
|
+
} else if (value === 38 /* EndChild */) {
|
330
331
|
return currentWalkIndex;
|
331
|
-
} else if (
|
332
|
+
} else if (value === 47 /* BeginChild */ || value === 48 /* BeginChildWithVar */) {
|
332
333
|
currentWalkIndex = walkInternal(
|
333
334
|
currentWalkIndex,
|
334
335
|
walkCodes,
|
335
336
|
scope[true ? getDebugKey(currentScopeIndex++, "#childScope") : currentScopeIndex++] = createScope(scope.$global, scope.___closestBranch)
|
336
337
|
);
|
337
|
-
if (
|
338
|
+
if (value === 48 /* BeginChildWithVar */) {
|
338
339
|
scope[true ? getDebugKey(currentScopeIndex++, "#scopeOffset") : currentScopeIndex++] = skipScope(scope);
|
339
340
|
}
|
340
|
-
} else if (
|
341
|
-
|
342
|
-
while (
|
341
|
+
} else if (value < 91 /* NextEnd */ + 1) {
|
342
|
+
value = 20 /* Next */ * currentMultiplier + value - 67 /* Next */;
|
343
|
+
while (value--) {
|
343
344
|
walker.nextNode();
|
344
345
|
}
|
345
|
-
} else if (
|
346
|
-
|
347
|
-
while (
|
346
|
+
} else if (value < 106 /* OverEnd */ + 1) {
|
347
|
+
value = 10 /* Over */ * currentMultiplier + value - 97 /* Over */;
|
348
|
+
while (value--) {
|
348
349
|
walker.nextSibling();
|
349
350
|
}
|
350
|
-
} else if (
|
351
|
-
|
352
|
-
while (
|
351
|
+
} else if (value < 116 /* OutEnd */ + 1) {
|
352
|
+
value = 10 /* Out */ * currentMultiplier + value - 107 /* Out */;
|
353
|
+
while (value--) {
|
353
354
|
walker.parentNode();
|
354
355
|
}
|
355
356
|
walker.nextSibling();
|
356
357
|
} else {
|
357
|
-
if (
|
358
|
-
throw new Error(`Unknown walk code: ${
|
358
|
+
if (value < 117 /* Multiplier */ || value > 126 /* MultiplierEnd */) {
|
359
|
+
throw new Error(`Unknown walk code: ${value}`);
|
359
360
|
}
|
360
|
-
storedMultiplier = currentMultiplier * 10 /* Multiplier */ +
|
361
|
+
storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value - 117 /* Multiplier */;
|
361
362
|
}
|
362
363
|
}
|
363
364
|
}
|
@@ -573,24 +574,24 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
|
|
573
574
|
}
|
574
575
|
}
|
575
576
|
var isResuming;
|
576
|
-
function
|
577
|
+
function _resume(id, obj) {
|
577
578
|
registeredValues[id] = obj;
|
578
579
|
return obj;
|
579
580
|
}
|
580
|
-
function
|
581
|
-
registeredValues[id] = (scope) => (
|
581
|
+
function _var_resume(id, signal) {
|
582
|
+
registeredValues[id] = (scope) => (value) => signal(scope, value);
|
582
583
|
return signal;
|
583
584
|
}
|
584
585
|
function getRegisteredWithScope(id, scope) {
|
585
586
|
const val = registeredValues[id];
|
586
587
|
return scope ? val(scope) : val;
|
587
588
|
}
|
588
|
-
function
|
589
|
-
return
|
589
|
+
function _el(id, key) {
|
590
|
+
return _resume(id, (scope) => () => scope[key]());
|
590
591
|
}
|
591
592
|
|
592
593
|
// src/dom/controllable.ts
|
593
|
-
function
|
594
|
+
function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
|
594
595
|
setCheckboxValue(
|
595
596
|
scope,
|
596
597
|
nodeAccessor,
|
@@ -599,7 +600,7 @@ function controllable_input_checked(scope, nodeAccessor, checked, checkedChange)
|
|
599
600
|
checkedChange
|
600
601
|
);
|
601
602
|
}
|
602
|
-
function
|
603
|
+
function _attr_input_checked_script(scope, nodeAccessor) {
|
603
604
|
const el = scope[nodeAccessor];
|
604
605
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
605
606
|
const checkedChange = scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor];
|
@@ -611,18 +612,18 @@ function controllable_input_checked_effect(scope, nodeAccessor) {
|
|
611
612
|
}
|
612
613
|
});
|
613
614
|
}
|
614
|
-
function
|
615
|
+
function _attr_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValueChange, value) {
|
615
616
|
scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] = checkedValue;
|
616
|
-
|
617
|
+
_attr(scope[nodeAccessor], "value", value);
|
617
618
|
setCheckboxValue(
|
618
619
|
scope,
|
619
620
|
nodeAccessor,
|
620
621
|
1 /* InputCheckedValue */,
|
621
|
-
Array.isArray(checkedValue) ? checkedValue.includes(
|
622
|
+
Array.isArray(checkedValue) ? checkedValue.includes(value) : checkedValue === value,
|
622
623
|
checkedValueChange
|
623
624
|
);
|
624
625
|
}
|
625
|
-
function
|
626
|
+
function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
626
627
|
const el = scope[nodeAccessor];
|
627
628
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
628
629
|
const checkedValueChange = scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor];
|
@@ -645,13 +646,13 @@ function controllable_input_checkedValue_effect(scope, nodeAccessor) {
|
|
645
646
|
}
|
646
647
|
});
|
647
648
|
}
|
648
|
-
function
|
649
|
+
function _attr_input_value(scope, nodeAccessor, value, valueChange) {
|
649
650
|
const el = scope[nodeAccessor];
|
650
|
-
const normalizedValue = normalizeStrProp(
|
651
|
+
const normalizedValue = normalizeStrProp(value);
|
651
652
|
scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor] = valueChange;
|
652
653
|
if (valueChange) {
|
653
654
|
scope["ControlledType:" /* ControlledType */ + nodeAccessor] = 0 /* InputChecked */;
|
654
|
-
scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] =
|
655
|
+
scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] = value;
|
655
656
|
if (el.isConnected) {
|
656
657
|
setValueAndUpdateSelection(el, normalizedValue);
|
657
658
|
} else {
|
@@ -662,7 +663,7 @@ function controllable_input_value(scope, nodeAccessor, value2, valueChange) {
|
|
662
663
|
el.defaultValue = normalizedValue;
|
663
664
|
}
|
664
665
|
}
|
665
|
-
function
|
666
|
+
function _attr_input_value_script(scope, nodeAccessor) {
|
666
667
|
const el = scope[nodeAccessor];
|
667
668
|
if (isResuming) {
|
668
669
|
scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] = el.defaultValue;
|
@@ -681,24 +682,24 @@ function controllable_input_value_effect(scope, nodeAccessor) {
|
|
681
682
|
}
|
682
683
|
});
|
683
684
|
}
|
684
|
-
function
|
685
|
+
function _attr_select_value(scope, nodeAccessor, value, valueChange) {
|
685
686
|
scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor] = valueChange;
|
686
687
|
if (valueChange) {
|
687
688
|
scope["ControlledType:" /* ControlledType */ + nodeAccessor] = 3 /* SelectValue */;
|
688
|
-
scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] =
|
689
|
+
scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] = value;
|
689
690
|
} else {
|
690
691
|
scope["ControlledType:" /* ControlledType */ + nodeAccessor] = 5 /* None */;
|
691
692
|
}
|
692
693
|
pendingEffects.unshift(
|
693
694
|
() => setSelectOptions(
|
694
695
|
scope[nodeAccessor],
|
695
|
-
|
696
|
+
value,
|
696
697
|
valueChange
|
697
698
|
),
|
698
699
|
scope
|
699
700
|
);
|
700
701
|
}
|
701
|
-
function
|
702
|
+
function _attr_select_value_script(scope, nodeAccessor) {
|
702
703
|
const el = scope[nodeAccessor];
|
703
704
|
const onChange = () => {
|
704
705
|
const valueChange = scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor];
|
@@ -717,8 +718,8 @@ function controllable_select_value_effect(scope, nodeAccessor) {
|
|
717
718
|
};
|
718
719
|
if (!el._) {
|
719
720
|
new MutationObserver(() => {
|
720
|
-
const
|
721
|
-
if (Array.isArray(
|
721
|
+
const value = scope["ControlledValue:" /* ControlledValue */ + nodeAccessor];
|
722
|
+
if (Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((value2, i) => value2 != el.selectedOptions[i].value) : el.value != value) {
|
722
723
|
onChange();
|
723
724
|
}
|
724
725
|
}).observe(el, {
|
@@ -728,10 +729,10 @@ function controllable_select_value_effect(scope, nodeAccessor) {
|
|
728
729
|
}
|
729
730
|
syncControllable(el, "input", hasSelectChanged, onChange);
|
730
731
|
}
|
731
|
-
function setSelectOptions(el,
|
732
|
-
if (Array.isArray(
|
732
|
+
function setSelectOptions(el, value, valueChange) {
|
733
|
+
if (Array.isArray(value)) {
|
733
734
|
for (const opt of el.options) {
|
734
|
-
const selected =
|
735
|
+
const selected = value.includes(opt.value);
|
735
736
|
if (valueChange) {
|
736
737
|
opt.selected = selected;
|
737
738
|
} else {
|
@@ -739,7 +740,7 @@ function setSelectOptions(el, value2, valueChange) {
|
|
739
740
|
}
|
740
741
|
}
|
741
742
|
} else {
|
742
|
-
const normalizedValue = normalizeStrProp(
|
743
|
+
const normalizedValue = normalizeStrProp(value);
|
743
744
|
if (valueChange) {
|
744
745
|
el.value = normalizedValue;
|
745
746
|
} else {
|
@@ -749,7 +750,7 @@ function setSelectOptions(el, value2, valueChange) {
|
|
749
750
|
}
|
750
751
|
}
|
751
752
|
}
|
752
|
-
function
|
753
|
+
function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
|
753
754
|
scope["ControlledHandler:" /* ControlledHandler */ + nodeAccessor] = openChange;
|
754
755
|
if (openChange) {
|
755
756
|
scope["ControlledType:" /* ControlledType */ + nodeAccessor] = 4 /* DetailsOrDialogOpen */;
|
@@ -758,7 +759,7 @@ function controllable_detailsOrDialog_open(scope, nodeAccessor, open, openChange
|
|
758
759
|
}
|
759
760
|
scope[nodeAccessor].open = scope["ControlledValue:" /* ControlledValue */ + nodeAccessor] = normalizeBoolProp(open);
|
760
761
|
}
|
761
|
-
function
|
762
|
+
function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
762
763
|
const el = scope[nodeAccessor];
|
763
764
|
const hasChanged = () => el.open !== scope["ControlledValue:" /* ControlledValue */ + nodeAccessor];
|
764
765
|
syncControllable(
|
@@ -777,13 +778,13 @@ function controllable_detailsOrDialog_open_effect(scope, nodeAccessor) {
|
|
777
778
|
);
|
778
779
|
}
|
779
780
|
var inputType = "";
|
780
|
-
function setValueAndUpdateSelection(el,
|
781
|
-
if (el.value !==
|
781
|
+
function setValueAndUpdateSelection(el, value) {
|
782
|
+
if (el.value !== value) {
|
782
783
|
const updatedPosition = resolveCursorPosition(
|
783
784
|
inputType,
|
784
785
|
el.getRootNode().activeElement === el && el.selectionStart,
|
785
786
|
el.value,
|
786
|
-
el.value =
|
787
|
+
el.value = value
|
787
788
|
);
|
788
789
|
if (~updatedPosition) {
|
789
790
|
el.setSelectionRange(updatedPosition, updatedPosition);
|
@@ -847,11 +848,11 @@ function hasSelectChanged(el) {
|
|
847
848
|
function hasFormElementChanged(el) {
|
848
849
|
return el.options ? hasSelectChanged(el) : hasValueChanged(el) || hasCheckboxChanged(el);
|
849
850
|
}
|
850
|
-
function normalizeStrProp(
|
851
|
-
return normalizeAttrValue(
|
851
|
+
function normalizeStrProp(value) {
|
852
|
+
return normalizeAttrValue(value) || "";
|
852
853
|
}
|
853
|
-
function normalizeBoolProp(
|
854
|
-
return
|
854
|
+
function normalizeBoolProp(value) {
|
855
|
+
return value != null && value !== false;
|
855
856
|
}
|
856
857
|
function updateList(arr, val, push) {
|
857
858
|
const index = arr.indexOf(val);
|
@@ -863,9 +864,9 @@ function toValueProp(it) {
|
|
863
864
|
|
864
865
|
// src/dom/parse-html.ts
|
865
866
|
var parsers = {};
|
866
|
-
function parseHTML(
|
867
|
+
function parseHTML(html, ns) {
|
867
868
|
const parser = parsers[ns] ||= document.createElementNS(ns, "template");
|
868
|
-
parser.innerHTML =
|
869
|
+
parser.innerHTML = html;
|
869
870
|
return parser.content || parser;
|
870
871
|
}
|
871
872
|
|
@@ -913,7 +914,7 @@ function triggerMacroTask() {
|
|
913
914
|
}
|
914
915
|
|
915
916
|
// src/dom/signals.ts
|
916
|
-
function
|
917
|
+
function _let(valueAccessor, fn) {
|
917
918
|
if (true) {
|
918
919
|
var id = +valueAccessor.slice(
|
919
920
|
valueAccessor.lastIndexOf("/") + 1
|
@@ -924,42 +925,42 @@ function state(valueAccessor, fn) {
|
|
924
925
|
);
|
925
926
|
}
|
926
927
|
const valueChangeAccessor = "TagVariableChange:" /* TagVariableChange */ + valueAccessor;
|
927
|
-
const update = (scope,
|
928
|
-
if (scope[valueAccessor] !==
|
929
|
-
scope[valueAccessor] =
|
930
|
-
fn(scope,
|
928
|
+
const update = (scope, value) => {
|
929
|
+
if (scope[valueAccessor] !== value) {
|
930
|
+
scope[valueAccessor] = value;
|
931
|
+
fn(scope, value);
|
931
932
|
}
|
932
933
|
};
|
933
|
-
return (scope,
|
934
|
+
return (scope, value, valueChange) => {
|
934
935
|
if (rendering) {
|
935
|
-
if ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !==
|
936
|
-
scope[valueAccessor] =
|
937
|
-
fn(scope,
|
936
|
+
if ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !== value || !(valueAccessor in scope)) {
|
937
|
+
scope[valueAccessor] = value;
|
938
|
+
fn(scope, value);
|
938
939
|
}
|
939
940
|
} else if (scope[valueChangeAccessor]) {
|
940
|
-
scope[valueChangeAccessor](
|
941
|
+
scope[valueChangeAccessor](value);
|
941
942
|
} else {
|
942
943
|
schedule();
|
943
944
|
queueRender(
|
944
945
|
scope,
|
945
946
|
update,
|
946
947
|
true ? id : valueAccessor,
|
947
|
-
|
948
|
+
value
|
948
949
|
);
|
949
950
|
}
|
950
|
-
return
|
951
|
+
return value;
|
951
952
|
};
|
952
953
|
}
|
953
|
-
function
|
954
|
+
function _const(valueAccessor, fn = () => {
|
954
955
|
}) {
|
955
|
-
return (scope,
|
956
|
-
if (!(valueAccessor in scope) || scope[valueAccessor] !==
|
957
|
-
scope[valueAccessor] =
|
958
|
-
fn(scope,
|
956
|
+
return (scope, value) => {
|
957
|
+
if (!(valueAccessor in scope) || scope[valueAccessor] !== value) {
|
958
|
+
scope[valueAccessor] = value;
|
959
|
+
fn(scope, value);
|
959
960
|
}
|
960
961
|
};
|
961
962
|
}
|
962
|
-
function
|
963
|
+
function _or(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "___id") {
|
963
964
|
return (scope) => {
|
964
965
|
if (scope.___creating) {
|
965
966
|
if (scope[id] === void 0) {
|
@@ -972,7 +973,7 @@ function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__
|
|
972
973
|
}
|
973
974
|
};
|
974
975
|
}
|
975
|
-
function
|
976
|
+
function _for_closure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
976
977
|
const childSignal = closure(valueAccessor, fn);
|
977
978
|
const loopScopeAccessor = "LoopScopeArray:" /* LoopScopeArray */ + ownerLoopNodeAccessor;
|
978
979
|
const loopScopeMapAccessor = "LoopScopeMap:" /* LoopScopeMap */ + ownerLoopNodeAccessor;
|
@@ -998,7 +999,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
998
999
|
ownerSignal._ = childSignal;
|
999
1000
|
return ownerSignal;
|
1000
1001
|
}
|
1001
|
-
function
|
1002
|
+
function _if_closure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
|
1002
1003
|
const childSignal = closure(valueAccessor, fn);
|
1003
1004
|
const scopeAccessor = "ConditionalScope:" /* ConditionalScope */ + ownerConditionalNodeAccessor;
|
1004
1005
|
const branchAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + ownerConditionalNodeAccessor;
|
@@ -1015,13 +1016,13 @@ function subscribeToScopeSet(ownerScope, accessor, scope) {
|
|
1015
1016
|
const subscribers = ownerScope[accessor] ||= /* @__PURE__ */ new Set();
|
1016
1017
|
if (!subscribers.has(scope)) {
|
1017
1018
|
subscribers.add(scope);
|
1018
|
-
|
1019
|
+
$signal(scope, -1).addEventListener(
|
1019
1020
|
"abort",
|
1020
1021
|
() => ownerScope[accessor].delete(scope)
|
1021
1022
|
);
|
1022
1023
|
}
|
1023
1024
|
}
|
1024
|
-
function
|
1025
|
+
function _closure(...closureSignals) {
|
1025
1026
|
const [{ ___scopeInstancesAccessor, ___signalIndexAccessor }] = closureSignals;
|
1026
1027
|
for (let i = closureSignals.length; i--; ) {
|
1027
1028
|
closureSignals[i].___index = i;
|
@@ -1040,7 +1041,7 @@ function dynamicClosure(...closureSignals) {
|
|
1040
1041
|
}
|
1041
1042
|
};
|
1042
1043
|
}
|
1043
|
-
function
|
1044
|
+
function _closure_get(valueAccessor, fn, getOwnerScope) {
|
1044
1045
|
const childSignal = closure(valueAccessor, fn, getOwnerScope);
|
1045
1046
|
const closureSignal = ((scope) => {
|
1046
1047
|
scope[closureSignal.___signalIndexAccessor] = closureSignal.___index;
|
@@ -1063,22 +1064,22 @@ function closure(valueAccessor, fn, getOwnerScope) {
|
|
1063
1064
|
);
|
1064
1065
|
};
|
1065
1066
|
}
|
1066
|
-
function
|
1067
|
-
scope[childAccessor]["#TagVariable" /* TagVariable */] = (
|
1067
|
+
function _var(scope, childAccessor, signal) {
|
1068
|
+
scope[childAccessor]["#TagVariable" /* TagVariable */] = (value) => signal(scope, value);
|
1068
1069
|
}
|
1069
|
-
var
|
1070
|
-
function
|
1070
|
+
var _return = (scope, value) => scope["#TagVariable" /* TagVariable */]?.(value);
|
1071
|
+
function _return_change(scope, changeHandler) {
|
1071
1072
|
scope["#TagVariableChange" /* TagVariableChange */] = changeHandler;
|
1072
1073
|
}
|
1073
|
-
var
|
1074
|
+
var _var_change = (scope, value) => scope["#TagVariableChange" /* TagVariableChange */]?.(value);
|
1074
1075
|
var tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
1075
|
-
function
|
1076
|
+
function _id({ $global }) {
|
1076
1077
|
const id = tagIdsByGlobal.get($global) || 0;
|
1077
1078
|
tagIdsByGlobal.set($global, id + 1);
|
1078
1079
|
return "c" + $global.runtimeId + $global.renderId + id.toString(36);
|
1079
1080
|
}
|
1080
|
-
function
|
1081
|
-
|
1081
|
+
function _script(id, fn) {
|
1082
|
+
_resume(id, fn);
|
1082
1083
|
return (scope) => {
|
1083
1084
|
queueEffect(scope, fn);
|
1084
1085
|
};
|
@@ -1096,7 +1097,7 @@ function* traverseAllHoisted(scope, path, curIndex = path.length - 1) {
|
|
1096
1097
|
}
|
1097
1098
|
}
|
1098
1099
|
}
|
1099
|
-
function
|
1100
|
+
function _hoist(...path) {
|
1100
1101
|
return (scope) => {
|
1101
1102
|
const getOne = (...args) => iterator().next().value(...args);
|
1102
1103
|
const iterator = getOne[Symbol.iterator] = () => traverseAllHoisted(scope, path);
|
@@ -1135,7 +1136,7 @@ function setupBranch(renderer, branch) {
|
|
1135
1136
|
}
|
1136
1137
|
return branch;
|
1137
1138
|
}
|
1138
|
-
function
|
1139
|
+
function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
|
1139
1140
|
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "";
|
1140
1141
|
setup = setup ? setup._ || setup : void 0;
|
1141
1142
|
params ||= void 0;
|
@@ -1162,16 +1163,16 @@ function createContent(id, template, walks, setup, params, dynamicScopesAccessor
|
|
1162
1163
|
};
|
1163
1164
|
};
|
1164
1165
|
}
|
1165
|
-
function
|
1166
|
-
return
|
1166
|
+
function _content_resume(id, template, walks, setup, params, dynamicScopesAccessor) {
|
1167
|
+
return _resume(
|
1167
1168
|
id,
|
1168
|
-
|
1169
|
+
_content(id, template, walks, setup, params, dynamicScopesAccessor)
|
1169
1170
|
);
|
1170
1171
|
}
|
1171
|
-
function
|
1172
|
+
function _content_closures(renderer, closureFns) {
|
1172
1173
|
const closureSignals = {};
|
1173
1174
|
for (const key in closureFns) {
|
1174
|
-
closureSignals[key] =
|
1175
|
+
closureSignals[key] = _const(key, closureFns[key]);
|
1175
1176
|
}
|
1176
1177
|
return (owner, closureValues) => {
|
1177
1178
|
const instance = renderer(owner);
|
@@ -1180,12 +1181,12 @@ function localClosures(renderer, closureFns) {
|
|
1180
1181
|
return instance;
|
1181
1182
|
};
|
1182
1183
|
}
|
1183
|
-
function
|
1184
|
-
return
|
1184
|
+
function _content_branch(template, walks, setup, params) {
|
1185
|
+
return _content("", template, walks, setup, params)();
|
1185
1186
|
}
|
1186
1187
|
var cloneCache = {};
|
1187
|
-
function createCloneableHTML(
|
1188
|
-
const { firstChild, lastChild } = parseHTML(
|
1188
|
+
function createCloneableHTML(html, ns) {
|
1189
|
+
const { firstChild, lastChild } = parseHTML(html, ns);
|
1189
1190
|
const parent = document.createElementNS(ns, "t");
|
1190
1191
|
insertChildNodes(parent, null, firstChild, lastChild);
|
1191
1192
|
return firstChild === lastChild && firstChild.nodeType < 8 /* Comment */ ? (branch, walks) => {
|
@@ -1203,53 +1204,53 @@ function createCloneableHTML(html2, ns) {
|
|
1203
1204
|
}
|
1204
1205
|
|
1205
1206
|
// src/dom/dom.ts
|
1206
|
-
function
|
1207
|
-
setAttribute(element, name, normalizeAttrValue(
|
1207
|
+
function _attr(element, name, value) {
|
1208
|
+
setAttribute(element, name, normalizeAttrValue(value));
|
1208
1209
|
}
|
1209
|
-
function setAttribute(element, name,
|
1210
|
-
if (element.getAttribute(name) !=
|
1211
|
-
if (
|
1210
|
+
function setAttribute(element, name, value) {
|
1211
|
+
if (element.getAttribute(name) != value) {
|
1212
|
+
if (value === void 0) {
|
1212
1213
|
element.removeAttribute(name);
|
1213
1214
|
} else {
|
1214
|
-
element.setAttribute(name,
|
1215
|
+
element.setAttribute(name, value);
|
1215
1216
|
}
|
1216
1217
|
}
|
1217
1218
|
}
|
1218
|
-
function
|
1219
|
-
setAttribute(element, "class", classValue(
|
1219
|
+
function _attr_class(element, value) {
|
1220
|
+
setAttribute(element, "class", classValue(value) || void 0);
|
1220
1221
|
}
|
1221
|
-
function
|
1222
|
+
function _attr_class_items(element, items) {
|
1222
1223
|
for (const key in items) {
|
1223
|
-
|
1224
|
+
_attr_class_item(element, key, items[key]);
|
1224
1225
|
}
|
1225
1226
|
}
|
1226
|
-
function
|
1227
|
-
element.classList.toggle(name, !!
|
1227
|
+
function _attr_class_item(element, name, value) {
|
1228
|
+
element.classList.toggle(name, !!value);
|
1228
1229
|
}
|
1229
|
-
function
|
1230
|
-
setAttribute(element, "style", styleValue(
|
1230
|
+
function _attr_style(element, value) {
|
1231
|
+
setAttribute(element, "style", styleValue(value) || void 0);
|
1231
1232
|
}
|
1232
|
-
function
|
1233
|
+
function _attr_style_items(element, items) {
|
1233
1234
|
for (const key in items) {
|
1234
|
-
|
1235
|
+
_attr_style_item(element, key, items[key]);
|
1235
1236
|
}
|
1236
1237
|
}
|
1237
|
-
function
|
1238
|
-
element.style.setProperty(name,
|
1238
|
+
function _attr_style_item(element, name, value) {
|
1239
|
+
element.style.setProperty(name, value || value === 0 ? value + "" : "");
|
1239
1240
|
}
|
1240
|
-
function
|
1241
|
-
const normalizedValue = normalizeString(
|
1241
|
+
function _text(node, value) {
|
1242
|
+
const normalizedValue = normalizeString(value);
|
1242
1243
|
if (node.data !== normalizedValue) {
|
1243
1244
|
node.data = normalizedValue;
|
1244
1245
|
}
|
1245
1246
|
}
|
1246
|
-
function
|
1247
|
-
const normalizedValue = normalizeString(
|
1247
|
+
function _text_content(node, value) {
|
1248
|
+
const normalizedValue = normalizeString(value);
|
1248
1249
|
if (node.textContent !== normalizedValue) {
|
1249
1250
|
node.textContent = normalizedValue;
|
1250
1251
|
}
|
1251
1252
|
}
|
1252
|
-
function
|
1253
|
+
function _attrs(scope, nodeAccessor, nextAttrs) {
|
1253
1254
|
const el = scope[nodeAccessor];
|
1254
1255
|
for (let i = el.attributes.length; i--; ) {
|
1255
1256
|
const { name } = el.attributes.item(i);
|
@@ -1259,14 +1260,14 @@ function attrs(scope, nodeAccessor, nextAttrs) {
|
|
1259
1260
|
}
|
1260
1261
|
attrsInternal(scope, nodeAccessor, nextAttrs);
|
1261
1262
|
}
|
1262
|
-
function
|
1263
|
-
|
1264
|
-
|
1263
|
+
function _attrs_content(scope, nodeAccessor, nextAttrs) {
|
1264
|
+
_attrs(scope, nodeAccessor, nextAttrs);
|
1265
|
+
_attr_content(scope, nodeAccessor, nextAttrs?.content);
|
1265
1266
|
}
|
1266
|
-
function hasAttrAlias(element,
|
1267
|
-
return
|
1267
|
+
function hasAttrAlias(element, attr, nextAttrs) {
|
1268
|
+
return attr === "checked" && element.tagName === "INPUT" && "checkedValue" in nextAttrs;
|
1268
1269
|
}
|
1269
|
-
function
|
1270
|
+
function _attrs_partial(scope, nodeAccessor, nextAttrs, skip) {
|
1270
1271
|
const el = scope[nodeAccessor];
|
1271
1272
|
const partial = {};
|
1272
1273
|
for (let i = el.attributes.length; i--; ) {
|
@@ -1280,9 +1281,9 @@ function partialAttrs(scope, nodeAccessor, nextAttrs, skip) {
|
|
1280
1281
|
}
|
1281
1282
|
attrsInternal(scope, nodeAccessor, partial);
|
1282
1283
|
}
|
1283
|
-
function
|
1284
|
-
|
1285
|
-
|
1284
|
+
function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip) {
|
1285
|
+
_attrs_partial(scope, nodeAccessor, nextAttrs, skip);
|
1286
|
+
_attr_content(scope, nodeAccessor, nextAttrs?.content);
|
1286
1287
|
}
|
1287
1288
|
function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
1288
1289
|
const el = scope[nodeAccessor];
|
@@ -1291,14 +1292,14 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
1291
1292
|
switch (el.tagName) {
|
1292
1293
|
case "INPUT":
|
1293
1294
|
if ("checked" in nextAttrs || "checkedChange" in nextAttrs) {
|
1294
|
-
|
1295
|
+
_attr_input_checked(
|
1295
1296
|
scope,
|
1296
1297
|
nodeAccessor,
|
1297
1298
|
nextAttrs.checked,
|
1298
1299
|
nextAttrs.checkedChange
|
1299
1300
|
);
|
1300
1301
|
} else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs) {
|
1301
|
-
|
1302
|
+
_attr_input_checkedValue(
|
1302
1303
|
scope,
|
1303
1304
|
nodeAccessor,
|
1304
1305
|
nextAttrs.checkedValue,
|
@@ -1306,7 +1307,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
1306
1307
|
nextAttrs.value
|
1307
1308
|
);
|
1308
1309
|
} else if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
1309
|
-
|
1310
|
+
_attr_input_value(
|
1310
1311
|
scope,
|
1311
1312
|
nodeAccessor,
|
1312
1313
|
nextAttrs.value,
|
@@ -1319,7 +1320,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
1319
1320
|
break;
|
1320
1321
|
case "SELECT":
|
1321
1322
|
if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
1322
|
-
|
1323
|
+
_attr_select_value(
|
1323
1324
|
scope,
|
1324
1325
|
nodeAccessor,
|
1325
1326
|
nextAttrs.value,
|
@@ -1330,7 +1331,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
1330
1331
|
break;
|
1331
1332
|
case "TEXTAREA":
|
1332
1333
|
if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
1333
|
-
|
1334
|
+
_attr_input_value(
|
1334
1335
|
scope,
|
1335
1336
|
nodeAccessor,
|
1336
1337
|
nextAttrs.value,
|
@@ -1342,7 +1343,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
1342
1343
|
case "DETAILS":
|
1343
1344
|
case "DIALOG":
|
1344
1345
|
if ("open" in nextAttrs || "openChange" in nextAttrs) {
|
1345
|
-
|
1346
|
+
_attr_details_or_dialog_open(
|
1346
1347
|
scope,
|
1347
1348
|
nodeAccessor,
|
1348
1349
|
nextAttrs.open,
|
@@ -1353,27 +1354,27 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
1353
1354
|
break;
|
1354
1355
|
}
|
1355
1356
|
for (const name in nextAttrs) {
|
1356
|
-
const
|
1357
|
+
const value = nextAttrs[name];
|
1357
1358
|
switch (name) {
|
1358
1359
|
case "class":
|
1359
|
-
|
1360
|
+
_attr_class(el, value);
|
1360
1361
|
break;
|
1361
1362
|
case "style":
|
1362
|
-
|
1363
|
+
_attr_style(el, value);
|
1363
1364
|
break;
|
1364
1365
|
default: {
|
1365
1366
|
if (isEventHandler(name)) {
|
1366
|
-
(events ||= scope["EventAttributes:" /* EventAttributes */ + nodeAccessor] = {})[getEventHandlerName(name)] =
|
1367
|
+
(events ||= scope["EventAttributes:" /* EventAttributes */ + nodeAccessor] = {})[getEventHandlerName(name)] = value;
|
1367
1368
|
} else if (!(skip?.test(name) || name === "content" && el.tagName !== "META")) {
|
1368
|
-
|
1369
|
+
_attr(el, name, value);
|
1369
1370
|
}
|
1370
1371
|
break;
|
1371
1372
|
}
|
1372
1373
|
}
|
1373
1374
|
}
|
1374
1375
|
}
|
1375
|
-
function
|
1376
|
-
const content = normalizeClientRender(
|
1376
|
+
function _attr_content(scope, nodeAccessor, value) {
|
1377
|
+
const content = normalizeClientRender(value);
|
1377
1378
|
const rendererAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + nodeAccessor;
|
1378
1379
|
if (scope[rendererAccessor] !== (scope[rendererAccessor] = content?.___id)) {
|
1379
1380
|
setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch);
|
@@ -1386,36 +1387,36 @@ function insertContent(scope, nodeAccessor, value2) {
|
|
1386
1387
|
}
|
1387
1388
|
}
|
1388
1389
|
}
|
1389
|
-
function
|
1390
|
+
function _attrs_script(scope, nodeAccessor) {
|
1390
1391
|
const el = scope[nodeAccessor];
|
1391
1392
|
const events = scope["EventAttributes:" /* EventAttributes */ + nodeAccessor];
|
1392
1393
|
switch (scope["ControlledType:" /* ControlledType */ + nodeAccessor]) {
|
1393
1394
|
case 0 /* InputChecked */:
|
1394
|
-
|
1395
|
+
_attr_input_checked_script(scope, nodeAccessor);
|
1395
1396
|
break;
|
1396
1397
|
case 1 /* InputCheckedValue */:
|
1397
|
-
|
1398
|
+
_attr_input_checkedValue_script(scope, nodeAccessor);
|
1398
1399
|
break;
|
1399
1400
|
case 2 /* InputValue */:
|
1400
|
-
|
1401
|
+
_attr_input_value_script(scope, nodeAccessor);
|
1401
1402
|
break;
|
1402
1403
|
case 3 /* SelectValue */:
|
1403
|
-
|
1404
|
+
_attr_select_value_script(scope, nodeAccessor);
|
1404
1405
|
break;
|
1405
1406
|
case 4 /* DetailsOrDialogOpen */:
|
1406
|
-
|
1407
|
+
_attr_details_or_dialog_open_script(scope, nodeAccessor);
|
1407
1408
|
break;
|
1408
1409
|
}
|
1409
1410
|
for (const name in events) {
|
1410
|
-
|
1411
|
+
_on(el, name, events[name]);
|
1411
1412
|
}
|
1412
1413
|
}
|
1413
|
-
function
|
1414
|
+
function _html(scope, value, accessor) {
|
1414
1415
|
const firstChild = scope[accessor];
|
1415
1416
|
const parentNode = firstChild.parentNode;
|
1416
1417
|
const lastChild = scope["DynamicPlaceholderLastChild:" /* DynamicPlaceholderLastChild */ + accessor] || firstChild;
|
1417
1418
|
const newContent = parseHTML(
|
1418
|
-
|
1419
|
+
value || value === 0 ? value + "" : "",
|
1419
1420
|
parentNode.namespaceURI
|
1420
1421
|
);
|
1421
1422
|
insertChildNodes(
|
@@ -1426,43 +1427,27 @@ function html(scope, value2, accessor) {
|
|
1426
1427
|
);
|
1427
1428
|
removeChildNodes(firstChild, lastChild);
|
1428
1429
|
}
|
1429
|
-
function normalizeClientRender(
|
1430
|
-
const renderer = normalizeDynamicRenderer(
|
1430
|
+
function normalizeClientRender(value) {
|
1431
|
+
const renderer = normalizeDynamicRenderer(value);
|
1431
1432
|
if (renderer) {
|
1432
1433
|
if (renderer.___id) {
|
1433
1434
|
return renderer;
|
1434
1435
|
} else if (true) {
|
1435
1436
|
throw new Error(
|
1436
|
-
`Invalid \`content\` attribute. Received ${typeof
|
1437
|
+
`Invalid \`content\` attribute. Received ${typeof value}`
|
1437
1438
|
);
|
1438
1439
|
}
|
1439
1440
|
}
|
1440
1441
|
}
|
1441
|
-
function
|
1442
|
-
|
1443
|
-
|
1444
|
-
const node = scope[nodeIndex];
|
1445
|
-
if (prevProps) {
|
1446
|
-
for (const name in prevProps) {
|
1447
|
-
if (!(name in nextProps)) {
|
1448
|
-
node[name] = void 0;
|
1449
|
-
}
|
1450
|
-
}
|
1451
|
-
}
|
1452
|
-
for (const name in nextProps) {
|
1453
|
-
node[name] = nextProps[name];
|
1442
|
+
function normalizeAttrValue(value) {
|
1443
|
+
if (value || value === 0) {
|
1444
|
+
return value === true ? "" : value + "";
|
1454
1445
|
}
|
1455
|
-
scope[index + "-"] = nextProps;
|
1456
1446
|
}
|
1457
|
-
function
|
1458
|
-
|
1459
|
-
return value2 === true ? "" : value2 + "";
|
1460
|
-
}
|
1461
|
-
}
|
1462
|
-
function normalizeString(value2) {
|
1463
|
-
return value2 || value2 === 0 ? value2 + "" : "\u200D";
|
1447
|
+
function normalizeString(value) {
|
1448
|
+
return value || value === 0 ? value + "" : "\u200D";
|
1464
1449
|
}
|
1465
|
-
function
|
1450
|
+
function _lifecycle(scope, index, thisObj) {
|
1466
1451
|
const instance = scope[index];
|
1467
1452
|
if (instance) {
|
1468
1453
|
Object.assign(instance, thisObj);
|
@@ -1470,10 +1455,7 @@ function lifecycle(scope, index, thisObj) {
|
|
1470
1455
|
} else {
|
1471
1456
|
scope[index] = thisObj;
|
1472
1457
|
thisObj.onMount?.();
|
1473
|
-
|
1474
|
-
scope,
|
1475
|
-
"LifecycleAbortController:" /* LifecycleAbortController */ + index
|
1476
|
-
).onabort = () => thisObj.onDestroy?.();
|
1458
|
+
$signal(scope, "LifecycleAbortController:" /* LifecycleAbortController */ + index).onabort = () => thisObj.onDestroy?.();
|
1477
1459
|
}
|
1478
1460
|
}
|
1479
1461
|
function removeChildNodes(startNode, endNode) {
|
@@ -1668,7 +1650,7 @@ function longestIncreasingSubsequence(a) {
|
|
1668
1650
|
}
|
1669
1651
|
|
1670
1652
|
// src/dom/control-flow.ts
|
1671
|
-
function
|
1653
|
+
function _await(nodeAccessor, renderer) {
|
1672
1654
|
const promiseAccessor = "Promise:" /* Promise */ + nodeAccessor;
|
1673
1655
|
const branchAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
|
1674
1656
|
return (scope, promise) => {
|
@@ -1713,7 +1695,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1713
1695
|
tempDetachBranch(awaitBranch);
|
1714
1696
|
}
|
1715
1697
|
const thisPromise = scope[promiseAccessor] = promise.then(
|
1716
|
-
(
|
1698
|
+
(data) => {
|
1717
1699
|
if (thisPromise === scope[promiseAccessor]) {
|
1718
1700
|
scope[promiseAccessor] = 0;
|
1719
1701
|
schedule();
|
@@ -1739,7 +1721,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1739
1721
|
);
|
1740
1722
|
referenceNode.remove();
|
1741
1723
|
}
|
1742
|
-
renderer.___params?.(awaitBranch, [
|
1724
|
+
renderer.___params?.(awaitBranch, [data]);
|
1743
1725
|
if (tryWithPlaceholder) {
|
1744
1726
|
placeholderShown.add(pendingEffects);
|
1745
1727
|
if (!--tryWithPlaceholder.___pendingAsyncCount) {
|
@@ -1773,14 +1755,14 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1773
1755
|
);
|
1774
1756
|
};
|
1775
1757
|
}
|
1776
|
-
function
|
1758
|
+
function _try(nodeAccessor, content) {
|
1777
1759
|
const branchAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
|
1778
1760
|
return (scope, input) => {
|
1779
1761
|
if (!scope[branchAccessor]) {
|
1780
1762
|
setConditionalRenderer(
|
1781
1763
|
scope,
|
1782
1764
|
nodeAccessor,
|
1783
|
-
|
1765
|
+
content,
|
1784
1766
|
createAndSetupBranch
|
1785
1767
|
);
|
1786
1768
|
}
|
@@ -1819,7 +1801,7 @@ function renderCatch(scope, error) {
|
|
1819
1801
|
);
|
1820
1802
|
}
|
1821
1803
|
}
|
1822
|
-
function
|
1804
|
+
function _if(nodeAccessor, ...branches) {
|
1823
1805
|
const branchAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + nodeAccessor;
|
1824
1806
|
enableBranches();
|
1825
1807
|
return (scope, newBranch) => {
|
@@ -1834,9 +1816,9 @@ function conditional(nodeAccessor, ...branches) {
|
|
1834
1816
|
};
|
1835
1817
|
}
|
1836
1818
|
function patchDynamicTag(fn) {
|
1837
|
-
|
1819
|
+
_dynamic_tag = fn(_dynamic_tag);
|
1838
1820
|
}
|
1839
|
-
var
|
1821
|
+
var _dynamic_tag = function dynamicTag(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
1840
1822
|
const childScopeAccessor = "ConditionalScope:" /* ConditionalScope */ + nodeAccessor;
|
1841
1823
|
const rendererAccessor = "ConditionalRenderer:" /* ConditionalRenderer */ + nodeAccessor;
|
1842
1824
|
enableBranches();
|
@@ -1850,7 +1832,7 @@ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, input
|
|
1850
1832
|
createBranchWithTagNameOrRenderer
|
1851
1833
|
);
|
1852
1834
|
if (getTagVar) {
|
1853
|
-
|
1835
|
+
_var(scope, childScopeAccessor, getTagVar());
|
1854
1836
|
}
|
1855
1837
|
if (typeof normalizedRenderer === "string") {
|
1856
1838
|
if (getContent) {
|
@@ -1881,7 +1863,7 @@ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, input
|
|
1881
1863
|
const childScope = scope[childScopeAccessor];
|
1882
1864
|
const args = getInput?.();
|
1883
1865
|
if (typeof normalizedRenderer === "string") {
|
1884
|
-
(getContent ?
|
1866
|
+
(getContent ? _attrs : _attrs_content)(
|
1885
1867
|
childScope,
|
1886
1868
|
true ? `#${normalizedRenderer}/0` : 0,
|
1887
1869
|
(inputIsArgs ? args[0] : args) || {}
|
@@ -1936,7 +1918,7 @@ function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2)
|
|
1936
1918
|
referenceNode.remove();
|
1937
1919
|
}
|
1938
1920
|
}
|
1939
|
-
function
|
1921
|
+
function _for_of(nodeAccessor, renderer) {
|
1940
1922
|
return loop(
|
1941
1923
|
nodeAccessor,
|
1942
1924
|
renderer,
|
@@ -1952,14 +1934,14 @@ function loopOf(nodeAccessor, renderer) {
|
|
1952
1934
|
}
|
1953
1935
|
);
|
1954
1936
|
}
|
1955
|
-
function
|
1937
|
+
function _for_in(nodeAccessor, renderer) {
|
1956
1938
|
return loop(
|
1957
1939
|
nodeAccessor,
|
1958
1940
|
renderer,
|
1959
|
-
([obj, by = byFirstArg], cb) => forIn(obj, (key,
|
1941
|
+
([obj, by = byFirstArg], cb) => forIn(obj, (key, value) => cb(by(key, value), [key, value]))
|
1960
1942
|
);
|
1961
1943
|
}
|
1962
|
-
function
|
1944
|
+
function _for_to(nodeAccessor, renderer) {
|
1963
1945
|
return loop(
|
1964
1946
|
nodeAccessor,
|
1965
1947
|
renderer,
|
@@ -1969,7 +1951,7 @@ function loopTo(nodeAccessor, renderer) {
|
|
1969
1951
|
function loop(nodeAccessor, renderer, forEach) {
|
1970
1952
|
const params = renderer.___params;
|
1971
1953
|
enableBranches();
|
1972
|
-
return (scope,
|
1954
|
+
return (scope, value) => {
|
1973
1955
|
const referenceNode = scope[nodeAccessor];
|
1974
1956
|
const oldMap = scope["LoopScopeMap:" /* LoopScopeMap */ + nodeAccessor];
|
1975
1957
|
const oldArray = oldMap ? scope["LoopScopeArray:" /* LoopScopeArray */ + nodeAccessor] || [
|
@@ -1978,7 +1960,7 @@ function loop(nodeAccessor, renderer, forEach) {
|
|
1978
1960
|
const parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].___startNode.parentNode : referenceNode;
|
1979
1961
|
const newMap = scope["LoopScopeMap:" /* LoopScopeMap */ + nodeAccessor] = /* @__PURE__ */ new Map();
|
1980
1962
|
const newArray = scope["LoopScopeArray:" /* LoopScopeArray */ + nodeAccessor] = [];
|
1981
|
-
forEach(
|
1963
|
+
forEach(value, (key, args) => {
|
1982
1964
|
const branch = oldMap?.get(key) || createAndSetupBranch(scope.$global, renderer, scope, parentNode);
|
1983
1965
|
params?.(branch, args);
|
1984
1966
|
newMap.set(key, branch);
|
@@ -2032,17 +2014,17 @@ var pendingEffects = [];
|
|
2032
2014
|
var pendingScopes = [];
|
2033
2015
|
var rendering;
|
2034
2016
|
var scopeKeyOffset = 1e3;
|
2035
|
-
function queueRender(scope, signal, signalKey,
|
2017
|
+
function queueRender(scope, signal, signalKey, value, scopeKey = scope.___id) {
|
2036
2018
|
const key = scopeKey * scopeKeyOffset + signalKey;
|
2037
2019
|
const existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
|
2038
2020
|
if (existingRender) {
|
2039
|
-
existingRender.___value =
|
2021
|
+
existingRender.___value = value;
|
2040
2022
|
} else {
|
2041
2023
|
const render = {
|
2042
2024
|
___key: key,
|
2043
2025
|
___scope: scope,
|
2044
2026
|
___signal: signal,
|
2045
|
-
___value:
|
2027
|
+
___value: value
|
2046
2028
|
};
|
2047
2029
|
let i = pendingRenders.push(render) - 1;
|
2048
2030
|
while (i) {
|
@@ -2132,8 +2114,8 @@ function runRenders() {
|
|
2132
2114
|
pendingScopes = [];
|
2133
2115
|
}
|
2134
2116
|
var runRender = (render) => render.___signal(render.___scope, render.___value);
|
2135
|
-
var
|
2136
|
-
|
2117
|
+
var _enable_catch = () => {
|
2118
|
+
_enable_catch = () => {
|
2137
2119
|
};
|
2138
2120
|
enableBranches();
|
2139
2121
|
const handlePendingTry = (fn, scope, branch) => {
|
@@ -2172,14 +2154,14 @@ var enableCatch = () => {
|
|
2172
2154
|
};
|
2173
2155
|
|
2174
2156
|
// src/dom/abort-signal.ts
|
2175
|
-
function
|
2157
|
+
function $signalReset(scope, id) {
|
2176
2158
|
const ctrl = scope.___abortControllers?.[id];
|
2177
2159
|
if (ctrl) {
|
2178
2160
|
queueEffect(ctrl, abort);
|
2179
2161
|
scope.___abortControllers[id] = void 0;
|
2180
2162
|
}
|
2181
2163
|
}
|
2182
|
-
function
|
2164
|
+
function $signal(scope, id) {
|
2183
2165
|
if (scope.___closestBranch) {
|
2184
2166
|
(scope.___closestBranch.___abortScopes ||= /* @__PURE__ */ new Set()).add(scope);
|
2185
2167
|
}
|
@@ -2201,13 +2183,13 @@ var compat = {
|
|
2201
2183
|
patchDynamicTag,
|
2202
2184
|
queueEffect,
|
2203
2185
|
init(warp10Noop) {
|
2204
|
-
|
2186
|
+
_resume(SET_SCOPE_REGISTER_ID, (branch) => {
|
2205
2187
|
classIdToBranch.set(branch.m5c, branch);
|
2206
2188
|
});
|
2207
|
-
|
2189
|
+
_resume(RENDER_BODY_ID, warp10Noop);
|
2208
2190
|
},
|
2209
2191
|
registerRenderer(fn) {
|
2210
|
-
|
2192
|
+
_resume(RENDERER_REGISTER_ID, fn);
|
2211
2193
|
},
|
2212
2194
|
isRenderer(renderer) {
|
2213
2195
|
return renderer.___clone;
|
@@ -2229,17 +2211,17 @@ var compat = {
|
|
2229
2211
|
destroyBranch(this.scope);
|
2230
2212
|
}
|
2231
2213
|
},
|
2232
|
-
resolveRegistered(
|
2233
|
-
if (Array.isArray(
|
2214
|
+
resolveRegistered(value, $global) {
|
2215
|
+
if (Array.isArray(value) && typeof value[0] === "string") {
|
2234
2216
|
return getRegisteredWithScope(
|
2235
|
-
|
2236
|
-
|
2217
|
+
value[0],
|
2218
|
+
value.length === 2 && self[$global.runtimeId]?.[$global.renderId]?.s[value[1]]
|
2237
2219
|
);
|
2238
2220
|
}
|
2239
|
-
return
|
2221
|
+
return value;
|
2240
2222
|
},
|
2241
2223
|
createRenderer(params, clone) {
|
2242
|
-
const renderer =
|
2224
|
+
const renderer = _content_branch(0, 0, 0, params);
|
2243
2225
|
renderer.___clone = (branch) => {
|
2244
2226
|
const cloned = clone();
|
2245
2227
|
branch.___startNode = cloned.startNode;
|
@@ -2281,8 +2263,8 @@ var compat = {
|
|
2281
2263
|
};
|
2282
2264
|
|
2283
2265
|
// src/dom/template.ts
|
2284
|
-
var
|
2285
|
-
const renderer =
|
2266
|
+
var _template = (id, template, walks, setup, inputSignal) => {
|
2267
|
+
const renderer = _content(
|
2286
2268
|
id,
|
2287
2269
|
template,
|
2288
2270
|
walks,
|
@@ -2298,7 +2280,7 @@ var createTemplate = (id, template, walks, setup, inputSignal) => {
|
|
2298
2280
|
);
|
2299
2281
|
};
|
2300
2282
|
}
|
2301
|
-
return
|
2283
|
+
return _resume(id, renderer);
|
2302
2284
|
};
|
2303
2285
|
function mount(input = {}, reference, position) {
|
2304
2286
|
let branch;
|
@@ -2372,7 +2354,7 @@ function mount(input = {}, reference, position) {
|
|
2372
2354
|
return curValue;
|
2373
2355
|
},
|
2374
2356
|
set value(newValue) {
|
2375
|
-
|
2357
|
+
_var_change(branch, newValue);
|
2376
2358
|
},
|
2377
2359
|
update(newInput) {
|
2378
2360
|
if (args) {
|