@wireweave/core 4.0.0-beta.0 → 4.0.0-beta.13
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/README.md +17 -462
- package/dist/app.cjs +50 -0
- package/dist/app.d.cts +488 -0
- package/dist/app.d.ts +488 -0
- package/dist/app.js +1 -0
- package/dist/chunk-3RWGG5EC.js +18042 -0
- package/dist/chunk-4TMDPWPR.cjs +186 -0
- package/dist/chunk-4UZBGIGJ.cjs +4359 -0
- package/dist/chunk-5DGRIQDU.cjs +824 -0
- package/dist/chunk-ETV4XYOV.cjs +5 -0
- package/dist/chunk-FS6A6EJ4.js +4345 -0
- package/dist/chunk-IMUVIIJR.cjs +18051 -0
- package/dist/chunk-JJWAFHSV.js +821 -0
- package/dist/chunk-MD6MNOEQ.cjs +2884 -0
- package/dist/chunk-PKBMQBKP.js +5 -0
- package/dist/chunk-R5WBZWBC.js +180 -0
- package/dist/chunk-V3HVWC7C.js +2874 -0
- package/dist/chunk-XYACLXXF.js +51484 -0
- package/dist/chunk-ZPHNXJRY.cjs +51590 -0
- package/dist/index-BGU_4N4W.d.ts +240 -0
- package/dist/index-BlNYFaZd.d.cts +337 -0
- package/dist/index-Cx4-VXVS.d.ts +337 -0
- package/dist/index-DyXaMSgd.d.cts +240 -0
- package/dist/index.cjs +1844 -58238
- package/dist/index.d.cts +556 -102
- package/dist/index.d.ts +556 -102
- package/dist/index.js +1163 -58104
- package/dist/interaction.cjs +26 -0
- package/dist/interaction.d.cts +3 -0
- package/dist/interaction.d.ts +3 -0
- package/dist/interaction.js +1 -0
- package/dist/parser.cjs +34 -6611
- package/dist/parser.d.cts +11 -2
- package/dist/parser.d.ts +11 -2
- package/dist/parser.js +1 -6585
- package/dist/renderer.cjs +119 -50537
- package/dist/renderer.d.cts +348 -123
- package/dist/renderer.d.ts +348 -123
- package/dist/renderer.js +3 -50499
- package/dist/spec.cjs +94 -0
- package/dist/spec.d.cts +301 -0
- package/dist/spec.d.ts +301 -0
- package/dist/spec.js +1 -0
- package/dist/{types-hEr_afgw.d.cts → types-CGRi1k2N.d.cts} +307 -27
- package/dist/{types-hEr_afgw.d.ts → types-CGRi1k2N.d.ts} +307 -27
- package/dist/types-Dkgr0Wyc.d.cts +75 -0
- package/dist/types-Dkgr0Wyc.d.ts +75 -0
- package/dist/v4-types-2ORUg6To.d.cts +137 -0
- package/dist/v4-types-2ORUg6To.d.ts +137 -0
- package/package.json +112 -35
package/dist/spec.cjs
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkMD6MNOEQ_cjs = require('./chunk-MD6MNOEQ.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "ATTRIBUTE_MAP", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkMD6MNOEQ_cjs.ATTRIBUTE_MAP; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "ATTRIBUTE_OVERRIDES", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkMD6MNOEQ_cjs.ATTRIBUTE_OVERRIDES; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "ATTRIBUTE_SPECS", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkMD6MNOEQ_cjs.ATTRIBUTE_SPECS; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "BLOCK_NODE_SPECS", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkMD6MNOEQ_cjs.BLOCK_NODE_SPECS; }
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "BOX_ATTRIBUTES", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return chunkMD6MNOEQ_cjs.BOX_ATTRIBUTES; }
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports, "COMPONENT_MAP", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () { return chunkMD6MNOEQ_cjs.COMPONENT_MAP; }
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "COMPONENT_NAMES", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return chunkMD6MNOEQ_cjs.COMPONENT_NAMES; }
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(exports, "COMPONENT_SPECS", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () { return chunkMD6MNOEQ_cjs.COMPONENT_SPECS; }
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, "COMPONENT_SPEC_BY_NAME", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () { return chunkMD6MNOEQ_cjs.COMPONENT_SPEC_BY_NAME; }
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "CONTAINER_ATTRIBUTES", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () { return chunkMD6MNOEQ_cjs.CONTAINER_ATTRIBUTES; }
|
|
46
|
+
});
|
|
47
|
+
Object.defineProperty(exports, "ELEMENT_NODE_TYPE_MAP", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () { return chunkMD6MNOEQ_cjs.ELEMENT_NODE_TYPE_MAP; }
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(exports, "GRAMMAR_BLOCK_NODE_TYPES", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () { return chunkMD6MNOEQ_cjs.GRAMMAR_BLOCK_NODE_TYPES; }
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "GRAMMAR_CHILD_KEYWORDS", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () { return chunkMD6MNOEQ_cjs.GRAMMAR_CHILD_KEYWORDS; }
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(exports, "GRAMMAR_ELEMENTS", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function () { return chunkMD6MNOEQ_cjs.GRAMMAR_ELEMENTS; }
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(exports, "INTERACTIVE_ATTRIBUTES", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
get: function () { return chunkMD6MNOEQ_cjs.INTERACTIVE_ATTRIBUTES; }
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(exports, "LUCIDE_ICON_NAMES", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () { return chunkMD6MNOEQ_cjs.LUCIDE_ICON_NAMES; }
|
|
70
|
+
});
|
|
71
|
+
Object.defineProperty(exports, "NODE_TYPE_MAP", {
|
|
72
|
+
enumerable: true,
|
|
73
|
+
get: function () { return chunkMD6MNOEQ_cjs.NODE_TYPE_MAP; }
|
|
74
|
+
});
|
|
75
|
+
Object.defineProperty(exports, "VALID_ATTRIBUTE_NAMES", {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
get: function () { return chunkMD6MNOEQ_cjs.VALID_ATTRIBUTE_NAMES; }
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(exports, "VALID_COMPONENT_NAMES", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function () { return chunkMD6MNOEQ_cjs.VALID_COMPONENT_NAMES; }
|
|
82
|
+
});
|
|
83
|
+
Object.defineProperty(exports, "attributeFor", {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
get: function () { return chunkMD6MNOEQ_cjs.attributeFor; }
|
|
86
|
+
});
|
|
87
|
+
Object.defineProperty(exports, "getValidAttributes", {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () { return chunkMD6MNOEQ_cjs.getValidAttributes; }
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(exports, "isValidAttribute", {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get: function () { return chunkMD6MNOEQ_cjs.isValidAttribute; }
|
|
94
|
+
});
|
package/dist/spec.d.cts
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { c as ComponentSpec, a as AttributeSpec, A as AttributeOverride } from './types-Dkgr0Wyc.cjs';
|
|
2
|
+
export { b as AttributeValueType, C as ComponentCategory } from './types-Dkgr0Wyc.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* GENERATED FILE — DO NOT EDIT.
|
|
6
|
+
*
|
|
7
|
+
* Derived from `src/grammar/wireframe.peggy` by `scripts/extract-grammar-elements.mjs`
|
|
8
|
+
* (`pnpm build:spec`). The grammar is the single source of truth for the DSL
|
|
9
|
+
* element set; edit the grammar and regenerate, never this file.
|
|
10
|
+
*/
|
|
11
|
+
/** Every DSL element keyword, mapped to the AST node type its rule emits. */
|
|
12
|
+
declare const GRAMMAR_ELEMENTS: {
|
|
13
|
+
readonly page: "Page";
|
|
14
|
+
readonly layout: "Layout";
|
|
15
|
+
readonly component: "Component";
|
|
16
|
+
readonly use: "ComponentUse";
|
|
17
|
+
readonly slot: "Slot";
|
|
18
|
+
readonly repeat: "Repeat";
|
|
19
|
+
readonly header: "Header";
|
|
20
|
+
readonly main: "Main";
|
|
21
|
+
readonly footer: "Footer";
|
|
22
|
+
readonly sidebar: "Sidebar";
|
|
23
|
+
readonly row: "Row";
|
|
24
|
+
readonly col: "Col";
|
|
25
|
+
readonly stack: "Stack";
|
|
26
|
+
readonly relative: "Relative";
|
|
27
|
+
readonly card: "Card";
|
|
28
|
+
readonly modal: "Modal";
|
|
29
|
+
readonly drawer: "Drawer";
|
|
30
|
+
readonly accordion: "Accordion";
|
|
31
|
+
readonly section: "Section";
|
|
32
|
+
readonly text: "Text";
|
|
33
|
+
readonly title: "Title";
|
|
34
|
+
readonly link: "Link";
|
|
35
|
+
readonly button: "Button";
|
|
36
|
+
readonly input: "Input";
|
|
37
|
+
readonly textarea: "Textarea";
|
|
38
|
+
readonly select: "Select";
|
|
39
|
+
readonly checkbox: "Checkbox";
|
|
40
|
+
readonly radio: "Radio";
|
|
41
|
+
readonly switch: "Switch";
|
|
42
|
+
readonly slider: "Slider";
|
|
43
|
+
readonly image: "Image";
|
|
44
|
+
readonly placeholder: "Placeholder";
|
|
45
|
+
readonly avatar: "Avatar";
|
|
46
|
+
readonly badge: "Badge";
|
|
47
|
+
readonly icon: "Icon";
|
|
48
|
+
readonly table: "Table";
|
|
49
|
+
readonly list: "List";
|
|
50
|
+
readonly alert: "Alert";
|
|
51
|
+
readonly toast: "Toast";
|
|
52
|
+
readonly progress: "Progress";
|
|
53
|
+
readonly spinner: "Spinner";
|
|
54
|
+
readonly tooltip: "Tooltip";
|
|
55
|
+
readonly popover: "Popover";
|
|
56
|
+
readonly dropdown: "Dropdown";
|
|
57
|
+
readonly nav: "Nav";
|
|
58
|
+
readonly tabs: "Tabs";
|
|
59
|
+
readonly breadcrumb: "Breadcrumb";
|
|
60
|
+
readonly divider: "Divider";
|
|
61
|
+
readonly marker: "Marker";
|
|
62
|
+
readonly annotations: "Annotations";
|
|
63
|
+
readonly item: "AnnotationItem";
|
|
64
|
+
};
|
|
65
|
+
/** Union of every DSL element keyword. */
|
|
66
|
+
type GrammarElementName = keyof typeof GRAMMAR_ELEMENTS;
|
|
67
|
+
/** Union of every AST node type an element rule emits. */
|
|
68
|
+
type GrammarNodeType = (typeof GRAMMAR_ELEMENTS)[GrammarElementName];
|
|
69
|
+
/**
|
|
70
|
+
* Node types that exist only inside another element's block.
|
|
71
|
+
*
|
|
72
|
+
* `nav { item … }` and `nav { group { … } }` produce real nodes — they carry
|
|
73
|
+
* attributes, hold interaction intents and need a source location — but their
|
|
74
|
+
* keywords are not elements: `item` means something different in `nav`,
|
|
75
|
+
* `list`, `dropdown` and `annotations`, so it cannot map to one node type the
|
|
76
|
+
* way {@link GRAMMAR_ELEMENTS} entries do. They are addressed by node type
|
|
77
|
+
* instead, and the spec registry gives them their metadata that way.
|
|
78
|
+
*/
|
|
79
|
+
declare const GRAMMAR_BLOCK_NODE_TYPES: readonly ["ListItem", "DropdownItem", "NavGroup", "NavItem"];
|
|
80
|
+
/** Union of every block-scoped node type. */
|
|
81
|
+
type GrammarBlockNodeType = (typeof GRAMMAR_BLOCK_NODE_TYPES)[number];
|
|
82
|
+
/**
|
|
83
|
+
* The grammar's `ChildKeyword` set: keywords that start a child element and so
|
|
84
|
+
* cannot be parsed back as attribute names (`AttributeName = !ChildKeyword Identifier`).
|
|
85
|
+
* It also covers block-scoped keywords (`columns`, `tab`, `group`) that are not
|
|
86
|
+
* elements of their own, and omits element keywords that are deliberately
|
|
87
|
+
* context-sensitive (`title`, `placeholder`, `icon` double as attribute names).
|
|
88
|
+
*/
|
|
89
|
+
declare const GRAMMAR_CHILD_KEYWORDS: readonly ["page", "header", "main", "footer", "sidebar", "row", "col", "stack", "relative", "card", "modal", "drawer", "accordion", "section", "text", "link", "button", "input", "textarea", "select", "checkbox", "radio", "switch", "slider", "image", "avatar", "badge", "table", "columns", "list", "item", "alert", "toast", "progress", "spinner", "tooltip", "popover", "dropdown", "divider", "nav", "tabs", "tab", "breadcrumb", "group", "marker", "annotations", "repeat", "layout", "component", "use", "fill", "slot"];
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* GENERATED FILE — DO NOT EDIT.
|
|
93
|
+
*
|
|
94
|
+
* Derived from `src/icons/lucide-icons.generated.ts` by `scripts/extract-icon-names.mjs`
|
|
95
|
+
* (`pnpm build:icon-names`). The dataset is the single source of truth for
|
|
96
|
+
* which glyphs exist; regenerate from it, never edit this file.
|
|
97
|
+
*/
|
|
98
|
+
/**
|
|
99
|
+
* Every icon name the renderer can draw.
|
|
100
|
+
*
|
|
101
|
+
* Read this through `attributeFor(element, attribute)`, which is the only
|
|
102
|
+
* consumer that knows an icon-valued attribute from any other string-valued
|
|
103
|
+
* one. The flat attribute registry deliberately does not carry these values —
|
|
104
|
+
* see `attribute-overrides.ts`.
|
|
105
|
+
*/
|
|
106
|
+
declare const LUCIDE_ICON_NAMES: readonly string[];
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Wireweave DSL Component Definitions
|
|
110
|
+
*
|
|
111
|
+
* Metadata for every element the grammar defines.
|
|
112
|
+
*
|
|
113
|
+
* The element set itself is not declared here — it is extracted from
|
|
114
|
+
* `src/grammar/wireframe.peggy` into `grammar-elements.generated.ts`. This file
|
|
115
|
+
* only attaches metadata (category, attributes, description) to those elements,
|
|
116
|
+
* and the `Record<GrammarElementName, …>` key type makes that attachment total:
|
|
117
|
+
* a new grammar element fails to typecheck until its metadata is filled in, and
|
|
118
|
+
* an entry for a non-element is rejected as an excess property.
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Every element keyword, in presentation order.
|
|
123
|
+
*
|
|
124
|
+
* `Object.keys` widens to `string[]`; the keys are exactly `GrammarElementName`
|
|
125
|
+
* because {@link COMPONENT_METADATA} is typed as a total record over it.
|
|
126
|
+
*/
|
|
127
|
+
declare const COMPONENT_NAMES: readonly GrammarElementName[];
|
|
128
|
+
/**
|
|
129
|
+
* All valid components in Wireweave DSL
|
|
130
|
+
*/
|
|
131
|
+
declare const COMPONENT_SPECS: readonly ComponentSpec[];
|
|
132
|
+
/**
|
|
133
|
+
* Set of all valid component names for quick lookup
|
|
134
|
+
*/
|
|
135
|
+
declare const VALID_COMPONENT_NAMES: ReadonlySet<string>;
|
|
136
|
+
/**
|
|
137
|
+
* Map of component name to spec for quick lookup
|
|
138
|
+
*/
|
|
139
|
+
declare const COMPONENT_MAP: ReadonlyMap<string, ComponentSpec>;
|
|
140
|
+
/**
|
|
141
|
+
* Specs for block-scoped nodes. Deliberately absent from {@link COMPONENT_SPECS}
|
|
142
|
+
* and {@link COMPONENT_MAP}: those answer "what elements can I write here", and
|
|
143
|
+
* `item` is not writable on its own.
|
|
144
|
+
*/
|
|
145
|
+
declare const BLOCK_NODE_SPECS: readonly ComponentSpec[];
|
|
146
|
+
/**
|
|
147
|
+
* Map of AST node type to spec for quick lookup.
|
|
148
|
+
*
|
|
149
|
+
* Covers every node type the parser can emit — elements and block-scoped nodes
|
|
150
|
+
* alike — because a consumer that dispatches on `node.type` has no way to know
|
|
151
|
+
* which category a node came from. `__tests__/grammar-spec-ssot.test.ts` holds
|
|
152
|
+
* that coverage total against the grammar.
|
|
153
|
+
*/
|
|
154
|
+
declare const NODE_TYPE_MAP: ReadonlyMap<string, ComponentSpec>;
|
|
155
|
+
/**
|
|
156
|
+
* Map of AST node type to spec, restricted to elements.
|
|
157
|
+
*
|
|
158
|
+
* The distinction from {@link NODE_TYPE_MAP} is the two different questions a
|
|
159
|
+
* consumer can be asking. "Can this node be resolved at all" — validation,
|
|
160
|
+
* attribute checking — wants every emitted type. "Is this a component the
|
|
161
|
+
* author placed on the screen" — element counts, category tallies, inventories
|
|
162
|
+
* — must exclude block-scoped nodes, or a nav's entries each get counted as
|
|
163
|
+
* screen elements alongside the nav itself.
|
|
164
|
+
*/
|
|
165
|
+
declare const ELEMENT_NODE_TYPE_MAP: ReadonlyMap<string, ComponentSpec>;
|
|
166
|
+
/**
|
|
167
|
+
* Spec by element name — the typed lookup consumers derive their own
|
|
168
|
+
* per-element data from (editor tooling, docs generators).
|
|
169
|
+
*/
|
|
170
|
+
declare const COMPONENT_SPEC_BY_NAME: Readonly<Record<GrammarElementName, ComponentSpec>>;
|
|
171
|
+
/**
|
|
172
|
+
* Get valid attributes for a component (by name or node type)
|
|
173
|
+
*/
|
|
174
|
+
declare function getValidAttributes(componentNameOrType: string): readonly string[] | undefined;
|
|
175
|
+
/**
|
|
176
|
+
* Check if an attribute is valid for a component
|
|
177
|
+
*/
|
|
178
|
+
declare function isValidAttribute(componentNameOrType: string, attributeName: string): boolean;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Wireweave DSL Attribute Definitions
|
|
182
|
+
*
|
|
183
|
+
* Complete list of all valid attributes in Wireweave DSL.
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* All valid attributes in Wireweave DSL
|
|
188
|
+
*/
|
|
189
|
+
declare const ATTRIBUTE_SPECS: readonly AttributeSpec[];
|
|
190
|
+
/**
|
|
191
|
+
* Set of all valid attribute names for quick lookup
|
|
192
|
+
*/
|
|
193
|
+
declare const VALID_ATTRIBUTE_NAMES: ReadonlySet<string>;
|
|
194
|
+
/**
|
|
195
|
+
* Map of attribute name to spec for quick lookup
|
|
196
|
+
*/
|
|
197
|
+
declare const ATTRIBUTE_MAP: ReadonlyMap<string, AttributeSpec>;
|
|
198
|
+
/**
|
|
199
|
+
* Attributes every element accepts, because every renderer turns them into that
|
|
200
|
+
* element's own box: padding, margin, gap, size bounds, absolute offsets.
|
|
201
|
+
*
|
|
202
|
+
* The membership of this list is measured, not asserted.
|
|
203
|
+
* `@wireweave/language-data`'s `__tests__/spec-render-closure.test.ts` renders
|
|
204
|
+
* each element with and without each attribute it declares and fails on any pair
|
|
205
|
+
* that leaves the output identical — bar a short list of recorded render debt,
|
|
206
|
+
* which may only shrink. So an attribute only some elements honour cannot sit
|
|
207
|
+
* here: it belongs in {@link CONTAINER_ATTRIBUTES} or on the individual elements
|
|
208
|
+
* that read it. Changes to the list itself are caught by
|
|
209
|
+
* `__tests__/spec-surface-baseline.ts` in the same package, in both directions:
|
|
210
|
+
* a name leaving this list withdraws syntax from documents already using it, and
|
|
211
|
+
* that is as much a failure as a name arriving unreviewed.
|
|
212
|
+
*
|
|
213
|
+
* Both gates live outside this package deliberately. A check shipped alongside
|
|
214
|
+
* the list it checks is the producer grading its own output, and this list is
|
|
215
|
+
* the thing under test.
|
|
216
|
+
*/
|
|
217
|
+
declare const BOX_ATTRIBUTES: readonly string[];
|
|
218
|
+
/**
|
|
219
|
+
* Attributes only the elements that render a flex container honour — the flex
|
|
220
|
+
* properties themselves plus the decoration `getCommonClasses` puts on that
|
|
221
|
+
* container.
|
|
222
|
+
*
|
|
223
|
+
* Leaf controls (`checkbox`, `radio`, `divider`, `marker`, `annotations`) build
|
|
224
|
+
* their own markup and read none of these, so they declare {@link BOX_ATTRIBUTES}
|
|
225
|
+
* alone. Spread both lists on an element that renders a container.
|
|
226
|
+
*/
|
|
227
|
+
declare const CONTAINER_ATTRIBUTES: readonly string[];
|
|
228
|
+
/**
|
|
229
|
+
* Attributes every element that can be interacted with accepts.
|
|
230
|
+
*
|
|
231
|
+
* The mirror of `InteractiveProps` in `src/ast/types.ts`: an element whose node
|
|
232
|
+
* extends that interface belongs in this list, and one whose node does not, does
|
|
233
|
+
* not. Spread it the way {@link BOX_ATTRIBUTES} is spread, so that adding an
|
|
234
|
+
* interaction attribute reaches every interactive element at once rather than
|
|
235
|
+
* six out of seven.
|
|
236
|
+
*/
|
|
237
|
+
declare const INTERACTIVE_ATTRIBUTES: readonly string[];
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Element-scoped attribute facts.
|
|
241
|
+
*
|
|
242
|
+
* `ATTRIBUTE_SPECS` is keyed by attribute name with no owning element, which is
|
|
243
|
+
* what lets an editor answer "is `gap` a real attribute" without knowing where
|
|
244
|
+
* the cursor is. The price is that it can hold only one answer per name, so a
|
|
245
|
+
* fact that is true on one element and false on the next has nowhere to live —
|
|
246
|
+
* the registry either states it everywhere (wrong) or nowhere (silent).
|
|
247
|
+
*
|
|
248
|
+
* This module is that missing place. It is keyed by node type first and
|
|
249
|
+
* attribute second, and {@link attributeFor} is the only way to read it: a
|
|
250
|
+
* consumer that has an element in hand gets the narrow answer, and one that has
|
|
251
|
+
* only a name still gets the registry's wide one.
|
|
252
|
+
*
|
|
253
|
+
* **The icon vocabulary is here on purpose, not for want of a better home.**
|
|
254
|
+
* `icon` is glyph-valued on all seven elements that declare it, so it looks like
|
|
255
|
+
* it belongs in the registry — but "in the registry" means "visible to
|
|
256
|
+
* element-blind consumers", and those are exactly the consumers that must not
|
|
257
|
+
* see it. `packages/language-data` mirrors registry `values` into the editor's
|
|
258
|
+
* value-keyword vocabulary, which is a single alternation matched against any
|
|
259
|
+
* value position; absorbing 1,667 glyph names there would colour `home` and
|
|
260
|
+
* `map` as language constants wherever a value can appear, in a document that
|
|
261
|
+
* has no icon in it. Icon names are a dataset the renderer looks names up in,
|
|
262
|
+
* not words of the language. Keeping them behind {@link attributeFor} is what
|
|
263
|
+
* keeps that distinction enforceable rather than merely stated.
|
|
264
|
+
*
|
|
265
|
+
* Keys are node types, never keywords. `item` names three different shapes
|
|
266
|
+
* (`NavItem`, `DropdownItem`, `ListItem`) — see the note on `BLOCK_NODE_METADATA`
|
|
267
|
+
* in `components.ts` — so a keyword-keyed table would silently apply one
|
|
268
|
+
* element's narrowing to two others. {@link attributeFor} still accepts either
|
|
269
|
+
* spelling and resolves it to the node type before looking here, so the two
|
|
270
|
+
* spellings cannot disagree.
|
|
271
|
+
*/
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Every element-scoped narrowing, keyed by node type then attribute name.
|
|
275
|
+
*
|
|
276
|
+
* Exported for the gates and for tooling that wants to enumerate the narrowings
|
|
277
|
+
* rather than ask about one pair. Read a single pair through
|
|
278
|
+
* {@link attributeFor}, which composes the narrowing onto the registry entry.
|
|
279
|
+
*/
|
|
280
|
+
declare const ATTRIBUTE_OVERRIDES: Readonly<Record<string, Readonly<Record<string, AttributeOverride>>>>;
|
|
281
|
+
/**
|
|
282
|
+
* The spec of one attribute *on one element*.
|
|
283
|
+
*
|
|
284
|
+
* The element-aware counterpart to `isValidAttribute`, resolving the same way:
|
|
285
|
+
* either an element keyword or an AST node type identifies the element, so a
|
|
286
|
+
* consumer walking a parsed tree and one completing source text ask the same
|
|
287
|
+
* question and get the same answer.
|
|
288
|
+
*
|
|
289
|
+
* `undefined` means there is no spec to return — the element is unknown, or it
|
|
290
|
+
* does not accept the attribute, or the registry has never heard of the
|
|
291
|
+
* attribute. A caller that needs to tell those apart is asking a diagnostic
|
|
292
|
+
* question and should reach for the registries directly; this function answers
|
|
293
|
+
* "what does this attribute mean here", and all three cases answer it the same.
|
|
294
|
+
*
|
|
295
|
+
* @param componentNameOrType - element keyword (`icon`) or node type (`Icon`)
|
|
296
|
+
* @param attributeName - attribute as written in the source
|
|
297
|
+
* @returns the registry entry, narrowed by any override for this element
|
|
298
|
+
*/
|
|
299
|
+
declare function attributeFor(componentNameOrType: string, attributeName: string): AttributeSpec | undefined;
|
|
300
|
+
|
|
301
|
+
export { ATTRIBUTE_MAP, ATTRIBUTE_OVERRIDES, ATTRIBUTE_SPECS, AttributeOverride, AttributeSpec, BLOCK_NODE_SPECS, BOX_ATTRIBUTES, COMPONENT_MAP, COMPONENT_NAMES, COMPONENT_SPECS, COMPONENT_SPEC_BY_NAME, CONTAINER_ATTRIBUTES, ComponentSpec, ELEMENT_NODE_TYPE_MAP, GRAMMAR_BLOCK_NODE_TYPES, GRAMMAR_CHILD_KEYWORDS, GRAMMAR_ELEMENTS, type GrammarBlockNodeType, type GrammarElementName, type GrammarNodeType, INTERACTIVE_ATTRIBUTES, LUCIDE_ICON_NAMES, NODE_TYPE_MAP, VALID_ATTRIBUTE_NAMES, VALID_COMPONENT_NAMES, attributeFor, getValidAttributes, isValidAttribute };
|