marko 6.0.0-next.3.66 → 6.0.0-next.3.68

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/html.js CHANGED
@@ -178,7 +178,7 @@ function forTo(to, from, step, cb) {
178
178
  }
179
179
 
180
180
  // src/html/inlined-runtimes.ts
181
- var WALKER_RUNTIME_CODE = '(e=>self[e]=self[e]||(l=>{let t,d={},s=[],f=document,i=f.createTreeWalker(f,129),n=self[e][l]={i:l=e+l,d:f,l:d,v:s,x(){},w(e){for(;e=i.nextNode();)this.x(n=(n=e.data)&&!n.indexOf(l)&&(d[t=n.slice(x+1)]=e,n[x]),t,e),n>"#"&&s.push(e)}},x=l.length}))', REORDER_RUNTIME_CODE = '(e=>{let i,t,r,l={},o=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(d,n,a,c,p)=>{"#"==d?(l[n]=t).i++:a==r&&i(),"T"==a.tagName&&(n=a.getAttribute(e.i))&&((c=e.l["^"+n])&&(l[n]={i:1,c(i=e.l[n]||a){for(;i.parentNode!==c.parentNode;)i=i.parentNode;for(;i!=r;(r=c.nextSibling).remove());o(c,a)}}),r=a.nextSibling,t=l[n],i=()=>{c||o(e.l[n],a),--t.i||t.c()},(d=e.j[n])&&(p=t.c,t.c=()=>p()+d(e.r)))}})';
181
+ var WALKER_RUNTIME_CODE = '(e=>self[e]=self[e]||(l=>{let t,d={},s=[],f=document,i=f.createTreeWalker(f,129),n=self[e][l]={i:l=e+l,d:f,l:d,v:s,x(){},w(e){for(;e=i.nextNode();)this.x(n=(n=e.data)&&!n.indexOf(l)&&(d[t=n.slice(x+1)]=e,n[x]),t,e),n>"#"&&s.push(e)}},x=l.length}))', REORDER_RUNTIME_CODE = '(e=>{let i,l,t,r={},c=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(d,o,n,a,g)=>{"#"==d?(r[o]=l).i++:n==t&&i(),"T"==n.tagName&&(o=n.getAttribute(e.i))&&((a=e.l["^"+o])&&(r[o]={i:1,c(i=e.l[o]||n){for(;(t=i.previousSibling||a).remove(),a!=t;);c(i,n)}}),t=n.nextSibling,l=r[o],i=()=>{a||c(e.l[o],n),--l.i||l.c()},(d=e.j[o])&&(g=l.c,l.c=()=>g()+d(e.r)))}})';
182
182
 
183
183
  // src/html/serializer.ts
184
184
  var { hasOwnProperty } = {}, Generator = function* () {
@@ -1250,10 +1250,7 @@ function resumeSingleNodeConditional(cb, scopeId, accessor, onlyChild) {
1250
1250
  }
1251
1251
  var writeScope = (scopeId, partialScope) => {
1252
1252
  let { state } = $chunk.boundary, { scopes } = state, scope = scopes.get(scopeId);
1253
- return state.needsMainRuntime = !0, scope ? Object.assign(scope, partialScope) : (scope = partialScope, scope[K_SCOPE_ID] = scopeId, state.scopes.set(scopeId, scope)), state.writeScopes ? state.writeScopes[scopeId] = scope : state.hasGlobals ? state.writeScopes = { [scopeId]: scope } : (state.hasGlobals = !0, state.writeScopes = {
1254
- $: getFilteredGlobals(state.$global),
1255
- [scopeId]: scope
1256
- }), scope;
1253
+ return state.needsMainRuntime = !0, scope ? Object.assign(scope, partialScope) : (scope = partialScope, scope[K_SCOPE_ID] = scopeId, state.scopes.set(scopeId, scope)), state.writeScopes ? state.writeScopes[scopeId] = scope : state.writeScopes = { [scopeId]: scope }, scope;
1257
1254
  };
1258
1255
  function writeExistingScope(scope) {
1259
1256
  return writeScope(scope[K_SCOPE_ID], scope);
@@ -1371,6 +1368,7 @@ var State2 = class {
1371
1368
  tagId = 1;
1372
1369
  scopeId = 1;
1373
1370
  reorderId = 1;
1371
+ lastSerializedScopeId = this.scopeId;
1374
1372
  hasGlobals = !1;
1375
1373
  needsMainRuntime = !1;
1376
1374
  hasMainRuntime = !1;
@@ -1498,7 +1496,16 @@ function prepareChunk(chunk) {
1498
1496
  WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
1499
1497
  ));
1500
1498
  let resumes = "";
1501
- if ((state.writeScopes || serializer.flushed) && (resumes = state.serializer.stringify(state.writeScopes || {}, boundary), state.writeScopes = null), effects && (hasWalk = !0, resumes = resumes ? resumes + "," + effects : effects), resumes && (state.hasWrittenResume ? scripts = concatScripts(
1499
+ if (state.writeScopes || serializer.flushed) {
1500
+ let { lastSerializedScopeId } = state, serializeData = [];
1501
+ state.hasGlobals || (state.hasGlobals = !0, serializeData.push(getFilteredGlobals(state.$global)));
1502
+ for (let key in state.writeScopes) {
1503
+ let scope = state.writeScopes[key], scopeId = getScopeId(scope), scopeIdDelta = scopeId - lastSerializedScopeId;
1504
+ lastSerializedScopeId = scopeId + 1, scopeIdDelta && serializeData.push(scopeIdDelta), serializeData.push(scope);
1505
+ }
1506
+ resumes = state.serializer.stringify(serializeData, boundary), state.writeScopes = null, state.lastSerializedScopeId = lastSerializedScopeId;
1507
+ }
1508
+ if (effects && (hasWalk = !0, resumes = resumes ? resumes + "," + effects : effects), resumes && (state.hasWrittenResume ? scripts = concatScripts(
1502
1509
  scripts,
1503
1510
  runtimePrefix + ".r.push(" + resumes + ")"
1504
1511
  ) : (state.hasWrittenResume = !0, scripts = concatScripts(
@@ -1512,8 +1519,9 @@ function prepareChunk(chunk) {
1512
1519
  for (let reorderedChunk of state.writeReorders) {
1513
1520
  let { reorderId } = reorderedChunk, reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk;
1514
1521
  for (reorderedChunk.reorderId = null; ; ) {
1522
+ cur.flushPlaceholder();
1515
1523
  let { next } = cur;
1516
- if (cur.flushPlaceholder(), cur.consumed = !0, reorderHTML += cur.html, reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, cur.scripts), cur.async && (reorderHTML += state.mark(
1524
+ if (cur.consumed = !0, reorderHTML += cur.html, reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, cur.scripts), cur.async && (reorderHTML += state.mark(
1517
1525
  "#" /* ReorderMarker */,
1518
1526
  cur.reorderId = state.nextReorderId()
1519
1527
  ), cur.html = cur.effects = cur.scripts = "", cur.next = null), next)
@@ -1566,10 +1574,10 @@ function isPromise(value) {
1566
1574
  return value != null && typeof value.then == "function";
1567
1575
  }
1568
1576
  function getFilteredGlobals($global2) {
1569
- if (!$global2) return;
1577
+ if (!$global2) return 0;
1570
1578
  let serializedGlobals = $global2.serializedGlobals;
1571
- if (!serializedGlobals) return;
1572
- let filtered;
1579
+ if (!serializedGlobals) return 0;
1580
+ let filtered = 0;
1573
1581
  if (Array.isArray(serializedGlobals))
1574
1582
  for (let key of serializedGlobals) {
1575
1583
  let value = $global2[key];
package/dist/html.mjs CHANGED
@@ -97,7 +97,7 @@ function forTo(to, from, step, cb) {
97
97
  }
98
98
 
99
99
  // src/html/inlined-runtimes.ts
100
- var WALKER_RUNTIME_CODE = '(e=>self[e]=self[e]||(l=>{let t,d={},s=[],f=document,i=f.createTreeWalker(f,129),n=self[e][l]={i:l=e+l,d:f,l:d,v:s,x(){},w(e){for(;e=i.nextNode();)this.x(n=(n=e.data)&&!n.indexOf(l)&&(d[t=n.slice(x+1)]=e,n[x]),t,e),n>"#"&&s.push(e)}},x=l.length}))', REORDER_RUNTIME_CODE = '(e=>{let i,t,r,l={},o=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(d,n,a,c,p)=>{"#"==d?(l[n]=t).i++:a==r&&i(),"T"==a.tagName&&(n=a.getAttribute(e.i))&&((c=e.l["^"+n])&&(l[n]={i:1,c(i=e.l[n]||a){for(;i.parentNode!==c.parentNode;)i=i.parentNode;for(;i!=r;(r=c.nextSibling).remove());o(c,a)}}),r=a.nextSibling,t=l[n],i=()=>{c||o(e.l[n],a),--t.i||t.c()},(d=e.j[n])&&(p=t.c,t.c=()=>p()+d(e.r)))}})';
100
+ var WALKER_RUNTIME_CODE = '(e=>self[e]=self[e]||(l=>{let t,d={},s=[],f=document,i=f.createTreeWalker(f,129),n=self[e][l]={i:l=e+l,d:f,l:d,v:s,x(){},w(e){for(;e=i.nextNode();)this.x(n=(n=e.data)&&!n.indexOf(l)&&(d[t=n.slice(x+1)]=e,n[x]),t,e),n>"#"&&s.push(e)}},x=l.length}))', REORDER_RUNTIME_CODE = '(e=>{let i,l,t,r={},c=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(d,o,n,a,g)=>{"#"==d?(r[o]=l).i++:n==t&&i(),"T"==n.tagName&&(o=n.getAttribute(e.i))&&((a=e.l["^"+o])&&(r[o]={i:1,c(i=e.l[o]||n){for(;(t=i.previousSibling||a).remove(),a!=t;);c(i,n)}}),t=n.nextSibling,l=r[o],i=()=>{a||c(e.l[o],n),--l.i||l.c()},(d=e.j[o])&&(g=l.c,l.c=()=>g()+d(e.r)))}})';
101
101
 
102
102
  // src/html/serializer.ts
103
103
  var { hasOwnProperty } = {}, Generator = function* () {
@@ -1169,10 +1169,7 @@ function resumeSingleNodeConditional(cb, scopeId, accessor, onlyChild) {
1169
1169
  }
1170
1170
  var writeScope = (scopeId, partialScope) => {
1171
1171
  let { state } = $chunk.boundary, { scopes } = state, scope = scopes.get(scopeId);
1172
- return state.needsMainRuntime = !0, scope ? Object.assign(scope, partialScope) : (scope = partialScope, scope[K_SCOPE_ID] = scopeId, state.scopes.set(scopeId, scope)), state.writeScopes ? state.writeScopes[scopeId] = scope : state.hasGlobals ? state.writeScopes = { [scopeId]: scope } : (state.hasGlobals = !0, state.writeScopes = {
1173
- $: getFilteredGlobals(state.$global),
1174
- [scopeId]: scope
1175
- }), scope;
1172
+ return state.needsMainRuntime = !0, scope ? Object.assign(scope, partialScope) : (scope = partialScope, scope[K_SCOPE_ID] = scopeId, state.scopes.set(scopeId, scope)), state.writeScopes ? state.writeScopes[scopeId] = scope : state.writeScopes = { [scopeId]: scope }, scope;
1176
1173
  };
1177
1174
  function writeExistingScope(scope) {
1178
1175
  return writeScope(scope[K_SCOPE_ID], scope);
@@ -1290,6 +1287,7 @@ var State2 = class {
1290
1287
  tagId = 1;
1291
1288
  scopeId = 1;
1292
1289
  reorderId = 1;
1290
+ lastSerializedScopeId = this.scopeId;
1293
1291
  hasGlobals = !1;
1294
1292
  needsMainRuntime = !1;
1295
1293
  hasMainRuntime = !1;
@@ -1417,7 +1415,16 @@ function prepareChunk(chunk) {
1417
1415
  WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
1418
1416
  ));
1419
1417
  let resumes = "";
1420
- if ((state.writeScopes || serializer.flushed) && (resumes = state.serializer.stringify(state.writeScopes || {}, boundary), state.writeScopes = null), effects && (hasWalk = !0, resumes = resumes ? resumes + "," + effects : effects), resumes && (state.hasWrittenResume ? scripts = concatScripts(
1418
+ if (state.writeScopes || serializer.flushed) {
1419
+ let { lastSerializedScopeId } = state, serializeData = [];
1420
+ state.hasGlobals || (state.hasGlobals = !0, serializeData.push(getFilteredGlobals(state.$global)));
1421
+ for (let key in state.writeScopes) {
1422
+ let scope = state.writeScopes[key], scopeId = getScopeId(scope), scopeIdDelta = scopeId - lastSerializedScopeId;
1423
+ lastSerializedScopeId = scopeId + 1, scopeIdDelta && serializeData.push(scopeIdDelta), serializeData.push(scope);
1424
+ }
1425
+ resumes = state.serializer.stringify(serializeData, boundary), state.writeScopes = null, state.lastSerializedScopeId = lastSerializedScopeId;
1426
+ }
1427
+ if (effects && (hasWalk = !0, resumes = resumes ? resumes + "," + effects : effects), resumes && (state.hasWrittenResume ? scripts = concatScripts(
1421
1428
  scripts,
1422
1429
  runtimePrefix + ".r.push(" + resumes + ")"
1423
1430
  ) : (state.hasWrittenResume = !0, scripts = concatScripts(
@@ -1431,8 +1438,9 @@ function prepareChunk(chunk) {
1431
1438
  for (let reorderedChunk of state.writeReorders) {
1432
1439
  let { reorderId } = reorderedChunk, reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk;
1433
1440
  for (reorderedChunk.reorderId = null; ; ) {
1441
+ cur.flushPlaceholder();
1434
1442
  let { next } = cur;
1435
- if (cur.flushPlaceholder(), cur.consumed = !0, reorderHTML += cur.html, reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, cur.scripts), cur.async && (reorderHTML += state.mark(
1443
+ if (cur.consumed = !0, reorderHTML += cur.html, reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, cur.scripts), cur.async && (reorderHTML += state.mark(
1436
1444
  "#" /* ReorderMarker */,
1437
1445
  cur.reorderId = state.nextReorderId()
1438
1446
  ), cur.html = cur.effects = cur.scripts = "", cur.next = null), next)
@@ -1485,10 +1493,10 @@ function isPromise(value) {
1485
1493
  return value != null && typeof value.then == "function";
1486
1494
  }
1487
1495
  function getFilteredGlobals($global2) {
1488
- if (!$global2) return;
1496
+ if (!$global2) return 0;
1489
1497
  let serializedGlobals = $global2.serializedGlobals;
1490
- if (!serializedGlobals) return;
1491
- let filtered;
1498
+ if (!serializedGlobals) return 0;
1499
+ let filtered = 0;
1492
1500
  if (Array.isArray(serializedGlobals))
1493
1501
  for (let key of serializedGlobals) {
1494
1502
  let value = $global2[key];