@wireweave/core 3.1.0-beta.1 → 3.1.0-beta.10
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/index.cjs +13616 -7709
- package/dist/index.d.cts +733 -116
- package/dist/index.d.ts +733 -116
- package/dist/index.js +13566 -7708
- package/dist/parser.cjs +2191 -972
- package/dist/parser.d.cts +1 -1
- package/dist/parser.d.ts +1 -1
- package/dist/parser.js +2191 -972
- package/dist/renderer.cjs +7156 -4512
- package/dist/renderer.d.cts +439 -9
- package/dist/renderer.d.ts +439 -9
- package/dist/renderer.js +7145 -4512
- package/dist/spec.cjs +2890 -0
- package/dist/spec.d.cts +372 -0
- package/dist/spec.d.ts +372 -0
- package/dist/spec.js +2842 -0
- package/dist/{types-BDbXDhTp.d.cts → types-vhPCZpAW.d.cts} +294 -27
- package/dist/{types-BDbXDhTp.d.ts → types-vhPCZpAW.d.ts} +294 -27
- package/package.json +55 -13
|
@@ -93,14 +93,93 @@ interface PositionProps {
|
|
|
93
93
|
interface AppearanceProps {
|
|
94
94
|
bg?: 'muted' | 'primary' | 'secondary';
|
|
95
95
|
border?: boolean;
|
|
96
|
+
rounded?: boolean;
|
|
96
97
|
}
|
|
97
|
-
interface CommonProps extends SpacingProps, SizeProps, FlexProps, GridProps, PositionProps, AppearanceProps {
|
|
98
|
+
interface CommonProps extends SpacingProps, SizeProps, FlexProps, GridProps, PositionProps, AppearanceProps, GuardedOutcomeProps, VariantScopedProps {
|
|
98
99
|
}
|
|
99
100
|
/**
|
|
100
101
|
* Interactive properties for components that can trigger actions.
|
|
101
102
|
* Used for buttons, links, avatars, icons, and other clickable elements.
|
|
102
103
|
*/
|
|
103
|
-
|
|
104
|
+
/** Scalar values supported by the deterministic prototype state store. */
|
|
105
|
+
type StateValue = string | number | boolean;
|
|
106
|
+
/** Closed scalar types supported by a state declaration. */
|
|
107
|
+
type StateValueType = 'string' | 'number' | 'boolean';
|
|
108
|
+
/** One typed state value and the value it resets to. */
|
|
109
|
+
interface StateDeclaration {
|
|
110
|
+
name: string;
|
|
111
|
+
valueType: StateValueType;
|
|
112
|
+
initial: StateValue;
|
|
113
|
+
}
|
|
114
|
+
/** Equality is the only guard operation: small, typed, and deterministic. */
|
|
115
|
+
interface StateGuard {
|
|
116
|
+
state: string;
|
|
117
|
+
equals: StateValue;
|
|
118
|
+
}
|
|
119
|
+
/** State-controlled render outcomes available on every ordinary node. */
|
|
120
|
+
interface GuardedOutcomeProps {
|
|
121
|
+
visibleWhen?: StateGuard;
|
|
122
|
+
enabledWhen?: StateGuard;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Which variant boards an element is drawn on — `when=loading`, `when=[a, b]`.
|
|
126
|
+
*
|
|
127
|
+
* Deliberately **not** a member of {@link GuardedOutcomeProps}, though the two
|
|
128
|
+
* read alike. A guarded outcome is a runtime fact: the element exists on every
|
|
129
|
+
* board, the renderer emits `data-wf-visible-when`, and the site runtime turns
|
|
130
|
+
* it on and off as state changes. `when` is a build-time fact: the element is
|
|
131
|
+
* *absent* from the markup of every board it does not name, so nothing can
|
|
132
|
+
* toggle it back and no state change reaches it.
|
|
133
|
+
*
|
|
134
|
+
* They are therefore orthogonal rather than alternatives, and one element may
|
|
135
|
+
* carry both — `section when=ready visibleWhen={ state=open, equals=true }`
|
|
136
|
+
* means "only on the ready board, and there only while `open`". Folding `when`
|
|
137
|
+
* into the guarded-outcome interface would say the two are one concept, and the
|
|
138
|
+
* first author to write both would find the pair collapsing into whichever the
|
|
139
|
+
* renderer read last.
|
|
140
|
+
*/
|
|
141
|
+
interface VariantScopedProps {
|
|
142
|
+
/**
|
|
143
|
+
* The variant name, or names, this element belongs to.
|
|
144
|
+
*
|
|
145
|
+
* A list is a disjunction: `when=[loading, empty]` draws the element on the
|
|
146
|
+
* loading board and on the empty board. That is the whole reason the list
|
|
147
|
+
* form exists — a `visibleWhen` guard has only `equals`, so a block two
|
|
148
|
+
* conditions share had to be written once per condition, and a header common
|
|
149
|
+
* to three states was three copies that could drift apart.
|
|
150
|
+
*
|
|
151
|
+
* Absent means "every board", which is what keeps documents that declare no
|
|
152
|
+
* variants rendering exactly as they did.
|
|
153
|
+
*/
|
|
154
|
+
when?: string | string[];
|
|
155
|
+
}
|
|
156
|
+
type InteractionEffect = {
|
|
157
|
+
kind: 'navigate';
|
|
158
|
+
target: string;
|
|
159
|
+
} | {
|
|
160
|
+
kind: 'set';
|
|
161
|
+
state: string;
|
|
162
|
+
value: StateValue;
|
|
163
|
+
} | {
|
|
164
|
+
kind: 'reset';
|
|
165
|
+
state: string;
|
|
166
|
+
} | {
|
|
167
|
+
kind: 'toggle';
|
|
168
|
+
state: string;
|
|
169
|
+
} | {
|
|
170
|
+
kind: 'open';
|
|
171
|
+
target: string;
|
|
172
|
+
} | {
|
|
173
|
+
kind: 'close';
|
|
174
|
+
target: string;
|
|
175
|
+
};
|
|
176
|
+
/** A browser event with an optional state guard and ordered effects. */
|
|
177
|
+
interface InteractionHandler {
|
|
178
|
+
event: 'click';
|
|
179
|
+
guard?: StateGuard;
|
|
180
|
+
effects: InteractionEffect[];
|
|
181
|
+
}
|
|
182
|
+
interface InteractiveProps extends GuardedOutcomeProps {
|
|
104
183
|
/** Navigate to another page or URL */
|
|
105
184
|
navigate?: string;
|
|
106
185
|
/** Opens a modal, drawer, or other overlay element by id */
|
|
@@ -109,9 +188,11 @@ interface InteractiveProps {
|
|
|
109
188
|
toggles?: string;
|
|
110
189
|
/** Custom action identifier (e.g., "submit", "logout", "delete") */
|
|
111
190
|
action?: string;
|
|
191
|
+
/** Typed event/guard/effect handlers. Legacy intent props remain supported. */
|
|
192
|
+
on?: InteractionHandler | InteractionHandler[];
|
|
112
193
|
}
|
|
113
194
|
/**
|
|
114
|
-
* Wireframe Document — root node, holds
|
|
195
|
+
* Wireframe Document — root node, holds `Page`s and reuse definitions.
|
|
115
196
|
*
|
|
116
197
|
* Multi-page semantics:
|
|
117
198
|
* - A document is a *canvas* of pages. `renderPage` consumes one page;
|
|
@@ -120,10 +201,27 @@ interface InteractiveProps {
|
|
|
120
201
|
* - The canvas itself (gap, layout) is a *renderer* concern, not part of
|
|
121
202
|
* the DSL — see `CanvasOptions` in `renderer/types.ts`. Chrome / grid /
|
|
122
203
|
* pan-zoom are host concerns and live entirely outside the renderer.
|
|
204
|
+
*
|
|
205
|
+
* A document child is not necessarily a page: `layout` and `component`
|
|
206
|
+
* definitions are top-level siblings of `page` (see {@link TopLevelNode}).
|
|
207
|
+
* They define trees to be reused, not screens to be drawn, so consumers that
|
|
208
|
+
* want screens must select them — {@link documentPages}.
|
|
209
|
+
*
|
|
210
|
+
* Two independent name scopes live at this level, and neither is enforced by
|
|
211
|
+
* the parser:
|
|
212
|
+
* - {@link PageNode.id} — what `navigate=` addresses.
|
|
213
|
+
* - the `name` of a {@link LayoutDefinitionNode} / {@link ComponentDefinitionNode}
|
|
214
|
+
* — what `uses=` addresses.
|
|
215
|
+
*
|
|
216
|
+
* A duplicate in either scope is a well-formed document that means something
|
|
217
|
+
* unintended (a second page with the same `id` is simply unreachable), so it
|
|
218
|
+
* is a diagnostic, not a parse error: reporting it belongs to `validation/`,
|
|
219
|
+
* where it can carry a location and still let the file be parsed, printed and
|
|
220
|
+
* edited. Resolution must therefore stay total in the presence of duplicates.
|
|
123
221
|
*/
|
|
124
222
|
interface WireframeDocument extends BaseNode {
|
|
125
223
|
type: 'Document';
|
|
126
|
-
children:
|
|
224
|
+
children: TopLevelNode[];
|
|
127
225
|
}
|
|
128
226
|
/**
|
|
129
227
|
* Page — a single fixed-size board (one wireframe screen).
|
|
@@ -139,6 +237,21 @@ interface WireframeDocument extends BaseNode {
|
|
|
139
237
|
*/
|
|
140
238
|
interface PageNode extends BaseNode, CommonProps {
|
|
141
239
|
type: 'Page';
|
|
240
|
+
/**
|
|
241
|
+
* Stable identifier this page is referenced by — the `id=home` attribute.
|
|
242
|
+
*
|
|
243
|
+
* This is the screen's *address*, as distinct from {@link PageNode.title},
|
|
244
|
+
* which is its *display name*. `navigate="home"` resolves against this, so
|
|
245
|
+
* renaming a title must not break a link. Same role the `id` on
|
|
246
|
+
* {@link ModalNode} / {@link DrawerNode} plays for `opens=` / `toggles=`,
|
|
247
|
+
* one scope up: those address an overlay within a page, this addresses a
|
|
248
|
+
* page within a document.
|
|
249
|
+
*
|
|
250
|
+
* Optional, and deliberately not enforced unique by the parser — see the
|
|
251
|
+
* note on {@link WireframeDocument} for where uniqueness is checked and what
|
|
252
|
+
* a duplicate costs.
|
|
253
|
+
*/
|
|
254
|
+
id?: string;
|
|
142
255
|
title?: string | null;
|
|
143
256
|
/** Center content both horizontally and vertically */
|
|
144
257
|
centered?: boolean;
|
|
@@ -146,7 +259,131 @@ interface PageNode extends BaseNode, CommonProps {
|
|
|
146
259
|
viewport?: string | number;
|
|
147
260
|
/** Device preset (e.g., "iphone14", "desktop") */
|
|
148
261
|
device?: string;
|
|
262
|
+
/**
|
|
263
|
+
* Name of the `layout` this page is drawn inside — the `uses=app` attribute.
|
|
264
|
+
* Resolving it to a {@link LayoutDefinitionNode} is a renderer concern; the
|
|
265
|
+
* parser only records the reference.
|
|
266
|
+
*/
|
|
267
|
+
uses?: string;
|
|
268
|
+
/** Application state declarations contributed by this screen module. */
|
|
269
|
+
states?: StateDeclaration[];
|
|
270
|
+
/**
|
|
271
|
+
* Named state variants of this screen — `variants=[loading, empty, ready]`.
|
|
272
|
+
*
|
|
273
|
+
* Each name draws the page again as a screen of its own, so a document
|
|
274
|
+
* declaring three variants renders three independent boards rather than one
|
|
275
|
+
* board with a toggle in it. That is the whole difference from {@link states}:
|
|
276
|
+
* a state is a runtime value the site runtime flips and guards read, so the
|
|
277
|
+
* transitions between states have to exist as UI somewhere; a variant is an
|
|
278
|
+
* axis of the *artifact*, so the states appear side by side and nothing in
|
|
279
|
+
* the wireframe has to offer a way to switch between them. A reviewer of a
|
|
280
|
+
* variant sheet never mistakes a state-switching control for a product
|
|
281
|
+
* feature, because there is none to mistake.
|
|
282
|
+
*
|
|
283
|
+
* Deliberately page-local, where `states` is collected document-wide: a
|
|
284
|
+
* variant only means anything relative to the page it varies, and a document
|
|
285
|
+
* scope would make one page's variant list multiply every other page's
|
|
286
|
+
* screens. Names are free-form identifiers — the language fixes no vocabulary
|
|
287
|
+
* of states, because which states a screen has is a property of that screen.
|
|
288
|
+
*/
|
|
289
|
+
variants?: string[];
|
|
290
|
+
/**
|
|
291
|
+
* Which variant this page *is* — set by `expandVariants`, never by an author.
|
|
292
|
+
*
|
|
293
|
+
* The authored `variants` list and this are the two ends of the same
|
|
294
|
+
* expansion: a page carries the list before it, and each page it expands into
|
|
295
|
+
* carries one name from that list and no list. The printer therefore only
|
|
296
|
+
* writes `variants`, and a document that has been expanded prints back as the
|
|
297
|
+
* boards it became rather than as the fold it came from — the same asymmetry
|
|
298
|
+
* `repeat` has between its node and its copies.
|
|
299
|
+
*/
|
|
300
|
+
variant?: string;
|
|
301
|
+
children: AnyNode[];
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Layout — a named shell defined once and referenced by pages (`uses=<name>`).
|
|
305
|
+
*
|
|
306
|
+
* A layout body is ordinary element content plus one {@link SlotNode} marking
|
|
307
|
+
* where a referencing page's own children belong:
|
|
308
|
+
*
|
|
309
|
+
* ```wireframe
|
|
310
|
+
* layout app {
|
|
311
|
+
* header { title "Acme" }
|
|
312
|
+
* slot
|
|
313
|
+
* footer { text "© 2026" }
|
|
314
|
+
* }
|
|
315
|
+
* ```
|
|
316
|
+
*
|
|
317
|
+
* The node type is `'Layout'`; the interface is named `LayoutDefinitionNode`
|
|
318
|
+
* because `LayoutNode` already names the union of layout-*category* elements
|
|
319
|
+
* (page / header / main / footer / sidebar / section).
|
|
320
|
+
*/
|
|
321
|
+
interface LayoutDefinitionNode extends BaseNode, CommonProps {
|
|
322
|
+
type: 'Layout';
|
|
323
|
+
/** Grammar `Identifier` this layout is referenced by. */
|
|
324
|
+
name: string;
|
|
325
|
+
/** Application state declarations contributed by this shared layout module. */
|
|
326
|
+
states?: StateDeclaration[];
|
|
327
|
+
children: AnyNode[];
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Component — a named fragment defined once for reuse across pages.
|
|
331
|
+
*
|
|
332
|
+
* Definition and round-trip only: expanding a component into its use sites is
|
|
333
|
+
* a renderer concern, so nothing here describes instantiation.
|
|
334
|
+
*/
|
|
335
|
+
interface ComponentDefinitionNode extends BaseNode, CommonProps {
|
|
336
|
+
type: 'Component';
|
|
337
|
+
/** Grammar `Identifier` this component is referenced by. */
|
|
338
|
+
name: string;
|
|
339
|
+
/** Typed values every invocation must provide by name. */
|
|
340
|
+
parameters?: ComponentParameter[];
|
|
341
|
+
children: AnyNode[];
|
|
342
|
+
}
|
|
343
|
+
/** Scalar input types supported by reusable component contracts. */
|
|
344
|
+
type ComponentParameterType = 'string' | 'number' | 'boolean';
|
|
345
|
+
/** One named, required input declared by a reusable component. */
|
|
346
|
+
interface ComponentParameter {
|
|
347
|
+
name: string;
|
|
348
|
+
valueType: ComponentParameterType;
|
|
349
|
+
}
|
|
350
|
+
/** Values accepted by a component invocation. */
|
|
351
|
+
type ComponentInputValue = string | number | boolean;
|
|
352
|
+
/** Content supplied to one named slot at a component use-site. */
|
|
353
|
+
interface ComponentSlotFill {
|
|
354
|
+
name: string;
|
|
149
355
|
children: AnyNode[];
|
|
356
|
+
loc?: SourceLocation;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* An explicit reusable-component invocation.
|
|
360
|
+
*
|
|
361
|
+
* This is intentionally separate from {@link PageNode.uses}: `uses=` remains
|
|
362
|
+
* the legacy page-layout reference, while `use` invokes a component fragment.
|
|
363
|
+
* The linker fills `instanceId`, `targetId`, and `children` after validating
|
|
364
|
+
* and expanding the invocation.
|
|
365
|
+
*/
|
|
366
|
+
interface ComponentUseNode extends BaseNode {
|
|
367
|
+
type: 'ComponentUse';
|
|
368
|
+
name: string;
|
|
369
|
+
namespace?: string;
|
|
370
|
+
inputs: Record<string, ComponentInputValue>;
|
|
371
|
+
fills: ComponentSlotFill[];
|
|
372
|
+
instanceId?: string;
|
|
373
|
+
targetId?: string;
|
|
374
|
+
children?: AnyNode[];
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Slot — the position inside a {@link LayoutDefinitionNode} where a
|
|
378
|
+
* referencing page's own content is placed.
|
|
379
|
+
*
|
|
380
|
+
* A bare positional marker: no name, no block. Its position among its parent's
|
|
381
|
+
* `children` is the whole content of the node.
|
|
382
|
+
*/
|
|
383
|
+
interface SlotNode extends BaseNode, CommonProps {
|
|
384
|
+
type: 'Slot';
|
|
385
|
+
/** Required for component slots; absent for the legacy layout slot. */
|
|
386
|
+
name?: string;
|
|
150
387
|
}
|
|
151
388
|
interface HeaderNode extends BaseNode, CommonProps {
|
|
152
389
|
type: 'Header';
|
|
@@ -175,6 +412,24 @@ interface SectionNode extends BaseNode, CommonProps {
|
|
|
175
412
|
expanded?: boolean;
|
|
176
413
|
children: AnyNode[];
|
|
177
414
|
}
|
|
415
|
+
/**
|
|
416
|
+
* `repeat N { … }` — the same body drawn `count` times.
|
|
417
|
+
*
|
|
418
|
+
* A folding device, not an expressive one: it carries a count and nothing else,
|
|
419
|
+
* so every copy is identical by construction. There is deliberately no index
|
|
420
|
+
* variable — an index is what lets copies differ, and copies that differ are
|
|
421
|
+
* data binding rather than a wireframe.
|
|
422
|
+
*
|
|
423
|
+
* The node survives into the AST unexpanded so the printer can write
|
|
424
|
+
* `repeat 6` back out. Expansion happens on the way to a rendered tree
|
|
425
|
+
* (`expandRepeats`), never in the parser.
|
|
426
|
+
*/
|
|
427
|
+
interface RepeatNode extends BaseNode {
|
|
428
|
+
type: 'Repeat';
|
|
429
|
+
/** How many times to draw `children`. A non-negative integer; `0` draws nothing. */
|
|
430
|
+
count: number;
|
|
431
|
+
children: AnyNode[];
|
|
432
|
+
}
|
|
178
433
|
interface RowNode extends BaseNode, CommonProps {
|
|
179
434
|
type: 'Row';
|
|
180
435
|
children: AnyNode[];
|
|
@@ -260,6 +515,8 @@ interface TextNode extends BaseNode, Omit<CommonProps, 'align'> {
|
|
|
260
515
|
content: string;
|
|
261
516
|
size?: TextSize;
|
|
262
517
|
weight?: TextWeight;
|
|
518
|
+
/** Shorthand for `weight: 'bold'`; an explicit `weight` wins. */
|
|
519
|
+
bold?: boolean;
|
|
263
520
|
align?: TextAlign;
|
|
264
521
|
muted?: boolean;
|
|
265
522
|
}
|
|
@@ -415,7 +672,8 @@ interface TableNode extends BaseNode, CommonProps {
|
|
|
415
672
|
bordered?: boolean;
|
|
416
673
|
hover?: boolean;
|
|
417
674
|
}
|
|
418
|
-
interface ListItemNode {
|
|
675
|
+
interface ListItemNode extends BaseNode {
|
|
676
|
+
type: 'ListItem';
|
|
419
677
|
content: string;
|
|
420
678
|
icon?: string;
|
|
421
679
|
children?: ListItemNode[];
|
|
@@ -467,19 +725,17 @@ interface PopoverNode extends BaseNode, CommonProps {
|
|
|
467
725
|
title?: string | null;
|
|
468
726
|
children: AnyNode[];
|
|
469
727
|
}
|
|
470
|
-
interface DropdownItemNode extends InteractiveProps {
|
|
728
|
+
interface DropdownItemNode extends BaseNode, InteractiveProps {
|
|
729
|
+
type: 'DropdownItem';
|
|
471
730
|
label: string;
|
|
472
731
|
icon?: string;
|
|
473
732
|
href?: string;
|
|
474
733
|
danger?: boolean;
|
|
475
734
|
disabled?: boolean;
|
|
476
735
|
}
|
|
477
|
-
interface DividerNode {
|
|
478
|
-
type: 'divider';
|
|
479
|
-
}
|
|
480
736
|
interface DropdownNode extends BaseNode, CommonProps {
|
|
481
737
|
type: 'Dropdown';
|
|
482
|
-
items: (DropdownItemNode |
|
|
738
|
+
items: (DropdownItemNode | DividerComponentNode)[];
|
|
483
739
|
}
|
|
484
740
|
/** Nav item for array syntax: nav ["a", "b"] */
|
|
485
741
|
interface NavItem extends InteractiveProps {
|
|
@@ -489,9 +745,15 @@ interface NavItem extends InteractiveProps {
|
|
|
489
745
|
active?: boolean;
|
|
490
746
|
disabled?: boolean;
|
|
491
747
|
}
|
|
492
|
-
/**
|
|
493
|
-
|
|
494
|
-
|
|
748
|
+
/**
|
|
749
|
+
* Nav item for block syntax: item "label" icon="x" active
|
|
750
|
+
*
|
|
751
|
+
* `NavItem` is the same shape written as an array entry, which carries no `type`
|
|
752
|
+
* because an array position needs no discriminant. Here the tag is load-bearing:
|
|
753
|
+
* a nav block holds items, groups and dividers in one list.
|
|
754
|
+
*/
|
|
755
|
+
interface NavBlockItem extends BaseNode, InteractiveProps {
|
|
756
|
+
type: 'NavItem';
|
|
495
757
|
label: string;
|
|
496
758
|
icon?: string;
|
|
497
759
|
href?: string;
|
|
@@ -499,18 +761,19 @@ interface NavBlockItem extends InteractiveProps {
|
|
|
499
761
|
disabled?: boolean;
|
|
500
762
|
}
|
|
501
763
|
/** Nav group for block syntax: group "label" { ... } */
|
|
502
|
-
interface NavGroupNode {
|
|
503
|
-
type: '
|
|
764
|
+
interface NavGroupNode extends BaseNode {
|
|
765
|
+
type: 'NavGroup';
|
|
504
766
|
label: string;
|
|
505
|
-
|
|
506
|
-
items: (NavBlockItem | NavDivider)[];
|
|
767
|
+
items: (NavBlockItem | DividerComponentNode)[];
|
|
507
768
|
}
|
|
508
|
-
/**
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
|
|
769
|
+
/**
|
|
770
|
+
* Nav child can be group, item, or divider.
|
|
771
|
+
*
|
|
772
|
+
* The divider is the ordinary {@link DividerComponentNode}: `divider` means one
|
|
773
|
+
* thing in this DSL, and a separator written inside a nav block is the same
|
|
774
|
+
* element as one written between two cards.
|
|
775
|
+
*/
|
|
776
|
+
type NavChild = NavGroupNode | NavBlockItem | DividerComponentNode;
|
|
514
777
|
interface NavNode extends BaseNode, CommonProps {
|
|
515
778
|
type: 'Nav';
|
|
516
779
|
/** Items for array syntax */
|
|
@@ -611,6 +874,10 @@ interface AnnotationItemNode extends BaseNode {
|
|
|
611
874
|
children: AnyNode[];
|
|
612
875
|
}
|
|
613
876
|
type LayoutNode = PageNode | HeaderNode | MainNode | FooterNode | SidebarNode | SectionNode;
|
|
877
|
+
/** A named tree defined once for reuse, rather than a screen to draw. */
|
|
878
|
+
type DefinitionNode = LayoutDefinitionNode | ComponentDefinitionNode;
|
|
879
|
+
/** What a {@link WireframeDocument} can hold directly. */
|
|
880
|
+
type TopLevelNode = PageNode | DefinitionNode;
|
|
614
881
|
type GridNode = RowNode | ColNode | StackNode | RelativeNode;
|
|
615
882
|
type ContainerComponentNode = CardNode | ModalNode | DrawerNode | AccordionNode;
|
|
616
883
|
type TextContentNode = TextNode | TitleNode | LinkNode;
|
|
@@ -621,9 +888,9 @@ type FeedbackNode = AlertNode | ToastNode | ProgressNode | SpinnerNode;
|
|
|
621
888
|
type OverlayNode = TooltipNode | PopoverNode | DropdownNode;
|
|
622
889
|
type NavigationNode = NavNode | TabsNode | BreadcrumbNode;
|
|
623
890
|
type AnnotationNode = MarkerNode | AnnotationsNode | AnnotationItemNode;
|
|
624
|
-
type ContainerNode = LayoutNode | GridNode | ContainerComponentNode | PopoverNode | TooltipNode | AnnotationsNode | AnnotationItemNode;
|
|
625
|
-
type LeafNode = TextContentNode | InputComponentNode | ButtonNode | DisplayNode | DataNode | FeedbackNode | DropdownNode | NavigationNode | DividerComponentNode | MarkerNode;
|
|
891
|
+
type ContainerNode = LayoutNode | DefinitionNode | GridNode | ContainerComponentNode | PopoverNode | TooltipNode | AnnotationsNode | AnnotationItemNode | ComponentUseNode | RepeatNode;
|
|
892
|
+
type LeafNode = TextContentNode | InputComponentNode | ButtonNode | DisplayNode | DataNode | FeedbackNode | DropdownNode | NavigationNode | DividerComponentNode | MarkerNode | SlotNode;
|
|
626
893
|
type AnyNode = ContainerNode | LeafNode;
|
|
627
|
-
type NodeType = 'Document' | 'Page' | 'Header' | 'Main' | 'Footer' | 'Sidebar' | 'Section' | 'Row' | 'Col' | 'Stack' | 'Relative' | 'Card' | 'Modal' | 'Drawer' | 'Accordion' | 'Text' | 'Title' | 'Link' | 'Input' | 'Textarea' | 'Select' | 'Checkbox' | 'Radio' | 'Switch' | 'Slider' | 'Button' | 'Image' | 'Placeholder' | 'Avatar' | 'Badge' | 'Icon' | 'Table' | 'List' | 'Alert' | 'Toast' | 'Progress' | 'Spinner' | 'Tooltip' | 'Popover' | 'Dropdown' | 'Nav' | 'Tabs' | 'Breadcrumb' | 'Divider' | 'Marker' | 'Annotations' | 'AnnotationItem';
|
|
894
|
+
type NodeType = 'Document' | 'Page' | 'Layout' | 'Component' | 'ComponentUse' | 'Slot' | 'Repeat' | 'Header' | 'Main' | 'Footer' | 'Sidebar' | 'Section' | 'Row' | 'Col' | 'Stack' | 'Relative' | 'Card' | 'Modal' | 'Drawer' | 'Accordion' | 'Text' | 'Title' | 'Link' | 'Input' | 'Textarea' | 'Select' | 'Checkbox' | 'Radio' | 'Switch' | 'Slider' | 'Button' | 'Image' | 'Placeholder' | 'Avatar' | 'Badge' | 'Icon' | 'Table' | 'List' | 'Alert' | 'Toast' | 'Progress' | 'Spinner' | 'Tooltip' | 'Popover' | 'Dropdown' | 'Nav' | 'Tabs' | 'Breadcrumb' | 'Divider' | 'Marker' | 'Annotations' | 'AnnotationItem';
|
|
628
895
|
|
|
629
|
-
export type {
|
|
896
|
+
export type { IconNode as $, AccordionNode as A, BadgeNode as B, CardNode as C, ComponentInputValue as D, ComponentParameter as E, ComponentParameterType as F, ComponentSlotFill as G, ComponentUseNode as H, ContainerComponentNode as I, ContainerNode as J, DataNode as K, DefinitionNode as L, DirectionValue as M, DisplayNode as N, DividerComponentNode as O, DrawerNode as P, DrawerPosition as Q, DropdownItemNode as R, DropdownNode as S, FeedbackNode as T, FlexProps as U, FooterNode as V, GridNode as W, GridProps as X, GuardedOutcomeProps as Y, HeaderNode as Z, HeightValue as _, AlertNode as a, TextNode as a$, IconSize as a0, IconSizeToken as a1, ImageNode as a2, InputComponentNode as a3, InputNode as a4, InputType as a5, InteractionEffect as a6, InteractionHandler as a7, InteractiveProps as a8, JustifyValue as a9, RepeatNode as aA, RowNode as aB, SectionNode as aC, SelectNode as aD, SelectOption as aE, ShadowValue as aF, SidebarNode as aG, SizeProps as aH, SliderNode as aI, SlotNode as aJ, SourceLocation as aK, SpacingProps as aL, SpacingValue as aM, SpinnerNode as aN, SpinnerSize as aO, SpinnerSizeToken as aP, StackNode as aQ, StateDeclaration as aR, StateGuard as aS, StateValue as aT, StateValueType as aU, SwitchNode as aV, TabNode as aW, TableNode as aX, TabsNode as aY, TextAlign as aZ, TextContentNode as a_, LayoutDefinitionNode as aa, LayoutNode as ab, LeafNode as ac, LinkNode as ad, ListItemNode as ae, ListNode as af, MainNode as ag, MarkerColor as ah, MarkerNode as ai, ModalNode as aj, NavBlockItem as ak, NavChild as al, NavGroupNode as am, NavItem as an, NavNode as ao, NavigationNode as ap, NodeType as aq, OverlayNode as ar, PageNode as as, PlaceholderNode as at, PopoverNode as au, Position as av, PositionProps as aw, ProgressNode as ax, RadioNode as ay, RelativeNode as az, AlertVariant as b, TextSize as b0, TextSizeToken as b1, TextWeight as b2, TextareaNode as b3, TitleLevel as b4, TitleNode as b5, ToastNode as b6, ToastPosition as b7, TooltipNode as b8, TooltipPosition as b9, TopLevelNode as ba, ValueWithUnit as bb, VariantScopedProps as bc, WidthValue as bd, WireframeDocument as be, AlignValue as c, AnchorPosition as d, AnnotationItemNode as e, AnnotationNode as f, AnnotationsNode as g, AnyNode as h, AppearanceProps as i, AvatarNode as j, AvatarSize as k, AvatarSizeToken as l, BadgeSize as m, BadgeSizeToken as n, BadgeVariant as o, BaseNode as p, BreadcrumbItem as q, BreadcrumbNode as r, ButtonNode as s, ButtonSize as t, ButtonSizeToken as u, ButtonVariant as v, CheckboxNode as w, ColNode as x, CommonProps as y, ComponentDefinitionNode as z };
|
package/package.json
CHANGED
|
@@ -1,31 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wireweave/core",
|
|
3
|
-
"version": "3.1.0-beta.
|
|
3
|
+
"version": "3.1.0-beta.10",
|
|
4
4
|
"description": "Core parser and renderer for wireweave",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"main": "dist/index.cjs",
|
|
8
|
+
"module": "dist/index.js",
|
|
8
9
|
"types": "dist/index.d.ts",
|
|
9
10
|
"exports": {
|
|
10
11
|
".": {
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./dist/index.d.cts",
|
|
18
|
+
"default": "./dist/index.cjs"
|
|
19
|
+
}
|
|
14
20
|
},
|
|
15
21
|
"./parser": {
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
22
|
+
"import": {
|
|
23
|
+
"types": "./dist/parser.d.ts",
|
|
24
|
+
"default": "./dist/parser.js"
|
|
25
|
+
},
|
|
26
|
+
"require": {
|
|
27
|
+
"types": "./dist/parser.d.cts",
|
|
28
|
+
"default": "./dist/parser.cjs"
|
|
29
|
+
}
|
|
19
30
|
},
|
|
20
31
|
"./renderer": {
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
32
|
+
"import": {
|
|
33
|
+
"types": "./dist/renderer.d.ts",
|
|
34
|
+
"default": "./dist/renderer.js"
|
|
35
|
+
},
|
|
36
|
+
"require": {
|
|
37
|
+
"types": "./dist/renderer.d.cts",
|
|
38
|
+
"default": "./dist/renderer.cjs"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"./spec": {
|
|
42
|
+
"import": {
|
|
43
|
+
"types": "./dist/spec.d.ts",
|
|
44
|
+
"default": "./dist/spec.js"
|
|
45
|
+
},
|
|
46
|
+
"require": {
|
|
47
|
+
"types": "./dist/spec.d.cts",
|
|
48
|
+
"default": "./dist/spec.cjs"
|
|
49
|
+
}
|
|
24
50
|
}
|
|
25
51
|
},
|
|
26
52
|
"files": [
|
|
27
53
|
"dist"
|
|
28
54
|
],
|
|
55
|
+
"engines": {
|
|
56
|
+
"node": ">=22.13.0"
|
|
57
|
+
},
|
|
29
58
|
"devDependencies": {
|
|
30
59
|
"@commitlint/cli": "^21.0.1",
|
|
31
60
|
"@commitlint/config-conventional": "^21.0.1",
|
|
@@ -33,15 +62,18 @@
|
|
|
33
62
|
"@release-it/conventional-changelog": "^10.0.4",
|
|
34
63
|
"@storybook/html": "^10.2.18",
|
|
35
64
|
"@storybook/html-vite": "^10.2.18",
|
|
65
|
+
"@types/jsdom": "^28.0.3",
|
|
36
66
|
"@types/node": "^25.0.8",
|
|
37
67
|
"@vitest/coverage-v8": "^3.2.4",
|
|
38
68
|
"eslint": "^10.3.0",
|
|
39
69
|
"husky": "^9.1.7",
|
|
70
|
+
"jsdom": "^30.0.1",
|
|
40
71
|
"knip": "^6.13.1",
|
|
41
72
|
"lint-staged": "^17.0.4",
|
|
42
73
|
"lucide": "^0.562.0",
|
|
43
74
|
"peggy": "^5.0.0",
|
|
44
75
|
"prettier": "^3.8.3",
|
|
76
|
+
"publint": "^0.3.21",
|
|
45
77
|
"release-it": "^19.2.3",
|
|
46
78
|
"storybook": "^10.2.18",
|
|
47
79
|
"tsup": "^8.3.5",
|
|
@@ -66,8 +98,17 @@
|
|
|
66
98
|
},
|
|
67
99
|
"scripts": {
|
|
68
100
|
"build:grammar": "peggy --format es -o src/parser/generated-parser.js src/grammar/wireframe.peggy",
|
|
101
|
+
"build:spec": "node scripts/extract-grammar-elements.mjs",
|
|
102
|
+
"build:icons": "node scripts/generate-icons.mjs",
|
|
103
|
+
"build:icon-names": "node scripts/extract-icon-names.mjs",
|
|
69
104
|
"build:ts": "tsup",
|
|
70
|
-
"build": "pnpm build:grammar && pnpm build:ts",
|
|
105
|
+
"build": "pnpm build:grammar && pnpm build:spec && pnpm build:icons && pnpm build:icon-names && pnpm build:ts",
|
|
106
|
+
"postbuild": "node ../../scripts/dist-freshness-gate.mjs --write .",
|
|
107
|
+
"check:parser-sync": "node scripts/check-generated-parser.mjs",
|
|
108
|
+
"check:spec-sync": "node scripts/extract-grammar-elements.mjs --check",
|
|
109
|
+
"check:icons-sync": "node scripts/generate-icons.mjs --check",
|
|
110
|
+
"check:icon-names-sync": "node scripts/extract-icon-names.mjs --check",
|
|
111
|
+
"pretest": "pnpm run check:parser-sync && pnpm run check:spec-sync && pnpm run check:icons-sync && pnpm run check:icon-names-sync",
|
|
71
112
|
"test": "vitest run",
|
|
72
113
|
"test:watch": "vitest",
|
|
73
114
|
"storybook": "storybook dev -p 6006",
|
|
@@ -79,6 +120,7 @@
|
|
|
79
120
|
"format": "prettier --write .",
|
|
80
121
|
"format:check": "prettier --check .",
|
|
81
122
|
"knip": "knip",
|
|
123
|
+
"publint": "publint --strict",
|
|
82
124
|
"release": "release-it"
|
|
83
125
|
}
|
|
84
126
|
}
|