@dexhq/canvas 0.13.0 → 0.15.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 +53 -0
- package/README.md +21 -18
- package/app/canvas/activity.tsx +8 -15
- package/app/canvas/anchoring.ts +3 -5
- package/app/canvas/canvas-input.ts +151 -14
- package/app/canvas/canvas-keys.ts +9 -0
- package/app/canvas/canvas-model.ts +5 -42
- package/app/canvas/canvas-panels.ts +1 -17
- package/app/canvas/canvas-scene.ts +7 -3
- package/app/canvas/canvas-ui.ts +2 -1
- package/app/canvas/canvas.css +61 -26
- package/app/canvas/change-notice.tsx +10 -1
- package/app/canvas/comment-layer.tsx +2 -1
- package/app/canvas/comments.tsx +204 -82
- package/app/canvas/element-picker.ts +200 -27
- package/app/canvas/engine/canvas-gestures.ts +72 -17
- package/app/canvas/engine/canvas-store.ts +17 -1
- package/app/canvas/engine/engine.css +6 -3
- package/app/canvas/find-bar.tsx +817 -0
- package/app/canvas/find-model.ts +135 -0
- package/app/canvas/flow-canvas.tsx +18 -2
- package/app/canvas/follow-pin.ts +26 -6
- package/app/canvas/frame-node.tsx +43 -26
- package/app/canvas/imported-reviews.tsx +12 -22
- package/app/canvas/layout.ts +27 -0
- package/app/canvas/live-page.ts +142 -19
- package/app/canvas/page-find.ts +220 -0
- package/app/canvas/page-style.ts +23 -0
- package/app/canvas/section-node.tsx +2 -0
- package/app/canvas/spec-threads.ts +24 -23
- package/app/canvas/thread-focus.tsx +14 -12
- package/app/canvas/tool-cursors.ts +16 -16
- package/app/canvas/use-activity.ts +0 -8
- package/app/canvas/use-agent-changes.tsx +34 -40
- package/app/canvas/use-canvas-clipboard.tsx +11 -14
- package/app/canvas/xray.ts +3 -12
- package/app/frame.tsx +5 -0
- package/app/i18n/locales/en/messages.po +114 -12
- package/app/i18n/locales/en/messages.ts +1 -1
- package/app/i18n/locales/pseudo/messages.po +114 -12
- package/app/i18n/locales/pseudo/messages.ts +1 -1
- package/app/icons/{sets/lucide.tsx → glyphs.tsx} +7 -5
- package/app/icons/index.tsx +3 -3
- package/app/icons/types.ts +3 -10
- package/app/index.html +3 -3
- package/app/main.tsx +3 -0
- package/app/pages/canvas-settings.tsx +35 -0
- package/app/pages/canvas.tsx +27 -8
- package/app/pages/commands-settings.tsx +16 -2
- package/app/shell/about.tsx +5 -4
- package/app/shell/feedback-details.ts +0 -3
- package/app/shell/feedback-form.tsx +10 -21
- package/app/shell/feedback-link.tsx +2 -1
- package/app/shell/instructions-editor.tsx +1 -1
- package/app/shell/presence-style.ts +59 -0
- package/app/shell/presence.tsx +6 -3
- package/app/shell/scaled-frame.tsx +21 -9
- package/app/shell/settings-sections.ts +12 -0
- package/app/shell/sidebar.tsx +1 -1
- package/app/studio-ui.d.ts +0 -9
- package/app/types.ts +21 -205
- package/app/ui/file-drop.ts +128 -0
- package/app/ui/prompt-editor.tsx +1 -1
- package/app/ui/shadcn/input-group.tsx +2 -2
- package/dist/cli/banner.d.mts +4 -2
- package/dist/cli/banner.mjs +34 -11
- package/dist/cli/commands/app.mjs +19 -11
- package/dist/cli/commands/create.d.mts +26 -14
- package/dist/cli/commands/create.mjs +13 -7
- package/dist/cli/commands/dev.mjs +2 -3
- package/dist/cli/commands/hook.mjs +2 -1
- package/dist/cli/commands/init.d.mts +11 -6
- package/dist/cli/help.d.mts +1 -1
- package/dist/cli/help.mjs +3 -3
- package/dist/cli/main.d.mts +22 -12
- package/dist/config/index.d.mts +6 -5
- package/dist/config/project-files.d.mts +6 -3
- package/dist/config/project-files.mjs +14 -5
- package/dist/config/renamed.d.mts +0 -2
- package/dist/config/renamed.mjs +1 -3
- package/dist/config/schema.d.mts +0 -5
- package/dist/config/schema.mjs +0 -5
- package/dist/content/capture.d.mts +2 -2
- package/dist/content/capture.mjs +2 -2
- package/dist/content/content.d.mts +3 -141
- package/dist/content/content.mjs +7 -65
- package/dist/content/flow-specs.mjs +1 -1
- package/dist/content/prototype-summary.d.mts +3 -39
- package/dist/content/prototype-summary.mjs +2 -3
- package/dist/content/prototypes.mjs +1 -1
- package/dist/content/snapshot-client.mjs +1 -1
- package/dist/content/text-replace.d.mts +30 -0
- package/dist/content/text-replace.mjs +309 -0
- package/dist/content/thread-module.mjs +1 -1
- package/dist/content/threads.mjs +1 -1
- package/dist/paths.d.mts +0 -2
- package/dist/paths.mjs +1 -3
- package/dist/server/agent-env.d.mts +5 -1
- package/dist/server/agent-env.mjs +7 -2
- package/dist/server/agent-session.d.mts +14 -1
- package/dist/server/agent-session.mjs +84 -19
- package/dist/server/brief.mjs +3 -3
- package/dist/server/build-pictures.mjs +1 -1
- package/dist/server/channel.d.mts +19 -24
- package/dist/server/channel.mjs +70 -37
- package/dist/server/claimed-presence.d.mts +18 -0
- package/dist/server/claimed-presence.mjs +58 -0
- package/dist/server/close-check.mjs +2 -2
- package/dist/server/comments/actions.d.mts +153 -0
- package/dist/server/comments/actions.mjs +154 -0
- package/dist/server/comments/routes.d.mts +25 -0
- package/dist/server/comments/routes.mjs +88 -0
- package/dist/server/comments/tools.d.mts +6 -0
- package/dist/server/comments/tools.mjs +154 -0
- package/dist/server/dev-server.mjs +36 -13
- package/dist/server/file-errors.d.mts +7 -2
- package/dist/server/file-errors.mjs +31 -8
- package/dist/server/file-lock.d.mts +2 -2
- package/dist/server/file-lock.mjs +130 -36
- package/dist/server/mcp.d.mts +0 -2
- package/dist/server/mcp.mjs +7 -8
- package/dist/server/me.d.mts +1 -1
- package/dist/server/open-page.d.mts +22 -0
- package/dist/server/open-page.mjs +20 -2
- package/dist/server/outcome.d.mts +22 -0
- package/dist/server/outcome.mjs +8 -0
- package/dist/server/own-copies.mjs +2 -2
- package/dist/server/people.d.mts +1 -1
- package/dist/server/port.d.mts +12 -0
- package/dist/server/port.mjs +66 -14
- package/dist/server/presence.d.mts +4 -1
- package/dist/server/presence.mjs +2 -2
- package/dist/server/requests.d.mts +5 -1
- package/dist/server/requests.mjs +32 -47
- package/dist/server/studio-for.d.mts +5 -0
- package/dist/server/studio-for.mjs +18 -4
- package/dist/server/sync-install.d.mts +8 -12
- package/dist/server/sync-install.mjs +12 -30
- package/dist/server/thread-source.mjs +2 -2
- package/dist/server/tools/describe.d.mts +1 -1
- package/dist/server/tools/describe.mjs +1 -1
- package/dist/server/tools/feedback.d.mts +1 -1
- package/dist/server/tools/reading.mjs +13 -4
- package/dist/server/tools/show.d.mts +1 -1
- package/dist/server/tools/snapshot.d.mts +1 -1
- package/dist/server/tools/thread-list.mjs +1 -1
- package/dist/server/tools/watch.mjs +5 -3
- package/dist/server/vite.mjs +28 -31
- package/dist/server/web-app.mjs +7 -10
- package/dist/server/work-groups.mjs +1 -1
- package/dist/setup/apply.mjs +8 -14
- package/dist/setup/create.d.mts +4 -2
- package/dist/setup/create.mjs +118 -36
- package/dist/setup/design-system-checks.mjs +3 -12
- package/dist/setup/desktop-app-script.mjs +4 -3
- package/dist/setup/desktop-app-start.d.mts +8 -2
- package/dist/setup/desktop-app-start.mjs +64 -29
- package/dist/setup/desktop-app.d.mts +8 -0
- package/dist/setup/desktop-app.mjs +20 -4
- package/dist/setup/detect.d.mts +14 -7
- package/dist/setup/detect.mjs +56 -10
- package/dist/setup/doctor.mjs +2 -4
- package/dist/setup/existing-setup.d.mts +1 -3
- package/dist/setup/existing-setup.mjs +10 -11
- package/dist/setup/migrate/row-titles.mjs +1 -1
- package/dist/setup/own-app.d.mts +1 -2
- package/dist/setup/own-app.mjs +4 -5
- package/dist/setup/plan.d.mts +8 -6
- package/dist/setup/plan.mjs +64 -48
- package/dist/setup/project.d.mts +6 -17
- package/dist/setup/project.mjs +17 -61
- package/dist/setup/prompts.d.mts +5 -5
- package/dist/setup/prompts.mjs +28 -61
- package/dist/setup/questions.d.mts +12 -4
- package/dist/setup/questions.mjs +10 -25
- package/dist/setup/starters.d.mts +2 -0
- package/dist/setup/starters.mjs +26 -9
- package/dist/setup/workspace-setup.d.mts +1 -2
- package/dist/setup/workspace-setup.mjs +4 -6
- package/dist/setup/write.d.mts +15 -5
- package/dist/setup/write.mjs +35 -9
- package/dist/shared/annotations-core.mjs +1 -1
- package/dist/shared/canvas-core.mjs +1 -1
- package/dist/shared/canvas-file.d.mts +201 -0
- package/dist/shared/canvas-file.mjs +1 -0
- package/dist/shared/comments/routes.d.mts +53 -0
- package/dist/shared/comments/routes.mjs +37 -0
- package/dist/shared/feedback.d.mts +8 -0
- package/dist/shared/feedback.mjs +10 -2
- package/dist/shared/page-review.d.mts +2 -11
- package/dist/shared/page-review.mjs +4 -13
- package/dist/shared/presence-core.d.mts +11 -0
- package/dist/shared/presence-core.mjs +11 -2
- package/dist/shared/review-file.d.mts +5 -0
- package/dist/shared/review-file.mjs +23 -13
- package/dist/shared/server-page.mjs +7 -1
- package/dist/shared/signup.d.mts +2 -5
- package/dist/shared/signup.mjs +2 -35
- package/dist/shared/studio-events.d.mts +0 -6
- package/dist/shared/studio-events.mjs +1 -5
- package/dist/shared/studio-files.d.mts +12 -0
- package/dist/shared/studio-files.mjs +6 -1
- package/dist/shared/studio-routes.d.mts +16 -62
- package/dist/shared/studio-routes.mjs +1 -69
- package/dist/shared/threads-core.d.mts +2 -2
- package/dist/shared/threads-core.mjs +1 -1
- package/extension/dist/feedback.js +148 -138
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/picker.js +146 -136
- package/package.json +3 -20
- package/src/cli/banner.ts +45 -11
- package/src/cli/commands/app.ts +23 -8
- package/src/cli/commands/create.ts +17 -9
- package/src/cli/commands/dev.ts +0 -3
- package/src/cli/commands/hook.ts +4 -1
- package/src/cli/help.ts +3 -3
- package/src/config/index.ts +6 -5
- package/src/config/project-files.ts +21 -11
- package/src/config/renamed.ts +0 -3
- package/src/config/schema.ts +0 -1
- package/src/content/capture.ts +6 -12
- package/src/content/content.ts +7 -244
- package/src/content/flow-specs.ts +2 -1
- package/src/content/prototype-summary.ts +4 -44
- package/src/content/review-pages.ts +2 -1
- package/src/content/snapshot-client.ts +1 -1
- package/src/content/text-replace.ts +449 -0
- package/src/paths.ts +0 -8
- package/src/server/agent-env.ts +12 -2
- package/src/server/agent-session.ts +124 -34
- package/src/server/brief.ts +8 -3
- package/src/server/channel.ts +121 -52
- package/src/server/claimed-presence.ts +93 -0
- package/src/server/comments/actions.ts +352 -0
- package/src/server/comments/routes.ts +176 -0
- package/src/server/comments/tools.ts +317 -0
- package/src/server/dev-server.ts +49 -15
- package/src/server/file-errors.ts +47 -13
- package/src/server/file-lock.ts +205 -54
- package/src/server/mcp.ts +13 -14
- package/src/server/me.ts +2 -5
- package/src/server/open-page.ts +54 -4
- package/src/server/outcome.ts +26 -0
- package/src/server/people.ts +2 -1
- package/src/server/port.ts +94 -20
- package/src/server/presence.ts +11 -3
- package/src/server/requests.ts +60 -70
- package/src/server/studio-for.ts +27 -3
- package/src/server/sync-install.ts +35 -26
- package/src/server/thread-place.ts +2 -4
- package/src/server/tools/reading.ts +16 -3
- package/src/server/tools/watch.ts +7 -7
- package/src/server/vite.ts +37 -40
- package/src/server/web-app.ts +14 -12
- package/src/setup/apply.ts +10 -16
- package/src/setup/create.ts +143 -37
- package/src/setup/design-system-checks.ts +7 -15
- package/src/setup/desktop-app-script.ts +4 -3
- package/src/setup/desktop-app-start.ts +94 -26
- package/src/setup/desktop-app.ts +24 -3
- package/src/setup/detect.ts +56 -14
- package/src/setup/doctor.ts +4 -4
- package/src/setup/existing-setup.ts +10 -12
- package/src/setup/own-app.ts +2 -5
- package/src/setup/plan.ts +93 -84
- package/src/setup/project.ts +25 -118
- package/src/setup/prompts.ts +44 -127
- package/src/setup/questions.ts +27 -29
- package/src/setup/starters.ts +35 -10
- package/src/setup/workspace-setup.ts +8 -18
- package/src/setup/write.ts +52 -9
- package/src/shared/canvas-file.ts +205 -0
- package/src/shared/comments/routes.ts +79 -0
- package/src/shared/feedback.ts +14 -4
- package/src/shared/page-review.ts +11 -16
- package/src/shared/presence-core.ts +16 -2
- package/src/shared/review-file.ts +28 -12
- package/src/shared/server-page.ts +11 -1
- package/src/shared/signup.ts +4 -28
- package/src/shared/studio-events.ts +0 -13
- package/src/shared/studio-files.ts +14 -0
- package/src/shared/studio-routes.ts +21 -64
- package/src/shared/threads-core.ts +2 -2
- package/templates/methods/review.md +2 -2
- package/templates/rules/canvas-frames.md +104 -0
- package/templates/rules/canvas.md +8 -142
- package/templates/rules/prototypes.md +1 -1
- package/templates/rules/snapshots.md +52 -0
- package/templates/starters/standalone/README.md +7 -7
- package/templates/starters/standalone/components.json +1 -1
- package/templates/starters/standalone/package.json +1 -2
- package/templates/starters/turborepo/README.md +6 -6
- package/templates/starters/turborepo/apps/web/components.json +1 -1
- package/templates/starters/turborepo/apps/web/package.json +1 -2
- package/templates/starters/turborepo/apps/web/src/app.tsx +4 -5
- package/templates/starters/turborepo/packages/ui/components.json +1 -1
- package/templates/starters/turborepo/packages/ui/package.json +1 -2
- package/templates/starters/vite/README.md +7 -6
- package/templates/starters/vite/components.json +1 -1
- package/templates/starters/vite/package.json +1 -2
- package/templates/starters/vite/src/app.tsx +3 -4
- package/templates/starters/vite/src/components/ui/accordion.tsx +71 -0
- package/templates/starters/vite/src/components/ui/attachment.tsx +1 -1
- package/templates/starters/vite/src/components/ui/badge.tsx +2 -2
- package/templates/starters/vite/src/components/ui/button.tsx +17 -12
- package/templates/starters/vite/src/components/ui/card.tsx +1 -1
- package/templates/starters/vite/src/components/ui/checkbox.tsx +28 -0
- package/templates/starters/vite/src/components/ui/dialog.tsx +5 -5
- package/templates/starters/vite/src/components/ui/dropdown-menu.tsx +17 -14
- package/templates/starters/vite/src/components/ui/field.tsx +3 -1
- package/templates/starters/vite/src/components/ui/input-group.tsx +5 -3
- package/templates/starters/vite/src/components/ui/input.tsx +1 -1
- package/templates/starters/vite/src/components/ui/label.tsx +2 -0
- package/templates/starters/vite/src/components/ui/native-select.tsx +3 -4
- package/templates/starters/vite/src/components/ui/popover.tsx +1 -1
- package/templates/starters/vite/src/components/ui/separator.tsx +2 -0
- package/templates/starters/vite/src/components/ui/spinner.tsx +3 -7
- package/templates/starters/vite/src/components/ui/switch.tsx +1 -1
- package/templates/starters/vite/src/components/ui/textarea.tsx +1 -1
- package/templates/starters/vite/src/components/ui/toggle.tsx +4 -2
- package/templates/starters/vite/src/index.css +533 -111
- package/app/icons/sets/hugeicons.tsx +0 -259
- package/app/icons/sets/phosphor.tsx +0 -251
- package/dist/server/icon-set.d.mts +0 -15
- package/dist/server/icon-set.mjs +0 -31
- package/dist/server/tools/close-reply.d.mts +0 -6
- package/dist/server/tools/close-reply.mjs +0 -138
- package/dist/server/tools/comment.d.mts +0 -6
- package/dist/server/tools/comment.mjs +0 -49
- package/dist/shared/icon-sets.d.mts +0 -9
- package/dist/shared/icon-sets.mjs +0 -21
- package/src/server/icon-set.ts +0 -56
- package/src/server/tools/close-reply.ts +0 -271
- package/src/server/tools/comment.ts +0 -96
- package/src/shared/icon-sets.ts +0 -23
- /package/app/public/{sudio-192.png → dex-192.png} +0 -0
- /package/app/public/{sudio-512.png → dex-512.png} +0 -0
- /package/app/public/{apple-touch-icon.png → dex-apple-touch-icon.png} +0 -0
- /package/app/public/{favicon-32.png → dex-icon-32.png} +0 -0
- /package/app/public/{favicon.svg → dex-icon.svg} +0 -0
- /package/app/public/{sudio-maskable-512.png → dex-maskable-512.png} +0 -0
package/src/content/content.ts
CHANGED
|
@@ -43,9 +43,9 @@ import {
|
|
|
43
43
|
type Viewport,
|
|
44
44
|
viewOf,
|
|
45
45
|
} from "../shared/canvas-core.ts";
|
|
46
|
+
import type { Canvas, Section, ViewFrame } from "../shared/canvas-file.ts";
|
|
46
47
|
import { isOneOf, isRecord, isText } from "../shared/checks.ts";
|
|
47
48
|
import { defaultDevice } from "../shared/devices.ts";
|
|
48
|
-
import type { FrameGrid, FrameGuide } from "../shared/frame-grids.ts";
|
|
49
49
|
import { formattedJson } from "../shared/json-style.ts";
|
|
50
50
|
import { LARGE_CANVAS_BYTES } from "../shared/live-core.ts";
|
|
51
51
|
import { targetForPath } from "../shared/live-presence.ts";
|
|
@@ -73,8 +73,11 @@ import {
|
|
|
73
73
|
slugify,
|
|
74
74
|
} from "../shared/prototypes-core.ts";
|
|
75
75
|
import { nextRemovals, removalsOf } from "../shared/removed-views-core.ts";
|
|
76
|
-
import
|
|
77
|
-
|
|
76
|
+
import {
|
|
77
|
+
type Contributor,
|
|
78
|
+
DISCIPLINES,
|
|
79
|
+
STUDIO_FILES,
|
|
80
|
+
} from "../shared/studio-files.ts";
|
|
78
81
|
import { NOT_RECOGNISED, youOf } from "../shared/studio-routes.ts";
|
|
79
82
|
import {
|
|
80
83
|
type AgentAction,
|
|
@@ -101,153 +104,6 @@ import type { ViewShot } from "./screenshot.ts";
|
|
|
101
104
|
import { SnapshotError, snapshotView } from "./snapshot-client.ts";
|
|
102
105
|
import { openThreads } from "./thread-module.ts";
|
|
103
106
|
|
|
104
|
-
// --- The studio's files ---------------------------------------------------------
|
|
105
|
-
//
|
|
106
|
-
// As this module reads and writes them. The studio's interface declares its
|
|
107
|
-
// own, fuller, in app/types.ts; these say only what the commands rely on.
|
|
108
|
-
|
|
109
|
-
/** A person who makes prototypes, from contributors.json. */
|
|
110
|
-
export interface Contributor {
|
|
111
|
-
discipline: string;
|
|
112
|
-
/** Git user names that identify this person. */
|
|
113
|
-
git: string[];
|
|
114
|
-
/** Their GitHub username, for their avatar. */
|
|
115
|
-
github?: string;
|
|
116
|
-
name: string;
|
|
117
|
-
slug: string;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
interface FrameBase {
|
|
121
|
-
/** On a column's first frame: the stacked frame its column starts level with. */
|
|
122
|
-
beside?: string;
|
|
123
|
-
id: string;
|
|
124
|
-
step?: number;
|
|
125
|
-
title?: string;
|
|
126
|
-
/**
|
|
127
|
-
* Which frame this is, for good: kept when it moves or is renamed, new on
|
|
128
|
-
* a copy. Picks follow it. Given to the saver's frames that have none when
|
|
129
|
-
* they save.
|
|
130
|
-
*/
|
|
131
|
-
uid?: string;
|
|
132
|
-
/** Stacked below the frame before it, in its column. */
|
|
133
|
-
under?: true;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/** A frame that shows one of the prototype's views. */
|
|
137
|
-
export interface ViewFrame extends FrameBase {
|
|
138
|
-
doc?: undefined;
|
|
139
|
-
/** The frame's own grids and guides, shown in place of the canvas's grid. */
|
|
140
|
-
grids?: FrameGrid[];
|
|
141
|
-
guides?: FrameGuide[];
|
|
142
|
-
params?: Record<string, string>;
|
|
143
|
-
/** A fixed size in pixels, for a snapshot of one element. */
|
|
144
|
-
size?: { height: number; width: number };
|
|
145
|
-
sketch?: undefined;
|
|
146
|
-
/**
|
|
147
|
-
* Where a snapshot was captured from, and when; and the image it is, when
|
|
148
|
-
* it is one, in the prototype's folder: "images/….png".
|
|
149
|
-
*/
|
|
150
|
-
snapshot?: { captured: string; image?: string; url: string };
|
|
151
|
-
spec?: undefined;
|
|
152
|
-
view: string;
|
|
153
|
-
viewport?: Viewport;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/** A frame that shows one of the prototype's docs. */
|
|
157
|
-
export interface DocFrame extends FrameBase {
|
|
158
|
-
doc: string;
|
|
159
|
-
sketch?: undefined;
|
|
160
|
-
spec?: undefined;
|
|
161
|
-
view?: undefined;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/** A spec, edited in place: its markdown file, from the file's folder. */
|
|
165
|
-
export interface SpecFrame extends FrameBase {
|
|
166
|
-
doc?: undefined;
|
|
167
|
-
size?: { height: number; width: number };
|
|
168
|
-
sketch?: undefined;
|
|
169
|
-
spec: string;
|
|
170
|
-
view?: undefined;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export interface SketchFrame extends FrameBase {
|
|
174
|
-
doc?: undefined;
|
|
175
|
-
sketch: Sketch;
|
|
176
|
-
spec?: undefined;
|
|
177
|
-
/** Required, as an older Dex names a frame by its title or view. */
|
|
178
|
-
title: string;
|
|
179
|
-
view?: undefined;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
declare const readFromDisk: unique symbol;
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* A frame this Dex cannot show: a kind from a newer Dex, or a mistake.
|
|
186
|
-
* Only reading a canvas makes one, so Dex never writes a frame that shows
|
|
187
|
-
* nothing.
|
|
188
|
-
*/
|
|
189
|
-
export interface UnknownFrame extends FrameBase {
|
|
190
|
-
doc?: undefined;
|
|
191
|
-
sketch?: undefined;
|
|
192
|
-
spec?: undefined;
|
|
193
|
-
view?: undefined;
|
|
194
|
-
readonly [readFromDisk]: true;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export type CanvasFrame =
|
|
198
|
-
| ViewFrame
|
|
199
|
-
| DocFrame
|
|
200
|
-
| SpecFrame
|
|
201
|
-
| SketchFrame
|
|
202
|
-
| UnknownFrame;
|
|
203
|
-
|
|
204
|
-
/** A pass through a section; its frames are the steps, left to right. */
|
|
205
|
-
export interface CanvasRow {
|
|
206
|
-
/**
|
|
207
|
-
* In a person's copy of someone else's section: the id of their row this one
|
|
208
|
-
* is shown under (people-core.ts).
|
|
209
|
-
*/
|
|
210
|
-
after?: string;
|
|
211
|
-
/** Whose it is, when not its section's: set when read, never written. */
|
|
212
|
-
author?: string;
|
|
213
|
-
/** The id of the section in its author's file that keeps it. */
|
|
214
|
-
copy?: string;
|
|
215
|
-
frames: CanvasFrame[];
|
|
216
|
-
id: string;
|
|
217
|
-
title?: string;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/** A section on the canvas; with `at`, a frame of its own drawn at that point. */
|
|
221
|
-
export interface CanvasSection {
|
|
222
|
-
at?: CanvasPoint;
|
|
223
|
-
/** Whose it is, from the folder it was read from; never written to a file. */
|
|
224
|
-
author?: string;
|
|
225
|
-
/** The id of the section it is a copy of, shown right below it. */
|
|
226
|
-
copyOf?: string;
|
|
227
|
-
/** When it was added, as an ISO date. */
|
|
228
|
-
created?: string;
|
|
229
|
-
description?: string;
|
|
230
|
-
/** Whose section it was copied from, when it is a copy. */
|
|
231
|
-
from?: string;
|
|
232
|
-
id: string;
|
|
233
|
-
/** Where a placed section's area starts; none stacks it with the others. */
|
|
234
|
-
position?: CanvasPoint;
|
|
235
|
-
rows: CanvasRow[];
|
|
236
|
-
title: string;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/** canvas.json: sections stacked top to bottom. */
|
|
240
|
-
export interface Canvas {
|
|
241
|
-
/**
|
|
242
|
-
* Set once the person's frames have uids (with uids on): from then on, a
|
|
243
|
-
* frame of theirs with none is new. Read, a canvas lists whose files have
|
|
244
|
-
* it in `uidsGiven`.
|
|
245
|
-
*/
|
|
246
|
-
frameUids?: true;
|
|
247
|
-
sections: CanvasSection[];
|
|
248
|
-
uidsGiven?: string[];
|
|
249
|
-
}
|
|
250
|
-
|
|
251
107
|
/** The views and docs that exist in a prototype, which frames may show. */
|
|
252
108
|
export interface Known {
|
|
253
109
|
docs: string[];
|
|
@@ -319,7 +175,6 @@ const shownIn = (root: string, file: string): string =>
|
|
|
319
175
|
relative(root, file).split(sep).join("/");
|
|
320
176
|
|
|
321
177
|
export const STATUSES = ["exploring", "in-review", "handed-off", "archived"];
|
|
322
|
-
export const DISCIPLINES = ["product", "brand", "engineering"];
|
|
323
178
|
|
|
324
179
|
const DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
325
180
|
// A GitHub username, and after it the `_company` that an enterprise's own
|
|
@@ -329,11 +184,6 @@ const GITHUB_LOGIN_RE =
|
|
|
329
184
|
const GITHUB_NOREPLY_RE = /^(?:\d+\+)?([^@]+)@users\.noreply\.github\.com$/i;
|
|
330
185
|
const LEADING_AT_RE = /^@/;
|
|
331
186
|
const GH_TIMEOUT_MS = 5000;
|
|
332
|
-
const SOURCE_FILE_RE = /\.(?:tsx?|css)$/;
|
|
333
|
-
const TEST_FILE_RE = /\.(?:test|bench)\.[cm]?[jt]sx?$/;
|
|
334
|
-
// What the interface's tests share (app/testing): not shipped, so not the
|
|
335
|
-
// interface either.
|
|
336
|
-
const TEST_SUPPORT_DIR = "testing";
|
|
337
187
|
const DOC_FILE_RE = /\.md$/;
|
|
338
188
|
|
|
339
189
|
/** A JSON file, as the shape the caller reads it into. */
|
|
@@ -525,93 +375,6 @@ async function prototypeIssues(
|
|
|
525
375
|
};
|
|
526
376
|
}
|
|
527
377
|
|
|
528
|
-
// The studio's interface must not name a design system: everything about the
|
|
529
|
-
// design system comes through virtual:studio-design-system, from the config.
|
|
530
|
-
// These are the only modules app/ may import besides its own files.
|
|
531
|
-
const CHROME_IMPORTS = [
|
|
532
|
-
"react",
|
|
533
|
-
// The config's ui settings and the project's own interface components.
|
|
534
|
-
"virtual:studio-ui",
|
|
535
|
-
"virtual:studio-icons",
|
|
536
|
-
"react-dom",
|
|
537
|
-
"wouter",
|
|
538
|
-
"next-themes",
|
|
539
|
-
"react-markdown",
|
|
540
|
-
"remark-gfm",
|
|
541
|
-
"@base-ui/react",
|
|
542
|
-
"class-variance-authority",
|
|
543
|
-
"cn",
|
|
544
|
-
"lucide-react",
|
|
545
|
-
"@tiptap/",
|
|
546
|
-
// Reads the design tokens in DESIGN.md's front matter, to show them.
|
|
547
|
-
"yaml",
|
|
548
|
-
// A completed guest review's celebration (canvas/review-panel.tsx).
|
|
549
|
-
"canvas-confetti",
|
|
550
|
-
// The agent heads-up's lines rising in and its log opening
|
|
551
|
-
// (canvas/activity-bar.tsx, canvas/activity.tsx).
|
|
552
|
-
"motion/react",
|
|
553
|
-
"tw-animate-css",
|
|
554
|
-
"@hugeicons/",
|
|
555
|
-
"@phosphor-icons/",
|
|
556
|
-
"@lingui/",
|
|
557
|
-
"@fontsource-variable/inter",
|
|
558
|
-
"@studio/",
|
|
559
|
-
// The kit as the editor types re-export it: this package's own (client.d.ts).
|
|
560
|
-
"@dexhq/canvas/kit/",
|
|
561
|
-
"@studio-content/",
|
|
562
|
-
"@studio-entry.css",
|
|
563
|
-
// The frame page's stylesheet, generated from the config like the entry.
|
|
564
|
-
"@studio-frame.css",
|
|
565
|
-
"virtual:studio-design-system",
|
|
566
|
-
// The design system's components, loaded by the components canvas from
|
|
567
|
-
// the config, never named here.
|
|
568
|
-
"virtual:studio-components",
|
|
569
|
-
// What wraps every prototype view: the design system's provider, or nothing.
|
|
570
|
-
"virtual:studio-provider",
|
|
571
|
-
// Every file's comments as built, which a built studio shows.
|
|
572
|
-
"virtual:studio-threads",
|
|
573
|
-
"node:",
|
|
574
|
-
"../types",
|
|
575
|
-
];
|
|
576
|
-
const IMPORT_RE = /(?:from|import)\s+["']([^"']+)["']/g;
|
|
577
|
-
|
|
578
|
-
/** The studio's own interface must not import a design system. */
|
|
579
|
-
export async function chromeIssues(appDir: string): Promise<string[]> {
|
|
580
|
-
const entries = await readdir(appDir, {
|
|
581
|
-
recursive: true,
|
|
582
|
-
withFileTypes: true,
|
|
583
|
-
});
|
|
584
|
-
const problems: string[] = [];
|
|
585
|
-
for (const entry of entries) {
|
|
586
|
-
// Tests hold fixture source in strings; neither they nor what they share
|
|
587
|
-
// are the interface.
|
|
588
|
-
if (
|
|
589
|
-
!(entry.isFile() && SOURCE_FILE_RE.test(entry.name)) ||
|
|
590
|
-
TEST_FILE_RE.test(entry.name) ||
|
|
591
|
-
relative(appDir, entry.parentPath).split(sep).includes(TEST_SUPPORT_DIR)
|
|
592
|
-
) {
|
|
593
|
-
continue;
|
|
594
|
-
}
|
|
595
|
-
const file = join(entry.parentPath, entry.name);
|
|
596
|
-
const source = await readFile(file, "utf8");
|
|
597
|
-
for (const [, specifier] of source.matchAll(IMPORT_RE)) {
|
|
598
|
-
const allowed =
|
|
599
|
-
specifier.startsWith(".") ||
|
|
600
|
-
specifier.startsWith("/") ||
|
|
601
|
-
specifier.startsWith("../../") ||
|
|
602
|
-
CHROME_IMPORTS.some(
|
|
603
|
-
(name) => specifier === name || specifier.startsWith(name)
|
|
604
|
-
);
|
|
605
|
-
if (!allowed) {
|
|
606
|
-
problems.push(
|
|
607
|
-
`${relative(appDir, file)}: imports "${specifier}". The studio's interface must not depend on a design system; go through virtual:studio-design-system.`
|
|
608
|
-
);
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
return problems;
|
|
613
|
-
}
|
|
614
|
-
|
|
615
378
|
/**
|
|
616
379
|
* Every problem in the studio, as readable lines, and the warnings the
|
|
617
380
|
* prototype checks found (prototype-checks.ts). No problems when all is
|
|
@@ -817,7 +580,7 @@ export function ownCell(
|
|
|
817
580
|
return {
|
|
818
581
|
canvas: {
|
|
819
582
|
sections: canvas.sections.map((entry) =>
|
|
820
|
-
entry === section ? (own.section as
|
|
583
|
+
entry === section ? (own.section as Section) : entry
|
|
821
584
|
),
|
|
822
585
|
},
|
|
823
586
|
cell: { ...cell, row: own.row.id },
|
|
@@ -10,10 +10,11 @@ import {
|
|
|
10
10
|
SPEC_SIZE,
|
|
11
11
|
specName,
|
|
12
12
|
} from "../shared/canvas-core.ts";
|
|
13
|
+
import type { Canvas } from "../shared/canvas-file.ts";
|
|
13
14
|
import { frontMatterTitle, splitFrontMatter } from "../shared/front-matter.ts";
|
|
14
15
|
import { personSpecPath, prototypeFiles } from "../shared/prototypes-core.ts";
|
|
15
16
|
import type { ThreadTarget } from "../shared/threads-core.ts";
|
|
16
|
-
import {
|
|
17
|
+
import { readCanvas } from "./content.ts";
|
|
17
18
|
import { peopleOf } from "./prototypes.ts";
|
|
18
19
|
import { readText } from "./read-text.ts";
|
|
19
20
|
|
|
@@ -6,15 +6,14 @@ import { join } from "node:path";
|
|
|
6
6
|
import { shownFrom } from "../paths.ts";
|
|
7
7
|
import { placePicks } from "../shared/annotations-core.ts";
|
|
8
8
|
import {
|
|
9
|
-
type CanvasShape,
|
|
10
9
|
canvasFrames,
|
|
11
10
|
type FrameKind,
|
|
12
11
|
frameTitle,
|
|
13
12
|
kinded,
|
|
14
|
-
type Viewport,
|
|
15
13
|
} from "../shared/canvas-core.ts";
|
|
14
|
+
import type { Frame } from "../shared/canvas-file.ts";
|
|
16
15
|
import { rowOwner } from "../shared/people-core.ts";
|
|
17
|
-
import { outlineSketch
|
|
16
|
+
import { outlineSketch } from "../shared/sketch-core.ts";
|
|
18
17
|
import { knownFor, readCanvas, readPrototypeAnnotations } from "./content.ts";
|
|
19
18
|
import { fileSpecTexts } from "./flow-specs.ts";
|
|
20
19
|
import { prototypePaths, prototypeTitle, viewFiles } from "./prototypes.ts";
|
|
@@ -22,49 +21,10 @@ import { readText } from "./read-text.ts";
|
|
|
22
21
|
|
|
23
22
|
const HEADING_RE = /^#\s+(.+)$/m;
|
|
24
23
|
|
|
25
|
-
export type CanvasFrame = (
|
|
26
|
-
| ViewFrame
|
|
27
|
-
| { doc: string; id: string; sketch?: undefined; view?: undefined }
|
|
28
|
-
| {
|
|
29
|
-
doc?: undefined;
|
|
30
|
-
id: string;
|
|
31
|
-
sketch?: undefined;
|
|
32
|
-
spec: string;
|
|
33
|
-
view?: undefined;
|
|
34
|
-
}
|
|
35
|
-
| {
|
|
36
|
-
doc?: undefined;
|
|
37
|
-
id: string;
|
|
38
|
-
sketch: Sketch;
|
|
39
|
-
title: string;
|
|
40
|
-
view?: undefined;
|
|
41
|
-
}
|
|
42
|
-
| UnknownFrame
|
|
43
|
-
) & { uid?: string };
|
|
44
|
-
|
|
45
|
-
interface UnknownFrame {
|
|
46
|
-
doc?: undefined;
|
|
47
|
-
id: string;
|
|
48
|
-
sketch?: undefined;
|
|
49
|
-
spec?: undefined;
|
|
50
|
-
view?: undefined;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/** A frame showing a view, in its viewport and state. */
|
|
54
|
-
export interface ViewFrame {
|
|
55
|
-
doc?: undefined;
|
|
56
|
-
id: string;
|
|
57
|
-
params?: Record<string, string>;
|
|
58
|
-
sketch?: undefined;
|
|
59
|
-
view: string;
|
|
60
|
-
viewport?: Viewport;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
24
|
/** Every frame on a prototype's canvas, with its key, as the studio shows it. */
|
|
64
25
|
export async function prototypeFrames(root: string, slug: string) {
|
|
65
26
|
try {
|
|
66
|
-
|
|
67
|
-
return canvasFrames(canvas);
|
|
27
|
+
return canvasFrames(await readCanvas(slug, root));
|
|
68
28
|
} catch {
|
|
69
29
|
return [];
|
|
70
30
|
}
|
|
@@ -86,7 +46,7 @@ interface SummaryFrame {
|
|
|
86
46
|
}
|
|
87
47
|
|
|
88
48
|
const shownBy = (
|
|
89
|
-
frame:
|
|
49
|
+
frame: Frame
|
|
90
50
|
): Pick<
|
|
91
51
|
SummaryFrame,
|
|
92
52
|
"doc" | "kind" | "sketch" | "spec" | "title" | "view"
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
idFor,
|
|
17
17
|
placeFrameInCell,
|
|
18
18
|
} from "../shared/canvas-core.ts";
|
|
19
|
+
import type { Canvas } from "../shared/canvas-file.ts";
|
|
19
20
|
import type {
|
|
20
21
|
PageComment,
|
|
21
22
|
PageReviewFile,
|
|
@@ -30,7 +31,7 @@ import {
|
|
|
30
31
|
type Snapshot,
|
|
31
32
|
saveSnapshots,
|
|
32
33
|
} from "./capture.ts";
|
|
33
|
-
import {
|
|
34
|
+
import { readCanvas } from "./content.ts";
|
|
34
35
|
|
|
35
36
|
/** The row for pages commented on outside every task. */
|
|
36
37
|
const ELSEWHERE = { id: "elsewhere", title: "Outside the tasks" };
|
|
@@ -41,7 +41,7 @@ function unreachable(url: string, error: unknown): SnapshotError {
|
|
|
41
41
|
?.cause;
|
|
42
42
|
if (cause?.code && NOT_LISTENING.has(cause.code)) {
|
|
43
43
|
return new SnapshotError(
|
|
44
|
-
`Dex is not running at ${url}. Start it with \`npx dex dev\` (or the project's own script, such as \`npm run
|
|
44
|
+
`Dex is not running at ${url}. Start it with \`npx dex dev\` (or the project's own script, such as \`npm run dex\`), then try again.`
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
const why = cause?.message ?? (error as Error)?.message ?? String(error);
|