marko 6.3.34 → 6.3.35

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 (53) hide show
  1. package/cheatsheet.md +2 -2
  2. package/dist/common/constants/accessor-prefix.d.ts +1 -0
  3. package/dist/common/constants/accessor-prefix.debug.d.ts +1 -0
  4. package/dist/common/errors.d.ts +1 -0
  5. package/dist/common/types.d.ts +10 -0
  6. package/dist/debug/dom/catch.feat.js +1 -1
  7. package/dist/debug/dom/catch.feat.mjs +1 -1
  8. package/dist/debug/dom/controllable-input.feat.js +1 -1
  9. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  10. package/dist/debug/dom/controllable-open.feat.js +1 -1
  11. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  12. package/dist/debug/dom/controllable-select.feat.js +1 -1
  13. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  14. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  15. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  16. package/dist/debug/dom/controllable.feat.js +1 -1
  17. package/dist/debug/dom/controllable.feat.mjs +1 -1
  18. package/dist/debug/{dom-klf8Ec_o.mjs → dom-B57LrRnX.mjs} +34 -16
  19. package/dist/debug/{dom-Bj58jt8y.js → dom-Bt4OoZ-j.js} +34 -16
  20. package/dist/debug/dom.js +1 -1
  21. package/dist/debug/dom.mjs +1 -1
  22. package/dist/debug/html.js +88 -21
  23. package/dist/debug/html.mjs +88 -21
  24. package/dist/dom/catch.feat.js +1 -1
  25. package/dist/dom/catch.feat.mjs +1 -1
  26. package/dist/dom/control-flow.d.ts +1 -0
  27. package/dist/dom/controllable-input.feat.js +1 -1
  28. package/dist/dom/controllable-input.feat.mjs +1 -1
  29. package/dist/dom/controllable-open.feat.js +1 -1
  30. package/dist/dom/controllable-open.feat.mjs +1 -1
  31. package/dist/dom/controllable-select.feat.js +1 -1
  32. package/dist/dom/controllable-select.feat.mjs +1 -1
  33. package/dist/dom/controllable-textarea.feat.js +1 -1
  34. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  35. package/dist/dom/controllable.feat.js +1 -1
  36. package/dist/dom/controllable.feat.mjs +1 -1
  37. package/dist/dom/signals.d.ts +3 -3
  38. package/dist/{dom-6hBvZW7X.mjs → dom-BP2XSglG.mjs} +19 -12
  39. package/dist/{dom-B-XpL2_H.js → dom-BeF9xIzO.js} +19 -12
  40. package/dist/dom.js +1 -1
  41. package/dist/dom.mjs +1 -1
  42. package/dist/html/dynamic-tag.d.ts +1 -1
  43. package/dist/html/serializer.d.ts +9 -1
  44. package/dist/html/template.d.ts +1 -0
  45. package/dist/html/writer.d.ts +1 -0
  46. package/dist/html.js +15 -9
  47. package/dist/html.mjs +15 -9
  48. package/dist/translator/index.js +137 -70
  49. package/dist/translator/util/signals.d.ts +2 -0
  50. package/dist/translator/util/translate-var.d.ts +1 -1
  51. package/dist/translator/visitors/export-declaration.d.ts +8 -0
  52. package/package.json +4 -4
  53. package/tags/let.d.marko +3 -4
@@ -52,7 +52,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
52
52
  let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor;
53
53
  return (scope, newRenderer, getInput) => {
54
54
  let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
55
- if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.a || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) if (setConditionalRenderer(scope, nodeAccessor, normalizedRenderer || (getContent ? getContent(scope) : void 0), createBranchWithTagNameOrRenderer), getTagVar && (scope[childScopeAccessor].T = (value) => getTagVar()(scope, value)), typeof normalizedRenderer == "string") {
55
+ if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(normalizedRenderer)) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) if (setConditionalRenderer(scope, nodeAccessor, normalizedRenderer || (getContent ? getContent(scope) : void 0), createBranchWithTagNameOrRenderer), getTagVar && (scope[childScopeAccessor] ? scope[childScopeAccessor].T = (value) => getTagVar()(scope, value) : getTagVar()(scope, void 0)), typeof normalizedRenderer == "string") {
56
56
  if (getContent) {
57
57
  let content = getContent(scope);
58
58
  setConditionalRenderer(scope[childScopeAccessor], "a", content, createAndSetupBranch), content.f && subscribeToScopeSet(content.e, content.f, scope[childScopeAccessor].Aa);
@@ -78,7 +78,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
78
78
  nodeAccessor = decodeAccessor(nodeAccessor);
79
79
  let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor;
80
80
  return (scope, renderer) => {
81
- if (scope[rendererAccessor] !== (scope[rendererAccessor] = renderer?.a || renderer) && (setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch), renderer?.f && subscribeToScopeSet(renderer.e, renderer.f, scope[childScopeAccessor])), renderer) for (let accessor in renderer.g) renderer.g[accessor](scope[childScopeAccessor], renderer.h[accessor]);
81
+ if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(renderer)) && (setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch), renderer?.f && subscribeToScopeSet(renderer.e, renderer.f, scope[childScopeAccessor])), renderer) for (let accessor in renderer.g) renderer.g[accessor](scope[childScopeAccessor], renderer.h[accessor]);
82
82
  };
83
83
  }), _resume_dynamic_tag = /*@__PURE__*/ withBranches(() => _resume("d", dynamicTagScript)), loop = /*@__PURE__*/ withBranches((forEach) => (nodeAccessor, template, walks, setup, params) => {
84
84
  nodeAccessor = decodeAccessor(nodeAccessor);
@@ -462,9 +462,13 @@ function _var(scope, childAccessor, signal) {
462
462
  function _return_change(scope, changeHandler) {
463
463
  scope.U = changeHandler || void 0;
464
464
  }
465
- function _id({ $: $global }) {
466
- let id = tagIdsByGlobal.get($global) || 0;
467
- return tagIdsByGlobal.set($global, id + 1), "c" + $global.runtimeId + $global.renderId + id.toString(36);
465
+ function _id(scope, accessor) {
466
+ let id = accessor !== void 0 && scope[accessor];
467
+ if (!id) {
468
+ let $global = scope.$, n = tagIdsByGlobal.get($global) || 0;
469
+ tagIdsByGlobal.set($global, n + 1), id = "c" + $global.runtimeId + $global.renderId + n.toString(36), accessor !== void 0 && (scope[accessor] = id);
470
+ }
471
+ return id;
468
472
  }
469
473
  function _script(id, fn) {
470
474
  return _resume(id, fn), (scope) => {
@@ -474,17 +478,17 @@ function _script(id, fn) {
474
478
  function _el_read(value) {
475
479
  return value;
476
480
  }
477
- function* traverse(scope, path, i = path.length - 1) {
478
- if (scope) if (Symbol.iterator in scope) for (let childScope of scope.values()) yield* traverse(childScope, path, i);
481
+ function* traverse(scope, path, args, i = path.length - 1) {
482
+ if (scope) if (Symbol.iterator in scope) for (let childScope of scope.values()) yield* traverse(childScope, path, args, i);
479
483
  else {
480
484
  let item = scope[path[i]];
481
- i ? yield* traverse(item, path, i - 1) : yield typeof item == "function" ? item() : item;
485
+ i ? yield* traverse(item, path, args, i - 1) : yield typeof item == "function" ? item(...args) : item;
482
486
  }
483
487
  }
484
488
  function _hoist(...path) {
485
489
  return path = path.map((p) => typeof p == "string" ? p : decodeAccessor(p)), (scope) => {
486
- let fn = () => traverse(scope, path).next().value;
487
- return fn[Symbol.iterator] = () => traverse(scope, path), fn;
490
+ let fn = (...args) => traverse(scope, path, args).next().value;
491
+ return fn[Symbol.iterator] = () => traverse(scope, path, []), fn;
488
492
  };
489
493
  }
490
494
  function _hoist_resume(id, ...path) {
@@ -756,7 +760,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
756
760
  }
757
761
  function _attr_content(scope, nodeAccessor, value) {
758
762
  let content = normalizeClientRender(value);
759
- scope["D" + nodeAccessor] !== (scope["D" + nodeAccessor] = content?.a) && (setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch), content?.f && subscribeToScopeSet(content.e, content.f, scope["A" + nodeAccessor]));
763
+ scope["D" + nodeAccessor] !== (scope["D" + nodeAccessor] = rendererKey(content)) && (setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch), content?.f && subscribeToScopeSet(content.e, content.f, scope["A" + nodeAccessor]));
760
764
  for (let accessor in content?.g) content.g[accessor](scope["A" + nodeAccessor], content.h[accessor]);
761
765
  }
762
766
  function _attrs_script(scope, nodeAccessor) {
@@ -874,7 +878,7 @@ function _attr_input_value_dynamic_default(scope, nodeAccessor, value) {
874
878
  }
875
879
  function _attr_input_value(scope, nodeAccessor, value, valueChange, setDefault = _attr_input_value_default) {
876
880
  let el = scope[nodeAccessor], normalizedValue = normalizeAttrValue(value) || "";
877
- scope["E" + nodeAccessor] = valueChange, scope["G" + nodeAccessor] = normalizedValue, scope["F" + nodeAccessor] = valueChange ? 2 : 5, valueChange && scope.H < runId ? setInputValue(el, normalizedValue) : setDefault(scope, nodeAccessor, normalizedValue);
881
+ scope["E" + nodeAccessor] = valueChange, scope["G" + nodeAccessor] = normalizedValue, scope["F" + nodeAccessor] = valueChange ? 2 : 5, valueChange && scope.H < runId ? setInputValue(el, normalizedValue) : setDefault(scope, nodeAccessor, value);
878
882
  }
879
883
  function _attr_input_value_attribute_default(scope, nodeAccessor, value) {
880
884
  _attr(scope[nodeAccessor], "value", value);
@@ -1119,6 +1123,9 @@ function renderCatch(scope, error) {
1119
1123
  placeholderBranch && (tryWithCatch.O && (tryWithCatch.O.i = 0), owner["A" + tryWithCatch.C] = placeholderBranch, destroyBranch(tryWithCatch)), caughtError.add(pendingEffects), setConditionalRenderer(owner, tryWithCatch.C, tryWithCatch.E, createAndSetupBranch), tryWithCatch.E?.d?.(owner["A" + tryWithCatch.C], [error]);
1120
1124
  } else throw error;
1121
1125
  }
1126
+ function rendererKey(renderer) {
1127
+ return renderer?.e ? renderer.a + " " + renderer.e.L : renderer?.a || renderer;
1128
+ }
1122
1129
  function patchDynamicTag(fn) {
1123
1130
  _dynamic_tag = fn(_dynamic_tag);
1124
1131
  }
@@ -52,7 +52,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
52
52
  let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor;
53
53
  return (scope, newRenderer, getInput) => {
54
54
  let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
55
- if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.a || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) if (setConditionalRenderer(scope, nodeAccessor, normalizedRenderer || (getContent ? getContent(scope) : void 0), createBranchWithTagNameOrRenderer), getTagVar && (scope[childScopeAccessor].T = (value) => getTagVar()(scope, value)), typeof normalizedRenderer == "string") {
55
+ if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(normalizedRenderer)) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) if (setConditionalRenderer(scope, nodeAccessor, normalizedRenderer || (getContent ? getContent(scope) : void 0), createBranchWithTagNameOrRenderer), getTagVar && (scope[childScopeAccessor] ? scope[childScopeAccessor].T = (value) => getTagVar()(scope, value) : getTagVar()(scope, void 0)), typeof normalizedRenderer == "string") {
56
56
  if (getContent) {
57
57
  let content = getContent(scope);
58
58
  setConditionalRenderer(scope[childScopeAccessor], "a", content, createAndSetupBranch), content.f && subscribeToScopeSet(content.e, content.f, scope[childScopeAccessor].Aa);
@@ -78,7 +78,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
78
78
  nodeAccessor = decodeAccessor(nodeAccessor);
79
79
  let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor;
80
80
  return (scope, renderer) => {
81
- if (scope[rendererAccessor] !== (scope[rendererAccessor] = renderer?.a || renderer) && (setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch), renderer?.f && subscribeToScopeSet(renderer.e, renderer.f, scope[childScopeAccessor])), renderer) for (let accessor in renderer.g) renderer.g[accessor](scope[childScopeAccessor], renderer.h[accessor]);
81
+ if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(renderer)) && (setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch), renderer?.f && subscribeToScopeSet(renderer.e, renderer.f, scope[childScopeAccessor])), renderer) for (let accessor in renderer.g) renderer.g[accessor](scope[childScopeAccessor], renderer.h[accessor]);
82
82
  };
83
83
  }), _resume_dynamic_tag = /*@__PURE__*/ withBranches(() => _resume("d", dynamicTagScript)), loop = /*@__PURE__*/ withBranches((forEach) => (nodeAccessor, template, walks, setup, params) => {
84
84
  nodeAccessor = decodeAccessor(nodeAccessor);
@@ -462,9 +462,13 @@ function _var(scope, childAccessor, signal) {
462
462
  function _return_change(scope, changeHandler) {
463
463
  scope.U = changeHandler || void 0;
464
464
  }
465
- function _id({ $: $global }) {
466
- let id = tagIdsByGlobal.get($global) || 0;
467
- return tagIdsByGlobal.set($global, id + 1), "c" + $global.runtimeId + $global.renderId + id.toString(36);
465
+ function _id(scope, accessor) {
466
+ let id = accessor !== void 0 && scope[accessor];
467
+ if (!id) {
468
+ let $global = scope.$, n = tagIdsByGlobal.get($global) || 0;
469
+ tagIdsByGlobal.set($global, n + 1), id = "c" + $global.runtimeId + $global.renderId + n.toString(36), accessor !== void 0 && (scope[accessor] = id);
470
+ }
471
+ return id;
468
472
  }
469
473
  function _script(id, fn) {
470
474
  return _resume(id, fn), (scope) => {
@@ -474,17 +478,17 @@ function _script(id, fn) {
474
478
  function _el_read(value) {
475
479
  return value;
476
480
  }
477
- function* traverse(scope, path, i = path.length - 1) {
478
- if (scope) if (Symbol.iterator in scope) for (let childScope of scope.values()) yield* traverse(childScope, path, i);
481
+ function* traverse(scope, path, args, i = path.length - 1) {
482
+ if (scope) if (Symbol.iterator in scope) for (let childScope of scope.values()) yield* traverse(childScope, path, args, i);
479
483
  else {
480
484
  let item = scope[path[i]];
481
- i ? yield* traverse(item, path, i - 1) : yield typeof item == "function" ? item() : item;
485
+ i ? yield* traverse(item, path, args, i - 1) : yield typeof item == "function" ? item(...args) : item;
482
486
  }
483
487
  }
484
488
  function _hoist(...path) {
485
489
  return path = path.map((p) => typeof p == "string" ? p : decodeAccessor(p)), (scope) => {
486
- let fn = () => traverse(scope, path).next().value;
487
- return fn[Symbol.iterator] = () => traverse(scope, path), fn;
490
+ let fn = (...args) => traverse(scope, path, args).next().value;
491
+ return fn[Symbol.iterator] = () => traverse(scope, path, []), fn;
488
492
  };
489
493
  }
490
494
  function _hoist_resume(id, ...path) {
@@ -756,7 +760,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
756
760
  }
757
761
  function _attr_content(scope, nodeAccessor, value) {
758
762
  let content = normalizeClientRender(value);
759
- scope["D" + nodeAccessor] !== (scope["D" + nodeAccessor] = content?.a) && (setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch), content?.f && subscribeToScopeSet(content.e, content.f, scope["A" + nodeAccessor]));
763
+ scope["D" + nodeAccessor] !== (scope["D" + nodeAccessor] = rendererKey(content)) && (setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch), content?.f && subscribeToScopeSet(content.e, content.f, scope["A" + nodeAccessor]));
760
764
  for (let accessor in content?.g) content.g[accessor](scope["A" + nodeAccessor], content.h[accessor]);
761
765
  }
762
766
  function _attrs_script(scope, nodeAccessor) {
@@ -874,7 +878,7 @@ function _attr_input_value_dynamic_default(scope, nodeAccessor, value) {
874
878
  }
875
879
  function _attr_input_value(scope, nodeAccessor, value, valueChange, setDefault = _attr_input_value_default) {
876
880
  let el = scope[nodeAccessor], normalizedValue = normalizeAttrValue(value) || "";
877
- scope["E" + nodeAccessor] = valueChange, scope["G" + nodeAccessor] = normalizedValue, scope["F" + nodeAccessor] = valueChange ? 2 : 5, valueChange && scope.H < runId ? setInputValue(el, normalizedValue) : setDefault(scope, nodeAccessor, normalizedValue);
881
+ scope["E" + nodeAccessor] = valueChange, scope["G" + nodeAccessor] = normalizedValue, scope["F" + nodeAccessor] = valueChange ? 2 : 5, valueChange && scope.H < runId ? setInputValue(el, normalizedValue) : setDefault(scope, nodeAccessor, value);
878
882
  }
879
883
  function _attr_input_value_attribute_default(scope, nodeAccessor, value) {
880
884
  _attr(scope[nodeAccessor], "value", value);
@@ -1119,6 +1123,9 @@ function renderCatch(scope, error) {
1119
1123
  placeholderBranch && (tryWithCatch.O && (tryWithCatch.O.i = 0), owner["A" + tryWithCatch.C] = placeholderBranch, destroyBranch(tryWithCatch)), caughtError.add(pendingEffects), setConditionalRenderer(owner, tryWithCatch.C, tryWithCatch.E, createAndSetupBranch), tryWithCatch.E?.d?.(owner["A" + tryWithCatch.C], [error]);
1120
1124
  } else throw error;
1121
1125
  }
1126
+ function rendererKey(renderer) {
1127
+ return renderer?.e ? renderer.a + " " + renderer.e.L : renderer?.a || renderer;
1128
+ }
1122
1129
  function patchDynamicTag(fn) {
1123
1130
  _dynamic_tag = fn(_dynamic_tag);
1124
1131
  }
package/dist/dom.js CHANGED
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("./dom-B-XpL2_H.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
1
+ let require_control_flow = require("./dom-BeF9xIzO.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
2
2
  require_control_flow.vt($global.runtimeId);
3
3
  let render = self[$global.runtimeId]?.[$global.renderId], scopes = render && scopesByRender.get(render);
4
4
  return render && !scopes && scopesByRender.set(render, scopes = {}), scopes;
package/dist/dom.mjs CHANGED
@@ -65,7 +65,7 @@ let empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), cl
65
65
  let renderer = _content(id, template, walks, setup, inputSignal)();
66
66
  return renderer.mount = mount, renderer._ = renderer, _resume(id, renderer);
67
67
  };
68
- import { $ as _html, $t as queueEffect, A as _attr_select_value, At as _id, B as _attr_class, Bt as _assert_init, C as _attr_input_checked_default, Ct as _closure_get, D as _attr_input_value_default, Dt as _for_selector, E as _attr_input_value_attribute_default, Et as _for_closure, F as _controllable_select, Ft as _return, G as _attr_style, Gt as _on, H as _attr_class_items, Ht as insertBranchBefore, I as _controllable_textarea, It as _return_change, J as _attrs, K as _attr_style_item, Kt as $signal, Lt as _script, M as _attr_select_value_script, Mt as _let, N as _controllable_input, Nt as _let_change, O as _attr_input_value_dynamic_default, Ot as _hoist, P as _controllable_open, Pt as _or, Q as _attrs_script, Qt as queueAsyncRender, Rt as _var, S as _attr_input_checkedValue_script, St as _closure, T as _attr_input_value, Tt as _el_read, U as _attr_content, Ut as removeAndDestroyBranch, V as _attr_class_item, Vt as destroyBranch, W as _attr_nonce, Wt as syncGen, X as _attrs_partial, Y as _attrs_content, Z as _attrs_partial_content, Zt as prepareEffects, _ as _attr_details_or_dialog_open_default, _t as getRegisteredWithScope, a as _for_in, an as forTo, at as _to_text, b as _attr_input_checkedValue, bt as ready, c as _for_until, cn as _call, ct as _content, d as _show, dt as createAndSetupBranch, en as run, et as _lifecycle, f as _try, ft as createBranch, g as _attr_details_or_dialog_open, gt as _var_resume, h as renderCatch, ht as _resume, i as _dynamic_tag_content, in as forOf, it as _text_content, j as _attr_select_value_default, jt as _if_closure, k as _attr_input_value_script, kt as _hoist_resume, l as _if, ln as decodeAccessor, lt as _content_closures, m as patchDynamicTag, mt as _el, n as _await_promise, nn as runId, nt as _style_shell, o as _for_of, on as forUntil, ot as insertChildNodes, p as addAwaitCounter, pt as setupBranch, q as _attr_style_items, qt as $signalReset, r as _dynamic_tag, rn as forIn, rt as _text, s as _for_to, sn as _assert_hoist, st as toInsertNode, t as _await_content, tn as runEffects, tt as _style_rule_item, u as _resume_dynamic_tag, ut as _content_resume, v as _attr_details_or_dialog_open_script, vt as init, w as _attr_input_checked_script, wt as _const, x as _attr_input_checkedValue_default, xt as _child_setup, y as _attr_input_checked, yt as initEmbedded, z as _attr, zt as _var_change } from "./dom-6hBvZW7X.mjs";
68
+ import { $ as _html, $t as queueEffect, A as _attr_select_value, At as _id, B as _attr_class, Bt as _assert_init, C as _attr_input_checked_default, Ct as _closure_get, D as _attr_input_value_default, Dt as _for_selector, E as _attr_input_value_attribute_default, Et as _for_closure, F as _controllable_select, Ft as _return, G as _attr_style, Gt as _on, H as _attr_class_items, Ht as insertBranchBefore, I as _controllable_textarea, It as _return_change, J as _attrs, K as _attr_style_item, Kt as $signal, Lt as _script, M as _attr_select_value_script, Mt as _let, N as _controllable_input, Nt as _let_change, O as _attr_input_value_dynamic_default, Ot as _hoist, P as _controllable_open, Pt as _or, Q as _attrs_script, Qt as queueAsyncRender, Rt as _var, S as _attr_input_checkedValue_script, St as _closure, T as _attr_input_value, Tt as _el_read, U as _attr_content, Ut as removeAndDestroyBranch, V as _attr_class_item, Vt as destroyBranch, W as _attr_nonce, Wt as syncGen, X as _attrs_partial, Y as _attrs_content, Z as _attrs_partial_content, Zt as prepareEffects, _ as _attr_details_or_dialog_open_default, _t as getRegisteredWithScope, a as _for_in, an as forTo, at as _to_text, b as _attr_input_checkedValue, bt as ready, c as _for_until, cn as _call, ct as _content, d as _show, dt as createAndSetupBranch, en as run, et as _lifecycle, f as _try, ft as createBranch, g as _attr_details_or_dialog_open, gt as _var_resume, h as renderCatch, ht as _resume, i as _dynamic_tag_content, in as forOf, it as _text_content, j as _attr_select_value_default, jt as _if_closure, k as _attr_input_value_script, kt as _hoist_resume, l as _if, ln as decodeAccessor, lt as _content_closures, m as patchDynamicTag, mt as _el, n as _await_promise, nn as runId, nt as _style_shell, o as _for_of, on as forUntil, ot as insertChildNodes, p as addAwaitCounter, pt as setupBranch, q as _attr_style_items, qt as $signalReset, r as _dynamic_tag, rn as forIn, rt as _text, s as _for_to, sn as _assert_hoist, st as toInsertNode, t as _await_content, tn as runEffects, tt as _style_rule_item, u as _resume_dynamic_tag, ut as _content_resume, v as _attr_details_or_dialog_open_script, vt as init, w as _attr_input_checked_script, wt as _const, x as _attr_input_checkedValue_default, xt as _child_setup, y as _attr_input_checked, yt as initEmbedded, z as _attr, zt as _var_change } from "./dom-BP2XSglG.mjs";
69
69
  //#region src/common/attr-tag.ts
70
70
  function attrTag(attrs) {
71
71
  return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
@@ -5,7 +5,7 @@ interface BodyContentObject {
5
5
  content: ServerRenderer;
6
6
  }
7
7
  export declare let _dynamic_tag: (scopeId: number, accessor: Accessor, tag: unknown | string | ServerRenderer | BodyContentObject, inputOrArgs: unknown, content?: (() => void) | 0, inputIsArgs?: 1, serializeReason?: 1 | 0) => unknown;
8
- export declare function _content(id: string, fn: ServerRenderer): ServerRenderer;
8
+ export declare function _content(id: string, fn: ServerRenderer, scopeId?: number): ServerRenderer;
9
9
  export declare function _content_resume(id: string, fn: ServerRenderer, scopeId?: number): ServerRenderer;
10
10
  export declare const patchDynamicTag: (patch: (tag: unknown, scopeId: number, accessor: Accessor) => unknown) => void;
11
11
  export {};
@@ -5,7 +5,14 @@ export interface SerializeChannel {
5
5
  readyId?: string;
6
6
  parent?: SerializeChannel;
7
7
  }
8
- export declare function setDebugInfo(obj: WeakKey, file: string, loc: string | 0, vars?: Record<string, string>): void;
8
+ interface Debug {
9
+ file: string;
10
+ loc: string | 0;
11
+ vars: Record<string, string | [name: string, loc?: string]> | undefined;
12
+ slots?: Record<string, string>;
13
+ }
14
+ export declare function setDebugInfo(obj: WeakKey, file: string, loc: string | 0, vars?: Debug["vars"]): void;
15
+ export declare function setDebugSlotName(obj: WeakKey, accessor: string, name: string): void;
9
16
  export declare class Serializer {
10
17
  #private;
11
18
  pending(channel?: SerializeChannel): boolean;
@@ -23,3 +30,4 @@ export declare function getRegistered(val: WeakKey): {
23
30
  export declare function toObjectKey(name: string): string;
24
31
  export declare function toAccess(accessor: string): string;
25
32
  export declare function quote(str: string, startPos: number): string;
33
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { RendererProp, type Template } from "../common/types";
2
2
  export type ServerRenderer = ((...args: unknown[]) => unknown) & {
3
3
  [RendererProp.Id]?: string;
4
+ [RendererProp.Owner]?: number;
4
5
  [RendererProp.Embed]?: boolean;
5
6
  };
6
7
  export declare const _template: (templateId: string, renderer: ServerRenderer, page?: 1) => Template;
@@ -21,6 +21,7 @@ export declare function getChunk(): Chunk | undefined;
21
21
  export declare function withChunk<T>(chunk: Chunk, cb: () => T): T;
22
22
  export declare function getContext(key: keyof NonNullable<Chunk["context"]>): unknown;
23
23
  export declare function getState(): State;
24
+ export declare function rendererKey(renderer: unknown): unknown;
24
25
  export declare function getScopeId(scope: unknown): number | undefined;
25
26
  export declare function getScopeById(scopeId: number | undefined): ScopeInternals | undefined;
26
27
  export declare function $global(): $Global & {
package/dist/html.js CHANGED
@@ -4,7 +4,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
4
4
  else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
5
5
  else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
6
6
  return str;
7
- }, unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&amp;" : "&lt;", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<(\/?script|!--)/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C$1") : str, unsafeStyleReg = /<(\/style)/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str, unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, "&gt;") : str, K_SCOPE_ID = Symbol("Scope ID"), kTouchedIterator = Symbol.for("marko.touchedIterator"), { hasOwnProperty } = {}, objectProto = Object.prototype, arrayProto = Array.prototype, Generator = (function* () {})().constructor, AsyncGenerator = (async function* () {})().constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
7
+ }, 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, "\\x3C$1") : str, unsafeStyleReg = /<(\/style)/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str, unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, "&gt;") : str, K_SCOPE_ID = Symbol("Scope ID"), kTouchedIterator = Symbol.for("marko.touchedIterator"), { hasOwnProperty } = {}, objectProto = Object.prototype, arrayProto = Array.prototype, Generator = (function* () {})().constructor, AsyncGenerator = (async function* () {})().constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
8
8
  let KNOWN_SYMBOLS = /* @__PURE__ */ new Map();
9
9
  for (let name of Object.getOwnPropertyNames(Symbol)) {
10
10
  let symbol = Symbol[name];
@@ -278,7 +278,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
278
278
  };
279
279
  result = shouldResume ? withBranchId(branchId, render) : render(), rendered = _peek_scope_id() !== branchId, beforeBranch !== void 0 && (applyBranchStart(chunk, beforeBranch, rendered), _html(state.mark("]", scopeId + " " + accessor + (rendered ? " " + branchId : ""))));
280
280
  }
281
- return rendered ? shouldResume && writeScope(scopeId, { ["D" + accessor]: renderer?.a || renderer }) : _scope_id(), result;
281
+ return rendered ? shouldResume && writeScope(scopeId, { ["D" + accessor]: rendererKey(renderer) }) : _scope_id(), result;
282
282
  }, patchDynamicTag = ((originalDynamicTag) => (patch) => {
283
283
  _dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
284
284
  let patched = patch(tag, scopeId, accessor);
@@ -1264,6 +1264,9 @@ function getContext(key) {
1264
1264
  function getState() {
1265
1265
  return $chunk.boundary.state;
1266
1266
  }
1267
+ function rendererKey(renderer) {
1268
+ return renderer?.e === void 0 ? renderer?.a || renderer : renderer.a + " " + renderer.e;
1269
+ }
1267
1270
  function getScopeId(scope) {
1268
1271
  return scope[K_SCOPE_ID];
1269
1272
  }
@@ -1342,7 +1345,7 @@ function _attr_content(nodeAccessor, scopeId, content, serializeReason) {
1342
1345
  let shouldResume = serializeReason !== 0, render = normalizeServerRender(content), branchId = _peek_scope_id();
1343
1346
  render && (shouldResume ? withBranchId(branchId, render) : render()), _peek_scope_id() === branchId ? _scope_id() : shouldResume && writeScope(scopeId, {
1344
1347
  ["A" + nodeAccessor]: writeScope(branchId, {}),
1345
- ["D" + nodeAccessor]: render?.a
1348
+ ["D" + nodeAccessor]: rendererKey(render)
1346
1349
  });
1347
1350
  }
1348
1351
  function normalizeServerRender(value) {
@@ -1857,7 +1860,7 @@ function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange, seriali
1857
1860
  }
1858
1861
  function _textarea_value(value) {
1859
1862
  let escaped = _escape(normalizeStrAttrValue(value));
1860
- return escaped[0] === "\n" || escaped[0] === "\r" ? "\n" + escaped : escaped;
1863
+ return escaped[0] === "\n" ? "\n" + escaped : escaped;
1861
1864
  }
1862
1865
  function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
1863
1866
  return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _attr("value", value);
@@ -1994,11 +1997,11 @@ function normalizeStrAttrValue(value) {
1994
1997
  }
1995
1998
  //#endregion
1996
1999
  //#region src/html/dynamic-tag.ts
1997
- function _content(id, fn) {
1998
- return fn.a = id, fn;
2000
+ function _content(id, fn, scopeId) {
2001
+ return fn.a = id, fn.e = scopeId, fn;
1999
2002
  }
2000
2003
  function _content_resume(id, fn, scopeId) {
2001
- return _resume(_content(id, fn), id, scopeId);
2004
+ return _resume(_content(id, fn, scopeId), id, scopeId);
2002
2005
  }
2003
2006
  //#endregion
2004
2007
  //#region src/html/template.ts
@@ -2209,14 +2212,17 @@ function writeTriggerScript(html, triggers) {
2209
2212
  let htmlStr = _escape_script(JSON.stringify(html)), exprs = triggers.map((trigger) => {
2210
2213
  let options = trigger.options && toObjectExpression(trigger.options);
2211
2214
  switch (trigger.type) {
2212
- case "visible": return `(e=>e&&new IntersectionObserver((e,i)=>e.some(e=>e.isIntersecting)&&i.disconnect()+l()${options ? `,${options}` : ""}).observe(e))(document.querySelector(${JSON.stringify(trigger.selector)})||l())`;
2215
+ case "visible": return `(e=>e&&new IntersectionObserver((e,i)=>e.some(e=>e.isIntersecting)&&i.disconnect()+l()${options ? `,${options}` : ""}).observe(e))(${querySelectorOrLoad(trigger.selector)})`;
2213
2216
  case "idle": return `(self.requestIdleCallback||l)(l${options ? `,${options}` : ""})`;
2214
2217
  case "media": return `(m=>m.matches?l():m.addEventListener("change",l,{once:1}))(matchMedia(${JSON.stringify(trigger.selector)}))`;
2215
- default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(document.querySelector(${JSON.stringify(trigger.selector)})||l())`;
2218
+ default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(${querySelectorOrLoad(trigger.selector)})`;
2216
2219
  }
2217
2220
  });
2218
2221
  writeScript(`((p,h,d,l=$=>{d||p.after(new Range().createContextualFragment(d=h))})=>${exprs.length > 1 ? `{${exprs.join(";")}}` : exprs[0]})(document.currentScript,${htmlStr})`);
2219
2222
  }
2223
+ function querySelectorOrLoad(selector) {
2224
+ return `document.querySelector(${JSON.stringify(selector)})||l()`;
2225
+ }
2220
2226
  function toObjectExpression(options) {
2221
2227
  let result = "{", sep = "";
2222
2228
  for (let key in options) Object.hasOwn(options, key) && (result += sep + toObjectKey(key) + ":" + JSON.stringify(options[key]), sep = ",");
package/dist/html.mjs CHANGED
@@ -4,7 +4,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
4
4
  else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
5
5
  else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
6
6
  return str;
7
- }, unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&amp;" : "&lt;", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<(\/?script|!--)/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C$1") : str, unsafeStyleReg = /<(\/style)/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str, unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, "&gt;") : str, K_SCOPE_ID = Symbol("Scope ID"), kTouchedIterator = Symbol.for("marko.touchedIterator"), { hasOwnProperty } = {}, objectProto = Object.prototype, arrayProto = Array.prototype, Generator = (function* () {})().constructor, AsyncGenerator = (async function* () {})().constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
7
+ }, 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, "\\x3C$1") : str, unsafeStyleReg = /<(\/style)/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str, unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, "&gt;") : str, K_SCOPE_ID = Symbol("Scope ID"), kTouchedIterator = Symbol.for("marko.touchedIterator"), { hasOwnProperty } = {}, objectProto = Object.prototype, arrayProto = Array.prototype, Generator = (function* () {})().constructor, AsyncGenerator = (async function* () {})().constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
8
8
  let KNOWN_SYMBOLS = /* @__PURE__ */ new Map();
9
9
  for (let name of Object.getOwnPropertyNames(Symbol)) {
10
10
  let symbol = Symbol[name];
@@ -278,7 +278,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
278
278
  };
279
279
  result = shouldResume ? withBranchId(branchId, render) : render(), rendered = _peek_scope_id() !== branchId, beforeBranch !== void 0 && (applyBranchStart(chunk, beforeBranch, rendered), _html(state.mark("]", scopeId + " " + accessor + (rendered ? " " + branchId : ""))));
280
280
  }
281
- return rendered ? shouldResume && writeScope(scopeId, { ["D" + accessor]: renderer?.a || renderer }) : _scope_id(), result;
281
+ return rendered ? shouldResume && writeScope(scopeId, { ["D" + accessor]: rendererKey(renderer) }) : _scope_id(), result;
282
282
  }, patchDynamicTag = ((originalDynamicTag) => (patch) => {
283
283
  _dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
284
284
  let patched = patch(tag, scopeId, accessor);
@@ -1263,6 +1263,9 @@ function getContext(key) {
1263
1263
  function getState() {
1264
1264
  return $chunk.boundary.state;
1265
1265
  }
1266
+ function rendererKey(renderer) {
1267
+ return renderer?.e === void 0 ? renderer?.a || renderer : renderer.a + " " + renderer.e;
1268
+ }
1266
1269
  function getScopeId(scope) {
1267
1270
  return scope[K_SCOPE_ID];
1268
1271
  }
@@ -1341,7 +1344,7 @@ function _attr_content(nodeAccessor, scopeId, content, serializeReason) {
1341
1344
  let shouldResume = serializeReason !== 0, render = normalizeServerRender(content), branchId = _peek_scope_id();
1342
1345
  render && (shouldResume ? withBranchId(branchId, render) : render()), _peek_scope_id() === branchId ? _scope_id() : shouldResume && writeScope(scopeId, {
1343
1346
  ["A" + nodeAccessor]: writeScope(branchId, {}),
1344
- ["D" + nodeAccessor]: render?.a
1347
+ ["D" + nodeAccessor]: rendererKey(render)
1345
1348
  });
1346
1349
  }
1347
1350
  function normalizeServerRender(value) {
@@ -1856,7 +1859,7 @@ function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange, seriali
1856
1859
  }
1857
1860
  function _textarea_value(value) {
1858
1861
  let escaped = _escape(normalizeStrAttrValue(value));
1859
- return escaped[0] === "\n" || escaped[0] === "\r" ? "\n" + escaped : escaped;
1862
+ return escaped[0] === "\n" ? "\n" + escaped : escaped;
1860
1863
  }
1861
1864
  function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
1862
1865
  return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _attr("value", value);
@@ -1993,11 +1996,11 @@ function normalizeStrAttrValue(value) {
1993
1996
  }
1994
1997
  //#endregion
1995
1998
  //#region src/html/dynamic-tag.ts
1996
- function _content(id, fn) {
1997
- return fn.a = id, fn;
1999
+ function _content(id, fn, scopeId) {
2000
+ return fn.a = id, fn.e = scopeId, fn;
1998
2001
  }
1999
2002
  function _content_resume(id, fn, scopeId) {
2000
- return _resume(_content(id, fn), id, scopeId);
2003
+ return _resume(_content(id, fn, scopeId), id, scopeId);
2001
2004
  }
2002
2005
  //#endregion
2003
2006
  //#region src/html/template.ts
@@ -2208,14 +2211,17 @@ function writeTriggerScript(html, triggers) {
2208
2211
  let htmlStr = _escape_script(JSON.stringify(html)), exprs = triggers.map((trigger) => {
2209
2212
  let options = trigger.options && toObjectExpression(trigger.options);
2210
2213
  switch (trigger.type) {
2211
- case "visible": return `(e=>e&&new IntersectionObserver((e,i)=>e.some(e=>e.isIntersecting)&&i.disconnect()+l()${options ? `,${options}` : ""}).observe(e))(document.querySelector(${JSON.stringify(trigger.selector)})||l())`;
2214
+ case "visible": return `(e=>e&&new IntersectionObserver((e,i)=>e.some(e=>e.isIntersecting)&&i.disconnect()+l()${options ? `,${options}` : ""}).observe(e))(${querySelectorOrLoad(trigger.selector)})`;
2212
2215
  case "idle": return `(self.requestIdleCallback||l)(l${options ? `,${options}` : ""})`;
2213
2216
  case "media": return `(m=>m.matches?l():m.addEventListener("change",l,{once:1}))(matchMedia(${JSON.stringify(trigger.selector)}))`;
2214
- default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(document.querySelector(${JSON.stringify(trigger.selector)})||l())`;
2217
+ default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(${querySelectorOrLoad(trigger.selector)})`;
2215
2218
  }
2216
2219
  });
2217
2220
  writeScript(`((p,h,d,l=$=>{d||p.after(new Range().createContextualFragment(d=h))})=>${exprs.length > 1 ? `{${exprs.join(";")}}` : exprs[0]})(document.currentScript,${htmlStr})`);
2218
2221
  }
2222
+ function querySelectorOrLoad(selector) {
2223
+ return `document.querySelector(${JSON.stringify(selector)})||l()`;
2224
+ }
2219
2225
  function toObjectExpression(options) {
2220
2226
  let result = "{", sep = "";
2221
2227
  for (let key in options) Object.hasOwn(options, key) && (result += sep + toObjectKey(key) + ":" + JSON.stringify(options[key]), sep = ",");