@aestheticfunction/dspack-emit 0.5.0 → 0.7.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 (39) hide show
  1. package/README.md +5 -3
  2. package/dist/targets/a2ui/surface.js +580 -36
  3. package/dist/transform/mapping.js +21 -7
  4. package/dist/transform/model.d.ts +94 -1
  5. package/dist/transform/model.js +25 -4
  6. package/dist/transform/parse-v2.d.ts +55 -24
  7. package/dist/transform/parse-v2.js +176 -2
  8. package/dist/transform/profile-schema-v2.js +224 -46
  9. package/dist/transform/shadcn-v2-respelling.d.ts +65 -0
  10. package/dist/transform/shadcn-v2-respelling.js +407 -0
  11. package/dist/transform/validate-v2.js +39 -3
  12. package/dist/types.d.ts +5 -1
  13. package/dist/validate/ajv.d.ts +19 -0
  14. package/dist/validate/ajv.js +78 -13
  15. package/package.json +6 -2
  16. package/src/a0.test.ts +235 -0
  17. package/src/engine-boundary.test.ts +10 -0
  18. package/src/eval-fixture.test.ts +27 -14
  19. package/src/instance-diagnostics.test.ts +194 -0
  20. package/src/layered-dissolution.test.ts +139 -0
  21. package/src/profile-v2.test.ts +9 -3
  22. package/src/review-findings.test.ts +4 -1
  23. package/src/surface-emit.test.ts +43 -11
  24. package/src/surface-fidelity.test.ts +12 -0
  25. package/src/t1.test.ts +370 -0
  26. package/src/t2.test.ts +222 -0
  27. package/src/t3.test.ts +304 -0
  28. package/src/t4.test.ts +278 -0
  29. package/src/targets/a2ui/surface.ts +747 -72
  30. package/src/transform/mapping.ts +22 -6
  31. package/src/transform/model.ts +107 -5
  32. package/src/transform/parse-v2.ts +228 -17
  33. package/src/transform/profile-schema-v2.ts +224 -46
  34. package/src/transform/profile.v2.schema.json +224 -46
  35. package/src/transform/shadcn-v2-respelling.ts +414 -0
  36. package/src/transform/validate-v2.ts +39 -3
  37. package/src/types.ts +13 -1
  38. package/src/validate/ajv.ts +96 -12
  39. package/src/validate-v2.test.ts +1 -1
@@ -300,6 +300,44 @@ export const profileSchemaV2 = {
300
300
  "^x-": {}
301
301
  },
302
302
  "properties": {
303
+ "transparent": {
304
+ "oneOf": [
305
+ {
306
+ "const": true
307
+ },
308
+ {
309
+ "type": "object",
310
+ "additionalProperties": false,
311
+ "required": [
312
+ "donate"
313
+ ],
314
+ "properties": {
315
+ "donate": {
316
+ "type": "array",
317
+ "minItems": 1,
318
+ "items": {
319
+ "type": "object",
320
+ "additionalProperties": false,
321
+ "required": [
322
+ "from",
323
+ "to"
324
+ ],
325
+ "properties": {
326
+ "from": {
327
+ "type": "string",
328
+ "pattern": "^(self\\.text|sub\\([a-z][a-z0-9-]*(\\|[a-z][a-z0-9-]*)*\\)\\.text)$"
329
+ },
330
+ "to": {
331
+ "type": "string",
332
+ "pattern": "^prop:[A-Za-z][A-Za-z0-9]*$"
333
+ }
334
+ }
335
+ }
336
+ }
337
+ }
338
+ }
339
+ ]
340
+ },
303
341
  "routes": {
304
342
  "type": "array",
305
343
  "items": {
@@ -316,7 +354,7 @@ export const profileSchemaV2 = {
316
354
  "description": "Ordered fallback chain; the first selector that yields a value wins.",
317
355
  "items": {
318
356
  "type": "string",
319
- "pattern": "^(self\\.text|self\\.props\\.[A-Za-z][A-Za-z0-9]*|sub\\([a-z][a-z0-9-]*(\\|[a-z][a-z0-9-]*)*\\)\\.(text|label|firstText|subtreeText)|children|synthesized\\.action)$"
357
+ "pattern": "^(self\\.text|self\\.props\\.[A-Za-z][A-Za-z0-9]*|sub\\([a-z][a-z0-9-]*(\\|[a-z][a-z0-9-]*)*\\)\\.(text|label|firstText|subtreeText|children)|children|synthesized\\.action)$"
320
358
  }
321
359
  },
322
360
  "to": {
@@ -332,55 +370,148 @@ export const profileSchemaV2 = {
332
370
  "collects": {
333
371
  "type": "array",
334
372
  "items": {
335
- "type": "object",
336
- "additionalProperties": false,
337
- "required": [
338
- "of",
339
- "into",
340
- "shape",
341
- "row",
342
- "cells"
343
- ],
344
- "properties": {
345
- "of": {
346
- "type": "array",
347
- "minItems": 1,
348
- "items": {
349
- "type": "string",
350
- "pattern": "^[a-z][a-z0-9-]*$"
351
- }
352
- },
353
- "into": {
354
- "type": "string",
355
- "pattern": "^prop:[A-Za-z][A-Za-z0-9]*$"
356
- },
357
- "shape": {
358
- "enum": [
359
- "flat",
360
- "records"
361
- ]
362
- },
363
- "field": {
364
- "type": "string",
365
- "pattern": "^[A-Za-z][A-Za-z0-9]*$"
366
- },
367
- "row": {
368
- "type": "array",
369
- "minItems": 1,
370
- "items": {
371
- "type": "string",
372
- "pattern": "^[a-z][a-z0-9-]*$"
373
+ "oneOf": [
374
+ {
375
+ "type": "object",
376
+ "additionalProperties": false,
377
+ "required": [
378
+ "of",
379
+ "into",
380
+ "item"
381
+ ],
382
+ "properties": {
383
+ "of": {
384
+ "type": "array",
385
+ "minItems": 1,
386
+ "items": {
387
+ "type": "string",
388
+ "pattern": "^[a-z][a-z0-9-]*$"
389
+ }
390
+ },
391
+ "into": {
392
+ "type": "string",
393
+ "pattern": "^prop:[A-Za-z][A-Za-z0-9]*$"
394
+ },
395
+ "item": {
396
+ "type": "object",
397
+ "minProperties": 1,
398
+ "propertyNames": {
399
+ "pattern": "^[A-Za-z][A-Za-z0-9]*$"
400
+ },
401
+ "additionalProperties": {
402
+ "type": "string",
403
+ "pattern": "^(self\\.text|self\\.id|self\\.props\\.[A-Za-z][A-Za-z0-9]*)$"
404
+ },
405
+ "description": "T2 item-mode: one record per matching descendant; fields resolve on the item's own node (self.text, self.props.<prop>, self.id). Joins and sibling reads are T3."
406
+ },
407
+ "join": {
408
+ "type": "object",
409
+ "additionalProperties": false,
410
+ "required": [
411
+ "with",
412
+ "on",
413
+ "fields"
414
+ ],
415
+ "properties": {
416
+ "with": {
417
+ "type": "array",
418
+ "minItems": 1,
419
+ "items": {
420
+ "type": "string",
421
+ "pattern": "^[a-z][a-z0-9-]*$"
422
+ }
423
+ },
424
+ "on": {
425
+ "type": "object",
426
+ "additionalProperties": false,
427
+ "required": [
428
+ "left",
429
+ "right"
430
+ ],
431
+ "properties": {
432
+ "left": {
433
+ "type": "string",
434
+ "pattern": "^(self\\.text|self\\.id|self\\.props\\.[A-Za-z][A-Za-z0-9]*)$"
435
+ },
436
+ "right": {
437
+ "type": "string",
438
+ "pattern": "^(self\\.text|self\\.id|self\\.props\\.[A-Za-z][A-Za-z0-9]*)$"
439
+ }
440
+ }
441
+ },
442
+ "fields": {
443
+ "type": "object",
444
+ "minProperties": 1,
445
+ "propertyNames": {
446
+ "pattern": "^[A-Za-z][A-Za-z0-9]*$"
447
+ },
448
+ "additionalProperties": {
449
+ "type": "string",
450
+ "pattern": "^(children|self\\.text|self\\.id|self\\.props\\.[A-Za-z][A-Za-z0-9]*)$"
451
+ },
452
+ "description": "Record fields sourced from the JOINED side \u2014 item-local selectors, or the literal \"children\" for the slot-valued field (the counterpart's children emit as instances; the record carries the reference)."
453
+ },
454
+ "optional": {
455
+ "type": "boolean",
456
+ "description": "0..1 counterparts allowed when true; exactly one required otherwise."
457
+ }
458
+ },
459
+ "description": "T3 declared key join onto a sibling sub-family. The profile names the relation; the emitter never infers one \u2014 no positional pairing, no nearest-sibling, no similarity."
460
+ }
373
461
  }
374
462
  },
375
- "cells": {
376
- "type": "array",
377
- "minItems": 1,
378
- "items": {
379
- "type": "string",
380
- "pattern": "^[a-z][a-z0-9-]*$"
463
+ {
464
+ "type": "object",
465
+ "additionalProperties": false,
466
+ "required": [
467
+ "of",
468
+ "into",
469
+ "shape",
470
+ "row",
471
+ "cells"
472
+ ],
473
+ "properties": {
474
+ "of": {
475
+ "type": "array",
476
+ "minItems": 1,
477
+ "items": {
478
+ "type": "string",
479
+ "pattern": "^[a-z][a-z0-9-]*$"
480
+ }
481
+ },
482
+ "into": {
483
+ "type": "string",
484
+ "pattern": "^prop:[A-Za-z][A-Za-z0-9]*$"
485
+ },
486
+ "shape": {
487
+ "enum": [
488
+ "flat",
489
+ "records"
490
+ ]
491
+ },
492
+ "field": {
493
+ "type": "string",
494
+ "pattern": "^[A-Za-z][A-Za-z0-9]*$"
495
+ },
496
+ "row": {
497
+ "type": "array",
498
+ "minItems": 1,
499
+ "items": {
500
+ "type": "string",
501
+ "pattern": "^[a-z][a-z0-9-]*$"
502
+ }
503
+ },
504
+ "cells": {
505
+ "type": "array",
506
+ "minItems": 1,
507
+ "items": {
508
+ "type": "string",
509
+ "pattern": "^[a-z][a-z0-9-]*$"
510
+ }
511
+ }
381
512
  }
382
513
  }
383
- }
514
+ ]
384
515
  }
385
516
  },
386
517
  "subs": {
@@ -393,6 +524,53 @@ export const profileSchemaV2 = {
393
524
  {
394
525
  "const": "transparent"
395
526
  },
527
+ {
528
+ "type": "object",
529
+ "additionalProperties": false,
530
+ "required": [
531
+ "transparent"
532
+ ],
533
+ "properties": {
534
+ "transparent": {
535
+ "oneOf": [
536
+ {
537
+ "const": true
538
+ },
539
+ {
540
+ "type": "object",
541
+ "additionalProperties": false,
542
+ "required": [
543
+ "donate"
544
+ ],
545
+ "properties": {
546
+ "donate": {
547
+ "type": "array",
548
+ "minItems": 1,
549
+ "items": {
550
+ "type": "object",
551
+ "additionalProperties": false,
552
+ "required": [
553
+ "from",
554
+ "to"
555
+ ],
556
+ "properties": {
557
+ "from": {
558
+ "type": "string",
559
+ "pattern": "^(self\\.text|sub\\([a-z][a-z0-9-]*(\\|[a-z][a-z0-9-]*)*\\)\\.text)$"
560
+ },
561
+ "to": {
562
+ "type": "string",
563
+ "pattern": "^prop:[A-Za-z][A-Za-z0-9]*$"
564
+ }
565
+ }
566
+ }
567
+ }
568
+ }
569
+ }
570
+ ]
571
+ }
572
+ }
573
+ },
396
574
  {
397
575
  "type": "object",
398
576
  "additionalProperties": false,
@@ -10,3 +10,68 @@
10
10
  */
11
11
  import type { SurfaceV2 } from "./parse-v2.js";
12
12
  export declare const SHADCN_V2_SURFACES: Record<string, SurfaceV2>;
13
+ /**
14
+ * T1 resolutions for the production v3 contract — the transparent-identity
15
+ * spellings proven by src/t1.test.ts against the named production failure
16
+ * (`card > form > form-field > form-item > form-label + input`). Consumed by
17
+ * the eval fixture builder as committed mapping evidence; the fixture's other
18
+ * unresolved decisions stay deliberately open.
19
+ */
20
+ export declare const SHADCN_V3_T1_SURFACES: Record<string, SurfaceV2>;
21
+ /**
22
+ * T2 resolutions for the production v3 contract — item-mode collection
23
+ * spellings proven by src/t2.test.ts. `radio-group` collects what each item
24
+ * itself carries ({value: self.id}); its htmlFor-joined sibling labels are
25
+ * the measured T3 frontier, dropped with record until declared joins land.
26
+ * `select` is the pure homogeneous shape ({label: self.text}).
27
+ *
28
+ * Each entry carries the full receiving plan (structural options schema) —
29
+ * unlike T1's transparent plans, a collecting plan IS a catalog component.
30
+ */
31
+ export declare const SHADCN_V3_T3_PLANS: Record<string, Record<string, unknown>>;
32
+ export declare const SHADCN_V3_T2_PLANS: Record<string, Record<string, unknown>>;
33
+ /**
34
+ * A0 authoring resolutions (the zero-new-capability milestone): production
35
+ * profile judgment for the families the shipped Identity/Routing/Repetition
36
+ * model already supports, proven by src/a0.test.ts. Six compound plans plus
37
+ * label-slot additions on the five controls that appear as a field's single
38
+ * control (the T1 donation destination). No new primitive anywhere.
39
+ *
40
+ * Grounded in measured usage across the 14 worked examples (contract 3.2.0):
41
+ * alert-title 5/5 + alert-description 5/5 carry the content; avatar-fallback
42
+ * carries text while avatar-image is an EMPTY node (the contract declares no
43
+ * src/alt — the dspack#39 class, recorded on the drop); scroll-area's two
44
+ * subs are scrollbar chrome; the field family follows the corrected
45
+ * declaration (dspack#40) with field as its own donating boundary.
46
+ */
47
+ export declare const SHADCN_V3_A0_PLANS: Record<string, Record<string, unknown>>;
48
+ /**
49
+ * A0 label additions: the five controls that appear as a field's (or
50
+ * form-item's) single control across the worked examples — input already
51
+ * declares `label`; these gain the same structural slot so the T1 donation
52
+ * has a declared destination. Merged onto the scaffolded plans (select's T2
53
+ * plan) by the fixture builder; nothing else on those plans changes.
54
+ */
55
+ export declare const SHADCN_V3_A0_LABEL_ADDITIONS: Record<string, {
56
+ description: string;
57
+ synthNote: string;
58
+ }>;
59
+ /**
60
+ * T4 resolutions: multi-slot compounds, proven by src/t4.test.ts. The new
61
+ * primitive is ONE closed spelling — `sub(x).children -> slot:name` — the
62
+ * region's ordered children emitted as instances, the slot carrying the
63
+ * reference (multi wraps in Column, exactly like T3's joined-children).
64
+ *
65
+ * Measured shapes (contract 3.2.0 worked examples):
66
+ * - dialog/sheet: trigger and close labels are TEXT lifts (the alert-dialog
67
+ * idiom); title/description lift; header dissolves; content minus the
68
+ * claimed regions is the body slot; footer minus close is the footer slot.
69
+ * - popover: same family; its measured body is EMPTY after the header
70
+ * dissolves — the slot stays absent and gate A3 arbitrates. The unused
71
+ * popover-anchor drops pending usage evidence.
72
+ * - dropdown-menu is DATA-shaped, not slot-shaped: its items are a T2
73
+ * item-mode collect and its labels are scalar text routes — resolved with
74
+ * ZERO new primitive. The historic taxonomy called it T4; measurement
75
+ * says otherwise, and the plan follows the measurement.
76
+ */
77
+ export declare const SHADCN_V3_T4_PLANS: Record<string, Record<string, unknown>>;