@wireweave/core 3.1.0-beta.3 → 3.1.0-beta.5

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.
@@ -93,14 +93,61 @@ 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 {
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
- interface InteractiveProps {
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
+ type InteractionEffect = {
125
+ kind: 'navigate';
126
+ target: string;
127
+ } | {
128
+ kind: 'set';
129
+ state: string;
130
+ value: StateValue;
131
+ } | {
132
+ kind: 'reset';
133
+ state: string;
134
+ } | {
135
+ kind: 'toggle';
136
+ state: string;
137
+ } | {
138
+ kind: 'open';
139
+ target: string;
140
+ } | {
141
+ kind: 'close';
142
+ target: string;
143
+ };
144
+ /** A browser event with an optional state guard and ordered effects. */
145
+ interface InteractionHandler {
146
+ event: 'click';
147
+ guard?: StateGuard;
148
+ effects: InteractionEffect[];
149
+ }
150
+ interface InteractiveProps extends GuardedOutcomeProps {
104
151
  /** Navigate to another page or URL */
105
152
  navigate?: string;
106
153
  /** Opens a modal, drawer, or other overlay element by id */
@@ -109,9 +156,11 @@ interface InteractiveProps {
109
156
  toggles?: string;
110
157
  /** Custom action identifier (e.g., "submit", "logout", "delete") */
111
158
  action?: string;
159
+ /** Typed event/guard/effect handlers. Legacy intent props remain supported. */
160
+ on?: InteractionHandler | InteractionHandler[];
112
161
  }
113
162
  /**
114
- * Wireframe Document — root node, holds pages and named layout definitions.
163
+ * Wireframe Document — root node, holds `Page`s and reuse definitions.
115
164
  *
116
165
  * Multi-page semantics:
117
166
  * - A document is a *canvas* of pages. `renderPage` consumes one page;
@@ -120,6 +169,23 @@ interface InteractiveProps {
120
169
  * - The canvas itself (gap, layout) is a *renderer* concern, not part of
121
170
  * the DSL — see `CanvasOptions` in `renderer/types.ts`. Chrome / grid /
122
171
  * pan-zoom are host concerns and live entirely outside the renderer.
172
+ *
173
+ * A document child is not necessarily a page: `layout` and `component`
174
+ * definitions are top-level siblings of `page` (see {@link TopLevelNode}).
175
+ * They define trees to be reused, not screens to be drawn, so consumers that
176
+ * want screens must select them — {@link documentPages}.
177
+ *
178
+ * Two independent name scopes live at this level, and neither is enforced by
179
+ * the parser:
180
+ * - {@link PageNode.id} — what `navigate=` addresses.
181
+ * - the `name` of a {@link LayoutDefinitionNode} / {@link ComponentDefinitionNode}
182
+ * — what `uses=` addresses.
183
+ *
184
+ * A duplicate in either scope is a well-formed document that means something
185
+ * unintended (a second page with the same `id` is simply unreachable), so it
186
+ * is a diagnostic, not a parse error: reporting it belongs to `validation/`,
187
+ * where it can carry a location and still let the file be parsed, printed and
188
+ * edited. Resolution must therefore stay total in the presence of duplicates.
123
189
  */
124
190
  interface WireframeDocument extends BaseNode {
125
191
  type: 'Document';
@@ -139,7 +205,20 @@ interface WireframeDocument extends BaseNode {
139
205
  */
140
206
  interface PageNode extends BaseNode, CommonProps {
141
207
  type: 'Page';
142
- /** Stable address used by `navigate=`; distinct from the display title. */
208
+ /**
209
+ * Stable identifier this page is referenced by — the `id=home` attribute.
210
+ *
211
+ * This is the screen's *address*, as distinct from {@link PageNode.title},
212
+ * which is its *display name*. `navigate="home"` resolves against this, so
213
+ * renaming a title must not break a link. Same role the `id` on
214
+ * {@link ModalNode} / {@link DrawerNode} plays for `opens=` / `toggles=`,
215
+ * one scope up: those address an overlay within a page, this addresses a
216
+ * page within a document.
217
+ *
218
+ * Optional, and deliberately not enforced unique by the parser — see the
219
+ * note on {@link WireframeDocument} for where uniqueness is checked and what
220
+ * a duplicate costs.
221
+ */
143
222
  id?: string;
144
223
  title?: string | null;
145
224
  /** Center content both horizontally and vertically */
@@ -148,25 +227,100 @@ interface PageNode extends BaseNode, CommonProps {
148
227
  viewport?: string | number;
149
228
  /** Device preset (e.g., "iphone14", "desktop") */
150
229
  device?: string;
151
- /** Named layout shell that hosts this page's own children. */
230
+ /**
231
+ * Name of the `layout` this page is drawn inside — the `uses=app` attribute.
232
+ * Resolving it to a {@link LayoutDefinitionNode} is a renderer concern; the
233
+ * parser only records the reference.
234
+ */
152
235
  uses?: string;
236
+ /** Application state declarations contributed by this screen module. */
237
+ states?: StateDeclaration[];
153
238
  children: AnyNode[];
154
239
  }
155
240
  /**
156
- * A named page shell declared with `layout NAME { ... slot ... }`.
241
+ * Layout — a named shell defined once and referenced by pages (`uses=<name>`).
242
+ *
243
+ * A layout body is ordinary element content plus one {@link SlotNode} marking
244
+ * where a referencing page's own children belong:
245
+ *
246
+ * ```wireframe
247
+ * layout app {
248
+ * header { title "Acme" }
249
+ * slot
250
+ * footer { text "© 2026" }
251
+ * }
252
+ * ```
157
253
  *
158
- * Layout definitions are top-level structure, not screens. The renderer
159
- * composes a page's children into the first slot when the page says
160
- * `uses=NAME`.
254
+ * The node type is `'Layout'`; the interface is named `LayoutDefinitionNode`
255
+ * because `LayoutNode` already names the union of layout-*category* elements
256
+ * (page / header / main / footer / sidebar / section).
161
257
  */
162
258
  interface LayoutDefinitionNode extends BaseNode, CommonProps {
163
259
  type: 'Layout';
260
+ /** Grammar `Identifier` this layout is referenced by. */
164
261
  name: string;
262
+ /** Application state declarations contributed by this shared layout module. */
263
+ states?: StateDeclaration[];
165
264
  children: AnyNode[];
166
265
  }
167
- /** Bare positional marker inside a layout definition. */
266
+ /**
267
+ * Component — a named fragment defined once for reuse across pages.
268
+ *
269
+ * Definition and round-trip only: expanding a component into its use sites is
270
+ * a renderer concern, so nothing here describes instantiation.
271
+ */
272
+ interface ComponentDefinitionNode extends BaseNode, CommonProps {
273
+ type: 'Component';
274
+ /** Grammar `Identifier` this component is referenced by. */
275
+ name: string;
276
+ /** Typed values every invocation must provide by name. */
277
+ parameters?: ComponentParameter[];
278
+ children: AnyNode[];
279
+ }
280
+ /** Scalar input types supported by reusable component contracts. */
281
+ type ComponentParameterType = 'string' | 'number' | 'boolean';
282
+ /** One named, required input declared by a reusable component. */
283
+ interface ComponentParameter {
284
+ name: string;
285
+ valueType: ComponentParameterType;
286
+ }
287
+ /** Values accepted by a component invocation. */
288
+ type ComponentInputValue = string | number | boolean;
289
+ /** Content supplied to one named slot at a component use-site. */
290
+ interface ComponentSlotFill {
291
+ name: string;
292
+ children: AnyNode[];
293
+ loc?: SourceLocation;
294
+ }
295
+ /**
296
+ * An explicit reusable-component invocation.
297
+ *
298
+ * This is intentionally separate from {@link PageNode.uses}: `uses=` remains
299
+ * the legacy page-layout reference, while `use` invokes a component fragment.
300
+ * The linker fills `instanceId`, `targetId`, and `children` after validating
301
+ * and expanding the invocation.
302
+ */
303
+ interface ComponentUseNode extends BaseNode {
304
+ type: 'ComponentUse';
305
+ name: string;
306
+ namespace?: string;
307
+ inputs: Record<string, ComponentInputValue>;
308
+ fills: ComponentSlotFill[];
309
+ instanceId?: string;
310
+ targetId?: string;
311
+ children?: AnyNode[];
312
+ }
313
+ /**
314
+ * Slot — the position inside a {@link LayoutDefinitionNode} where a
315
+ * referencing page's own content is placed.
316
+ *
317
+ * A bare positional marker: no name, no block. Its position among its parent's
318
+ * `children` is the whole content of the node.
319
+ */
168
320
  interface SlotNode extends BaseNode, CommonProps {
169
321
  type: 'Slot';
322
+ /** Required for component slots; absent for the legacy layout slot. */
323
+ name?: string;
170
324
  }
171
325
  interface HeaderNode extends BaseNode, CommonProps {
172
326
  type: 'Header';
@@ -280,6 +434,8 @@ interface TextNode extends BaseNode, Omit<CommonProps, 'align'> {
280
434
  content: string;
281
435
  size?: TextSize;
282
436
  weight?: TextWeight;
437
+ /** Shorthand for `weight: 'bold'`; an explicit `weight` wins. */
438
+ bold?: boolean;
283
439
  align?: TextAlign;
284
440
  muted?: boolean;
285
441
  }
@@ -435,7 +591,8 @@ interface TableNode extends BaseNode, CommonProps {
435
591
  bordered?: boolean;
436
592
  hover?: boolean;
437
593
  }
438
- interface ListItemNode {
594
+ interface ListItemNode extends BaseNode {
595
+ type: 'ListItem';
439
596
  content: string;
440
597
  icon?: string;
441
598
  children?: ListItemNode[];
@@ -487,19 +644,17 @@ interface PopoverNode extends BaseNode, CommonProps {
487
644
  title?: string | null;
488
645
  children: AnyNode[];
489
646
  }
490
- interface DropdownItemNode extends InteractiveProps {
647
+ interface DropdownItemNode extends BaseNode, InteractiveProps {
648
+ type: 'DropdownItem';
491
649
  label: string;
492
650
  icon?: string;
493
651
  href?: string;
494
652
  danger?: boolean;
495
653
  disabled?: boolean;
496
654
  }
497
- interface DividerNode {
498
- type: 'divider';
499
- }
500
655
  interface DropdownNode extends BaseNode, CommonProps {
501
656
  type: 'Dropdown';
502
- items: (DropdownItemNode | DividerNode)[];
657
+ items: (DropdownItemNode | DividerComponentNode)[];
503
658
  }
504
659
  /** Nav item for array syntax: nav ["a", "b"] */
505
660
  interface NavItem extends InteractiveProps {
@@ -509,9 +664,15 @@ interface NavItem extends InteractiveProps {
509
664
  active?: boolean;
510
665
  disabled?: boolean;
511
666
  }
512
- /** Nav item for block syntax: item "label" icon="x" active */
513
- interface NavBlockItem extends InteractiveProps {
514
- type: 'item';
667
+ /**
668
+ * Nav item for block syntax: item "label" icon="x" active
669
+ *
670
+ * `NavItem` is the same shape written as an array entry, which carries no `type`
671
+ * because an array position needs no discriminant. Here the tag is load-bearing:
672
+ * a nav block holds items, groups and dividers in one list.
673
+ */
674
+ interface NavBlockItem extends BaseNode, InteractiveProps {
675
+ type: 'NavItem';
515
676
  label: string;
516
677
  icon?: string;
517
678
  href?: string;
@@ -519,18 +680,19 @@ interface NavBlockItem extends InteractiveProps {
519
680
  disabled?: boolean;
520
681
  }
521
682
  /** Nav group for block syntax: group "label" { ... } */
522
- interface NavGroupNode {
523
- type: 'group';
683
+ interface NavGroupNode extends BaseNode {
684
+ type: 'NavGroup';
524
685
  label: string;
525
- collapsed?: boolean;
526
- items: (NavBlockItem | NavDivider)[];
527
- }
528
- /** Divider inside nav block */
529
- interface NavDivider {
530
- type: 'divider';
686
+ items: (NavBlockItem | DividerComponentNode)[];
531
687
  }
532
- /** Nav child can be group, item, or divider */
533
- type NavChild = NavGroupNode | NavBlockItem | NavDivider;
688
+ /**
689
+ * Nav child can be group, item, or divider.
690
+ *
691
+ * The divider is the ordinary {@link DividerComponentNode}: `divider` means one
692
+ * thing in this DSL, and a separator written inside a nav block is the same
693
+ * element as one written between two cards.
694
+ */
695
+ type NavChild = NavGroupNode | NavBlockItem | DividerComponentNode;
534
696
  interface NavNode extends BaseNode, CommonProps {
535
697
  type: 'Nav';
536
698
  /** Items for array syntax */
@@ -631,7 +793,9 @@ interface AnnotationItemNode extends BaseNode {
631
793
  children: AnyNode[];
632
794
  }
633
795
  type LayoutNode = PageNode | HeaderNode | MainNode | FooterNode | SidebarNode | SectionNode;
634
- type DefinitionNode = LayoutDefinitionNode;
796
+ /** A named tree defined once for reuse, rather than a screen to draw. */
797
+ type DefinitionNode = LayoutDefinitionNode | ComponentDefinitionNode;
798
+ /** What a {@link WireframeDocument} can hold directly. */
635
799
  type TopLevelNode = PageNode | DefinitionNode;
636
800
  type GridNode = RowNode | ColNode | StackNode | RelativeNode;
637
801
  type ContainerComponentNode = CardNode | ModalNode | DrawerNode | AccordionNode;
@@ -643,9 +807,9 @@ type FeedbackNode = AlertNode | ToastNode | ProgressNode | SpinnerNode;
643
807
  type OverlayNode = TooltipNode | PopoverNode | DropdownNode;
644
808
  type NavigationNode = NavNode | TabsNode | BreadcrumbNode;
645
809
  type AnnotationNode = MarkerNode | AnnotationsNode | AnnotationItemNode;
646
- type ContainerNode = LayoutNode | DefinitionNode | GridNode | ContainerComponentNode | PopoverNode | TooltipNode | AnnotationsNode | AnnotationItemNode;
810
+ type ContainerNode = LayoutNode | DefinitionNode | GridNode | ContainerComponentNode | PopoverNode | TooltipNode | AnnotationsNode | AnnotationItemNode | ComponentUseNode;
647
811
  type LeafNode = TextContentNode | InputComponentNode | ButtonNode | DisplayNode | DataNode | FeedbackNode | DropdownNode | NavigationNode | DividerComponentNode | MarkerNode | SlotNode;
648
812
  type AnyNode = ContainerNode | LeafNode;
649
- type NodeType = 'Document' | 'Page' | 'Layout' | 'Slot' | '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';
813
+ type NodeType = 'Document' | 'Page' | 'Layout' | 'Component' | 'ComponentUse' | 'Slot' | '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';
650
814
 
651
- export type { InputType as $, AccordionNode as A, BadgeNode as B, CardNode as C, ContainerNode as D, DataNode as E, DefinitionNode as F, DirectionValue as G, DisplayNode as H, DividerComponentNode as I, DividerNode as J, DrawerNode as K, DrawerPosition as L, DropdownItemNode as M, DropdownNode as N, FeedbackNode as O, FlexProps as P, FooterNode as Q, GridNode as R, GridProps as S, HeaderNode as T, HeightValue as U, IconNode as V, IconSize as W, IconSizeToken as X, ImageNode as Y, InputComponentNode as Z, InputNode as _, AlertNode as a, ValueWithUnit as a$, InteractiveProps as a0, JustifyValue as a1, LayoutDefinitionNode as a2, LayoutNode as a3, LeafNode as a4, LinkNode as a5, ListItemNode as a6, ListNode as a7, MainNode as a8, MarkerColor as a9, SliderNode as aA, SlotNode as aB, SourceLocation as aC, SpacingProps as aD, SpacingValue as aE, SpinnerNode as aF, SpinnerSize as aG, SpinnerSizeToken as aH, StackNode as aI, SwitchNode as aJ, TabNode as aK, TableNode as aL, TabsNode as aM, TextAlign as aN, TextContentNode as aO, TextNode as aP, TextSize as aQ, TextSizeToken as aR, TextWeight as aS, TextareaNode as aT, TitleLevel as aU, TitleNode as aV, ToastNode as aW, ToastPosition as aX, TooltipNode as aY, TooltipPosition as aZ, TopLevelNode as a_, MarkerNode as aa, ModalNode as ab, NavBlockItem as ac, NavChild as ad, NavDivider as ae, NavGroupNode as af, NavItem as ag, NavNode as ah, NavigationNode as ai, NodeType as aj, OverlayNode as ak, PageNode as al, PlaceholderNode as am, PopoverNode as an, Position as ao, PositionProps as ap, ProgressNode as aq, RadioNode as ar, RelativeNode as as, RowNode as at, SectionNode as au, SelectNode as av, SelectOption as aw, ShadowValue as ax, SidebarNode as ay, SizeProps as az, AlertVariant as b, WidthValue as b0, WireframeDocument as b1, 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, ContainerComponentNode as z };
815
+ 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, TextSize 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, RowNode as aA, SectionNode as aB, SelectNode as aC, SelectOption as aD, ShadowValue as aE, SidebarNode as aF, SizeProps as aG, SliderNode as aH, SlotNode as aI, SourceLocation as aJ, SpacingProps as aK, SpacingValue as aL, SpinnerNode as aM, SpinnerSize as aN, SpinnerSizeToken as aO, StackNode as aP, StateDeclaration as aQ, StateGuard as aR, StateValue as aS, StateValueType as aT, SwitchNode as aU, TabNode as aV, TableNode as aW, TabsNode as aX, TextAlign as aY, TextContentNode as aZ, TextNode 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, TextSizeToken as b0, TextWeight as b1, TextareaNode as b2, TitleLevel as b3, TitleNode as b4, ToastNode as b5, ToastPosition as b6, TooltipNode as b7, TooltipPosition as b8, TopLevelNode as b9, ValueWithUnit as ba, WidthValue as bb, WireframeDocument as bc, 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",
3
+ "version": "3.1.0-beta.5",
4
4
  "description": "Core parser and renderer for wireweave",
5
5
  "type": "module",
6
- "main": "dist/index.js",
6
+ "sideEffects": false,
7
+ "main": "dist/index.cjs",
7
8
  "module": "dist/index.js",
8
9
  "types": "dist/index.d.ts",
9
10
  "exports": {
10
11
  ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js",
13
- "require": "./dist/index.cjs"
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
- "types": "./dist/parser.d.ts",
17
- "import": "./dist/parser.js",
18
- "require": "./dist/parser.cjs"
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
- "types": "./dist/renderer.d.ts",
22
- "import": "./dist/renderer.js",
23
- "require": "./dist/renderer.cjs"
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
  }