marko 6.4.6 → 6.4.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.
Files changed (85) hide show
  1. package/cheatsheet.md +2 -1
  2. package/dist/common/errors.d.ts +1 -0
  3. package/dist/debug/dom/catch.feat.js +2 -2
  4. package/dist/debug/dom/catch.feat.mjs +2 -2
  5. package/dist/debug/dom/controllable-input.feat.js +1 -1
  6. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  7. package/dist/debug/dom/controllable-open.feat.js +1 -1
  8. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  9. package/dist/debug/dom/controllable-select.feat.js +1 -1
  10. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  11. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  12. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  13. package/dist/debug/dom/controllable.feat.js +1 -1
  14. package/dist/debug/dom/controllable.feat.mjs +1 -1
  15. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  16. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  17. package/dist/debug/dom/dynamic-tag-var.feat.js +2 -2
  18. package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -2
  19. package/dist/debug/dom/lazy.feat.js +1 -1
  20. package/dist/debug/dom/lazy.feat.mjs +1 -1
  21. package/dist/debug/dom/placeholder.feat.js +1 -1
  22. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  23. package/dist/debug/{dom-o9jQjchF.mjs → dom-CFCBDift.mjs} +97 -99
  24. package/dist/debug/{dom-CNgQ6lj9.js → dom-D8znnhpf.js} +102 -104
  25. package/dist/debug/dom.js +18 -19
  26. package/dist/debug/dom.mjs +19 -19
  27. package/dist/debug/html.js +15 -12
  28. package/dist/debug/html.mjs +15 -13
  29. package/dist/dom/catch.feat.js +3 -3
  30. package/dist/dom/catch.feat.mjs +2 -2
  31. package/dist/dom/control-flow.d.ts +1 -1
  32. package/dist/dom/controllable-input.feat.js +1 -1
  33. package/dist/dom/controllable-input.feat.mjs +1 -1
  34. package/dist/dom/controllable-open.feat.js +1 -1
  35. package/dist/dom/controllable-open.feat.mjs +1 -1
  36. package/dist/dom/controllable-select.feat.js +1 -1
  37. package/dist/dom/controllable-select.feat.mjs +1 -1
  38. package/dist/dom/controllable-textarea.feat.js +1 -1
  39. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  40. package/dist/dom/controllable.feat.js +1 -1
  41. package/dist/dom/controllable.feat.mjs +1 -1
  42. package/dist/dom/dynamic-tag-script.feat.js +2 -2
  43. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  44. package/dist/dom/dynamic-tag-var.feat.js +3 -3
  45. package/dist/dom/dynamic-tag-var.feat.mjs +2 -2
  46. package/dist/dom/lazy.feat.js +1 -1
  47. package/dist/dom/lazy.feat.mjs +1 -1
  48. package/dist/dom/placeholder.feat.js +2 -2
  49. package/dist/dom/placeholder.feat.mjs +1 -1
  50. package/dist/dom/renderer.d.ts +1 -3
  51. package/dist/dom/resume.d.ts +2 -3
  52. package/dist/dom/signals.d.ts +2 -7
  53. package/dist/{dom-60R4bRWD.js → dom-Bpkm72vV.js} +123 -132
  54. package/dist/{dom-Ci2W4l1P.mjs → dom-CVAevsbz.mjs} +77 -81
  55. package/dist/dom.d.ts +1 -1
  56. package/dist/dom.js +33 -33
  57. package/dist/dom.mjs +19 -19
  58. package/dist/html/assets.d.ts +1 -1
  59. package/dist/html/control-flow.d.ts +1 -1
  60. package/dist/html/inlined-runtimes.d.ts +2 -2
  61. package/dist/html/inlined-runtimes.debug.d.ts +2 -2
  62. package/dist/html/template.d.ts +1 -1
  63. package/dist/html.d.ts +1 -1
  64. package/dist/html.js +16 -19
  65. package/dist/html.mjs +16 -19
  66. package/dist/translator/index.js +6946 -6830
  67. package/dist/translator/util/assert.d.ts +7 -0
  68. package/dist/translator/util/bindings.d.ts +11 -3
  69. package/dist/translator/util/cyclic-memo.d.ts +6 -2
  70. package/dist/translator/util/entry-builder.d.ts +0 -1
  71. package/dist/translator/util/finalize-references.d.ts +4 -2
  72. package/dist/translator/util/for-selector.d.ts +1 -1
  73. package/dist/translator/util/generate-uid.d.ts +1 -0
  74. package/dist/translator/util/known-tag.d.ts +4 -1
  75. package/dist/translator/util/optional.d.ts +1 -1
  76. package/dist/translator/util/reasons.d.ts +4 -1
  77. package/dist/translator/util/references.d.ts +2 -0
  78. package/dist/translator/util/sections.d.ts +5 -5
  79. package/dist/translator/util/signals.d.ts +3 -3
  80. package/dist/translator/util/slots.d.ts +2 -2
  81. package/dist/translator/util/state.d.ts +4 -2
  82. package/dist/translator/visitors/import-declaration.d.ts +2 -0
  83. package/dist/translator/visitors/program/pre-analyze.d.ts +2 -0
  84. package/dist/translator/visitors/tag/dynamic-tag.d.ts +1 -0
  85. package/package.json +4 -4
package/dist/html.mjs CHANGED
@@ -254,12 +254,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
254
254
  rendered = !0, (() => {
255
255
  if (_scope_id(), _html(`<${renderer}${_attrs(input, "a", branchId, renderer)}>`), !voidElementsReg.test(renderer)) {
256
256
  let renderContent = content || normalizeDynamicRenderer(input.content);
257
- if (renderer === "textarea") _html(_attrs_textarea_value(branchId, "a", input));
258
- else {
259
- if (renderContent && typeof renderContent != "function") throw Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
260
- 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);
261
- }
262
- _html(`</${renderer}>`);
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}>`);
263
258
  }
264
259
  let childScope = getScopeById(branchId), needsScript = childScope && (childScope.Ia || childScope.Ea);
265
260
  needsScript && _script(branchId, "_d"), (shouldResume || needsScript) && _html(state.mark("(", scopeId + " " + accessor + " " + branchId));
@@ -284,7 +279,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
284
279
  let patched = patch(tag, scopeId, accessor);
285
280
  return patched !== tag && (patched.a = tag), originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs, markerGuard, tagVar);
286
281
  };
287
- })(_dynamic_tag), CONSUMED_RESULT_MESSAGE = "Cannot read from a consumed render result", _template = (templateId, renderer, page) => (renderer.render = render, renderer.i = !page, renderer._ = renderer, _content_resume(templateId, renderer)), kAssets = Symbol(), kHead = Symbol(), SET_SCOPE_REGISTER_ID = "$C_s", RENDER_BODY_ID = "$C_b", K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap(), compat = {
282
+ })(_dynamic_tag), _template = (templateId, renderer, page) => (renderer.render = render, renderer.i = !page, renderer._ = renderer, _content_resume(templateId, renderer)), kAssets = Symbol(), kHead = Symbol(), SET_SCOPE_REGISTER_ID = "$C_s", RENDER_BODY_ID = "$C_b", K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap(), compat = {
288
283
  $global,
289
284
  writeLoadAsset,
290
285
  fork: _await,
@@ -353,7 +348,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
353
348
  let { boundary } = chunk, { state } = boundary, html = "", scripts = "";
354
349
  if (reorders) for (let reorder of reorders) state.reorder(reorder);
355
350
  if (boundary.flush() === 0 && ({html, scripts} = chunk.flush(boundary)), boundary.aborted) throw boundary.reason;
356
- if (boundary.count) throw Error("Cannot serialize promise across tags/class compat layer.");
351
+ if (boundary.count) throw /* @__PURE__ */ Error();
357
352
  return {
358
353
  html,
359
354
  scripts
@@ -484,6 +479,7 @@ function normalizeDynamicRenderer(value) {
484
479
  function _assert_class_toggles(classes, toggles) {}
485
480
  function _el_read_error() {}
486
481
  function _hoist_read_error() {}
482
+ function _signal_read_error() {}
487
483
  function _assert_hoist(value) {}
488
484
  //#endregion
489
485
  //#region src/common/opt.ts
@@ -1708,7 +1704,7 @@ var State = class {
1708
1704
  flushSerializer(boundary, this);
1709
1705
  }
1710
1706
  runtimeScript() {
1711
- return "(e=>(self[e]||=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(r=l.slice(s+1),(l=l[s])>\"#\"||(a[r]=e),l),r,e),l>\"#\"&&d.push(e)}},self[e]))(\"" + this.$global.runtimeId + "\")(\"" + this.$global.renderId + "\")";
1707
+ return "(e=>(self[e]||=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(r=l.slice(s+1),(l=l[s])>\"#\"||(a[r]=e),l),r,e),l>\"#\"&&d.push(e)}},self[e]))(\"" + this.$global.runtimeId + "\")(\"" + this.$global.renderId + "\")";
1712
1708
  }
1713
1709
  keepsTryMarks(chunk, resumeWrites) {
1714
1710
  return chunk !== $chunk || chunk.boundary.resumeWrites !== resumeWrites;
@@ -1865,7 +1861,7 @@ var State = class {
1865
1861
  let { branchId, scopeId, placeholderBranchId } = placeholder, reorderId = body.reorderId = branchId + "";
1866
1862
  this.writeHTML(state.mark("!^", reorderId));
1867
1863
  let { effects } = this, beforeBranch = deferBranchStart(this);
1868
- if (this.render(withBranchId, placeholderBranchId, placeholder.render) !== this && this.boundary.abort(/* @__PURE__ */ Error("An @placeholder cannot contain async content.")), this.boundary.aborted) return !0;
1864
+ if (this.render(withBranchId, placeholderBranchId, placeholder.render) !== this && this.boundary.abort(/* @__PURE__ */ Error()), this.boundary.aborted) return !0;
1869
1865
  let stateful = this.effects !== effects;
1870
1866
  return applyBranchStart(this, beforeBranch, stateful), stateful && (this.render(writeScope, branchId, { P: scopeWithId(state, placeholderBranchId) }), this.writeHTML(state.mark("]", scopeId + " " + ("P" + branchId) + " " + placeholderBranchId)), dismissChunk(end, body).writeEffect(branchId, "_f")), this.writeHTML(state.mark("!", reorderId)), this.deferredReorder = body, !1;
1871
1867
  }
@@ -1930,7 +1926,7 @@ var State = class {
1930
1926
  let reordered = "", needsResumeArray = !1;
1931
1927
  if (state.writeReorders) {
1932
1928
  for (let reorderedChunk of state.writeReorders) {
1933
- needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, scripts = concatScripts(scripts, "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:1,r:a,c(i=e.l[\"^\"+a],f=d.cloneNode()){if(--o.i)return 1;for(;f.prepend(r=e.l[a].previousSibling||i),i!=r;);c(a,d)}}),e.v.push({data:e.i+\"*\"+l.r}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})(" + runtimePrefix + ")"));
1929
+ needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, scripts = concatScripts(scripts, "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=e=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:1,r:a,c(i=e.l[\"^\"+a],f=d.cloneNode()){if(--o.i)return 1;for(;f.prepend(r=e.l[a].previousSibling||i),i!=r;);c(a,d)}}),e.v.push({data:e.i+\"*\"+l.r}),(n=e.j[a])&&(g=l.c,l.c=i=>g()||n(e.r)))}})(" + runtimePrefix + ")"));
1934
1930
  let { reorderId, reorderBranch } = reorderedChunk, rootBranch = reorderBranch || +reorderId, readyReservations = [], reorderHTML = "", reorderEffects = "", effectsBoundary = reorderedChunk.boundary, reorderScripts = "", cur = reorderedChunk.boundary.aborted ? null : reorderedChunk;
1935
1931
  for (reorderedChunk.reorderId = null; cur;) {
1936
1932
  cur.markCatchRange(), cur.queueDeferredReorder(), cur.deferOwnReady();
@@ -2187,7 +2183,7 @@ var ServerRendered = class {
2187
2183
  });
2188
2184
  },
2189
2185
  return(value) {
2190
- return done || aborted || boundary?.abort(/* @__PURE__ */ Error("Iterator returned before consumed.")), Promise.resolve({
2186
+ return done || aborted || boundary?.abort(/* @__PURE__ */ Error()), Promise.resolve({
2191
2187
  value,
2192
2188
  done: !0
2193
2189
  });
@@ -2236,7 +2232,7 @@ var ServerRendered = class {
2236
2232
  #promise() {
2237
2233
  return this.#cachedPromise ||= new Promise((resolve, reject) => {
2238
2234
  let head = this.#head;
2239
- if (this.#head = null, !head) return reject(/* @__PURE__ */ Error(CONSUMED_RESULT_MESSAGE));
2235
+ if (this.#head = null, !head) return reject(/* @__PURE__ */ Error());
2240
2236
  let { boundary } = head, html = "";
2241
2237
  (boundary.onNext = () => {
2242
2238
  switch (!boundary.count && boundary.flush()) {
@@ -2253,7 +2249,7 @@ var ServerRendered = class {
2253
2249
  #read(onWrite, onAbort, onClose) {
2254
2250
  let tick = !0, flushing = !1, again = !1, head = this.#head;
2255
2251
  if (this.#head = null, !head) {
2256
- onAbort(/* @__PURE__ */ Error(CONSUMED_RESULT_MESSAGE));
2252
+ onAbort(/* @__PURE__ */ Error());
2257
2253
  return;
2258
2254
  }
2259
2255
  let { boundary } = head, onNext = boundary.onNext = (write) => {
@@ -2286,9 +2282,9 @@ var ServerRendered = class {
2286
2282
  }
2287
2283
  toString() {
2288
2284
  let head = this.#head;
2289
- if (this.#head = null, !head) throw Error(CONSUMED_RESULT_MESSAGE);
2285
+ if (this.#head = null, !head) throw /* @__PURE__ */ Error();
2290
2286
  let { boundary } = head, html = boundary.flush() === 0 ? head.consume(boundary).flushHTML(boundary) : "";
2291
- if (boundary.count && boundary.abort(/* @__PURE__ */ Error("Cannot consume asynchronous render with 'toString'")), settle(boundary), boundary.aborted) throw boundary.reason;
2287
+ if (boundary.count && boundary.abort(/* @__PURE__ */ Error()), settle(boundary), boundary.aborted) throw boundary.reason;
2292
2288
  return html;
2293
2289
  }
2294
2290
  };
@@ -2298,8 +2294,9 @@ function settle(boundary) {
2298
2294
  function NOOP$1() {}
2299
2295
  //#endregion
2300
2296
  //#region src/html/assets.ts
2301
- function withLoadAssets(renderer, flush, assetId, triggers) {
2302
- return register(renderer.a, Object.assign((input) => (writeLoadAsset(assetId, flush, triggers), writeWaitReady(assetId, renderer, input)), renderer));
2297
+ function withLoadAssets(template, id, flush, assetId, triggers) {
2298
+ let renderer = (input) => (writeLoadAsset(assetId, flush, triggers), writeWaitReady(assetId, template(), input));
2299
+ return _template(id, renderer), renderer;
2303
2300
  }
2304
2301
  function writeLoadAsset(assetId, flush, triggers) {
2305
2302
  let g = $global();
@@ -2598,4 +2595,4 @@ function swapReorders(state, reorders) {
2598
2595
  }
2599
2596
  function NOOP() {}
2600
2597
  //#endregion
2601
- 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_read_error, _el_resume, _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_resume, _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, _style_html, _subscribe, _template, _text_resume, _textarea_value, _to_text, _trailers, _try, _unescaped, _var, _write_guard, _write_if, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, withLoadAssets, withPageAssets };
2598
+ 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_read_error, _el_resume, _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_resume, _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_resume, _textarea_value, _to_text, _trailers, _try, _unescaped, _var, _write_guard, _write_if, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, withLoadAssets, withPageAssets };