@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.
Files changed (174) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/app/canvas/canvas-commands.ts +2 -10
  3. package/app/canvas/canvas-context.tsx +11 -2
  4. package/app/canvas/canvas-document.ts +5 -1
  5. package/app/canvas/canvas-keys.ts +1 -1
  6. package/app/canvas/canvas-model.ts +195 -20
  7. package/app/canvas/canvas-scene.ts +176 -171
  8. package/app/canvas/canvas-ui.ts +4 -11
  9. package/app/canvas/canvas.css +159 -179
  10. package/app/canvas/change-pictures.tsx +156 -0
  11. package/app/canvas/comment-drafts.ts +31 -0
  12. package/app/canvas/comment-layer.tsx +125 -71
  13. package/app/canvas/comments.tsx +38 -2
  14. package/app/canvas/element-picker.ts +20 -0
  15. package/app/canvas/engine/canvas-gestures.ts +15 -3
  16. package/app/canvas/engine/canvas-store.ts +5 -0
  17. package/app/canvas/engine/canvas-view.tsx +22 -5
  18. package/app/canvas/find-bar.tsx +57 -41
  19. package/app/canvas/flow-canvas.tsx +147 -272
  20. package/app/canvas/frame-copies.ts +14 -17
  21. package/app/canvas/frame-drops.ts +15 -7
  22. package/app/canvas/frame-inspector.ts +192 -41
  23. package/app/canvas/frame-node.tsx +123 -75
  24. package/app/canvas/frame-resize.tsx +321 -83
  25. package/app/canvas/insert-hint.tsx +5 -15
  26. package/app/canvas/inspect-layer.tsx +73 -19
  27. package/app/canvas/label-action.tsx +13 -2
  28. package/app/canvas/layout.ts +233 -98
  29. package/app/canvas/live-page.ts +5 -0
  30. package/app/canvas/new-frame.ts +10 -25
  31. package/app/canvas/note-placing.ts +55 -84
  32. package/app/canvas/picked-box.tsx +5 -0
  33. package/app/canvas/picks-menu.tsx +3 -9
  34. package/app/canvas/readable-colour.ts +52 -0
  35. package/app/canvas/request-node.tsx +19 -10
  36. package/app/canvas/scrolling-page.ts +45 -0
  37. package/app/canvas/section-node.tsx +36 -53
  38. package/app/canvas/settle.ts +21 -0
  39. package/app/canvas/snapping.ts +96 -8
  40. package/app/canvas/spec-frame.tsx +8 -5
  41. package/app/canvas/spot-pins.tsx +15 -3
  42. package/app/canvas/stack-frame.tsx +13 -57
  43. package/app/canvas/stack-model.ts +5 -0
  44. package/app/canvas/stack-toggle.tsx +89 -0
  45. package/app/canvas/styles-layer.tsx +23 -43
  46. package/app/canvas/text-layer.tsx +26 -10
  47. package/app/canvas/thread-focus.tsx +18 -1
  48. package/app/canvas/tool-cursors.ts +2 -2
  49. package/app/canvas/toolbar-parts.tsx +48 -8
  50. package/app/canvas/toolbar.tsx +12 -10
  51. package/app/canvas/use-canvas-clipboard.tsx +13 -5
  52. package/app/canvas/use-reveal.ts +86 -0
  53. package/app/editor/extensions.ts +2 -0
  54. package/app/editor/line-break-caret.ts +57 -0
  55. package/app/git/branch-panel.tsx +61 -20
  56. package/app/i18n/locales/en/messages.po +64 -17
  57. package/app/i18n/locales/en/messages.ts +1 -1
  58. package/app/i18n/locales/pseudo/messages.po +64 -17
  59. package/app/i18n/locales/pseudo/messages.ts +1 -1
  60. package/app/icons/glyphs.tsx +2 -0
  61. package/app/live/studio-live.ts +29 -9
  62. package/app/pages/canvas.tsx +1 -1
  63. package/app/pages/commands-settings.tsx +70 -76
  64. package/app/pages/play-bar.tsx +6 -11
  65. package/app/pages/play.tsx +52 -33
  66. package/app/shell/feedback-form.tsx +29 -5
  67. package/app/ui/prompt-editor.tsx +2 -0
  68. package/app/ui/use-field-list.ts +90 -0
  69. package/dist/cli/commands/mcp.mjs +6 -4
  70. package/dist/cli/mcp-relay.mjs +10 -6
  71. package/dist/content/content.d.mts +26 -9
  72. package/dist/content/content.mjs +65 -8
  73. package/dist/content/screenshot.d.mts +2 -0
  74. package/dist/content/screenshot.mjs +3 -0
  75. package/dist/content/snapshot-client.d.mts +2 -0
  76. package/dist/content/snapshot-client.mjs +12 -1
  77. package/dist/inspector.js +96 -19
  78. package/dist/paste/paste.d.mts +5 -0
  79. package/dist/paste/paste.mjs +7 -2
  80. package/dist/server/agent-tools.d.mts +1 -0
  81. package/dist/server/agent-tools.mjs +4 -3
  82. package/dist/server/change-picture-store.d.mts +13 -0
  83. package/dist/server/change-picture-store.mjs +42 -0
  84. package/dist/server/change-pictures.d.mts +25 -0
  85. package/dist/server/change-pictures.mjs +104 -0
  86. package/dist/server/close-check.d.mts +11 -0
  87. package/dist/server/close-check.mjs +37 -5
  88. package/dist/server/comments/agent-actions.d.mts +8 -4
  89. package/dist/server/comments/agent-actions.mjs +16 -7
  90. package/dist/server/comments/close-tools.mjs +7 -5
  91. package/dist/server/comments/files.d.mts +5 -1
  92. package/dist/server/comments/hand-out.d.mts +1 -1
  93. package/dist/server/comments/hand-out.mjs +4 -1
  94. package/dist/server/comments/push.d.mts +19 -10
  95. package/dist/server/comments/push.mjs +45 -30
  96. package/dist/server/comments/studio-files.d.mts +14 -1
  97. package/dist/server/comments/studio-files.mjs +44 -31
  98. package/dist/server/comments/tools.d.mts +1 -1
  99. package/dist/server/comments/workspace.mjs +1 -0
  100. package/dist/server/dev-server.mjs +34 -0
  101. package/dist/server/own-copies.mjs +4 -23
  102. package/dist/server/requests.mjs +57 -3
  103. package/dist/server/response-budget.d.mts +2 -1
  104. package/dist/server/response-budget.mjs +4 -3
  105. package/dist/server/roster.d.mts +19 -8
  106. package/dist/server/roster.mjs +50 -22
  107. package/dist/server/studio-for.d.mts +7 -0
  108. package/dist/server/studio-for.mjs +23 -7
  109. package/dist/server/thread-forms.d.mts +3 -0
  110. package/dist/server/thread-forms.mjs +21 -1
  111. package/dist/server/tools/place-frame.d.mts +1 -0
  112. package/dist/server/tools/place-frame.mjs +33 -9
  113. package/dist/server/tools/result.mjs +2 -2
  114. package/dist/server/tools/snapshot.d.mts +1 -1
  115. package/dist/server/tools/snapshot.mjs +2 -1
  116. package/dist/server/tools/studio-context.d.mts +2 -1
  117. package/dist/server/tools/studio-context.mjs +2 -1
  118. package/dist/server/tools/watch.mjs +29 -12
  119. package/dist/server/work-groups.mjs +1 -1
  120. package/dist/shared/canvas-core.d.mts +39 -5
  121. package/dist/shared/canvas-core.mjs +60 -15
  122. package/dist/shared/canvas-file.d.mts +7 -4
  123. package/dist/shared/change-pictures-core.d.mts +6 -0
  124. package/dist/shared/change-pictures-core.mjs +5 -0
  125. package/dist/shared/page-looks.d.mts +12 -0
  126. package/dist/shared/page-looks.mjs +49 -0
  127. package/dist/shared/snapshot-clipboard.d.mts +6 -0
  128. package/dist/shared/studio-routes.d.mts +11 -0
  129. package/extension/dist/manifest.json +1 -1
  130. package/extension/dist/picker.js +114 -108
  131. package/package.json +4 -3
  132. package/src/cli/commands/mcp.ts +18 -8
  133. package/src/cli/mcp-relay.ts +13 -6
  134. package/src/content/content.ts +90 -16
  135. package/src/content/screenshot.ts +9 -1
  136. package/src/content/snapshot-client.ts +17 -0
  137. package/src/paste/paste.ts +18 -1
  138. package/src/server/agent-tools.ts +5 -4
  139. package/src/server/change-picture-store.ts +71 -0
  140. package/src/server/change-pictures.ts +244 -0
  141. package/src/server/close-check.ts +69 -6
  142. package/src/server/comments/agent-actions.ts +51 -12
  143. package/src/server/comments/close-tools.ts +20 -10
  144. package/src/server/comments/files.ts +10 -2
  145. package/src/server/comments/hand-out.ts +2 -2
  146. package/src/server/comments/push.ts +94 -46
  147. package/src/server/comments/studio-files.ts +77 -46
  148. package/src/server/comments/workspace.ts +1 -0
  149. package/src/server/dev-server.ts +70 -0
  150. package/src/server/own-copies.ts +5 -33
  151. package/src/server/requests.ts +84 -4
  152. package/src/server/response-budget.ts +5 -3
  153. package/src/server/roster.ts +78 -28
  154. package/src/server/studio-for.ts +32 -7
  155. package/src/server/thread-forms.ts +41 -1
  156. package/src/server/tools/place-frame.ts +71 -14
  157. package/src/server/tools/result.ts +2 -2
  158. package/src/server/tools/snapshot.ts +2 -1
  159. package/src/server/tools/studio-context.ts +24 -14
  160. package/src/server/tools/watch.ts +38 -13
  161. package/src/server/work-groups.ts +1 -1
  162. package/src/shared/canvas-core.ts +119 -27
  163. package/src/shared/canvas-file.ts +7 -4
  164. package/src/shared/change-pictures-core.ts +8 -0
  165. package/src/shared/page-looks.ts +133 -0
  166. package/src/shared/snapshot-clipboard.ts +6 -0
  167. package/src/shared/studio-routes.ts +7 -1
  168. package/templates/agents/dex-worker.md +9 -7
  169. package/templates/feedback-workflow.md +1 -1
  170. package/templates/methods/review.md +7 -6
  171. package/templates/rules/canvas-frames.md +8 -7
  172. package/templates/rules/canvas.md +10 -8
  173. package/templates/rules/prototypes.md +5 -3
  174. package/app/canvas/stack-node.tsx +0 -100
@@ -17,6 +17,7 @@ import { flushSync } from "react-dom";
17
17
  import { withBase } from "../base";
18
18
  import { problemsOf } from "../live/studio-action";
19
19
  import { studioRequest } from "../live/studio-request";
20
+ import { type FieldList, useFieldList } from "../ui/use-field-list.ts";
20
21
  import { COVERS_CANVAS } from "./canvas-clipboard.ts";
21
22
  import { useCanvas } from "./canvas-context";
22
23
  import { isFindKey } from "./canvas-keys.ts";
@@ -294,38 +295,31 @@ const HitRow = ({
294
295
  current,
295
296
  hit,
296
297
  length,
297
- onPick,
298
+ option,
298
299
  }: {
299
300
  current: boolean;
300
301
  hit: Hit;
301
302
  length: number;
302
- onPick: () => void;
303
+ option: ReturnType<FieldList["option"]>;
303
304
  }) => {
304
305
  const { before, match, after } = snippet(hit, length);
305
306
 
306
307
  return (
307
- <li>
308
- <button
309
- aria-current={current ? "true" : undefined}
308
+ <div
309
+ {...option}
310
+ className="studio-small text-muted-foreground hover:bg-studio-hover aria-selected:bg-studio-hover aria-selected:text-foreground block w-full cursor-default truncate rounded-md px-2 py-1 text-left"
311
+ >
312
+ {before}
313
+ <mark
310
314
  className={cn(
311
- "studio-small text-muted-foreground hover:bg-studio-hover focus-visible:bg-studio-focus-fill focus-visible:text-foreground block w-full truncate rounded-md px-2 py-1 text-left outline-none",
312
- current && "bg-studio-hover text-foreground"
315
+ "rounded-xs text-[#0a0a0a]",
316
+ current ? "bg-[#ffd34d]" : "bg-[#ffd34d]/45"
313
317
  )}
314
- onClick={onPick}
315
- type="button"
316
318
  >
317
- {before}
318
- <mark
319
- className={cn(
320
- "rounded-xs text-[#0a0a0a]",
321
- current ? "bg-[#ffd34d]" : "bg-[#ffd34d]/45"
322
- )}
323
- >
324
- {match}
325
- </mark>
326
- {after}
327
- </button>
328
- </li>
319
+ {match}
320
+ </mark>
321
+ {after}
322
+ </div>
329
323
  );
330
324
  };
331
325
 
@@ -672,13 +666,14 @@ const HitList = ({
672
666
  at,
673
667
  hits,
674
668
  length,
675
- onPick,
669
+ list,
676
670
  }: {
677
671
  at: number;
678
672
  hits: readonly Hit[];
679
673
  length: number;
680
- onPick: (index: number) => void;
674
+ list: FieldList;
681
675
  }) => {
676
+ const { t } = useLingui();
682
677
  const groups = hitsByFrame(hits.slice(0, LISTED));
683
678
 
684
679
  if (groups.length === 0) {
@@ -686,24 +681,29 @@ const HitList = ({
686
681
  }
687
682
 
688
683
  return (
689
- <div className="border-studio-edge mt-[3px] max-h-64 overflow-y-auto overscroll-contain border-t px-1 pt-1 pb-0.5">
684
+ <div
685
+ {...list.listbox}
686
+ aria-label={t`Matches`}
687
+ className="border-studio-edge mt-[3px] max-h-64 overflow-y-auto overscroll-contain border-t px-1 pt-1 pb-0.5"
688
+ >
690
689
  {groups.map((group) => (
691
- <section aria-label={group.title} key={group.frame}>
692
- <h3 className="studio-label text-muted-foreground truncate px-2 pt-1.5 pb-0.5">
690
+ <div {...list.group(group.title)} key={group.frame}>
691
+ <div
692
+ aria-hidden
693
+ className="studio-label text-muted-foreground truncate px-2 pt-1.5 pb-0.5"
694
+ >
693
695
  {group.title}
694
- </h3>
695
- <ul>
696
- {group.hits.map(({ at: index, hit }) => (
697
- <HitRow
698
- current={index === at}
699
- hit={hit}
700
- key={`${hit.frame}:${hit.index}`}
701
- length={length}
702
- onPick={() => onPick(index)}
703
- />
704
- ))}
705
- </ul>
706
- </section>
696
+ </div>
697
+ {group.hits.map(({ at: index, hit }) => (
698
+ <HitRow
699
+ current={index === at}
700
+ hit={hit}
701
+ key={`${hit.frame}:${hit.index}`}
702
+ length={length}
703
+ option={list.option(index)}
704
+ />
705
+ ))}
706
+ </div>
707
707
  ))}
708
708
  </div>
709
709
  );
@@ -771,11 +771,22 @@ export const FindBar = ({ writable }: { writable: boolean }) => {
771
771
 
772
772
  const stepBy = (by: 1 | -1) => go(stepHit(at, by, count));
773
773
 
774
+ const listedAt = at < LISTED ? at : undefined;
775
+
776
+ const list = useFieldList({
777
+ active: listedAt,
778
+ expanded: open && count > 0,
779
+ onMove: stepBy,
780
+ onPick: go,
781
+ });
782
+
774
783
  const close = () => {
775
784
  setOpen(false);
776
785
  setStatus(undefined);
777
786
  };
778
787
 
788
+ const findKeys = fieldKeys(close, (shift) => stepBy(shift ? -1 : 1));
789
+
779
790
  const replace = () => {
780
791
  if (busy || reading || count === 0) {
781
792
  return;
@@ -845,13 +856,18 @@ export const FindBar = ({ writable }: { writable: boolean }) => {
845
856
  />
846
857
  )}
847
858
  <input
859
+ {...list.field}
848
860
  aria-label={t`Find`}
849
861
  className={FIELD}
850
862
  onChange={(event) => {
851
863
  setQuery(event.target.value);
852
864
  go(0);
853
865
  }}
854
- onKeyDown={fieldKeys(close, (shift) => stepBy(shift ? -1 : 1))}
866
+ onKeyDown={(event) => {
867
+ if (!list.moves(event)) {
868
+ findKeys(event);
869
+ }
870
+ }}
855
871
  placeholder={t`Find on the frames`}
856
872
  ref={findField}
857
873
  spellCheck={false}
@@ -908,7 +924,7 @@ export const FindBar = ({ writable }: { writable: boolean }) => {
908
924
  {status ? (
909
925
  <StatusLine busy={busy} onUndo={undo} status={status} />
910
926
  ) : null}
911
- <HitList at={at} hits={found.hits} length={query.length} onPick={go} />
927
+ <HitList at={at} hits={found.hits} length={query.length} list={list} />
912
928
  </search>
913
929
  </div>
914
930
  );