@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
package/README.md
CHANGED
|
@@ -39,6 +39,14 @@ import {
|
|
|
39
39
|
StatsCard,
|
|
40
40
|
buildDashboardPanelGroups,
|
|
41
41
|
} from "@agent-native/toolkit/dashboard";
|
|
42
|
+
import {
|
|
43
|
+
CanvasCommentPins,
|
|
44
|
+
DrawOverlay,
|
|
45
|
+
} from "@agent-native/toolkit/canvas-annotations";
|
|
46
|
+
import {
|
|
47
|
+
createCanvasGestureController,
|
|
48
|
+
createCanvasInteractionCore,
|
|
49
|
+
} from "@agent-native/toolkit/canvas-interactions";
|
|
42
50
|
import { VisualTweakControl } from "@agent-native/toolkit/design-tweaks";
|
|
43
51
|
import { SharedRichEditor } from "@agent-native/toolkit/editor";
|
|
44
52
|
import { VisibilityBadge } from "@agent-native/toolkit/sharing";
|
|
@@ -56,6 +64,17 @@ source scanning. If an app renders `SharedRichEditor`, also import
|
|
|
56
64
|
`@agent-native/toolkit/editor.css`. If an app renders `ChatHistoryList` or
|
|
57
65
|
`ChatHistoryRail`, also import `@agent-native/toolkit/chat-history.css`.
|
|
58
66
|
|
|
67
|
+
`DrawOverlay` backs the Design and Slides drawing tools. `CanvasCommentPins`
|
|
68
|
+
provides lightweight, transient pins that send canvas context to an agent.
|
|
69
|
+
Translation, agent-chat routing, document context, and storage-backed review
|
|
70
|
+
threads stay with the app.
|
|
71
|
+
|
|
72
|
+
`createCanvasGestureController` provides a headless move and resize state
|
|
73
|
+
machine with zoom conversion, modifier policies, previews, cancellation, and a
|
|
74
|
+
single commit boundary. Apps provide adapters for selection, rendering, and
|
|
75
|
+
persistence. `createCanvasInteractionCore` exposes the same shared geometry,
|
|
76
|
+
text-activation, Escape, nudge, and shortcut policies without owning state.
|
|
77
|
+
|
|
59
78
|
Use `ChatHistoryRail` for app sidebars. It shows five recent chats by default,
|
|
60
79
|
progressively discloses up to fifteen, and keeps the app-provided New chat
|
|
61
80
|
action in a footer row with the ellipsis disclosure on its right. The app
|
package/agent-native.eject.json
CHANGED
|
@@ -151,6 +151,41 @@
|
|
|
151
151
|
],
|
|
152
152
|
"verification": ["pnpm typecheck"]
|
|
153
153
|
},
|
|
154
|
+
{
|
|
155
|
+
"id": "toolkit/canvas-annotations",
|
|
156
|
+
"label": "Canvas drawing and pinned agent comments",
|
|
157
|
+
"catalog": "toolkit-ui",
|
|
158
|
+
"catalogItems": ["canvas-annotations"],
|
|
159
|
+
"entrypoints": ["./canvas-annotations", "./canvas-annotations/*"],
|
|
160
|
+
"strategy": "source-copy",
|
|
161
|
+
"sourceEntries": ["src/canvas-annotations"],
|
|
162
|
+
"targetRoot": "app/components/agent-native/toolkit",
|
|
163
|
+
"dependencies": [
|
|
164
|
+
"@radix-ui/react-slot",
|
|
165
|
+
"@radix-ui/react-tooltip",
|
|
166
|
+
"@tabler/icons-react",
|
|
167
|
+
"class-variance-authority",
|
|
168
|
+
"clsx",
|
|
169
|
+
"culori",
|
|
170
|
+
"react",
|
|
171
|
+
"react-dom",
|
|
172
|
+
"sonner",
|
|
173
|
+
"tailwind-merge"
|
|
174
|
+
],
|
|
175
|
+
"verification": ["pnpm typecheck"]
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"id": "toolkit/canvas-interactions",
|
|
179
|
+
"label": "Canvas gestures, geometry, and shortcuts",
|
|
180
|
+
"catalog": "toolkit-ui",
|
|
181
|
+
"catalogItems": ["canvas-interactions"],
|
|
182
|
+
"entrypoints": ["./canvas-interactions", "./canvas-interactions/*"],
|
|
183
|
+
"strategy": "source-copy",
|
|
184
|
+
"sourceEntries": ["src/canvas-interactions"],
|
|
185
|
+
"targetRoot": "app/components/agent-native/toolkit",
|
|
186
|
+
"dependencies": [],
|
|
187
|
+
"verification": ["pnpm typecheck"]
|
|
188
|
+
},
|
|
154
189
|
{
|
|
155
190
|
"id": "toolkit/composer",
|
|
156
191
|
"label": "Agent composer",
|
|
@@ -229,8 +264,11 @@
|
|
|
229
264
|
"sourceEntries": ["src/design-tweaks"],
|
|
230
265
|
"targetRoot": "app/components/agent-native/toolkit",
|
|
231
266
|
"dependencies": [
|
|
267
|
+
"@radix-ui/react-label",
|
|
232
268
|
"@radix-ui/react-popover",
|
|
269
|
+
"@radix-ui/react-tooltip",
|
|
233
270
|
"@tabler/icons-react",
|
|
271
|
+
"class-variance-authority",
|
|
234
272
|
"clsx",
|
|
235
273
|
"react",
|
|
236
274
|
"tailwind-merge"
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { CanvasAnnotationTranslate, SendCanvasAnnotation } from "./types.js";
|
|
2
|
+
export interface CanvasPin {
|
|
3
|
+
id: string;
|
|
4
|
+
/** Position as a percentage of the canvas (so it survives resize/zoom) */
|
|
5
|
+
xPct: number;
|
|
6
|
+
yPct: number;
|
|
7
|
+
/** Optional CSS selector of the element under the click, for context */
|
|
8
|
+
targetSelector?: string;
|
|
9
|
+
/** Best-effort stable canvas/code-layer id when the clicked layer exposes one. */
|
|
10
|
+
targetAnchorId?: string;
|
|
11
|
+
/** Optional snippet of text content the user clicked near */
|
|
12
|
+
targetText?: string;
|
|
13
|
+
/** Pending comment text the user is composing */
|
|
14
|
+
draft?: string;
|
|
15
|
+
/** Held locally until the user batch-applies queued comments. */
|
|
16
|
+
queued?: boolean;
|
|
17
|
+
/** Submitted state — the marker stays visible as confirmation. */
|
|
18
|
+
submitted?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface CanvasCommentPinsProps {
|
|
21
|
+
translate: CanvasAnnotationTranslate;
|
|
22
|
+
sendToAgent: SendCanvasAnnotation;
|
|
23
|
+
onSendError?: () => void;
|
|
24
|
+
allowQueue?: boolean;
|
|
25
|
+
showAnchorDetails?: boolean;
|
|
26
|
+
showSubmitShortcut?: boolean;
|
|
27
|
+
/** Whether the pin tool is active. When true, clicks drop pins. */
|
|
28
|
+
active: boolean;
|
|
29
|
+
/** In queue mode, pin Send adds to the shared annotation batch. */
|
|
30
|
+
submitMode?: "direct" | "queue";
|
|
31
|
+
/** Disable / exit the pin mode (called on Escape, after submit, etc.) */
|
|
32
|
+
onClose: () => void;
|
|
33
|
+
/** Mirrors local pins to a parent that can submit them with other annotations. */
|
|
34
|
+
onPinsChange?: (pins: CanvasPin[]) => void;
|
|
35
|
+
/** Increment to mark queued pins as submitted by a parent action. */
|
|
36
|
+
submitQueuedSignal?: number;
|
|
37
|
+
/** Keep the click plane below a sibling draw toolbar in combined annotate mode. */
|
|
38
|
+
clickPlaneUnderToolbar?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Selector for the canvas surface (e.g. `.slide-content`). Pins are anchored
|
|
41
|
+
* to this element's bounding rect; clicks outside are ignored.
|
|
42
|
+
*/
|
|
43
|
+
canvasSelector: string;
|
|
44
|
+
/** Stable identifier for the current view (slide id / design id) — used in
|
|
45
|
+
* the agent prompt and as a pin namespace key. */
|
|
46
|
+
contextId: string;
|
|
47
|
+
/** Human-readable label for the context (slide title, slide index, design
|
|
48
|
+
* title) used in the agent prompt. */
|
|
49
|
+
contextLabel?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Click-to-comment pins anchored to the canvas.
|
|
53
|
+
*
|
|
54
|
+
* Mirrors claude.ai/design's "inline comments" feature — the most-praised
|
|
55
|
+
* interaction pattern of that tool. A user clicks anywhere on the canvas to
|
|
56
|
+
* drop a pin, types a one-line instruction, and the pin's position + nearby
|
|
57
|
+
* element selector + instruction is sent to the agent. Submitted pins stay on
|
|
58
|
+
* the canvas as local confirmation; the agent's reply lands in the chat
|
|
59
|
+
* sidebar where it can make targeted edits.
|
|
60
|
+
*
|
|
61
|
+
* Why pins (vs text-anchored comments):
|
|
62
|
+
* The existing slide_comments table anchors comments to text selections via
|
|
63
|
+
* TipTap. That's good for prose review — but Rochkind also wants to point
|
|
64
|
+
* to images, charts, and whitespace. Pins handle those cases without
|
|
65
|
+
* requiring a text selection.
|
|
66
|
+
*/
|
|
67
|
+
export declare function CanvasCommentPins({ translate, sendToAgent, onSendError, allowQueue, showAnchorDetails, showSubmitShortcut, active, submitMode, onClose, onPinsChange, submitQueuedSignal, clickPlaneUnderToolbar, canvasSelector, contextId, contextLabel, }: CanvasCommentPinsProps): import("react").JSX.Element | null;
|
|
68
|
+
//# sourceMappingURL=CanvasCommentPins.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CanvasCommentPins.d.ts","sourceRoot":"","sources":["../../src/canvas-annotations/CanvasCommentPins.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EACV,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kFAAkF;IAClF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kEAAkE;IAClE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,yBAAyB,CAAC;IACrC,WAAW,EAAE,oBAAoB,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,mEAAmE;IACnE,MAAM,EAAE,OAAO,CAAC;IAChB,mEAAmE;IACnE,UAAU,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAChC,yEAAyE;IACzE,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,kFAAkF;IAClF,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;IAC3C,qEAAqE;IACrE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mFAAmF;IACnF,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;sDACkD;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB;0CACsC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAgID;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,WAAW,EACX,WAAW,EACX,UAAiB,EACjB,iBAAwB,EACxB,kBAAyB,EACzB,MAAM,EACN,UAAqB,EACrB,OAAO,EACP,YAAY,EACZ,kBAAkB,EAClB,sBAA8B,EAC9B,cAAc,EACd,SAAS,EACT,YAAY,GACb,EAAE,sBAAsB,sCAknBxB"}
|