@aestheticfunction/dspack-emit 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +16 -6
  2. package/dist/cli.js +56 -0
  3. package/dist/index.d.ts +4 -1
  4. package/dist/index.js +3 -1
  5. package/dist/targets/a2ui/diagnostics.d.ts +110 -0
  6. package/dist/targets/a2ui/diagnostics.js +94 -0
  7. package/dist/targets/a2ui/surface.d.ts +28 -9
  8. package/dist/targets/a2ui/surface.js +566 -224
  9. package/dist/transform/desugar.d.ts +32 -0
  10. package/dist/transform/desugar.js +156 -0
  11. package/dist/transform/emit.js +59 -0
  12. package/dist/transform/index.js +4 -0
  13. package/dist/transform/mapping.d.ts +0 -6
  14. package/dist/transform/mapping.js +50 -0
  15. package/dist/transform/model.d.ts +275 -0
  16. package/dist/transform/model.js +148 -0
  17. package/dist/transform/parse-v2.d.ts +78 -0
  18. package/dist/transform/parse-v2.js +305 -0
  19. package/dist/transform/profile-load.d.ts +8 -7
  20. package/dist/transform/profile-load.js +101 -24
  21. package/dist/transform/profile-schema-v2.d.ts +9 -0
  22. package/dist/transform/profile-schema-v2.js +430 -0
  23. package/dist/transform/profile-schema.d.ts +8 -0
  24. package/dist/transform/profile-schema.js +382 -0
  25. package/dist/transform/profiles.d.ts +31 -1
  26. package/dist/transform/scaffold.d.ts +29 -12
  27. package/dist/transform/scaffold.js +91 -31
  28. package/dist/transform/shadcn-v2-respelling.d.ts +12 -0
  29. package/dist/transform/shadcn-v2-respelling.js +49 -0
  30. package/dist/transform/validate-v2.d.ts +36 -0
  31. package/dist/transform/validate-v2.js +100 -0
  32. package/dist/types.d.ts +19 -0
  33. package/dist/validate/ajv.js +98 -29
  34. package/dist/validate/meta/catalog-meta.d.ts +10 -0
  35. package/dist/validate/meta/catalog-meta.js +157 -0
  36. package/package.json +3 -3
  37. package/src/__snapshots__/byte-neutral.test.ts.snap +66 -0
  38. package/src/browser-boundary.test.ts +47 -0
  39. package/src/byte-neutral.test.ts +246 -0
  40. package/src/cli.ts +60 -0
  41. package/src/dangling-ref.test.ts +118 -0
  42. package/src/desugar.test.ts +162 -0
  43. package/src/engine-boundary.test.ts +248 -0
  44. package/src/eval-fixture.test.ts +89 -0
  45. package/src/functions.test.ts +182 -0
  46. package/src/index.ts +4 -1
  47. package/src/profile-load.test.ts +99 -1
  48. package/src/profile-v2.test.ts +363 -0
  49. package/src/review-findings.test.ts +292 -0
  50. package/src/schema-mirrors.test.ts +35 -0
  51. package/src/surface-fidelity.test.ts +213 -0
  52. package/src/targets/a2ui/diagnostics.ts +136 -0
  53. package/src/targets/a2ui/surface.ts +920 -242
  54. package/src/transform/desugar.ts +194 -0
  55. package/src/transform/emit.ts +65 -0
  56. package/src/transform/index.ts +5 -0
  57. package/src/transform/mapping.ts +42 -0
  58. package/src/transform/model.ts +325 -0
  59. package/src/transform/parse-v2.ts +397 -0
  60. package/src/transform/profile-load.ts +107 -28
  61. package/src/transform/profile-schema-v2.ts +430 -0
  62. package/src/transform/profile-schema.ts +382 -0
  63. package/src/transform/profile.v2.schema.json +422 -0
  64. package/src/transform/profiles.ts +32 -1
  65. package/src/transform/scaffold.ts +124 -47
  66. package/src/transform/shadcn-v2-respelling.ts +61 -0
  67. package/src/transform/validate-v2.ts +138 -0
  68. package/src/types.ts +20 -0
  69. package/src/validate/ajv.ts +91 -32
  70. package/src/validate/meta/catalog-meta.ts +167 -0
  71. package/src/validate-v2.test.ts +173 -0
  72. package/dist/transform/profile.v1.schema.json +0 -153
  73. package/dist/validate/meta/a2ui-catalog.meta.0_9_1.json +0 -39
  74. package/dist/validate/meta/a2ui-catalog.meta.1_0.json +0 -34
@@ -0,0 +1,382 @@
1
+ /**
2
+ * Runtime mirror of profile.v1.schema.json. The .json file stays the
3
+ * reviewable schema document (docs/PROFILES.md links it); this constant
4
+ * exists because loadProfile must run in a browser bundle (dspack-studio
5
+ * composer), where readFileSync is not available. src/schema-mirrors.test.ts
6
+ * asserts mirror and JSON stay identical — edit both together.
7
+ */
8
+ export const profileSchema: Record<string, unknown> = {
9
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
10
+ "$id": "https://aestheticfunction.github.io/dspack-emit/schema/profile.v1.schema.json",
11
+ "title": "dspack-emit a2ui Profile v1",
12
+ "description": "JSON form of the a2ui target's mapping Profile. Mirrors the TypeScript Profile interface in src/transform/profiles.ts one to one; loadProfile() validates against this schema before the engine runs.",
13
+ "type": "object",
14
+ "additionalProperties": false,
15
+ "patternProperties": {
16
+ "^x-": {}
17
+ },
18
+ "required": [
19
+ "profileVersion",
20
+ "catalogTitle",
21
+ "catalogDescription",
22
+ "catalogIdBase",
23
+ "instructions",
24
+ "primaryColorToken",
25
+ "components",
26
+ "synthesized",
27
+ "casualtyComponents",
28
+ "surfaceSynthesis"
29
+ ],
30
+ "properties": {
31
+ "profileVersion": {
32
+ "const": "1"
33
+ },
34
+ "catalogTitle": {
35
+ "type": "string",
36
+ "minLength": 1
37
+ },
38
+ "catalogDescription": {
39
+ "type": "string",
40
+ "minLength": 1
41
+ },
42
+ "catalogIdBase": {
43
+ "type": "string",
44
+ "format": "uri",
45
+ "pattern": "^https://"
46
+ },
47
+ "instructions": {
48
+ "type": "string"
49
+ },
50
+ "primaryColorToken": {
51
+ "type": "object",
52
+ "additionalProperties": false,
53
+ "required": [
54
+ "category",
55
+ "name"
56
+ ],
57
+ "properties": {
58
+ "category": {
59
+ "type": "string",
60
+ "minLength": 1
61
+ },
62
+ "name": {
63
+ "type": "string",
64
+ "minLength": 1
65
+ }
66
+ }
67
+ },
68
+ "components": {
69
+ "type": "array",
70
+ "items": {
71
+ "$ref": "#/$defs/componentPlan"
72
+ }
73
+ },
74
+ "synthesized": {
75
+ "type": "array",
76
+ "items": {
77
+ "$ref": "#/$defs/componentPlan"
78
+ }
79
+ },
80
+ "casualtyComponents": {
81
+ "type": "array",
82
+ "items": {
83
+ "type": "object",
84
+ "additionalProperties": false,
85
+ "patternProperties": {
86
+ "^x-": {}
87
+ },
88
+ "required": [
89
+ "dspackId",
90
+ "attempted",
91
+ "class",
92
+ "reason"
93
+ ],
94
+ "properties": {
95
+ "dspackId": {
96
+ "$ref": "#/$defs/dspackId"
97
+ },
98
+ "attempted": {
99
+ "type": "string",
100
+ "minLength": 1
101
+ },
102
+ "class": {
103
+ "enum": [
104
+ "maps-cleanly",
105
+ "synthesis-defaults",
106
+ "lossy",
107
+ "cannot-represent"
108
+ ]
109
+ },
110
+ "reason": {
111
+ "type": "string",
112
+ "minLength": 1
113
+ }
114
+ }
115
+ }
116
+ },
117
+ "intentionallyOmitted": {
118
+ "type": "array",
119
+ "items": {
120
+ "$ref": "#/$defs/dspackId"
121
+ }
122
+ },
123
+ "surfaceSynthesis": {
124
+ "type": "object",
125
+ "additionalProperties": false,
126
+ "required": [
127
+ "textComponent",
128
+ "textProp",
129
+ "wrapComponent",
130
+ "wrapChildrenProp"
131
+ ],
132
+ "properties": {
133
+ "textComponent": {
134
+ "$ref": "#/$defs/a2uiName"
135
+ },
136
+ "textProp": {
137
+ "type": "string",
138
+ "minLength": 1
139
+ },
140
+ "wrapComponent": {
141
+ "$ref": "#/$defs/a2uiName"
142
+ },
143
+ "wrapChildrenProp": {
144
+ "type": "string",
145
+ "minLength": 1
146
+ }
147
+ }
148
+ }
149
+ },
150
+ "$defs": {
151
+ "dspackId": {
152
+ "type": "string",
153
+ "pattern": "^[a-z][a-z0-9-]*$"
154
+ },
155
+ "a2uiName": {
156
+ "type": "string",
157
+ "pattern": "^[A-Z][A-Za-z0-9]*$"
158
+ },
159
+ "componentPlan": {
160
+ "type": "object",
161
+ "additionalProperties": false,
162
+ "patternProperties": {
163
+ "^x-": {}
164
+ },
165
+ "required": [
166
+ "a2ui",
167
+ "commons",
168
+ "structural",
169
+ "required"
170
+ ],
171
+ "properties": {
172
+ "a2ui": {
173
+ "$ref": "#/$defs/a2uiName"
174
+ },
175
+ "dspackId": {
176
+ "$ref": "#/$defs/dspackId"
177
+ },
178
+ "description": {
179
+ "type": "string"
180
+ },
181
+ "commons": {
182
+ "type": "array",
183
+ "items": {
184
+ "type": "string",
185
+ "minLength": 1
186
+ }
187
+ },
188
+ "structural": {
189
+ "type": "object",
190
+ "additionalProperties": {
191
+ "type": "object",
192
+ "additionalProperties": false,
193
+ "required": [
194
+ "schema",
195
+ "description",
196
+ "synthNote"
197
+ ],
198
+ "properties": {
199
+ "schema": {},
200
+ "description": {
201
+ "type": "string",
202
+ "minLength": 1
203
+ },
204
+ "synthNote": {
205
+ "type": "string",
206
+ "minLength": 1
207
+ }
208
+ }
209
+ }
210
+ },
211
+ "propMap": {
212
+ "type": "object",
213
+ "additionalProperties": {
214
+ "type": "object",
215
+ "additionalProperties": false,
216
+ "required": [
217
+ "a2ui",
218
+ "kind"
219
+ ],
220
+ "properties": {
221
+ "a2ui": {
222
+ "type": "string",
223
+ "minLength": 1
224
+ },
225
+ "kind": {
226
+ "enum": [
227
+ "enum",
228
+ "string",
229
+ "boolean",
230
+ "number"
231
+ ]
232
+ },
233
+ "targetEnum": {
234
+ "type": "array",
235
+ "items": {
236
+ "type": "string"
237
+ },
238
+ "minItems": 1
239
+ },
240
+ "valueMap": {
241
+ "type": "object",
242
+ "additionalProperties": {
243
+ "type": "string"
244
+ }
245
+ },
246
+ "default": {
247
+ "type": "string"
248
+ },
249
+ "description": {
250
+ "type": "string"
251
+ }
252
+ }
253
+ }
254
+ },
255
+ "required": {
256
+ "type": "array",
257
+ "items": {
258
+ "type": "string"
259
+ }
260
+ },
261
+ "surfacePlan": {
262
+ "type": "object",
263
+ "additionalProperties": false,
264
+ "properties": {
265
+ "subText": {
266
+ "type": "object",
267
+ "additionalProperties": {
268
+ "type": "string"
269
+ }
270
+ },
271
+ "subButtonText": {
272
+ "type": "object",
273
+ "additionalProperties": {
274
+ "type": "string"
275
+ }
276
+ },
277
+ "actionProp": {
278
+ "type": "string"
279
+ },
280
+ "textChildProp": {
281
+ "type": "string"
282
+ },
283
+ "textProp": {
284
+ "type": "string"
285
+ },
286
+ "childProp": {
287
+ "type": "string"
288
+ },
289
+ "childrenProp": {
290
+ "type": "string"
291
+ },
292
+ "structuralPassthrough": {
293
+ "type": "array",
294
+ "items": {
295
+ "type": "string"
296
+ }
297
+ },
298
+ "subTable": {
299
+ "type": "object",
300
+ "additionalProperties": false,
301
+ "required": [
302
+ "caption",
303
+ "header",
304
+ "headerCell",
305
+ "body",
306
+ "row",
307
+ "cell",
308
+ "targetCaption",
309
+ "targetColumns",
310
+ "targetRows",
311
+ "drops"
312
+ ],
313
+ "properties": {
314
+ "caption": {
315
+ "type": "string"
316
+ },
317
+ "header": {
318
+ "type": "string"
319
+ },
320
+ "headerCell": {
321
+ "type": "string"
322
+ },
323
+ "body": {
324
+ "type": "string"
325
+ },
326
+ "row": {
327
+ "type": "string"
328
+ },
329
+ "cell": {
330
+ "type": "string"
331
+ },
332
+ "targetCaption": {
333
+ "type": "string"
334
+ },
335
+ "targetColumns": {
336
+ "type": "string"
337
+ },
338
+ "targetRows": {
339
+ "type": "string"
340
+ },
341
+ "drops": {
342
+ "type": "object",
343
+ "additionalProperties": {
344
+ "type": "string"
345
+ }
346
+ }
347
+ }
348
+ },
349
+ "subFlatten": {
350
+ "type": "object",
351
+ "additionalProperties": false,
352
+ "required": [
353
+ "transparent",
354
+ "asText"
355
+ ],
356
+ "properties": {
357
+ "transparent": {
358
+ "type": "array",
359
+ "items": {
360
+ "$ref": "#/$defs/dspackId"
361
+ }
362
+ },
363
+ "asText": {
364
+ "type": "object",
365
+ "additionalProperties": {
366
+ "type": "string"
367
+ }
368
+ }
369
+ }
370
+ }
371
+ }
372
+ },
373
+ "subCoverage": {
374
+ "type": "object",
375
+ "additionalProperties": {
376
+ "type": "string"
377
+ }
378
+ }
379
+ }
380
+ }
381
+ }
382
+ };