@wireweave/language-data 1.5.3-beta.0 → 1.5.3
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 +52 -143
- package/dist/codemirror/index.cjs +238 -34
- 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 +238 -34
- package/dist/codemirror/index.js.map +1 -1
- package/dist/index.cjs +231 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +231 -30
- package/dist/index.js.map +1 -1
- package/dist/monaco/index.cjs +276 -49
- 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 +276 -49
- package/dist/monaco/index.js.map +1 -1
- package/package.json +88 -23
package/dist/monaco/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import * as Monaco from 'monaco-editor';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Monaco Language Definition for Wireframe DSL
|
|
3
5
|
*
|
|
4
6
|
* Provides syntax highlighting via Monarch tokenizer
|
|
5
7
|
*/
|
|
8
|
+
|
|
6
9
|
/**
|
|
7
10
|
* Language ID for Monaco
|
|
8
11
|
*/
|
|
@@ -19,12 +22,12 @@ declare const LANGUAGE_EXTENSIONS: string[];
|
|
|
19
22
|
* Get Monarch tokenizer configuration
|
|
20
23
|
* This provides syntax highlighting for the Wireframe DSL
|
|
21
24
|
*/
|
|
22
|
-
declare function getMonarchTokensProvider():
|
|
25
|
+
declare function getMonarchTokensProvider(): Monaco.languages.IMonarchLanguage;
|
|
23
26
|
/**
|
|
24
27
|
* Language configuration for Monaco
|
|
25
28
|
* Provides bracket matching, auto-closing, etc.
|
|
26
29
|
*/
|
|
27
|
-
declare function getLanguageConfiguration():
|
|
30
|
+
declare function getLanguageConfiguration(): Monaco.languages.LanguageConfiguration;
|
|
28
31
|
|
|
29
32
|
/**
|
|
30
33
|
* Monaco IntelliSense Providers for Wireframe DSL
|
|
@@ -32,6 +35,8 @@ declare function getLanguageConfiguration(): object;
|
|
|
32
35
|
* Provides hover tooltips, auto-completion, and diagnostics
|
|
33
36
|
* These are factory functions that return provider configurations
|
|
34
37
|
*/
|
|
38
|
+
|
|
39
|
+
type MonacoApi = typeof Monaco;
|
|
35
40
|
/**
|
|
36
41
|
* Create hover provider configuration
|
|
37
42
|
* Returns an object compatible with monaco.languages.registerHoverProvider
|
|
@@ -39,14 +44,7 @@ declare function getLanguageConfiguration(): object;
|
|
|
39
44
|
* Usage in Monaco:
|
|
40
45
|
* monaco.languages.registerHoverProvider('wireframe', createHoverProvider(monaco))
|
|
41
46
|
*/
|
|
42
|
-
declare function createHoverProvider(monaco:
|
|
43
|
-
provideHover(model: any, position: any): {
|
|
44
|
-
range: any;
|
|
45
|
-
contents: {
|
|
46
|
-
value: string;
|
|
47
|
-
}[];
|
|
48
|
-
} | null;
|
|
49
|
-
};
|
|
47
|
+
declare function createHoverProvider(monaco: MonacoApi): Monaco.languages.HoverProvider;
|
|
50
48
|
/**
|
|
51
49
|
* Create completion provider configuration
|
|
52
50
|
* Returns an object compatible with monaco.languages.registerCompletionItemProvider
|
|
@@ -54,18 +52,14 @@ declare function createHoverProvider(monaco: any): {
|
|
|
54
52
|
* Usage in Monaco:
|
|
55
53
|
* monaco.languages.registerCompletionItemProvider('wireframe', createCompletionProvider(monaco))
|
|
56
54
|
*/
|
|
57
|
-
declare function createCompletionProvider(monaco:
|
|
58
|
-
triggerCharacters: string[];
|
|
59
|
-
provideCompletionItems(model: any, position: any): {
|
|
60
|
-
suggestions: any[];
|
|
61
|
-
};
|
|
62
|
-
};
|
|
55
|
+
declare function createCompletionProvider(monaco: MonacoApi): Monaco.languages.CompletionItemProvider;
|
|
63
56
|
|
|
64
57
|
/**
|
|
65
58
|
* Monaco Diagnostics for Wireframe DSL
|
|
66
59
|
*
|
|
67
60
|
* Provides real-time code validation and error markers
|
|
68
61
|
*/
|
|
62
|
+
|
|
69
63
|
/**
|
|
70
64
|
* Marker severity levels (matching Monaco's MarkerSeverity)
|
|
71
65
|
*/
|
|
@@ -75,7 +69,7 @@ declare const MarkerSeverity: {
|
|
|
75
69
|
readonly Warning: 4;
|
|
76
70
|
readonly Error: 8;
|
|
77
71
|
};
|
|
78
|
-
type MarkerSeverityType = typeof MarkerSeverity[keyof typeof MarkerSeverity];
|
|
72
|
+
type MarkerSeverityType = (typeof MarkerSeverity)[keyof typeof MarkerSeverity];
|
|
79
73
|
/**
|
|
80
74
|
* Marker data structure (compatible with Monaco's IMarkerData)
|
|
81
75
|
*/
|
|
@@ -99,7 +93,7 @@ declare function validateCode(text: string): MarkerData[];
|
|
|
99
93
|
* const cleanup = setupDiagnostics(monaco, editor);
|
|
100
94
|
* // Later: cleanup();
|
|
101
95
|
*/
|
|
102
|
-
declare function createDiagnosticsSetup(monaco:
|
|
96
|
+
declare function createDiagnosticsSetup(monaco: typeof Monaco): (editor: Monaco.editor.IStandaloneCodeEditor) => () => void;
|
|
103
97
|
|
|
104
98
|
/**
|
|
105
99
|
* Monaco Editor Integration for Wireframe DSL
|
|
@@ -138,6 +132,6 @@ declare function createDiagnosticsSetup(monaco: any): (editor: any) => () => voi
|
|
|
138
132
|
* Register wireframe language with Monaco
|
|
139
133
|
* Convenience function that registers everything at once
|
|
140
134
|
*/
|
|
141
|
-
declare function registerWireframeLanguage(monaco:
|
|
135
|
+
declare function registerWireframeLanguage(monaco: typeof Monaco): void;
|
|
142
136
|
|
|
143
137
|
export { LANGUAGE_ALIASES, LANGUAGE_EXTENSIONS, LANGUAGE_ID, type MarkerData, MarkerSeverity, type MarkerSeverityType, createCompletionProvider, createDiagnosticsSetup, createHoverProvider, getLanguageConfiguration, getMonarchTokensProvider, registerWireframeLanguage, validateCode };
|
package/dist/monaco/index.js
CHANGED
|
@@ -47,7 +47,12 @@ var ATTRIBUTES = [
|
|
|
47
47
|
{ name: "pb", type: "number", description: "Bottom padding", example: "pb=4" },
|
|
48
48
|
{ name: "pl", type: "number", description: "Left padding", example: "pl=4" },
|
|
49
49
|
{ name: "m", type: "number", description: "Margin (all sides)", example: "m=4" },
|
|
50
|
-
{
|
|
50
|
+
{
|
|
51
|
+
name: "mx",
|
|
52
|
+
type: "string",
|
|
53
|
+
description: 'Horizontal margin (number or "auto")',
|
|
54
|
+
example: "mx=auto"
|
|
55
|
+
},
|
|
51
56
|
{ name: "my", type: "number", description: "Vertical margin", example: "my=4" },
|
|
52
57
|
{ name: "mt", type: "number", description: "Top margin", example: "mt=4" },
|
|
53
58
|
{ name: "mr", type: "number", description: "Right margin", example: "mr=4" },
|
|
@@ -57,10 +62,30 @@ var ATTRIBUTES = [
|
|
|
57
62
|
// ============================================
|
|
58
63
|
// Size Attributes
|
|
59
64
|
// ============================================
|
|
60
|
-
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
{
|
|
66
|
+
name: "w",
|
|
67
|
+
type: "string",
|
|
68
|
+
description: 'Width (number, "full", "auto", "screen", "fit")',
|
|
69
|
+
example: "w=full"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "h",
|
|
73
|
+
type: "string",
|
|
74
|
+
description: 'Height (number, "full", "auto", "screen")',
|
|
75
|
+
example: "h=full"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "width",
|
|
79
|
+
type: "number",
|
|
80
|
+
description: "Width in pixels (page only)",
|
|
81
|
+
example: "width=400"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "height",
|
|
85
|
+
type: "number",
|
|
86
|
+
description: "Height in pixels (page only)",
|
|
87
|
+
example: "height=300"
|
|
88
|
+
},
|
|
64
89
|
{ name: "minW", type: "number", description: "Minimum width", example: "minW=200" },
|
|
65
90
|
{ name: "maxW", type: "number", description: "Maximum width", example: "maxW=600" },
|
|
66
91
|
{ name: "minH", type: "number", description: "Minimum height", example: "minH=100" },
|
|
@@ -69,9 +94,27 @@ var ATTRIBUTES = [
|
|
|
69
94
|
// Flex/Grid Layout Attributes
|
|
70
95
|
// ============================================
|
|
71
96
|
{ name: "flex", type: "boolean", description: "Enable flexbox", example: "flex" },
|
|
72
|
-
{
|
|
73
|
-
|
|
74
|
-
|
|
97
|
+
{
|
|
98
|
+
name: "direction",
|
|
99
|
+
type: "enum",
|
|
100
|
+
values: ["row", "column", "row-reverse", "column-reverse"],
|
|
101
|
+
description: "Flex direction",
|
|
102
|
+
example: "direction=column"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "justify",
|
|
106
|
+
type: "enum",
|
|
107
|
+
values: ["start", "center", "end", "between", "around", "evenly"],
|
|
108
|
+
description: "Main axis alignment",
|
|
109
|
+
example: "justify=center"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "align",
|
|
113
|
+
type: "enum",
|
|
114
|
+
values: ["start", "center", "end", "stretch", "baseline"],
|
|
115
|
+
description: "Cross axis alignment",
|
|
116
|
+
example: "align=center"
|
|
117
|
+
},
|
|
75
118
|
{ name: "wrap", type: "boolean", description: "Enable flex wrap", example: "wrap" },
|
|
76
119
|
{ name: "span", type: "number", description: "Grid column span (1-12)", example: "span=6" },
|
|
77
120
|
{ name: "sm", type: "number", description: "Responsive span at 576px+", example: "sm=6" },
|
|
@@ -84,19 +127,60 @@ var ATTRIBUTES = [
|
|
|
84
127
|
// ============================================
|
|
85
128
|
{ name: "x", type: "number", description: "Horizontal position", example: "x=100" },
|
|
86
129
|
{ name: "y", type: "number", description: "Vertical position", example: "y=50" },
|
|
87
|
-
{
|
|
130
|
+
{
|
|
131
|
+
name: "position",
|
|
132
|
+
type: "enum",
|
|
133
|
+
values: [
|
|
134
|
+
"left",
|
|
135
|
+
"right",
|
|
136
|
+
"top",
|
|
137
|
+
"bottom",
|
|
138
|
+
"top-left",
|
|
139
|
+
"top-center",
|
|
140
|
+
"top-right",
|
|
141
|
+
"bottom-left",
|
|
142
|
+
"bottom-center",
|
|
143
|
+
"bottom-right"
|
|
144
|
+
],
|
|
145
|
+
description: "Position preset",
|
|
146
|
+
example: "position=left"
|
|
147
|
+
},
|
|
88
148
|
// ============================================
|
|
89
149
|
// Visual Attributes
|
|
90
150
|
// ============================================
|
|
91
151
|
{ name: "border", type: "boolean", description: "Show border", example: "border" },
|
|
92
152
|
{ name: "rounded", type: "boolean", description: "Apply border radius", example: "rounded" },
|
|
93
|
-
{
|
|
94
|
-
|
|
153
|
+
{
|
|
154
|
+
name: "shadow",
|
|
155
|
+
type: "enum",
|
|
156
|
+
values: ["none", "sm", "md", "lg", "xl"],
|
|
157
|
+
description: "Box shadow",
|
|
158
|
+
example: "shadow=md"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: "bg",
|
|
162
|
+
type: "enum",
|
|
163
|
+
values: ["muted", "primary", "secondary"],
|
|
164
|
+
description: "Background variant",
|
|
165
|
+
example: "bg=muted"
|
|
166
|
+
},
|
|
95
167
|
// ============================================
|
|
96
168
|
// Text Attributes
|
|
97
169
|
// ============================================
|
|
98
|
-
{
|
|
99
|
-
|
|
170
|
+
{
|
|
171
|
+
name: "size",
|
|
172
|
+
type: "enum",
|
|
173
|
+
values: ["xs", "sm", "base", "md", "lg", "xl", "2xl", "3xl"],
|
|
174
|
+
description: "Size preset",
|
|
175
|
+
example: "size=lg"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: "weight",
|
|
179
|
+
type: "enum",
|
|
180
|
+
values: ["normal", "medium", "semibold", "bold"],
|
|
181
|
+
description: "Font weight",
|
|
182
|
+
example: "weight=bold"
|
|
183
|
+
},
|
|
100
184
|
{ name: "level", type: "number", description: "Heading level (1-6)", example: "level=2" },
|
|
101
185
|
{ name: "muted", type: "boolean", description: "Muted/dimmed style", example: "muted" },
|
|
102
186
|
{ name: "bold", type: "boolean", description: "Bold text", example: "bold" },
|
|
@@ -111,12 +195,29 @@ var ATTRIBUTES = [
|
|
|
111
195
|
// ============================================
|
|
112
196
|
// Status Variant Attributes
|
|
113
197
|
// ============================================
|
|
114
|
-
{
|
|
198
|
+
{
|
|
199
|
+
name: "variant",
|
|
200
|
+
type: "enum",
|
|
201
|
+
values: ["default", "primary", "secondary", "success", "warning", "danger", "info"],
|
|
202
|
+
description: "Status variant",
|
|
203
|
+
example: "variant=success"
|
|
204
|
+
},
|
|
115
205
|
// ============================================
|
|
116
206
|
// Form Attributes
|
|
117
207
|
// ============================================
|
|
118
|
-
{
|
|
119
|
-
|
|
208
|
+
{
|
|
209
|
+
name: "inputType",
|
|
210
|
+
type: "enum",
|
|
211
|
+
values: ["text", "email", "password", "number", "tel", "url", "search", "date"],
|
|
212
|
+
description: "Input field type",
|
|
213
|
+
example: "inputType=email"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: "placeholder",
|
|
217
|
+
type: "string",
|
|
218
|
+
description: "Placeholder text",
|
|
219
|
+
example: 'placeholder="Enter text"'
|
|
220
|
+
},
|
|
120
221
|
{ name: "value", type: "string", description: "Default value", example: 'value="default"' },
|
|
121
222
|
{ name: "label", type: "string", description: "Field label", example: 'label="Name"' },
|
|
122
223
|
{ name: "name", type: "string", description: "Form field name", example: 'name="field"' },
|
|
@@ -150,7 +251,12 @@ var ATTRIBUTES = [
|
|
|
150
251
|
// Feedback Attributes
|
|
151
252
|
// ============================================
|
|
152
253
|
{ name: "dismissible", type: "boolean", description: "Can be dismissed", example: "dismissible" },
|
|
153
|
-
{
|
|
254
|
+
{
|
|
255
|
+
name: "indeterminate",
|
|
256
|
+
type: "boolean",
|
|
257
|
+
description: "Indeterminate state",
|
|
258
|
+
example: "indeterminate"
|
|
259
|
+
},
|
|
154
260
|
{ name: "pill", type: "boolean", description: "Pill/rounded style", example: "pill" },
|
|
155
261
|
// ============================================
|
|
156
262
|
// Data Attributes
|
|
@@ -163,20 +269,73 @@ var ATTRIBUTES = [
|
|
|
163
269
|
// ============================================
|
|
164
270
|
// Page/Viewport Attributes
|
|
165
271
|
// ============================================
|
|
166
|
-
{
|
|
272
|
+
{
|
|
273
|
+
name: "viewport",
|
|
274
|
+
type: "string",
|
|
275
|
+
description: 'Viewport size (e.g., "1440x900")',
|
|
276
|
+
example: 'viewport="1440x900"'
|
|
277
|
+
},
|
|
167
278
|
{ name: "device", type: "string", description: "Device preset", example: 'device="iphone14"' },
|
|
279
|
+
{
|
|
280
|
+
name: "at",
|
|
281
|
+
type: "function",
|
|
282
|
+
description: "Place page on the multi-page canvas at (x, y) \u2014 pages without at() auto-flow horizontally",
|
|
283
|
+
example: "at(0, 0)"
|
|
284
|
+
},
|
|
168
285
|
// ============================================
|
|
169
286
|
// Interactive Attributes
|
|
170
287
|
// ============================================
|
|
171
|
-
{
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
288
|
+
{
|
|
289
|
+
name: "navigate",
|
|
290
|
+
type: "string",
|
|
291
|
+
description: "Navigation target URL or page",
|
|
292
|
+
example: 'navigate="/dashboard"'
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
name: "opens",
|
|
296
|
+
type: "string",
|
|
297
|
+
description: "Opens a modal, drawer, or popup",
|
|
298
|
+
example: 'opens="settings-modal"'
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
name: "toggles",
|
|
302
|
+
type: "string",
|
|
303
|
+
description: "Toggles visibility of an element",
|
|
304
|
+
example: 'toggles="menu"'
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
name: "action",
|
|
308
|
+
type: "string",
|
|
309
|
+
description: "Action identifier for event handling",
|
|
310
|
+
example: 'action="submit-form"'
|
|
311
|
+
},
|
|
175
312
|
// ============================================
|
|
176
313
|
// Annotation Attributes
|
|
177
314
|
// ============================================
|
|
178
|
-
{
|
|
179
|
-
|
|
315
|
+
{
|
|
316
|
+
name: "anchor",
|
|
317
|
+
type: "enum",
|
|
318
|
+
values: [
|
|
319
|
+
"top-left",
|
|
320
|
+
"top-center",
|
|
321
|
+
"top-right",
|
|
322
|
+
"center-left",
|
|
323
|
+
"center",
|
|
324
|
+
"center-right",
|
|
325
|
+
"bottom-left",
|
|
326
|
+
"bottom-center",
|
|
327
|
+
"bottom-right"
|
|
328
|
+
],
|
|
329
|
+
description: "Anchor position for marker in relative container",
|
|
330
|
+
example: "anchor=top-right"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
name: "color",
|
|
334
|
+
type: "enum",
|
|
335
|
+
values: ["blue", "red", "green", "yellow", "purple", "orange"],
|
|
336
|
+
description: "Marker color",
|
|
337
|
+
example: "color=blue"
|
|
338
|
+
}
|
|
180
339
|
];
|
|
181
340
|
var ATTRIBUTE_MAP = new Map(
|
|
182
341
|
ATTRIBUTES.map((attr) => [attr.name, attr])
|
|
@@ -194,10 +353,19 @@ var ALL_COMPONENTS = [
|
|
|
194
353
|
name: "page",
|
|
195
354
|
nodeType: "Page",
|
|
196
355
|
category: "layout",
|
|
197
|
-
attributes: [
|
|
356
|
+
attributes: [
|
|
357
|
+
...COMMON_ATTRIBUTES,
|
|
358
|
+
"title",
|
|
359
|
+
"width",
|
|
360
|
+
"height",
|
|
361
|
+
"viewport",
|
|
362
|
+
"device",
|
|
363
|
+
"centered",
|
|
364
|
+
"at"
|
|
365
|
+
],
|
|
198
366
|
hasChildren: true,
|
|
199
|
-
description: "Root container for a wireframe page",
|
|
200
|
-
example: 'page "
|
|
367
|
+
description: "Root container for a wireframe page. Multiple pages in one .wf file lay out side-by-side on a canvas; use at(x, y) for explicit placement, or omit for auto-flow.",
|
|
368
|
+
example: 'page "Login" at(0, 0) viewport="1280x800" { ... }',
|
|
201
369
|
validChildren: ["header", "main", "footer", "sidebar", "section", "nav", "row", "col", "card"],
|
|
202
370
|
validParents: []
|
|
203
371
|
},
|
|
@@ -365,7 +533,19 @@ var ALL_COMPONENTS = [
|
|
|
365
533
|
name: "input",
|
|
366
534
|
nodeType: "Input",
|
|
367
535
|
category: "input",
|
|
368
|
-
attributes: [
|
|
536
|
+
attributes: [
|
|
537
|
+
...COMMON_ATTRIBUTES,
|
|
538
|
+
"label",
|
|
539
|
+
"inputType",
|
|
540
|
+
"placeholder",
|
|
541
|
+
"value",
|
|
542
|
+
"disabled",
|
|
543
|
+
"required",
|
|
544
|
+
"readonly",
|
|
545
|
+
"icon",
|
|
546
|
+
"size",
|
|
547
|
+
"rounded"
|
|
548
|
+
],
|
|
369
549
|
hasChildren: false,
|
|
370
550
|
description: "Text input field",
|
|
371
551
|
example: 'input "Email" inputType=email placeholder="user@example.com" required'
|
|
@@ -374,7 +554,15 @@ var ALL_COMPONENTS = [
|
|
|
374
554
|
name: "textarea",
|
|
375
555
|
nodeType: "Textarea",
|
|
376
556
|
category: "input",
|
|
377
|
-
attributes: [
|
|
557
|
+
attributes: [
|
|
558
|
+
...COMMON_ATTRIBUTES,
|
|
559
|
+
"label",
|
|
560
|
+
"placeholder",
|
|
561
|
+
"value",
|
|
562
|
+
"rows",
|
|
563
|
+
"disabled",
|
|
564
|
+
"required"
|
|
565
|
+
],
|
|
378
566
|
hasChildren: false,
|
|
379
567
|
description: "Multi-line text input",
|
|
380
568
|
example: 'textarea "Description" rows=4 placeholder="Enter description..."'
|
|
@@ -428,7 +616,18 @@ var ALL_COMPONENTS = [
|
|
|
428
616
|
name: "button",
|
|
429
617
|
nodeType: "Button",
|
|
430
618
|
category: "input",
|
|
431
|
-
attributes: [
|
|
619
|
+
attributes: [
|
|
620
|
+
...COMMON_ATTRIBUTES,
|
|
621
|
+
"primary",
|
|
622
|
+
"secondary",
|
|
623
|
+
"outline",
|
|
624
|
+
"ghost",
|
|
625
|
+
"danger",
|
|
626
|
+
"size",
|
|
627
|
+
"icon",
|
|
628
|
+
"disabled",
|
|
629
|
+
"loading"
|
|
630
|
+
],
|
|
432
631
|
hasChildren: false,
|
|
433
632
|
description: "Clickable button",
|
|
434
633
|
example: 'button "Submit" primary icon=send'
|
|
@@ -684,6 +883,7 @@ function getAttributeTypeLabel(attr) {
|
|
|
684
883
|
const preview = attr.values.slice(0, 3).join(" | ");
|
|
685
884
|
return attr.values.length > 3 ? `${preview}...` : preview;
|
|
686
885
|
}
|
|
886
|
+
if (attr.type === "function") return `function (${attr.example})`;
|
|
687
887
|
return attr.type;
|
|
688
888
|
}
|
|
689
889
|
function getComponentNames() {
|
|
@@ -796,7 +996,21 @@ var LANGUAGE_EXTENSIONS = [".wf", ".wireframe"];
|
|
|
796
996
|
function getMonarchTokensProvider() {
|
|
797
997
|
const componentNames = getComponentNames();
|
|
798
998
|
const attributeNames = getAttributeNames();
|
|
799
|
-
const layoutComponents = [
|
|
999
|
+
const layoutComponents = [
|
|
1000
|
+
"page",
|
|
1001
|
+
"header",
|
|
1002
|
+
"footer",
|
|
1003
|
+
"main",
|
|
1004
|
+
"sidebar",
|
|
1005
|
+
"nav",
|
|
1006
|
+
"row",
|
|
1007
|
+
"col",
|
|
1008
|
+
"card",
|
|
1009
|
+
"modal",
|
|
1010
|
+
"table",
|
|
1011
|
+
"form",
|
|
1012
|
+
"tabs"
|
|
1013
|
+
];
|
|
800
1014
|
const otherComponents = componentNames.filter((c) => !layoutComponents.includes(c));
|
|
801
1015
|
return {
|
|
802
1016
|
defaultToken: "",
|
|
@@ -809,7 +1023,7 @@ function getMonarchTokensProvider() {
|
|
|
809
1023
|
// Operators
|
|
810
1024
|
operators: ["="],
|
|
811
1025
|
// Symbols
|
|
812
|
-
symbols: /[
|
|
1026
|
+
symbols: /[=><!~?:&|+\-*/^%]+/,
|
|
813
1027
|
// Escapes
|
|
814
1028
|
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
|
|
815
1029
|
// Tokenizer
|
|
@@ -824,31 +1038,37 @@ function getMonarchTokensProvider() {
|
|
|
824
1038
|
// Numbers
|
|
825
1039
|
[/\d+(\.\d+)?/, "number"],
|
|
826
1040
|
// Identifiers and keywords
|
|
827
|
-
[
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
1041
|
+
[
|
|
1042
|
+
/[a-zA-Z_]\w*/,
|
|
1043
|
+
{
|
|
1044
|
+
cases: {
|
|
1045
|
+
"@keywords": "keyword",
|
|
1046
|
+
"@typeKeywords": "type",
|
|
1047
|
+
"@attributes": "attribute.name",
|
|
1048
|
+
"@valueKeywords": "attribute.value",
|
|
1049
|
+
"@default": "identifier"
|
|
1050
|
+
}
|
|
834
1051
|
}
|
|
835
|
-
|
|
1052
|
+
],
|
|
836
1053
|
// Brackets
|
|
837
|
-
[/[{}()
|
|
1054
|
+
[/[{}()[\]]/, "@brackets"],
|
|
838
1055
|
// Operators
|
|
839
|
-
[
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
1056
|
+
[
|
|
1057
|
+
/@symbols/,
|
|
1058
|
+
{
|
|
1059
|
+
cases: {
|
|
1060
|
+
"@operators": "operator",
|
|
1061
|
+
"@default": ""
|
|
1062
|
+
}
|
|
843
1063
|
}
|
|
844
|
-
|
|
1064
|
+
],
|
|
845
1065
|
// Whitespace
|
|
846
1066
|
[/[ \t\r\n]+/, "white"]
|
|
847
1067
|
],
|
|
848
1068
|
comment: [
|
|
849
|
-
[/[
|
|
1069
|
+
[/[^/*]+/, "comment"],
|
|
850
1070
|
[/\*\//, "comment", "@pop"],
|
|
851
|
-
[/[
|
|
1071
|
+
[/[/*]/, "comment"]
|
|
852
1072
|
],
|
|
853
1073
|
string: [
|
|
854
1074
|
[/[^\\"]+/, "string"],
|
|
@@ -934,6 +1154,8 @@ Attributes: ${component.attributes.join(", ")}
|
|
|
934
1154
|
valueInfo = "Type: boolean (can be omitted)";
|
|
935
1155
|
} else if (attribute.type === "enum" && attribute.values) {
|
|
936
1156
|
valueInfo = `Values: ${attribute.values.join(" | ")}`;
|
|
1157
|
+
} else if (attribute.type === "function") {
|
|
1158
|
+
valueInfo = `Functional shorthand. Example: ${attribute.example}`;
|
|
937
1159
|
}
|
|
938
1160
|
return {
|
|
939
1161
|
range: new monaco.Range(
|
|
@@ -1022,6 +1244,7 @@ function createCompletionProvider(monaco) {
|
|
|
1022
1244
|
});
|
|
1023
1245
|
});
|
|
1024
1246
|
} else if (attr?.type === "number") {
|
|
1247
|
+
;
|
|
1025
1248
|
[1, 2, 3, 4, 5, 6, 8, 10, 12, 16].forEach((n) => {
|
|
1026
1249
|
suggestions.push({
|
|
1027
1250
|
label: String(n),
|
|
@@ -1072,6 +1295,8 @@ function createCompletionProvider(monaco) {
|
|
|
1072
1295
|
insertText = `${attr.name}=$1`;
|
|
1073
1296
|
} else if (attr.type === "enum") {
|
|
1074
1297
|
insertText = `${attr.name}=$1`;
|
|
1298
|
+
} else if (attr.type === "function") {
|
|
1299
|
+
insertText = `${attr.name}($1, $2)`;
|
|
1075
1300
|
}
|
|
1076
1301
|
suggestions.push({
|
|
1077
1302
|
label: attr.name,
|
|
@@ -1094,6 +1319,8 @@ Example: ${attr.example}` : "")
|
|
|
1094
1319
|
insertText = `${attr.name}=$1`;
|
|
1095
1320
|
} else if (attr.type === "enum") {
|
|
1096
1321
|
insertText = `${attr.name}=$1`;
|
|
1322
|
+
} else if (attr.type === "function") {
|
|
1323
|
+
insertText = `${attr.name}($1, $2)`;
|
|
1097
1324
|
}
|
|
1098
1325
|
suggestions.push({
|
|
1099
1326
|
label: attr.name,
|
|
@@ -1143,7 +1370,7 @@ var MarkerSeverity = {
|
|
|
1143
1370
|
function validateCode(text) {
|
|
1144
1371
|
const markers = [];
|
|
1145
1372
|
const lines = text.split("\n");
|
|
1146
|
-
|
|
1373
|
+
const braceStack = [];
|
|
1147
1374
|
let hasPage = false;
|
|
1148
1375
|
for (let i = 0; i < lines.length; i++) {
|
|
1149
1376
|
const line = lines[i];
|