@arbidocs/blocks 0.5.123 → 0.5.125

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 (192) hide show
  1. package/dist/{ClippingMediaViewer-IEIBT74X.cjs → ClippingMediaViewer-ZFEX5A3U.cjs} +11 -10
  2. package/dist/ClippingMediaViewer-ZFEX5A3U.cjs.map +1 -0
  3. package/dist/{ClippingPdfViewer-OGYLMVCE.cjs → ClippingPdfViewer-3LRTEPHV.cjs} +45 -11
  4. package/dist/ClippingPdfViewer-3LRTEPHV.cjs.map +1 -0
  5. package/dist/ConnectedCallDock-XJOYVVAH.cjs +6 -6
  6. package/dist/ConnectedCallRoom-CUDYAPQK.cjs +6 -6
  7. package/dist/{ConnectedNativeDocxComparison-QKHCYD6W.cjs → ConnectedNativeDocxComparison-7QQ55JIO.cjs} +13 -13
  8. package/dist/{ConnectedNativeDocxComparison-QKHCYD6W.cjs.map → ConnectedNativeDocxComparison-7QQ55JIO.cjs.map} +1 -1
  9. package/dist/{ConnectedPresentation-5DOJ35XL.cjs → ConnectedPresentation-L32JPRFI.cjs} +30 -156
  10. package/dist/ConnectedPresentation-L32JPRFI.cjs.map +1 -0
  11. package/dist/{ConnectedProductionSetDialog-LHB4VQWC.cjs → ConnectedProductionSetDialog-4EAY6KAZ.cjs} +3 -3
  12. package/dist/{ConnectedProductionSetDialog-LHB4VQWC.cjs.map → ConnectedProductionSetDialog-4EAY6KAZ.cjs.map} +1 -1
  13. package/dist/{ConnectedSlidesTab-7YMEDGUU.cjs → ConnectedSlidesTab-P7GGNUTO.cjs} +31 -29
  14. package/dist/ConnectedSlidesTab-P7GGNUTO.cjs.map +1 -0
  15. package/dist/{ConnectedStreamedWordArtifact-AG62232A.cjs → ConnectedStreamedWordArtifact-7NJ3N52V.cjs} +13 -13
  16. package/dist/{ConnectedStreamedWordArtifact-AG62232A.cjs.map → ConnectedStreamedWordArtifact-7NJ3N52V.cjs.map} +1 -1
  17. package/dist/{DocumentReviewCard-M53XFLI2.cjs → DocumentReviewCard-BFPOFQXI.cjs} +16 -16
  18. package/dist/{DocumentReviewCard-M53XFLI2.cjs.map → DocumentReviewCard-BFPOFQXI.cjs.map} +1 -1
  19. package/dist/{FilesViewerDialog-2QCCRWF2.cjs → FilesViewerDialog-MHUVEZ7M.cjs} +35 -32
  20. package/dist/FilesViewerDialog-MHUVEZ7M.cjs.map +1 -0
  21. package/dist/{NativeDocxEditor-2LQY2CTV.cjs → NativeDocxEditor-SIRYPMBN.cjs} +6 -6
  22. package/dist/{NativeDocxEditor-2LQY2CTV.cjs.map → NativeDocxEditor-SIRYPMBN.cjs.map} +1 -1
  23. package/dist/SpotlightStrip-ED22UYTM.cjs +398 -0
  24. package/dist/SpotlightStrip-ED22UYTM.cjs.map +1 -0
  25. package/dist/{WorkspaceTableView-3XYAV4BV.cjs → WorkspaceTableView-MIFYXV3G.cjs} +8 -8
  26. package/dist/{WorkspaceTableView-3XYAV4BV.cjs.map → WorkspaceTableView-MIFYXV3G.cjs.map} +1 -1
  27. package/dist/agents/index.cjs +216 -216
  28. package/dist/ai-IEIR7SC2.cjs +3 -3
  29. package/dist/auth/index.cjs +1 -1
  30. package/dist/calls/index.cjs +2 -2
  31. package/dist/chat/index.cjs +6 -6
  32. package/dist/{chunk-GNZAH6UI.cjs → chunk-2K6IMIVL.cjs} +3 -3
  33. package/dist/{chunk-GNZAH6UI.cjs.map → chunk-2K6IMIVL.cjs.map} +1 -1
  34. package/dist/{chunk-NQML7IUC.cjs → chunk-3UP32FM3.cjs} +6 -6
  35. package/dist/{chunk-NQML7IUC.cjs.map → chunk-3UP32FM3.cjs.map} +1 -1
  36. package/dist/chunk-3ZZZO4F7.cjs +145 -0
  37. package/dist/chunk-3ZZZO4F7.cjs.map +1 -0
  38. package/dist/{chunk-L4CIFLCU.cjs → chunk-4LP5MJGQ.cjs} +4 -4
  39. package/dist/{chunk-L4CIFLCU.cjs.map → chunk-4LP5MJGQ.cjs.map} +1 -1
  40. package/dist/{chunk-JD2HX2BR.cjs → chunk-6JMW3IJ2.cjs} +152 -155
  41. package/dist/chunk-6JMW3IJ2.cjs.map +1 -0
  42. package/dist/{chunk-WV7BCGCK.cjs → chunk-7RJZIPLE.cjs} +33 -33
  43. package/dist/{chunk-WV7BCGCK.cjs.map → chunk-7RJZIPLE.cjs.map} +1 -1
  44. package/dist/{chunk-WFMWKPGY.cjs → chunk-ADPRIBSH.cjs} +9 -33
  45. package/dist/chunk-ADPRIBSH.cjs.map +1 -0
  46. package/dist/{chunk-7NLO7ASW.cjs → chunk-AISYXX4M.cjs} +4 -4
  47. package/dist/{chunk-7NLO7ASW.cjs.map → chunk-AISYXX4M.cjs.map} +1 -1
  48. package/dist/{chunk-5QERK4PK.cjs → chunk-AS6QZETU.cjs} +35 -35
  49. package/dist/{chunk-5QERK4PK.cjs.map → chunk-AS6QZETU.cjs.map} +1 -1
  50. package/dist/{chunk-V6MW7B4B.cjs → chunk-B3R62764.cjs} +6 -6
  51. package/dist/{chunk-V6MW7B4B.cjs.map → chunk-B3R62764.cjs.map} +1 -1
  52. package/dist/{chunk-VKH3BEZE.cjs → chunk-BLIO3B7Z.cjs} +3 -3
  53. package/dist/{chunk-VKH3BEZE.cjs.map → chunk-BLIO3B7Z.cjs.map} +1 -1
  54. package/dist/{chunk-46P7IDBX.cjs → chunk-CQ2RJYE2.cjs} +4 -4
  55. package/dist/chunk-CQ2RJYE2.cjs.map +1 -0
  56. package/dist/{chunk-MXBXZXXQ.cjs → chunk-ENOPKX7E.cjs} +3 -3
  57. package/dist/{chunk-MXBXZXXQ.cjs.map → chunk-ENOPKX7E.cjs.map} +1 -1
  58. package/dist/{chunk-2CSLFAGF.cjs → chunk-GAMRVB3I.cjs} +4 -3
  59. package/dist/chunk-GAMRVB3I.cjs.map +1 -0
  60. package/dist/chunk-IRGRMJPP.cjs +18 -0
  61. package/dist/{chunk-SDRYSLOX.cjs.map → chunk-IRGRMJPP.cjs.map} +1 -1
  62. package/dist/{chunk-ADDQKZ5I.cjs → chunk-J3FFSEKO.cjs} +4 -4
  63. package/dist/{chunk-ADDQKZ5I.cjs.map → chunk-J3FFSEKO.cjs.map} +1 -1
  64. package/dist/chunk-JITYC4OS.cjs +66 -0
  65. package/dist/chunk-JITYC4OS.cjs.map +1 -0
  66. package/dist/chunk-JY7UUZQG.cjs +1513 -0
  67. package/dist/chunk-JY7UUZQG.cjs.map +1 -0
  68. package/dist/{chunk-ALK3PUUB.cjs → chunk-L6HTZIBD.cjs} +3 -3
  69. package/dist/{chunk-ALK3PUUB.cjs.map → chunk-L6HTZIBD.cjs.map} +1 -1
  70. package/dist/chunk-MVXHTAJ4.cjs +111 -0
  71. package/dist/chunk-MVXHTAJ4.cjs.map +1 -0
  72. package/dist/{chunk-OHHKBURG.cjs → chunk-OGK377NL.cjs} +33 -33
  73. package/dist/{chunk-OHHKBURG.cjs.map → chunk-OGK377NL.cjs.map} +1 -1
  74. package/dist/{chunk-T73BHNQX.cjs → chunk-OHWHYVKG.cjs} +3 -3
  75. package/dist/{chunk-T73BHNQX.cjs.map → chunk-OHWHYVKG.cjs.map} +1 -1
  76. package/dist/{chunk-4TTX6ZNS.cjs → chunk-ORNLCBNE.cjs} +24 -2
  77. package/dist/chunk-ORNLCBNE.cjs.map +1 -0
  78. package/dist/{chunk-MLA2BJ2Y.cjs → chunk-PSB64T43.cjs} +28 -28
  79. package/dist/{chunk-MLA2BJ2Y.cjs.map → chunk-PSB64T43.cjs.map} +1 -1
  80. package/dist/{chunk-COD5ENHK.cjs → chunk-PVJ5ODDB.cjs} +4 -4
  81. package/dist/{chunk-COD5ENHK.cjs.map → chunk-PVJ5ODDB.cjs.map} +1 -1
  82. package/dist/{chunk-7557LDAN.cjs → chunk-PWBRE7JA.cjs} +5 -5
  83. package/dist/{chunk-7557LDAN.cjs.map → chunk-PWBRE7JA.cjs.map} +1 -1
  84. package/dist/{chunk-7PN3YENO.cjs → chunk-QIK7E6VF.cjs} +4 -4
  85. package/dist/{chunk-7PN3YENO.cjs.map → chunk-QIK7E6VF.cjs.map} +1 -1
  86. package/dist/{chunk-DWMWEALB.cjs → chunk-TSFNLY3K.cjs} +143 -1634
  87. package/dist/chunk-TSFNLY3K.cjs.map +1 -0
  88. package/dist/{chunk-YGBHY67W.cjs → chunk-UA7HOLAZ.cjs} +5 -5
  89. package/dist/{chunk-YGBHY67W.cjs.map → chunk-UA7HOLAZ.cjs.map} +1 -1
  90. package/dist/{chunk-KXIRVKCJ.cjs → chunk-UUENH4BJ.cjs} +3 -3
  91. package/dist/{chunk-KXIRVKCJ.cjs.map → chunk-UUENH4BJ.cjs.map} +1 -1
  92. package/dist/chunk-WVZLAAIZ.cjs +31 -0
  93. package/dist/chunk-WVZLAAIZ.cjs.map +1 -0
  94. package/dist/{chunk-E3L5DB5F.cjs → chunk-YOEP3I4V.cjs} +5 -5
  95. package/dist/{chunk-E3L5DB5F.cjs.map → chunk-YOEP3I4V.cjs.map} +1 -1
  96. package/dist/{chunk-SNPK3R3O.cjs → chunk-YVO6Z5BS.cjs} +10 -10
  97. package/dist/{chunk-SNPK3R3O.cjs.map → chunk-YVO6Z5BS.cjs.map} +1 -1
  98. package/dist/chunk-ZZZITHGK.cjs +119 -0
  99. package/dist/chunk-ZZZITHGK.cjs.map +1 -0
  100. package/dist/connect/docx.cjs +17 -17
  101. package/dist/connect/index.cjs +994 -994
  102. package/dist/connect/viewer.cjs +28 -25
  103. package/dist/connection/presentation/ClippingMediaViewer.js +3 -3
  104. package/dist/connection/presentation/ClippingMediaViewer.js.map +2 -2
  105. package/dist/connection/presentation/ClippingPdfViewer.d.ts +4 -3
  106. package/dist/connection/presentation/ClippingPdfViewer.js +48 -9
  107. package/dist/connection/presentation/ClippingPdfViewer.js.map +2 -2
  108. package/dist/connection/presentation/SpotlightLayer.d.ts +5 -0
  109. package/dist/connection/presentation/SpotlightLayer.js +19 -0
  110. package/dist/connection/presentation/SpotlightLayer.js.map +7 -0
  111. package/dist/connection/presentation/SpotlightStrip.d.ts +10 -0
  112. package/dist/connection/presentation/SpotlightStrip.js +237 -0
  113. package/dist/connection/presentation/SpotlightStrip.js.map +7 -0
  114. package/dist/connection/presentation/useViewerClipping.d.ts +4 -3
  115. package/dist/connection/presentation/useViewerClipping.js +8 -4
  116. package/dist/connection/presentation/useViewerClipping.js.map +2 -2
  117. package/dist/connection/viewer/ConnectedDocumentViewer.js +1 -1
  118. package/dist/connection/viewer/ConnectedDocumentViewer.js.map +2 -2
  119. package/dist/connection/viewer/VersionDropdown.js +1 -1
  120. package/dist/connection/viewer/VersionDropdown.js.map +1 -1
  121. package/dist/connection/viewer/ViewerPdfPane.js +2 -0
  122. package/dist/connection/viewer/ViewerPdfPane.js.map +2 -2
  123. package/dist/connection/viewer/pdf/passageHighlights.d.ts +5 -0
  124. package/dist/connection/viewer/pdf/passageHighlights.js +14 -1
  125. package/dist/connection/viewer/pdf/passageHighlights.js.map +2 -2
  126. package/dist/connection/viewer/pdf/usePassageTextFallback.d.ts +12 -0
  127. package/dist/connection/viewer/pdf/usePassageTextFallback.js +30 -0
  128. package/dist/connection/viewer/pdf/usePassageTextFallback.js.map +7 -0
  129. package/dist/connection/viewer/pdf/usePdfPassageHighlights.js +2 -11
  130. package/dist/connection/viewer/pdf/usePdfPassageHighlights.js.map +2 -2
  131. package/dist/connection/viewer/useCleanView.d.ts +3 -1
  132. package/dist/connection/viewer/useCleanView.js +6 -3
  133. package/dist/connection/viewer/useCleanView.js.map +2 -2
  134. package/dist/connection/viewer/useViewerTabs.js +13 -1
  135. package/dist/connection/viewer/useViewerTabs.js.map +2 -2
  136. package/dist/document-tools/DocumentToolButtons.js +1 -1
  137. package/dist/document-tools/DocumentToolButtons.js.map +1 -1
  138. package/dist/document-tools/index.cjs +20 -20
  139. package/dist/docx/DocxCommandMenu.js +2 -1
  140. package/dist/docx/DocxCommandMenu.js.map +2 -2
  141. package/dist/docx/index.cjs +38 -38
  142. package/dist/embed/index.cjs +20 -20
  143. package/dist/facts/index.cjs +64 -64
  144. package/dist/files/index.cjs +223 -223
  145. package/dist/index.cjs +521 -521
  146. package/dist/presentation/ClipCaptureOverlay.d.ts +7 -3
  147. package/dist/presentation/ClipCaptureOverlay.js +43 -14
  148. package/dist/presentation/ClipCaptureOverlay.js.map +2 -2
  149. package/dist/presentation/PresentControls.d.ts +8 -0
  150. package/dist/presentation/PresentControls.js +1 -0
  151. package/dist/presentation/PresentControls.js.map +2 -2
  152. package/dist/presentation/PresentationStage.d.ts +10 -2
  153. package/dist/presentation/PresentationStage.js +6 -3
  154. package/dist/presentation/PresentationStage.js.map +2 -2
  155. package/dist/presentation/PresenterView.js +1 -22
  156. package/dist/presentation/PresenterView.js.map +2 -2
  157. package/dist/presentation/SpotlightView.d.ts +19 -0
  158. package/dist/presentation/SpotlightView.js +180 -0
  159. package/dist/presentation/SpotlightView.js.map +7 -0
  160. package/dist/presentation/passage-clip.d.ts +17 -0
  161. package/dist/presentation/passage-clip.js +25 -0
  162. package/dist/presentation/passage-clip.js.map +7 -0
  163. package/dist/presentation/spotlight.d.ts +58 -0
  164. package/dist/presentation/spotlight.js +110 -0
  165. package/dist/presentation/spotlight.js.map +7 -0
  166. package/dist/presentation/store.d.ts +5 -0
  167. package/dist/presentation/store.js +19 -0
  168. package/dist/presentation/store.js.map +2 -2
  169. package/dist/presentation/usePointerActive.d.ts +2 -0
  170. package/dist/presentation/usePointerActive.js +28 -0
  171. package/dist/presentation/usePointerActive.js.map +7 -0
  172. package/dist/settings/index.cjs +146 -146
  173. package/dist/site/index.cjs +6 -6
  174. package/dist/studio/index.cjs +9 -9
  175. package/dist/styles.css +1 -1
  176. package/dist/workflow-canvas/index.cjs +35 -35
  177. package/node_modules/@arbidocs/coedit/package.json +1 -1
  178. package/package.json +5 -5
  179. package/dist/ClippingMediaViewer-IEIBT74X.cjs.map +0 -1
  180. package/dist/ClippingPdfViewer-OGYLMVCE.cjs.map +0 -1
  181. package/dist/ConnectedPresentation-5DOJ35XL.cjs.map +0 -1
  182. package/dist/ConnectedSlidesTab-7YMEDGUU.cjs.map +0 -1
  183. package/dist/FilesViewerDialog-2QCCRWF2.cjs.map +0 -1
  184. package/dist/chunk-2CSLFAGF.cjs.map +0 -1
  185. package/dist/chunk-46P7IDBX.cjs.map +0 -1
  186. package/dist/chunk-4TTX6ZNS.cjs.map +0 -1
  187. package/dist/chunk-DWMWEALB.cjs.map +0 -1
  188. package/dist/chunk-JD2HX2BR.cjs.map +0 -1
  189. package/dist/chunk-SDRYSLOX.cjs +0 -18
  190. package/dist/chunk-WFMWKPGY.cjs.map +0 -1
  191. package/dist/chunk-XK4TVJKD.cjs +0 -73
  192. package/dist/chunk-XK4TVJKD.cjs.map +0 -1
@@ -1,14 +1,18 @@
1
1
  /**
2
- * Over a page while clipping: drag a rectangle and it becomes a clip. The rectangle is kept as
3
- * fractions of the page (`toNorm`), so it does not depend on the zoom it was drawn at.
2
+ * Over a page while clipping. A click on a passage clips exactly that passage (the parser placed it
3
+ * on the page; it is outlined under the pointer); a drag clips any rectangle (a figure, a scan, a
4
+ * page with no passages). Either way the area is kept as fractions of the page (`toNorm`), so it
5
+ * does not depend on the zoom it was taken at.
4
6
  */
5
7
  import type { Rect } from './model';
6
8
  export interface ClipCaptureOverlayProps {
7
9
  page: number;
10
+ /** The page's passages, as the areas a click clips (page fractions, margin included). */
11
+ passages?: readonly Rect[];
8
12
  onCapture: (capture: {
9
13
  page: number;
10
14
  rect: Rect;
11
15
  aspect: number;
12
16
  }) => void;
13
17
  }
14
- export declare function ClipCaptureOverlay({ page, onCapture }: ClipCaptureOverlayProps): import("react").JSX.Element;
18
+ export declare function ClipCaptureOverlay({ page, passages, onCapture }: ClipCaptureOverlayProps): import("react").JSX.Element;
@@ -1,26 +1,43 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useRef, useState } from "react";
4
4
  import { toNorm } from "@arbidocs/react/annotations";
5
+ import { passageAt } from "./passage-clip.js";
5
6
  const MIN_CLIP_FRACTION = 0.02;
6
- function ClipCaptureOverlay({ page, onCapture }) {
7
+ const percent = (rect) => ({
8
+ left: `${rect.x * 100}%`,
9
+ top: `${rect.y * 100}%`,
10
+ width: `${rect.w * 100}%`,
11
+ height: `${rect.h * 100}%`
12
+ });
13
+ function ClipCaptureOverlay({ page, passages = [], onCapture }) {
7
14
  const start = useRef(null);
8
15
  const [draft, setDraft] = useState(null);
16
+ const [hovered, setHovered] = useState(null);
9
17
  const point = (event, box) => ({
10
18
  x: event.clientX - box.left,
11
19
  y: event.clientY - box.top
12
20
  });
21
+ const passageUnder = (event, box) => {
22
+ if (!passages.length || !box.width || !box.height) return null;
23
+ const p = point(event, box);
24
+ return passageAt(passages, p.x / box.width, p.y / box.height);
25
+ };
13
26
  const onPointerDown = (event) => {
14
27
  if (event.button !== 0) return;
15
28
  event.preventDefault();
16
- event.currentTarget.setPointerCapture(event.pointerId);
29
+ event.currentTarget.setPointerCapture?.(event.pointerId);
17
30
  const box = event.currentTarget.getBoundingClientRect();
18
31
  start.current = { ...point(event, box), box };
19
32
  setDraft(null);
20
33
  };
21
34
  const onPointerMove = (event) => {
22
35
  const s = start.current;
23
- if (!s) return;
36
+ if (!s) {
37
+ const next = passageUnder(event, event.currentTarget.getBoundingClientRect());
38
+ if (next !== hovered) setHovered(next);
39
+ return;
40
+ }
24
41
  const p = point(event, s.box);
25
42
  setDraft({ x: s.x, y: s.y, width: p.x - s.x, height: p.y - s.y });
26
43
  };
@@ -31,8 +48,9 @@ function ClipCaptureOverlay({ page, onCapture }) {
31
48
  if (!s) return;
32
49
  const p = point(event, s.box);
33
50
  const size = { width: s.box.width, height: s.box.height };
34
- const rect = toNorm({ x: s.x, y: s.y, width: p.x - s.x, height: p.y - s.y }, size);
35
- if (rect.w < MIN_CLIP_FRACTION || rect.h < MIN_CLIP_FRACTION) return;
51
+ const dragged = toNorm({ x: s.x, y: s.y, width: p.x - s.x, height: p.y - s.y }, size);
52
+ const rect = dragged.w < MIN_CLIP_FRACTION || dragged.h < MIN_CLIP_FRACTION ? passageUnder(event, s.box) : dragged;
53
+ if (!rect) return;
36
54
  onCapture({ page, rect, aspect: rect.w * size.width / (rect.h * size.height) });
37
55
  };
38
56
  const shown = draft && {
@@ -41,25 +59,36 @@ function ClipCaptureOverlay({ page, onCapture }) {
41
59
  width: Math.abs(draft.width),
42
60
  height: Math.abs(draft.height)
43
61
  };
44
- return /* @__PURE__ */ jsx(
62
+ return /* @__PURE__ */ jsxs(
45
63
  "div",
46
64
  {
47
65
  className: "absolute inset-0 z-20 cursor-crosshair touch-none select-none",
48
66
  onPointerDown,
49
67
  onPointerMove,
50
68
  onPointerUp,
69
+ onPointerLeave: () => setHovered(null),
51
70
  onPointerCancel: () => {
52
71
  start.current = null;
53
72
  setDraft(null);
54
73
  },
55
74
  "data-testid": `clip-capture-${page}`,
56
- children: shown && /* @__PURE__ */ jsx(
57
- "div",
58
- {
59
- className: "pointer-events-none absolute border-2 border-dashed border-primary bg-primary/10",
60
- style: shown
61
- }
62
- )
75
+ children: [
76
+ hovered && !draft && /* @__PURE__ */ jsx(
77
+ "div",
78
+ {
79
+ className: "pointer-events-none absolute rounded-sm bg-ai-soft/40 ring-2 ring-ai-accent",
80
+ style: percent(hovered),
81
+ "data-testid": "clip-passage-outline"
82
+ }
83
+ ),
84
+ shown && /* @__PURE__ */ jsx(
85
+ "div",
86
+ {
87
+ className: "pointer-events-none absolute border-2 border-dashed border-primary bg-primary/10",
88
+ style: shown
89
+ }
90
+ )
91
+ ]
63
92
  }
64
93
  );
65
94
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/presentation/ClipCaptureOverlay.tsx"],
4
- "sourcesContent": ["/**\n * Over a page while clipping: drag a rectangle and it becomes a clip. The rectangle is kept as\n * fractions of the page (`toNorm`), so it does not depend on the zoom it was drawn at.\n */\n\nimport { useRef, useState, type PointerEvent as ReactPointerEvent } from 'react'\nimport { toNorm, type PixelRect } from '@arbidocs/react/annotations'\nimport type { Rect } from './model'\n\n/** Smaller than this (a fraction of the page, either side) is a stray click, not a clip. */\nconst MIN_CLIP_FRACTION = 0.02\n\nexport interface ClipCaptureOverlayProps {\n page: number\n onCapture: (capture: { page: number; rect: Rect; aspect: number }) => void\n}\n\nexport function ClipCaptureOverlay({ page, onCapture }: ClipCaptureOverlayProps) {\n const start = useRef<{ x: number; y: number; box: DOMRect } | null>(null)\n const [draft, setDraft] = useState<PixelRect | null>(null)\n\n const point = (event: ReactPointerEvent, box: DOMRect) => ({\n x: event.clientX - box.left,\n y: event.clientY - box.top,\n })\n\n const onPointerDown = (event: ReactPointerEvent<HTMLDivElement>) => {\n if (event.button !== 0) return\n event.preventDefault()\n event.currentTarget.setPointerCapture(event.pointerId)\n const box = event.currentTarget.getBoundingClientRect()\n start.current = { ...point(event, box), box }\n setDraft(null)\n }\n\n const onPointerMove = (event: ReactPointerEvent) => {\n const s = start.current\n if (!s) return\n const p = point(event, s.box)\n setDraft({ x: s.x, y: s.y, width: p.x - s.x, height: p.y - s.y })\n }\n\n const onPointerUp = (event: ReactPointerEvent) => {\n const s = start.current\n start.current = null\n setDraft(null)\n if (!s) return\n const p = point(event, s.box)\n const size = { width: s.box.width, height: s.box.height }\n const rect = toNorm({ x: s.x, y: s.y, width: p.x - s.x, height: p.y - s.y }, size)\n if (rect.w < MIN_CLIP_FRACTION || rect.h < MIN_CLIP_FRACTION) return\n onCapture({ page, rect, aspect: (rect.w * size.width) / (rect.h * size.height) })\n }\n\n const shown = draft && {\n left: Math.min(draft.x, draft.x + draft.width),\n top: Math.min(draft.y, draft.y + draft.height),\n width: Math.abs(draft.width),\n height: Math.abs(draft.height),\n }\n\n return (\n <div\n className=\"absolute inset-0 z-20 cursor-crosshair touch-none select-none\"\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={() => {\n start.current = null\n setDraft(null)\n }}\n data-testid={`clip-capture-${page}`}\n >\n {shown && (\n <div\n className=\"pointer-events-none absolute border-2 border-dashed border-primary bg-primary/10\"\n style={shown}\n />\n )}\n </div>\n )\n}\n"],
5
- "mappings": ";AA0EQ;AArER,SAAS,QAAQ,gBAAwD;AACzE,SAAS,cAA8B;AAIvC,MAAM,oBAAoB;AAOnB,SAAS,mBAAmB,EAAE,MAAM,UAAU,GAA4B;AAC/E,QAAM,QAAQ,OAAsD,IAAI;AACxE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAA2B,IAAI;AAEzD,QAAM,QAAQ,CAAC,OAA0B,SAAkB;AAAA,IACzD,GAAG,MAAM,UAAU,IAAI;AAAA,IACvB,GAAG,MAAM,UAAU,IAAI;AAAA,EACzB;AAEA,QAAM,gBAAgB,CAAC,UAA6C;AAClE,QAAI,MAAM,WAAW,EAAG;AACxB,UAAM,eAAe;AACrB,UAAM,cAAc,kBAAkB,MAAM,SAAS;AACrD,UAAM,MAAM,MAAM,cAAc,sBAAsB;AACtD,UAAM,UAAU,EAAE,GAAG,MAAM,OAAO,GAAG,GAAG,IAAI;AAC5C,aAAS,IAAI;AAAA,EACf;AAEA,QAAM,gBAAgB,CAAC,UAA6B;AAClD,UAAM,IAAI,MAAM;AAChB,QAAI,CAAC,EAAG;AACR,UAAM,IAAI,MAAM,OAAO,EAAE,GAAG;AAC5B,aAAS,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC;AAAA,EAClE;AAEA,QAAM,cAAc,CAAC,UAA6B;AAChD,UAAM,IAAI,MAAM;AAChB,UAAM,UAAU;AAChB,aAAS,IAAI;AACb,QAAI,CAAC,EAAG;AACR,UAAM,IAAI,MAAM,OAAO,EAAE,GAAG;AAC5B,UAAM,OAAO,EAAE,OAAO,EAAE,IAAI,OAAO,QAAQ,EAAE,IAAI,OAAO;AACxD,UAAM,OAAO,OAAO,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,GAAG,QAAQ,EAAE,IAAI,EAAE,EAAE,GAAG,IAAI;AACjF,QAAI,KAAK,IAAI,qBAAqB,KAAK,IAAI,kBAAmB;AAC9D,cAAU,EAAE,MAAM,MAAM,QAAS,KAAK,IAAI,KAAK,SAAU,KAAK,IAAI,KAAK,QAAQ,CAAC;AAAA,EAClF;AAEA,QAAM,QAAQ,SAAS;AAAA,IACrB,MAAM,KAAK,IAAI,MAAM,GAAG,MAAM,IAAI,MAAM,KAAK;AAAA,IAC7C,KAAK,KAAK,IAAI,MAAM,GAAG,MAAM,IAAI,MAAM,MAAM;AAAA,IAC7C,OAAO,KAAK,IAAI,MAAM,KAAK;AAAA,IAC3B,QAAQ,KAAK,IAAI,MAAM,MAAM;AAAA,EAC/B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,MACA,iBAAiB,MAAM;AACrB,cAAM,UAAU;AAChB,iBAAS,IAAI;AAAA,MACf;AAAA,MACA,eAAa,gBAAgB,IAAI;AAAA,MAEhC,mBACC;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,OAAO;AAAA;AAAA,MACT;AAAA;AAAA,EAEJ;AAEJ;",
4
+ "sourcesContent": ["/**\n * Over a page while clipping. A click on a passage clips exactly that passage (the parser placed it\n * on the page; it is outlined under the pointer); a drag clips any rectangle (a figure, a scan, a\n * page with no passages). Either way the area is kept as fractions of the page (`toNorm`), so it\n * does not depend on the zoom it was taken at.\n */\n\nimport { useRef, useState, type PointerEvent as ReactPointerEvent } from 'react'\nimport { toNorm, type PixelRect } from '@arbidocs/react/annotations'\nimport type { Rect } from './model'\nimport { passageAt } from './passage-clip'\n\n/** Smaller than this (a fraction of the page, either side) is a click, not a dragged clip. */\nconst MIN_CLIP_FRACTION = 0.02\n\nexport interface ClipCaptureOverlayProps {\n page: number\n /** The page's passages, as the areas a click clips (page fractions, margin included). */\n passages?: readonly Rect[]\n onCapture: (capture: { page: number; rect: Rect; aspect: number }) => void\n}\n\nconst percent = (rect: Rect) => ({\n left: `${rect.x * 100}%`,\n top: `${rect.y * 100}%`,\n width: `${rect.w * 100}%`,\n height: `${rect.h * 100}%`,\n})\n\nexport function ClipCaptureOverlay({ page, passages = [], onCapture }: ClipCaptureOverlayProps) {\n const start = useRef<{ x: number; y: number; box: DOMRect } | null>(null)\n const [draft, setDraft] = useState<PixelRect | null>(null)\n const [hovered, setHovered] = useState<Rect | null>(null)\n\n const point = (event: ReactPointerEvent, box: DOMRect) => ({\n x: event.clientX - box.left,\n y: event.clientY - box.top,\n })\n /** The passage under the pointer, if any. */\n const passageUnder = (event: ReactPointerEvent, box: DOMRect) => {\n if (!passages.length || !box.width || !box.height) return null\n const p = point(event, box)\n return passageAt(passages, p.x / box.width, p.y / box.height)\n }\n\n const onPointerDown = (event: ReactPointerEvent<HTMLDivElement>) => {\n if (event.button !== 0) return\n event.preventDefault()\n event.currentTarget.setPointerCapture?.(event.pointerId)\n const box = event.currentTarget.getBoundingClientRect()\n start.current = { ...point(event, box), box }\n setDraft(null)\n }\n\n const onPointerMove = (event: ReactPointerEvent<HTMLDivElement>) => {\n const s = start.current\n if (!s) {\n const next = passageUnder(event, event.currentTarget.getBoundingClientRect())\n if (next !== hovered) setHovered(next)\n return\n }\n const p = point(event, s.box)\n setDraft({ x: s.x, y: s.y, width: p.x - s.x, height: p.y - s.y })\n }\n\n const onPointerUp = (event: ReactPointerEvent) => {\n const s = start.current\n start.current = null\n setDraft(null)\n if (!s) return\n const p = point(event, s.box)\n const size = { width: s.box.width, height: s.box.height }\n const dragged = toNorm({ x: s.x, y: s.y, width: p.x - s.x, height: p.y - s.y }, size)\n // A click: the passage under it, if there is one.\n const rect =\n dragged.w < MIN_CLIP_FRACTION || dragged.h < MIN_CLIP_FRACTION\n ? passageUnder(event, s.box)\n : dragged\n if (!rect) return\n onCapture({ page, rect, aspect: (rect.w * size.width) / (rect.h * size.height) })\n }\n\n const shown = draft && {\n left: Math.min(draft.x, draft.x + draft.width),\n top: Math.min(draft.y, draft.y + draft.height),\n width: Math.abs(draft.width),\n height: Math.abs(draft.height),\n }\n\n return (\n <div\n className=\"absolute inset-0 z-20 cursor-crosshair touch-none select-none\"\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerLeave={() => setHovered(null)}\n onPointerCancel={() => {\n start.current = null\n setDraft(null)\n }}\n data-testid={`clip-capture-${page}`}\n >\n {/* The passage a click would clip, exactly as it would be clipped. */}\n {hovered && !draft && (\n <div\n className=\"pointer-events-none absolute rounded-sm bg-ai-soft/40 ring-2 ring-ai-accent\"\n style={percent(hovered)}\n data-testid=\"clip-passage-outline\"\n />\n )}\n {shown && (\n <div\n className=\"pointer-events-none absolute border-2 border-dashed border-primary bg-primary/10\"\n style={shown}\n />\n )}\n </div>\n )\n}\n"],
5
+ "mappings": ";AA0FI,SAcI,KAdJ;AAnFJ,SAAS,QAAQ,gBAAwD;AACzE,SAAS,cAA8B;AAEvC,SAAS,iBAAiB;AAG1B,MAAM,oBAAoB;AAS1B,MAAM,UAAU,CAAC,UAAgB;AAAA,EAC/B,MAAM,GAAG,KAAK,IAAI,GAAG;AAAA,EACrB,KAAK,GAAG,KAAK,IAAI,GAAG;AAAA,EACpB,OAAO,GAAG,KAAK,IAAI,GAAG;AAAA,EACtB,QAAQ,GAAG,KAAK,IAAI,GAAG;AACzB;AAEO,SAAS,mBAAmB,EAAE,MAAM,WAAW,CAAC,GAAG,UAAU,GAA4B;AAC9F,QAAM,QAAQ,OAAsD,IAAI;AACxE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAA2B,IAAI;AACzD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAsB,IAAI;AAExD,QAAM,QAAQ,CAAC,OAA0B,SAAkB;AAAA,IACzD,GAAG,MAAM,UAAU,IAAI;AAAA,IACvB,GAAG,MAAM,UAAU,IAAI;AAAA,EACzB;AAEA,QAAM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AAQ,IAAI,qBAAqB,QAAQ,IAAI,oBACzC,aAAa,OAAO,EAAE,GAAG,IACzB;AACN,QAAI,CAAC,KAAM;AACX,cAAU,EAAE,MAAM,MAAM,QAAS,KAAK,IAAI,KAAK,SAAU,KAAK,IAAI,KAAK,QAAQ,CAAC;AAAA,EAClF;AAEA,QAAM,QAAQ,SAAS;AAAA,IACrB,MAAM,KAAK,IAAI,MAAM,GAAG,MAAM,IAAI,MAAM,KAAK;AAAA,IAC7C,KAAK,KAAK,IAAI,MAAM,GAAG,MAAM,IAAI,MAAM,MAAM;AAAA,IAC7C,OAAO,KAAK,IAAI,MAAM,KAAK;AAAA,IAC3B,QAAQ,KAAK,IAAI,MAAM,MAAM;AAAA,EAC/B;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,MACA,gBAAgB,MAAM,WAAW,IAAI;AAAA,MACrC,iBAAiB,MAAM;AACrB,cAAM,UAAU;AAChB,iBAAS,IAAI;AAAA,MACf;AAAA,MACA,eAAa,gBAAgB,IAAI;AAAA,MAGhC;AAAA,mBAAW,CAAC,SACX;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO,QAAQ,OAAO;AAAA,YACtB,eAAY;AAAA;AAAA,QACd;AAAA,QAED,SACC;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO;AAAA;AAAA,QACT;AAAA;AAAA;AAAA,EAEJ;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -3,6 +3,14 @@
3
3
  * blank, full screen and stop. Like a slideshow's, they show while the pointer moves (or a key is
4
4
  * pressed) and fade after a moment, with the pointer, so a shared screen rarely shows them.
5
5
  */
6
+ import type { ReactNode } from 'react';
7
+ export declare function Control({ label, onClick, disabled, children, testId, }: {
8
+ label: string;
9
+ onClick: () => void;
10
+ disabled?: boolean;
11
+ children: ReactNode;
12
+ testId: string;
13
+ }): import("react").JSX.Element;
6
14
  export interface PresentControlsProps {
7
15
  /** The window presented in (full screen is that window's). */
8
16
  view: Window | null;
@@ -112,6 +112,7 @@ function PresentControls({ view, shown }) {
112
112
  );
113
113
  }
114
114
  export {
115
+ Control,
115
116
  PresentControls
116
117
  };
117
118
  //# sourceMappingURL=PresentControls.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/presentation/PresentControls.tsx"],
4
- "sourcesContent": ["/**\n * The presented slides' controls, bottom left: previous and next slide (with where you are),\n * blank, full screen and stop. Like a slideshow's, they show while the pointer moves (or a key is\n * pressed) and fade after a moment, with the pointer, so a shared screen rarely shows them.\n */\n\nimport type { ReactNode } from 'react'\nimport { ChevronLeft, ChevronRight, EyeOff, Maximize, Square } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { usePresentation } from './store'\nimport { toggleFullscreen } from './usePresenterKeys'\n\nconst CONTROL =\n 'inline-flex size-8 items-center justify-center rounded-full text-white/85 hover:bg-white/15 hover:text-white disabled:opacity-30 disabled:hover:bg-transparent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60 pointer-coarse:size-11'\n\nfunction Control({\n label,\n onClick,\n disabled,\n children,\n testId,\n}: {\n label: string\n onClick: () => void\n disabled?: boolean\n children: ReactNode\n testId: string\n}) {\n return (\n <button\n type=\"button\"\n className={CONTROL}\n title={label}\n aria-label={label}\n disabled={disabled}\n onClick={(event) => {\n // A click on the controls is not a click on the slide (which goes to the next one).\n event.stopPropagation()\n onClick()\n }}\n data-testid={testId}\n >\n {children}\n </button>\n )\n}\n\nexport interface PresentControlsProps {\n /** The window presented in (full screen is that window's). */\n view: Window | null\n shown: boolean\n}\n\nexport function PresentControls({ view, shown }: PresentControlsProps) {\n const current = usePresentation((s) => s.current)\n const count = usePresentation((s) => s.slides.length)\n const blank = usePresentation((s) => s.blank)\n const actions = usePresentation.getState()\n return (\n <div\n className={cn(\n 'absolute bottom-4 left-4 z-30 flex items-center gap-0.5 rounded-full bg-black/60 p-1 text-white shadow-lg backdrop-blur transition-opacity duration-300',\n shown ? 'opacity-100' : 'pointer-events-none opacity-0'\n )}\n onPointerDown={(event) => event.stopPropagation()}\n onDoubleClick={(event) => event.stopPropagation()}\n role=\"toolbar\"\n aria-label=\"Slideshow\"\n data-testid=\"present-controls\"\n >\n <Control\n label=\"Previous slide (\u2190)\"\n onClick={() => actions.goTo(current - 1)}\n disabled={current === 0}\n testId=\"present-previous\"\n >\n <ChevronLeft className=\"size-4\" />\n </Control>\n <span\n className=\"min-w-12 text-center text-xs tabular-nums text-white/85\"\n data-testid=\"present-position\"\n >\n {current + 1} / {count}\n </span>\n <Control\n label=\"Next slide (\u2192, or click the slide)\"\n onClick={() => actions.goTo(current + 1)}\n disabled={current >= count - 1}\n testId=\"present-next\"\n >\n <ChevronRight className=\"size-4\" />\n </Control>\n <div className=\"mx-1 h-4 w-px bg-white/25\" />\n <Control\n label={blank ? 'Show the slide (B)' : 'Blank the screen (B)'}\n onClick={() => actions.setBlank(!blank)}\n testId=\"present-blank\"\n >\n <EyeOff className={cn('size-4', blank && 'text-amber-300')} />\n </Control>\n <Control\n label=\"Full screen (F)\"\n onClick={() => view && toggleFullscreen(view)}\n testId=\"present-fullscreen\"\n >\n <Maximize className=\"size-4\" />\n </Control>\n <Control\n label=\"Stop presenting (Esc)\"\n onClick={() => actions.setPresenting(false)}\n testId=\"present-stop\"\n >\n <Square className=\"size-3.5 fill-current\" />\n </Control>\n </div>\n )\n}\n"],
5
- "mappings": ";AA6BI,cAiDE,YAjDF;AAtBJ,SAAS,aAAa,cAAc,QAAQ,UAAU,cAAc;AACpE,SAAS,UAAU;AACnB,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AAEjC,MAAM,UACJ;AAEF,SAAS,QAAQ;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAMG;AACD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,WAAW;AAA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C;AAAA,UAAC;AAAA;AAAA,YACC,OAAO,QAAQ,uBAAuB;AAAA,YACtC,SAAS,MAAM,QAAQ,SAAS,CAAC,KAAK;AAAA,YACtC,QAAO;AAAA,YAEP,8BAAC,UAAO,WAAW,GAAG,UAAU,SAAS,gBAAgB,GAAG;AAAA;AAAA,QAC9D;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,OAAM;AAAA,YACN,SAAS,MAAM,QAAQ,iBAAiB,IAAI;AAAA,YAC5C,QAAO;AAAA,YAEP,8BAAC,YAAS,WAAU,UAAS;AAAA;AAAA,QAC/B;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,OAAM;AAAA,YACN,SAAS,MAAM,QAAQ,cAAc,KAAK;AAAA,YAC1C,QAAO;AAAA,YAEP,8BAAC,UAAO,WAAU,yBAAwB;AAAA;AAAA,QAC5C;AAAA;AAAA;AAAA,EACF;AAEJ;",
4
+ "sourcesContent": ["/**\n * The presented slides' controls, bottom left: previous and next slide (with where you are),\n * blank, full screen and stop. Like a slideshow's, they show while the pointer moves (or a key is\n * pressed) and fade after a moment, with the pointer, so a shared screen rarely shows them.\n */\n\nimport type { ReactNode } from 'react'\nimport { ChevronLeft, ChevronRight, EyeOff, Maximize, Square } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { usePresentation } from './store'\nimport { toggleFullscreen } from './usePresenterKeys'\n\nconst CONTROL =\n 'inline-flex size-8 items-center justify-center rounded-full text-white/85 hover:bg-white/15 hover:text-white disabled:opacity-30 disabled:hover:bg-transparent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60 pointer-coarse:size-11'\n\nexport function Control({\n label,\n onClick,\n disabled,\n children,\n testId,\n}: {\n label: string\n onClick: () => void\n disabled?: boolean\n children: ReactNode\n testId: string\n}) {\n return (\n <button\n type=\"button\"\n className={CONTROL}\n title={label}\n aria-label={label}\n disabled={disabled}\n onClick={(event) => {\n // A click on the controls is not a click on the slide (which goes to the next one).\n event.stopPropagation()\n onClick()\n }}\n data-testid={testId}\n >\n {children}\n </button>\n )\n}\n\nexport interface PresentControlsProps {\n /** The window presented in (full screen is that window's). */\n view: Window | null\n shown: boolean\n}\n\nexport function PresentControls({ view, shown }: PresentControlsProps) {\n const current = usePresentation((s) => s.current)\n const count = usePresentation((s) => s.slides.length)\n const blank = usePresentation((s) => s.blank)\n const actions = usePresentation.getState()\n return (\n <div\n className={cn(\n 'absolute bottom-4 left-4 z-30 flex items-center gap-0.5 rounded-full bg-black/60 p-1 text-white shadow-lg backdrop-blur transition-opacity duration-300',\n shown ? 'opacity-100' : 'pointer-events-none opacity-0'\n )}\n onPointerDown={(event) => event.stopPropagation()}\n onDoubleClick={(event) => event.stopPropagation()}\n role=\"toolbar\"\n aria-label=\"Slideshow\"\n data-testid=\"present-controls\"\n >\n <Control\n label=\"Previous slide (\u2190)\"\n onClick={() => actions.goTo(current - 1)}\n disabled={current === 0}\n testId=\"present-previous\"\n >\n <ChevronLeft className=\"size-4\" />\n </Control>\n <span\n className=\"min-w-12 text-center text-xs tabular-nums text-white/85\"\n data-testid=\"present-position\"\n >\n {current + 1} / {count}\n </span>\n <Control\n label=\"Next slide (\u2192, or click the slide)\"\n onClick={() => actions.goTo(current + 1)}\n disabled={current >= count - 1}\n testId=\"present-next\"\n >\n <ChevronRight className=\"size-4\" />\n </Control>\n <div className=\"mx-1 h-4 w-px bg-white/25\" />\n <Control\n label={blank ? 'Show the slide (B)' : 'Blank the screen (B)'}\n onClick={() => actions.setBlank(!blank)}\n testId=\"present-blank\"\n >\n <EyeOff className={cn('size-4', blank && 'text-amber-300')} />\n </Control>\n <Control\n label=\"Full screen (F)\"\n onClick={() => view && toggleFullscreen(view)}\n testId=\"present-fullscreen\"\n >\n <Maximize className=\"size-4\" />\n </Control>\n <Control\n label=\"Stop presenting (Esc)\"\n onClick={() => actions.setPresenting(false)}\n testId=\"present-stop\"\n >\n <Square className=\"size-3.5 fill-current\" />\n </Control>\n </div>\n )\n}\n"],
5
+ "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AAU;AAAA,cAAE;AAAA,cAAI;AAAA;AAAA;AAAA,QACnB;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,OAAM;AAAA,YACN,SAAS,MAAM,QAAQ,KAAK,UAAU,CAAC;AAAA,YACvC,UAAU,WAAW,QAAQ;AAAA,YAC7B,QAAO;AAAA,YAEP,8BAAC,gBAAa,WAAU,UAAS;AAAA;AAAA,QACnC;AAAA,QACA,oBAAC,SAAI,WAAU,6BAA4B;AAAA,QAC3C;AAAA,UAAC;AAAA;AAAA,YACC,OAAO,QAAQ,uBAAuB;AAAA,YACtC,SAAS,MAAM,QAAQ,SAAS,CAAC,KAAK;AAAA,YACtC,QAAO;AAAA,YAEP,8BAAC,UAAO,WAAW,GAAG,UAAU,SAAS,gBAAgB,GAAG;AAAA;AAAA,QAC9D;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,OAAM;AAAA,YACN,SAAS,MAAM,QAAQ,iBAAiB,IAAI;AAAA,YAC5C,QAAO;AAAA,YAEP,8BAAC,YAAS,WAAU,UAAS;AAAA;AAAA,QAC/B;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,OAAM;AAAA,YACN,SAAS,MAAM,QAAQ,cAAc,KAAK;AAAA,YAC1C,QAAO;AAAA,YAEP,8BAAC,UAAO,WAAU,yBAAwB;AAAA;AAAA,QAC5C;AAAA;AAAA;AAAA,EACF;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -9,11 +9,19 @@
9
9
  */
10
10
  import { type ReactNode } from 'react';
11
11
  import { type SlideTextEditing } from './SlideDecor';
12
- import { type Guide } from './model';
12
+ import { type Clip, type Guide, type Slide } from './model';
13
13
  export interface PresentationStageProps {
14
14
  editable?: boolean;
15
15
  /** The slide shown (default: the current one). */
16
16
  slideIndex?: number;
17
+ /**
18
+ * A slide that is not one of the presentation's, shown with its own clips (the viewer's
19
+ * spotlight); the presentation's look still applies.
20
+ */
21
+ show?: {
22
+ slide: Slide;
23
+ clips: readonly Clip[];
24
+ };
17
25
  selected?: string | null;
18
26
  onSelect?: (clipId: string | null) => void;
19
27
  /** Offered on a selected image clip: make a new version of it. */
@@ -29,4 +37,4 @@ export interface PresentationStageProps {
29
37
  export interface GuideLayerHandle {
30
38
  set(guides: Guide[]): void;
31
39
  }
32
- export declare function PresentationStage({ editable, slideIndex, selected, onSelect, onEditImage, onCropImage, textEditing, overlay, className, }: PresentationStageProps): import("react").JSX.Element;
40
+ export declare function PresentationStage({ editable, slideIndex, show, selected, onSelect, onEditImage, onCropImage, textEditing, overlay, className, }: PresentationStageProps): import("react").JSX.Element;
@@ -37,6 +37,7 @@ const GuideLayer = memo(
37
37
  function PresentationStage({
38
38
  editable = false,
39
39
  slideIndex,
40
+ show,
40
41
  selected = null,
41
42
  onSelect,
42
43
  onEditImage,
@@ -46,9 +47,11 @@ function PresentationStage({
46
47
  className
47
48
  }) {
48
49
  const index = usePresentation((s) => slideIndex ?? s.current);
49
- const slide = usePresentation((s) => s.slides[index]);
50
- const clips = usePresentation((s) => s.clips);
51
- const blank = usePresentation((s) => s.blank && !editable);
50
+ const deckSlide = usePresentation((s) => s.slides[index]);
51
+ const deckClips = usePresentation((s) => s.clips);
52
+ const slide = show?.slide ?? deckSlide;
53
+ const clips = show?.clips ?? deckClips;
54
+ const blank = usePresentation((s) => s.blank && !editable && !show);
52
55
  const captions = usePresentation((s) => s.captions);
53
56
  const columnValues = usePresentation((s) => s.columnValues);
54
57
  const theme = usePresentation((s) => s.theme);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/presentation/PresentationStage.tsx"],
4
- "sourcesContent": ["/**\n * The 16:9 stage: a slide's clips in their frames, its title, points and logo, as large as the\n * container allows. Presenting shows it bare; the editor's copy is `editable`: each clip\n * (`StageItem`) is moved, resized and reshaped by dragging, snapping with guide lines; clips are\n * selected for their floating actions, and clips dragged from the tray are dropped onto it.\n *\n * A slide's stage re-renders only when its slide (or the clips, theme or labels) change; a clip's\n * drag re-renders nothing here but the guides and, at its start and end, the floating actions.\n */\n\nimport {\n forwardRef,\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react'\nimport { cn } from '@arbidocs/react/ui'\nimport { ClipActionBar } from './ClipActionBar'\nimport { SlideDecor, type SlideTextEditing } from './SlideDecor'\nimport { StageItem, type StageItemHost } from './StageItem'\nimport { StageBox, type StageBoxHost } from './StageBox'\nimport { BoxActionBar } from './BoxActionBar'\nimport { FONTS, backgroundCss, slideBackgroundCss } from './theme'\nimport { clipLabel, type Clip, type Frame, type Guide } from './model'\nimport { usePresentation } from './store'\nimport { DROP_ATTRIBUTE } from './useClipDrag'\n\nexport interface PresentationStageProps {\n editable?: boolean\n /** The slide shown (default: the current one). */\n slideIndex?: number\n selected?: string | null\n onSelect?: (clipId: string | null) => void\n /** Offered on a selected image clip: make a new version of it. */\n onEditImage?: (clipId: string) => void\n /** Offered on a selected image clip: choose the part of the image it shows. */\n onCropImage?: (clipId: string) => void\n /** Typing the slide's title and points on the slide itself (the editor's stages). */\n textEditing?: SlideTextEditing\n /** Over the slide (e.g. the editor's hover actions). */\n overlay?: ReactNode\n className?: string\n}\n\nexport interface GuideLayerHandle {\n set(guides: Guide[]): void\n}\n\n/** The snap lines of a dragged clip: its own state, so drawing them re-renders nothing else. */\nconst GuideLayer = memo(\n forwardRef<GuideLayerHandle>(function GuideLayer(_, ref) {\n const [guides, setGuides] = useState<Guide[]>([])\n useImperativeHandle(ref, () => ({ set: setGuides }), [])\n return (\n <>\n {guides.map((guide) => (\n <div\n key={`${guide.axis}-${guide.at}`}\n className=\"pointer-events-none absolute z-10 bg-primary\"\n style={\n guide.axis === 'x'\n ? { left: `${guide.at * 100}%`, top: 0, bottom: 0, width: 1 }\n : { top: `${guide.at * 100}%`, left: 0, right: 0, height: 1 }\n }\n data-testid={`stage-guide-${guide.axis}`}\n />\n ))}\n </>\n )\n })\n)\n\nexport function PresentationStage({\n editable = false,\n slideIndex,\n selected = null,\n onSelect,\n onEditImage,\n onCropImage,\n textEditing,\n overlay,\n className,\n}: PresentationStageProps) {\n const index = usePresentation((s) => slideIndex ?? s.current)\n const slide = usePresentation((s) => s.slides[index])\n const clips = usePresentation((s) => s.clips)\n const blank = usePresentation((s) => s.blank && !editable)\n const captions = usePresentation((s) => s.captions)\n const columnValues = usePresentation((s) => s.columnValues)\n const theme = usePresentation((s) => s.theme)\n const logoImage = usePresentation((s) => s.logoImage)\n const media = usePresentation((s) => s.media)\n const stageRef = useRef<HTMLDivElement>(null)\n const guideLayer = useRef<GuideLayerHandle>(null)\n // A clip dragged from the tray: the stage shows it can take it.\n const dropping = usePresentation((s) => editable && s.dragging !== null)\n // A clip being dragged on the stage: its floating actions hide meanwhile.\n const [dragging, setDragging] = useState(false)\n\n // The latest values the clips' gestures read as they begin (the host itself never changes).\n const latest = useRef({ slide, clips, index, onSelect })\n latest.current = { slide, clips, index, onSelect }\n const host = useMemo<StageItemHost>(\n () => ({\n stageBox: () => stageRef.current?.getBoundingClientRect() ?? null,\n others: (clipId) => {\n const { slide: current, clips: all } = latest.current\n return (current?.items ?? [])\n .filter((item) => item.clipId !== clipId)\n .map((item) => ({\n frame: item.frame,\n aspect: all.find((clip) => clip.id === item.clipId)?.aspect ?? 1,\n }))\n },\n select: (clipId) => {\n usePresentation.getState().goTo(latest.current.index)\n latest.current.onSelect?.(clipId)\n },\n guides: (guides) => guideLayer.current?.set(guides),\n dragging: setDragging,\n commit: (clipId: string, frame: Frame, shape?: Pick<Clip, 'rect' | 'aspect'>) => {\n const state = usePresentation.getState()\n state.goTo(latest.current.index)\n if (shape) state.reshapeClip(clipId, frame, shape.rect, shape.aspect)\n else state.setFrame(clipId, frame)\n },\n }),\n []\n )\n\n const boxHost = useMemo<StageBoxHost>(\n () => ({\n stageBox: () => stageRef.current?.getBoundingClientRect() ?? null,\n select: (boxId) => {\n usePresentation.getState().goTo(latest.current.index)\n latest.current.onSelect?.(boxId)\n },\n commit: (boxId, frame) =>\n usePresentation.getState().updateBox(boxId, (box) => ({ ...box, frame })),\n setText: (boxId, text) => usePresentation.getState().setBoxText(boxId, text),\n }),\n []\n )\n const font = FONTS[theme.font].css\n const boxes = slide?.boxes ?? []\n const selectedBox = selected ? boxes.find((box) => box.id === selected) : undefined\n const renderBoxes = (front: boolean) =>\n boxes\n .filter((box) => !!box.front === front)\n .map((box) => (\n <StageBox\n key={box.id}\n box={box}\n font={font}\n editable={editable}\n selected={editable && selected === box.id}\n host={boxHost}\n />\n ))\n\n const clipOf = (id: string): Clip | undefined => clips.find((clip) => clip.id === id)\n const selectedFrame = selected\n ? slide?.items.find((item) => item.clipId === selected)?.frame\n : undefined\n\n // Scrolling over the selected clip (wheel or trackpad; Shift for sideways) scrolls what it shows\n // over its source: the lines above or below, say. A native listener, so the editor itself does\n // not scroll; steps are gathered and applied once per animation frame.\n useEffect(() => {\n const stage = stageRef.current\n const view = stage?.ownerDocument.defaultView\n if (!editable || !selected || !stage || !view) return\n let sum = { x: 0, y: 0 }\n let request: number | null = null\n const onWheel = (event: WheelEvent) => {\n const item = (event.target as Element | null)?.closest?.(\n `[data-testid=\"stage-item-${selected}\"]`\n )\n const clip = usePresentation.getState().clips.find((entry) => entry.id === selected)\n if (!item || !clip) return\n event.preventDefault()\n const box = item.getBoundingClientRect()\n const horizontal = event.shiftKey && !event.deltaX\n const deltaX = horizontal ? event.deltaY : event.deltaX\n const deltaY = horizontal ? 0 : event.deltaY\n // Screen pixels to fractions of the source: the clip's area spans the clip's box.\n sum = {\n x: sum.x + (deltaX / box.width) * clip.rect.w,\n y: sum.y + (deltaY / box.height) * clip.rect.h,\n }\n request ??= view.requestAnimationFrame(() => {\n request = null\n usePresentation.getState().panClip(selected, sum.x, sum.y)\n sum = { x: 0, y: 0 }\n })\n }\n stage.addEventListener('wheel', onWheel, { passive: false })\n return () => {\n stage.removeEventListener('wheel', onWheel)\n if (request !== null) view.cancelAnimationFrame(request)\n }\n }, [editable, selected])\n\n return (\n <div\n className={cn('relative h-full w-full', !editable && 'overflow-hidden bg-black', className)}\n // The stage's size comes from this box's (container query units): 16:9, as large as fits.\n style={{ containerType: 'size' }}\n data-testid={editable ? 'presentation-stage-editor' : 'presentation-stage'}\n >\n <div\n ref={stageRef}\n className={cn(\n 'absolute inset-0 m-auto',\n editable ? 'shadow-md' : 'overflow-hidden',\n dropping && 'outline outline-2 outline-offset-2 outline-primary'\n )}\n style={{\n width: 'min(100cqw, calc(100cqh * 16 / 9))',\n height: 'min(100cqh, calc(100cqw * 9 / 16))',\n containerType: 'inline-size',\n background: slide?.background\n ? slideBackgroundCss(slide.background, media)\n : backgroundCss(theme.background),\n fontFamily: FONTS[theme.font].css,\n }}\n onPointerDown={() => {\n if (!editable) return\n usePresentation.getState().goTo(index)\n onSelect?.(null)\n }}\n {...(editable ? { [DROP_ATTRIBUTE]: 'stage', 'data-slide-index': index } : {})}\n aria-label={`Slide ${index + 1}`}\n >\n {/* Blanked: the shared stage is black. */}\n {blank && <div className=\"absolute inset-0 z-20 bg-black\" />}\n {/* The title, points and logo, by the slide's layout. */}\n {slide && (\n <SlideDecor\n slide={slide}\n theme={theme}\n labels={captions}\n logoImage={logoImage}\n editable={editable}\n editing={textEditing}\n />\n )}\n {renderBoxes(false)}\n {slide?.items.map((item) => {\n const clip = clipOf(item.clipId)\n if (!clip) return null\n return (\n <StageItem\n key={clip.id}\n clip={clip}\n frame={item.frame}\n editable={editable}\n selected={editable && selected === clip.id}\n dim={false}\n label={captions ? clipLabel(clip, columnValues) : ''}\n host={host}\n />\n )\n })}\n {renderBoxes(true)}\n {/* Smart guides: the lines the dragged clip snapped to (editor only). */}\n {editable && <GuideLayer ref={guideLayer} />}\n {/* The selected clip's floating actions, above it (the stage leaves room). */}\n {editable && selectedFrame && selected && !dragging && (\n <ClipActionBar\n clipId={selected}\n at={selectedFrame}\n onRemoved={() => onSelect?.(null)}\n onEditImage={\n onEditImage && clipOf(selected)?.kind === 'image'\n ? () => onEditImage(selected)\n : undefined\n }\n onCropImage={\n onCropImage && clipOf(selected)?.kind === 'image'\n ? () => onCropImage(selected)\n : undefined\n }\n />\n )}\n {editable && selectedBox && (\n <BoxActionBar box={selectedBox} onRemoved={() => onSelect?.(null)} />\n )}\n {overlay}\n </div>\n </div>\n )\n}\n"],
5
- "mappings": ";AA0DM,mBAEI,KA0JJ,YA5JA;AAhDN;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,UAAU;AACnB,SAAS,qBAAqB;AAC9B,SAAS,kBAAyC;AAClD,SAAS,iBAAqC;AAC9C,SAAS,gBAAmC;AAC5C,SAAS,oBAAoB;AAC7B,SAAS,OAAO,eAAe,0BAA0B;AACzD,SAAS,iBAAoD;AAC7D,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAwB/B,MAAM,aAAa;AAAA,EACjB,WAA6B,SAASA,YAAW,GAAG,KAAK;AACvD,UAAM,CAAC,QAAQ,SAAS,IAAI,SAAkB,CAAC,CAAC;AAChD,wBAAoB,KAAK,OAAO,EAAE,KAAK,UAAU,IAAI,CAAC,CAAC;AACvD,WACE,gCACG,iBAAO,IAAI,CAAC,UACX;AAAA,MAAC;AAAA;AAAA,QAEC,WAAU;AAAA,QACV,OACE,MAAM,SAAS,MACX,EAAE,MAAM,GAAG,MAAM,KAAK,GAAG,KAAK,KAAK,GAAG,QAAQ,GAAG,OAAO,EAAE,IAC1D,EAAE,KAAK,GAAG,MAAM,KAAK,GAAG,KAAK,MAAM,GAAG,OAAO,GAAG,QAAQ,EAAE;AAAA,QAEhE,eAAa,eAAe,MAAM,IAAI;AAAA;AAAA,MAPjC,GAAG,MAAM,IAAI,IAAI,MAAM,EAAE;AAAA,IAQhC,CACD,GACH;AAAA,EAEJ,CAAC;AACH;AAEO,SAAS,kBAAkB;AAAA,EAChC,WAAW;AAAA,EACX;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,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kBAEC;AAAA,kBACA,OAAO,KAAK;AAAA,kBACZ;AAAA,kBACA,UAAU,YAAY,aAAa,KAAK;AAAA,kBACxC,KAAK;AAAA,kBACL,OAAO,WAAW,UAAU,MAAM,YAAY,IAAI;AAAA,kBAClD;AAAA;AAAA,gBAPK,KAAK;AAAA,cAQZ;AAAA,YAEJ,CAAC;AAAA,YACA,YAAY,IAAI;AAAA,YAEhB,YAAY,oBAAC,cAAW,KAAK,YAAY;AAAA,YAEzC,YAAY,iBAAiB,YAAY,CAAC,YACzC;AAAA,cAAC;AAAA;AAAA,gBACC,QAAQ;AAAA,gBACR,IAAI;AAAA,gBACJ,WAAW,MAAM,WAAW,IAAI;AAAA,gBAChC,aACE,eAAe,OAAO,QAAQ,GAAG,SAAS,UACtC,MAAM,YAAY,QAAQ,IAC1B;AAAA,gBAEN,aACE,eAAe,OAAO,QAAQ,GAAG,SAAS,UACtC,MAAM,YAAY,QAAQ,IAC1B;AAAA;AAAA,YAER;AAAA,YAED,YAAY,eACX,oBAAC,gBAAa,KAAK,aAAa,WAAW,MAAM,WAAW,IAAI,GAAG;AAAA,YAEpE;AAAA;AAAA;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;",
4
+ "sourcesContent": ["/**\n * The 16:9 stage: a slide's clips in their frames, its title, points and logo, as large as the\n * container allows. Presenting shows it bare; the editor's copy is `editable`: each clip\n * (`StageItem`) is moved, resized and reshaped by dragging, snapping with guide lines; clips are\n * selected for their floating actions, and clips dragged from the tray are dropped onto it.\n *\n * A slide's stage re-renders only when its slide (or the clips, theme or labels) change; a clip's\n * drag re-renders nothing here but the guides and, at its start and end, the floating actions.\n */\n\nimport {\n forwardRef,\n memo,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react'\nimport { cn } from '@arbidocs/react/ui'\nimport { ClipActionBar } from './ClipActionBar'\nimport { SlideDecor, type SlideTextEditing } from './SlideDecor'\nimport { StageItem, type StageItemHost } from './StageItem'\nimport { StageBox, type StageBoxHost } from './StageBox'\nimport { BoxActionBar } from './BoxActionBar'\nimport { FONTS, backgroundCss, slideBackgroundCss } from './theme'\nimport { clipLabel, type Clip, type Frame, type Guide, type Slide } from './model'\nimport { usePresentation } from './store'\nimport { DROP_ATTRIBUTE } from './useClipDrag'\n\nexport interface PresentationStageProps {\n editable?: boolean\n /** The slide shown (default: the current one). */\n slideIndex?: number\n /**\n * A slide that is not one of the presentation's, shown with its own clips (the viewer's\n * spotlight); the presentation's look still applies.\n */\n show?: { slide: Slide; clips: readonly Clip[] }\n selected?: string | null\n onSelect?: (clipId: string | null) => void\n /** Offered on a selected image clip: make a new version of it. */\n onEditImage?: (clipId: string) => void\n /** Offered on a selected image clip: choose the part of the image it shows. */\n onCropImage?: (clipId: string) => void\n /** Typing the slide's title and points on the slide itself (the editor's stages). */\n textEditing?: SlideTextEditing\n /** Over the slide (e.g. the editor's hover actions). */\n overlay?: ReactNode\n className?: string\n}\n\nexport interface GuideLayerHandle {\n set(guides: Guide[]): void\n}\n\n/** The snap lines of a dragged clip: its own state, so drawing them re-renders nothing else. */\nconst GuideLayer = memo(\n forwardRef<GuideLayerHandle>(function GuideLayer(_, ref) {\n const [guides, setGuides] = useState<Guide[]>([])\n useImperativeHandle(ref, () => ({ set: setGuides }), [])\n return (\n <>\n {guides.map((guide) => (\n <div\n key={`${guide.axis}-${guide.at}`}\n className=\"pointer-events-none absolute z-10 bg-primary\"\n style={\n guide.axis === 'x'\n ? { left: `${guide.at * 100}%`, top: 0, bottom: 0, width: 1 }\n : { top: `${guide.at * 100}%`, left: 0, right: 0, height: 1 }\n }\n data-testid={`stage-guide-${guide.axis}`}\n />\n ))}\n </>\n )\n })\n)\n\nexport function PresentationStage({\n editable = false,\n slideIndex,\n show,\n selected = null,\n onSelect,\n onEditImage,\n onCropImage,\n textEditing,\n overlay,\n className,\n}: PresentationStageProps) {\n const index = usePresentation((s) => slideIndex ?? s.current)\n const deckSlide = usePresentation((s) => s.slides[index])\n const deckClips = usePresentation((s) => s.clips)\n const slide = show?.slide ?? deckSlide\n const clips = show?.clips ?? deckClips\n const blank = usePresentation((s) => s.blank && !editable && !show)\n const captions = usePresentation((s) => s.captions)\n const columnValues = usePresentation((s) => s.columnValues)\n const theme = usePresentation((s) => s.theme)\n const logoImage = usePresentation((s) => s.logoImage)\n const media = usePresentation((s) => s.media)\n const stageRef = useRef<HTMLDivElement>(null)\n const guideLayer = useRef<GuideLayerHandle>(null)\n // A clip dragged from the tray: the stage shows it can take it.\n const dropping = usePresentation((s) => editable && s.dragging !== null)\n // A clip being dragged on the stage: its floating actions hide meanwhile.\n const [dragging, setDragging] = useState(false)\n\n // The latest values the clips' gestures read as they begin (the host itself never changes).\n const latest = useRef({ slide, clips, index, onSelect })\n latest.current = { slide, clips, index, onSelect }\n const host = useMemo<StageItemHost>(\n () => ({\n stageBox: () => stageRef.current?.getBoundingClientRect() ?? null,\n others: (clipId) => {\n const { slide: current, clips: all } = latest.current\n return (current?.items ?? [])\n .filter((item) => item.clipId !== clipId)\n .map((item) => ({\n frame: item.frame,\n aspect: all.find((clip) => clip.id === item.clipId)?.aspect ?? 1,\n }))\n },\n select: (clipId) => {\n usePresentation.getState().goTo(latest.current.index)\n latest.current.onSelect?.(clipId)\n },\n guides: (guides) => guideLayer.current?.set(guides),\n dragging: setDragging,\n commit: (clipId: string, frame: Frame, shape?: Pick<Clip, 'rect' | 'aspect'>) => {\n const state = usePresentation.getState()\n state.goTo(latest.current.index)\n if (shape) state.reshapeClip(clipId, frame, shape.rect, shape.aspect)\n else state.setFrame(clipId, frame)\n },\n }),\n []\n )\n\n const boxHost = useMemo<StageBoxHost>(\n () => ({\n stageBox: () => stageRef.current?.getBoundingClientRect() ?? null,\n select: (boxId) => {\n usePresentation.getState().goTo(latest.current.index)\n latest.current.onSelect?.(boxId)\n },\n commit: (boxId, frame) =>\n usePresentation.getState().updateBox(boxId, (box) => ({ ...box, frame })),\n setText: (boxId, text) => usePresentation.getState().setBoxText(boxId, text),\n }),\n []\n )\n const font = FONTS[theme.font].css\n const boxes = slide?.boxes ?? []\n const selectedBox = selected ? boxes.find((box) => box.id === selected) : undefined\n const renderBoxes = (front: boolean) =>\n boxes\n .filter((box) => !!box.front === front)\n .map((box) => (\n <StageBox\n key={box.id}\n box={box}\n font={font}\n editable={editable}\n selected={editable && selected === box.id}\n host={boxHost}\n />\n ))\n\n const clipOf = (id: string): Clip | undefined => clips.find((clip) => clip.id === id)\n const selectedFrame = selected\n ? slide?.items.find((item) => item.clipId === selected)?.frame\n : undefined\n\n // Scrolling over the selected clip (wheel or trackpad; Shift for sideways) scrolls what it shows\n // over its source: the lines above or below, say. A native listener, so the editor itself does\n // not scroll; steps are gathered and applied once per animation frame.\n useEffect(() => {\n const stage = stageRef.current\n const view = stage?.ownerDocument.defaultView\n if (!editable || !selected || !stage || !view) return\n let sum = { x: 0, y: 0 }\n let request: number | null = null\n const onWheel = (event: WheelEvent) => {\n const item = (event.target as Element | null)?.closest?.(\n `[data-testid=\"stage-item-${selected}\"]`\n )\n const clip = usePresentation.getState().clips.find((entry) => entry.id === selected)\n if (!item || !clip) return\n event.preventDefault()\n const box = item.getBoundingClientRect()\n const horizontal = event.shiftKey && !event.deltaX\n const deltaX = horizontal ? event.deltaY : event.deltaX\n const deltaY = horizontal ? 0 : event.deltaY\n // Screen pixels to fractions of the source: the clip's area spans the clip's box.\n sum = {\n x: sum.x + (deltaX / box.width) * clip.rect.w,\n y: sum.y + (deltaY / box.height) * clip.rect.h,\n }\n request ??= view.requestAnimationFrame(() => {\n request = null\n usePresentation.getState().panClip(selected, sum.x, sum.y)\n sum = { x: 0, y: 0 }\n })\n }\n stage.addEventListener('wheel', onWheel, { passive: false })\n return () => {\n stage.removeEventListener('wheel', onWheel)\n if (request !== null) view.cancelAnimationFrame(request)\n }\n }, [editable, selected])\n\n return (\n <div\n className={cn('relative h-full w-full', !editable && 'overflow-hidden bg-black', className)}\n // The stage's size comes from this box's (container query units): 16:9, as large as fits.\n style={{ containerType: 'size' }}\n data-testid={editable ? 'presentation-stage-editor' : 'presentation-stage'}\n >\n <div\n ref={stageRef}\n className={cn(\n 'absolute inset-0 m-auto',\n editable ? 'shadow-md' : 'overflow-hidden',\n dropping && 'outline outline-2 outline-offset-2 outline-primary'\n )}\n style={{\n width: 'min(100cqw, calc(100cqh * 16 / 9))',\n height: 'min(100cqh, calc(100cqw * 9 / 16))',\n containerType: 'inline-size',\n background: slide?.background\n ? slideBackgroundCss(slide.background, media)\n : backgroundCss(theme.background),\n fontFamily: FONTS[theme.font].css,\n }}\n onPointerDown={() => {\n if (!editable) return\n usePresentation.getState().goTo(index)\n onSelect?.(null)\n }}\n {...(editable ? { [DROP_ATTRIBUTE]: 'stage', 'data-slide-index': index } : {})}\n aria-label={`Slide ${index + 1}`}\n >\n {/* Blanked: the shared stage is black. */}\n {blank && <div className=\"absolute inset-0 z-20 bg-black\" />}\n {/* The title, points and logo, by the slide's layout. */}\n {slide && (\n <SlideDecor\n slide={slide}\n theme={theme}\n labels={captions}\n logoImage={logoImage}\n editable={editable}\n editing={textEditing}\n />\n )}\n {renderBoxes(false)}\n {slide?.items.map((item) => {\n const clip = clipOf(item.clipId)\n if (!clip) return null\n return (\n <StageItem\n key={clip.id}\n clip={clip}\n frame={item.frame}\n editable={editable}\n selected={editable && selected === clip.id}\n dim={false}\n label={captions ? clipLabel(clip, columnValues) : ''}\n host={host}\n />\n )\n })}\n {renderBoxes(true)}\n {/* Smart guides: the lines the dragged clip snapped to (editor only). */}\n {editable && <GuideLayer ref={guideLayer} />}\n {/* The selected clip's floating actions, above it (the stage leaves room). */}\n {editable && selectedFrame && selected && !dragging && (\n <ClipActionBar\n clipId={selected}\n at={selectedFrame}\n onRemoved={() => onSelect?.(null)}\n onEditImage={\n onEditImage && clipOf(selected)?.kind === 'image'\n ? () => onEditImage(selected)\n : undefined\n }\n onCropImage={\n onCropImage && clipOf(selected)?.kind === 'image'\n ? () => onCropImage(selected)\n : undefined\n }\n />\n )}\n {editable && selected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EC;AAAA,kBACA,OAAO,KAAK;AAAA,kBACZ;AAAA,kBACA,UAAU,YAAY,aAAa,KAAK;AAAA,kBACxC,KAAK;AAAA,kBACL,OAAO,WAAW,UAAU,MAAM,YAAY,IAAI;AAAA,kBAClD;AAAA;AAAA,gBAPK,KAAK;AAAA,cAQZ;AAAA,YAEJ,CAAC;AAAA,YACA,YAAY,IAAI;AAAA,YAEhB,YAAY,oBAAC,cAAW,KAAK,YAAY;AAAA,YAEzC,YAAY,iBAAiB,YAAY,CAAC,YACzC;AAAA,cAAC;AAAA;AAAA,gBACC,QAAQ;AAAA,gBACR,IAAI;AAAA,gBACJ,WAAW,MAAM,WAAW,IAAI;AAAA,gBAChC,aACE,eAAe,OAAO,QAAQ,GAAG,SAAS,UACtC,MAAM,YAAY,QAAQ,IAC1B;AAAA,gBAEN,aACE,eAAe,OAAO,QAAQ,GAAG,SAAS,UACtC,MAAM,YAAY,QAAQ,IAC1B;AAAA;AAAA,YAER;AAAA,YAED,YAAY,eACX,oBAAC,gBAAa,KAAK,aAAa,WAAW,MAAM,WAAW,IAAI,GAAG;AAAA,YAEpE;AAAA;AAAA;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;",
6
6
  "names": ["GuideLayer"]
7
7
  }
@@ -7,6 +7,7 @@ import { STAGE_ASPECT } from "./model.js";
7
7
  import { usePresentation } from "./store.js";
8
8
  import { toggleFullscreen, usePresenterKeys } from "./usePresenterKeys.js";
9
9
  import { PresentControls } from "./PresentControls.js";
10
+ import { usePointerActive } from "./usePointerActive.js";
10
11
  const PRESENT_WIDTH = 1280;
11
12
  function useStageShapedWindow(view, presenting) {
12
13
  useEffect(() => {
@@ -35,28 +36,6 @@ function useStageShapedWindow(view, presenting) {
35
36
  };
36
37
  }, [view, presenting]);
37
38
  }
38
- const IDLE_MS = 2200;
39
- function usePointerActive(view) {
40
- const [active, setActive] = useState(true);
41
- useEffect(() => {
42
- if (!view) return;
43
- setActive(true);
44
- let timer = view.setTimeout(() => setActive(false), IDLE_MS);
45
- const wake = () => {
46
- setActive(true);
47
- view.clearTimeout(timer);
48
- timer = view.setTimeout(() => setActive(false), IDLE_MS);
49
- };
50
- view.addEventListener("pointermove", wake);
51
- view.addEventListener("keydown", wake);
52
- return () => {
53
- view.clearTimeout(timer);
54
- view.removeEventListener("pointermove", wake);
55
- view.removeEventListener("keydown", wake);
56
- };
57
- }, [view]);
58
- return active;
59
- }
60
39
  function PresenterView({ onPresent, ...editor }) {
61
40
  const presenting = usePresentation((s) => s.presenting);
62
41
  const [view, setView] = useState(null);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/presentation/PresenterView.tsx"],
4
- "sourcesContent": ["/**\n * The presentation in a window of its own, in one of two modes.\n *\n * Present: nothing but the stage on black, no controls and no pointer: what is shared in a call or\n * shown on a projector. Keys drive it (arrows / Page Up / Page Down change slide, B blanks, F or\n * double-click toggles full screen, Space plays videos, Escape stops presenting).\n *\n * Edit: the slides editor (`SlidesEditor`), the same as in the viewer's tab, when the presentation\n * is edited in its own window (beside the document its clips come from).\n */\n\nimport { useCallback, useEffect, useState } from 'react'\nimport { PresentationStage } from './PresentationStage'\nimport { SlidesEditor, type SlidesEditorProps } from './SlidesEditor'\nimport { STAGE_ASPECT } from './model'\nimport { usePresentation } from './store'\nimport { toggleFullscreen, usePresenterKeys } from './usePresenterKeys'\nimport { PresentControls } from './PresentControls'\n\n/** The presenting window's page width, at most (smaller on a small screen). */\nconst PRESENT_WIDTH = 1280\n\n/**\n * While presenting in a pop-out, its page is made 16:9 and wide enough to share sharply, so a\n * shared window is all stage with no bars; editing again gives the window back its size. Only a\n * pop-out (a window this app opened) can be resized; the app's own window is left alone.\n */\nfunction useStageShapedWindow(view: Window | null, presenting: boolean) {\n useEffect(() => {\n if (!view || !presenting || !view.opener) return\n const before = { width: view.outerWidth, height: view.outerHeight }\n const chromeWidth = view.outerWidth - view.innerWidth\n const chromeHeight = view.outerHeight - view.innerHeight\n // Wide enough for a sharp share (a call receives about what the window shows), and 16:9.\n const width = Math.max(\n view.innerWidth,\n Math.min(PRESENT_WIDTH, Math.round((view.screen.availWidth - chromeWidth) * 0.6))\n )\n const height = Math.min(\n Math.round(width / STAGE_ASPECT),\n view.screen.availHeight - chromeHeight\n )\n try {\n view.resizeTo(Math.round(height * STAGE_ASPECT) + chromeWidth, height + chromeHeight)\n } catch {\n return // not resizable: the stage letterboxes in black\n }\n return () => {\n try {\n if (!view.closed) view.resizeTo(before.width, before.height)\n } catch {\n // gone or not resizable\n }\n }\n }, [view, presenting])\n}\n\n/** How long the pointer (or a key) has to rest before the controls fade. */\nconst IDLE_MS = 2200\n\n/** The pointer has moved (or a key was pressed) in `view` within the last moment. */\nfunction usePointerActive(view: Window | null): boolean {\n const [active, setActive] = useState(true)\n useEffect(() => {\n if (!view) return\n setActive(true)\n let timer = view.setTimeout(() => setActive(false), IDLE_MS)\n const wake = () => {\n setActive(true)\n view.clearTimeout(timer)\n timer = view.setTimeout(() => setActive(false), IDLE_MS)\n }\n view.addEventListener('pointermove', wake)\n view.addEventListener('keydown', wake)\n return () => {\n view.clearTimeout(timer)\n view.removeEventListener('pointermove', wake)\n view.removeEventListener('keydown', wake)\n }\n }, [view])\n return active\n}\n\nexport type PresenterViewProps = Omit<SlidesEditorProps, 'onPresent'> & {\n /** Present (default: here, in this window). */\n onPresent?: () => void\n}\n\nexport function PresenterView({ onPresent, ...editor }: PresenterViewProps) {\n const presenting = usePresentation((s) => s.presenting)\n const [view, setView] = useState<Window | null>(null)\n // The keys work in whichever window the presenter is in.\n const rootRef = useCallback((node: HTMLDivElement | null) => {\n if (node) setView(node.ownerDocument.defaultView)\n }, [])\n usePresenterKeys(presenting ? view : null, true)\n useStageShapedWindow(view, presenting)\n\n const active = usePointerActive(presenting ? view : null)\n\n if (presenting) {\n return (\n <div\n ref={rootRef}\n className=\"relative h-full w-full select-none bg-black\"\n // The pointer shows while it moves, with the controls; idle, nothing but the slide.\n style={{ cursor: active ? 'default' : 'none' }}\n // A click on the slide goes to the next one, as in a slideshow.\n onClick={() => {\n const state = usePresentation.getState()\n state.goTo(state.current + 1)\n }}\n onDoubleClick={() => view && toggleFullscreen(view)}\n data-testid=\"presentation-present\"\n >\n <PresentationStage />\n <PresentControls view={view} shown={active} />\n </div>\n )\n }\n return (\n <div ref={rootRef} className=\"h-full min-h-0\" data-testid=\"presenter-view\">\n <SlidesEditor\n {...editor}\n onPresent={onPresent ?? (() => usePresentation.getState().setPresenting(true))}\n />\n </div>\n )\n}\n"],
5
- "mappings": ";AAsGM,SAaE,KAbF;AA3FN,SAAS,aAAa,WAAW,gBAAgB;AACjD,SAAS,yBAAyB;AAClC,SAAS,oBAA4C;AACrD,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,kBAAkB,wBAAwB;AACnD,SAAS,uBAAuB;AAGhC,MAAM,gBAAgB;AAOtB,SAAS,qBAAqB,MAAqB,YAAqB;AACtE,YAAU,MAAM;AACd,QAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,KAAK,OAAQ;AAC1C,UAAM,SAAS,EAAE,OAAO,KAAK,YAAY,QAAQ,KAAK,YAAY;AAClE,UAAM,cAAc,KAAK,aAAa,KAAK;AAC3C,UAAM,eAAe,KAAK,cAAc,KAAK;AAE7C,UAAM,QAAQ,KAAK;AAAA,MACjB,KAAK;AAAA,MACL,KAAK,IAAI,eAAe,KAAK,OAAO,KAAK,OAAO,aAAa,eAAe,GAAG,CAAC;AAAA,IAClF;AACA,UAAM,SAAS,KAAK;AAAA,MAClB,KAAK,MAAM,QAAQ,YAAY;AAAA,MAC/B,KAAK,OAAO,cAAc;AAAA,IAC5B;AACA,QAAI;AACF,WAAK,SAAS,KAAK,MAAM,SAAS,YAAY,IAAI,aAAa,SAAS,YAAY;AAAA,IACtF,QAAQ;AACN;AAAA,IACF;AACA,WAAO,MAAM;AACX,UAAI;AACF,YAAI,CAAC,KAAK,OAAQ,MAAK,SAAS,OAAO,OAAO,OAAO,MAAM;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;AACvC,gBAAM,KAAK,MAAM,UAAU,CAAC;AAAA,QAC9B;AAAA,QACA,eAAe,MAAM,QAAQ,iBAAiB,IAAI;AAAA,QAClD,eAAY;AAAA,QAEZ;AAAA,8BAAC,qBAAkB;AAAA,UACnB,oBAAC,mBAAgB,MAAY,OAAO,QAAQ;AAAA;AAAA;AAAA,IAC9C;AAAA,EAEJ;AACA,SACE,oBAAC,SAAI,KAAK,SAAS,WAAU,kBAAiB,eAAY,kBACxD;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,cAAc,MAAM,gBAAgB,SAAS,EAAE,cAAc,IAAI;AAAA;AAAA,EAC9E,GACF;AAEJ;",
4
+ "sourcesContent": ["/**\n * The presentation in a window of its own, in one of two modes.\n *\n * Present: nothing but the stage on black, no controls and no pointer: what is shared in a call or\n * shown on a projector. Keys drive it (arrows / Page Up / Page Down change slide, B blanks, F or\n * double-click toggles full screen, Space plays videos, Escape stops presenting).\n *\n * Edit: the slides editor (`SlidesEditor`), the same as in the viewer's tab, when the presentation\n * is edited in its own window (beside the document its clips come from).\n */\n\nimport { useCallback, useEffect, useState } from 'react'\nimport { PresentationStage } from './PresentationStage'\nimport { SlidesEditor, type SlidesEditorProps } from './SlidesEditor'\nimport { STAGE_ASPECT } from './model'\nimport { usePresentation } from './store'\nimport { toggleFullscreen, usePresenterKeys } from './usePresenterKeys'\nimport { PresentControls } from './PresentControls'\nimport { usePointerActive } from './usePointerActive'\n\n/** The presenting window's page width, at most (smaller on a small screen). */\nconst PRESENT_WIDTH = 1280\n\n/**\n * While presenting in a pop-out, its page is made 16:9 and wide enough to share sharply, so a\n * shared window is all stage with no bars; editing again gives the window back its size. Only a\n * pop-out (a window this app opened) can be resized; the app's own window is left alone.\n */\nfunction useStageShapedWindow(view: Window | null, presenting: boolean) {\n useEffect(() => {\n if (!view || !presenting || !view.opener) return\n const before = { width: view.outerWidth, height: view.outerHeight }\n const chromeWidth = view.outerWidth - view.innerWidth\n const chromeHeight = view.outerHeight - view.innerHeight\n // Wide enough for a sharp share (a call receives about what the window shows), and 16:9.\n const width = Math.max(\n view.innerWidth,\n Math.min(PRESENT_WIDTH, Math.round((view.screen.availWidth - chromeWidth) * 0.6))\n )\n const height = Math.min(\n Math.round(width / STAGE_ASPECT),\n view.screen.availHeight - chromeHeight\n )\n try {\n view.resizeTo(Math.round(height * STAGE_ASPECT) + chromeWidth, height + chromeHeight)\n } catch {\n return // not resizable: the stage letterboxes in black\n }\n return () => {\n try {\n if (!view.closed) view.resizeTo(before.width, before.height)\n } catch {\n // gone or not resizable\n }\n }\n }, [view, presenting])\n}\n\nexport type PresenterViewProps = Omit<SlidesEditorProps, 'onPresent'> & {\n /** Present (default: here, in this window). */\n onPresent?: () => void\n}\n\nexport function PresenterView({ onPresent, ...editor }: PresenterViewProps) {\n const presenting = usePresentation((s) => s.presenting)\n const [view, setView] = useState<Window | null>(null)\n // The keys work in whichever window the presenter is in.\n const rootRef = useCallback((node: HTMLDivElement | null) => {\n if (node) setView(node.ownerDocument.defaultView)\n }, [])\n usePresenterKeys(presenting ? view : null, true)\n useStageShapedWindow(view, presenting)\n\n const active = usePointerActive(presenting ? view : null)\n\n if (presenting) {\n return (\n <div\n ref={rootRef}\n className=\"relative h-full w-full select-none bg-black\"\n // The pointer shows while it moves, with the controls; idle, nothing but the slide.\n style={{ cursor: active ? 'default' : 'none' }}\n // A click on the slide goes to the next one, as in a slideshow.\n onClick={() => {\n const state = usePresentation.getState()\n state.goTo(state.current + 1)\n }}\n onDoubleClick={() => view && toggleFullscreen(view)}\n data-testid=\"presentation-present\"\n >\n <PresentationStage />\n <PresentControls view={view} shown={active} />\n </div>\n )\n }\n return (\n <div ref={rootRef} className=\"h-full min-h-0\" data-testid=\"presenter-view\">\n <SlidesEditor\n {...editor}\n onPresent={onPresent ?? (() => usePresentation.getState().setPresenting(true))}\n />\n </div>\n )\n}\n"],
5
+ "mappings": ";AA6EM,SAaE,KAbF;AAlEN,SAAS,aAAa,WAA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BAAiB,aAAa,OAAO,MAAM,IAAI;AAC/C,uBAAqB,MAAM,UAAU;AAErC,QAAM,SAAS,iBAAiB,aAAa,OAAO,IAAI;AAExD,MAAI,YAAY;AACd,WACE;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QACL,WAAU;AAAA,QAEV,OAAO,EAAE,QAAQ,SAAS,YAAY,OAAO;AAAA,QAE7C,SAAS,MAAM;AACb,gBAAM,QAAQ,gBAAgB,SAAS;AACvC,gBAAM,KAAK,MAAM,UAAU,CAAC;AAAA,QAC9B;AAAA,QACA,eAAe,MAAM,QAAQ,iBAAiB,IAAI;AAAA,QAClD,eAAY;AAAA,QAEZ;AAAA,8BAAC,qBAAkB;AAAA,UACnB,oBAAC,mBAAgB,MAAY,OAAO,QAAQ;AAAA;AAAA;AAAA,IAC9C;AAAA,EAEJ;AACA,SACE,oBAAC,SAAI,KAAK,SAAS,WAAU,kBAAiB,eAAY,kBACxD;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW,cAAc,MAAM,gBAAgB,SAAS,EAAE,cAAc,IAAI;AAAA;AAAA,EAC9E,GACF;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The spotlight on screen: the document dims and the gathered clips fly from where they are on
3
+ * their pages into a slide over it, in the same window (a call sharing it goes on sharing it). It is
4
+ * the presentation's own stage (`PresentationStage`), so it looks as a slide of the deck would.
5
+ *
6
+ * ← → step through the clips together and each alone, Esc goes back to the document. Each move is
7
+ * a FLIP: a clip is drawn where it ends and animated from where it was (its page, or its place on
8
+ * the previous step) by a transform, about 300 ms; with reduced motion it simply appears.
9
+ */
10
+ import type { Clip } from './model';
11
+ /** How long a clip takes to fly into place. */
12
+ export declare const SPOTLIGHT_MS = 300;
13
+ /** A box on screen, in CSS pixels. */
14
+ export type ScreenRect = Pick<DOMRect, 'left' | 'top' | 'width' | 'height'>;
15
+ export interface SpotlightViewProps {
16
+ /** Where a clip is on screen before the spotlight (its passage on the page), if it shows. */
17
+ fromRect: (clip: Clip) => ScreenRect | null;
18
+ }
19
+ export declare function SpotlightView({ fromRect }: SpotlightViewProps): import("react").JSX.Element;