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.
- package/dist/tutuca-cli.js +130 -104
- package/dist/tutuca-dev.ext.js +121 -90
- package/dist/tutuca-dev.js +121 -90
- package/dist/tutuca-dev.min.js +3 -3
- package/dist/tutuca-extra.ext.js +116 -59
- package/dist/tutuca-extra.js +116 -59
- package/dist/tutuca-extra.min.js +2 -2
- package/dist/tutuca-storybook.js +3 -3
- package/dist/tutuca.ext.js +116 -59
- package/dist/tutuca.js +116 -59
- package/dist/tutuca.min.js +2 -2
- package/package.json +1 -1
- package/skill/margaui/SKILL.md +105 -0
- package/skill/margaui/components/accordion.md +127 -0
- package/skill/margaui/components/alert.md +174 -0
- package/skill/margaui/components/aura.md +97 -0
- package/skill/margaui/components/avatar.md +220 -0
- package/skill/margaui/components/badge.md +193 -0
- package/skill/margaui/components/breadcrumbs.md +103 -0
- package/skill/margaui/components/button.md +322 -0
- package/skill/margaui/components/calendar.md +67 -0
- package/skill/margaui/components/card.md +373 -0
- package/skill/margaui/components/carousel.md +387 -0
- package/skill/margaui/components/chat.md +171 -0
- package/skill/margaui/components/checkbox.md +101 -0
- package/skill/margaui/components/collapse.md +172 -0
- package/skill/margaui/components/countdown.md +165 -0
- package/skill/margaui/components/diff.md +53 -0
- package/skill/margaui/components/divider.md +107 -0
- package/skill/margaui/components/dock.md +173 -0
- package/skill/margaui/components/drawer.md +184 -0
- package/skill/margaui/components/dropdown.md +388 -0
- package/skill/margaui/components/fab.md +346 -0
- package/skill/margaui/components/fieldset.md +88 -0
- package/skill/margaui/components/file-input.md +84 -0
- package/skill/margaui/components/filter.md +52 -0
- package/skill/margaui/components/footer.md +583 -0
- package/skill/margaui/components/hero.md +135 -0
- package/skill/margaui/components/hover-3d.md +129 -0
- package/skill/margaui/components/hover-gallery.md +49 -0
- package/skill/margaui/components/indicator.md +265 -0
- package/skill/margaui/components/input.md +389 -0
- package/skill/margaui/components/join.md +100 -0
- package/skill/margaui/components/kbd.md +127 -0
- package/skill/margaui/components/label.md +102 -0
- package/skill/margaui/components/link.md +96 -0
- package/skill/margaui/components/list.md +182 -0
- package/skill/margaui/components/loading.md +105 -0
- package/skill/margaui/components/mask.md +168 -0
- package/skill/margaui/components/megamenu.md +131 -0
- package/skill/margaui/components/menu.md +887 -0
- package/skill/margaui/components/mockup-browser.md +39 -0
- package/skill/margaui/components/mockup-code.md +81 -0
- package/skill/margaui/components/mockup-phone.md +39 -0
- package/skill/margaui/components/mockup-window.md +33 -0
- package/skill/margaui/components/modal.md +196 -0
- package/skill/margaui/components/navbar.md +282 -0
- package/skill/margaui/components/otp.md +171 -0
- package/skill/margaui/components/pagination.md +122 -0
- package/skill/margaui/components/progress.md +135 -0
- package/skill/margaui/components/radial-progress.md +67 -0
- package/skill/margaui/components/radio.md +133 -0
- package/skill/margaui/components/range.md +134 -0
- package/skill/margaui/components/rating.md +170 -0
- package/skill/margaui/components/select.md +225 -0
- package/skill/margaui/components/skeleton.md +64 -0
- package/skill/margaui/components/stack.md +142 -0
- package/skill/margaui/components/stat.md +254 -0
- package/skill/margaui/components/status.md +73 -0
- package/skill/margaui/components/steps.md +138 -0
- package/skill/margaui/components/swap.md +152 -0
- package/skill/margaui/components/tab.md +248 -0
- package/skill/margaui/components/table.md +1018 -0
- package/skill/margaui/components/text-rotate.md +91 -0
- package/skill/margaui/components/textarea.md +85 -0
- package/skill/margaui/components/theme-controller.md +266 -0
- package/skill/margaui/components/timeline.md +1356 -0
- package/skill/margaui/components/toast.md +165 -0
- package/skill/margaui/components/toggle.md +135 -0
- package/skill/margaui/components/tooltip.md +181 -0
- package/skill/margaui/components/validator.md +163 -0
- package/skill/tutuca/SKILL.md +56 -0
- package/skill/tutuca/advanced.md +212 -0
- package/skill/tutuca/cli.md +239 -0
- package/skill/tutuca/component-design.md +168 -0
- package/skill/tutuca/core.md +918 -0
- package/skill/tutuca/iteration.md +207 -0
- package/skill/tutuca/macros.md +86 -0
- package/skill/tutuca/margaui.md +175 -0
- package/skill/tutuca/messages-and-intents.md +399 -0
- package/skill/tutuca/patterns/README.md +48 -0
- package/skill/tutuca/patterns/add-a-story.md +26 -0
- package/skill/tutuca/patterns/bind-text-and-attributes.md +30 -0
- package/skill/tutuca/patterns/conditional-attribute-value.md +29 -0
- package/skill/tutuca/patterns/coordinate-components.md +54 -0
- package/skill/tutuca/patterns/edit-through-a-dynamic-target.md +27 -0
- package/skill/tutuca/patterns/enrich-each-item.md +25 -0
- package/skill/tutuca/patterns/file-input.md +39 -0
- package/skill/tutuca/patterns/filter-a-list.md +25 -0
- package/skill/tutuca/patterns/filter-and-paginate.md +60 -0
- package/skill/tutuca/patterns/handle-events.md +44 -0
- package/skill/tutuca/patterns/iterate-a-list.md +18 -0
- package/skill/tutuca/patterns/paginate-a-list.md +29 -0
- package/skill/tutuca/patterns/render-a-child-component.md +21 -0
- package/skill/tutuca/patterns/reuse-markup-with-macros.md +36 -0
- package/skill/tutuca/patterns/share-state-across-the-tree.md +38 -0
- package/skill/tutuca/patterns/show-or-hide-content.md +23 -0
- package/skill/tutuca/patterns/switch-between-views.md +30 -0
- package/skill/tutuca/patterns/tabbed-interface.md +43 -0
- package/skill/tutuca/semantics.md +195 -0
- package/skill/tutuca/storybook.md +270 -0
- package/skill/tutuca/styles.md +48 -0
- package/skill/tutuca/testing.md +345 -0
- package/skill/tutuca-source/SKILL.md +33 -0
- package/skill/tutuca-source/tutuca.ext.js +4301 -0
package/dist/tutuca-dev.ext.js
CHANGED
|
@@ -724,6 +724,9 @@ var PathBuilder = class {
|
|
|
724
724
|
}
|
|
725
725
|
};
|
|
726
726
|
|
|
727
|
+
// src/util/env.js
|
|
728
|
+
var isMac = (globalThis.navigator?.userAgent ?? "").toLowerCase().includes("mac");
|
|
729
|
+
|
|
727
730
|
// src/value.js
|
|
728
731
|
var VALID_VAL_ID_RE = /^[a-zA-Z][a-zA-Z0-9_]*\??$/;
|
|
729
732
|
var isValidValId = (name) => VALID_VAL_ID_RE.test(name);
|
|
@@ -742,6 +745,7 @@ var K_NAME = 32;
|
|
|
742
745
|
var K_TYPE = 64;
|
|
743
746
|
var K_SEQ = 256;
|
|
744
747
|
var K_METHOD = 1024;
|
|
748
|
+
var K_EVENT = 2048;
|
|
745
749
|
var G_BOOL = K_FIELD | K_METHOD | K_BIND | K_DYN | K_CONST;
|
|
746
750
|
var G_TEXT = G_BOOL | K_STRTPL;
|
|
747
751
|
var G_COMPONENT = K_FIELD | K_SEQ | K_DYN;
|
|
@@ -749,6 +753,7 @@ var G_SEQUENCE = K_FIELD | K_DYN;
|
|
|
749
753
|
var G_PROVIDE = K_FIELD | K_SEQ;
|
|
750
754
|
var G_FIELD = K_FIELD | K_METHOD | K_CONST | K_SEQ;
|
|
751
755
|
var G_VALUE = K_FIELD | K_METHOD | K_BIND | K_DYN | K_NAME | K_TYPE | K_CONST;
|
|
756
|
+
var G_HANDLER_ARG = G_VALUE & ~K_NAME | K_EVENT;
|
|
752
757
|
var G_ALL = G_VALUE | K_STRTPL | K_SEQ;
|
|
753
758
|
function sizeOf(v) {
|
|
754
759
|
if (v == null) return null;
|
|
@@ -758,6 +763,10 @@ function sizeOf(v) {
|
|
|
758
763
|
if (typeof l === "number") return l;
|
|
759
764
|
return isPlainObject(v) ? Object.keys(v).length : null;
|
|
760
765
|
}
|
|
766
|
+
var toNullIfNaN = (v) => Number.isNaN(v) ? null : v;
|
|
767
|
+
function getValue(e) {
|
|
768
|
+
return e.target.type === "checkbox" ? e.target.checked : (e instanceof CustomEvent ? e.detail : e.target.value) ?? null;
|
|
769
|
+
}
|
|
761
770
|
var predTruthy = (v) => {
|
|
762
771
|
const n = sizeOf(v);
|
|
763
772
|
return n === null ? !!v : n > 0;
|
|
@@ -808,6 +817,10 @@ function parseToken(s, px) {
|
|
|
808
817
|
const num = VALID_FLOAT_RE.test(s) ? parseFloat(s) : null;
|
|
809
818
|
if (Number.isFinite(num)) return new ConstVal(num);
|
|
810
819
|
if (s === "true" || s === "false") return new ConstVal(s === "true");
|
|
820
|
+
if (c0 === 101) {
|
|
821
|
+
const m = /^e(\.[a-zA-Z][a-zA-Z0-9_]*)+$/.exec(s);
|
|
822
|
+
if (m !== null) return new EventMemberVal(s.split(".").slice(1));
|
|
823
|
+
}
|
|
811
824
|
if (c0 >= 97 && c0 <= 122) return mkVal(s, NameVal);
|
|
812
825
|
if (c0 >= 65 && c0 <= 90) return mkVal(s, TypeVal);
|
|
813
826
|
return null;
|
|
@@ -883,7 +896,7 @@ function _parseHandler(s, px, namespace, allowArgs, report, allowMethod) {
|
|
|
883
896
|
const args = new Array(tokens.length - 1);
|
|
884
897
|
for (let i = 1; i < tokens.length; i++) {
|
|
885
898
|
const val = parseToken(tokens[i], px);
|
|
886
|
-
if (val !== null && kindOf(val) &
|
|
899
|
+
if (val !== null && kindOf(val) & G_HANDLER_ARG) args[i - 1] = val;
|
|
887
900
|
else {
|
|
888
901
|
if (report) px.onParseIssue("bad-value", { role: "handler-arg", value: tokens[i] });
|
|
889
902
|
args[i - 1] = NULL_CONST_VAL;
|
|
@@ -926,6 +939,7 @@ function kindOf(val) {
|
|
|
926
939
|
if (val instanceof DynVal) return K_DYN;
|
|
927
940
|
if (val instanceof TypeVal) return K_TYPE;
|
|
928
941
|
if (val instanceof NameVal) return K_NAME;
|
|
942
|
+
if (val instanceof EventMemberVal) return K_EVENT;
|
|
929
943
|
return 0;
|
|
930
944
|
}
|
|
931
945
|
var BaseVal = class {
|
|
@@ -1050,11 +1064,14 @@ var HandlerNameVal = class extends NameVal {
|
|
|
1050
1064
|
this.namespace = namespace;
|
|
1051
1065
|
}
|
|
1052
1066
|
eval(stack) {
|
|
1053
|
-
return stack.getHandlerFor(this.name, this.namespace) ?? mk404Handler(this.namespace, this.name);
|
|
1067
|
+
return stack.getHandlerFor(this.name, this.namespace) ?? mk404Handler(stack, this.namespace, this.name);
|
|
1054
1068
|
}
|
|
1055
1069
|
};
|
|
1056
|
-
var mk404Handler = (type, name) => function(...args) {
|
|
1057
|
-
|
|
1070
|
+
var mk404Handler = (stack, type, name) => function(...args) {
|
|
1071
|
+
const transactor = stack?.ctx?.transactor;
|
|
1072
|
+
if (transactor)
|
|
1073
|
+
transactor.refuse("NO_HANDLER", { namespace: type, name, argCount: args.length });
|
|
1074
|
+
else console.warn("handler not found", { type, name });
|
|
1058
1075
|
return this;
|
|
1059
1076
|
};
|
|
1060
1077
|
var TypeVal = class extends NameVal {
|
|
@@ -1062,6 +1079,53 @@ var TypeVal = class extends NameVal {
|
|
|
1062
1079
|
return stack.lookupType(this.name);
|
|
1063
1080
|
}
|
|
1064
1081
|
};
|
|
1082
|
+
var keyIs = (k) => (e) => e.key === k;
|
|
1083
|
+
var macCtrl = (e) => isMac && e.metaKey || e.ctrlKey;
|
|
1084
|
+
var nullSafe = (fn) => (e, stack) => {
|
|
1085
|
+
const info = stack.lookupDragInfo();
|
|
1086
|
+
return info == null ? null : fn(info);
|
|
1087
|
+
};
|
|
1088
|
+
var EVENT_CONVENIENCES = {
|
|
1089
|
+
value: (e) => getValue(e),
|
|
1090
|
+
valueAsInt: (e) => toNullIfNaN(parseInt(getValue(e), 10)),
|
|
1091
|
+
valueAsFloat: (e) => toNullIfNaN(parseFloat(getValue(e))),
|
|
1092
|
+
isAlt: (e) => e.altKey,
|
|
1093
|
+
isShift: (e) => e.shiftKey,
|
|
1094
|
+
isCtrl: macCtrl,
|
|
1095
|
+
isCmd: macCtrl,
|
|
1096
|
+
isUpKey: keyIs("ArrowUp"),
|
|
1097
|
+
isDownKey: keyIs("ArrowDown"),
|
|
1098
|
+
isSend: keyIs("Enter"),
|
|
1099
|
+
isCancel: keyIs("Escape"),
|
|
1100
|
+
isTabKey: keyIs("Tab"),
|
|
1101
|
+
dragInfo: (_e, stack) => stack.lookupDragInfo(),
|
|
1102
|
+
dragType: nullSafe((info) => info.type),
|
|
1103
|
+
dragValue: nullSafe((info) => info.val),
|
|
1104
|
+
dragKey: nullSafe((info) => info.lookupBind("key"))
|
|
1105
|
+
};
|
|
1106
|
+
var EventMemberVal = class extends BaseVal {
|
|
1107
|
+
constructor(members) {
|
|
1108
|
+
super();
|
|
1109
|
+
this.members = members;
|
|
1110
|
+
}
|
|
1111
|
+
eval(stack) {
|
|
1112
|
+
const e = stack.lookupEvent();
|
|
1113
|
+
if (e == null) return null;
|
|
1114
|
+
if (this.members.length === 1) {
|
|
1115
|
+
const convenience = EVENT_CONVENIENCES[this.members[0]];
|
|
1116
|
+
if (convenience !== void 0) return convenience(e, stack);
|
|
1117
|
+
}
|
|
1118
|
+
let v = e;
|
|
1119
|
+
for (const member of this.members) {
|
|
1120
|
+
if (v == null) return null;
|
|
1121
|
+
v = v[member];
|
|
1122
|
+
}
|
|
1123
|
+
return v ?? null;
|
|
1124
|
+
}
|
|
1125
|
+
toString() {
|
|
1126
|
+
return `e.${this.members.join(".")}`;
|
|
1127
|
+
}
|
|
1128
|
+
};
|
|
1065
1129
|
var RenderVal = class extends BaseVal {
|
|
1066
1130
|
render(stack, _rx) {
|
|
1067
1131
|
return this.eval(stack);
|
|
@@ -1993,9 +2057,6 @@ var unkIter = () => {
|
|
|
1993
2057
|
};
|
|
1994
2058
|
var SEQ_INFO = /* @__PURE__ */ Symbol.for("tutuca.seqInfo");
|
|
1995
2059
|
|
|
1996
|
-
// src/util/env.js
|
|
1997
|
-
var isMac = (globalThis.navigator?.userAgent ?? "").toLowerCase().includes("mac");
|
|
1998
|
-
|
|
1999
2060
|
// src/anode.js
|
|
2000
2061
|
function resolveDynProducer(comp, name) {
|
|
2001
2062
|
let producerComp, producerProvide;
|
|
@@ -5293,7 +5354,6 @@ var LOOKUP_BAD_SHAPE = "LOOKUP_BAD_SHAPE";
|
|
|
5293
5354
|
var LOOKUP_TARGET_MALFORMED = "LOOKUP_TARGET_MALFORMED";
|
|
5294
5355
|
var RENDER_IT_OUTSIDE_OF_LOOP = "RENDER_IT_OUTSIDE_OF_LOOP";
|
|
5295
5356
|
var UNKNOWN_EVENT_MODIFIER = "UNKNOWN_EVENT_MODIFIER";
|
|
5296
|
-
var UNKNOWN_HANDLER_ARG_NAME = "UNKNOWN_HANDLER_ARG_NAME";
|
|
5297
5357
|
var RECEIVE_HANDLER_NOT_IMPLEMENTED = "RECEIVE_HANDLER_NOT_IMPLEMENTED";
|
|
5298
5358
|
var EVENT_HANDLER_METHOD_NOT_ALLOWED = "EVENT_HANDLER_METHOD_NOT_ALLOWED";
|
|
5299
5359
|
var HANDLER_NAME_COLLISION = "HANDLER_NAME_COLLISION";
|
|
@@ -5647,29 +5707,6 @@ function checkEventModifiers(lx, view) {
|
|
|
5647
5707
|
}
|
|
5648
5708
|
}
|
|
5649
5709
|
}
|
|
5650
|
-
var KNOWN_HANDLER_NAMES = /* @__PURE__ */ new Set([
|
|
5651
|
-
"value",
|
|
5652
|
-
"valueAsInt",
|
|
5653
|
-
"valueAsFloat",
|
|
5654
|
-
"target",
|
|
5655
|
-
"event",
|
|
5656
|
-
"isAlt",
|
|
5657
|
-
"isShift",
|
|
5658
|
-
"isCtrl",
|
|
5659
|
-
"isCmd",
|
|
5660
|
-
"key",
|
|
5661
|
-
"keyCode",
|
|
5662
|
-
"isUpKey",
|
|
5663
|
-
"isDownKey",
|
|
5664
|
-
"isSend",
|
|
5665
|
-
"isCancel",
|
|
5666
|
-
"isTabKey",
|
|
5667
|
-
"ctx",
|
|
5668
|
-
"dragInfo"
|
|
5669
|
-
]);
|
|
5670
|
-
function isKnownHandlerName(name) {
|
|
5671
|
-
return KNOWN_HANDLER_NAMES.has(name);
|
|
5672
|
-
}
|
|
5673
5710
|
function checkKnownHandlerNames(lx, view, Comp, referencedAlters, referencedDynamics) {
|
|
5674
5711
|
const env = mkAttrValEnv(Comp, referencedAlters, referencedDynamics);
|
|
5675
5712
|
for (const event of view.ctx.events) {
|
|
@@ -5779,10 +5816,11 @@ var ATTR_VAL_CHECKERS = {
|
|
|
5779
5816
|
errCtx
|
|
5780
5817
|
);
|
|
5781
5818
|
},
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5819
|
+
// NameVals on a macro call-site attribute are macro-param bindings, not
|
|
5820
|
+
// handler args — their role is determined inside the macro body after
|
|
5821
|
+
// ^-substitution, where re-parsing handles validation. No checker: a NameVal
|
|
5822
|
+
// can no longer reach a handler-arg slot (sigil-less words fail to parse),
|
|
5823
|
+
// and macro-attr pass-throughs are skipped via skipNameVal.
|
|
5786
5824
|
StrTplVal({ lx, val, errCtx, recurse, isRoot }) {
|
|
5787
5825
|
const vs = val.vals;
|
|
5788
5826
|
const literal = val.toLiteralSource();
|
|
@@ -6679,8 +6717,19 @@ var Stack = class _Stack {
|
|
|
6679
6717
|
const fn = this.it[name];
|
|
6680
6718
|
return fn instanceof Function ? fn.call(this.it) : null;
|
|
6681
6719
|
}
|
|
6682
|
-
|
|
6683
|
-
|
|
6720
|
+
// Bare implicit event names are gone: a sigil-less word cannot reach a
|
|
6721
|
+
// handler-arg slot anymore, so this only ever serves stale NameVals parsed
|
|
6722
|
+
// before the removal (e.g. macro-attr pass-throughs). Always null.
|
|
6723
|
+
lookupName(_name) {
|
|
6724
|
+
return null;
|
|
6725
|
+
}
|
|
6726
|
+
// The dispatched DOM event / drag info, read only by EventMemberVal's
|
|
6727
|
+
// `e.<member>` handler args. Null outside a live event transaction.
|
|
6728
|
+
lookupEvent() {
|
|
6729
|
+
return this.ctx?.event ?? null;
|
|
6730
|
+
}
|
|
6731
|
+
lookupDragInfo() {
|
|
6732
|
+
return this.ctx?.dragInfo ?? null;
|
|
6684
6733
|
}
|
|
6685
6734
|
getHandlerFor(name, key) {
|
|
6686
6735
|
return this.comps.getHandlerFor(this.it, name, key);
|
|
@@ -6722,6 +6771,8 @@ var Transactor = class {
|
|
|
6722
6771
|
this.onTransactionPushed = () => {
|
|
6723
6772
|
};
|
|
6724
6773
|
this._observers = [];
|
|
6774
|
+
this.refusals = [];
|
|
6775
|
+
this._refusalObservers = [];
|
|
6725
6776
|
this._inflight = /* @__PURE__ */ new Set();
|
|
6726
6777
|
}
|
|
6727
6778
|
pushTransaction(t) {
|
|
@@ -6745,6 +6796,29 @@ var Transactor = class {
|
|
|
6745
6796
|
_emit(record) {
|
|
6746
6797
|
for (const cb of this._observers) cb(record);
|
|
6747
6798
|
}
|
|
6799
|
+
// Record a refusal: a dispatch the runtime could not carry out. Kinds are
|
|
6800
|
+
// open strings; today the runtime raises NO_HANDLER (a receive name with no
|
|
6801
|
+
// implementation, including the auto-generated fallback firing at dispatch
|
|
6802
|
+
// time) and FORWARD_NO_NAME (ctx.forward() from a handler whose view wrote
|
|
6803
|
+
// no name). Records carry { kind, info, timestamp } and are observational —
|
|
6804
|
+
// the dispatch itself has already failed gracefully.
|
|
6805
|
+
refuse(kind, info = {}) {
|
|
6806
|
+
const record = { kind, info, timestamp: Date.now() };
|
|
6807
|
+
this.refusals.push(record);
|
|
6808
|
+
if (this.refusals.length > REFUSAL_RING_CAP) this.refusals.shift();
|
|
6809
|
+
console.warn(`tutuca refusal [${kind}]`, info);
|
|
6810
|
+
for (const cb of this._refusalObservers) cb(record);
|
|
6811
|
+
return record;
|
|
6812
|
+
}
|
|
6813
|
+
// Subscribe to refusal records as they happen. Returns an unsubscribe fn,
|
|
6814
|
+
// like observe().
|
|
6815
|
+
observeRefusals(cb) {
|
|
6816
|
+
this._refusalObservers.push(cb);
|
|
6817
|
+
return () => {
|
|
6818
|
+
const i = this._refusalObservers.indexOf(cb);
|
|
6819
|
+
if (i !== -1) this._refusalObservers.splice(i, 1);
|
|
6820
|
+
};
|
|
6821
|
+
}
|
|
6748
6822
|
// Build and dispatch the observer record for a settled transaction. The
|
|
6749
6823
|
// resolved handler (`_resolvedHandler`/`_matched`) and per-leaf before/after
|
|
6750
6824
|
// (`_before`/`_after`) were captured while the handler ran (see callHandler /
|
|
@@ -6910,14 +6984,7 @@ var Transaction = class {
|
|
|
6910
6984
|
this._completion?.markSelfSettled({ value: newLeaf, old: curLeaf });
|
|
6911
6985
|
return curLeaf !== newLeaf ? txnPath.setValue(curRoot, newLeaf) : curRoot;
|
|
6912
6986
|
}
|
|
6913
|
-
lookupName(_name) {
|
|
6914
|
-
return null;
|
|
6915
|
-
}
|
|
6916
6987
|
};
|
|
6917
|
-
var toNullIfNaN = (v) => Number.isNaN(v) ? null : v;
|
|
6918
|
-
function getValue(e) {
|
|
6919
|
-
return e.target.type === "checkbox" ? e.target.checked : (e instanceof CustomEvent ? e.detail : e.target.value) ?? null;
|
|
6920
|
-
}
|
|
6921
6988
|
var InputEvent = class extends Transaction {
|
|
6922
6989
|
constructor(path, e, handler, transactor, dragInfo) {
|
|
6923
6990
|
super(path, transactor);
|
|
@@ -6955,8 +7022,10 @@ var InputEvent = class extends Transaction {
|
|
|
6955
7022
|
const { args = this._handlerArgs ?? [], ...rest } = f;
|
|
6956
7023
|
const hv = this.handler?.handlerCall?.handlerVal ?? this.handler?.handlerVal;
|
|
6957
7024
|
const name = hv?.name;
|
|
6958
|
-
if (name === void 0)
|
|
6959
|
-
|
|
7025
|
+
if (name === void 0) {
|
|
7026
|
+
this.transactor.refuse("FORWARD_NO_NAME", {});
|
|
7027
|
+
return;
|
|
7028
|
+
}
|
|
6960
7029
|
this.transactor.pushIntent(this.dispatchPath, name, args, rest, this);
|
|
6961
7030
|
}
|
|
6962
7031
|
buildRootStack(root, comps) {
|
|
@@ -6970,47 +7039,11 @@ var InputEvent = class extends Transaction {
|
|
|
6970
7039
|
args.push(new EventContext(path, this.transactor, this));
|
|
6971
7040
|
return [handler, args];
|
|
6972
7041
|
}
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
case "valueAsInt":
|
|
6979
|
-
return toNullIfNaN(parseInt(getValue(e), 10));
|
|
6980
|
-
case "valueAsFloat":
|
|
6981
|
-
return toNullIfNaN(parseFloat(getValue(e)));
|
|
6982
|
-
case "target":
|
|
6983
|
-
return e.target;
|
|
6984
|
-
case "event":
|
|
6985
|
-
return e;
|
|
6986
|
-
case "isAlt":
|
|
6987
|
-
return e.altKey;
|
|
6988
|
-
case "isShift":
|
|
6989
|
-
return e.shiftKey;
|
|
6990
|
-
case "isCtrl":
|
|
6991
|
-
/* falls through */
|
|
6992
|
-
case "isCmd":
|
|
6993
|
-
return isMac && e.metaKey || e.ctrlKey;
|
|
6994
|
-
case "key":
|
|
6995
|
-
return e.key;
|
|
6996
|
-
case "keyCode":
|
|
6997
|
-
return e.keyCode;
|
|
6998
|
-
case "isUpKey":
|
|
6999
|
-
return e.key === "ArrowUp";
|
|
7000
|
-
case "isDownKey":
|
|
7001
|
-
return e.key === "ArrowDown";
|
|
7002
|
-
case "isSend":
|
|
7003
|
-
return e.key === "Enter";
|
|
7004
|
-
case "isCancel":
|
|
7005
|
-
return e.key === "Escape";
|
|
7006
|
-
case "isTabKey":
|
|
7007
|
-
return e.key === "Tab";
|
|
7008
|
-
case "ctx":
|
|
7009
|
-
return new EventContext(this.dispatchPath, this.transactor, this);
|
|
7010
|
-
case "dragInfo":
|
|
7011
|
-
return this.dragInfo;
|
|
7012
|
-
}
|
|
7013
|
-
return null;
|
|
7042
|
+
// The dispatched DOM event, read only through `e.<member>` handler args
|
|
7043
|
+
// (src/value.js EventMemberVal via Stack.lookupEvent). There is no bare
|
|
7044
|
+
// implicit-name vocabulary anymore: every arg carries a sigil.
|
|
7045
|
+
get event() {
|
|
7046
|
+
return this.e;
|
|
7014
7047
|
}
|
|
7015
7048
|
};
|
|
7016
7049
|
var NameArgsTransaction = class extends Transaction {
|
|
@@ -7101,6 +7134,7 @@ var IntentEvent = class extends NameArgsTransaction {
|
|
|
7101
7134
|
}
|
|
7102
7135
|
};
|
|
7103
7136
|
var PASS = /* @__PURE__ */ Symbol.for("tutuca.intent.pass");
|
|
7137
|
+
var REFUSAL_RING_CAP = 200;
|
|
7104
7138
|
var DEFAULT_ROUTE = ["dyn", "lex"];
|
|
7105
7139
|
var INTENT_DEPTH = 64;
|
|
7106
7140
|
var IntentWalk = class {
|
|
@@ -7891,8 +7925,6 @@ function lintIdToMessage(id, info) {
|
|
|
7891
7925
|
const written = `@on.${info.name}+${mods.join("+")}`;
|
|
7892
7926
|
return `Unknown modifier '+${info.modifier}' in '${written}'`;
|
|
7893
7927
|
}
|
|
7894
|
-
case "UNKNOWN_HANDLER_ARG_NAME":
|
|
7895
|
-
return `Unknown handler argument '${info.name}'${fmtOriginSuffix(info)}`;
|
|
7896
7928
|
case "HANDLER_NAME_COLLISION":
|
|
7897
7929
|
return `${info.problem} — ${info.fix}`;
|
|
7898
7930
|
case "RECEIVE_HANDLER_NOT_IMPLEMENTED":
|
|
@@ -8585,7 +8617,6 @@ export {
|
|
|
8585
8617
|
UNKNOWN_COMPONENT_SPEC_KEY,
|
|
8586
8618
|
UNKNOWN_DIRECTIVE,
|
|
8587
8619
|
UNKNOWN_EVENT_MODIFIER,
|
|
8588
|
-
UNKNOWN_HANDLER_ARG_NAME,
|
|
8589
8620
|
UNKNOWN_MACRO_ARG,
|
|
8590
8621
|
UNKNOWN_X_ATTR,
|
|
8591
8622
|
UNKNOWN_X_OP,
|