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