@marko/runtime-tags 0.3.41 → 0.3.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/types.d.ts +1 -2
- package/dist/debug/dom.js +33 -46
- package/dist/debug/dom.mjs +33 -46
- package/dist/debug/html.js +61 -53
- package/dist/debug/html.mjs +61 -52
- package/dist/dom.js +35 -26
- package/dist/dom.mjs +35 -26
- package/dist/html/serializer.d.ts +1 -1
- package/dist/html/writer.d.ts +2 -2
- package/dist/html.d.ts +0 -1
- package/dist/html.js +35 -28
- package/dist/html.mjs +35 -27
- package/dist/translator/index.js +124 -101
- package/dist/translator/util/references.d.ts +1 -0
- package/dist/translator/util/signals.d.ts +1 -1
- package/dist/translator/util/to-property-name.d.ts +1 -0
- package/package.json +1 -1
package/dist/common/types.d.ts
CHANGED
package/dist/debug/dom.js
CHANGED
|
@@ -140,9 +140,8 @@ function stringifyClassObject(name, value2) {
|
|
|
140
140
|
function styleValue(value2) {
|
|
141
141
|
return toDelimitedString(value2, ";", stringifyStyleObject);
|
|
142
142
|
}
|
|
143
|
-
var NON_DIMENSIONAL = /^(--|ta|or|li|z)|n-c|i(do|nk|m|t)|w$|we/;
|
|
144
143
|
function stringifyStyleObject(name, value2) {
|
|
145
|
-
return value2 || value2 === 0 ? `${name}:${typeof value2 === "number" && value2 &&
|
|
144
|
+
return value2 || value2 === 0 ? `${name}:${typeof value2 === "number" && value2 && !/^(--|ta|or|li|z)|cou|nk|it|ag|we|do|w$/.test(name) ? value2 + "px" : value2}` : "";
|
|
146
145
|
}
|
|
147
146
|
function toDelimitedString(val, delimiter, stringify) {
|
|
148
147
|
switch (typeof val) {
|
|
@@ -468,12 +467,10 @@ function controllable_input_checked_effect(scope, nodeAccessor) {
|
|
|
468
467
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
|
469
468
|
const checkedChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
|
470
469
|
if (checkedChange) {
|
|
471
|
-
|
|
472
|
-
|
|
470
|
+
const newValue = el.checked;
|
|
471
|
+
el.checked = !newValue;
|
|
472
|
+
checkedChange(newValue);
|
|
473
473
|
run();
|
|
474
|
-
if (scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */) {
|
|
475
|
-
el.checked = !el.checked;
|
|
476
|
-
}
|
|
477
474
|
}
|
|
478
475
|
});
|
|
479
476
|
}
|
|
@@ -494,24 +491,20 @@ function controllable_input_checkedValue_effect(scope, nodeAccessor) {
|
|
|
494
491
|
const checkedValueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
|
495
492
|
if (checkedValueChange) {
|
|
496
493
|
const oldValue = scope[nodeAccessor + ":" /* ControlledValue */];
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
for (const radio of el.getRootNode().querySelectorAll(
|
|
505
|
-
`[type=radio][name=${CSS.escape(el.name)}]`
|
|
506
|
-
)) {
|
|
507
|
-
if (radio.form === el.form) {
|
|
508
|
-
radio.checked = Array.isArray(oldValue) ? oldValue.includes(radio.value) : oldValue === radio.value;
|
|
509
|
-
}
|
|
494
|
+
const newValue = Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0;
|
|
495
|
+
if (el.name && el.type[0] === "r") {
|
|
496
|
+
for (const radio of el.getRootNode().querySelectorAll(
|
|
497
|
+
`[type=radio][name=${CSS.escape(el.name)}]`
|
|
498
|
+
)) {
|
|
499
|
+
if (radio.form === el.form) {
|
|
500
|
+
radio.checked = Array.isArray(oldValue) ? oldValue.includes(radio.value) : oldValue === radio.value;
|
|
510
501
|
}
|
|
511
|
-
} else {
|
|
512
|
-
el.checked = !el.checked;
|
|
513
502
|
}
|
|
503
|
+
} else {
|
|
504
|
+
el.checked = !el.checked;
|
|
514
505
|
}
|
|
506
|
+
checkedValueChange(newValue);
|
|
507
|
+
run();
|
|
515
508
|
}
|
|
516
509
|
});
|
|
517
510
|
}
|
|
@@ -540,16 +533,14 @@ function controllable_input_value_effect(scope, nodeAccessor) {
|
|
|
540
533
|
syncControllable(el, "input", hasValueChanged, (ev) => {
|
|
541
534
|
const valueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
|
542
535
|
if (valueChange) {
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
536
|
+
const newValue = el.value;
|
|
537
|
+
inputType = ev?.inputType;
|
|
538
|
+
setValueAndUpdateSelection(
|
|
539
|
+
el,
|
|
540
|
+
scope[nodeAccessor + ":" /* ControlledValue */]
|
|
541
|
+
);
|
|
542
|
+
valueChange(newValue);
|
|
546
543
|
run();
|
|
547
|
-
if (scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */) {
|
|
548
|
-
setValueAndUpdateSelection(
|
|
549
|
-
el,
|
|
550
|
-
scope[nodeAccessor + ":" /* ControlledValue */]
|
|
551
|
-
);
|
|
552
|
-
}
|
|
553
544
|
inputType = "";
|
|
554
545
|
}
|
|
555
546
|
});
|
|
@@ -576,18 +567,16 @@ function controllable_select_value_effect(scope, nodeAccessor) {
|
|
|
576
567
|
const onChange = () => {
|
|
577
568
|
const valueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
|
578
569
|
if (valueChange) {
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
570
|
+
const newValue = Array.isArray(
|
|
571
|
+
scope[nodeAccessor + ":" /* ControlledValue */]
|
|
572
|
+
) ? Array.from(el.selectedOptions, toValueProp) : el.value;
|
|
573
|
+
setSelectOptions(
|
|
574
|
+
el,
|
|
575
|
+
scope[nodeAccessor + ":" /* ControlledValue */],
|
|
576
|
+
valueChange
|
|
582
577
|
);
|
|
578
|
+
valueChange(newValue);
|
|
583
579
|
run();
|
|
584
|
-
if (scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */) {
|
|
585
|
-
setSelectOptions(
|
|
586
|
-
el,
|
|
587
|
-
scope[nodeAccessor + ":" /* ControlledValue */],
|
|
588
|
-
valueChange
|
|
589
|
-
);
|
|
590
|
-
}
|
|
591
580
|
}
|
|
592
581
|
};
|
|
593
582
|
if (!el._) {
|
|
@@ -643,12 +632,10 @@ function controllable_detailsOrDialog_open_effect(scope, nodeAccessor) {
|
|
|
643
632
|
() => {
|
|
644
633
|
const openChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
|
645
634
|
if (openChange && hasChanged()) {
|
|
646
|
-
|
|
647
|
-
|
|
635
|
+
const newValue = el.open;
|
|
636
|
+
el.open = !newValue;
|
|
637
|
+
openChange(newValue);
|
|
648
638
|
run();
|
|
649
|
-
if (scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */) {
|
|
650
|
-
el.open = !el.open;
|
|
651
|
-
}
|
|
652
639
|
}
|
|
653
640
|
}
|
|
654
641
|
);
|
package/dist/debug/dom.mjs
CHANGED
|
@@ -54,9 +54,8 @@ function stringifyClassObject(name, value2) {
|
|
|
54
54
|
function styleValue(value2) {
|
|
55
55
|
return toDelimitedString(value2, ";", stringifyStyleObject);
|
|
56
56
|
}
|
|
57
|
-
var NON_DIMENSIONAL = /^(--|ta|or|li|z)|n-c|i(do|nk|m|t)|w$|we/;
|
|
58
57
|
function stringifyStyleObject(name, value2) {
|
|
59
|
-
return value2 || value2 === 0 ? `${name}:${typeof value2 === "number" && value2 &&
|
|
58
|
+
return value2 || value2 === 0 ? `${name}:${typeof value2 === "number" && value2 && !/^(--|ta|or|li|z)|cou|nk|it|ag|we|do|w$/.test(name) ? value2 + "px" : value2}` : "";
|
|
60
59
|
}
|
|
61
60
|
function toDelimitedString(val, delimiter, stringify) {
|
|
62
61
|
switch (typeof val) {
|
|
@@ -382,12 +381,10 @@ function controllable_input_checked_effect(scope, nodeAccessor) {
|
|
|
382
381
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
|
383
382
|
const checkedChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
|
384
383
|
if (checkedChange) {
|
|
385
|
-
|
|
386
|
-
|
|
384
|
+
const newValue = el.checked;
|
|
385
|
+
el.checked = !newValue;
|
|
386
|
+
checkedChange(newValue);
|
|
387
387
|
run();
|
|
388
|
-
if (scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */) {
|
|
389
|
-
el.checked = !el.checked;
|
|
390
|
-
}
|
|
391
388
|
}
|
|
392
389
|
});
|
|
393
390
|
}
|
|
@@ -408,24 +405,20 @@ function controllable_input_checkedValue_effect(scope, nodeAccessor) {
|
|
|
408
405
|
const checkedValueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
|
409
406
|
if (checkedValueChange) {
|
|
410
407
|
const oldValue = scope[nodeAccessor + ":" /* ControlledValue */];
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
for (const radio of el.getRootNode().querySelectorAll(
|
|
419
|
-
`[type=radio][name=${CSS.escape(el.name)}]`
|
|
420
|
-
)) {
|
|
421
|
-
if (radio.form === el.form) {
|
|
422
|
-
radio.checked = Array.isArray(oldValue) ? oldValue.includes(radio.value) : oldValue === radio.value;
|
|
423
|
-
}
|
|
408
|
+
const newValue = Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0;
|
|
409
|
+
if (el.name && el.type[0] === "r") {
|
|
410
|
+
for (const radio of el.getRootNode().querySelectorAll(
|
|
411
|
+
`[type=radio][name=${CSS.escape(el.name)}]`
|
|
412
|
+
)) {
|
|
413
|
+
if (radio.form === el.form) {
|
|
414
|
+
radio.checked = Array.isArray(oldValue) ? oldValue.includes(radio.value) : oldValue === radio.value;
|
|
424
415
|
}
|
|
425
|
-
} else {
|
|
426
|
-
el.checked = !el.checked;
|
|
427
416
|
}
|
|
417
|
+
} else {
|
|
418
|
+
el.checked = !el.checked;
|
|
428
419
|
}
|
|
420
|
+
checkedValueChange(newValue);
|
|
421
|
+
run();
|
|
429
422
|
}
|
|
430
423
|
});
|
|
431
424
|
}
|
|
@@ -454,16 +447,14 @@ function controllable_input_value_effect(scope, nodeAccessor) {
|
|
|
454
447
|
syncControllable(el, "input", hasValueChanged, (ev) => {
|
|
455
448
|
const valueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
|
456
449
|
if (valueChange) {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
450
|
+
const newValue = el.value;
|
|
451
|
+
inputType = ev?.inputType;
|
|
452
|
+
setValueAndUpdateSelection(
|
|
453
|
+
el,
|
|
454
|
+
scope[nodeAccessor + ":" /* ControlledValue */]
|
|
455
|
+
);
|
|
456
|
+
valueChange(newValue);
|
|
460
457
|
run();
|
|
461
|
-
if (scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */) {
|
|
462
|
-
setValueAndUpdateSelection(
|
|
463
|
-
el,
|
|
464
|
-
scope[nodeAccessor + ":" /* ControlledValue */]
|
|
465
|
-
);
|
|
466
|
-
}
|
|
467
458
|
inputType = "";
|
|
468
459
|
}
|
|
469
460
|
});
|
|
@@ -490,18 +481,16 @@ function controllable_select_value_effect(scope, nodeAccessor) {
|
|
|
490
481
|
const onChange = () => {
|
|
491
482
|
const valueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
|
492
483
|
if (valueChange) {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
484
|
+
const newValue = Array.isArray(
|
|
485
|
+
scope[nodeAccessor + ":" /* ControlledValue */]
|
|
486
|
+
) ? Array.from(el.selectedOptions, toValueProp) : el.value;
|
|
487
|
+
setSelectOptions(
|
|
488
|
+
el,
|
|
489
|
+
scope[nodeAccessor + ":" /* ControlledValue */],
|
|
490
|
+
valueChange
|
|
496
491
|
);
|
|
492
|
+
valueChange(newValue);
|
|
497
493
|
run();
|
|
498
|
-
if (scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */) {
|
|
499
|
-
setSelectOptions(
|
|
500
|
-
el,
|
|
501
|
-
scope[nodeAccessor + ":" /* ControlledValue */],
|
|
502
|
-
valueChange
|
|
503
|
-
);
|
|
504
|
-
}
|
|
505
494
|
}
|
|
506
495
|
};
|
|
507
496
|
if (!el._) {
|
|
@@ -557,12 +546,10 @@ function controllable_detailsOrDialog_open_effect(scope, nodeAccessor) {
|
|
|
557
546
|
() => {
|
|
558
547
|
const openChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
|
559
548
|
if (openChange && hasChanged()) {
|
|
560
|
-
|
|
561
|
-
|
|
549
|
+
const newValue = el.open;
|
|
550
|
+
el.open = !newValue;
|
|
551
|
+
openChange(newValue);
|
|
562
552
|
run();
|
|
563
|
-
if (scope[nodeAccessor + "=" /* ControlledType */] === 6 /* Pending */) {
|
|
564
|
-
el.open = !el.open;
|
|
565
|
-
}
|
|
566
553
|
}
|
|
567
554
|
}
|
|
568
555
|
);
|
package/dist/debug/html.js
CHANGED
|
@@ -35,7 +35,6 @@ __export(html_exports, {
|
|
|
35
35
|
controllable_textarea_value: () => controllable_textarea_value,
|
|
36
36
|
createRenderer: () => createRenderer,
|
|
37
37
|
createTemplate: () => createTemplate,
|
|
38
|
-
debug: () => debug,
|
|
39
38
|
dynamicTagArgs: () => dynamicTagArgs,
|
|
40
39
|
dynamicTagInput: () => dynamicTagInput,
|
|
41
40
|
ensureScopeWithId: () => ensureScopeWithId,
|
|
@@ -114,9 +113,8 @@ function stringifyClassObject(name, value) {
|
|
|
114
113
|
function styleValue(value) {
|
|
115
114
|
return toDelimitedString(value, ";", stringifyStyleObject);
|
|
116
115
|
}
|
|
117
|
-
var NON_DIMENSIONAL = /^(--|ta|or|li|z)|n-c|i(do|nk|m|t)|w$|we/;
|
|
118
116
|
function stringifyStyleObject(name, value) {
|
|
119
|
-
return value || value === 0 ? `${name}:${typeof value === "number" && value &&
|
|
117
|
+
return value || value === 0 ? `${name}:${typeof value === "number" && value && !/^(--|ta|or|li|z)|cou|nk|it|ag|we|do|w$/.test(name) ? value + "px" : value}` : "";
|
|
120
118
|
}
|
|
121
119
|
function toDelimitedString(val, delimiter, stringify) {
|
|
122
120
|
switch (typeof val) {
|
|
@@ -585,15 +583,12 @@ var Reference = class {
|
|
|
585
583
|
assigns = "";
|
|
586
584
|
};
|
|
587
585
|
var DEBUG = /* @__PURE__ */ new WeakMap();
|
|
588
|
-
function
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
return obj;
|
|
586
|
+
function setDebugInfo(obj, file, loc, vars) {
|
|
587
|
+
DEBUG.set(obj, {
|
|
588
|
+
file,
|
|
589
|
+
loc,
|
|
590
|
+
vars
|
|
591
|
+
});
|
|
597
592
|
}
|
|
598
593
|
var Serializer = class {
|
|
599
594
|
#state = new State();
|
|
@@ -646,15 +641,11 @@ function writeRoot(state, root) {
|
|
|
646
641
|
if (writeProp(state, root, null, "")) {
|
|
647
642
|
const rootRef = state.refs.get(root);
|
|
648
643
|
if (rootRef) {
|
|
649
|
-
ensureId(state, rootRef);
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
if (assigned.delete(rootRef)) {
|
|
653
|
-
assigned.add(rootRef);
|
|
644
|
+
const rootId = ensureId(state, rootRef);
|
|
645
|
+
if (assigned.size) {
|
|
646
|
+
assigned.delete(rootRef);
|
|
654
647
|
writeAssigned(state);
|
|
655
|
-
|
|
656
|
-
writeAssigned(state);
|
|
657
|
-
buf.push("," + rootRef.id);
|
|
648
|
+
buf.push("," + rootRef.assigns + rootId);
|
|
658
649
|
}
|
|
659
650
|
}
|
|
660
651
|
result = "(";
|
|
@@ -674,8 +665,10 @@ function writeRoot(state, root) {
|
|
|
674
665
|
}
|
|
675
666
|
function writeAssigned(state) {
|
|
676
667
|
for (const valueRef of state.assigned) {
|
|
677
|
-
|
|
678
|
-
|
|
668
|
+
if (valueRef.assigns || valueRef.init) {
|
|
669
|
+
state.buf.push("," + valueRef.assigns + (valueRef.init || valueRef.id));
|
|
670
|
+
valueRef.init = "";
|
|
671
|
+
}
|
|
679
672
|
}
|
|
680
673
|
}
|
|
681
674
|
function writeProp(state, val, parent, accessor) {
|
|
@@ -743,6 +736,7 @@ function writeRegistered(state, val, parent, accessor, { access, scope }) {
|
|
|
743
736
|
state.refs.set(val, fnRef);
|
|
744
737
|
if (scopeRef) {
|
|
745
738
|
if (isCircular(parent, scopeRef)) {
|
|
739
|
+
state.assigned.add(parent);
|
|
746
740
|
state.assigned.add(fnRef);
|
|
747
741
|
fnRef.init = access + "(" + ensureId(state, scopeRef) + ")";
|
|
748
742
|
fnRef.assigns += ensureId(state, parent) + toAccess(accessor) + "=";
|
|
@@ -756,6 +750,7 @@ function writeRegistered(state, val, parent, accessor, { access, scope }) {
|
|
|
756
750
|
const scopeRef2 = parent && state.refs.get(scope);
|
|
757
751
|
const scopeId = scopeRef2 && ensureId(state, scopeRef2);
|
|
758
752
|
if (scopeId && assigns !== state.assigned.size) {
|
|
753
|
+
state.assigned.add(parent);
|
|
759
754
|
state.assigned.add(fnRef);
|
|
760
755
|
fnRef.init = access + "(" + scopeId + ")";
|
|
761
756
|
fnRef.assigns += ensureId(state, parent) + toAccess(accessor) + "=";
|
|
@@ -1271,26 +1266,31 @@ function writeObjectProps(state, val, ref) {
|
|
|
1271
1266
|
}
|
|
1272
1267
|
}
|
|
1273
1268
|
if (hasSymbolIterator(val)) {
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1269
|
+
const iterArr = [...val];
|
|
1270
|
+
switch (iterArr.length) {
|
|
1271
|
+
case 0:
|
|
1272
|
+
state.buf.push(sep + "*[Symbol.iterator](){}");
|
|
1273
|
+
break;
|
|
1274
|
+
case 1:
|
|
1275
|
+
state.buf.push(
|
|
1276
|
+
sep + "*[Symbol.iterator](){yield " + (iterArr[0] === val ? "this" : ensureId(state, ref)) + "}"
|
|
1277
|
+
);
|
|
1278
|
+
break;
|
|
1279
|
+
default: {
|
|
1280
|
+
const iterRef = new Reference(
|
|
1281
|
+
ref,
|
|
1282
|
+
null,
|
|
1283
|
+
state.flush,
|
|
1284
|
+
null,
|
|
1285
|
+
nextRefAccess(state)
|
|
1286
|
+
);
|
|
1287
|
+
state.buf.push(sep + "*[(" + iterRef.id + "=");
|
|
1288
|
+
writeArray(state, iterArr, iterRef);
|
|
1289
|
+
state.buf.push(",Symbol.iterator)](){yield*" + iterRef.id + "}");
|
|
1290
|
+
break;
|
|
1291
|
+
}
|
|
1293
1292
|
}
|
|
1293
|
+
sep = ",";
|
|
1294
1294
|
}
|
|
1295
1295
|
return sep;
|
|
1296
1296
|
}
|
|
@@ -1315,21 +1315,21 @@ function throwUnserializable(state, cause, ref = null, accessor = "") {
|
|
|
1315
1315
|
let message = "Unable to serialize";
|
|
1316
1316
|
let access = "";
|
|
1317
1317
|
while (ref?.accessor) {
|
|
1318
|
-
const
|
|
1319
|
-
if (
|
|
1320
|
-
const varLoc =
|
|
1318
|
+
const debug = ref.parent?.debug;
|
|
1319
|
+
if (debug) {
|
|
1320
|
+
const varLoc = debug.vars?.[ref.accessor];
|
|
1321
|
+
let debugAccess = ref.accessor;
|
|
1322
|
+
let debugLoc = debug.loc;
|
|
1321
1323
|
if (varLoc) {
|
|
1322
1324
|
if (Array.isArray(varLoc)) {
|
|
1323
|
-
|
|
1325
|
+
debugAccess = varLoc[0];
|
|
1326
|
+
if (varLoc[1]) debugLoc = varLoc[1];
|
|
1324
1327
|
} else {
|
|
1325
|
-
|
|
1326
|
-
}
|
|
1327
|
-
} else {
|
|
1328
|
-
message += ` ${JSON.stringify(ref.accessor)} in ${debug2.file}`;
|
|
1329
|
-
if (debug2.loc) {
|
|
1330
|
-
message += `:${debug2.loc}`;
|
|
1328
|
+
debugLoc = varLoc;
|
|
1331
1329
|
}
|
|
1332
1330
|
}
|
|
1331
|
+
message += ` ${JSON.stringify(debugAccess)} in ${debug.file}`;
|
|
1332
|
+
if (debugLoc) message += `:${debugLoc}`;
|
|
1333
1333
|
break;
|
|
1334
1334
|
}
|
|
1335
1335
|
access = toAccess(ref.accessor) + access;
|
|
@@ -1725,7 +1725,7 @@ function resumeSingleNodeConditional(cb, scopeId, accessor, onlyChild) {
|
|
|
1725
1725
|
)
|
|
1726
1726
|
);
|
|
1727
1727
|
}
|
|
1728
|
-
|
|
1728
|
+
var writeScope = (scopeId, partialScope) => {
|
|
1729
1729
|
const { state } = $chunk.boundary;
|
|
1730
1730
|
const { scopes } = state;
|
|
1731
1731
|
let scope = scopes.get(scopeId);
|
|
@@ -1749,6 +1749,15 @@ function writeScope(scopeId, partialScope) {
|
|
|
1749
1749
|
};
|
|
1750
1750
|
}
|
|
1751
1751
|
return scope;
|
|
1752
|
+
};
|
|
1753
|
+
if (true) {
|
|
1754
|
+
writeScope = /* @__PURE__ */ ((writeScope2) => (scopeId, partialScope, file, loc, vars) => {
|
|
1755
|
+
const scope = writeScope2(scopeId, partialScope);
|
|
1756
|
+
if (file && loc !== void 0) {
|
|
1757
|
+
setDebugInfo(scope, file, loc, vars);
|
|
1758
|
+
}
|
|
1759
|
+
return scope;
|
|
1760
|
+
})(writeScope);
|
|
1752
1761
|
}
|
|
1753
1762
|
function writeExistingScope(scope) {
|
|
1754
1763
|
return writeScope(scope[K_SCOPE_ID], scope);
|
|
@@ -2963,7 +2972,6 @@ function NOOP2() {
|
|
|
2963
2972
|
controllable_textarea_value,
|
|
2964
2973
|
createRenderer,
|
|
2965
2974
|
createTemplate,
|
|
2966
|
-
debug,
|
|
2967
2975
|
dynamicTagArgs,
|
|
2968
2976
|
dynamicTagInput,
|
|
2969
2977
|
ensureScopeWithId,
|
package/dist/debug/html.mjs
CHANGED
|
@@ -32,9 +32,8 @@ function stringifyClassObject(name, value) {
|
|
|
32
32
|
function styleValue(value) {
|
|
33
33
|
return toDelimitedString(value, ";", stringifyStyleObject);
|
|
34
34
|
}
|
|
35
|
-
var NON_DIMENSIONAL = /^(--|ta|or|li|z)|n-c|i(do|nk|m|t)|w$|we/;
|
|
36
35
|
function stringifyStyleObject(name, value) {
|
|
37
|
-
return value || value === 0 ? `${name}:${typeof value === "number" && value &&
|
|
36
|
+
return value || value === 0 ? `${name}:${typeof value === "number" && value && !/^(--|ta|or|li|z)|cou|nk|it|ag|we|do|w$/.test(name) ? value + "px" : value}` : "";
|
|
38
37
|
}
|
|
39
38
|
function toDelimitedString(val, delimiter, stringify) {
|
|
40
39
|
switch (typeof val) {
|
|
@@ -503,15 +502,12 @@ var Reference = class {
|
|
|
503
502
|
assigns = "";
|
|
504
503
|
};
|
|
505
504
|
var DEBUG = /* @__PURE__ */ new WeakMap();
|
|
506
|
-
function
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
return obj;
|
|
505
|
+
function setDebugInfo(obj, file, loc, vars) {
|
|
506
|
+
DEBUG.set(obj, {
|
|
507
|
+
file,
|
|
508
|
+
loc,
|
|
509
|
+
vars
|
|
510
|
+
});
|
|
515
511
|
}
|
|
516
512
|
var Serializer = class {
|
|
517
513
|
#state = new State();
|
|
@@ -564,15 +560,11 @@ function writeRoot(state, root) {
|
|
|
564
560
|
if (writeProp(state, root, null, "")) {
|
|
565
561
|
const rootRef = state.refs.get(root);
|
|
566
562
|
if (rootRef) {
|
|
567
|
-
ensureId(state, rootRef);
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
if (assigned.delete(rootRef)) {
|
|
571
|
-
assigned.add(rootRef);
|
|
563
|
+
const rootId = ensureId(state, rootRef);
|
|
564
|
+
if (assigned.size) {
|
|
565
|
+
assigned.delete(rootRef);
|
|
572
566
|
writeAssigned(state);
|
|
573
|
-
|
|
574
|
-
writeAssigned(state);
|
|
575
|
-
buf.push("," + rootRef.id);
|
|
567
|
+
buf.push("," + rootRef.assigns + rootId);
|
|
576
568
|
}
|
|
577
569
|
}
|
|
578
570
|
result = "(";
|
|
@@ -592,8 +584,10 @@ function writeRoot(state, root) {
|
|
|
592
584
|
}
|
|
593
585
|
function writeAssigned(state) {
|
|
594
586
|
for (const valueRef of state.assigned) {
|
|
595
|
-
|
|
596
|
-
|
|
587
|
+
if (valueRef.assigns || valueRef.init) {
|
|
588
|
+
state.buf.push("," + valueRef.assigns + (valueRef.init || valueRef.id));
|
|
589
|
+
valueRef.init = "";
|
|
590
|
+
}
|
|
597
591
|
}
|
|
598
592
|
}
|
|
599
593
|
function writeProp(state, val, parent, accessor) {
|
|
@@ -661,6 +655,7 @@ function writeRegistered(state, val, parent, accessor, { access, scope }) {
|
|
|
661
655
|
state.refs.set(val, fnRef);
|
|
662
656
|
if (scopeRef) {
|
|
663
657
|
if (isCircular(parent, scopeRef)) {
|
|
658
|
+
state.assigned.add(parent);
|
|
664
659
|
state.assigned.add(fnRef);
|
|
665
660
|
fnRef.init = access + "(" + ensureId(state, scopeRef) + ")";
|
|
666
661
|
fnRef.assigns += ensureId(state, parent) + toAccess(accessor) + "=";
|
|
@@ -674,6 +669,7 @@ function writeRegistered(state, val, parent, accessor, { access, scope }) {
|
|
|
674
669
|
const scopeRef2 = parent && state.refs.get(scope);
|
|
675
670
|
const scopeId = scopeRef2 && ensureId(state, scopeRef2);
|
|
676
671
|
if (scopeId && assigns !== state.assigned.size) {
|
|
672
|
+
state.assigned.add(parent);
|
|
677
673
|
state.assigned.add(fnRef);
|
|
678
674
|
fnRef.init = access + "(" + scopeId + ")";
|
|
679
675
|
fnRef.assigns += ensureId(state, parent) + toAccess(accessor) + "=";
|
|
@@ -1189,26 +1185,31 @@ function writeObjectProps(state, val, ref) {
|
|
|
1189
1185
|
}
|
|
1190
1186
|
}
|
|
1191
1187
|
if (hasSymbolIterator(val)) {
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1188
|
+
const iterArr = [...val];
|
|
1189
|
+
switch (iterArr.length) {
|
|
1190
|
+
case 0:
|
|
1191
|
+
state.buf.push(sep + "*[Symbol.iterator](){}");
|
|
1192
|
+
break;
|
|
1193
|
+
case 1:
|
|
1194
|
+
state.buf.push(
|
|
1195
|
+
sep + "*[Symbol.iterator](){yield " + (iterArr[0] === val ? "this" : ensureId(state, ref)) + "}"
|
|
1196
|
+
);
|
|
1197
|
+
break;
|
|
1198
|
+
default: {
|
|
1199
|
+
const iterRef = new Reference(
|
|
1200
|
+
ref,
|
|
1201
|
+
null,
|
|
1202
|
+
state.flush,
|
|
1203
|
+
null,
|
|
1204
|
+
nextRefAccess(state)
|
|
1205
|
+
);
|
|
1206
|
+
state.buf.push(sep + "*[(" + iterRef.id + "=");
|
|
1207
|
+
writeArray(state, iterArr, iterRef);
|
|
1208
|
+
state.buf.push(",Symbol.iterator)](){yield*" + iterRef.id + "}");
|
|
1209
|
+
break;
|
|
1210
|
+
}
|
|
1211
1211
|
}
|
|
1212
|
+
sep = ",";
|
|
1212
1213
|
}
|
|
1213
1214
|
return sep;
|
|
1214
1215
|
}
|
|
@@ -1233,21 +1234,21 @@ function throwUnserializable(state, cause, ref = null, accessor = "") {
|
|
|
1233
1234
|
let message = "Unable to serialize";
|
|
1234
1235
|
let access = "";
|
|
1235
1236
|
while (ref?.accessor) {
|
|
1236
|
-
const
|
|
1237
|
-
if (
|
|
1238
|
-
const varLoc =
|
|
1237
|
+
const debug = ref.parent?.debug;
|
|
1238
|
+
if (debug) {
|
|
1239
|
+
const varLoc = debug.vars?.[ref.accessor];
|
|
1240
|
+
let debugAccess = ref.accessor;
|
|
1241
|
+
let debugLoc = debug.loc;
|
|
1239
1242
|
if (varLoc) {
|
|
1240
1243
|
if (Array.isArray(varLoc)) {
|
|
1241
|
-
|
|
1244
|
+
debugAccess = varLoc[0];
|
|
1245
|
+
if (varLoc[1]) debugLoc = varLoc[1];
|
|
1242
1246
|
} else {
|
|
1243
|
-
|
|
1244
|
-
}
|
|
1245
|
-
} else {
|
|
1246
|
-
message += ` ${JSON.stringify(ref.accessor)} in ${debug2.file}`;
|
|
1247
|
-
if (debug2.loc) {
|
|
1248
|
-
message += `:${debug2.loc}`;
|
|
1247
|
+
debugLoc = varLoc;
|
|
1249
1248
|
}
|
|
1250
1249
|
}
|
|
1250
|
+
message += ` ${JSON.stringify(debugAccess)} in ${debug.file}`;
|
|
1251
|
+
if (debugLoc) message += `:${debugLoc}`;
|
|
1251
1252
|
break;
|
|
1252
1253
|
}
|
|
1253
1254
|
access = toAccess(ref.accessor) + access;
|
|
@@ -1643,7 +1644,7 @@ function resumeSingleNodeConditional(cb, scopeId, accessor, onlyChild) {
|
|
|
1643
1644
|
)
|
|
1644
1645
|
);
|
|
1645
1646
|
}
|
|
1646
|
-
|
|
1647
|
+
var writeScope = (scopeId, partialScope) => {
|
|
1647
1648
|
const { state } = $chunk.boundary;
|
|
1648
1649
|
const { scopes } = state;
|
|
1649
1650
|
let scope = scopes.get(scopeId);
|
|
@@ -1667,6 +1668,15 @@ function writeScope(scopeId, partialScope) {
|
|
|
1667
1668
|
};
|
|
1668
1669
|
}
|
|
1669
1670
|
return scope;
|
|
1671
|
+
};
|
|
1672
|
+
if (true) {
|
|
1673
|
+
writeScope = /* @__PURE__ */ ((writeScope2) => (scopeId, partialScope, file, loc, vars) => {
|
|
1674
|
+
const scope = writeScope2(scopeId, partialScope);
|
|
1675
|
+
if (file && loc !== void 0) {
|
|
1676
|
+
setDebugInfo(scope, file, loc, vars);
|
|
1677
|
+
}
|
|
1678
|
+
return scope;
|
|
1679
|
+
})(writeScope);
|
|
1670
1680
|
}
|
|
1671
1681
|
function writeExistingScope(scope) {
|
|
1672
1682
|
return writeScope(scope[K_SCOPE_ID], scope);
|
|
@@ -2880,7 +2890,6 @@ export {
|
|
|
2880
2890
|
controllable_textarea_value,
|
|
2881
2891
|
createRenderer,
|
|
2882
2892
|
createTemplate,
|
|
2883
|
-
debug,
|
|
2884
2893
|
dynamicTagArgs,
|
|
2885
2894
|
dynamicTagInput,
|
|
2886
2895
|
ensureScopeWithId,
|