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