@dexhq/canvas 0.17.0 → 0.18.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/CHANGELOG.md +31 -0
- package/app/canvas/canvas-commands.ts +2 -10
- package/app/canvas/canvas-context.tsx +11 -2
- package/app/canvas/canvas-document.ts +5 -1
- package/app/canvas/canvas-keys.ts +1 -1
- package/app/canvas/canvas-model.ts +195 -20
- package/app/canvas/canvas-scene.ts +176 -171
- package/app/canvas/canvas-ui.ts +4 -11
- package/app/canvas/canvas.css +159 -179
- package/app/canvas/change-pictures.tsx +156 -0
- package/app/canvas/comment-drafts.ts +31 -0
- package/app/canvas/comment-layer.tsx +125 -71
- package/app/canvas/comments.tsx +38 -2
- package/app/canvas/element-picker.ts +20 -0
- package/app/canvas/engine/canvas-gestures.ts +15 -3
- package/app/canvas/engine/canvas-store.ts +5 -0
- package/app/canvas/engine/canvas-view.tsx +22 -5
- package/app/canvas/find-bar.tsx +57 -41
- package/app/canvas/flow-canvas.tsx +147 -272
- package/app/canvas/frame-copies.ts +14 -17
- package/app/canvas/frame-drops.ts +15 -7
- package/app/canvas/frame-inspector.ts +192 -41
- package/app/canvas/frame-node.tsx +123 -75
- package/app/canvas/frame-resize.tsx +321 -83
- package/app/canvas/insert-hint.tsx +5 -15
- package/app/canvas/inspect-layer.tsx +73 -19
- package/app/canvas/label-action.tsx +13 -2
- package/app/canvas/layout.ts +233 -98
- package/app/canvas/live-page.ts +5 -0
- package/app/canvas/new-frame.ts +10 -25
- package/app/canvas/note-placing.ts +55 -84
- package/app/canvas/picked-box.tsx +5 -0
- package/app/canvas/picks-menu.tsx +3 -9
- package/app/canvas/readable-colour.ts +52 -0
- package/app/canvas/request-node.tsx +19 -10
- package/app/canvas/scrolling-page.ts +45 -0
- package/app/canvas/section-node.tsx +36 -53
- package/app/canvas/settle.ts +21 -0
- package/app/canvas/snapping.ts +96 -8
- package/app/canvas/spec-frame.tsx +8 -5
- package/app/canvas/spot-pins.tsx +15 -3
- package/app/canvas/stack-frame.tsx +13 -57
- package/app/canvas/stack-model.ts +5 -0
- package/app/canvas/stack-toggle.tsx +89 -0
- package/app/canvas/styles-layer.tsx +23 -43
- package/app/canvas/text-layer.tsx +26 -10
- package/app/canvas/thread-focus.tsx +18 -1
- package/app/canvas/tool-cursors.ts +2 -2
- package/app/canvas/toolbar-parts.tsx +48 -8
- package/app/canvas/toolbar.tsx +12 -10
- package/app/canvas/use-canvas-clipboard.tsx +13 -5
- package/app/canvas/use-reveal.ts +86 -0
- package/app/editor/extensions.ts +2 -0
- package/app/editor/line-break-caret.ts +57 -0
- package/app/git/branch-panel.tsx +61 -20
- package/app/i18n/locales/en/messages.po +64 -17
- package/app/i18n/locales/en/messages.ts +1 -1
- package/app/i18n/locales/pseudo/messages.po +64 -17
- package/app/i18n/locales/pseudo/messages.ts +1 -1
- package/app/icons/glyphs.tsx +2 -0
- package/app/live/studio-live.ts +29 -9
- package/app/pages/canvas.tsx +1 -1
- package/app/pages/commands-settings.tsx +70 -76
- package/app/pages/play-bar.tsx +6 -11
- package/app/pages/play.tsx +52 -33
- package/app/shell/feedback-form.tsx +29 -5
- package/app/ui/prompt-editor.tsx +2 -0
- package/app/ui/use-field-list.ts +90 -0
- package/dist/cli/commands/mcp.mjs +6 -4
- package/dist/cli/mcp-relay.mjs +10 -6
- package/dist/content/content.d.mts +26 -9
- package/dist/content/content.mjs +65 -8
- package/dist/content/screenshot.d.mts +2 -0
- package/dist/content/screenshot.mjs +3 -0
- package/dist/content/snapshot-client.d.mts +2 -0
- package/dist/content/snapshot-client.mjs +12 -1
- package/dist/inspector.js +96 -19
- package/dist/paste/paste.d.mts +5 -0
- package/dist/paste/paste.mjs +7 -2
- package/dist/server/agent-tools.d.mts +1 -0
- package/dist/server/agent-tools.mjs +4 -3
- package/dist/server/change-picture-store.d.mts +13 -0
- package/dist/server/change-picture-store.mjs +42 -0
- package/dist/server/change-pictures.d.mts +25 -0
- package/dist/server/change-pictures.mjs +104 -0
- package/dist/server/close-check.d.mts +11 -0
- package/dist/server/close-check.mjs +37 -5
- package/dist/server/comments/agent-actions.d.mts +8 -4
- package/dist/server/comments/agent-actions.mjs +16 -7
- package/dist/server/comments/close-tools.mjs +7 -5
- package/dist/server/comments/files.d.mts +5 -1
- package/dist/server/comments/hand-out.d.mts +1 -1
- package/dist/server/comments/hand-out.mjs +4 -1
- package/dist/server/comments/push.d.mts +19 -10
- package/dist/server/comments/push.mjs +45 -30
- package/dist/server/comments/studio-files.d.mts +14 -1
- package/dist/server/comments/studio-files.mjs +44 -31
- package/dist/server/comments/tools.d.mts +1 -1
- package/dist/server/comments/workspace.mjs +1 -0
- package/dist/server/dev-server.mjs +34 -0
- package/dist/server/own-copies.mjs +4 -23
- package/dist/server/requests.mjs +57 -3
- package/dist/server/response-budget.d.mts +2 -1
- package/dist/server/response-budget.mjs +4 -3
- package/dist/server/roster.d.mts +19 -8
- package/dist/server/roster.mjs +50 -22
- package/dist/server/studio-for.d.mts +7 -0
- package/dist/server/studio-for.mjs +23 -7
- package/dist/server/thread-forms.d.mts +3 -0
- package/dist/server/thread-forms.mjs +21 -1
- package/dist/server/tools/place-frame.d.mts +1 -0
- package/dist/server/tools/place-frame.mjs +33 -9
- package/dist/server/tools/result.mjs +2 -2
- package/dist/server/tools/snapshot.d.mts +1 -1
- package/dist/server/tools/snapshot.mjs +2 -1
- package/dist/server/tools/studio-context.d.mts +2 -1
- package/dist/server/tools/studio-context.mjs +2 -1
- package/dist/server/tools/watch.mjs +29 -12
- package/dist/server/work-groups.mjs +1 -1
- package/dist/shared/canvas-core.d.mts +39 -5
- package/dist/shared/canvas-core.mjs +60 -15
- package/dist/shared/canvas-file.d.mts +7 -4
- package/dist/shared/change-pictures-core.d.mts +6 -0
- package/dist/shared/change-pictures-core.mjs +5 -0
- package/dist/shared/page-looks.d.mts +12 -0
- package/dist/shared/page-looks.mjs +49 -0
- package/dist/shared/snapshot-clipboard.d.mts +6 -0
- package/dist/shared/studio-routes.d.mts +11 -0
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/picker.js +114 -108
- package/package.json +4 -3
- package/src/cli/commands/mcp.ts +18 -8
- package/src/cli/mcp-relay.ts +13 -6
- package/src/content/content.ts +90 -16
- package/src/content/screenshot.ts +9 -1
- package/src/content/snapshot-client.ts +17 -0
- package/src/paste/paste.ts +18 -1
- package/src/server/agent-tools.ts +5 -4
- package/src/server/change-picture-store.ts +71 -0
- package/src/server/change-pictures.ts +244 -0
- package/src/server/close-check.ts +69 -6
- package/src/server/comments/agent-actions.ts +51 -12
- package/src/server/comments/close-tools.ts +20 -10
- package/src/server/comments/files.ts +10 -2
- package/src/server/comments/hand-out.ts +2 -2
- package/src/server/comments/push.ts +94 -46
- package/src/server/comments/studio-files.ts +77 -46
- package/src/server/comments/workspace.ts +1 -0
- package/src/server/dev-server.ts +70 -0
- package/src/server/own-copies.ts +5 -33
- package/src/server/requests.ts +84 -4
- package/src/server/response-budget.ts +5 -3
- package/src/server/roster.ts +78 -28
- package/src/server/studio-for.ts +32 -7
- package/src/server/thread-forms.ts +41 -1
- package/src/server/tools/place-frame.ts +71 -14
- package/src/server/tools/result.ts +2 -2
- package/src/server/tools/snapshot.ts +2 -1
- package/src/server/tools/studio-context.ts +24 -14
- package/src/server/tools/watch.ts +38 -13
- package/src/server/work-groups.ts +1 -1
- package/src/shared/canvas-core.ts +119 -27
- package/src/shared/canvas-file.ts +7 -4
- package/src/shared/change-pictures-core.ts +8 -0
- package/src/shared/page-looks.ts +133 -0
- package/src/shared/snapshot-clipboard.ts +6 -0
- package/src/shared/studio-routes.ts +7 -1
- package/templates/agents/dex-worker.md +9 -7
- package/templates/feedback-workflow.md +1 -1
- package/templates/methods/review.md +7 -6
- package/templates/rules/canvas-frames.md +8 -7
- package/templates/rules/canvas.md +10 -8
- package/templates/rules/prototypes.md +5 -3
- package/app/canvas/stack-node.tsx +0 -100
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
/* oxlint-disable shadcn/no-inline-styles -- computed at runtime: the inspected element's box, from the page's geometry, and the tool's cursor */
|
|
2
|
-
import { useEffect } from "react";
|
|
2
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
3
3
|
|
|
4
4
|
import type { InspectBox, StudioInspect } from "../kit/inspect-runtime";
|
|
5
5
|
import { useCanvasUi, useCanvasUiStore } from "./canvas-ui";
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import {
|
|
7
|
+
framePoint,
|
|
8
|
+
isWholeFrame,
|
|
9
|
+
useFrameInspector,
|
|
10
|
+
useInspectorKeys,
|
|
11
|
+
} from "./frame-inspector";
|
|
8
12
|
import type { LivePage } from "./live-page";
|
|
13
|
+
import { FrameOutline } from "./picked-box";
|
|
9
14
|
import { toolCursor } from "./tool-cursors";
|
|
10
15
|
|
|
11
16
|
// Inspecting a frame: a layer over its page that outlines the design-system
|
|
@@ -14,7 +19,9 @@ import { toolCursor } from "./tool-cursors";
|
|
|
14
19
|
// and Escape lets go. ↑ and ↓ step to the component that holds it and back
|
|
15
20
|
// down, ← and → to the components beside it, as every tool that chooses an
|
|
16
21
|
// element steps (frame-inspector.ts): the component inspected, else the one
|
|
17
|
-
// outlined. The elements between components are passed over.
|
|
22
|
+
// outlined. The elements between components are passed over. What is
|
|
23
|
+
// chosen is the frame's inspector's (frame-inspector.ts): an element chosen
|
|
24
|
+
// in another tool is inspected as the component it is in.
|
|
18
25
|
|
|
19
26
|
const Outline = ({ box, picked }: { box: InspectBox; picked?: boolean }) => (
|
|
20
27
|
<div
|
|
@@ -42,6 +49,18 @@ const insideComponent = (
|
|
|
42
49
|
);
|
|
43
50
|
};
|
|
44
51
|
|
|
52
|
+
/** The top of the component an element is in; none outside every one. */
|
|
53
|
+
const componentOf = (
|
|
54
|
+
inspect: StudioInspect | undefined,
|
|
55
|
+
element: Element
|
|
56
|
+
): Element | undefined => {
|
|
57
|
+
for (let at: Element | null = element; at !== null; at = at.parentElement) {
|
|
58
|
+
if (!insideComponent(inspect, at)) {
|
|
59
|
+
return at;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
45
64
|
export const InspectLayer = ({
|
|
46
65
|
frameKey: key,
|
|
47
66
|
page,
|
|
@@ -58,11 +77,19 @@ export const InspectLayer = ({
|
|
|
58
77
|
state.inspected?.frame === key ? state.inspected : undefined
|
|
59
78
|
);
|
|
60
79
|
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
80
|
+
const componentInspectedElsewhere = useCanvasUi(
|
|
81
|
+
(state) => state.inspected !== undefined && state.inspected.frame !== key
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
/** Shows an element's component in the props panel, or none. */
|
|
85
|
+
const show = useCallback(
|
|
86
|
+
(element: Element | undefined) => {
|
|
87
|
+
if (isWholeFrame(element)) {
|
|
88
|
+
ui.setInspected(undefined);
|
|
89
|
+
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
66
93
|
const { inspected: now } = ui.get();
|
|
67
94
|
const shown = now?.frame === key ? now.element : undefined;
|
|
68
95
|
|
|
@@ -81,27 +108,52 @@ export const InspectLayer = ({
|
|
|
81
108
|
);
|
|
82
109
|
}
|
|
83
110
|
},
|
|
111
|
+
[key, page, ui]
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
const inspecting = useFrameInspector(page, {
|
|
115
|
+
elementAt: (point) => page?.inspectAt(point.x, point.y)?.element,
|
|
116
|
+
skip: (element) => insideComponent(page?.inspector(), element),
|
|
117
|
+
// What is chosen here is what the props panel shows.
|
|
118
|
+
onChoose: show,
|
|
84
119
|
});
|
|
85
120
|
|
|
121
|
+
// As the tool starts, an element chosen on this frame in another canvas
|
|
122
|
+
// tool is inspected: the component it is in. Unless another frame's
|
|
123
|
+
// component is inspected already: the props panel shows one.
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
const { chosen } = inspecting;
|
|
126
|
+
const top = chosen && componentOf(page?.inspector(), chosen);
|
|
127
|
+
|
|
128
|
+
if (top && !ui.get().inspected) {
|
|
129
|
+
inspecting.choose(top);
|
|
130
|
+
show(top);
|
|
131
|
+
}
|
|
132
|
+
}, [inspecting, page, show, ui]);
|
|
133
|
+
|
|
86
134
|
// And the other way: a component inspected in another frame, or found
|
|
87
|
-
// again once the page loads anew (props-panel.tsx), is chosen here
|
|
135
|
+
// again once the page loads anew (props-panel.tsx), is chosen here; one
|
|
136
|
+
// let go of there, while it was this frame's, is let go of here.
|
|
88
137
|
const element = inspected?.element;
|
|
138
|
+
const shown = useRef(element);
|
|
89
139
|
|
|
90
140
|
useEffect(() => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
141
|
+
const before = shown.current;
|
|
142
|
+
shown.current = element;
|
|
143
|
+
const { chosen } = inspecting;
|
|
94
144
|
|
|
95
|
-
if (element) {
|
|
145
|
+
if (element && element !== chosen) {
|
|
96
146
|
inspecting.choose(element);
|
|
97
|
-
} else
|
|
147
|
+
} else if (
|
|
148
|
+
isWholeFrame(chosen) ? componentInspectedElsewhere : !element && before
|
|
149
|
+
) {
|
|
98
150
|
inspecting.release();
|
|
99
151
|
}
|
|
100
|
-
}, [inspecting, element]);
|
|
152
|
+
}, [inspecting, element, componentInspectedElsewhere]);
|
|
101
153
|
|
|
102
154
|
useInspectorKeys(inspecting, { choose: () => inspecting.choose() });
|
|
103
155
|
|
|
104
|
-
const { current } = inspecting;
|
|
156
|
+
const { chosen, current } = inspecting;
|
|
105
157
|
const hover = current && page?.inspector()?.at(current)?.box;
|
|
106
158
|
|
|
107
159
|
return (
|
|
@@ -110,16 +162,18 @@ export const InspectLayer = ({
|
|
|
110
162
|
className="nodrag nopan absolute inset-0 z-20"
|
|
111
163
|
onClick={(event) => {
|
|
112
164
|
event.stopPropagation();
|
|
113
|
-
inspecting.
|
|
165
|
+
inspecting.click(framePoint(event, width));
|
|
114
166
|
inspecting.choose();
|
|
115
167
|
}}
|
|
116
168
|
onDoubleClick={(event) => event.stopPropagation()}
|
|
117
169
|
onMouseLeave={() => inspecting.hover()}
|
|
118
|
-
onMouseMove={(event) => inspecting.hover(
|
|
170
|
+
onMouseMove={(event) => inspecting.hover(framePoint(event, width))}
|
|
119
171
|
style={{ cursor: toolCursor("inspect") }}
|
|
120
172
|
>
|
|
121
173
|
{hover ? <Outline box={hover} /> : null}
|
|
174
|
+
{isWholeFrame(current) && current !== chosen ? <FrameOutline /> : null}
|
|
122
175
|
{inspected ? <Outline box={inspected.found.box} picked /> : null}
|
|
176
|
+
{isWholeFrame(chosen) ? <FrameOutline picked /> : null}
|
|
123
177
|
</div>
|
|
124
178
|
);
|
|
125
179
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cn } from "cn";
|
|
2
|
-
import type { MouseEvent, ReactNode } from "react";
|
|
2
|
+
import type { KeyboardEvent, MouseEvent, ReactNode } from "react";
|
|
3
3
|
import { Link } from "wouter";
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -10,17 +10,22 @@ import { Link } from "wouter";
|
|
|
10
10
|
export const LabelAction = ({
|
|
11
11
|
children,
|
|
12
12
|
className,
|
|
13
|
+
expanded,
|
|
13
14
|
href,
|
|
14
15
|
label,
|
|
15
16
|
onClick,
|
|
17
|
+
onKeyDown,
|
|
16
18
|
pressed,
|
|
17
19
|
shown = false,
|
|
18
20
|
}: {
|
|
19
21
|
children: ReactNode;
|
|
20
22
|
className?: string;
|
|
23
|
+
/** For a toggle that opens something, such as a stack. */
|
|
24
|
+
expanded?: boolean;
|
|
21
25
|
href?: string;
|
|
22
26
|
label: string;
|
|
23
27
|
onClick?: () => void;
|
|
28
|
+
onKeyDown?: (event: KeyboardEvent) => void;
|
|
24
29
|
pressed?: boolean;
|
|
25
30
|
/** Shown whether or not you reach for it. */
|
|
26
31
|
shown?: boolean;
|
|
@@ -44,7 +49,13 @@ export const LabelAction = ({
|
|
|
44
49
|
{children}
|
|
45
50
|
</Link>
|
|
46
51
|
) : (
|
|
47
|
-
<button
|
|
52
|
+
<button
|
|
53
|
+
{...props}
|
|
54
|
+
aria-expanded={expanded}
|
|
55
|
+
aria-pressed={pressed}
|
|
56
|
+
onKeyDown={onKeyDown}
|
|
57
|
+
type="button"
|
|
58
|
+
>
|
|
48
59
|
{children}
|
|
49
60
|
</button>
|
|
50
61
|
);
|