@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
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type KeyboardEvent,
|
|
3
|
+
type MouseEvent,
|
|
4
|
+
useEffect,
|
|
5
|
+
useId,
|
|
6
|
+
useRef,
|
|
7
|
+
} from "react";
|
|
8
|
+
|
|
9
|
+
const ARROW_STEPS = new Map<string, 1 | -1>([
|
|
10
|
+
["ArrowDown", 1],
|
|
11
|
+
["ArrowUp", -1],
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
const isPlainKey = (event: KeyboardEvent<HTMLElement>) =>
|
|
15
|
+
!(
|
|
16
|
+
event.altKey ||
|
|
17
|
+
event.ctrlKey ||
|
|
18
|
+
event.metaKey ||
|
|
19
|
+
event.shiftKey ||
|
|
20
|
+
event.nativeEvent.isComposing
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const keepFocusInField = (event: MouseEvent) => event.preventDefault();
|
|
24
|
+
|
|
25
|
+
const useListScrolledToActive = (activeId: string | undefined) => {
|
|
26
|
+
const listbox = useRef<HTMLDivElement>(null);
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (activeId) {
|
|
30
|
+
listbox.current
|
|
31
|
+
?.querySelector('[role="option"][aria-selected="true"]')
|
|
32
|
+
?.scrollIntoView({ block: "nearest" });
|
|
33
|
+
}
|
|
34
|
+
}, [activeId]);
|
|
35
|
+
|
|
36
|
+
return listbox;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const useFieldList = ({
|
|
40
|
+
active,
|
|
41
|
+
expanded,
|
|
42
|
+
onMove,
|
|
43
|
+
onPick,
|
|
44
|
+
}: {
|
|
45
|
+
active: number | undefined;
|
|
46
|
+
expanded: boolean;
|
|
47
|
+
onMove: (by: 1 | -1) => void;
|
|
48
|
+
onPick: (index: number) => void;
|
|
49
|
+
}) => {
|
|
50
|
+
const id = useId();
|
|
51
|
+
const optionId = (index: number) => `${id}-${index}`;
|
|
52
|
+
|
|
53
|
+
const activeId =
|
|
54
|
+
expanded && active !== undefined ? optionId(active) : undefined;
|
|
55
|
+
|
|
56
|
+
const listbox = useListScrolledToActive(activeId);
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
field: {
|
|
60
|
+
"aria-activedescendant": activeId,
|
|
61
|
+
"aria-autocomplete": "list" as const,
|
|
62
|
+
"aria-controls": expanded ? id : undefined,
|
|
63
|
+
"aria-expanded": expanded,
|
|
64
|
+
role: "combobox",
|
|
65
|
+
},
|
|
66
|
+
group: (label: string) => ({ "aria-label": label, role: "group" }),
|
|
67
|
+
listbox: { id, ref: listbox, role: "listbox" },
|
|
68
|
+
moves: (event: KeyboardEvent<HTMLElement>) => {
|
|
69
|
+
const by = ARROW_STEPS.get(event.key);
|
|
70
|
+
|
|
71
|
+
if (by === undefined || !isPlainKey(event) || !expanded) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
onMove(by);
|
|
77
|
+
|
|
78
|
+
return true;
|
|
79
|
+
},
|
|
80
|
+
option: (index: number) => ({
|
|
81
|
+
"aria-selected": index === active,
|
|
82
|
+
id: optionId(index),
|
|
83
|
+
onClick: () => onPick(index),
|
|
84
|
+
onMouseDown: keepFocusInField,
|
|
85
|
+
role: "option",
|
|
86
|
+
}),
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export type FieldList = ReturnType<typeof useFieldList>;
|
|
@@ -37,16 +37,18 @@ var mcp_default = defineCommand({
|
|
|
37
37
|
console.info = console.error;
|
|
38
38
|
console.debug = console.error;
|
|
39
39
|
const root = await contentRoot(args.root);
|
|
40
|
-
const [{ serveMcp }, { canvasTools }, { commentsToPush }] = await Promise.all([
|
|
40
|
+
const [{ serveMcp }, { canvasTools, studioOf }, { commentsToPush }, { pictureBefore }] = await Promise.all([
|
|
41
41
|
import("../../server/studio-server.mjs"),
|
|
42
42
|
import("../../server/agent-tools.mjs"),
|
|
43
|
-
import("../../server/comments/push.mjs")
|
|
43
|
+
import("../../server/comments/push.mjs"),
|
|
44
|
+
import("../../server/change-pictures.mjs")
|
|
44
45
|
]);
|
|
46
|
+
const findStudio = studioOf(root);
|
|
45
47
|
await serveMcp(root, {
|
|
46
48
|
agent: args.agent,
|
|
47
|
-
push: commentsToPush,
|
|
49
|
+
push: (content, threads, agentSession) => commentsToPush(content, threads, agentSession, { pictureBefore: (found) => pictureBefore(content, found, findStudio) }),
|
|
48
50
|
session,
|
|
49
|
-
tools: canvasTools()
|
|
51
|
+
tools: canvasTools({ findStudio })
|
|
50
52
|
});
|
|
51
53
|
}
|
|
52
54
|
});
|
package/dist/cli/mcp-relay.mjs
CHANGED
|
@@ -48,8 +48,13 @@ const parse = (line) => {
|
|
|
48
48
|
function openRelay({ checkMs = CHECK_MS, handoverMs = HANDOVER_MS, onMove, ready, retryMs = RETRY_MS, running: first, start, startMs = START_MS, toClient }) {
|
|
49
49
|
/** The Dex the server in use is from. */
|
|
50
50
|
let running = first;
|
|
51
|
-
/** The Dex to move to. */
|
|
52
|
-
let
|
|
51
|
+
/** The Dex ready to move to, as the last look found it. */
|
|
52
|
+
let lastReady;
|
|
53
|
+
/**
|
|
54
|
+
* The Dex to move to: the one ready, unless it is the one running. Asked
|
|
55
|
+
* each time, never kept: a move changes which Dex runs.
|
|
56
|
+
*/
|
|
57
|
+
const wanted = () => lastReady !== void 0 && lastReady !== running ? lastReady : void 0;
|
|
53
58
|
let retryAt = 0;
|
|
54
59
|
let moving = false;
|
|
55
60
|
/** The agent left: the server in use ends once any move has. */
|
|
@@ -186,7 +191,7 @@ function openRelay({ checkMs = CHECK_MS, handoverMs = HANDOVER_MS, onMove, ready
|
|
|
186
191
|
};
|
|
187
192
|
/** Move now, when another Dex waits and nothing is open either way. */
|
|
188
193
|
function moveWhenQuiet() {
|
|
189
|
-
const to = wanted;
|
|
194
|
+
const to = wanted();
|
|
190
195
|
const quiet = open.size === 0 && owed.size === 0;
|
|
191
196
|
if (to === void 0 || !hello || Date.now() < retryAt) return;
|
|
192
197
|
if (moving || left || !quiet) return;
|
|
@@ -207,9 +212,8 @@ function openRelay({ checkMs = CHECK_MS, handoverMs = HANDOVER_MS, onMove, ready
|
|
|
207
212
|
* (mcp-handover.ts), also one that began since the last look.
|
|
208
213
|
*/
|
|
209
214
|
const check = () => {
|
|
210
|
-
|
|
211
|
-
wanted
|
|
212
|
-
if (wanted !== void 0 && !moving && Date.now() >= retryAt && open.size > 0) current.send(lineOf({ method: UPDATE_READY }));
|
|
215
|
+
lastReady = ready();
|
|
216
|
+
if (wanted() !== void 0 && !moving && Date.now() >= retryAt && open.size > 0) current.send(lineOf({ method: UPDATE_READY }));
|
|
213
217
|
moveWhenQuiet();
|
|
214
218
|
};
|
|
215
219
|
const checking = setInterval(check, checkMs);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Cell, PageSize, Viewport } from "../shared/canvas-core.mjs";
|
|
1
|
+
import { AskedCell, Cell, PageSize, Viewport } from "../shared/canvas-core.mjs";
|
|
2
2
|
import { ClosedStatus, PlacedElement, ThreadAudience, ThreadPoint, ThreadStatus } from "../shared/threads-core.mjs";
|
|
3
3
|
import { ResolvedDesignSystem } from "../config/design-system.mjs";
|
|
4
4
|
import { Canvas, ViewFrame } from "../shared/canvas-file.mjs";
|
|
@@ -153,9 +153,9 @@ interface CanvasSave {
|
|
|
153
153
|
*/
|
|
154
154
|
export declare function writeCanvas(save: CanvasSave, root: string): Promise<SavedCanvas>;
|
|
155
155
|
/** A canvas and a cell on it. */
|
|
156
|
-
export interface CanvasCell {
|
|
156
|
+
export interface CanvasCell<C extends Omit<Cell, "step"> = Cell> {
|
|
157
157
|
canvas: Canvas;
|
|
158
|
-
cell:
|
|
158
|
+
cell: C;
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
161
161
|
* A cell the person may add to: theirs, or, in someone else's row, the same
|
|
@@ -163,17 +163,34 @@ export interface CanvasCell {
|
|
|
163
163
|
* `newRow`). A new row in someone else's section goes where the cell asks
|
|
164
164
|
* (rowBefore): in the person's own row there, or one right below theirs.
|
|
165
165
|
*/
|
|
166
|
-
export declare function ownCell(canvas: Canvas, cell:
|
|
166
|
+
export declare function ownCell<C extends Omit<Cell, "step">>(canvas: Canvas, cell: C, person: string, { newRow }?: {
|
|
167
167
|
newRow?: boolean;
|
|
168
|
-
}): CanvasCell
|
|
168
|
+
}): CanvasCell<C>;
|
|
169
|
+
/**
|
|
170
|
+
* The key a frame is at now, found by its uid first, then its key
|
|
171
|
+
* (targetFrameKey); none when no one frame has it.
|
|
172
|
+
*/
|
|
173
|
+
export declare const frameKeyOn: (canvas: Canvas, target: {
|
|
174
|
+
frame: string;
|
|
175
|
+
uid?: string;
|
|
176
|
+
}) => string | undefined;
|
|
177
|
+
/** The cell a frame is in now (frameKeyOn); none when it is gone. */
|
|
178
|
+
export declare function cellOfFrame(canvas: Canvas, target: {
|
|
179
|
+
frame: string;
|
|
180
|
+
uid?: string;
|
|
181
|
+
}): Cell | undefined;
|
|
169
182
|
/**
|
|
170
183
|
* Put a frame for a view in a cell of a prototype's canvas (placeViewInCell),
|
|
171
184
|
* reading and writing canvas.json in one turn, so agents placing frames at
|
|
172
|
-
* once never lose each other's
|
|
173
|
-
*
|
|
185
|
+
* once never lose each other's, and a frame asked for right of another
|
|
186
|
+
* (`rightOf`) or with no step (stepAsked) is placed by the canvas as it is
|
|
187
|
+
* then. A frame for the view already in the cell is kept. Returns its key,
|
|
188
|
+
* its uid and whether it was added, or { problems }.
|
|
174
189
|
*/
|
|
175
|
-
export declare function placeViewFrame({ slug, cell, view, viewport, size, person, newRow, stack }: {
|
|
176
|
-
cell:
|
|
190
|
+
export declare function placeViewFrame({ slug, cell: asked, view, viewport, size, person, newRow, stack }: {
|
|
191
|
+
cell: AskedCell | {
|
|
192
|
+
rightOf: string;
|
|
193
|
+
};
|
|
177
194
|
/**
|
|
178
195
|
* In someone else's row, put it in a new row of the person's right
|
|
179
196
|
* below it, not the one they have there.
|
package/dist/content/content.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { dexRunner, packageManager } from "../harness/src/connect/package-manage
|
|
|
2
2
|
import { NOT_RECOGNISED, youOf } from "../shared/studio-routes.mjs";
|
|
3
3
|
import { isOneOf, isRecord, isText } from "../shared/checks.mjs";
|
|
4
4
|
import { PROTOTYPES_FOLDER, framePage, isSlug, newFileId, placeOf, prototypeFiles, prototypePage, slugify } from "../shared/prototypes-core.mjs";
|
|
5
|
-
import { appendOwnFrame, canvasFormProblems, canvasFrames, canvasProblems, placeViewInCell, stackPiles, uniqueId, viewOf } from "../shared/canvas-core.mjs";
|
|
6
|
-
import { agentChange, describeThread } from "../shared/threads-core.mjs";
|
|
5
|
+
import { appendOwnFrame, canvasFormProblems, canvasFrames, canvasProblems, parseFrameKey, placeViewInCell, stackPiles, stepAsked, uniqueId, viewOf, whereInRow } from "../shared/canvas-core.mjs";
|
|
6
|
+
import { agentChange, describeThread, targetFrameKey } from "../shared/threads-core.mjs";
|
|
7
7
|
import { targetForPath } from "../shared/live-presence.mjs";
|
|
8
8
|
import { prepareState, studioState } from "../server/state.mjs";
|
|
9
9
|
import { openPresence } from "../server/presence.mjs";
|
|
@@ -325,17 +325,74 @@ function ownCell(canvas, cell, person, { newRow = false } = {}) {
|
|
|
325
325
|
};
|
|
326
326
|
}
|
|
327
327
|
/**
|
|
328
|
+
* The key a frame is at now, found by its uid first, then its key
|
|
329
|
+
* (targetFrameKey); none when no one frame has it.
|
|
330
|
+
*/
|
|
331
|
+
const frameKeyOn = (canvas, target) => targetFrameKey(target, canvasFrames(canvas).map(({ key, frame }) => ({
|
|
332
|
+
key,
|
|
333
|
+
uid: frame.uid
|
|
334
|
+
})));
|
|
335
|
+
/** The cell a frame is in now (frameKeyOn); none when it is gone. */
|
|
336
|
+
function cellOfFrame(canvas, target) {
|
|
337
|
+
const key = frameKeyOn(canvas, target);
|
|
338
|
+
const where = key === void 0 ? void 0 : whereInRow(canvas, key);
|
|
339
|
+
if (!(key && where)) return;
|
|
340
|
+
const { section, row } = parseFrameKey(key);
|
|
341
|
+
return {
|
|
342
|
+
section,
|
|
343
|
+
row,
|
|
344
|
+
step: where.step
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* The cell asked for, before the person's own row is found: right of the
|
|
349
|
+
* frame `rightOf` names (its uid or key), where it is now; or, with no row,
|
|
350
|
+
* step or `above`, at the end of the section's first row, its main path.
|
|
351
|
+
*/
|
|
352
|
+
function cellWanted(canvas, asked) {
|
|
353
|
+
if ("rightOf" in asked) {
|
|
354
|
+
const { rightOf } = asked;
|
|
355
|
+
const frame = cellOfFrame(canvas, {
|
|
356
|
+
frame: rightOf,
|
|
357
|
+
uid: rightOf
|
|
358
|
+
});
|
|
359
|
+
if (!frame) return { problem: `No frame "${rightOf}" on the canvas, or more than one with that uid. Name it by its key ("section/row/frame") as canvas.json has it now.` };
|
|
360
|
+
return {
|
|
361
|
+
section: frame.section,
|
|
362
|
+
row: frame.row,
|
|
363
|
+
after: frame.step
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
const { above, row, step } = asked;
|
|
367
|
+
if (row !== void 0 || step !== void 0 || above !== void 0) return asked;
|
|
368
|
+
const main = canvas.sections.find((each) => each.id === asked.section)?.rows[0];
|
|
369
|
+
return main ? {
|
|
370
|
+
...asked,
|
|
371
|
+
row: main.id
|
|
372
|
+
} : asked;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
328
375
|
* Put a frame for a view in a cell of a prototype's canvas (placeViewInCell),
|
|
329
376
|
* reading and writing canvas.json in one turn, so agents placing frames at
|
|
330
|
-
* once never lose each other's
|
|
331
|
-
*
|
|
377
|
+
* once never lose each other's, and a frame asked for right of another
|
|
378
|
+
* (`rightOf`) or with no step (stepAsked) is placed by the canvas as it is
|
|
379
|
+
* then. A frame for the view already in the cell is kept. Returns its key,
|
|
380
|
+
* its uid and whether it was added, or { problems }.
|
|
332
381
|
*/
|
|
333
|
-
function placeViewFrame({ slug, cell, view, viewport, size, person, newRow, stack }, root) {
|
|
382
|
+
function placeViewFrame({ slug, cell: asked, view, viewport, size, person, newRow, stack }, root) {
|
|
334
383
|
return queued(root, slug, async () => {
|
|
335
384
|
const saver = person;
|
|
336
|
-
const
|
|
385
|
+
const read = await readCanvas(slug, root);
|
|
386
|
+
const wanted = cellWanted(read, asked);
|
|
387
|
+
if ("problem" in wanted) return { problems: [wanted.problem] };
|
|
388
|
+
const { canvas, cell: own } = ownCell(read, wanted, saver, { newRow });
|
|
389
|
+
const past = own.row === wanted.row ? void 0 : wanted.row;
|
|
390
|
+
const cell = {
|
|
391
|
+
...own,
|
|
392
|
+
step: stepAsked(canvas, own, view, past)
|
|
393
|
+
};
|
|
337
394
|
const { devices } = await loadDevices(root);
|
|
338
|
-
const placed = placeViewInCell(canvas,
|
|
395
|
+
const placed = placeViewInCell(canvas, cell, {
|
|
339
396
|
view,
|
|
340
397
|
viewport,
|
|
341
398
|
size,
|
|
@@ -1401,4 +1458,4 @@ function createContentCommands({ content, port, designSystem, root: projectRoot
|
|
|
1401
1458
|
};
|
|
1402
1459
|
}
|
|
1403
1460
|
//#endregion
|
|
1404
|
-
export { STATUSES, addContributor, allowedPrefixes, canvasParts, changedFiles, check, checkStudio, contributorProblems, createContentCommands, createPrototype, createUntitledPrototype, currentPerson, deletePrototype, duplicatePrototype, framePageOf, git, githubAccountLogin, githubLogin, identify, identityFrom, joinCurrentPerson, knownFor, linkGithub, loadStudio, manifestProblems, outOfScope, ownCell, placeViewFrame, queued, readCanvas, readCanvasRevision, readPrototypePicks, removePick, savePick, scratchView, setPrototypeCover, setPrototypeStatus, setPrototypeTitle, snapshot, targetForFile, whoami, writeCanvas };
|
|
1461
|
+
export { STATUSES, addContributor, allowedPrefixes, canvasParts, cellOfFrame, changedFiles, check, checkStudio, contributorProblems, createContentCommands, createPrototype, createUntitledPrototype, currentPerson, deletePrototype, duplicatePrototype, frameKeyOn, framePageOf, git, githubAccountLogin, githubLogin, identify, identityFrom, joinCurrentPerson, knownFor, linkGithub, loadStudio, manifestProblems, outOfScope, ownCell, placeViewFrame, queued, readCanvas, readCanvasRevision, readPrototypePicks, removePick, savePick, scratchView, setPrototypeCover, setPrototypeStatus, setPrototypeTitle, snapshot, targetForFile, whoami, writeCanvas };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PageLooks } from "../shared/page-looks.mjs";
|
|
1
2
|
import { Browser } from "playwright";
|
|
2
3
|
//#region src/content/screenshot.d.ts
|
|
3
4
|
/** A page's size in CSS pixels. */
|
|
@@ -41,6 +42,7 @@ export declare const shotViewport: ({ size, viewport }: Pick<ShotRequest, "size"
|
|
|
41
42
|
/** A view's picture, and what looked wrong on its page. */
|
|
42
43
|
export interface ViewShot {
|
|
43
44
|
image: Buffer;
|
|
45
|
+
looks?: PageLooks;
|
|
44
46
|
/**
|
|
45
47
|
* What a picture hides: errors the page threw or logged, and a page wider
|
|
46
48
|
* than its viewport.
|
|
@@ -2,6 +2,7 @@ import { viewInFrame } from "../shared/prototypes-core.mjs";
|
|
|
2
2
|
import { VIEWPORTS } from "../shared/canvas-core.mjs";
|
|
3
3
|
import { captureHeaders } from "./hosted-person.mjs";
|
|
4
4
|
import { VIEW_RENDERED } from "../shared/page-messages.mjs";
|
|
5
|
+
import { LOOKS_SELECTORS, pageLooks } from "../shared/page-looks.mjs";
|
|
5
6
|
import { XRAY_CSS } from "../shared/xray.mjs";
|
|
6
7
|
import { existsSync } from "node:fs";
|
|
7
8
|
//#region src/content/screenshot.ts
|
|
@@ -241,12 +242,14 @@ async function capture(site, { href, size, viewport, scheme, xray }, { scale, se
|
|
|
241
242
|
await page.waitForTimeout(settle);
|
|
242
243
|
const overflow = Number(await page.evaluate("document.documentElement.scrollWidth - window.innerWidth"));
|
|
243
244
|
if (overflow > 0) problems.push(`overflows horizontally by ${overflow}px`);
|
|
245
|
+
const looks = await page.evaluate(pageLooks, LOOKS_SELECTORS);
|
|
244
246
|
return {
|
|
245
247
|
image: await page.screenshot({
|
|
246
248
|
fullPage: true,
|
|
247
249
|
type,
|
|
248
250
|
...type === "jpeg" && { quality: PICTURE_QUALITY }
|
|
249
251
|
}),
|
|
252
|
+
looks,
|
|
250
253
|
problems: [...new Set(problems)]
|
|
251
254
|
};
|
|
252
255
|
} finally {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PageLooks } from "../shared/page-looks.mjs";
|
|
1
2
|
import { ViewShot } from "./screenshot.mjs";
|
|
2
3
|
//#region src/content/snapshot-client.d.ts
|
|
3
4
|
/** One view to snapshot: its frame page, and how to show it. */
|
|
@@ -12,6 +13,7 @@ export interface SnapshotRequest {
|
|
|
12
13
|
/** What the studio answers with: the picture as base64, and its problems. */
|
|
13
14
|
export interface SnapshotBody {
|
|
14
15
|
image: string;
|
|
16
|
+
looks: PageLooks;
|
|
15
17
|
problems: string[];
|
|
16
18
|
}
|
|
17
19
|
/** Why there is no snapshot: Dex is not running, or it said why not. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isRecord } from "../shared/checks.mjs";
|
|
1
2
|
//#region src/content/snapshot-client.ts
|
|
2
3
|
/** Why there is no snapshot: Dex is not running, or it said why not. */
|
|
3
4
|
var SnapshotError = class extends Error {
|
|
@@ -22,6 +23,14 @@ function unreachable(url, error) {
|
|
|
22
23
|
return new SnapshotError(`Dex at ${url} could not be asked: ${cause?.message ?? error?.message ?? String(error)}`);
|
|
23
24
|
}
|
|
24
25
|
const strings = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
26
|
+
const looksIn = (value) => {
|
|
27
|
+
if (!isRecord(value) || typeof value.blank !== "boolean") return;
|
|
28
|
+
const { blank, error } = value;
|
|
29
|
+
return typeof error === "string" ? {
|
|
30
|
+
blank,
|
|
31
|
+
error
|
|
32
|
+
} : { blank };
|
|
33
|
+
};
|
|
25
34
|
/** The studio's answer as JSON, or undefined when it is not. */
|
|
26
35
|
const json = (text) => {
|
|
27
36
|
try {
|
|
@@ -50,9 +59,11 @@ async function snapshotView(url, { href, scale = 1, scheme, viewport }) {
|
|
|
50
59
|
const answer = json(text);
|
|
51
60
|
if (!response.ok) throw new SnapshotError((strings(answer?.problems).join(" ") || text).slice(0, 400), response.status);
|
|
52
61
|
if (typeof answer?.image !== "string") throw new SnapshotError(`Dex at ${url} answered without a picture: ${text.slice(0, 200)}`, response.status);
|
|
62
|
+
const looks = looksIn(answer.looks);
|
|
53
63
|
return {
|
|
54
64
|
image: Buffer.from(answer.image, "base64"),
|
|
55
|
-
problems: strings(answer.problems)
|
|
65
|
+
problems: strings(answer.problems),
|
|
66
|
+
...looks && { looks }
|
|
56
67
|
};
|
|
57
68
|
}
|
|
58
69
|
//#endregion
|
package/dist/inspector.js
CHANGED
|
@@ -149,22 +149,29 @@ function inside(element, skip, last) {
|
|
|
149
149
|
if (reached) return reached;
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
+
const holds = (element, skip, wholePage) => element === element.ownerDocument.documentElement ? wholePage : !skip(element);
|
|
152
153
|
/**
|
|
153
154
|
* The element the inspector holds for one the pointer is over: it, or the
|
|
154
155
|
* nearest element holding it that isn't passed over. None at the root.
|
|
155
156
|
*/
|
|
156
|
-
const landOn = (element, skip) => {
|
|
157
|
-
|
|
158
|
-
for (let at = element; at && at !== root; at = at.parentElement ?? void 0) if (!skip(at)) return at;
|
|
157
|
+
const landOn = (element, skip, wholePage = false) => {
|
|
158
|
+
for (let at = element; at; at = at.parentElement ?? void 0) if (holds(at, skip, wholePage)) return at;
|
|
159
159
|
};
|
|
160
160
|
/** The parent to step up to, noting `element` in `trail` to come back to. */
|
|
161
|
-
const up = (element, trail, skip) => {
|
|
162
|
-
|
|
163
|
-
for (let parent = element.parentElement; parent && parent !== root; parent = parent.parentElement) if (!skip(parent)) {
|
|
161
|
+
const up = (element, trail, skip, wholePage) => {
|
|
162
|
+
for (let parent = element.parentElement; parent; parent = parent.parentElement) if (holds(parent, skip, wholePage)) {
|
|
164
163
|
trail.push(element);
|
|
165
164
|
return parent;
|
|
166
165
|
}
|
|
167
166
|
};
|
|
167
|
+
const top = (element, trail, skip, wholePage) => {
|
|
168
|
+
let at = element;
|
|
169
|
+
for (let next = up(at, [], skip, wholePage); next; next = up(at, [], skip, wholePage)) at = next;
|
|
170
|
+
if (at !== element) {
|
|
171
|
+
trail.push(element);
|
|
172
|
+
return at;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
168
175
|
/**
|
|
169
176
|
* Back along `trail` while the way is still in `element`, else the first
|
|
170
177
|
* element in it: a step across, or the page changing, leaves the way.
|
|
@@ -191,14 +198,45 @@ const across = (element, last, skip) => {
|
|
|
191
198
|
}
|
|
192
199
|
};
|
|
193
200
|
/** Where a step from `element` goes; none when it goes nowhere. */
|
|
194
|
-
const stepFrom = (element, step, trail, skip) => {
|
|
201
|
+
const stepFrom = (element, step, trail, skip, wholePage = false) => {
|
|
195
202
|
switch (step) {
|
|
196
|
-
case "up": return up(element, trail, skip);
|
|
203
|
+
case "up": return up(element, trail, skip, wholePage);
|
|
204
|
+
case "top": return top(element, trail, skip, wholePage);
|
|
197
205
|
case "down": return down(element, trail, skip);
|
|
198
206
|
default: return across(element, step === "previous", skip);
|
|
199
207
|
}
|
|
200
208
|
};
|
|
201
209
|
//#endregion
|
|
210
|
+
//#region ../inspector/src/deep-select.ts
|
|
211
|
+
const isDeepSelect = ({ ctrlKey, metaKey }) => metaKey || ctrlKey;
|
|
212
|
+
const boxHolds = (element, x, y) => {
|
|
213
|
+
const { bottom, height, left, right, top, width } = element.getBoundingClientRect();
|
|
214
|
+
return width > 0 && height > 0 && x >= left && x <= right && y >= top && y <= bottom;
|
|
215
|
+
};
|
|
216
|
+
const elementsAtPoint = (page, x, y) => page.elementsFromPoint(x, y).filter((element) => boxHolds(element, x, y));
|
|
217
|
+
const areaOf = (element) => {
|
|
218
|
+
const { height, width } = element.getBoundingClientRect();
|
|
219
|
+
return width * height;
|
|
220
|
+
};
|
|
221
|
+
const depthOf = (element) => {
|
|
222
|
+
let depth = 0;
|
|
223
|
+
for (let at = element.parentElement; at; at = at.parentElement) depth += 1;
|
|
224
|
+
return depth;
|
|
225
|
+
};
|
|
226
|
+
const smallerThenDeeper = (a, b) => a.area - b.area || b.depth - a.depth;
|
|
227
|
+
const bestMatches = (topmostFirst, skip, wholePage) => {
|
|
228
|
+
const held = /* @__PURE__ */ new Set();
|
|
229
|
+
for (const element of topmostFirst) {
|
|
230
|
+
const landed = landOn(element, skip, wholePage);
|
|
231
|
+
if (landed && isSeen(landed)) held.add(landed);
|
|
232
|
+
}
|
|
233
|
+
return [...held].map((element) => ({
|
|
234
|
+
area: areaOf(element),
|
|
235
|
+
depth: depthOf(element),
|
|
236
|
+
element
|
|
237
|
+
})).toSorted(smallerThenDeeper).map(({ element }) => element);
|
|
238
|
+
};
|
|
239
|
+
//#endregion
|
|
202
240
|
//#region ../inspector/src/inspector.ts
|
|
203
241
|
const SKIP_NONE = () => false;
|
|
204
242
|
/** The step each arrow key takes, in every tool. */
|
|
@@ -209,12 +247,28 @@ const STEP_KEYS = /* @__PURE__ */ new Map([
|
|
|
209
247
|
["ArrowUp", "up"]
|
|
210
248
|
]);
|
|
211
249
|
/** The step a key takes: the arrows'; none for any other key. */
|
|
212
|
-
const stepOf = (key) =>
|
|
213
|
-
|
|
250
|
+
const stepOf = ({ ctrlKey = false, key, metaKey = false }) => {
|
|
251
|
+
if (!(metaKey || ctrlKey)) return STEP_KEYS.get(key);
|
|
252
|
+
return key === "ArrowUp" ? "top" : void 0;
|
|
253
|
+
};
|
|
254
|
+
const sameElements = (a, b) => a.length === b.length && a.every((element, index) => element === b[index]);
|
|
255
|
+
const inspector = ({ elementAt, elementsAt, deep, wholePage = false, skip = SKIP_NONE, start, onChange }) => {
|
|
214
256
|
let current;
|
|
215
257
|
let chosen;
|
|
216
258
|
let trail = [];
|
|
217
259
|
let steered;
|
|
260
|
+
let lastDeepClick;
|
|
261
|
+
const asksDeep = (point) => deep?.(point) === true;
|
|
262
|
+
const plainAt = (point) => landOn(elementAt(point), skip, wholePage);
|
|
263
|
+
const bestMatchesAt = (point) => bestMatches(elementsAt?.(point) ?? [elementAt(point)].filter((element) => element !== void 0), skip, wholePage);
|
|
264
|
+
const tookAtSameSpot = (matches) => lastDeepClick && sameElements(matches, lastDeepClick.matches) ? lastDeepClick.took : void 0;
|
|
265
|
+
const outline = (under) => {
|
|
266
|
+
steered = void 0;
|
|
267
|
+
if (under === current) return;
|
|
268
|
+
current = under;
|
|
269
|
+
if (!chosen) trail = [];
|
|
270
|
+
onChange?.();
|
|
271
|
+
};
|
|
218
272
|
/** The pointer is on what the keys stepped to, or stepped from. */
|
|
219
273
|
const onSteered = (under) => steered !== void 0 && (under === steered.from || under !== void 0 && current?.contains(under) === true);
|
|
220
274
|
return {
|
|
@@ -232,14 +286,37 @@ const inspector = ({ elementAt, skip = SKIP_NONE, start, onChange }) => {
|
|
|
232
286
|
}
|
|
233
287
|
return chosen;
|
|
234
288
|
},
|
|
289
|
+
click: (point) => {
|
|
290
|
+
if (!asksDeep(point)) {
|
|
291
|
+
lastDeepClick = void 0;
|
|
292
|
+
const under = plainAt(point);
|
|
293
|
+
if (!onSteered(under)) outline(under);
|
|
294
|
+
return current;
|
|
295
|
+
}
|
|
296
|
+
const matches = bestMatchesAt(point);
|
|
297
|
+
const took = tookAtSameSpot(matches);
|
|
298
|
+
const next = took ? matches[(matches.indexOf(took) + 1) % matches.length] : matches[0];
|
|
299
|
+
lastDeepClick = next ? {
|
|
300
|
+
matches,
|
|
301
|
+
took: next
|
|
302
|
+
} : void 0;
|
|
303
|
+
outline(next);
|
|
304
|
+
return current;
|
|
305
|
+
},
|
|
235
306
|
hover: (point) => {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
if (
|
|
242
|
-
|
|
307
|
+
if (point === void 0) {
|
|
308
|
+
outline(void 0);
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
let under;
|
|
312
|
+
if (asksDeep(point)) {
|
|
313
|
+
const matches = bestMatchesAt(point);
|
|
314
|
+
under = tookAtSameSpot(matches) ?? matches[0];
|
|
315
|
+
} else {
|
|
316
|
+
lastDeepClick = void 0;
|
|
317
|
+
under = plainAt(point);
|
|
318
|
+
}
|
|
319
|
+
if (!onSteered(under)) outline(under);
|
|
243
320
|
},
|
|
244
321
|
release: () => {
|
|
245
322
|
const held = chosen !== void 0;
|
|
@@ -261,7 +338,7 @@ const inspector = ({ elementAt, skip = SKIP_NONE, start, onChange }) => {
|
|
|
261
338
|
}
|
|
262
339
|
return;
|
|
263
340
|
}
|
|
264
|
-
const to = stepFrom(from, step, trail, skip);
|
|
341
|
+
const to = stepFrom(from, step, trail, skip, wholePage);
|
|
265
342
|
if (!to) return;
|
|
266
343
|
if (chosen) chosen = to;
|
|
267
344
|
else {
|
|
@@ -595,4 +672,4 @@ const readAnchor = (value) => {
|
|
|
595
672
|
} : void 0;
|
|
596
673
|
};
|
|
597
674
|
//#endregion
|
|
598
|
-
export { anchorOf, find, inspector, labelledWords, namingClasses, openersOf, readAnchor, stepOf, wordsOf };
|
|
675
|
+
export { anchorOf, elementsAtPoint, find, inspector, isDeepSelect, labelledWords, namingClasses, openersOf, readAnchor, stepOf, wordsOf };
|
package/dist/paste/paste.d.mts
CHANGED
|
@@ -6,6 +6,11 @@ export interface Pasted {
|
|
|
6
6
|
from: PasteSource;
|
|
7
7
|
/** Images left grey or as links: they could not be brought. */
|
|
8
8
|
images: number;
|
|
9
|
+
/**
|
|
10
|
+
* Parts of an extension's snapshot its page's scripts sized: they keep
|
|
11
|
+
* that size, and won't reflow when the frame is resized.
|
|
12
|
+
*/
|
|
13
|
+
sizedByScripts?: number;
|
|
9
14
|
}
|
|
10
15
|
/**
|
|
11
16
|
* A paste that cannot be read: 400 when the clipboard holds no snapshot,
|
package/dist/paste/paste.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isRecord } from "../shared/checks.mjs";
|
|
1
2
|
import { MAX_SIDE } from "../content/capture.mjs";
|
|
2
3
|
import { isSnapshotClipboard, snapshotFrom } from "../shared/snapshot-clipboard.mjs";
|
|
3
4
|
import { fontBringer } from "./fonts.mjs";
|
|
@@ -42,10 +43,14 @@ const fetchFigmaImage = async (url) => {
|
|
|
42
43
|
};
|
|
43
44
|
const extensionPaste = (html) => {
|
|
44
45
|
try {
|
|
46
|
+
const snapshot = snapshotFrom(html);
|
|
47
|
+
const said = isRecord(snapshot) ? snapshot.sizedByScripts : void 0;
|
|
48
|
+
const sized = Number.isInteger(said) ? Number(said) : 0;
|
|
45
49
|
return {
|
|
46
50
|
from: "extension",
|
|
47
|
-
captures: [
|
|
48
|
-
images: 0
|
|
51
|
+
captures: [snapshot],
|
|
52
|
+
images: 0,
|
|
53
|
+
...sized > 0 && { sizedByScripts: sized }
|
|
49
54
|
};
|
|
50
55
|
} catch (error) {
|
|
51
56
|
throw new PasteProblemError(422, `The snapshot could not be read: ${messageOf(error)}`);
|
|
@@ -12,6 +12,7 @@ export interface CanvasToolOptions {
|
|
|
12
12
|
*/
|
|
13
13
|
findStudio?: () => Promise<StudioFor>;
|
|
14
14
|
}
|
|
15
|
+
export declare const studioOf: (root: string) => () => Promise<StudioFor>;
|
|
15
16
|
/** The canvas's tools, made for each session's server. */
|
|
16
17
|
export declare const canvasTools: ({ feedbackRelay, findStudio }?: CanvasToolOptions) => ToolsFor;
|
|
17
18
|
//#endregion
|
|
@@ -11,10 +11,11 @@ import { openToolContext } from "./tools/studio-context.mjs";
|
|
|
11
11
|
import { threadsTool } from "./tools/thread-list.mjs";
|
|
12
12
|
import { watchTool } from "./tools/watch.mjs";
|
|
13
13
|
//#region src/server/agent-tools.ts
|
|
14
|
+
const studioOf = (root) => async () => studioFor(await loadProject(root));
|
|
14
15
|
/** The canvas's tools, made for each session's server. */
|
|
15
16
|
const canvasTools = ({ feedbackRelay, findStudio } = {}) => (setup) => {
|
|
16
|
-
const
|
|
17
|
-
const
|
|
17
|
+
const studio = findStudio ?? studioOf(setup.root);
|
|
18
|
+
const context = openToolContext(setup, studio);
|
|
18
19
|
return [
|
|
19
20
|
...readingTools(context, setup.briefing),
|
|
20
21
|
threadsTool(context),
|
|
@@ -28,4 +29,4 @@ const canvasTools = ({ feedbackRelay, findStudio } = {}) => (setup) => {
|
|
|
28
29
|
];
|
|
29
30
|
};
|
|
30
31
|
//#endregion
|
|
31
|
-
export { canvasTools };
|
|
32
|
+
export { canvasTools, studioOf };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { KeptPictures, Moment } from "../shared/change-pictures-core.mjs";
|
|
2
|
+
//#region src/server/change-picture-store.d.ts
|
|
3
|
+
export declare const MOST_PICTURE_BYTES = 200000000;
|
|
4
|
+
export interface ChangePictureStore {
|
|
5
|
+
drop: (id: string, moment: Moment) => void;
|
|
6
|
+
image: (id: string, moment: Moment) => Buffer | undefined;
|
|
7
|
+
keep: (id: string, moment: Moment, image: Buffer) => void;
|
|
8
|
+
kept: (id: string) => KeptPictures;
|
|
9
|
+
}
|
|
10
|
+
export declare function changePictureStore({ mostBytes }?: {
|
|
11
|
+
mostBytes?: number;
|
|
12
|
+
}): ChangePictureStore;
|
|
13
|
+
//#endregion
|