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.js
CHANGED
|
@@ -6979,13 +6979,12 @@ function processXExtras(node, attrs, opName, startIdx, px) {
|
|
|
6979
6979
|
const a = attrs[i];
|
|
6980
6980
|
const aName = a.name;
|
|
6981
6981
|
if (consumed.has(aName)) continue;
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
continue;
|
|
6982
|
+
if (wrappable && aName.charCodeAt(0) === 64) {
|
|
6983
|
+
const wrapper = X_OPS[aName.slice(1)]?.wrapper;
|
|
6984
|
+
if (wrapper) {
|
|
6985
|
+
wrappers.push([wrapper, parseBool(a.value, px)]);
|
|
6986
|
+
continue;
|
|
6987
|
+
}
|
|
6989
6988
|
}
|
|
6990
6989
|
const issueInfo = { op: opName, name: aName, value: a.value };
|
|
6991
6990
|
px.onParseIssue("unknown-x-attr", issueInfo);
|
|
@@ -6997,9 +6996,6 @@ function processXExtras(node, attrs, opName, startIdx, px) {
|
|
|
6997
6996
|
}
|
|
6998
6997
|
return node;
|
|
6999
6998
|
}
|
|
7000
|
-
function maybeDeprecateBareXDirective(px, opName, name) {
|
|
7001
|
-
px.onDeprecatedSyntax("bare-x-directive", { op: opName, name });
|
|
7002
|
-
}
|
|
7003
6999
|
function wrap(node, px, wrappers) {
|
|
7004
7000
|
if (wrappers) {
|
|
7005
7001
|
for (let i = wrappers.length - 1; i >= 0; i--) {
|
|
@@ -7121,17 +7117,10 @@ function parseRenderEach(px, value, as, attrs) {
|
|
|
7121
7117
|
const attrParser = getAttrParser(px);
|
|
7122
7118
|
const eachAttr = attrParser.pushWrapper("each", value, seqVal);
|
|
7123
7119
|
attrParser.eachAttr = eachAttr;
|
|
7124
|
-
const when = attrs.getNamedItem("@when")
|
|
7125
|
-
if (when)
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
}
|
|
7129
|
-
const lWith = attrs.getNamedItem("@loop-with") ?? attrs.getNamedItem("loop-with");
|
|
7130
|
-
if (lWith) {
|
|
7131
|
-
if (lWith.name.charCodeAt(0) !== 64)
|
|
7132
|
-
maybeDeprecateBareXDirective(px, "render-each", "loop-with");
|
|
7133
|
-
attrParser._parseLoopWith(lWith.value);
|
|
7134
|
-
}
|
|
7120
|
+
const when = attrs.getNamedItem("@when");
|
|
7121
|
+
if (when) attrParser._parseWhen(when.value);
|
|
7122
|
+
const lWith = attrs.getNamedItem("@loop-with");
|
|
7123
|
+
if (lWith) attrParser._parseLoopWith(lWith.value);
|
|
7135
7124
|
const each2 = px.addNodeIf(EachNode, seqVal);
|
|
7136
7125
|
each2.iterInfo.whenVal = eachAttr.whenVal ?? null;
|
|
7137
7126
|
each2.iterInfo.loopWithVal = eachAttr.loopWithVal ?? null;
|
|
@@ -7269,10 +7258,8 @@ var X_OPS = {
|
|
|
7269
7258
|
render: xOp(["as"], { wrappable: true, ignoresChildren: true }),
|
|
7270
7259
|
"render-it": xOp(["as"], { wrappable: true, ignoresChildren: true }),
|
|
7271
7260
|
// `@when`/`@loop-with` are consumed here (handled in parseRenderEach) so
|
|
7272
|
-
// `processXExtras` does not flag them as unknown attrs.
|
|
7273
|
-
|
|
7274
|
-
// maybeDeprecateBareXDirective (added 2026-07-08).
|
|
7275
|
-
"render-each": xOp(["as", "when", "loop-with", "@when", "@loop-with"], {
|
|
7261
|
+
// `processXExtras` does not flag them as unknown attrs.
|
|
7262
|
+
"render-each": xOp(["as", "@when", "@loop-with"], {
|
|
7276
7263
|
wrappable: true,
|
|
7277
7264
|
ignoresChildren: true
|
|
7278
7265
|
}),
|
|
@@ -7363,10 +7350,6 @@ var ParseContext = class _ParseContext {
|
|
|
7363
7350
|
onParseIssue(kind, info) {
|
|
7364
7351
|
console.warn(`tutuca parse issue [${kind}]`, info);
|
|
7365
7352
|
}
|
|
7366
|
-
// Lint-only channel for deprecation nudges on still-valid syntax; the base
|
|
7367
|
-
// (runtime) context ignores them so live apps stay quiet. See LintParseContext.
|
|
7368
|
-
onDeprecatedSyntax(_kind, _info) {
|
|
7369
|
-
}
|
|
7370
7353
|
};
|
|
7371
7354
|
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";
|
|
7372
7355
|
var HTML_BLOCK_TAGS = new Set(_htmlBlockTags.split(","));
|
|
@@ -7580,6 +7563,191 @@ function collectAppClassesInSet(app) {
|
|
|
7580
7563
|
return classes;
|
|
7581
7564
|
}
|
|
7582
7565
|
|
|
7566
|
+
// src/components.js
|
|
7567
|
+
var COMPONENT = /* @__PURE__ */ Symbol.for("tutuca.component");
|
|
7568
|
+
var Components = class {
|
|
7569
|
+
constructor() {
|
|
7570
|
+
this.byId = /* @__PURE__ */ new Map();
|
|
7571
|
+
}
|
|
7572
|
+
registerComponent(Comp) {
|
|
7573
|
+
this.byId.set(Comp[COMPONENT].id, Comp);
|
|
7574
|
+
}
|
|
7575
|
+
getComponentForId(id) {
|
|
7576
|
+
return this.byId.get(id) ?? null;
|
|
7577
|
+
}
|
|
7578
|
+
getCompFor(v) {
|
|
7579
|
+
const Comp = v?.constructor;
|
|
7580
|
+
return Comp?.[COMPONENT] ? Comp : null;
|
|
7581
|
+
}
|
|
7582
|
+
getHandlerFor(v, name, key) {
|
|
7583
|
+
return this.getCompFor(v)?.[key][name] ?? null;
|
|
7584
|
+
}
|
|
7585
|
+
// The `lex` leg of an intent's route: the handlers registered on the scope chain of
|
|
7586
|
+
// the component that raised it, innermost first. A list, not a first match — see
|
|
7587
|
+
// ComponentStack.lookupIntentChain.
|
|
7588
|
+
getIntentChainFor(v, name) {
|
|
7589
|
+
return this.getCompFor(v)?.scope.lookupIntentChain(name) ?? [];
|
|
7590
|
+
}
|
|
7591
|
+
compileStyles() {
|
|
7592
|
+
const styles2 = [];
|
|
7593
|
+
for (const comp of this.byId.values()) styles2.push(comp.compileStyle());
|
|
7594
|
+
return styles2.join("\n");
|
|
7595
|
+
}
|
|
7596
|
+
};
|
|
7597
|
+
var ComponentStack = class _ComponentStack {
|
|
7598
|
+
constructor(comps = new Components(), parent = null) {
|
|
7599
|
+
this.comps = comps;
|
|
7600
|
+
this.parent = parent;
|
|
7601
|
+
this.byName = {};
|
|
7602
|
+
this.intentsByName = {};
|
|
7603
|
+
this.macros = {};
|
|
7604
|
+
}
|
|
7605
|
+
enter() {
|
|
7606
|
+
return new _ComponentStack(this.comps, this);
|
|
7607
|
+
}
|
|
7608
|
+
registerComponents(comps, opts) {
|
|
7609
|
+
const { aliases: aliases2 = {} } = opts ?? {};
|
|
7610
|
+
for (let i = 0; i < comps.length; i++) {
|
|
7611
|
+
const Comp = comps[i];
|
|
7612
|
+
Comp[COMPONENT].scope = this.enter();
|
|
7613
|
+
this.comps.registerComponent(Comp);
|
|
7614
|
+
this.byName[Comp.name] = Comp;
|
|
7615
|
+
}
|
|
7616
|
+
for (const alias in aliases2) {
|
|
7617
|
+
const comp = this.byName[aliases2[alias]];
|
|
7618
|
+
console.assert(this.byName[alias] === void 0, "alias overrides component", alias);
|
|
7619
|
+
if (comp !== void 0) this.byName[alias] = comp;
|
|
7620
|
+
else console.warn("alias", alias, "to inexistent component", aliases2[alias]);
|
|
7621
|
+
}
|
|
7622
|
+
}
|
|
7623
|
+
registerMacros(macros) {
|
|
7624
|
+
for (const key in macros) {
|
|
7625
|
+
const lower = key.toLowerCase();
|
|
7626
|
+
console.assert(this.macros[lower] === void 0, "macro key collision", lower);
|
|
7627
|
+
this.macros[lower] = macros[key];
|
|
7628
|
+
}
|
|
7629
|
+
}
|
|
7630
|
+
getCompFor(v) {
|
|
7631
|
+
return this.comps.getCompFor(v);
|
|
7632
|
+
}
|
|
7633
|
+
// Handlers that answer an intent's `lex` leg. A name maps to a LIST, because the leg
|
|
7634
|
+
// walks: a handler that returns PASS declines and hands the intent to the next one.
|
|
7635
|
+
// A bare function is accepted as a one-element list.
|
|
7636
|
+
registerIntentHandlers(handlers) {
|
|
7637
|
+
for (const name in handlers) {
|
|
7638
|
+
const fns = Array.isArray(handlers[name]) ? handlers[name] : [handlers[name]];
|
|
7639
|
+
this.intentsByName[name] = fns.map((fn) => new IntentHandler(name, fn));
|
|
7640
|
+
}
|
|
7641
|
+
}
|
|
7642
|
+
// Innermost scope first, then outward. Concatenated rather than first-match, so a
|
|
7643
|
+
// declining handler can hand the intent to one further up.
|
|
7644
|
+
lookupIntentChain(name) {
|
|
7645
|
+
const here = this.intentsByName[name] ?? [];
|
|
7646
|
+
const up = this.parent?.lookupIntentChain(name) ?? [];
|
|
7647
|
+
return up.length === 0 ? here : here.concat(up);
|
|
7648
|
+
}
|
|
7649
|
+
lookupComponent(name) {
|
|
7650
|
+
return this.byName[name] ?? this.parent?.lookupComponent(name) ?? null;
|
|
7651
|
+
}
|
|
7652
|
+
lookupMacro(name) {
|
|
7653
|
+
return this.macros[name] ?? this.parent?.lookupMacro(name) ?? null;
|
|
7654
|
+
}
|
|
7655
|
+
};
|
|
7656
|
+
var ProvideInfo = class {
|
|
7657
|
+
constructor(name, val, symbol) {
|
|
7658
|
+
this.name = name;
|
|
7659
|
+
this.val = val;
|
|
7660
|
+
this.symbol = symbol;
|
|
7661
|
+
}
|
|
7662
|
+
};
|
|
7663
|
+
var LookupInfo = class {
|
|
7664
|
+
constructor(name, compName, provideName, val) {
|
|
7665
|
+
this.name = name;
|
|
7666
|
+
this.compName = compName;
|
|
7667
|
+
this.provideName = provideName;
|
|
7668
|
+
this.val = val;
|
|
7669
|
+
this._sym = void 0;
|
|
7670
|
+
}
|
|
7671
|
+
getProducerSymbol(stack) {
|
|
7672
|
+
if (this._sym === void 0)
|
|
7673
|
+
this._sym = stack.lookupType(this.compName)?.provide?.[this.provideName]?.symbol ?? null;
|
|
7674
|
+
return this._sym;
|
|
7675
|
+
}
|
|
7676
|
+
};
|
|
7677
|
+
var isString = (v) => typeof v === "string";
|
|
7678
|
+
var _rawSpecKeys = "name view style commonStyle globalStyle receive intent alter views provide lookup fields methods statics";
|
|
7679
|
+
var KNOWN_SPEC_KEYS = new Set(_rawSpecKeys.split(" "));
|
|
7680
|
+
var _compId = 0;
|
|
7681
|
+
var Component = class {
|
|
7682
|
+
constructor(Class, o) {
|
|
7683
|
+
this.id = _compId++;
|
|
7684
|
+
this.name = o.name ?? "UnkComp";
|
|
7685
|
+
this.Class = Class;
|
|
7686
|
+
this.views = { main: new View("main", o.view, o.style) };
|
|
7687
|
+
this.commonStyle = o.commonStyle ?? "";
|
|
7688
|
+
this.globalStyle = o.globalStyle ?? "";
|
|
7689
|
+
this.receive = o.receive ?? {};
|
|
7690
|
+
this.intent = o.intent ?? {};
|
|
7691
|
+
this.alter = o.alter ?? {};
|
|
7692
|
+
for (const name in o.views ?? {}) {
|
|
7693
|
+
const v = o.views[name];
|
|
7694
|
+
const { view, style } = isString(v) ? { view: v } : v;
|
|
7695
|
+
this.views[name] = new View(name, view, style);
|
|
7696
|
+
}
|
|
7697
|
+
this._rawProvide = o.provide ?? {};
|
|
7698
|
+
this._rawLookup = o.lookup ?? {};
|
|
7699
|
+
this.provide = {};
|
|
7700
|
+
this.lookup = {};
|
|
7701
|
+
this.scope = null;
|
|
7702
|
+
this.spec = o;
|
|
7703
|
+
this.extra = {};
|
|
7704
|
+
for (const key of Object.keys(o)) if (!KNOWN_SPEC_KEYS.has(key)) this.extra[key] = o[key];
|
|
7705
|
+
}
|
|
7706
|
+
compile(ParseContext2) {
|
|
7707
|
+
for (const name in this.views)
|
|
7708
|
+
this.views[name].compile(new ParseContext2(), this.scope, this.id);
|
|
7709
|
+
const ctx = this.views.main.ctx;
|
|
7710
|
+
for (const key in this._rawProvide) {
|
|
7711
|
+
const val = parseProvide(this._rawProvide[key], ctx);
|
|
7712
|
+
if (val) this.provide[key] = new ProvideInfo(key, val, Symbol(key));
|
|
7713
|
+
}
|
|
7714
|
+
for (const key in this._rawLookup) {
|
|
7715
|
+
const linfo = this._rawLookup[key];
|
|
7716
|
+
const forStr = isString(linfo) ? linfo : isString(linfo?.for) ? linfo.for : null;
|
|
7717
|
+
const [compName, provideName] = forStr === null ? [] : forStr.split(".");
|
|
7718
|
+
if (!isString(compName) || !isString(provideName)) continue;
|
|
7719
|
+
const defStr = isString(linfo?.default) ? linfo.default : null;
|
|
7720
|
+
const val = defStr === null ? null : parseField(defStr, ctx);
|
|
7721
|
+
this.lookup[key] = new LookupInfo(key, compName, provideName, val);
|
|
7722
|
+
}
|
|
7723
|
+
for (const key in this.lookup)
|
|
7724
|
+
if (this.provide[key] !== void 0)
|
|
7725
|
+
console.warn("name declared in both provide and lookup", this.name, key);
|
|
7726
|
+
}
|
|
7727
|
+
make(args, opts) {
|
|
7728
|
+
return this.Class.make(args, opts ?? { scope: this.scope });
|
|
7729
|
+
}
|
|
7730
|
+
getView(name) {
|
|
7731
|
+
return this.views[name] ?? this.views.main;
|
|
7732
|
+
}
|
|
7733
|
+
getEventForId(id, name = "main") {
|
|
7734
|
+
return this.getView(name).ctx.getEventForId(id);
|
|
7735
|
+
}
|
|
7736
|
+
getNodeForId(id, name = "main") {
|
|
7737
|
+
return this.getView(name).ctx.getNodeForId(id);
|
|
7738
|
+
}
|
|
7739
|
+
compileStyle() {
|
|
7740
|
+
const { id, commonStyle, globalStyle, views } = this;
|
|
7741
|
+
const styles2 = commonStyle ? [`[data-cid="${id}"]{${commonStyle}}`] : [];
|
|
7742
|
+
if (globalStyle !== "") styles2.push(globalStyle);
|
|
7743
|
+
for (const name in views) {
|
|
7744
|
+
const { style } = views[name];
|
|
7745
|
+
if (style !== "") styles2.push(`[data-cid="${id}"][data-vid="${name}"]{${style}}`);
|
|
7746
|
+
}
|
|
7747
|
+
return styles2.join("\n");
|
|
7748
|
+
}
|
|
7749
|
+
};
|
|
7750
|
+
|
|
7583
7751
|
// tools/core/html-tokenizer.js
|
|
7584
7752
|
var CharCodes = {
|
|
7585
7753
|
Tab: 9,
|
|
@@ -9841,7 +10009,7 @@ function closestName(name, candidates, maxDistance = 2) {
|
|
|
9841
10009
|
|
|
9842
10010
|
// tools/core/lint-check.js
|
|
9843
10011
|
var KNOWN_COMPONENT_SPEC_KEYS = new Set(
|
|
9844
|
-
"name view style commonStyle globalStyle
|
|
10012
|
+
"name view style commonStyle globalStyle receive intent alter views provide lookup fields methods statics".split(
|
|
9845
10013
|
" "
|
|
9846
10014
|
)
|
|
9847
10015
|
);
|
|
@@ -9873,8 +10041,6 @@ var UNKNOWN_EVENT_MODIFIER = "UNKNOWN_EVENT_MODIFIER";
|
|
|
9873
10041
|
var UNKNOWN_HANDLER_ARG_NAME = "UNKNOWN_HANDLER_ARG_NAME";
|
|
9874
10042
|
var RECEIVE_HANDLER_NOT_IMPLEMENTED = "RECEIVE_HANDLER_NOT_IMPLEMENTED";
|
|
9875
10043
|
var EVENT_HANDLER_METHOD_NOT_ALLOWED = "EVENT_HANDLER_METHOD_NOT_ALLOWED";
|
|
9876
|
-
var RETIRED_HANDLER_BUCKET = "RETIRED_HANDLER_BUCKET";
|
|
9877
|
-
var RETIRED_CTX_VERB = "RETIRED_CTX_VERB";
|
|
9878
10044
|
var HANDLER_NAME_COLLISION = "HANDLER_NAME_COLLISION";
|
|
9879
10045
|
var FIELD_VAL_NOT_DEFINED = "FIELD_VAL_NOT_DEFINED";
|
|
9880
10046
|
var FIELD_VAL_IS_METHOD = "FIELD_VAL_IS_METHOD";
|
|
@@ -9890,7 +10056,6 @@ var UNKNOWN_X_ATTR = "UNKNOWN_X_ATTR";
|
|
|
9890
10056
|
var X_OP_IGNORES_CHILDREN = "X_OP_IGNORES_CHILDREN";
|
|
9891
10057
|
var MAYBE_DROP_AT_PREFIX = "MAYBE_DROP_AT_PREFIX";
|
|
9892
10058
|
var MAYBE_ADD_AT_PREFIX = "MAYBE_ADD_AT_PREFIX";
|
|
9893
|
-
var DEPRECATED_BARE_X_DIRECTIVE = "DEPRECATED_BARE_X_DIRECTIVE";
|
|
9894
10059
|
var BAD_VALUE = "BAD_VALUE";
|
|
9895
10060
|
var UNSUPPORTED_EXPR_SYNTAX = "UNSUPPORTED_EXPR_SYNTAX";
|
|
9896
10061
|
var BINDING_MEMBER_TOO_DEEP = "BINDING_MEMBER_TOO_DEEP";
|
|
@@ -9993,8 +10158,6 @@ function checkComponent(Comp, lx = new LintContext(), { wellKnownExtras = EMPTY_
|
|
|
9993
10158
|
checkProvidesAreAddressable(lx, Comp);
|
|
9994
10159
|
checkLookupShapes(lx, Comp);
|
|
9995
10160
|
checkHandlersNotAsync(lx, Comp);
|
|
9996
|
-
checkRetiredBuckets(lx, Comp);
|
|
9997
|
-
checkRetiredCtxVerbs(lx, Comp);
|
|
9998
10161
|
checkHandlerNameCollisions(lx, Comp);
|
|
9999
10162
|
checkScopedStyleTopLevel(lx, Comp);
|
|
10000
10163
|
const referencedAlters = /* @__PURE__ */ new Set();
|
|
@@ -10040,14 +10203,6 @@ function checkParseIssues(lx, view) {
|
|
|
10040
10203
|
const issues = view.ctx.parseIssues;
|
|
10041
10204
|
if (!issues) return;
|
|
10042
10205
|
for (const { kind, info } of issues) {
|
|
10043
|
-
if (kind === "deprecated:bare-x-directive") {
|
|
10044
|
-
lx.warn(DEPRECATED_BARE_X_DIRECTIVE, info, {
|
|
10045
|
-
kind: "add-prefix",
|
|
10046
|
-
from: info.name,
|
|
10047
|
-
to: `@${info.name}`
|
|
10048
|
-
});
|
|
10049
|
-
continue;
|
|
10050
|
-
}
|
|
10051
10206
|
if (kind === "x-op-ignores-children") {
|
|
10052
10207
|
lx.warn(X_OP_IGNORES_CHILDREN, info, { kind: "remove", what: "the ignored children" });
|
|
10053
10208
|
continue;
|
|
@@ -10158,7 +10313,7 @@ function checkEnrichProjection(lx, view, Comp) {
|
|
|
10158
10313
|
if (node.constructor.name !== "EachNode") continue;
|
|
10159
10314
|
const enrich = node.iterInfo?.enrichWithVal;
|
|
10160
10315
|
if (!enrich?.name) continue;
|
|
10161
|
-
const fn = enrich.constructor.name === "MethodVal" ? protoMethodValue(Comp.
|
|
10316
|
+
const fn = enrich.constructor.name === "MethodVal" ? protoMethodValue(Comp.prototype ?? Object.getPrototypeOf(Comp), enrich.name) : Comp.alter?.[enrich.name];
|
|
10162
10317
|
if (typeof fn !== "function") continue;
|
|
10163
10318
|
const members = pureProjectionBinds(fn);
|
|
10164
10319
|
if (members === null) continue;
|
|
@@ -10279,15 +10434,14 @@ function checkKnownHandlerNames(lx, view, Comp, referencedAlters, referencedDyna
|
|
|
10279
10434
|
}
|
|
10280
10435
|
}
|
|
10281
10436
|
function mkAttrValEnv(Comp, referencedAlters, referencedDynamics) {
|
|
10282
|
-
const { scope, alter, provide, lookup: lookup2,
|
|
10283
|
-
const
|
|
10284
|
-
const { fields } = Class.getMetaClass();
|
|
10437
|
+
const { scope, alter, provide, lookup: lookup2, fields } = Comp;
|
|
10438
|
+
const proto = Comp.prototype ?? Object.getPrototypeOf(Comp);
|
|
10285
10439
|
const dynamicMap = { ...provide, ...lookup2 };
|
|
10286
10440
|
return { fields, proto, scope, alter, referencedAlters, dynamicMap, referencedDynamics };
|
|
10287
10441
|
}
|
|
10288
10442
|
function checkEventHandlersHaveImpls(lx, Comp, referencedInputs) {
|
|
10289
|
-
const { receive: input, views
|
|
10290
|
-
const
|
|
10443
|
+
const { receive: input, views } = Comp;
|
|
10444
|
+
const proto = Comp.prototype ?? Object.getPrototypeOf(Comp);
|
|
10291
10445
|
for (const viewName in views) {
|
|
10292
10446
|
lx.push({ viewName }, () => {
|
|
10293
10447
|
const view = views[viewName];
|
|
@@ -10554,57 +10708,6 @@ function checkConsistentAttrs(lx, Comp, referencedAlters, referencedDynamics) {
|
|
|
10554
10708
|
});
|
|
10555
10709
|
}
|
|
10556
10710
|
}
|
|
10557
|
-
var isPlainObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
10558
|
-
var RETIRED_BUCKETS = {
|
|
10559
|
-
input: {
|
|
10560
|
-
to: "receive",
|
|
10561
|
-
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"
|
|
10562
|
-
},
|
|
10563
|
-
bubble: {
|
|
10564
|
-
to: "intent",
|
|
10565
|
-
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"
|
|
10566
|
-
},
|
|
10567
|
-
response: {
|
|
10568
|
-
to: "receive",
|
|
10569
|
-
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"
|
|
10570
|
-
}
|
|
10571
|
-
};
|
|
10572
|
-
function checkRetiredBuckets(lx, Comp) {
|
|
10573
|
-
const extra = Comp.extra;
|
|
10574
|
-
if (!extra) return;
|
|
10575
|
-
for (const key of Object.keys(extra)) {
|
|
10576
|
-
if (!Object.hasOwn(RETIRED_BUCKETS, key)) continue;
|
|
10577
|
-
const retired = RETIRED_BUCKETS[key];
|
|
10578
|
-
const names = isPlainObj(extra[key]) ? Object.keys(extra[key]) : [];
|
|
10579
|
-
lx.error(RETIRED_HANDLER_BUCKET, { key, to: retired.to, how: retired.how, names });
|
|
10580
|
-
}
|
|
10581
|
-
}
|
|
10582
|
-
var RETIRED_CTX_VERBS = {
|
|
10583
|
-
bubble: 'ctx.intent(name, args, { route: ["dyn"] }) - the route says it walks the ancestors, where the verb used to',
|
|
10584
|
-
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',
|
|
10585
|
-
stopPropagation: "ctx.stop()",
|
|
10586
|
-
inputAtPath: "ctx.sendAtPath(path, name, args)",
|
|
10587
|
-
requestAtPath: 'ctx.intentAtPath(path, name, args, { route: ["lex"] })'
|
|
10588
|
-
};
|
|
10589
|
-
var RETIRED_CTX_RE = new RegExp(
|
|
10590
|
-
`\\bctx\\.(${Object.keys(RETIRED_CTX_VERBS).join("|")})\\s*\\(`,
|
|
10591
|
-
"g"
|
|
10592
|
-
);
|
|
10593
|
-
function checkRetiredCtxVerbs(lx, Comp) {
|
|
10594
|
-
for (const bucket of ["receive", "intent", "alter", "methods", "statics"]) {
|
|
10595
|
-
const block = bucket === "methods" || bucket === "statics" ? Comp.spec?.[bucket] : Comp[bucket];
|
|
10596
|
-
if (!isPlainObj(block)) continue;
|
|
10597
|
-
for (const name in block) {
|
|
10598
|
-
const fn = block[name];
|
|
10599
|
-
if (typeof fn !== "function") continue;
|
|
10600
|
-
const src = String(fn);
|
|
10601
|
-
for (const m of src.matchAll(RETIRED_CTX_RE)) {
|
|
10602
|
-
const verb = m[1];
|
|
10603
|
-
lx.error(RETIRED_CTX_VERB, { verb, to: RETIRED_CTX_VERBS[verb], bucket, name });
|
|
10604
|
-
}
|
|
10605
|
-
}
|
|
10606
|
-
}
|
|
10607
|
-
}
|
|
10608
10711
|
function checkHandlerNameCollisions(lx, Comp) {
|
|
10609
10712
|
const receive = Comp.receive ?? {};
|
|
10610
10713
|
const intent = Comp.intent ?? {};
|
|
@@ -10630,7 +10733,6 @@ function checkUnknownSpecKeys(lx, Comp, wellKnownExtras) {
|
|
|
10630
10733
|
let candidates = null;
|
|
10631
10734
|
for (const key of Object.keys(extra)) {
|
|
10632
10735
|
if (FRAMEWORK_WELL_KNOWN_EXTRAS.has(key) || wellKnownExtras.has(key)) continue;
|
|
10633
|
-
if (Object.hasOwn(RETIRED_BUCKETS, key)) continue;
|
|
10634
10736
|
candidates ??= [
|
|
10635
10737
|
...KNOWN_COMPONENT_SPEC_KEYS,
|
|
10636
10738
|
...FRAMEWORK_WELL_KNOWN_EXTRAS,
|
|
@@ -10640,7 +10742,7 @@ function checkUnknownSpecKeys(lx, Comp, wellKnownExtras) {
|
|
|
10640
10742
|
}
|
|
10641
10743
|
}
|
|
10642
10744
|
function checkFieldDeclarations(lx, Comp) {
|
|
10643
|
-
const fields = Comp
|
|
10745
|
+
const fields = Comp[COMPONENT]?.fields;
|
|
10644
10746
|
if (!fields) return;
|
|
10645
10747
|
for (const fieldName in fields) {
|
|
10646
10748
|
const field = fields[fieldName];
|
|
@@ -10663,7 +10765,7 @@ function checkFieldDeclarations(lx, Comp) {
|
|
|
10663
10765
|
}
|
|
10664
10766
|
}
|
|
10665
10767
|
function checkFieldMethodNameCollisions(lx, Comp) {
|
|
10666
|
-
const meta = Comp
|
|
10768
|
+
const meta = Comp[COMPONENT];
|
|
10667
10769
|
if (!meta) return;
|
|
10668
10770
|
for (const name in meta.fields)
|
|
10669
10771
|
if (Object.hasOwn(meta.methods, name)) lx.error(FIELD_METHOD_NAME_COLLISION, { name });
|
|
@@ -10841,202 +10943,6 @@ var LintParseContext = class extends ParseContext {
|
|
|
10841
10943
|
const tag = this.currentTag;
|
|
10842
10944
|
this.parseIssues.push({ kind, info: tag && info.tag === void 0 ? { ...info, tag } : info });
|
|
10843
10945
|
}
|
|
10844
|
-
// TEMPORARY (2026-07-08): record deprecation nudges on the same channel as
|
|
10845
|
-
// parse issues so checkParseIssues can surface them as warnings. Remove with
|
|
10846
|
-
// the bare `show`/`hide`/`when` spelling.
|
|
10847
|
-
onDeprecatedSyntax(kind, info) {
|
|
10848
|
-
const tag = this.currentTag;
|
|
10849
|
-
this.parseIssues.push({
|
|
10850
|
-
kind: `deprecated:${kind}`,
|
|
10851
|
-
info: tag && info.tag === void 0 ? { ...info, tag } : info
|
|
10852
|
-
});
|
|
10853
|
-
}
|
|
10854
|
-
};
|
|
10855
|
-
|
|
10856
|
-
// src/components.js
|
|
10857
|
-
var Components = class {
|
|
10858
|
-
constructor() {
|
|
10859
|
-
this.getComponentSymbol = /* @__PURE__ */ Symbol("getComponent");
|
|
10860
|
-
this.byId = /* @__PURE__ */ new Map();
|
|
10861
|
-
}
|
|
10862
|
-
registerComponent(comp) {
|
|
10863
|
-
comp.Class.prototype[this.getComponentSymbol] = () => comp;
|
|
10864
|
-
this.byId.set(comp.id, comp);
|
|
10865
|
-
}
|
|
10866
|
-
getComponentForId(id) {
|
|
10867
|
-
return this.byId.get(id) ?? null;
|
|
10868
|
-
}
|
|
10869
|
-
getCompFor(v) {
|
|
10870
|
-
return v?.[this.getComponentSymbol]?.() ?? null;
|
|
10871
|
-
}
|
|
10872
|
-
getHandlerFor(v, name, key) {
|
|
10873
|
-
return this.getCompFor(v)?.[key][name] ?? null;
|
|
10874
|
-
}
|
|
10875
|
-
// The `lex` leg of an intent's route: the handlers registered on the scope chain of
|
|
10876
|
-
// the component that raised it, innermost first. A list, not a first match — see
|
|
10877
|
-
// ComponentStack.lookupIntentChain.
|
|
10878
|
-
getIntentChainFor(v, name) {
|
|
10879
|
-
return this.getCompFor(v)?.scope.lookupIntentChain(name) ?? [];
|
|
10880
|
-
}
|
|
10881
|
-
compileStyles() {
|
|
10882
|
-
const styles2 = [];
|
|
10883
|
-
for (const comp of this.byId.values()) styles2.push(comp.compileStyle());
|
|
10884
|
-
return styles2.join("\n");
|
|
10885
|
-
}
|
|
10886
|
-
};
|
|
10887
|
-
var ComponentStack = class _ComponentStack {
|
|
10888
|
-
constructor(comps = new Components(), parent = null) {
|
|
10889
|
-
this.comps = comps;
|
|
10890
|
-
this.parent = parent;
|
|
10891
|
-
this.byName = {};
|
|
10892
|
-
this.intentsByName = {};
|
|
10893
|
-
this.macros = {};
|
|
10894
|
-
}
|
|
10895
|
-
enter() {
|
|
10896
|
-
return new _ComponentStack(this.comps, this);
|
|
10897
|
-
}
|
|
10898
|
-
registerComponents(comps, opts) {
|
|
10899
|
-
const { aliases: aliases2 = {} } = opts ?? {};
|
|
10900
|
-
for (let i = 0; i < comps.length; i++) {
|
|
10901
|
-
const comp = comps[i];
|
|
10902
|
-
comp.scope = this.enter();
|
|
10903
|
-
comp.Class.scope = comp.scope;
|
|
10904
|
-
this.comps.registerComponent(comp);
|
|
10905
|
-
this.byName[comp.name] = comp;
|
|
10906
|
-
}
|
|
10907
|
-
for (const alias in aliases2) {
|
|
10908
|
-
const comp = this.byName[aliases2[alias]];
|
|
10909
|
-
console.assert(this.byName[alias] === void 0, "alias overrides component", alias);
|
|
10910
|
-
if (comp !== void 0) this.byName[alias] = comp;
|
|
10911
|
-
else console.warn("alias", alias, "to inexistent component", aliases2[alias]);
|
|
10912
|
-
}
|
|
10913
|
-
}
|
|
10914
|
-
registerMacros(macros) {
|
|
10915
|
-
for (const key in macros) {
|
|
10916
|
-
const lower = key.toLowerCase();
|
|
10917
|
-
console.assert(this.macros[lower] === void 0, "macro key collision", lower);
|
|
10918
|
-
this.macros[lower] = macros[key];
|
|
10919
|
-
}
|
|
10920
|
-
}
|
|
10921
|
-
getCompFor(v) {
|
|
10922
|
-
return this.comps.getCompFor(v);
|
|
10923
|
-
}
|
|
10924
|
-
// Handlers that answer an intent's `lex` leg. A name maps to a LIST, because the leg
|
|
10925
|
-
// walks: a handler that returns PASS declines and hands the intent to the next one.
|
|
10926
|
-
// A bare function is accepted as a one-element list.
|
|
10927
|
-
registerIntentHandlers(handlers) {
|
|
10928
|
-
for (const name in handlers) {
|
|
10929
|
-
const fns = Array.isArray(handlers[name]) ? handlers[name] : [handlers[name]];
|
|
10930
|
-
this.intentsByName[name] = fns.map((fn) => new IntentHandler(name, fn));
|
|
10931
|
-
}
|
|
10932
|
-
}
|
|
10933
|
-
// Innermost scope first, then outward. Concatenated rather than first-match, so a
|
|
10934
|
-
// declining handler can hand the intent to one further up.
|
|
10935
|
-
lookupIntentChain(name) {
|
|
10936
|
-
const here = this.intentsByName[name] ?? [];
|
|
10937
|
-
const up = this.parent?.lookupIntentChain(name) ?? [];
|
|
10938
|
-
return up.length === 0 ? here : here.concat(up);
|
|
10939
|
-
}
|
|
10940
|
-
lookupComponent(name) {
|
|
10941
|
-
return this.byName[name] ?? this.parent?.lookupComponent(name) ?? null;
|
|
10942
|
-
}
|
|
10943
|
-
lookupMacro(name) {
|
|
10944
|
-
return this.macros[name] ?? this.parent?.lookupMacro(name) ?? null;
|
|
10945
|
-
}
|
|
10946
|
-
};
|
|
10947
|
-
var ProvideInfo = class {
|
|
10948
|
-
constructor(name, val, symbol) {
|
|
10949
|
-
this.name = name;
|
|
10950
|
-
this.val = val;
|
|
10951
|
-
this.symbol = symbol;
|
|
10952
|
-
}
|
|
10953
|
-
};
|
|
10954
|
-
var LookupInfo = class {
|
|
10955
|
-
constructor(name, compName, provideName, val) {
|
|
10956
|
-
this.name = name;
|
|
10957
|
-
this.compName = compName;
|
|
10958
|
-
this.provideName = provideName;
|
|
10959
|
-
this.val = val;
|
|
10960
|
-
this._sym = void 0;
|
|
10961
|
-
}
|
|
10962
|
-
getProducerSymbol(stack) {
|
|
10963
|
-
if (this._sym === void 0)
|
|
10964
|
-
this._sym = stack.lookupType(this.compName)?.provide?.[this.provideName]?.symbol ?? null;
|
|
10965
|
-
return this._sym;
|
|
10966
|
-
}
|
|
10967
|
-
};
|
|
10968
|
-
var isString = (v) => typeof v === "string";
|
|
10969
|
-
var _rawSpecKeys = "name view style commonStyle globalStyle receive intent alter views provide lookup fields methods statics";
|
|
10970
|
-
var KNOWN_SPEC_KEYS = new Set(_rawSpecKeys.split(" "));
|
|
10971
|
-
var _compId = 0;
|
|
10972
|
-
var Component = class {
|
|
10973
|
-
constructor(Class, o) {
|
|
10974
|
-
this.id = _compId++;
|
|
10975
|
-
this.name = o.name ?? "UnkComp";
|
|
10976
|
-
this.Class = Class;
|
|
10977
|
-
this.views = { main: new View("main", o.view, o.style) };
|
|
10978
|
-
this.commonStyle = o.commonStyle ?? "";
|
|
10979
|
-
this.globalStyle = o.globalStyle ?? "";
|
|
10980
|
-
this.receive = o.receive ?? {};
|
|
10981
|
-
this.intent = o.intent ?? {};
|
|
10982
|
-
this.alter = o.alter ?? {};
|
|
10983
|
-
for (const name in o.views ?? {}) {
|
|
10984
|
-
const v = o.views[name];
|
|
10985
|
-
const { view, style } = isString(v) ? { view: v } : v;
|
|
10986
|
-
this.views[name] = new View(name, view, style);
|
|
10987
|
-
}
|
|
10988
|
-
this._rawProvide = o.provide ?? {};
|
|
10989
|
-
this._rawLookup = o.lookup ?? {};
|
|
10990
|
-
this.provide = {};
|
|
10991
|
-
this.lookup = {};
|
|
10992
|
-
this.scope = null;
|
|
10993
|
-
this.spec = o;
|
|
10994
|
-
this.extra = {};
|
|
10995
|
-
for (const key of Object.keys(o)) if (!KNOWN_SPEC_KEYS.has(key)) this.extra[key] = o[key];
|
|
10996
|
-
}
|
|
10997
|
-
compile(ParseContext2) {
|
|
10998
|
-
for (const name in this.views)
|
|
10999
|
-
this.views[name].compile(new ParseContext2(), this.scope, this.id);
|
|
11000
|
-
const ctx = this.views.main.ctx;
|
|
11001
|
-
for (const key in this._rawProvide) {
|
|
11002
|
-
const val = parseProvide(this._rawProvide[key], ctx);
|
|
11003
|
-
if (val) this.provide[key] = new ProvideInfo(key, val, Symbol(key));
|
|
11004
|
-
}
|
|
11005
|
-
for (const key in this._rawLookup) {
|
|
11006
|
-
const linfo = this._rawLookup[key];
|
|
11007
|
-
const forStr = isString(linfo) ? linfo : isString(linfo?.for) ? linfo.for : null;
|
|
11008
|
-
const [compName, provideName] = forStr === null ? [] : forStr.split(".");
|
|
11009
|
-
if (!isString(compName) || !isString(provideName)) continue;
|
|
11010
|
-
const defStr = isString(linfo?.default) ? linfo.default : null;
|
|
11011
|
-
const val = defStr === null ? null : parseField(defStr, ctx);
|
|
11012
|
-
this.lookup[key] = new LookupInfo(key, compName, provideName, val);
|
|
11013
|
-
}
|
|
11014
|
-
for (const key in this.lookup)
|
|
11015
|
-
if (this.provide[key] !== void 0)
|
|
11016
|
-
console.warn("name declared in both provide and lookup", this.name, key);
|
|
11017
|
-
}
|
|
11018
|
-
make(args, opts) {
|
|
11019
|
-
return this.Class.make(args, opts ?? { scope: this.scope });
|
|
11020
|
-
}
|
|
11021
|
-
getView(name) {
|
|
11022
|
-
return this.views[name] ?? this.views.main;
|
|
11023
|
-
}
|
|
11024
|
-
getEventForId(id, name = "main") {
|
|
11025
|
-
return this.getView(name).ctx.getEventForId(id);
|
|
11026
|
-
}
|
|
11027
|
-
getNodeForId(id, name = "main") {
|
|
11028
|
-
return this.getView(name).ctx.getNodeForId(id);
|
|
11029
|
-
}
|
|
11030
|
-
compileStyle() {
|
|
11031
|
-
const { id, commonStyle, globalStyle, views } = this;
|
|
11032
|
-
const styles2 = commonStyle ? [`[data-cid="${id}"]{${commonStyle}}`] : [];
|
|
11033
|
-
if (globalStyle !== "") styles2.push(globalStyle);
|
|
11034
|
-
for (const name in views) {
|
|
11035
|
-
const { style } = views[name];
|
|
11036
|
-
if (style !== "") styles2.push(`[data-cid="${id}"][data-vid="${name}"]{${style}}`);
|
|
11037
|
-
}
|
|
11038
|
-
return styles2.join("\n");
|
|
11039
|
-
}
|
|
11040
10946
|
};
|
|
11041
10947
|
|
|
11042
10948
|
// src/on.js
|
|
@@ -11178,7 +11084,7 @@ var FieldFloat = class extends Field {
|
|
|
11178
11084
|
super("float", name, CHECK_TYPE_FLOAT, (_) => null, defaultValue);
|
|
11179
11085
|
}
|
|
11180
11086
|
};
|
|
11181
|
-
var getTypeName = (v) => v?.constructor?.getMetaClass?.()?.name;
|
|
11087
|
+
var getTypeName = (v) => v?.constructor?.[COMPONENT]?.name ?? v?.constructor?.getMetaClass?.()?.name ?? null;
|
|
11182
11088
|
var CheckTypeName = class {
|
|
11183
11089
|
constructor(typeName) {
|
|
11184
11090
|
this.typeName = typeName;
|
|
@@ -11279,7 +11185,7 @@ var ClassBuilder = class {
|
|
|
11279
11185
|
getMetaClass: () => metaClass,
|
|
11280
11186
|
make(inArgs = {}, opts = {}) {
|
|
11281
11187
|
const args = {};
|
|
11282
|
-
const scope = opts.scope ?? this.scope;
|
|
11188
|
+
const scope = opts.scope ?? this[COMPONENT]?.scope ?? this.scope;
|
|
11283
11189
|
for (const key in inArgs) {
|
|
11284
11190
|
const field = fields[key];
|
|
11285
11191
|
if (compFields.has(key)) args[key] = mkCompField(field, scope, inArgs[key]);
|
|
@@ -11359,7 +11265,7 @@ function classFromData(name, { fields = {}, methods, statics }) {
|
|
|
11359
11265
|
return b.build();
|
|
11360
11266
|
}
|
|
11361
11267
|
function validateDraftFields(current2, draft) {
|
|
11362
|
-
const meta = current2?.constructor?.getMetaClass?.();
|
|
11268
|
+
const meta = current2?.constructor?.[COMPONENT] ?? current2?.constructor?.getMetaClass?.();
|
|
11363
11269
|
if (!meta) return;
|
|
11364
11270
|
for (const [name, field] of Object.entries(meta.fields)) {
|
|
11365
11271
|
const value = draft[name];
|
|
@@ -11372,7 +11278,33 @@ function validateDraftFields(current2, draft) {
|
|
|
11372
11278
|
}
|
|
11373
11279
|
}
|
|
11374
11280
|
}
|
|
11375
|
-
|
|
11281
|
+
var META_KEYS = "name id fields methods views receive intent alter provide lookup spec extra commonStyle globalStyle scope _rawProvide _rawLookup".split(
|
|
11282
|
+
" "
|
|
11283
|
+
);
|
|
11284
|
+
Component.fromSpec = (opts) => {
|
|
11285
|
+
const Class = classFromData(opts.name, opts);
|
|
11286
|
+
const comp = new Component(Class, opts);
|
|
11287
|
+
const metaClass = Class.getMetaClass();
|
|
11288
|
+
comp.fields = metaClass.fields;
|
|
11289
|
+
comp.methods = metaClass.methods;
|
|
11290
|
+
Class.getMetaClass = () => comp;
|
|
11291
|
+
Class[COMPONENT] = comp;
|
|
11292
|
+
for (const key of META_KEYS)
|
|
11293
|
+
if (!Object.hasOwn(Class, key))
|
|
11294
|
+
Object.defineProperty(Class, key, {
|
|
11295
|
+
get() {
|
|
11296
|
+
return comp[key];
|
|
11297
|
+
},
|
|
11298
|
+
set(v) {
|
|
11299
|
+
comp[key] = v;
|
|
11300
|
+
},
|
|
11301
|
+
configurable: true
|
|
11302
|
+
});
|
|
11303
|
+
for (const key of Object.getOwnPropertyNames(Component.prototype))
|
|
11304
|
+
if (key !== "constructor" && key !== "make" && !Object.hasOwn(Class, key))
|
|
11305
|
+
Class[key] = (...args) => comp[key](...args);
|
|
11306
|
+
return Class;
|
|
11307
|
+
};
|
|
11376
11308
|
var component = (opts) => Component.fromSpec(opts);
|
|
11377
11309
|
|
|
11378
11310
|
// src/stack.js
|
|
@@ -11661,8 +11593,8 @@ var Transaction = class {
|
|
|
11661
11593
|
whenSettled() {
|
|
11662
11594
|
return this.completion.whenSettled();
|
|
11663
11595
|
}
|
|
11664
|
-
// Resolves once this transaction AND all transitively-derived work (sends
|
|
11665
|
-
//
|
|
11596
|
+
// Resolves once this transaction AND all transitively-derived work (sends and
|
|
11597
|
+
// intents, including the answers they produce, recursively) have settled.
|
|
11666
11598
|
whenSubtreeSettled() {
|
|
11667
11599
|
return this.completion.whenSubtreeSettled();
|
|
11668
11600
|
}
|
|
@@ -11836,7 +11768,7 @@ var NameArgsTransaction = class extends Transaction {
|
|
|
11836
11768
|
}
|
|
11837
11769
|
handlerProp = null;
|
|
11838
11770
|
// NameArgs verbs map their handler bucket straight to the observed kind:
|
|
11839
|
-
// receive /
|
|
11771
|
+
// receive / intent.
|
|
11840
11772
|
get observeKind() {
|
|
11841
11773
|
return this.handlerProp;
|
|
11842
11774
|
}
|
|
@@ -12360,12 +12292,14 @@ var ModuleTests = class {
|
|
|
12360
12292
|
}
|
|
12361
12293
|
};
|
|
12362
12294
|
function isComponentObject(x) {
|
|
12363
|
-
|
|
12295
|
+
if (x === null) return false;
|
|
12296
|
+
if (typeof x === "function") return x[COMPONENT] != null;
|
|
12297
|
+
return typeof x.name === "string" && typeof x.Class === "function";
|
|
12364
12298
|
}
|
|
12365
12299
|
function resolveComponentName(arg, components) {
|
|
12366
12300
|
if (isComponentObject(arg)) return arg.name;
|
|
12367
12301
|
if (typeof arg === "function") {
|
|
12368
|
-
for (const c of components) if (c
|
|
12302
|
+
for (const c of components) if (c === arg) return c.name;
|
|
12369
12303
|
}
|
|
12370
12304
|
return null;
|
|
12371
12305
|
}
|
|
@@ -12704,12 +12638,6 @@ function lintIdToMessage(id, info) {
|
|
|
12704
12638
|
}
|
|
12705
12639
|
case "UNKNOWN_HANDLER_ARG_NAME":
|
|
12706
12640
|
return `Unknown handler argument '${info.name}'${fmtOriginSuffix(info)}`;
|
|
12707
|
-
case "RETIRED_HANDLER_BUCKET": {
|
|
12708
|
-
const which = info.names?.length ? ` (${info.names.join(", ")})` : "";
|
|
12709
|
-
return `\`${info.key}\` is no longer a handler bucket${which} — ${info.how}`;
|
|
12710
|
-
}
|
|
12711
|
-
case "RETIRED_CTX_VERB":
|
|
12712
|
-
return `ctx.${info.verb}() no longer exists — use ${info.to} (in \`${info.bucket}.${info.name}\`)`;
|
|
12713
12641
|
case "HANDLER_NAME_COLLISION":
|
|
12714
12642
|
return `${info.problem} — ${info.fix}`;
|
|
12715
12643
|
case "RECEIVE_HANDLER_NOT_IMPLEMENTED":
|
|
@@ -12765,9 +12693,6 @@ function lintIdToMessage(id, info) {
|
|
|
12765
12693
|
}
|
|
12766
12694
|
case "MAYBE_ADD_AT_PREFIX":
|
|
12767
12695
|
return `'${info.name}' on <${(info.tag ?? "").toLowerCase()}> is a plain attribute, but '@${info.name}' is a directive — add the leading '@'`;
|
|
12768
|
-
// TEMPORARY (2026-07-08): remove with the bare `show`/`hide`/`when` spelling.
|
|
12769
|
-
case "DEPRECATED_BARE_X_DIRECTIVE":
|
|
12770
|
-
return `'${info.name}' on <x ${info.op}> is deprecated — write '@${info.name}' instead${fmtTagSuffix(info)}`;
|
|
12771
12696
|
case "BAD_VALUE":
|
|
12772
12697
|
return `${badValueMessage(info)}${fmtTagSuffix(info)}`;
|
|
12773
12698
|
case "UNSUPPORTED_EXPR_SYNTAX":
|
|
@@ -13231,8 +13156,7 @@ function serializeDefault(v) {
|
|
|
13231
13156
|
return v;
|
|
13232
13157
|
}
|
|
13233
13158
|
function getComponentDoc(comp) {
|
|
13234
|
-
const
|
|
13235
|
-
const { fields, name, methods } = meta;
|
|
13159
|
+
const { fields, name, methods } = comp;
|
|
13236
13160
|
const userMethods = Object.keys(methods).map((k) => ({
|
|
13237
13161
|
name: k,
|
|
13238
13162
|
sig: getSignature(k, methods[k])
|
|
@@ -13280,7 +13204,12 @@ function shadowCheckComponent(Comp) {
|
|
|
13280
13204
|
shadowViews[name] = { name, ctx, rawView };
|
|
13281
13205
|
}
|
|
13282
13206
|
const shadowComp = Object.create(Comp);
|
|
13283
|
-
shadowComp
|
|
13207
|
+
Object.defineProperty(shadowComp, "views", {
|
|
13208
|
+
value: shadowViews,
|
|
13209
|
+
writable: true,
|
|
13210
|
+
enumerable: true,
|
|
13211
|
+
configurable: true
|
|
13212
|
+
});
|
|
13284
13213
|
return checkComponent(shadowComp).reports;
|
|
13285
13214
|
}
|
|
13286
13215
|
function check2(app) {
|
|
@@ -13345,12 +13274,12 @@ export {
|
|
|
13345
13274
|
ASYNC_HANDLER,
|
|
13346
13275
|
BAD_VALUE,
|
|
13347
13276
|
BINDING_MEMBER_TOO_DEEP,
|
|
13277
|
+
COMPONENT,
|
|
13348
13278
|
COMP_FIELD_BAD_SHAPE,
|
|
13349
13279
|
CONSTANT_CONDITION,
|
|
13350
13280
|
ComponentDocs,
|
|
13351
13281
|
ComponentList,
|
|
13352
13282
|
ComponentSummary,
|
|
13353
|
-
DEPRECATED_BARE_X_DIRECTIVE,
|
|
13354
13283
|
DUPLICATE_ATTR_DEFINITION,
|
|
13355
13284
|
DYN_ALIAS_NOT_REFERENCED,
|
|
13356
13285
|
DYN_VAL_NOT_DEFINED,
|
|
@@ -13387,8 +13316,6 @@ export {
|
|
|
13387
13316
|
RECEIVE_HANDLER_NOT_IMPLEMENTED,
|
|
13388
13317
|
REDUNDANT_TEMPLATE_STRING,
|
|
13389
13318
|
RENDER_IT_OUTSIDE_OF_LOOP,
|
|
13390
|
-
RETIRED_CTX_VERB,
|
|
13391
|
-
RETIRED_HANDLER_BUCKET,
|
|
13392
13319
|
RenderBatch,
|
|
13393
13320
|
RenderedExample,
|
|
13394
13321
|
RenderedSection,
|