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/dom.js
CHANGED
@@ -17,87 +17,88 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0
|
|
17
17
|
// src/dom.ts
|
18
18
|
var dom_exports = {};
|
19
19
|
__export(dom_exports, {
|
20
|
-
|
20
|
+
$signal: () => $signal,
|
21
|
+
$signalReset: () => $signalReset,
|
22
|
+
_attr: () => _attr,
|
23
|
+
_attr_class: () => _attr_class,
|
24
|
+
_attr_class_item: () => _attr_class_item,
|
25
|
+
_attr_class_items: () => _attr_class_items,
|
26
|
+
_attr_content: () => _attr_content,
|
27
|
+
_attr_details_open: () => _attr_details_or_dialog_open,
|
28
|
+
_attr_details_open_script: () => _attr_details_or_dialog_open_script,
|
29
|
+
_attr_dialog_open: () => _attr_details_or_dialog_open,
|
30
|
+
_attr_dialog_open_script: () => _attr_details_or_dialog_open_script,
|
31
|
+
_attr_input_checked: () => _attr_input_checked,
|
32
|
+
_attr_input_checkedValue: () => _attr_input_checkedValue,
|
33
|
+
_attr_input_checkedValue_script: () => _attr_input_checkedValue_script,
|
34
|
+
_attr_input_checked_script: () => _attr_input_checked_script,
|
35
|
+
_attr_input_value: () => _attr_input_value,
|
36
|
+
_attr_input_value_script: () => _attr_input_value_script,
|
37
|
+
_attr_select_value: () => _attr_select_value,
|
38
|
+
_attr_select_value_script: () => _attr_select_value_script,
|
39
|
+
_attr_style: () => _attr_style,
|
40
|
+
_attr_style_item: () => _attr_style_item,
|
41
|
+
_attr_style_items: () => _attr_style_items,
|
42
|
+
_attr_textarea_value: () => _attr_input_value,
|
43
|
+
_attr_textarea_value_script: () => _attr_input_value_script,
|
44
|
+
_attrs: () => _attrs,
|
45
|
+
_attrs_content: () => _attrs_content,
|
46
|
+
_attrs_partial: () => _attrs_partial,
|
47
|
+
_attrs_partial_content: () => _attrs_partial_content,
|
48
|
+
_attrs_script: () => _attrs_script,
|
49
|
+
_await: () => _await,
|
50
|
+
_closure: () => _closure,
|
51
|
+
_closure_get: () => _closure_get,
|
52
|
+
_const: () => _const,
|
53
|
+
_content: () => _content,
|
54
|
+
_content_branch: () => _content_branch,
|
55
|
+
_content_closures: () => _content_closures,
|
56
|
+
_content_resume: () => _content_resume,
|
57
|
+
_dynamic_tag: () => _dynamic_tag,
|
58
|
+
_el: () => _el,
|
59
|
+
_enable_catch: () => _enable_catch,
|
60
|
+
_for_closure: () => _for_closure,
|
61
|
+
_for_in: () => _for_in,
|
62
|
+
_for_of: () => _for_of,
|
63
|
+
_for_to: () => _for_to,
|
64
|
+
_hoist: () => _hoist,
|
65
|
+
_html: () => _html,
|
66
|
+
_id: () => _id,
|
67
|
+
_if: () => _if,
|
68
|
+
_if_closure: () => _if_closure,
|
69
|
+
_let: () => _let,
|
70
|
+
_lifecycle: () => _lifecycle,
|
71
|
+
_on: () => _on,
|
72
|
+
_or: () => _or,
|
73
|
+
_resume: () => _resume,
|
74
|
+
_return: () => _return,
|
75
|
+
_return_change: () => _return_change,
|
76
|
+
_script: () => _script,
|
77
|
+
_template: () => _template,
|
78
|
+
_text: () => _text,
|
79
|
+
_text_content: () => _text_content,
|
80
|
+
_try: () => _try,
|
81
|
+
_var: () => _var,
|
82
|
+
_var_change: () => _var_change,
|
83
|
+
_var_resume: () => _var_resume,
|
21
84
|
attrTag: () => attrTag,
|
22
85
|
attrTags: () => attrTags,
|
23
|
-
attrs: () => attrs,
|
24
|
-
attrsAndContent: () => attrsAndContent,
|
25
|
-
attrsEvents: () => attrsEvents,
|
26
|
-
awaitTag: () => awaitTag,
|
27
|
-
classAttr: () => classAttr,
|
28
|
-
classItem: () => classItem,
|
29
|
-
classItems: () => classItems,
|
30
86
|
compat: () => compat,
|
31
|
-
conditional: () => conditional,
|
32
|
-
conditionalClosure: () => conditionalClosure,
|
33
|
-
controllable_detailsOrDialog_open: () => controllable_detailsOrDialog_open,
|
34
|
-
controllable_detailsOrDialog_open_effect: () => controllable_detailsOrDialog_open_effect,
|
35
|
-
controllable_input_checked: () => controllable_input_checked,
|
36
|
-
controllable_input_checkedValue: () => controllable_input_checkedValue,
|
37
|
-
controllable_input_checkedValue_effect: () => controllable_input_checkedValue_effect,
|
38
|
-
controllable_input_checked_effect: () => controllable_input_checked_effect,
|
39
|
-
controllable_input_value: () => controllable_input_value,
|
40
|
-
controllable_input_value_effect: () => controllable_input_value_effect,
|
41
|
-
controllable_select_value: () => controllable_select_value,
|
42
|
-
controllable_select_value_effect: () => controllable_select_value_effect,
|
43
|
-
controllable_textarea_value: () => controllable_input_value,
|
44
|
-
controllable_textarea_value_effect: () => controllable_input_value_effect,
|
45
|
-
createContent: () => createContent,
|
46
|
-
createRenderer: () => createRenderer,
|
47
|
-
createTemplate: () => createTemplate,
|
48
|
-
createTry: () => createTry,
|
49
|
-
data: () => data,
|
50
|
-
dynamicClosure: () => dynamicClosure,
|
51
|
-
dynamicClosureRead: () => dynamicClosureRead,
|
52
|
-
dynamicTag: () => dynamicTag,
|
53
|
-
effect: () => effect,
|
54
|
-
enableCatch: () => enableCatch,
|
55
87
|
forIn: () => forIn,
|
56
88
|
forOf: () => forOf,
|
57
89
|
forTo: () => forTo,
|
58
|
-
getAbortSignal: () => getAbortSignal,
|
59
|
-
hoist: () => hoist,
|
60
|
-
html: () => html,
|
61
90
|
init: () => init,
|
62
|
-
|
63
|
-
intersection: () => intersection,
|
64
|
-
lifecycle: () => lifecycle,
|
65
|
-
localClosures: () => localClosures,
|
66
|
-
loopClosure: () => loopClosure,
|
67
|
-
loopIn: () => loopIn,
|
68
|
-
loopOf: () => loopOf,
|
69
|
-
loopTo: () => loopTo,
|
70
|
-
nextTagId: () => nextTagId,
|
71
|
-
nodeRef: () => nodeRef,
|
72
|
-
on: () => on,
|
73
|
-
partialAttrs: () => partialAttrs,
|
74
|
-
partialAttrsAndContent: () => partialAttrsAndContent,
|
75
|
-
props: () => props,
|
76
|
-
register: () => register,
|
77
|
-
registerBoundSignal: () => registerBoundSignal,
|
78
|
-
registerContent: () => registerContent,
|
79
|
-
resetAbortSignal: () => resetAbortSignal,
|
80
|
-
run: () => run,
|
81
|
-
setTagVar: () => setTagVar,
|
82
|
-
setTagVarChange: () => setTagVarChange,
|
83
|
-
state: () => state,
|
84
|
-
styleAttr: () => styleAttr,
|
85
|
-
styleItem: () => styleItem,
|
86
|
-
styleItems: () => styleItems,
|
87
|
-
tagVarSignal: () => tagVarSignal,
|
88
|
-
tagVarSignalChange: () => tagVarSignalChange,
|
89
|
-
textContent: () => textContent,
|
90
|
-
value: () => value
|
91
|
+
run: () => run
|
91
92
|
});
|
92
93
|
module.exports = __toCommonJS(dom_exports);
|
93
94
|
|
94
95
|
// src/common/attr-tag.ts
|
95
96
|
var empty = [], rest = Symbol();
|
96
|
-
function attrTag(
|
97
|
-
return
|
97
|
+
function attrTag(attrs) {
|
98
|
+
return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
|
98
99
|
}
|
99
|
-
function attrTags(first,
|
100
|
-
return first ? (first[rest] === empty ? first[rest] = [
|
100
|
+
function attrTags(first, attrs) {
|
101
|
+
return first ? (first[rest] === empty ? first[rest] = [attrs] : first[rest].push(attrs), first) : attrTag(attrs);
|
101
102
|
}
|
102
103
|
function* attrTagIterator() {
|
103
104
|
yield this, yield* this[rest];
|
@@ -125,14 +126,14 @@ function forTo(to, from, step, cb) {
|
|
125
126
|
function classValue(classValue2) {
|
126
127
|
return toDelimitedString(classValue2, " ", stringifyClassObject);
|
127
128
|
}
|
128
|
-
function stringifyClassObject(name,
|
129
|
-
return
|
129
|
+
function stringifyClassObject(name, value) {
|
130
|
+
return value ? name : "";
|
130
131
|
}
|
131
132
|
function styleValue(styleValue2) {
|
132
133
|
return toDelimitedString(styleValue2, ";", stringifyStyleObject);
|
133
134
|
}
|
134
|
-
function stringifyStyleObject(name,
|
135
|
-
return
|
135
|
+
function stringifyStyleObject(name, value) {
|
136
|
+
return value || value === 0 ? name + ":" + value : "";
|
136
137
|
}
|
137
138
|
function toDelimitedString(val, delimiter, stringify) {
|
138
139
|
let str = "", sep = "", part;
|
@@ -153,13 +154,13 @@ function isEventHandler(name) {
|
|
153
154
|
function getEventHandlerName(name) {
|
154
155
|
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
155
156
|
}
|
156
|
-
function normalizeDynamicRenderer(
|
157
|
-
return
|
157
|
+
function normalizeDynamicRenderer(value) {
|
158
|
+
return value ? value.content || value.default || value : void 0;
|
158
159
|
}
|
159
160
|
|
160
161
|
// src/dom/event.ts
|
161
162
|
var defaultDelegator = createDelegator();
|
162
|
-
function
|
163
|
+
function _on(element, type, handler) {
|
163
164
|
element["$" + type] === void 0 && defaultDelegator(element, type, handleDelegated), element["$" + type] = handler || null;
|
164
165
|
}
|
165
166
|
function createDelegator() {
|
@@ -251,36 +252,36 @@ function walk(startNode, walkCodes, branch) {
|
|
251
252
|
walker.currentNode = startNode, walkInternal(0, walkCodes, branch);
|
252
253
|
}
|
253
254
|
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
254
|
-
let
|
255
|
+
let value, storedMultiplier = 0, currentMultiplier = 0, currentScopeIndex = 0;
|
255
256
|
for (; currentWalkIndex < walkCodes.length; )
|
256
|
-
if (
|
257
|
+
if (value = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value === 32 /* Get */) {
|
257
258
|
let node = walker.currentNode;
|
258
259
|
scope[currentScopeIndex] = node, scope["j" /* Getter */ + currentScopeIndex++] = () => node;
|
259
|
-
} else if (
|
260
|
+
} else if (value === 37 /* Replace */ || value === 49 /* DynamicTagWithVar */)
|
260
261
|
walker.currentNode.replaceWith(
|
261
262
|
walker.currentNode = scope[currentScopeIndex++] = new Text()
|
262
|
-
),
|
263
|
+
), value === 49 /* DynamicTagWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
|
263
264
|
else {
|
264
|
-
if (
|
265
|
+
if (value === 38 /* EndChild */)
|
265
266
|
return currentWalkIndex;
|
266
|
-
if (
|
267
|
+
if (value === 47 /* BeginChild */ || value === 48 /* BeginChildWithVar */)
|
267
268
|
currentWalkIndex = walkInternal(
|
268
269
|
currentWalkIndex,
|
269
270
|
walkCodes,
|
270
271
|
scope[currentScopeIndex++] = createScope(scope.$global, scope.k)
|
271
|
-
),
|
272
|
-
else if (
|
273
|
-
for (
|
272
|
+
), value === 48 /* BeginChildWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
|
273
|
+
else if (value < 92)
|
274
|
+
for (value = 20 /* Next */ * currentMultiplier + value - 67 /* Next */; value--; )
|
274
275
|
walker.nextNode();
|
275
|
-
else if (
|
276
|
-
for (
|
276
|
+
else if (value < 107)
|
277
|
+
for (value = 10 /* Over */ * currentMultiplier + value - 97 /* Over */; value--; )
|
277
278
|
walker.nextSibling();
|
278
|
-
else if (
|
279
|
-
for (
|
279
|
+
else if (value < 117) {
|
280
|
+
for (value = 10 /* Out */ * currentMultiplier + value - 107 /* Out */; value--; )
|
280
281
|
walker.parentNode();
|
281
282
|
walker.nextSibling();
|
282
283
|
} else
|
283
|
-
storedMultiplier = currentMultiplier * 10 /* Multiplier */ +
|
284
|
+
storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value - 117 /* Multiplier */;
|
284
285
|
}
|
285
286
|
}
|
286
287
|
|
@@ -380,22 +381,22 @@ function init(runtimeId = "M") {
|
|
380
381
|
});
|
381
382
|
}
|
382
383
|
var isResuming;
|
383
|
-
function
|
384
|
+
function _resume(id, obj) {
|
384
385
|
return registeredValues[id] = obj, obj;
|
385
386
|
}
|
386
|
-
function
|
387
|
-
return registeredValues[id] = (scope) => (
|
387
|
+
function _var_resume(id, signal) {
|
388
|
+
return registeredValues[id] = (scope) => (value) => signal(scope, value), signal;
|
388
389
|
}
|
389
390
|
function getRegisteredWithScope(id, scope) {
|
390
391
|
let val = registeredValues[id];
|
391
392
|
return scope ? val(scope) : val;
|
392
393
|
}
|
393
|
-
function
|
394
|
-
return
|
394
|
+
function _el(id, key) {
|
395
|
+
return _resume(id, (scope) => () => scope[key]());
|
395
396
|
}
|
396
397
|
|
397
398
|
// src/dom/controllable.ts
|
398
|
-
function
|
399
|
+
function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
|
399
400
|
setCheckboxValue(
|
400
401
|
scope,
|
401
402
|
nodeAccessor,
|
@@ -404,7 +405,7 @@ function controllable_input_checked(scope, nodeAccessor, checked, checkedChange)
|
|
404
405
|
checkedChange
|
405
406
|
);
|
406
407
|
}
|
407
|
-
function
|
408
|
+
function _attr_input_checked_script(scope, nodeAccessor) {
|
408
409
|
let el = scope[nodeAccessor];
|
409
410
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
410
411
|
let checkedChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
@@ -414,16 +415,16 @@ function controllable_input_checked_effect(scope, nodeAccessor) {
|
|
414
415
|
}
|
415
416
|
});
|
416
417
|
}
|
417
|
-
function
|
418
|
-
scope["g" /* ControlledValue */ + nodeAccessor] = checkedValue,
|
418
|
+
function _attr_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValueChange, value) {
|
419
|
+
scope["g" /* ControlledValue */ + nodeAccessor] = checkedValue, _attr(scope[nodeAccessor], "value", value), setCheckboxValue(
|
419
420
|
scope,
|
420
421
|
nodeAccessor,
|
421
422
|
1 /* InputCheckedValue */,
|
422
|
-
Array.isArray(checkedValue) ? checkedValue.includes(
|
423
|
+
Array.isArray(checkedValue) ? checkedValue.includes(value) : checkedValue === value,
|
423
424
|
checkedValueChange
|
424
425
|
);
|
425
426
|
}
|
426
|
-
function
|
427
|
+
function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
427
428
|
let el = scope[nodeAccessor];
|
428
429
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
429
430
|
let checkedValueChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
@@ -440,11 +441,11 @@ function controllable_input_checkedValue_effect(scope, nodeAccessor) {
|
|
440
441
|
}
|
441
442
|
});
|
442
443
|
}
|
443
|
-
function
|
444
|
-
let el = scope[nodeAccessor], normalizedValue = normalizeStrProp(
|
445
|
-
scope["e" /* ControlledHandler */ + nodeAccessor] = valueChange, valueChange ? (scope["f" /* ControlledType */ + nodeAccessor] = 0 /* InputChecked */, scope["g" /* ControlledValue */ + nodeAccessor] =
|
444
|
+
function _attr_input_value(scope, nodeAccessor, value, valueChange) {
|
445
|
+
let el = scope[nodeAccessor], normalizedValue = normalizeStrProp(value);
|
446
|
+
scope["e" /* ControlledHandler */ + nodeAccessor] = valueChange, valueChange ? (scope["f" /* ControlledType */ + nodeAccessor] = 0 /* InputChecked */, scope["g" /* ControlledValue */ + nodeAccessor] = value, el.isConnected ? setValueAndUpdateSelection(el, normalizedValue) : el.defaultValue = normalizedValue) : (scope["f" /* ControlledType */ + nodeAccessor] = 5 /* None */, el.defaultValue = normalizedValue);
|
446
447
|
}
|
447
|
-
function
|
448
|
+
function _attr_input_value_script(scope, nodeAccessor) {
|
448
449
|
let el = scope[nodeAccessor];
|
449
450
|
isResuming && (scope["g" /* ControlledValue */ + nodeAccessor] = el.defaultValue), syncControllable(el, "input", hasValueChanged, (ev) => {
|
450
451
|
let valueChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
@@ -454,17 +455,17 @@ function controllable_input_value_effect(scope, nodeAccessor) {
|
|
454
455
|
), inputType = "");
|
455
456
|
});
|
456
457
|
}
|
457
|
-
function
|
458
|
-
scope["e" /* ControlledHandler */ + nodeAccessor] = valueChange, valueChange ? (scope["f" /* ControlledType */ + nodeAccessor] = 3 /* SelectValue */, scope["g" /* ControlledValue */ + nodeAccessor] =
|
458
|
+
function _attr_select_value(scope, nodeAccessor, value, valueChange) {
|
459
|
+
scope["e" /* ControlledHandler */ + nodeAccessor] = valueChange, valueChange ? (scope["f" /* ControlledType */ + nodeAccessor] = 3 /* SelectValue */, scope["g" /* ControlledValue */ + nodeAccessor] = value) : scope["f" /* ControlledType */ + nodeAccessor] = 5 /* None */, pendingEffects.unshift(
|
459
460
|
() => setSelectOptions(
|
460
461
|
scope[nodeAccessor],
|
461
|
-
|
462
|
+
value,
|
462
463
|
valueChange
|
463
464
|
),
|
464
465
|
scope
|
465
466
|
);
|
466
467
|
}
|
467
|
-
function
|
468
|
+
function _attr_select_value_script(scope, nodeAccessor) {
|
468
469
|
let el = scope[nodeAccessor], onChange = () => {
|
469
470
|
let valueChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
470
471
|
if (valueChange) {
|
@@ -479,21 +480,21 @@ function controllable_select_value_effect(scope, nodeAccessor) {
|
|
479
480
|
}
|
480
481
|
};
|
481
482
|
el._ || new MutationObserver(() => {
|
482
|
-
let
|
483
|
-
(Array.isArray(
|
483
|
+
let value = scope["g" /* ControlledValue */ + nodeAccessor];
|
484
|
+
(Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((value2, i) => value2 != el.selectedOptions[i].value) : el.value != value) && onChange();
|
484
485
|
}).observe(el, {
|
485
486
|
childList: !0,
|
486
487
|
subtree: !0
|
487
488
|
}), syncControllable(el, "input", hasSelectChanged, onChange);
|
488
489
|
}
|
489
|
-
function setSelectOptions(el,
|
490
|
-
if (Array.isArray(
|
490
|
+
function setSelectOptions(el, value, valueChange) {
|
491
|
+
if (Array.isArray(value))
|
491
492
|
for (let opt of el.options) {
|
492
|
-
let selected =
|
493
|
+
let selected = value.includes(opt.value);
|
493
494
|
valueChange ? opt.selected = selected : opt.defaultSelected = selected;
|
494
495
|
}
|
495
496
|
else {
|
496
|
-
let normalizedValue = normalizeStrProp(
|
497
|
+
let normalizedValue = normalizeStrProp(value);
|
497
498
|
if (valueChange)
|
498
499
|
el.value = normalizedValue;
|
499
500
|
else
|
@@ -501,10 +502,10 @@ function setSelectOptions(el, value2, valueChange) {
|
|
501
502
|
opt.defaultSelected = opt.value === normalizedValue;
|
502
503
|
}
|
503
504
|
}
|
504
|
-
function
|
505
|
+
function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
|
505
506
|
scope["e" /* ControlledHandler */ + nodeAccessor] = openChange, openChange ? scope["f" /* ControlledType */ + nodeAccessor] = 4 /* DetailsOrDialogOpen */ : scope["f" /* ControlledType */ + nodeAccessor] = 5 /* None */, scope[nodeAccessor].open = scope["g" /* ControlledValue */ + nodeAccessor] = normalizeBoolProp(open);
|
506
507
|
}
|
507
|
-
function
|
508
|
+
function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
508
509
|
let el = scope[nodeAccessor], hasChanged = () => el.open !== scope["g" /* ControlledValue */ + nodeAccessor];
|
509
510
|
syncControllable(
|
510
511
|
el,
|
@@ -520,13 +521,13 @@ function controllable_detailsOrDialog_open_effect(scope, nodeAccessor) {
|
|
520
521
|
);
|
521
522
|
}
|
522
523
|
var inputType = "";
|
523
|
-
function setValueAndUpdateSelection(el,
|
524
|
-
if (el.value !==
|
524
|
+
function setValueAndUpdateSelection(el, value) {
|
525
|
+
if (el.value !== value) {
|
525
526
|
let updatedPosition = resolveCursorPosition(
|
526
527
|
inputType,
|
527
528
|
el.getRootNode().activeElement === el && el.selectionStart,
|
528
529
|
el.value,
|
529
|
-
el.value =
|
530
|
+
el.value = value
|
530
531
|
);
|
531
532
|
~updatedPosition && el.setSelectionRange(updatedPosition, updatedPosition);
|
532
533
|
}
|
@@ -565,11 +566,11 @@ function hasSelectChanged(el) {
|
|
565
566
|
function hasFormElementChanged(el) {
|
566
567
|
return el.options ? hasSelectChanged(el) : hasValueChanged(el) || hasCheckboxChanged(el);
|
567
568
|
}
|
568
|
-
function normalizeStrProp(
|
569
|
-
return normalizeAttrValue(
|
569
|
+
function normalizeStrProp(value) {
|
570
|
+
return normalizeAttrValue(value) || "";
|
570
571
|
}
|
571
|
-
function normalizeBoolProp(
|
572
|
-
return
|
572
|
+
function normalizeBoolProp(value) {
|
573
|
+
return value != null && value !== !1;
|
573
574
|
}
|
574
575
|
function updateList(arr, val, push) {
|
575
576
|
let index = arr.indexOf(val);
|
@@ -581,9 +582,9 @@ function toValueProp(it) {
|
|
581
582
|
|
582
583
|
// src/dom/parse-html.ts
|
583
584
|
var parsers = {};
|
584
|
-
function parseHTML(
|
585
|
+
function parseHTML(html, ns) {
|
585
586
|
let parser = parsers[ns] ||= document.createElementNS(ns, "template");
|
586
|
-
return parser.innerHTML =
|
587
|
+
return parser.innerHTML = html, parser.content || parser;
|
587
588
|
}
|
588
589
|
|
589
590
|
// src/dom/schedule.ts
|
@@ -601,31 +602,31 @@ function triggerMacroTask() {
|
|
601
602
|
}
|
602
603
|
|
603
604
|
// src/dom/signals.ts
|
604
|
-
function
|
605
|
+
function _let(valueAccessor, fn) {
|
605
606
|
if (0)
|
606
607
|
var id;
|
607
|
-
let valueChangeAccessor = "o" /* TagVariableChange */ + valueAccessor, update = (scope,
|
608
|
-
scope[valueAccessor] !==
|
608
|
+
let valueChangeAccessor = "o" /* TagVariableChange */ + valueAccessor, update = (scope, value) => {
|
609
|
+
scope[valueAccessor] !== value && (scope[valueAccessor] = value, fn(scope, value));
|
609
610
|
};
|
610
|
-
return (scope,
|
611
|
+
return (scope, value, valueChange) => (rendering ? ((scope[valueChangeAccessor] = valueChange) && scope[valueAccessor] !== value || !(valueAccessor in scope)) && (scope[valueAccessor] = value, fn(scope, value)) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](value) : (schedule(), queueRender(
|
611
612
|
scope,
|
612
613
|
update,
|
613
614
|
valueAccessor,
|
614
|
-
|
615
|
-
)),
|
615
|
+
value
|
616
|
+
)), value);
|
616
617
|
}
|
617
|
-
function
|
618
|
+
function _const(valueAccessor, fn = () => {
|
618
619
|
}) {
|
619
|
-
return (scope,
|
620
|
-
(!(valueAccessor in scope) || scope[valueAccessor] !==
|
620
|
+
return (scope, value) => {
|
621
|
+
(!(valueAccessor in scope) || scope[valueAccessor] !== value) && (scope[valueAccessor] = value, fn(scope, value));
|
621
622
|
};
|
622
623
|
}
|
623
|
-
function
|
624
|
+
function _or(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "l") {
|
624
625
|
return (scope) => {
|
625
626
|
scope.q ? scope[id] === void 0 ? scope[id] = defaultPending : --scope[id] || fn(scope) : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
626
627
|
};
|
627
628
|
}
|
628
|
-
function
|
629
|
+
function _for_closure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
629
630
|
let childSignal = closure(valueAccessor, fn), loopScopeAccessor = "l" /* LoopScopeArray */ + ownerLoopNodeAccessor, loopScopeMapAccessor = "m" /* LoopScopeMap */ + ownerLoopNodeAccessor, ownerSignal = (ownerScope) => {
|
630
631
|
let scopes = ownerScope[loopScopeAccessor] ||= ownerScope[loopScopeMapAccessor] ? [...ownerScope[loopScopeMapAccessor].values()] : [], [firstScope] = scopes;
|
631
632
|
firstScope && queueRender(
|
@@ -641,7 +642,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
641
642
|
};
|
642
643
|
return ownerSignal._ = childSignal, ownerSignal;
|
643
644
|
}
|
644
|
-
function
|
645
|
+
function _if_closure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
|
645
646
|
let childSignal = closure(valueAccessor, fn), scopeAccessor = "d" /* ConditionalScope */ + ownerConditionalNodeAccessor, branchAccessor = "c" /* ConditionalRenderer */ + ownerConditionalNodeAccessor, ownerSignal = (scope) => {
|
646
647
|
let ifScope = scope[scopeAccessor];
|
647
648
|
ifScope && !ifScope.q && scope[branchAccessor] === branch && queueRender(ifScope, childSignal, -1);
|
@@ -650,12 +651,12 @@ function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch,
|
|
650
651
|
}
|
651
652
|
function subscribeToScopeSet(ownerScope, accessor, scope) {
|
652
653
|
let subscribers = ownerScope[accessor] ||= /* @__PURE__ */ new Set();
|
653
|
-
subscribers.has(scope) || (subscribers.add(scope),
|
654
|
+
subscribers.has(scope) || (subscribers.add(scope), $signal(scope, -1).addEventListener(
|
654
655
|
"abort",
|
655
656
|
() => ownerScope[accessor].delete(scope)
|
656
657
|
));
|
657
658
|
}
|
658
|
-
function
|
659
|
+
function _closure(...closureSignals) {
|
659
660
|
let [{ E: ___scopeInstancesAccessor, F: ___signalIndexAccessor }] = closureSignals;
|
660
661
|
for (let i = closureSignals.length; i--; )
|
661
662
|
closureSignals[i].L = i;
|
@@ -669,7 +670,7 @@ function dynamicClosure(...closureSignals) {
|
|
669
670
|
);
|
670
671
|
};
|
671
672
|
}
|
672
|
-
function
|
673
|
+
function _closure_get(valueAccessor, fn, getOwnerScope) {
|
673
674
|
let childSignal = closure(valueAccessor, fn, getOwnerScope), closureSignal = ((scope) => {
|
674
675
|
scope[closureSignal.F] = closureSignal.L, childSignal(scope), subscribeToScopeSet(
|
675
676
|
getOwnerScope ? getOwnerScope(scope) : scope._,
|
@@ -687,20 +688,20 @@ function closure(valueAccessor, fn, getOwnerScope) {
|
|
687
688
|
);
|
688
689
|
};
|
689
690
|
}
|
690
|
-
function
|
691
|
-
scope[childAccessor].e = (
|
691
|
+
function _var(scope, childAccessor, signal) {
|
692
|
+
scope[childAccessor].e = (value) => signal(scope, value);
|
692
693
|
}
|
693
|
-
var
|
694
|
-
function
|
694
|
+
var _return = (scope, value) => scope.e?.(value);
|
695
|
+
function _return_change(scope, changeHandler) {
|
695
696
|
scope.f = changeHandler;
|
696
697
|
}
|
697
|
-
var
|
698
|
-
function
|
698
|
+
var _var_change = (scope, value) => scope.f?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
699
|
+
function _id({ $global }) {
|
699
700
|
let id = tagIdsByGlobal.get($global) || 0;
|
700
701
|
return tagIdsByGlobal.set($global, id + 1), "c" + $global.runtimeId + $global.renderId + id.toString(36);
|
701
702
|
}
|
702
|
-
function
|
703
|
-
return
|
703
|
+
function _script(id, fn) {
|
704
|
+
return _resume(id, fn), (scope) => {
|
704
705
|
queueEffect(scope, fn);
|
705
706
|
};
|
706
707
|
}
|
@@ -711,7 +712,7 @@ function* traverseAllHoisted(scope, path, curIndex = path.length - 1) {
|
|
711
712
|
yield* traverseAllHoisted(s, path, curIndex);
|
712
713
|
else curIndex ? yield* traverseAllHoisted(scope[path[curIndex]], path, curIndex - 1) : yield scope[path[0]];
|
713
714
|
}
|
714
|
-
function
|
715
|
+
function _hoist(...path) {
|
715
716
|
return (scope) => {
|
716
717
|
let getOne = (...args) => iterator().next().value(...args), iterator = getOne[Symbol.iterator] = () => traverseAllHoisted(scope, path);
|
717
718
|
return getOne;
|
@@ -735,7 +736,7 @@ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
|
735
736
|
function setupBranch(renderer, branch) {
|
736
737
|
return renderer.D && queueRender(branch, renderer.D, -1), branch;
|
737
738
|
}
|
738
|
-
function
|
739
|
+
function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
|
739
740
|
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup = setup ? setup._ || setup : void 0, params ||= void 0;
|
740
741
|
let clone = template ? (branch, ns) => {
|
741
742
|
((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
|
@@ -758,27 +759,27 @@ function createContent(id, template, walks, setup, params, dynamicScopesAccessor
|
|
758
759
|
n: dynamicScopesAccessor
|
759
760
|
});
|
760
761
|
}
|
761
|
-
function
|
762
|
-
return
|
762
|
+
function _content_resume(id, template, walks, setup, params, dynamicScopesAccessor) {
|
763
|
+
return _resume(
|
763
764
|
id,
|
764
|
-
|
765
|
+
_content(id, template, walks, setup, params, dynamicScopesAccessor)
|
765
766
|
);
|
766
767
|
}
|
767
|
-
function
|
768
|
+
function _content_closures(renderer, closureFns) {
|
768
769
|
let closureSignals = {};
|
769
770
|
for (let key in closureFns)
|
770
|
-
closureSignals[key] =
|
771
|
+
closureSignals[key] = _const(key, closureFns[key]);
|
771
772
|
return (owner, closureValues) => {
|
772
773
|
let instance = renderer(owner);
|
773
774
|
return instance.G = closureSignals, instance.M = closureValues, instance;
|
774
775
|
};
|
775
776
|
}
|
776
|
-
function
|
777
|
-
return
|
777
|
+
function _content_branch(template, walks, setup, params) {
|
778
|
+
return _content("", template, walks, setup, params)();
|
778
779
|
}
|
779
780
|
var cloneCache = {};
|
780
|
-
function createCloneableHTML(
|
781
|
-
let { firstChild, lastChild } = parseHTML(
|
781
|
+
function createCloneableHTML(html, ns) {
|
782
|
+
let { firstChild, lastChild } = parseHTML(html, ns), parent = document.createElementNS(ns, "t");
|
782
783
|
return insertChildNodes(parent, null, firstChild, lastChild), firstChild === lastChild && firstChild.nodeType < 8 /* Comment */ ? (branch, walks) => {
|
783
784
|
walk(
|
784
785
|
branch.h = branch.j = firstChild.cloneNode(!0),
|
@@ -792,41 +793,41 @@ function createCloneableHTML(html2, ns) {
|
|
792
793
|
}
|
793
794
|
|
794
795
|
// src/dom/dom.ts
|
795
|
-
function
|
796
|
-
setAttribute(element, name, normalizeAttrValue(
|
796
|
+
function _attr(element, name, value) {
|
797
|
+
setAttribute(element, name, normalizeAttrValue(value));
|
797
798
|
}
|
798
|
-
function setAttribute(element, name,
|
799
|
-
element.getAttribute(name) !=
|
799
|
+
function setAttribute(element, name, value) {
|
800
|
+
element.getAttribute(name) != value && (value === void 0 ? element.removeAttribute(name) : element.setAttribute(name, value));
|
800
801
|
}
|
801
|
-
function
|
802
|
-
setAttribute(element, "class", classValue(
|
802
|
+
function _attr_class(element, value) {
|
803
|
+
setAttribute(element, "class", classValue(value) || void 0);
|
803
804
|
}
|
804
|
-
function
|
805
|
+
function _attr_class_items(element, items) {
|
805
806
|
for (let key in items)
|
806
|
-
|
807
|
+
_attr_class_item(element, key, items[key]);
|
807
808
|
}
|
808
|
-
function
|
809
|
-
element.classList.toggle(name, !!
|
809
|
+
function _attr_class_item(element, name, value) {
|
810
|
+
element.classList.toggle(name, !!value);
|
810
811
|
}
|
811
|
-
function
|
812
|
-
setAttribute(element, "style", styleValue(
|
812
|
+
function _attr_style(element, value) {
|
813
|
+
setAttribute(element, "style", styleValue(value) || void 0);
|
813
814
|
}
|
814
|
-
function
|
815
|
+
function _attr_style_items(element, items) {
|
815
816
|
for (let key in items)
|
816
|
-
|
817
|
+
_attr_style_item(element, key, items[key]);
|
817
818
|
}
|
818
|
-
function
|
819
|
-
element.style.setProperty(name,
|
819
|
+
function _attr_style_item(element, name, value) {
|
820
|
+
element.style.setProperty(name, value || value === 0 ? value + "" : "");
|
820
821
|
}
|
821
|
-
function
|
822
|
-
let normalizedValue = normalizeString(
|
822
|
+
function _text(node, value) {
|
823
|
+
let normalizedValue = normalizeString(value);
|
823
824
|
node.data !== normalizedValue && (node.data = normalizedValue);
|
824
825
|
}
|
825
|
-
function
|
826
|
-
let normalizedValue = normalizeString(
|
826
|
+
function _text_content(node, value) {
|
827
|
+
let normalizedValue = normalizeString(value);
|
827
828
|
node.textContent !== normalizedValue && (node.textContent = normalizedValue);
|
828
829
|
}
|
829
|
-
function
|
830
|
+
function _attrs(scope, nodeAccessor, nextAttrs) {
|
830
831
|
let el = scope[nodeAccessor];
|
831
832
|
for (let i = el.attributes.length; i--; ) {
|
832
833
|
let { name } = el.attributes.item(i);
|
@@ -834,13 +835,13 @@ function attrs(scope, nodeAccessor, nextAttrs) {
|
|
834
835
|
}
|
835
836
|
attrsInternal(scope, nodeAccessor, nextAttrs);
|
836
837
|
}
|
837
|
-
function
|
838
|
-
|
838
|
+
function _attrs_content(scope, nodeAccessor, nextAttrs) {
|
839
|
+
_attrs(scope, nodeAccessor, nextAttrs), _attr_content(scope, nodeAccessor, nextAttrs?.content);
|
839
840
|
}
|
840
|
-
function hasAttrAlias(element,
|
841
|
-
return
|
841
|
+
function hasAttrAlias(element, attr, nextAttrs) {
|
842
|
+
return attr === "checked" && element.tagName === "INPUT" && "checkedValue" in nextAttrs;
|
842
843
|
}
|
843
|
-
function
|
844
|
+
function _attrs_partial(scope, nodeAccessor, nextAttrs, skip) {
|
844
845
|
let el = scope[nodeAccessor], partial = {};
|
845
846
|
for (let i = el.attributes.length; i--; ) {
|
846
847
|
let { name } = el.attributes.item(i);
|
@@ -850,22 +851,22 @@ function partialAttrs(scope, nodeAccessor, nextAttrs, skip) {
|
|
850
851
|
skip[key] || (partial[key] = nextAttrs[key]);
|
851
852
|
attrsInternal(scope, nodeAccessor, partial);
|
852
853
|
}
|
853
|
-
function
|
854
|
-
|
854
|
+
function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip) {
|
855
|
+
_attrs_partial(scope, nodeAccessor, nextAttrs, skip), _attr_content(scope, nodeAccessor, nextAttrs?.content);
|
855
856
|
}
|
856
857
|
function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
857
858
|
let el = scope[nodeAccessor], events, skip;
|
858
859
|
switch (el.tagName) {
|
859
860
|
case "INPUT":
|
860
861
|
if ("checked" in nextAttrs || "checkedChange" in nextAttrs)
|
861
|
-
|
862
|
+
_attr_input_checked(
|
862
863
|
scope,
|
863
864
|
nodeAccessor,
|
864
865
|
nextAttrs.checked,
|
865
866
|
nextAttrs.checkedChange
|
866
867
|
);
|
867
868
|
else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs)
|
868
|
-
|
869
|
+
_attr_input_checkedValue(
|
869
870
|
scope,
|
870
871
|
nodeAccessor,
|
871
872
|
nextAttrs.checkedValue,
|
@@ -873,7 +874,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
873
874
|
nextAttrs.value
|
874
875
|
);
|
875
876
|
else if ("value" in nextAttrs || "valueChange" in nextAttrs)
|
876
|
-
|
877
|
+
_attr_input_value(
|
877
878
|
scope,
|
878
879
|
nodeAccessor,
|
879
880
|
nextAttrs.value,
|
@@ -884,7 +885,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
884
885
|
skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
885
886
|
break;
|
886
887
|
case "SELECT":
|
887
|
-
("value" in nextAttrs || "valueChange" in nextAttrs) && (
|
888
|
+
("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_select_value(
|
888
889
|
scope,
|
889
890
|
nodeAccessor,
|
890
891
|
nextAttrs.value,
|
@@ -892,7 +893,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
892
893
|
), skip = /^value(?:Change)?$/);
|
893
894
|
break;
|
894
895
|
case "TEXTAREA":
|
895
|
-
("value" in nextAttrs || "valueChange" in nextAttrs) && (
|
896
|
+
("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_input_value(
|
896
897
|
scope,
|
897
898
|
nodeAccessor,
|
898
899
|
nextAttrs.value,
|
@@ -901,7 +902,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
901
902
|
break;
|
902
903
|
case "DETAILS":
|
903
904
|
case "DIALOG":
|
904
|
-
("open" in nextAttrs || "openChange" in nextAttrs) && (
|
905
|
+
("open" in nextAttrs || "openChange" in nextAttrs) && (_attr_details_or_dialog_open(
|
905
906
|
scope,
|
906
907
|
nodeAccessor,
|
907
908
|
nextAttrs.open,
|
@@ -910,54 +911,54 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
910
911
|
break;
|
911
912
|
}
|
912
913
|
for (let name in nextAttrs) {
|
913
|
-
let
|
914
|
+
let value = nextAttrs[name];
|
914
915
|
switch (name) {
|
915
916
|
case "class":
|
916
|
-
|
917
|
+
_attr_class(el, value);
|
917
918
|
break;
|
918
919
|
case "style":
|
919
|
-
|
920
|
+
_attr_style(el, value);
|
920
921
|
break;
|
921
922
|
default: {
|
922
|
-
isEventHandler(name) ? (events ||= scope["i" /* EventAttributes */ + nodeAccessor] = {})[getEventHandlerName(name)] =
|
923
|
+
isEventHandler(name) ? (events ||= scope["i" /* EventAttributes */ + nodeAccessor] = {})[getEventHandlerName(name)] = value : skip?.test(name) || name === "content" && el.tagName !== "META" || _attr(el, name, value);
|
923
924
|
break;
|
924
925
|
}
|
925
926
|
}
|
926
927
|
}
|
927
928
|
}
|
928
|
-
function
|
929
|
-
let content = normalizeClientRender(
|
929
|
+
function _attr_content(scope, nodeAccessor, value) {
|
930
|
+
let content = normalizeClientRender(value), rendererAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
930
931
|
scope[rendererAccessor] !== (scope[rendererAccessor] = content?.l) && (setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch), content?.n && subscribeToScopeSet(
|
931
932
|
content.u,
|
932
933
|
content.n,
|
933
934
|
scope["d" /* ConditionalScope */ + nodeAccessor]
|
934
935
|
));
|
935
936
|
}
|
936
|
-
function
|
937
|
+
function _attrs_script(scope, nodeAccessor) {
|
937
938
|
let el = scope[nodeAccessor], events = scope["i" /* EventAttributes */ + nodeAccessor];
|
938
939
|
switch (scope["f" /* ControlledType */ + nodeAccessor]) {
|
939
940
|
case 0 /* InputChecked */:
|
940
|
-
|
941
|
+
_attr_input_checked_script(scope, nodeAccessor);
|
941
942
|
break;
|
942
943
|
case 1 /* InputCheckedValue */:
|
943
|
-
|
944
|
+
_attr_input_checkedValue_script(scope, nodeAccessor);
|
944
945
|
break;
|
945
946
|
case 2 /* InputValue */:
|
946
|
-
|
947
|
+
_attr_input_value_script(scope, nodeAccessor);
|
947
948
|
break;
|
948
949
|
case 3 /* SelectValue */:
|
949
|
-
|
950
|
+
_attr_select_value_script(scope, nodeAccessor);
|
950
951
|
break;
|
951
952
|
case 4 /* DetailsOrDialogOpen */:
|
952
|
-
|
953
|
+
_attr_details_or_dialog_open_script(scope, nodeAccessor);
|
953
954
|
break;
|
954
955
|
}
|
955
956
|
for (let name in events)
|
956
|
-
|
957
|
+
_on(el, name, events[name]);
|
957
958
|
}
|
958
|
-
function
|
959
|
+
function _html(scope, value, accessor) {
|
959
960
|
let firstChild = scope[accessor], parentNode = firstChild.parentNode, lastChild = scope["h" /* DynamicPlaceholderLastChild */ + accessor] || firstChild, newContent = parseHTML(
|
960
|
-
|
961
|
+
value || value === 0 ? value + "" : "",
|
961
962
|
parentNode.namespaceURI
|
962
963
|
);
|
963
964
|
insertChildNodes(
|
@@ -967,33 +968,21 @@ function html(scope, value2, accessor) {
|
|
967
968
|
scope["h" /* DynamicPlaceholderLastChild */ + accessor] = newContent.lastChild
|
968
969
|
), removeChildNodes(firstChild, lastChild);
|
969
970
|
}
|
970
|
-
function normalizeClientRender(
|
971
|
-
let renderer = normalizeDynamicRenderer(
|
971
|
+
function normalizeClientRender(value) {
|
972
|
+
let renderer = normalizeDynamicRenderer(value);
|
972
973
|
if (renderer && renderer.l)
|
973
974
|
return renderer;
|
974
975
|
}
|
975
|
-
function
|
976
|
-
|
977
|
-
|
978
|
-
for (let name in prevProps)
|
979
|
-
name in nextProps || (node[name] = void 0);
|
980
|
-
for (let name in nextProps)
|
981
|
-
node[name] = nextProps[name];
|
982
|
-
scope[index + "-"] = nextProps;
|
976
|
+
function normalizeAttrValue(value) {
|
977
|
+
if (value || value === 0)
|
978
|
+
return value === !0 ? "" : value + "";
|
983
979
|
}
|
984
|
-
function
|
985
|
-
|
986
|
-
return value2 === !0 ? "" : value2 + "";
|
980
|
+
function normalizeString(value) {
|
981
|
+
return value || value === 0 ? value + "" : "\u200D";
|
987
982
|
}
|
988
|
-
function
|
989
|
-
return value2 || value2 === 0 ? value2 + "" : "\u200D";
|
990
|
-
}
|
991
|
-
function lifecycle(scope, index, thisObj) {
|
983
|
+
function _lifecycle(scope, index, thisObj) {
|
992
984
|
let instance = scope[index];
|
993
|
-
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[index] = thisObj, thisObj.onMount?.(),
|
994
|
-
scope,
|
995
|
-
"k" /* LifecycleAbortController */ + index
|
996
|
-
).onabort = () => thisObj.onDestroy?.());
|
985
|
+
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[index] = thisObj, thisObj.onMount?.(), $signal(scope, "k" /* LifecycleAbortController */ + index).onabort = () => thisObj.onDestroy?.());
|
997
986
|
}
|
998
987
|
function removeChildNodes(startNode, endNode) {
|
999
988
|
let stop = endNode.nextSibling, current = startNode;
|
@@ -1091,7 +1080,7 @@ function longestIncreasingSubsequence(a) {
|
|
1091
1080
|
}
|
1092
1081
|
|
1093
1082
|
// src/dom/control-flow.ts
|
1094
|
-
function
|
1083
|
+
function _await(nodeAccessor, renderer) {
|
1095
1084
|
let promiseAccessor = "n" /* Promise */ + nodeAccessor, branchAccessor = "d" /* ConditionalScope */ + nodeAccessor;
|
1096
1085
|
return (scope, promise) => {
|
1097
1086
|
let referenceNode = scope[nodeAccessor], tryWithPlaceholder = findBranchWithKey(
|
@@ -1124,7 +1113,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1124
1113
|
awaitBranch.h
|
1125
1114
|
), tempDetachBranch(awaitBranch));
|
1126
1115
|
let thisPromise = scope[promiseAccessor] = promise.then(
|
1127
|
-
(
|
1116
|
+
(data) => {
|
1128
1117
|
thisPromise === scope[promiseAccessor] && (scope[promiseAccessor] = 0, schedule(), queueRender(
|
1129
1118
|
scope,
|
1130
1119
|
() => {
|
@@ -1139,7 +1128,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1139
1128
|
),
|
1140
1129
|
referenceNode.parentNode,
|
1141
1130
|
referenceNode
|
1142
|
-
), referenceNode.remove()), renderer.m?.(awaitBranch, [
|
1131
|
+
), referenceNode.remove()), renderer.m?.(awaitBranch, [data]), tryWithPlaceholder && (placeholderShown.add(pendingEffects), !--tryWithPlaceholder.o)) {
|
1143
1132
|
let placeholderBranch = tryWithPlaceholder.c;
|
1144
1133
|
tryWithPlaceholder.c = 0, placeholderBranch && (placeholderBranch.h.parentNode.insertBefore(
|
1145
1134
|
tryWithPlaceholder.h.parentNode,
|
@@ -1156,13 +1145,13 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1156
1145
|
);
|
1157
1146
|
};
|
1158
1147
|
}
|
1159
|
-
function
|
1148
|
+
function _try(nodeAccessor, content) {
|
1160
1149
|
let branchAccessor = "d" /* ConditionalScope */ + nodeAccessor;
|
1161
1150
|
return (scope, input) => {
|
1162
1151
|
scope[branchAccessor] || setConditionalRenderer(
|
1163
1152
|
scope,
|
1164
1153
|
nodeAccessor,
|
1165
|
-
|
1154
|
+
content,
|
1166
1155
|
createAndSetupBranch
|
1167
1156
|
);
|
1168
1157
|
let branch = scope[branchAccessor];
|
@@ -1187,7 +1176,7 @@ function renderCatch(scope, error) {
|
|
1187
1176
|
} else
|
1188
1177
|
throw error;
|
1189
1178
|
}
|
1190
|
-
function
|
1179
|
+
function _if(nodeAccessor, ...branches) {
|
1191
1180
|
let branchAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
1192
1181
|
return enableBranches(), (scope, newBranch) => {
|
1193
1182
|
newBranch !== scope[branchAccessor] && setConditionalRenderer(
|
@@ -1199,9 +1188,9 @@ function conditional(nodeAccessor, ...branches) {
|
|
1199
1188
|
};
|
1200
1189
|
}
|
1201
1190
|
function patchDynamicTag(fn) {
|
1202
|
-
|
1191
|
+
_dynamic_tag = fn(_dynamic_tag);
|
1203
1192
|
}
|
1204
|
-
var
|
1193
|
+
var _dynamic_tag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
1205
1194
|
let childScopeAccessor = "d" /* ConditionalScope */ + nodeAccessor, rendererAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
1206
1195
|
return enableBranches(), (scope, newRenderer, getInput) => {
|
1207
1196
|
let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
|
@@ -1211,7 +1200,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1211
1200
|
nodeAccessor,
|
1212
1201
|
normalizedRenderer || (getContent ? getContent(scope) : void 0),
|
1213
1202
|
createBranchWithTagNameOrRenderer
|
1214
|
-
), getTagVar &&
|
1203
|
+
), getTagVar && _var(scope, childScopeAccessor, getTagVar()), typeof normalizedRenderer == "string") {
|
1215
1204
|
if (getContent) {
|
1216
1205
|
let content = getContent(scope);
|
1217
1206
|
setConditionalRenderer(
|
@@ -1233,7 +1222,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1233
1222
|
if (normalizedRenderer) {
|
1234
1223
|
let childScope = scope[childScopeAccessor], args = getInput?.();
|
1235
1224
|
if (typeof normalizedRenderer == "string")
|
1236
|
-
(getContent ?
|
1225
|
+
(getContent ? _attrs : _attrs_content)(
|
1237
1226
|
childScope,
|
1238
1227
|
0,
|
1239
1228
|
(inputIsArgs ? args[0] : args) || {}
|
@@ -1265,7 +1254,7 @@ function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2)
|
|
1265
1254
|
let referenceNode = scope[nodeAccessor], prevBranch = scope["d" /* ConditionalScope */ + nodeAccessor], parentNode = referenceNode.nodeType > 1 /* Element */ ? (prevBranch?.h || referenceNode).parentNode : referenceNode, newBranch = scope["d" /* ConditionalScope */ + nodeAccessor] = newRenderer && createBranch2(scope.$global, newRenderer, scope, parentNode);
|
1266
1255
|
referenceNode === parentNode ? (prevBranch && (destroyBranch(prevBranch), referenceNode.textContent = ""), newBranch && insertBranchBefore(newBranch, parentNode, null)) : prevBranch ? (newBranch ? insertBranchBefore(newBranch, parentNode, prevBranch.h) : parentNode.insertBefore(referenceNode, prevBranch.h), removeAndDestroyBranch(prevBranch)) : newBranch && (insertBranchBefore(newBranch, parentNode, referenceNode), referenceNode.remove());
|
1267
1256
|
}
|
1268
|
-
function
|
1257
|
+
function _for_of(nodeAccessor, renderer) {
|
1269
1258
|
return loop(
|
1270
1259
|
nodeAccessor,
|
1271
1260
|
renderer,
|
@@ -1277,14 +1266,14 @@ function loopOf(nodeAccessor, renderer) {
|
|
1277
1266
|
}
|
1278
1267
|
);
|
1279
1268
|
}
|
1280
|
-
function
|
1269
|
+
function _for_in(nodeAccessor, renderer) {
|
1281
1270
|
return loop(
|
1282
1271
|
nodeAccessor,
|
1283
1272
|
renderer,
|
1284
|
-
([obj, by = byFirstArg], cb) => forIn(obj, (key,
|
1273
|
+
([obj, by = byFirstArg], cb) => forIn(obj, (key, value) => cb(by(key, value), [key, value]))
|
1285
1274
|
);
|
1286
1275
|
}
|
1287
|
-
function
|
1276
|
+
function _for_to(nodeAccessor, renderer) {
|
1288
1277
|
return loop(
|
1289
1278
|
nodeAccessor,
|
1290
1279
|
renderer,
|
@@ -1293,11 +1282,11 @@ function loopTo(nodeAccessor, renderer) {
|
|
1293
1282
|
}
|
1294
1283
|
function loop(nodeAccessor, renderer, forEach) {
|
1295
1284
|
let params = renderer.m;
|
1296
|
-
return enableBranches(), (scope,
|
1285
|
+
return enableBranches(), (scope, value) => {
|
1297
1286
|
let referenceNode = scope[nodeAccessor], oldMap = scope["m" /* LoopScopeMap */ + nodeAccessor], oldArray = oldMap ? scope["l" /* LoopScopeArray */ + nodeAccessor] || [
|
1298
1287
|
...oldMap.values()
|
1299
1288
|
] : [], parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].h.parentNode : referenceNode, newMap = scope["m" /* LoopScopeMap */ + nodeAccessor] = /* @__PURE__ */ new Map(), newArray = scope["l" /* LoopScopeArray */ + nodeAccessor] = [];
|
1300
|
-
forEach(
|
1289
|
+
forEach(value, (key, args) => {
|
1301
1290
|
let branch = oldMap?.get(key) || createAndSetupBranch(scope.$global, renderer, scope, parentNode);
|
1302
1291
|
params?.(branch, args), newMap.set(key, branch), newArray.push(branch);
|
1303
1292
|
});
|
@@ -1326,16 +1315,16 @@ function byFirstArg(name) {
|
|
1326
1315
|
|
1327
1316
|
// src/dom/queue.ts
|
1328
1317
|
var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), caughtError = /* @__PURE__ */ new WeakSet(), placeholderShown = /* @__PURE__ */ new WeakSet(), pendingEffects = [], pendingScopes = [], rendering, scopeKeyOffset = 1e3;
|
1329
|
-
function queueRender(scope, signal, signalKey,
|
1318
|
+
function queueRender(scope, signal, signalKey, value, scopeKey = scope.l) {
|
1330
1319
|
let key = scopeKey * scopeKeyOffset + signalKey, existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
|
1331
1320
|
if (existingRender)
|
1332
|
-
existingRender.I =
|
1321
|
+
existingRender.I = value;
|
1333
1322
|
else {
|
1334
1323
|
let render = {
|
1335
1324
|
x: key,
|
1336
1325
|
t: scope,
|
1337
1326
|
N: signal,
|
1338
|
-
I:
|
1327
|
+
I: value
|
1339
1328
|
}, i = pendingRenders.push(render) - 1;
|
1340
1329
|
for (; i; ) {
|
1341
1330
|
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
@@ -1393,8 +1382,8 @@ function runRenders() {
|
|
1393
1382
|
scope.q = 0;
|
1394
1383
|
pendingScopes = [];
|
1395
1384
|
}
|
1396
|
-
var runRender = (render) => render.N(render.t, render.I),
|
1397
|
-
|
1385
|
+
var runRender = (render) => render.N(render.t, render.I), _enable_catch = () => {
|
1386
|
+
_enable_catch = () => {
|
1398
1387
|
}, enableBranches();
|
1399
1388
|
let handlePendingTry = (fn, scope, branch) => {
|
1400
1389
|
for (; branch; ) {
|
@@ -1420,11 +1409,11 @@ var runRender = (render) => render.N(render.t, render.I), enableCatch = () => {
|
|
1420
1409
|
};
|
1421
1410
|
|
1422
1411
|
// src/dom/abort-signal.ts
|
1423
|
-
function
|
1412
|
+
function $signalReset(scope, id) {
|
1424
1413
|
let ctrl = scope.z?.[id];
|
1425
1414
|
ctrl && (queueEffect(ctrl, abort), scope.z[id] = void 0);
|
1426
1415
|
}
|
1427
|
-
function
|
1416
|
+
function $signal(scope, id) {
|
1428
1417
|
return scope.k && (scope.k.J ||= /* @__PURE__ */ new Set()).add(scope), ((scope.z ||= {})[id] ||= new AbortController()).signal;
|
1429
1418
|
}
|
1430
1419
|
function abort(ctrl) {
|
@@ -1439,12 +1428,12 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1439
1428
|
patchDynamicTag,
|
1440
1429
|
queueEffect,
|
1441
1430
|
init(warp10Noop) {
|
1442
|
-
|
1431
|
+
_resume(SET_SCOPE_REGISTER_ID, (branch) => {
|
1443
1432
|
classIdToBranch.set(branch.m5c, branch);
|
1444
|
-
}),
|
1433
|
+
}), _resume(RENDER_BODY_ID, warp10Noop);
|
1445
1434
|
},
|
1446
1435
|
registerRenderer(fn) {
|
1447
|
-
|
1436
|
+
_resume(RENDERER_REGISTER_ID, fn);
|
1448
1437
|
},
|
1449
1438
|
isRenderer(renderer) {
|
1450
1439
|
return renderer.C;
|
@@ -1461,14 +1450,14 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1461
1450
|
runComponentDestroy() {
|
1462
1451
|
this.scope && destroyBranch(this.scope);
|
1463
1452
|
},
|
1464
|
-
resolveRegistered(
|
1465
|
-
return Array.isArray(
|
1466
|
-
|
1467
|
-
|
1468
|
-
) :
|
1453
|
+
resolveRegistered(value, $global) {
|
1454
|
+
return Array.isArray(value) && typeof value[0] == "string" ? getRegisteredWithScope(
|
1455
|
+
value[0],
|
1456
|
+
value.length === 2 && self[$global.runtimeId]?.[$global.renderId]?.s[value[1]]
|
1457
|
+
) : value;
|
1469
1458
|
},
|
1470
1459
|
createRenderer(params, clone) {
|
1471
|
-
let renderer =
|
1460
|
+
let renderer = _content_branch(0, 0, 0, params);
|
1472
1461
|
return renderer.C = (branch) => {
|
1473
1462
|
let cloned = clone();
|
1474
1463
|
branch.h = cloned.startNode, branch.j = cloned.endNode;
|
@@ -1494,15 +1483,15 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1494
1483
|
};
|
1495
1484
|
|
1496
1485
|
// src/dom/template.ts
|
1497
|
-
var
|
1498
|
-
let renderer =
|
1486
|
+
var _template = (id, template, walks, setup, inputSignal) => {
|
1487
|
+
let renderer = _content(
|
1499
1488
|
id,
|
1500
1489
|
template,
|
1501
1490
|
walks,
|
1502
1491
|
setup,
|
1503
1492
|
inputSignal
|
1504
1493
|
)();
|
1505
|
-
return renderer.mount = mount, renderer._ = renderer,
|
1494
|
+
return renderer.mount = mount, renderer._ = renderer, _resume(id, renderer);
|
1506
1495
|
};
|
1507
1496
|
function mount(input = {}, reference, position) {
|
1508
1497
|
let branch, parentNode = reference, nextSibling = null, { $global } = input;
|
@@ -1546,7 +1535,7 @@ function mount(input = {}, reference, position) {
|
|
1546
1535
|
return curValue;
|
1547
1536
|
},
|
1548
1537
|
set value(newValue) {
|
1549
|
-
|
1538
|
+
_var_change(branch, newValue);
|
1550
1539
|
},
|
1551
1540
|
update(newInput) {
|
1552
1541
|
args && runEffects(
|