marko 6.1.5 → 6.1.7
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 +2 -3
- package/dist/debug/dom.mjs +2 -3
- package/dist/debug/html.js +18 -15
- package/dist/debug/html.mjs +18 -15
- package/dist/dom.js +2 -2
- package/dist/dom.mjs +2 -2
- package/dist/html/serializer.d.ts +1 -1
- package/dist/html.js +21 -10
- package/dist/html.mjs +21 -10
- package/package.json +1 -1
package/dist/debug/dom.js
CHANGED
|
@@ -597,8 +597,8 @@ function init(runtimeId = "M") {
|
|
|
597
597
|
const render = curRenders[renderId] = renders[renderId] || renders(renderId);
|
|
598
598
|
const walk = render.w;
|
|
599
599
|
const scopeLookup = {};
|
|
600
|
-
const getScope = (id) => scopeLookup[id] || initScope(scopeLookup[id] = { ["#Id"]: +id });
|
|
601
|
-
const initGlobal = () =>
|
|
600
|
+
const getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { ["#Id"]: +id }) : initGlobal());
|
|
601
|
+
const initGlobal = () => scopeLookup[0] ||= {
|
|
602
602
|
runtimeId,
|
|
603
603
|
renderId
|
|
604
604
|
};
|
|
@@ -684,7 +684,6 @@ function init(runtimeId = "M") {
|
|
|
684
684
|
resumes.splice(0, i);
|
|
685
685
|
return i;
|
|
686
686
|
};
|
|
687
|
-
let $global;
|
|
688
687
|
let lastEffect;
|
|
689
688
|
let visits;
|
|
690
689
|
let visit;
|
package/dist/debug/dom.mjs
CHANGED
|
@@ -595,8 +595,8 @@ function init(runtimeId = "M") {
|
|
|
595
595
|
const render = curRenders[renderId] = renders[renderId] || renders(renderId);
|
|
596
596
|
const walk = render.w;
|
|
597
597
|
const scopeLookup = {};
|
|
598
|
-
const getScope = (id) => scopeLookup[id] || initScope(scopeLookup[id] = { ["#Id"]: +id });
|
|
599
|
-
const initGlobal = () =>
|
|
598
|
+
const getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { ["#Id"]: +id }) : initGlobal());
|
|
599
|
+
const initGlobal = () => scopeLookup[0] ||= {
|
|
600
600
|
runtimeId,
|
|
601
601
|
renderId
|
|
602
602
|
};
|
|
@@ -682,7 +682,6 @@ function init(runtimeId = "M") {
|
|
|
682
682
|
resumes.splice(0, i);
|
|
683
683
|
return i;
|
|
684
684
|
};
|
|
685
|
-
let $global;
|
|
686
685
|
let lastEffect;
|
|
687
686
|
let visits;
|
|
688
687
|
let visit;
|
package/dist/debug/html.js
CHANGED
|
@@ -382,11 +382,11 @@ var Serializer = class {
|
|
|
382
382
|
pendingReadyChannel() {
|
|
383
383
|
for (const mutation of this.#state.mutated) if (mutation.channel?.readyId) return mutation.channel;
|
|
384
384
|
}
|
|
385
|
-
stringifyScopes(flushes,
|
|
385
|
+
stringifyScopes(flushes, boundary, channel) {
|
|
386
386
|
try {
|
|
387
387
|
this.#state.boundary = boundary;
|
|
388
388
|
this.#state.channel = channel;
|
|
389
|
-
return writeScopesRoot(this.#state, flushes
|
|
389
|
+
return writeScopesRoot(this.#state, flushes);
|
|
390
390
|
} finally {
|
|
391
391
|
this.#state.flush++;
|
|
392
392
|
this.#state.buf = [];
|
|
@@ -424,15 +424,10 @@ function getRegistered(val) {
|
|
|
424
424
|
scope: registered.scope
|
|
425
425
|
};
|
|
426
426
|
}
|
|
427
|
-
function writeScopesRoot(state, flushes
|
|
427
|
+
function writeScopesRoot(state, flushes) {
|
|
428
428
|
const { buf } = state;
|
|
429
429
|
let nextSlotId = -1;
|
|
430
430
|
let fillIndex = -1;
|
|
431
|
-
if (globals) {
|
|
432
|
-
fillIndex = buf.push("[0,") - 1;
|
|
433
|
-
writeProp(state, globals, null, "");
|
|
434
|
-
nextSlotId = 1;
|
|
435
|
-
}
|
|
436
431
|
for (const flush of flushes) {
|
|
437
432
|
const scopeId = flush[0];
|
|
438
433
|
const scope = flush[1];
|
|
@@ -2144,7 +2139,7 @@ var Chunk = class Chunk {
|
|
|
2144
2139
|
if (needsWalk) state.walkOnNextFlush = false;
|
|
2145
2140
|
let readyResumeScripts = this.flushReadyScripts();
|
|
2146
2141
|
for (let channel; channel = state.serializer.pendingReadyChannel();) {
|
|
2147
|
-
const resumes = state.serializer.stringifyScopes([],
|
|
2142
|
+
const resumes = state.serializer.stringifyScopes([], boundary, channel);
|
|
2148
2143
|
const deps = state.serializer.takeChannelDeps();
|
|
2149
2144
|
state.needsMainRuntime = true;
|
|
2150
2145
|
readyResumeScripts = concatScripts(readyResumeScripts, state.writeReady(channel.readyId, concatSequence(depsMarker(deps), resumes)));
|
|
@@ -2247,7 +2242,6 @@ function flushSerializer(boundary, serializeState) {
|
|
|
2247
2242
|
const { writeScopes, passiveScopes } = serializeState;
|
|
2248
2243
|
const isBlockingState = serializeState !== state;
|
|
2249
2244
|
const flushes = [];
|
|
2250
|
-
let globals = 0;
|
|
2251
2245
|
if (passiveScopes) for (const key in passiveScopes) {
|
|
2252
2246
|
const props = writeScopes[key];
|
|
2253
2247
|
if (props) {
|
|
@@ -2257,7 +2251,12 @@ function flushSerializer(boundary, serializeState) {
|
|
|
2257
2251
|
}
|
|
2258
2252
|
if (!isBlockingState && !state.hasGlobals) {
|
|
2259
2253
|
state.hasGlobals = true;
|
|
2260
|
-
globals = getFilteredGlobals(state.$global);
|
|
2254
|
+
const globals = getFilteredGlobals(state.$global);
|
|
2255
|
+
if (globals) flushes.push([
|
|
2256
|
+
0,
|
|
2257
|
+
globals,
|
|
2258
|
+
globals
|
|
2259
|
+
]);
|
|
2261
2260
|
}
|
|
2262
2261
|
for (const key in writeScopes) {
|
|
2263
2262
|
const scopeId = +key;
|
|
@@ -2268,9 +2267,9 @@ function flushSerializer(boundary, serializeState) {
|
|
|
2268
2267
|
props
|
|
2269
2268
|
]);
|
|
2270
2269
|
}
|
|
2271
|
-
if (flushes.length ||
|
|
2270
|
+
if (flushes.length || pending) {
|
|
2272
2271
|
if (isBlockingState && !state.hasGlobals) flushSerializerGlobals(boundary);
|
|
2273
|
-
serializeState.resumes = concatSequence(serializeState.resumes, serializer.stringifyScopes(flushes,
|
|
2272
|
+
serializeState.resumes = concatSequence(serializeState.resumes, serializer.stringifyScopes(flushes, boundary, serializeState));
|
|
2274
2273
|
}
|
|
2275
2274
|
serializeState.writeScopes = {};
|
|
2276
2275
|
serializeState.flushScopes = false;
|
|
@@ -2283,7 +2282,11 @@ function flushSerializerGlobals(boundary) {
|
|
|
2283
2282
|
if (globals) {
|
|
2284
2283
|
state.hasGlobals = true;
|
|
2285
2284
|
state.needsMainRuntime = true;
|
|
2286
|
-
state.resumes = concatSequence(state.resumes, state.serializer.stringifyScopes([
|
|
2285
|
+
state.resumes = concatSequence(state.resumes, state.serializer.stringifyScopes([[
|
|
2286
|
+
0,
|
|
2287
|
+
globals,
|
|
2288
|
+
globals
|
|
2289
|
+
]], boundary));
|
|
2287
2290
|
}
|
|
2288
2291
|
}
|
|
2289
2292
|
function depsMarker(deps) {
|
|
@@ -2900,7 +2903,7 @@ function writeTriggerScript(html, triggers) {
|
|
|
2900
2903
|
default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(document.querySelector(${JSON.stringify(trigger.selector)})||l())`;
|
|
2901
2904
|
}
|
|
2902
2905
|
});
|
|
2903
|
-
writeScript(`((p,h,d,l=$=>d||p.
|
|
2906
|
+
writeScript(`((p,h,d,l=$=>d||p.after(new Range().createContextualFragment(d=h)))=>${exprs.length > 1 ? `{${exprs.join(";")}}` : exprs[0]})(document.currentScript,${htmlStr})`);
|
|
2904
2907
|
}
|
|
2905
2908
|
function toObjectExpression(options) {
|
|
2906
2909
|
let result = "{";
|
package/dist/debug/html.mjs
CHANGED
|
@@ -380,11 +380,11 @@ var Serializer = class {
|
|
|
380
380
|
pendingReadyChannel() {
|
|
381
381
|
for (const mutation of this.#state.mutated) if (mutation.channel?.readyId) return mutation.channel;
|
|
382
382
|
}
|
|
383
|
-
stringifyScopes(flushes,
|
|
383
|
+
stringifyScopes(flushes, boundary, channel) {
|
|
384
384
|
try {
|
|
385
385
|
this.#state.boundary = boundary;
|
|
386
386
|
this.#state.channel = channel;
|
|
387
|
-
return writeScopesRoot(this.#state, flushes
|
|
387
|
+
return writeScopesRoot(this.#state, flushes);
|
|
388
388
|
} finally {
|
|
389
389
|
this.#state.flush++;
|
|
390
390
|
this.#state.buf = [];
|
|
@@ -422,15 +422,10 @@ function getRegistered(val) {
|
|
|
422
422
|
scope: registered.scope
|
|
423
423
|
};
|
|
424
424
|
}
|
|
425
|
-
function writeScopesRoot(state, flushes
|
|
425
|
+
function writeScopesRoot(state, flushes) {
|
|
426
426
|
const { buf } = state;
|
|
427
427
|
let nextSlotId = -1;
|
|
428
428
|
let fillIndex = -1;
|
|
429
|
-
if (globals) {
|
|
430
|
-
fillIndex = buf.push("[0,") - 1;
|
|
431
|
-
writeProp(state, globals, null, "");
|
|
432
|
-
nextSlotId = 1;
|
|
433
|
-
}
|
|
434
429
|
for (const flush of flushes) {
|
|
435
430
|
const scopeId = flush[0];
|
|
436
431
|
const scope = flush[1];
|
|
@@ -2142,7 +2137,7 @@ var Chunk = class Chunk {
|
|
|
2142
2137
|
if (needsWalk) state.walkOnNextFlush = false;
|
|
2143
2138
|
let readyResumeScripts = this.flushReadyScripts();
|
|
2144
2139
|
for (let channel; channel = state.serializer.pendingReadyChannel();) {
|
|
2145
|
-
const resumes = state.serializer.stringifyScopes([],
|
|
2140
|
+
const resumes = state.serializer.stringifyScopes([], boundary, channel);
|
|
2146
2141
|
const deps = state.serializer.takeChannelDeps();
|
|
2147
2142
|
state.needsMainRuntime = true;
|
|
2148
2143
|
readyResumeScripts = concatScripts(readyResumeScripts, state.writeReady(channel.readyId, concatSequence(depsMarker(deps), resumes)));
|
|
@@ -2245,7 +2240,6 @@ function flushSerializer(boundary, serializeState) {
|
|
|
2245
2240
|
const { writeScopes, passiveScopes } = serializeState;
|
|
2246
2241
|
const isBlockingState = serializeState !== state;
|
|
2247
2242
|
const flushes = [];
|
|
2248
|
-
let globals = 0;
|
|
2249
2243
|
if (passiveScopes) for (const key in passiveScopes) {
|
|
2250
2244
|
const props = writeScopes[key];
|
|
2251
2245
|
if (props) {
|
|
@@ -2255,7 +2249,12 @@ function flushSerializer(boundary, serializeState) {
|
|
|
2255
2249
|
}
|
|
2256
2250
|
if (!isBlockingState && !state.hasGlobals) {
|
|
2257
2251
|
state.hasGlobals = true;
|
|
2258
|
-
globals = getFilteredGlobals(state.$global);
|
|
2252
|
+
const globals = getFilteredGlobals(state.$global);
|
|
2253
|
+
if (globals) flushes.push([
|
|
2254
|
+
0,
|
|
2255
|
+
globals,
|
|
2256
|
+
globals
|
|
2257
|
+
]);
|
|
2259
2258
|
}
|
|
2260
2259
|
for (const key in writeScopes) {
|
|
2261
2260
|
const scopeId = +key;
|
|
@@ -2266,9 +2265,9 @@ function flushSerializer(boundary, serializeState) {
|
|
|
2266
2265
|
props
|
|
2267
2266
|
]);
|
|
2268
2267
|
}
|
|
2269
|
-
if (flushes.length ||
|
|
2268
|
+
if (flushes.length || pending) {
|
|
2270
2269
|
if (isBlockingState && !state.hasGlobals) flushSerializerGlobals(boundary);
|
|
2271
|
-
serializeState.resumes = concatSequence(serializeState.resumes, serializer.stringifyScopes(flushes,
|
|
2270
|
+
serializeState.resumes = concatSequence(serializeState.resumes, serializer.stringifyScopes(flushes, boundary, serializeState));
|
|
2272
2271
|
}
|
|
2273
2272
|
serializeState.writeScopes = {};
|
|
2274
2273
|
serializeState.flushScopes = false;
|
|
@@ -2281,7 +2280,11 @@ function flushSerializerGlobals(boundary) {
|
|
|
2281
2280
|
if (globals) {
|
|
2282
2281
|
state.hasGlobals = true;
|
|
2283
2282
|
state.needsMainRuntime = true;
|
|
2284
|
-
state.resumes = concatSequence(state.resumes, state.serializer.stringifyScopes([
|
|
2283
|
+
state.resumes = concatSequence(state.resumes, state.serializer.stringifyScopes([[
|
|
2284
|
+
0,
|
|
2285
|
+
globals,
|
|
2286
|
+
globals
|
|
2287
|
+
]], boundary));
|
|
2285
2288
|
}
|
|
2286
2289
|
}
|
|
2287
2290
|
function depsMarker(deps) {
|
|
@@ -2898,7 +2901,7 @@ function writeTriggerScript(html, triggers) {
|
|
|
2898
2901
|
default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(document.querySelector(${JSON.stringify(trigger.selector)})||l())`;
|
|
2899
2902
|
}
|
|
2900
2903
|
});
|
|
2901
|
-
writeScript(`((p,h,d,l=$=>d||p.
|
|
2904
|
+
writeScript(`((p,h,d,l=$=>d||p.after(new Range().createContextualFragment(d=h)))=>${exprs.length > 1 ? `{${exprs.join(";")}}` : exprs[0]})(document.currentScript,${htmlStr})`);
|
|
2902
2905
|
}
|
|
2903
2906
|
function toObjectExpression(options) {
|
|
2904
2907
|
let result = "{";
|
package/dist/dom.js
CHANGED
|
@@ -434,7 +434,7 @@ function init(runtimeId = "M") {
|
|
|
434
434
|
if (curRenders) return;
|
|
435
435
|
let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), initRuntime = (renders) => {
|
|
436
436
|
defineRuntime({ value: curRenders = ((renderId) => {
|
|
437
|
-
let render = curRenders[renderId] = renders[renderId] || renders(renderId), walk = render.w, scopeLookup = {}, getScope = (id) => scopeLookup[id] || initScope(scopeLookup[id] = { L: +id }), initGlobal = () =>
|
|
437
|
+
let render = curRenders[renderId] = renders[renderId] || renders(renderId), walk = render.w, scopeLookup = {}, getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { L: +id }) : initGlobal()), initGlobal = () => scopeLookup[0] ||= {
|
|
438
438
|
runtimeId,
|
|
439
439
|
renderId
|
|
440
440
|
}, initScope = (scope) => (scope.$ = initGlobal(), branchesEnabled && scope.G && (scope.F = getScope(scope.G)), scope), applyScopes = (partials) => {
|
|
@@ -471,7 +471,7 @@ function init(runtimeId = "M") {
|
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
473
|
return resumes.splice(0, i), i;
|
|
474
|
-
},
|
|
474
|
+
}, lastEffect, visits, visit, visitText, visitType, visitScope, lastToken, lastTokenIndex, visitBranches, embedAnchor;
|
|
475
475
|
return serializeContext._ = registeredValues, render.m = (effects) => {
|
|
476
476
|
if (processResumes(render.r, effects), readyIds && render.b) for (let progress = 1; progress;) {
|
|
477
477
|
progress = 0;
|
package/dist/dom.mjs
CHANGED
|
@@ -433,7 +433,7 @@ function init(runtimeId = "M") {
|
|
|
433
433
|
if (curRenders) return;
|
|
434
434
|
let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), initRuntime = (renders) => {
|
|
435
435
|
defineRuntime({ value: curRenders = ((renderId) => {
|
|
436
|
-
let render = curRenders[renderId] = renders[renderId] || renders(renderId), walk = render.w, scopeLookup = {}, getScope = (id) => scopeLookup[id] || initScope(scopeLookup[id] = { L: +id }), initGlobal = () =>
|
|
436
|
+
let render = curRenders[renderId] = renders[renderId] || renders(renderId), walk = render.w, scopeLookup = {}, getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { L: +id }) : initGlobal()), initGlobal = () => scopeLookup[0] ||= {
|
|
437
437
|
runtimeId,
|
|
438
438
|
renderId
|
|
439
439
|
}, initScope = (scope) => (scope.$ = initGlobal(), branchesEnabled && scope.G && (scope.F = getScope(scope.G)), scope), applyScopes = (partials) => {
|
|
@@ -470,7 +470,7 @@ function init(runtimeId = "M") {
|
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
472
|
return resumes.splice(0, i), i;
|
|
473
|
-
},
|
|
473
|
+
}, lastEffect, visits, visit, visitText, visitType, visitScope, lastToken, lastTokenIndex, visitBranches, embedAnchor;
|
|
474
474
|
return serializeContext._ = registeredValues, render.m = (effects) => {
|
|
475
475
|
if (processResumes(render.r, effects), readyIds && render.b) for (let progress = 1; progress;) {
|
|
476
476
|
progress = 0;
|
|
@@ -10,7 +10,7 @@ export declare class Serializer {
|
|
|
10
10
|
#private;
|
|
11
11
|
pending(channel?: SerializeChannel): boolean;
|
|
12
12
|
pendingReadyChannel(): SerializeChannel | undefined;
|
|
13
|
-
stringifyScopes(flushes: ScopeFlush[],
|
|
13
|
+
stringifyScopes(flushes: ScopeFlush[], boundary: Boundary, channel?: SerializeChannel): string;
|
|
14
14
|
written(val: WeakKey): boolean;
|
|
15
15
|
takeChannelDeps(): Set<string> | null;
|
|
16
16
|
writeCall(value: unknown, object: unknown, property: string, channel?: SerializeChannel): void;
|
package/dist/html.js
CHANGED
|
@@ -422,9 +422,9 @@ var State$1 = class {
|
|
|
422
422
|
pendingReadyChannel() {
|
|
423
423
|
for (let mutation of this.#state.mutated) if (mutation.channel?.readyId) return mutation.channel;
|
|
424
424
|
}
|
|
425
|
-
stringifyScopes(flushes,
|
|
425
|
+
stringifyScopes(flushes, boundary, channel) {
|
|
426
426
|
try {
|
|
427
|
-
return this.#state.boundary = boundary, this.#state.channel = channel, writeScopesRoot(this.#state, flushes
|
|
427
|
+
return this.#state.boundary = boundary, this.#state.channel = channel, writeScopesRoot(this.#state, flushes);
|
|
428
428
|
} finally {
|
|
429
429
|
this.#state.flush++, this.#state.buf = [];
|
|
430
430
|
}
|
|
@@ -459,9 +459,8 @@ function getRegistered(val) {
|
|
|
459
459
|
scope: registered.scope
|
|
460
460
|
};
|
|
461
461
|
}
|
|
462
|
-
function writeScopesRoot(state, flushes
|
|
462
|
+
function writeScopesRoot(state, flushes) {
|
|
463
463
|
let { buf } = state, nextSlotId = -1, fillIndex = -1;
|
|
464
|
-
globals && (fillIndex = buf.push("[0,") - 1, writeProp(state, globals, null, ""), nextSlotId = 1);
|
|
465
464
|
for (let flush of flushes) {
|
|
466
465
|
let scopeId = flush[0], scope = flush[1], ref = state.refs.get(scope) || newScopeReference(state, scope, scopeId), openIndex = buf.push("") - 1;
|
|
467
466
|
writeObjectProps(state, flush[2], ref) ? (buf[openIndex] = nextSlotId === -1 ? "[" + scopeId + ",{" : (scopeId > nextSlotId ? "," + (scopeId - nextSlotId) : "") + ",{", fillIndex === -1 && (fillIndex = openIndex), nextSlotId = scopeId + 1, buf.push("}")) : buf.pop();
|
|
@@ -1464,7 +1463,7 @@ var State = class {
|
|
|
1464
1463
|
needsWalk && (state.walkOnNextFlush = !1);
|
|
1465
1464
|
let readyResumeScripts = this.flushReadyScripts();
|
|
1466
1465
|
for (let channel; channel = state.serializer.pendingReadyChannel();) {
|
|
1467
|
-
let resumes = state.serializer.stringifyScopes([],
|
|
1466
|
+
let resumes = state.serializer.stringifyScopes([], boundary, channel), deps = state.serializer.takeChannelDeps();
|
|
1468
1467
|
state.needsMainRuntime = !0, readyResumeScripts = concatScripts(readyResumeScripts, state.writeReady(channel.readyId, concatSequence(depsMarker(deps), resumes)));
|
|
1469
1468
|
}
|
|
1470
1469
|
readyResumeScripts && (needsWalk = !0);
|
|
@@ -1497,12 +1496,20 @@ var State = class {
|
|
|
1497
1496
|
function flushSerializer(boundary, serializeState) {
|
|
1498
1497
|
let { state } = boundary, { serializer } = state, pending = serializer.pending(serializeState);
|
|
1499
1498
|
if (serializeState.flushScopes || pending) {
|
|
1500
|
-
let { writeScopes, passiveScopes } = serializeState, isBlockingState = serializeState !== state, flushes = []
|
|
1499
|
+
let { writeScopes, passiveScopes } = serializeState, isBlockingState = serializeState !== state, flushes = [];
|
|
1501
1500
|
if (passiveScopes) for (let key in passiveScopes) {
|
|
1502
1501
|
let props = writeScopes[key];
|
|
1503
1502
|
props && (writeScopes[key] = Object.assign(passiveScopes[key], props), delete passiveScopes[key]);
|
|
1504
1503
|
}
|
|
1505
|
-
!isBlockingState && !state.hasGlobals
|
|
1504
|
+
if (!isBlockingState && !state.hasGlobals) {
|
|
1505
|
+
state.hasGlobals = !0;
|
|
1506
|
+
let globals = getFilteredGlobals(state.$global);
|
|
1507
|
+
globals && flushes.push([
|
|
1508
|
+
0,
|
|
1509
|
+
globals,
|
|
1510
|
+
globals
|
|
1511
|
+
]);
|
|
1512
|
+
}
|
|
1506
1513
|
for (let key in writeScopes) {
|
|
1507
1514
|
let scopeId = +key, props = writeScopes[scopeId];
|
|
1508
1515
|
Object.getOwnPropertyNames(props).length && flushes.push([
|
|
@@ -1511,12 +1518,16 @@ function flushSerializer(boundary, serializeState) {
|
|
|
1511
1518
|
props
|
|
1512
1519
|
]);
|
|
1513
1520
|
}
|
|
1514
|
-
(flushes.length ||
|
|
1521
|
+
(flushes.length || pending) && (isBlockingState && !state.hasGlobals && flushSerializerGlobals(boundary), serializeState.resumes = concatSequence(serializeState.resumes, serializer.stringifyScopes(flushes, boundary, serializeState))), serializeState.writeScopes = {}, serializeState.flushScopes = !1, pending && (state.walkOnNextFlush = !0);
|
|
1515
1522
|
}
|
|
1516
1523
|
}
|
|
1517
1524
|
function flushSerializerGlobals(boundary) {
|
|
1518
1525
|
let { state } = boundary, globals = getFilteredGlobals(state.$global);
|
|
1519
|
-
globals && (state.hasGlobals = !0, state.needsMainRuntime = !0, state.resumes = concatSequence(state.resumes, state.serializer.stringifyScopes([
|
|
1526
|
+
globals && (state.hasGlobals = !0, state.needsMainRuntime = !0, state.resumes = concatSequence(state.resumes, state.serializer.stringifyScopes([[
|
|
1527
|
+
0,
|
|
1528
|
+
globals,
|
|
1529
|
+
globals
|
|
1530
|
+
]], boundary)));
|
|
1520
1531
|
}
|
|
1521
1532
|
function depsMarker(deps) {
|
|
1522
1533
|
let marker = "";
|
|
@@ -1930,7 +1941,7 @@ function writeTriggerScript(html, triggers) {
|
|
|
1930
1941
|
default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(document.querySelector(${JSON.stringify(trigger.selector)})||l())`;
|
|
1931
1942
|
}
|
|
1932
1943
|
});
|
|
1933
|
-
writeScript(`((p,h,d,l=$=>d||p.
|
|
1944
|
+
writeScript(`((p,h,d,l=$=>d||p.after(new Range().createContextualFragment(d=h)))=>${exprs.length > 1 ? `{${exprs.join(";")}}` : exprs[0]})(document.currentScript,${htmlStr})`);
|
|
1934
1945
|
}
|
|
1935
1946
|
function toObjectExpression(options) {
|
|
1936
1947
|
let result = "{", sep = "";
|
package/dist/html.mjs
CHANGED
|
@@ -421,9 +421,9 @@ var State$1 = class {
|
|
|
421
421
|
pendingReadyChannel() {
|
|
422
422
|
for (let mutation of this.#state.mutated) if (mutation.channel?.readyId) return mutation.channel;
|
|
423
423
|
}
|
|
424
|
-
stringifyScopes(flushes,
|
|
424
|
+
stringifyScopes(flushes, boundary, channel) {
|
|
425
425
|
try {
|
|
426
|
-
return this.#state.boundary = boundary, this.#state.channel = channel, writeScopesRoot(this.#state, flushes
|
|
426
|
+
return this.#state.boundary = boundary, this.#state.channel = channel, writeScopesRoot(this.#state, flushes);
|
|
427
427
|
} finally {
|
|
428
428
|
this.#state.flush++, this.#state.buf = [];
|
|
429
429
|
}
|
|
@@ -458,9 +458,8 @@ function getRegistered(val) {
|
|
|
458
458
|
scope: registered.scope
|
|
459
459
|
};
|
|
460
460
|
}
|
|
461
|
-
function writeScopesRoot(state, flushes
|
|
461
|
+
function writeScopesRoot(state, flushes) {
|
|
462
462
|
let { buf } = state, nextSlotId = -1, fillIndex = -1;
|
|
463
|
-
globals && (fillIndex = buf.push("[0,") - 1, writeProp(state, globals, null, ""), nextSlotId = 1);
|
|
464
463
|
for (let flush of flushes) {
|
|
465
464
|
let scopeId = flush[0], scope = flush[1], ref = state.refs.get(scope) || newScopeReference(state, scope, scopeId), openIndex = buf.push("") - 1;
|
|
466
465
|
writeObjectProps(state, flush[2], ref) ? (buf[openIndex] = nextSlotId === -1 ? "[" + scopeId + ",{" : (scopeId > nextSlotId ? "," + (scopeId - nextSlotId) : "") + ",{", fillIndex === -1 && (fillIndex = openIndex), nextSlotId = scopeId + 1, buf.push("}")) : buf.pop();
|
|
@@ -1463,7 +1462,7 @@ var State = class {
|
|
|
1463
1462
|
needsWalk && (state.walkOnNextFlush = !1);
|
|
1464
1463
|
let readyResumeScripts = this.flushReadyScripts();
|
|
1465
1464
|
for (let channel; channel = state.serializer.pendingReadyChannel();) {
|
|
1466
|
-
let resumes = state.serializer.stringifyScopes([],
|
|
1465
|
+
let resumes = state.serializer.stringifyScopes([], boundary, channel), deps = state.serializer.takeChannelDeps();
|
|
1467
1466
|
state.needsMainRuntime = !0, readyResumeScripts = concatScripts(readyResumeScripts, state.writeReady(channel.readyId, concatSequence(depsMarker(deps), resumes)));
|
|
1468
1467
|
}
|
|
1469
1468
|
readyResumeScripts && (needsWalk = !0);
|
|
@@ -1496,12 +1495,20 @@ var State = class {
|
|
|
1496
1495
|
function flushSerializer(boundary, serializeState) {
|
|
1497
1496
|
let { state } = boundary, { serializer } = state, pending = serializer.pending(serializeState);
|
|
1498
1497
|
if (serializeState.flushScopes || pending) {
|
|
1499
|
-
let { writeScopes, passiveScopes } = serializeState, isBlockingState = serializeState !== state, flushes = []
|
|
1498
|
+
let { writeScopes, passiveScopes } = serializeState, isBlockingState = serializeState !== state, flushes = [];
|
|
1500
1499
|
if (passiveScopes) for (let key in passiveScopes) {
|
|
1501
1500
|
let props = writeScopes[key];
|
|
1502
1501
|
props && (writeScopes[key] = Object.assign(passiveScopes[key], props), delete passiveScopes[key]);
|
|
1503
1502
|
}
|
|
1504
|
-
!isBlockingState && !state.hasGlobals
|
|
1503
|
+
if (!isBlockingState && !state.hasGlobals) {
|
|
1504
|
+
state.hasGlobals = !0;
|
|
1505
|
+
let globals = getFilteredGlobals(state.$global);
|
|
1506
|
+
globals && flushes.push([
|
|
1507
|
+
0,
|
|
1508
|
+
globals,
|
|
1509
|
+
globals
|
|
1510
|
+
]);
|
|
1511
|
+
}
|
|
1505
1512
|
for (let key in writeScopes) {
|
|
1506
1513
|
let scopeId = +key, props = writeScopes[scopeId];
|
|
1507
1514
|
Object.getOwnPropertyNames(props).length && flushes.push([
|
|
@@ -1510,12 +1517,16 @@ function flushSerializer(boundary, serializeState) {
|
|
|
1510
1517
|
props
|
|
1511
1518
|
]);
|
|
1512
1519
|
}
|
|
1513
|
-
(flushes.length ||
|
|
1520
|
+
(flushes.length || pending) && (isBlockingState && !state.hasGlobals && flushSerializerGlobals(boundary), serializeState.resumes = concatSequence(serializeState.resumes, serializer.stringifyScopes(flushes, boundary, serializeState))), serializeState.writeScopes = {}, serializeState.flushScopes = !1, pending && (state.walkOnNextFlush = !0);
|
|
1514
1521
|
}
|
|
1515
1522
|
}
|
|
1516
1523
|
function flushSerializerGlobals(boundary) {
|
|
1517
1524
|
let { state } = boundary, globals = getFilteredGlobals(state.$global);
|
|
1518
|
-
globals && (state.hasGlobals = !0, state.needsMainRuntime = !0, state.resumes = concatSequence(state.resumes, state.serializer.stringifyScopes([
|
|
1525
|
+
globals && (state.hasGlobals = !0, state.needsMainRuntime = !0, state.resumes = concatSequence(state.resumes, state.serializer.stringifyScopes([[
|
|
1526
|
+
0,
|
|
1527
|
+
globals,
|
|
1528
|
+
globals
|
|
1529
|
+
]], boundary)));
|
|
1519
1530
|
}
|
|
1520
1531
|
function depsMarker(deps) {
|
|
1521
1532
|
let marker = "";
|
|
@@ -1929,7 +1940,7 @@ function writeTriggerScript(html, triggers) {
|
|
|
1929
1940
|
default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(document.querySelector(${JSON.stringify(trigger.selector)})||l())`;
|
|
1930
1941
|
}
|
|
1931
1942
|
});
|
|
1932
|
-
writeScript(`((p,h,d,l=$=>d||p.
|
|
1943
|
+
writeScript(`((p,h,d,l=$=>d||p.after(new Range().createContextualFragment(d=h)))=>${exprs.length > 1 ? `{${exprs.join(";")}}` : exprs[0]})(document.currentScript,${htmlStr})`);
|
|
1933
1944
|
}
|
|
1934
1945
|
function toObjectExpression(options) {
|
|
1935
1946
|
let result = "{", sep = "";
|