@marko/runtime-tags 6.1.0 → 6.1.1
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 +17 -18
- package/dist/debug/dom.mjs +17 -18
- package/dist/debug/html.js +9 -1
- package/dist/debug/html.mjs +9 -1
- package/dist/dom.js +16 -16
- package/dist/dom.mjs +16 -16
- package/dist/html.js +6 -1
- package/dist/html.mjs +6 -1
- package/dist/translator/index.js +6 -2
- package/dist/translator/util/sections.d.ts +1 -1
- package/package.json +1 -1
package/dist/debug/dom.js
CHANGED
|
@@ -302,7 +302,7 @@ function _let(id, fn) {
|
|
|
302
302
|
}
|
|
303
303
|
function _const(valueAccessor, fn) {
|
|
304
304
|
return (scope, value) => {
|
|
305
|
-
if (
|
|
305
|
+
if (scope["#Creating"] || scope[valueAccessor] !== value) {
|
|
306
306
|
scope[valueAccessor] = value;
|
|
307
307
|
fn?.(scope);
|
|
308
308
|
}
|
|
@@ -970,7 +970,8 @@ function setAttribute(element, name, value) {
|
|
|
970
970
|
else element.setAttribute(name, value);
|
|
971
971
|
}
|
|
972
972
|
function _attr_class(element, value) {
|
|
973
|
-
|
|
973
|
+
value = typeof value === "string" ? value : toDelimitedString(value, " ", stringifyClassObject);
|
|
974
|
+
if (value !== element.className) element.className = value;
|
|
974
975
|
}
|
|
975
976
|
function _attr_class_items(element, items) {
|
|
976
977
|
for (const key in items) _attr_class_item(element, key, items[key]);
|
|
@@ -1144,11 +1145,10 @@ function _lifecycle(scope, thisObj, index = 0) {
|
|
|
1144
1145
|
}
|
|
1145
1146
|
function removeChildNodes(startNode, endNode) {
|
|
1146
1147
|
const stop = endNode.nextSibling;
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
current = next;
|
|
1148
|
+
while (startNode !== stop) {
|
|
1149
|
+
const next = startNode.nextSibling;
|
|
1150
|
+
startNode.remove();
|
|
1151
|
+
startNode = next;
|
|
1152
1152
|
}
|
|
1153
1153
|
}
|
|
1154
1154
|
function insertChildNodes(parentNode, referenceNode, startNode, endNode) {
|
|
@@ -1158,11 +1158,10 @@ function toInsertNode(startNode, endNode) {
|
|
|
1158
1158
|
if (startNode === endNode) return startNode;
|
|
1159
1159
|
const parent = new DocumentFragment();
|
|
1160
1160
|
const stop = endNode.nextSibling;
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
current = next;
|
|
1161
|
+
while (startNode !== stop) {
|
|
1162
|
+
const next = startNode.nextSibling;
|
|
1163
|
+
parent.appendChild(startNode);
|
|
1164
|
+
startNode = next;
|
|
1166
1165
|
}
|
|
1167
1166
|
return parent;
|
|
1168
1167
|
}
|
|
@@ -1493,7 +1492,7 @@ function byFirstArg(name) {
|
|
|
1493
1492
|
//#endregion
|
|
1494
1493
|
//#region src/dom/queue.ts
|
|
1495
1494
|
let pendingRenders = [];
|
|
1496
|
-
let pendingRendersLookup =
|
|
1495
|
+
let pendingRendersLookup = {};
|
|
1497
1496
|
let asyncRendersLookup;
|
|
1498
1497
|
const caughtError = /* @__PURE__ */ new WeakSet();
|
|
1499
1498
|
const placeholderShown = /* @__PURE__ */ new WeakSet();
|
|
@@ -1503,7 +1502,7 @@ let rendering;
|
|
|
1503
1502
|
const scopeKeyOffset = 1e3;
|
|
1504
1503
|
function queueRender(scope, signal, signalKey, value, scopeKey = scope["#Id"]) {
|
|
1505
1504
|
const key = scopeKey * scopeKeyOffset + signalKey;
|
|
1506
|
-
let render = signalKey >= 0 && pendingRendersLookup
|
|
1505
|
+
let render = signalKey >= 0 && pendingRendersLookup[key];
|
|
1507
1506
|
if (render) render["value"] = value;
|
|
1508
1507
|
else {
|
|
1509
1508
|
queuePendingRender(render = {
|
|
@@ -1512,7 +1511,7 @@ function queueRender(scope, signal, signalKey, value, scopeKey = scope["#Id"]) {
|
|
|
1512
1511
|
["signal"]: signal,
|
|
1513
1512
|
["value"]: value
|
|
1514
1513
|
});
|
|
1515
|
-
signalKey >= 0 && pendingRendersLookup
|
|
1514
|
+
signalKey >= 0 && (pendingRendersLookup[key] = render);
|
|
1516
1515
|
}
|
|
1517
1516
|
}
|
|
1518
1517
|
function queuePendingRender(render) {
|
|
@@ -1531,7 +1530,7 @@ function queueEffect(scope, fn) {
|
|
|
1531
1530
|
}
|
|
1532
1531
|
function run() {
|
|
1533
1532
|
const effects = pendingEffects;
|
|
1534
|
-
asyncRendersLookup =
|
|
1533
|
+
asyncRendersLookup = {};
|
|
1535
1534
|
try {
|
|
1536
1535
|
rendering = 1;
|
|
1537
1536
|
runRenders();
|
|
@@ -1550,7 +1549,7 @@ function prepareEffects(fn) {
|
|
|
1550
1549
|
const preparedEffects = pendingEffects = [];
|
|
1551
1550
|
pendingRenders = [];
|
|
1552
1551
|
asyncRendersLookup = pendingRendersLookup;
|
|
1553
|
-
pendingRendersLookup =
|
|
1552
|
+
pendingRendersLookup = {};
|
|
1554
1553
|
try {
|
|
1555
1554
|
rendering = 1;
|
|
1556
1555
|
fn();
|
|
@@ -1623,7 +1622,7 @@ function _enable_catch() {
|
|
|
1623
1622
|
let branch = render["scope"]["#ClosestBranch"];
|
|
1624
1623
|
while (branch) {
|
|
1625
1624
|
if (branch["#PendingRenders"]) {
|
|
1626
|
-
asyncRendersLookup
|
|
1625
|
+
asyncRendersLookup[render["key"]] = render;
|
|
1627
1626
|
return branch["#PendingRenders"].push(render);
|
|
1628
1627
|
}
|
|
1629
1628
|
branch = branch["#ParentBranch"];
|
package/dist/debug/dom.mjs
CHANGED
|
@@ -300,7 +300,7 @@ function _let(id, fn) {
|
|
|
300
300
|
}
|
|
301
301
|
function _const(valueAccessor, fn) {
|
|
302
302
|
return (scope, value) => {
|
|
303
|
-
if (
|
|
303
|
+
if (scope["#Creating"] || scope[valueAccessor] !== value) {
|
|
304
304
|
scope[valueAccessor] = value;
|
|
305
305
|
fn?.(scope);
|
|
306
306
|
}
|
|
@@ -968,7 +968,8 @@ function setAttribute(element, name, value) {
|
|
|
968
968
|
else element.setAttribute(name, value);
|
|
969
969
|
}
|
|
970
970
|
function _attr_class(element, value) {
|
|
971
|
-
|
|
971
|
+
value = typeof value === "string" ? value : toDelimitedString(value, " ", stringifyClassObject);
|
|
972
|
+
if (value !== element.className) element.className = value;
|
|
972
973
|
}
|
|
973
974
|
function _attr_class_items(element, items) {
|
|
974
975
|
for (const key in items) _attr_class_item(element, key, items[key]);
|
|
@@ -1142,11 +1143,10 @@ function _lifecycle(scope, thisObj, index = 0) {
|
|
|
1142
1143
|
}
|
|
1143
1144
|
function removeChildNodes(startNode, endNode) {
|
|
1144
1145
|
const stop = endNode.nextSibling;
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
current = next;
|
|
1146
|
+
while (startNode !== stop) {
|
|
1147
|
+
const next = startNode.nextSibling;
|
|
1148
|
+
startNode.remove();
|
|
1149
|
+
startNode = next;
|
|
1150
1150
|
}
|
|
1151
1151
|
}
|
|
1152
1152
|
function insertChildNodes(parentNode, referenceNode, startNode, endNode) {
|
|
@@ -1156,11 +1156,10 @@ function toInsertNode(startNode, endNode) {
|
|
|
1156
1156
|
if (startNode === endNode) return startNode;
|
|
1157
1157
|
const parent = new DocumentFragment();
|
|
1158
1158
|
const stop = endNode.nextSibling;
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
current = next;
|
|
1159
|
+
while (startNode !== stop) {
|
|
1160
|
+
const next = startNode.nextSibling;
|
|
1161
|
+
parent.appendChild(startNode);
|
|
1162
|
+
startNode = next;
|
|
1164
1163
|
}
|
|
1165
1164
|
return parent;
|
|
1166
1165
|
}
|
|
@@ -1491,7 +1490,7 @@ function byFirstArg(name) {
|
|
|
1491
1490
|
//#endregion
|
|
1492
1491
|
//#region src/dom/queue.ts
|
|
1493
1492
|
let pendingRenders = [];
|
|
1494
|
-
let pendingRendersLookup =
|
|
1493
|
+
let pendingRendersLookup = {};
|
|
1495
1494
|
let asyncRendersLookup;
|
|
1496
1495
|
const caughtError = /* @__PURE__ */ new WeakSet();
|
|
1497
1496
|
const placeholderShown = /* @__PURE__ */ new WeakSet();
|
|
@@ -1501,7 +1500,7 @@ let rendering;
|
|
|
1501
1500
|
const scopeKeyOffset = 1e3;
|
|
1502
1501
|
function queueRender(scope, signal, signalKey, value, scopeKey = scope["#Id"]) {
|
|
1503
1502
|
const key = scopeKey * scopeKeyOffset + signalKey;
|
|
1504
|
-
let render = signalKey >= 0 && pendingRendersLookup
|
|
1503
|
+
let render = signalKey >= 0 && pendingRendersLookup[key];
|
|
1505
1504
|
if (render) render["value"] = value;
|
|
1506
1505
|
else {
|
|
1507
1506
|
queuePendingRender(render = {
|
|
@@ -1510,7 +1509,7 @@ function queueRender(scope, signal, signalKey, value, scopeKey = scope["#Id"]) {
|
|
|
1510
1509
|
["signal"]: signal,
|
|
1511
1510
|
["value"]: value
|
|
1512
1511
|
});
|
|
1513
|
-
signalKey >= 0 && pendingRendersLookup
|
|
1512
|
+
signalKey >= 0 && (pendingRendersLookup[key] = render);
|
|
1514
1513
|
}
|
|
1515
1514
|
}
|
|
1516
1515
|
function queuePendingRender(render) {
|
|
@@ -1529,7 +1528,7 @@ function queueEffect(scope, fn) {
|
|
|
1529
1528
|
}
|
|
1530
1529
|
function run() {
|
|
1531
1530
|
const effects = pendingEffects;
|
|
1532
|
-
asyncRendersLookup =
|
|
1531
|
+
asyncRendersLookup = {};
|
|
1533
1532
|
try {
|
|
1534
1533
|
rendering = 1;
|
|
1535
1534
|
runRenders();
|
|
@@ -1548,7 +1547,7 @@ function prepareEffects(fn) {
|
|
|
1548
1547
|
const preparedEffects = pendingEffects = [];
|
|
1549
1548
|
pendingRenders = [];
|
|
1550
1549
|
asyncRendersLookup = pendingRendersLookup;
|
|
1551
|
-
pendingRendersLookup =
|
|
1550
|
+
pendingRendersLookup = {};
|
|
1552
1551
|
try {
|
|
1553
1552
|
rendering = 1;
|
|
1554
1553
|
fn();
|
|
@@ -1621,7 +1620,7 @@ function _enable_catch() {
|
|
|
1621
1620
|
let branch = render["scope"]["#ClosestBranch"];
|
|
1622
1621
|
while (branch) {
|
|
1623
1622
|
if (branch["#PendingRenders"]) {
|
|
1624
|
-
asyncRendersLookup
|
|
1623
|
+
asyncRendersLookup[render["key"]] = render;
|
|
1625
1624
|
return branch["#PendingRenders"].push(render);
|
|
1626
1625
|
}
|
|
1627
1626
|
branch = branch["#ParentBranch"];
|
package/dist/debug/html.js
CHANGED
|
@@ -746,12 +746,20 @@ function writeReferenceOr(state, write, val, parent, accessor) {
|
|
|
746
746
|
}
|
|
747
747
|
function writeRegistered(state, val, parent, accessor, registered) {
|
|
748
748
|
if (parent && registered.scope) {
|
|
749
|
+
if (!state.refs.has(registered.scope)) {
|
|
750
|
+
state.buf.push(registered.access + "(");
|
|
751
|
+
writeProp(state, registered.scope, null, "");
|
|
752
|
+
state.buf.push(")");
|
|
753
|
+
const scopeRef = state.refs.get(registered.scope);
|
|
754
|
+
if (scopeRef) ensureId(state, scopeRef);
|
|
755
|
+
return true;
|
|
756
|
+
}
|
|
749
757
|
const fnRef = new Reference(parent, accessor, state.flush, state.buf.length);
|
|
750
758
|
fnRef.registered = registered;
|
|
751
759
|
state.refs.set(val, fnRef);
|
|
752
760
|
state.registered.push(fnRef);
|
|
753
761
|
addAssignment(fnRef, ensureId(state, parent) + toAccess(accessor));
|
|
754
|
-
return
|
|
762
|
+
return false;
|
|
755
763
|
} else state.buf.push(registered.access);
|
|
756
764
|
return true;
|
|
757
765
|
}
|
package/dist/debug/html.mjs
CHANGED
|
@@ -744,12 +744,20 @@ function writeReferenceOr(state, write, val, parent, accessor) {
|
|
|
744
744
|
}
|
|
745
745
|
function writeRegistered(state, val, parent, accessor, registered) {
|
|
746
746
|
if (parent && registered.scope) {
|
|
747
|
+
if (!state.refs.has(registered.scope)) {
|
|
748
|
+
state.buf.push(registered.access + "(");
|
|
749
|
+
writeProp(state, registered.scope, null, "");
|
|
750
|
+
state.buf.push(")");
|
|
751
|
+
const scopeRef = state.refs.get(registered.scope);
|
|
752
|
+
if (scopeRef) ensureId(state, scopeRef);
|
|
753
|
+
return true;
|
|
754
|
+
}
|
|
747
755
|
const fnRef = new Reference(parent, accessor, state.flush, state.buf.length);
|
|
748
756
|
fnRef.registered = registered;
|
|
749
757
|
state.refs.set(val, fnRef);
|
|
750
758
|
state.registered.push(fnRef);
|
|
751
759
|
addAssignment(fnRef, ensureId(state, parent) + toAccess(accessor));
|
|
752
|
-
return
|
|
760
|
+
return false;
|
|
753
761
|
} else state.buf.push(registered.access);
|
|
754
762
|
return true;
|
|
755
763
|
}
|
package/dist/dom.js
CHANGED
|
@@ -52,7 +52,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
52
52
|
};
|
|
53
53
|
}, _for_of = /* @__PURE__ */ loop(([all, by = bySecondArg], cb) => {
|
|
54
54
|
typeof by == "string" ? forOf(all, (item, i) => cb(item[by], [item, i])) : forOf(all, (item, i) => cb(by(item, i), [item, i]));
|
|
55
|
-
}), _for_in = /* @__PURE__ */ loop(([obj, by = byFirstArg], cb) => forIn(obj, (key, value) => cb(by(key, value), [key, value]))), _for_to = /* @__PURE__ */ loop(([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))), _for_until = /* @__PURE__ */ loop(([until, from, step, by = byFirstArg], cb) => forUntil(until, from, step, (v) => cb(by(v), [v]))), pendingRenders = [], pendingRendersLookup =
|
|
55
|
+
}), _for_in = /* @__PURE__ */ loop(([obj, by = byFirstArg], cb) => forIn(obj, (key, value) => cb(by(key, value), [key, value]))), _for_to = /* @__PURE__ */ loop(([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))), _for_until = /* @__PURE__ */ loop(([until, from, step, by = byFirstArg], cb) => forUntil(until, from, step, (v) => cb(by(v), [v]))), pendingRenders = [], pendingRendersLookup = {}, asyncRendersLookup, caughtError = /* @__PURE__ */ new WeakSet(), placeholderShown = /* @__PURE__ */ new WeakSet(), pendingEffects = [], pendingScopes = [], rendering, runEffects = ((effects) => {
|
|
56
56
|
for (let i = 0; i < effects.length;) effects[i++](effects[i++]);
|
|
57
57
|
}), runRender = (render) => render.c(render.b, render.d), catchEnabled, classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
58
58
|
patchDynamicTag,
|
|
@@ -264,7 +264,7 @@ function _let(id, fn) {
|
|
|
264
264
|
}
|
|
265
265
|
function _const(valueAccessor, fn) {
|
|
266
266
|
return valueAccessor = decodeAccessor(valueAccessor), (scope, value) => {
|
|
267
|
-
(
|
|
267
|
+
(scope.H || scope[valueAccessor] !== value) && (scope[valueAccessor] = value, fn?.(scope));
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
270
|
function _or(id, fn, defaultPending = 1, scopeIdAccessor = "L") {
|
|
@@ -667,7 +667,7 @@ function setAttribute(element, name, value) {
|
|
|
667
667
|
element.getAttribute(name) != value && (value === void 0 ? element.removeAttribute(name) : element.setAttribute(name, value));
|
|
668
668
|
}
|
|
669
669
|
function _attr_class(element, value) {
|
|
670
|
-
|
|
670
|
+
value = typeof value == "string" ? value : toDelimitedString(value, " ", stringifyClassObject), value !== element.className && (element.className = value);
|
|
671
671
|
}
|
|
672
672
|
function _attr_class_items(element, items) {
|
|
673
673
|
for (let key in items) _attr_class_item(element, key, items[key]);
|
|
@@ -802,10 +802,10 @@ function _lifecycle(scope, thisObj, index = 0) {
|
|
|
802
802
|
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[accessor] = thisObj, thisObj.onMount?.(), $signal(scope, accessor).onabort = () => thisObj.onDestroy?.());
|
|
803
803
|
}
|
|
804
804
|
function removeChildNodes(startNode, endNode) {
|
|
805
|
-
let stop = endNode.nextSibling
|
|
806
|
-
for (;
|
|
807
|
-
let next =
|
|
808
|
-
|
|
805
|
+
let stop = endNode.nextSibling;
|
|
806
|
+
for (; startNode !== stop;) {
|
|
807
|
+
let next = startNode.nextSibling;
|
|
808
|
+
startNode.remove(), startNode = next;
|
|
809
809
|
}
|
|
810
810
|
}
|
|
811
811
|
function insertChildNodes(parentNode, referenceNode, startNode, endNode) {
|
|
@@ -813,10 +813,10 @@ function insertChildNodes(parentNode, referenceNode, startNode, endNode) {
|
|
|
813
813
|
}
|
|
814
814
|
function toInsertNode(startNode, endNode) {
|
|
815
815
|
if (startNode === endNode) return startNode;
|
|
816
|
-
let parent = new DocumentFragment(), stop = endNode.nextSibling
|
|
817
|
-
for (;
|
|
818
|
-
let next =
|
|
819
|
-
parent.appendChild(
|
|
816
|
+
let parent = new DocumentFragment(), stop = endNode.nextSibling;
|
|
817
|
+
for (; startNode !== stop;) {
|
|
818
|
+
let next = startNode.nextSibling;
|
|
819
|
+
parent.appendChild(startNode), startNode = next;
|
|
820
820
|
}
|
|
821
821
|
return parent;
|
|
822
822
|
}
|
|
@@ -962,13 +962,13 @@ function byFirstArg(name) {
|
|
|
962
962
|
//#endregion
|
|
963
963
|
//#region src/dom/queue.ts
|
|
964
964
|
function queueRender(scope, signal, signalKey, value, scopeKey = scope.L) {
|
|
965
|
-
let key = scopeKey * 1e3 + signalKey, render = signalKey >= 0 && pendingRendersLookup
|
|
965
|
+
let key = scopeKey * 1e3 + signalKey, render = signalKey >= 0 && pendingRendersLookup[key];
|
|
966
966
|
render ? render.d = value : (queuePendingRender(render = {
|
|
967
967
|
a: key,
|
|
968
968
|
b: scope,
|
|
969
969
|
c: signal,
|
|
970
970
|
d: value
|
|
971
|
-
}), signalKey >= 0 && pendingRendersLookup
|
|
971
|
+
}), signalKey >= 0 && (pendingRendersLookup[key] = render));
|
|
972
972
|
}
|
|
973
973
|
function queuePendingRender(render) {
|
|
974
974
|
let i = pendingRenders.push(render) - 1;
|
|
@@ -984,7 +984,7 @@ function queueEffect(scope, fn) {
|
|
|
984
984
|
}
|
|
985
985
|
function run() {
|
|
986
986
|
let effects = pendingEffects;
|
|
987
|
-
asyncRendersLookup =
|
|
987
|
+
asyncRendersLookup = {};
|
|
988
988
|
try {
|
|
989
989
|
rendering = 1, runRenders();
|
|
990
990
|
} finally {
|
|
@@ -994,7 +994,7 @@ function run() {
|
|
|
994
994
|
}
|
|
995
995
|
function prepareEffects(fn) {
|
|
996
996
|
let prevRenders = pendingRenders, prevEffects = pendingEffects, prevLookup = asyncRendersLookup, preparedEffects = pendingEffects = [];
|
|
997
|
-
pendingRenders = [], asyncRendersLookup = pendingRendersLookup, pendingRendersLookup =
|
|
997
|
+
pendingRenders = [], asyncRendersLookup = pendingRendersLookup, pendingRendersLookup = {};
|
|
998
998
|
try {
|
|
999
999
|
rendering = 1, fn(), runRenders();
|
|
1000
1000
|
} finally {
|
|
@@ -1037,7 +1037,7 @@ function _enable_catch() {
|
|
|
1037
1037
|
try {
|
|
1038
1038
|
let branch = render.b.F;
|
|
1039
1039
|
for (; branch;) {
|
|
1040
|
-
if (branch.W) return asyncRendersLookup
|
|
1040
|
+
if (branch.W) return asyncRendersLookup[render.a] = render, branch.W.push(render);
|
|
1041
1041
|
branch = branch.N;
|
|
1042
1042
|
}
|
|
1043
1043
|
runRender(render);
|
package/dist/dom.mjs
CHANGED
|
@@ -52,7 +52,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
52
52
|
};
|
|
53
53
|
}, _for_of = /* @__PURE__ */ loop(([all, by = bySecondArg], cb) => {
|
|
54
54
|
typeof by == "string" ? forOf(all, (item, i) => cb(item[by], [item, i])) : forOf(all, (item, i) => cb(by(item, i), [item, i]));
|
|
55
|
-
}), _for_in = /* @__PURE__ */ loop(([obj, by = byFirstArg], cb) => forIn(obj, (key, value) => cb(by(key, value), [key, value]))), _for_to = /* @__PURE__ */ loop(([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))), _for_until = /* @__PURE__ */ loop(([until, from, step, by = byFirstArg], cb) => forUntil(until, from, step, (v) => cb(by(v), [v]))), pendingRenders = [], pendingRendersLookup =
|
|
55
|
+
}), _for_in = /* @__PURE__ */ loop(([obj, by = byFirstArg], cb) => forIn(obj, (key, value) => cb(by(key, value), [key, value]))), _for_to = /* @__PURE__ */ loop(([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))), _for_until = /* @__PURE__ */ loop(([until, from, step, by = byFirstArg], cb) => forUntil(until, from, step, (v) => cb(by(v), [v]))), pendingRenders = [], pendingRendersLookup = {}, asyncRendersLookup, caughtError = /* @__PURE__ */ new WeakSet(), placeholderShown = /* @__PURE__ */ new WeakSet(), pendingEffects = [], pendingScopes = [], rendering, runEffects = ((effects) => {
|
|
56
56
|
for (let i = 0; i < effects.length;) effects[i++](effects[i++]);
|
|
57
57
|
}), runRender = (render) => render.c(render.b, render.d), catchEnabled, classIdToBranch = /* @__PURE__ */ new Map(), compat = {
|
|
58
58
|
patchDynamicTag,
|
|
@@ -263,7 +263,7 @@ function _let(id, fn) {
|
|
|
263
263
|
}
|
|
264
264
|
function _const(valueAccessor, fn) {
|
|
265
265
|
return valueAccessor = decodeAccessor(valueAccessor), (scope, value) => {
|
|
266
|
-
(
|
|
266
|
+
(scope.H || scope[valueAccessor] !== value) && (scope[valueAccessor] = value, fn?.(scope));
|
|
267
267
|
};
|
|
268
268
|
}
|
|
269
269
|
function _or(id, fn, defaultPending = 1, scopeIdAccessor = "L") {
|
|
@@ -666,7 +666,7 @@ function setAttribute(element, name, value) {
|
|
|
666
666
|
element.getAttribute(name) != value && (value === void 0 ? element.removeAttribute(name) : element.setAttribute(name, value));
|
|
667
667
|
}
|
|
668
668
|
function _attr_class(element, value) {
|
|
669
|
-
|
|
669
|
+
value = typeof value == "string" ? value : toDelimitedString(value, " ", stringifyClassObject), value !== element.className && (element.className = value);
|
|
670
670
|
}
|
|
671
671
|
function _attr_class_items(element, items) {
|
|
672
672
|
for (let key in items) _attr_class_item(element, key, items[key]);
|
|
@@ -801,10 +801,10 @@ function _lifecycle(scope, thisObj, index = 0) {
|
|
|
801
801
|
instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[accessor] = thisObj, thisObj.onMount?.(), $signal(scope, accessor).onabort = () => thisObj.onDestroy?.());
|
|
802
802
|
}
|
|
803
803
|
function removeChildNodes(startNode, endNode) {
|
|
804
|
-
let stop = endNode.nextSibling
|
|
805
|
-
for (;
|
|
806
|
-
let next =
|
|
807
|
-
|
|
804
|
+
let stop = endNode.nextSibling;
|
|
805
|
+
for (; startNode !== stop;) {
|
|
806
|
+
let next = startNode.nextSibling;
|
|
807
|
+
startNode.remove(), startNode = next;
|
|
808
808
|
}
|
|
809
809
|
}
|
|
810
810
|
function insertChildNodes(parentNode, referenceNode, startNode, endNode) {
|
|
@@ -812,10 +812,10 @@ function insertChildNodes(parentNode, referenceNode, startNode, endNode) {
|
|
|
812
812
|
}
|
|
813
813
|
function toInsertNode(startNode, endNode) {
|
|
814
814
|
if (startNode === endNode) return startNode;
|
|
815
|
-
let parent = new DocumentFragment(), stop = endNode.nextSibling
|
|
816
|
-
for (;
|
|
817
|
-
let next =
|
|
818
|
-
parent.appendChild(
|
|
815
|
+
let parent = new DocumentFragment(), stop = endNode.nextSibling;
|
|
816
|
+
for (; startNode !== stop;) {
|
|
817
|
+
let next = startNode.nextSibling;
|
|
818
|
+
parent.appendChild(startNode), startNode = next;
|
|
819
819
|
}
|
|
820
820
|
return parent;
|
|
821
821
|
}
|
|
@@ -961,13 +961,13 @@ function byFirstArg(name) {
|
|
|
961
961
|
//#endregion
|
|
962
962
|
//#region src/dom/queue.ts
|
|
963
963
|
function queueRender(scope, signal, signalKey, value, scopeKey = scope.L) {
|
|
964
|
-
let key = scopeKey * 1e3 + signalKey, render = signalKey >= 0 && pendingRendersLookup
|
|
964
|
+
let key = scopeKey * 1e3 + signalKey, render = signalKey >= 0 && pendingRendersLookup[key];
|
|
965
965
|
render ? render.d = value : (queuePendingRender(render = {
|
|
966
966
|
a: key,
|
|
967
967
|
b: scope,
|
|
968
968
|
c: signal,
|
|
969
969
|
d: value
|
|
970
|
-
}), signalKey >= 0 && pendingRendersLookup
|
|
970
|
+
}), signalKey >= 0 && (pendingRendersLookup[key] = render));
|
|
971
971
|
}
|
|
972
972
|
function queuePendingRender(render) {
|
|
973
973
|
let i = pendingRenders.push(render) - 1;
|
|
@@ -983,7 +983,7 @@ function queueEffect(scope, fn) {
|
|
|
983
983
|
}
|
|
984
984
|
function run() {
|
|
985
985
|
let effects = pendingEffects;
|
|
986
|
-
asyncRendersLookup =
|
|
986
|
+
asyncRendersLookup = {};
|
|
987
987
|
try {
|
|
988
988
|
rendering = 1, runRenders();
|
|
989
989
|
} finally {
|
|
@@ -993,7 +993,7 @@ function run() {
|
|
|
993
993
|
}
|
|
994
994
|
function prepareEffects(fn) {
|
|
995
995
|
let prevRenders = pendingRenders, prevEffects = pendingEffects, prevLookup = asyncRendersLookup, preparedEffects = pendingEffects = [];
|
|
996
|
-
pendingRenders = [], asyncRendersLookup = pendingRendersLookup, pendingRendersLookup =
|
|
996
|
+
pendingRenders = [], asyncRendersLookup = pendingRendersLookup, pendingRendersLookup = {};
|
|
997
997
|
try {
|
|
998
998
|
rendering = 1, fn(), runRenders();
|
|
999
999
|
} finally {
|
|
@@ -1036,7 +1036,7 @@ function _enable_catch() {
|
|
|
1036
1036
|
try {
|
|
1037
1037
|
let branch = render.b.F;
|
|
1038
1038
|
for (; branch;) {
|
|
1039
|
-
if (branch.W) return asyncRendersLookup
|
|
1039
|
+
if (branch.W) return asyncRendersLookup[render.a] = render, branch.W.push(render);
|
|
1040
1040
|
branch = branch.N;
|
|
1041
1041
|
}
|
|
1042
1042
|
runRender(render);
|
package/dist/html.js
CHANGED
|
@@ -599,8 +599,13 @@ function writeReferenceOr(state, write, val, parent, accessor) {
|
|
|
599
599
|
}
|
|
600
600
|
function writeRegistered(state, val, parent, accessor, registered) {
|
|
601
601
|
if (parent && registered.scope) {
|
|
602
|
+
if (!state.refs.has(registered.scope)) {
|
|
603
|
+
state.buf.push(registered.access + "("), writeProp(state, registered.scope, null, ""), state.buf.push(")");
|
|
604
|
+
let scopeRef = state.refs.get(registered.scope);
|
|
605
|
+
return scopeRef && ensureId(state, scopeRef), !0;
|
|
606
|
+
}
|
|
602
607
|
let fnRef = new Reference(parent, accessor, state.flush, state.buf.length);
|
|
603
|
-
return fnRef.registered = registered, state.refs.set(val, fnRef), state.registered.push(fnRef), addAssignment(fnRef, ensureId(state, parent) + toAccess(accessor)), !
|
|
608
|
+
return fnRef.registered = registered, state.refs.set(val, fnRef), state.registered.push(fnRef), addAssignment(fnRef, ensureId(state, parent) + toAccess(accessor)), !1;
|
|
604
609
|
} else state.buf.push(registered.access);
|
|
605
610
|
return !0;
|
|
606
611
|
}
|
package/dist/html.mjs
CHANGED
|
@@ -598,8 +598,13 @@ function writeReferenceOr(state, write, val, parent, accessor) {
|
|
|
598
598
|
}
|
|
599
599
|
function writeRegistered(state, val, parent, accessor, registered) {
|
|
600
600
|
if (parent && registered.scope) {
|
|
601
|
+
if (!state.refs.has(registered.scope)) {
|
|
602
|
+
state.buf.push(registered.access + "("), writeProp(state, registered.scope, null, ""), state.buf.push(")");
|
|
603
|
+
let scopeRef = state.refs.get(registered.scope);
|
|
604
|
+
return scopeRef && ensureId(state, scopeRef), !0;
|
|
605
|
+
}
|
|
601
606
|
let fnRef = new Reference(parent, accessor, state.flush, state.buf.length);
|
|
602
|
-
return fnRef.registered = registered, state.refs.set(val, fnRef), state.registered.push(fnRef), addAssignment(fnRef, ensureId(state, parent) + toAccess(accessor)), !
|
|
607
|
+
return fnRef.registered = registered, state.refs.set(val, fnRef), state.registered.push(fnRef), addAssignment(fnRef, ensureId(state, parent) + toAccess(accessor)), !1;
|
|
603
608
|
} else state.buf.push(registered.access);
|
|
604
609
|
return !0;
|
|
605
610
|
}
|
package/dist/translator/index.js
CHANGED
|
@@ -1535,8 +1535,12 @@ function getNodeContentType(path, extraMember, contentInfo) {
|
|
|
1535
1535
|
function getSectionRegisterReasons(section) {
|
|
1536
1536
|
if (section.isBranch) return false;
|
|
1537
1537
|
const { downstreamBinding } = section;
|
|
1538
|
-
if (downstreamBinding)
|
|
1539
|
-
|
|
1538
|
+
if (downstreamBinding) {
|
|
1539
|
+
const downstreamReasons = getAllSerializeReasonsForBinding(downstreamBinding.binding, downstreamBinding.properties);
|
|
1540
|
+
if (!downstreamReasons) return false;
|
|
1541
|
+
if (downstreamReasons !== true && !section.serializeReason && !section.serializeReasons.size && !section.parent?.serializeReason && !section.parent?.serializeReasons.size) return false;
|
|
1542
|
+
return downstreamReasons;
|
|
1543
|
+
} else if (downstreamBinding === false) return false;
|
|
1540
1544
|
return true;
|
|
1541
1545
|
}
|
|
1542
1546
|
function isImmediateOwner(section, binding) {
|
|
@@ -75,7 +75,7 @@ export declare const getBranchRendererArgs: (section: Section) => [template?: t.
|
|
|
75
75
|
export declare function forEachSection(fn: (section: Section) => void): void;
|
|
76
76
|
export declare function forEachSectionReverse(fn: (section: Section) => void): void;
|
|
77
77
|
export declare function getNodeContentType(path: t.NodePath<t.Statement>, extraMember: "startType" | "endType", contentInfo?: Section["content"]): ContentType | null;
|
|
78
|
-
export declare function getSectionRegisterReasons(section: Section):
|
|
78
|
+
export declare function getSectionRegisterReasons(section: Section): boolean | Sources;
|
|
79
79
|
export declare function isImmediateOwner(section: Section, binding: Binding): boolean;
|
|
80
80
|
export declare function isDirectClosure(section: Section, closure: Binding): boolean;
|
|
81
81
|
export declare function isDynamicClosure(section: Section, closure: Binding): boolean;
|