@marko/runtime-tags 0.3.41 → 0.3.42
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 +35 -31
- package/dist/debug/html.mjs +35 -31
- package/dist/dom.js +35 -26
- package/dist/dom.mjs +35 -26
- package/dist/html.js +33 -21
- package/dist/html.mjs +33 -21
- package/dist/translator/index.js +1 -2
- 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
|
@@ -114,9 +114,8 @@ function stringifyClassObject(name, value) {
|
|
|
114
114
|
function styleValue(value) {
|
|
115
115
|
return toDelimitedString(value, ";", stringifyStyleObject);
|
|
116
116
|
}
|
|
117
|
-
var NON_DIMENSIONAL = /^(--|ta|or|li|z)|n-c|i(do|nk|m|t)|w$|we/;
|
|
118
117
|
function stringifyStyleObject(name, value) {
|
|
119
|
-
return value || value === 0 ? `${name}:${typeof value === "number" && value &&
|
|
118
|
+
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
119
|
}
|
|
121
120
|
function toDelimitedString(val, delimiter, stringify) {
|
|
122
121
|
switch (typeof val) {
|
|
@@ -646,15 +645,11 @@ function writeRoot(state, root) {
|
|
|
646
645
|
if (writeProp(state, root, null, "")) {
|
|
647
646
|
const rootRef = state.refs.get(root);
|
|
648
647
|
if (rootRef) {
|
|
649
|
-
ensureId(state, rootRef);
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
if (assigned.delete(rootRef)) {
|
|
653
|
-
assigned.add(rootRef);
|
|
654
|
-
writeAssigned(state);
|
|
655
|
-
} else {
|
|
648
|
+
const rootId = ensureId(state, rootRef);
|
|
649
|
+
if (assigned.size) {
|
|
650
|
+
assigned.delete(rootRef);
|
|
656
651
|
writeAssigned(state);
|
|
657
|
-
buf.push("," + rootRef.
|
|
652
|
+
buf.push("," + rootRef.assigns + rootId);
|
|
658
653
|
}
|
|
659
654
|
}
|
|
660
655
|
result = "(";
|
|
@@ -674,8 +669,10 @@ function writeRoot(state, root) {
|
|
|
674
669
|
}
|
|
675
670
|
function writeAssigned(state) {
|
|
676
671
|
for (const valueRef of state.assigned) {
|
|
677
|
-
|
|
678
|
-
|
|
672
|
+
if (valueRef.assigns || valueRef.init) {
|
|
673
|
+
state.buf.push("," + valueRef.assigns + (valueRef.init || valueRef.id));
|
|
674
|
+
valueRef.init = "";
|
|
675
|
+
}
|
|
679
676
|
}
|
|
680
677
|
}
|
|
681
678
|
function writeProp(state, val, parent, accessor) {
|
|
@@ -743,6 +740,7 @@ function writeRegistered(state, val, parent, accessor, { access, scope }) {
|
|
|
743
740
|
state.refs.set(val, fnRef);
|
|
744
741
|
if (scopeRef) {
|
|
745
742
|
if (isCircular(parent, scopeRef)) {
|
|
743
|
+
state.assigned.add(parent);
|
|
746
744
|
state.assigned.add(fnRef);
|
|
747
745
|
fnRef.init = access + "(" + ensureId(state, scopeRef) + ")";
|
|
748
746
|
fnRef.assigns += ensureId(state, parent) + toAccess(accessor) + "=";
|
|
@@ -756,6 +754,7 @@ function writeRegistered(state, val, parent, accessor, { access, scope }) {
|
|
|
756
754
|
const scopeRef2 = parent && state.refs.get(scope);
|
|
757
755
|
const scopeId = scopeRef2 && ensureId(state, scopeRef2);
|
|
758
756
|
if (scopeId && assigns !== state.assigned.size) {
|
|
757
|
+
state.assigned.add(parent);
|
|
759
758
|
state.assigned.add(fnRef);
|
|
760
759
|
fnRef.init = access + "(" + scopeId + ")";
|
|
761
760
|
fnRef.assigns += ensureId(state, parent) + toAccess(accessor) + "=";
|
|
@@ -1271,26 +1270,31 @@ function writeObjectProps(state, val, ref) {
|
|
|
1271
1270
|
}
|
|
1272
1271
|
}
|
|
1273
1272
|
if (hasSymbolIterator(val)) {
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1273
|
+
const iterArr = [...val];
|
|
1274
|
+
switch (iterArr.length) {
|
|
1275
|
+
case 0:
|
|
1276
|
+
state.buf.push(sep + "*[Symbol.iterator](){}");
|
|
1277
|
+
break;
|
|
1278
|
+
case 1:
|
|
1279
|
+
state.buf.push(
|
|
1280
|
+
sep + "*[Symbol.iterator](){yield " + (iterArr[0] === val ? "this" : ensureId(state, ref)) + "}"
|
|
1281
|
+
);
|
|
1282
|
+
break;
|
|
1283
|
+
default: {
|
|
1284
|
+
const iterRef = new Reference(
|
|
1285
|
+
ref,
|
|
1286
|
+
null,
|
|
1287
|
+
state.flush,
|
|
1288
|
+
null,
|
|
1289
|
+
nextRefAccess(state)
|
|
1290
|
+
);
|
|
1291
|
+
state.buf.push(sep + "*[(" + iterRef.id + "=");
|
|
1292
|
+
writeArray(state, iterArr, iterRef);
|
|
1293
|
+
state.buf.push(",Symbol.iterator)](){yield*" + iterRef.id + "}");
|
|
1294
|
+
break;
|
|
1295
|
+
}
|
|
1293
1296
|
}
|
|
1297
|
+
sep = ",";
|
|
1294
1298
|
}
|
|
1295
1299
|
return sep;
|
|
1296
1300
|
}
|
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) {
|
|
@@ -564,15 +563,11 @@ function writeRoot(state, root) {
|
|
|
564
563
|
if (writeProp(state, root, null, "")) {
|
|
565
564
|
const rootRef = state.refs.get(root);
|
|
566
565
|
if (rootRef) {
|
|
567
|
-
ensureId(state, rootRef);
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
if (assigned.delete(rootRef)) {
|
|
571
|
-
assigned.add(rootRef);
|
|
572
|
-
writeAssigned(state);
|
|
573
|
-
} else {
|
|
566
|
+
const rootId = ensureId(state, rootRef);
|
|
567
|
+
if (assigned.size) {
|
|
568
|
+
assigned.delete(rootRef);
|
|
574
569
|
writeAssigned(state);
|
|
575
|
-
buf.push("," + rootRef.
|
|
570
|
+
buf.push("," + rootRef.assigns + rootId);
|
|
576
571
|
}
|
|
577
572
|
}
|
|
578
573
|
result = "(";
|
|
@@ -592,8 +587,10 @@ function writeRoot(state, root) {
|
|
|
592
587
|
}
|
|
593
588
|
function writeAssigned(state) {
|
|
594
589
|
for (const valueRef of state.assigned) {
|
|
595
|
-
|
|
596
|
-
|
|
590
|
+
if (valueRef.assigns || valueRef.init) {
|
|
591
|
+
state.buf.push("," + valueRef.assigns + (valueRef.init || valueRef.id));
|
|
592
|
+
valueRef.init = "";
|
|
593
|
+
}
|
|
597
594
|
}
|
|
598
595
|
}
|
|
599
596
|
function writeProp(state, val, parent, accessor) {
|
|
@@ -661,6 +658,7 @@ function writeRegistered(state, val, parent, accessor, { access, scope }) {
|
|
|
661
658
|
state.refs.set(val, fnRef);
|
|
662
659
|
if (scopeRef) {
|
|
663
660
|
if (isCircular(parent, scopeRef)) {
|
|
661
|
+
state.assigned.add(parent);
|
|
664
662
|
state.assigned.add(fnRef);
|
|
665
663
|
fnRef.init = access + "(" + ensureId(state, scopeRef) + ")";
|
|
666
664
|
fnRef.assigns += ensureId(state, parent) + toAccess(accessor) + "=";
|
|
@@ -674,6 +672,7 @@ function writeRegistered(state, val, parent, accessor, { access, scope }) {
|
|
|
674
672
|
const scopeRef2 = parent && state.refs.get(scope);
|
|
675
673
|
const scopeId = scopeRef2 && ensureId(state, scopeRef2);
|
|
676
674
|
if (scopeId && assigns !== state.assigned.size) {
|
|
675
|
+
state.assigned.add(parent);
|
|
677
676
|
state.assigned.add(fnRef);
|
|
678
677
|
fnRef.init = access + "(" + scopeId + ")";
|
|
679
678
|
fnRef.assigns += ensureId(state, parent) + toAccess(accessor) + "=";
|
|
@@ -1189,26 +1188,31 @@ function writeObjectProps(state, val, ref) {
|
|
|
1189
1188
|
}
|
|
1190
1189
|
}
|
|
1191
1190
|
if (hasSymbolIterator(val)) {
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1191
|
+
const iterArr = [...val];
|
|
1192
|
+
switch (iterArr.length) {
|
|
1193
|
+
case 0:
|
|
1194
|
+
state.buf.push(sep + "*[Symbol.iterator](){}");
|
|
1195
|
+
break;
|
|
1196
|
+
case 1:
|
|
1197
|
+
state.buf.push(
|
|
1198
|
+
sep + "*[Symbol.iterator](){yield " + (iterArr[0] === val ? "this" : ensureId(state, ref)) + "}"
|
|
1199
|
+
);
|
|
1200
|
+
break;
|
|
1201
|
+
default: {
|
|
1202
|
+
const iterRef = new Reference(
|
|
1203
|
+
ref,
|
|
1204
|
+
null,
|
|
1205
|
+
state.flush,
|
|
1206
|
+
null,
|
|
1207
|
+
nextRefAccess(state)
|
|
1208
|
+
);
|
|
1209
|
+
state.buf.push(sep + "*[(" + iterRef.id + "=");
|
|
1210
|
+
writeArray(state, iterArr, iterRef);
|
|
1211
|
+
state.buf.push(",Symbol.iterator)](){yield*" + iterRef.id + "}");
|
|
1212
|
+
break;
|
|
1213
|
+
}
|
|
1211
1214
|
}
|
|
1215
|
+
sep = ",";
|
|
1212
1216
|
}
|
|
1213
1217
|
return sep;
|
|
1214
1218
|
}
|
package/dist/dom.js
CHANGED
|
@@ -121,9 +121,8 @@ function stringifyClassObject(name, value2) {
|
|
|
121
121
|
function styleValue(value2) {
|
|
122
122
|
return toDelimitedString(value2, ";", stringifyStyleObject);
|
|
123
123
|
}
|
|
124
|
-
var NON_DIMENSIONAL = /^(--|ta|or|li|z)|n-c|i(do|nk|m|t)|w$|we/;
|
|
125
124
|
function stringifyStyleObject(name, value2) {
|
|
126
|
-
return value2 || value2 === 0 ? `${name}:${typeof value2 == "number" && value2 &&
|
|
125
|
+
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}` : "";
|
|
127
126
|
}
|
|
128
127
|
function toDelimitedString(val, delimiter, stringify) {
|
|
129
128
|
switch (typeof val) {
|
|
@@ -333,7 +332,10 @@ function controllable_input_checked_effect(scope, nodeAccessor) {
|
|
|
333
332
|
let el = scope[nodeAccessor];
|
|
334
333
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
|
335
334
|
let checkedChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
|
336
|
-
|
|
335
|
+
if (checkedChange) {
|
|
336
|
+
let newValue = el.checked;
|
|
337
|
+
el.checked = !newValue, checkedChange(newValue), run();
|
|
338
|
+
}
|
|
337
339
|
});
|
|
338
340
|
}
|
|
339
341
|
function controllable_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValueChange, value2) {
|
|
@@ -350,17 +352,15 @@ function controllable_input_checkedValue_effect(scope, nodeAccessor) {
|
|
|
350
352
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
|
351
353
|
let checkedValueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
|
352
354
|
if (checkedValueChange) {
|
|
353
|
-
let oldValue = scope[nodeAccessor + ":" /* ControlledValue */];
|
|
354
|
-
if (
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
else
|
|
363
|
-
el.checked = !el.checked;
|
|
355
|
+
let oldValue = scope[nodeAccessor + ":" /* ControlledValue */], newValue = Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0;
|
|
356
|
+
if (el.name && el.type[0] === "r")
|
|
357
|
+
for (let radio of el.getRootNode().querySelectorAll(
|
|
358
|
+
`[type=radio][name=${CSS.escape(el.name)}]`
|
|
359
|
+
))
|
|
360
|
+
radio.form === el.form && (radio.checked = Array.isArray(oldValue) ? oldValue.includes(radio.value) : oldValue === radio.value);
|
|
361
|
+
else
|
|
362
|
+
el.checked = !el.checked;
|
|
363
|
+
checkedValueChange(newValue), run();
|
|
364
364
|
}
|
|
365
365
|
});
|
|
366
366
|
}
|
|
@@ -372,10 +372,13 @@ function controllable_input_value_effect(scope, nodeAccessor) {
|
|
|
372
372
|
let el = scope[nodeAccessor];
|
|
373
373
|
isResuming && (scope[nodeAccessor + ":" /* ControlledValue */] = el.defaultValue), syncControllable(el, "input", hasValueChanged, (ev) => {
|
|
374
374
|
let valueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
|
375
|
-
|
|
376
|
-
el
|
|
377
|
-
|
|
378
|
-
|
|
375
|
+
if (valueChange) {
|
|
376
|
+
let newValue = el.value;
|
|
377
|
+
inputType = ev?.inputType, setValueAndUpdateSelection(
|
|
378
|
+
el,
|
|
379
|
+
scope[nodeAccessor + ":" /* ControlledValue */]
|
|
380
|
+
), valueChange(newValue), run(), inputType = "";
|
|
381
|
+
}
|
|
379
382
|
});
|
|
380
383
|
}
|
|
381
384
|
function controllable_select_value(scope, nodeAccessor, value2, valueChange) {
|
|
@@ -391,13 +394,16 @@ function controllable_select_value(scope, nodeAccessor, value2, valueChange) {
|
|
|
391
394
|
function controllable_select_value_effect(scope, nodeAccessor) {
|
|
392
395
|
let el = scope[nodeAccessor], onChange = () => {
|
|
393
396
|
let valueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
el,
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
397
|
+
if (valueChange) {
|
|
398
|
+
let newValue = Array.isArray(
|
|
399
|
+
scope[nodeAccessor + ":" /* ControlledValue */]
|
|
400
|
+
) ? Array.from(el.selectedOptions, toValueProp) : el.value;
|
|
401
|
+
setSelectOptions(
|
|
402
|
+
el,
|
|
403
|
+
scope[nodeAccessor + ":" /* ControlledValue */],
|
|
404
|
+
valueChange
|
|
405
|
+
), valueChange(newValue), run();
|
|
406
|
+
}
|
|
401
407
|
};
|
|
402
408
|
el._ || new MutationObserver(() => {
|
|
403
409
|
let value2 = scope[nodeAccessor + ":" /* ControlledValue */];
|
|
@@ -433,7 +439,10 @@ function controllable_detailsOrDialog_open_effect(scope, nodeAccessor) {
|
|
|
433
439
|
hasChanged,
|
|
434
440
|
() => {
|
|
435
441
|
let openChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
|
436
|
-
openChange && hasChanged()
|
|
442
|
+
if (openChange && hasChanged()) {
|
|
443
|
+
let newValue = el.open;
|
|
444
|
+
el.open = !newValue, openChange(newValue), run();
|
|
445
|
+
}
|
|
437
446
|
}
|
|
438
447
|
);
|
|
439
448
|
}
|
package/dist/dom.mjs
CHANGED
|
@@ -38,9 +38,8 @@ function stringifyClassObject(name, value2) {
|
|
|
38
38
|
function styleValue(value2) {
|
|
39
39
|
return toDelimitedString(value2, ";", stringifyStyleObject);
|
|
40
40
|
}
|
|
41
|
-
var NON_DIMENSIONAL = /^(--|ta|or|li|z)|n-c|i(do|nk|m|t)|w$|we/;
|
|
42
41
|
function stringifyStyleObject(name, value2) {
|
|
43
|
-
return value2 || value2 === 0 ? `${name}:${typeof value2 == "number" && value2 &&
|
|
42
|
+
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}` : "";
|
|
44
43
|
}
|
|
45
44
|
function toDelimitedString(val, delimiter, stringify) {
|
|
46
45
|
switch (typeof val) {
|
|
@@ -250,7 +249,10 @@ function controllable_input_checked_effect(scope, nodeAccessor) {
|
|
|
250
249
|
let el = scope[nodeAccessor];
|
|
251
250
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
|
252
251
|
let checkedChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
|
253
|
-
|
|
252
|
+
if (checkedChange) {
|
|
253
|
+
let newValue = el.checked;
|
|
254
|
+
el.checked = !newValue, checkedChange(newValue), run();
|
|
255
|
+
}
|
|
254
256
|
});
|
|
255
257
|
}
|
|
256
258
|
function controllable_input_checkedValue(scope, nodeAccessor, checkedValue, checkedValueChange, value2) {
|
|
@@ -267,17 +269,15 @@ function controllable_input_checkedValue_effect(scope, nodeAccessor) {
|
|
|
267
269
|
syncControllable(el, "input", hasCheckboxChanged, () => {
|
|
268
270
|
let checkedValueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
|
269
271
|
if (checkedValueChange) {
|
|
270
|
-
let oldValue = scope[nodeAccessor + ":" /* ControlledValue */];
|
|
271
|
-
if (
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
else
|
|
280
|
-
el.checked = !el.checked;
|
|
272
|
+
let oldValue = scope[nodeAccessor + ":" /* ControlledValue */], newValue = Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0;
|
|
273
|
+
if (el.name && el.type[0] === "r")
|
|
274
|
+
for (let radio of el.getRootNode().querySelectorAll(
|
|
275
|
+
`[type=radio][name=${CSS.escape(el.name)}]`
|
|
276
|
+
))
|
|
277
|
+
radio.form === el.form && (radio.checked = Array.isArray(oldValue) ? oldValue.includes(radio.value) : oldValue === radio.value);
|
|
278
|
+
else
|
|
279
|
+
el.checked = !el.checked;
|
|
280
|
+
checkedValueChange(newValue), run();
|
|
281
281
|
}
|
|
282
282
|
});
|
|
283
283
|
}
|
|
@@ -289,10 +289,13 @@ function controllable_input_value_effect(scope, nodeAccessor) {
|
|
|
289
289
|
let el = scope[nodeAccessor];
|
|
290
290
|
isResuming && (scope[nodeAccessor + ":" /* ControlledValue */] = el.defaultValue), syncControllable(el, "input", hasValueChanged, (ev) => {
|
|
291
291
|
let valueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
|
292
|
-
|
|
293
|
-
el
|
|
294
|
-
|
|
295
|
-
|
|
292
|
+
if (valueChange) {
|
|
293
|
+
let newValue = el.value;
|
|
294
|
+
inputType = ev?.inputType, setValueAndUpdateSelection(
|
|
295
|
+
el,
|
|
296
|
+
scope[nodeAccessor + ":" /* ControlledValue */]
|
|
297
|
+
), valueChange(newValue), run(), inputType = "";
|
|
298
|
+
}
|
|
296
299
|
});
|
|
297
300
|
}
|
|
298
301
|
function controllable_select_value(scope, nodeAccessor, value2, valueChange) {
|
|
@@ -308,13 +311,16 @@ function controllable_select_value(scope, nodeAccessor, value2, valueChange) {
|
|
|
308
311
|
function controllable_select_value_effect(scope, nodeAccessor) {
|
|
309
312
|
let el = scope[nodeAccessor], onChange = () => {
|
|
310
313
|
let valueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
el,
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
314
|
+
if (valueChange) {
|
|
315
|
+
let newValue = Array.isArray(
|
|
316
|
+
scope[nodeAccessor + ":" /* ControlledValue */]
|
|
317
|
+
) ? Array.from(el.selectedOptions, toValueProp) : el.value;
|
|
318
|
+
setSelectOptions(
|
|
319
|
+
el,
|
|
320
|
+
scope[nodeAccessor + ":" /* ControlledValue */],
|
|
321
|
+
valueChange
|
|
322
|
+
), valueChange(newValue), run();
|
|
323
|
+
}
|
|
318
324
|
};
|
|
319
325
|
el._ || new MutationObserver(() => {
|
|
320
326
|
let value2 = scope[nodeAccessor + ":" /* ControlledValue */];
|
|
@@ -350,7 +356,10 @@ function controllable_detailsOrDialog_open_effect(scope, nodeAccessor) {
|
|
|
350
356
|
hasChanged,
|
|
351
357
|
() => {
|
|
352
358
|
let openChange = scope[nodeAccessor + ";" /* ControlledHandler */];
|
|
353
|
-
openChange && hasChanged()
|
|
359
|
+
if (openChange && hasChanged()) {
|
|
360
|
+
let newValue = el.open;
|
|
361
|
+
el.open = !newValue, openChange(newValue), run();
|
|
362
|
+
}
|
|
354
363
|
}
|
|
355
364
|
);
|
|
356
365
|
}
|
package/dist/html.js
CHANGED
|
@@ -99,9 +99,8 @@ function stringifyClassObject(name, value) {
|
|
|
99
99
|
function styleValue(value) {
|
|
100
100
|
return toDelimitedString(value, ";", stringifyStyleObject);
|
|
101
101
|
}
|
|
102
|
-
var NON_DIMENSIONAL = /^(--|ta|or|li|z)|n-c|i(do|nk|m|t)|w$|we/;
|
|
103
102
|
function stringifyStyleObject(name, value) {
|
|
104
|
-
return value || value === 0 ? `${name}:${typeof value == "number" && value &&
|
|
103
|
+
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}` : "";
|
|
105
104
|
}
|
|
106
105
|
function toDelimitedString(val, delimiter, stringify) {
|
|
107
106
|
switch (typeof val) {
|
|
@@ -479,7 +478,11 @@ function writeRoot(state, root) {
|
|
|
479
478
|
let { buf, assigned } = state, hadBuf = buf.length !== 0, result = "";
|
|
480
479
|
if (hadBuf && buf.push(","), writeProp(state, root, null, "")) {
|
|
481
480
|
let rootRef = state.refs.get(root);
|
|
482
|
-
|
|
481
|
+
if (rootRef) {
|
|
482
|
+
let rootId = ensureId(state, rootRef);
|
|
483
|
+
assigned.size && (assigned.delete(rootRef), writeAssigned(state), buf.push("," + rootRef.assigns + rootId));
|
|
484
|
+
}
|
|
485
|
+
result = "(", buf.push(")");
|
|
483
486
|
} else
|
|
484
487
|
hadBuf && (buf.pop(), writeAssigned(state)), result = "{", buf.push("}");
|
|
485
488
|
for (let chunk of buf)
|
|
@@ -488,7 +491,7 @@ function writeRoot(state, root) {
|
|
|
488
491
|
}
|
|
489
492
|
function writeAssigned(state) {
|
|
490
493
|
for (let valueRef of state.assigned)
|
|
491
|
-
state.buf.push("," + valueRef.assigns + (valueRef.init || valueRef.id)), valueRef.init = "";
|
|
494
|
+
(valueRef.assigns || valueRef.init) && (state.buf.push("," + valueRef.assigns + (valueRef.init || valueRef.id)), valueRef.init = "");
|
|
492
495
|
}
|
|
493
496
|
function writeProp(state, val, parent, accessor) {
|
|
494
497
|
switch (typeof val) {
|
|
@@ -530,13 +533,13 @@ function writeRegistered(state, val, parent, accessor, { access, scope }) {
|
|
|
530
533
|
);
|
|
531
534
|
if (state.refs.set(val, fnRef), scopeRef) {
|
|
532
535
|
if (isCircular(parent, scopeRef))
|
|
533
|
-
return state.assigned.add(fnRef), fnRef.init = access + "(" + ensureId(state, scopeRef) + ")", fnRef.assigns += ensureId(state, parent) + toAccess(accessor) + "=", !1;
|
|
536
|
+
return state.assigned.add(parent), state.assigned.add(fnRef), fnRef.init = access + "(" + ensureId(state, scopeRef) + ")", fnRef.assigns += ensureId(state, parent) + toAccess(accessor) + "=", !1;
|
|
534
537
|
state.buf.push(access + "(" + ensureId(state, scopeRef) + ")");
|
|
535
538
|
} else {
|
|
536
539
|
let pos = state.buf.push(""), assigns = state.assigned.size;
|
|
537
540
|
writeProp(state, scope, parent, "");
|
|
538
541
|
let scopeRef2 = parent && state.refs.get(scope), scopeId = scopeRef2 && ensureId(state, scopeRef2);
|
|
539
|
-
scopeId && assigns !== state.assigned.size ? (state.assigned.add(fnRef), fnRef.init = access + "(" + scopeId + ")", fnRef.assigns += ensureId(state, parent) + toAccess(accessor) + "=") : (state.buf[pos - 2] += access + "(", state.buf.push(")"));
|
|
542
|
+
scopeId && assigns !== state.assigned.size ? (state.assigned.add(parent), state.assigned.add(fnRef), fnRef.init = access + "(" + scopeId + ")", fnRef.assigns += ensureId(state, parent) + toAccess(accessor) + "=") : (state.buf[pos - 2] += access + "(", state.buf.push(")"));
|
|
540
543
|
}
|
|
541
544
|
} else
|
|
542
545
|
state.buf.push(access);
|
|
@@ -821,21 +824,30 @@ function writeObjectProps(state, val, ref) {
|
|
|
821
824
|
escapedKey
|
|
822
825
|
) ? sep = "," : state.buf.pop();
|
|
823
826
|
}
|
|
824
|
-
if (hasSymbolIterator(val)
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
827
|
+
if (hasSymbolIterator(val)) {
|
|
828
|
+
let iterArr = [...val];
|
|
829
|
+
switch (iterArr.length) {
|
|
830
|
+
case 0:
|
|
831
|
+
state.buf.push(sep + "*[Symbol.iterator](){}");
|
|
832
|
+
break;
|
|
833
|
+
case 1:
|
|
834
|
+
state.buf.push(
|
|
835
|
+
sep + "*[Symbol.iterator](){yield " + (iterArr[0] === val ? "this" : ensureId(state, ref)) + "}"
|
|
836
|
+
);
|
|
837
|
+
break;
|
|
838
|
+
default: {
|
|
839
|
+
let iterRef = new Reference(
|
|
840
|
+
ref,
|
|
841
|
+
null,
|
|
842
|
+
state.flush,
|
|
843
|
+
null,
|
|
844
|
+
nextRefAccess(state)
|
|
845
|
+
);
|
|
846
|
+
state.buf.push(sep + "*[(" + iterRef.id + "="), writeArray(state, iterArr, iterRef), state.buf.push(",Symbol.iterator)](){yield*" + iterRef.id + "}");
|
|
847
|
+
break;
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
sep = ",";
|
|
839
851
|
}
|
|
840
852
|
return sep;
|
|
841
853
|
}
|
package/dist/html.mjs
CHANGED
|
@@ -20,9 +20,8 @@ function stringifyClassObject(name, value) {
|
|
|
20
20
|
function styleValue(value) {
|
|
21
21
|
return toDelimitedString(value, ";", stringifyStyleObject);
|
|
22
22
|
}
|
|
23
|
-
var NON_DIMENSIONAL = /^(--|ta|or|li|z)|n-c|i(do|nk|m|t)|w$|we/;
|
|
24
23
|
function stringifyStyleObject(name, value) {
|
|
25
|
-
return value || value === 0 ? `${name}:${typeof value == "number" && value &&
|
|
24
|
+
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}` : "";
|
|
26
25
|
}
|
|
27
26
|
function toDelimitedString(val, delimiter, stringify) {
|
|
28
27
|
switch (typeof val) {
|
|
@@ -400,7 +399,11 @@ function writeRoot(state, root) {
|
|
|
400
399
|
let { buf, assigned } = state, hadBuf = buf.length !== 0, result = "";
|
|
401
400
|
if (hadBuf && buf.push(","), writeProp(state, root, null, "")) {
|
|
402
401
|
let rootRef = state.refs.get(root);
|
|
403
|
-
|
|
402
|
+
if (rootRef) {
|
|
403
|
+
let rootId = ensureId(state, rootRef);
|
|
404
|
+
assigned.size && (assigned.delete(rootRef), writeAssigned(state), buf.push("," + rootRef.assigns + rootId));
|
|
405
|
+
}
|
|
406
|
+
result = "(", buf.push(")");
|
|
404
407
|
} else
|
|
405
408
|
hadBuf && (buf.pop(), writeAssigned(state)), result = "{", buf.push("}");
|
|
406
409
|
for (let chunk of buf)
|
|
@@ -409,7 +412,7 @@ function writeRoot(state, root) {
|
|
|
409
412
|
}
|
|
410
413
|
function writeAssigned(state) {
|
|
411
414
|
for (let valueRef of state.assigned)
|
|
412
|
-
state.buf.push("," + valueRef.assigns + (valueRef.init || valueRef.id)), valueRef.init = "";
|
|
415
|
+
(valueRef.assigns || valueRef.init) && (state.buf.push("," + valueRef.assigns + (valueRef.init || valueRef.id)), valueRef.init = "");
|
|
413
416
|
}
|
|
414
417
|
function writeProp(state, val, parent, accessor) {
|
|
415
418
|
switch (typeof val) {
|
|
@@ -451,13 +454,13 @@ function writeRegistered(state, val, parent, accessor, { access, scope }) {
|
|
|
451
454
|
);
|
|
452
455
|
if (state.refs.set(val, fnRef), scopeRef) {
|
|
453
456
|
if (isCircular(parent, scopeRef))
|
|
454
|
-
return state.assigned.add(fnRef), fnRef.init = access + "(" + ensureId(state, scopeRef) + ")", fnRef.assigns += ensureId(state, parent) + toAccess(accessor) + "=", !1;
|
|
457
|
+
return state.assigned.add(parent), state.assigned.add(fnRef), fnRef.init = access + "(" + ensureId(state, scopeRef) + ")", fnRef.assigns += ensureId(state, parent) + toAccess(accessor) + "=", !1;
|
|
455
458
|
state.buf.push(access + "(" + ensureId(state, scopeRef) + ")");
|
|
456
459
|
} else {
|
|
457
460
|
let pos = state.buf.push(""), assigns = state.assigned.size;
|
|
458
461
|
writeProp(state, scope, parent, "");
|
|
459
462
|
let scopeRef2 = parent && state.refs.get(scope), scopeId = scopeRef2 && ensureId(state, scopeRef2);
|
|
460
|
-
scopeId && assigns !== state.assigned.size ? (state.assigned.add(fnRef), fnRef.init = access + "(" + scopeId + ")", fnRef.assigns += ensureId(state, parent) + toAccess(accessor) + "=") : (state.buf[pos - 2] += access + "(", state.buf.push(")"));
|
|
463
|
+
scopeId && assigns !== state.assigned.size ? (state.assigned.add(parent), state.assigned.add(fnRef), fnRef.init = access + "(" + scopeId + ")", fnRef.assigns += ensureId(state, parent) + toAccess(accessor) + "=") : (state.buf[pos - 2] += access + "(", state.buf.push(")"));
|
|
461
464
|
}
|
|
462
465
|
} else
|
|
463
466
|
state.buf.push(access);
|
|
@@ -742,21 +745,30 @@ function writeObjectProps(state, val, ref) {
|
|
|
742
745
|
escapedKey
|
|
743
746
|
) ? sep = "," : state.buf.pop();
|
|
744
747
|
}
|
|
745
|
-
if (hasSymbolIterator(val)
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
748
|
+
if (hasSymbolIterator(val)) {
|
|
749
|
+
let iterArr = [...val];
|
|
750
|
+
switch (iterArr.length) {
|
|
751
|
+
case 0:
|
|
752
|
+
state.buf.push(sep + "*[Symbol.iterator](){}");
|
|
753
|
+
break;
|
|
754
|
+
case 1:
|
|
755
|
+
state.buf.push(
|
|
756
|
+
sep + "*[Symbol.iterator](){yield " + (iterArr[0] === val ? "this" : ensureId(state, ref)) + "}"
|
|
757
|
+
);
|
|
758
|
+
break;
|
|
759
|
+
default: {
|
|
760
|
+
let iterRef = new Reference(
|
|
761
|
+
ref,
|
|
762
|
+
null,
|
|
763
|
+
state.flush,
|
|
764
|
+
null,
|
|
765
|
+
nextRefAccess(state)
|
|
766
|
+
);
|
|
767
|
+
state.buf.push(sep + "*[(" + iterRef.id + "="), writeArray(state, iterArr, iterRef), state.buf.push(",Symbol.iterator)](){yield*" + iterRef.id + "}");
|
|
768
|
+
break;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
sep = ",";
|
|
760
772
|
}
|
|
761
773
|
return sep;
|
|
762
774
|
}
|
package/dist/translator/index.js
CHANGED
|
@@ -229,9 +229,8 @@ function stringifyClassObject(name2, value) {
|
|
|
229
229
|
function styleValue(value) {
|
|
230
230
|
return toDelimitedString(value, ";", stringifyStyleObject);
|
|
231
231
|
}
|
|
232
|
-
var NON_DIMENSIONAL = /^(--|ta|or|li|z)|n-c|i(do|nk|m|t)|w$|we/;
|
|
233
232
|
function stringifyStyleObject(name2, value) {
|
|
234
|
-
return value || value === 0 ? `${name2}:${typeof value === "number" && value &&
|
|
233
|
+
return value || value === 0 ? `${name2}:${typeof value === "number" && value && !/^(--|ta|or|li|z)|cou|nk|it|ag|we|do|w$/.test(name2) ? value + "px" : value}` : "";
|
|
235
234
|
}
|
|
236
235
|
function toDelimitedString(val, delimiter, stringify) {
|
|
237
236
|
switch (typeof val) {
|