tutuca 0.11.0 → 0.11.2
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 +264 -361
- package/dist/tutuca-components.js +175 -175
- package/dist/tutuca-dev.ext.js +250 -323
- package/dist/tutuca-dev.js +250 -323
- package/dist/tutuca-dev.min.js +4 -4
- package/dist/tutuca-extra.ext.js +55 -46
- package/dist/tutuca-extra.js +55 -46
- package/dist/tutuca-extra.min.js +3 -3
- package/dist/tutuca-storybook.js +29 -29
- package/dist/tutuca.ext.js +55 -46
- package/dist/tutuca.js +55 -46
- package/dist/tutuca.min.js +3 -3
- package/package.json +4 -3
- package/skill/margaui/SKILL.md +0 -105
- package/skill/margaui/components/accordion.md +0 -127
- package/skill/margaui/components/alert.md +0 -174
- package/skill/margaui/components/aura.md +0 -97
- package/skill/margaui/components/avatar.md +0 -220
- package/skill/margaui/components/badge.md +0 -193
- package/skill/margaui/components/breadcrumbs.md +0 -103
- package/skill/margaui/components/button.md +0 -322
- package/skill/margaui/components/calendar.md +0 -67
- package/skill/margaui/components/card.md +0 -373
- package/skill/margaui/components/carousel.md +0 -387
- package/skill/margaui/components/chat.md +0 -171
- package/skill/margaui/components/checkbox.md +0 -101
- package/skill/margaui/components/collapse.md +0 -172
- package/skill/margaui/components/countdown.md +0 -165
- package/skill/margaui/components/diff.md +0 -53
- package/skill/margaui/components/divider.md +0 -107
- package/skill/margaui/components/dock.md +0 -173
- package/skill/margaui/components/drawer.md +0 -184
- package/skill/margaui/components/dropdown.md +0 -388
- package/skill/margaui/components/fab.md +0 -346
- package/skill/margaui/components/fieldset.md +0 -88
- package/skill/margaui/components/file-input.md +0 -84
- package/skill/margaui/components/filter.md +0 -52
- package/skill/margaui/components/footer.md +0 -583
- package/skill/margaui/components/hero.md +0 -135
- package/skill/margaui/components/hover-3d.md +0 -129
- package/skill/margaui/components/hover-gallery.md +0 -49
- package/skill/margaui/components/indicator.md +0 -265
- package/skill/margaui/components/input.md +0 -389
- package/skill/margaui/components/join.md +0 -100
- package/skill/margaui/components/kbd.md +0 -127
- package/skill/margaui/components/label.md +0 -102
- package/skill/margaui/components/link.md +0 -96
- package/skill/margaui/components/list.md +0 -182
- package/skill/margaui/components/loading.md +0 -105
- package/skill/margaui/components/mask.md +0 -168
- package/skill/margaui/components/megamenu.md +0 -131
- package/skill/margaui/components/menu.md +0 -887
- package/skill/margaui/components/mockup-browser.md +0 -39
- package/skill/margaui/components/mockup-code.md +0 -81
- package/skill/margaui/components/mockup-phone.md +0 -39
- package/skill/margaui/components/mockup-window.md +0 -33
- package/skill/margaui/components/modal.md +0 -196
- package/skill/margaui/components/navbar.md +0 -282
- package/skill/margaui/components/otp.md +0 -171
- package/skill/margaui/components/pagination.md +0 -122
- package/skill/margaui/components/progress.md +0 -135
- package/skill/margaui/components/radial-progress.md +0 -67
- package/skill/margaui/components/radio.md +0 -133
- package/skill/margaui/components/range.md +0 -134
- package/skill/margaui/components/rating.md +0 -170
- package/skill/margaui/components/select.md +0 -225
- package/skill/margaui/components/skeleton.md +0 -64
- package/skill/margaui/components/stack.md +0 -142
- package/skill/margaui/components/stat.md +0 -254
- package/skill/margaui/components/status.md +0 -73
- package/skill/margaui/components/steps.md +0 -138
- package/skill/margaui/components/swap.md +0 -152
- package/skill/margaui/components/tab.md +0 -248
- package/skill/margaui/components/table.md +0 -1018
- package/skill/margaui/components/text-rotate.md +0 -91
- package/skill/margaui/components/textarea.md +0 -85
- package/skill/margaui/components/theme-controller.md +0 -266
- package/skill/margaui/components/timeline.md +0 -1356
- package/skill/margaui/components/toast.md +0 -165
- package/skill/margaui/components/toggle.md +0 -135
- package/skill/margaui/components/tooltip.md +0 -181
- package/skill/margaui/components/validator.md +0 -163
- package/skill/tutuca/SKILL.md +0 -56
- package/skill/tutuca/advanced.md +0 -212
- package/skill/tutuca/cli.md +0 -239
- package/skill/tutuca/component-design.md +0 -168
- package/skill/tutuca/core.md +0 -908
- package/skill/tutuca/iteration.md +0 -207
- package/skill/tutuca/macros.md +0 -86
- package/skill/tutuca/margaui.md +0 -175
- package/skill/tutuca/messages-and-intents.md +0 -399
- package/skill/tutuca/patterns/README.md +0 -48
- package/skill/tutuca/patterns/add-a-story.md +0 -26
- package/skill/tutuca/patterns/bind-text-and-attributes.md +0 -30
- package/skill/tutuca/patterns/conditional-attribute-value.md +0 -29
- package/skill/tutuca/patterns/coordinate-components.md +0 -54
- package/skill/tutuca/patterns/edit-through-a-dynamic-target.md +0 -27
- package/skill/tutuca/patterns/enrich-each-item.md +0 -25
- package/skill/tutuca/patterns/file-input.md +0 -39
- package/skill/tutuca/patterns/filter-a-list.md +0 -25
- package/skill/tutuca/patterns/filter-and-paginate.md +0 -60
- package/skill/tutuca/patterns/handle-events.md +0 -38
- package/skill/tutuca/patterns/iterate-a-list.md +0 -18
- package/skill/tutuca/patterns/paginate-a-list.md +0 -29
- package/skill/tutuca/patterns/render-a-child-component.md +0 -21
- package/skill/tutuca/patterns/reuse-markup-with-macros.md +0 -36
- package/skill/tutuca/patterns/share-state-across-the-tree.md +0 -38
- package/skill/tutuca/patterns/show-or-hide-content.md +0 -23
- package/skill/tutuca/patterns/switch-between-views.md +0 -30
- package/skill/tutuca/patterns/tabbed-interface.md +0 -43
- package/skill/tutuca/semantics.md +0 -195
- package/skill/tutuca/storybook.md +0 -270
- package/skill/tutuca/styles.md +0 -48
- package/skill/tutuca/testing.md +0 -346
- package/skill/tutuca-source/SKILL.md +0 -33
- package/skill/tutuca-source/tutuca.ext.js +0 -4235
package/dist/tutuca-dev.ext.js
CHANGED
|
@@ -2234,13 +2234,12 @@ function processXExtras(node, attrs, opName, startIdx, px) {
|
|
|
2234
2234
|
const a = attrs[i];
|
|
2235
2235
|
const aName = a.name;
|
|
2236
2236
|
if (consumed.has(aName)) continue;
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
continue;
|
|
2237
|
+
if (wrappable && aName.charCodeAt(0) === 64) {
|
|
2238
|
+
const wrapper = X_OPS[aName.slice(1)]?.wrapper;
|
|
2239
|
+
if (wrapper) {
|
|
2240
|
+
wrappers.push([wrapper, parseBool(a.value, px)]);
|
|
2241
|
+
continue;
|
|
2242
|
+
}
|
|
2244
2243
|
}
|
|
2245
2244
|
const issueInfo = { op: opName, name: aName, value: a.value };
|
|
2246
2245
|
px.onParseIssue("unknown-x-attr", issueInfo);
|
|
@@ -2252,9 +2251,6 @@ function processXExtras(node, attrs, opName, startIdx, px) {
|
|
|
2252
2251
|
}
|
|
2253
2252
|
return node;
|
|
2254
2253
|
}
|
|
2255
|
-
function maybeDeprecateBareXDirective(px, opName, name) {
|
|
2256
|
-
px.onDeprecatedSyntax("bare-x-directive", { op: opName, name });
|
|
2257
|
-
}
|
|
2258
2254
|
function wrap(node, px, wrappers) {
|
|
2259
2255
|
if (wrappers) {
|
|
2260
2256
|
for (let i = wrappers.length - 1; i >= 0; i--) {
|
|
@@ -2376,17 +2372,10 @@ function parseRenderEach(px, value, as, attrs) {
|
|
|
2376
2372
|
const attrParser = getAttrParser(px);
|
|
2377
2373
|
const eachAttr = attrParser.pushWrapper("each", value, seqVal);
|
|
2378
2374
|
attrParser.eachAttr = eachAttr;
|
|
2379
|
-
const when = attrs.getNamedItem("@when")
|
|
2380
|
-
if (when)
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
}
|
|
2384
|
-
const lWith = attrs.getNamedItem("@loop-with") ?? attrs.getNamedItem("loop-with");
|
|
2385
|
-
if (lWith) {
|
|
2386
|
-
if (lWith.name.charCodeAt(0) !== 64)
|
|
2387
|
-
maybeDeprecateBareXDirective(px, "render-each", "loop-with");
|
|
2388
|
-
attrParser._parseLoopWith(lWith.value);
|
|
2389
|
-
}
|
|
2375
|
+
const when = attrs.getNamedItem("@when");
|
|
2376
|
+
if (when) attrParser._parseWhen(when.value);
|
|
2377
|
+
const lWith = attrs.getNamedItem("@loop-with");
|
|
2378
|
+
if (lWith) attrParser._parseLoopWith(lWith.value);
|
|
2390
2379
|
const each = px.addNodeIf(EachNode, seqVal);
|
|
2391
2380
|
each.iterInfo.whenVal = eachAttr.whenVal ?? null;
|
|
2392
2381
|
each.iterInfo.loopWithVal = eachAttr.loopWithVal ?? null;
|
|
@@ -2524,10 +2513,8 @@ var X_OPS = {
|
|
|
2524
2513
|
render: xOp(["as"], { wrappable: true, ignoresChildren: true }),
|
|
2525
2514
|
"render-it": xOp(["as"], { wrappable: true, ignoresChildren: true }),
|
|
2526
2515
|
// `@when`/`@loop-with` are consumed here (handled in parseRenderEach) so
|
|
2527
|
-
// `processXExtras` does not flag them as unknown attrs.
|
|
2528
|
-
|
|
2529
|
-
// maybeDeprecateBareXDirective (added 2026-07-08).
|
|
2530
|
-
"render-each": xOp(["as", "when", "loop-with", "@when", "@loop-with"], {
|
|
2516
|
+
// `processXExtras` does not flag them as unknown attrs.
|
|
2517
|
+
"render-each": xOp(["as", "@when", "@loop-with"], {
|
|
2531
2518
|
wrappable: true,
|
|
2532
2519
|
ignoresChildren: true
|
|
2533
2520
|
}),
|
|
@@ -2618,10 +2605,6 @@ var ParseContext = class _ParseContext {
|
|
|
2618
2605
|
onParseIssue(kind, info) {
|
|
2619
2606
|
console.warn(`tutuca parse issue [${kind}]`, info);
|
|
2620
2607
|
}
|
|
2621
|
-
// Lint-only channel for deprecation nudges on still-valid syntax; the base
|
|
2622
|
-
// (runtime) context ignores them so live apps stay quiet. See LintParseContext.
|
|
2623
|
-
onDeprecatedSyntax(_kind, _info) {
|
|
2624
|
-
}
|
|
2625
2608
|
};
|
|
2626
2609
|
var _htmlBlockTags = "ADDRESS,ARTICLE,ASIDE,BLOCKQUOTE,CAPTION,COL,COLGROUP,DETAILS,DIALOG,DIV,DD,DL,DT,FIELDSET,FIGCAPTION,FIGURE,FOOTER,FORM,H1,H2,H3,H4,H5,H6,HEADER,HGROUP,HR,LEGEND,LI,MAIN,MENU,NAV,OL,P,PRE,SECTION,SUMMARY,TABLE,TBODY,TD,TFOOT,TH,THEAD,TR,UL";
|
|
2627
2610
|
var HTML_BLOCK_TAGS = new Set(_htmlBlockTags.split(","));
|
|
@@ -2835,6 +2818,191 @@ function collectAppClassesInSet(app) {
|
|
|
2835
2818
|
return classes;
|
|
2836
2819
|
}
|
|
2837
2820
|
|
|
2821
|
+
// src/components.js
|
|
2822
|
+
var COMPONENT = /* @__PURE__ */ Symbol.for("tutuca.component");
|
|
2823
|
+
var Components = class {
|
|
2824
|
+
constructor() {
|
|
2825
|
+
this.byId = /* @__PURE__ */ new Map();
|
|
2826
|
+
}
|
|
2827
|
+
registerComponent(Comp) {
|
|
2828
|
+
this.byId.set(Comp[COMPONENT].id, Comp);
|
|
2829
|
+
}
|
|
2830
|
+
getComponentForId(id) {
|
|
2831
|
+
return this.byId.get(id) ?? null;
|
|
2832
|
+
}
|
|
2833
|
+
getCompFor(v) {
|
|
2834
|
+
const Comp = v?.constructor;
|
|
2835
|
+
return Comp?.[COMPONENT] ? Comp : null;
|
|
2836
|
+
}
|
|
2837
|
+
getHandlerFor(v, name, key) {
|
|
2838
|
+
return this.getCompFor(v)?.[key][name] ?? null;
|
|
2839
|
+
}
|
|
2840
|
+
// The `lex` leg of an intent's route: the handlers registered on the scope chain of
|
|
2841
|
+
// the component that raised it, innermost first. A list, not a first match — see
|
|
2842
|
+
// ComponentStack.lookupIntentChain.
|
|
2843
|
+
getIntentChainFor(v, name) {
|
|
2844
|
+
return this.getCompFor(v)?.scope.lookupIntentChain(name) ?? [];
|
|
2845
|
+
}
|
|
2846
|
+
compileStyles() {
|
|
2847
|
+
const styles = [];
|
|
2848
|
+
for (const comp of this.byId.values()) styles.push(comp.compileStyle());
|
|
2849
|
+
return styles.join("\n");
|
|
2850
|
+
}
|
|
2851
|
+
};
|
|
2852
|
+
var ComponentStack = class _ComponentStack {
|
|
2853
|
+
constructor(comps = new Components(), parent = null) {
|
|
2854
|
+
this.comps = comps;
|
|
2855
|
+
this.parent = parent;
|
|
2856
|
+
this.byName = {};
|
|
2857
|
+
this.intentsByName = {};
|
|
2858
|
+
this.macros = {};
|
|
2859
|
+
}
|
|
2860
|
+
enter() {
|
|
2861
|
+
return new _ComponentStack(this.comps, this);
|
|
2862
|
+
}
|
|
2863
|
+
registerComponents(comps, opts) {
|
|
2864
|
+
const { aliases = {} } = opts ?? {};
|
|
2865
|
+
for (let i = 0; i < comps.length; i++) {
|
|
2866
|
+
const Comp = comps[i];
|
|
2867
|
+
Comp[COMPONENT].scope = this.enter();
|
|
2868
|
+
this.comps.registerComponent(Comp);
|
|
2869
|
+
this.byName[Comp.name] = Comp;
|
|
2870
|
+
}
|
|
2871
|
+
for (const alias in aliases) {
|
|
2872
|
+
const comp = this.byName[aliases[alias]];
|
|
2873
|
+
console.assert(this.byName[alias] === void 0, "alias overrides component", alias);
|
|
2874
|
+
if (comp !== void 0) this.byName[alias] = comp;
|
|
2875
|
+
else console.warn("alias", alias, "to inexistent component", aliases[alias]);
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
registerMacros(macros) {
|
|
2879
|
+
for (const key in macros) {
|
|
2880
|
+
const lower = key.toLowerCase();
|
|
2881
|
+
console.assert(this.macros[lower] === void 0, "macro key collision", lower);
|
|
2882
|
+
this.macros[lower] = macros[key];
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
getCompFor(v) {
|
|
2886
|
+
return this.comps.getCompFor(v);
|
|
2887
|
+
}
|
|
2888
|
+
// Handlers that answer an intent's `lex` leg. A name maps to a LIST, because the leg
|
|
2889
|
+
// walks: a handler that returns PASS declines and hands the intent to the next one.
|
|
2890
|
+
// A bare function is accepted as a one-element list.
|
|
2891
|
+
registerIntentHandlers(handlers) {
|
|
2892
|
+
for (const name in handlers) {
|
|
2893
|
+
const fns = Array.isArray(handlers[name]) ? handlers[name] : [handlers[name]];
|
|
2894
|
+
this.intentsByName[name] = fns.map((fn) => new IntentHandler(name, fn));
|
|
2895
|
+
}
|
|
2896
|
+
}
|
|
2897
|
+
// Innermost scope first, then outward. Concatenated rather than first-match, so a
|
|
2898
|
+
// declining handler can hand the intent to one further up.
|
|
2899
|
+
lookupIntentChain(name) {
|
|
2900
|
+
const here = this.intentsByName[name] ?? [];
|
|
2901
|
+
const up = this.parent?.lookupIntentChain(name) ?? [];
|
|
2902
|
+
return up.length === 0 ? here : here.concat(up);
|
|
2903
|
+
}
|
|
2904
|
+
lookupComponent(name) {
|
|
2905
|
+
return this.byName[name] ?? this.parent?.lookupComponent(name) ?? null;
|
|
2906
|
+
}
|
|
2907
|
+
lookupMacro(name) {
|
|
2908
|
+
return this.macros[name] ?? this.parent?.lookupMacro(name) ?? null;
|
|
2909
|
+
}
|
|
2910
|
+
};
|
|
2911
|
+
var ProvideInfo = class {
|
|
2912
|
+
constructor(name, val, symbol) {
|
|
2913
|
+
this.name = name;
|
|
2914
|
+
this.val = val;
|
|
2915
|
+
this.symbol = symbol;
|
|
2916
|
+
}
|
|
2917
|
+
};
|
|
2918
|
+
var LookupInfo = class {
|
|
2919
|
+
constructor(name, compName, provideName, val) {
|
|
2920
|
+
this.name = name;
|
|
2921
|
+
this.compName = compName;
|
|
2922
|
+
this.provideName = provideName;
|
|
2923
|
+
this.val = val;
|
|
2924
|
+
this._sym = void 0;
|
|
2925
|
+
}
|
|
2926
|
+
getProducerSymbol(stack) {
|
|
2927
|
+
if (this._sym === void 0)
|
|
2928
|
+
this._sym = stack.lookupType(this.compName)?.provide?.[this.provideName]?.symbol ?? null;
|
|
2929
|
+
return this._sym;
|
|
2930
|
+
}
|
|
2931
|
+
};
|
|
2932
|
+
var isString = (v) => typeof v === "string";
|
|
2933
|
+
var _rawSpecKeys = "name view style commonStyle globalStyle receive intent alter views provide lookup fields methods statics";
|
|
2934
|
+
var KNOWN_SPEC_KEYS = new Set(_rawSpecKeys.split(" "));
|
|
2935
|
+
var _compId = 0;
|
|
2936
|
+
var Component = class {
|
|
2937
|
+
constructor(Class, o) {
|
|
2938
|
+
this.id = _compId++;
|
|
2939
|
+
this.name = o.name ?? "UnkComp";
|
|
2940
|
+
this.Class = Class;
|
|
2941
|
+
this.views = { main: new View("main", o.view, o.style) };
|
|
2942
|
+
this.commonStyle = o.commonStyle ?? "";
|
|
2943
|
+
this.globalStyle = o.globalStyle ?? "";
|
|
2944
|
+
this.receive = o.receive ?? {};
|
|
2945
|
+
this.intent = o.intent ?? {};
|
|
2946
|
+
this.alter = o.alter ?? {};
|
|
2947
|
+
for (const name in o.views ?? {}) {
|
|
2948
|
+
const v = o.views[name];
|
|
2949
|
+
const { view, style } = isString(v) ? { view: v } : v;
|
|
2950
|
+
this.views[name] = new View(name, view, style);
|
|
2951
|
+
}
|
|
2952
|
+
this._rawProvide = o.provide ?? {};
|
|
2953
|
+
this._rawLookup = o.lookup ?? {};
|
|
2954
|
+
this.provide = {};
|
|
2955
|
+
this.lookup = {};
|
|
2956
|
+
this.scope = null;
|
|
2957
|
+
this.spec = o;
|
|
2958
|
+
this.extra = {};
|
|
2959
|
+
for (const key of Object.keys(o)) if (!KNOWN_SPEC_KEYS.has(key)) this.extra[key] = o[key];
|
|
2960
|
+
}
|
|
2961
|
+
compile(ParseContext2) {
|
|
2962
|
+
for (const name in this.views)
|
|
2963
|
+
this.views[name].compile(new ParseContext2(), this.scope, this.id);
|
|
2964
|
+
const ctx = this.views.main.ctx;
|
|
2965
|
+
for (const key in this._rawProvide) {
|
|
2966
|
+
const val = parseProvide(this._rawProvide[key], ctx);
|
|
2967
|
+
if (val) this.provide[key] = new ProvideInfo(key, val, Symbol(key));
|
|
2968
|
+
}
|
|
2969
|
+
for (const key in this._rawLookup) {
|
|
2970
|
+
const linfo = this._rawLookup[key];
|
|
2971
|
+
const forStr = isString(linfo) ? linfo : isString(linfo?.for) ? linfo.for : null;
|
|
2972
|
+
const [compName, provideName] = forStr === null ? [] : forStr.split(".");
|
|
2973
|
+
if (!isString(compName) || !isString(provideName)) continue;
|
|
2974
|
+
const defStr = isString(linfo?.default) ? linfo.default : null;
|
|
2975
|
+
const val = defStr === null ? null : parseField(defStr, ctx);
|
|
2976
|
+
this.lookup[key] = new LookupInfo(key, compName, provideName, val);
|
|
2977
|
+
}
|
|
2978
|
+
for (const key in this.lookup)
|
|
2979
|
+
if (this.provide[key] !== void 0)
|
|
2980
|
+
console.warn("name declared in both provide and lookup", this.name, key);
|
|
2981
|
+
}
|
|
2982
|
+
make(args, opts) {
|
|
2983
|
+
return this.Class.make(args, opts ?? { scope: this.scope });
|
|
2984
|
+
}
|
|
2985
|
+
getView(name) {
|
|
2986
|
+
return this.views[name] ?? this.views.main;
|
|
2987
|
+
}
|
|
2988
|
+
getEventForId(id, name = "main") {
|
|
2989
|
+
return this.getView(name).ctx.getEventForId(id);
|
|
2990
|
+
}
|
|
2991
|
+
getNodeForId(id, name = "main") {
|
|
2992
|
+
return this.getView(name).ctx.getNodeForId(id);
|
|
2993
|
+
}
|
|
2994
|
+
compileStyle() {
|
|
2995
|
+
const { id, commonStyle, globalStyle, views } = this;
|
|
2996
|
+
const styles = commonStyle ? [`[data-cid="${id}"]{${commonStyle}}`] : [];
|
|
2997
|
+
if (globalStyle !== "") styles.push(globalStyle);
|
|
2998
|
+
for (const name in views) {
|
|
2999
|
+
const { style } = views[name];
|
|
3000
|
+
if (style !== "") styles.push(`[data-cid="${id}"][data-vid="${name}"]{${style}}`);
|
|
3001
|
+
}
|
|
3002
|
+
return styles.join("\n");
|
|
3003
|
+
}
|
|
3004
|
+
};
|
|
3005
|
+
|
|
2838
3006
|
// tools/core/html-tokenizer.js
|
|
2839
3007
|
var CharCodes = {
|
|
2840
3008
|
Tab: 9,
|
|
@@ -5096,7 +5264,7 @@ function closestName(name, candidates, maxDistance = 2) {
|
|
|
5096
5264
|
|
|
5097
5265
|
// tools/core/lint-check.js
|
|
5098
5266
|
var KNOWN_COMPONENT_SPEC_KEYS = new Set(
|
|
5099
|
-
"name view style commonStyle globalStyle
|
|
5267
|
+
"name view style commonStyle globalStyle receive intent alter views provide lookup fields methods statics".split(
|
|
5100
5268
|
" "
|
|
5101
5269
|
)
|
|
5102
5270
|
);
|
|
@@ -5128,8 +5296,6 @@ var UNKNOWN_EVENT_MODIFIER = "UNKNOWN_EVENT_MODIFIER";
|
|
|
5128
5296
|
var UNKNOWN_HANDLER_ARG_NAME = "UNKNOWN_HANDLER_ARG_NAME";
|
|
5129
5297
|
var RECEIVE_HANDLER_NOT_IMPLEMENTED = "RECEIVE_HANDLER_NOT_IMPLEMENTED";
|
|
5130
5298
|
var EVENT_HANDLER_METHOD_NOT_ALLOWED = "EVENT_HANDLER_METHOD_NOT_ALLOWED";
|
|
5131
|
-
var RETIRED_HANDLER_BUCKET = "RETIRED_HANDLER_BUCKET";
|
|
5132
|
-
var RETIRED_CTX_VERB = "RETIRED_CTX_VERB";
|
|
5133
5299
|
var HANDLER_NAME_COLLISION = "HANDLER_NAME_COLLISION";
|
|
5134
5300
|
var FIELD_VAL_NOT_DEFINED = "FIELD_VAL_NOT_DEFINED";
|
|
5135
5301
|
var FIELD_VAL_IS_METHOD = "FIELD_VAL_IS_METHOD";
|
|
@@ -5145,7 +5311,6 @@ var UNKNOWN_X_ATTR = "UNKNOWN_X_ATTR";
|
|
|
5145
5311
|
var X_OP_IGNORES_CHILDREN = "X_OP_IGNORES_CHILDREN";
|
|
5146
5312
|
var MAYBE_DROP_AT_PREFIX = "MAYBE_DROP_AT_PREFIX";
|
|
5147
5313
|
var MAYBE_ADD_AT_PREFIX = "MAYBE_ADD_AT_PREFIX";
|
|
5148
|
-
var DEPRECATED_BARE_X_DIRECTIVE = "DEPRECATED_BARE_X_DIRECTIVE";
|
|
5149
5314
|
var BAD_VALUE = "BAD_VALUE";
|
|
5150
5315
|
var UNSUPPORTED_EXPR_SYNTAX = "UNSUPPORTED_EXPR_SYNTAX";
|
|
5151
5316
|
var BINDING_MEMBER_TOO_DEEP = "BINDING_MEMBER_TOO_DEEP";
|
|
@@ -5248,8 +5413,6 @@ function checkComponent(Comp, lx = new LintContext(), { wellKnownExtras = EMPTY_
|
|
|
5248
5413
|
checkProvidesAreAddressable(lx, Comp);
|
|
5249
5414
|
checkLookupShapes(lx, Comp);
|
|
5250
5415
|
checkHandlersNotAsync(lx, Comp);
|
|
5251
|
-
checkRetiredBuckets(lx, Comp);
|
|
5252
|
-
checkRetiredCtxVerbs(lx, Comp);
|
|
5253
5416
|
checkHandlerNameCollisions(lx, Comp);
|
|
5254
5417
|
checkScopedStyleTopLevel(lx, Comp);
|
|
5255
5418
|
const referencedAlters = /* @__PURE__ */ new Set();
|
|
@@ -5295,14 +5458,6 @@ function checkParseIssues(lx, view) {
|
|
|
5295
5458
|
const issues = view.ctx.parseIssues;
|
|
5296
5459
|
if (!issues) return;
|
|
5297
5460
|
for (const { kind, info } of issues) {
|
|
5298
|
-
if (kind === "deprecated:bare-x-directive") {
|
|
5299
|
-
lx.warn(DEPRECATED_BARE_X_DIRECTIVE, info, {
|
|
5300
|
-
kind: "add-prefix",
|
|
5301
|
-
from: info.name,
|
|
5302
|
-
to: `@${info.name}`
|
|
5303
|
-
});
|
|
5304
|
-
continue;
|
|
5305
|
-
}
|
|
5306
5461
|
if (kind === "x-op-ignores-children") {
|
|
5307
5462
|
lx.warn(X_OP_IGNORES_CHILDREN, info, { kind: "remove", what: "the ignored children" });
|
|
5308
5463
|
continue;
|
|
@@ -5413,7 +5568,7 @@ function checkEnrichProjection(lx, view, Comp) {
|
|
|
5413
5568
|
if (node.constructor.name !== "EachNode") continue;
|
|
5414
5569
|
const enrich = node.iterInfo?.enrichWithVal;
|
|
5415
5570
|
if (!enrich?.name) continue;
|
|
5416
|
-
const fn = enrich.constructor.name === "MethodVal" ? protoMethodValue(Comp.
|
|
5571
|
+
const fn = enrich.constructor.name === "MethodVal" ? protoMethodValue(Comp.prototype ?? Object.getPrototypeOf(Comp), enrich.name) : Comp.alter?.[enrich.name];
|
|
5417
5572
|
if (typeof fn !== "function") continue;
|
|
5418
5573
|
const members = pureProjectionBinds(fn);
|
|
5419
5574
|
if (members === null) continue;
|
|
@@ -5534,15 +5689,14 @@ function checkKnownHandlerNames(lx, view, Comp, referencedAlters, referencedDyna
|
|
|
5534
5689
|
}
|
|
5535
5690
|
}
|
|
5536
5691
|
function mkAttrValEnv(Comp, referencedAlters, referencedDynamics) {
|
|
5537
|
-
const { scope, alter, provide, lookup: lookup2,
|
|
5538
|
-
const
|
|
5539
|
-
const { fields } = Class.getMetaClass();
|
|
5692
|
+
const { scope, alter, provide, lookup: lookup2, fields } = Comp;
|
|
5693
|
+
const proto = Comp.prototype ?? Object.getPrototypeOf(Comp);
|
|
5540
5694
|
const dynamicMap = { ...provide, ...lookup2 };
|
|
5541
5695
|
return { fields, proto, scope, alter, referencedAlters, dynamicMap, referencedDynamics };
|
|
5542
5696
|
}
|
|
5543
5697
|
function checkEventHandlersHaveImpls(lx, Comp, referencedInputs) {
|
|
5544
|
-
const { receive: input, views
|
|
5545
|
-
const
|
|
5698
|
+
const { receive: input, views } = Comp;
|
|
5699
|
+
const proto = Comp.prototype ?? Object.getPrototypeOf(Comp);
|
|
5546
5700
|
for (const viewName in views) {
|
|
5547
5701
|
lx.push({ viewName }, () => {
|
|
5548
5702
|
const view = views[viewName];
|
|
@@ -5809,57 +5963,6 @@ function checkConsistentAttrs(lx, Comp, referencedAlters, referencedDynamics) {
|
|
|
5809
5963
|
});
|
|
5810
5964
|
}
|
|
5811
5965
|
}
|
|
5812
|
-
var isPlainObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
5813
|
-
var RETIRED_BUCKETS = {
|
|
5814
|
-
input: {
|
|
5815
|
-
to: "receive",
|
|
5816
|
-
how: "rename the bucket to `receive` - a view's own @on.* name and a parent's ctx.send are the same message now, and nothing can tell them apart"
|
|
5817
|
-
},
|
|
5818
|
-
bubble: {
|
|
5819
|
-
to: "intent",
|
|
5820
|
-
how: "rename the bucket to `intent` - and note the walk changed: a handler that calls ctx.reply() ENDS it, where ctx.stopPropagation() used to be the only way to stop"
|
|
5821
|
-
},
|
|
5822
|
-
response: {
|
|
5823
|
-
to: "receive",
|
|
5824
|
-
how: "split each arm into `receive` arms named after the intent: <name>Ok takes the result alone, <name>Error takes the error alone, and the optional <name>Unhandled means nothing claimed it"
|
|
5825
|
-
}
|
|
5826
|
-
};
|
|
5827
|
-
function checkRetiredBuckets(lx, Comp) {
|
|
5828
|
-
const extra = Comp.extra;
|
|
5829
|
-
if (!extra) return;
|
|
5830
|
-
for (const key of Object.keys(extra)) {
|
|
5831
|
-
if (!Object.hasOwn(RETIRED_BUCKETS, key)) continue;
|
|
5832
|
-
const retired = RETIRED_BUCKETS[key];
|
|
5833
|
-
const names = isPlainObj(extra[key]) ? Object.keys(extra[key]) : [];
|
|
5834
|
-
lx.error(RETIRED_HANDLER_BUCKET, { key, to: retired.to, how: retired.how, names });
|
|
5835
|
-
}
|
|
5836
|
-
}
|
|
5837
|
-
var RETIRED_CTX_VERBS = {
|
|
5838
|
-
bubble: 'ctx.intent(name, args, { route: ["dyn"] }) - the route says it walks the ancestors, where the verb used to',
|
|
5839
|
-
request: 'ctx.intent(name, args, { route: ["lex"] }) - and the outcome comes back as a `receive` arm named <name>Ok / <name>Error / <name>Unhandled, so onOkName and onErrorName are gone',
|
|
5840
|
-
stopPropagation: "ctx.stop()",
|
|
5841
|
-
inputAtPath: "ctx.sendAtPath(path, name, args)",
|
|
5842
|
-
requestAtPath: 'ctx.intentAtPath(path, name, args, { route: ["lex"] })'
|
|
5843
|
-
};
|
|
5844
|
-
var RETIRED_CTX_RE = new RegExp(
|
|
5845
|
-
`\\bctx\\.(${Object.keys(RETIRED_CTX_VERBS).join("|")})\\s*\\(`,
|
|
5846
|
-
"g"
|
|
5847
|
-
);
|
|
5848
|
-
function checkRetiredCtxVerbs(lx, Comp) {
|
|
5849
|
-
for (const bucket of ["receive", "intent", "alter", "methods", "statics"]) {
|
|
5850
|
-
const block = bucket === "methods" || bucket === "statics" ? Comp.spec?.[bucket] : Comp[bucket];
|
|
5851
|
-
if (!isPlainObj(block)) continue;
|
|
5852
|
-
for (const name in block) {
|
|
5853
|
-
const fn = block[name];
|
|
5854
|
-
if (typeof fn !== "function") continue;
|
|
5855
|
-
const src = String(fn);
|
|
5856
|
-
for (const m of src.matchAll(RETIRED_CTX_RE)) {
|
|
5857
|
-
const verb = m[1];
|
|
5858
|
-
lx.error(RETIRED_CTX_VERB, { verb, to: RETIRED_CTX_VERBS[verb], bucket, name });
|
|
5859
|
-
}
|
|
5860
|
-
}
|
|
5861
|
-
}
|
|
5862
|
-
}
|
|
5863
5966
|
function checkHandlerNameCollisions(lx, Comp) {
|
|
5864
5967
|
const receive = Comp.receive ?? {};
|
|
5865
5968
|
const intent = Comp.intent ?? {};
|
|
@@ -5885,7 +5988,6 @@ function checkUnknownSpecKeys(lx, Comp, wellKnownExtras) {
|
|
|
5885
5988
|
let candidates = null;
|
|
5886
5989
|
for (const key of Object.keys(extra)) {
|
|
5887
5990
|
if (FRAMEWORK_WELL_KNOWN_EXTRAS.has(key) || wellKnownExtras.has(key)) continue;
|
|
5888
|
-
if (Object.hasOwn(RETIRED_BUCKETS, key)) continue;
|
|
5889
5991
|
candidates ??= [
|
|
5890
5992
|
...KNOWN_COMPONENT_SPEC_KEYS,
|
|
5891
5993
|
...FRAMEWORK_WELL_KNOWN_EXTRAS,
|
|
@@ -5895,7 +5997,7 @@ function checkUnknownSpecKeys(lx, Comp, wellKnownExtras) {
|
|
|
5895
5997
|
}
|
|
5896
5998
|
}
|
|
5897
5999
|
function checkFieldDeclarations(lx, Comp) {
|
|
5898
|
-
const fields = Comp
|
|
6000
|
+
const fields = Comp[COMPONENT]?.fields;
|
|
5899
6001
|
if (!fields) return;
|
|
5900
6002
|
for (const fieldName in fields) {
|
|
5901
6003
|
const field = fields[fieldName];
|
|
@@ -5918,7 +6020,7 @@ function checkFieldDeclarations(lx, Comp) {
|
|
|
5918
6020
|
}
|
|
5919
6021
|
}
|
|
5920
6022
|
function checkFieldMethodNameCollisions(lx, Comp) {
|
|
5921
|
-
const meta = Comp
|
|
6023
|
+
const meta = Comp[COMPONENT];
|
|
5922
6024
|
if (!meta) return;
|
|
5923
6025
|
for (const name in meta.fields)
|
|
5924
6026
|
if (Object.hasOwn(meta.methods, name)) lx.error(FIELD_METHOD_NAME_COLLISION, { name });
|
|
@@ -6096,202 +6198,6 @@ var LintParseContext = class extends ParseContext {
|
|
|
6096
6198
|
const tag = this.currentTag;
|
|
6097
6199
|
this.parseIssues.push({ kind, info: tag && info.tag === void 0 ? { ...info, tag } : info });
|
|
6098
6200
|
}
|
|
6099
|
-
// TEMPORARY (2026-07-08): record deprecation nudges on the same channel as
|
|
6100
|
-
// parse issues so checkParseIssues can surface them as warnings. Remove with
|
|
6101
|
-
// the bare `show`/`hide`/`when` spelling.
|
|
6102
|
-
onDeprecatedSyntax(kind, info) {
|
|
6103
|
-
const tag = this.currentTag;
|
|
6104
|
-
this.parseIssues.push({
|
|
6105
|
-
kind: `deprecated:${kind}`,
|
|
6106
|
-
info: tag && info.tag === void 0 ? { ...info, tag } : info
|
|
6107
|
-
});
|
|
6108
|
-
}
|
|
6109
|
-
};
|
|
6110
|
-
|
|
6111
|
-
// src/components.js
|
|
6112
|
-
var Components = class {
|
|
6113
|
-
constructor() {
|
|
6114
|
-
this.getComponentSymbol = /* @__PURE__ */ Symbol("getComponent");
|
|
6115
|
-
this.byId = /* @__PURE__ */ new Map();
|
|
6116
|
-
}
|
|
6117
|
-
registerComponent(comp) {
|
|
6118
|
-
comp.Class.prototype[this.getComponentSymbol] = () => comp;
|
|
6119
|
-
this.byId.set(comp.id, comp);
|
|
6120
|
-
}
|
|
6121
|
-
getComponentForId(id) {
|
|
6122
|
-
return this.byId.get(id) ?? null;
|
|
6123
|
-
}
|
|
6124
|
-
getCompFor(v) {
|
|
6125
|
-
return v?.[this.getComponentSymbol]?.() ?? null;
|
|
6126
|
-
}
|
|
6127
|
-
getHandlerFor(v, name, key) {
|
|
6128
|
-
return this.getCompFor(v)?.[key][name] ?? null;
|
|
6129
|
-
}
|
|
6130
|
-
// The `lex` leg of an intent's route: the handlers registered on the scope chain of
|
|
6131
|
-
// the component that raised it, innermost first. A list, not a first match — see
|
|
6132
|
-
// ComponentStack.lookupIntentChain.
|
|
6133
|
-
getIntentChainFor(v, name) {
|
|
6134
|
-
return this.getCompFor(v)?.scope.lookupIntentChain(name) ?? [];
|
|
6135
|
-
}
|
|
6136
|
-
compileStyles() {
|
|
6137
|
-
const styles = [];
|
|
6138
|
-
for (const comp of this.byId.values()) styles.push(comp.compileStyle());
|
|
6139
|
-
return styles.join("\n");
|
|
6140
|
-
}
|
|
6141
|
-
};
|
|
6142
|
-
var ComponentStack = class _ComponentStack {
|
|
6143
|
-
constructor(comps = new Components(), parent = null) {
|
|
6144
|
-
this.comps = comps;
|
|
6145
|
-
this.parent = parent;
|
|
6146
|
-
this.byName = {};
|
|
6147
|
-
this.intentsByName = {};
|
|
6148
|
-
this.macros = {};
|
|
6149
|
-
}
|
|
6150
|
-
enter() {
|
|
6151
|
-
return new _ComponentStack(this.comps, this);
|
|
6152
|
-
}
|
|
6153
|
-
registerComponents(comps, opts) {
|
|
6154
|
-
const { aliases = {} } = opts ?? {};
|
|
6155
|
-
for (let i = 0; i < comps.length; i++) {
|
|
6156
|
-
const comp = comps[i];
|
|
6157
|
-
comp.scope = this.enter();
|
|
6158
|
-
comp.Class.scope = comp.scope;
|
|
6159
|
-
this.comps.registerComponent(comp);
|
|
6160
|
-
this.byName[comp.name] = comp;
|
|
6161
|
-
}
|
|
6162
|
-
for (const alias in aliases) {
|
|
6163
|
-
const comp = this.byName[aliases[alias]];
|
|
6164
|
-
console.assert(this.byName[alias] === void 0, "alias overrides component", alias);
|
|
6165
|
-
if (comp !== void 0) this.byName[alias] = comp;
|
|
6166
|
-
else console.warn("alias", alias, "to inexistent component", aliases[alias]);
|
|
6167
|
-
}
|
|
6168
|
-
}
|
|
6169
|
-
registerMacros(macros) {
|
|
6170
|
-
for (const key in macros) {
|
|
6171
|
-
const lower = key.toLowerCase();
|
|
6172
|
-
console.assert(this.macros[lower] === void 0, "macro key collision", lower);
|
|
6173
|
-
this.macros[lower] = macros[key];
|
|
6174
|
-
}
|
|
6175
|
-
}
|
|
6176
|
-
getCompFor(v) {
|
|
6177
|
-
return this.comps.getCompFor(v);
|
|
6178
|
-
}
|
|
6179
|
-
// Handlers that answer an intent's `lex` leg. A name maps to a LIST, because the leg
|
|
6180
|
-
// walks: a handler that returns PASS declines and hands the intent to the next one.
|
|
6181
|
-
// A bare function is accepted as a one-element list.
|
|
6182
|
-
registerIntentHandlers(handlers) {
|
|
6183
|
-
for (const name in handlers) {
|
|
6184
|
-
const fns = Array.isArray(handlers[name]) ? handlers[name] : [handlers[name]];
|
|
6185
|
-
this.intentsByName[name] = fns.map((fn) => new IntentHandler(name, fn));
|
|
6186
|
-
}
|
|
6187
|
-
}
|
|
6188
|
-
// Innermost scope first, then outward. Concatenated rather than first-match, so a
|
|
6189
|
-
// declining handler can hand the intent to one further up.
|
|
6190
|
-
lookupIntentChain(name) {
|
|
6191
|
-
const here = this.intentsByName[name] ?? [];
|
|
6192
|
-
const up = this.parent?.lookupIntentChain(name) ?? [];
|
|
6193
|
-
return up.length === 0 ? here : here.concat(up);
|
|
6194
|
-
}
|
|
6195
|
-
lookupComponent(name) {
|
|
6196
|
-
return this.byName[name] ?? this.parent?.lookupComponent(name) ?? null;
|
|
6197
|
-
}
|
|
6198
|
-
lookupMacro(name) {
|
|
6199
|
-
return this.macros[name] ?? this.parent?.lookupMacro(name) ?? null;
|
|
6200
|
-
}
|
|
6201
|
-
};
|
|
6202
|
-
var ProvideInfo = class {
|
|
6203
|
-
constructor(name, val, symbol) {
|
|
6204
|
-
this.name = name;
|
|
6205
|
-
this.val = val;
|
|
6206
|
-
this.symbol = symbol;
|
|
6207
|
-
}
|
|
6208
|
-
};
|
|
6209
|
-
var LookupInfo = class {
|
|
6210
|
-
constructor(name, compName, provideName, val) {
|
|
6211
|
-
this.name = name;
|
|
6212
|
-
this.compName = compName;
|
|
6213
|
-
this.provideName = provideName;
|
|
6214
|
-
this.val = val;
|
|
6215
|
-
this._sym = void 0;
|
|
6216
|
-
}
|
|
6217
|
-
getProducerSymbol(stack) {
|
|
6218
|
-
if (this._sym === void 0)
|
|
6219
|
-
this._sym = stack.lookupType(this.compName)?.provide?.[this.provideName]?.symbol ?? null;
|
|
6220
|
-
return this._sym;
|
|
6221
|
-
}
|
|
6222
|
-
};
|
|
6223
|
-
var isString = (v) => typeof v === "string";
|
|
6224
|
-
var _rawSpecKeys = "name view style commonStyle globalStyle receive intent alter views provide lookup fields methods statics";
|
|
6225
|
-
var KNOWN_SPEC_KEYS = new Set(_rawSpecKeys.split(" "));
|
|
6226
|
-
var _compId = 0;
|
|
6227
|
-
var Component = class {
|
|
6228
|
-
constructor(Class, o) {
|
|
6229
|
-
this.id = _compId++;
|
|
6230
|
-
this.name = o.name ?? "UnkComp";
|
|
6231
|
-
this.Class = Class;
|
|
6232
|
-
this.views = { main: new View("main", o.view, o.style) };
|
|
6233
|
-
this.commonStyle = o.commonStyle ?? "";
|
|
6234
|
-
this.globalStyle = o.globalStyle ?? "";
|
|
6235
|
-
this.receive = o.receive ?? {};
|
|
6236
|
-
this.intent = o.intent ?? {};
|
|
6237
|
-
this.alter = o.alter ?? {};
|
|
6238
|
-
for (const name in o.views ?? {}) {
|
|
6239
|
-
const v = o.views[name];
|
|
6240
|
-
const { view, style } = isString(v) ? { view: v } : v;
|
|
6241
|
-
this.views[name] = new View(name, view, style);
|
|
6242
|
-
}
|
|
6243
|
-
this._rawProvide = o.provide ?? {};
|
|
6244
|
-
this._rawLookup = o.lookup ?? {};
|
|
6245
|
-
this.provide = {};
|
|
6246
|
-
this.lookup = {};
|
|
6247
|
-
this.scope = null;
|
|
6248
|
-
this.spec = o;
|
|
6249
|
-
this.extra = {};
|
|
6250
|
-
for (const key of Object.keys(o)) if (!KNOWN_SPEC_KEYS.has(key)) this.extra[key] = o[key];
|
|
6251
|
-
}
|
|
6252
|
-
compile(ParseContext2) {
|
|
6253
|
-
for (const name in this.views)
|
|
6254
|
-
this.views[name].compile(new ParseContext2(), this.scope, this.id);
|
|
6255
|
-
const ctx = this.views.main.ctx;
|
|
6256
|
-
for (const key in this._rawProvide) {
|
|
6257
|
-
const val = parseProvide(this._rawProvide[key], ctx);
|
|
6258
|
-
if (val) this.provide[key] = new ProvideInfo(key, val, Symbol(key));
|
|
6259
|
-
}
|
|
6260
|
-
for (const key in this._rawLookup) {
|
|
6261
|
-
const linfo = this._rawLookup[key];
|
|
6262
|
-
const forStr = isString(linfo) ? linfo : isString(linfo?.for) ? linfo.for : null;
|
|
6263
|
-
const [compName, provideName] = forStr === null ? [] : forStr.split(".");
|
|
6264
|
-
if (!isString(compName) || !isString(provideName)) continue;
|
|
6265
|
-
const defStr = isString(linfo?.default) ? linfo.default : null;
|
|
6266
|
-
const val = defStr === null ? null : parseField(defStr, ctx);
|
|
6267
|
-
this.lookup[key] = new LookupInfo(key, compName, provideName, val);
|
|
6268
|
-
}
|
|
6269
|
-
for (const key in this.lookup)
|
|
6270
|
-
if (this.provide[key] !== void 0)
|
|
6271
|
-
console.warn("name declared in both provide and lookup", this.name, key);
|
|
6272
|
-
}
|
|
6273
|
-
make(args, opts) {
|
|
6274
|
-
return this.Class.make(args, opts ?? { scope: this.scope });
|
|
6275
|
-
}
|
|
6276
|
-
getView(name) {
|
|
6277
|
-
return this.views[name] ?? this.views.main;
|
|
6278
|
-
}
|
|
6279
|
-
getEventForId(id, name = "main") {
|
|
6280
|
-
return this.getView(name).ctx.getEventForId(id);
|
|
6281
|
-
}
|
|
6282
|
-
getNodeForId(id, name = "main") {
|
|
6283
|
-
return this.getView(name).ctx.getNodeForId(id);
|
|
6284
|
-
}
|
|
6285
|
-
compileStyle() {
|
|
6286
|
-
const { id, commonStyle, globalStyle, views } = this;
|
|
6287
|
-
const styles = commonStyle ? [`[data-cid="${id}"]{${commonStyle}}`] : [];
|
|
6288
|
-
if (globalStyle !== "") styles.push(globalStyle);
|
|
6289
|
-
for (const name in views) {
|
|
6290
|
-
const { style } = views[name];
|
|
6291
|
-
if (style !== "") styles.push(`[data-cid="${id}"][data-vid="${name}"]{${style}}`);
|
|
6292
|
-
}
|
|
6293
|
-
return styles.join("\n");
|
|
6294
|
-
}
|
|
6295
6201
|
};
|
|
6296
6202
|
|
|
6297
6203
|
// src/on.js
|
|
@@ -6433,7 +6339,7 @@ var FieldFloat = class extends Field {
|
|
|
6433
6339
|
super("float", name, CHECK_TYPE_FLOAT, (_) => null, defaultValue);
|
|
6434
6340
|
}
|
|
6435
6341
|
};
|
|
6436
|
-
var getTypeName = (v) => v?.constructor?.getMetaClass?.()?.name;
|
|
6342
|
+
var getTypeName = (v) => v?.constructor?.[COMPONENT]?.name ?? v?.constructor?.getMetaClass?.()?.name ?? null;
|
|
6437
6343
|
var CheckTypeName = class {
|
|
6438
6344
|
constructor(typeName) {
|
|
6439
6345
|
this.typeName = typeName;
|
|
@@ -6534,7 +6440,7 @@ var ClassBuilder = class {
|
|
|
6534
6440
|
getMetaClass: () => metaClass,
|
|
6535
6441
|
make(inArgs = {}, opts = {}) {
|
|
6536
6442
|
const args = {};
|
|
6537
|
-
const scope = opts.scope ?? this.scope;
|
|
6443
|
+
const scope = opts.scope ?? this[COMPONENT]?.scope ?? this.scope;
|
|
6538
6444
|
for (const key in inArgs) {
|
|
6539
6445
|
const field = fields[key];
|
|
6540
6446
|
if (compFields.has(key)) args[key] = mkCompField(field, scope, inArgs[key]);
|
|
@@ -6614,7 +6520,7 @@ function classFromData(name, { fields = {}, methods, statics }) {
|
|
|
6614
6520
|
return b.build();
|
|
6615
6521
|
}
|
|
6616
6522
|
function validateDraftFields(current, draft) {
|
|
6617
|
-
const meta = current?.constructor?.getMetaClass?.();
|
|
6523
|
+
const meta = current?.constructor?.[COMPONENT] ?? current?.constructor?.getMetaClass?.();
|
|
6618
6524
|
if (!meta) return;
|
|
6619
6525
|
for (const [name, field] of Object.entries(meta.fields)) {
|
|
6620
6526
|
const value = draft[name];
|
|
@@ -6627,7 +6533,33 @@ function validateDraftFields(current, draft) {
|
|
|
6627
6533
|
}
|
|
6628
6534
|
}
|
|
6629
6535
|
}
|
|
6630
|
-
|
|
6536
|
+
var META_KEYS = "name id fields methods views receive intent alter provide lookup spec extra commonStyle globalStyle scope _rawProvide _rawLookup".split(
|
|
6537
|
+
" "
|
|
6538
|
+
);
|
|
6539
|
+
Component.fromSpec = (opts) => {
|
|
6540
|
+
const Class = classFromData(opts.name, opts);
|
|
6541
|
+
const comp = new Component(Class, opts);
|
|
6542
|
+
const metaClass = Class.getMetaClass();
|
|
6543
|
+
comp.fields = metaClass.fields;
|
|
6544
|
+
comp.methods = metaClass.methods;
|
|
6545
|
+
Class.getMetaClass = () => comp;
|
|
6546
|
+
Class[COMPONENT] = comp;
|
|
6547
|
+
for (const key of META_KEYS)
|
|
6548
|
+
if (!Object.hasOwn(Class, key))
|
|
6549
|
+
Object.defineProperty(Class, key, {
|
|
6550
|
+
get() {
|
|
6551
|
+
return comp[key];
|
|
6552
|
+
},
|
|
6553
|
+
set(v) {
|
|
6554
|
+
comp[key] = v;
|
|
6555
|
+
},
|
|
6556
|
+
configurable: true
|
|
6557
|
+
});
|
|
6558
|
+
for (const key of Object.getOwnPropertyNames(Component.prototype))
|
|
6559
|
+
if (key !== "constructor" && key !== "make" && !Object.hasOwn(Class, key))
|
|
6560
|
+
Class[key] = (...args) => comp[key](...args);
|
|
6561
|
+
return Class;
|
|
6562
|
+
};
|
|
6631
6563
|
var component = (opts) => Component.fromSpec(opts);
|
|
6632
6564
|
|
|
6633
6565
|
// src/stack.js
|
|
@@ -6916,8 +6848,8 @@ var Transaction = class {
|
|
|
6916
6848
|
whenSettled() {
|
|
6917
6849
|
return this.completion.whenSettled();
|
|
6918
6850
|
}
|
|
6919
|
-
// Resolves once this transaction AND all transitively-derived work (sends
|
|
6920
|
-
//
|
|
6851
|
+
// Resolves once this transaction AND all transitively-derived work (sends and
|
|
6852
|
+
// intents, including the answers they produce, recursively) have settled.
|
|
6921
6853
|
whenSubtreeSettled() {
|
|
6922
6854
|
return this.completion.whenSubtreeSettled();
|
|
6923
6855
|
}
|
|
@@ -7091,7 +7023,7 @@ var NameArgsTransaction = class extends Transaction {
|
|
|
7091
7023
|
}
|
|
7092
7024
|
handlerProp = null;
|
|
7093
7025
|
// NameArgs verbs map their handler bucket straight to the observed kind:
|
|
7094
|
-
// receive /
|
|
7026
|
+
// receive / intent.
|
|
7095
7027
|
get observeKind() {
|
|
7096
7028
|
return this.handlerProp;
|
|
7097
7029
|
}
|
|
@@ -7615,12 +7547,14 @@ var ModuleTests = class {
|
|
|
7615
7547
|
}
|
|
7616
7548
|
};
|
|
7617
7549
|
function isComponentObject(x) {
|
|
7618
|
-
|
|
7550
|
+
if (x === null) return false;
|
|
7551
|
+
if (typeof x === "function") return x[COMPONENT] != null;
|
|
7552
|
+
return typeof x.name === "string" && typeof x.Class === "function";
|
|
7619
7553
|
}
|
|
7620
7554
|
function resolveComponentName(arg, components) {
|
|
7621
7555
|
if (isComponentObject(arg)) return arg.name;
|
|
7622
7556
|
if (typeof arg === "function") {
|
|
7623
|
-
for (const c of components) if (c
|
|
7557
|
+
for (const c of components) if (c === arg) return c.name;
|
|
7624
7558
|
}
|
|
7625
7559
|
return null;
|
|
7626
7560
|
}
|
|
@@ -7959,12 +7893,6 @@ function lintIdToMessage(id, info) {
|
|
|
7959
7893
|
}
|
|
7960
7894
|
case "UNKNOWN_HANDLER_ARG_NAME":
|
|
7961
7895
|
return `Unknown handler argument '${info.name}'${fmtOriginSuffix(info)}`;
|
|
7962
|
-
case "RETIRED_HANDLER_BUCKET": {
|
|
7963
|
-
const which = info.names?.length ? ` (${info.names.join(", ")})` : "";
|
|
7964
|
-
return `\`${info.key}\` is no longer a handler bucket${which} — ${info.how}`;
|
|
7965
|
-
}
|
|
7966
|
-
case "RETIRED_CTX_VERB":
|
|
7967
|
-
return `ctx.${info.verb}() no longer exists — use ${info.to} (in \`${info.bucket}.${info.name}\`)`;
|
|
7968
7896
|
case "HANDLER_NAME_COLLISION":
|
|
7969
7897
|
return `${info.problem} — ${info.fix}`;
|
|
7970
7898
|
case "RECEIVE_HANDLER_NOT_IMPLEMENTED":
|
|
@@ -8020,9 +7948,6 @@ function lintIdToMessage(id, info) {
|
|
|
8020
7948
|
}
|
|
8021
7949
|
case "MAYBE_ADD_AT_PREFIX":
|
|
8022
7950
|
return `'${info.name}' on <${(info.tag ?? "").toLowerCase()}> is a plain attribute, but '@${info.name}' is a directive — add the leading '@'`;
|
|
8023
|
-
// TEMPORARY (2026-07-08): remove with the bare `show`/`hide`/`when` spelling.
|
|
8024
|
-
case "DEPRECATED_BARE_X_DIRECTIVE":
|
|
8025
|
-
return `'${info.name}' on <x ${info.op}> is deprecated — write '@${info.name}' instead${fmtTagSuffix(info)}`;
|
|
8026
7951
|
case "BAD_VALUE":
|
|
8027
7952
|
return `${badValueMessage(info)}${fmtTagSuffix(info)}`;
|
|
8028
7953
|
case "UNSUPPORTED_EXPR_SYNTAX":
|
|
@@ -8486,8 +8411,7 @@ function serializeDefault(v) {
|
|
|
8486
8411
|
return v;
|
|
8487
8412
|
}
|
|
8488
8413
|
function getComponentDoc(comp) {
|
|
8489
|
-
const
|
|
8490
|
-
const { fields, name, methods } = meta;
|
|
8414
|
+
const { fields, name, methods } = comp;
|
|
8491
8415
|
const userMethods = Object.keys(methods).map((k) => ({
|
|
8492
8416
|
name: k,
|
|
8493
8417
|
sig: getSignature(k, methods[k])
|
|
@@ -8535,7 +8459,12 @@ function shadowCheckComponent(Comp) {
|
|
|
8535
8459
|
shadowViews[name] = { name, ctx, rawView };
|
|
8536
8460
|
}
|
|
8537
8461
|
const shadowComp = Object.create(Comp);
|
|
8538
|
-
shadowComp
|
|
8462
|
+
Object.defineProperty(shadowComp, "views", {
|
|
8463
|
+
value: shadowViews,
|
|
8464
|
+
writable: true,
|
|
8465
|
+
enumerable: true,
|
|
8466
|
+
configurable: true
|
|
8467
|
+
});
|
|
8539
8468
|
return checkComponent(shadowComp).reports;
|
|
8540
8469
|
}
|
|
8541
8470
|
function check2(app) {
|
|
@@ -8601,12 +8530,12 @@ export {
|
|
|
8601
8530
|
ASYNC_HANDLER,
|
|
8602
8531
|
BAD_VALUE,
|
|
8603
8532
|
BINDING_MEMBER_TOO_DEEP,
|
|
8533
|
+
COMPONENT,
|
|
8604
8534
|
COMP_FIELD_BAD_SHAPE,
|
|
8605
8535
|
CONSTANT_CONDITION,
|
|
8606
8536
|
ComponentDocs,
|
|
8607
8537
|
ComponentList,
|
|
8608
8538
|
ComponentSummary,
|
|
8609
|
-
DEPRECATED_BARE_X_DIRECTIVE,
|
|
8610
8539
|
DUPLICATE_ATTR_DEFINITION,
|
|
8611
8540
|
DYN_ALIAS_NOT_REFERENCED,
|
|
8612
8541
|
DYN_VAL_NOT_DEFINED,
|
|
@@ -8643,8 +8572,6 @@ export {
|
|
|
8643
8572
|
RECEIVE_HANDLER_NOT_IMPLEMENTED,
|
|
8644
8573
|
REDUNDANT_TEMPLATE_STRING,
|
|
8645
8574
|
RENDER_IT_OUTSIDE_OF_LOOP,
|
|
8646
|
-
RETIRED_CTX_VERB,
|
|
8647
|
-
RETIRED_HANDLER_BUCKET,
|
|
8648
8575
|
RenderBatch,
|
|
8649
8576
|
RenderedExample,
|
|
8650
8577
|
RenderedSection,
|