@wireweave/language-data 1.0.0

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.js ADDED
@@ -0,0 +1,628 @@
1
+ // src/components.ts
2
+ var ALL_COMPONENTS = [
3
+ // Layout
4
+ {
5
+ name: "page",
6
+ description: "Page root container. Starting point for the entire layout.",
7
+ category: "layout",
8
+ attributes: ["title", "width", "height", "viewport", "device", "centered", "p", "px", "py", "pt", "pr", "pb", "pl", "m", "gap"],
9
+ hasChildren: true,
10
+ validChildren: ["header", "main", "footer", "sidebar", "section", "nav", "row", "col", "card"],
11
+ validParents: [],
12
+ example: 'page "Dashboard" centered { ... }'
13
+ },
14
+ {
15
+ name: "header",
16
+ description: "Page header area. Place navigation, logo, etc.",
17
+ category: "layout",
18
+ attributes: ["p", "px", "py", "border", "gap", "justify", "align"],
19
+ hasChildren: true,
20
+ validParents: ["page"],
21
+ example: "header p=4 border { ... }"
22
+ },
23
+ {
24
+ name: "main",
25
+ description: "Main content area. Place primary content here.",
26
+ category: "layout",
27
+ attributes: ["p", "px", "py", "gap"],
28
+ hasChildren: true,
29
+ validParents: ["page"],
30
+ example: "main p=6 { ... }"
31
+ },
32
+ {
33
+ name: "footer",
34
+ description: "Page footer area. Place copyright, links, etc.",
35
+ category: "layout",
36
+ attributes: ["p", "px", "py", "border", "gap"],
37
+ hasChildren: true,
38
+ validParents: ["page"],
39
+ example: "footer p=4 border { ... }"
40
+ },
41
+ {
42
+ name: "sidebar",
43
+ description: "Sidebar area. Place auxiliary navigation or information.",
44
+ category: "layout",
45
+ attributes: ["position", "w", "p", "px", "py", "gap"],
46
+ hasChildren: true,
47
+ validParents: ["page"],
48
+ example: "sidebar w=240 { ... }"
49
+ },
50
+ {
51
+ name: "section",
52
+ description: "Section area. Logically group content.",
53
+ category: "layout",
54
+ attributes: ["title", "expanded", "p", "px", "py", "gap"],
55
+ hasChildren: true,
56
+ example: 'section "Settings" expanded { ... }'
57
+ },
58
+ // Grid
59
+ {
60
+ name: "row",
61
+ description: "Horizontal flex container. Arrange children horizontally.",
62
+ category: "grid",
63
+ attributes: ["gap", "justify", "align", "wrap", "direction", "flex", "p", "m", "mt", "mb"],
64
+ hasChildren: true,
65
+ example: "row flex gap=4 justify=between { ... }"
66
+ },
67
+ {
68
+ name: "col",
69
+ description: "Vertical flex container or grid column.",
70
+ category: "grid",
71
+ attributes: ["span", "sm", "md", "lg", "xl", "order", "gap", "justify", "align", "p", "m", "w"],
72
+ hasChildren: true,
73
+ example: "col span=6 md=4 { ... }"
74
+ },
75
+ // Container
76
+ {
77
+ name: "card",
78
+ description: "Card component. Group and display content.",
79
+ category: "container",
80
+ attributes: ["title", "p", "shadow", "border", "gap"],
81
+ hasChildren: true,
82
+ example: 'card "Settings" p=4 shadow=md { ... }'
83
+ },
84
+ {
85
+ name: "modal",
86
+ description: "Modal dialog. Display content on an overlay.",
87
+ category: "container",
88
+ attributes: ["title", "w", "h", "p"],
89
+ hasChildren: true,
90
+ example: 'modal "Confirm" w=400 { ... }'
91
+ },
92
+ {
93
+ name: "drawer",
94
+ description: "Drawer panel. Slides in from the edge of the screen.",
95
+ category: "container",
96
+ attributes: ["title", "position", "p"],
97
+ hasChildren: true,
98
+ example: 'drawer "Menu" position=left { ... }'
99
+ },
100
+ {
101
+ name: "accordion",
102
+ description: "Accordion. Collapsible content panel.",
103
+ category: "container",
104
+ attributes: ["title", "p"],
105
+ hasChildren: true,
106
+ example: 'accordion { section "FAQ 1" { ... } }'
107
+ },
108
+ // Text
109
+ {
110
+ name: "text",
111
+ description: "Text element. Display plain text.",
112
+ category: "text",
113
+ attributes: ["size", "weight", "align", "muted", "m", "mt", "mb"],
114
+ hasChildren: false,
115
+ example: 'text "Hello World" size=lg weight=bold'
116
+ },
117
+ {
118
+ name: "title",
119
+ description: "Title element. Display h1-h6 headings.",
120
+ category: "text",
121
+ attributes: ["level", "size", "align", "m", "mt", "mb"],
122
+ hasChildren: false,
123
+ example: 'title "Welcome" level=2'
124
+ },
125
+ {
126
+ name: "link",
127
+ description: "Link element. Display clickable hyperlink.",
128
+ category: "text",
129
+ attributes: ["href", "external"],
130
+ hasChildren: false,
131
+ example: 'link "Learn more" href="/docs" external'
132
+ },
133
+ // Input
134
+ {
135
+ name: "input",
136
+ description: "Input field. Accept text, email, password, etc.",
137
+ category: "input",
138
+ attributes: ["label", "inputType", "placeholder", "value", "disabled", "required", "readonly", "icon", "m", "mb"],
139
+ hasChildren: false,
140
+ example: 'input "Email" inputType=email placeholder="user@example.com" required'
141
+ },
142
+ {
143
+ name: "textarea",
144
+ description: "Multi-line input field. Accept long text.",
145
+ category: "input",
146
+ attributes: ["label", "placeholder", "value", "rows", "disabled", "required", "m", "mb"],
147
+ hasChildren: false,
148
+ example: 'textarea "Description" rows=4 placeholder="Enter description..."'
149
+ },
150
+ {
151
+ name: "select",
152
+ description: "Dropdown select. Choose one from multiple options.",
153
+ category: "input",
154
+ attributes: ["label", "placeholder", "value", "disabled", "required", "m", "mb"],
155
+ hasChildren: false,
156
+ example: 'select "Country" ["USA", "Canada", "UK"] placeholder="Select..."'
157
+ },
158
+ {
159
+ name: "checkbox",
160
+ description: "Checkbox. Select true/false value.",
161
+ category: "input",
162
+ attributes: ["label", "checked", "disabled", "m", "mb"],
163
+ hasChildren: false,
164
+ example: 'checkbox "I agree to terms" checked'
165
+ },
166
+ {
167
+ name: "radio",
168
+ description: "Radio button. Select one within a group.",
169
+ category: "input",
170
+ attributes: ["label", "name", "checked", "disabled", "m", "mb"],
171
+ hasChildren: false,
172
+ example: 'radio "Option A" name="choice" checked'
173
+ },
174
+ {
175
+ name: "switch",
176
+ description: "Toggle switch. Switch on/off state.",
177
+ category: "input",
178
+ attributes: ["label", "checked", "disabled", "m", "mb"],
179
+ hasChildren: false,
180
+ example: 'switch "Dark mode" checked'
181
+ },
182
+ {
183
+ name: "slider",
184
+ description: "Slider. Select a value within a range.",
185
+ category: "input",
186
+ attributes: ["label", "min", "max", "value", "step", "disabled", "m", "mb"],
187
+ hasChildren: false,
188
+ example: 'slider "Volume" min=0 max=100 value=50'
189
+ },
190
+ // Button
191
+ {
192
+ name: "button",
193
+ description: "Button element. Display clickable button.",
194
+ category: "input",
195
+ attributes: ["primary", "secondary", "outline", "ghost", "danger", "size", "icon", "disabled", "loading", "w"],
196
+ hasChildren: false,
197
+ example: 'button "Submit" primary icon=send'
198
+ },
199
+ // Display
200
+ {
201
+ name: "image",
202
+ description: "Image element. Display an image.",
203
+ category: "display",
204
+ attributes: ["src", "alt", "w", "h"],
205
+ hasChildren: false,
206
+ example: "image w=200 h=150"
207
+ },
208
+ {
209
+ name: "placeholder",
210
+ description: "Placeholder. Image or content placeholder.",
211
+ category: "display",
212
+ attributes: ["label", "w", "h"],
213
+ hasChildren: false,
214
+ example: 'placeholder "Banner Image" w=full h=200'
215
+ },
216
+ {
217
+ name: "avatar",
218
+ description: "Avatar element. Display user profile image.",
219
+ category: "display",
220
+ attributes: ["name", "src", "size"],
221
+ hasChildren: false,
222
+ example: 'avatar "John Doe" size=lg'
223
+ },
224
+ {
225
+ name: "badge",
226
+ description: "Badge element. Display status or count as a small label.",
227
+ category: "display",
228
+ attributes: ["variant", "pill", "icon", "size"],
229
+ hasChildren: false,
230
+ example: 'badge "New" variant=success pill'
231
+ },
232
+ {
233
+ name: "icon",
234
+ description: "Icon element. Display a Lucide icon.",
235
+ category: "display",
236
+ attributes: ["name", "size", "muted"],
237
+ hasChildren: false,
238
+ example: 'icon "settings" size=lg'
239
+ },
240
+ // Data
241
+ {
242
+ name: "table",
243
+ description: "Table component. Display data in tabular format.",
244
+ category: "data",
245
+ attributes: ["striped", "bordered", "hover"],
246
+ hasChildren: false,
247
+ example: 'table striped bordered { columns ["Name", "Email"] row ["John", "john@example.com"] }'
248
+ },
249
+ {
250
+ name: "list",
251
+ description: "List component. Display items as a list.",
252
+ category: "data",
253
+ attributes: ["ordered", "none", "gap"],
254
+ hasChildren: false,
255
+ example: 'list ordered ["First", "Second", "Third"]'
256
+ },
257
+ // Feedback
258
+ {
259
+ name: "alert",
260
+ description: "Alert element. Display a message to the user.",
261
+ category: "feedback",
262
+ attributes: ["variant", "dismissible", "icon"],
263
+ hasChildren: false,
264
+ example: 'alert "Changes saved!" variant=success'
265
+ },
266
+ {
267
+ name: "toast",
268
+ description: "Toast notification. Display a temporary message.",
269
+ category: "feedback",
270
+ attributes: ["position", "variant"],
271
+ hasChildren: false,
272
+ example: 'toast "Item deleted" position=bottom-right variant=danger'
273
+ },
274
+ {
275
+ name: "progress",
276
+ description: "Progress bar. Display progress status.",
277
+ category: "feedback",
278
+ attributes: ["value", "max", "label", "indeterminate"],
279
+ hasChildren: false,
280
+ example: 'progress value=75 label="Uploading..."'
281
+ },
282
+ {
283
+ name: "spinner",
284
+ description: "Loading spinner. Display loading status.",
285
+ category: "feedback",
286
+ attributes: ["label", "size"],
287
+ hasChildren: false,
288
+ example: "spinner size=lg"
289
+ },
290
+ // Overlay
291
+ {
292
+ name: "tooltip",
293
+ description: "Tooltip element. Show additional info on hover.",
294
+ category: "overlay",
295
+ attributes: ["position"],
296
+ hasChildren: true,
297
+ example: 'tooltip "More info" position=top { icon "help-circle" }'
298
+ },
299
+ {
300
+ name: "popover",
301
+ description: "Popover. Show additional content on click.",
302
+ category: "overlay",
303
+ attributes: ["title"],
304
+ hasChildren: true,
305
+ example: 'popover "Details" { ... }'
306
+ },
307
+ {
308
+ name: "dropdown",
309
+ description: "Dropdown menu. Expand menu on click.",
310
+ category: "overlay",
311
+ attributes: [],
312
+ hasChildren: false,
313
+ example: 'dropdown { item "Edit" icon=edit item "Delete" icon=trash danger }'
314
+ },
315
+ // Navigation
316
+ {
317
+ name: "nav",
318
+ description: "Navigation area. Place menu items.",
319
+ category: "navigation",
320
+ attributes: ["vertical", "gap"],
321
+ hasChildren: false,
322
+ example: 'nav [{ label="Home" icon=home active }, { label="Settings" icon=settings }] vertical'
323
+ },
324
+ {
325
+ name: "tabs",
326
+ description: "Tabs component. Switch between multiple panels.",
327
+ category: "navigation",
328
+ attributes: ["active"],
329
+ hasChildren: true,
330
+ example: 'tabs { tab "General" active { ... } tab "Advanced" { ... } }'
331
+ },
332
+ {
333
+ name: "breadcrumb",
334
+ description: "Breadcrumb. Display current location as a path.",
335
+ category: "navigation",
336
+ attributes: [],
337
+ hasChildren: false,
338
+ example: 'breadcrumb [{ label="Home" href="/" }, { label="Products" }, { label="Details" }]'
339
+ },
340
+ // Divider
341
+ {
342
+ name: "divider",
343
+ description: "Divider element. Visually separate content.",
344
+ category: "display",
345
+ attributes: ["m", "my", "mx"],
346
+ hasChildren: false,
347
+ example: "divider my=4"
348
+ }
349
+ ];
350
+
351
+ // src/attributes.ts
352
+ var ATTRIBUTES = [
353
+ // Spacing
354
+ { name: "p", description: "Padding. Set inner spacing.", values: "number", example: "p=4" },
355
+ { name: "px", description: "Horizontal padding.", values: "number", example: "px=4" },
356
+ { name: "py", description: "Vertical padding.", values: "number", example: "py=4" },
357
+ { name: "pt", description: "Top padding.", values: "number", example: "pt=4" },
358
+ { name: "pr", description: "Right padding.", values: "number", example: "pr=4" },
359
+ { name: "pb", description: "Bottom padding.", values: "number", example: "pb=4" },
360
+ { name: "pl", description: "Left padding.", values: "number", example: "pl=4" },
361
+ { name: "m", description: "Margin. Set outer spacing.", values: "number", example: "m=4" },
362
+ { name: "mx", description: 'Horizontal margin. Can be "auto" for centering.', values: "number", example: "mx=auto" },
363
+ { name: "my", description: "Vertical margin.", values: "number", example: "my=4" },
364
+ { name: "mt", description: "Top margin.", values: "number", example: "mt=4" },
365
+ { name: "mr", description: "Right margin.", values: "number", example: "mr=4" },
366
+ { name: "mb", description: "Bottom margin.", values: "number", example: "mb=4" },
367
+ { name: "ml", description: "Left margin.", values: "number", example: "ml=4" },
368
+ { name: "gap", description: "Gap between child elements.", values: "number", example: "gap=4" },
369
+ // Grid Layout
370
+ { name: "span", description: "Grid column width (1-12).", values: "number", example: "span=6" },
371
+ { name: "sm", description: "Column width at 576px and above.", values: "number", example: "sm=6" },
372
+ { name: "md", description: "Column width at 768px and above.", values: "number", example: "md=4" },
373
+ { name: "lg", description: "Column width at 992px and above.", values: "number", example: "lg=3" },
374
+ { name: "xl", description: "Column width at 1200px and above.", values: "number", example: "xl=2" },
375
+ { name: "order", description: "Order within flex container.", values: "number", example: "order=1" },
376
+ // Flex Layout
377
+ { name: "flex", description: "Enable flexbox layout.", values: "boolean", example: "flex" },
378
+ { name: "direction", description: "Flex direction.", values: ["row", "column", "row-reverse", "column-reverse"], example: "direction=column" },
379
+ { name: "justify", description: "Main axis alignment.", values: ["start", "center", "end", "between", "around", "evenly"], example: "justify=center" },
380
+ { name: "align", description: "Cross axis alignment.", values: ["start", "center", "end", "stretch", "baseline"], example: "align=center" },
381
+ { name: "wrap", description: "Allow child elements to wrap.", values: "boolean", example: "wrap" },
382
+ // Size
383
+ { name: "width", description: "Width in pixels.", values: "number", example: "width=400" },
384
+ { name: "height", description: "Height in pixels.", values: "number", example: "height=300" },
385
+ { name: "w", description: "Width (full, auto, screen, fit, or number).", values: ["full", "auto", "screen", "fit"], example: "w=full" },
386
+ { name: "h", description: "Height (full, auto, screen, or number).", values: ["full", "auto", "screen"], example: "h=full" },
387
+ { name: "minW", description: "Minimum width.", values: "number", example: "minW=200" },
388
+ { name: "maxW", description: "Maximum width.", values: "number", example: "maxW=600" },
389
+ { name: "minH", description: "Minimum height.", values: "number", example: "minH=100" },
390
+ { name: "maxH", description: "Maximum height.", values: "number", example: "maxH=400" },
391
+ { name: "size", description: "Size preset.", values: ["xs", "sm", "md", "lg", "xl"], example: "size=lg" },
392
+ { name: "viewport", description: 'Viewport size (e.g., "1440x900").', values: "string", example: 'viewport="1440x900"' },
393
+ { name: "device", description: "Device preset.", values: ["iphone14", "iphone14pro", "desktop", "tablet"], example: 'device="iphone14"' },
394
+ // Visual
395
+ { name: "border", description: "Show border.", values: "boolean", example: "border" },
396
+ { name: "shadow", description: "Box shadow.", values: ["none", "sm", "md", "lg", "xl"], example: "shadow=md" },
397
+ { name: "position", description: "Position setting.", values: ["left", "right", "top", "bottom", "top-left", "top-center", "top-right", "bottom-left", "bottom-center", "bottom-right"], example: "position=left" },
398
+ // Text
399
+ { name: "level", description: "Heading level (1-6).", values: "number", example: "level=2" },
400
+ { name: "weight", description: "Font weight.", values: ["normal", "medium", "semibold", "bold"], example: "weight=bold" },
401
+ { name: "muted", description: "Muted style.", values: "boolean", example: "muted" },
402
+ // Button variants
403
+ { name: "primary", description: "Primary emphasis style.", values: "boolean", example: "primary" },
404
+ { name: "secondary", description: "Secondary style.", values: "boolean", example: "secondary" },
405
+ { name: "outline", description: "Outline style.", values: "boolean", example: "outline" },
406
+ { name: "ghost", description: "Ghost/transparent style.", values: "boolean", example: "ghost" },
407
+ { name: "danger", description: "Danger/delete style.", values: "boolean", example: "danger" },
408
+ // Status variants
409
+ { name: "variant", description: "Variant style.", values: ["default", "primary", "secondary", "success", "warning", "danger", "info"], example: "variant=success" },
410
+ // Form
411
+ { name: "inputType", description: "Input field type.", values: ["text", "email", "password", "number", "tel", "url", "search", "date"], example: "inputType=email" },
412
+ { name: "placeholder", description: "Placeholder text.", values: "string", example: 'placeholder="Enter text"' },
413
+ { name: "value", description: "Default value.", values: "string", example: 'value="default"' },
414
+ { name: "label", description: "Label text.", values: "string", example: 'label="Name"' },
415
+ { name: "required", description: "Required field.", values: "boolean", example: "required" },
416
+ { name: "disabled", description: "Disabled state.", values: "boolean", example: "disabled" },
417
+ { name: "readonly", description: "Read-only.", values: "boolean", example: "readonly" },
418
+ { name: "checked", description: "Checked state.", values: "boolean", example: "checked" },
419
+ { name: "loading", description: "Loading state.", values: "boolean", example: "loading" },
420
+ { name: "name", description: "Form element name attribute.", values: "string", example: 'name="field"' },
421
+ { name: "rows", description: "Number of textarea rows.", values: "number", example: "rows=4" },
422
+ { name: "min", description: "Minimum value.", values: "number", example: "min=0" },
423
+ { name: "max", description: "Maximum value.", values: "number", example: "max=100" },
424
+ { name: "step", description: "Step increment.", values: "number", example: "step=1" },
425
+ // Other
426
+ { name: "title", description: "Title text.", values: "string", example: 'title="Title"' },
427
+ { name: "centered", description: "Center alignment.", values: "boolean", example: "centered" },
428
+ { name: "vertical", description: "Vertical orientation.", values: "boolean", example: "vertical" },
429
+ { name: "expanded", description: "Expanded state.", values: "boolean", example: "expanded" },
430
+ { name: "active", description: "Active state/index.", values: "number", example: "active=0" },
431
+ { name: "href", description: "Link URL.", values: "string", example: 'href="/path"' },
432
+ { name: "external", description: "External link.", values: "boolean", example: "external" },
433
+ { name: "src", description: "Image source URL.", values: "string", example: 'src="/image.png"' },
434
+ { name: "alt", description: "Alternative text.", values: "string", example: 'alt="Image"' },
435
+ { name: "icon", description: "Icon name (Lucide icons).", values: "string", example: 'icon="home"' },
436
+ { name: "pill", description: "Rounded pill badge.", values: "boolean", example: "pill" },
437
+ { name: "dismissible", description: "Can be dismissed.", values: "boolean", example: "dismissible" },
438
+ { name: "indeterminate", description: "Indeterminate state.", values: "boolean", example: "indeterminate" },
439
+ { name: "striped", description: "Striped style.", values: "boolean", example: "striped" },
440
+ { name: "bordered", description: "Bordered style.", values: "boolean", example: "bordered" },
441
+ { name: "hover", description: "Hover effect.", values: "boolean", example: "hover" },
442
+ { name: "ordered", description: "Ordered list.", values: "boolean", example: "ordered" },
443
+ { name: "none", description: "No list style.", values: "boolean", example: "none" }
444
+ ];
445
+
446
+ // src/keywords.ts
447
+ var CATEGORY_LABELS = {
448
+ layout: "Layout",
449
+ container: "Container",
450
+ grid: "Grid",
451
+ text: "Text",
452
+ input: "Input",
453
+ display: "Display",
454
+ data: "Data",
455
+ feedback: "Feedback",
456
+ overlay: "Overlay",
457
+ navigation: "Navigation"
458
+ };
459
+ var VALUE_KEYWORDS = [
460
+ // Booleans
461
+ "true",
462
+ "false",
463
+ // Button variants
464
+ "primary",
465
+ "secondary",
466
+ "outline",
467
+ "ghost",
468
+ // Status variants
469
+ "success",
470
+ "danger",
471
+ "warning",
472
+ "info",
473
+ "default",
474
+ // Sizes
475
+ "xs",
476
+ "sm",
477
+ "md",
478
+ "lg",
479
+ "xl",
480
+ "base",
481
+ "2xl",
482
+ "3xl",
483
+ // Flex alignment
484
+ "start",
485
+ "center",
486
+ "end",
487
+ "between",
488
+ "around",
489
+ "evenly",
490
+ "stretch",
491
+ "baseline",
492
+ // Positions
493
+ "left",
494
+ "right",
495
+ "top",
496
+ "bottom",
497
+ "top-left",
498
+ "top-center",
499
+ "top-right",
500
+ "bottom-left",
501
+ "bottom-center",
502
+ "bottom-right",
503
+ // Sizing
504
+ "full",
505
+ "auto",
506
+ "screen",
507
+ "fit",
508
+ // Font weights
509
+ "normal",
510
+ "medium",
511
+ "semibold",
512
+ "bold",
513
+ // Input types
514
+ "text",
515
+ "email",
516
+ "password",
517
+ "number",
518
+ "tel",
519
+ "url",
520
+ "search",
521
+ "date",
522
+ // Flex direction
523
+ "row",
524
+ "column",
525
+ "row-reverse",
526
+ "column-reverse",
527
+ // List
528
+ "none",
529
+ "nowrap"
530
+ ];
531
+ var COMMON_NUMBERS = [0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 32, 48, 64];
532
+ var SPACING_SCALE = {
533
+ 0: "0px",
534
+ 1: "4px",
535
+ 2: "8px",
536
+ 3: "12px",
537
+ 4: "16px",
538
+ 5: "20px",
539
+ 6: "24px",
540
+ 8: "32px",
541
+ 10: "40px",
542
+ 12: "48px",
543
+ 16: "64px",
544
+ 20: "80px",
545
+ 24: "96px"
546
+ };
547
+
548
+ // src/utils.ts
549
+ function getComponent(name) {
550
+ return ALL_COMPONENTS.find((c) => c.name === name.toLowerCase());
551
+ }
552
+ function getAttribute(name) {
553
+ return ATTRIBUTES.find((a) => a.name === name);
554
+ }
555
+ function getValidChildren(componentName) {
556
+ const component = getComponent(componentName);
557
+ if (!component || !component.hasChildren) return [];
558
+ if (component.validChildren === void 0) {
559
+ return ALL_COMPONENTS.filter((c) => c.name !== "page");
560
+ }
561
+ return component.validChildren.map((name) => getComponent(name)).filter((c) => c !== void 0);
562
+ }
563
+ function isValidChild(childName, parentName) {
564
+ const parent = getComponent(parentName);
565
+ if (!parent || !parent.hasChildren) return false;
566
+ if (parent.validChildren === void 0) return true;
567
+ return parent.validChildren.includes(childName.toLowerCase());
568
+ }
569
+ function getComponentAttributes(componentName) {
570
+ const component = getComponent(componentName);
571
+ if (!component) return ATTRIBUTES;
572
+ return ATTRIBUTES.filter((attr) => component.attributes.includes(attr.name));
573
+ }
574
+ function getComponentsByCategory(category) {
575
+ return ALL_COMPONENTS.filter((c) => c.category === category);
576
+ }
577
+ function getAttributeTypeLabel(attr) {
578
+ if (attr.values === "number") return "number";
579
+ if (attr.values === "string") return "string";
580
+ if (attr.values === "boolean") return "boolean";
581
+ if (Array.isArray(attr.values)) {
582
+ const preview = attr.values.slice(0, 3).join(" | ");
583
+ return attr.values.length > 3 ? `${preview}...` : preview;
584
+ }
585
+ return "";
586
+ }
587
+ function formatAttributeValues(attr) {
588
+ if (attr.values === "number") return "Type: number";
589
+ if (attr.values === "string") return "Type: string";
590
+ if (attr.values === "boolean") return "Type: boolean (can be omitted)";
591
+ if (Array.isArray(attr.values)) {
592
+ return `Values: ${attr.values.join(" | ")}`;
593
+ }
594
+ return "";
595
+ }
596
+ function isComponent(word) {
597
+ return ALL_COMPONENTS.some((c) => c.name === word.toLowerCase());
598
+ }
599
+ function isAttribute(word) {
600
+ return ATTRIBUTES.some((a) => a.name === word);
601
+ }
602
+ function getComponentNames() {
603
+ return ALL_COMPONENTS.map((c) => c.name);
604
+ }
605
+ function getAttributeNames() {
606
+ return ATTRIBUTES.map((a) => a.name);
607
+ }
608
+ export {
609
+ ALL_COMPONENTS,
610
+ ATTRIBUTES,
611
+ CATEGORY_LABELS,
612
+ COMMON_NUMBERS,
613
+ SPACING_SCALE,
614
+ VALUE_KEYWORDS,
615
+ formatAttributeValues,
616
+ getAttribute,
617
+ getAttributeNames,
618
+ getAttributeTypeLabel,
619
+ getComponent,
620
+ getComponentAttributes,
621
+ getComponentNames,
622
+ getComponentsByCategory,
623
+ getValidChildren,
624
+ isAttribute,
625
+ isComponent,
626
+ isValidChild
627
+ };
628
+ //# sourceMappingURL=index.js.map