@wireweave/core 1.0.0-beta.20260107130839 → 1.0.0-beta.20260107132939

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/src/ast/types.ts DELETED
@@ -1,661 +0,0 @@
1
- /**
2
- * AST Type definitions for wireweave
3
- *
4
- * Comprehensive type definitions for all AST nodes
5
- */
6
-
7
- // ===========================================
8
- // Source Location
9
- // ===========================================
10
-
11
- export interface Position {
12
- line: number;
13
- column: number;
14
- offset: number;
15
- }
16
-
17
- export interface SourceLocation {
18
- start: Position;
19
- end: Position;
20
- }
21
-
22
- // ===========================================
23
- // Base Node
24
- // ===========================================
25
-
26
- export interface BaseNode {
27
- type: string;
28
- loc?: SourceLocation;
29
- }
30
-
31
- // ===========================================
32
- // Common Props
33
- // ===========================================
34
-
35
- /**
36
- * Value with CSS unit (e.g., 16px, 100%, 2em)
37
- * Used when explicit unit is specified in DSL
38
- */
39
- export interface ValueWithUnit {
40
- value: number;
41
- unit: 'px' | '%' | 'em' | 'rem' | 'vh' | 'vw';
42
- }
43
-
44
- /**
45
- * Spacing value:
46
- * - number: spacing token (0=0px, 1=4px, 2=8px, 4=16px, 6=24px, 8=32px, etc.)
47
- * - ValueWithUnit: direct CSS value (e.g., { value: 16, unit: 'px' })
48
- */
49
- export type SpacingValue = number | ValueWithUnit;
50
-
51
- export interface SpacingProps {
52
- p?: SpacingValue;
53
- px?: SpacingValue;
54
- py?: SpacingValue;
55
- pt?: SpacingValue;
56
- pr?: SpacingValue;
57
- pb?: SpacingValue;
58
- pl?: SpacingValue;
59
- m?: SpacingValue;
60
- mx?: SpacingValue | 'auto';
61
- my?: SpacingValue;
62
- mt?: SpacingValue;
63
- mr?: SpacingValue;
64
- mb?: SpacingValue;
65
- ml?: SpacingValue;
66
- }
67
-
68
- /**
69
- * Width/Height value:
70
- * - number: size token or direct px
71
- * - ValueWithUnit: direct CSS value with unit
72
- * - string keywords: 'full', 'auto', 'screen', 'fit'
73
- */
74
- export type WidthValue = number | ValueWithUnit | 'full' | 'auto' | 'screen' | 'fit';
75
- export type HeightValue = number | ValueWithUnit | 'full' | 'auto' | 'screen';
76
-
77
- export interface SizeProps {
78
- w?: WidthValue;
79
- h?: HeightValue;
80
- minW?: number | ValueWithUnit;
81
- maxW?: number | ValueWithUnit;
82
- minH?: number | ValueWithUnit;
83
- maxH?: number | ValueWithUnit;
84
- }
85
-
86
- export type JustifyValue = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
87
- export type AlignValue = 'start' | 'center' | 'end' | 'stretch' | 'baseline';
88
- export type DirectionValue = 'row' | 'column' | 'row-reverse' | 'column-reverse';
89
-
90
- export interface FlexProps {
91
- flex?: boolean | number;
92
- direction?: DirectionValue;
93
- justify?: JustifyValue;
94
- align?: AlignValue;
95
- wrap?: boolean | 'nowrap';
96
- gap?: SpacingValue;
97
- }
98
-
99
- export interface GridProps {
100
- span?: number;
101
- }
102
-
103
- export interface CommonProps extends SpacingProps, SizeProps, FlexProps, GridProps {}
104
-
105
- // ===========================================
106
- // Document Node
107
- // ===========================================
108
-
109
- export interface WireframeDocument extends BaseNode {
110
- type: 'Document';
111
- children: PageNode[];
112
- }
113
-
114
- // ===========================================
115
- // Layout Nodes
116
- // ===========================================
117
-
118
- export interface PageNode extends BaseNode, CommonProps {
119
- type: 'Page';
120
- title?: string | null;
121
- /** Center content both horizontally and vertically */
122
- centered?: boolean;
123
- /** Viewport size (e.g., "1440x900", "1440", or number for width only) */
124
- viewport?: string | number;
125
- /** Device preset (e.g., "iphone14", "desktop") */
126
- device?: string;
127
- children: AnyNode[];
128
- }
129
-
130
- export interface HeaderNode extends BaseNode, CommonProps {
131
- type: 'Header';
132
- border?: boolean;
133
- children: AnyNode[];
134
- }
135
-
136
- export interface MainNode extends BaseNode, CommonProps {
137
- type: 'Main';
138
- children: AnyNode[];
139
- }
140
-
141
- export interface FooterNode extends BaseNode, CommonProps {
142
- type: 'Footer';
143
- border?: boolean;
144
- children: AnyNode[];
145
- }
146
-
147
- export interface SidebarNode extends BaseNode, CommonProps {
148
- type: 'Sidebar';
149
- position?: 'left' | 'right';
150
- children: AnyNode[];
151
- }
152
-
153
- export interface SectionNode extends BaseNode, CommonProps {
154
- type: 'Section';
155
- title?: string | null;
156
- expanded?: boolean;
157
- children: AnyNode[];
158
- }
159
-
160
- // ===========================================
161
- // Grid Nodes
162
- // ===========================================
163
-
164
- export interface RowNode extends BaseNode, CommonProps {
165
- type: 'Row';
166
- children: AnyNode[];
167
- }
168
-
169
- export interface ColNode extends BaseNode, CommonProps {
170
- type: 'Col';
171
- /** Responsive breakpoint spans (sm: 576px+, md: 768px+, lg: 992px+, xl: 1200px+) */
172
- sm?: number;
173
- md?: number;
174
- lg?: number;
175
- xl?: number;
176
- /** Column order in flex container */
177
- order?: number;
178
- children: AnyNode[];
179
- }
180
-
181
- // ===========================================
182
- // Container Nodes
183
- // ===========================================
184
-
185
- export type ShadowValue = 'none' | 'sm' | 'md' | 'lg' | 'xl';
186
-
187
- export interface CardNode extends BaseNode, CommonProps {
188
- type: 'Card';
189
- title?: string | null;
190
- shadow?: ShadowValue;
191
- border?: boolean;
192
- children: AnyNode[];
193
- }
194
-
195
- export interface ModalNode extends BaseNode, CommonProps {
196
- type: 'Modal';
197
- title?: string | null;
198
- children: AnyNode[];
199
- }
200
-
201
- export type DrawerPosition = 'left' | 'right' | 'top' | 'bottom';
202
-
203
- export interface DrawerNode extends BaseNode, CommonProps {
204
- type: 'Drawer';
205
- title?: string | null;
206
- position?: DrawerPosition;
207
- children: AnyNode[];
208
- }
209
-
210
- export interface AccordionNode extends BaseNode, CommonProps {
211
- type: 'Accordion';
212
- title?: string | null;
213
- children: AnyNode[];
214
- }
215
-
216
- // ===========================================
217
- // Text Nodes
218
- // ===========================================
219
-
220
- export type TextSizeToken = 'xs' | 'sm' | 'base' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
221
- export type TextSize = TextSizeToken | ValueWithUnit;
222
- export type TextWeight = 'normal' | 'medium' | 'semibold' | 'bold';
223
- export type TextAlign = 'left' | 'center' | 'right' | 'justify';
224
-
225
- export interface TextNode extends BaseNode, Omit<CommonProps, 'align'> {
226
- type: 'Text';
227
- content: string;
228
- size?: TextSize;
229
- weight?: TextWeight;
230
- align?: TextAlign;
231
- muted?: boolean;
232
- }
233
-
234
- export type TitleLevel = 1 | 2 | 3 | 4 | 5 | 6;
235
-
236
- export interface TitleNode extends BaseNode, Omit<CommonProps, 'align'> {
237
- type: 'Title';
238
- content: string;
239
- level?: TitleLevel;
240
- size?: TextSize;
241
- align?: TextAlign;
242
- }
243
-
244
- export interface LinkNode extends BaseNode, CommonProps {
245
- type: 'Link';
246
- content: string;
247
- href?: string;
248
- external?: boolean;
249
- }
250
-
251
- // ===========================================
252
- // Input Nodes
253
- // ===========================================
254
-
255
- export type InputType = 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'search' | 'date';
256
-
257
- export interface InputNode extends BaseNode, CommonProps {
258
- type: 'Input';
259
- label?: string | null;
260
- inputType?: InputType;
261
- placeholder?: string;
262
- value?: string;
263
- disabled?: boolean;
264
- required?: boolean;
265
- readonly?: boolean;
266
- icon?: string;
267
- }
268
-
269
- export interface TextareaNode extends BaseNode, CommonProps {
270
- type: 'Textarea';
271
- label?: string | null;
272
- placeholder?: string;
273
- value?: string;
274
- rows?: number;
275
- disabled?: boolean;
276
- required?: boolean;
277
- }
278
-
279
- export interface SelectNode extends BaseNode, CommonProps {
280
- type: 'Select';
281
- label?: string | null;
282
- options: (string | SelectOption)[];
283
- value?: string;
284
- placeholder?: string;
285
- disabled?: boolean;
286
- required?: boolean;
287
- }
288
-
289
- export interface SelectOption {
290
- label: string;
291
- value: string;
292
- }
293
-
294
- export interface CheckboxNode extends BaseNode, CommonProps {
295
- type: 'Checkbox';
296
- label?: string | null;
297
- checked?: boolean;
298
- disabled?: boolean;
299
- }
300
-
301
- export interface RadioNode extends BaseNode, CommonProps {
302
- type: 'Radio';
303
- label?: string | null;
304
- name?: string;
305
- checked?: boolean;
306
- disabled?: boolean;
307
- }
308
-
309
- export interface SwitchNode extends BaseNode, CommonProps {
310
- type: 'Switch';
311
- label?: string | null;
312
- checked?: boolean;
313
- disabled?: boolean;
314
- }
315
-
316
- export interface SliderNode extends BaseNode, CommonProps {
317
- type: 'Slider';
318
- label?: string | null;
319
- min?: number;
320
- max?: number;
321
- value?: number;
322
- step?: number;
323
- disabled?: boolean;
324
- }
325
-
326
- // ===========================================
327
- // Button Node
328
- // ===========================================
329
-
330
- export type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger';
331
- export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
332
-
333
- export interface ButtonNode extends BaseNode, CommonProps {
334
- type: 'Button';
335
- content: string;
336
- primary?: boolean;
337
- secondary?: boolean;
338
- outline?: boolean;
339
- ghost?: boolean;
340
- danger?: boolean;
341
- size?: ButtonSize;
342
- icon?: string;
343
- disabled?: boolean;
344
- loading?: boolean;
345
- }
346
-
347
- // ===========================================
348
- // Display Nodes
349
- // ===========================================
350
-
351
- export interface ImageNode extends BaseNode, CommonProps {
352
- type: 'Image';
353
- src?: string | null;
354
- alt?: string;
355
- }
356
-
357
- export interface PlaceholderNode extends BaseNode, CommonProps {
358
- type: 'Placeholder';
359
- label?: string | null;
360
- }
361
-
362
- export type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
363
-
364
- export interface AvatarNode extends BaseNode, CommonProps {
365
- type: 'Avatar';
366
- name?: string | null;
367
- src?: boolean;
368
- size?: AvatarSize | number; // Token string or custom px number
369
- }
370
-
371
- export type BadgeVariant = 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info';
372
-
373
- export type BadgeSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
374
-
375
- export interface BadgeNode extends BaseNode, CommonProps {
376
- type: 'Badge';
377
- content: string;
378
- variant?: BadgeVariant;
379
- pill?: boolean;
380
- icon?: string;
381
- size?: BadgeSize;
382
- }
383
-
384
- export type IconSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
385
-
386
- export interface IconNode extends BaseNode, CommonProps {
387
- type: 'Icon';
388
- name: string;
389
- size?: IconSize | number; // Token string or custom px number
390
- muted?: boolean;
391
- }
392
-
393
- // ===========================================
394
- // Data Nodes
395
- // ===========================================
396
-
397
- export interface TableNode extends BaseNode, CommonProps {
398
- type: 'Table';
399
- columns: string[];
400
- rows: (string | AnyNode)[][];
401
- striped?: boolean;
402
- bordered?: boolean;
403
- hover?: boolean;
404
- }
405
-
406
- export interface ListItemNode {
407
- content: string;
408
- icon?: string;
409
- children?: ListItemNode[];
410
- }
411
-
412
- export interface ListNode extends BaseNode, CommonProps {
413
- type: 'List';
414
- items: (string | ListItemNode)[];
415
- ordered?: boolean;
416
- none?: boolean;
417
- }
418
-
419
- // ===========================================
420
- // Feedback Nodes
421
- // ===========================================
422
-
423
- export type AlertVariant = 'success' | 'warning' | 'danger' | 'info';
424
-
425
- export interface AlertNode extends BaseNode, CommonProps {
426
- type: 'Alert';
427
- content: string;
428
- variant?: AlertVariant;
429
- dismissible?: boolean;
430
- icon?: string;
431
- }
432
-
433
- export type ToastPosition =
434
- | 'top-left'
435
- | 'top-center'
436
- | 'top-right'
437
- | 'bottom-left'
438
- | 'bottom-center'
439
- | 'bottom-right';
440
-
441
- export interface ToastNode extends BaseNode, CommonProps {
442
- type: 'Toast';
443
- content: string;
444
- position?: ToastPosition;
445
- variant?: AlertVariant;
446
- }
447
-
448
- export interface ProgressNode extends BaseNode, CommonProps {
449
- type: 'Progress';
450
- value?: number;
451
- max?: number;
452
- label?: string;
453
- indeterminate?: boolean;
454
- }
455
-
456
- export type SpinnerSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
457
-
458
- export interface SpinnerNode extends BaseNode, CommonProps {
459
- type: 'Spinner';
460
- label?: string | null;
461
- size?: SpinnerSize | number; // Token string or custom px number
462
- }
463
-
464
- // ===========================================
465
- // Overlay Nodes
466
- // ===========================================
467
-
468
- export type TooltipPosition = 'top' | 'right' | 'bottom' | 'left';
469
-
470
- export interface TooltipNode extends BaseNode, CommonProps {
471
- type: 'Tooltip';
472
- content: string;
473
- position?: TooltipPosition;
474
- children: AnyNode[];
475
- }
476
-
477
- export interface PopoverNode extends BaseNode, CommonProps {
478
- type: 'Popover';
479
- title?: string | null;
480
- children: AnyNode[];
481
- }
482
-
483
- export interface DropdownItemNode {
484
- label: string;
485
- icon?: string;
486
- danger?: boolean;
487
- disabled?: boolean;
488
- }
489
-
490
- export interface DividerNode {
491
- type: 'divider';
492
- }
493
-
494
- export interface DropdownNode extends BaseNode, CommonProps {
495
- type: 'Dropdown';
496
- items: (DropdownItemNode | DividerNode)[];
497
- }
498
-
499
- // ===========================================
500
- // Navigation Nodes
501
- // ===========================================
502
-
503
- export interface NavItem {
504
- label: string;
505
- icon?: string;
506
- href?: string;
507
- active?: boolean;
508
- disabled?: boolean;
509
- }
510
-
511
- export interface NavNode extends BaseNode, CommonProps {
512
- type: 'Nav';
513
- items: (string | NavItem)[];
514
- vertical?: boolean;
515
- }
516
-
517
- export interface TabNode {
518
- label: string;
519
- active?: boolean;
520
- disabled?: boolean;
521
- children: AnyNode[];
522
- }
523
-
524
- export interface TabsNode extends BaseNode, CommonProps {
525
- type: 'Tabs';
526
- items: string[];
527
- active?: number;
528
- children: TabNode[];
529
- }
530
-
531
- export interface BreadcrumbItem {
532
- label: string;
533
- href?: string;
534
- }
535
-
536
- export interface BreadcrumbNode extends BaseNode, CommonProps {
537
- type: 'Breadcrumb';
538
- items: (string | BreadcrumbItem)[];
539
- }
540
-
541
- // ===========================================
542
- // Divider Node
543
- // ===========================================
544
-
545
- export interface DividerComponentNode extends BaseNode, CommonProps {
546
- type: 'Divider';
547
- }
548
-
549
- // ===========================================
550
- // Node Type Unions
551
- // ===========================================
552
-
553
- export type LayoutNode =
554
- | PageNode
555
- | HeaderNode
556
- | MainNode
557
- | FooterNode
558
- | SidebarNode
559
- | SectionNode;
560
-
561
- export type GridNode = RowNode | ColNode;
562
-
563
- export type ContainerComponentNode =
564
- | CardNode
565
- | ModalNode
566
- | DrawerNode
567
- | AccordionNode;
568
-
569
- export type TextContentNode = TextNode | TitleNode | LinkNode;
570
-
571
- export type InputComponentNode =
572
- | InputNode
573
- | TextareaNode
574
- | SelectNode
575
- | CheckboxNode
576
- | RadioNode
577
- | SwitchNode
578
- | SliderNode;
579
-
580
- export type DisplayNode =
581
- | ImageNode
582
- | PlaceholderNode
583
- | AvatarNode
584
- | BadgeNode
585
- | IconNode;
586
-
587
- export type DataNode = TableNode | ListNode;
588
-
589
- export type FeedbackNode =
590
- | AlertNode
591
- | ToastNode
592
- | ProgressNode
593
- | SpinnerNode;
594
-
595
- export type OverlayNode = TooltipNode | PopoverNode | DropdownNode;
596
-
597
- export type NavigationNode = NavNode | TabsNode | BreadcrumbNode;
598
-
599
- export type ContainerNode =
600
- | LayoutNode
601
- | GridNode
602
- | ContainerComponentNode
603
- | PopoverNode
604
- | TooltipNode;
605
-
606
- export type LeafNode =
607
- | TextContentNode
608
- | InputComponentNode
609
- | ButtonNode
610
- | DisplayNode
611
- | DataNode
612
- | FeedbackNode
613
- | DropdownNode
614
- | NavigationNode
615
- | DividerComponentNode;
616
-
617
- export type AnyNode = ContainerNode | LeafNode;
618
-
619
- export type NodeType =
620
- | 'Document'
621
- | 'Page'
622
- | 'Header'
623
- | 'Main'
624
- | 'Footer'
625
- | 'Sidebar'
626
- | 'Section'
627
- | 'Row'
628
- | 'Col'
629
- | 'Card'
630
- | 'Modal'
631
- | 'Drawer'
632
- | 'Accordion'
633
- | 'Text'
634
- | 'Title'
635
- | 'Link'
636
- | 'Input'
637
- | 'Textarea'
638
- | 'Select'
639
- | 'Checkbox'
640
- | 'Radio'
641
- | 'Switch'
642
- | 'Slider'
643
- | 'Button'
644
- | 'Image'
645
- | 'Placeholder'
646
- | 'Avatar'
647
- | 'Badge'
648
- | 'Icon'
649
- | 'Table'
650
- | 'List'
651
- | 'Alert'
652
- | 'Toast'
653
- | 'Progress'
654
- | 'Spinner'
655
- | 'Tooltip'
656
- | 'Popover'
657
- | 'Dropdown'
658
- | 'Nav'
659
- | 'Tabs'
660
- | 'Breadcrumb'
661
- | 'Divider';