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