tutuca 0.11.2 → 0.12.0

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 (115) hide show
  1. package/dist/tutuca-cli.js +130 -104
  2. package/dist/tutuca-dev.ext.js +121 -90
  3. package/dist/tutuca-dev.js +121 -90
  4. package/dist/tutuca-dev.min.js +3 -3
  5. package/dist/tutuca-extra.ext.js +116 -59
  6. package/dist/tutuca-extra.js +116 -59
  7. package/dist/tutuca-extra.min.js +2 -2
  8. package/dist/tutuca-storybook.js +3 -3
  9. package/dist/tutuca.ext.js +116 -59
  10. package/dist/tutuca.js +116 -59
  11. package/dist/tutuca.min.js +2 -2
  12. package/package.json +1 -1
  13. package/skill/margaui/SKILL.md +105 -0
  14. package/skill/margaui/components/accordion.md +127 -0
  15. package/skill/margaui/components/alert.md +174 -0
  16. package/skill/margaui/components/aura.md +97 -0
  17. package/skill/margaui/components/avatar.md +220 -0
  18. package/skill/margaui/components/badge.md +193 -0
  19. package/skill/margaui/components/breadcrumbs.md +103 -0
  20. package/skill/margaui/components/button.md +322 -0
  21. package/skill/margaui/components/calendar.md +67 -0
  22. package/skill/margaui/components/card.md +373 -0
  23. package/skill/margaui/components/carousel.md +387 -0
  24. package/skill/margaui/components/chat.md +171 -0
  25. package/skill/margaui/components/checkbox.md +101 -0
  26. package/skill/margaui/components/collapse.md +172 -0
  27. package/skill/margaui/components/countdown.md +165 -0
  28. package/skill/margaui/components/diff.md +53 -0
  29. package/skill/margaui/components/divider.md +107 -0
  30. package/skill/margaui/components/dock.md +173 -0
  31. package/skill/margaui/components/drawer.md +184 -0
  32. package/skill/margaui/components/dropdown.md +388 -0
  33. package/skill/margaui/components/fab.md +346 -0
  34. package/skill/margaui/components/fieldset.md +88 -0
  35. package/skill/margaui/components/file-input.md +84 -0
  36. package/skill/margaui/components/filter.md +52 -0
  37. package/skill/margaui/components/footer.md +583 -0
  38. package/skill/margaui/components/hero.md +135 -0
  39. package/skill/margaui/components/hover-3d.md +129 -0
  40. package/skill/margaui/components/hover-gallery.md +49 -0
  41. package/skill/margaui/components/indicator.md +265 -0
  42. package/skill/margaui/components/input.md +389 -0
  43. package/skill/margaui/components/join.md +100 -0
  44. package/skill/margaui/components/kbd.md +127 -0
  45. package/skill/margaui/components/label.md +102 -0
  46. package/skill/margaui/components/link.md +96 -0
  47. package/skill/margaui/components/list.md +182 -0
  48. package/skill/margaui/components/loading.md +105 -0
  49. package/skill/margaui/components/mask.md +168 -0
  50. package/skill/margaui/components/megamenu.md +131 -0
  51. package/skill/margaui/components/menu.md +887 -0
  52. package/skill/margaui/components/mockup-browser.md +39 -0
  53. package/skill/margaui/components/mockup-code.md +81 -0
  54. package/skill/margaui/components/mockup-phone.md +39 -0
  55. package/skill/margaui/components/mockup-window.md +33 -0
  56. package/skill/margaui/components/modal.md +196 -0
  57. package/skill/margaui/components/navbar.md +282 -0
  58. package/skill/margaui/components/otp.md +171 -0
  59. package/skill/margaui/components/pagination.md +122 -0
  60. package/skill/margaui/components/progress.md +135 -0
  61. package/skill/margaui/components/radial-progress.md +67 -0
  62. package/skill/margaui/components/radio.md +133 -0
  63. package/skill/margaui/components/range.md +134 -0
  64. package/skill/margaui/components/rating.md +170 -0
  65. package/skill/margaui/components/select.md +225 -0
  66. package/skill/margaui/components/skeleton.md +64 -0
  67. package/skill/margaui/components/stack.md +142 -0
  68. package/skill/margaui/components/stat.md +254 -0
  69. package/skill/margaui/components/status.md +73 -0
  70. package/skill/margaui/components/steps.md +138 -0
  71. package/skill/margaui/components/swap.md +152 -0
  72. package/skill/margaui/components/tab.md +248 -0
  73. package/skill/margaui/components/table.md +1018 -0
  74. package/skill/margaui/components/text-rotate.md +91 -0
  75. package/skill/margaui/components/textarea.md +85 -0
  76. package/skill/margaui/components/theme-controller.md +266 -0
  77. package/skill/margaui/components/timeline.md +1356 -0
  78. package/skill/margaui/components/toast.md +165 -0
  79. package/skill/margaui/components/toggle.md +135 -0
  80. package/skill/margaui/components/tooltip.md +181 -0
  81. package/skill/margaui/components/validator.md +163 -0
  82. package/skill/tutuca/SKILL.md +56 -0
  83. package/skill/tutuca/advanced.md +212 -0
  84. package/skill/tutuca/cli.md +239 -0
  85. package/skill/tutuca/component-design.md +168 -0
  86. package/skill/tutuca/core.md +918 -0
  87. package/skill/tutuca/iteration.md +207 -0
  88. package/skill/tutuca/macros.md +86 -0
  89. package/skill/tutuca/margaui.md +175 -0
  90. package/skill/tutuca/messages-and-intents.md +399 -0
  91. package/skill/tutuca/patterns/README.md +48 -0
  92. package/skill/tutuca/patterns/add-a-story.md +26 -0
  93. package/skill/tutuca/patterns/bind-text-and-attributes.md +30 -0
  94. package/skill/tutuca/patterns/conditional-attribute-value.md +29 -0
  95. package/skill/tutuca/patterns/coordinate-components.md +54 -0
  96. package/skill/tutuca/patterns/edit-through-a-dynamic-target.md +27 -0
  97. package/skill/tutuca/patterns/enrich-each-item.md +25 -0
  98. package/skill/tutuca/patterns/file-input.md +39 -0
  99. package/skill/tutuca/patterns/filter-a-list.md +25 -0
  100. package/skill/tutuca/patterns/filter-and-paginate.md +60 -0
  101. package/skill/tutuca/patterns/handle-events.md +44 -0
  102. package/skill/tutuca/patterns/iterate-a-list.md +18 -0
  103. package/skill/tutuca/patterns/paginate-a-list.md +29 -0
  104. package/skill/tutuca/patterns/render-a-child-component.md +21 -0
  105. package/skill/tutuca/patterns/reuse-markup-with-macros.md +36 -0
  106. package/skill/tutuca/patterns/share-state-across-the-tree.md +38 -0
  107. package/skill/tutuca/patterns/show-or-hide-content.md +23 -0
  108. package/skill/tutuca/patterns/switch-between-views.md +30 -0
  109. package/skill/tutuca/patterns/tabbed-interface.md +43 -0
  110. package/skill/tutuca/semantics.md +195 -0
  111. package/skill/tutuca/storybook.md +270 -0
  112. package/skill/tutuca/styles.md +48 -0
  113. package/skill/tutuca/testing.md +345 -0
  114. package/skill/tutuca-source/SKILL.md +33 -0
  115. package/skill/tutuca-source/tutuca.ext.js +4301 -0
@@ -1561,6 +1561,14 @@ var init_path = __esm({
1561
1561
  }
1562
1562
  });
1563
1563
 
1564
+ // src/util/env.js
1565
+ var isMac;
1566
+ var init_env = __esm({
1567
+ "src/util/env.js"() {
1568
+ isMac = (globalThis.navigator?.userAgent ?? "").toLowerCase().includes("mac");
1569
+ }
1570
+ });
1571
+
1564
1572
  // src/value.js
1565
1573
  function sizeOf(v) {
1566
1574
  if (v == null) return null;
@@ -1570,6 +1578,9 @@ function sizeOf(v) {
1570
1578
  if (typeof l === "number") return l;
1571
1579
  return isPlainObject(v) ? Object.keys(v).length : null;
1572
1580
  }
1581
+ function getValue(e) {
1582
+ return e.target.type === "checkbox" ? e.target.checked : (e instanceof CustomEvent ? e.detail : e.target.value) ?? null;
1583
+ }
1573
1584
  function parseToken(s, px) {
1574
1585
  const c0 = s.charCodeAt(0);
1575
1586
  if (c0 === 39)
@@ -1609,6 +1620,10 @@ function parseToken(s, px) {
1609
1620
  const num = VALID_FLOAT_RE.test(s) ? parseFloat(s) : null;
1610
1621
  if (Number.isFinite(num)) return new ConstVal(num);
1611
1622
  if (s === "true" || s === "false") return new ConstVal(s === "true");
1623
+ if (c0 === 101) {
1624
+ const m = /^e(\.[a-zA-Z][a-zA-Z0-9_]*)+$/.exec(s);
1625
+ if (m !== null) return new EventMemberVal(s.split(".").slice(1));
1626
+ }
1612
1627
  if (c0 >= 97 && c0 <= 122) return mkVal(s, NameVal);
1613
1628
  if (c0 >= 65 && c0 <= 90) return mkVal(s, TypeVal);
1614
1629
  return null;
@@ -1684,7 +1699,7 @@ function _parseHandler(s, px, namespace, allowArgs, report, allowMethod) {
1684
1699
  const args = new Array(tokens.length - 1);
1685
1700
  for (let i = 1; i < tokens.length; i++) {
1686
1701
  const val = parseToken(tokens[i], px);
1687
- if (val !== null && kindOf(val) & G_VALUE) args[i - 1] = val;
1702
+ if (val !== null && kindOf(val) & G_HANDLER_ARG) args[i - 1] = val;
1688
1703
  else {
1689
1704
  if (report) px.onParseIssue("bad-value", { role: "handler-arg", value: tokens[i] });
1690
1705
  args[i - 1] = NULL_CONST_VAL;
@@ -1727,13 +1742,15 @@ function kindOf(val) {
1727
1742
  if (val instanceof DynVal) return K_DYN;
1728
1743
  if (val instanceof TypeVal) return K_TYPE;
1729
1744
  if (val instanceof NameVal) return K_NAME;
1745
+ if (val instanceof EventMemberVal) return K_EVENT;
1730
1746
  return 0;
1731
1747
  }
1732
- var VALID_VAL_ID_RE, isValidValId, VALID_FLOAT_RE, STR_TPL_SPLIT_RE, mkVal, VAL_TOKEN_RE, tokenizeValue, unescapeStr, K_CONST, K_STRTPL, K_FIELD, K_BIND, K_DYN, K_NAME, K_TYPE, K_SEQ, K_METHOD, G_BOOL, G_TEXT, G_COMPONENT, G_SEQUENCE, G_PROVIDE, G_FIELD, G_VALUE, G_ALL, predTruthy, PREDICATES, BaseVal, ConstVal, NULL_CONST_VAL, PredicateVal, VarVal, StrTplVal, NameVal, HandlerNameVal, mk404Handler, TypeVal, RenderVal, RenderNameVal, BindVal, BindMemberVal, DynVal, FieldVal, MethodVal, SeqAccessVal;
1748
+ var VALID_VAL_ID_RE, isValidValId, VALID_FLOAT_RE, STR_TPL_SPLIT_RE, mkVal, VAL_TOKEN_RE, tokenizeValue, unescapeStr, K_CONST, K_STRTPL, K_FIELD, K_BIND, K_DYN, K_NAME, K_TYPE, K_SEQ, K_METHOD, K_EVENT, G_BOOL, G_TEXT, G_COMPONENT, G_SEQUENCE, G_PROVIDE, G_FIELD, G_VALUE, G_HANDLER_ARG, G_ALL, toNullIfNaN, predTruthy, PREDICATES, BaseVal, ConstVal, NULL_CONST_VAL, PredicateVal, VarVal, StrTplVal, NameVal, HandlerNameVal, mk404Handler, TypeVal, keyIs, macCtrl, nullSafe, EVENT_CONVENIENCES, EventMemberVal, RenderVal, RenderNameVal, BindVal, BindMemberVal, DynVal, FieldVal, MethodVal, SeqAccessVal;
1733
1749
  var init_value = __esm({
1734
1750
  "src/value.js"() {
1735
1751
  init_collection();
1736
1752
  init_path();
1753
+ init_env();
1737
1754
  VALID_VAL_ID_RE = /^[a-zA-Z][a-zA-Z0-9_]*\??$/;
1738
1755
  isValidValId = (name) => VALID_VAL_ID_RE.test(name);
1739
1756
  VALID_FLOAT_RE = /^-?[0-9]+(\.[0-9]+)?$/;
@@ -1751,6 +1768,7 @@ var init_value = __esm({
1751
1768
  K_TYPE = 64;
1752
1769
  K_SEQ = 256;
1753
1770
  K_METHOD = 1024;
1771
+ K_EVENT = 2048;
1754
1772
  G_BOOL = K_FIELD | K_METHOD | K_BIND | K_DYN | K_CONST;
1755
1773
  G_TEXT = G_BOOL | K_STRTPL;
1756
1774
  G_COMPONENT = K_FIELD | K_SEQ | K_DYN;
@@ -1758,7 +1776,9 @@ var init_value = __esm({
1758
1776
  G_PROVIDE = K_FIELD | K_SEQ;
1759
1777
  G_FIELD = K_FIELD | K_METHOD | K_CONST | K_SEQ;
1760
1778
  G_VALUE = K_FIELD | K_METHOD | K_BIND | K_DYN | K_NAME | K_TYPE | K_CONST;
1779
+ G_HANDLER_ARG = G_VALUE & ~K_NAME | K_EVENT;
1761
1780
  G_ALL = G_VALUE | K_STRTPL | K_SEQ;
1781
+ toNullIfNaN = (v) => Number.isNaN(v) ? null : v;
1762
1782
  predTruthy = (v) => {
1763
1783
  const n = sizeOf(v);
1764
1784
  return n === null ? !!v : n > 0;
@@ -1892,11 +1912,14 @@ var init_value = __esm({
1892
1912
  this.namespace = namespace;
1893
1913
  }
1894
1914
  eval(stack) {
1895
- return stack.getHandlerFor(this.name, this.namespace) ?? mk404Handler(this.namespace, this.name);
1915
+ return stack.getHandlerFor(this.name, this.namespace) ?? mk404Handler(stack, this.namespace, this.name);
1896
1916
  }
1897
1917
  };
1898
- mk404Handler = (type3, name) => function(...args) {
1899
- console.warn("handler not found", { type: type3, name, args }, this);
1918
+ mk404Handler = (stack, type3, name) => function(...args) {
1919
+ const transactor = stack?.ctx?.transactor;
1920
+ if (transactor)
1921
+ transactor.refuse("NO_HANDLER", { namespace: type3, name, argCount: args.length });
1922
+ else console.warn("handler not found", { type: type3, name });
1900
1923
  return this;
1901
1924
  };
1902
1925
  TypeVal = class extends NameVal {
@@ -1904,6 +1927,53 @@ var init_value = __esm({
1904
1927
  return stack.lookupType(this.name);
1905
1928
  }
1906
1929
  };
1930
+ keyIs = (k) => (e) => e.key === k;
1931
+ macCtrl = (e) => isMac && e.metaKey || e.ctrlKey;
1932
+ nullSafe = (fn) => (e, stack) => {
1933
+ const info = stack.lookupDragInfo();
1934
+ return info == null ? null : fn(info);
1935
+ };
1936
+ EVENT_CONVENIENCES = {
1937
+ value: (e) => getValue(e),
1938
+ valueAsInt: (e) => toNullIfNaN(parseInt(getValue(e), 10)),
1939
+ valueAsFloat: (e) => toNullIfNaN(parseFloat(getValue(e))),
1940
+ isAlt: (e) => e.altKey,
1941
+ isShift: (e) => e.shiftKey,
1942
+ isCtrl: macCtrl,
1943
+ isCmd: macCtrl,
1944
+ isUpKey: keyIs("ArrowUp"),
1945
+ isDownKey: keyIs("ArrowDown"),
1946
+ isSend: keyIs("Enter"),
1947
+ isCancel: keyIs("Escape"),
1948
+ isTabKey: keyIs("Tab"),
1949
+ dragInfo: (_e, stack) => stack.lookupDragInfo(),
1950
+ dragType: nullSafe((info) => info.type),
1951
+ dragValue: nullSafe((info) => info.val),
1952
+ dragKey: nullSafe((info) => info.lookupBind("key"))
1953
+ };
1954
+ EventMemberVal = class extends BaseVal {
1955
+ constructor(members) {
1956
+ super();
1957
+ this.members = members;
1958
+ }
1959
+ eval(stack) {
1960
+ const e = stack.lookupEvent();
1961
+ if (e == null) return null;
1962
+ if (this.members.length === 1) {
1963
+ const convenience = EVENT_CONVENIENCES[this.members[0]];
1964
+ if (convenience !== void 0) return convenience(e, stack);
1965
+ }
1966
+ let v = e;
1967
+ for (const member of this.members) {
1968
+ if (v == null) return null;
1969
+ v = v[member];
1970
+ }
1971
+ return v ?? null;
1972
+ }
1973
+ toString() {
1974
+ return `e.${this.members.join(".")}`;
1975
+ }
1976
+ };
1907
1977
  RenderVal = class extends BaseVal {
1908
1978
  render(stack, _rx) {
1909
1979
  return this.eval(stack);
@@ -2861,14 +2931,6 @@ var init_renderer = __esm({
2861
2931
  }
2862
2932
  });
2863
2933
 
2864
- // src/util/env.js
2865
- var isMac;
2866
- var init_env = __esm({
2867
- "src/util/env.js"() {
2868
- isMac = (globalThis.navigator?.userAgent ?? "").toLowerCase().includes("mac");
2869
- }
2870
- });
2871
-
2872
2934
  // src/anode.js
2873
2935
  function resolveDynProducer(comp, name) {
2874
2936
  let producerComp, producerProvide;
@@ -6369,9 +6431,6 @@ function checkEventModifiers(lx, view) {
6369
6431
  }
6370
6432
  }
6371
6433
  }
6372
- function isKnownHandlerName(name) {
6373
- return KNOWN_HANDLER_NAMES.has(name);
6374
- }
6375
6434
  function checkKnownHandlerNames(lx, view, Comp, referencedAlters, referencedDynamics) {
6376
6435
  const env = mkAttrValEnv(Comp, referencedAlters, referencedDynamics);
6377
6436
  for (const event of view.ctx.events) {
@@ -6752,7 +6811,7 @@ function checkUnreferencedDynamics(lx, Comp, referencedDynamics) {
6752
6811
  }
6753
6812
  }
6754
6813
  }
6755
- var KNOWN_COMPONENT_SPEC_KEYS, EMPTY_SET, FRAMEWORK_WELL_KNOWN_EXTRAS, KNOWN_DIRECTIVE_NAMES, ALT_HANDLER_NOT_DEFINED, ALT_HANDLER_NOT_REFERENCED, DYN_VAL_NOT_DEFINED, DYN_ALIAS_NOT_REFERENCED, PROVIDE_NOT_ADDRESSABLE, LOOKUP_BAD_SHAPE, LOOKUP_TARGET_MALFORMED, RENDER_IT_OUTSIDE_OF_LOOP, UNKNOWN_EVENT_MODIFIER, UNKNOWN_HANDLER_ARG_NAME, RECEIVE_HANDLER_NOT_IMPLEMENTED, EVENT_HANDLER_METHOD_NOT_ALLOWED, HANDLER_NAME_COLLISION, FIELD_VAL_NOT_DEFINED, FIELD_VAL_IS_METHOD, METHOD_VAL_NOT_DEFINED, METHOD_VAL_IS_FIELD, DUPLICATE_ATTR_DEFINITION, IF_NO_BRANCH_SET, UNKNOWN_COMPONENT_NAME, UNKNOWN_MACRO_ARG, UNKNOWN_DIRECTIVE, UNKNOWN_X_OP, UNKNOWN_X_ATTR, X_OP_IGNORES_CHILDREN, MAYBE_DROP_AT_PREFIX, MAYBE_ADD_AT_PREFIX, BAD_VALUE, UNSUPPORTED_EXPR_SYNTAX, BINDING_MEMBER_TOO_DEEP, SUGGEST_BINDING_MEMBER, REDUNDANT_TEMPLATE_STRING, PLACEHOLDERLESS_TEMPLATE_STRING, CONSTANT_CONDITION, UNKNOWN_COMPONENT_SPEC_KEY, COMP_FIELD_BAD_SHAPE, ASYNC_HANDLER, TOP_LEVEL_AT_RULE_IN_SCOPED_STYLE, GLOBAL_SELECTOR_IN_SCOPED_STYLE, FIELD_METHOD_NAME_COLLISION, X_KNOWN_OP_NAMES, X_KNOWN_ATTR_NAMES, HOST_DIRECTIVE_ONLY_NAMES, LEVEL_WARN2, LEVEL_ERROR2, LEVEL_HINT, PARSE_ISSUES, BINDING_MEMBER_TOO_DEEP_RE, UNSUPPORTED_EXPR_GUIDANCE, HTML_LINT_OPTS, NO_WRAPPERS2, ANY_EVENT_MODIFIERS, KNOWN_HANDLER_NAMES, fixTo, BOOL_CONDITION_ORIGINS, isBoolConditionCtx, ATTR_VAL_CHECKERS, NODE_KIND_TO_CTX, HANDLER_CHANNELS, ASYNC_HANDLER_HELP, NON_NESTABLE_AT_RULE, GLOBAL_LEADING_SELECTOR, IGNORE_DIRECTIVE, blankRun, STYLE_TO_GLOBAL_HELP, KNOWN_LOOKUP_KEYS, LintContext, LintParseContext;
6814
+ var KNOWN_COMPONENT_SPEC_KEYS, EMPTY_SET, FRAMEWORK_WELL_KNOWN_EXTRAS, KNOWN_DIRECTIVE_NAMES, ALT_HANDLER_NOT_DEFINED, ALT_HANDLER_NOT_REFERENCED, DYN_VAL_NOT_DEFINED, DYN_ALIAS_NOT_REFERENCED, PROVIDE_NOT_ADDRESSABLE, LOOKUP_BAD_SHAPE, LOOKUP_TARGET_MALFORMED, RENDER_IT_OUTSIDE_OF_LOOP, UNKNOWN_EVENT_MODIFIER, RECEIVE_HANDLER_NOT_IMPLEMENTED, EVENT_HANDLER_METHOD_NOT_ALLOWED, HANDLER_NAME_COLLISION, FIELD_VAL_NOT_DEFINED, FIELD_VAL_IS_METHOD, METHOD_VAL_NOT_DEFINED, METHOD_VAL_IS_FIELD, DUPLICATE_ATTR_DEFINITION, IF_NO_BRANCH_SET, UNKNOWN_COMPONENT_NAME, UNKNOWN_MACRO_ARG, UNKNOWN_DIRECTIVE, UNKNOWN_X_OP, UNKNOWN_X_ATTR, X_OP_IGNORES_CHILDREN, MAYBE_DROP_AT_PREFIX, MAYBE_ADD_AT_PREFIX, BAD_VALUE, UNSUPPORTED_EXPR_SYNTAX, BINDING_MEMBER_TOO_DEEP, SUGGEST_BINDING_MEMBER, REDUNDANT_TEMPLATE_STRING, PLACEHOLDERLESS_TEMPLATE_STRING, CONSTANT_CONDITION, UNKNOWN_COMPONENT_SPEC_KEY, COMP_FIELD_BAD_SHAPE, ASYNC_HANDLER, TOP_LEVEL_AT_RULE_IN_SCOPED_STYLE, GLOBAL_SELECTOR_IN_SCOPED_STYLE, FIELD_METHOD_NAME_COLLISION, X_KNOWN_OP_NAMES, X_KNOWN_ATTR_NAMES, HOST_DIRECTIVE_ONLY_NAMES, LEVEL_WARN2, LEVEL_ERROR2, LEVEL_HINT, PARSE_ISSUES, BINDING_MEMBER_TOO_DEEP_RE, UNSUPPORTED_EXPR_GUIDANCE, HTML_LINT_OPTS, NO_WRAPPERS2, ANY_EVENT_MODIFIERS, fixTo, BOOL_CONDITION_ORIGINS, isBoolConditionCtx, ATTR_VAL_CHECKERS, NODE_KIND_TO_CTX, HANDLER_CHANNELS, ASYNC_HANDLER_HELP, NON_NESTABLE_AT_RULE, GLOBAL_LEADING_SELECTOR, IGNORE_DIRECTIVE, blankRun, STYLE_TO_GLOBAL_HELP, KNOWN_LOOKUP_KEYS, LintContext, LintParseContext;
6756
6815
  var init_lint_check = __esm({
6757
6816
  "tools/core/lint-check.js"() {
6758
6817
  init_anode();
@@ -6789,7 +6848,6 @@ var init_lint_check = __esm({
6789
6848
  LOOKUP_TARGET_MALFORMED = "LOOKUP_TARGET_MALFORMED";
6790
6849
  RENDER_IT_OUTSIDE_OF_LOOP = "RENDER_IT_OUTSIDE_OF_LOOP";
6791
6850
  UNKNOWN_EVENT_MODIFIER = "UNKNOWN_EVENT_MODIFIER";
6792
- UNKNOWN_HANDLER_ARG_NAME = "UNKNOWN_HANDLER_ARG_NAME";
6793
6851
  RECEIVE_HANDLER_NOT_IMPLEMENTED = "RECEIVE_HANDLER_NOT_IMPLEMENTED";
6794
6852
  EVENT_HANDLER_METHOD_NOT_ALLOWED = "EVENT_HANDLER_METHOD_NOT_ALLOWED";
6795
6853
  HANDLER_NAME_COLLISION = "HANDLER_NAME_COLLISION";
@@ -6864,26 +6922,6 @@ var init_lint_check = __esm({
6864
6922
  ...Object.keys(MOD_WRAPPERS_FOR_ANY_EVENT),
6865
6923
  ...Object.keys(MOD_EFFECTS)
6866
6924
  ];
6867
- KNOWN_HANDLER_NAMES = /* @__PURE__ */ new Set([
6868
- "value",
6869
- "valueAsInt",
6870
- "valueAsFloat",
6871
- "target",
6872
- "event",
6873
- "isAlt",
6874
- "isShift",
6875
- "isCtrl",
6876
- "isCmd",
6877
- "key",
6878
- "keyCode",
6879
- "isUpKey",
6880
- "isDownKey",
6881
- "isSend",
6882
- "isCancel",
6883
- "isTabKey",
6884
- "ctx",
6885
- "dragInfo"
6886
- ]);
6887
6925
  fixTo = (from, to) => ({ kind: "rewrite", from, to });
6888
6926
  BOOL_CONDITION_ORIGINS = /* @__PURE__ */ new Set(["@show", "@hide", "<x show>", "<x hide>"]);
6889
6927
  isBoolConditionCtx = (errCtx) => errCtx != null && (BOOL_CONDITION_ORIGINS.has(errCtx.originAttr) || errCtx.branch === "@if");
@@ -6934,10 +6972,11 @@ var init_lint_check = __esm({
6934
6972
  errCtx
6935
6973
  );
6936
6974
  },
6937
- NameVal({ lx, val, errCtx, skipNameVal }) {
6938
- if (!skipNameVal && !isKnownHandlerName(val.name))
6939
- reportUnknownName(lx, UNKNOWN_HANDLER_ARG_NAME, val.name, KNOWN_HANDLER_NAMES, errCtx);
6940
- },
6975
+ // NameVals on a macro call-site attribute are macro-param bindings, not
6976
+ // handler args — their role is determined inside the macro body after
6977
+ // ^-substitution, where re-parsing handles validation. No checker: a NameVal
6978
+ // can no longer reach a handler-arg slot (sigil-less words fail to parse),
6979
+ // and macro-attr pass-throughs are skipped via skipNameVal.
6941
6980
  StrTplVal({ lx, val, errCtx, recurse, isRoot }) {
6942
6981
  const vs = val.vals;
6943
6982
  const literal = val.toLiteralSource();
@@ -7157,12 +7196,6 @@ var init_lint_rules = __esm({
7157
7196
  group: "Templates / events",
7158
7197
  summary: "`@on.<event>+<mod>` uses a modifier not in the recognized set."
7159
7198
  },
7160
- {
7161
- code: UNKNOWN_HANDLER_ARG_NAME,
7162
- level: "error",
7163
- group: "Templates / events",
7164
- summary: "Handler argument name is not a built-in or a declared component."
7165
- },
7166
7199
  {
7167
7200
  code: DUPLICATE_ATTR_DEFINITION,
7168
7201
  level: "error",
@@ -7404,8 +7437,6 @@ function lintIdToMessage(id, info) {
7404
7437
  const written = `@on.${info.name}+${mods.join("+")}`;
7405
7438
  return `Unknown modifier '+${info.modifier}' in '${written}'`;
7406
7439
  }
7407
- case "UNKNOWN_HANDLER_ARG_NAME":
7408
- return `Unknown handler argument '${info.name}'${fmtOriginSuffix(info)}`;
7409
7440
  case "HANDLER_NAME_COLLISION":
7410
7441
  return `${info.problem} — ${info.fix}`;
7411
7442
  case "RECEIVE_HANDLER_NOT_IMPLEMENTED":
@@ -13039,8 +13070,19 @@ var init_stack = __esm({
13039
13070
  const fn = this.it[name];
13040
13071
  return fn instanceof Function ? fn.call(this.it) : null;
13041
13072
  }
13042
- lookupName(name) {
13043
- return this.ctx.lookupName(name);
13073
+ // Bare implicit event names are gone: a sigil-less word cannot reach a
13074
+ // handler-arg slot anymore, so this only ever serves stale NameVals parsed
13075
+ // before the removal (e.g. macro-attr pass-throughs). Always null.
13076
+ lookupName(_name) {
13077
+ return null;
13078
+ }
13079
+ // The dispatched DOM event / drag info, read only by EventMemberVal's
13080
+ // `e.<member>` handler args. Null outside a live event transaction.
13081
+ lookupEvent() {
13082
+ return this.ctx?.event ?? null;
13083
+ }
13084
+ lookupDragInfo() {
13085
+ return this.ctx?.dragInfo ?? null;
13044
13086
  }
13045
13087
  getHandlerFor(name, key) {
13046
13088
  return this.comps.getHandlerFor(this.it, name, key);
@@ -13404,23 +13446,19 @@ var init_oo = __esm({
13404
13446
  function nullHandler() {
13405
13447
  return this;
13406
13448
  }
13407
- function getValue(e) {
13408
- return e.target.type === "checkbox" ? e.target.checked : (e instanceof CustomEvent ? e.detail : e.target.value) ?? null;
13409
- }
13410
13449
  function warnNotIntent(verb) {
13411
13450
  console.warn(`ctx.${verb}() is only meaningful in an "intent" handler - ignored`);
13412
13451
  }
13413
13452
  function rootDispatcher(transactor) {
13414
13453
  return new Dispatcher(new Path([]), transactor, null);
13415
13454
  }
13416
- var State2, Transactor, Transaction, toNullIfNaN, InputEvent, NameArgsTransaction, SendEvent, IntentEvent, PASS, DEFAULT_ROUTE, INTENT_DEPTH, IntentWalk, Completion, Dispatcher, EventContext, IntentContext, PathChanges;
13455
+ var State2, Transactor, Transaction, InputEvent, NameArgsTransaction, SendEvent, IntentEvent, PASS, REFUSAL_RING_CAP, DEFAULT_ROUTE, INTENT_DEPTH, IntentWalk, Completion, Dispatcher, EventContext, IntentContext, PathChanges;
13417
13456
  var init_transactor = __esm({
13418
13457
  "src/transactor.js"() {
13419
13458
  init_immer2();
13420
13459
  init_oo();
13421
13460
  init_path();
13422
13461
  init_stack();
13423
- init_env();
13424
13462
  State2 = class {
13425
13463
  constructor(val) {
13426
13464
  this.val = val;
@@ -13446,6 +13484,8 @@ var init_transactor = __esm({
13446
13484
  this.onTransactionPushed = () => {
13447
13485
  };
13448
13486
  this._observers = [];
13487
+ this.refusals = [];
13488
+ this._refusalObservers = [];
13449
13489
  this._inflight = /* @__PURE__ */ new Set();
13450
13490
  }
13451
13491
  pushTransaction(t) {
@@ -13469,6 +13509,29 @@ var init_transactor = __esm({
13469
13509
  _emit(record) {
13470
13510
  for (const cb of this._observers) cb(record);
13471
13511
  }
13512
+ // Record a refusal: a dispatch the runtime could not carry out. Kinds are
13513
+ // open strings; today the runtime raises NO_HANDLER (a receive name with no
13514
+ // implementation, including the auto-generated fallback firing at dispatch
13515
+ // time) and FORWARD_NO_NAME (ctx.forward() from a handler whose view wrote
13516
+ // no name). Records carry { kind, info, timestamp } and are observational —
13517
+ // the dispatch itself has already failed gracefully.
13518
+ refuse(kind, info = {}) {
13519
+ const record = { kind, info, timestamp: Date.now() };
13520
+ this.refusals.push(record);
13521
+ if (this.refusals.length > REFUSAL_RING_CAP) this.refusals.shift();
13522
+ console.warn(`tutuca refusal [${kind}]`, info);
13523
+ for (const cb of this._refusalObservers) cb(record);
13524
+ return record;
13525
+ }
13526
+ // Subscribe to refusal records as they happen. Returns an unsubscribe fn,
13527
+ // like observe().
13528
+ observeRefusals(cb) {
13529
+ this._refusalObservers.push(cb);
13530
+ return () => {
13531
+ const i = this._refusalObservers.indexOf(cb);
13532
+ if (i !== -1) this._refusalObservers.splice(i, 1);
13533
+ };
13534
+ }
13472
13535
  // Build and dispatch the observer record for a settled transaction. The
13473
13536
  // resolved handler (`_resolvedHandler`/`_matched`) and per-leaf before/after
13474
13537
  // (`_before`/`_after`) were captured while the handler ran (see callHandler /
@@ -13631,11 +13694,7 @@ var init_transactor = __esm({
13631
13694
  this._completion?.markSelfSettled({ value: newLeaf, old: curLeaf });
13632
13695
  return curLeaf !== newLeaf ? txnPath.setValue(curRoot, newLeaf) : curRoot;
13633
13696
  }
13634
- lookupName(_name) {
13635
- return null;
13636
- }
13637
13697
  };
13638
- toNullIfNaN = (v) => Number.isNaN(v) ? null : v;
13639
13698
  InputEvent = class extends Transaction {
13640
13699
  constructor(path, e, handler, transactor, dragInfo) {
13641
13700
  super(path, transactor);
@@ -13673,8 +13732,10 @@ var init_transactor = __esm({
13673
13732
  const { args = this._handlerArgs ?? [], ...rest } = f;
13674
13733
  const hv = this.handler?.handlerCall?.handlerVal ?? this.handler?.handlerVal;
13675
13734
  const name = hv?.name;
13676
- if (name === void 0)
13677
- return console.warn("ctx.forward() from a handler with no name - ignored");
13735
+ if (name === void 0) {
13736
+ this.transactor.refuse("FORWARD_NO_NAME", {});
13737
+ return;
13738
+ }
13678
13739
  this.transactor.pushIntent(this.dispatchPath, name, args, rest, this);
13679
13740
  }
13680
13741
  buildRootStack(root, comps) {
@@ -13688,47 +13749,11 @@ var init_transactor = __esm({
13688
13749
  args.push(new EventContext(path, this.transactor, this));
13689
13750
  return [handler, args];
13690
13751
  }
13691
- lookupName(name) {
13692
- const { e } = this;
13693
- switch (name) {
13694
- case "value":
13695
- return getValue(e);
13696
- case "valueAsInt":
13697
- return toNullIfNaN(parseInt(getValue(e), 10));
13698
- case "valueAsFloat":
13699
- return toNullIfNaN(parseFloat(getValue(e)));
13700
- case "target":
13701
- return e.target;
13702
- case "event":
13703
- return e;
13704
- case "isAlt":
13705
- return e.altKey;
13706
- case "isShift":
13707
- return e.shiftKey;
13708
- case "isCtrl":
13709
- /* falls through */
13710
- case "isCmd":
13711
- return isMac && e.metaKey || e.ctrlKey;
13712
- case "key":
13713
- return e.key;
13714
- case "keyCode":
13715
- return e.keyCode;
13716
- case "isUpKey":
13717
- return e.key === "ArrowUp";
13718
- case "isDownKey":
13719
- return e.key === "ArrowDown";
13720
- case "isSend":
13721
- return e.key === "Enter";
13722
- case "isCancel":
13723
- return e.key === "Escape";
13724
- case "isTabKey":
13725
- return e.key === "Tab";
13726
- case "ctx":
13727
- return new EventContext(this.dispatchPath, this.transactor, this);
13728
- case "dragInfo":
13729
- return this.dragInfo;
13730
- }
13731
- return null;
13752
+ // The dispatched DOM event, read only through `e.<member>` handler args
13753
+ // (src/value.js EventMemberVal via Stack.lookupEvent). There is no bare
13754
+ // implicit-name vocabulary anymore: every arg carries a sigil.
13755
+ get event() {
13756
+ return this.e;
13732
13757
  }
13733
13758
  };
13734
13759
  NameArgsTransaction = class extends Transaction {
@@ -13819,6 +13844,7 @@ var init_transactor = __esm({
13819
13844
  }
13820
13845
  };
13821
13846
  PASS = /* @__PURE__ */ Symbol.for("tutuca.intent.pass");
13847
+ REFUSAL_RING_CAP = 200;
13822
13848
  DEFAULT_ROUTE = ["dyn", "lex"];
13823
13849
  INTENT_DEPTH = 64;
13824
13850
  IntentWalk = class {