@magicpages/kalotyp-ui 0.1.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 (110) hide show
  1. package/dist/canvas/position-handles.d.ts +18 -0
  2. package/dist/canvas/position-handles.d.ts.map +1 -0
  3. package/dist/canvas/preview-canvas.d.ts +21 -0
  4. package/dist/canvas/preview-canvas.d.ts.map +1 -0
  5. package/dist/canvas/render-image.d.ts +4 -0
  6. package/dist/canvas/render-image.d.ts.map +1 -0
  7. package/dist/canvas/render-overlay.d.ts +4 -0
  8. package/dist/canvas/render-overlay.d.ts.map +1 -0
  9. package/dist/canvas/stage-gestures.d.ts +12 -0
  10. package/dist/canvas/stage-gestures.d.ts.map +1 -0
  11. package/dist/cheatsheet/modal.d.ts +10 -0
  12. package/dist/cheatsheet/modal.d.ts.map +1 -0
  13. package/dist/dom/build-preset-row.d.ts +10 -0
  14. package/dist/dom/build-preset-row.d.ts.map +1 -0
  15. package/dist/dom/build-shell-dom.d.ts +39 -0
  16. package/dist/dom/build-shell-dom.d.ts.map +1 -0
  17. package/dist/dom/build-stage.d.ts +19 -0
  18. package/dist/dom/build-stage.d.ts.map +1 -0
  19. package/dist/dom/build-util-nav.d.ts +18 -0
  20. package/dist/dom/build-util-nav.d.ts.map +1 -0
  21. package/dist/dom/focus-trap.d.ts +21 -0
  22. package/dist/dom/focus-trap.d.ts.map +1 -0
  23. package/dist/dom/nested-modal.d.ts +25 -0
  24. package/dist/dom/nested-modal.d.ts.map +1 -0
  25. package/dist/icons.d.ts +13 -0
  26. package/dist/icons.d.ts.map +1 -0
  27. package/dist/index.d.ts +61 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +5198 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/keyboard-shortcuts.d.ts +15 -0
  32. package/dist/keyboard-shortcuts.d.ts.map +1 -0
  33. package/dist/output/popover.d.ts +21 -0
  34. package/dist/output/popover.d.ts.map +1 -0
  35. package/dist/plugins/annotate/coord-inputs.d.ts +72 -0
  36. package/dist/plugins/annotate/coord-inputs.d.ts.map +1 -0
  37. package/dist/plugins/annotate/mount.d.ts +40 -0
  38. package/dist/plugins/annotate/mount.d.ts.map +1 -0
  39. package/dist/plugins/annotate/panel.d.ts +43 -0
  40. package/dist/plugins/annotate/panel.d.ts.map +1 -0
  41. package/dist/plugins/annotate/plugin.d.ts +20 -0
  42. package/dist/plugins/annotate/plugin.d.ts.map +1 -0
  43. package/dist/plugins/annotate/pointer-drag.d.ts +41 -0
  44. package/dist/plugins/annotate/pointer-drag.d.ts.map +1 -0
  45. package/dist/plugins/annotate/render.d.ts +46 -0
  46. package/dist/plugins/annotate/render.d.ts.map +1 -0
  47. package/dist/plugins/annotate/selection.d.ts +43 -0
  48. package/dist/plugins/annotate/selection.d.ts.map +1 -0
  49. package/dist/plugins/annotate/stage.d.ts +29 -0
  50. package/dist/plugins/annotate/stage.d.ts.map +1 -0
  51. package/dist/plugins/annotate/text-editor.d.ts +34 -0
  52. package/dist/plugins/annotate/text-editor.d.ts.map +1 -0
  53. package/dist/plugins/annotate/tools.d.ts +46 -0
  54. package/dist/plugins/annotate/tools.d.ts.map +1 -0
  55. package/dist/plugins/crop/interaction.d.ts +17 -0
  56. package/dist/plugins/crop/interaction.d.ts.map +1 -0
  57. package/dist/plugins/crop/mount.d.ts +19 -0
  58. package/dist/plugins/crop/mount.d.ts.map +1 -0
  59. package/dist/plugins/crop/plugin.d.ts +11 -0
  60. package/dist/plugins/crop/plugin.d.ts.map +1 -0
  61. package/dist/plugins/filter/mount.d.ts +16 -0
  62. package/dist/plugins/filter/mount.d.ts.map +1 -0
  63. package/dist/plugins/filter/plugin.d.ts +10 -0
  64. package/dist/plugins/filter/plugin.d.ts.map +1 -0
  65. package/dist/plugins/filter/thumbnails.d.ts +32 -0
  66. package/dist/plugins/filter/thumbnails.d.ts.map +1 -0
  67. package/dist/plugins/finetune/mount.d.ts +16 -0
  68. package/dist/plugins/finetune/mount.d.ts.map +1 -0
  69. package/dist/plugins/finetune/plugin.d.ts +6 -0
  70. package/dist/plugins/finetune/plugin.d.ts.map +1 -0
  71. package/dist/plugins/finetune/preview.d.ts +16 -0
  72. package/dist/plugins/finetune/preview.d.ts.map +1 -0
  73. package/dist/plugins/flip/mount.d.ts +14 -0
  74. package/dist/plugins/flip/mount.d.ts.map +1 -0
  75. package/dist/plugins/flip/plugin.d.ts +6 -0
  76. package/dist/plugins/flip/plugin.d.ts.map +1 -0
  77. package/dist/plugins/frame/mount.d.ts +33 -0
  78. package/dist/plugins/frame/mount.d.ts.map +1 -0
  79. package/dist/plugins/frame/plugin.d.ts +15 -0
  80. package/dist/plugins/frame/plugin.d.ts.map +1 -0
  81. package/dist/plugins/redact/coord-inputs.d.ts +18 -0
  82. package/dist/plugins/redact/coord-inputs.d.ts.map +1 -0
  83. package/dist/plugins/redact/mount.d.ts +26 -0
  84. package/dist/plugins/redact/mount.d.ts.map +1 -0
  85. package/dist/plugins/redact/panel.d.ts +34 -0
  86. package/dist/plugins/redact/panel.d.ts.map +1 -0
  87. package/dist/plugins/redact/plugin.d.ts +14 -0
  88. package/dist/plugins/redact/plugin.d.ts.map +1 -0
  89. package/dist/plugins/redact/render.d.ts +57 -0
  90. package/dist/plugins/redact/render.d.ts.map +1 -0
  91. package/dist/plugins/redact/selection.d.ts +30 -0
  92. package/dist/plugins/redact/selection.d.ts.map +1 -0
  93. package/dist/plugins/redact/stage.d.ts +19 -0
  94. package/dist/plugins/redact/stage.d.ts.map +1 -0
  95. package/dist/plugins/resize/mount.d.ts +21 -0
  96. package/dist/plugins/resize/mount.d.ts.map +1 -0
  97. package/dist/plugins/resize/plugin.d.ts +6 -0
  98. package/dist/plugins/resize/plugin.d.ts.map +1 -0
  99. package/dist/plugins/rotate/mount.d.ts +16 -0
  100. package/dist/plugins/rotate/mount.d.ts.map +1 -0
  101. package/dist/plugins/rotate/plugin.d.ts +6 -0
  102. package/dist/plugins/rotate/plugin.d.ts.map +1 -0
  103. package/dist/preferences/modal.d.ts +24 -0
  104. package/dist/preferences/modal.d.ts.map +1 -0
  105. package/dist/preferences/storage.d.ts +77 -0
  106. package/dist/preferences/storage.d.ts.map +1 -0
  107. package/dist/shell.d.ts +27 -0
  108. package/dist/shell.d.ts.map +1 -0
  109. package/dist/styles.css +1 -0
  110. package/package.json +58 -0
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Manifest of every keyboard shortcut. The cheatsheet UI reads this list.
3
+ * This is a manifest, not a registry — handlers live with the features that own them.
4
+ * "Ctrl" stands in for Ctrl/Cmd: handlers check `ctrlKey || metaKey`, so one label covers both.
5
+ */
6
+ export type KeyboardShortcutContext = 'editor' | 'annotate' | 'redact' | 'text';
7
+ export interface KeyboardShortcut {
8
+ /** Tokens rendered as `<kbd>` pills joined by " + ". Use platform-neutral spelling ("Ctrl", "Esc", "Arrow keys"). */
9
+ readonly keys: ReadonlyArray<string>;
10
+ readonly description: string;
11
+ readonly context: KeyboardShortcutContext;
12
+ }
13
+ export declare const KEYBOARD_SHORTCUTS: ReadonlyArray<KeyboardShortcut>;
14
+ export declare const KEYBOARD_SHORTCUT_CONTEXT_LABELS: Readonly<Record<KeyboardShortcutContext, string>>;
15
+ //# sourceMappingURL=keyboard-shortcuts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboard-shortcuts.d.ts","sourceRoot":"","sources":["../src/keyboard-shortcuts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEhF,MAAM,WAAW,gBAAgB;IAC/B,qHAAqH;IACrH,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,uBAAuB,CAAC;CAC3C;AAED,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,gBAAgB,CAyF9D,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,QAAQ,CAAC,MAAM,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAK9F,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Output popover anchored to the Save-button caret: format, quality, strip-metadata.
3
+ * State commits immediately to the Store; no apply button. Unsupported formats
4
+ * (per async runtime probe) are disabled in-place when the probe resolves.
5
+ */
6
+ import { type OutputState, type Store } from '@magicpages/kalotyp-core';
7
+ export interface OpenOutputPopoverOptions {
8
+ readonly host: HTMLElement;
9
+ readonly anchor: HTMLElement;
10
+ readonly store: Store<OutputState>;
11
+ /** Click of "Save and close" inside the popover. */
12
+ readonly onSaveAndClose: () => void;
13
+ /** Mirrors the editor's Save-enabled state so the in-popover Save button stays in sync. */
14
+ readonly canSave: () => boolean;
15
+ readonly onClose: () => void;
16
+ }
17
+ export interface OutputPopoverHandle {
18
+ close(): void;
19
+ }
20
+ export declare function openOutputPopover(options: OpenOutputPopoverOptions): OutputPopoverHandle;
21
+ //# sourceMappingURL=popover.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../src/output/popover.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,KAAK,EAKX,MAAM,0BAA0B,CAAC;AAGlC,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IACnC,oDAAoD;IACpD,QAAQ,CAAC,cAAc,EAAE,MAAM,IAAI,CAAC;IACpC,2FAA2F;IAC3F,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,IAAI,IAAI,CAAC;CACf;AA2CD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,mBAAmB,CA8KxF"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Per-shape coordinate-input rows for the keyboard placement path
3
+ *. The inputs are the keyboard-only equivalent
4
+ * of dragging selection handles: a user types image-space pixel
5
+ * coordinates, the shape's geometry updates on `change` (blur or
6
+ * Enter), and the live canvas + selection handles re-paint via the
7
+ * existing store subscription path.
8
+ *
9
+ * Each shape kind exposes a different shape of fields:
10
+ *
11
+ * - rect / ellipse → Left, Top, Width, Height (matches crop's
12
+ * dimension-input pattern from Phase 6.2; same semantics).
13
+ * - arrow → Start X, Start Y, End X, End Y (the two endpoints).
14
+ * - text → X, Y (anchor only; size is driven by the font size
15
+ * control, and the inline editor handles the text content).
16
+ *
17
+ * One row instance is reused across selections; it rebuilds its
18
+ * fields when the selected shape's kind changes. The mount layer
19
+ * subscribes to the selection and calls `updateForShape(shape)` on
20
+ * each change so the inputs reflect the live geometry.
21
+ */
22
+ import type { Shape } from '@magicpages/kalotyp-core';
23
+ export interface CoordInputsOptions {
24
+ /**
25
+ * Called when a typed value commits (blur or Enter). The handler
26
+ * receives the new shape; the mount layer writes it to the store
27
+ * via `replaceShape` and emits a commit. Keeping the helper
28
+ * store-free means the row's tests don't need to thread a store.
29
+ */
30
+ onShapeChanged(shape: Shape): void;
31
+ }
32
+ /**
33
+ * A single coordinate edit. Discriminated on shape kind so the apply
34
+ * step can narrow without re-reading the input ids.
35
+ */
36
+ export type ShapeCoordEdit = {
37
+ readonly kind: 'rect' | 'ellipse';
38
+ readonly x: number;
39
+ readonly y: number;
40
+ readonly width: number;
41
+ readonly height: number;
42
+ } | {
43
+ readonly kind: 'arrow';
44
+ readonly x1: number;
45
+ readonly y1: number;
46
+ readonly x2: number;
47
+ readonly y2: number;
48
+ } | {
49
+ readonly kind: 'text';
50
+ readonly x: number;
51
+ readonly y: number;
52
+ };
53
+ export interface CoordInputsHandle {
54
+ readonly container: HTMLDivElement;
55
+ /** Show inputs for the given shape and prefill values. Hides when shape is null. */
56
+ updateForShape(shape: Shape | null): void;
57
+ destroy(): void;
58
+ }
59
+ /**
60
+ * Build a single per-selection coordinate-input row. The row reuses
61
+ * the same `kalotyp-annotate-coords-*` class set across shape kinds
62
+ * so styling is one rule set; only the field set changes per shape.
63
+ */
64
+ export declare function buildCoordInputs(options: CoordInputsOptions): CoordInputsHandle;
65
+ /**
66
+ * Apply an edit produced by the inputs to the shape it came from.
67
+ * Exported so the mount layer can compose it with its own clamping
68
+ * before writing to the store. The function is total over the shape
69
+ * union so the caller doesn't need to re-narrow.
70
+ */
71
+ export declare function applyCoordEdit(shape: Shape, edit: ShapeCoordEdit): Shape;
72
+ //# sourceMappingURL=coord-inputs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coord-inputs.d.ts","sourceRoot":"","sources":["../../../src/plugins/annotate/coord-inputs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAIV,KAAK,EAEN,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GACtB;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,oFAAoF;IACpF,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1C,OAAO,IAAI,IAAI,CAAC;CACjB;AA4BD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,GAAG,iBAAiB,CAsK/E;AAcD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,GAAG,KAAK,CAqCxE"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Mount the annotation plugin's stage UI and wire up:
3
+ * - the three layered canvases (image / shapes / live);
4
+ * - the bottom panel (tool toolbar + style controls);
5
+ * - pointer dispatch (drawing tools vs select tool);
6
+ * - selection handles + per-handle resize gestures;
7
+ * - the inline text editor;
8
+ * - keyboard shortcuts (Delete/Backspace to remove the selected
9
+ * shape; Esc to deselect).
10
+ *
11
+ * The mount keeps two pieces of derived state at module scope:
12
+ *
13
+ * - `viewport` — the current letterbox of the upstream-baked source
14
+ * into the stage. Recomputed on every stage resize.
15
+ * - `liveShape` — the in-progress shape during a draw or move
16
+ * gesture. `null` when no gesture is active.
17
+ */
18
+ import { type AnnotateState, type SourceImage, type Store, type ViewportController } from '@magicpages/kalotyp-core';
19
+ export interface MountAnnotateOptions {
20
+ readonly stageHost: HTMLElement;
21
+ readonly utilHost: HTMLElement;
22
+ readonly source: SourceImage;
23
+ readonly store: Store<AnnotateState>;
24
+ /** Editor-level zoom + pan controller. Optional in jsdom tests. */
25
+ readonly viewport?: ViewportController;
26
+ /** Called after each user-meaningful annotation mutation. */
27
+ readonly onCommit?: () => void;
28
+ /**
29
+ * Optional live-region announcer. The annotate plugin
30
+ * uses it for state changes that don't move keyboard focus —
31
+ * notably Esc-deselect, where the screen reader would otherwise
32
+ * have no cue that the selection went away.
33
+ */
34
+ readonly onAnnounce?: (message: string) => void;
35
+ }
36
+ export interface MountAnnotateHandle {
37
+ destroy(): void;
38
+ }
39
+ export declare function mountAnnotateUtility(options: MountAnnotateOptions): MountAnnotateHandle;
40
+ //# sourceMappingURL=mount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../../src/plugins/annotate/mount.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,KAAK,aAAa,EAIlB,KAAK,WAAW,EAChB,KAAK,KAAK,EAIV,KAAK,kBAAkB,EAexB,MAAM,0BAA0B,CAAC;AAmBlC,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IACrC,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IACvC,6DAA6D;IAC7D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,oBAAoB,GAAG,mBAAmB,CAucvF"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Build the annotation panel: tool toolbar on the left, style
3
+ * controls on the right. Mirrors the layout-rhythm conventions the
4
+ * other Phase 2 panels (rotate, flip, resize) established — flat
5
+ * row(s) of controls under `.kalotyp-util-main`.
6
+ */
7
+ import { type AnnotateTool, type StylePalette } from '@magicpages/kalotyp-core';
8
+ export interface AnnotatePanelOptions {
9
+ readonly initialTool: AnnotateTool;
10
+ readonly initialStyle: StylePalette;
11
+ readonly canDelete: boolean;
12
+ /**
13
+ * Where the per-selection coordinate-input row mounts. The mount layer owns the row's lifecycle and just
14
+ * needs the panel to expose the slot so the inputs render in the
15
+ * panel rhythm rather than as a free-floating bar.
16
+ */
17
+ readonly coordInputs: HTMLElement;
18
+ onSelectTool(tool: AnnotateTool): void;
19
+ onColorChange(color: string): void;
20
+ onStrokeWidthChange(width: number): void;
21
+ onDeleteSelected(): void;
22
+ /**
23
+ * Insert the active drawing tool's default shape at image centre
24
+ * (Phase 6.3). The panel disables the button when the active tool
25
+ * is `select`, `freehand`, or `highlight` — see
26
+ * `isKeyboardPlaceableKind` in core.
27
+ */
28
+ onInsertAtCenter(): void;
29
+ }
30
+ export interface AnnotatePanel {
31
+ readonly container: HTMLDivElement;
32
+ readonly toolButtons: ReadonlyMap<AnnotateTool, HTMLButtonElement>;
33
+ readonly hexInput: HTMLInputElement;
34
+ readonly colorSwatches: ReadonlyArray<HTMLButtonElement>;
35
+ readonly strokeRange: HTMLInputElement;
36
+ readonly deleteButton: HTMLButtonElement;
37
+ readonly insertButton: HTMLButtonElement;
38
+ setActiveTool(tool: AnnotateTool): void;
39
+ setStyle(style: StylePalette): void;
40
+ setCanDelete(canDelete: boolean): void;
41
+ }
42
+ export declare function buildAnnotatePanel(options: AnnotatePanelOptions): AnnotatePanel;
43
+ //# sourceMappingURL=panel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panel.d.ts","sourceRoot":"","sources":["../../../src/plugins/annotate/panel.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,YAAY,EAElB,MAAM,0BAA0B,CAAC;AAGlC,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,WAAW,EAAE,YAAY,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAAC;IACvC,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,gBAAgB,IAAI,IAAI,CAAC;IACzB;;;;;OAKG;IACH,gBAAgB,IAAI,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;IACnE,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACzD,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;IACvC,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACzC,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACzC,aAAa,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACpC,YAAY,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAAC;CACxC;AAsCD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAoL/E"}
@@ -0,0 +1,20 @@
1
+ import { type AnnotateState, type UtilityPlugin } from '@magicpages/kalotyp-core';
2
+ export interface AnnotatePluginOptions {
3
+ /**
4
+ * Where the plugin's panel UI mounts. The plugin's stage UI is
5
+ * mounted into the `host` argument of the standard plugin `mount()`
6
+ * call. Same panel-host-as-closure pattern the other plugins use
7
+ * (see `crop/plugin.ts`).
8
+ */
9
+ readonly panelHost: HTMLElement;
10
+ }
11
+ /**
12
+ * Build the annotation `UtilityPlugin` instance for one editor
13
+ * session. Each `openDefaultEditor` call gets a fresh plugin closing
14
+ * over its own panel host.
15
+ *
16
+ * The chain position (annotate before resize) is the editor's
17
+ * concern; this factory just supplies the bake.
18
+ */
19
+ export declare function createAnnotatePlugin(options: AnnotatePluginOptions): UtilityPlugin<AnnotateState>;
20
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/annotate/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAGnB,MAAM,0BAA0B,CAAC;AAGlC,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,aAAa,CAAC,aAAa,CAAC,CAmBjG"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Pointer-drag helper. Same shape as the crop plugin's
3
+ * `attachPointerDrag` (interaction.ts), kept local here so the
4
+ * annotation tool gestures can layer their own per-gesture state on
5
+ * top without coupling to the crop module.
6
+ *
7
+ * The factory is invoked on `pointerdown`. It must return a
8
+ * `DragHandlers` object whose three callbacks describe the gesture's
9
+ * lifecycle: `onMove(point)` per coalesced animation frame,
10
+ * `onCommit()` once on `pointerup` (after a final drained move), and
11
+ * `onCancel()` once on `pointercancel`.
12
+ *
13
+ * The factory may return `null` to refuse the gesture — useful when
14
+ * a hit-area pointerdown only sometimes starts a drag (e.g. the
15
+ * select tool doesn't drag if no shape is under the pointer).
16
+ */
17
+ /**
18
+ * Per-frame point payload. Includes `shiftKey` so tool gestures can
19
+ * apply axis / square / circle constraints while the modifier is
20
+ * held — the standard image-editor convention (Figma, Sketch,
21
+ * Photoshop). The flag reflects shift-state at the most
22
+ * recent pointer event, so releasing/re-pressing shift mid-drag
23
+ * toggles the constraint live.
24
+ */
25
+ export interface DragPoint {
26
+ readonly clientX: number;
27
+ readonly clientY: number;
28
+ readonly shiftKey: boolean;
29
+ }
30
+ export interface DragHandlers {
31
+ onMove(point: DragPoint): void;
32
+ onCommit(): void;
33
+ onCancel(): void;
34
+ }
35
+ export declare function attachPointerDrag(element: HTMLElement, factory: (start: PointerEvent) => DragHandlers | null): () => void;
36
+ /** Convert a client-space point to the bounding-rect-local coords of `element`. */
37
+ export declare function clientToElement(element: HTMLElement, clientX: number, clientY: number): {
38
+ x: number;
39
+ y: number;
40
+ };
41
+ //# sourceMappingURL=pointer-drag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pointer-drag.d.ts","sourceRoot":"","sources":["../../../src/plugins/annotate/pointer-drag.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;IAC/B,QAAQ,IAAI,IAAI,CAAC;IACjB,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,YAAY,GAAG,IAAI,GACpD,MAAM,IAAI,CAsGZ;AAED,mFAAmF;AACnF,wBAAgB,eAAe,CAC7B,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAG1B"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Render helpers for the annotation plugin's three canvas layers.
3
+ *
4
+ * - `paintImageLayer`: paints the upstream-baked source onto the
5
+ * bottom canvas. Called once on mount and on stage resize.
6
+ * - `paintShapesLayer`: paints every committed shape onto the middle
7
+ * canvas. Called when the shape list, selection, or viewport
8
+ * changes.
9
+ * - `paintLiveLayer`: paints whatever the in-progress gesture wants
10
+ * on top — a draft shape during a drag, a marquee, etc. Called
11
+ * per frame during a gesture.
12
+ *
13
+ * All three reuse the same DPR-aware canvas-sizing helper to keep the
14
+ * pixel grids consistent. Shapes are rendered through `paintShape`
15
+ * from the core `bake.ts` module so the live preview is byte-equal to
16
+ * the bake output (per shape).
17
+ */
18
+ import { type Shape, type SourceImage, type Viewport } from '@magicpages/kalotyp-core';
19
+ export declare function paintImageLayer(canvas: HTMLCanvasElement, source: SourceImage, stageWidth: number, stageHeight: number, viewport: Viewport): void;
20
+ /**
21
+ * Paint a list of shapes by setting up an image-space coordinate
22
+ * frame and calling the shared `paintShape` for each. The image-space
23
+ * frame is established by translating to the displayRect's origin and
24
+ * scaling by the viewport scale; the shapes' image-space coordinates
25
+ * then land at the right display pixels for free.
26
+ */
27
+ export declare function paintShapesLayer(canvas: HTMLCanvasElement, shapes: ReadonlyArray<Shape>, stageWidth: number, stageHeight: number, viewport: Viewport): void;
28
+ /**
29
+ * Paint a single in-progress shape on the live canvas. Same
30
+ * coordinate setup as the shapes layer; passing `null` clears the
31
+ * canvas without drawing — useful when a gesture ends.
32
+ */
33
+ export declare function paintLiveLayer(canvas: HTMLCanvasElement, shape: Shape | null, stageWidth: number, stageHeight: number, viewport: Viewport): void;
34
+ /**
35
+ * Paint a selection-marquee rectangle (image-space) on the live
36
+ * canvas. Distinct from `paintLiveLayer` because the marquee uses
37
+ * dashed strokes + a faint fill — visual conventions for "I am
38
+ * marquee-selecting" — that don't belong to any committed shape.
39
+ */
40
+ export declare function paintMarqueeLayer(canvas: HTMLCanvasElement, marqueeImage: {
41
+ x: number;
42
+ y: number;
43
+ width: number;
44
+ height: number;
45
+ } | null, stageWidth: number, stageHeight: number, viewport: Viewport): void;
46
+ //# sourceMappingURL=render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/plugins/annotate/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAc,MAAM,0BAA0B,CAAC;AA0BnG,wBAAgB,eAAe,CAC7B,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,QAAQ,GACjB,IAAI,CAYN;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,EAC5B,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,QAAQ,GACjB,IAAI,CAWN;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,iBAAiB,EACzB,KAAK,EAAE,KAAK,GAAG,IAAI,EACnB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,QAAQ,GACjB,IAAI,CASN;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,iBAAiB,EACzB,YAAY,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,EAC5E,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,QAAQ,GACjB,IAAI,CA+BN"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Selection rendering and per-handle resize gesture for annotation
3
+ * shapes. The selection layer is responsible for:
4
+ *
5
+ * - Rendering the bounding-box outline + 8 corner/edge handles when
6
+ * a shape is selected. Arrows render with two endpoint handles
7
+ * instead (no orthogonal extent to resize).
8
+ * - Wiring each handle's pointerdown to a per-handle resize gesture
9
+ * that mutates the shape's geometry as the user drags.
10
+ * - Cleaning up handles when the selection clears.
11
+ *
12
+ * Handles are positioned in stage CSS pixels using the shared
13
+ * `position-handles` helper that crop already uses for its 8
14
+ * manipulators. Reusing that helper keeps the handle DOM consistent
15
+ * with crop's so future styling can target both with a single rule.
16
+ */
17
+ import { type AnnotateState, type Shape, type Viewport } from '@magicpages/kalotyp-core';
18
+ import type { ToolGestureContext } from './tools.js';
19
+ /**
20
+ * Build and own the selection-handle DOM. The returned object exposes
21
+ * `update(shape, viewport)` so the caller can re-render handles after
22
+ * any state change without rebuilding the DOM.
23
+ */
24
+ export interface SelectionLayerOptions {
25
+ readonly host: HTMLDivElement;
26
+ readonly stageElement: HTMLElement;
27
+ readonly toolContext: ToolGestureContext;
28
+ /** Read the current letterbox viewport at gesture-start time. */
29
+ getViewport(): Viewport;
30
+ }
31
+ export interface SelectionLayer {
32
+ /** Update the rendered handles to reflect the selected shape (or clear). */
33
+ update(shape: Shape | null, viewport: Viewport): void;
34
+ destroy(): void;
35
+ }
36
+ export declare function buildSelectionLayer(options: SelectionLayerOptions): SelectionLayer;
37
+ /**
38
+ * Helper for the mount layer: which shape (if any) is selected, given
39
+ * the current state? Keeps the lookup logic in one place — most
40
+ * callers in `mount.ts` need it via the store subscription.
41
+ */
42
+ export declare function selectedShapeOf(state: AnnotateState): Shape | null;
43
+ //# sourceMappingURL=selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../../src/plugins/annotate/selection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAEL,KAAK,aAAa,EAIlB,KAAK,KAAK,EACV,KAAK,QAAQ,EAKd,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,kBAAkB,CAAC;IACzC,iEAAiE;IACjE,WAAW,IAAI,QAAQ,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B,4EAA4E;IAC5E,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IACtD,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,CAwElF;AA8ID;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,GAAG,IAAI,CAGlE"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Build the layered DOM for the annotation plugin's stage. Three
3
+ * canvases (image, committed shapes, live in-progress) plus three DOM
4
+ * layers (a hit-area for pointer input, a handles layer for selection
5
+ * resize handles, and a text-edit overlay) — / Phase 3
6
+ * brief on stacked canvases.
7
+ *
8
+ * The element ordering follows the z-stack: image at the bottom,
9
+ * shapes and live canvases above it, then the pointer hit-area, then
10
+ * the handles layer (so handles can intercept pointerdowns before the
11
+ * hit-area sees them), then the text overlay on top.
12
+ *
13
+ * The hit-area is the surface the tool / selection layer attaches its
14
+ * pointerdown handlers to. It carries `touch-action: none` so the
15
+ * browser doesn't hijack drags for scroll/pinch on touch devices.
16
+ */
17
+ export interface AnnotateStageElements {
18
+ readonly container: HTMLDivElement;
19
+ readonly imageCanvas: HTMLCanvasElement;
20
+ readonly shapesCanvas: HTMLCanvasElement;
21
+ readonly liveCanvas: HTMLCanvasElement;
22
+ readonly hitArea: HTMLDivElement;
23
+ /** Holds selection handles (DOM buttons) when a shape is selected. */
24
+ readonly handlesLayer: HTMLDivElement;
25
+ /** Holds the inline text editor when text is being edited. */
26
+ readonly textOverlay: HTMLDivElement;
27
+ }
28
+ export declare function buildAnnotateStage(): AnnotateStageElements;
29
+ //# sourceMappingURL=stage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../../src/plugins/annotate/stage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,iBAAiB,CAAC;IACxC,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACzC,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,sEAAsE;IACtE,QAAQ,CAAC,YAAY,EAAE,cAAc,CAAC;IACtC,8DAA8D;IAC9D,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC;CACtC;AAED,wBAAgB,kBAAkB,IAAI,qBAAqB,CA4C1D"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Inline text editor for the text annotation tool.
3
+ *
4
+ * The editor renders a contenteditable `<div>` overlaid on the
5
+ * annotation's image-space anchor. Using a `<div>` instead of a
6
+ * `<textarea>` lets us match the canvas-side font and size precisely
7
+ * (textareas restrict the visible padding/size combination on some
8
+ * browsers). The element keeps a fixed width by default and grows
9
+ * vertically with line breaks.
10
+ *
11
+ * Lifecycle:
12
+ * - `open(shape, viewport)`: position the editor over the shape,
13
+ * prefill its text, focus it. Each input event reports the new
14
+ * text via `onInput`. Pressing Enter (without Shift) commits;
15
+ * pressing Escape cancels.
16
+ * - `close()`: hide the editor and blur it.
17
+ *
18
+ * The caller is responsible for committing the shape into the store
19
+ * when the editor closes; the editor is presentational.
20
+ */
21
+ import { type SourceImage, type TextShape, type Viewport } from '@magicpages/kalotyp-core';
22
+ export interface TextEditorOptions {
23
+ readonly host: HTMLDivElement;
24
+ onInput(text: string): void;
25
+ onCommit(): void;
26
+ onCancel(): void;
27
+ }
28
+ export interface TextEditorHandle {
29
+ open(shape: TextShape, viewport: Viewport, source: SourceImage): void;
30
+ close(): void;
31
+ destroy(): void;
32
+ }
33
+ export declare function buildTextEditor(options: TextEditorOptions): TextEditorHandle;
34
+ //# sourceMappingURL=text-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-editor.d.ts","sourceRoot":"","sources":["../../../src/plugins/annotate/text-editor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,QAAQ,EACd,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,IAAI,IAAI,CAAC;IACjB,QAAQ,IAAI,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IACtE,KAAK,IAAI,IAAI,CAAC;IACd,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CAuG5E"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Drawing-tool gesture factories. Each function builds the
3
+ * pointer-drag handlers for one tool (rect, ellipse, arrow, freehand,
4
+ * highlight, plus body-move for the select tool). Text and select
5
+ * dispatch are handled in `mount.ts` because they don't fit the
6
+ * "drag-to-create" shape these factories codify.
7
+ *
8
+ * Each gesture:
9
+ * 1. Mints a fresh shape id and creates an in-progress shape.
10
+ * 2. On every coalesced pointermove, the shape's geometry is
11
+ * updated and rendered into the live canvas (caller-supplied).
12
+ * 3. On commit (`pointerup`), the shape is added to the store and
13
+ * a `commit` event is emitted so the editor history snapshots.
14
+ * A degenerate shape (zero-extent rect, single-tap freehand) is
15
+ * dropped instead of committed — the user obviously didn't mean
16
+ * to draw anything.
17
+ */
18
+ import { type AnnotateState, type Point, type Shape, type Store } from '@magicpages/kalotyp-core';
19
+ import type { DragHandlers } from './pointer-drag.js';
20
+ export interface ToolGestureContext {
21
+ readonly store: Store<AnnotateState>;
22
+ /** Project a raw client-space pointer to image-space pixels. */
23
+ toImageSpace(clientPoint: {
24
+ clientX: number;
25
+ clientY: number;
26
+ }): Point;
27
+ /** Update the live canvas with the in-progress shape. */
28
+ setLiveShape(shape: Shape | null): void;
29
+ /** Emit the editor's history-commit signal. */
30
+ commit(): void;
31
+ }
32
+ export declare function startRectGesture(ctx: ToolGestureContext, origin: PointerEvent): DragHandlers;
33
+ export declare function startEllipseGesture(ctx: ToolGestureContext, origin: PointerEvent): DragHandlers;
34
+ export declare function startArrowGesture(ctx: ToolGestureContext, origin: PointerEvent): DragHandlers;
35
+ export declare function startFreehandGesture(ctx: ToolGestureContext, origin: PointerEvent, options: {
36
+ kind: 'freehand' | 'highlight';
37
+ }): DragHandlers;
38
+ /**
39
+ * Body-drag (move) gesture used by the select tool when the user
40
+ * presses on an already-selected shape and drags. Translates the
41
+ * shape by the per-frame delta; commits on pointerup. The caller
42
+ * supplies the `translate` and `replace` closures so this stays
43
+ * decoupled from the store-write specifics.
44
+ */
45
+ export declare function startBodyMoveGesture(ctx: ToolGestureContext, origin: PointerEvent, shapeId: string, initialShape: Shape, translate: (shape: Shape, dx: number, dy: number) => Shape, replace: (shape: Shape) => void): DragHandlers;
46
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/plugins/annotate/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,KAAK,aAAa,EAOlB,KAAK,KAAK,EAEV,KAAK,KAAK,EACV,KAAK,KAAK,EAMX,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AA6CtD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IACrC,gEAAgE;IAChE,YAAY,CAAC,WAAW,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,KAAK,CAAC;IACvE,yDAAyD;IACzD,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC;IACxC,+CAA+C;IAC/C,MAAM,IAAI,IAAI,CAAC;CAChB;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,kBAAkB,EAAE,MAAM,EAAE,YAAY,GAAG,YAAY,CAiD5F;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,kBAAkB,EAAE,MAAM,EAAE,YAAY,GAAG,YAAY,CAgD/F;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,kBAAkB,EAAE,MAAM,EAAE,YAAY,GAAG,YAAY,CA+C7F;AAED,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,kBAAkB,EACvB,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE;IAAE,IAAI,EAAE,UAAU,GAAG,WAAW,CAAA;CAAE,GAC1C,YAAY,CAiFd;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,kBAAkB,EACvB,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,KAAK,EACnB,SAAS,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,KAAK,EAC1D,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAC9B,YAAY,CAgBd"}
@@ -0,0 +1,17 @@
1
+ import { type CropState, type HandleDirection, type Store, type Viewport } from '@magicpages/kalotyp-core';
2
+ export interface CropInteractionElements {
3
+ readonly stageElement: HTMLElement;
4
+ readonly handles: Readonly<Record<HandleDirection, HTMLElement>>;
5
+ readonly bodyHitArea: HTMLElement;
6
+ }
7
+ export interface CropInteractionContext {
8
+ getViewport(): Viewport;
9
+ /** Called once on pointerup so editor history can snapshot. Optional for tests. */
10
+ onCommit?: () => void;
11
+ }
12
+ export interface CropInteractionHandle {
13
+ destroy(): void;
14
+ }
15
+ /** Wire eight-handle resize + body translate onto the crop rect. Per-frame rAF-coalesced. */
16
+ export declare function bindCropInteractions(elements: CropInteractionElements, store: Store<CropState>, ctx: CropInteractionContext): CropInteractionHandle;
17
+ //# sourceMappingURL=interaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../../../src/plugins/crop/interaction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,eAAe,EAEpB,KAAK,KAAK,EACV,KAAK,QAAQ,EAId,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC,CAAC;IACjE,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;CACnC;AAED,MAAM,WAAW,sBAAsB;IACrC,WAAW,IAAI,QAAQ,CAAC;IACxB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,6FAA6F;AAC7F,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,uBAAuB,EACjC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,EACvB,GAAG,EAAE,sBAAsB,GAC1B,qBAAqB,CAcvB"}
@@ -0,0 +1,19 @@
1
+ import { type CropPreset, type CropPresetFilter, type CropState, type SourceImage, type Store, type ViewportController, initialCropState } from '@magicpages/kalotyp-core';
2
+ export interface MountCropOptions {
3
+ readonly stageHost: HTMLElement;
4
+ readonly utilHost: HTMLElement;
5
+ readonly source: SourceImage;
6
+ readonly presets: readonly CropPreset[];
7
+ readonly presetFilter: CropPresetFilter | undefined;
8
+ readonly store: Store<CropState>;
9
+ /** Editor-level zoom + pan. Optional — falls back to fit-only viewports when absent. */
10
+ readonly viewport?: ViewportController;
11
+ readonly onCommit?: () => void;
12
+ }
13
+ export interface MountCropHandle {
14
+ destroy(): void;
15
+ }
16
+ /** Mount the crop UI. Expects the store pre-initialised via `initialCropState`. */
17
+ export declare function mountCropUtility(options: MountCropOptions): MountCropHandle;
18
+ export { initialCropState };
19
+ //# sourceMappingURL=mount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../../src/plugins/crop/mount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,SAAS,EAEd,KAAK,WAAW,EAChB,KAAK,KAAK,EAEV,KAAK,kBAAkB,EAKvB,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAQlC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;IACxC,QAAQ,CAAC,YAAY,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACpD,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACjC,wFAAwF;IACxF,QAAQ,CAAC,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,IAAI,IAAI,CAAC;CACjB;AAID,mFAAmF;AACnF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,GAAG,eAAe,CAmJ3E;AAuFD,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { type CropPreset, type CropPresetFilter, type CropState, type UtilityPlugin } from '@magicpages/kalotyp-core';
2
+ export interface CropPluginOptions {
3
+ /** The 12 presets Ghost passes (or any caller-supplied subset). */
4
+ readonly presets: readonly CropPreset[];
5
+ /** Orientation filter (Ghost always passes 'landscape'). */
6
+ readonly presetFilter: CropPresetFilter | undefined;
7
+ /** Panel host (closed-over); stage host is the `mount()` argument. */
8
+ readonly panelHost: HTMLElement;
9
+ }
10
+ export declare function createCropPlugin(options: CropPluginOptions): UtilityPlugin<CropState>;
11
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/crop/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,aAAa,EAGnB,MAAM,0BAA0B,CAAC;AAKlC,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;IACxC,4DAA4D;IAC5D,QAAQ,CAAC,YAAY,EAAE,gBAAgB,GAAG,SAAS,CAAC;IACpD,sEAAsE;IACtE,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;CACjC;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,aAAa,CAAC,SAAS,CAAC,CA2BrF"}
@@ -0,0 +1,16 @@
1
+ import { type FinetuneState, type SourceImage, type Store, type ViewportController } from '@magicpages/kalotyp-core';
2
+ export interface MountFilterOptions {
3
+ readonly stageHost: HTMLElement;
4
+ readonly utilHost: HTMLElement;
5
+ /** Upstream-baked source (same input as the finetune tab — filter shares finetune's slot). */
6
+ readonly source: SourceImage;
7
+ /** Shared store with finetune; clicking a thumbnail writes here. */
8
+ readonly store: Store<FinetuneState>;
9
+ readonly viewport?: ViewportController;
10
+ readonly onCommit?: () => void;
11
+ }
12
+ export interface MountFilterHandle {
13
+ destroy(): void;
14
+ }
15
+ export declare function mountFilterUtility(options: MountFilterOptions): MountFilterHandle;
16
+ //# sourceMappingURL=mount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../../src/plugins/filter/mount.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,KAAK,EACV,KAAK,kBAAkB,EAExB,MAAM,0BAA0B,CAAC;AAKlC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,8FAA8F;IAC9F,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,GAAG,iBAAiB,CAgHjF"}
@@ -0,0 +1,10 @@
1
+ import { type FinetuneState, type UtilityPlugin } from '@magicpages/kalotyp-core';
2
+ export interface FilterPluginOptions {
3
+ readonly panelHost: HTMLElement;
4
+ }
5
+ /**
6
+ * Filter plugin. Shares the finetune slot's store; `init`/`bake` here are synthetic
7
+ * (filter isn't in CHAIN_ORDER and the editor registers the slot manually with the shared store).
8
+ */
9
+ export declare function createFilterPlugin(options: FilterPluginOptions): UtilityPlugin<FinetuneState>;
10
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/filter/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAC;AAGlC,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;CACjC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,aAAa,CAAC,aAAa,CAAC,CAiB7F"}