@wireweave/language-data 1.0.0 → 1.0.1-beta.20260108022210

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.
Files changed (2) hide show
  1. package/README.md +110 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,110 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/wireweave/language-data/main/logo.svg" width="128" height="128" alt="Wireweave Language Data">
3
+ </p>
4
+
5
+ <h1 align="center">@wireweave/language-data</h1>
6
+
7
+ <p align="center">Shared language definitions for Wireweave DSL editors</p>
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @wireweave/language-data
13
+ # or
14
+ pnpm add @wireweave/language-data
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```typescript
20
+ import {
21
+ ALL_COMPONENTS,
22
+ ATTRIBUTES,
23
+ getComponent,
24
+ getAttribute,
25
+ getValidChildren,
26
+ getComponentAttributes,
27
+ } from '@wireweave/language-data';
28
+
29
+ // Get component definition
30
+ const page = getComponent('page');
31
+ console.log(page?.description); // "Page root container..."
32
+
33
+ // Get attribute definition
34
+ const gap = getAttribute('gap');
35
+ console.log(gap?.values); // "number"
36
+
37
+ // Get valid children for a component
38
+ const children = getValidChildren('page');
39
+ console.log(children.map(c => c.name)); // ["header", "main", "footer", ...]
40
+
41
+ // Get attributes for a component
42
+ const attrs = getComponentAttributes('button');
43
+ console.log(attrs.map(a => a.name)); // ["primary", "secondary", ...]
44
+ ```
45
+
46
+ ## Exports
47
+
48
+ ### Data
49
+
50
+ | Export | Description |
51
+ |--------|-------------|
52
+ | `ALL_COMPONENTS` | Array of all 36 component definitions |
53
+ | `ATTRIBUTES` | Array of all attribute definitions |
54
+ | `VALUE_KEYWORDS` | Array of valid value keywords |
55
+ | `CATEGORY_LABELS` | Category name to label mapping |
56
+ | `COMMON_NUMBERS` | Common number values for suggestions |
57
+ | `SPACING_SCALE` | Spacing scale (4px base) |
58
+
59
+ ### Types
60
+
61
+ ```typescript
62
+ interface ComponentDef {
63
+ name: string;
64
+ description: string;
65
+ category: ComponentCategory;
66
+ attributes: string[];
67
+ hasChildren: boolean;
68
+ validChildren?: string[];
69
+ validParents?: string[];
70
+ example?: string;
71
+ }
72
+
73
+ interface AttributeDef {
74
+ name: string;
75
+ description: string;
76
+ values?: string[] | 'number' | 'string' | 'boolean';
77
+ example?: string;
78
+ }
79
+
80
+ type ComponentCategory =
81
+ | 'layout' | 'container' | 'grid' | 'text'
82
+ | 'input' | 'display' | 'data' | 'feedback'
83
+ | 'overlay' | 'navigation';
84
+ ```
85
+
86
+ ### Utilities
87
+
88
+ | Function | Description |
89
+ |----------|-------------|
90
+ | `getComponent(name)` | Get component by name |
91
+ | `getAttribute(name)` | Get attribute by name |
92
+ | `getValidChildren(componentName)` | Get valid child components |
93
+ | `isValidChild(child, parent)` | Check if child is valid |
94
+ | `getComponentAttributes(componentName)` | Get attributes for component |
95
+ | `getComponentsByCategory(category)` | Get components by category |
96
+ | `getAttributeTypeLabel(attr)` | Get type label for display |
97
+ | `formatAttributeValues(attr)` | Format values for display |
98
+ | `isComponent(word)` | Check if word is a component |
99
+ | `isAttribute(word)` | Check if word is an attribute |
100
+ | `getComponentNames()` | Get all component names |
101
+ | `getAttributeNames()` | Get all attribute names |
102
+
103
+ ## Used By
104
+
105
+ - [@wireweave/playground](https://www.npmjs.com/package/@wireweave/playground) - Monaco Editor integration
106
+ - [wireweave-vscode](https://marketplace.visualstudio.com/items?itemName=wireweave.wireweave-vscode) - VS Code Extension
107
+
108
+ ## License
109
+
110
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wireweave/language-data",
3
- "version": "1.0.0",
3
+ "version": "1.0.1-beta.20260108022210",
4
4
  "description": "Shared language definitions for Wireweave DSL editors",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",