@1agh/maude 1.4.6 → 1.5.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.
Files changed (100) hide show
  1. package/apps/studio/annotations/ai-read.ts +288 -0
  2. package/apps/studio/annotations/ai-write.ts +534 -0
  3. package/apps/studio/annotations/board-io.ts +94 -0
  4. package/apps/studio/annotations/board-text.ts +45 -0
  5. package/apps/studio/annotations/constants.ts +58 -0
  6. package/apps/studio/annotations/elements/_shared.ts +125 -0
  7. package/apps/studio/annotations/elements/arrow.model.ts +196 -0
  8. package/apps/studio/annotations/elements/media.model.ts +79 -0
  9. package/apps/studio/annotations/elements/pen.model.ts +82 -0
  10. package/apps/studio/annotations/elements/section.model.ts +70 -0
  11. package/apps/studio/annotations/elements/shape.model.ts +141 -0
  12. package/apps/studio/annotations/elements/sticky.model.ts +48 -0
  13. package/apps/studio/annotations/elements/text.model.ts +52 -0
  14. package/apps/studio/annotations/fields.ts +347 -0
  15. package/apps/studio/annotations/fractional-index.ts +234 -0
  16. package/apps/studio/annotations/legacy/mini-dom.ts +207 -0
  17. package/apps/studio/annotations/migrate-boot.ts +172 -0
  18. package/apps/studio/annotations/migrate-cli.ts +37 -0
  19. package/apps/studio/annotations/migrate-v1.ts +383 -0
  20. package/apps/studio/annotations/ops-merge.ts +15 -0
  21. package/apps/studio/annotations/ops.ts +499 -0
  22. package/apps/studio/annotations/registry.ts +159 -0
  23. package/apps/studio/annotations/replica.ts +264 -0
  24. package/apps/studio/annotations/scene.ts +235 -0
  25. package/apps/studio/annotations/schema.ts +188 -0
  26. package/apps/studio/annotations/types.ts +77 -0
  27. package/apps/studio/annotations/ui/board.ts +126 -0
  28. package/apps/studio/annotations/ui/containment.ts +118 -0
  29. package/apps/studio/annotations/ui/edit-actions.ts +551 -0
  30. package/apps/studio/annotations/ui/editor-channel.ts +62 -0
  31. package/apps/studio/annotations/ui/element-node.tsx +993 -0
  32. package/apps/studio/annotations/ui/pipeline-context.ts +17 -0
  33. package/apps/studio/annotations/ui/pointer-pipeline.ts +150 -0
  34. package/apps/studio/annotations/ui/render-model.ts +264 -0
  35. package/apps/studio/annotations/ui/scene.tsx +63 -0
  36. package/apps/studio/annotations/ui/text-editor.tsx +420 -0
  37. package/apps/studio/annotations/ui/text-session.ts +140 -0
  38. package/apps/studio/annotations/ui/text-style.ts +111 -0
  39. package/apps/studio/annotations/ui/world.ts +47 -0
  40. package/apps/studio/annotations/v1-adapter.ts +428 -0
  41. package/apps/studio/annotations-align.ts +21 -6
  42. package/apps/studio/annotations-bindings.ts +2 -0
  43. package/apps/studio/annotations-context-toolbar.tsx +9 -13
  44. package/apps/studio/annotations-groups.ts +3 -0
  45. package/apps/studio/annotations-layer.tsx +923 -1925
  46. package/apps/studio/annotations-model.ts +65 -4
  47. package/apps/studio/annotations-sync.ts +4 -47
  48. package/apps/studio/api.ts +249 -69
  49. package/apps/studio/bin/_import-figma.mjs +22 -12
  50. package/apps/studio/bin/annotate.mjs +331 -838
  51. package/apps/studio/bin/annotate.sh +4 -4
  52. package/apps/studio/bin/perf.sh +21 -7
  53. package/apps/studio/bin/read-annotations.mjs +184 -666
  54. package/apps/studio/bin/read-annotations.sh +9 -5
  55. package/apps/studio/canvas-artifacts.ts +9 -0
  56. package/apps/studio/canvas-lib.tsx +13 -1
  57. package/apps/studio/canvas-shell.tsx +6 -0
  58. package/apps/studio/client/app.jsx +98 -35
  59. package/apps/studio/client/hmr.mjs +1 -1
  60. package/apps/studio/client/panels/git-grouping.js +2 -2
  61. package/apps/studio/client/tree-expansion.js +217 -0
  62. package/apps/studio/collab/index.ts +49 -5
  63. package/apps/studio/collab/persistence.ts +31 -10
  64. package/apps/studio/collab/registry.ts +64 -26
  65. package/apps/studio/commands/annotation-ops-command.ts +72 -0
  66. package/apps/studio/cursors-overlay.tsx +158 -4
  67. package/apps/studio/dist/client.bundle.js +850 -850
  68. package/apps/studio/dist/comment-mount.js +2 -2
  69. package/apps/studio/figma/to-strokes.ts +31 -10
  70. package/apps/studio/git/endpoints.ts +1 -1
  71. package/apps/studio/git/service.ts +1 -1
  72. package/apps/studio/git/watch.ts +1 -1
  73. package/apps/studio/http.ts +90 -15
  74. package/apps/studio/server.ts +16 -0
  75. package/apps/studio/sync/accepted-cold-start.ts +12 -4
  76. package/apps/studio/sync/agent.ts +8 -4
  77. package/apps/studio/sync/codec.ts +96 -40
  78. package/apps/studio/sync/file-membership.ts +12 -2
  79. package/apps/studio/sync/file-plane.ts +1 -1
  80. package/apps/studio/sync/index.ts +38 -16
  81. package/apps/studio/sync/journal-client.ts +5 -0
  82. package/apps/studio/sync/limits.ts +7 -2
  83. package/apps/studio/sync/migrate-seed.ts +8 -5
  84. package/apps/studio/sync/projection.ts +7 -2
  85. package/apps/studio/sync/remote-docs.ts +34 -0
  86. package/apps/studio/sync/writer-registry.ts +10 -0
  87. package/apps/studio/text-caret.ts +11 -2
  88. package/apps/studio/tree-state.ts +45 -0
  89. package/apps/studio/undo-stack.ts +2 -2
  90. package/apps/studio/use-annotation-resize.tsx +48 -23
  91. package/apps/studio/use-annotation-selection.tsx +9 -2
  92. package/apps/studio/use-collab.tsx +76 -0
  93. package/apps/studio/whats-new.json +27 -0
  94. package/cli/lib/design-link.mjs +5 -1
  95. package/cli/lib/gitignore-block.mjs +1 -1
  96. package/cli/lib/gitignore-drift.mjs +2 -1
  97. package/package.json +9 -8
  98. package/plugins/design/templates/brief-board.tsx.template +1 -1
  99. package/apps/studio/annotation-edit-base.ts +0 -36
  100. package/apps/studio/commands/annotation-strokes-command.ts +0 -137
@@ -42,8 +42,16 @@ import {
42
42
  import { homedir, tmpdir } from 'node:os';
43
43
  import { join, resolve, sep } from 'node:path';
44
44
  import { pathToFileURL } from 'node:url';
45
+ import { serializeBoard } from '../annotations/schema.ts';
46
+
47
+ /**
48
+ * Translated strokes → canonical v2 board text (DDR-242): straight to
49
+ * registry-validated elements (`toBoardElements`), never through SVG.
50
+ */
51
+ function boardText(strokes) {
52
+ return serializeBoard(toBoardElements(strokes).elements);
53
+ }
45
54
 
46
- import { sanitizeAnnotationSvg, strokesToSvg } from '../annotations-model.ts';
47
55
  import {
48
56
  applyRewrites,
49
57
  FIGMA_ASSET_HOSTS,
@@ -68,7 +76,7 @@ import { readFigZip } from '../figma/fig-zip.ts';
68
76
  import { attrValue, ImportReport } from '../figma/sanitize.ts';
69
77
  import { JsxTooLargeError, toArtboard, toCanvas } from '../figma/to-artboard.ts';
70
78
  import { toRenderCanvas } from '../figma/to-render.ts';
71
- import { BoardTooLargeError, toStrokes } from '../figma/to-strokes.ts';
79
+ import { BoardTooLargeError, toBoardElements, toStrokes } from '../figma/to-strokes.ts';
72
80
  import { stylesToTokens, variablesToTokens } from '../figma/to-tokens.ts';
73
81
  import { FigmaCapError, normalizeDocument, walkNodes } from '../figma/types.ts';
74
82
  import { FigmaUrlError, parseFigmaTarget } from '../figma/url.ts';
@@ -258,9 +266,9 @@ export function formatSummary(report, extra = {}) {
258
266
  /**
259
267
  * Phase 2 — import a FigJam board into the whiteboard annotation layer.
260
268
  *
261
- * Writes `<designRoot>/<slug>.annotations.svg` through the CANONICAL serializer
262
- * plus `sanitizeAnnotationSvg`, so this verb can never persist a shape the
263
- * canvas would reject (D6's annotation row).
269
+ * Writes `<designRoot>/<slug>.annotations.json` as registry-validated v2
270
+ * elements (DDR-242), so this verb can never persist an element the canvas
271
+ * would reject (D6's annotation row).
264
272
  */
265
273
  /**
266
274
  * Read and decode a local `.fig` / `.jam` (DDR-221). Offline end to end: no
@@ -553,7 +561,9 @@ export async function importBoard({
553
561
  const usable = strokes.filter((s) => s.tool !== 'image' || Boolean(s.href));
554
562
  // Paper, then region, then content — in paint order. Either one emitted
555
563
  // after the board would veil it.
556
- const svgFinal = sanitizeAnnotationSvg(strokesToSvg([paper, backing, ...usable]));
564
+ // DDR-242 — the board is written as the v2 element model (`.annotations.json`):
565
+ // the translator's strokes become registry-validated elements directly.
566
+ const boardFinal = boardText([paper, backing, ...usable]);
557
567
 
558
568
  // The board needs a canvas to live on — see `boardHostCanvas`. The
559
569
  // annotation layer is named after THAT canvas's slug, not after a slug of
@@ -562,10 +572,10 @@ export async function importBoard({
562
572
  const canvasRel = `ui/${title}.tsx`;
563
573
  const annSlug = canvasSlug(canvasRel);
564
574
 
565
- const stagedSvg = join(staging, 'board.annotations.svg');
575
+ const stagedSvg = join(staging, 'board.annotations.json');
566
576
  const stagedTsx = join(staging, 'board.tsx');
567
577
  const stagedMeta = join(staging, 'board.meta.json');
568
- writeFileSync(stagedSvg, svgFinal, 'utf8');
578
+ writeFileSync(stagedSvg, boardFinal, 'utf8');
569
579
  writeFileSync(stagedTsx, boardHostCanvas(title), 'utf8');
570
580
  writeFileSync(
571
581
  stagedMeta,
@@ -583,7 +593,7 @@ export async function importBoard({
583
593
  const finalPath = assertContained(
584
594
  root,
585
595
  designRootRel,
586
- join(root, designRootRel, `${annSlug}.annotations.svg`)
596
+ join(root, designRootRel, `${annSlug}.annotations.json`)
587
597
  );
588
598
  const finalTsx = assertContained(root, designRootRel, join(root, designRootRel, canvasRel));
589
599
  const finalMeta = assertContained(
@@ -1099,12 +1109,12 @@ export async function importPages({
1099
1109
 
1100
1110
  if (annStrokes.length > 0) {
1101
1111
  const annSlug = canvasSlug(`${relDir}/${title}.tsx`);
1102
- const stagedAnn = join(staging, 'page.annotations.svg');
1103
- writeFileSync(stagedAnn, sanitizeAnnotationSvg(strokesToSvg(annStrokes)), 'utf8');
1112
+ const stagedAnn = join(staging, 'page.annotations.json');
1113
+ writeFileSync(stagedAnn, boardText(annStrokes), 'utf8');
1104
1114
  const finalAnn = assertContained(
1105
1115
  root,
1106
1116
  designRootRel,
1107
- join(root, designRootRel, `${annSlug}.annotations.svg`)
1117
+ join(root, designRootRel, `${annSlug}.annotations.json`)
1108
1118
  );
1109
1119
  promoteFile(stagedAnn, finalAnn);
1110
1120
  }