@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.
Files changed (341) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +21 -18
  3. package/app/canvas/activity.tsx +8 -15
  4. package/app/canvas/anchoring.ts +3 -5
  5. package/app/canvas/canvas-input.ts +151 -14
  6. package/app/canvas/canvas-keys.ts +9 -0
  7. package/app/canvas/canvas-model.ts +5 -42
  8. package/app/canvas/canvas-panels.ts +1 -17
  9. package/app/canvas/canvas-scene.ts +7 -3
  10. package/app/canvas/canvas-ui.ts +2 -1
  11. package/app/canvas/canvas.css +61 -26
  12. package/app/canvas/change-notice.tsx +10 -1
  13. package/app/canvas/comment-layer.tsx +2 -1
  14. package/app/canvas/comments.tsx +204 -82
  15. package/app/canvas/element-picker.ts +200 -27
  16. package/app/canvas/engine/canvas-gestures.ts +72 -17
  17. package/app/canvas/engine/canvas-store.ts +17 -1
  18. package/app/canvas/engine/engine.css +6 -3
  19. package/app/canvas/find-bar.tsx +817 -0
  20. package/app/canvas/find-model.ts +135 -0
  21. package/app/canvas/flow-canvas.tsx +18 -2
  22. package/app/canvas/follow-pin.ts +26 -6
  23. package/app/canvas/frame-node.tsx +43 -26
  24. package/app/canvas/imported-reviews.tsx +12 -22
  25. package/app/canvas/layout.ts +27 -0
  26. package/app/canvas/live-page.ts +142 -19
  27. package/app/canvas/page-find.ts +220 -0
  28. package/app/canvas/page-style.ts +23 -0
  29. package/app/canvas/section-node.tsx +2 -0
  30. package/app/canvas/spec-threads.ts +24 -23
  31. package/app/canvas/thread-focus.tsx +14 -12
  32. package/app/canvas/tool-cursors.ts +16 -16
  33. package/app/canvas/use-activity.ts +0 -8
  34. package/app/canvas/use-agent-changes.tsx +34 -40
  35. package/app/canvas/use-canvas-clipboard.tsx +11 -14
  36. package/app/canvas/xray.ts +3 -12
  37. package/app/frame.tsx +5 -0
  38. package/app/i18n/locales/en/messages.po +114 -12
  39. package/app/i18n/locales/en/messages.ts +1 -1
  40. package/app/i18n/locales/pseudo/messages.po +114 -12
  41. package/app/i18n/locales/pseudo/messages.ts +1 -1
  42. package/app/icons/{sets/lucide.tsx → glyphs.tsx} +7 -5
  43. package/app/icons/index.tsx +3 -3
  44. package/app/icons/types.ts +3 -10
  45. package/app/index.html +3 -3
  46. package/app/main.tsx +3 -0
  47. package/app/pages/canvas-settings.tsx +35 -0
  48. package/app/pages/canvas.tsx +27 -8
  49. package/app/pages/commands-settings.tsx +16 -2
  50. package/app/shell/about.tsx +5 -4
  51. package/app/shell/feedback-details.ts +0 -3
  52. package/app/shell/feedback-form.tsx +10 -21
  53. package/app/shell/feedback-link.tsx +2 -1
  54. package/app/shell/instructions-editor.tsx +1 -1
  55. package/app/shell/presence-style.ts +59 -0
  56. package/app/shell/presence.tsx +6 -3
  57. package/app/shell/scaled-frame.tsx +21 -9
  58. package/app/shell/settings-sections.ts +12 -0
  59. package/app/shell/sidebar.tsx +1 -1
  60. package/app/studio-ui.d.ts +0 -9
  61. package/app/types.ts +21 -205
  62. package/app/ui/file-drop.ts +128 -0
  63. package/app/ui/prompt-editor.tsx +1 -1
  64. package/app/ui/shadcn/input-group.tsx +2 -2
  65. package/dist/cli/banner.d.mts +4 -2
  66. package/dist/cli/banner.mjs +34 -11
  67. package/dist/cli/commands/app.mjs +19 -11
  68. package/dist/cli/commands/create.d.mts +26 -14
  69. package/dist/cli/commands/create.mjs +13 -7
  70. package/dist/cli/commands/dev.mjs +2 -3
  71. package/dist/cli/commands/hook.mjs +2 -1
  72. package/dist/cli/commands/init.d.mts +11 -6
  73. package/dist/cli/help.d.mts +1 -1
  74. package/dist/cli/help.mjs +3 -3
  75. package/dist/cli/main.d.mts +22 -12
  76. package/dist/config/index.d.mts +6 -5
  77. package/dist/config/project-files.d.mts +6 -3
  78. package/dist/config/project-files.mjs +14 -5
  79. package/dist/config/renamed.d.mts +0 -2
  80. package/dist/config/renamed.mjs +1 -3
  81. package/dist/config/schema.d.mts +0 -5
  82. package/dist/config/schema.mjs +0 -5
  83. package/dist/content/capture.d.mts +2 -2
  84. package/dist/content/capture.mjs +2 -2
  85. package/dist/content/content.d.mts +3 -141
  86. package/dist/content/content.mjs +7 -65
  87. package/dist/content/flow-specs.mjs +1 -1
  88. package/dist/content/prototype-summary.d.mts +3 -39
  89. package/dist/content/prototype-summary.mjs +2 -3
  90. package/dist/content/prototypes.mjs +1 -1
  91. package/dist/content/snapshot-client.mjs +1 -1
  92. package/dist/content/text-replace.d.mts +30 -0
  93. package/dist/content/text-replace.mjs +309 -0
  94. package/dist/content/thread-module.mjs +1 -1
  95. package/dist/content/threads.mjs +1 -1
  96. package/dist/paths.d.mts +0 -2
  97. package/dist/paths.mjs +1 -3
  98. package/dist/server/agent-env.d.mts +5 -1
  99. package/dist/server/agent-env.mjs +7 -2
  100. package/dist/server/agent-session.d.mts +14 -1
  101. package/dist/server/agent-session.mjs +84 -19
  102. package/dist/server/brief.mjs +3 -3
  103. package/dist/server/build-pictures.mjs +1 -1
  104. package/dist/server/channel.d.mts +19 -24
  105. package/dist/server/channel.mjs +70 -37
  106. package/dist/server/claimed-presence.d.mts +18 -0
  107. package/dist/server/claimed-presence.mjs +58 -0
  108. package/dist/server/close-check.mjs +2 -2
  109. package/dist/server/comments/actions.d.mts +153 -0
  110. package/dist/server/comments/actions.mjs +154 -0
  111. package/dist/server/comments/routes.d.mts +25 -0
  112. package/dist/server/comments/routes.mjs +88 -0
  113. package/dist/server/comments/tools.d.mts +6 -0
  114. package/dist/server/comments/tools.mjs +154 -0
  115. package/dist/server/dev-server.mjs +36 -13
  116. package/dist/server/file-errors.d.mts +7 -2
  117. package/dist/server/file-errors.mjs +31 -8
  118. package/dist/server/file-lock.d.mts +2 -2
  119. package/dist/server/file-lock.mjs +130 -36
  120. package/dist/server/mcp.d.mts +0 -2
  121. package/dist/server/mcp.mjs +7 -8
  122. package/dist/server/me.d.mts +1 -1
  123. package/dist/server/open-page.d.mts +22 -0
  124. package/dist/server/open-page.mjs +20 -2
  125. package/dist/server/outcome.d.mts +22 -0
  126. package/dist/server/outcome.mjs +8 -0
  127. package/dist/server/own-copies.mjs +2 -2
  128. package/dist/server/people.d.mts +1 -1
  129. package/dist/server/port.d.mts +12 -0
  130. package/dist/server/port.mjs +66 -14
  131. package/dist/server/presence.d.mts +4 -1
  132. package/dist/server/presence.mjs +2 -2
  133. package/dist/server/requests.d.mts +5 -1
  134. package/dist/server/requests.mjs +32 -47
  135. package/dist/server/studio-for.d.mts +5 -0
  136. package/dist/server/studio-for.mjs +18 -4
  137. package/dist/server/sync-install.d.mts +8 -12
  138. package/dist/server/sync-install.mjs +12 -30
  139. package/dist/server/thread-source.mjs +2 -2
  140. package/dist/server/tools/describe.d.mts +1 -1
  141. package/dist/server/tools/describe.mjs +1 -1
  142. package/dist/server/tools/feedback.d.mts +1 -1
  143. package/dist/server/tools/reading.mjs +13 -4
  144. package/dist/server/tools/show.d.mts +1 -1
  145. package/dist/server/tools/snapshot.d.mts +1 -1
  146. package/dist/server/tools/thread-list.mjs +1 -1
  147. package/dist/server/tools/watch.mjs +5 -3
  148. package/dist/server/vite.mjs +28 -31
  149. package/dist/server/web-app.mjs +7 -10
  150. package/dist/server/work-groups.mjs +1 -1
  151. package/dist/setup/apply.mjs +8 -14
  152. package/dist/setup/create.d.mts +4 -2
  153. package/dist/setup/create.mjs +118 -36
  154. package/dist/setup/design-system-checks.mjs +3 -12
  155. package/dist/setup/desktop-app-script.mjs +4 -3
  156. package/dist/setup/desktop-app-start.d.mts +8 -2
  157. package/dist/setup/desktop-app-start.mjs +64 -29
  158. package/dist/setup/desktop-app.d.mts +8 -0
  159. package/dist/setup/desktop-app.mjs +20 -4
  160. package/dist/setup/detect.d.mts +14 -7
  161. package/dist/setup/detect.mjs +56 -10
  162. package/dist/setup/doctor.mjs +2 -4
  163. package/dist/setup/existing-setup.d.mts +1 -3
  164. package/dist/setup/existing-setup.mjs +10 -11
  165. package/dist/setup/migrate/row-titles.mjs +1 -1
  166. package/dist/setup/own-app.d.mts +1 -2
  167. package/dist/setup/own-app.mjs +4 -5
  168. package/dist/setup/plan.d.mts +8 -6
  169. package/dist/setup/plan.mjs +64 -48
  170. package/dist/setup/project.d.mts +6 -17
  171. package/dist/setup/project.mjs +17 -61
  172. package/dist/setup/prompts.d.mts +5 -5
  173. package/dist/setup/prompts.mjs +28 -61
  174. package/dist/setup/questions.d.mts +12 -4
  175. package/dist/setup/questions.mjs +10 -25
  176. package/dist/setup/starters.d.mts +2 -0
  177. package/dist/setup/starters.mjs +26 -9
  178. package/dist/setup/workspace-setup.d.mts +1 -2
  179. package/dist/setup/workspace-setup.mjs +4 -6
  180. package/dist/setup/write.d.mts +15 -5
  181. package/dist/setup/write.mjs +35 -9
  182. package/dist/shared/annotations-core.mjs +1 -1
  183. package/dist/shared/canvas-core.mjs +1 -1
  184. package/dist/shared/canvas-file.d.mts +201 -0
  185. package/dist/shared/canvas-file.mjs +1 -0
  186. package/dist/shared/comments/routes.d.mts +53 -0
  187. package/dist/shared/comments/routes.mjs +37 -0
  188. package/dist/shared/feedback.d.mts +8 -0
  189. package/dist/shared/feedback.mjs +10 -2
  190. package/dist/shared/page-review.d.mts +2 -11
  191. package/dist/shared/page-review.mjs +4 -13
  192. package/dist/shared/presence-core.d.mts +11 -0
  193. package/dist/shared/presence-core.mjs +11 -2
  194. package/dist/shared/review-file.d.mts +5 -0
  195. package/dist/shared/review-file.mjs +23 -13
  196. package/dist/shared/server-page.mjs +7 -1
  197. package/dist/shared/signup.d.mts +2 -5
  198. package/dist/shared/signup.mjs +2 -35
  199. package/dist/shared/studio-events.d.mts +0 -6
  200. package/dist/shared/studio-events.mjs +1 -5
  201. package/dist/shared/studio-files.d.mts +12 -0
  202. package/dist/shared/studio-files.mjs +6 -1
  203. package/dist/shared/studio-routes.d.mts +16 -62
  204. package/dist/shared/studio-routes.mjs +1 -69
  205. package/dist/shared/threads-core.d.mts +2 -2
  206. package/dist/shared/threads-core.mjs +1 -1
  207. package/extension/dist/feedback.js +148 -138
  208. package/extension/dist/manifest.json +1 -1
  209. package/extension/dist/picker.js +146 -136
  210. package/package.json +3 -20
  211. package/src/cli/banner.ts +45 -11
  212. package/src/cli/commands/app.ts +23 -8
  213. package/src/cli/commands/create.ts +17 -9
  214. package/src/cli/commands/dev.ts +0 -3
  215. package/src/cli/commands/hook.ts +4 -1
  216. package/src/cli/help.ts +3 -3
  217. package/src/config/index.ts +6 -5
  218. package/src/config/project-files.ts +21 -11
  219. package/src/config/renamed.ts +0 -3
  220. package/src/config/schema.ts +0 -1
  221. package/src/content/capture.ts +6 -12
  222. package/src/content/content.ts +7 -244
  223. package/src/content/flow-specs.ts +2 -1
  224. package/src/content/prototype-summary.ts +4 -44
  225. package/src/content/review-pages.ts +2 -1
  226. package/src/content/snapshot-client.ts +1 -1
  227. package/src/content/text-replace.ts +449 -0
  228. package/src/paths.ts +0 -8
  229. package/src/server/agent-env.ts +12 -2
  230. package/src/server/agent-session.ts +124 -34
  231. package/src/server/brief.ts +8 -3
  232. package/src/server/channel.ts +121 -52
  233. package/src/server/claimed-presence.ts +93 -0
  234. package/src/server/comments/actions.ts +352 -0
  235. package/src/server/comments/routes.ts +176 -0
  236. package/src/server/comments/tools.ts +317 -0
  237. package/src/server/dev-server.ts +49 -15
  238. package/src/server/file-errors.ts +47 -13
  239. package/src/server/file-lock.ts +205 -54
  240. package/src/server/mcp.ts +13 -14
  241. package/src/server/me.ts +2 -5
  242. package/src/server/open-page.ts +54 -4
  243. package/src/server/outcome.ts +26 -0
  244. package/src/server/people.ts +2 -1
  245. package/src/server/port.ts +94 -20
  246. package/src/server/presence.ts +11 -3
  247. package/src/server/requests.ts +60 -70
  248. package/src/server/studio-for.ts +27 -3
  249. package/src/server/sync-install.ts +35 -26
  250. package/src/server/thread-place.ts +2 -4
  251. package/src/server/tools/reading.ts +16 -3
  252. package/src/server/tools/watch.ts +7 -7
  253. package/src/server/vite.ts +37 -40
  254. package/src/server/web-app.ts +14 -12
  255. package/src/setup/apply.ts +10 -16
  256. package/src/setup/create.ts +143 -37
  257. package/src/setup/design-system-checks.ts +7 -15
  258. package/src/setup/desktop-app-script.ts +4 -3
  259. package/src/setup/desktop-app-start.ts +94 -26
  260. package/src/setup/desktop-app.ts +24 -3
  261. package/src/setup/detect.ts +56 -14
  262. package/src/setup/doctor.ts +4 -4
  263. package/src/setup/existing-setup.ts +10 -12
  264. package/src/setup/own-app.ts +2 -5
  265. package/src/setup/plan.ts +93 -84
  266. package/src/setup/project.ts +25 -118
  267. package/src/setup/prompts.ts +44 -127
  268. package/src/setup/questions.ts +27 -29
  269. package/src/setup/starters.ts +35 -10
  270. package/src/setup/workspace-setup.ts +8 -18
  271. package/src/setup/write.ts +52 -9
  272. package/src/shared/canvas-file.ts +205 -0
  273. package/src/shared/comments/routes.ts +79 -0
  274. package/src/shared/feedback.ts +14 -4
  275. package/src/shared/page-review.ts +11 -16
  276. package/src/shared/presence-core.ts +16 -2
  277. package/src/shared/review-file.ts +28 -12
  278. package/src/shared/server-page.ts +11 -1
  279. package/src/shared/signup.ts +4 -28
  280. package/src/shared/studio-events.ts +0 -13
  281. package/src/shared/studio-files.ts +14 -0
  282. package/src/shared/studio-routes.ts +21 -64
  283. package/src/shared/threads-core.ts +2 -2
  284. package/templates/methods/review.md +2 -2
  285. package/templates/rules/canvas-frames.md +104 -0
  286. package/templates/rules/canvas.md +8 -142
  287. package/templates/rules/prototypes.md +1 -1
  288. package/templates/rules/snapshots.md +52 -0
  289. package/templates/starters/standalone/README.md +7 -7
  290. package/templates/starters/standalone/components.json +1 -1
  291. package/templates/starters/standalone/package.json +1 -2
  292. package/templates/starters/turborepo/README.md +6 -6
  293. package/templates/starters/turborepo/apps/web/components.json +1 -1
  294. package/templates/starters/turborepo/apps/web/package.json +1 -2
  295. package/templates/starters/turborepo/apps/web/src/app.tsx +4 -5
  296. package/templates/starters/turborepo/packages/ui/components.json +1 -1
  297. package/templates/starters/turborepo/packages/ui/package.json +1 -2
  298. package/templates/starters/vite/README.md +7 -6
  299. package/templates/starters/vite/components.json +1 -1
  300. package/templates/starters/vite/package.json +1 -2
  301. package/templates/starters/vite/src/app.tsx +3 -4
  302. package/templates/starters/vite/src/components/ui/accordion.tsx +71 -0
  303. package/templates/starters/vite/src/components/ui/attachment.tsx +1 -1
  304. package/templates/starters/vite/src/components/ui/badge.tsx +2 -2
  305. package/templates/starters/vite/src/components/ui/button.tsx +17 -12
  306. package/templates/starters/vite/src/components/ui/card.tsx +1 -1
  307. package/templates/starters/vite/src/components/ui/checkbox.tsx +28 -0
  308. package/templates/starters/vite/src/components/ui/dialog.tsx +5 -5
  309. package/templates/starters/vite/src/components/ui/dropdown-menu.tsx +17 -14
  310. package/templates/starters/vite/src/components/ui/field.tsx +3 -1
  311. package/templates/starters/vite/src/components/ui/input-group.tsx +5 -3
  312. package/templates/starters/vite/src/components/ui/input.tsx +1 -1
  313. package/templates/starters/vite/src/components/ui/label.tsx +2 -0
  314. package/templates/starters/vite/src/components/ui/native-select.tsx +3 -4
  315. package/templates/starters/vite/src/components/ui/popover.tsx +1 -1
  316. package/templates/starters/vite/src/components/ui/separator.tsx +2 -0
  317. package/templates/starters/vite/src/components/ui/spinner.tsx +3 -7
  318. package/templates/starters/vite/src/components/ui/switch.tsx +1 -1
  319. package/templates/starters/vite/src/components/ui/textarea.tsx +1 -1
  320. package/templates/starters/vite/src/components/ui/toggle.tsx +4 -2
  321. package/templates/starters/vite/src/index.css +533 -111
  322. package/app/icons/sets/hugeicons.tsx +0 -259
  323. package/app/icons/sets/phosphor.tsx +0 -251
  324. package/dist/server/icon-set.d.mts +0 -15
  325. package/dist/server/icon-set.mjs +0 -31
  326. package/dist/server/tools/close-reply.d.mts +0 -6
  327. package/dist/server/tools/close-reply.mjs +0 -138
  328. package/dist/server/tools/comment.d.mts +0 -6
  329. package/dist/server/tools/comment.mjs +0 -49
  330. package/dist/shared/icon-sets.d.mts +0 -9
  331. package/dist/shared/icon-sets.mjs +0 -21
  332. package/src/server/icon-set.ts +0 -56
  333. package/src/server/tools/close-reply.ts +0 -271
  334. package/src/server/tools/comment.ts +0 -96
  335. package/src/shared/icon-sets.ts +0 -23
  336. /package/app/public/{sudio-192.png → dex-192.png} +0 -0
  337. /package/app/public/{sudio-512.png → dex-512.png} +0 -0
  338. /package/app/public/{apple-touch-icon.png → dex-apple-touch-icon.png} +0 -0
  339. /package/app/public/{favicon-32.png → dex-icon-32.png} +0 -0
  340. /package/app/public/{favicon.svg → dex-icon.svg} +0 -0
  341. /package/app/public/{sudio-maskable-512.png → dex-maskable-512.png} +0 -0
@@ -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 type { Sketch } from "../shared/sketch-core.ts";
77
- import { STUDIO_FILES } from "../shared/studio-files.ts";
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 CanvasSection) : entry
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 { type Canvas, readCanvas } from "./content.ts";
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, type Sketch } from "../shared/sketch-core.ts";
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
- const canvas: CanvasShape<CanvasFrame> = await readCanvas(slug, root);
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: CanvasFrame
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 { type Canvas, readCanvas } from "./content.ts";
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 studio\`), then try again.`
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);