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