marko 6.3.29 → 6.3.30
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/constants/accessor-prop.d.ts +1 -0
- package/dist/common/constants/accessor-prop.debug.d.ts +1 -0
- package/dist/common/types.d.ts +1 -0
- package/dist/debug/dom.js +28 -18
- package/dist/debug/dom.mjs +28 -18
- package/dist/dom/abort-signal.d.ts +2 -0
- package/dist/dom/dom.d.ts +1 -1
- package/dist/dom.js +25 -14
- package/dist/dom.mjs +25 -14
- package/dist/translator/index.js +3 -0
- package/package.json +2 -2
|
@@ -23,6 +23,7 @@ export declare const PlaceholderBranch = "P";
|
|
|
23
23
|
export declare const PlaceholderContent = "Q";
|
|
24
24
|
export declare const Renderer = "R";
|
|
25
25
|
export declare const StartNode = "S";
|
|
26
|
+
export declare const Subscriptions = "Z";
|
|
26
27
|
export declare const TagVariable = "T";
|
|
27
28
|
export declare const TagVariableChange = "U";
|
|
28
29
|
type Self = typeof import("./accessor-prop");
|
|
@@ -23,6 +23,7 @@ export declare const PlaceholderBranch = "#PlaceholderBranch";
|
|
|
23
23
|
export declare const PlaceholderContent = "#PlaceholderContent";
|
|
24
24
|
export declare const Renderer = "#Renderer";
|
|
25
25
|
export declare const StartNode = "#StartNode";
|
|
26
|
+
export declare const Subscriptions = "#Subscriptions";
|
|
26
27
|
export declare const TagVariable = "#TagVariable";
|
|
27
28
|
export declare const TagVariableChange = "#TagVariableChange";
|
|
28
29
|
type Self = typeof import("./accessor-prop.debug");
|
package/dist/common/types.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export interface Scope {
|
|
|
29
29
|
[AccessorProp.AbortControllers]: Record<string | number, AbortController | void> | undefined;
|
|
30
30
|
[AccessorProp.ClosestBranch]: BranchScope | undefined;
|
|
31
31
|
[AccessorProp.ClosestBranchId]: number | undefined;
|
|
32
|
+
[AccessorProp.Subscriptions]: Set<Scope>[] | undefined;
|
|
32
33
|
[x: `___${string}`]: never;
|
|
33
34
|
[x: string | number]: any;
|
|
34
35
|
}
|
package/dist/debug/dom.js
CHANGED
|
@@ -60,6 +60,7 @@ const PlaceholderBranch = "#PlaceholderBranch";
|
|
|
60
60
|
const PlaceholderContent = "#PlaceholderContent";
|
|
61
61
|
const Renderer = "#Renderer";
|
|
62
62
|
const StartNode = "#StartNode";
|
|
63
|
+
const Subscriptions = "#Subscriptions";
|
|
63
64
|
const TagVariable = "#TagVariable";
|
|
64
65
|
const TagVariableChange = "#TagVariableChange";
|
|
65
66
|
//#endregion
|
|
@@ -400,17 +401,21 @@ function destroyBranch(branch) {
|
|
|
400
401
|
function destroyScope(scope) {
|
|
401
402
|
if (scope["#Gen"]) {
|
|
402
403
|
destroyNestedScopes(scope);
|
|
403
|
-
|
|
404
|
+
cleanupScope(scope);
|
|
404
405
|
}
|
|
405
406
|
}
|
|
406
407
|
const destroyNestedScopes = function destroyNestedScopes(scope) {
|
|
407
408
|
scope[Gen$1] = 0;
|
|
408
409
|
scope[BranchScopes]?.forEach(destroyNestedScopes);
|
|
409
|
-
scope[AbortScopes]?.forEach(
|
|
410
|
+
scope[AbortScopes]?.forEach(cleanupScope);
|
|
410
411
|
};
|
|
411
|
-
function
|
|
412
|
+
function cleanupScope(scope) {
|
|
413
|
+
scope[Subscriptions]?.forEach(unsubscribe, scope);
|
|
412
414
|
for (const id in scope[AbortControllers]) $signalReset(scope, id);
|
|
413
415
|
}
|
|
416
|
+
function unsubscribe(subscribers) {
|
|
417
|
+
subscribers.delete(this);
|
|
418
|
+
}
|
|
414
419
|
function removeAndDestroyBranch(branch) {
|
|
415
420
|
destroyBranch(branch);
|
|
416
421
|
removeChildNodes(branch[StartNode], branch[EndNode]);
|
|
@@ -565,10 +570,8 @@ function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
|
|
|
565
570
|
}
|
|
566
571
|
function subscribeToScopeSet(ownerScope, accessor, scope) {
|
|
567
572
|
const subscribers = ownerScope[accessor] ||= /* @__PURE__ */ new Set();
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
$signal(scope, -1).addEventListener("abort", () => ownerScope[accessor].delete(scope));
|
|
571
|
-
}
|
|
573
|
+
const { size } = subscribers;
|
|
574
|
+
if (subscribers.add(scope).size !== size) trackCleanup(scope, subscribers);
|
|
572
575
|
}
|
|
573
576
|
function _closure(...closureSignals) {
|
|
574
577
|
const [firstSignal] = closureSignals;
|
|
@@ -1160,18 +1163,19 @@ function removeChildNodes(startNode, endNode) {
|
|
|
1160
1163
|
}
|
|
1161
1164
|
}
|
|
1162
1165
|
function insertChildNodes(parentNode, referenceNode, startNode, endNode) {
|
|
1163
|
-
parentNode.insertBefore(toInsertNode(startNode, endNode), referenceNode);
|
|
1166
|
+
if (parentNode.isConnected) parentNode.insertBefore(toInsertNode(startNode, endNode), referenceNode);
|
|
1167
|
+
else {
|
|
1168
|
+
const stop = endNode.nextSibling;
|
|
1169
|
+
while (startNode !== stop) {
|
|
1170
|
+
const next = startNode.nextSibling;
|
|
1171
|
+
parentNode.insertBefore(startNode, referenceNode);
|
|
1172
|
+
startNode = next;
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
return parentNode;
|
|
1164
1176
|
}
|
|
1165
1177
|
function toInsertNode(startNode, endNode) {
|
|
1166
|
-
|
|
1167
|
-
const parent = new DocumentFragment();
|
|
1168
|
-
const stop = endNode.nextSibling;
|
|
1169
|
-
while (startNode !== stop) {
|
|
1170
|
-
const next = startNode.nextSibling;
|
|
1171
|
-
parent.appendChild(startNode);
|
|
1172
|
-
startNode = next;
|
|
1173
|
-
}
|
|
1174
|
-
return parent;
|
|
1178
|
+
return startNode === endNode ? startNode : insertChildNodes(new DocumentFragment(), null, startNode, endNode);
|
|
1175
1179
|
}
|
|
1176
1180
|
//#endregion
|
|
1177
1181
|
//#region src/dom/resolve-cursor-position.ts
|
|
@@ -2090,9 +2094,15 @@ function $signalReset(scope, id) {
|
|
|
2090
2094
|
}
|
|
2091
2095
|
}
|
|
2092
2096
|
function $signal(scope, id) {
|
|
2093
|
-
|
|
2097
|
+
trackCleanup(scope);
|
|
2094
2098
|
return ((scope[AbortControllers] ||= {})[id] ||= new AbortController()).signal;
|
|
2095
2099
|
}
|
|
2100
|
+
/** Enrols `scope` with its branch so destroying the branch cleans it up. */
|
|
2101
|
+
function trackCleanup(scope, subscribers) {
|
|
2102
|
+
const branch = scope[ClosestBranch];
|
|
2103
|
+
if (branch) (branch[AbortScopes] ||= /* @__PURE__ */ new Set()).add(scope);
|
|
2104
|
+
if (subscribers) (scope[Subscriptions] ||= []).push(subscribers);
|
|
2105
|
+
}
|
|
2096
2106
|
function abort(ctrl) {
|
|
2097
2107
|
ctrl.abort();
|
|
2098
2108
|
}
|
package/dist/debug/dom.mjs
CHANGED
|
@@ -58,6 +58,7 @@ const PlaceholderBranch = "#PlaceholderBranch";
|
|
|
58
58
|
const PlaceholderContent = "#PlaceholderContent";
|
|
59
59
|
const Renderer = "#Renderer";
|
|
60
60
|
const StartNode = "#StartNode";
|
|
61
|
+
const Subscriptions = "#Subscriptions";
|
|
61
62
|
const TagVariable = "#TagVariable";
|
|
62
63
|
const TagVariableChange = "#TagVariableChange";
|
|
63
64
|
//#endregion
|
|
@@ -398,17 +399,21 @@ function destroyBranch(branch) {
|
|
|
398
399
|
function destroyScope(scope) {
|
|
399
400
|
if (scope["#Gen"]) {
|
|
400
401
|
destroyNestedScopes(scope);
|
|
401
|
-
|
|
402
|
+
cleanupScope(scope);
|
|
402
403
|
}
|
|
403
404
|
}
|
|
404
405
|
const destroyNestedScopes = function destroyNestedScopes(scope) {
|
|
405
406
|
scope[Gen$1] = 0;
|
|
406
407
|
scope[BranchScopes]?.forEach(destroyNestedScopes);
|
|
407
|
-
scope[AbortScopes]?.forEach(
|
|
408
|
+
scope[AbortScopes]?.forEach(cleanupScope);
|
|
408
409
|
};
|
|
409
|
-
function
|
|
410
|
+
function cleanupScope(scope) {
|
|
411
|
+
scope[Subscriptions]?.forEach(unsubscribe, scope);
|
|
410
412
|
for (const id in scope[AbortControllers]) $signalReset(scope, id);
|
|
411
413
|
}
|
|
414
|
+
function unsubscribe(subscribers) {
|
|
415
|
+
subscribers.delete(this);
|
|
416
|
+
}
|
|
412
417
|
function removeAndDestroyBranch(branch) {
|
|
413
418
|
destroyBranch(branch);
|
|
414
419
|
removeChildNodes(branch[StartNode], branch[EndNode]);
|
|
@@ -563,10 +568,8 @@ function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
|
|
|
563
568
|
}
|
|
564
569
|
function subscribeToScopeSet(ownerScope, accessor, scope) {
|
|
565
570
|
const subscribers = ownerScope[accessor] ||= /* @__PURE__ */ new Set();
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
$signal(scope, -1).addEventListener("abort", () => ownerScope[accessor].delete(scope));
|
|
569
|
-
}
|
|
571
|
+
const { size } = subscribers;
|
|
572
|
+
if (subscribers.add(scope).size !== size) trackCleanup(scope, subscribers);
|
|
570
573
|
}
|
|
571
574
|
function _closure(...closureSignals) {
|
|
572
575
|
const [firstSignal] = closureSignals;
|
|
@@ -1158,18 +1161,19 @@ function removeChildNodes(startNode, endNode) {
|
|
|
1158
1161
|
}
|
|
1159
1162
|
}
|
|
1160
1163
|
function insertChildNodes(parentNode, referenceNode, startNode, endNode) {
|
|
1161
|
-
parentNode.insertBefore(toInsertNode(startNode, endNode), referenceNode);
|
|
1164
|
+
if (parentNode.isConnected) parentNode.insertBefore(toInsertNode(startNode, endNode), referenceNode);
|
|
1165
|
+
else {
|
|
1166
|
+
const stop = endNode.nextSibling;
|
|
1167
|
+
while (startNode !== stop) {
|
|
1168
|
+
const next = startNode.nextSibling;
|
|
1169
|
+
parentNode.insertBefore(startNode, referenceNode);
|
|
1170
|
+
startNode = next;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
return parentNode;
|
|
1162
1174
|
}
|
|
1163
1175
|
function toInsertNode(startNode, endNode) {
|
|
1164
|
-
|
|
1165
|
-
const parent = new DocumentFragment();
|
|
1166
|
-
const stop = endNode.nextSibling;
|
|
1167
|
-
while (startNode !== stop) {
|
|
1168
|
-
const next = startNode.nextSibling;
|
|
1169
|
-
parent.appendChild(startNode);
|
|
1170
|
-
startNode = next;
|
|
1171
|
-
}
|
|
1172
|
-
return parent;
|
|
1176
|
+
return startNode === endNode ? startNode : insertChildNodes(new DocumentFragment(), null, startNode, endNode);
|
|
1173
1177
|
}
|
|
1174
1178
|
//#endregion
|
|
1175
1179
|
//#region src/dom/resolve-cursor-position.ts
|
|
@@ -2088,9 +2092,15 @@ function $signalReset(scope, id) {
|
|
|
2088
2092
|
}
|
|
2089
2093
|
}
|
|
2090
2094
|
function $signal(scope, id) {
|
|
2091
|
-
|
|
2095
|
+
trackCleanup(scope);
|
|
2092
2096
|
return ((scope[AbortControllers] ||= {})[id] ||= new AbortController()).signal;
|
|
2093
2097
|
}
|
|
2098
|
+
/** Enrols `scope` with its branch so destroying the branch cleans it up. */
|
|
2099
|
+
function trackCleanup(scope, subscribers) {
|
|
2100
|
+
const branch = scope[ClosestBranch];
|
|
2101
|
+
if (branch) (branch[AbortScopes] ||= /* @__PURE__ */ new Set()).add(scope);
|
|
2102
|
+
if (subscribers) (scope[Subscriptions] ||= []).push(subscribers);
|
|
2103
|
+
}
|
|
2094
2104
|
function abort(ctrl) {
|
|
2095
2105
|
ctrl.abort();
|
|
2096
2106
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { type Scope } from "../common/types";
|
|
2
2
|
export declare function $signalReset(scope: Scope, id: string | number): void;
|
|
3
3
|
export declare function $signal(scope: Scope, id: string | number): AbortSignal;
|
|
4
|
+
/** Enrols `scope` with its branch so destroying the branch cleans it up. */
|
|
5
|
+
export declare function trackCleanup(scope: Scope, subscribers?: Set<Scope>): void;
|
package/dist/dom/dom.d.ts
CHANGED
|
@@ -27,5 +27,5 @@ export declare function _lifecycle(scope: Scope, thisObj: Record<string, unknown
|
|
|
27
27
|
onDestroy?: (this: unknown) => void;
|
|
28
28
|
}, index?: number): void;
|
|
29
29
|
export declare function removeChildNodes(startNode: ChildNode, endNode: ChildNode): void;
|
|
30
|
-
export declare function insertChildNodes(parentNode: ParentNode, referenceNode: Node | null, startNode: Node, endNode: Node):
|
|
30
|
+
export declare function insertChildNodes(parentNode: ParentNode, referenceNode: Node | null, startNode: Node, endNode: Node): ParentNode;
|
|
31
31
|
export declare function toInsertNode(startNode: Node, endNode: Node): Node;
|
package/dist/dom.js
CHANGED
|
@@ -5,7 +5,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
5
5
|
else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
6
6
|
return str;
|
|
7
7
|
}, decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)).toString(36), delegate = (type, handler) => handler[type] ||= (document.addEventListener(type, handler, !0), 1), parsers = {}, nextScopeId = 1e6, collectingScopes, destroyNestedScopes = function destroyNestedScopes(scope) {
|
|
8
|
-
scope.H = 0, scope.D?.forEach(destroyNestedScopes), scope.B?.forEach(
|
|
8
|
+
scope.H = 0, scope.D?.forEach(destroyNestedScopes), scope.B?.forEach(cleanupScope);
|
|
9
9
|
}, isScheduled, channel, _return = (scope, value) => scope.T?.(value), _var_change = (scope, value) => scope.U?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap(), walker = /* @__PURE__ */ document.createTreeWalker(document), walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
10
10
|
let value, currentMultiplier, storedMultiplier = 0, currentScopeIndex = 0;
|
|
11
11
|
for (; currentWalkIndex < walkCodes.length;) if (value = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value === 32) {
|
|
@@ -250,11 +250,15 @@ function destroyBranch(branch) {
|
|
|
250
250
|
branch.N?.D?.delete(branch), destroyNestedScopes(branch);
|
|
251
251
|
}
|
|
252
252
|
function destroyScope(scope) {
|
|
253
|
-
scope.H && (destroyNestedScopes(scope),
|
|
253
|
+
scope.H && (destroyNestedScopes(scope), cleanupScope(scope));
|
|
254
254
|
}
|
|
255
|
-
function
|
|
255
|
+
function cleanupScope(scope) {
|
|
256
|
+
scope.Z?.forEach(unsubscribe, scope);
|
|
256
257
|
for (let id in scope.A) $signalReset(scope, id);
|
|
257
258
|
}
|
|
259
|
+
function unsubscribe(subscribers) {
|
|
260
|
+
subscribers.delete(this);
|
|
261
|
+
}
|
|
258
262
|
function removeAndDestroyBranch(branch) {
|
|
259
263
|
destroyBranch(branch), removeChildNodes(branch.S, branch.K);
|
|
260
264
|
}
|
|
@@ -347,8 +351,8 @@ function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
|
|
|
347
351
|
return ownerSignal._ = fn, ownerSignal;
|
|
348
352
|
}
|
|
349
353
|
function subscribeToScopeSet(ownerScope, accessor, scope) {
|
|
350
|
-
let subscribers = ownerScope[accessor] ||= /* @__PURE__ */ new Set();
|
|
351
|
-
subscribers.
|
|
354
|
+
let subscribers = ownerScope[accessor] ||= /* @__PURE__ */ new Set(), { size } = subscribers;
|
|
355
|
+
subscribers.add(scope).size !== size && trackCleanup(scope, subscribers);
|
|
352
356
|
}
|
|
353
357
|
function _closure(...closureSignals) {
|
|
354
358
|
let [firstSignal] = closureSignals, scopeInstances = firstSignal.a, signalIndex = firstSignal.b;
|
|
@@ -702,16 +706,18 @@ function removeChildNodes(startNode, endNode) {
|
|
|
702
706
|
}
|
|
703
707
|
}
|
|
704
708
|
function insertChildNodes(parentNode, referenceNode, startNode, endNode) {
|
|
705
|
-
parentNode.insertBefore(toInsertNode(startNode, endNode), referenceNode);
|
|
709
|
+
if (parentNode.isConnected) parentNode.insertBefore(toInsertNode(startNode, endNode), referenceNode);
|
|
710
|
+
else {
|
|
711
|
+
let stop = endNode.nextSibling;
|
|
712
|
+
for (; startNode !== stop;) {
|
|
713
|
+
let next = startNode.nextSibling;
|
|
714
|
+
parentNode.insertBefore(startNode, referenceNode), startNode = next;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
return parentNode;
|
|
706
718
|
}
|
|
707
719
|
function toInsertNode(startNode, endNode) {
|
|
708
|
-
|
|
709
|
-
let parent = new DocumentFragment(), stop = endNode.nextSibling;
|
|
710
|
-
for (; startNode !== stop;) {
|
|
711
|
-
let next = startNode.nextSibling;
|
|
712
|
-
parent.appendChild(startNode), startNode = next;
|
|
713
|
-
}
|
|
714
|
-
return parent;
|
|
720
|
+
return startNode === endNode ? startNode : insertChildNodes(new DocumentFragment(), null, startNode, endNode);
|
|
715
721
|
}
|
|
716
722
|
//#endregion
|
|
717
723
|
//#region src/dom/resolve-cursor-position.ts
|
|
@@ -1242,7 +1248,12 @@ function $signalReset(scope, id) {
|
|
|
1242
1248
|
ctrl && (scope.A[id] = void 0, rendering ? queueEffect(ctrl, abort) : abort(ctrl));
|
|
1243
1249
|
}
|
|
1244
1250
|
function $signal(scope, id) {
|
|
1245
|
-
return
|
|
1251
|
+
return trackCleanup(scope), ((scope.A ||= {})[id] ||= new AbortController()).signal;
|
|
1252
|
+
}
|
|
1253
|
+
/** Enrols `scope` with its branch so destroying the branch cleans it up. */
|
|
1254
|
+
function trackCleanup(scope, subscribers) {
|
|
1255
|
+
let branch = scope.F;
|
|
1256
|
+
branch && (branch.B ||= /* @__PURE__ */ new Set()).add(scope), subscribers && (scope.Z ||= []).push(subscribers);
|
|
1246
1257
|
}
|
|
1247
1258
|
function abort(ctrl) {
|
|
1248
1259
|
ctrl.abort();
|
package/dist/dom.mjs
CHANGED
|
@@ -5,7 +5,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
|
|
|
5
5
|
else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
6
6
|
return str;
|
|
7
7
|
}, decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)).toString(36), delegate = (type, handler) => handler[type] ||= (document.addEventListener(type, handler, !0), 1), parsers = {}, nextScopeId = 1e6, collectingScopes, destroyNestedScopes = function destroyNestedScopes(scope) {
|
|
8
|
-
scope.H = 0, scope.D?.forEach(destroyNestedScopes), scope.B?.forEach(
|
|
8
|
+
scope.H = 0, scope.D?.forEach(destroyNestedScopes), scope.B?.forEach(cleanupScope);
|
|
9
9
|
}, isScheduled, channel, _return = (scope, value) => scope.T?.(value), _var_change = (scope, value) => scope.U?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap(), walker = /* @__PURE__ */ document.createTreeWalker(document), walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
|
|
10
10
|
let value, currentMultiplier, storedMultiplier = 0, currentScopeIndex = 0;
|
|
11
11
|
for (; currentWalkIndex < walkCodes.length;) if (value = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value === 32) {
|
|
@@ -249,11 +249,15 @@ function destroyBranch(branch) {
|
|
|
249
249
|
branch.N?.D?.delete(branch), destroyNestedScopes(branch);
|
|
250
250
|
}
|
|
251
251
|
function destroyScope(scope) {
|
|
252
|
-
scope.H && (destroyNestedScopes(scope),
|
|
252
|
+
scope.H && (destroyNestedScopes(scope), cleanupScope(scope));
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function cleanupScope(scope) {
|
|
255
|
+
scope.Z?.forEach(unsubscribe, scope);
|
|
255
256
|
for (let id in scope.A) $signalReset(scope, id);
|
|
256
257
|
}
|
|
258
|
+
function unsubscribe(subscribers) {
|
|
259
|
+
subscribers.delete(this);
|
|
260
|
+
}
|
|
257
261
|
function removeAndDestroyBranch(branch) {
|
|
258
262
|
destroyBranch(branch), removeChildNodes(branch.S, branch.K);
|
|
259
263
|
}
|
|
@@ -346,8 +350,8 @@ function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
|
|
|
346
350
|
return ownerSignal._ = fn, ownerSignal;
|
|
347
351
|
}
|
|
348
352
|
function subscribeToScopeSet(ownerScope, accessor, scope) {
|
|
349
|
-
let subscribers = ownerScope[accessor] ||= /* @__PURE__ */ new Set();
|
|
350
|
-
subscribers.
|
|
353
|
+
let subscribers = ownerScope[accessor] ||= /* @__PURE__ */ new Set(), { size } = subscribers;
|
|
354
|
+
subscribers.add(scope).size !== size && trackCleanup(scope, subscribers);
|
|
351
355
|
}
|
|
352
356
|
function _closure(...closureSignals) {
|
|
353
357
|
let [firstSignal] = closureSignals, scopeInstances = firstSignal.a, signalIndex = firstSignal.b;
|
|
@@ -701,16 +705,18 @@ function removeChildNodes(startNode, endNode) {
|
|
|
701
705
|
}
|
|
702
706
|
}
|
|
703
707
|
function insertChildNodes(parentNode, referenceNode, startNode, endNode) {
|
|
704
|
-
parentNode.insertBefore(toInsertNode(startNode, endNode), referenceNode);
|
|
708
|
+
if (parentNode.isConnected) parentNode.insertBefore(toInsertNode(startNode, endNode), referenceNode);
|
|
709
|
+
else {
|
|
710
|
+
let stop = endNode.nextSibling;
|
|
711
|
+
for (; startNode !== stop;) {
|
|
712
|
+
let next = startNode.nextSibling;
|
|
713
|
+
parentNode.insertBefore(startNode, referenceNode), startNode = next;
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
return parentNode;
|
|
705
717
|
}
|
|
706
718
|
function toInsertNode(startNode, endNode) {
|
|
707
|
-
|
|
708
|
-
let parent = new DocumentFragment(), stop = endNode.nextSibling;
|
|
709
|
-
for (; startNode !== stop;) {
|
|
710
|
-
let next = startNode.nextSibling;
|
|
711
|
-
parent.appendChild(startNode), startNode = next;
|
|
712
|
-
}
|
|
713
|
-
return parent;
|
|
719
|
+
return startNode === endNode ? startNode : insertChildNodes(new DocumentFragment(), null, startNode, endNode);
|
|
714
720
|
}
|
|
715
721
|
//#endregion
|
|
716
722
|
//#region src/dom/resolve-cursor-position.ts
|
|
@@ -1241,7 +1247,12 @@ function $signalReset(scope, id) {
|
|
|
1241
1247
|
ctrl && (scope.A[id] = void 0, rendering ? queueEffect(ctrl, abort) : abort(ctrl));
|
|
1242
1248
|
}
|
|
1243
1249
|
function $signal(scope, id) {
|
|
1244
|
-
return
|
|
1250
|
+
return trackCleanup(scope), ((scope.A ||= {})[id] ||= new AbortController()).signal;
|
|
1251
|
+
}
|
|
1252
|
+
/** Enrols `scope` with its branch so destroying the branch cleans it up. */
|
|
1253
|
+
function trackCleanup(scope, subscribers) {
|
|
1254
|
+
let branch = scope.F;
|
|
1255
|
+
branch && (branch.B ||= /* @__PURE__ */ new Set()).add(scope), subscribers && (scope.Z ||= []).push(subscribers);
|
|
1245
1256
|
}
|
|
1246
1257
|
function abort(ctrl) {
|
|
1247
1258
|
ctrl.abort();
|
package/dist/translator/index.js
CHANGED
|
@@ -162,6 +162,7 @@ var accessor_prop_debug_exports = /* @__PURE__ */ __exportAll({
|
|
|
162
162
|
PlaceholderContent: () => PlaceholderContent$1,
|
|
163
163
|
Renderer: () => Renderer$1,
|
|
164
164
|
StartNode: () => StartNode$1,
|
|
165
|
+
Subscriptions: () => Subscriptions$1,
|
|
165
166
|
TagVariable: () => TagVariable$1,
|
|
166
167
|
TagVariableChange: () => TagVariableChange$2
|
|
167
168
|
});
|
|
@@ -188,6 +189,7 @@ const PlaceholderBranch$1 = "#PlaceholderBranch";
|
|
|
188
189
|
const PlaceholderContent$1 = "#PlaceholderContent";
|
|
189
190
|
const Renderer$1 = "#Renderer";
|
|
190
191
|
const StartNode$1 = "#StartNode";
|
|
192
|
+
const Subscriptions$1 = "#Subscriptions";
|
|
191
193
|
const TagVariable$1 = "#TagVariable";
|
|
192
194
|
const TagVariableChange$2 = "#TagVariableChange";
|
|
193
195
|
//#endregion
|
|
@@ -948,6 +950,7 @@ var accessor_prop_exports = /* @__PURE__ */ __exportAll({
|
|
|
948
950
|
PlaceholderContent: () => "Q",
|
|
949
951
|
Renderer: () => "R",
|
|
950
952
|
StartNode: () => "S",
|
|
953
|
+
Subscriptions: () => "Z",
|
|
951
954
|
TagVariable: () => "T",
|
|
952
955
|
TagVariableChange: () => "U"
|
|
953
956
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "marko",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.30",
|
|
4
4
|
"description": "Optimized runtime for Marko templates.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"magic-string": "^0.30.21"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@marko/runtime-tags": "npm:marko@6.3.
|
|
57
|
+
"@marko/runtime-tags": "npm:marko@6.3.30",
|
|
58
58
|
"marko": "5.39.30"
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|