@agent-native/toolkit 0.11.2 → 0.12.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.
- package/README.md +19 -0
- package/agent-native.eject.json +38 -0
- package/dist/canvas-annotations/CanvasCommentPins.d.ts +68 -0
- package/dist/canvas-annotations/CanvasCommentPins.d.ts.map +1 -0
- package/dist/canvas-annotations/CanvasCommentPins.js +513 -0
- package/dist/canvas-annotations/CanvasCommentPins.js.map +1 -0
- package/dist/canvas-annotations/DrawOverlay.d.ts +108 -0
- package/dist/canvas-annotations/DrawOverlay.d.ts.map +1 -0
- package/dist/canvas-annotations/DrawOverlay.js +746 -0
- package/dist/canvas-annotations/DrawOverlay.js.map +1 -0
- package/dist/canvas-annotations/DrawOverlay.spec.d.ts +2 -0
- package/dist/canvas-annotations/DrawOverlay.spec.d.ts.map +1 -0
- package/dist/canvas-annotations/DrawOverlay.spec.js +111 -0
- package/dist/canvas-annotations/DrawOverlay.spec.js.map +1 -0
- package/dist/canvas-annotations/index.d.ts +4 -0
- package/dist/canvas-annotations/index.d.ts.map +1 -0
- package/dist/canvas-annotations/index.js +3 -0
- package/dist/canvas-annotations/index.js.map +1 -0
- package/dist/canvas-annotations/types.d.ts +8 -0
- package/dist/canvas-annotations/types.d.ts.map +1 -0
- package/dist/canvas-annotations/types.js +2 -0
- package/dist/canvas-annotations/types.js.map +1 -0
- package/dist/canvas-interactions/canvas-interactions.d.ts +334 -0
- package/dist/canvas-interactions/canvas-interactions.d.ts.map +1 -0
- package/dist/canvas-interactions/canvas-interactions.js +451 -0
- package/dist/canvas-interactions/canvas-interactions.js.map +1 -0
- package/dist/canvas-interactions/canvas-interactions.spec.d.ts +2 -0
- package/dist/canvas-interactions/canvas-interactions.spec.d.ts.map +1 -0
- package/dist/canvas-interactions/canvas-interactions.spec.js +538 -0
- package/dist/canvas-interactions/canvas-interactions.spec.js.map +1 -0
- package/dist/canvas-interactions/index.d.ts +2 -0
- package/dist/canvas-interactions/index.d.ts.map +1 -0
- package/dist/canvas-interactions/index.js +2 -0
- package/dist/canvas-interactions/index.js.map +1 -0
- package/dist/design-tweaks/scrub-input-utils.d.ts +61 -0
- package/dist/design-tweaks/scrub-input-utils.d.ts.map +1 -0
- package/dist/design-tweaks/scrub-input-utils.js +235 -0
- package/dist/design-tweaks/scrub-input-utils.js.map +1 -0
- package/dist/design-tweaks/scrub-input.d.ts +66 -0
- package/dist/design-tweaks/scrub-input.d.ts.map +1 -0
- package/dist/design-tweaks/scrub-input.js +313 -0
- package/dist/design-tweaks/scrub-input.js.map +1 -0
- package/dist/design-tweaks/visual-style-controls.d.ts +2 -12
- package/dist/design-tweaks/visual-style-controls.d.ts.map +1 -1
- package/dist/design-tweaks/visual-style-controls.js +3 -107
- package/dist/design-tweaks/visual-style-controls.js.map +1 -1
- package/dist/design-tweaks/visual-style-controls.spec.js +26 -0
- package/dist/design-tweaks/visual-style-controls.spec.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +29 -1
- package/src/canvas-annotations/CanvasCommentPins.tsx +861 -0
- package/src/canvas-annotations/DrawOverlay.spec.tsx +145 -0
- package/src/canvas-annotations/DrawOverlay.tsx +1233 -0
- package/src/canvas-annotations/index.ts +15 -0
- package/src/canvas-annotations/types.ts +14 -0
- package/src/canvas-interactions/canvas-interactions.spec.ts +688 -0
- package/src/canvas-interactions/canvas-interactions.ts +933 -0
- package/src/canvas-interactions/index.ts +67 -0
- package/src/design-tweaks/scrub-input-utils.ts +311 -0
- package/src/design-tweaks/scrub-input.tsx +491 -0
- package/src/design-tweaks/visual-style-controls.spec.tsx +60 -0
- package/src/design-tweaks/visual-style-controls.tsx +23 -168
- package/src/index.ts +1 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { CanvasAnnotationTranslate } from "./types.js";
|
|
2
|
+
export interface DrawAnnotation {
|
|
3
|
+
id: string;
|
|
4
|
+
type: "path" | "text";
|
|
5
|
+
/** SVG path data for "path" type */
|
|
6
|
+
pathData?: string;
|
|
7
|
+
/** Text content for "text" type */
|
|
8
|
+
text?: string;
|
|
9
|
+
/** Annotation color (hex) */
|
|
10
|
+
color: string;
|
|
11
|
+
/** Stroke width for paths, font weight reference for text */
|
|
12
|
+
lineWidth: number;
|
|
13
|
+
/** Position relative to the canvas (text annotations only) */
|
|
14
|
+
position: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Creation timestamp (Date.now()) — used for unified undo ordering across
|
|
20
|
+
* strokes and text annotations. Optional so existing callers of DrawAnnotation
|
|
21
|
+
* don't need to supply it.
|
|
22
|
+
*/
|
|
23
|
+
createdAt?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface DrawOverlayProps {
|
|
26
|
+
translate: CanvasAnnotationTranslate;
|
|
27
|
+
/** Whether the overlay is currently visible (toggled from the toolbar) */
|
|
28
|
+
visible: boolean;
|
|
29
|
+
/** When false, canvas clicks pass through to sibling tools while the toolbar stays usable. */
|
|
30
|
+
canvasInteractive?: boolean;
|
|
31
|
+
/** Extra queued annotations owned by sibling tools, such as comment pins. */
|
|
32
|
+
queuedAnnotationCount?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Current zoom level (percentage, e.g. 100 = 100%). Used to convert
|
|
35
|
+
* getBoundingClientRect() visual-space coordinates to layout-space so that
|
|
36
|
+
* strokes and text labels stay anchored to their painted position across
|
|
37
|
+
* zoom changes.
|
|
38
|
+
*/
|
|
39
|
+
zoom?: number;
|
|
40
|
+
/** Called when the user submits the queued strokes/text to the agent */
|
|
41
|
+
onSend: (annotations: DrawAnnotation[], instruction: string, canvasSize: {
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
}) => void;
|
|
45
|
+
/** Called when the user cancels / closes the draw mode */
|
|
46
|
+
onClose: () => void;
|
|
47
|
+
/**
|
|
48
|
+
* True while the caller is capturing/compositing/uploading the annotated
|
|
49
|
+
* screenshot for a just-submitted drawing (see the design app's
|
|
50
|
+
* design-canvas/annotation-snapshot.ts). Disables Send and swaps its icon
|
|
51
|
+
* for a spinner so a slow capture can't be triggered twice from the same
|
|
52
|
+
* drawing. The entire overlay becomes inert while true so edits made after
|
|
53
|
+
* the submitted snapshot cannot be erased when that submission is later
|
|
54
|
+
* confirmed and the caller clears the batch.
|
|
55
|
+
*/
|
|
56
|
+
sending?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Bump this (e.g. a counter) exactly when the caller wants to discard the
|
|
59
|
+
* current strokes/text annotations — after `onClose` or a confirmed Send.
|
|
60
|
+
* Strokes/text are intentionally NOT cleared merely because `visible`
|
|
61
|
+
* turns false: `visible` can toggle off for reasons that have nothing to
|
|
62
|
+
* do with the user wanting to discard their work (switching tools, views,
|
|
63
|
+
* or side panels), and doing so silently would destroy annotations the
|
|
64
|
+
* user never got a chance to send. Only an in-progress (uncommitted)
|
|
65
|
+
* gesture is reset on hide; a pending text label is committed so its typed
|
|
66
|
+
* content survives.
|
|
67
|
+
*/
|
|
68
|
+
clearSignal?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Identity of the canvas this annotation batch belongs to. When the host
|
|
71
|
+
* reuses one DrawOverlay instance for a different screen, the old batch is
|
|
72
|
+
* cleared with a warning instead of being silently reinterpreted against
|
|
73
|
+
* the new screen's pixels and submitted with the wrong screenshot.
|
|
74
|
+
*/
|
|
75
|
+
scopeKey?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Keep the canvas DOM/bitmap alive while hidden. Use for the one active
|
|
78
|
+
* editor overlay whose work must survive mode/view toggles; leave false for
|
|
79
|
+
* large preview grids so every dormant screen does not allocate a canvas
|
|
80
|
+
* and ResizeObserver.
|
|
81
|
+
*/
|
|
82
|
+
retainSurfaceWhenHidden?: boolean;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Draw-to-prompt overlay for the slide canvas.
|
|
86
|
+
*
|
|
87
|
+
* Mirrors claude.ai/design's "Draw mode": the user sketches on the canvas,
|
|
88
|
+
* adds a one-line text instruction, hits Send, and the strokes + instruction
|
|
89
|
+
* are forwarded to the agent. The agent receives the path geometry along with
|
|
90
|
+
* the canvas size so it can interpret position semantically (e.g. "move the
|
|
91
|
+
* title here").
|
|
92
|
+
*
|
|
93
|
+
* This component is canvas-agnostic — it overlays absolutely-positioned over
|
|
94
|
+
* its parent, so the parent (a slide editor or design canvas) only needs to
|
|
95
|
+
* be `position: relative`.
|
|
96
|
+
*
|
|
97
|
+
* Coordinate model
|
|
98
|
+
* ----------------
|
|
99
|
+
* All stroke points and text positions are stored as fractions (0..1) of the
|
|
100
|
+
* canvas's visual rect (getBoundingClientRect). This makes them stable across
|
|
101
|
+
* zoom and resize. When rendering:
|
|
102
|
+
* - Canvas strokes: multiply by rect.width / rect.height (visual pixels).
|
|
103
|
+
* - CSS text labels: multiply by rect.width/scale / rect.height/scale
|
|
104
|
+
* (layout pixels inside the scaled wrapper).
|
|
105
|
+
* - pathData in send(): layout pixels = fraction * rect.width / scale.
|
|
106
|
+
*/
|
|
107
|
+
export declare function DrawOverlay({ translate, visible, canvasInteractive, queuedAnnotationCount, zoom, onSend, onClose, sending, clearSignal, scopeKey, retainSurfaceWhenHidden, }: DrawOverlayProps): import("react").JSX.Element | null;
|
|
108
|
+
//# sourceMappingURL=DrawOverlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DrawOverlay.d.ts","sourceRoot":"","sources":["../../src/canvas-annotations/DrawOverlay.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAE5D,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mCAAmC;IACnC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