@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
@@ -1,137 +0,0 @@
1
- /**
2
- * @file commands/annotation-strokes-command.ts — undo entry for annotation
3
- * stroke add / erase / batch-translate.
4
- * @scope apps/studio/commands/annotation-strokes-command.ts
5
- * @purpose Records a `Stroke[]` pair (before/after) and routes both
6
- * directions through a single `putFn`. The server endpoint is
7
- * `PUT /_api/annotations` which replaces the entire SVG; we
8
- * match that shape rather than diffing.
9
- *
10
- * Per DDR-050 rev 2 the runtime command is rebuilt per iframe
11
- * mount from a serializable `CommandRecord` so the stack
12
- * survives canvas switches. The `putFn` here also updates the
13
- * iframe's local React strokes state (see annotations-layer
14
- * `putStrokes`) so undo/redo visibly refresh, not just PUT.
15
- *
16
- * Why per-stroke commands (not coalesced into a 300 ms window):
17
- * matches Figma/FigJam — Cmd+Z reverts the most recent tap or
18
- * pen stroke individually. Coalescing into windows led to a
19
- * matoucí "why did Cmd+Z erase two of my last lines?" UX.
20
- */
21
-
22
- import type { Stroke } from '../annotations-layer.tsx';
23
- import type { CommandRecord, EditCommand } from '../undo-stack.ts';
24
- import { registerCommand } from '../undo-stack.ts';
25
-
26
- /**
27
- * Push-once callable that submits a full `Stroke[]` to the server (or its
28
- * test stub) AND updates the iframe's local strokes state. The
29
- * annotations-layer `putStrokes` is the production binding.
30
- *
31
- * `before` is the baseline THIS command's `next` was computed from — passed
32
- * through so the consumer can distinguish "an id `prev` still has that
33
- * `before` already lacked too" (a genuinely concurrent addition, fold it in)
34
- * from "an id `before` had that `next` deliberately dropped" (this command's
35
- * own delete — must stay dropped even if React's rendered state hasn't
36
- * caught up yet). See `reconcileCommit` in annotations-layer.tsx.
37
- */
38
- export type StrokesPutFn = (
39
- next: readonly Stroke[],
40
- before: readonly Stroke[]
41
- ) => void | Promise<void>;
42
-
43
- export interface AnnotationStrokesPayload {
44
- before: readonly Stroke[];
45
- after: readonly Stroke[];
46
- }
47
-
48
- export const ANNOTATION_STROKES_KIND = 'annotation-strokes';
49
-
50
- export interface AnnotationStrokesCommandInit {
51
- before: readonly Stroke[];
52
- after: readonly Stroke[];
53
- putFn: StrokesPutFn;
54
- /** Optional label override (eraser → "erase 1 stroke"). */
55
- label?: string;
56
- /** Telemetry kind. */
57
- kind?: string;
58
- }
59
-
60
- export function createAnnotationStrokesCommand(init: AnnotationStrokesCommandInit): EditCommand {
61
- const { putFn } = init;
62
- const before = init.before.map(cloneStroke);
63
- const after = init.after.map(cloneStroke);
64
- const label = init.label ?? defaultLabel(before, after);
65
- const kind = init.kind ?? ANNOTATION_STROKES_KIND;
66
-
67
- return {
68
- kind,
69
- label,
70
- async do() {
71
- await putFn(after.map(cloneStroke), before.map(cloneStroke));
72
- },
73
- async undo() {
74
- await putFn(before.map(cloneStroke), after.map(cloneStroke));
75
- },
76
- };
77
- }
78
-
79
- /**
80
- * Build a persistable record from the same inputs as `createAnnotationStrokesCommand`.
81
- * Used by the consumer alongside the EditCommand so the runtime side-effect
82
- * and the stored shape share one snapshot.
83
- */
84
- export function buildAnnotationStrokesRecord(opts: {
85
- before: readonly Stroke[];
86
- after: readonly Stroke[];
87
- label?: string;
88
- }): CommandRecord<AnnotationStrokesPayload> {
89
- const before = opts.before.map(cloneStroke);
90
- const after = opts.after.map(cloneStroke);
91
- return {
92
- kind: ANNOTATION_STROKES_KIND,
93
- label: opts.label ?? defaultLabel(before, after),
94
- payload: { before, after },
95
- };
96
- }
97
-
98
- // ─────────────────────────────────────────────────────────────────────────────
99
- // Registry
100
-
101
- registerCommand<AnnotationStrokesPayload>(ANNOTATION_STROKES_KIND, (record, sinks) => {
102
- const putFn = sinks.strokesPutFn as StrokesPutFn | undefined;
103
- if (!putFn) return null;
104
- return createAnnotationStrokesCommand({
105
- before: record.payload.before,
106
- after: record.payload.after,
107
- putFn,
108
- label: record.label,
109
- });
110
- });
111
-
112
- // ─────────────────────────────────────────────────────────────────────────────
113
- // Internals
114
-
115
- /**
116
- * Structured clone — works for every Stroke variant because they're plain
117
- * JSON-shaped (no Date / Map / DOM nodes). The pen `points: WorldPoint[]`
118
- * array is nested-cloned too so callers can't poison the snapshot by
119
- * mutating the source.
120
- */
121
- function cloneStroke<T extends Stroke>(s: T): T {
122
- // structuredClone is available on every runtime we ship to (Bun, modern
123
- // browsers, Node 17+). Fall back to JSON for the rare older harness.
124
- if (typeof structuredClone === 'function') return structuredClone(s);
125
- return JSON.parse(JSON.stringify(s)) as T;
126
- }
127
-
128
- function defaultLabel(before: readonly Stroke[], after: readonly Stroke[]): string {
129
- const added = after.length - before.length;
130
- if (added > 0) return `add ${added} stroke${added === 1 ? '' : 's'}`;
131
- if (added < 0) {
132
- const erased = -added;
133
- return `erase ${erased} stroke${erased === 1 ? '' : 's'}`;
134
- }
135
- // Same count — could be translate / edit / fill-change.
136
- return `edit ${after.length} stroke${after.length === 1 ? '' : 's'}`;
137
- }