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.mjs
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
// src/common/attr-tag.ts
|
2
2
|
var empty = [], rest = Symbol();
|
3
|
-
function attrTag(
|
4
|
-
return
|
3
|
+
function attrTag(attrs) {
|
4
|
+
return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
|
5
5
|
}
|
6
|
-
function attrTags(first,
|
7
|
-
return first ? (first[rest] === empty ? first[rest] = [
|
6
|
+
function attrTags(first, attrs) {
|
7
|
+
return first ? (first[rest] === empty ? first[rest] = [attrs] : first[rest].push(attrs), first) : attrTag(attrs);
|
8
8
|
}
|
9
9
|
function* attrTagIterator() {
|
10
10
|
yield this, yield* this[rest];
|
@@ -32,14 +32,14 @@ function forTo(to, from, step, cb) {
|
|
32
32
|
function classValue(classValue2) {
|
33
33
|
return toDelimitedString(classValue2, " ", stringifyClassObject);
|
34
34
|
}
|
35
|
-
function stringifyClassObject(name,
|
36
|
-
return
|
35
|
+
function stringifyClassObject(name, value) {
|
36
|
+
return value ? name : "";
|
37
37
|
}
|
38
38
|
function styleValue(styleValue2) {
|
39
39
|
return toDelimitedString(styleValue2, ";", stringifyStyleObject);
|
40
40
|
}
|
41
|
-
function stringifyStyleObject(name,
|
42
|
-
return
|
41
|
+
function stringifyStyleObject(name, value) {
|
42
|
+
return value || value === 0 ? name + ":" + value : "";
|
43
43
|
}
|
44
44
|
function toDelimitedString(val, delimiter, stringify) {
|
45
45
|
let str = "", sep = "", part;
|
@@ -60,13 +60,13 @@ function isEventHandler(name) {
|
|
60
60
|
function getEventHandlerName(name) {
|
61
61
|
return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
|
62
62
|
}
|
63
|
-
function normalizeDynamicRenderer(
|
64
|
-
return
|
63
|
+
function normalizeDynamicRenderer(value) {
|
64
|
+
return value ? value.content || value.default || value : void 0;
|
65
65
|
}
|
66
66
|
|
67
67
|
// src/dom/event.ts
|
68
68
|
var defaultDelegator = createDelegator();
|
69
|
-
function
|
69
|
+
function _on(element, type, handler) {
|
70
70
|
element["$" + type] === void 0 && defaultDelegator(element, type, handleDelegated), element["$" + type] = handler || null;
|
71
71
|
}
|
72
72
|
function createDelegator() {
|
@@ -158,36 +158,36 @@ function walk(startNode, walkCodes, branch) {
|
|
158
158
|
walker.currentNode = startNode, walkInternal(0, walkCodes, branch);
|
159
159
|
}
|
160
160
|
function walkInternal(currentWalkIndex, walkCodes, scope) {
|
161
|
-
let
|
161
|
+
let value, storedMultiplier = 0, currentMultiplier = 0, currentScopeIndex = 0;
|
162
162
|
for (; currentWalkIndex < walkCodes.length; )
|
163
|
-
if (
|
163
|
+
if (value = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value === 32 /* Get */) {
|
164
164
|
let node = walker.currentNode;
|
165
165
|
scope[currentScopeIndex] = node, scope["j" /* Getter */ + currentScopeIndex++] = () => node;
|
166
|
-
} else if (
|
166
|
+
} else if (value === 37 /* Replace */ || value === 49 /* DynamicTagWithVar */)
|
167
167
|
walker.currentNode.replaceWith(
|
168
168
|
walker.currentNode = scope[currentScopeIndex++] = new Text()
|
169
|
-
),
|
169
|
+
), value === 49 /* DynamicTagWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
|
170
170
|
else {
|
171
|
-
if (
|
171
|
+
if (value === 38 /* EndChild */)
|
172
172
|
return currentWalkIndex;
|
173
|
-
if (
|
173
|
+
if (value === 47 /* BeginChild */ || value === 48 /* BeginChildWithVar */)
|
174
174
|
currentWalkIndex = walkInternal(
|
175
175
|
currentWalkIndex,
|
176
176
|
walkCodes,
|
177
177
|
scope[currentScopeIndex++] = createScope(scope.$global, scope.k)
|
178
|
-
),
|
179
|
-
else if (
|
180
|
-
for (
|
178
|
+
), value === 48 /* BeginChildWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
|
179
|
+
else if (value < 92)
|
180
|
+
for (value = 20 /* Next */ * currentMultiplier + value - 67 /* Next */; value--; )
|
181
181
|
walker.nextNode();
|
182
|
-
else if (
|
183
|
-
for (
|
182
|
+
else if (value < 107)
|
183
|
+
for (value = 10 /* Over */ * currentMultiplier + value - 97 /* Over */; value--; )
|
184
184
|
walker.nextSibling();
|
185
|
-
else if (
|
186
|
-
for (
|
185
|
+
else if (value < 117) {
|
186
|
+
for (value = 10 /* Out */ * currentMultiplier + value - 107 /* Out */; value--; )
|
187
187
|
walker.parentNode();
|
188
188
|
walker.nextSibling();
|
189
189
|
} else
|
190
|
-
storedMultiplier = currentMultiplier * 10 /* Multiplier */ +
|
190
|
+
storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value - 117 /* Multiplier */;
|
191
191
|
}
|
192
192
|
}
|
193
193
|
|
@@ -287,22 +287,22 @@ function init(runtimeId = "M") {
|
|
287
287
|
});
|
288
288
|
}
|
289
289
|
var isResuming;
|
290
|
-
function
|
290
|
+
function _resume(id, obj) {
|
291
291
|
return registeredValues[id] = obj, obj;
|
292
292
|
}
|
293
|
-
function
|
294
|
-
return registeredValues[id] = (scope) => (
|
293
|
+
function _var_resume(id, signal) {
|
294
|
+
return registeredValues[id] = (scope) => (value) => signal(scope, value), signal;
|
295
295
|
}
|
296
296
|
function getRegisteredWithScope(id, scope) {
|
297
297
|
let val = registeredValues[id];
|
298
298
|
return scope ? val(scope) : val;
|
299
299
|
}
|
300
|
-
function
|
301
|
-
return
|
300
|
+
function _el(id, key) {
|
301
|
+
return _resume(id, (scope) => () => scope[key]());
|
302
302
|
}
|
303
303
|
|
304
304
|
// src/dom/controllable.ts
|
305
|
-
function
|
305
|
+
function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
|
306
306
|
setCheckboxValue(
|
307
307
|
scope,
|
308
308
|
nodeAccessor,
|
@@ -311,7 +311,7 @@ function controllable_input_checked(scope, nodeAccessor, checked, checkedChange)
|
|
311
311
|
checkedChange
|
312
312
|
);
|
313
313
|
}
|
314
|
-
function
|
314
|
+
function _attr_input_checked_script(scope, nodeAccessor) {
|
315
315
|
let el = scope[nodeAccessor];
|
316
316
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
317
317
|
let checkedChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
@@ -321,16 +321,16 @@ function controllable_input_checked_effect(scope, nodeAccessor) {
|
|
321
321
|
}
|
322
322
|
});
|
323
323
|
}
|
324
|
-
function
|
325
|
-
scope["g" /* ControlledValue */ + nodeAccessor] = checkedValue,
|
324
|
+
function _attr_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValueChange, value) {
|
325
|
+
scope["g" /* ControlledValue */ + nodeAccessor] = checkedValue, _attr(scope[nodeAccessor], "value", value), setCheckboxValue(
|
326
326
|
scope,
|
327
327
|
nodeAccessor,
|
328
328
|
1 /* InputCheckedValue */,
|
329
|
-
Array.isArray(checkedValue) ? checkedValue.includes(
|
329
|
+
Array.isArray(checkedValue) ? checkedValue.includes(value) : checkedValue === value,
|
330
330
|
checkedValueChange
|
331
331
|
);
|
332
332
|
}
|
333
|
-
function
|
333
|
+
function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
334
334
|
let el = scope[nodeAccessor];
|
335
335
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
336
336
|
let checkedValueChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
@@ -347,11 +347,11 @@ function controllable_input_checkedValue_effect(scope, nodeAccessor) {
|
|
347
347
|
}
|
348
348
|
});
|
349
349
|
}
|
350
|
-
function
|
351
|
-
let el = scope[nodeAccessor], normalizedValue = normalizeStrProp(
|
352
|
-
scope["e" /* ControlledHandler */ + nodeAccessor] = valueChange, valueChange ? (scope["f" /* ControlledType */ + nodeAccessor] = 0 /* InputChecked */, scope["g" /* ControlledValue */ + nodeAccessor] =
|
350
|
+
function _attr_input_value(scope, nodeAccessor, value, valueChange) {
|
351
|
+
let el = scope[nodeAccessor], normalizedValue = normalizeStrProp(value);
|
352
|
+
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);
|
353
353
|
}
|
354
|
-
function
|
354
|
+
function _attr_input_value_script(scope, nodeAccessor) {
|
355
355
|
let el = scope[nodeAccessor];
|
356
356
|
isResuming && (scope["g" /* ControlledValue */ + nodeAccessor] = el.defaultValue), syncControllable(el, "input", hasValueChanged, (ev) => {
|
357
357
|
let valueChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
@@ -361,17 +361,17 @@ function controllable_input_value_effect(scope, nodeAccessor) {
|
|
361
361
|
), inputType = "");
|
362
362
|
});
|
363
363
|
}
|
364
|
-
function
|
365
|
-
scope["e" /* ControlledHandler */ + nodeAccessor] = valueChange, valueChange ? (scope["f" /* ControlledType */ + nodeAccessor] = 3 /* SelectValue */, scope["g" /* ControlledValue */ + nodeAccessor] =
|
364
|
+
function _attr_select_value(scope, nodeAccessor, value, valueChange) {
|
365
|
+
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(
|
366
366
|
() => setSelectOptions(
|
367
367
|
scope[nodeAccessor],
|
368
|
-
|
368
|
+
value,
|
369
369
|
valueChange
|
370
370
|
),
|
371
371
|
scope
|
372
372
|
);
|
373
373
|
}
|
374
|
-
function
|
374
|
+
function _attr_select_value_script(scope, nodeAccessor) {
|
375
375
|
let el = scope[nodeAccessor], onChange = () => {
|
376
376
|
let valueChange = scope["e" /* ControlledHandler */ + nodeAccessor];
|
377
377
|
if (valueChange) {
|
@@ -386,21 +386,21 @@ function controllable_select_value_effect(scope, nodeAccessor) {
|
|
386
386
|
}
|
387
387
|
};
|
388
388
|
el._ || new MutationObserver(() => {
|
389
|
-
let
|
390
|
-
(Array.isArray(
|
389
|
+
let value = scope["g" /* ControlledValue */ + nodeAccessor];
|
390
|
+
(Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((value2, i) => value2 != el.selectedOptions[i].value) : el.value != value) && onChange();
|
391
391
|
}).observe(el, {
|
392
392
|
childList: !0,
|
393
393
|
subtree: !0
|
394
394
|
}), syncControllable(el, "input", hasSelectChanged, onChange);
|
395
395
|
}
|
396
|
-
function setSelectOptions(el,
|
397
|
-
if (Array.isArray(
|
396
|
+
function setSelectOptions(el, value, valueChange) {
|
397
|
+
if (Array.isArray(value))
|
398
398
|
for (let opt of el.options) {
|
399
|
-
let selected =
|
399
|
+
let selected = value.includes(opt.value);
|
400
400
|
valueChange ? opt.selected = selected : opt.defaultSelected = selected;
|
401
401
|
}
|
402
402
|
else {
|
403
|
-
let normalizedValue = normalizeStrProp(
|
403
|
+
let normalizedValue = normalizeStrProp(value);
|
404
404
|
if (valueChange)
|
405
405
|
el.value = normalizedValue;
|
406
406
|
else
|
@@ -408,10 +408,10 @@ function setSelectOptions(el, value2, valueChange) {
|
|
408
408
|
opt.defaultSelected = opt.value === normalizedValue;
|
409
409
|
}
|
410
410
|
}
|
411
|
-
function
|
411
|
+
function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
|
412
412
|
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);
|
413
413
|
}
|
414
|
-
function
|
414
|
+
function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
|
415
415
|
let el = scope[nodeAccessor], hasChanged = () => el.open !== scope["g" /* ControlledValue */ + nodeAccessor];
|
416
416
|
syncControllable(
|
417
417
|
el,
|
@@ -427,13 +427,13 @@ function controllable_detailsOrDialog_open_effect(scope, nodeAccessor) {
|
|
427
427
|
);
|
428
428
|
}
|
429
429
|
var inputType = "";
|
430
|
-
function setValueAndUpdateSelection(el,
|
431
|
-
if (el.value !==
|
430
|
+
function setValueAndUpdateSelection(el, value) {
|
431
|
+
if (el.value !== value) {
|
432
432
|
let updatedPosition = resolveCursorPosition(
|
433
433
|
inputType,
|
434
434
|
el.getRootNode().activeElement === el && el.selectionStart,
|
435
435
|
el.value,
|
436
|
-
el.value =
|
436
|
+
el.value = value
|
437
437
|
);
|
438
438
|
~updatedPosition && el.setSelectionRange(updatedPosition, updatedPosition);
|
439
439
|
}
|
@@ -472,11 +472,11 @@ function hasSelectChanged(el) {
|
|
472
472
|
function hasFormElementChanged(el) {
|
473
473
|
return el.options ? hasSelectChanged(el) : hasValueChanged(el) || hasCheckboxChanged(el);
|
474
474
|
}
|
475
|
-
function normalizeStrProp(
|
476
|
-
return normalizeAttrValue(
|
475
|
+
function normalizeStrProp(value) {
|
476
|
+
return normalizeAttrValue(value) || "";
|
477
477
|
}
|
478
|
-
function normalizeBoolProp(
|
479
|
-
return
|
478
|
+
function normalizeBoolProp(value) {
|
479
|
+
return value != null && value !== !1;
|
480
480
|
}
|
481
481
|
function updateList(arr, val, push) {
|
482
482
|
let index = arr.indexOf(val);
|
@@ -488,9 +488,9 @@ function toValueProp(it) {
|
|
488
488
|
|
489
489
|
// src/dom/parse-html.ts
|
490
490
|
var parsers = {};
|
491
|
-
function parseHTML(
|
491
|
+
function parseHTML(html, ns) {
|
492
492
|
let parser = parsers[ns] ||= document.createElementNS(ns, "template");
|
493
|
-
return parser.innerHTML =
|
493
|
+
return parser.innerHTML = html, parser.content || parser;
|
494
494
|
}
|
495
495
|
|
496
496
|
// src/dom/schedule.ts
|
@@ -508,31 +508,31 @@ function triggerMacroTask() {
|
|
508
508
|
}
|
509
509
|
|
510
510
|
// src/dom/signals.ts
|
511
|
-
function
|
511
|
+
function _let(valueAccessor, fn) {
|
512
512
|
if (0)
|
513
513
|
var id;
|
514
|
-
let valueChangeAccessor = "o" /* TagVariableChange */ + valueAccessor, update = (scope,
|
515
|
-
scope[valueAccessor] !==
|
514
|
+
let valueChangeAccessor = "o" /* TagVariableChange */ + valueAccessor, update = (scope, value) => {
|
515
|
+
scope[valueAccessor] !== value && (scope[valueAccessor] = value, fn(scope, value));
|
516
516
|
};
|
517
|
-
return (scope,
|
517
|
+
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(
|
518
518
|
scope,
|
519
519
|
update,
|
520
520
|
valueAccessor,
|
521
|
-
|
522
|
-
)),
|
521
|
+
value
|
522
|
+
)), value);
|
523
523
|
}
|
524
|
-
function
|
524
|
+
function _const(valueAccessor, fn = () => {
|
525
525
|
}) {
|
526
|
-
return (scope,
|
527
|
-
(!(valueAccessor in scope) || scope[valueAccessor] !==
|
526
|
+
return (scope, value) => {
|
527
|
+
(!(valueAccessor in scope) || scope[valueAccessor] !== value) && (scope[valueAccessor] = value, fn(scope, value));
|
528
528
|
};
|
529
529
|
}
|
530
|
-
function
|
530
|
+
function _or(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "l") {
|
531
531
|
return (scope) => {
|
532
532
|
scope.q ? scope[id] === void 0 ? scope[id] = defaultPending : --scope[id] || fn(scope) : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
|
533
533
|
};
|
534
534
|
}
|
535
|
-
function
|
535
|
+
function _for_closure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
536
536
|
let childSignal = closure(valueAccessor, fn), loopScopeAccessor = "l" /* LoopScopeArray */ + ownerLoopNodeAccessor, loopScopeMapAccessor = "m" /* LoopScopeMap */ + ownerLoopNodeAccessor, ownerSignal = (ownerScope) => {
|
537
537
|
let scopes = ownerScope[loopScopeAccessor] ||= ownerScope[loopScopeMapAccessor] ? [...ownerScope[loopScopeMapAccessor].values()] : [], [firstScope] = scopes;
|
538
538
|
firstScope && queueRender(
|
@@ -548,7 +548,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
|
|
548
548
|
};
|
549
549
|
return ownerSignal._ = childSignal, ownerSignal;
|
550
550
|
}
|
551
|
-
function
|
551
|
+
function _if_closure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
|
552
552
|
let childSignal = closure(valueAccessor, fn), scopeAccessor = "d" /* ConditionalScope */ + ownerConditionalNodeAccessor, branchAccessor = "c" /* ConditionalRenderer */ + ownerConditionalNodeAccessor, ownerSignal = (scope) => {
|
553
553
|
let ifScope = scope[scopeAccessor];
|
554
554
|
ifScope && !ifScope.q && scope[branchAccessor] === branch && queueRender(ifScope, childSignal, -1);
|
@@ -557,12 +557,12 @@ function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch,
|
|
557
557
|
}
|
558
558
|
function subscribeToScopeSet(ownerScope, accessor, scope) {
|
559
559
|
let subscribers = ownerScope[accessor] ||= /* @__PURE__ */ new Set();
|
560
|
-
subscribers.has(scope) || (subscribers.add(scope),
|
560
|
+
subscribers.has(scope) || (subscribers.add(scope), $signal(scope, -1).addEventListener(
|
561
561
|
"abort",
|
562
562
|
() => ownerScope[accessor].delete(scope)
|
563
563
|
));
|
564
564
|
}
|
565
|
-
function
|
565
|
+
function _closure(...closureSignals) {
|
566
566
|
let [{ E: ___scopeInstancesAccessor, F: ___signalIndexAccessor }] = closureSignals;
|
567
567
|
for (let i = closureSignals.length; i--; )
|
568
568
|
closureSignals[i].L = i;
|
@@ -576,7 +576,7 @@ function dynamicClosure(...closureSignals) {
|
|
576
576
|
);
|
577
577
|
};
|
578
578
|
}
|
579
|
-
function
|
579
|
+
function _closure_get(valueAccessor, fn, getOwnerScope) {
|
580
580
|
let childSignal = closure(valueAccessor, fn, getOwnerScope), closureSignal = ((scope) => {
|
581
581
|
scope[closureSignal.F] = closureSignal.L, childSignal(scope), subscribeToScopeSet(
|
582
582
|
getOwnerScope ? getOwnerScope(scope) : scope._,
|
@@ -594,20 +594,20 @@ function closure(valueAccessor, fn, getOwnerScope) {
|
|
594
594
|
);
|
595
595
|
};
|
596
596
|
}
|
597
|
-
function
|
598
|
-
scope[childAccessor].e = (
|
597
|
+
function _var(scope, childAccessor, signal) {
|
598
|
+
scope[childAccessor].e = (value) => signal(scope, value);
|
599
599
|
}
|
600
|
-
var
|
601
|
-
function
|
600
|
+
var _return = (scope, value) => scope.e?.(value);
|
601
|
+
function _return_change(scope, changeHandler) {
|
602
602
|
scope.f = changeHandler;
|
603
603
|
}
|
604
|
-
var
|
605
|
-
function
|
604
|
+
var _var_change = (scope, value) => scope.f?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
|
605
|
+
function _id({ $global }) {
|
606
606
|
let id = tagIdsByGlobal.get($global) || 0;
|
607
607
|
return tagIdsByGlobal.set($global, id + 1), "c" + $global.runtimeId + $global.renderId + id.toString(36);
|
608
608
|
}
|
609
|
-
function
|
610
|
-
return
|
609
|
+
function _script(id, fn) {
|
610
|
+
return _resume(id, fn), (scope) => {
|
611
611
|
queueEffect(scope, fn);
|
612
612
|
};
|
613
613
|
}
|
@@ -618,7 +618,7 @@ function* traverseAllHoisted(scope, path, curIndex = path.length - 1) {
|
|
618
618
|
yield* traverseAllHoisted(s, path, curIndex);
|
619
619
|
else curIndex ? yield* traverseAllHoisted(scope[path[curIndex]], path, curIndex - 1) : yield scope[path[0]];
|
620
620
|
}
|
621
|
-
function
|
621
|
+
function _hoist(...path) {
|
622
622
|
return (scope) => {
|
623
623
|
let getOne = (...args) => iterator().next().value(...args), iterator = getOne[Symbol.iterator] = () => traverseAllHoisted(scope, path);
|
624
624
|
return getOne;
|
@@ -642,7 +642,7 @@ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
|
|
642
642
|
function setupBranch(renderer, branch) {
|
643
643
|
return renderer.D && queueRender(branch, renderer.D, -1), branch;
|
644
644
|
}
|
645
|
-
function
|
645
|
+
function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
|
646
646
|
walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup = setup ? setup._ || setup : void 0, params ||= void 0;
|
647
647
|
let clone = template ? (branch, ns) => {
|
648
648
|
((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
|
@@ -665,27 +665,27 @@ function createContent(id, template, walks, setup, params, dynamicScopesAccessor
|
|
665
665
|
n: dynamicScopesAccessor
|
666
666
|
});
|
667
667
|
}
|
668
|
-
function
|
669
|
-
return
|
668
|
+
function _content_resume(id, template, walks, setup, params, dynamicScopesAccessor) {
|
669
|
+
return _resume(
|
670
670
|
id,
|
671
|
-
|
671
|
+
_content(id, template, walks, setup, params, dynamicScopesAccessor)
|
672
672
|
);
|
673
673
|
}
|
674
|
-
function
|
674
|
+
function _content_closures(renderer, closureFns) {
|
675
675
|
let closureSignals = {};
|
676
676
|
for (let key in closureFns)
|
677
|
-
closureSignals[key] =
|
677
|
+
closureSignals[key] = _const(key, closureFns[key]);
|
678
678
|
return (owner, closureValues) => {
|
679
679
|
let instance = renderer(owner);
|
680
680
|
return instance.G = closureSignals, instance.M = closureValues, instance;
|
681
681
|
};
|
682
682
|
}
|
683
|
-
function
|
684
|
-
return
|
683
|
+
function _content_branch(template, walks, setup, params) {
|
684
|
+
return _content("", template, walks, setup, params)();
|
685
685
|
}
|
686
686
|
var cloneCache = {};
|
687
|
-
function createCloneableHTML(
|
688
|
-
let { firstChild, lastChild } = parseHTML(
|
687
|
+
function createCloneableHTML(html, ns) {
|
688
|
+
let { firstChild, lastChild } = parseHTML(html, ns), parent = document.createElementNS(ns, "t");
|
689
689
|
return insertChildNodes(parent, null, firstChild, lastChild), firstChild === lastChild && firstChild.nodeType < 8 /* Comment */ ? (branch, walks) => {
|
690
690
|
walk(
|
691
691
|
branch.h = branch.j = firstChild.cloneNode(!0),
|
@@ -699,41 +699,41 @@ function createCloneableHTML(html2, ns) {
|
|
699
699
|
}
|
700
700
|
|
701
701
|
// src/dom/dom.ts
|
702
|
-
function
|
703
|
-
setAttribute(element, name, normalizeAttrValue(
|
702
|
+
function _attr(element, name, value) {
|
703
|
+
setAttribute(element, name, normalizeAttrValue(value));
|
704
704
|
}
|
705
|
-
function setAttribute(element, name,
|
706
|
-
element.getAttribute(name) !=
|
705
|
+
function setAttribute(element, name, value) {
|
706
|
+
element.getAttribute(name) != value && (value === void 0 ? element.removeAttribute(name) : element.setAttribute(name, value));
|
707
707
|
}
|
708
|
-
function
|
709
|
-
setAttribute(element, "class", classValue(
|
708
|
+
function _attr_class(element, value) {
|
709
|
+
setAttribute(element, "class", classValue(value) || void 0);
|
710
710
|
}
|
711
|
-
function
|
711
|
+
function _attr_class_items(element, items) {
|
712
712
|
for (let key in items)
|
713
|
-
|
713
|
+
_attr_class_item(element, key, items[key]);
|
714
714
|
}
|
715
|
-
function
|
716
|
-
element.classList.toggle(name, !!
|
715
|
+
function _attr_class_item(element, name, value) {
|
716
|
+
element.classList.toggle(name, !!value);
|
717
717
|
}
|
718
|
-
function
|
719
|
-
setAttribute(element, "style", styleValue(
|
718
|
+
function _attr_style(element, value) {
|
719
|
+
setAttribute(element, "style", styleValue(value) || void 0);
|
720
720
|
}
|
721
|
-
function
|
721
|
+
function _attr_style_items(element, items) {
|
722
722
|
for (let key in items)
|
723
|
-
|
723
|
+
_attr_style_item(element, key, items[key]);
|
724
724
|
}
|
725
|
-
function
|
726
|
-
element.style.setProperty(name,
|
725
|
+
function _attr_style_item(element, name, value) {
|
726
|
+
element.style.setProperty(name, value || value === 0 ? value + "" : "");
|
727
727
|
}
|
728
|
-
function
|
729
|
-
let normalizedValue = normalizeString(
|
728
|
+
function _text(node, value) {
|
729
|
+
let normalizedValue = normalizeString(value);
|
730
730
|
node.data !== normalizedValue && (node.data = normalizedValue);
|
731
731
|
}
|
732
|
-
function
|
733
|
-
let normalizedValue = normalizeString(
|
732
|
+
function _text_content(node, value) {
|
733
|
+
let normalizedValue = normalizeString(value);
|
734
734
|
node.textContent !== normalizedValue && (node.textContent = normalizedValue);
|
735
735
|
}
|
736
|
-
function
|
736
|
+
function _attrs(scope, nodeAccessor, nextAttrs) {
|
737
737
|
let el = scope[nodeAccessor];
|
738
738
|
for (let i = el.attributes.length; i--; ) {
|
739
739
|
let { name } = el.attributes.item(i);
|
@@ -741,13 +741,13 @@ function attrs(scope, nodeAccessor, nextAttrs) {
|
|
741
741
|
}
|
742
742
|
attrsInternal(scope, nodeAccessor, nextAttrs);
|
743
743
|
}
|
744
|
-
function
|
745
|
-
|
744
|
+
function _attrs_content(scope, nodeAccessor, nextAttrs) {
|
745
|
+
_attrs(scope, nodeAccessor, nextAttrs), _attr_content(scope, nodeAccessor, nextAttrs?.content);
|
746
746
|
}
|
747
|
-
function hasAttrAlias(element,
|
748
|
-
return
|
747
|
+
function hasAttrAlias(element, attr, nextAttrs) {
|
748
|
+
return attr === "checked" && element.tagName === "INPUT" && "checkedValue" in nextAttrs;
|
749
749
|
}
|
750
|
-
function
|
750
|
+
function _attrs_partial(scope, nodeAccessor, nextAttrs, skip) {
|
751
751
|
let el = scope[nodeAccessor], partial = {};
|
752
752
|
for (let i = el.attributes.length; i--; ) {
|
753
753
|
let { name } = el.attributes.item(i);
|
@@ -757,22 +757,22 @@ function partialAttrs(scope, nodeAccessor, nextAttrs, skip) {
|
|
757
757
|
skip[key] || (partial[key] = nextAttrs[key]);
|
758
758
|
attrsInternal(scope, nodeAccessor, partial);
|
759
759
|
}
|
760
|
-
function
|
761
|
-
|
760
|
+
function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip) {
|
761
|
+
_attrs_partial(scope, nodeAccessor, nextAttrs, skip), _attr_content(scope, nodeAccessor, nextAttrs?.content);
|
762
762
|
}
|
763
763
|
function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
764
764
|
let el = scope[nodeAccessor], events, skip;
|
765
765
|
switch (el.tagName) {
|
766
766
|
case "INPUT":
|
767
767
|
if ("checked" in nextAttrs || "checkedChange" in nextAttrs)
|
768
|
-
|
768
|
+
_attr_input_checked(
|
769
769
|
scope,
|
770
770
|
nodeAccessor,
|
771
771
|
nextAttrs.checked,
|
772
772
|
nextAttrs.checkedChange
|
773
773
|
);
|
774
774
|
else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs)
|
775
|
-
|
775
|
+
_attr_input_checkedValue(
|
776
776
|
scope,
|
777
777
|
nodeAccessor,
|
778
778
|
nextAttrs.checkedValue,
|
@@ -780,7 +780,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
780
780
|
nextAttrs.value
|
781
781
|
);
|
782
782
|
else if ("value" in nextAttrs || "valueChange" in nextAttrs)
|
783
|
-
|
783
|
+
_attr_input_value(
|
784
784
|
scope,
|
785
785
|
nodeAccessor,
|
786
786
|
nextAttrs.value,
|
@@ -791,7 +791,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
791
791
|
skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
792
792
|
break;
|
793
793
|
case "SELECT":
|
794
|
-
("value" in nextAttrs || "valueChange" in nextAttrs) && (
|
794
|
+
("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_select_value(
|
795
795
|
scope,
|
796
796
|
nodeAccessor,
|
797
797
|
nextAttrs.value,
|
@@ -799,7 +799,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
799
799
|
), skip = /^value(?:Change)?$/);
|
800
800
|
break;
|
801
801
|
case "TEXTAREA":
|
802
|
-
("value" in nextAttrs || "valueChange" in nextAttrs) && (
|
802
|
+
("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_input_value(
|
803
803
|
scope,
|
804
804
|
nodeAccessor,
|
805
805
|
nextAttrs.value,
|
@@ -808,7 +808,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
808
808
|
break;
|
809
809
|
case "DETAILS":
|
810
810
|
case "DIALOG":
|
811
|
-
("open" in nextAttrs || "openChange" in nextAttrs) && (
|
811
|
+
("open" in nextAttrs || "openChange" in nextAttrs) && (_attr_details_or_dialog_open(
|
812
812
|
scope,
|
813
813
|
nodeAccessor,
|
814
814
|
nextAttrs.open,
|
@@ -817,54 +817,54 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
817
817
|
break;
|
818
818
|
}
|
819
819
|
for (let name in nextAttrs) {
|
820
|
-
let
|
820
|
+
let value = nextAttrs[name];
|
821
821
|
switch (name) {
|
822
822
|
case "class":
|
823
|
-
|
823
|
+
_attr_class(el, value);
|
824
824
|
break;
|
825
825
|
case "style":
|
826
|
-
|
826
|
+
_attr_style(el, value);
|
827
827
|
break;
|
828
828
|
default: {
|
829
|
-
isEventHandler(name) ? (events ||= scope["i" /* EventAttributes */ + nodeAccessor] = {})[getEventHandlerName(name)] =
|
829
|
+
isEventHandler(name) ? (events ||= scope["i" /* EventAttributes */ + nodeAccessor] = {})[getEventHandlerName(name)] = value : skip?.test(name) || name === "content" && el.tagName !== "META" || _attr(el, name, value);
|
830
830
|
break;
|
831
831
|
}
|
832
832
|
}
|
833
833
|
}
|
834
834
|
}
|
835
|
-
function
|
836
|
-
let content = normalizeClientRender(
|
835
|
+
function _attr_content(scope, nodeAccessor, value) {
|
836
|
+
let content = normalizeClientRender(value), rendererAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
837
837
|
scope[rendererAccessor] !== (scope[rendererAccessor] = content?.l) && (setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch), content?.n && subscribeToScopeSet(
|
838
838
|
content.u,
|
839
839
|
content.n,
|
840
840
|
scope["d" /* ConditionalScope */ + nodeAccessor]
|
841
841
|
));
|
842
842
|
}
|
843
|
-
function
|
843
|
+
function _attrs_script(scope, nodeAccessor) {
|
844
844
|
let el = scope[nodeAccessor], events = scope["i" /* EventAttributes */ + nodeAccessor];
|
845
845
|
switch (scope["f" /* ControlledType */ + nodeAccessor]) {
|
846
846
|
case 0 /* InputChecked */:
|
847
|
-
|
847
|
+
_attr_input_checked_script(scope, nodeAccessor);
|
848
848
|
break;
|
849
849
|
case 1 /* InputCheckedValue */:
|
850
|
-
|
850
|
+
_attr_input_checkedValue_script(scope, nodeAccessor);
|
851
851
|
break;
|
852
852
|
case 2 /* InputValue */:
|
853
|
-
|
853
|
+
_attr_input_value_script(scope, nodeAccessor);
|
854
854
|
break;
|
855
855
|
case 3 /* SelectValue */:
|
856
|
-
|
856
|
+
_attr_select_value_script(scope, nodeAccessor);
|
857
857
|
break;
|
858
858
|
case 4 /* DetailsOrDialogOpen */:
|
859
|
-
|
859
|
+
_attr_details_or_dialog_open_script(scope, nodeAccessor);
|
860
860
|
break;
|
861
861
|
}
|
862
862
|
for (let name in events)
|
863
|
-
|
863
|
+
_on(el, name, events[name]);
|
864
864
|
}
|
865
|
-
function
|
865
|
+
function _html(scope, value, accessor) {
|
866
866
|
let firstChild = scope[accessor], parentNode = firstChild.parentNode, lastChild = scope["h" /* DynamicPlaceholderLastChild */ + accessor] || firstChild, newContent = parseHTML(
|
867
|
-
|
867
|
+
value || value === 0 ? value + "" : "",
|
868
868
|
parentNode.namespaceURI
|
869
869
|
);
|
870
870
|
insertChildNodes(
|
@@ -874,33 +874,21 @@ function html(scope, value2, accessor) {
|
|
874
874
|
scope["h" /* DynamicPlaceholderLastChild */ + accessor] = newContent.lastChild
|
875
875
|
), removeChildNodes(firstChild, lastChild);
|
876
876
|
}
|
877
|
-
function normalizeClientRender(
|
878
|
-
let renderer = normalizeDynamicRenderer(
|
877
|
+
function normalizeClientRender(value) {
|
878
|
+
let renderer = normalizeDynamicRenderer(value);
|
879
879
|
if (renderer && renderer.l)
|
880
880
|
return renderer;
|
881
881
|
}
|
882
|
-
function
|
883
|
-
|
884
|
-
|
885
|
-
for (let name in prevProps)
|
886
|
-
name in nextProps || (node[name] = void 0);
|
887
|
-
for (let name in nextProps)
|
888
|
-
node[name] = nextProps[name];
|
889
|
-
scope[index + "-"] = nextProps;
|
882
|
+
function normalizeAttrValue(value) {
|
883
|
+
if (value || value === 0)
|
884
|
+
return value === !0 ? "" : value + "";
|
890
885
|
}
|
891
|
-
function
|
892
|
-
|
893
|
-
return value2 === !0 ? "" : value2 + "";
|
886
|
+
function normalizeString(value) {
|
887
|
+
return value || value === 0 ? value + "" : "\u200D";
|
894
888
|
}
|
895
|
-
function
|
896
|
-
return value2 || value2 === 0 ? value2 + "" : "\u200D";
|
897
|
-
}
|
898
|
-
function lifecycle(scope, index, thisObj) {
|
889
|
+
function _lifecycle(scope, index, thisObj) {
|
899
890
|
let instance = scope[index];
|
900
|
-
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[index] = thisObj, thisObj.onMount?.(),
|
901
|
-
scope,
|
902
|
-
"k" /* LifecycleAbortController */ + index
|
903
|
-
).onabort = () => thisObj.onDestroy?.());
|
891
|
+
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[index] = thisObj, thisObj.onMount?.(), $signal(scope, "k" /* LifecycleAbortController */ + index).onabort = () => thisObj.onDestroy?.());
|
904
892
|
}
|
905
893
|
function removeChildNodes(startNode, endNode) {
|
906
894
|
let stop = endNode.nextSibling, current = startNode;
|
@@ -998,7 +986,7 @@ function longestIncreasingSubsequence(a) {
|
|
998
986
|
}
|
999
987
|
|
1000
988
|
// src/dom/control-flow.ts
|
1001
|
-
function
|
989
|
+
function _await(nodeAccessor, renderer) {
|
1002
990
|
let promiseAccessor = "n" /* Promise */ + nodeAccessor, branchAccessor = "d" /* ConditionalScope */ + nodeAccessor;
|
1003
991
|
return (scope, promise) => {
|
1004
992
|
let referenceNode = scope[nodeAccessor], tryWithPlaceholder = findBranchWithKey(
|
@@ -1031,7 +1019,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1031
1019
|
awaitBranch.h
|
1032
1020
|
), tempDetachBranch(awaitBranch));
|
1033
1021
|
let thisPromise = scope[promiseAccessor] = promise.then(
|
1034
|
-
(
|
1022
|
+
(data) => {
|
1035
1023
|
thisPromise === scope[promiseAccessor] && (scope[promiseAccessor] = 0, schedule(), queueRender(
|
1036
1024
|
scope,
|
1037
1025
|
() => {
|
@@ -1046,7 +1034,7 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1046
1034
|
),
|
1047
1035
|
referenceNode.parentNode,
|
1048
1036
|
referenceNode
|
1049
|
-
), referenceNode.remove()), renderer.m?.(awaitBranch, [
|
1037
|
+
), referenceNode.remove()), renderer.m?.(awaitBranch, [data]), tryWithPlaceholder && (placeholderShown.add(pendingEffects), !--tryWithPlaceholder.o)) {
|
1050
1038
|
let placeholderBranch = tryWithPlaceholder.c;
|
1051
1039
|
tryWithPlaceholder.c = 0, placeholderBranch && (placeholderBranch.h.parentNode.insertBefore(
|
1052
1040
|
tryWithPlaceholder.h.parentNode,
|
@@ -1063,13 +1051,13 @@ function awaitTag(nodeAccessor, renderer) {
|
|
1063
1051
|
);
|
1064
1052
|
};
|
1065
1053
|
}
|
1066
|
-
function
|
1054
|
+
function _try(nodeAccessor, content) {
|
1067
1055
|
let branchAccessor = "d" /* ConditionalScope */ + nodeAccessor;
|
1068
1056
|
return (scope, input) => {
|
1069
1057
|
scope[branchAccessor] || setConditionalRenderer(
|
1070
1058
|
scope,
|
1071
1059
|
nodeAccessor,
|
1072
|
-
|
1060
|
+
content,
|
1073
1061
|
createAndSetupBranch
|
1074
1062
|
);
|
1075
1063
|
let branch = scope[branchAccessor];
|
@@ -1094,7 +1082,7 @@ function renderCatch(scope, error) {
|
|
1094
1082
|
} else
|
1095
1083
|
throw error;
|
1096
1084
|
}
|
1097
|
-
function
|
1085
|
+
function _if(nodeAccessor, ...branches) {
|
1098
1086
|
let branchAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
1099
1087
|
return enableBranches(), (scope, newBranch) => {
|
1100
1088
|
newBranch !== scope[branchAccessor] && setConditionalRenderer(
|
@@ -1106,9 +1094,9 @@ function conditional(nodeAccessor, ...branches) {
|
|
1106
1094
|
};
|
1107
1095
|
}
|
1108
1096
|
function patchDynamicTag(fn) {
|
1109
|
-
|
1097
|
+
_dynamic_tag = fn(_dynamic_tag);
|
1110
1098
|
}
|
1111
|
-
var
|
1099
|
+
var _dynamic_tag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
1112
1100
|
let childScopeAccessor = "d" /* ConditionalScope */ + nodeAccessor, rendererAccessor = "c" /* ConditionalRenderer */ + nodeAccessor;
|
1113
1101
|
return enableBranches(), (scope, newRenderer, getInput) => {
|
1114
1102
|
let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
|
@@ -1118,7 +1106,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1118
1106
|
nodeAccessor,
|
1119
1107
|
normalizedRenderer || (getContent ? getContent(scope) : void 0),
|
1120
1108
|
createBranchWithTagNameOrRenderer
|
1121
|
-
), getTagVar &&
|
1109
|
+
), getTagVar && _var(scope, childScopeAccessor, getTagVar()), typeof normalizedRenderer == "string") {
|
1122
1110
|
if (getContent) {
|
1123
1111
|
let content = getContent(scope);
|
1124
1112
|
setConditionalRenderer(
|
@@ -1140,7 +1128,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
|
|
1140
1128
|
if (normalizedRenderer) {
|
1141
1129
|
let childScope = scope[childScopeAccessor], args = getInput?.();
|
1142
1130
|
if (typeof normalizedRenderer == "string")
|
1143
|
-
(getContent ?
|
1131
|
+
(getContent ? _attrs : _attrs_content)(
|
1144
1132
|
childScope,
|
1145
1133
|
0,
|
1146
1134
|
(inputIsArgs ? args[0] : args) || {}
|
@@ -1172,7 +1160,7 @@ function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2)
|
|
1172
1160
|
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);
|
1173
1161
|
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());
|
1174
1162
|
}
|
1175
|
-
function
|
1163
|
+
function _for_of(nodeAccessor, renderer) {
|
1176
1164
|
return loop(
|
1177
1165
|
nodeAccessor,
|
1178
1166
|
renderer,
|
@@ -1184,14 +1172,14 @@ function loopOf(nodeAccessor, renderer) {
|
|
1184
1172
|
}
|
1185
1173
|
);
|
1186
1174
|
}
|
1187
|
-
function
|
1175
|
+
function _for_in(nodeAccessor, renderer) {
|
1188
1176
|
return loop(
|
1189
1177
|
nodeAccessor,
|
1190
1178
|
renderer,
|
1191
|
-
([obj, by = byFirstArg], cb) => forIn(obj, (key,
|
1179
|
+
([obj, by = byFirstArg], cb) => forIn(obj, (key, value) => cb(by(key, value), [key, value]))
|
1192
1180
|
);
|
1193
1181
|
}
|
1194
|
-
function
|
1182
|
+
function _for_to(nodeAccessor, renderer) {
|
1195
1183
|
return loop(
|
1196
1184
|
nodeAccessor,
|
1197
1185
|
renderer,
|
@@ -1200,11 +1188,11 @@ function loopTo(nodeAccessor, renderer) {
|
|
1200
1188
|
}
|
1201
1189
|
function loop(nodeAccessor, renderer, forEach) {
|
1202
1190
|
let params = renderer.m;
|
1203
|
-
return enableBranches(), (scope,
|
1191
|
+
return enableBranches(), (scope, value) => {
|
1204
1192
|
let referenceNode = scope[nodeAccessor], oldMap = scope["m" /* LoopScopeMap */ + nodeAccessor], oldArray = oldMap ? scope["l" /* LoopScopeArray */ + nodeAccessor] || [
|
1205
1193
|
...oldMap.values()
|
1206
1194
|
] : [], 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] = [];
|
1207
|
-
forEach(
|
1195
|
+
forEach(value, (key, args) => {
|
1208
1196
|
let branch = oldMap?.get(key) || createAndSetupBranch(scope.$global, renderer, scope, parentNode);
|
1209
1197
|
params?.(branch, args), newMap.set(key, branch), newArray.push(branch);
|
1210
1198
|
});
|
@@ -1233,16 +1221,16 @@ function byFirstArg(name) {
|
|
1233
1221
|
|
1234
1222
|
// src/dom/queue.ts
|
1235
1223
|
var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), caughtError = /* @__PURE__ */ new WeakSet(), placeholderShown = /* @__PURE__ */ new WeakSet(), pendingEffects = [], pendingScopes = [], rendering, scopeKeyOffset = 1e3;
|
1236
|
-
function queueRender(scope, signal, signalKey,
|
1224
|
+
function queueRender(scope, signal, signalKey, value, scopeKey = scope.l) {
|
1237
1225
|
let key = scopeKey * scopeKeyOffset + signalKey, existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
|
1238
1226
|
if (existingRender)
|
1239
|
-
existingRender.I =
|
1227
|
+
existingRender.I = value;
|
1240
1228
|
else {
|
1241
1229
|
let render = {
|
1242
1230
|
x: key,
|
1243
1231
|
t: scope,
|
1244
1232
|
N: signal,
|
1245
|
-
I:
|
1233
|
+
I: value
|
1246
1234
|
}, i = pendingRenders.push(render) - 1;
|
1247
1235
|
for (; i; ) {
|
1248
1236
|
let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
|
@@ -1300,8 +1288,8 @@ function runRenders() {
|
|
1300
1288
|
scope.q = 0;
|
1301
1289
|
pendingScopes = [];
|
1302
1290
|
}
|
1303
|
-
var runRender = (render) => render.N(render.t, render.I),
|
1304
|
-
|
1291
|
+
var runRender = (render) => render.N(render.t, render.I), _enable_catch = () => {
|
1292
|
+
_enable_catch = () => {
|
1305
1293
|
}, enableBranches();
|
1306
1294
|
let handlePendingTry = (fn, scope, branch) => {
|
1307
1295
|
for (; branch; ) {
|
@@ -1327,11 +1315,11 @@ var runRender = (render) => render.N(render.t, render.I), enableCatch = () => {
|
|
1327
1315
|
};
|
1328
1316
|
|
1329
1317
|
// src/dom/abort-signal.ts
|
1330
|
-
function
|
1318
|
+
function $signalReset(scope, id) {
|
1331
1319
|
let ctrl = scope.z?.[id];
|
1332
1320
|
ctrl && (queueEffect(ctrl, abort), scope.z[id] = void 0);
|
1333
1321
|
}
|
1334
|
-
function
|
1322
|
+
function $signal(scope, id) {
|
1335
1323
|
return scope.k && (scope.k.J ||= /* @__PURE__ */ new Set()).add(scope), ((scope.z ||= {})[id] ||= new AbortController()).signal;
|
1336
1324
|
}
|
1337
1325
|
function abort(ctrl) {
|
@@ -1346,12 +1334,12 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1346
1334
|
patchDynamicTag,
|
1347
1335
|
queueEffect,
|
1348
1336
|
init(warp10Noop) {
|
1349
|
-
|
1337
|
+
_resume(SET_SCOPE_REGISTER_ID, (branch) => {
|
1350
1338
|
classIdToBranch.set(branch.m5c, branch);
|
1351
|
-
}),
|
1339
|
+
}), _resume(RENDER_BODY_ID, warp10Noop);
|
1352
1340
|
},
|
1353
1341
|
registerRenderer(fn) {
|
1354
|
-
|
1342
|
+
_resume(RENDERER_REGISTER_ID, fn);
|
1355
1343
|
},
|
1356
1344
|
isRenderer(renderer) {
|
1357
1345
|
return renderer.C;
|
@@ -1368,14 +1356,14 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1368
1356
|
runComponentDestroy() {
|
1369
1357
|
this.scope && destroyBranch(this.scope);
|
1370
1358
|
},
|
1371
|
-
resolveRegistered(
|
1372
|
-
return Array.isArray(
|
1373
|
-
|
1374
|
-
|
1375
|
-
) :
|
1359
|
+
resolveRegistered(value, $global) {
|
1360
|
+
return Array.isArray(value) && typeof value[0] == "string" ? getRegisteredWithScope(
|
1361
|
+
value[0],
|
1362
|
+
value.length === 2 && self[$global.runtimeId]?.[$global.renderId]?.s[value[1]]
|
1363
|
+
) : value;
|
1376
1364
|
},
|
1377
1365
|
createRenderer(params, clone) {
|
1378
|
-
let renderer =
|
1366
|
+
let renderer = _content_branch(0, 0, 0, params);
|
1379
1367
|
return renderer.C = (branch) => {
|
1380
1368
|
let cloned = clone();
|
1381
1369
|
branch.h = cloned.startNode, branch.j = cloned.endNode;
|
@@ -1401,15 +1389,15 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
1401
1389
|
};
|
1402
1390
|
|
1403
1391
|
// src/dom/template.ts
|
1404
|
-
var
|
1405
|
-
let renderer =
|
1392
|
+
var _template = (id, template, walks, setup, inputSignal) => {
|
1393
|
+
let renderer = _content(
|
1406
1394
|
id,
|
1407
1395
|
template,
|
1408
1396
|
walks,
|
1409
1397
|
setup,
|
1410
1398
|
inputSignal
|
1411
1399
|
)();
|
1412
|
-
return renderer.mount = mount, renderer._ = renderer,
|
1400
|
+
return renderer.mount = mount, renderer._ = renderer, _resume(id, renderer);
|
1413
1401
|
};
|
1414
1402
|
function mount(input = {}, reference, position) {
|
1415
1403
|
let branch, parentNode = reference, nextSibling = null, { $global } = input;
|
@@ -1453,7 +1441,7 @@ function mount(input = {}, reference, position) {
|
|
1453
1441
|
return curValue;
|
1454
1442
|
},
|
1455
1443
|
set value(newValue) {
|
1456
|
-
|
1444
|
+
_var_change(branch, newValue);
|
1457
1445
|
},
|
1458
1446
|
update(newInput) {
|
1459
1447
|
args && runEffects(
|
@@ -1468,75 +1456,76 @@ function mount(input = {}, reference, position) {
|
|
1468
1456
|
};
|
1469
1457
|
}
|
1470
1458
|
export {
|
1471
|
-
|
1459
|
+
$signal,
|
1460
|
+
$signalReset,
|
1461
|
+
_attr,
|
1462
|
+
_attr_class,
|
1463
|
+
_attr_class_item,
|
1464
|
+
_attr_class_items,
|
1465
|
+
_attr_content,
|
1466
|
+
_attr_details_or_dialog_open as _attr_details_open,
|
1467
|
+
_attr_details_or_dialog_open_script as _attr_details_open_script,
|
1468
|
+
_attr_details_or_dialog_open as _attr_dialog_open,
|
1469
|
+
_attr_details_or_dialog_open_script as _attr_dialog_open_script,
|
1470
|
+
_attr_input_checked,
|
1471
|
+
_attr_input_checkedValue,
|
1472
|
+
_attr_input_checkedValue_script,
|
1473
|
+
_attr_input_checked_script,
|
1474
|
+
_attr_input_value,
|
1475
|
+
_attr_input_value_script,
|
1476
|
+
_attr_select_value,
|
1477
|
+
_attr_select_value_script,
|
1478
|
+
_attr_style,
|
1479
|
+
_attr_style_item,
|
1480
|
+
_attr_style_items,
|
1481
|
+
_attr_input_value as _attr_textarea_value,
|
1482
|
+
_attr_input_value_script as _attr_textarea_value_script,
|
1483
|
+
_attrs,
|
1484
|
+
_attrs_content,
|
1485
|
+
_attrs_partial,
|
1486
|
+
_attrs_partial_content,
|
1487
|
+
_attrs_script,
|
1488
|
+
_await,
|
1489
|
+
_closure,
|
1490
|
+
_closure_get,
|
1491
|
+
_const,
|
1492
|
+
_content,
|
1493
|
+
_content_branch,
|
1494
|
+
_content_closures,
|
1495
|
+
_content_resume,
|
1496
|
+
_dynamic_tag,
|
1497
|
+
_el,
|
1498
|
+
_enable_catch,
|
1499
|
+
_for_closure,
|
1500
|
+
_for_in,
|
1501
|
+
_for_of,
|
1502
|
+
_for_to,
|
1503
|
+
_hoist,
|
1504
|
+
_html,
|
1505
|
+
_id,
|
1506
|
+
_if,
|
1507
|
+
_if_closure,
|
1508
|
+
_let,
|
1509
|
+
_lifecycle,
|
1510
|
+
_on,
|
1511
|
+
_or,
|
1512
|
+
_resume,
|
1513
|
+
_return,
|
1514
|
+
_return_change,
|
1515
|
+
_script,
|
1516
|
+
_template,
|
1517
|
+
_text,
|
1518
|
+
_text_content,
|
1519
|
+
_try,
|
1520
|
+
_var,
|
1521
|
+
_var_change,
|
1522
|
+
_var_resume,
|
1472
1523
|
attrTag,
|
1473
1524
|
attrTags,
|
1474
|
-
attrs,
|
1475
|
-
attrsAndContent,
|
1476
|
-
attrsEvents,
|
1477
|
-
awaitTag,
|
1478
|
-
classAttr,
|
1479
|
-
classItem,
|
1480
|
-
classItems,
|
1481
1525
|
compat,
|
1482
|
-
conditional,
|
1483
|
-
conditionalClosure,
|
1484
|
-
controllable_detailsOrDialog_open,
|
1485
|
-
controllable_detailsOrDialog_open_effect,
|
1486
|
-
controllable_input_checked,
|
1487
|
-
controllable_input_checkedValue,
|
1488
|
-
controllable_input_checkedValue_effect,
|
1489
|
-
controllable_input_checked_effect,
|
1490
|
-
controllable_input_value,
|
1491
|
-
controllable_input_value_effect,
|
1492
|
-
controllable_select_value,
|
1493
|
-
controllable_select_value_effect,
|
1494
|
-
controllable_input_value as controllable_textarea_value,
|
1495
|
-
controllable_input_value_effect as controllable_textarea_value_effect,
|
1496
|
-
createContent,
|
1497
|
-
createRenderer,
|
1498
|
-
createTemplate,
|
1499
|
-
createTry,
|
1500
|
-
data,
|
1501
|
-
dynamicClosure,
|
1502
|
-
dynamicClosureRead,
|
1503
|
-
dynamicTag,
|
1504
|
-
effect,
|
1505
|
-
enableCatch,
|
1506
1526
|
forIn,
|
1507
1527
|
forOf,
|
1508
1528
|
forTo,
|
1509
|
-
getAbortSignal,
|
1510
|
-
hoist,
|
1511
|
-
html,
|
1512
1529
|
init,
|
1513
|
-
|
1514
|
-
intersection,
|
1515
|
-
lifecycle,
|
1516
|
-
localClosures,
|
1517
|
-
loopClosure,
|
1518
|
-
loopIn,
|
1519
|
-
loopOf,
|
1520
|
-
loopTo,
|
1521
|
-
nextTagId,
|
1522
|
-
nodeRef,
|
1523
|
-
on,
|
1524
|
-
partialAttrs,
|
1525
|
-
partialAttrsAndContent,
|
1526
|
-
props,
|
1527
|
-
register,
|
1528
|
-
registerBoundSignal,
|
1529
|
-
registerContent,
|
1530
|
-
resetAbortSignal,
|
1531
|
-
run,
|
1532
|
-
setTagVar,
|
1533
|
-
setTagVarChange,
|
1534
|
-
state,
|
1535
|
-
styleAttr,
|
1536
|
-
styleItem,
|
1537
|
-
styleItems,
|
1538
|
-
tagVarSignal,
|
1539
|
-
tagVarSignalChange,
|
1540
|
-
textContent,
|
1541
|
-
value
|
1530
|
+
run
|
1542
1531
|
};
|