@wireweave/language-data 1.5.3-beta.0 → 1.6.0-beta.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/README.md +54 -143
- package/dist/codemirror/index.cjs +305 -778
- package/dist/codemirror/index.cjs.map +1 -1
- package/dist/codemirror/index.d.cts +13 -23
- package/dist/codemirror/index.d.ts +13 -23
- package/dist/codemirror/index.js +312 -778
- package/dist/codemirror/index.js.map +1 -1
- package/dist/index.cjs +301 -712
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -14
- package/dist/index.d.ts +56 -14
- package/dist/index.js +306 -711
- package/dist/index.js.map +1 -1
- package/dist/monaco/index.cjs +338 -729
- package/dist/monaco/index.cjs.map +1 -1
- package/dist/monaco/index.d.cts +13 -19
- package/dist/monaco/index.d.ts +13 -19
- package/dist/monaco/index.js +345 -729
- package/dist/monaco/index.js.map +1 -1
- package/package.json +90 -19
package/dist/index.js
CHANGED
|
@@ -1,651 +1,117 @@
|
|
|
1
|
-
// src/attributes.ts
|
|
2
|
-
var COMMON_ATTRIBUTES = [
|
|
3
|
-
// Spacing
|
|
4
|
-
"p",
|
|
5
|
-
"px",
|
|
6
|
-
"py",
|
|
7
|
-
"pt",
|
|
8
|
-
"pr",
|
|
9
|
-
"pb",
|
|
10
|
-
"pl",
|
|
11
|
-
"m",
|
|
12
|
-
"mx",
|
|
13
|
-
"my",
|
|
14
|
-
"mt",
|
|
15
|
-
"mr",
|
|
16
|
-
"mb",
|
|
17
|
-
"ml",
|
|
18
|
-
"gap",
|
|
19
|
-
// Size
|
|
20
|
-
"w",
|
|
21
|
-
"h",
|
|
22
|
-
"minW",
|
|
23
|
-
"maxW",
|
|
24
|
-
"minH",
|
|
25
|
-
"maxH",
|
|
26
|
-
// Flex
|
|
27
|
-
"flex",
|
|
28
|
-
"direction",
|
|
29
|
-
"justify",
|
|
30
|
-
"align",
|
|
31
|
-
"wrap",
|
|
32
|
-
// Grid
|
|
33
|
-
"span",
|
|
34
|
-
// Position
|
|
35
|
-
"x",
|
|
36
|
-
"y"
|
|
37
|
-
];
|
|
38
|
-
var ATTRIBUTES = [
|
|
39
|
-
// ============================================
|
|
40
|
-
// Spacing Attributes
|
|
41
|
-
// ============================================
|
|
42
|
-
{ name: "p", type: "number", description: "Padding (all sides)", example: "p=4" },
|
|
43
|
-
{ name: "px", type: "number", description: "Horizontal padding", example: "px=4" },
|
|
44
|
-
{ name: "py", type: "number", description: "Vertical padding", example: "py=4" },
|
|
45
|
-
{ name: "pt", type: "number", description: "Top padding", example: "pt=4" },
|
|
46
|
-
{ name: "pr", type: "number", description: "Right padding", example: "pr=4" },
|
|
47
|
-
{ name: "pb", type: "number", description: "Bottom padding", example: "pb=4" },
|
|
48
|
-
{ name: "pl", type: "number", description: "Left padding", example: "pl=4" },
|
|
49
|
-
{ name: "m", type: "number", description: "Margin (all sides)", example: "m=4" },
|
|
50
|
-
{ name: "mx", type: "string", description: 'Horizontal margin (number or "auto")', example: "mx=auto" },
|
|
51
|
-
{ name: "my", type: "number", description: "Vertical margin", example: "my=4" },
|
|
52
|
-
{ name: "mt", type: "number", description: "Top margin", example: "mt=4" },
|
|
53
|
-
{ name: "mr", type: "number", description: "Right margin", example: "mr=4" },
|
|
54
|
-
{ name: "mb", type: "number", description: "Bottom margin", example: "mb=4" },
|
|
55
|
-
{ name: "ml", type: "number", description: "Left margin", example: "ml=4" },
|
|
56
|
-
{ name: "gap", type: "number", description: "Gap between children", example: "gap=4" },
|
|
57
|
-
// ============================================
|
|
58
|
-
// Size Attributes
|
|
59
|
-
// ============================================
|
|
60
|
-
{ name: "w", type: "string", description: 'Width (number, "full", "auto", "screen", "fit")', example: "w=full" },
|
|
61
|
-
{ name: "h", type: "string", description: 'Height (number, "full", "auto", "screen")', example: "h=full" },
|
|
62
|
-
{ name: "width", type: "number", description: "Width in pixels (page only)", example: "width=400" },
|
|
63
|
-
{ name: "height", type: "number", description: "Height in pixels (page only)", example: "height=300" },
|
|
64
|
-
{ name: "minW", type: "number", description: "Minimum width", example: "minW=200" },
|
|
65
|
-
{ name: "maxW", type: "number", description: "Maximum width", example: "maxW=600" },
|
|
66
|
-
{ name: "minH", type: "number", description: "Minimum height", example: "minH=100" },
|
|
67
|
-
{ name: "maxH", type: "number", description: "Maximum height", example: "maxH=400" },
|
|
68
|
-
// ============================================
|
|
69
|
-
// Flex/Grid Layout Attributes
|
|
70
|
-
// ============================================
|
|
71
|
-
{ name: "flex", type: "boolean", description: "Enable flexbox", example: "flex" },
|
|
72
|
-
{ name: "direction", type: "enum", values: ["row", "column", "row-reverse", "column-reverse"], description: "Flex direction", example: "direction=column" },
|
|
73
|
-
{ name: "justify", type: "enum", values: ["start", "center", "end", "between", "around", "evenly"], description: "Main axis alignment", example: "justify=center" },
|
|
74
|
-
{ name: "align", type: "enum", values: ["start", "center", "end", "stretch", "baseline"], description: "Cross axis alignment", example: "align=center" },
|
|
75
|
-
{ name: "wrap", type: "boolean", description: "Enable flex wrap", example: "wrap" },
|
|
76
|
-
{ name: "span", type: "number", description: "Grid column span (1-12)", example: "span=6" },
|
|
77
|
-
{ name: "sm", type: "number", description: "Responsive span at 576px+", example: "sm=6" },
|
|
78
|
-
{ name: "md", type: "number", description: "Responsive span at 768px+", example: "md=4" },
|
|
79
|
-
{ name: "lg", type: "number", description: "Responsive span at 992px+", example: "lg=3" },
|
|
80
|
-
{ name: "xl", type: "number", description: "Responsive span at 1200px+", example: "xl=2" },
|
|
81
|
-
{ name: "order", type: "number", description: "Flex order", example: "order=1" },
|
|
82
|
-
// ============================================
|
|
83
|
-
// Position Attributes
|
|
84
|
-
// ============================================
|
|
85
|
-
{ name: "x", type: "number", description: "Horizontal position", example: "x=100" },
|
|
86
|
-
{ name: "y", type: "number", description: "Vertical position", example: "y=50" },
|
|
87
|
-
{ name: "position", type: "enum", values: ["left", "right", "top", "bottom", "top-left", "top-center", "top-right", "bottom-left", "bottom-center", "bottom-right"], description: "Position preset", example: "position=left" },
|
|
88
|
-
// ============================================
|
|
89
|
-
// Visual Attributes
|
|
90
|
-
// ============================================
|
|
91
|
-
{ name: "border", type: "boolean", description: "Show border", example: "border" },
|
|
92
|
-
{ name: "rounded", type: "boolean", description: "Apply border radius", example: "rounded" },
|
|
93
|
-
{ name: "shadow", type: "enum", values: ["none", "sm", "md", "lg", "xl"], description: "Box shadow", example: "shadow=md" },
|
|
94
|
-
{ name: "bg", type: "enum", values: ["muted", "primary", "secondary"], description: "Background variant", example: "bg=muted" },
|
|
95
|
-
// ============================================
|
|
96
|
-
// Text Attributes
|
|
97
|
-
// ============================================
|
|
98
|
-
{ name: "size", type: "enum", values: ["xs", "sm", "base", "md", "lg", "xl", "2xl", "3xl"], description: "Size preset", example: "size=lg" },
|
|
99
|
-
{ name: "weight", type: "enum", values: ["normal", "medium", "semibold", "bold"], description: "Font weight", example: "weight=bold" },
|
|
100
|
-
{ name: "level", type: "number", description: "Heading level (1-6)", example: "level=2" },
|
|
101
|
-
{ name: "muted", type: "boolean", description: "Muted/dimmed style", example: "muted" },
|
|
102
|
-
{ name: "bold", type: "boolean", description: "Bold text", example: "bold" },
|
|
103
|
-
// ============================================
|
|
104
|
-
// Button Variant Attributes
|
|
105
|
-
// ============================================
|
|
106
|
-
{ name: "primary", type: "boolean", description: "Primary style", example: "primary" },
|
|
107
|
-
{ name: "secondary", type: "boolean", description: "Secondary style", example: "secondary" },
|
|
108
|
-
{ name: "outline", type: "boolean", description: "Outline style", example: "outline" },
|
|
109
|
-
{ name: "ghost", type: "boolean", description: "Ghost/transparent style", example: "ghost" },
|
|
110
|
-
{ name: "danger", type: "boolean", description: "Danger/destructive style", example: "danger" },
|
|
111
|
-
// ============================================
|
|
112
|
-
// Status Variant Attributes
|
|
113
|
-
// ============================================
|
|
114
|
-
{ name: "variant", type: "enum", values: ["default", "primary", "secondary", "success", "warning", "danger", "info"], description: "Status variant", example: "variant=success" },
|
|
115
|
-
// ============================================
|
|
116
|
-
// Form Attributes
|
|
117
|
-
// ============================================
|
|
118
|
-
{ name: "inputType", type: "enum", values: ["text", "email", "password", "number", "tel", "url", "search", "date"], description: "Input field type", example: "inputType=email" },
|
|
119
|
-
{ name: "placeholder", type: "string", description: "Placeholder text", example: 'placeholder="Enter text"' },
|
|
120
|
-
{ name: "value", type: "string", description: "Default value", example: 'value="default"' },
|
|
121
|
-
{ name: "label", type: "string", description: "Field label", example: 'label="Name"' },
|
|
122
|
-
{ name: "name", type: "string", description: "Form field name", example: 'name="field"' },
|
|
123
|
-
{ name: "required", type: "boolean", description: "Required field", example: "required" },
|
|
124
|
-
{ name: "disabled", type: "boolean", description: "Disabled state", example: "disabled" },
|
|
125
|
-
{ name: "readonly", type: "boolean", description: "Read-only state", example: "readonly" },
|
|
126
|
-
{ name: "checked", type: "boolean", description: "Checked state", example: "checked" },
|
|
127
|
-
{ name: "loading", type: "boolean", description: "Loading state", example: "loading" },
|
|
128
|
-
{ name: "rows", type: "number", description: "Textarea rows", example: "rows=4" },
|
|
129
|
-
{ name: "min", type: "number", description: "Minimum value", example: "min=0" },
|
|
130
|
-
{ name: "max", type: "number", description: "Maximum value", example: "max=100" },
|
|
131
|
-
{ name: "step", type: "number", description: "Step increment", example: "step=1" },
|
|
132
|
-
// ============================================
|
|
133
|
-
// Content Attributes
|
|
134
|
-
// ============================================
|
|
135
|
-
{ name: "title", type: "string", description: "Title text", example: 'title="Title"' },
|
|
136
|
-
{ name: "src", type: "string", description: "Source URL", example: 'src="/image.png"' },
|
|
137
|
-
{ name: "alt", type: "string", description: "Alt text", example: 'alt="Image"' },
|
|
138
|
-
{ name: "href", type: "string", description: "Link URL", example: 'href="/path"' },
|
|
139
|
-
{ name: "icon", type: "string", description: "Icon name", example: 'icon="home"' },
|
|
140
|
-
{ name: "external", type: "boolean", description: "External link", example: "external" },
|
|
141
|
-
// ============================================
|
|
142
|
-
// State Attributes
|
|
143
|
-
// ============================================
|
|
144
|
-
{ name: "active", type: "number", description: "Active index", example: "active=0" },
|
|
145
|
-
{ name: "expanded", type: "boolean", description: "Expanded state", example: "expanded" },
|
|
146
|
-
{ name: "centered", type: "boolean", description: "Center content", example: "centered" },
|
|
147
|
-
{ name: "vertical", type: "boolean", description: "Vertical orientation", example: "vertical" },
|
|
148
|
-
{ name: "scroll", type: "boolean", description: "Enable scrolling", example: "scroll" },
|
|
149
|
-
// ============================================
|
|
150
|
-
// Feedback Attributes
|
|
151
|
-
// ============================================
|
|
152
|
-
{ name: "dismissible", type: "boolean", description: "Can be dismissed", example: "dismissible" },
|
|
153
|
-
{ name: "indeterminate", type: "boolean", description: "Indeterminate state", example: "indeterminate" },
|
|
154
|
-
{ name: "pill", type: "boolean", description: "Pill/rounded style", example: "pill" },
|
|
155
|
-
// ============================================
|
|
156
|
-
// Data Attributes
|
|
157
|
-
// ============================================
|
|
158
|
-
{ name: "striped", type: "boolean", description: "Striped rows", example: "striped" },
|
|
159
|
-
{ name: "bordered", type: "boolean", description: "Full borders", example: "bordered" },
|
|
160
|
-
{ name: "hover", type: "boolean", description: "Hover effect", example: "hover" },
|
|
161
|
-
{ name: "ordered", type: "boolean", description: "Ordered list", example: "ordered" },
|
|
162
|
-
{ name: "none", type: "boolean", description: "No list markers", example: "none" },
|
|
163
|
-
// ============================================
|
|
164
|
-
// Page/Viewport Attributes
|
|
165
|
-
// ============================================
|
|
166
|
-
{ name: "viewport", type: "string", description: 'Viewport size (e.g., "1440x900")', example: 'viewport="1440x900"' },
|
|
167
|
-
{ name: "device", type: "string", description: "Device preset", example: 'device="iphone14"' },
|
|
168
|
-
// ============================================
|
|
169
|
-
// Interactive Attributes
|
|
170
|
-
// ============================================
|
|
171
|
-
{ name: "navigate", type: "string", description: "Navigation target URL or page", example: 'navigate="/dashboard"' },
|
|
172
|
-
{ name: "opens", type: "string", description: "Opens a modal, drawer, or popup", example: 'opens="settings-modal"' },
|
|
173
|
-
{ name: "toggles", type: "string", description: "Toggles visibility of an element", example: 'toggles="menu"' },
|
|
174
|
-
{ name: "action", type: "string", description: "Action identifier for event handling", example: 'action="submit-form"' },
|
|
175
|
-
// ============================================
|
|
176
|
-
// Annotation Attributes
|
|
177
|
-
// ============================================
|
|
178
|
-
{ name: "anchor", type: "enum", values: ["top-left", "top-center", "top-right", "center-left", "center", "center-right", "bottom-left", "bottom-center", "bottom-right"], description: "Anchor position for marker in relative container", example: "anchor=top-right" },
|
|
179
|
-
{ name: "color", type: "enum", values: ["blue", "red", "green", "yellow", "purple", "orange"], description: "Marker color", example: "color=blue" }
|
|
180
|
-
];
|
|
181
|
-
var ATTRIBUTE_MAP = new Map(
|
|
182
|
-
ATTRIBUTES.map((attr) => [attr.name, attr])
|
|
183
|
-
);
|
|
184
|
-
var VALID_ATTRIBUTE_NAMES = new Set(
|
|
185
|
-
ATTRIBUTES.map((attr) => attr.name)
|
|
186
|
-
);
|
|
187
|
-
|
|
188
1
|
// src/components.ts
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
attributes: [...COMMON_ATTRIBUTES, "title", "width", "height", "viewport", "device", "centered"],
|
|
198
|
-
hasChildren: true,
|
|
199
|
-
description: "Root container for a wireframe page",
|
|
200
|
-
example: 'page "Dashboard" centered { ... }',
|
|
2
|
+
import {
|
|
3
|
+
COMPONENT_SPEC_BY_NAME,
|
|
4
|
+
COMPONENT_NAMES
|
|
5
|
+
} from "@wireweave/core/spec";
|
|
6
|
+
var EDITOR_METADATA = {
|
|
7
|
+
// Layout
|
|
8
|
+
page: {
|
|
9
|
+
example: 'page "Login" at(0, 0) viewport="1280x800" { ... }',
|
|
201
10
|
validChildren: ["header", "main", "footer", "sidebar", "section", "nav", "row", "col", "card"],
|
|
11
|
+
validParents: [],
|
|
12
|
+
extraAttributes: ["at"]
|
|
13
|
+
},
|
|
14
|
+
header: { example: "header h=56 border { ... }", validParents: ["page"] },
|
|
15
|
+
main: { example: "main p=6 scroll { ... }", validParents: ["page"] },
|
|
16
|
+
footer: { example: "footer h=48 border { ... }", validParents: ["page"] },
|
|
17
|
+
sidebar: { example: "sidebar w=240 border { ... }", validParents: ["page"] },
|
|
18
|
+
section: { example: 'section "Settings" expanded { ... }' },
|
|
19
|
+
// Structure (reuse definitions — top level only)
|
|
20
|
+
layout: {
|
|
21
|
+
example: "layout app { header { ... } slot footer { ... } }",
|
|
202
22
|
validParents: []
|
|
203
23
|
},
|
|
204
|
-
{
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
category: "layout",
|
|
208
|
-
attributes: [...COMMON_ATTRIBUTES, "border"],
|
|
209
|
-
hasChildren: true,
|
|
210
|
-
description: "Page header section",
|
|
211
|
-
example: "header h=56 border { ... }",
|
|
212
|
-
validParents: ["page"]
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
name: "main",
|
|
216
|
-
nodeType: "Main",
|
|
217
|
-
category: "layout",
|
|
218
|
-
attributes: [...COMMON_ATTRIBUTES, "scroll"],
|
|
219
|
-
hasChildren: true,
|
|
220
|
-
description: "Main content section",
|
|
221
|
-
example: "main p=6 scroll { ... }",
|
|
222
|
-
validParents: ["page"]
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
name: "footer",
|
|
226
|
-
nodeType: "Footer",
|
|
227
|
-
category: "layout",
|
|
228
|
-
attributes: [...COMMON_ATTRIBUTES, "border"],
|
|
229
|
-
hasChildren: true,
|
|
230
|
-
description: "Page footer section",
|
|
231
|
-
example: "footer h=48 border { ... }",
|
|
232
|
-
validParents: ["page"]
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
name: "sidebar",
|
|
236
|
-
nodeType: "Sidebar",
|
|
237
|
-
category: "layout",
|
|
238
|
-
attributes: [...COMMON_ATTRIBUTES, "position", "border", "bg"],
|
|
239
|
-
hasChildren: true,
|
|
240
|
-
description: "Side navigation or content area",
|
|
241
|
-
example: "sidebar w=240 border { ... }",
|
|
242
|
-
validParents: ["page"]
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
name: "section",
|
|
246
|
-
nodeType: "Section",
|
|
247
|
-
category: "layout",
|
|
248
|
-
attributes: [...COMMON_ATTRIBUTES, "title", "expanded"],
|
|
249
|
-
hasChildren: true,
|
|
250
|
-
description: "Grouped content section",
|
|
251
|
-
example: 'section "Settings" expanded { ... }'
|
|
252
|
-
},
|
|
253
|
-
// ============================================
|
|
254
|
-
// Grid Components
|
|
255
|
-
// ============================================
|
|
256
|
-
{
|
|
257
|
-
name: "row",
|
|
258
|
-
nodeType: "Row",
|
|
259
|
-
category: "grid",
|
|
260
|
-
attributes: [...COMMON_ATTRIBUTES, "border", "bg"],
|
|
261
|
-
hasChildren: true,
|
|
262
|
-
description: "Horizontal flex container",
|
|
263
|
-
example: "row flex gap=4 justify=between { ... }"
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
name: "col",
|
|
267
|
-
nodeType: "Col",
|
|
268
|
-
category: "grid",
|
|
269
|
-
attributes: [...COMMON_ATTRIBUTES, "sm", "md", "lg", "xl", "order", "border", "bg", "scroll"],
|
|
270
|
-
hasChildren: true,
|
|
271
|
-
description: "Vertical flex container or grid column",
|
|
272
|
-
example: "col span=6 md=4 { ... }"
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
name: "stack",
|
|
276
|
-
nodeType: "Stack",
|
|
277
|
-
category: "grid",
|
|
278
|
-
attributes: [...COMMON_ATTRIBUTES, "border", "bg"],
|
|
279
|
-
hasChildren: true,
|
|
280
|
-
description: "Vertical stack that only takes content height (unlike col which fills)",
|
|
281
|
-
example: "stack gap=4 align=center { ... }"
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
name: "relative",
|
|
285
|
-
nodeType: "Relative",
|
|
286
|
-
category: "grid",
|
|
287
|
-
attributes: [...COMMON_ATTRIBUTES],
|
|
288
|
-
hasChildren: true,
|
|
289
|
-
description: "Container for overlaying elements with absolute positioning",
|
|
290
|
-
example: 'relative { button "Submit" marker 1 anchor=top-right }'
|
|
291
|
-
},
|
|
292
|
-
// ============================================
|
|
293
|
-
// Container Components
|
|
294
|
-
// ============================================
|
|
295
|
-
{
|
|
296
|
-
name: "card",
|
|
297
|
-
nodeType: "Card",
|
|
298
|
-
category: "container",
|
|
299
|
-
attributes: [...COMMON_ATTRIBUTES, "title", "shadow", "border", "rounded"],
|
|
300
|
-
hasChildren: true,
|
|
301
|
-
description: "Card container with optional title",
|
|
302
|
-
example: 'card "Settings" p=4 shadow=md { ... }'
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
name: "modal",
|
|
306
|
-
nodeType: "Modal",
|
|
307
|
-
category: "container",
|
|
308
|
-
attributes: [...COMMON_ATTRIBUTES, "title"],
|
|
309
|
-
hasChildren: true,
|
|
310
|
-
description: "Modal dialog overlay",
|
|
311
|
-
example: 'modal "Confirm" w=400 { ... }'
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
name: "drawer",
|
|
315
|
-
nodeType: "Drawer",
|
|
316
|
-
category: "container",
|
|
317
|
-
attributes: [...COMMON_ATTRIBUTES, "title", "position"],
|
|
318
|
-
hasChildren: true,
|
|
319
|
-
description: "Slide-in drawer panel",
|
|
320
|
-
example: 'drawer "Menu" position=left { ... }'
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
name: "accordion",
|
|
324
|
-
nodeType: "Accordion",
|
|
325
|
-
category: "container",
|
|
326
|
-
attributes: [...COMMON_ATTRIBUTES, "title"],
|
|
327
|
-
hasChildren: true,
|
|
328
|
-
description: "Collapsible sections container",
|
|
329
|
-
example: 'accordion { section "FAQ 1" { ... } }'
|
|
330
|
-
},
|
|
331
|
-
// ============================================
|
|
332
|
-
// Text Components
|
|
333
|
-
// ============================================
|
|
334
|
-
{
|
|
335
|
-
name: "text",
|
|
336
|
-
nodeType: "Text",
|
|
337
|
-
category: "text",
|
|
338
|
-
attributes: [...COMMON_ATTRIBUTES, "size", "weight", "muted", "bold"],
|
|
339
|
-
hasChildren: false,
|
|
340
|
-
description: "Text content",
|
|
341
|
-
example: 'text "Hello World" size=lg weight=bold'
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
name: "title",
|
|
345
|
-
nodeType: "Title",
|
|
346
|
-
category: "text",
|
|
347
|
-
attributes: [...COMMON_ATTRIBUTES, "level", "size"],
|
|
348
|
-
hasChildren: false,
|
|
349
|
-
description: "Heading element (h1-h6)",
|
|
350
|
-
example: 'title "Welcome" level=2'
|
|
351
|
-
},
|
|
352
|
-
{
|
|
353
|
-
name: "link",
|
|
354
|
-
nodeType: "Link",
|
|
355
|
-
category: "text",
|
|
356
|
-
attributes: [...COMMON_ATTRIBUTES, "href", "external"],
|
|
357
|
-
hasChildren: false,
|
|
358
|
-
description: "Hyperlink text",
|
|
359
|
-
example: 'link "Learn more" href="/docs" external'
|
|
360
|
-
},
|
|
361
|
-
// ============================================
|
|
362
|
-
// Input Components
|
|
363
|
-
// ============================================
|
|
364
|
-
{
|
|
365
|
-
name: "input",
|
|
366
|
-
nodeType: "Input",
|
|
367
|
-
category: "input",
|
|
368
|
-
attributes: [...COMMON_ATTRIBUTES, "label", "inputType", "placeholder", "value", "disabled", "required", "readonly", "icon", "size", "rounded"],
|
|
369
|
-
hasChildren: false,
|
|
370
|
-
description: "Text input field",
|
|
371
|
-
example: 'input "Email" inputType=email placeholder="user@example.com" required'
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
name: "textarea",
|
|
375
|
-
nodeType: "Textarea",
|
|
376
|
-
category: "input",
|
|
377
|
-
attributes: [...COMMON_ATTRIBUTES, "label", "placeholder", "value", "rows", "disabled", "required"],
|
|
378
|
-
hasChildren: false,
|
|
379
|
-
description: "Multi-line text input",
|
|
380
|
-
example: 'textarea "Description" rows=4 placeholder="Enter description..."'
|
|
381
|
-
},
|
|
382
|
-
{
|
|
383
|
-
name: "select",
|
|
384
|
-
nodeType: "Select",
|
|
385
|
-
category: "input",
|
|
386
|
-
attributes: [...COMMON_ATTRIBUTES, "label", "placeholder", "value", "disabled", "required"],
|
|
387
|
-
hasChildren: false,
|
|
388
|
-
description: "Dropdown select",
|
|
389
|
-
example: 'select "Country" ["USA", "Canada", "UK"] placeholder="Select..."'
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
name: "checkbox",
|
|
393
|
-
nodeType: "Checkbox",
|
|
394
|
-
category: "input",
|
|
395
|
-
attributes: [...COMMON_ATTRIBUTES, "label", "checked", "disabled"],
|
|
396
|
-
hasChildren: false,
|
|
397
|
-
description: "Checkbox input",
|
|
398
|
-
example: 'checkbox "I agree to terms" checked'
|
|
399
|
-
},
|
|
400
|
-
{
|
|
401
|
-
name: "radio",
|
|
402
|
-
nodeType: "Radio",
|
|
403
|
-
category: "input",
|
|
404
|
-
attributes: [...COMMON_ATTRIBUTES, "label", "name", "checked", "disabled"],
|
|
405
|
-
hasChildren: false,
|
|
406
|
-
description: "Radio button input",
|
|
407
|
-
example: 'radio "Option A" name="choice" checked'
|
|
408
|
-
},
|
|
409
|
-
{
|
|
410
|
-
name: "switch",
|
|
411
|
-
nodeType: "Switch",
|
|
412
|
-
category: "input",
|
|
413
|
-
attributes: [...COMMON_ATTRIBUTES, "label", "checked", "disabled"],
|
|
414
|
-
hasChildren: false,
|
|
415
|
-
description: "Toggle switch",
|
|
416
|
-
example: 'switch "Dark mode" checked'
|
|
417
|
-
},
|
|
418
|
-
{
|
|
419
|
-
name: "slider",
|
|
420
|
-
nodeType: "Slider",
|
|
421
|
-
category: "input",
|
|
422
|
-
attributes: [...COMMON_ATTRIBUTES, "label", "min", "max", "value", "step", "disabled"],
|
|
423
|
-
hasChildren: false,
|
|
424
|
-
description: "Range slider",
|
|
425
|
-
example: 'slider "Volume" min=0 max=100 value=50'
|
|
426
|
-
},
|
|
427
|
-
{
|
|
428
|
-
name: "button",
|
|
429
|
-
nodeType: "Button",
|
|
430
|
-
category: "input",
|
|
431
|
-
attributes: [...COMMON_ATTRIBUTES, "primary", "secondary", "outline", "ghost", "danger", "size", "icon", "disabled", "loading"],
|
|
432
|
-
hasChildren: false,
|
|
433
|
-
description: "Clickable button",
|
|
434
|
-
example: 'button "Submit" primary icon=send'
|
|
435
|
-
},
|
|
436
|
-
// ============================================
|
|
437
|
-
// Display Components
|
|
438
|
-
// ============================================
|
|
439
|
-
{
|
|
440
|
-
name: "image",
|
|
441
|
-
nodeType: "Image",
|
|
442
|
-
category: "display",
|
|
443
|
-
attributes: [...COMMON_ATTRIBUTES, "src", "alt"],
|
|
444
|
-
hasChildren: false,
|
|
445
|
-
description: "Image placeholder",
|
|
446
|
-
example: "image w=200 h=150"
|
|
447
|
-
},
|
|
448
|
-
{
|
|
449
|
-
name: "placeholder",
|
|
450
|
-
nodeType: "Placeholder",
|
|
451
|
-
category: "display",
|
|
452
|
-
attributes: [...COMMON_ATTRIBUTES, "label"],
|
|
453
|
-
hasChildren: true,
|
|
454
|
-
description: "Generic placeholder",
|
|
455
|
-
example: 'placeholder "Banner Image" w=full h=200 { ... }'
|
|
456
|
-
},
|
|
457
|
-
{
|
|
458
|
-
name: "avatar",
|
|
459
|
-
nodeType: "Avatar",
|
|
460
|
-
category: "display",
|
|
461
|
-
attributes: [...COMMON_ATTRIBUTES, "name", "src", "size"],
|
|
462
|
-
hasChildren: false,
|
|
463
|
-
description: "User avatar",
|
|
464
|
-
example: 'avatar "John Doe" size=lg'
|
|
24
|
+
component: {
|
|
25
|
+
example: 'component userbadge { avatar "SW" text "Seungwoo" }',
|
|
26
|
+
validParents: []
|
|
465
27
|
},
|
|
466
|
-
{
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
category: "display",
|
|
470
|
-
attributes: [...COMMON_ATTRIBUTES, "variant", "pill", "icon", "size"],
|
|
471
|
-
hasChildren: false,
|
|
472
|
-
description: "Status badge",
|
|
473
|
-
example: 'badge "New" variant=success pill'
|
|
28
|
+
slot: {
|
|
29
|
+
example: "slot",
|
|
30
|
+
validParents: ["layout"]
|
|
474
31
|
},
|
|
475
|
-
{
|
|
476
|
-
|
|
477
|
-
nodeType: "Icon",
|
|
478
|
-
category: "display",
|
|
479
|
-
attributes: [...COMMON_ATTRIBUTES, "size", "muted"],
|
|
480
|
-
hasChildren: false,
|
|
481
|
-
description: "Lucide icon",
|
|
482
|
-
example: 'icon "settings" size=lg'
|
|
32
|
+
use: {
|
|
33
|
+
example: 'use userbadge(name="Ada") { ... }'
|
|
483
34
|
},
|
|
484
|
-
//
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
{
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
35
|
+
// Grid
|
|
36
|
+
row: { example: "row flex gap=4 justify=between { ... }" },
|
|
37
|
+
col: { example: "col span=6 md=4 { ... }" },
|
|
38
|
+
stack: { example: "stack gap=4 align=center { ... }" },
|
|
39
|
+
relative: { example: 'relative { button "Submit" marker 1 anchor=top-right }' },
|
|
40
|
+
// Container
|
|
41
|
+
card: { example: 'card "Settings" p=4 shadow=md { ... }' },
|
|
42
|
+
modal: { example: 'modal "Confirm" w=400 { ... }' },
|
|
43
|
+
drawer: { example: 'drawer "Menu" position=left { ... }' },
|
|
44
|
+
accordion: { example: 'accordion { section "FAQ 1" { ... } }' },
|
|
45
|
+
// Text
|
|
46
|
+
text: { example: 'text "Hello World" size=lg weight=bold' },
|
|
47
|
+
title: { example: 'title "Welcome" level=2' },
|
|
48
|
+
link: { example: 'link "Learn more" href="/docs" external' },
|
|
49
|
+
// Input
|
|
50
|
+
input: { example: 'input "Email" inputType=email placeholder="user@example.com" required' },
|
|
51
|
+
textarea: { example: 'textarea "Description" rows=4 placeholder="Enter description..."' },
|
|
52
|
+
select: { example: 'select "Country" ["USA", "Canada", "UK"] placeholder="Select..."' },
|
|
53
|
+
checkbox: { example: 'checkbox "I agree to terms" checked' },
|
|
54
|
+
radio: { example: 'radio "Option A" name="choice" checked' },
|
|
55
|
+
switch: { example: 'switch "Dark mode" checked' },
|
|
56
|
+
slider: { example: 'slider "Volume" min=0 max=100 value=50' },
|
|
57
|
+
button: { example: 'button "Submit" primary icon=send' },
|
|
58
|
+
// Display
|
|
59
|
+
image: { example: "image w=200 h=150" },
|
|
60
|
+
placeholder: { example: 'placeholder "Banner Image" w=full h=200 { ... }' },
|
|
61
|
+
avatar: { example: 'avatar "John Doe" size=lg' },
|
|
62
|
+
badge: { example: 'badge "New" variant=success pill' },
|
|
63
|
+
icon: { example: 'icon "settings" size=lg' },
|
|
64
|
+
// Data
|
|
65
|
+
table: {
|
|
494
66
|
example: 'table striped bordered { columns ["Name", "Email"] row ["John", "john@example.com"] }'
|
|
495
67
|
},
|
|
496
|
-
{
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
},
|
|
505
|
-
|
|
506
|
-
//
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
attributes: [...COMMON_ATTRIBUTES, "variant", "dismissible", "icon"],
|
|
513
|
-
hasChildren: false,
|
|
514
|
-
description: "Alert message",
|
|
515
|
-
example: 'alert "Changes saved!" variant=success'
|
|
516
|
-
},
|
|
517
|
-
{
|
|
518
|
-
name: "toast",
|
|
519
|
-
nodeType: "Toast",
|
|
520
|
-
category: "feedback",
|
|
521
|
-
attributes: [...COMMON_ATTRIBUTES, "position", "variant"],
|
|
522
|
-
hasChildren: false,
|
|
523
|
-
description: "Toast notification",
|
|
524
|
-
example: 'toast "Item deleted" position=bottom-right variant=danger'
|
|
525
|
-
},
|
|
526
|
-
{
|
|
527
|
-
name: "progress",
|
|
528
|
-
nodeType: "Progress",
|
|
529
|
-
category: "feedback",
|
|
530
|
-
attributes: [...COMMON_ATTRIBUTES, "value", "max", "label", "indeterminate"],
|
|
531
|
-
hasChildren: false,
|
|
532
|
-
description: "Progress bar",
|
|
533
|
-
example: 'progress value=75 label="Uploading..."'
|
|
534
|
-
},
|
|
535
|
-
{
|
|
536
|
-
name: "spinner",
|
|
537
|
-
nodeType: "Spinner",
|
|
538
|
-
category: "feedback",
|
|
539
|
-
attributes: [...COMMON_ATTRIBUTES, "label", "size"],
|
|
540
|
-
hasChildren: false,
|
|
541
|
-
description: "Loading spinner",
|
|
542
|
-
example: "spinner size=lg"
|
|
543
|
-
},
|
|
544
|
-
// ============================================
|
|
545
|
-
// Overlay Components
|
|
546
|
-
// ============================================
|
|
547
|
-
{
|
|
548
|
-
name: "tooltip",
|
|
549
|
-
nodeType: "Tooltip",
|
|
550
|
-
category: "overlay",
|
|
551
|
-
attributes: [...COMMON_ATTRIBUTES, "position"],
|
|
552
|
-
hasChildren: false,
|
|
553
|
-
description: "Tooltip on hover",
|
|
554
|
-
example: 'tooltip "More info" position=top { icon "help-circle" }'
|
|
555
|
-
},
|
|
556
|
-
{
|
|
557
|
-
name: "popover",
|
|
558
|
-
nodeType: "Popover",
|
|
559
|
-
category: "overlay",
|
|
560
|
-
attributes: [...COMMON_ATTRIBUTES, "title"],
|
|
561
|
-
hasChildren: true,
|
|
562
|
-
description: "Popover panel",
|
|
563
|
-
example: 'popover "Details" { ... }'
|
|
564
|
-
},
|
|
565
|
-
{
|
|
566
|
-
name: "dropdown",
|
|
567
|
-
nodeType: "Dropdown",
|
|
568
|
-
category: "overlay",
|
|
569
|
-
attributes: [...COMMON_ATTRIBUTES],
|
|
570
|
-
hasChildren: false,
|
|
571
|
-
description: "Dropdown menu",
|
|
572
|
-
example: 'dropdown { item "Edit" icon=edit item "Delete" icon=trash danger }'
|
|
573
|
-
},
|
|
574
|
-
// ============================================
|
|
575
|
-
// Navigation Components
|
|
576
|
-
// ============================================
|
|
577
|
-
{
|
|
578
|
-
name: "nav",
|
|
579
|
-
nodeType: "Nav",
|
|
580
|
-
category: "navigation",
|
|
581
|
-
attributes: [...COMMON_ATTRIBUTES, "vertical"],
|
|
582
|
-
hasChildren: false,
|
|
583
|
-
description: "Navigation menu",
|
|
584
|
-
example: 'nav [{ label="Home" icon=home active }, { label="Settings" icon=settings }] vertical'
|
|
585
|
-
},
|
|
586
|
-
{
|
|
587
|
-
name: "tabs",
|
|
588
|
-
nodeType: "Tabs",
|
|
589
|
-
category: "navigation",
|
|
590
|
-
attributes: [...COMMON_ATTRIBUTES, "active"],
|
|
591
|
-
hasChildren: true,
|
|
592
|
-
description: "Tab navigation",
|
|
593
|
-
example: 'tabs { tab "General" active { ... } tab "Advanced" { ... } }'
|
|
594
|
-
},
|
|
595
|
-
{
|
|
596
|
-
name: "breadcrumb",
|
|
597
|
-
nodeType: "Breadcrumb",
|
|
598
|
-
category: "navigation",
|
|
599
|
-
attributes: [...COMMON_ATTRIBUTES],
|
|
600
|
-
hasChildren: false,
|
|
601
|
-
description: "Breadcrumb navigation",
|
|
68
|
+
list: { example: 'list ordered ["First", "Second", "Third"]' },
|
|
69
|
+
// Feedback
|
|
70
|
+
alert: { example: 'alert "Changes saved!" variant=success' },
|
|
71
|
+
toast: { example: 'toast "Item deleted" position=bottom-right variant=danger' },
|
|
72
|
+
progress: { example: 'progress value=75 label="Uploading..."' },
|
|
73
|
+
spinner: { example: "spinner size=lg" },
|
|
74
|
+
// Overlay
|
|
75
|
+
tooltip: { example: 'tooltip "More info" position=top { icon "circle-question-mark" }' },
|
|
76
|
+
popover: { example: 'popover "Details" { ... }' },
|
|
77
|
+
dropdown: { example: 'dropdown { item "Edit" icon=pencil item "Delete" icon=trash danger }' },
|
|
78
|
+
// Navigation
|
|
79
|
+
nav: {
|
|
80
|
+
example: 'nav [{ label="Home" icon=house active }, { label="Settings" icon=settings }] vertical'
|
|
81
|
+
},
|
|
82
|
+
tabs: { example: 'tabs { tab "General" active { ... } tab "Advanced" { ... } }' },
|
|
83
|
+
breadcrumb: {
|
|
602
84
|
example: 'breadcrumb [{ label="Home" href="/" }, { label="Products" }, { label="Details" }]'
|
|
603
85
|
},
|
|
604
|
-
//
|
|
605
|
-
|
|
606
|
-
//
|
|
607
|
-
{
|
|
608
|
-
|
|
609
|
-
nodeType: "Divider",
|
|
610
|
-
category: "layout",
|
|
611
|
-
attributes: [...COMMON_ATTRIBUTES, "vertical"],
|
|
612
|
-
hasChildren: false,
|
|
613
|
-
description: "Horizontal separator",
|
|
614
|
-
example: "divider my=4"
|
|
615
|
-
},
|
|
616
|
-
// ============================================
|
|
617
|
-
// Annotation Components
|
|
618
|
-
// ============================================
|
|
619
|
-
{
|
|
620
|
-
name: "marker",
|
|
621
|
-
nodeType: "Marker",
|
|
622
|
-
category: "annotation",
|
|
623
|
-
attributes: [...COMMON_ATTRIBUTES, "color", "anchor"],
|
|
624
|
-
hasChildren: false,
|
|
625
|
-
description: "Number marker for referencing in annotations",
|
|
626
|
-
example: "marker 1 anchor=top-right color=blue"
|
|
627
|
-
},
|
|
628
|
-
{
|
|
629
|
-
name: "annotations",
|
|
630
|
-
nodeType: "Annotations",
|
|
631
|
-
category: "annotation",
|
|
632
|
-
attributes: [...COMMON_ATTRIBUTES, "title"],
|
|
633
|
-
hasChildren: true,
|
|
634
|
-
description: "Documentation panel for screen specifications",
|
|
86
|
+
// Divider
|
|
87
|
+
divider: { example: "divider my=4" },
|
|
88
|
+
// Annotation
|
|
89
|
+
marker: { example: "marker 1 anchor=top-right color=blue" },
|
|
90
|
+
annotations: {
|
|
635
91
|
example: 'annotations title="\uD654\uBA74 \uC124\uBA85" { item 1 "\uC81C\uBAA9" { text "\uC124\uBA85" } }',
|
|
636
92
|
validChildren: ["item"]
|
|
637
93
|
},
|
|
638
|
-
{
|
|
639
|
-
name: "item",
|
|
640
|
-
nodeType: "AnnotationItem",
|
|
641
|
-
category: "annotation",
|
|
642
|
-
attributes: [],
|
|
643
|
-
hasChildren: true,
|
|
644
|
-
description: "Individual annotation entry with marker number and title",
|
|
94
|
+
item: {
|
|
645
95
|
example: 'item 1 "\uB85C\uADF8\uC778 \uBC84\uD2BC" { text "OAuth \uC5F0\uB3D9 \uC608\uC815" }',
|
|
646
96
|
validParents: ["annotations"]
|
|
647
97
|
}
|
|
648
|
-
|
|
98
|
+
};
|
|
99
|
+
function toComponentDef(name) {
|
|
100
|
+
const spec = COMPONENT_SPEC_BY_NAME[name];
|
|
101
|
+
const { example, validChildren, validParents, extraAttributes } = EDITOR_METADATA[name];
|
|
102
|
+
return {
|
|
103
|
+
name: spec.name,
|
|
104
|
+
nodeType: spec.nodeType,
|
|
105
|
+
category: spec.category,
|
|
106
|
+
attributes: [...spec.attributes, ...extraAttributes ?? []],
|
|
107
|
+
hasChildren: spec.hasChildren,
|
|
108
|
+
description: spec.description,
|
|
109
|
+
example,
|
|
110
|
+
...validChildren ? { validChildren } : {},
|
|
111
|
+
...validParents ? { validParents } : {}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
var ALL_COMPONENTS = COMPONENT_NAMES.map(toComponentDef);
|
|
649
115
|
var COMPONENT_MAP = new Map(
|
|
650
116
|
ALL_COMPONENTS.map((comp) => [comp.name, comp])
|
|
651
117
|
);
|
|
@@ -656,8 +122,207 @@ var VALID_COMPONENT_NAMES = new Set(
|
|
|
656
122
|
ALL_COMPONENTS.map((comp) => comp.name)
|
|
657
123
|
);
|
|
658
124
|
|
|
125
|
+
// src/attributes.ts
|
|
126
|
+
import {
|
|
127
|
+
ATTRIBUTE_SPECS as ATTRIBUTE_SPECS2,
|
|
128
|
+
BOX_ATTRIBUTES as SPEC_BOX_ATTRIBUTES,
|
|
129
|
+
CONTAINER_ATTRIBUTES as SPEC_CONTAINER_ATTRIBUTES
|
|
130
|
+
} from "@wireweave/core/spec";
|
|
131
|
+
|
|
132
|
+
// src/core-spec-gaps.ts
|
|
133
|
+
import { ATTRIBUTE_SPECS } from "@wireweave/core/spec";
|
|
134
|
+
function coreValuesOf(name) {
|
|
135
|
+
const values = ATTRIBUTE_SPECS.find((spec) => spec.name === name)?.values;
|
|
136
|
+
return values ? [...values] : void 0;
|
|
137
|
+
}
|
|
138
|
+
var EDITOR_ONLY_ATTRIBUTES = [
|
|
139
|
+
{
|
|
140
|
+
name: "at",
|
|
141
|
+
type: "function",
|
|
142
|
+
description: "Place page on the multi-page canvas at (x, y) \u2014 pages without at() auto-flow horizontally",
|
|
143
|
+
example: "at(0, 0)"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
// Desugared, not missing. `wireframe.peggy` (Input rule) reads the authored
|
|
147
|
+
// `type`, deletes it, and re-emits it as `inputType`; the renderer then reads
|
|
148
|
+
// `node.inputType` for the HTML type attribute. The rename is forced, not
|
|
149
|
+
// incidental: `type` is every AST node's kind discriminant, which is why
|
|
150
|
+
// `validation/index.ts` lists it among the structural keys it skips. Adding
|
|
151
|
+
// `type` to `ATTRIBUTE_SPECS` would put the same name in `validate()`'s
|
|
152
|
+
// known-attribute set and its structural-skip set at once, so core is right
|
|
153
|
+
// to declare only `inputType` and this is the source spelling's only home.
|
|
154
|
+
name: "type",
|
|
155
|
+
type: "string",
|
|
156
|
+
// One attribute, two spellings — so one value space. Copying core's list
|
|
157
|
+
// would let `inputType` gain a value that `type=` never completes.
|
|
158
|
+
values: coreValuesOf("inputType"),
|
|
159
|
+
description: "Input type \u2014 written as `type` and stored on the node as `inputType`",
|
|
160
|
+
example: "type=email"
|
|
161
|
+
}
|
|
162
|
+
];
|
|
163
|
+
var PENDING_CORE_ATTRIBUTES = [];
|
|
164
|
+
|
|
165
|
+
// src/attributes.ts
|
|
166
|
+
var BOX_ATTRIBUTES = SPEC_BOX_ATTRIBUTES;
|
|
167
|
+
var CONTAINER_ATTRIBUTES = SPEC_CONTAINER_ATTRIBUTES;
|
|
168
|
+
var ATTRIBUTE_EXAMPLES = {
|
|
169
|
+
// Spacing
|
|
170
|
+
p: "p=4",
|
|
171
|
+
px: "px=4",
|
|
172
|
+
py: "py=4",
|
|
173
|
+
pt: "pt=4",
|
|
174
|
+
pr: "pr=4",
|
|
175
|
+
pb: "pb=4",
|
|
176
|
+
pl: "pl=4",
|
|
177
|
+
m: "m=4",
|
|
178
|
+
mx: "mx=auto",
|
|
179
|
+
my: "my=4",
|
|
180
|
+
mt: "mt=4",
|
|
181
|
+
mr: "mr=4",
|
|
182
|
+
mb: "mb=4",
|
|
183
|
+
ml: "ml=4",
|
|
184
|
+
gap: "gap=4",
|
|
185
|
+
// Size
|
|
186
|
+
w: "w=full",
|
|
187
|
+
h: "h=full",
|
|
188
|
+
width: "width=400",
|
|
189
|
+
height: "height=300",
|
|
190
|
+
minW: "minW=200",
|
|
191
|
+
maxW: "maxW=600",
|
|
192
|
+
minH: "minH=100",
|
|
193
|
+
maxH: "maxH=400",
|
|
194
|
+
// Flex / Grid
|
|
195
|
+
flex: "flex",
|
|
196
|
+
direction: "direction=column",
|
|
197
|
+
justify: "justify=center",
|
|
198
|
+
align: "align=center",
|
|
199
|
+
wrap: "wrap",
|
|
200
|
+
span: "span=6",
|
|
201
|
+
sm: "sm=6",
|
|
202
|
+
md: "md=4",
|
|
203
|
+
lg: "lg=3",
|
|
204
|
+
xl: "xl=2",
|
|
205
|
+
order: "order=1",
|
|
206
|
+
// Position
|
|
207
|
+
x: "x=100",
|
|
208
|
+
y: "y=50",
|
|
209
|
+
position: "position=left",
|
|
210
|
+
// Visual
|
|
211
|
+
border: "border",
|
|
212
|
+
rounded: "rounded",
|
|
213
|
+
shadow: "shadow=md",
|
|
214
|
+
bg: "bg=muted",
|
|
215
|
+
// Text
|
|
216
|
+
size: "size=lg",
|
|
217
|
+
weight: "weight=bold",
|
|
218
|
+
level: "level=2",
|
|
219
|
+
muted: "muted",
|
|
220
|
+
bold: "bold",
|
|
221
|
+
// Button variants
|
|
222
|
+
primary: "primary",
|
|
223
|
+
secondary: "secondary",
|
|
224
|
+
outline: "outline",
|
|
225
|
+
ghost: "ghost",
|
|
226
|
+
danger: "danger",
|
|
227
|
+
// Status variant
|
|
228
|
+
variant: "variant=success",
|
|
229
|
+
// Form
|
|
230
|
+
inputType: "inputType=email",
|
|
231
|
+
placeholder: 'placeholder="Enter text"',
|
|
232
|
+
value: 'value="default"',
|
|
233
|
+
label: 'label="Name"',
|
|
234
|
+
name: 'name="field"',
|
|
235
|
+
required: "required",
|
|
236
|
+
disabled: "disabled",
|
|
237
|
+
readonly: "readonly",
|
|
238
|
+
checked: "checked",
|
|
239
|
+
loading: "loading",
|
|
240
|
+
rows: "rows=4",
|
|
241
|
+
min: "min=0",
|
|
242
|
+
max: "max=100",
|
|
243
|
+
step: "step=1",
|
|
244
|
+
// Content
|
|
245
|
+
title: 'title="Title"',
|
|
246
|
+
src: 'src="/image.png"',
|
|
247
|
+
alt: 'alt="Image"',
|
|
248
|
+
href: 'href="/path"',
|
|
249
|
+
icon: 'icon="home"',
|
|
250
|
+
external: "external",
|
|
251
|
+
// Accessibility
|
|
252
|
+
aria: 'aria="Close dialog"',
|
|
253
|
+
"aria-label": 'aria-label="Close dialog"',
|
|
254
|
+
// State
|
|
255
|
+
active: "active=0",
|
|
256
|
+
expanded: "expanded",
|
|
257
|
+
centered: "centered",
|
|
258
|
+
vertical: "vertical",
|
|
259
|
+
scroll: "scroll",
|
|
260
|
+
// Feedback
|
|
261
|
+
dismissible: "dismissible",
|
|
262
|
+
indeterminate: "indeterminate",
|
|
263
|
+
pill: "pill",
|
|
264
|
+
// Data
|
|
265
|
+
striped: "striped",
|
|
266
|
+
bordered: "bordered",
|
|
267
|
+
hover: "hover",
|
|
268
|
+
ordered: "ordered",
|
|
269
|
+
none: "none",
|
|
270
|
+
// Page / viewport
|
|
271
|
+
id: 'id="dashboard"',
|
|
272
|
+
viewport: 'viewport="1440x900"',
|
|
273
|
+
device: 'device="iphone14"',
|
|
274
|
+
// Reuse
|
|
275
|
+
uses: 'uses="app-shell"',
|
|
276
|
+
// Interaction
|
|
277
|
+
navigate: 'navigate="Dashboard"',
|
|
278
|
+
opens: 'opens="settings-modal"',
|
|
279
|
+
toggles: 'toggles="filter-drawer"',
|
|
280
|
+
action: "action=back",
|
|
281
|
+
// Typed state and events
|
|
282
|
+
states: "states=[{ name=allowed, valueType=boolean, initial=false }]",
|
|
283
|
+
on: "on={ event=click, effects=[{ kind=toggle, state=allowed }] }",
|
|
284
|
+
visibleWhen: "visibleWhen={ state=allowed, equals=true }",
|
|
285
|
+
enabledWhen: "enabledWhen={ state=allowed, equals=true }",
|
|
286
|
+
// Annotation
|
|
287
|
+
anchor: "anchor=top-right",
|
|
288
|
+
color: "color=blue"
|
|
289
|
+
};
|
|
290
|
+
function toAttributeDef(spec) {
|
|
291
|
+
const example = ATTRIBUTE_EXAMPLES[spec.name];
|
|
292
|
+
if (example === void 0) {
|
|
293
|
+
throw new Error(
|
|
294
|
+
`[@wireweave/language-data] No editor example for attribute "${spec.name}". Add one to ATTRIBUTE_EXAMPLES in src/attributes.ts.`
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
if (spec.description === void 0) {
|
|
298
|
+
throw new Error(
|
|
299
|
+
`[@wireweave/language-data] Attribute "${spec.name}" has no description in the core spec.`
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
return {
|
|
303
|
+
name: spec.name,
|
|
304
|
+
type: spec.type,
|
|
305
|
+
...spec.values ? { values: [...spec.values] } : {},
|
|
306
|
+
description: spec.description,
|
|
307
|
+
example
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
var ATTRIBUTES = [
|
|
311
|
+
...ATTRIBUTE_SPECS2.map(toAttributeDef),
|
|
312
|
+
...EDITOR_ONLY_ATTRIBUTES,
|
|
313
|
+
...PENDING_CORE_ATTRIBUTES
|
|
314
|
+
];
|
|
315
|
+
var ATTRIBUTE_MAP = new Map(
|
|
316
|
+
ATTRIBUTES.map((attr) => [attr.name, attr])
|
|
317
|
+
);
|
|
318
|
+
var VALID_ATTRIBUTE_NAMES = new Set(
|
|
319
|
+
ATTRIBUTES.map((attr) => attr.name)
|
|
320
|
+
);
|
|
321
|
+
|
|
659
322
|
// src/keywords.ts
|
|
323
|
+
import { ATTRIBUTE_SPECS as ATTRIBUTE_SPECS3 } from "@wireweave/core/spec";
|
|
660
324
|
var CATEGORY_LABELS = {
|
|
325
|
+
structure: "Structure",
|
|
661
326
|
layout: "Layout",
|
|
662
327
|
container: "Container",
|
|
663
328
|
grid: "Grid",
|
|
@@ -670,86 +335,13 @@ var CATEGORY_LABELS = {
|
|
|
670
335
|
navigation: "Navigation",
|
|
671
336
|
annotation: "Annotation"
|
|
672
337
|
};
|
|
338
|
+
var BOOLEAN_LITERALS = ["true", "false"];
|
|
673
339
|
var VALUE_KEYWORDS = [
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
"secondary",
|
|
680
|
-
"outline",
|
|
681
|
-
"ghost",
|
|
682
|
-
// Status variants
|
|
683
|
-
"success",
|
|
684
|
-
"danger",
|
|
685
|
-
"warning",
|
|
686
|
-
"info",
|
|
687
|
-
"default",
|
|
688
|
-
// Sizes
|
|
689
|
-
"xs",
|
|
690
|
-
"sm",
|
|
691
|
-
"md",
|
|
692
|
-
"lg",
|
|
693
|
-
"xl",
|
|
694
|
-
"base",
|
|
695
|
-
"2xl",
|
|
696
|
-
"3xl",
|
|
697
|
-
// Flex alignment
|
|
698
|
-
"start",
|
|
699
|
-
"center",
|
|
700
|
-
"end",
|
|
701
|
-
"between",
|
|
702
|
-
"around",
|
|
703
|
-
"evenly",
|
|
704
|
-
"stretch",
|
|
705
|
-
"baseline",
|
|
706
|
-
// Positions
|
|
707
|
-
"left",
|
|
708
|
-
"right",
|
|
709
|
-
"top",
|
|
710
|
-
"bottom",
|
|
711
|
-
"top-left",
|
|
712
|
-
"top-center",
|
|
713
|
-
"top-right",
|
|
714
|
-
"bottom-left",
|
|
715
|
-
"bottom-center",
|
|
716
|
-
"bottom-right",
|
|
717
|
-
"center-left",
|
|
718
|
-
"center-right",
|
|
719
|
-
// Marker colors
|
|
720
|
-
"blue",
|
|
721
|
-
"red",
|
|
722
|
-
"green",
|
|
723
|
-
"yellow",
|
|
724
|
-
"purple",
|
|
725
|
-
"orange",
|
|
726
|
-
// Sizing
|
|
727
|
-
"full",
|
|
728
|
-
"auto",
|
|
729
|
-
"screen",
|
|
730
|
-
"fit",
|
|
731
|
-
// Font weights
|
|
732
|
-
"normal",
|
|
733
|
-
"medium",
|
|
734
|
-
"semibold",
|
|
735
|
-
"bold",
|
|
736
|
-
// Input types
|
|
737
|
-
"text",
|
|
738
|
-
"email",
|
|
739
|
-
"password",
|
|
740
|
-
"number",
|
|
741
|
-
"tel",
|
|
742
|
-
"url",
|
|
743
|
-
"search",
|
|
744
|
-
"date",
|
|
745
|
-
// Flex direction
|
|
746
|
-
"row",
|
|
747
|
-
"column",
|
|
748
|
-
"row-reverse",
|
|
749
|
-
"column-reverse",
|
|
750
|
-
// List
|
|
751
|
-
"none",
|
|
752
|
-
"nowrap"
|
|
340
|
+
.../* @__PURE__ */ new Set([
|
|
341
|
+
...BOOLEAN_LITERALS,
|
|
342
|
+
...ATTRIBUTE_SPECS3.flatMap((attr) => attr.values ?? []),
|
|
343
|
+
...PENDING_CORE_ATTRIBUTES.flatMap((attr) => attr.values ?? [])
|
|
344
|
+
])
|
|
753
345
|
];
|
|
754
346
|
var COMMON_NUMBERS = [0, 1, 2, 3, 4, 5, 6, 8, 10, 12, 16, 20, 24, 32, 48, 64];
|
|
755
347
|
var SPACING_SCALE = {
|
|
@@ -808,6 +400,7 @@ function getAttributeTypeLabel(attr) {
|
|
|
808
400
|
const preview = attr.values.slice(0, 3).join(" | ");
|
|
809
401
|
return attr.values.length > 3 ? `${preview}...` : preview;
|
|
810
402
|
}
|
|
403
|
+
if (attr.type === "function") return `function (${attr.example})`;
|
|
811
404
|
return attr.type;
|
|
812
405
|
}
|
|
813
406
|
function formatAttributeValues(attr) {
|
|
@@ -817,6 +410,7 @@ function formatAttributeValues(attr) {
|
|
|
817
410
|
if (attr.type === "enum" && attr.values) {
|
|
818
411
|
return `Values: ${attr.values.join(" | ")}`;
|
|
819
412
|
}
|
|
413
|
+
if (attr.type === "function") return `Functional shorthand. Example: ${attr.example}`;
|
|
820
414
|
return `Type: ${attr.type}`;
|
|
821
415
|
}
|
|
822
416
|
function isComponent(word) {
|
|
@@ -838,10 +432,11 @@ export {
|
|
|
838
432
|
ALL_COMPONENTS,
|
|
839
433
|
ATTRIBUTES,
|
|
840
434
|
ATTRIBUTE_MAP,
|
|
435
|
+
BOX_ATTRIBUTES,
|
|
841
436
|
CATEGORY_LABELS,
|
|
842
|
-
COMMON_ATTRIBUTES,
|
|
843
437
|
COMMON_NUMBERS,
|
|
844
438
|
COMPONENT_MAP,
|
|
439
|
+
CONTAINER_ATTRIBUTES,
|
|
845
440
|
NODE_TYPE_MAP,
|
|
846
441
|
SPACING_SCALE,
|
|
847
442
|
VALID_ATTRIBUTE_NAMES,
|