tutuca 0.13.1 → 0.13.3
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 +173 -291
- package/dist/tutuca-dev.ext.js +159 -275
- package/dist/tutuca-dev.js +159 -275
- package/dist/tutuca-dev.min.js +4 -4
- package/dist/tutuca-extra.ext.js +156 -272
- package/dist/tutuca-extra.js +156 -272
- package/dist/tutuca-extra.min.js +3 -3
- package/dist/tutuca.ext.js +156 -272
- package/dist/tutuca.js +156 -272
- package/dist/tutuca.min.js +3 -3
- package/package.json +1 -1
- package/skill/tutuca/core.md +6 -0
- package/skill/tutuca-source/tutuca.ext.js +156 -272
package/dist/tutuca-cli.js
CHANGED
|
@@ -1069,9 +1069,10 @@ function resolvePathStep(comp, nodeIds, vid) {
|
|
|
1069
1069
|
}
|
|
1070
1070
|
return null;
|
|
1071
1071
|
}
|
|
1072
|
-
var NONE, readKey, writeKey,
|
|
1072
|
+
var NONE, readKey, writeKey, writeSeqKey, Step, BindStep, ScopeBindStep, FieldStep, SeqStep, SeqAccessStep, EachBindStep, EachRenderItStep, DynStep, DynEachStep, Path, StepCtx, NO_EVENT_INFO, BUBBLING_EVENTS, PathBuilder;
|
|
1073
1073
|
var init_path = __esm({
|
|
1074
1074
|
"src/path.js"() {
|
|
1075
|
+
init_collection();
|
|
1075
1076
|
init_immer2();
|
|
1076
1077
|
NONE = /* @__PURE__ */ Symbol("NONE");
|
|
1077
1078
|
readKey = (value, key, dval = null) => {
|
|
@@ -1087,11 +1088,6 @@ var init_path = __esm({
|
|
|
1087
1088
|
value.add(next);
|
|
1088
1089
|
} else value[key] = next;
|
|
1089
1090
|
};
|
|
1090
|
-
readSeqKey = (value, key, dval = null) => {
|
|
1091
|
-
const direct = readKey(value, key, NONE);
|
|
1092
|
-
if (direct !== NONE) return direct;
|
|
1093
|
-
return typeof value?.get === "function" ? value.get(key, dval) : dval;
|
|
1094
|
-
};
|
|
1095
1091
|
writeSeqKey = (value, key, next) => {
|
|
1096
1092
|
if (value instanceof Map || value instanceof Set || Array.isArray(value) || Object.hasOwn(value, key))
|
|
1097
1093
|
writeKey(value, key, next);
|
|
@@ -1104,7 +1100,7 @@ var init_path = __esm({
|
|
|
1104
1100
|
}
|
|
1105
1101
|
setDraftValue(_root, _v) {
|
|
1106
1102
|
}
|
|
1107
|
-
enterFrame(stack,
|
|
1103
|
+
enterFrame(stack, next) {
|
|
1108
1104
|
return stack.enter(next, {}, true);
|
|
1109
1105
|
}
|
|
1110
1106
|
toAbstractPathStep() {
|
|
@@ -1130,7 +1126,7 @@ var init_path = __esm({
|
|
|
1130
1126
|
lookup(v, _dval) {
|
|
1131
1127
|
return v;
|
|
1132
1128
|
}
|
|
1133
|
-
enterFrame(stack,
|
|
1129
|
+
enterFrame(stack, next) {
|
|
1134
1130
|
return stack.enter(next, { ...this.binds }, false);
|
|
1135
1131
|
}
|
|
1136
1132
|
withIndex(i) {
|
|
@@ -1148,7 +1144,7 @@ var init_path = __esm({
|
|
|
1148
1144
|
super(binds);
|
|
1149
1145
|
this.val = val;
|
|
1150
1146
|
}
|
|
1151
|
-
enterFrame(stack,
|
|
1147
|
+
enterFrame(stack, next) {
|
|
1152
1148
|
const dyn = this.val.evalAsHandler(stack)?.call(stack.it) ?? {};
|
|
1153
1149
|
return stack.enter(next, { ...this.binds, ...dyn }, false);
|
|
1154
1150
|
}
|
|
@@ -1187,13 +1183,13 @@ var init_path = __esm({
|
|
|
1187
1183
|
this.key = key;
|
|
1188
1184
|
}
|
|
1189
1185
|
lookup(v, dval = null) {
|
|
1190
|
-
return
|
|
1186
|
+
return seqGet(readKey(v, this.field, null), this.key, dval);
|
|
1191
1187
|
}
|
|
1192
1188
|
setDraftValue(root, v) {
|
|
1193
1189
|
const seq = readKey(root, this.field, null);
|
|
1194
1190
|
if (seq != null) writeSeqKey(seq, this.key, v);
|
|
1195
1191
|
}
|
|
1196
|
-
enterFrame(stack,
|
|
1192
|
+
enterFrame(stack, next) {
|
|
1197
1193
|
return stack.enter(next, { key: this.key }, true);
|
|
1198
1194
|
}
|
|
1199
1195
|
toKey() {
|
|
@@ -1209,7 +1205,7 @@ var init_path = __esm({
|
|
|
1209
1205
|
lookup(v, dval = null) {
|
|
1210
1206
|
const seq = readKey(v, this.seqField, NONE);
|
|
1211
1207
|
const key = readKey(v, this.keyField, NONE);
|
|
1212
|
-
return key !== NONE && seq !== NONE ?
|
|
1208
|
+
return key !== NONE && seq !== NONE ? seqGet(seq, key, dval) : dval;
|
|
1213
1209
|
}
|
|
1214
1210
|
setDraftValue(root, v) {
|
|
1215
1211
|
const seq = readKey(root, this.seqField, NONE);
|
|
@@ -1240,7 +1236,7 @@ var init_path = __esm({
|
|
|
1240
1236
|
}
|
|
1241
1237
|
// Replay the renderer's per-item binds (key, value + any @enrich-with binds)
|
|
1242
1238
|
// so a rebuilt stack matches the one @each rendered with.
|
|
1243
|
-
enterFrame(stack,
|
|
1239
|
+
enterFrame(stack, next) {
|
|
1244
1240
|
return stack.enter(next, this.iterInfo.enrichBinds(stack, this.key), false);
|
|
1245
1241
|
}
|
|
1246
1242
|
toAbstractPathStep() {
|
|
@@ -1248,7 +1244,7 @@ var init_path = __esm({
|
|
|
1248
1244
|
}
|
|
1249
1245
|
};
|
|
1250
1246
|
EachRenderItStep = class extends SeqStep {
|
|
1251
|
-
enterFrame(stack,
|
|
1247
|
+
enterFrame(stack, next) {
|
|
1252
1248
|
return stack.enter(next, { key: this.key, value: next }, false).enter(next, {}, true);
|
|
1253
1249
|
}
|
|
1254
1250
|
toAbstractPathStep() {
|
|
@@ -1270,7 +1266,7 @@ var init_path = __esm({
|
|
|
1270
1266
|
warnRawDynStep("lookup", this);
|
|
1271
1267
|
return dval;
|
|
1272
1268
|
}
|
|
1273
|
-
enterFrame(stack,
|
|
1269
|
+
enterFrame(stack, _next) {
|
|
1274
1270
|
warnRawDynStep("enterFrame", this);
|
|
1275
1271
|
return stack;
|
|
1276
1272
|
}
|
|
@@ -1408,7 +1404,7 @@ var init_path = __esm({
|
|
|
1408
1404
|
console.warn("bad PathItem", { root: stack.it, step, path: this });
|
|
1409
1405
|
return null;
|
|
1410
1406
|
}
|
|
1411
|
-
stack = step.enterFrame(stack,
|
|
1407
|
+
stack = step.enterFrame(stack, next);
|
|
1412
1408
|
prev = next;
|
|
1413
1409
|
}
|
|
1414
1410
|
return stack;
|
|
@@ -1478,10 +1474,6 @@ var init_path = __esm({
|
|
|
1478
1474
|
console.warn("event reconstruction: dynamic-var producer not found", pendingDyns);
|
|
1479
1475
|
return [new _Path(pathSteps.reverse()), handlers];
|
|
1480
1476
|
}
|
|
1481
|
-
static fromEvent(e, rNode, maxDepth, comps, stopOnNoEvent = true) {
|
|
1482
|
-
const { type: type3, target } = e;
|
|
1483
|
-
return _Path.fromNodeAndEventName(target, type3, rNode, maxDepth, comps, stopOnNoEvent);
|
|
1484
|
-
}
|
|
1485
1477
|
};
|
|
1486
1478
|
StepCtx = class _StepCtx {
|
|
1487
1479
|
constructor(comp, nodeIds, idx, vid) {
|
|
@@ -1627,31 +1619,6 @@ function parseBool(s, px) {
|
|
|
1627
1619
|
const val = parseToken(tokens[0], px);
|
|
1628
1620
|
return val !== null && kindOf(val) & G_BOOL ? val : null;
|
|
1629
1621
|
}
|
|
1630
|
-
function parseText(s, px) {
|
|
1631
|
-
return _parseSingle(s, px, G_TEXT);
|
|
1632
|
-
}
|
|
1633
|
-
function parseComponent(s, px) {
|
|
1634
|
-
return _parseSingle(s, px, G_COMPONENT);
|
|
1635
|
-
}
|
|
1636
|
-
function parseSequence(s, px) {
|
|
1637
|
-
return _parseSingle(s, px, G_SEQUENCE);
|
|
1638
|
-
}
|
|
1639
|
-
function parseField(s, px) {
|
|
1640
|
-
return _parseSingle(s, px, G_FIELD);
|
|
1641
|
-
}
|
|
1642
|
-
function parseProvide(s, px) {
|
|
1643
|
-
return _parseSingle(s, px, G_PROVIDE);
|
|
1644
|
-
}
|
|
1645
|
-
function parseMacroAttr(s, px) {
|
|
1646
|
-
return _parseSingle(s, px, G_ALL);
|
|
1647
|
-
}
|
|
1648
|
-
function parseReceiveHandler(s, px) {
|
|
1649
|
-
return _parseHandler(s, px, "receive", true, true, false);
|
|
1650
|
-
}
|
|
1651
|
-
function parseAlterHandler(s, px) {
|
|
1652
|
-
const r = _parseHandler(s, px, "alter", false, false, true);
|
|
1653
|
-
return r === null ? null : r.handlerVal;
|
|
1654
|
-
}
|
|
1655
1622
|
function _parseHandler(s, px, namespace, allowArgs, report, allowMethod) {
|
|
1656
1623
|
const tokens = tokenizeValue(s.trim());
|
|
1657
1624
|
const headTok = tokens[0] ?? "";
|
|
@@ -1721,7 +1688,7 @@ function kindOf(val) {
|
|
|
1721
1688
|
if (val instanceof EventMemberVal) return K_EVENT;
|
|
1722
1689
|
return 0;
|
|
1723
1690
|
}
|
|
1724
|
-
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_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, keyIs, macCtrl, nullSafe, EVENT_CONVENIENCES, EventMemberVal, RenderVal, RenderNameVal, BindVal, BindMemberVal, DynVal, FieldVal, MethodVal, SeqAccessVal;
|
|
1691
|
+
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_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, parseText, parseComponent, parseSequence, parseField, parseProvide, parseMacroAttr, parseReceiveHandler, parseAlterHandler, BaseVal, ConstVal, NULL_CONST_VAL, PredicateVal, VarVal, StrTplVal, NameVal, HandlerNameVal, mk404Handler, keyIs, macCtrl, nullSafe, EVENT_CONVENIENCES, EventMemberVal, RenderVal, RenderNameVal, BindVal, BindMemberVal, DynVal, FieldVal, MethodVal, SeqAccessVal;
|
|
1725
1692
|
var init_value = __esm({
|
|
1726
1693
|
"src/value.js"() {
|
|
1727
1694
|
init_collection();
|
|
@@ -1765,6 +1732,14 @@ var init_value = __esm({
|
|
|
1765
1732
|
"null?": { name: "null?", arity: 1, fn: (v) => v == null },
|
|
1766
1733
|
"equals?": { name: "equals?", arity: 2, fn: (a, b) => Object.is(a, b) }
|
|
1767
1734
|
};
|
|
1735
|
+
parseText = (s, px) => _parseSingle(s, px, G_TEXT);
|
|
1736
|
+
parseComponent = (s, px) => _parseSingle(s, px, G_COMPONENT);
|
|
1737
|
+
parseSequence = (s, px) => _parseSingle(s, px, G_SEQUENCE);
|
|
1738
|
+
parseField = (s, px) => _parseSingle(s, px, G_FIELD);
|
|
1739
|
+
parseProvide = (s, px) => _parseSingle(s, px, G_PROVIDE);
|
|
1740
|
+
parseMacroAttr = (s, px) => _parseSingle(s, px, G_ALL);
|
|
1741
|
+
parseReceiveHandler = (s, px) => _parseHandler(s, px, "receive", true, true, false);
|
|
1742
|
+
parseAlterHandler = (s, px) => _parseHandler(s, px, "alter", false, false, true)?.handlerVal ?? null;
|
|
1768
1743
|
BaseVal = class {
|
|
1769
1744
|
render(_stack, _rx) {
|
|
1770
1745
|
}
|
|
@@ -2042,10 +2017,7 @@ function parseIterationDirectives(attributes, px) {
|
|
|
2042
2017
|
};
|
|
2043
2018
|
return { whenVal: parseNamed("when"), loopWithVal: parseNamed("loop-with") };
|
|
2044
2019
|
}
|
|
2045
|
-
|
|
2046
|
-
return new AttrParser(px);
|
|
2047
|
-
}
|
|
2048
|
-
var Attributes, booleanAttrsRaw, booleanAttrs, AttrParser, ConstAttrs, DynAttrs, BaseAttr, Attr, ConstAttr, RawHtmlAttr, NOT_SET_VAL, IfAttr, EventHandler, IntentHandler;
|
|
2020
|
+
var Attributes, booleanAttrsRaw, booleanAttrs, AttrParser, ConstAttrs, DynAttrs, BaseAttr, Attr, ConstAttr, RawHtmlAttr, NOT_SET_VAL, IfAttr, EventHandler;
|
|
2049
2021
|
var init_attribute = __esm({
|
|
2050
2022
|
"src/attribute.js"() {
|
|
2051
2023
|
init_value();
|
|
@@ -2054,7 +2026,7 @@ var init_attribute = __esm({
|
|
|
2054
2026
|
this.items = items;
|
|
2055
2027
|
}
|
|
2056
2028
|
static parse(attributes, px, parseAll = false) {
|
|
2057
|
-
return
|
|
2029
|
+
return new AttrParser(px).parse(attributes, parseAll);
|
|
2058
2030
|
}
|
|
2059
2031
|
isConstant() {
|
|
2060
2032
|
return false;
|
|
@@ -2297,16 +2269,19 @@ var init_attribute = __esm({
|
|
|
2297
2269
|
return r === null ? null : new _EventHandler(r.handlerVal, r.args);
|
|
2298
2270
|
}
|
|
2299
2271
|
};
|
|
2300
|
-
IntentHandler = class {
|
|
2301
|
-
constructor(name, fn) {
|
|
2302
|
-
this.name = name;
|
|
2303
|
-
this.fn = fn;
|
|
2304
|
-
}
|
|
2305
|
-
};
|
|
2306
2272
|
}
|
|
2307
2273
|
});
|
|
2308
2274
|
|
|
2309
2275
|
// src/iteration.js
|
|
2276
|
+
function bindsForKey({ seq, it, loopWith, enricher, ctx }, key) {
|
|
2277
|
+
const value = seqGet(seq, key, null);
|
|
2278
|
+
const binds = { key, value };
|
|
2279
|
+
if (enricher) {
|
|
2280
|
+
const { iterData } = unpackLoopResult(loopWith.call(it, seq, ctx), seq);
|
|
2281
|
+
callEnricher(enricher, it, binds, key, value, iterData);
|
|
2282
|
+
}
|
|
2283
|
+
return binds;
|
|
2284
|
+
}
|
|
2310
2285
|
function walkLoopBindings({ seq, it, filter, loopWith, enricher, ctx }, visit) {
|
|
2311
2286
|
const { iterData, start, end, keys } = unpackLoopResult(loopWith.call(it, seq, ctx), seq);
|
|
2312
2287
|
const visitOne = (key, value, attrName) => {
|
|
@@ -2566,6 +2541,10 @@ function morphChildren(parentDom, oldChilds, newChilds, opts) {
|
|
|
2566
2541
|
if (!used2[i] && domNodes[i].parentNode === parentDom) parentDom.removeChild(domNodes[i]);
|
|
2567
2542
|
}
|
|
2568
2543
|
function render(vnode, container, options, prev) {
|
|
2544
|
+
if (vnode == null) {
|
|
2545
|
+
container.replaceChildren();
|
|
2546
|
+
return { vnode: null, dom: null };
|
|
2547
|
+
}
|
|
2569
2548
|
const isFragment = vnode instanceof VFragment;
|
|
2570
2549
|
if (prev && prev.vnode instanceof VFragment === isFragment) {
|
|
2571
2550
|
const oldDom = isFragment ? container : prev.dom;
|
|
@@ -2615,19 +2594,9 @@ var init_vdom = __esm({
|
|
|
2615
2594
|
};
|
|
2616
2595
|
isForeignObject = (tag) => tag.length === 13 && tag.toLowerCase() === "foreignobject";
|
|
2617
2596
|
effectiveNs = (vnode, opts) => vnode.namespace ?? opts.namespace ?? null;
|
|
2618
|
-
NEVER_ASSIGN =
|
|
2619
|
-
"width"
|
|
2620
|
-
|
|
2621
|
-
"href",
|
|
2622
|
-
"list",
|
|
2623
|
-
"form",
|
|
2624
|
-
"tabIndex",
|
|
2625
|
-
"download",
|
|
2626
|
-
"rowSpan",
|
|
2627
|
-
"colSpan",
|
|
2628
|
-
"role",
|
|
2629
|
-
"popover"
|
|
2630
|
-
]);
|
|
2597
|
+
NEVER_ASSIGN = new Set(
|
|
2598
|
+
"width height href list form tabIndex download rowSpan colSpan role popover".split(" ")
|
|
2599
|
+
);
|
|
2631
2600
|
PROP_ATTR_NAME = { className: "class", htmlFor: "for" };
|
|
2632
2601
|
VBase = class {
|
|
2633
2602
|
};
|
|
@@ -2906,14 +2875,12 @@ function compileModifiers(eventName, names) {
|
|
|
2906
2875
|
return w(this, f, args, ctx);
|
|
2907
2876
|
};
|
|
2908
2877
|
}
|
|
2909
|
-
var BaseNode, TextNode, CommentNode, ChildsNode, DomNode, FragmentNode, maybeFragment, VALID_NODE_RE, ANode, MacroNode, RenderViewId, RenderNode, RenderItNode, RenderTextNode, RenderOnceNode, WrapperNode, ShowNode, HideNode, PushViewNameNode, SlotNode, ScopeNode, EachNode, IterInfo, X_OPS, WRAPPER_NODES, ParseContext, _htmlBlockTags, HTML_BLOCK_TAGS, isBlockDomNode, isEmptyText, isIgnorableXChild, hasMeaningfulChilds, View, NodeEvents, NodeEvent, fwdIfCtxPred, fwdIfKey, fwdCtrl, fwdMeta, fwdAlt, MOD_WRAPPERS_FOR_ANY_EVENT, MOD_WRAPPERS_BY_EVENT, MOD_EFFECTS, NO_WRAPPERS, identityModifierWrapper;
|
|
2878
|
+
var BaseNode, TextNode, CommentNode, ChildsNode, DomNode, FragmentNode, maybeFragment, VALID_NODE_RE, ANode, MacroNode, RenderViewId, RenderNode, RenderItNode, RenderTextNode, RenderOnceNode, WrapperNode, ShowNode, HideNode, PushViewNameNode, SlotNode, ScopeNode, EachNode, IterInfo, X_OPS, WRAPPER_NODES, ParseContext, _htmlBlockTags, HTML_BLOCK_TAGS, isBlockDomNode, isEmptyText, isIgnorableXChild, hasMeaningfulChilds, View, NodeEvents, NodeEvent, fwdIfCtxPred, fwdIfEventPred, fwdIfKey, fwdCtrl, fwdMeta, fwdAlt, MOD_WRAPPERS_FOR_ANY_EVENT, MOD_WRAPPERS_BY_EVENT, MOD_EFFECTS, NO_WRAPPERS, identityModifierWrapper;
|
|
2910
2879
|
var init_anode = __esm({
|
|
2911
2880
|
"src/anode.js"() {
|
|
2912
2881
|
init_attribute();
|
|
2913
|
-
init_collection();
|
|
2914
2882
|
init_iteration();
|
|
2915
2883
|
init_path();
|
|
2916
|
-
init_env();
|
|
2917
2884
|
init_value();
|
|
2918
2885
|
init_vdom();
|
|
2919
2886
|
BaseNode = class {
|
|
@@ -3253,20 +3220,11 @@ var init_anode = __esm({
|
|
|
3253
3220
|
const enricher = this.enrichWithVal?.evalAsHandler(stack) ?? null;
|
|
3254
3221
|
return { seq, filter, loopWith, enricher };
|
|
3255
3222
|
}
|
|
3256
|
-
// Rebuild the per-item binds for `key
|
|
3257
|
-
// { key, value }, then run @enrich-with (with @loop-with's iterData) if any.
|
|
3223
|
+
// Rebuild the per-item binds for `key` (see iteration.js bindsForKey).
|
|
3258
3224
|
enrichBinds(stack, key) {
|
|
3259
3225
|
const { seq, filter, loopWith, enricher } = this.eval(stack);
|
|
3260
|
-
const
|
|
3261
|
-
|
|
3262
|
-
if (enricher) {
|
|
3263
|
-
const { iterData } = unpackLoopResult(
|
|
3264
|
-
loopWith.call(stack.it, seq, makeLoopCtx(stack, filter)),
|
|
3265
|
-
seq
|
|
3266
|
-
);
|
|
3267
|
-
callEnricher(enricher, stack.it, binds, key, value, iterData);
|
|
3268
|
-
}
|
|
3269
|
-
return binds;
|
|
3226
|
+
const ctx = makeLoopCtx(stack, filter);
|
|
3227
|
+
return bindsForKey({ seq, it: stack.it, loopWith, enricher, ctx }, key);
|
|
3270
3228
|
}
|
|
3271
3229
|
};
|
|
3272
3230
|
X_OPS = {
|
|
@@ -3440,10 +3398,11 @@ var init_anode = __esm({
|
|
|
3440
3398
|
}
|
|
3441
3399
|
};
|
|
3442
3400
|
fwdIfCtxPred = (pred) => (w) => (that, f, args, ctx) => pred(ctx) ? w(that, f, args, ctx) : that;
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3401
|
+
fwdIfEventPred = (pred) => fwdIfCtxPred(({ e }) => pred(e));
|
|
3402
|
+
fwdIfKey = (keyName) => fwdIfEventPred(keyIs(keyName));
|
|
3403
|
+
fwdCtrl = fwdIfEventPred(macCtrl);
|
|
3404
|
+
fwdMeta = fwdIfEventPred((e) => e.metaKey);
|
|
3405
|
+
fwdAlt = fwdIfEventPred((e) => e.altKey);
|
|
3447
3406
|
MOD_WRAPPERS_FOR_ANY_EVENT = {
|
|
3448
3407
|
ctrl: fwdCtrl,
|
|
3449
3408
|
cmd: fwdCtrl,
|
|
@@ -3470,7 +3429,6 @@ var COMPONENT, Components, ComponentStack, ProvideInfo, LookupInfo, isString, is
|
|
|
3470
3429
|
var init_components = __esm({
|
|
3471
3430
|
"src/components.js"() {
|
|
3472
3431
|
init_anode();
|
|
3473
|
-
init_attribute();
|
|
3474
3432
|
init_value();
|
|
3475
3433
|
COMPONENT = /* @__PURE__ */ Symbol.for("tutuca.component");
|
|
3476
3434
|
Components = class {
|
|
@@ -3538,13 +3496,15 @@ var init_components = __esm({
|
|
|
3538
3496
|
getCompFor(v) {
|
|
3539
3497
|
return this.comps.getCompFor(v);
|
|
3540
3498
|
}
|
|
3541
|
-
// Handlers that answer an intent's `lex` leg. A name maps to a LIST
|
|
3542
|
-
// walks: a handler that returns PASS declines and hands
|
|
3543
|
-
//
|
|
3499
|
+
// Handlers that answer an intent's `lex` leg. A name maps to a LIST of plain
|
|
3500
|
+
// functions, because the leg walks: a handler that returns PASS declines and hands
|
|
3501
|
+
// the intent to the next one. Each runs with no `this` and takes a dispatcher
|
|
3502
|
+
// context as its final argument; resolving answers, throwing fails. A bare function
|
|
3503
|
+
// is accepted as a one-element list.
|
|
3544
3504
|
registerIntentHandlers(handlers) {
|
|
3545
3505
|
for (const name in handlers) {
|
|
3546
|
-
const fns =
|
|
3547
|
-
this.intentsByName[name] =
|
|
3506
|
+
const fns = handlers[name];
|
|
3507
|
+
this.intentsByName[name] = Array.isArray(fns) ? fns : [fns];
|
|
3548
3508
|
}
|
|
3549
3509
|
}
|
|
3550
3510
|
// Innermost scope first, then outward. Concatenated rather than first-match, so a
|
|
@@ -3574,14 +3534,12 @@ var init_components = __esm({
|
|
|
3574
3534
|
}
|
|
3575
3535
|
};
|
|
3576
3536
|
ProvideInfo = class {
|
|
3577
|
-
constructor(
|
|
3578
|
-
this.name = name;
|
|
3537
|
+
constructor(val) {
|
|
3579
3538
|
this.val = val;
|
|
3580
3539
|
}
|
|
3581
3540
|
};
|
|
3582
3541
|
LookupInfo = class {
|
|
3583
|
-
constructor(
|
|
3584
|
-
this.name = name;
|
|
3542
|
+
constructor(val) {
|
|
3585
3543
|
this.val = val;
|
|
3586
3544
|
}
|
|
3587
3545
|
};
|
|
@@ -3629,13 +3587,13 @@ var init_components = __esm({
|
|
|
3629
3587
|
continue;
|
|
3630
3588
|
}
|
|
3631
3589
|
const val = parseProvide(this._rawProvide[key], ctx);
|
|
3632
|
-
if (val) this.provide[key] = new ProvideInfo(
|
|
3590
|
+
if (val) this.provide[key] = new ProvideInfo(val);
|
|
3633
3591
|
}
|
|
3634
3592
|
for (const entry of this._rawLookup) {
|
|
3635
3593
|
const name = isString(entry) ? entry : isString(entry?.name) ? entry.name : null;
|
|
3636
3594
|
if (name === null) continue;
|
|
3637
3595
|
const defStr = isString(entry?.default) ? entry.default : null;
|
|
3638
|
-
this.lookup[name] = new LookupInfo(
|
|
3596
|
+
this.lookup[name] = new LookupInfo(defStr === null ? null : parseField(defStr, ctx));
|
|
3639
3597
|
}
|
|
3640
3598
|
for (const key in this.lookup)
|
|
3641
3599
|
if (this.provide[key] !== void 0)
|
|
@@ -6288,10 +6246,10 @@ function reportUnknownName(lx, code, name, candidates, info) {
|
|
|
6288
6246
|
lx.error(code, { ...info, name }, replaceNameSuggestion(name, candidates));
|
|
6289
6247
|
}
|
|
6290
6248
|
function checkConsistentAttrVal(lx, val, env, skipNameVal = false, errCtx = null, isRoot = true) {
|
|
6291
|
-
const
|
|
6292
|
-
if (
|
|
6249
|
+
const check = ATTR_VAL_CHECKERS[val?.constructor.name];
|
|
6250
|
+
if (check === void 0) return;
|
|
6293
6251
|
const recurse = (sub) => checkConsistentAttrVal(lx, sub, env, skipNameVal, errCtx, false);
|
|
6294
|
-
|
|
6252
|
+
check({ lx, val, env, errCtx, skipNameVal, recurse, isRoot });
|
|
6295
6253
|
}
|
|
6296
6254
|
function nodeCtxForNode(nodeKind) {
|
|
6297
6255
|
return NODE_KIND_TO_CTX[nodeKind] ?? null;
|
|
@@ -12836,12 +12794,12 @@ function computeViewsId(views) {
|
|
|
12836
12794
|
}
|
|
12837
12795
|
return s === "main" ? "" : s;
|
|
12838
12796
|
}
|
|
12839
|
-
var STOP, NEXT,
|
|
12797
|
+
var STOP, NEXT, DEFAULT_ROUTE, BindFrame, ObjectFrame, Stack;
|
|
12840
12798
|
var init_stack = __esm({
|
|
12841
12799
|
"src/stack.js"() {
|
|
12842
12800
|
STOP = /* @__PURE__ */ Symbol("STOP");
|
|
12843
12801
|
NEXT = /* @__PURE__ */ Symbol("NEXT");
|
|
12844
|
-
|
|
12802
|
+
DEFAULT_ROUTE = ["dyn", "lex"];
|
|
12845
12803
|
BindFrame = class {
|
|
12846
12804
|
constructor(it, binds, isFrame) {
|
|
12847
12805
|
this.it = it;
|
|
@@ -12929,20 +12887,6 @@ var init_stack = __esm({
|
|
|
12929
12887
|
lookupBind(name) {
|
|
12930
12888
|
return lookup(this.binds, name);
|
|
12931
12889
|
}
|
|
12932
|
-
// The `lex` leg: what a name means in the registration scope of the component being
|
|
12933
|
-
// rendered. The scope chain holds components, so this leg only ever answers for a
|
|
12934
|
-
// type name — for a value name it is a miss, which is why one default route serves
|
|
12935
|
-
// both. Guarded: a non-component `it` has no scope to ask.
|
|
12936
|
-
_lookupLex(name) {
|
|
12937
|
-
return this.comps.getCompFor(this.it)?.scope.lookupComponent(name) ?? null;
|
|
12938
|
-
}
|
|
12939
|
-
lookupRouted(name, route = DEFAULT_LOOKUP_ROUTE) {
|
|
12940
|
-
return routeLookup(
|
|
12941
|
-
route,
|
|
12942
|
-
() => this._lookupLex(name),
|
|
12943
|
-
() => this.lookupDynamic(name)
|
|
12944
|
-
);
|
|
12945
|
-
}
|
|
12946
12890
|
lookupFieldRaw(name) {
|
|
12947
12891
|
return this.it[name] ?? null;
|
|
12948
12892
|
}
|
|
@@ -12975,11 +12919,6 @@ var init_stack = __esm({
|
|
|
12975
12919
|
});
|
|
12976
12920
|
|
|
12977
12921
|
// src/oo.js
|
|
12978
|
-
function defaultToData(v) {
|
|
12979
|
-
if (v instanceof Map) return [...v.entries()];
|
|
12980
|
-
if (v instanceof Set) return [...v.values()];
|
|
12981
|
-
return v;
|
|
12982
|
-
}
|
|
12983
12922
|
function mkCompField(field, scope, args) {
|
|
12984
12923
|
const Comp = scope?.lookupComponent(field.type) ?? null;
|
|
12985
12924
|
if (Comp === null)
|
|
@@ -12999,8 +12938,7 @@ function classFromData(name, { fields = {}, methods, statics }) {
|
|
|
12999
12938
|
const value = fields[field];
|
|
13000
12939
|
const type3 = typeof value;
|
|
13001
12940
|
if (type3 === "string") b.addField(field, value, FieldString);
|
|
13002
|
-
else if (type3 === "number")
|
|
13003
|
-
b.addField(field, value, Number.isInteger(value) ? FieldInt : FieldFloat);
|
|
12941
|
+
else if (type3 === "number") b.addField(field, value, FieldFloat);
|
|
13004
12942
|
else if (type3 === "boolean") b.addField(field, value, FieldBool);
|
|
13005
12943
|
else if (Array.isArray(value)) b.addField(field, [...value], FieldList);
|
|
13006
12944
|
else if (value instanceof Set) b.addField(field, new Set(value), FieldSet);
|
|
@@ -13021,7 +12959,7 @@ function classFromData(name, { fields = {}, methods, statics }) {
|
|
|
13021
12959
|
return b.build();
|
|
13022
12960
|
}
|
|
13023
12961
|
function validateDraftFields(current2, draft) {
|
|
13024
|
-
const meta = current2
|
|
12962
|
+
const meta = metaOf(current2);
|
|
13025
12963
|
if (!meta) return;
|
|
13026
12964
|
for (const [name, field] of Object.entries(meta.fields)) {
|
|
13027
12965
|
const value = draft[name];
|
|
@@ -13041,7 +12979,7 @@ function assertNoReservedComponentStatics(statics = {}) {
|
|
|
13041
12979
|
}
|
|
13042
12980
|
}
|
|
13043
12981
|
}
|
|
13044
|
-
var BAD_VALUE2, nullCoercer, Field,
|
|
12982
|
+
var BAD_VALUE2, nullCoercer, Field, CHECK_TYPE_ANY, CHECK_TYPE_INT, CHECK_TYPE_FLOAT, CHECK_TYPE_BOOL, CHECK_TYPE_STRING, CHECK_TYPE_LIST, CHECK_TYPE_OBJECT, CHECK_TYPE_MAP, CHECK_TYPE_SET, COERCE_NONE, COERCE_BOOL, COERCE_STRING, COERCE_INT, COERCE_LIST, COERCE_OBJECT, COERCE_MAP, COERCE_SET, FieldBool, FieldAny, FieldString, FieldInt, FieldFloat, metaOf, getTypeName, FieldComp, FieldList, FieldObject, FieldMap, FieldSet, ClassBuilder, FIELD_CLASS, fieldsByTypeName, META_KEYS, RESERVED_COMPONENT_STATICS;
|
|
13045
12983
|
var init_oo = __esm({
|
|
13046
12984
|
"src/oo.js"() {
|
|
13047
12985
|
init_collection();
|
|
@@ -13055,23 +12993,10 @@ var init_oo = __esm({
|
|
|
13055
12993
|
this.name = name;
|
|
13056
12994
|
this.typeCheck = typeCheck;
|
|
13057
12995
|
this.coercer = coercer;
|
|
13058
|
-
this.checks = [];
|
|
13059
12996
|
this.defaultValue = defaultValue;
|
|
13060
12997
|
}
|
|
13061
|
-
toDataDef() {
|
|
13062
|
-
return { type: this.type, defaultValue: defaultToData(this.defaultValue) };
|
|
13063
|
-
}
|
|
13064
|
-
getFirstFailingCheck(v) {
|
|
13065
|
-
if (!this.typeCheck.isValid(v)) return this.typeCheck;
|
|
13066
|
-
for (const check2 of this.checks) if (!check2.isValid(v)) return check2;
|
|
13067
|
-
return null;
|
|
13068
|
-
}
|
|
13069
12998
|
isValid(v) {
|
|
13070
|
-
return this.
|
|
13071
|
-
}
|
|
13072
|
-
addCheck(check2) {
|
|
13073
|
-
this.checks.push(check2);
|
|
13074
|
-
return this;
|
|
12999
|
+
return this.typeCheck(v);
|
|
13075
13000
|
}
|
|
13076
13001
|
coerceOr(v, defaultValue = null) {
|
|
13077
13002
|
if (this.isValid(v)) return v;
|
|
@@ -13082,135 +13007,79 @@ var init_oo = __esm({
|
|
|
13082
13007
|
return this.coerceOr(v, this.defaultValue);
|
|
13083
13008
|
}
|
|
13084
13009
|
};
|
|
13085
|
-
|
|
13086
|
-
|
|
13087
|
-
|
|
13088
|
-
|
|
13089
|
-
|
|
13090
|
-
|
|
13091
|
-
|
|
13092
|
-
|
|
13093
|
-
|
|
13094
|
-
|
|
13095
|
-
|
|
13096
|
-
|
|
13097
|
-
|
|
13098
|
-
|
|
13099
|
-
|
|
13100
|
-
|
|
13101
|
-
|
|
13102
|
-
|
|
13103
|
-
return
|
|
13104
|
-
|
|
13105
|
-
getMessage(v) {
|
|
13106
|
-
return this._getMessage(v);
|
|
13107
|
-
}
|
|
13010
|
+
CHECK_TYPE_ANY = (_v) => true;
|
|
13011
|
+
CHECK_TYPE_INT = Number.isInteger;
|
|
13012
|
+
CHECK_TYPE_FLOAT = Number.isFinite;
|
|
13013
|
+
CHECK_TYPE_BOOL = (v) => typeof v === "boolean";
|
|
13014
|
+
CHECK_TYPE_STRING = (v) => typeof v === "string";
|
|
13015
|
+
CHECK_TYPE_LIST = Array.isArray;
|
|
13016
|
+
CHECK_TYPE_OBJECT = isPlainObject;
|
|
13017
|
+
CHECK_TYPE_MAP = (v) => v instanceof Map;
|
|
13018
|
+
CHECK_TYPE_SET = (v) => v instanceof Set;
|
|
13019
|
+
COERCE_NONE = (_v) => null;
|
|
13020
|
+
COERCE_BOOL = (v) => !!v;
|
|
13021
|
+
COERCE_STRING = (v) => v?.toString?.() ?? "";
|
|
13022
|
+
COERCE_INT = (v) => Number.isFinite(v) ? Math.trunc(v) : null;
|
|
13023
|
+
COERCE_LIST = (v) => Array.isArray(v) ? [...v] : null;
|
|
13024
|
+
COERCE_OBJECT = (v) => isPlainObject(v) ? { ...v } : null;
|
|
13025
|
+
COERCE_MAP = (v) => {
|
|
13026
|
+
if (v instanceof Map) return new Map(v);
|
|
13027
|
+
if (Array.isArray(v) || isPlainObject(v))
|
|
13028
|
+
return new Map(Array.isArray(v) ? v : Object.entries(v));
|
|
13029
|
+
return null;
|
|
13108
13030
|
};
|
|
13109
|
-
|
|
13110
|
-
CHECK_TYPE_INT = check(Number.isInteger, "Integer expected");
|
|
13111
|
-
CHECK_TYPE_FLOAT = check(Number.isFinite, "Float expected");
|
|
13112
|
-
CHECK_TYPE_BOOL = check((v) => typeof v === "boolean", "Boolean expected");
|
|
13113
|
-
CHECK_TYPE_STRING = check((v) => typeof v === "string", "String expected");
|
|
13114
|
-
CHECK_TYPE_LIST = check(Array.isArray, "Array expected");
|
|
13115
|
-
CHECK_TYPE_OBJECT = check(isPlainObject, "Plain object expected");
|
|
13116
|
-
CHECK_TYPE_MAP = check((v) => v instanceof Map, "Map expected");
|
|
13117
|
-
CHECK_TYPE_SET = check((v) => v instanceof Set, "Set expected");
|
|
13031
|
+
COERCE_SET = (v) => v instanceof Set || Array.isArray(v) ? new Set(v) : null;
|
|
13118
13032
|
FieldBool = class extends Field {
|
|
13119
13033
|
constructor(name, defaultValue = false) {
|
|
13120
|
-
super("bool", name, CHECK_TYPE_BOOL,
|
|
13034
|
+
super("bool", name, CHECK_TYPE_BOOL, COERCE_BOOL, defaultValue);
|
|
13121
13035
|
}
|
|
13122
13036
|
};
|
|
13123
13037
|
FieldAny = class extends Field {
|
|
13124
13038
|
constructor(name, defaultValue = null) {
|
|
13125
13039
|
super("any", name, CHECK_TYPE_ANY, nullCoercer, defaultValue);
|
|
13126
13040
|
}
|
|
13127
|
-
toDataDef() {
|
|
13128
|
-
return { type: getTypeName(this.defaultValue) ?? "any", defaultValue: this.defaultValue };
|
|
13129
|
-
}
|
|
13130
13041
|
};
|
|
13131
13042
|
FieldString = class extends Field {
|
|
13132
13043
|
constructor(name, defaultValue = "") {
|
|
13133
|
-
super("text", name, CHECK_TYPE_STRING,
|
|
13044
|
+
super("text", name, CHECK_TYPE_STRING, COERCE_STRING, defaultValue);
|
|
13134
13045
|
}
|
|
13135
13046
|
};
|
|
13136
13047
|
FieldInt = class extends Field {
|
|
13137
13048
|
constructor(name, defaultValue = 0) {
|
|
13138
|
-
super(
|
|
13139
|
-
"int",
|
|
13140
|
-
name,
|
|
13141
|
-
CHECK_TYPE_INT,
|
|
13142
|
-
(v) => Number.isFinite(v) ? Math.trunc(v) : null,
|
|
13143
|
-
defaultValue
|
|
13144
|
-
);
|
|
13049
|
+
super("int", name, CHECK_TYPE_INT, COERCE_INT, defaultValue);
|
|
13145
13050
|
}
|
|
13146
13051
|
};
|
|
13147
13052
|
FieldFloat = class extends Field {
|
|
13148
13053
|
constructor(name, defaultValue = 0) {
|
|
13149
|
-
super("float", name, CHECK_TYPE_FLOAT,
|
|
13150
|
-
}
|
|
13151
|
-
};
|
|
13152
|
-
getTypeName = (v) => v?.constructor?.[COMPONENT]?.name ?? v?.constructor?.getMetaClass?.()?.name ?? null;
|
|
13153
|
-
CheckTypeName = class {
|
|
13154
|
-
constructor(typeName) {
|
|
13155
|
-
this.typeName = typeName;
|
|
13156
|
-
}
|
|
13157
|
-
isValid(v) {
|
|
13158
|
-
return getTypeName(v) === this.typeName;
|
|
13159
|
-
}
|
|
13160
|
-
getMessage(v) {
|
|
13161
|
-
return `Expected "${this.typeName}", got "${getTypeName(v)}"`;
|
|
13054
|
+
super("float", name, CHECK_TYPE_FLOAT, COERCE_NONE, defaultValue);
|
|
13162
13055
|
}
|
|
13163
13056
|
};
|
|
13057
|
+
metaOf = (v) => v?.constructor?.[COMPONENT] ?? v?.constructor?.getMetaClass?.();
|
|
13058
|
+
getTypeName = (v) => metaOf(v)?.name ?? null;
|
|
13164
13059
|
FieldComp = class extends Field {
|
|
13165
13060
|
constructor(type3, name, args) {
|
|
13166
|
-
super(type3, name,
|
|
13061
|
+
super(type3, name, (v) => getTypeName(v) === type3, nullCoercer, null);
|
|
13167
13062
|
this.args = args;
|
|
13168
13063
|
}
|
|
13169
|
-
toDataDef() {
|
|
13170
|
-
return { component: this.type, args: this.args };
|
|
13171
|
-
}
|
|
13172
13064
|
};
|
|
13173
13065
|
FieldList = class extends Field {
|
|
13174
13066
|
constructor(name, defaultValue = []) {
|
|
13175
|
-
super("list", name, CHECK_TYPE_LIST,
|
|
13067
|
+
super("list", name, CHECK_TYPE_LIST, COERCE_LIST, defaultValue);
|
|
13176
13068
|
}
|
|
13177
13069
|
};
|
|
13178
13070
|
FieldObject = class extends Field {
|
|
13179
13071
|
constructor(name, defaultValue = {}) {
|
|
13180
|
-
super(
|
|
13181
|
-
"object",
|
|
13182
|
-
name,
|
|
13183
|
-
CHECK_TYPE_OBJECT,
|
|
13184
|
-
(v) => isPlainObject(v) ? { ...v } : null,
|
|
13185
|
-
defaultValue
|
|
13186
|
-
);
|
|
13072
|
+
super("object", name, CHECK_TYPE_OBJECT, COERCE_OBJECT, defaultValue);
|
|
13187
13073
|
}
|
|
13188
13074
|
};
|
|
13189
13075
|
FieldMap = class extends Field {
|
|
13190
13076
|
constructor(name, defaultValue = /* @__PURE__ */ new Map()) {
|
|
13191
|
-
super(
|
|
13192
|
-
"map",
|
|
13193
|
-
name,
|
|
13194
|
-
CHECK_TYPE_MAP,
|
|
13195
|
-
(v) => {
|
|
13196
|
-
if (v instanceof Map) return new Map(v);
|
|
13197
|
-
if (Array.isArray(v) || isPlainObject(v))
|
|
13198
|
-
return new Map(Array.isArray(v) ? v : Object.entries(v));
|
|
13199
|
-
return null;
|
|
13200
|
-
},
|
|
13201
|
-
defaultValue
|
|
13202
|
-
);
|
|
13077
|
+
super("map", name, CHECK_TYPE_MAP, COERCE_MAP, defaultValue);
|
|
13203
13078
|
}
|
|
13204
13079
|
};
|
|
13205
13080
|
FieldSet = class extends Field {
|
|
13206
13081
|
constructor(name, defaultValue = /* @__PURE__ */ new Set()) {
|
|
13207
|
-
super(
|
|
13208
|
-
"set",
|
|
13209
|
-
name,
|
|
13210
|
-
CHECK_TYPE_SET,
|
|
13211
|
-
(v) => v instanceof Set || Array.isArray(v) ? new Set(v) : null,
|
|
13212
|
-
defaultValue
|
|
13213
|
-
);
|
|
13082
|
+
super("set", name, CHECK_TYPE_SET, COERCE_SET, defaultValue);
|
|
13214
13083
|
}
|
|
13215
13084
|
};
|
|
13216
13085
|
ClassBuilder = class {
|
|
@@ -13336,7 +13205,7 @@ function warnNotIntent(verb) {
|
|
|
13336
13205
|
function rootDispatcher(transactor) {
|
|
13337
13206
|
return new Dispatcher(new Path([]), transactor, null);
|
|
13338
13207
|
}
|
|
13339
|
-
var State2, Transactor, Transaction, InputEvent, NameArgsTransaction, SendEvent, IntentEvent, PASS, REFUSAL_RING_CAP,
|
|
13208
|
+
var State2, Transactor, Transaction, InputEvent, NameArgsTransaction, SendEvent, IntentEvent, PASS, REFUSAL_RING_CAP, INTENT_DEPTH, IntentWalk, Completion, Dispatcher, EventContext, PathChanges;
|
|
13340
13209
|
var init_transactor = __esm({
|
|
13341
13210
|
"src/transactor.js"() {
|
|
13342
13211
|
init_components();
|
|
@@ -13414,28 +13283,46 @@ var init_transactor = __esm({
|
|
|
13414
13283
|
if (i !== -1) this._refusalObservers.splice(i, 1);
|
|
13415
13284
|
};
|
|
13416
13285
|
}
|
|
13417
|
-
// Build and dispatch
|
|
13418
|
-
//
|
|
13419
|
-
//
|
|
13420
|
-
//
|
|
13286
|
+
// Build and dispatch one observer record. Pins field-resolved keys (e.g. a
|
|
13287
|
+
// `.a[.selId]` render target reconstructed from a DOM event) against the root the
|
|
13288
|
+
// handler read, so pathKeys carries concrete keys instead of dropping the dynamic
|
|
13289
|
+
// step. No-op when nobody is observing.
|
|
13290
|
+
_emitRecord(root, { kind, name, args, path, targetPath, handler, handlerName, matched, before, after, parent }) {
|
|
13291
|
+
if (this._observers.length === 0) return;
|
|
13292
|
+
const pinned = path.pinKeys(root);
|
|
13293
|
+
this._emit({
|
|
13294
|
+
kind,
|
|
13295
|
+
name,
|
|
13296
|
+
args: args ?? null,
|
|
13297
|
+
path: pinned,
|
|
13298
|
+
pathKeys: pinned.toKeys(),
|
|
13299
|
+
targetPath,
|
|
13300
|
+
handler: handler ?? null,
|
|
13301
|
+
handlerName: handlerName ?? (handler?.name || null),
|
|
13302
|
+
matched: matched ?? null,
|
|
13303
|
+
before,
|
|
13304
|
+
after,
|
|
13305
|
+
parent,
|
|
13306
|
+
timestamp: Date.now()
|
|
13307
|
+
});
|
|
13308
|
+
}
|
|
13309
|
+
// The observer record for a settled transaction. The resolved handler
|
|
13310
|
+
// (`_resolvedHandler`/`_matched`) and per-leaf before/after (`_before`/`_after`)
|
|
13311
|
+
// were captured while the handler ran (see callHandler / Transaction.run).
|
|
13421
13312
|
_emitTransaction(transaction, root) {
|
|
13422
13313
|
if (this._observers.length === 0) return;
|
|
13423
13314
|
if (transaction._resolvedHandler === void 0) return;
|
|
13424
|
-
|
|
13425
|
-
this._emit({
|
|
13315
|
+
this._emitRecord(root, {
|
|
13426
13316
|
kind: transaction.observeKind,
|
|
13427
13317
|
name: transaction.observeName,
|
|
13428
|
-
args: transaction.args
|
|
13429
|
-
path,
|
|
13430
|
-
pathKeys: path.toKeys(),
|
|
13318
|
+
args: transaction.args,
|
|
13319
|
+
path: transaction.getTransactionPath(),
|
|
13431
13320
|
targetPath: transaction.targetPath ?? transaction.path,
|
|
13432
|
-
handler: transaction._resolvedHandler
|
|
13433
|
-
|
|
13434
|
-
matched: transaction._matched ?? null,
|
|
13321
|
+
handler: transaction._resolvedHandler,
|
|
13322
|
+
matched: transaction._matched,
|
|
13435
13323
|
before: transaction._before,
|
|
13436
13324
|
after: transaction._after,
|
|
13437
|
-
parent: transaction.parentTransaction
|
|
13438
|
-
timestamp: Date.now()
|
|
13325
|
+
parent: transaction.parentTransaction
|
|
13439
13326
|
});
|
|
13440
13327
|
}
|
|
13441
13328
|
// Make `child` a tracked unit of `parent`'s subtree: the parent's completion stays open
|
|
@@ -13530,7 +13417,7 @@ var init_transactor = __esm({
|
|
|
13530
13417
|
// rather than throwing, so a stray call from the wrong place is a message and not a
|
|
13531
13418
|
// crash. `walk` is undefined here, which is how ctx.reply/ctx.fail tell the two apart.
|
|
13532
13419
|
stop() {
|
|
13533
|
-
|
|
13420
|
+
warnNotIntent("stop");
|
|
13534
13421
|
}
|
|
13535
13422
|
forward(_opts) {
|
|
13536
13423
|
console.warn('ctx.forward() needs a "receive" or "intent" handler - ignored');
|
|
@@ -13615,11 +13502,8 @@ var init_transactor = __esm({
|
|
|
13615
13502
|
}
|
|
13616
13503
|
this.transactor.pushIntent(this.dispatchPath, name, args, rest, this);
|
|
13617
13504
|
}
|
|
13618
|
-
buildStack(root, comps) {
|
|
13619
|
-
return this.path.toTransactionPath().buildStack(Stack.root(comps, root, this));
|
|
13620
|
-
}
|
|
13621
13505
|
getHandlerAndArgs(root, _instance, comps) {
|
|
13622
|
-
const stack = this.buildStack(root,
|
|
13506
|
+
const stack = this.path.toTransactionPath().buildStack(Stack.root(comps, root, this));
|
|
13623
13507
|
const [handler, args] = this.handler.getHandlerAndArgs(stack, this);
|
|
13624
13508
|
this._handlerArgs = [...args];
|
|
13625
13509
|
const path = this.dispatchPath;
|
|
@@ -13721,7 +13605,6 @@ var init_transactor = __esm({
|
|
|
13721
13605
|
};
|
|
13722
13606
|
PASS = /* @__PURE__ */ Symbol.for("tutuca.intent.pass");
|
|
13723
13607
|
REFUSAL_RING_CAP = 200;
|
|
13724
|
-
DEFAULT_ROUTE = ["dyn", "lex"];
|
|
13725
13608
|
INTENT_DEPTH = 64;
|
|
13726
13609
|
IntentWalk = class {
|
|
13727
13610
|
constructor(transactor, path, name, args, opts, parent, release) {
|
|
@@ -13770,24 +13653,19 @@ var init_transactor = __esm({
|
|
|
13770
13653
|
const txnPath = this.origin.toTransactionPath();
|
|
13771
13654
|
const leaf = txnPath.lookup(root);
|
|
13772
13655
|
const chain = this.transactor.comps.getIntentChainFor(leaf, this.name);
|
|
13773
|
-
|
|
13774
|
-
|
|
13775
|
-
this.
|
|
13776
|
-
|
|
13777
|
-
|
|
13778
|
-
|
|
13779
|
-
|
|
13780
|
-
|
|
13781
|
-
|
|
13782
|
-
|
|
13783
|
-
|
|
13784
|
-
|
|
13785
|
-
|
|
13786
|
-
after: void 0,
|
|
13787
|
-
parent: this.parent,
|
|
13788
|
-
timestamp: Date.now()
|
|
13789
|
-
});
|
|
13790
|
-
}
|
|
13656
|
+
this.transactor._emitRecord(root, {
|
|
13657
|
+
kind: "intent",
|
|
13658
|
+
name: this.name,
|
|
13659
|
+
args: this.args,
|
|
13660
|
+
path: txnPath,
|
|
13661
|
+
targetPath: this.origin,
|
|
13662
|
+
handler: chain[0],
|
|
13663
|
+
handlerName: chain[0]?.name || this.name,
|
|
13664
|
+
matched: chain.length > 0 ? "exact" : "none",
|
|
13665
|
+
before: leaf,
|
|
13666
|
+
after: void 0,
|
|
13667
|
+
parent: this.parent
|
|
13668
|
+
});
|
|
13791
13669
|
if (chain.length === 0) return this.advance();
|
|
13792
13670
|
const p = this._runLex(chain, 0);
|
|
13793
13671
|
this.transactor._inflight.add(p);
|
|
@@ -13798,7 +13676,7 @@ var init_transactor = __esm({
|
|
|
13798
13676
|
if (i >= chain.length) return this.advance();
|
|
13799
13677
|
const ctx = new Dispatcher(this.origin, this.transactor, this.parent);
|
|
13800
13678
|
try {
|
|
13801
|
-
const res = await chain[i].
|
|
13679
|
+
const res = await chain[i].apply(null, [...this.args, ctx]);
|
|
13802
13680
|
if (res === PASS) return this._runLex(chain, i + 1);
|
|
13803
13681
|
this.answer("Ok", res);
|
|
13804
13682
|
} catch (error) {
|
|
@@ -13951,9 +13829,8 @@ var init_transactor = __esm({
|
|
|
13951
13829
|
// the same spelling as `ctx.intent` — `["dyn"]` the render ancestry, `["lex"]` the
|
|
13952
13830
|
// registration scope, default both.
|
|
13953
13831
|
lookup(name, opts) {
|
|
13954
|
-
const route = opts?.route ?? DEFAULT_LOOKUP_ROUTE;
|
|
13955
13832
|
return routeLookup(
|
|
13956
|
-
route,
|
|
13833
|
+
opts?.route ?? DEFAULT_ROUTE,
|
|
13957
13834
|
() => this._lookupLex(name),
|
|
13958
13835
|
() => this._stack()?.lookupDynamic(name) ?? null
|
|
13959
13836
|
);
|
|
@@ -13972,12 +13849,10 @@ var init_transactor = __esm({
|
|
|
13972
13849
|
// can only ever answer with one; the `dyn` leg reads a binding an ancestor
|
|
13973
13850
|
// published, so it is the leg that has to be checked.
|
|
13974
13851
|
lookupType(name, opts) {
|
|
13975
|
-
const
|
|
13852
|
+
const route = opts?.route ?? DEFAULT_ROUTE;
|
|
13853
|
+
const v = this.lookup(name, { route });
|
|
13976
13854
|
if (v == null) {
|
|
13977
|
-
this.transactor.refuse("TYPE_NOT_FOUND", {
|
|
13978
|
-
name,
|
|
13979
|
-
route: opts?.route ?? DEFAULT_LOOKUP_ROUTE
|
|
13980
|
-
});
|
|
13855
|
+
this.transactor.refuse("TYPE_NOT_FOUND", { name, route });
|
|
13981
13856
|
return null;
|
|
13982
13857
|
}
|
|
13983
13858
|
if (v?.[COMPONENT] == null) {
|
|
@@ -14140,7 +14015,14 @@ var init_app = __esm({
|
|
|
14140
14015
|
const { type: type3 } = e;
|
|
14141
14016
|
const isDrag = type3 === "dragover" || type3 === "dragstart" || type3 === "dragend" || type3 === "drop";
|
|
14142
14017
|
const { rootNode: root, maxEventNodeDepth: maxDepth, comps, transactor } = this;
|
|
14143
|
-
const [path, handlers] = Path.
|
|
14018
|
+
const [path, handlers] = Path.fromNodeAndEventName(
|
|
14019
|
+
e.target,
|
|
14020
|
+
type3,
|
|
14021
|
+
root,
|
|
14022
|
+
maxDepth,
|
|
14023
|
+
comps,
|
|
14024
|
+
!isDrag
|
|
14025
|
+
);
|
|
14144
14026
|
if (isDrag) this._handleDragEvent(e, type3, path);
|
|
14145
14027
|
if (path !== null && handlers !== null)
|
|
14146
14028
|
for (const handler of handlers) transactor.transactInputNow(path, e, handler, this.dragInfo);
|
|
@@ -14202,7 +14084,7 @@ var init_app = __esm({
|
|
|
14202
14084
|
const value = txnPath.lookup(rootValue);
|
|
14203
14085
|
const dragType = e.target.dataset.dragtype ?? "?";
|
|
14204
14086
|
const stack = path.toTransactionPath().buildStack(this.makeStack(rootValue));
|
|
14205
|
-
this.dragInfo = new DragInfo(
|
|
14087
|
+
this.dragInfo = new DragInfo(stack, value, dragType, e.target);
|
|
14206
14088
|
} else if (type3 === "drop") {
|
|
14207
14089
|
e.preventDefault();
|
|
14208
14090
|
this._cleanDragOverAttrs();
|
|
@@ -14305,10 +14187,8 @@ var init_app = __esm({
|
|
|
14305
14187
|
};
|
|
14306
14188
|
listenerOpts = (name) => name === "touchmove" ? { passive: false } : void 0;
|
|
14307
14189
|
DragInfo = class {
|
|
14308
|
-
constructor(
|
|
14309
|
-
this.path = path;
|
|
14190
|
+
constructor(stack, val, type3, node) {
|
|
14310
14191
|
this.stack = stack;
|
|
14311
|
-
this.e = e;
|
|
14312
14192
|
this.val = val;
|
|
14313
14193
|
this.type = type3;
|
|
14314
14194
|
this.node = node;
|
|
@@ -14444,6 +14324,8 @@ var init_renderer = __esm({
|
|
|
14444
14324
|
setNullCache() {
|
|
14445
14325
|
this.cache = new NullDomCache();
|
|
14446
14326
|
}
|
|
14327
|
+
// Library utilities for consumers embedding tutuca: render a value to a detached
|
|
14328
|
+
// DOM node / an HTML string. Not called by the framework itself.
|
|
14447
14329
|
renderToDOM(stack, val) {
|
|
14448
14330
|
const rootNode = document.createElement("div");
|
|
14449
14331
|
const rOpts = { document };
|
|
@@ -15786,7 +15668,7 @@ ${JSON.stringify({ imports }, null, 6)}
|
|
|
15786
15668
|
</html>
|
|
15787
15669
|
`;
|
|
15788
15670
|
}
|
|
15789
|
-
function renderBootstrap(devModuleUrls, { margauiEnabled, margauiThemeUrl, check
|
|
15671
|
+
function renderBootstrap(devModuleUrls, { margauiEnabled, margauiThemeUrl, check, inspect: inspect3, noCache }) {
|
|
15790
15672
|
const lines = ['import { mountStorybook } from "tutuca/storybook";'];
|
|
15791
15673
|
if (margauiEnabled) {
|
|
15792
15674
|
lines.push('import { compileClassesToStyleText } from "tutuca/extra";');
|
|
@@ -15795,7 +15677,7 @@ function renderBootstrap(devModuleUrls, { margauiEnabled, margauiThemeUrl, check
|
|
|
15795
15677
|
if (inspect3) {
|
|
15796
15678
|
lines.push('import { shadowCheckComponent, runTests, expect } from "tutuca/dev";');
|
|
15797
15679
|
}
|
|
15798
|
-
if (
|
|
15680
|
+
if (check) lines.push('import { check } from "tutuca/dev";');
|
|
15799
15681
|
devModuleUrls.forEach((url, i) => {
|
|
15800
15682
|
lines.push(`import * as m${i} from ${JSON.stringify(url)};`);
|
|
15801
15683
|
});
|
|
@@ -15810,7 +15692,7 @@ function renderBootstrap(devModuleUrls, { margauiEnabled, margauiThemeUrl, check
|
|
|
15810
15692
|
const opts = optParts.length ? `{ ${optParts.join(", ")} }` : "{}";
|
|
15811
15693
|
lines.push("");
|
|
15812
15694
|
lines.push(`const app = await mountStorybook("#app", [${modules}], ${opts});`);
|
|
15813
|
-
if (
|
|
15695
|
+
if (check) lines.push("check(app);");
|
|
15814
15696
|
lines.push("");
|
|
15815
15697
|
return lines.join("\n");
|
|
15816
15698
|
}
|
|
@@ -15968,7 +15850,7 @@ async function run5(argv, opts = {}) {
|
|
|
15968
15850
|
const margauiEnabled = !parsed.values["no-margaui"];
|
|
15969
15851
|
const margauiOverride = parsed.values.margaui;
|
|
15970
15852
|
const forceMargauiCdn = parsed.values["margaui-cdn"];
|
|
15971
|
-
const
|
|
15853
|
+
const check = !parsed.values["no-check"];
|
|
15972
15854
|
const inspect3 = !parsed.values["no-inspect"];
|
|
15973
15855
|
const noCache = parsed.values["no-cache"];
|
|
15974
15856
|
const self = findSelf();
|
|
@@ -15992,7 +15874,7 @@ async function run5(argv, opts = {}) {
|
|
|
15992
15874
|
renderBootstrap(devModuleUrls, {
|
|
15993
15875
|
margauiEnabled,
|
|
15994
15876
|
margauiThemeUrl: mg2.themeUrl,
|
|
15995
|
-
check
|
|
15877
|
+
check,
|
|
15996
15878
|
inspect: inspect3,
|
|
15997
15879
|
noCache
|
|
15998
15880
|
})
|
|
@@ -16017,7 +15899,7 @@ async function run5(argv, opts = {}) {
|
|
|
16017
15899
|
projectDir,
|
|
16018
15900
|
tutuca: { source, base: base2, version: self.version },
|
|
16019
15901
|
margaui: margauiEnabled ? { source: mg2.source, jsUrl: mg2.jsUrl, themeUrl: mg2.themeUrl } : null,
|
|
16020
|
-
options: { margaui: margauiEnabled, check
|
|
15902
|
+
options: { margaui: margauiEnabled, check, noCache, runTests: !parsed.values["no-tests"] },
|
|
16021
15903
|
imports: imports2,
|
|
16022
15904
|
modules,
|
|
16023
15905
|
tests,
|
|
@@ -16032,7 +15914,7 @@ async function run5(argv, opts = {}) {
|
|
|
16032
15914
|
`tutuca storybook dry run (no server started)
|
|
16033
15915
|
project: ${projectDir}
|
|
16034
15916
|
tutuca runtime: ${source} (${base2}, version ${self.version})
|
|
16035
|
-
margaui: ${margauiEnabled ? `on (${mg2.source})` : "off"}, in-browser check: ${
|
|
15917
|
+
margaui: ${margauiEnabled ? `on (${mg2.source})` : "off"}, in-browser check: ${check ? "on" : "off"}, cache: ${noCache ? "off" : "on"}
|
|
16036
15918
|
${modules.length} dev module(s):
|
|
16037
15919
|
`
|
|
16038
15920
|
);
|
|
@@ -16106,7 +15988,7 @@ async function run5(argv, opts = {}) {
|
|
|
16106
15988
|
const bootstrapJs = renderBootstrap(devModuleUrls, {
|
|
16107
15989
|
margauiEnabled,
|
|
16108
15990
|
margauiThemeUrl: mg.themeUrl,
|
|
16109
|
-
check
|
|
15991
|
+
check,
|
|
16110
15992
|
inspect: inspect3,
|
|
16111
15993
|
noCache
|
|
16112
15994
|
});
|