@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.
@@ -83,7 +83,12 @@ var ATTRIBUTES = [
83
83
  { name: "pb", type: "number", description: "Bottom padding", example: "pb=4" },
84
84
  { name: "pl", type: "number", description: "Left padding", example: "pl=4" },
85
85
  { name: "m", type: "number", description: "Margin (all sides)", example: "m=4" },
86
- { name: "mx", type: "string", description: 'Horizontal margin (number or "auto")', example: "mx=auto" },
86
+ {
87
+ name: "mx",
88
+ type: "string",
89
+ description: 'Horizontal margin (number or "auto")',
90
+ example: "mx=auto"
91
+ },
87
92
  { name: "my", type: "number", description: "Vertical margin", example: "my=4" },
88
93
  { name: "mt", type: "number", description: "Top margin", example: "mt=4" },
89
94
  { name: "mr", type: "number", description: "Right margin", example: "mr=4" },
@@ -93,10 +98,30 @@ var ATTRIBUTES = [
93
98
  // ============================================
94
99
  // Size Attributes
95
100
  // ============================================
96
- { name: "w", type: "string", description: 'Width (number, "full", "auto", "screen", "fit")', example: "w=full" },
97
- { name: "h", type: "string", description: 'Height (number, "full", "auto", "screen")', example: "h=full" },
98
- { name: "width", type: "number", description: "Width in pixels (page only)", example: "width=400" },
99
- { name: "height", type: "number", description: "Height in pixels (page only)", example: "height=300" },
101
+ {
102
+ name: "w",
103
+ type: "string",
104
+ description: 'Width (number, "full", "auto", "screen", "fit")',
105
+ example: "w=full"
106
+ },
107
+ {
108
+ name: "h",
109
+ type: "string",
110
+ description: 'Height (number, "full", "auto", "screen")',
111
+ example: "h=full"
112
+ },
113
+ {
114
+ name: "width",
115
+ type: "number",
116
+ description: "Width in pixels (page only)",
117
+ example: "width=400"
118
+ },
119
+ {
120
+ name: "height",
121
+ type: "number",
122
+ description: "Height in pixels (page only)",
123
+ example: "height=300"
124
+ },
100
125
  { name: "minW", type: "number", description: "Minimum width", example: "minW=200" },
101
126
  { name: "maxW", type: "number", description: "Maximum width", example: "maxW=600" },
102
127
  { name: "minH", type: "number", description: "Minimum height", example: "minH=100" },
@@ -105,9 +130,27 @@ var ATTRIBUTES = [
105
130
  // Flex/Grid Layout Attributes
106
131
  // ============================================
107
132
  { name: "flex", type: "boolean", description: "Enable flexbox", example: "flex" },
108
- { name: "direction", type: "enum", values: ["row", "column", "row-reverse", "column-reverse"], description: "Flex direction", example: "direction=column" },
109
- { name: "justify", type: "enum", values: ["start", "center", "end", "between", "around", "evenly"], description: "Main axis alignment", example: "justify=center" },
110
- { name: "align", type: "enum", values: ["start", "center", "end", "stretch", "baseline"], description: "Cross axis alignment", example: "align=center" },
133
+ {
134
+ name: "direction",
135
+ type: "enum",
136
+ values: ["row", "column", "row-reverse", "column-reverse"],
137
+ description: "Flex direction",
138
+ example: "direction=column"
139
+ },
140
+ {
141
+ name: "justify",
142
+ type: "enum",
143
+ values: ["start", "center", "end", "between", "around", "evenly"],
144
+ description: "Main axis alignment",
145
+ example: "justify=center"
146
+ },
147
+ {
148
+ name: "align",
149
+ type: "enum",
150
+ values: ["start", "center", "end", "stretch", "baseline"],
151
+ description: "Cross axis alignment",
152
+ example: "align=center"
153
+ },
111
154
  { name: "wrap", type: "boolean", description: "Enable flex wrap", example: "wrap" },
112
155
  { name: "span", type: "number", description: "Grid column span (1-12)", example: "span=6" },
113
156
  { name: "sm", type: "number", description: "Responsive span at 576px+", example: "sm=6" },
@@ -120,19 +163,60 @@ var ATTRIBUTES = [
120
163
  // ============================================
121
164
  { name: "x", type: "number", description: "Horizontal position", example: "x=100" },
122
165
  { name: "y", type: "number", description: "Vertical position", example: "y=50" },
123
- { name: "position", type: "enum", values: ["left", "right", "top", "bottom", "top-left", "top-center", "top-right", "bottom-left", "bottom-center", "bottom-right"], description: "Position preset", example: "position=left" },
166
+ {
167
+ name: "position",
168
+ type: "enum",
169
+ values: [
170
+ "left",
171
+ "right",
172
+ "top",
173
+ "bottom",
174
+ "top-left",
175
+ "top-center",
176
+ "top-right",
177
+ "bottom-left",
178
+ "bottom-center",
179
+ "bottom-right"
180
+ ],
181
+ description: "Position preset",
182
+ example: "position=left"
183
+ },
124
184
  // ============================================
125
185
  // Visual Attributes
126
186
  // ============================================
127
187
  { name: "border", type: "boolean", description: "Show border", example: "border" },
128
188
  { name: "rounded", type: "boolean", description: "Apply border radius", example: "rounded" },
129
- { name: "shadow", type: "enum", values: ["none", "sm", "md", "lg", "xl"], description: "Box shadow", example: "shadow=md" },
130
- { name: "bg", type: "enum", values: ["muted", "primary", "secondary"], description: "Background variant", example: "bg=muted" },
189
+ {
190
+ name: "shadow",
191
+ type: "enum",
192
+ values: ["none", "sm", "md", "lg", "xl"],
193
+ description: "Box shadow",
194
+ example: "shadow=md"
195
+ },
196
+ {
197
+ name: "bg",
198
+ type: "enum",
199
+ values: ["muted", "primary", "secondary"],
200
+ description: "Background variant",
201
+ example: "bg=muted"
202
+ },
131
203
  // ============================================
132
204
  // Text Attributes
133
205
  // ============================================
134
- { name: "size", type: "enum", values: ["xs", "sm", "base", "md", "lg", "xl", "2xl", "3xl"], description: "Size preset", example: "size=lg" },
135
- { name: "weight", type: "enum", values: ["normal", "medium", "semibold", "bold"], description: "Font weight", example: "weight=bold" },
206
+ {
207
+ name: "size",
208
+ type: "enum",
209
+ values: ["xs", "sm", "base", "md", "lg", "xl", "2xl", "3xl"],
210
+ description: "Size preset",
211
+ example: "size=lg"
212
+ },
213
+ {
214
+ name: "weight",
215
+ type: "enum",
216
+ values: ["normal", "medium", "semibold", "bold"],
217
+ description: "Font weight",
218
+ example: "weight=bold"
219
+ },
136
220
  { name: "level", type: "number", description: "Heading level (1-6)", example: "level=2" },
137
221
  { name: "muted", type: "boolean", description: "Muted/dimmed style", example: "muted" },
138
222
  { name: "bold", type: "boolean", description: "Bold text", example: "bold" },
@@ -147,12 +231,29 @@ var ATTRIBUTES = [
147
231
  // ============================================
148
232
  // Status Variant Attributes
149
233
  // ============================================
150
- { name: "variant", type: "enum", values: ["default", "primary", "secondary", "success", "warning", "danger", "info"], description: "Status variant", example: "variant=success" },
234
+ {
235
+ name: "variant",
236
+ type: "enum",
237
+ values: ["default", "primary", "secondary", "success", "warning", "danger", "info"],
238
+ description: "Status variant",
239
+ example: "variant=success"
240
+ },
151
241
  // ============================================
152
242
  // Form Attributes
153
243
  // ============================================
154
- { name: "inputType", type: "enum", values: ["text", "email", "password", "number", "tel", "url", "search", "date"], description: "Input field type", example: "inputType=email" },
155
- { name: "placeholder", type: "string", description: "Placeholder text", example: 'placeholder="Enter text"' },
244
+ {
245
+ name: "inputType",
246
+ type: "enum",
247
+ values: ["text", "email", "password", "number", "tel", "url", "search", "date"],
248
+ description: "Input field type",
249
+ example: "inputType=email"
250
+ },
251
+ {
252
+ name: "placeholder",
253
+ type: "string",
254
+ description: "Placeholder text",
255
+ example: 'placeholder="Enter text"'
256
+ },
156
257
  { name: "value", type: "string", description: "Default value", example: 'value="default"' },
157
258
  { name: "label", type: "string", description: "Field label", example: 'label="Name"' },
158
259
  { name: "name", type: "string", description: "Form field name", example: 'name="field"' },
@@ -186,7 +287,12 @@ var ATTRIBUTES = [
186
287
  // Feedback Attributes
187
288
  // ============================================
188
289
  { name: "dismissible", type: "boolean", description: "Can be dismissed", example: "dismissible" },
189
- { name: "indeterminate", type: "boolean", description: "Indeterminate state", example: "indeterminate" },
290
+ {
291
+ name: "indeterminate",
292
+ type: "boolean",
293
+ description: "Indeterminate state",
294
+ example: "indeterminate"
295
+ },
190
296
  { name: "pill", type: "boolean", description: "Pill/rounded style", example: "pill" },
191
297
  // ============================================
192
298
  // Data Attributes
@@ -199,20 +305,73 @@ var ATTRIBUTES = [
199
305
  // ============================================
200
306
  // Page/Viewport Attributes
201
307
  // ============================================
202
- { name: "viewport", type: "string", description: 'Viewport size (e.g., "1440x900")', example: 'viewport="1440x900"' },
308
+ {
309
+ name: "viewport",
310
+ type: "string",
311
+ description: 'Viewport size (e.g., "1440x900")',
312
+ example: 'viewport="1440x900"'
313
+ },
203
314
  { name: "device", type: "string", description: "Device preset", example: 'device="iphone14"' },
315
+ {
316
+ name: "at",
317
+ type: "function",
318
+ description: "Place page on the multi-page canvas at (x, y) \u2014 pages without at() auto-flow horizontally",
319
+ example: "at(0, 0)"
320
+ },
204
321
  // ============================================
205
322
  // Interactive Attributes
206
323
  // ============================================
207
- { name: "navigate", type: "string", description: "Navigation target URL or page", example: 'navigate="/dashboard"' },
208
- { name: "opens", type: "string", description: "Opens a modal, drawer, or popup", example: 'opens="settings-modal"' },
209
- { name: "toggles", type: "string", description: "Toggles visibility of an element", example: 'toggles="menu"' },
210
- { name: "action", type: "string", description: "Action identifier for event handling", example: 'action="submit-form"' },
324
+ {
325
+ name: "navigate",
326
+ type: "string",
327
+ description: "Navigation target URL or page",
328
+ example: 'navigate="/dashboard"'
329
+ },
330
+ {
331
+ name: "opens",
332
+ type: "string",
333
+ description: "Opens a modal, drawer, or popup",
334
+ example: 'opens="settings-modal"'
335
+ },
336
+ {
337
+ name: "toggles",
338
+ type: "string",
339
+ description: "Toggles visibility of an element",
340
+ example: 'toggles="menu"'
341
+ },
342
+ {
343
+ name: "action",
344
+ type: "string",
345
+ description: "Action identifier for event handling",
346
+ example: 'action="submit-form"'
347
+ },
211
348
  // ============================================
212
349
  // Annotation Attributes
213
350
  // ============================================
214
- { name: "anchor", type: "enum", values: ["top-left", "top-center", "top-right", "center-left", "center", "center-right", "bottom-left", "bottom-center", "bottom-right"], description: "Anchor position for marker in relative container", example: "anchor=top-right" },
215
- { name: "color", type: "enum", values: ["blue", "red", "green", "yellow", "purple", "orange"], description: "Marker color", example: "color=blue" }
351
+ {
352
+ name: "anchor",
353
+ type: "enum",
354
+ values: [
355
+ "top-left",
356
+ "top-center",
357
+ "top-right",
358
+ "center-left",
359
+ "center",
360
+ "center-right",
361
+ "bottom-left",
362
+ "bottom-center",
363
+ "bottom-right"
364
+ ],
365
+ description: "Anchor position for marker in relative container",
366
+ example: "anchor=top-right"
367
+ },
368
+ {
369
+ name: "color",
370
+ type: "enum",
371
+ values: ["blue", "red", "green", "yellow", "purple", "orange"],
372
+ description: "Marker color",
373
+ example: "color=blue"
374
+ }
216
375
  ];
217
376
  var ATTRIBUTE_MAP = new Map(
218
377
  ATTRIBUTES.map((attr) => [attr.name, attr])
@@ -230,10 +389,19 @@ var ALL_COMPONENTS = [
230
389
  name: "page",
231
390
  nodeType: "Page",
232
391
  category: "layout",
233
- attributes: [...COMMON_ATTRIBUTES, "title", "width", "height", "viewport", "device", "centered"],
392
+ attributes: [
393
+ ...COMMON_ATTRIBUTES,
394
+ "title",
395
+ "width",
396
+ "height",
397
+ "viewport",
398
+ "device",
399
+ "centered",
400
+ "at"
401
+ ],
234
402
  hasChildren: true,
235
- description: "Root container for a wireframe page",
236
- example: 'page "Dashboard" centered { ... }',
403
+ 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.",
404
+ example: 'page "Login" at(0, 0) viewport="1280x800" { ... }',
237
405
  validChildren: ["header", "main", "footer", "sidebar", "section", "nav", "row", "col", "card"],
238
406
  validParents: []
239
407
  },
@@ -401,7 +569,19 @@ var ALL_COMPONENTS = [
401
569
  name: "input",
402
570
  nodeType: "Input",
403
571
  category: "input",
404
- attributes: [...COMMON_ATTRIBUTES, "label", "inputType", "placeholder", "value", "disabled", "required", "readonly", "icon", "size", "rounded"],
572
+ attributes: [
573
+ ...COMMON_ATTRIBUTES,
574
+ "label",
575
+ "inputType",
576
+ "placeholder",
577
+ "value",
578
+ "disabled",
579
+ "required",
580
+ "readonly",
581
+ "icon",
582
+ "size",
583
+ "rounded"
584
+ ],
405
585
  hasChildren: false,
406
586
  description: "Text input field",
407
587
  example: 'input "Email" inputType=email placeholder="user@example.com" required'
@@ -410,7 +590,15 @@ var ALL_COMPONENTS = [
410
590
  name: "textarea",
411
591
  nodeType: "Textarea",
412
592
  category: "input",
413
- attributes: [...COMMON_ATTRIBUTES, "label", "placeholder", "value", "rows", "disabled", "required"],
593
+ attributes: [
594
+ ...COMMON_ATTRIBUTES,
595
+ "label",
596
+ "placeholder",
597
+ "value",
598
+ "rows",
599
+ "disabled",
600
+ "required"
601
+ ],
414
602
  hasChildren: false,
415
603
  description: "Multi-line text input",
416
604
  example: 'textarea "Description" rows=4 placeholder="Enter description..."'
@@ -464,7 +652,18 @@ var ALL_COMPONENTS = [
464
652
  name: "button",
465
653
  nodeType: "Button",
466
654
  category: "input",
467
- attributes: [...COMMON_ATTRIBUTES, "primary", "secondary", "outline", "ghost", "danger", "size", "icon", "disabled", "loading"],
655
+ attributes: [
656
+ ...COMMON_ATTRIBUTES,
657
+ "primary",
658
+ "secondary",
659
+ "outline",
660
+ "ghost",
661
+ "danger",
662
+ "size",
663
+ "icon",
664
+ "disabled",
665
+ "loading"
666
+ ],
468
667
  hasChildren: false,
469
668
  description: "Clickable button",
470
669
  example: 'button "Submit" primary icon=send'
@@ -720,6 +919,7 @@ function getAttributeTypeLabel(attr) {
720
919
  const preview = attr.values.slice(0, 3).join(" | ");
721
920
  return attr.values.length > 3 ? `${preview}...` : preview;
722
921
  }
922
+ if (attr.type === "function") return `function (${attr.example})`;
723
923
  return attr.type;
724
924
  }
725
925
  function getComponentNames() {
@@ -832,7 +1032,21 @@ var LANGUAGE_EXTENSIONS = [".wf", ".wireframe"];
832
1032
  function getMonarchTokensProvider() {
833
1033
  const componentNames = getComponentNames();
834
1034
  const attributeNames = getAttributeNames();
835
- const layoutComponents = ["page", "header", "footer", "main", "sidebar", "nav", "row", "col", "card", "modal", "table", "form", "tabs"];
1035
+ const layoutComponents = [
1036
+ "page",
1037
+ "header",
1038
+ "footer",
1039
+ "main",
1040
+ "sidebar",
1041
+ "nav",
1042
+ "row",
1043
+ "col",
1044
+ "card",
1045
+ "modal",
1046
+ "table",
1047
+ "form",
1048
+ "tabs"
1049
+ ];
836
1050
  const otherComponents = componentNames.filter((c) => !layoutComponents.includes(c));
837
1051
  return {
838
1052
  defaultToken: "",
@@ -845,7 +1059,7 @@ function getMonarchTokensProvider() {
845
1059
  // Operators
846
1060
  operators: ["="],
847
1061
  // Symbols
848
- symbols: /[=><!~?:&|+\-*\/\^%]+/,
1062
+ symbols: /[=><!~?:&|+\-*/^%]+/,
849
1063
  // Escapes
850
1064
  escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
851
1065
  // Tokenizer
@@ -860,31 +1074,37 @@ function getMonarchTokensProvider() {
860
1074
  // Numbers
861
1075
  [/\d+(\.\d+)?/, "number"],
862
1076
  // Identifiers and keywords
863
- [/[a-zA-Z_]\w*/, {
864
- cases: {
865
- "@keywords": "keyword",
866
- "@typeKeywords": "type",
867
- "@attributes": "attribute.name",
868
- "@valueKeywords": "attribute.value",
869
- "@default": "identifier"
1077
+ [
1078
+ /[a-zA-Z_]\w*/,
1079
+ {
1080
+ cases: {
1081
+ "@keywords": "keyword",
1082
+ "@typeKeywords": "type",
1083
+ "@attributes": "attribute.name",
1084
+ "@valueKeywords": "attribute.value",
1085
+ "@default": "identifier"
1086
+ }
870
1087
  }
871
- }],
1088
+ ],
872
1089
  // Brackets
873
- [/[{}()\[\]]/, "@brackets"],
1090
+ [/[{}()[\]]/, "@brackets"],
874
1091
  // Operators
875
- [/@symbols/, {
876
- cases: {
877
- "@operators": "operator",
878
- "@default": ""
1092
+ [
1093
+ /@symbols/,
1094
+ {
1095
+ cases: {
1096
+ "@operators": "operator",
1097
+ "@default": ""
1098
+ }
879
1099
  }
880
- }],
1100
+ ],
881
1101
  // Whitespace
882
1102
  [/[ \t\r\n]+/, "white"]
883
1103
  ],
884
1104
  comment: [
885
- [/[^\/*]+/, "comment"],
1105
+ [/[^/*]+/, "comment"],
886
1106
  [/\*\//, "comment", "@pop"],
887
- [/[\/*]/, "comment"]
1107
+ [/[/*]/, "comment"]
888
1108
  ],
889
1109
  string: [
890
1110
  [/[^\\"]+/, "string"],
@@ -970,6 +1190,8 @@ Attributes: ${component.attributes.join(", ")}
970
1190
  valueInfo = "Type: boolean (can be omitted)";
971
1191
  } else if (attribute.type === "enum" && attribute.values) {
972
1192
  valueInfo = `Values: ${attribute.values.join(" | ")}`;
1193
+ } else if (attribute.type === "function") {
1194
+ valueInfo = `Functional shorthand. Example: ${attribute.example}`;
973
1195
  }
974
1196
  return {
975
1197
  range: new monaco.Range(
@@ -1058,6 +1280,7 @@ function createCompletionProvider(monaco) {
1058
1280
  });
1059
1281
  });
1060
1282
  } else if (attr?.type === "number") {
1283
+ ;
1061
1284
  [1, 2, 3, 4, 5, 6, 8, 10, 12, 16].forEach((n) => {
1062
1285
  suggestions.push({
1063
1286
  label: String(n),
@@ -1108,6 +1331,8 @@ function createCompletionProvider(monaco) {
1108
1331
  insertText = `${attr.name}=$1`;
1109
1332
  } else if (attr.type === "enum") {
1110
1333
  insertText = `${attr.name}=$1`;
1334
+ } else if (attr.type === "function") {
1335
+ insertText = `${attr.name}($1, $2)`;
1111
1336
  }
1112
1337
  suggestions.push({
1113
1338
  label: attr.name,
@@ -1130,6 +1355,8 @@ Example: ${attr.example}` : "")
1130
1355
  insertText = `${attr.name}=$1`;
1131
1356
  } else if (attr.type === "enum") {
1132
1357
  insertText = `${attr.name}=$1`;
1358
+ } else if (attr.type === "function") {
1359
+ insertText = `${attr.name}($1, $2)`;
1133
1360
  }
1134
1361
  suggestions.push({
1135
1362
  label: attr.name,
@@ -1179,7 +1406,7 @@ var MarkerSeverity = {
1179
1406
  function validateCode(text) {
1180
1407
  const markers = [];
1181
1408
  const lines = text.split("\n");
1182
- let braceStack = [];
1409
+ const braceStack = [];
1183
1410
  let hasPage = false;
1184
1411
  for (let i = 0; i < lines.length; i++) {
1185
1412
  const line = lines[i];