marko 6.4.10 → 6.4.11

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.
Files changed (87) hide show
  1. package/dist/common/accessor.d.ts +0 -3
  2. package/dist/common/accessor.debug.d.ts +0 -3
  3. package/dist/common/helpers.d.ts +1 -1
  4. package/dist/common/types.d.ts +4 -3
  5. package/dist/debug/dom/catch.feat.js +1 -1
  6. package/dist/debug/dom/catch.feat.mjs +1 -1
  7. package/dist/debug/dom/controllable-input.feat.js +1 -1
  8. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  9. package/dist/debug/dom/controllable-open.feat.js +1 -1
  10. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  11. package/dist/debug/dom/controllable-select.feat.js +1 -1
  12. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  13. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  14. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  15. package/dist/debug/dom/controllable.feat.js +1 -1
  16. package/dist/debug/dom/controllable.feat.mjs +1 -1
  17. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  18. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  19. package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
  20. package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
  21. package/dist/debug/dom/lazy.feat.js +1 -1
  22. package/dist/debug/dom/lazy.feat.mjs +1 -1
  23. package/dist/debug/dom/placeholder.feat.js +1 -1
  24. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  25. package/dist/debug/{dom-C1V5vpFs.mjs → dom-DjUZd-9y.mjs} +198 -214
  26. package/dist/debug/{dom-DNB5yq3U.js → dom-mQ5mPBTF.js} +203 -213
  27. package/dist/debug/dom.js +5 -8
  28. package/dist/debug/dom.mjs +5 -9
  29. package/dist/debug/html.js +68 -87
  30. package/dist/debug/html.mjs +68 -87
  31. package/dist/dom/abort-signal.d.ts +1 -1
  32. package/dist/dom/catch.feat.js +3 -3
  33. package/dist/dom/catch.feat.mjs +1 -1
  34. package/dist/dom/control-flow.d.ts +4 -4
  35. package/dist/dom/controllable-input.feat.js +1 -1
  36. package/dist/dom/controllable-input.feat.mjs +1 -1
  37. package/dist/dom/controllable-open.feat.js +1 -1
  38. package/dist/dom/controllable-open.feat.mjs +1 -1
  39. package/dist/dom/controllable-select.feat.js +1 -1
  40. package/dist/dom/controllable-select.feat.mjs +1 -1
  41. package/dist/dom/controllable-textarea.feat.js +1 -1
  42. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  43. package/dist/dom/controllable.feat.js +1 -1
  44. package/dist/dom/controllable.feat.mjs +1 -1
  45. package/dist/dom/dynamic-tag-script.feat.js +2 -2
  46. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  47. package/dist/dom/dynamic-tag-var.feat.js +3 -3
  48. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  49. package/dist/dom/lazy.feat.js +1 -1
  50. package/dist/dom/lazy.feat.mjs +1 -1
  51. package/dist/dom/load.d.ts +3 -4
  52. package/dist/dom/placeholder.feat.js +1 -1
  53. package/dist/dom/placeholder.feat.mjs +1 -1
  54. package/dist/dom/queue.d.ts +1 -2
  55. package/dist/dom/signals.d.ts +5 -7
  56. package/dist/{dom-C2-Flitp.js → dom-B8j2453O.js} +143 -155
  57. package/dist/{dom-DsHYWMCR.mjs → dom-HEWdZCCb.mjs} +119 -136
  58. package/dist/dom.d.ts +1 -1
  59. package/dist/dom.js +17 -21
  60. package/dist/dom.mjs +5 -9
  61. package/dist/html/assets.d.ts +3 -4
  62. package/dist/html/for.d.ts +0 -1
  63. package/dist/html/writer.d.ts +2 -2
  64. package/dist/html.d.ts +1 -1
  65. package/dist/html.js +60 -72
  66. package/dist/html.mjs +60 -72
  67. package/dist/translator/index.d.ts +0 -1
  68. package/dist/translator/index.js +4629 -4485
  69. package/dist/translator/interop/out-global.d.ts +5 -0
  70. package/dist/translator/util/assert.d.ts +4 -0
  71. package/dist/translator/util/entry-builder.d.ts +1 -1
  72. package/dist/translator/util/finalize-references.d.ts +2 -1
  73. package/dist/translator/util/for-selector.d.ts +1 -1
  74. package/dist/translator/util/known-tag.d.ts +7 -1
  75. package/dist/translator/util/references.d.ts +11 -5
  76. package/dist/translator/util/runtime.d.ts +1 -0
  77. package/dist/translator/util/sections.d.ts +6 -1
  78. package/dist/translator/util/signals.d.ts +2 -1
  79. package/dist/translator/util/style-interpolation.d.ts +1 -1
  80. package/dist/translator/util/tag-name-type.d.ts +1 -0
  81. package/dist/translator/util/visitors.d.ts +1 -1
  82. package/dist/translator/util/write-guard.d.ts +2 -0
  83. package/dist/translator/visitors/program/index.d.ts +0 -4
  84. package/dist/translator/visitors/referenced-identifier.d.ts +3 -1
  85. package/package.json +4 -4
  86. package/dist/common/constants/keyed-scopes-prop.d.ts +0 -4
  87. package/dist/common/constants/keyed-scopes-prop.debug.d.ts +0 -4
package/dist/html.mjs CHANGED
@@ -1,12 +1,4 @@
1
- let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "\\3B " : "\\\\", toDelimitedString = function toDelimitedString(val, delimiter, stringify) {
2
- let str = "", sep = "", part;
3
- if (val) {
4
- if (typeof val != "object") str += val;
5
- else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
6
- else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
7
- }
8
- return str;
9
- }, K_SCOPE_ID = Symbol("Scope ID"), kTouchedIterator = /* @__PURE__ */ Symbol.for("marko.touchedIterator"), { hasOwnProperty } = {}, objectProto = Object.prototype, arrayProto = Array.prototype, Generator = (/* @__PURE__ */ (function* () {})()).constructor, AsyncGenerator = (/* @__PURE__ */ (async function* () {})()).constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = /* @__PURE__ */ (() => {
1
+ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "\\3B " : "\\\\", K_SCOPE_ID = Symbol("Scope ID"), kTouchedIterator = /* @__PURE__ */ Symbol.for("marko.touchedIterator"), { hasOwnProperty } = {}, objectProto = Object.prototype, arrayProto = Array.prototype, Generator = (/* @__PURE__ */ (function* () {})()).constructor, AsyncGenerator = (/* @__PURE__ */ (async function* () {})()).constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = /* @__PURE__ */ (() => {
10
2
  let KNOWN_SYMBOLS = /* @__PURE__ */ new Map();
11
3
  for (let name of Object.getOwnPropertyNames(Symbol)) {
12
4
  let symbol = Symbol[name];
@@ -247,20 +239,18 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
247
239
  }, unsafeQuoteReg = /["\\<\n\r\u2028\u2029\0\ud800-\udfff]/u, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /['\r]|&(?=[#a-zA-Z])/g, doubleQuoteAttrReplacements = /["\r]|&(?=[#a-zA-Z])/g, needsQuotedAttr = /["'>\s]|&[#a-zA-Z]|\/$/g, $chunk, kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kAsyncContent = Symbol("Async Content"), writeScope = (scopeId, partialScope) => {
248
240
  let { state } = $chunk.boundary, target = $chunk.channel, scope = scopeWithId(state, scopeId);
249
241
  return state.needsWalkerRuntime = !0, countResumeWrite($chunk), writeAsyncVisits($chunk), Object.assign(scope, partialScope), state.queueScope(target, scopeId, partialScope), scope;
250
- }, ALL_GROUPS = 715827883, NOOP$2 = () => {}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, unsafeXMLReg = /[<&\r]/g, replaceUnsafeXML = (c) => c === "&" ? "&amp;" : c === "<" ? "&lt;" : "&#13;", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<(\/?script|!--)/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\u003C$1") : str, unsafeScriptTemplateLiteralReg = /[`\\\r]|\$\{|<(?=\/?script|!--)/gi, replaceUnsafeScriptTemplateLiteral = (c) => c === "<" ? "\\x3C" : c === "\r" ? "\\r" : "\\" + c, quoteScriptTemplateLiteral = (str) => "`" + (unsafeScriptTemplateLiteralReg.test(str) ? str.replace(unsafeScriptTemplateLiteralReg, replaceUnsafeScriptTemplateLiteral) : str) + "`", unsafeStyleReg = /<(\/style)/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str, unsafeCommentReg = />/g, voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, markerGuard, tagVar) => {
242
+ }, ALL_GROUPS = 715827883, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, unsafeXMLReg = /[<&\r]/g, replaceUnsafeXML = (c) => c === "&" ? "&amp;" : c === "<" ? "&lt;" : "&#13;", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<(\/?script|!--)/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\u003C$1") : str, unsafeScriptTemplateLiteralReg = /[`\\\r]|\$\{|<(?=\/?script|!--)/gi, replaceUnsafeScriptTemplateLiteral = (c) => c === "<" ? "\\x3C" : c === "\r" ? "\\r" : "\\" + c, quoteScriptTemplateLiteral = (str) => "`" + (unsafeScriptTemplateLiteralReg.test(str) ? str.replace(unsafeScriptTemplateLiteralReg, replaceUnsafeScriptTemplateLiteral) : str) + "`", unsafeStyleReg = /<(\/style)/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str, unsafeCommentReg = />/g, voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, markerGuard, tagVar) => {
251
243
  let shouldResume = markerGuard !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
252
244
  if (typeof renderer == "string") {
253
245
  let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
254
- rendered = !0, (() => {
255
- if (_scope_id(), _html(`<${renderer}${_attrs(input, "a", branchId, renderer)}>`), !voidElementsReg.test(renderer)) {
256
- let renderContent = content || normalizeDynamicRenderer(input.content);
257
- renderer === "textarea" ? _html(_attrs_textarea_value(branchId, "a", input)) : renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent ? () => _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, markerGuard) : void 0, 1) : renderContent && _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, markerGuard), _html(`</${renderer}>`);
258
- }
259
- let childScope = getScopeById(branchId), needsScript = childScope && (childScope.Ia || childScope.Ea);
260
- needsScript && _script(branchId, "_d"), (shouldResume || needsScript) && _html(state.mark("(", scopeId + " " + accessor + " " + branchId));
261
- })(), result = _el(scopeId, "-" + accessor);
246
+ if (rendered = !0, _scope_id(), _html(`<${renderer}${_attrs(input, "a", branchId, renderer)}>`), !voidElementsReg.test(renderer)) {
247
+ let renderContent = content || normalizeDynamicRenderer(input.content);
248
+ renderer === "textarea" ? _html(_attrs_textarea_value(branchId, "a", input)) : renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent ? () => _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, markerGuard) : void 0, 1) : renderContent && _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, markerGuard), _html(`</${renderer}>`);
249
+ }
250
+ let childScope = getScopeById(branchId), needsScript = childScope && (childScope.Ia || childScope.Ea);
251
+ needsScript && _script(branchId, "_d"), (shouldResume || needsScript) && _html(state.mark("(", scopeId + " " + accessor + " " + branchId)), result = _el(scopeId, "-" + accessor);
262
252
  } else {
263
- let chunk = getChunk(), beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0, render = () => {
253
+ let chunk = $chunk, beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0, render = () => {
264
254
  if (renderer) try {
265
255
  return _set_scope_reason(shouldResume ? ALL_GROUPS : 0), inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
266
256
  ...inputOrArgs,
@@ -333,11 +323,11 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
333
323
  return joined;
334
324
  },
335
325
  appendChunks(chunks) {
336
- let chunk = getChunk();
326
+ let chunk = $chunk;
337
327
  for (let part of chunks) chunk.append(part), part.effects && (chunk.lastEffect = part.lastEffect);
338
328
  },
339
329
  deferReorders(reorders) {
340
- let chunk = getChunk();
330
+ let chunk = $chunk;
341
331
  for (let i = reorders.length; i--;) {
342
332
  let carrier = chunk.fork(chunk.boundary, chunk.next);
343
333
  carrier.deferredReorder = reorders[i], chunk.next = carrier;
@@ -450,6 +440,15 @@ function escapeStyleValue(str) {
450
440
  for (let c of result) c === "(" ? closers = ")" + closers : c === "[" ? closers = "]" + closers : c === closers[0] && (closers = closers.slice(1));
451
441
  return result + closers;
452
442
  }
443
+ function toDelimitedString(val, delimiter, stringify) {
444
+ let str = "", sep = "", part;
445
+ if (val) {
446
+ if (typeof val != "object") str += val;
447
+ else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
448
+ else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
449
+ }
450
+ return str;
451
+ }
453
452
  function isEventHandler(name) {
454
453
  return /^on[A-Z-]/.test(name);
455
454
  }
@@ -483,6 +482,9 @@ function _hoist_read_error() {}
483
482
  function _signal_read_error() {}
484
483
  function _assert_hoist(value) {}
485
484
  // src/common/opt.ts
485
+ function toArray(opt) {
486
+ return opt ? Array.isArray(opt) ? opt : [opt] : [];
487
+ }
486
488
  function reduce(opt, cb, acc) {
487
489
  if (opt) {
488
490
  if (Array.isArray(opt)) for (let item of opt) acc = cb(acc, item);
@@ -610,7 +612,7 @@ function writeScopesRoot(state, flushes) {
610
612
  state.writeScopeProps(flush[2], ref) ? (buf[openIndex] = nextSlotId === -1 ? state.scopesCursor(scopeId) + "{" : (scopeId === nextSlotId ? "" : "," + (scopeId - nextSlotId)) + ",{", scopesIndex === -1 && (scopesIndex = openIndex), nextSlotId = scopeId + 1, buf.push("}")) : buf.pop();
611
613
  }
612
614
  let extras = "";
613
- (state.deferredRefs.size || hasChannelCalls(state)) && (extras = state.writeTrailing(scopesIndex));
615
+ (state.deferredRefs.size || hasMatchingCalls(state, state.channel?.readyId)) && (extras = state.writeTrailing(scopesIndex));
614
616
  let result = extras && "(";
615
617
  for (let chunk of buf) result += chunk;
616
618
  return result += extras, result ? state.wrapPayload(result, extras) : "";
@@ -667,9 +669,6 @@ function writeCallArg(state, val, valueId) {
667
669
  ref && !ref.id && ref.scopeId === void 0 && !isAncestorChannelRef(state, ref) && (ref.id = valueId || nextRefAccess(state), state.buf[startIndex] = ref.id + "=" + state.buf[startIndex]);
668
670
  } else state.buf.push("void 0");
669
671
  }
670
- function hasChannelCalls(state) {
671
- return hasMatchingCalls(state, state.channel?.readyId);
672
- }
673
672
  function hasMatchingCalls(state, readyId) {
674
673
  if (!readyId) return state.queuedCalls.length > 0;
675
674
  for (let call of state.queuedReadyCalls) if (call.channel.readyId === readyId) return !0;
@@ -996,26 +995,18 @@ function writeRequest(state, val, ref) {
996
995
  state.buf.push("new Request(" + quote(val.url, 0)), hasBody && (state.buf.push(",{body:"), writeProp(state, val.body, ref, "body") ? (state.buf.push(",duplex:\"half\""), sep = ",", bodySerialized = !0) : state.buf.pop());
997
996
  let options = "";
998
997
  val.cache !== "default" && (options += sep + "cache:" + quote(val.cache, 0), sep = ","), val.credentials !== "same-origin" && (options += sep + "credentials:" + quote(val.credentials, 0), sep = ",");
999
- let seenHeaders = state.refs.get(val.headers);
1000
- if (seenHeaders) options += sep + "headers:" + ensureRefAccess(state, seenHeaders), sep = ",";
1001
- else {
1002
- state.refs.set(val.headers, new Reference(ref, "headers", state.flushId, null));
1003
- let headers = stringEntriesToHeadersInit(val.headers);
1004
- headers && (options += sep + "headers:" + headers, sep = ",");
1005
- }
1006
- return val.integrity && (options += sep + "integrity:" + quote(val.integrity, 0), sep = ","), val.keepalive && (options += sep + "keepalive:true", sep = ","), val.method !== "GET" && (options += sep + "method:" + quote(val.method, 0), sep = ","), val.mode !== "cors" && (options += sep + "mode:" + quote(val.mode, 0), sep = ","), val.redirect !== "follow" && (options += sep + "redirect:" + quote(val.redirect, 0), sep = ","), val.referrer !== "about:client" && (options += sep + "referrer:" + quote(val.referrer, 0), sep = ","), val.referrerPolicy && (options += sep + "referrerPolicy:" + quote(val.referrerPolicy, 0)), state.buf.push(bodySerialized ? options + "})" : options ? ",{" + options + "})" : ")"), !0;
998
+ let headers = headersOption(state, val.headers, ref);
999
+ return headers && (options += sep + "headers:" + headers, sep = ","), val.integrity && (options += sep + "integrity:" + quote(val.integrity, 0), sep = ","), val.keepalive && (options += sep + "keepalive:true", sep = ","), val.method !== "GET" && (options += sep + "method:" + quote(val.method, 0), sep = ","), val.mode !== "cors" && (options += sep + "mode:" + quote(val.mode, 0), sep = ","), val.redirect !== "follow" && (options += sep + "redirect:" + quote(val.redirect, 0), sep = ","), val.referrer !== "about:client" && (options += sep + "referrer:" + quote(val.referrer, 0), sep = ","), val.referrerPolicy && (options += sep + "referrerPolicy:" + quote(val.referrerPolicy, 0)), state.buf.push(bodySerialized ? options + "})" : options ? ",{" + options + "})" : ")"), !0;
1007
1000
  }
1008
1001
  function writeResponse(state, val, ref) {
1009
1002
  let sep = "", options = "";
1010
1003
  val.status !== 200 && (options += "status:" + val.status, sep = ","), val.statusText && (options += sep + "statusText:" + quote(val.statusText, 0), sep = ",");
1011
- let seenHeaders = state.refs.get(val.headers);
1012
- if (seenHeaders) options += sep + "headers:" + ensureRefAccess(state, seenHeaders);
1013
- else {
1014
- state.refs.set(val.headers, new Reference(ref, "headers", state.flushId, null));
1015
- let headers = stringEntriesToHeadersInit(val.headers);
1016
- headers && (options += sep + "headers:" + headers);
1017
- }
1018
- return !val.body || val.bodyUsed ? state.buf.push("new Response" + (options ? "(null,{" + options + "})" : "")) : (state.buf.push("new Response("), state.buf.push((writeProp(state, val.body, ref, "body") ? "" : "null") + (options ? ",{" + options + "})" : ")"))), !0;
1004
+ let headers = headersOption(state, val.headers, ref);
1005
+ return headers && (options += sep + "headers:" + headers), !val.body || val.bodyUsed ? state.buf.push("new Response" + (options ? "(null,{" + options + "})" : "")) : (state.buf.push("new Response("), state.buf.push((writeProp(state, val.body, ref, "body") ? "" : "null") + (options ? ",{" + options + "})" : ")"))), !0;
1006
+ }
1007
+ function headersOption(state, headers, ref) {
1008
+ let seen = state.refs.get(headers);
1009
+ return seen ? ensureRefAccess(state, seen) : (state.refs.set(headers, new Reference(ref, "headers", state.flushId, null)), stringEntriesToHeadersInit(headers));
1019
1010
  }
1020
1011
  function writeIntl(state, val, name, ref) {
1021
1012
  let { locale, ...options } = val.resolvedOptions();
@@ -1323,7 +1314,7 @@ function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange, s
1323
1314
  return openChange && writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange, serializeType), normalizedOpen ? " open" : "";
1324
1315
  }
1325
1316
  function _attr_nonce() {
1326
- return getChunk().boundary.state.nonceAttr;
1317
+ return getState().nonceAttr;
1327
1318
  }
1328
1319
  function _style_html(decls) {
1329
1320
  let id = _id();
@@ -1366,7 +1357,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
1366
1357
  case "style":
1367
1358
  result += _attr_style(value);
1368
1359
  break;
1369
- default: name && !(isNullishOrFalse(value) || skip.test(name) || name === "content" && tagName !== "meta") && (isEventHandler(name) ? (events || (events = {}, writeScope(scopeId, { ["I" + nodeAccessor]: events })), events[getEventType(name)] = value) : result += stringifyAttr(name, value));
1360
+ default: name && !(isNullishOrFalse(value) || name === "content" && tagName !== "meta" || skip.test(name)) && (isEventHandler(name) ? (events || (events = {}, writeScope(scopeId, { ["I" + nodeAccessor]: events })), events[getEventType(name)] = value) : result += stringifyAttr(name, value));
1370
1361
  }
1371
1362
  }
1372
1363
  return result;
@@ -1458,7 +1449,7 @@ function getScopeId(scope) {
1458
1449
  return scope[K_SCOPE_ID];
1459
1450
  }
1460
1451
  function getScopeById(scopeId) {
1461
- if (scopeId !== void 0) return $chunk.boundary.state.scopes.get(scopeId);
1452
+ return $chunk.boundary.state.scopes.get(scopeId);
1462
1453
  }
1463
1454
  function $global() {
1464
1455
  return $chunk.boundary.state.$global;
@@ -1513,7 +1504,7 @@ function mayDrop(written) {
1513
1504
  return !1;
1514
1505
  }
1515
1506
  function _script(scopeId, registryId, markerGuard) {
1516
- markerGuard === 0 && ($chunk.channel.readyId || $chunk.context?.[kAsyncContent]) && _resume_branch(scopeId), $chunk.boundary.state.queueEffect(scopeId, registryId);
1507
+ markerGuard === 0 && ($chunk.channel.readyId || getAsyncContent($chunk)) && _resume_branch(scopeId), $chunk.boundary.state.queueEffect(scopeId, registryId);
1517
1508
  }
1518
1509
  function _trailers(html) {
1519
1510
  $chunk.boundary.state.trailerHTML += html;
@@ -1551,7 +1542,7 @@ function markText(scopeId, accessor, text, markerGuard) {
1551
1542
  return state.needsWalkerRuntime = !0, text ? (markerGuard === 2 ? "<!>" : "") + text + state.mark("$", scopeId + " " + accessor) : state.mark("%", scopeId + " " + accessor);
1552
1543
  }
1553
1544
  function _resume_branch(scopeId) {
1554
- let branchId = $chunk.context?.[kBranchId];
1545
+ let branchId = getContext(kBranchId);
1555
1546
  branchId !== void 0 && branchId !== scopeId && writeScope(scopeId, { G: branchId });
1556
1547
  }
1557
1548
  function _attr_content(nodeAccessor, scopeId, content, markerGuard) {
@@ -1735,8 +1726,10 @@ var State = class {
1735
1726
  mark(code, str) {
1736
1727
  return "<!--" + this.commentPrefix + code + str + "-->";
1737
1728
  }
1738
- }, Boundary = class {
1739
- onNext = NOOP$2;
1729
+ };
1730
+ function NOOP() {}
1731
+ var Boundary = class {
1732
+ onNext = NOOP;
1740
1733
  count = 0;
1741
1734
  resumeWrites = 0;
1742
1735
  state;
@@ -1892,7 +1885,7 @@ var State = class {
1892
1885
  }
1893
1886
  flushReadyScripts(boundary, reservations, holdEffects) {
1894
1887
  let { channel } = this, { readyId } = channel, scripts = "", held = this.takeDeferredReady();
1895
- if (held) for (let chunk of Array.isArray(held) ? held : [held]) chunk.boundary.aborted || (scripts = concatScripts(scripts, chunk.flushReadyScripts(boundary, reservations, holdEffects)), (chunk.effects || chunk.deferredReady) && (this.deferredReady = push(this.deferredReady, chunk)));
1888
+ if (held) for (let chunk of toArray(held)) chunk.boundary.aborted || (scripts = concatScripts(scripts, chunk.flushReadyScripts(boundary, reservations, holdEffects)), (chunk.effects || chunk.deferredReady) && (this.deferredReady = push(this.deferredReady, chunk)));
1896
1889
  if (readyId && !this.async) {
1897
1890
  let { state } = boundary, effects = holdEffects ? "" : this.effects;
1898
1891
  effects && flushSerializerGlobals(boundary), flushSerializer(boundary, channel);
@@ -1919,7 +1912,7 @@ var State = class {
1919
1912
  }
1920
1913
  readyResumeScripts && (needsWalk = !0);
1921
1914
  let effects = this.async ? "" : joinHeldEffects(this.takeHeldEffects(), this.effects), { html, scripts } = this;
1922
- html && state.hasReorderRuntime && (html = state.mark("*", "") + html), state.needsWalkerRuntime && !state.hasWalkerRuntime && (state.hasWalkerRuntime = !0, scripts = concatScripts(scripts, state.runtimeScript())), scripts = concatScripts(scripts, readyResumeScripts), effects && (needsWalk = !0, flushSerializerGlobals(boundary), state.resumes = state.resumes ? state.resumes + ",\"" + effects + "\"" : "\"" + effects + "\"");
1915
+ html && state.hasReorderRuntime && (html = state.mark("*", "") + html), state.needsWalkerRuntime && !state.hasWalkerRuntime && (state.hasWalkerRuntime = !0, scripts = concatScripts(scripts, state.runtimeScript())), scripts = concatScripts(scripts, readyResumeScripts), effects && (needsWalk = !0, flushSerializerGlobals(boundary), state.resumes = concatSequence(state.resumes, "\"" + effects + "\""));
1923
1916
  let reordered = "", needsResumeArray = !1;
1924
1917
  if (state.writeReorders) {
1925
1918
  for (let reorderedChunk of state.writeReorders) {
@@ -2032,17 +2025,16 @@ function depsMarker(deps) {
2032
2025
  return marker;
2033
2026
  }
2034
2027
  function getFilteredGlobals($global) {
2035
- if (!$global) return 0;
2036
2028
  let serializedGlobals = $global.serializedGlobals;
2037
2029
  if (!serializedGlobals) return 0;
2038
2030
  let filtered = 0;
2039
2031
  if (Array.isArray(serializedGlobals)) for (let key of serializedGlobals) {
2040
2032
  let value = $global[key];
2041
- value !== void 0 && (filtered ? filtered[key] = value : filtered = { [key]: value });
2033
+ value !== void 0 && ((filtered ||= {})[key] = value);
2042
2034
  }
2043
2035
  else for (let key in serializedGlobals) if (serializedGlobals[key]) {
2044
2036
  let value = $global[key];
2045
- value !== void 0 && (filtered ? filtered[key] = value : filtered = { [key]: value });
2037
+ value !== void 0 && ((filtered ||= {})[key] = value);
2046
2038
  }
2047
2039
  return filtered;
2048
2040
  }
@@ -2080,7 +2072,7 @@ function _unescaped(val) {
2080
2072
  return val ? val + "" : val === 0 ? "0" : "";
2081
2073
  }
2082
2074
  function _escape(val) {
2083
- return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "";
2075
+ return val || val === 0 ? typeof val == "number" ? val + "" : escapeXMLStr(val + "") : "";
2084
2076
  }
2085
2077
  function _escape_script(val) {
2086
2078
  return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
@@ -2285,9 +2277,8 @@ var ServerRendered = class {
2285
2277
  }
2286
2278
  };
2287
2279
  function settle(boundary) {
2288
- boundary.onNext = NOOP$1, boundary.state.$global.signal?.removeEventListener("abort", boundary);
2280
+ boundary.onNext = NOOP, boundary.state.$global.signal?.removeEventListener("abort", boundary);
2289
2281
  }
2290
- function NOOP$1() {}
2291
2282
  // src/html/assets.ts
2292
2283
  function withLoadAssets(template, id, flush, assetId, triggers) {
2293
2284
  let renderer = (input) => (writeLoadAsset(assetId, flush, triggers), writeWaitReady(assetId, template(), input));
@@ -2350,17 +2341,18 @@ function addAsset(g, id, flush, triggers) {
2350
2341
  }), asset;
2351
2342
  }
2352
2343
  function triggerScript(id, html, triggers) {
2353
- let htmlStr = quoteScriptTemplateLiteral(html), exprs = triggers.map((trigger) => {
2354
- let options = trigger.options && toObjectExpression(trigger.options);
2355
- switch (trigger.type) {
2356
- case "visible": return `(e=>e&&new IntersectionObserver((e,i)=>e.some(e=>e.isIntersecting)&&i.disconnect()+l()${options ? `,${options}` : ""}).observe(e))(${querySelectorOrLoad(trigger.selector)})`;
2357
- case "idle": return `(self.requestIdleCallback||l)(l${options ? `,${options}` : ""})`;
2358
- case "media": return `(m=>m.matches?l():m.addEventListener("change",l,{once:1}))(matchMedia(${JSON.stringify(trigger.selector)}))`;
2359
- default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(${querySelectorOrLoad(trigger.selector)})`;
2360
- }
2361
- });
2344
+ let htmlStr = quoteScriptTemplateLiteral(html), exprs = triggers.map(triggerExpression);
2362
2345
  return `((h,d,l=$=>{d||document.head.append(new Range().createContextualFragment(d=h))})=>${exprs.length > 1 ? `{${exprs.join(";")}}` : exprs[0]})(${htmlStr})`;
2363
2346
  }
2347
+ function triggerExpression(trigger) {
2348
+ let options = trigger.options && toObjectExpression(trigger.options);
2349
+ switch (trigger.type) {
2350
+ case "visible": return `(e=>e&&new IntersectionObserver((e,i)=>e.some(e=>e.isIntersecting)&&i.disconnect()+l()${options ? `,${options}` : ""}).observe(e))(${querySelectorOrLoad(trigger.selector)})`;
2351
+ case "idle": return `(self.requestIdleCallback||l)(l${options ? `,${options}` : ""})`;
2352
+ case "media": return `(m=>m.matches?l():m.addEventListener("change",l,{once:1}))(matchMedia(${JSON.stringify(trigger.selector)}))`;
2353
+ default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(${querySelectorOrLoad(trigger.selector)})`;
2354
+ }
2355
+ }
2364
2356
  function querySelectorOrLoad(selector) {
2365
2357
  return `document.querySelector(${JSON.stringify(selector)})||l()`;
2366
2358
  }
@@ -2455,13 +2447,13 @@ function forBranches(by, cb, iterate, scopeId, accessor, branchGuard, markerGuar
2455
2447
  let { state } = $chunk.boundary, resumeKeys = markerGuard !== 0, resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag), flushBranchIds = "", loopScopes;
2456
2448
  iterate((itemKey, sameAsIndex, a, b) => {
2457
2449
  let branchId = _peek_scope_id();
2458
- resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), withBranchId(branchId, cb, a, b);
2450
+ resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), resumeMarker ? withBranchId(branchId, cb, a, b) : cb(a, b);
2459
2451
  let branchScope = writeScope(branchId, resumeKeys && !sameAsIndex ? { M: itemKey } : {});
2460
2452
  resumeMarker || (loopScopes = push(loopScopes, branchScope));
2461
2453
  }), loopScopes && writeScope(scopeId, { ["A" + accessor]: loopScopes }), writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
2462
2454
  }
2463
2455
  function _if(cb, scopeId, accessor, branchGuard, markerGuard, branchExprGuard, parentEndTag, singleNode) {
2464
- let resumeBranch = branchGuard !== 0, resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag), branchId = _peek_scope_id(), chunk = $chunk, beforeBranch = resumeMarker && resumeBranch && !singleNode ? deferBranchStart(chunk) : void 0, branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
2456
+ let resumeBranch = branchGuard !== 0, resumeMarker = resumesMarker(markerGuard, branchExprGuard, parentEndTag), branchId = _peek_scope_id(), chunk = $chunk, beforeBranch = resumeMarker && resumeBranch && !singleNode ? deferBranchStart(chunk) : void 0, branchIndex = resumeBranch && resumeMarker ? withBranchId(branchId, cb) : cb(), shouldWriteBranch = resumeBranch && branchIndex !== void 0;
2465
2457
  beforeBranch !== void 0 && applyBranchStart(chunk, beforeBranch, shouldWriteBranch), shouldWriteBranch && (branchIndex || !resumeMarker) && writeScope(scopeId, {
2466
2458
  ["D" + accessor]: branchIndex || void 0,
2467
2459
  ["A" + accessor]: resumeMarker ? void 0 : writeScope(branchId, {})
@@ -2472,10 +2464,7 @@ function resumesMarker(markerGuard, branchExprGuard, parentEndTag) {
2472
2464
  }
2473
2465
  function writeBranchEnd(scopeId, accessor, branchExprGuard, markerGuard, parentEndTag, singleNode, branchIds) {
2474
2466
  let endTag = parentEndTag || "";
2475
- if (resumesMarker(markerGuard, branchExprGuard, parentEndTag)) {
2476
- let { state } = $chunk.boundary, mark = singleNode ? state.mark(parentEndTag ? "}" : "|", scopeId + " " + accessor + (branchIds || "")) : state.mark(parentEndTag ? ")" : "]", scopeId + " " + accessor + (branchIds || ""));
2477
- $chunk.writeHTML(mark + endTag);
2478
- } else markerGuard === 0 ? $chunk.writeHTML(endTag) : $chunk.writeHTML(endTag + _el_mark(scopeId, accessor));
2467
+ resumesMarker(markerGuard, branchExprGuard, parentEndTag) ? $chunk.writeHTML($chunk.boundary.state.mark(singleNode ? parentEndTag ? "}" : "|" : parentEndTag ? ")" : "]", scopeId + " " + accessor + branchIds) + endTag) : markerGuard === 0 ? $chunk.writeHTML(endTag) : $chunk.writeHTML(endTag + _el_mark(scopeId, accessor));
2479
2468
  }
2480
2469
  function _await(scopeId, accessor, promise, content, markerGuard) {
2481
2470
  let resumeMarker = markerGuard !== 0;
@@ -2579,5 +2568,4 @@ function swapReorders(state, reorders) {
2579
2568
  let { writeReorders } = state;
2580
2569
  return state.writeReorders = reorders, writeReorders;
2581
2570
  }
2582
- function NOOP() {}
2583
2571
  export { $global, _assert_class_toggles, _assert_hoist, _attr, _attr_and, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_nullish, _attr_option_value, _attr_or, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_select_value, _attrs_textarea_value, _await, _content, _content_resume, _dynamic_tag, _el, _el_mark, _el_read_error, _escape, _escape_comment, _escape_script, _escape_style, _escape_style_value, _existing_scope, _flush_head, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _html_mark, _id, _if, _peek_scope_id, _resume, _resume_branch, _resume_locals, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _set_scope_reason, _show_end, _show_start, _signal_read_error, _style_html, _subscribe, _template, _text_mark, _textarea_value, _to_text, _trailers, _try, _unescaped, _var, _write_guard, _write_if, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, withLoadAssets, withPageAssets };
@@ -118,7 +118,6 @@ export declare const taglibs: (string | {
118
118
  "<static>": import("@marko/compiler/babel-utils").Tag;
119
119
  "<style>": import("@marko/compiler/babel-utils").Tag;
120
120
  "<try>": import("@marko/compiler/babel-utils").Tag;
121
- migrate: import("@marko/compiler/babel-types").Visitor<unknown>;
122
121
  })[][];
123
122
  export declare function getRuntimeEntryFiles(output: Config["output"], optimize: boolean): string[];
124
123
  export { createInteropTranslator } from "./interop";