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
@@ -35,6 +35,7 @@ const LoopKey = "#LoopKey";
35
35
  const PlaceholderContent = "#PlaceholderContent";
36
36
  const Renderer = "#Renderer";
37
37
  const TagVariable = "#TagVariable";
38
+ const Owner = "owner";
38
39
  const Embed = "embed";
39
40
  //#endregion
40
41
  //#region src/common/helpers.ts
@@ -224,10 +225,16 @@ function assertExclusiveAttrs(attrs, onError = throwErr) {
224
225
  (exclusiveAttrs ||= []).push("checkedValueChange");
225
226
  if ("checked" in attrs) exclusiveAttrs.push("checked");
226
227
  }
227
- if (attrs.valueChange) (exclusiveAttrs ||= []).push("valueChange");
228
+ if (attrs.valueChange) {
229
+ (exclusiveAttrs ||= []).push("valueChange");
230
+ if ("checked" in attrs && !exclusiveAttrs.includes("checked")) exclusiveAttrs.push("checked");
231
+ }
228
232
  if (exclusiveAttrs && exclusiveAttrs.length > 1) onError(`The attributes ${joinWithAnd(exclusiveAttrs)} are mutually exclusive.`);
229
233
  }
230
234
  }
235
+ function assertNoValueBindingOnCheckable(type, valueChange) {
236
+ if (valueChange && /^(?:button|checkbox|hidden|image|radio|reset|submit)$/i.test(type)) console.error(`\`valueChange\` cannot be used on a \`type="${type}"\` \`<input>\` — user interaction can never change its \`value\`.` + (/^[cr]/i.test(type) ? " Bind `checked` or `checkedValue` instead." : ""));
237
+ }
231
238
  function assertHandlerIsFunction(name, value) {
232
239
  if (value && typeof value !== "function") throw new Error(`The \`${name}\` handler must be a function or a falsey value (\`null\`, \`undefined\`, \`false\`, \`0\`, …), but received type "${typeof value}".`);
233
240
  }
@@ -258,8 +265,8 @@ function _unescaped(val) {
258
265
  assertValidTextValue(val);
259
266
  return val ? val + "" : val === 0 ? "0" : "";
260
267
  }
261
- const unsafeXMLReg = /[<&]/g;
262
- const replaceUnsafeXML = (c) => c === "&" ? "&amp;" : "&lt;";
268
+ const unsafeXMLReg = /[<&\r]/g;
269
+ const replaceUnsafeXML = (c) => c === "&" ? "&amp;" : c === "<" ? "&lt;" : "&#13;";
263
270
  const escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
264
271
  function _escape(val) {
265
272
  assertValidTextValue(val);
@@ -572,7 +579,18 @@ function setDebugInfo(obj, file, loc, vars) {
572
579
  DEBUG.set(obj, {
573
580
  file,
574
581
  loc,
575
- vars
582
+ vars,
583
+ slots: DEBUG.get(obj)?.slots
584
+ });
585
+ }
586
+ function setDebugSlotName(obj, accessor, name) {
587
+ const debug = DEBUG.get(obj);
588
+ if (debug) (debug.slots ??= {})[accessor] = name;
589
+ else DEBUG.set(obj, {
590
+ file: "",
591
+ loc: 0,
592
+ vars: void 0,
593
+ slots: { [accessor]: name }
576
594
  });
577
595
  }
578
596
  var Serializer = class {
@@ -1471,21 +1489,27 @@ function throwUnserializable(state, cause, ref = null, accessor = "") {
1471
1489
  if (cause !== void 0 && state.boundary?.abort) {
1472
1490
  let message = "Unable to serialize";
1473
1491
  let access = "";
1474
- while (ref?.accessor) {
1492
+ while (ref) {
1493
+ const { accessor } = ref;
1475
1494
  const debug = ref.parent?.debug;
1476
- if (debug) {
1477
- const varLoc = debug.vars?.[ref.accessor];
1478
- let debugAccess = ref.accessor;
1495
+ if (accessor && debug) {
1496
+ const rawAccessor = fromObjectKey(accessor);
1497
+ const varLoc = debug.vars?.[rawAccessor];
1498
+ const slotName = debug.slots?.[rawAccessor];
1499
+ let debugAccess = varLoc ? rawAccessor : void 0;
1479
1500
  let debugLoc = debug.loc;
1480
1501
  if (varLoc) if (Array.isArray(varLoc)) {
1481
1502
  debugAccess = varLoc[0];
1482
1503
  if (varLoc[1]) debugLoc = varLoc[1];
1483
1504
  } else debugLoc = varLoc;
1484
- message += ` ${JSON.stringify(debugAccess)} in ${debug.file}`;
1505
+ let display;
1506
+ if (debugAccess !== void 0) display = slotName && debugAccess.startsWith("...") ? `\`${slotName}\` from \`${debugAccess}\`` : JSON.stringify(debugAccess);
1507
+ else display = describeAccessor(rawAccessor, slotName) ?? JSON.stringify(rawAccessor);
1508
+ message += ` ${display} in ${debug.file}`;
1485
1509
  if (debugLoc) message += `:${debugLoc}`;
1486
1510
  break;
1487
1511
  }
1488
- access = toAccess(ref.accessor) + access;
1512
+ if (accessor) access = toAccess(accessor) + access;
1489
1513
  ref = ref.parent;
1490
1514
  }
1491
1515
  if (accessor) access = toAccess(accessor) + access;
@@ -1497,6 +1521,40 @@ function throwUnserializable(state, cause, ref = null, accessor = "") {
1497
1521
  state.boundary.abort(err);
1498
1522
  }
1499
1523
  }
1524
+ const accessorPrefixDescriptions = {
1525
+ BranchScopes: "the branch scopes",
1526
+ ClosureScopes: "the closure scopes",
1527
+ ClosureSignalIndex: "the closure signal index",
1528
+ ConditionalRenderer: "the conditional renderer",
1529
+ ControlledObserver: "the controlled observer",
1530
+ ControlledHandler: "the change handler",
1531
+ ControlledType: "the controlled type",
1532
+ ControlledValue: "the controlled value",
1533
+ DynamicHTMLLastChild: "the dynamic html",
1534
+ EventAttributes: "the event handlers",
1535
+ IdFallback: "the generated id",
1536
+ KeyedScopes: "the keyed scopes",
1537
+ Lifecycle: "the lifecycle handlers",
1538
+ Promise: "the pending promise",
1539
+ TagVariableChange: "the tag variable change handler"
1540
+ };
1541
+ function describeAccessor(accessor, slotName) {
1542
+ const sep = accessor.indexOf(":");
1543
+ if (~sep) {
1544
+ const description = slotName === void 0 ? accessorPrefixDescriptions[accessor.slice(0, sep)] : `the \`${slotName}\` handler`;
1545
+ if (description) {
1546
+ const node = /^#([a-z-]+)\//i.exec(accessor.slice(sep + 1));
1547
+ return node ? `${description} of \`<${node[1]}>\`` : description;
1548
+ }
1549
+ }
1550
+ }
1551
+ function fromObjectKey(key) {
1552
+ try {
1553
+ if (key[0] === "\"") return JSON.parse(key.replace(/\\x/g, "\\u00"));
1554
+ if (key[0] === "[") return JSON.parse(key.slice(1, -1));
1555
+ } catch {}
1556
+ return key;
1557
+ }
1500
1558
  function trackChannel(state, ref) {
1501
1559
  const refReadyId = ref.channel?.readyId;
1502
1560
  if (!refReadyId || refReadyId === state.channel?.readyId) return true;
@@ -1877,6 +1935,9 @@ function getContext(key) {
1877
1935
  function getState() {
1878
1936
  return $chunk.boundary.state;
1879
1937
  }
1938
+ function rendererKey(renderer) {
1939
+ return renderer?.["owner"] === void 0 ? renderer?.["id"] || renderer : renderer["id"] + " " + renderer[Owner];
1940
+ }
1880
1941
  function getScopeId(scope) {
1881
1942
  return scope[K_SCOPE_ID];
1882
1943
  }
@@ -1972,7 +2033,7 @@ function _attr_content(nodeAccessor, scopeId, content, serializeReason) {
1972
2033
  if (_peek_scope_id() !== branchId) {
1973
2034
  if (shouldResume) writeScope(scopeId, {
1974
2035
  [BranchScopes + nodeAccessor]: writeScope(branchId, {}),
1975
- [ConditionalRenderer + nodeAccessor]: render?.["id"]
2036
+ [ConditionalRenderer + nodeAccessor]: rendererKey(render)
1976
2037
  });
1977
2038
  } else _scope_id();
1978
2039
  }
@@ -2806,7 +2867,7 @@ function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange, seriali
2806
2867
  }
2807
2868
  function _textarea_value(value) {
2808
2869
  const escaped = _escape(normalizeStrAttrValue(value));
2809
- return escaped[0] === "\n" || escaped[0] === "\r" ? "\n" + escaped : escaped;
2870
+ return escaped[0] === "\n" ? "\n" + escaped : escaped;
2810
2871
  }
2811
2872
  function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
2812
2873
  if (valueChange) writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType);
@@ -2870,6 +2931,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
2870
2931
  result += _attr_input_checkedValue(scopeId, nodeAccessor, data.checkedValue, data.checkedValueChange, data.value, 1);
2871
2932
  skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/;
2872
2933
  } else if (data.valueChange) {
2934
+ assertNoValueBindingOnCheckable(data.type, data.valueChange);
2873
2935
  result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange, 1);
2874
2936
  skip = /^value(?:Change)?$|[\s/>"'=]/;
2875
2937
  }
@@ -2936,21 +2998,22 @@ function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, seri
2936
2998
  _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
2937
2999
  }
2938
3000
  function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
2939
- assertHandlerIsFunction([
3001
+ var handlerName = [
2940
3002
  "checkedChange",
2941
3003
  "checkedValueChange",
2942
3004
  "valueChange",
2943
3005
  "valueChange",
2944
3006
  "openChange"
2945
- ][type], valueChange);
2946
- writeScope(scopeId, serializeType ? {
3007
+ ][type];
3008
+ assertHandlerIsFunction(handlerName, valueChange);
3009
+ setDebugSlotName(writeScope(scopeId, serializeType ? {
2947
3010
  [ControlledType + nodeAccessor]: type,
2948
3011
  [ControlledValue + nodeAccessor]: value,
2949
3012
  [ControlledHandler + nodeAccessor]: valueChange
2950
3013
  } : {
2951
3014
  [ControlledValue + nodeAccessor]: value,
2952
3015
  [ControlledHandler + nodeAccessor]: valueChange
2953
- });
3016
+ }), ControlledHandler + nodeAccessor, handlerName);
2954
3017
  }
2955
3018
  function stringAttr(name, value) {
2956
3019
  return value && " " + name + attrAssignment(value);
@@ -3053,16 +3116,17 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
3053
3116
  }
3054
3117
  }
3055
3118
  if (rendered) {
3056
- if (shouldResume) writeScope(scopeId, { [ConditionalRenderer + accessor]: renderer?.["id"] || renderer });
3119
+ if (shouldResume) writeScope(scopeId, { [ConditionalRenderer + accessor]: rendererKey(renderer) });
3057
3120
  } else _scope_id();
3058
3121
  return result;
3059
3122
  };
3060
- function _content(id, fn) {
3123
+ function _content(id, fn, scopeId) {
3061
3124
  fn["id"] = id;
3125
+ fn[Owner] = scopeId;
3062
3126
  return fn;
3063
3127
  }
3064
3128
  function _content_resume(id, fn, scopeId) {
3065
- return _resume(_content(id, fn), id, scopeId);
3129
+ return _resume(_content(id, fn, scopeId), id, scopeId);
3066
3130
  }
3067
3131
  const patchDynamicTag = ((originalDynamicTag) => (patch) => {
3068
3132
  _dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
@@ -3383,14 +3447,17 @@ function writeTriggerScript(html, triggers) {
3383
3447
  const exprs = triggers.map((trigger) => {
3384
3448
  const options = trigger.options && toObjectExpression(trigger.options);
3385
3449
  switch (trigger.type) {
3386
- 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())`;
3450
+ case "visible": return `(e=>e&&new IntersectionObserver((e,i)=>e.some(e=>e.isIntersecting)&&i.disconnect()+l()${options ? `,${options}` : ""}).observe(e))(${querySelectorOrLoad(trigger.selector)})`;
3387
3451
  case "idle": return `(self.requestIdleCallback||l)(l${options ? `,${options}` : ""})`;
3388
3452
  case "media": return `(m=>m.matches?l():m.addEventListener("change",l,{once:1}))(matchMedia(${JSON.stringify(trigger.selector)}))`;
3389
- default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(document.querySelector(${JSON.stringify(trigger.selector)})||l())`;
3453
+ default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(${querySelectorOrLoad(trigger.selector)})`;
3390
3454
  }
3391
3455
  });
3392
3456
  writeScript(`((p,h,d,l=$=>{d||p.after(new Range().createContextualFragment(d=h))})=>${exprs.length > 1 ? `{${exprs.join(";")}}` : exprs[0]})(document.currentScript,${htmlStr})`);
3393
3457
  }
3458
+ function querySelectorOrLoad(selector) {
3459
+ return `document.querySelector(${JSON.stringify(selector)})||${`(console.warn(${JSON.stringify(`A lazy load trigger could not find an element matching "${selector}". The module was loaded immediately.`)}),l())`}`;
3460
+ }
3394
3461
  function toObjectExpression(options) {
3395
3462
  let result = "{";
3396
3463
  let sep = "";
@@ -33,6 +33,7 @@ const LoopKey = "#LoopKey";
33
33
  const PlaceholderContent = "#PlaceholderContent";
34
34
  const Renderer = "#Renderer";
35
35
  const TagVariable = "#TagVariable";
36
+ const Owner = "owner";
36
37
  const Embed = "embed";
37
38
  //#endregion
38
39
  //#region src/common/helpers.ts
@@ -222,10 +223,16 @@ function assertExclusiveAttrs(attrs, onError = throwErr) {
222
223
  (exclusiveAttrs ||= []).push("checkedValueChange");
223
224
  if ("checked" in attrs) exclusiveAttrs.push("checked");
224
225
  }
225
- if (attrs.valueChange) (exclusiveAttrs ||= []).push("valueChange");
226
+ if (attrs.valueChange) {
227
+ (exclusiveAttrs ||= []).push("valueChange");
228
+ if ("checked" in attrs && !exclusiveAttrs.includes("checked")) exclusiveAttrs.push("checked");
229
+ }
226
230
  if (exclusiveAttrs && exclusiveAttrs.length > 1) onError(`The attributes ${joinWithAnd(exclusiveAttrs)} are mutually exclusive.`);
227
231
  }
228
232
  }
233
+ function assertNoValueBindingOnCheckable(type, valueChange) {
234
+ if (valueChange && /^(?:button|checkbox|hidden|image|radio|reset|submit)$/i.test(type)) console.error(`\`valueChange\` cannot be used on a \`type="${type}"\` \`<input>\` — user interaction can never change its \`value\`.` + (/^[cr]/i.test(type) ? " Bind `checked` or `checkedValue` instead." : ""));
235
+ }
229
236
  function assertHandlerIsFunction(name, value) {
230
237
  if (value && typeof value !== "function") throw new Error(`The \`${name}\` handler must be a function or a falsey value (\`null\`, \`undefined\`, \`false\`, \`0\`, …), but received type "${typeof value}".`);
231
238
  }
@@ -256,8 +263,8 @@ function _unescaped(val) {
256
263
  assertValidTextValue(val);
257
264
  return val ? val + "" : val === 0 ? "0" : "";
258
265
  }
259
- const unsafeXMLReg = /[<&]/g;
260
- const replaceUnsafeXML = (c) => c === "&" ? "&amp;" : "&lt;";
266
+ const unsafeXMLReg = /[<&\r]/g;
267
+ const replaceUnsafeXML = (c) => c === "&" ? "&amp;" : c === "<" ? "&lt;" : "&#13;";
261
268
  const escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
262
269
  function _escape(val) {
263
270
  assertValidTextValue(val);
@@ -570,7 +577,18 @@ function setDebugInfo(obj, file, loc, vars) {
570
577
  DEBUG.set(obj, {
571
578
  file,
572
579
  loc,
573
- vars
580
+ vars,
581
+ slots: DEBUG.get(obj)?.slots
582
+ });
583
+ }
584
+ function setDebugSlotName(obj, accessor, name) {
585
+ const debug = DEBUG.get(obj);
586
+ if (debug) (debug.slots ??= {})[accessor] = name;
587
+ else DEBUG.set(obj, {
588
+ file: "",
589
+ loc: 0,
590
+ vars: void 0,
591
+ slots: { [accessor]: name }
574
592
  });
575
593
  }
576
594
  var Serializer = class {
@@ -1469,21 +1487,27 @@ function throwUnserializable(state, cause, ref = null, accessor = "") {
1469
1487
  if (cause !== void 0 && state.boundary?.abort) {
1470
1488
  let message = "Unable to serialize";
1471
1489
  let access = "";
1472
- while (ref?.accessor) {
1490
+ while (ref) {
1491
+ const { accessor } = ref;
1473
1492
  const debug = ref.parent?.debug;
1474
- if (debug) {
1475
- const varLoc = debug.vars?.[ref.accessor];
1476
- let debugAccess = ref.accessor;
1493
+ if (accessor && debug) {
1494
+ const rawAccessor = fromObjectKey(accessor);
1495
+ const varLoc = debug.vars?.[rawAccessor];
1496
+ const slotName = debug.slots?.[rawAccessor];
1497
+ let debugAccess = varLoc ? rawAccessor : void 0;
1477
1498
  let debugLoc = debug.loc;
1478
1499
  if (varLoc) if (Array.isArray(varLoc)) {
1479
1500
  debugAccess = varLoc[0];
1480
1501
  if (varLoc[1]) debugLoc = varLoc[1];
1481
1502
  } else debugLoc = varLoc;
1482
- message += ` ${JSON.stringify(debugAccess)} in ${debug.file}`;
1503
+ let display;
1504
+ if (debugAccess !== void 0) display = slotName && debugAccess.startsWith("...") ? `\`${slotName}\` from \`${debugAccess}\`` : JSON.stringify(debugAccess);
1505
+ else display = describeAccessor(rawAccessor, slotName) ?? JSON.stringify(rawAccessor);
1506
+ message += ` ${display} in ${debug.file}`;
1483
1507
  if (debugLoc) message += `:${debugLoc}`;
1484
1508
  break;
1485
1509
  }
1486
- access = toAccess(ref.accessor) + access;
1510
+ if (accessor) access = toAccess(accessor) + access;
1487
1511
  ref = ref.parent;
1488
1512
  }
1489
1513
  if (accessor) access = toAccess(accessor) + access;
@@ -1495,6 +1519,40 @@ function throwUnserializable(state, cause, ref = null, accessor = "") {
1495
1519
  state.boundary.abort(err);
1496
1520
  }
1497
1521
  }
1522
+ const accessorPrefixDescriptions = {
1523
+ BranchScopes: "the branch scopes",
1524
+ ClosureScopes: "the closure scopes",
1525
+ ClosureSignalIndex: "the closure signal index",
1526
+ ConditionalRenderer: "the conditional renderer",
1527
+ ControlledObserver: "the controlled observer",
1528
+ ControlledHandler: "the change handler",
1529
+ ControlledType: "the controlled type",
1530
+ ControlledValue: "the controlled value",
1531
+ DynamicHTMLLastChild: "the dynamic html",
1532
+ EventAttributes: "the event handlers",
1533
+ IdFallback: "the generated id",
1534
+ KeyedScopes: "the keyed scopes",
1535
+ Lifecycle: "the lifecycle handlers",
1536
+ Promise: "the pending promise",
1537
+ TagVariableChange: "the tag variable change handler"
1538
+ };
1539
+ function describeAccessor(accessor, slotName) {
1540
+ const sep = accessor.indexOf(":");
1541
+ if (~sep) {
1542
+ const description = slotName === void 0 ? accessorPrefixDescriptions[accessor.slice(0, sep)] : `the \`${slotName}\` handler`;
1543
+ if (description) {
1544
+ const node = /^#([a-z-]+)\//i.exec(accessor.slice(sep + 1));
1545
+ return node ? `${description} of \`<${node[1]}>\`` : description;
1546
+ }
1547
+ }
1548
+ }
1549
+ function fromObjectKey(key) {
1550
+ try {
1551
+ if (key[0] === "\"") return JSON.parse(key.replace(/\\x/g, "\\u00"));
1552
+ if (key[0] === "[") return JSON.parse(key.slice(1, -1));
1553
+ } catch {}
1554
+ return key;
1555
+ }
1498
1556
  function trackChannel(state, ref) {
1499
1557
  const refReadyId = ref.channel?.readyId;
1500
1558
  if (!refReadyId || refReadyId === state.channel?.readyId) return true;
@@ -1875,6 +1933,9 @@ function getContext(key) {
1875
1933
  function getState() {
1876
1934
  return $chunk.boundary.state;
1877
1935
  }
1936
+ function rendererKey(renderer) {
1937
+ return renderer?.["owner"] === void 0 ? renderer?.["id"] || renderer : renderer["id"] + " " + renderer[Owner];
1938
+ }
1878
1939
  function getScopeId(scope) {
1879
1940
  return scope[K_SCOPE_ID];
1880
1941
  }
@@ -1970,7 +2031,7 @@ function _attr_content(nodeAccessor, scopeId, content, serializeReason) {
1970
2031
  if (_peek_scope_id() !== branchId) {
1971
2032
  if (shouldResume) writeScope(scopeId, {
1972
2033
  [BranchScopes + nodeAccessor]: writeScope(branchId, {}),
1973
- [ConditionalRenderer + nodeAccessor]: render?.["id"]
2034
+ [ConditionalRenderer + nodeAccessor]: rendererKey(render)
1974
2035
  });
1975
2036
  } else _scope_id();
1976
2037
  }
@@ -2804,7 +2865,7 @@ function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange, seriali
2804
2865
  }
2805
2866
  function _textarea_value(value) {
2806
2867
  const escaped = _escape(normalizeStrAttrValue(value));
2807
- return escaped[0] === "\n" || escaped[0] === "\r" ? "\n" + escaped : escaped;
2868
+ return escaped[0] === "\n" ? "\n" + escaped : escaped;
2808
2869
  }
2809
2870
  function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
2810
2871
  if (valueChange) writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType);
@@ -2868,6 +2929,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
2868
2929
  result += _attr_input_checkedValue(scopeId, nodeAccessor, data.checkedValue, data.checkedValueChange, data.value, 1);
2869
2930
  skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/;
2870
2931
  } else if (data.valueChange) {
2932
+ assertNoValueBindingOnCheckable(data.type, data.valueChange);
2871
2933
  result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange, 1);
2872
2934
  skip = /^value(?:Change)?$|[\s/>"'=]/;
2873
2935
  }
@@ -2934,21 +2996,22 @@ function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, seri
2934
2996
  _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
2935
2997
  }
2936
2998
  function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
2937
- assertHandlerIsFunction([
2999
+ var handlerName = [
2938
3000
  "checkedChange",
2939
3001
  "checkedValueChange",
2940
3002
  "valueChange",
2941
3003
  "valueChange",
2942
3004
  "openChange"
2943
- ][type], valueChange);
2944
- writeScope(scopeId, serializeType ? {
3005
+ ][type];
3006
+ assertHandlerIsFunction(handlerName, valueChange);
3007
+ setDebugSlotName(writeScope(scopeId, serializeType ? {
2945
3008
  [ControlledType + nodeAccessor]: type,
2946
3009
  [ControlledValue + nodeAccessor]: value,
2947
3010
  [ControlledHandler + nodeAccessor]: valueChange
2948
3011
  } : {
2949
3012
  [ControlledValue + nodeAccessor]: value,
2950
3013
  [ControlledHandler + nodeAccessor]: valueChange
2951
- });
3014
+ }), ControlledHandler + nodeAccessor, handlerName);
2952
3015
  }
2953
3016
  function stringAttr(name, value) {
2954
3017
  return value && " " + name + attrAssignment(value);
@@ -3051,16 +3114,17 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
3051
3114
  }
3052
3115
  }
3053
3116
  if (rendered) {
3054
- if (shouldResume) writeScope(scopeId, { [ConditionalRenderer + accessor]: renderer?.["id"] || renderer });
3117
+ if (shouldResume) writeScope(scopeId, { [ConditionalRenderer + accessor]: rendererKey(renderer) });
3055
3118
  } else _scope_id();
3056
3119
  return result;
3057
3120
  };
3058
- function _content(id, fn) {
3121
+ function _content(id, fn, scopeId) {
3059
3122
  fn["id"] = id;
3123
+ fn[Owner] = scopeId;
3060
3124
  return fn;
3061
3125
  }
3062
3126
  function _content_resume(id, fn, scopeId) {
3063
- return _resume(_content(id, fn), id, scopeId);
3127
+ return _resume(_content(id, fn, scopeId), id, scopeId);
3064
3128
  }
3065
3129
  const patchDynamicTag = ((originalDynamicTag) => (patch) => {
3066
3130
  _dynamic_tag = (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
@@ -3381,14 +3445,17 @@ function writeTriggerScript(html, triggers) {
3381
3445
  const exprs = triggers.map((trigger) => {
3382
3446
  const options = trigger.options && toObjectExpression(trigger.options);
3383
3447
  switch (trigger.type) {
3384
- 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())`;
3448
+ case "visible": return `(e=>e&&new IntersectionObserver((e,i)=>e.some(e=>e.isIntersecting)&&i.disconnect()+l()${options ? `,${options}` : ""}).observe(e))(${querySelectorOrLoad(trigger.selector)})`;
3385
3449
  case "idle": return `(self.requestIdleCallback||l)(l${options ? `,${options}` : ""})`;
3386
3450
  case "media": return `(m=>m.matches?l():m.addEventListener("change",l,{once:1}))(matchMedia(${JSON.stringify(trigger.selector)}))`;
3387
- default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(document.querySelector(${JSON.stringify(trigger.selector)})||l())`;
3451
+ default: return `(e=>e?.addEventListener("${trigger.type.slice(3)}",l,{once:1}))(${querySelectorOrLoad(trigger.selector)})`;
3388
3452
  }
3389
3453
  });
3390
3454
  writeScript(`((p,h,d,l=$=>{d||p.after(new Range().createContextualFragment(d=h))})=>${exprs.length > 1 ? `{${exprs.join(";")}}` : exprs[0]})(document.currentScript,${htmlStr})`);
3391
3455
  }
3456
+ function querySelectorOrLoad(selector) {
3457
+ return `document.querySelector(${JSON.stringify(selector)})||${`(console.warn(${JSON.stringify(`A lazy load trigger could not find an element matching "${selector}". The module was loaded immediately.`)}),l())`}`;
3458
+ }
3392
3459
  function toObjectExpression(options) {
3393
3460
  let result = "{";
3394
3461
  let sep = "";
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-B-XpL2_H.js"), handlePendingTry = (fn, scope, branch) => {
1
+ let require_control_flow = require("../dom-BeF9xIzO.js"), handlePendingTry = (fn, scope, branch) => {
2
2
  for (; branch;) {
3
3
  if (branch.O?.i) return (branch.J ||= []).push(fn, scope);
4
4
  branch = branch.N;
@@ -4,7 +4,7 @@ let handlePendingTry = (fn, scope, branch) => {
4
4
  branch = branch.N;
5
5
  }
6
6
  };
7
- import { Jt as caughtError, Xt as placeholderShown, Yt as installCatch, h as renderCatch } from "../dom-6hBvZW7X.mjs";
7
+ import { Jt as caughtError, Xt as placeholderShown, Yt as installCatch, h as renderCatch } from "../dom-BP2XSglG.mjs";
8
8
  //#region src/dom/catch.feat.ts
9
9
  installCatch((runEffects) => (effects, checkPending = placeholderShown.has(effects)) => {
10
10
  if (checkPending || caughtError.has(effects)) {
@@ -11,6 +11,7 @@ export declare function _try(nodeAccessor: EncodedAccessor, template?: string |
11
11
  export declare function renderCatch(scope: Scope, error: unknown): void;
12
12
  export declare const _if: (nodeAccessor: EncodedAccessor, ...branchesArgs: (string | SetupFn | 0)[]) => (scope: Scope, newBranch: number) => void;
13
13
  export declare const _show: (nodeAccessor: EncodedAccessor, startNodeAccessor?: EncodedAccessor, endNodeAccessor?: EncodedAccessor) => (scope: Scope, display: unknown) => void;
14
+ export declare function rendererKey(renderer: Renderer | string | undefined): string | Renderer | undefined;
14
15
  export declare function patchDynamicTag(fn: <T extends typeof _dynamic_tag>(cond: T) => T): void;
15
16
  export declare let _dynamic_tag: (nodeAccessor: EncodedAccessor, getContent?: ((scope: Scope) => Renderer) | 0, getTagVar?: (() => Signal<unknown>) | 0, inputIsArgs?: 1) => Signal<Renderer | string | undefined>;
16
17
  export declare const _dynamic_tag_content: (nodeAccessor: EncodedAccessor) => Signal<Renderer | undefined>;
@@ -1,3 +1,3 @@
1
- let require_control_flow = require("../dom-B-XpL2_H.js");
1
+ let require_control_flow = require("../dom-BeF9xIzO.js");
2
2
  require_control_flow.R[0] = require_control_flow.w, require_control_flow.R[1] = require_control_flow.S, require_control_flow.R[2] = require_control_flow.k;
3
3
  //#endregion
@@ -1,3 +1,3 @@
1
- import { R as controllableScripts, S as _attr_input_checkedValue_script, k as _attr_input_value_script, w as _attr_input_checked_script } from "../dom-6hBvZW7X.mjs";
1
+ import { R as controllableScripts, S as _attr_input_checkedValue_script, k as _attr_input_value_script, w as _attr_input_checked_script } from "../dom-BP2XSglG.mjs";
2
2
  controllableScripts[0] = _attr_input_checked_script, controllableScripts[1] = _attr_input_checkedValue_script, controllableScripts[2] = _attr_input_value_script;
3
3
  //#endregion
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-B-XpL2_H.js");
1
+ let require_control_flow = require("../dom-BeF9xIzO.js");
2
2
  //#region src/dom/controllable-open.feat.ts
3
3
  require_control_flow.R[4] = require_control_flow.v;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { R as controllableScripts, v as _attr_details_or_dialog_open_script } from "../dom-6hBvZW7X.mjs";
1
+ import { R as controllableScripts, v as _attr_details_or_dialog_open_script } from "../dom-BP2XSglG.mjs";
2
2
  //#region src/dom/controllable-open.feat.ts
3
3
  controllableScripts[4] = _attr_details_or_dialog_open_script;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-B-XpL2_H.js");
1
+ let require_control_flow = require("../dom-BeF9xIzO.js");
2
2
  //#region src/dom/controllable-select.feat.ts
3
3
  require_control_flow.R[3] = require_control_flow.M;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { M as _attr_select_value_script, R as controllableScripts } from "../dom-6hBvZW7X.mjs";
1
+ import { M as _attr_select_value_script, R as controllableScripts } from "../dom-BP2XSglG.mjs";
2
2
  //#region src/dom/controllable-select.feat.ts
3
3
  controllableScripts[3] = _attr_select_value_script;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-B-XpL2_H.js");
1
+ let require_control_flow = require("../dom-BeF9xIzO.js");
2
2
  //#region src/dom/controllable-textarea.feat.ts
3
3
  require_control_flow.R[2] = require_control_flow.k;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { R as controllableScripts, k as _attr_input_value_script } from "../dom-6hBvZW7X.mjs";
1
+ import { R as controllableScripts, k as _attr_input_value_script } from "../dom-BP2XSglG.mjs";
2
2
  //#region src/dom/controllable-textarea.feat.ts
3
3
  controllableScripts[2] = _attr_input_value_script;
4
4
  //#endregion
@@ -1,3 +1,3 @@
1
- let require_control_flow = require("../dom-B-XpL2_H.js");
1
+ let require_control_flow = require("../dom-BeF9xIzO.js");
2
2
  require("./controllable-input.feat.js"), require("./controllable-open.feat.js"), require("./controllable-select.feat.js"), require_control_flow.L.INPUT = require_control_flow.N, require_control_flow.L.TEXTAREA = require_control_flow.I, require_control_flow.L.SELECT = require_control_flow.F, require_control_flow.L.DETAILS = require_control_flow.L.DIALOG = require_control_flow.P;
3
3
  //#endregion
@@ -1,4 +1,4 @@
1
- import { F as _controllable_select, I as _controllable_textarea, L as controllableRenders, N as _controllable_input, P as _controllable_open } from "../dom-6hBvZW7X.mjs";
1
+ import { F as _controllable_select, I as _controllable_textarea, L as controllableRenders, N as _controllable_input, P as _controllable_open } from "../dom-BP2XSglG.mjs";
2
2
  import "./controllable-input.feat.mjs";
3
3
  import "./controllable-open.feat.mjs";
4
4
  import "./controllable-select.feat.mjs";
@@ -1,4 +1,4 @@
1
- import { type Accessor, AccessorProp, type EncodedAccessor, type Scope } from "../common/types";
1
+ import { type Accessor, type EncodedAccessor, type Scope } from "../common/types";
2
2
  export type SignalFn = (scope: Scope) => void;
3
3
  export type Signal<T = unknown, U extends Scope = Scope> = (scope: U, value: T) => void;
4
4
  export declare function _let<T>(id: EncodedAccessor, fn?: SignalFn): (scope: Scope, value: T) => T;
@@ -24,10 +24,10 @@ export declare function _var(scope: Scope, childAccessor: EncodedAccessor, signa
24
24
  export declare const _return: (scope: Scope, value: unknown) => any;
25
25
  export declare function _return_change(scope: Scope, changeHandler?: ((value: unknown) => void) | null | false): void;
26
26
  export declare const _var_change: (scope: Scope, value: unknown, name?: string) => void;
27
- export declare function _id({ [AccessorProp.Global]: $global }: Scope): string;
27
+ export declare function _id(scope: Scope, accessor?: Accessor): string;
28
28
  export declare function _script(id: string, fn: (scope: Scope) => void): (scope: Scope) => void;
29
29
  export declare function _el_read<T>(value: T): T;
30
- type Hoistable<T> = () => T;
30
+ type Hoistable<T> = (...args: unknown[]) => T;
31
31
  type Hoisted<T> = Hoistable<T> & Iterable<T>;
32
32
  export declare function _hoist<T>(...path: Accessor[]): (scope: Scope) => Hoisted<T>;
33
33
  export declare function _hoist_resume<T>(id: string, ...path: Accessor[]): (scope: Scope) => Hoisted<T>;