@arbidocs/blocks 0.5.119 → 0.5.121

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 (463) hide show
  1. package/dist/ClippingMediaViewer-B6WG7Q64.cjs +156 -0
  2. package/dist/ClippingMediaViewer-B6WG7Q64.cjs.map +1 -0
  3. package/dist/ClippingPdfViewer-6GCVTV3V.cjs +79 -0
  4. package/dist/ClippingPdfViewer-6GCVTV3V.cjs.map +1 -0
  5. package/dist/{ConnectedCallDock-WER7R222.cjs → ConnectedCallDock-DC5V5OUJ.cjs} +25 -23
  6. package/dist/ConnectedCallDock-DC5V5OUJ.cjs.map +1 -0
  7. package/dist/{ConnectedCallRoom-T7OBQTYP.cjs → ConnectedCallRoom-FQLXWTFB.cjs} +18 -16
  8. package/dist/{ConnectedCallRoom-T7OBQTYP.cjs.map → ConnectedCallRoom-FQLXWTFB.cjs.map} +1 -1
  9. package/dist/{ConnectedNativeDocxComparison-546ILGLW.cjs → ConnectedNativeDocxComparison-4Q5S7VLD.cjs} +17 -17
  10. package/dist/{ConnectedNativeDocxComparison-546ILGLW.cjs.map → ConnectedNativeDocxComparison-4Q5S7VLD.cjs.map} +1 -1
  11. package/dist/ConnectedPresentation-4HLDZDWV.cjs +183 -0
  12. package/dist/ConnectedPresentation-4HLDZDWV.cjs.map +1 -0
  13. package/dist/{ConnectedProductionSetDialog-LHB4VQWC.cjs → ConnectedProductionSetDialog-4EAY6KAZ.cjs} +3 -3
  14. package/dist/{ConnectedProductionSetDialog-LHB4VQWC.cjs.map → ConnectedProductionSetDialog-4EAY6KAZ.cjs.map} +1 -1
  15. package/dist/ConnectedSlidesTab-7QDE2CZD.cjs +234 -0
  16. package/dist/ConnectedSlidesTab-7QDE2CZD.cjs.map +1 -0
  17. package/dist/{ConnectedStreamedWordArtifact-S2ZFZLZQ.cjs → ConnectedStreamedWordArtifact-FFOQJBOI.cjs} +17 -17
  18. package/dist/{ConnectedStreamedWordArtifact-S2ZFZLZQ.cjs.map → ConnectedStreamedWordArtifact-FFOQJBOI.cjs.map} +1 -1
  19. package/dist/{DocumentReviewCard-ZSBZBGFK.cjs → DocumentReviewCard-SNWVEZ7S.cjs} +19 -18
  20. package/dist/DocumentReviewCard-SNWVEZ7S.cjs.map +1 -0
  21. package/dist/{FilesViewerDialog-6UKR5WEF.cjs → FilesViewerDialog-IZI63FOV.cjs} +54 -47
  22. package/dist/FilesViewerDialog-IZI63FOV.cjs.map +1 -0
  23. package/dist/{GridViewImpl-ZMJJWTOM.cjs → GridViewImpl-LTYET77Q.cjs} +3 -3
  24. package/dist/GridViewImpl-LTYET77Q.cjs.map +1 -0
  25. package/dist/{WorkspaceTableView-J3C6VH4T.cjs → WorkspaceTableView-TEIRB6VJ.cjs} +11 -10
  26. package/dist/WorkspaceTableView-TEIRB6VJ.cjs.map +1 -0
  27. package/dist/agents/index.cjs +297 -297
  28. package/dist/agents/tasks/ConversationListView.js +10 -2
  29. package/dist/agents/tasks/ConversationListView.js.map +2 -2
  30. package/dist/agents/tasks/TaskTable.js +5 -4
  31. package/dist/agents/tasks/TaskTable.js.map +2 -2
  32. package/dist/agents/tasks/WorkflowsTable.js +4 -5
  33. package/dist/agents/tasks/WorkflowsTable.js.map +2 -2
  34. package/dist/agents/tasks/taskColumns.js +1 -1
  35. package/dist/agents/tasks/taskColumns.js.map +1 -1
  36. package/dist/agents/tasks/taskTableLabels.js +1 -1
  37. package/dist/agents/tasks/taskTableLabels.js.map +1 -1
  38. package/dist/agents/tasks/workflowTableLabels.js +1 -1
  39. package/dist/agents/tasks/workflowTableLabels.js.map +1 -1
  40. package/dist/{ai-IM4A23YT.cjs → ai-KBYNRNZ6.cjs} +28 -26
  41. package/dist/ai-KBYNRNZ6.cjs.map +1 -0
  42. package/dist/calls/connected/CallControls.d.ts +2 -0
  43. package/dist/calls/connected/CallControls.js +71 -9
  44. package/dist/calls/connected/CallControls.js.map +2 -2
  45. package/dist/calls/connected/ShareDocumentDialog.d.ts +14 -0
  46. package/dist/calls/connected/ShareDocumentDialog.js +77 -0
  47. package/dist/calls/connected/ShareDocumentDialog.js.map +7 -0
  48. package/dist/calls/index.cjs +121 -121
  49. package/dist/chat/index.cjs +9 -8
  50. package/dist/{chunk-T23UTIRI.cjs → chunk-2PZT3J34.cjs} +6 -6
  51. package/dist/{chunk-T23UTIRI.cjs.map → chunk-2PZT3J34.cjs.map} +1 -1
  52. package/dist/{chunk-SGYSDABK.cjs → chunk-2W5E62EY.cjs} +6 -6
  53. package/dist/{chunk-SGYSDABK.cjs.map → chunk-2W5E62EY.cjs.map} +1 -1
  54. package/dist/{chunk-TDO5UWXF.cjs → chunk-3SCNXNHI.cjs} +5 -5
  55. package/dist/{chunk-TDO5UWXF.cjs.map → chunk-3SCNXNHI.cjs.map} +1 -1
  56. package/dist/{chunk-KTQOGT2L.cjs → chunk-474GPLCM.cjs} +7 -7
  57. package/dist/{chunk-KTQOGT2L.cjs.map → chunk-474GPLCM.cjs.map} +1 -1
  58. package/dist/{chunk-TP5PGWIO.cjs → chunk-4IOYQLKG.cjs} +3 -3
  59. package/dist/{chunk-TP5PGWIO.cjs.map → chunk-4IOYQLKG.cjs.map} +1 -1
  60. package/dist/{chunk-NY3YUCOW.cjs → chunk-4NPCDS2X.cjs} +3 -3
  61. package/dist/{chunk-NY3YUCOW.cjs.map → chunk-4NPCDS2X.cjs.map} +1 -1
  62. package/dist/{chunk-CPG7II4E.cjs → chunk-4RBQ44RY.cjs} +28 -28
  63. package/dist/chunk-4RBQ44RY.cjs.map +1 -0
  64. package/dist/{chunk-BQ5RIWWT.cjs → chunk-4VZZWYEC.cjs} +3 -3
  65. package/dist/{chunk-BQ5RIWWT.cjs.map → chunk-4VZZWYEC.cjs.map} +1 -1
  66. package/dist/{chunk-Y24V6HPR.cjs → chunk-52KGMAO5.cjs} +15 -15
  67. package/dist/{chunk-Y24V6HPR.cjs.map → chunk-52KGMAO5.cjs.map} +1 -1
  68. package/dist/{chunk-HB2O4THB.cjs → chunk-5534FYXP.cjs} +4 -4
  69. package/dist/{chunk-HB2O4THB.cjs.map → chunk-5534FYXP.cjs.map} +1 -1
  70. package/dist/chunk-5GCCUXMT.cjs +63 -0
  71. package/dist/chunk-5GCCUXMT.cjs.map +1 -0
  72. package/dist/chunk-5LTIZ44D.cjs +95 -0
  73. package/dist/chunk-5LTIZ44D.cjs.map +1 -0
  74. package/dist/{chunk-YGXOKB5Z.cjs → chunk-734NPQNR.cjs} +4 -4
  75. package/dist/{chunk-YGXOKB5Z.cjs.map → chunk-734NPQNR.cjs.map} +1 -1
  76. package/dist/{chunk-SB4M3ITT.cjs → chunk-7VUJGHMY.cjs} +444 -100
  77. package/dist/chunk-7VUJGHMY.cjs.map +1 -0
  78. package/dist/chunk-AFQTQC7A.cjs +35 -0
  79. package/dist/chunk-AFQTQC7A.cjs.map +1 -0
  80. package/dist/{chunk-XKVPSOKP.cjs → chunk-AY6EZSZB.cjs} +4 -4
  81. package/dist/{chunk-XKVPSOKP.cjs.map → chunk-AY6EZSZB.cjs.map} +1 -1
  82. package/dist/{chunk-TT4IF52H.cjs → chunk-BVAT4EVC.cjs} +40 -41
  83. package/dist/chunk-BVAT4EVC.cjs.map +1 -0
  84. package/dist/{chunk-VGCTYTEW.cjs → chunk-C2OICDMI.cjs} +10 -10
  85. package/dist/{chunk-VGCTYTEW.cjs.map → chunk-C2OICDMI.cjs.map} +1 -1
  86. package/dist/{chunk-CPR6EHG7.cjs → chunk-DR2AH7JL.cjs} +179 -55
  87. package/dist/chunk-DR2AH7JL.cjs.map +1 -0
  88. package/dist/{chunk-NJCK6V6U.cjs → chunk-EATIFPKP.cjs} +4 -60
  89. package/dist/chunk-EATIFPKP.cjs.map +1 -0
  90. package/dist/{chunk-B3LZITVF.cjs → chunk-EHP6OH5D.cjs} +11 -451
  91. package/dist/chunk-EHP6OH5D.cjs.map +1 -0
  92. package/dist/{chunk-DDIW4HLU.cjs → chunk-ENGL7P3I.cjs} +46 -37
  93. package/dist/chunk-ENGL7P3I.cjs.map +1 -0
  94. package/dist/{chunk-QHOHDNBU.cjs → chunk-FKFQCK3C.cjs} +4 -4
  95. package/dist/{chunk-QHOHDNBU.cjs.map → chunk-FKFQCK3C.cjs.map} +1 -1
  96. package/dist/{chunk-6UTKM5AB.cjs → chunk-GKVE5JGB.cjs} +76 -76
  97. package/dist/chunk-GKVE5JGB.cjs.map +1 -0
  98. package/dist/{chunk-B2HNNG25.cjs → chunk-GPX5VC57.cjs} +50 -50
  99. package/dist/{chunk-B2HNNG25.cjs.map → chunk-GPX5VC57.cjs.map} +1 -1
  100. package/dist/{chunk-WAV762GP.cjs → chunk-GQXPNIRE.cjs} +6 -6
  101. package/dist/{chunk-WAV762GP.cjs.map → chunk-GQXPNIRE.cjs.map} +1 -1
  102. package/dist/chunk-GX2EBMJW.cjs +133 -0
  103. package/dist/chunk-GX2EBMJW.cjs.map +1 -0
  104. package/dist/{chunk-7OPOPYV6.cjs → chunk-H5OLHP2U.cjs} +3 -3
  105. package/dist/{chunk-7OPOPYV6.cjs.map → chunk-H5OLHP2U.cjs.map} +1 -1
  106. package/dist/chunk-HYUKPHCT.cjs +66 -0
  107. package/dist/chunk-HYUKPHCT.cjs.map +1 -0
  108. package/dist/{chunk-NNUK5ZM7.cjs → chunk-JQLWKNJO.cjs} +29 -27
  109. package/dist/chunk-JQLWKNJO.cjs.map +1 -0
  110. package/dist/{chunk-OEREKAAP.cjs → chunk-JZEYHDWJ.cjs} +75 -75
  111. package/dist/{chunk-OEREKAAP.cjs.map → chunk-JZEYHDWJ.cjs.map} +1 -1
  112. package/dist/{chunk-PGJYD67F.cjs → chunk-KNGZZC4O.cjs} +7 -6
  113. package/dist/chunk-KNGZZC4O.cjs.map +1 -0
  114. package/dist/{chunk-NIE3N6OM.cjs → chunk-KP5AITQ4.cjs} +10 -10
  115. package/dist/{chunk-NIE3N6OM.cjs.map → chunk-KP5AITQ4.cjs.map} +1 -1
  116. package/dist/{chunk-YYPZOEED.cjs → chunk-LHWOKOMP.cjs} +23 -2
  117. package/dist/chunk-LHWOKOMP.cjs.map +1 -0
  118. package/dist/{chunk-57NHXEU2.cjs → chunk-MXBXZXXQ.cjs} +5 -5
  119. package/dist/{chunk-57NHXEU2.cjs.map → chunk-MXBXZXXQ.cjs.map} +1 -1
  120. package/dist/{chunk-WXUU3COI.cjs → chunk-MZ2KZXNU.cjs} +3 -3
  121. package/dist/{chunk-WXUU3COI.cjs.map → chunk-MZ2KZXNU.cjs.map} +1 -1
  122. package/dist/chunk-NAJN32MF.cjs +154 -0
  123. package/dist/chunk-NAJN32MF.cjs.map +1 -0
  124. package/dist/{chunk-557MJ4IH.cjs → chunk-NLOETJCB.cjs} +17 -154
  125. package/dist/chunk-NLOETJCB.cjs.map +1 -0
  126. package/dist/{chunk-4XJEHKVZ.cjs → chunk-PIYYBPHH.cjs} +4 -4
  127. package/dist/{chunk-4XJEHKVZ.cjs.map → chunk-PIYYBPHH.cjs.map} +1 -1
  128. package/dist/chunk-Q3XJUXID.cjs +4774 -0
  129. package/dist/chunk-Q3XJUXID.cjs.map +1 -0
  130. package/dist/{chunk-325GVZE6.cjs → chunk-Q6DQGGP4.cjs} +3 -3
  131. package/dist/{chunk-325GVZE6.cjs.map → chunk-Q6DQGGP4.cjs.map} +1 -1
  132. package/dist/chunk-QFXILJMJ.cjs +458 -0
  133. package/dist/chunk-QFXILJMJ.cjs.map +1 -0
  134. package/dist/{chunk-R7CJEIA5.cjs → chunk-RYVZDFVO.cjs} +8 -9
  135. package/dist/chunk-RYVZDFVO.cjs.map +1 -0
  136. package/dist/{chunk-VLCY46K6.cjs → chunk-TG2GM7WJ.cjs} +4 -3
  137. package/dist/chunk-TG2GM7WJ.cjs.map +1 -0
  138. package/dist/{chunk-EOG6OT5I.cjs → chunk-TXP2N3DC.cjs} +4 -4
  139. package/dist/{chunk-EOG6OT5I.cjs.map → chunk-TXP2N3DC.cjs.map} +1 -1
  140. package/dist/{chunk-KXIRVKCJ.cjs → chunk-UUENH4BJ.cjs} +3 -3
  141. package/dist/{chunk-KXIRVKCJ.cjs.map → chunk-UUENH4BJ.cjs.map} +1 -1
  142. package/dist/chunk-VJ5ZLRBD.cjs +27 -0
  143. package/dist/chunk-VJ5ZLRBD.cjs.map +1 -0
  144. package/dist/{chunk-P77YTTJ3.cjs → chunk-W6B3RYTX.cjs} +4 -4
  145. package/dist/{chunk-P77YTTJ3.cjs.map → chunk-W6B3RYTX.cjs.map} +1 -1
  146. package/dist/chunk-WOOOMTTA.cjs +19 -0
  147. package/dist/chunk-WOOOMTTA.cjs.map +1 -0
  148. package/dist/{chunk-ZPPMAL5P.cjs → chunk-WQMR3O2D.cjs} +6 -10
  149. package/dist/chunk-WQMR3O2D.cjs.map +1 -0
  150. package/dist/{chunk-CJYWHUZR.cjs → chunk-XCKHOXRP.cjs} +4 -4
  151. package/dist/{chunk-CJYWHUZR.cjs.map → chunk-XCKHOXRP.cjs.map} +1 -1
  152. package/dist/{chunk-6WMMZLEV.cjs → chunk-XJEXFEWG.cjs} +2 -27
  153. package/dist/chunk-XJEXFEWG.cjs.map +1 -0
  154. package/dist/chunk-XK4TVJKD.cjs +73 -0
  155. package/dist/chunk-XK4TVJKD.cjs.map +1 -0
  156. package/dist/chunk-XTR26TNE.cjs +1358 -0
  157. package/dist/chunk-XTR26TNE.cjs.map +1 -0
  158. package/dist/{chunk-E7TE2WVT.cjs → chunk-ZVEW3JBT.cjs} +3 -3
  159. package/dist/{chunk-E7TE2WVT.cjs.map → chunk-ZVEW3JBT.cjs.map} +1 -1
  160. package/dist/collaboration/index.cjs +73 -73
  161. package/dist/collaboration/sharing/ShareControl.js +10 -2
  162. package/dist/collaboration/sharing/ShareControl.js.map +2 -2
  163. package/dist/components/SharedCell.d.ts +2 -4
  164. package/dist/components/SharedCell.js +4 -8
  165. package/dist/components/SharedCell.js.map +2 -2
  166. package/dist/components/ZoomSlider.d.ts +25 -0
  167. package/dist/components/ZoomSlider.js +59 -0
  168. package/dist/components/ZoomSlider.js.map +7 -0
  169. package/dist/connect/docx.cjs +20 -20
  170. package/dist/connect/index.cjs +1210 -1264
  171. package/dist/connect/index.cjs.map +1 -1
  172. package/dist/connect/viewer.cjs +42 -36
  173. package/dist/connection/ai.d.ts +1 -1
  174. package/dist/connection/facts/factPageColumns.js +3 -9
  175. package/dist/connection/facts/factPageColumns.js.map +2 -2
  176. package/dist/connection/files/ConnectedNewFileMenu.d.ts +2 -1
  177. package/dist/connection/files/ConnectedNewFileMenu.js +9 -3
  178. package/dist/connection/files/ConnectedNewFileMenu.js.map +2 -2
  179. package/dist/connection/files/explorer/ConnectedFilesExplorer.js +1 -1
  180. package/dist/connection/files/explorer/ConnectedFilesExplorer.js.map +2 -2
  181. package/dist/connection/files/explorer/FileTiles.js +1 -1
  182. package/dist/connection/files/explorer/FileTiles.js.map +2 -2
  183. package/dist/connection/files/fields/documentField.js +1 -1
  184. package/dist/connection/files/fields/documentField.js.map +2 -2
  185. package/dist/connection/files/grid/cells.js +1 -3
  186. package/dist/connection/files/grid/cells.js.map +2 -2
  187. package/dist/connection/files/grid/documentColumns.js +4 -3
  188. package/dist/connection/files/grid/documentColumns.js.map +2 -2
  189. package/dist/connection/files/page/DocumentsFilterBarActions.js +17 -28
  190. package/dist/connection/files/page/DocumentsFilterBarActions.js.map +2 -2
  191. package/dist/connection/mail/useMailboxDefaults.js +1 -1
  192. package/dist/connection/mail/useMailboxDefaults.js.map +2 -2
  193. package/dist/connection/panels/useSessionPanelMode.js +3 -2
  194. package/dist/connection/panels/useSessionPanelMode.js.map +2 -2
  195. package/dist/connection/presentation/ClippingMediaViewer.d.ts +12 -0
  196. package/dist/connection/presentation/ClippingMediaViewer.js +153 -0
  197. package/dist/connection/presentation/ClippingMediaViewer.js.map +7 -0
  198. package/dist/connection/presentation/ClippingPdfViewer.d.ts +22 -0
  199. package/dist/connection/presentation/ClippingPdfViewer.js +75 -0
  200. package/dist/connection/presentation/ClippingPdfViewer.js.map +7 -0
  201. package/dist/connection/presentation/ConnectedPresentation.d.ts +12 -0
  202. package/dist/connection/presentation/ConnectedPresentation.js +100 -0
  203. package/dist/connection/presentation/ConnectedPresentation.js.map +7 -0
  204. package/dist/connection/presentation/ConnectedSlidesTab.d.ts +20 -0
  205. package/dist/connection/presentation/ConnectedSlidesTab.js +220 -0
  206. package/dist/connection/presentation/ConnectedSlidesTab.js.map +7 -0
  207. package/dist/connection/presentation/CropClipDialog.d.ts +11 -0
  208. package/dist/connection/presentation/CropClipDialog.js +86 -0
  209. package/dist/connection/presentation/CropClipDialog.js.map +7 -0
  210. package/dist/connection/presentation/GenerateTile.d.ts +4 -0
  211. package/dist/connection/presentation/GenerateTile.js +24 -0
  212. package/dist/connection/presentation/GenerateTile.js.map +7 -0
  213. package/dist/connection/presentation/LabelColumnMenu.d.ts +8 -0
  214. package/dist/connection/presentation/LabelColumnMenu.js +38 -0
  215. package/dist/connection/presentation/LabelColumnMenu.js.map +7 -0
  216. package/dist/connection/presentation/PresentationDialogs.d.ts +39 -0
  217. package/dist/connection/presentation/PresentationDialogs.js +295 -0
  218. package/dist/connection/presentation/PresentationDialogs.js.map +7 -0
  219. package/dist/connection/presentation/PresentationFileCard.d.ts +10 -0
  220. package/dist/connection/presentation/PresentationFileCard.js +35 -0
  221. package/dist/connection/presentation/PresentationFileCard.js.map +7 -0
  222. package/dist/connection/presentation/PresentationPill.d.ts +8 -0
  223. package/dist/connection/presentation/PresentationPill.js +44 -0
  224. package/dist/connection/presentation/PresentationPill.js.map +7 -0
  225. package/dist/connection/presentation/PresentationSlot.d.ts +7 -0
  226. package/dist/connection/presentation/PresentationSlot.js +35 -0
  227. package/dist/connection/presentation/PresentationSlot.js.map +7 -0
  228. package/dist/connection/presentation/requests.d.ts +16 -0
  229. package/dist/connection/presentation/requests.js +20 -0
  230. package/dist/connection/presentation/requests.js.map +7 -0
  231. package/dist/connection/presentation/useImageGeneration.d.ts +11 -0
  232. package/dist/connection/presentation/useImageGeneration.js +66 -0
  233. package/dist/connection/presentation/useImageGeneration.js.map +7 -0
  234. package/dist/connection/presentation/useLabelColumns.d.ts +15 -0
  235. package/dist/connection/presentation/useLabelColumns.js +33 -0
  236. package/dist/connection/presentation/useLabelColumns.js.map +7 -0
  237. package/dist/connection/presentation/usePresentationController.d.ts +15 -0
  238. package/dist/connection/presentation/usePresentationController.js +118 -0
  239. package/dist/connection/presentation/usePresentationController.js.map +7 -0
  240. package/dist/connection/presentation/usePresentationFiles.d.ts +44 -0
  241. package/dist/connection/presentation/usePresentationFiles.js +307 -0
  242. package/dist/connection/presentation/usePresentationFiles.js.map +7 -0
  243. package/dist/connection/presentation/useViewerClipping.d.ts +14 -0
  244. package/dist/connection/presentation/useViewerClipping.js +18 -0
  245. package/dist/connection/presentation/useViewerClipping.js.map +7 -0
  246. package/dist/connection/sharing/WorkspaceMembersList.d.ts +4 -0
  247. package/dist/connection/sharing/WorkspaceMembersList.js +34 -0
  248. package/dist/connection/sharing/WorkspaceMembersList.js.map +7 -0
  249. package/dist/connection/shell/ConnectedAppShell.js +9 -1
  250. package/dist/connection/shell/ConnectedAppShell.js.map +2 -2
  251. package/dist/connection/viewer/CleanViewControl.d.ts +8 -0
  252. package/dist/connection/viewer/CleanViewControl.js +76 -0
  253. package/dist/connection/viewer/CleanViewControl.js.map +7 -0
  254. package/dist/connection/viewer/ConnectedDocumentViewer.js +31 -31
  255. package/dist/connection/viewer/ConnectedDocumentViewer.js.map +2 -2
  256. package/dist/connection/viewer/ViewerCropModal.d.ts +5 -0
  257. package/dist/connection/viewer/ViewerCropModal.js +22 -0
  258. package/dist/connection/viewer/ViewerCropModal.js.map +7 -0
  259. package/dist/connection/viewer/ViewerPdfPane.d.ts +3 -1
  260. package/dist/connection/viewer/ViewerPdfPane.js +57 -2
  261. package/dist/connection/viewer/ViewerPdfPane.js.map +2 -2
  262. package/dist/connection/viewer/drafts.js +6 -4
  263. package/dist/connection/viewer/drafts.js.map +2 -2
  264. package/dist/connection/viewer/pdf/PdfPassageHighlights.d.ts +12 -0
  265. package/dist/connection/viewer/pdf/PdfPassageHighlights.js +36 -0
  266. package/dist/connection/viewer/pdf/PdfPassageHighlights.js.map +7 -0
  267. package/dist/connection/viewer/pdf/passageHighlights.d.ts +26 -0
  268. package/dist/connection/viewer/pdf/passageHighlights.js +40 -0
  269. package/dist/connection/viewer/pdf/passageHighlights.js.map +7 -0
  270. package/dist/connection/viewer/pdf/usePdfPassageHighlights.d.ts +9 -0
  271. package/dist/connection/viewer/pdf/usePdfPassageHighlights.js +47 -0
  272. package/dist/connection/viewer/pdf/usePdfPassageHighlights.js.map +7 -0
  273. package/dist/connection/viewer/shareDocument.d.ts +11 -0
  274. package/dist/connection/viewer/shareDocument.js +11 -0
  275. package/dist/connection/viewer/shareDocument.js.map +7 -0
  276. package/dist/connection/viewer/slidesTabChunk.d.ts +2 -0
  277. package/dist/connection/viewer/slidesTabChunk.js +9 -0
  278. package/dist/connection/viewer/slidesTabChunk.js.map +7 -0
  279. package/dist/connection/viewer/useCleanView.d.ts +14 -0
  280. package/dist/connection/viewer/useCleanView.js +29 -0
  281. package/dist/connection/viewer/useCleanView.js.map +7 -0
  282. package/dist/connection/viewer/useViewedDocument.d.ts +1 -0
  283. package/dist/connection/viewer/useViewedDocument.js +9 -1
  284. package/dist/connection/viewer/useViewedDocument.js.map +2 -2
  285. package/dist/connection/viewer/useViewerTabs.js +18 -4
  286. package/dist/connection/viewer/useViewerTabs.js.map +2 -2
  287. package/dist/connection/workflows/ConnectedWorkflowStart.d.ts +14 -2
  288. package/dist/connection/workflows/ConnectedWorkflowStart.js +5 -2
  289. package/dist/connection/workflows/ConnectedWorkflowStart.js.map +2 -2
  290. package/dist/connection/workflows/workflowsPageLabels.js +1 -1
  291. package/dist/connection/workflows/workflowsPageLabels.js.map +1 -1
  292. package/dist/dashboards/index.cjs +1 -1
  293. package/dist/databases/index.cjs +49 -49
  294. package/dist/document-tools/DocumentToolButtons.d.ts +2 -0
  295. package/dist/document-tools/DocumentToolButtons.js +22 -1
  296. package/dist/document-tools/DocumentToolButtons.js.map +2 -2
  297. package/dist/document-tools/index.cjs +16 -12
  298. package/dist/document-tools/index.d.ts +1 -1
  299. package/dist/document-tools/index.js +2 -0
  300. package/dist/document-tools/index.js.map +2 -2
  301. package/dist/embed/index.cjs +43 -41
  302. package/dist/facts/factColumns.js +3 -3
  303. package/dist/facts/factColumns.js.map +1 -1
  304. package/dist/facts/index.cjs +42 -42
  305. package/dist/files/GridViewImpl.js +1 -1
  306. package/dist/files/GridViewImpl.js.map +2 -2
  307. package/dist/files/HtmlViewerParts.js +7 -15
  308. package/dist/files/HtmlViewerParts.js.map +2 -2
  309. package/dist/files/ViewerChrome.d.ts +5 -1
  310. package/dist/files/ViewerChrome.js +16 -6
  311. package/dist/files/ViewerChrome.js.map +2 -2
  312. package/dist/files/index.cjs +226 -226
  313. package/dist/files/navigator/DocumentSearchList.js +1 -1
  314. package/dist/files/navigator/DocumentSearchList.js.map +2 -2
  315. package/dist/index.cjs +1668 -1666
  316. package/dist/index.cjs.map +1 -1
  317. package/dist/presentation/BoxActionBar.d.ts +11 -0
  318. package/dist/presentation/BoxActionBar.js +182 -0
  319. package/dist/presentation/BoxActionBar.js.map +7 -0
  320. package/dist/presentation/ClipActionBar.d.ts +26 -0
  321. package/dist/presentation/ClipActionBar.js +103 -0
  322. package/dist/presentation/ClipActionBar.js.map +7 -0
  323. package/dist/presentation/ClipCaptureOverlay.d.ts +14 -0
  324. package/dist/presentation/ClipCaptureOverlay.js +69 -0
  325. package/dist/presentation/ClipCaptureOverlay.js.map +7 -0
  326. package/dist/presentation/ClipImage.d.ts +21 -0
  327. package/dist/presentation/ClipImage.js +119 -0
  328. package/dist/presentation/ClipImage.js.map +7 -0
  329. package/dist/presentation/ClipTray.d.ts +11 -0
  330. package/dist/presentation/ClipTray.js +152 -0
  331. package/dist/presentation/ClipTray.js.map +7 -0
  332. package/dist/presentation/ClipViewControls.d.ts +11 -0
  333. package/dist/presentation/ClipViewControls.js +142 -0
  334. package/dist/presentation/ClipViewControls.js.map +7 -0
  335. package/dist/presentation/DesignMenu.d.ts +8 -0
  336. package/dist/presentation/DesignMenu.js +199 -0
  337. package/dist/presentation/DesignMenu.js.map +7 -0
  338. package/dist/presentation/LayoutMenu.d.ts +17 -0
  339. package/dist/presentation/LayoutMenu.js +122 -0
  340. package/dist/presentation/LayoutMenu.js.map +7 -0
  341. package/dist/presentation/MediaClip.d.ts +15 -0
  342. package/dist/presentation/MediaClip.js +67 -0
  343. package/dist/presentation/MediaClip.js.map +7 -0
  344. package/dist/presentation/Notice.d.ts +6 -0
  345. package/dist/presentation/Notice.js +43 -0
  346. package/dist/presentation/Notice.js.map +7 -0
  347. package/dist/presentation/PresentationStage.d.ts +32 -0
  348. package/dist/presentation/PresentationStage.js +232 -0
  349. package/dist/presentation/PresentationStage.js.map +7 -0
  350. package/dist/presentation/PresenterView.d.ts +16 -0
  351. package/dist/presentation/PresenterView.js +69 -0
  352. package/dist/presentation/PresenterView.js.map +7 -0
  353. package/dist/presentation/SlideDecor.d.ts +25 -0
  354. package/dist/presentation/SlideDecor.js +189 -0
  355. package/dist/presentation/SlideDecor.js.map +7 -0
  356. package/dist/presentation/SlidesEditor.d.ts +25 -0
  357. package/dist/presentation/SlidesEditor.js +359 -0
  358. package/dist/presentation/SlidesEditor.js.map +7 -0
  359. package/dist/presentation/StageBox.d.ts +30 -0
  360. package/dist/presentation/StageBox.js +281 -0
  361. package/dist/presentation/StageBox.js.map +7 -0
  362. package/dist/presentation/StageItem.d.ts +37 -0
  363. package/dist/presentation/StageItem.js +211 -0
  364. package/dist/presentation/StageItem.js.map +7 -0
  365. package/dist/presentation/box-style.d.ts +6 -0
  366. package/dist/presentation/box-style.js +19 -0
  367. package/dist/presentation/box-style.js.map +7 -0
  368. package/dist/presentation/boxes.d.ts +105 -0
  369. package/dist/presentation/boxes.js +103 -0
  370. package/dist/presentation/boxes.js.map +7 -0
  371. package/dist/presentation/draw-boxes.d.ts +8 -0
  372. package/dist/presentation/draw-boxes.js +130 -0
  373. package/dist/presentation/draw-boxes.js.map +7 -0
  374. package/dist/presentation/export-boxes.d.ts +10 -0
  375. package/dist/presentation/export-boxes.js +74 -0
  376. package/dist/presentation/export-boxes.js.map +7 -0
  377. package/dist/presentation/export-pptx.d.ts +16 -0
  378. package/dist/presentation/export-pptx.js +194 -0
  379. package/dist/presentation/export-pptx.js.map +7 -0
  380. package/dist/presentation/import-pptx.d.ts +35 -0
  381. package/dist/presentation/import-pptx.js +659 -0
  382. package/dist/presentation/import-pptx.js.map +7 -0
  383. package/dist/presentation/merge-outside-edits.d.ts +12 -0
  384. package/dist/presentation/merge-outside-edits.js +35 -0
  385. package/dist/presentation/merge-outside-edits.js.map +7 -0
  386. package/dist/presentation/model.d.ts +201 -0
  387. package/dist/presentation/model.js +271 -0
  388. package/dist/presentation/model.js.map +7 -0
  389. package/dist/presentation/panel-id.d.ts +34 -0
  390. package/dist/presentation/panel-id.js +24 -0
  391. package/dist/presentation/panel-id.js.map +7 -0
  392. package/dist/presentation/persistence.d.ts +121 -0
  393. package/dist/presentation/persistence.js +141 -0
  394. package/dist/presentation/persistence.js.map +7 -0
  395. package/dist/presentation/pptx-data.d.ts +22 -0
  396. package/dist/presentation/pptx-data.js +83 -0
  397. package/dist/presentation/pptx-data.js.map +7 -0
  398. package/dist/presentation/pptx-xml.d.ts +90 -0
  399. package/dist/presentation/pptx-xml.js +333 -0
  400. package/dist/presentation/pptx-xml.js.map +7 -0
  401. package/dist/presentation/render-slides.d.ts +58 -0
  402. package/dist/presentation/render-slides.js +309 -0
  403. package/dist/presentation/render-slides.js.map +7 -0
  404. package/dist/presentation/saved-boxes.d.ts +11 -0
  405. package/dist/presentation/saved-boxes.js +80 -0
  406. package/dist/presentation/saved-boxes.js.map +7 -0
  407. package/dist/presentation/slide-layout.d.ts +54 -0
  408. package/dist/presentation/slide-layout.js +117 -0
  409. package/dist/presentation/slide-layout.js.map +7 -0
  410. package/dist/presentation/stage-videos.d.ts +5 -0
  411. package/dist/presentation/stage-videos.js +19 -0
  412. package/dist/presentation/stage-videos.js.map +7 -0
  413. package/dist/presentation/store.d.ts +203 -0
  414. package/dist/presentation/store.js +429 -0
  415. package/dist/presentation/store.js.map +7 -0
  416. package/dist/presentation/theme.d.ts +102 -0
  417. package/dist/presentation/theme.js +276 -0
  418. package/dist/presentation/theme.js.map +7 -0
  419. package/dist/presentation/useClipDrag.d.ts +26 -0
  420. package/dist/presentation/useClipDrag.js +65 -0
  421. package/dist/presentation/useClipDrag.js.map +7 -0
  422. package/dist/presentation/useObjectUrl.d.ts +6 -0
  423. package/dist/presentation/useObjectUrl.js +15 -0
  424. package/dist/presentation/useObjectUrl.js.map +7 -0
  425. package/dist/presentation/usePresenterKeys.d.ts +13 -0
  426. package/dist/presentation/usePresenterKeys.js +62 -0
  427. package/dist/presentation/usePresenterKeys.js.map +7 -0
  428. package/dist/settings/index.cjs +151 -150
  429. package/dist/shell/PanelPortal.js +1 -0
  430. package/dist/shell/PanelPortal.js.map +2 -2
  431. package/dist/shell/index.cjs +112 -110
  432. package/dist/shell/panel-windows.d.ts +2 -0
  433. package/dist/shell/panel-windows.js +7 -2
  434. package/dist/shell/panel-windows.js.map +2 -2
  435. package/dist/studio/index.cjs +28 -26
  436. package/dist/studio/index.cjs.map +1 -1
  437. package/dist/styles.css +1 -1
  438. package/dist/workflow-canvas/index.cjs +58 -57
  439. package/dist/workflow-canvas/index.cjs.map +1 -1
  440. package/node_modules/@arbidocs/coedit/package.json +1 -1
  441. package/package.json +6 -5
  442. package/dist/ConnectedCallDock-WER7R222.cjs.map +0 -1
  443. package/dist/DocumentReviewCard-ZSBZBGFK.cjs.map +0 -1
  444. package/dist/FilesViewerDialog-6UKR5WEF.cjs.map +0 -1
  445. package/dist/GridViewImpl-ZMJJWTOM.cjs.map +0 -1
  446. package/dist/WorkspaceTableView-J3C6VH4T.cjs.map +0 -1
  447. package/dist/ai-IM4A23YT.cjs.map +0 -1
  448. package/dist/chunk-557MJ4IH.cjs.map +0 -1
  449. package/dist/chunk-6UTKM5AB.cjs.map +0 -1
  450. package/dist/chunk-6WMMZLEV.cjs.map +0 -1
  451. package/dist/chunk-B3LZITVF.cjs.map +0 -1
  452. package/dist/chunk-CPG7II4E.cjs.map +0 -1
  453. package/dist/chunk-CPR6EHG7.cjs.map +0 -1
  454. package/dist/chunk-DDIW4HLU.cjs.map +0 -1
  455. package/dist/chunk-NJCK6V6U.cjs.map +0 -1
  456. package/dist/chunk-NNUK5ZM7.cjs.map +0 -1
  457. package/dist/chunk-PGJYD67F.cjs.map +0 -1
  458. package/dist/chunk-R7CJEIA5.cjs.map +0 -1
  459. package/dist/chunk-SB4M3ITT.cjs.map +0 -1
  460. package/dist/chunk-TT4IF52H.cjs.map +0 -1
  461. package/dist/chunk-VLCY46K6.cjs.map +0 -1
  462. package/dist/chunk-YYPZOEED.cjs.map +0 -1
  463. package/dist/chunk-ZPPMAL5P.cjs.map +0 -1
@@ -0,0 +1,281 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import {
4
+ memo,
5
+ useRef,
6
+ useState
7
+ } from "react";
8
+ import { cn } from "@arbidocs/react/ui";
9
+ import {
10
+ DEFAULT_INSET,
11
+ DEFAULT_TEXT_SIZE,
12
+ boxText,
13
+ firstRun,
14
+ moveBox,
15
+ stretchBox
16
+ } from "./boxes.js";
17
+ import { STAGE_ASPECT } from "./model.js";
18
+ import { TEXT_COLORS } from "./theme.js";
19
+ import { cqw, runStyle } from "./box-style.js";
20
+ const HANDLES = [
21
+ { handle: "nw", left: "0%", top: "0%", cursor: "nwse-resize" },
22
+ { handle: "n", left: "50%", top: "0%", cursor: "ns-resize" },
23
+ { handle: "ne", left: "100%", top: "0%", cursor: "nesw-resize" },
24
+ { handle: "e", left: "100%", top: "50%", cursor: "ew-resize" },
25
+ { handle: "se", left: "100%", top: "100%", cursor: "nwse-resize" },
26
+ { handle: "s", left: "50%", top: "100%", cursor: "ns-resize" },
27
+ { handle: "sw", left: "0%", top: "100%", cursor: "nesw-resize" },
28
+ { handle: "w", left: "0%", top: "50%", cursor: "ew-resize" }
29
+ ];
30
+ const withAlpha = (hex, alpha = 1) => {
31
+ if (alpha >= 1) return hex;
32
+ const n = parseInt(hex.slice(1), 16);
33
+ return `rgba(${n >> 16 & 255}, ${n >> 8 & 255}, ${n & 255}, ${alpha})`;
34
+ };
35
+ function shapeStyle(box) {
36
+ const { frame } = box;
37
+ const line = box.line;
38
+ const shorter = Math.min(frame.w, frame.h * 1 / STAGE_ASPECT);
39
+ return {
40
+ background: box.fill && box.shape !== "line" ? withAlpha(box.fill, box.fillAlpha) : void 0,
41
+ border: line && box.shape !== "line" ? `${cqw(line.width)} ${line.dash ? "dashed" : "solid"} ${line.color}` : void 0,
42
+ borderRadius: box.shape === "ellipse" ? "50%" : box.shape === "roundRect" ? `${shorter * 16.67}cqw` : void 0
43
+ };
44
+ }
45
+ function Paragraphs({
46
+ paragraphs,
47
+ font
48
+ }) {
49
+ return /* @__PURE__ */ jsx(Fragment, { children: paragraphs.map((paragraph, index) => {
50
+ const first = paragraph.runs[0];
51
+ const size = first?.size ?? DEFAULT_TEXT_SIZE;
52
+ const indent = (paragraph.level ?? 0) * 0.5 * size;
53
+ const empty = !paragraph.runs.some((run) => run.text);
54
+ return /* @__PURE__ */ jsxs(
55
+ "div",
56
+ {
57
+ className: "whitespace-pre-wrap break-words",
58
+ style: {
59
+ textAlign: paragraph.align ?? "left",
60
+ lineHeight: 1.2,
61
+ paddingLeft: cqw(indent + (paragraph.bullet ? size * 0.9 : 0)),
62
+ textIndent: paragraph.bullet ? cqw(-size * 0.9) : void 0,
63
+ // An empty line keeps its height.
64
+ fontSize: cqw(size)
65
+ },
66
+ children: [
67
+ paragraph.bullet && /* @__PURE__ */ jsx(
68
+ "span",
69
+ {
70
+ style: {
71
+ ...runStyle(first ?? { text: "" }, font),
72
+ display: "inline-block",
73
+ width: cqw(size * 0.9),
74
+ textIndent: 0
75
+ },
76
+ children: "\u2022"
77
+ }
78
+ ),
79
+ empty ? "\u200B" : paragraph.runs.map((run, i) => /* @__PURE__ */ jsx("span", { style: runStyle(run, font), children: run.text }, i))
80
+ ]
81
+ },
82
+ index
83
+ );
84
+ }) });
85
+ }
86
+ const StageBox = memo(function StageBox2({
87
+ box,
88
+ font,
89
+ editable,
90
+ selected,
91
+ host
92
+ }) {
93
+ const element = useRef(null);
94
+ const gesture = useRef(null);
95
+ const [typing, setTyping] = useState(false);
96
+ const [dragging, setDragging] = useState(false);
97
+ const { frame } = box;
98
+ const view = () => element.current?.ownerDocument.defaultView ?? window;
99
+ const apply = () => {
100
+ const g = gesture.current;
101
+ const el = element.current;
102
+ if (!g || !el) return;
103
+ g.request = null;
104
+ if (!g.next) return;
105
+ if (g.handle === "move") {
106
+ el.style.translate = `${(g.next.x - g.frame.x) * g.stage.width}px ${(g.next.y - g.frame.y) * g.stage.height}px`;
107
+ } else {
108
+ el.style.left = `${g.next.x * 100}%`;
109
+ el.style.top = `${g.next.y * 100}%`;
110
+ el.style.width = `${g.next.w * 100}%`;
111
+ el.style.height = `${g.next.h * 100}%`;
112
+ }
113
+ };
114
+ const start = (event, handle) => {
115
+ if (!editable || typing || event.button !== 0) return;
116
+ const stage = host.stageBox();
117
+ if (!stage) return;
118
+ event.preventDefault();
119
+ event.stopPropagation();
120
+ host.select(box.id);
121
+ event.currentTarget.setPointerCapture(event.pointerId);
122
+ gesture.current = {
123
+ handle,
124
+ pointer: { x: event.clientX, y: event.clientY },
125
+ frame,
126
+ stage,
127
+ next: null,
128
+ request: null,
129
+ wasSelected: selected
130
+ };
131
+ };
132
+ const move = (event) => {
133
+ const g = gesture.current;
134
+ if (!g) return;
135
+ const dx = (event.clientX - g.pointer.x) / g.stage.width;
136
+ const dy = (event.clientY - g.pointer.y) / g.stage.height;
137
+ if (!g.next) setDragging(true);
138
+ g.next = g.handle === "move" ? moveBox(g.frame, dx, dy) : stretchBox(g.frame, g.handle, dx, dy);
139
+ g.request ??= view().requestAnimationFrame(apply);
140
+ };
141
+ const end = () => {
142
+ const g = gesture.current;
143
+ gesture.current = null;
144
+ if (!g) return;
145
+ if (g.request !== null) view().cancelAnimationFrame(g.request);
146
+ if (!g.next) {
147
+ if (g.wasSelected && g.handle === "move" && hasText) setTyping(true);
148
+ return;
149
+ }
150
+ const el = element.current;
151
+ if (el) {
152
+ el.style.translate = "";
153
+ el.style.left = `${g.frame.x * 100}%`;
154
+ el.style.top = `${g.frame.y * 100}%`;
155
+ el.style.width = `${g.frame.w * 100}%`;
156
+ el.style.height = `${g.frame.h * 100}%`;
157
+ }
158
+ setDragging(false);
159
+ host.commit(box.id, g.next);
160
+ };
161
+ const hasText = box.shape !== "line";
162
+ const inset = cqw(box.inset ?? DEFAULT_INSET);
163
+ const run = firstRun(box);
164
+ const transform = box.rotation ? `rotate(${box.rotation}deg)` : void 0;
165
+ return /* @__PURE__ */ jsxs(
166
+ "div",
167
+ {
168
+ ref: element,
169
+ className: cn(
170
+ "absolute",
171
+ editable ? "pointer-events-auto" : "pointer-events-none",
172
+ editable && !typing && "cursor-move touch-none",
173
+ editable && !selected && "hover:outline hover:outline-1 hover:outline-white/30",
174
+ selected && "outline outline-2 outline-offset-1 outline-primary"
175
+ ),
176
+ style: {
177
+ left: `${frame.x * 100}%`,
178
+ top: `${frame.y * 100}%`,
179
+ width: `${frame.w * 100}%`,
180
+ height: `${frame.h * 100}%`,
181
+ transform,
182
+ willChange: dragging ? "translate" : void 0
183
+ },
184
+ onPointerDown: (event) => start(event, "move"),
185
+ onPointerMove: move,
186
+ onPointerUp: end,
187
+ onPointerCancel: end,
188
+ onDoubleClick: () => editable && hasText && setTyping(true),
189
+ onKeyDown: (event) => {
190
+ if (selected && !typing && event.key === "Enter" && hasText) {
191
+ event.preventDefault();
192
+ setTyping(true);
193
+ }
194
+ },
195
+ tabIndex: editable ? 0 : void 0,
196
+ "data-testid": `stage-box-${box.id}`,
197
+ children: [
198
+ box.shape === "line" ? /* @__PURE__ */ jsx(
199
+ "svg",
200
+ {
201
+ className: "absolute inset-0 size-full overflow-visible",
202
+ preserveAspectRatio: "none",
203
+ "aria-hidden": true,
204
+ children: /* @__PURE__ */ jsx(
205
+ "line",
206
+ {
207
+ x1: "0%",
208
+ y1: box.flipV ? "100%" : "0%",
209
+ x2: "100%",
210
+ y2: box.flipV ? "0%" : "100%",
211
+ stroke: box.line?.color ?? TEXT_COLORS.body,
212
+ style: { strokeWidth: cqw(box.line?.width ?? 1) },
213
+ strokeDasharray: box.line?.dash ? "6 4" : void 0
214
+ }
215
+ )
216
+ }
217
+ ) : /* @__PURE__ */ jsx(
218
+ "div",
219
+ {
220
+ className: cn(
221
+ "absolute inset-0 box-border flex flex-col overflow-hidden",
222
+ box.anchor === "middle" && "justify-center",
223
+ box.anchor === "bottom" && "justify-end"
224
+ ),
225
+ style: { ...shapeStyle(box), padding: inset },
226
+ children: typing ? /* @__PURE__ */ jsx(
227
+ "textarea",
228
+ {
229
+ autoFocus: true,
230
+ defaultValue: boxText(box),
231
+ className: "pointer-events-auto w-full flex-1 resize-none bg-transparent p-0 outline-none",
232
+ style: {
233
+ ...runStyle(run ?? { text: "" }, font),
234
+ lineHeight: 1.2,
235
+ textAlign: box.paragraphs[0]?.align ?? "left"
236
+ },
237
+ onPointerDown: (event) => event.stopPropagation(),
238
+ onBlur: (event) => {
239
+ host.setText(box.id, event.currentTarget.value);
240
+ setTyping(false);
241
+ },
242
+ onKeyDown: (event) => {
243
+ event.stopPropagation();
244
+ if (event.key === "Escape") event.currentTarget.blur();
245
+ },
246
+ "aria-label": "Text",
247
+ "data-testid": "stage-box-text-input"
248
+ }
249
+ ) : boxText(box) || !editable ? /* @__PURE__ */ jsx(Paragraphs, { paragraphs: box.paragraphs, font }) : box.shape === "text" && /* @__PURE__ */ jsx(
250
+ "span",
251
+ {
252
+ className: "text-white/40",
253
+ style: { fontSize: cqw(run?.size ?? DEFAULT_TEXT_SIZE) },
254
+ children: "Double-click to type"
255
+ }
256
+ )
257
+ }
258
+ ),
259
+ selected && !typing && !dragging && HANDLES.filter(
260
+ ({ handle }) => box.shape !== "line" || handle === "e" || handle === "w" || handle === "n" || handle === "s"
261
+ ).map(({ handle, left, top, cursor }) => /* @__PURE__ */ jsx(
262
+ "div",
263
+ {
264
+ className: "absolute flex size-5 -translate-x-1/2 -translate-y-1/2 items-center justify-center pointer-coarse:size-11",
265
+ style: { left, top, cursor, touchAction: "none" },
266
+ onPointerDown: (event) => start(event, handle),
267
+ "aria-label": `Resize from ${handle}`,
268
+ "data-testid": `stage-box-resize-${handle}`,
269
+ children: /* @__PURE__ */ jsx("span", { className: "pointer-events-none size-2.5 rounded-full border-2 border-primary bg-background" })
270
+ },
271
+ handle
272
+ ))
273
+ ]
274
+ }
275
+ );
276
+ });
277
+ export {
278
+ Paragraphs,
279
+ StageBox
280
+ };
281
+ //# sourceMappingURL=StageBox.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/presentation/StageBox.tsx"],
4
+ "sourcesContent": ["/**\n * A text box or shape on the stage (`boxes`), drawn in CSS sized in container units so it scales\n * with the stage. In the editor it is selected with a click, moved by dragging it, resized from\n * its eight handles (its shape free), and typed in after a second click (a double click, or\n * Enter): the text is edited in place, in its own type.\n *\n * Like a clip, it moves on the GPU while dragged: a transform (or, resizing, its box) is set once\n * per animation frame and the new frame reaches the presentation when the drag ends.\n */\n\nimport {\n memo,\n useRef,\n useState,\n type CSSProperties,\n type PointerEvent as ReactPointerEvent,\n} from 'react'\nimport { cn } from '@arbidocs/react/ui'\nimport {\n DEFAULT_INSET,\n DEFAULT_TEXT_SIZE,\n boxText,\n firstRun,\n moveBox,\n stretchBox,\n type BoxFrame,\n type BoxHandle,\n type Paragraph,\n type SlideBox,\n} from './boxes'\nimport { STAGE_ASPECT } from './model'\nimport { TEXT_COLORS } from './theme'\nimport { cqw, runStyle } from './box-style'\n\nconst HANDLES: { handle: BoxHandle; left: string; top: string; cursor: string }[] = [\n { handle: 'nw', left: '0%', top: '0%', cursor: 'nwse-resize' },\n { handle: 'n', left: '50%', top: '0%', cursor: 'ns-resize' },\n { handle: 'ne', left: '100%', top: '0%', cursor: 'nesw-resize' },\n { handle: 'e', left: '100%', top: '50%', cursor: 'ew-resize' },\n { handle: 'se', left: '100%', top: '100%', cursor: 'nwse-resize' },\n { handle: 's', left: '50%', top: '100%', cursor: 'ns-resize' },\n { handle: 'sw', left: '0%', top: '100%', cursor: 'nesw-resize' },\n { handle: 'w', left: '0%', top: '50%', cursor: 'ew-resize' },\n]\n\nconst withAlpha = (hex: string, alpha = 1) => {\n if (alpha >= 1) return hex\n const n = parseInt(hex.slice(1), 16)\n return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${alpha})`\n}\n\n/** A box's shape and outline, as CSS. */\nfunction shapeStyle(box: SlideBox): CSSProperties {\n const { frame } = box\n const line = box.line\n // A rounded rectangle's corners: a sixth of its shorter side, as PowerPoint's default.\n const shorter = Math.min(frame.w, (frame.h * 1) / STAGE_ASPECT)\n return {\n background: box.fill && box.shape !== 'line' ? withAlpha(box.fill, box.fillAlpha) : undefined,\n border:\n line && box.shape !== 'line'\n ? `${cqw(line.width)} ${line.dash ? 'dashed' : 'solid'} ${line.color}`\n : undefined,\n borderRadius:\n box.shape === 'ellipse'\n ? '50%'\n : box.shape === 'roundRect'\n ? `${shorter * 16.67}cqw`\n : undefined,\n }\n}\n\nexport function Paragraphs({\n paragraphs,\n font,\n}: {\n paragraphs: readonly Paragraph[]\n font: string\n}) {\n return (\n <>\n {paragraphs.map((paragraph, index) => {\n const first = paragraph.runs[0]\n const size = first?.size ?? DEFAULT_TEXT_SIZE\n const indent = (paragraph.level ?? 0) * 0.5 * size\n const empty = !paragraph.runs.some((run) => run.text)\n return (\n <div\n key={index}\n className=\"whitespace-pre-wrap break-words\"\n style={{\n textAlign: paragraph.align ?? 'left',\n lineHeight: 1.2,\n paddingLeft: cqw(indent + (paragraph.bullet ? size * 0.9 : 0)),\n textIndent: paragraph.bullet ? cqw(-size * 0.9) : undefined,\n // An empty line keeps its height.\n fontSize: cqw(size),\n }}\n >\n {paragraph.bullet && (\n <span\n style={{\n ...runStyle(first ?? { text: '' }, font),\n display: 'inline-block',\n width: cqw(size * 0.9),\n textIndent: 0,\n }}\n >\n \u2022\n </span>\n )}\n {empty\n ? '\u200B'\n : paragraph.runs.map((run, i) => (\n <span key={i} style={runStyle(run, font)}>\n {run.text}\n </span>\n ))}\n </div>\n )\n })}\n </>\n )\n}\n\n/** What a stage gives its boxes (stable: the boxes are memoised). */\nexport interface StageBoxHost {\n stageBox(): DOMRect | null\n select(boxId: string): void\n commit(boxId: string, frame: BoxFrame): void\n setText(boxId: string, text: string): void\n}\n\nexport interface StageBoxProps {\n box: SlideBox\n /** The theme's typeface (CSS), for runs without one of their own. */\n font: string\n editable: boolean\n selected: boolean\n host: StageBoxHost\n}\n\ninterface Gesture {\n handle: BoxHandle | 'move'\n pointer: { x: number; y: number }\n frame: BoxFrame\n stage: DOMRect\n next: BoxFrame | null\n request: number | null\n /** The box was already selected: a click on it (no move) starts typing. */\n wasSelected: boolean\n}\n\nexport const StageBox = memo(function StageBox({\n box,\n font,\n editable,\n selected,\n host,\n}: StageBoxProps) {\n const element = useRef<HTMLDivElement>(null)\n const gesture = useRef<Gesture | null>(null)\n const [typing, setTyping] = useState(false)\n const [dragging, setDragging] = useState(false)\n const { frame } = box\n const view = () => element.current?.ownerDocument.defaultView ?? window\n\n const apply = () => {\n const g = gesture.current\n const el = element.current\n if (!g || !el) return\n g.request = null\n if (!g.next) return\n if (g.handle === 'move') {\n el.style.translate = `${(g.next.x - g.frame.x) * g.stage.width}px ${(g.next.y - g.frame.y) * g.stage.height}px`\n } else {\n el.style.left = `${g.next.x * 100}%`\n el.style.top = `${g.next.y * 100}%`\n el.style.width = `${g.next.w * 100}%`\n el.style.height = `${g.next.h * 100}%`\n }\n }\n\n const start = (event: ReactPointerEvent, handle: Gesture['handle']) => {\n if (!editable || typing || event.button !== 0) return\n const stage = host.stageBox()\n if (!stage) return\n event.preventDefault()\n event.stopPropagation()\n host.select(box.id)\n event.currentTarget.setPointerCapture(event.pointerId)\n gesture.current = {\n handle,\n pointer: { x: event.clientX, y: event.clientY },\n frame,\n stage,\n next: null,\n request: null,\n wasSelected: selected,\n }\n }\n\n const move = (event: ReactPointerEvent) => {\n const g = gesture.current\n if (!g) return\n const dx = (event.clientX - g.pointer.x) / g.stage.width\n const dy = (event.clientY - g.pointer.y) / g.stage.height\n if (!g.next) setDragging(true)\n g.next = g.handle === 'move' ? moveBox(g.frame, dx, dy) : stretchBox(g.frame, g.handle, dx, dy)\n g.request ??= view().requestAnimationFrame(apply)\n }\n\n const end = () => {\n const g = gesture.current\n gesture.current = null\n if (!g) return\n if (g.request !== null) view().cancelAnimationFrame(g.request)\n if (!g.next) {\n // A click: selected; on a box already selected, typing starts (as in PowerPoint).\n if (g.wasSelected && g.handle === 'move' && hasText) setTyping(true)\n return\n }\n const el = element.current\n if (el) {\n // Back to the frame React set (the committed one replaces it on the next render).\n el.style.translate = ''\n el.style.left = `${g.frame.x * 100}%`\n el.style.top = `${g.frame.y * 100}%`\n el.style.width = `${g.frame.w * 100}%`\n el.style.height = `${g.frame.h * 100}%`\n }\n setDragging(false)\n host.commit(box.id, g.next)\n }\n\n const hasText = box.shape !== 'line'\n const inset = cqw(box.inset ?? DEFAULT_INSET)\n const run = firstRun(box)\n const transform = box.rotation ? `rotate(${box.rotation}deg)` : undefined\n\n return (\n <div\n ref={element}\n className={cn(\n 'absolute',\n editable ? 'pointer-events-auto' : 'pointer-events-none',\n editable && !typing && 'cursor-move touch-none',\n editable && !selected && 'hover:outline hover:outline-1 hover:outline-white/30',\n selected && 'outline outline-2 outline-offset-1 outline-primary'\n )}\n style={{\n left: `${frame.x * 100}%`,\n top: `${frame.y * 100}%`,\n width: `${frame.w * 100}%`,\n height: `${frame.h * 100}%`,\n transform,\n willChange: dragging ? 'translate' : undefined,\n }}\n onPointerDown={(event) => start(event, 'move')}\n onPointerMove={move}\n onPointerUp={end}\n onPointerCancel={end}\n onDoubleClick={() => editable && hasText && setTyping(true)}\n onKeyDown={(event) => {\n if (selected && !typing && event.key === 'Enter' && hasText) {\n event.preventDefault()\n setTyping(true)\n }\n }}\n tabIndex={editable ? 0 : undefined}\n data-testid={`stage-box-${box.id}`}\n >\n {box.shape === 'line' ? (\n <svg\n className=\"absolute inset-0 size-full overflow-visible\"\n preserveAspectRatio=\"none\"\n aria-hidden\n >\n <line\n x1=\"0%\"\n y1={box.flipV ? '100%' : '0%'}\n x2=\"100%\"\n y2={box.flipV ? '0%' : '100%'}\n stroke={box.line?.color ?? TEXT_COLORS.body}\n style={{ strokeWidth: cqw(box.line?.width ?? 1) }}\n strokeDasharray={box.line?.dash ? '6 4' : undefined}\n />\n </svg>\n ) : (\n <div\n className={cn(\n 'absolute inset-0 box-border flex flex-col overflow-hidden',\n box.anchor === 'middle' && 'justify-center',\n box.anchor === 'bottom' && 'justify-end'\n )}\n style={{ ...shapeStyle(box), padding: inset }}\n >\n {typing ? (\n <textarea\n autoFocus\n defaultValue={boxText(box)}\n className=\"pointer-events-auto w-full flex-1 resize-none bg-transparent p-0 outline-none\"\n style={{\n ...runStyle(run ?? { text: '' }, font),\n lineHeight: 1.2,\n textAlign: box.paragraphs[0]?.align ?? 'left',\n }}\n onPointerDown={(event) => event.stopPropagation()}\n onBlur={(event) => {\n host.setText(box.id, event.currentTarget.value)\n setTyping(false)\n }}\n onKeyDown={(event) => {\n event.stopPropagation()\n if (event.key === 'Escape') event.currentTarget.blur()\n }}\n aria-label=\"Text\"\n data-testid=\"stage-box-text-input\"\n />\n ) : boxText(box) || !editable ? (\n <Paragraphs paragraphs={box.paragraphs} font={font} />\n ) : (\n box.shape === 'text' && (\n <span\n className=\"text-white/40\"\n style={{ fontSize: cqw(run?.size ?? DEFAULT_TEXT_SIZE) }}\n >\n Double-click to type\n </span>\n )\n )}\n </div>\n )}\n {selected &&\n !typing &&\n !dragging &&\n HANDLES.filter(\n ({ handle }) =>\n box.shape !== 'line' ||\n handle === 'e' ||\n handle === 'w' ||\n handle === 'n' ||\n handle === 's'\n ).map(({ handle, left, top, cursor }) => (\n <div\n key={handle}\n className=\"absolute flex size-5 -translate-x-1/2 -translate-y-1/2 items-center justify-center pointer-coarse:size-11\"\n style={{ left, top, cursor, touchAction: 'none' }}\n onPointerDown={(event) => start(event, handle)}\n aria-label={`Resize from ${handle}`}\n data-testid={`stage-box-resize-${handle}`}\n >\n <span className=\"pointer-events-none size-2.5 rounded-full border-2 border-primary bg-background\" />\n </div>\n ))}\n </div>\n )\n})\n"],
5
+ "mappings": ";AAgFI,mBAoBU,KAbJ,YAPN;AAtEJ;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,UAAU;AACnB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AACP,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,KAAK,gBAAgB;AAE9B,MAAM,UAA8E;AAAA,EAClF,EAAE,QAAQ,MAAM,MAAM,MAAM,KAAK,MAAM,QAAQ,cAAc;AAAA,EAC7D,EAAE,QAAQ,KAAK,MAAM,OAAO,KAAK,MAAM,QAAQ,YAAY;AAAA,EAC3D,EAAE,QAAQ,MAAM,MAAM,QAAQ,KAAK,MAAM,QAAQ,cAAc;AAAA,EAC/D,EAAE,QAAQ,KAAK,MAAM,QAAQ,KAAK,OAAO,QAAQ,YAAY;AAAA,EAC7D,EAAE,QAAQ,MAAM,MAAM,QAAQ,KAAK,QAAQ,QAAQ,cAAc;AAAA,EACjE,EAAE,QAAQ,KAAK,MAAM,OAAO,KAAK,QAAQ,QAAQ,YAAY;AAAA,EAC7D,EAAE,QAAQ,MAAM,MAAM,MAAM,KAAK,QAAQ,QAAQ,cAAc;AAAA,EAC/D,EAAE,QAAQ,KAAK,MAAM,MAAM,KAAK,OAAO,QAAQ,YAAY;AAC7D;AAEA,MAAM,YAAY,CAAC,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,sBAAI,MAAM,QAAQ,SAAU,OAAM,cAAc,KAAK;AAAA,gBACvD;AAAA,gBACA,cAAW;AAAA,gBACX,eAAY;AAAA;AAAA,YACd,IACE,QAAQ,GAAG,KAAK,CAAC,WACnB,oBAAC,cAAW,YAAY,IAAI,YAAY,MAAY,IAEpD,IAAI,UAAU,UACZ;AAAA,cAAC;AAAA;AAAA,gBACC,WAAU;AAAA,gBACV,OAAO,EAAE,UAAU,IAAI,KAAK,QAAQ,iBAAiB,EAAE;AAAA,gBACxD;AAAA;AAAA,YAED;AAAA;AAAA,QAGN;AAAA,QAED,YACC,CAAC,UACD,CAAC,YACD,QAAQ;AAAA,UACN,CAAC,EAAE,OAAO,MACR,IAAI,UAAU,UACd,WAAW,OACX,WAAW,OACX,WAAW,OACX,WAAW;AAAA,QACf,EAAE,IAAI,CAAC,EAAE,QAAQ,MAAM,KAAK,OAAO,MACjC;AAAA,UAAC;AAAA;AAAA,YAEC,WAAU;AAAA,YACV,OAAO,EAAE,MAAM,KAAK,QAAQ,aAAa,OAAO;AAAA,YAChD,eAAe,CAAC,UAAU,MAAM,OAAO,MAAM;AAAA,YAC7C,cAAY,eAAe,MAAM;AAAA,YACjC,eAAa,oBAAoB,MAAM;AAAA,YAEvC,8BAAC,UAAK,WAAU,mFAAkF;AAAA;AAAA,UAP7F;AAAA,QAQP,CACD;AAAA;AAAA;AAAA,EACL;AAEJ,CAAC;",
6
+ "names": ["StageBox"]
7
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * One clip on the stage, and its own gestures: moved by dragging it, resized from a corner (its
3
+ * shape kept), reshaped from a side's middle (more or less of the page that way), snapping to the
4
+ * stage and to the other clips.
5
+ *
6
+ * Built for smooth dragging: while a clip is moved or resized nothing re-renders and nothing is
7
+ * laid out again. Its element is moved by a GPU transform (translate, scale) once per animation
8
+ * frame, and the new frame reaches the presentation once, when the drag ends. Only reshaping, which
9
+ * changes what the clip shows, re-renders the clip itself (and nothing else). The component is
10
+ * memoised: other clips, the slide's text and the other slides are untouched by its drags.
11
+ */
12
+ import { type Clip, type Frame, type Guide, type Placed } from './model';
13
+ /** What a stage gives its clips (stable across renders: the clips are memoised). */
14
+ export interface StageItemHost {
15
+ /** The stage's box on screen, as a gesture begins. */
16
+ stageBox(): DOMRect | null;
17
+ /** The other clips of the slide, as a gesture begins: what this one snaps to. */
18
+ others(clipId: string): Placed[];
19
+ select(clipId: string): void;
20
+ /** The snap lines to draw while a clip is dragged (empty: none). */
21
+ guides(guides: Guide[]): void;
22
+ /** A drag is on (the stage hides the selected clip's floating actions meanwhile). */
23
+ dragging(on: boolean): void;
24
+ /** The drag's result, once it ends. */
25
+ commit(clipId: string, frame: Frame, shape?: Pick<Clip, 'rect' | 'aspect'>): void;
26
+ }
27
+ export interface StageItemProps {
28
+ clip: Clip;
29
+ frame: Frame;
30
+ editable: boolean;
31
+ selected: boolean;
32
+ dim: boolean;
33
+ /** Its source label, under it (empty: none). */
34
+ label: string;
35
+ host: StageItemHost;
36
+ }
37
+ export declare const StageItem: import("react").NamedExoticComponent<StageItemProps>;
@@ -0,0 +1,211 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { memo, useRef, useState } from "react";
4
+ import { cn } from "@arbidocs/react/ui";
5
+ import { ClipImage } from "./ClipImage.js";
6
+ import { ClipViewControls } from "./ClipViewControls.js";
7
+ import {
8
+ frameHeight,
9
+ moveFrame,
10
+ reshapeFrame,
11
+ resizeFrame
12
+ } from "./model.js";
13
+ import { TEXT_COLORS, clipEdgeCss } from "./theme.js";
14
+ const isEdge = (kind) => kind === "n" || kind === "e" || kind === "s" || kind === "w";
15
+ const EDGES = [
16
+ { edge: "n", left: "50%", top: "0%", cursor: "ns-resize", label: "top" },
17
+ { edge: "e", left: "100%", top: "50%", cursor: "ew-resize", label: "right" },
18
+ { edge: "s", left: "50%", top: "100%", cursor: "ns-resize", label: "bottom" },
19
+ { edge: "w", left: "0%", top: "50%", cursor: "ew-resize", label: "left" }
20
+ ];
21
+ const CORNERS = [
22
+ { corner: "nw", left: "0%", top: "0%", cursor: "nwse-resize" },
23
+ { corner: "ne", left: "100%", top: "0%", cursor: "nesw-resize" },
24
+ { corner: "sw", left: "0%", top: "100%", cursor: "nesw-resize" },
25
+ { corner: "se", left: "100%", top: "100%", cursor: "nwse-resize" }
26
+ ];
27
+ const EDGE_CSS = clipEdgeCss();
28
+ const StageItem = memo(function StageItem2({
29
+ clip,
30
+ frame,
31
+ editable,
32
+ selected,
33
+ dim,
34
+ label,
35
+ host
36
+ }) {
37
+ const element = useRef(null);
38
+ const gesture = useRef(null);
39
+ const [dragging, setDragging] = useState(false);
40
+ const [reshape, setReshape] = useState(null);
41
+ const shown = reshape ? { ...clip, ...reshape.shape } : clip;
42
+ const box = reshape?.frame ?? frame;
43
+ const view = () => element.current?.ownerDocument.defaultView ?? window;
44
+ const apply = () => {
45
+ const g = gesture.current;
46
+ const el = element.current;
47
+ if (!g) return;
48
+ g.request = null;
49
+ const next = g.next;
50
+ if (!next || !el) return;
51
+ if (next.shape) {
52
+ setReshape({ frame: next.frame, shape: next.shape });
53
+ } else {
54
+ const dx = (next.frame.x - g.frame.x) * g.stage.width;
55
+ const dy = (next.frame.y - g.frame.y) * g.stage.height;
56
+ const scale = next.frame.w / g.frame.w;
57
+ el.style.transform = `translate3d(${dx}px, ${dy}px, 0) scale(${scale})`;
58
+ }
59
+ const key = next.guides.map((guide) => `${guide.axis}${guide.at}`).join();
60
+ if (key !== g.guidesKey) {
61
+ g.guidesKey = key;
62
+ host.guides(next.guides);
63
+ }
64
+ };
65
+ const start = (event, kind) => {
66
+ if (!editable || event.button !== 0) return;
67
+ const stage = host.stageBox();
68
+ if (!stage) return;
69
+ event.preventDefault();
70
+ event.stopPropagation();
71
+ host.select(clip.id);
72
+ event.currentTarget.setPointerCapture(event.pointerId);
73
+ gesture.current = {
74
+ kind,
75
+ pointer: { x: event.clientX, y: event.clientY },
76
+ frame,
77
+ shape: { rect: clip.rect, aspect: clip.aspect },
78
+ stage,
79
+ others: host.others(clip.id),
80
+ next: null,
81
+ request: null,
82
+ guidesKey: ""
83
+ };
84
+ };
85
+ const move = (event) => {
86
+ const g = gesture.current;
87
+ if (!g) return;
88
+ if (!g.next) {
89
+ setDragging(true);
90
+ host.dragging(true);
91
+ if (element.current) element.current.style.willChange = "transform";
92
+ }
93
+ const dx = (event.clientX - g.pointer.x) / g.stage.width;
94
+ const dy = (event.clientY - g.pointer.y) / g.stage.height;
95
+ const free = event.altKey;
96
+ if (isEdge(g.kind)) {
97
+ const result = reshapeFrame(g.frame, g.shape, g.kind, dx, dy, g.others, free);
98
+ g.next = {
99
+ frame: result.frame,
100
+ shape: { rect: result.rect, aspect: result.aspect },
101
+ guides: result.guides
102
+ };
103
+ } else {
104
+ g.next = g.kind === "move" ? moveFrame(g.frame, g.shape.aspect, dx, dy, g.others, free) : resizeFrame(g.frame, g.shape.aspect, g.kind, dx, dy, g.others, free);
105
+ }
106
+ g.request ??= view().requestAnimationFrame(apply);
107
+ };
108
+ const end = () => {
109
+ const g = gesture.current;
110
+ gesture.current = null;
111
+ if (!g) return;
112
+ if (g.request !== null) view().cancelAnimationFrame(g.request);
113
+ const el = element.current;
114
+ if (el) {
115
+ el.style.transform = "";
116
+ el.style.willChange = "";
117
+ }
118
+ if (!g.next) return;
119
+ setReshape(null);
120
+ setDragging(false);
121
+ host.dragging(false);
122
+ host.guides([]);
123
+ host.commit(clip.id, g.next.frame, g.next.shape);
124
+ };
125
+ return /* @__PURE__ */ jsxs(
126
+ "div",
127
+ {
128
+ ref: element,
129
+ className: cn(
130
+ "absolute origin-top-left",
131
+ // Lifted off the background (a picture that is part of the slide's design is not).
132
+ !clip.plain && "rounded-[0.6cqw] shadow-[0_0.5cqw_1.6cqw_rgba(0,0,0,0.5)]",
133
+ editable && "cursor-move touch-none",
134
+ selected && "outline outline-2 outline-offset-2 outline-primary",
135
+ dim && "opacity-30"
136
+ ),
137
+ style: {
138
+ left: `${box.x * 100}%`,
139
+ top: `${box.y * 100}%`,
140
+ width: `${box.w * 100}%`,
141
+ height: `${frameHeight(box, shown.aspect) * 100}%`
142
+ },
143
+ onPointerDown: (event) => start(event, "move"),
144
+ onPointerMove: move,
145
+ onPointerUp: end,
146
+ onPointerCancel: end,
147
+ "data-testid": `stage-item-${clip.id}`,
148
+ children: [
149
+ /* @__PURE__ */ jsxs("div", { className: cn("absolute inset-0 overflow-hidden", !clip.plain && "rounded-[0.6cqw]"), children: [
150
+ /* @__PURE__ */ jsx(ClipImage, { clip: shown, live: !editable }),
151
+ clip.kind === "pdf" && !clip.plain && /* @__PURE__ */ jsx(
152
+ "div",
153
+ {
154
+ className: "pointer-events-none absolute inset-0",
155
+ style: { background: EDGE_CSS },
156
+ "data-testid": "stage-clip-edge"
157
+ }
158
+ ),
159
+ !clip.plain && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0 rounded-[0.6cqw] ring-1 ring-inset ring-white/15" })
160
+ ] }),
161
+ label && !clip.plain && // Under the clip, in the room the layout keeps (CAPTION_SPACE): never over it.
162
+ /* @__PURE__ */ jsx(
163
+ "div",
164
+ {
165
+ className: "pointer-events-none absolute left-0 top-full mt-[0.5cqw] max-w-full truncate text-[1.7cqw] leading-tight",
166
+ style: { color: TEXT_COLORS.muted },
167
+ children: label
168
+ }
169
+ ),
170
+ selected && !dragging && /* @__PURE__ */ jsx(ClipViewControls, { clip }),
171
+ selected && CORNERS.map(({ corner, left, top, cursor }) => /* @__PURE__ */ jsx(
172
+ "div",
173
+ {
174
+ className: "absolute flex size-6 -translate-x-1/2 -translate-y-1/2 items-center justify-center pointer-coarse:size-11",
175
+ style: { left, top, cursor, touchAction: "none" },
176
+ onPointerDown: (event) => start(event, corner),
177
+ "aria-label": `Resize from the ${corner} corner`,
178
+ "data-testid": `stage-item-resize-${corner}`,
179
+ children: /* @__PURE__ */ jsx("span", { className: "pointer-events-none size-3 rounded-full border-2 border-primary bg-background" })
180
+ },
181
+ corner
182
+ )),
183
+ selected && EDGES.map(({ edge, left, top, cursor, label: side }) => /* @__PURE__ */ jsx(
184
+ "div",
185
+ {
186
+ className: "absolute flex size-6 -translate-x-1/2 -translate-y-1/2 items-center justify-center pointer-coarse:size-11",
187
+ style: { left, top, cursor, touchAction: "none" },
188
+ onPointerDown: (event) => start(event, edge),
189
+ "aria-label": `Show more or less at the ${side}`,
190
+ title: "Drag to show more or less of the page",
191
+ "data-testid": `stage-item-reshape-${edge}`,
192
+ children: /* @__PURE__ */ jsx(
193
+ "span",
194
+ {
195
+ className: cn(
196
+ "pointer-events-none rounded-full border-2 border-primary bg-background",
197
+ edge === "n" || edge === "s" ? "h-2 w-4" : "h-4 w-2"
198
+ )
199
+ }
200
+ )
201
+ },
202
+ edge
203
+ ))
204
+ ]
205
+ }
206
+ );
207
+ });
208
+ export {
209
+ StageItem
210
+ };
211
+ //# sourceMappingURL=StageItem.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/presentation/StageItem.tsx"],
4
+ "sourcesContent": ["/**\n * One clip on the stage, and its own gestures: moved by dragging it, resized from a corner (its\n * shape kept), reshaped from a side's middle (more or less of the page that way), snapping to the\n * stage and to the other clips.\n *\n * Built for smooth dragging: while a clip is moved or resized nothing re-renders and nothing is\n * laid out again. Its element is moved by a GPU transform (translate, scale) once per animation\n * frame, and the new frame reaches the presentation once, when the drag ends. Only reshaping, which\n * changes what the clip shows, re-renders the clip itself (and nothing else). The component is\n * memoised: other clips, the slide's text and the other slides are untouched by its drags.\n */\n\nimport { memo, useRef, useState, type PointerEvent as ReactPointerEvent } from 'react'\nimport { cn } from '@arbidocs/react/ui'\nimport { ClipImage } from './ClipImage'\nimport { ClipViewControls } from './ClipViewControls'\nimport {\n frameHeight,\n moveFrame,\n reshapeFrame,\n resizeFrame,\n type Clip,\n type Corner,\n type Edge,\n type Frame,\n type Guide,\n type Placed,\n} from './model'\nimport { TEXT_COLORS, clipEdgeCss } from './theme'\n\ntype Kind = 'move' | Corner | Edge\n\nconst isEdge = (kind: Kind): kind is Edge =>\n kind === 'n' || kind === 'e' || kind === 's' || kind === 'w'\n\n/** The handle on each side's middle: drag it to show more (or less) of the page that way. */\nconst EDGES: { edge: Edge; left: string; top: string; cursor: string; label: string }[] = [\n { edge: 'n', left: '50%', top: '0%', cursor: 'ns-resize', label: 'top' },\n { edge: 'e', left: '100%', top: '50%', cursor: 'ew-resize', label: 'right' },\n { edge: 's', left: '50%', top: '100%', cursor: 'ns-resize', label: 'bottom' },\n { edge: 'w', left: '0%', top: '50%', cursor: 'ew-resize', label: 'left' },\n]\n\nconst CORNERS: { corner: Corner; left: string; top: string; cursor: string }[] = [\n { corner: 'nw', left: '0%', top: '0%', cursor: 'nwse-resize' },\n { corner: 'ne', left: '100%', top: '0%', cursor: 'nesw-resize' },\n { corner: 'sw', left: '0%', top: '100%', cursor: 'nesw-resize' },\n { corner: 'se', left: '100%', top: '100%', cursor: 'nwse-resize' },\n]\n\nconst EDGE_CSS = clipEdgeCss()\n\n/** What a stage gives its clips (stable across renders: the clips are memoised). */\nexport interface StageItemHost {\n /** The stage's box on screen, as a gesture begins. */\n stageBox(): DOMRect | null\n /** The other clips of the slide, as a gesture begins: what this one snaps to. */\n others(clipId: string): Placed[]\n select(clipId: string): void\n /** The snap lines to draw while a clip is dragged (empty: none). */\n guides(guides: Guide[]): void\n /** A drag is on (the stage hides the selected clip's floating actions meanwhile). */\n dragging(on: boolean): void\n /** The drag's result, once it ends. */\n commit(clipId: string, frame: Frame, shape?: Pick<Clip, 'rect' | 'aspect'>): void\n}\n\nexport interface StageItemProps {\n clip: Clip\n frame: Frame\n editable: boolean\n selected: boolean\n dim: boolean\n /** Its source label, under it (empty: none). */\n label: string\n host: StageItemHost\n}\n\ninterface Gesture {\n kind: Kind\n pointer: { x: number; y: number }\n frame: Frame\n shape: Pick<Clip, 'rect' | 'aspect'>\n stage: DOMRect\n others: Placed[]\n /** The latest result, applied at the next animation frame and committed at the end. */\n next: { frame: Frame; shape?: Pick<Clip, 'rect' | 'aspect'>; guides: Guide[] } | null\n request: number | null\n guidesKey: string\n}\n\nexport const StageItem = memo(function StageItem({\n clip,\n frame,\n editable,\n selected,\n dim,\n label,\n host,\n}: StageItemProps) {\n const element = useRef<HTMLDivElement>(null)\n const gesture = useRef<Gesture | null>(null)\n const [dragging, setDragging] = useState(false)\n // Being reshaped: drawn as it will be (the one case that re-renders while dragging).\n const [reshape, setReshape] = useState<{\n frame: Frame\n shape: Pick<Clip, 'rect' | 'aspect'>\n } | null>(null)\n\n const shown = reshape ? { ...clip, ...reshape.shape } : clip\n const box = reshape?.frame ?? frame\n\n const view = () => element.current?.ownerDocument.defaultView ?? window\n\n const apply = () => {\n const g = gesture.current\n const el = element.current\n if (!g) return\n g.request = null\n const next = g.next\n if (!next || !el) return\n if (next.shape) {\n setReshape({ frame: next.frame, shape: next.shape })\n } else {\n // Moved or resized: a transform from where the drag began (top left fixed as the origin).\n const dx = (next.frame.x - g.frame.x) * g.stage.width\n const dy = (next.frame.y - g.frame.y) * g.stage.height\n const scale = next.frame.w / g.frame.w\n el.style.transform = `translate3d(${dx}px, ${dy}px, 0) scale(${scale})`\n }\n const key = next.guides.map((guide) => `${guide.axis}${guide.at}`).join()\n if (key !== g.guidesKey) {\n g.guidesKey = key\n host.guides(next.guides)\n }\n }\n\n const start = (event: ReactPointerEvent, kind: Kind) => {\n if (!editable || event.button !== 0) return\n const stage = host.stageBox()\n if (!stage) return\n event.preventDefault()\n event.stopPropagation()\n host.select(clip.id)\n event.currentTarget.setPointerCapture(event.pointerId)\n gesture.current = {\n kind,\n pointer: { x: event.clientX, y: event.clientY },\n frame,\n shape: { rect: clip.rect, aspect: clip.aspect },\n stage,\n others: host.others(clip.id),\n next: null,\n request: null,\n guidesKey: '',\n }\n }\n\n const move = (event: ReactPointerEvent) => {\n const g = gesture.current\n if (!g) return\n if (!g.next) {\n // The first move: the drag is on (handles and actions hide; the layer is promoted).\n setDragging(true)\n host.dragging(true)\n if (element.current) element.current.style.willChange = 'transform'\n }\n const dx = (event.clientX - g.pointer.x) / g.stage.width\n const dy = (event.clientY - g.pointer.y) / g.stage.height\n // Alt (Option) places freely, without snapping.\n const free = event.altKey\n if (isEdge(g.kind)) {\n const result = reshapeFrame(g.frame, g.shape, g.kind, dx, dy, g.others, free)\n g.next = {\n frame: result.frame,\n shape: { rect: result.rect, aspect: result.aspect },\n guides: result.guides,\n }\n } else {\n g.next =\n g.kind === 'move'\n ? moveFrame(g.frame, g.shape.aspect, dx, dy, g.others, free)\n : resizeFrame(g.frame, g.shape.aspect, g.kind, dx, dy, g.others, free)\n }\n g.request ??= view().requestAnimationFrame(apply)\n }\n\n const end = () => {\n const g = gesture.current\n gesture.current = null\n if (!g) return\n if (g.request !== null) view().cancelAnimationFrame(g.request)\n const el = element.current\n if (el) {\n el.style.transform = ''\n el.style.willChange = ''\n }\n if (!g.next) return // a click: the clip is selected, nothing moved\n setReshape(null)\n setDragging(false)\n host.dragging(false)\n host.guides([])\n host.commit(clip.id, g.next.frame, g.next.shape)\n }\n\n return (\n <div\n ref={element}\n className={cn(\n 'absolute origin-top-left',\n // Lifted off the background (a picture that is part of the slide's design is not).\n !clip.plain && 'rounded-[0.6cqw] shadow-[0_0.5cqw_1.6cqw_rgba(0,0,0,0.5)]',\n editable && 'cursor-move touch-none',\n selected && 'outline outline-2 outline-offset-2 outline-primary',\n dim && 'opacity-30'\n )}\n style={{\n left: `${box.x * 100}%`,\n top: `${box.y * 100}%`,\n width: `${box.w * 100}%`,\n height: `${frameHeight(box, shown.aspect) * 100}%`,\n }}\n onPointerDown={(event) => start(event, 'move')}\n onPointerMove={move}\n onPointerUp={end}\n onPointerCancel={end}\n data-testid={`stage-item-${clip.id}`}\n >\n {/* Softly rounded, with a faint light edge: crisp on any background. */}\n <div className={cn('absolute inset-0 overflow-hidden', !clip.plain && 'rounded-[0.6cqw]')}>\n <ClipImage clip={shown} live={!editable} />\n {/* A page's text fades out at the clip's edge rather than being sliced. */}\n {clip.kind === 'pdf' && !clip.plain && (\n <div\n className=\"pointer-events-none absolute inset-0\"\n style={{ background: EDGE_CSS }}\n data-testid=\"stage-clip-edge\"\n />\n )}\n {!clip.plain && (\n <div className=\"pointer-events-none absolute inset-0 rounded-[0.6cqw] ring-1 ring-inset ring-white/15\" />\n )}\n </div>\n {label && !clip.plain && (\n // Under the clip, in the room the layout keeps (CAPTION_SPACE): never over it.\n <div\n className=\"pointer-events-none absolute left-0 top-full mt-[0.5cqw] max-w-full truncate text-[1.7cqw] leading-tight\"\n style={{ color: TEXT_COLORS.muted }}\n >\n {label}\n </div>\n )}\n {/* Scroll and zoom what it shows, on a layer over it (not while it is dragged). */}\n {selected && !dragging && <ClipViewControls clip={clip} />}\n {/* A handle on each corner (a small dot in a finger-sized target), and a bar on each side's\n middle; their moves bubble to the clip's handlers while the gesture lasts. */}\n {selected &&\n CORNERS.map(({ corner, left, top, cursor }) => (\n <div\n key={corner}\n className=\"absolute flex size-6 -translate-x-1/2 -translate-y-1/2 items-center justify-center pointer-coarse:size-11\"\n style={{ left, top, cursor, touchAction: 'none' }}\n onPointerDown={(event) => start(event, corner)}\n aria-label={`Resize from the ${corner} corner`}\n data-testid={`stage-item-resize-${corner}`}\n >\n <span className=\"pointer-events-none size-3 rounded-full border-2 border-primary bg-background\" />\n </div>\n ))}\n {selected &&\n EDGES.map(({ edge, left, top, cursor, label: side }) => (\n <div\n key={edge}\n className=\"absolute flex size-6 -translate-x-1/2 -translate-y-1/2 items-center justify-center pointer-coarse:size-11\"\n style={{ left, top, cursor, touchAction: 'none' }}\n onPointerDown={(event) => start(event, edge)}\n aria-label={`Show more or less at the ${side}`}\n title=\"Drag to show more or less of the page\"\n data-testid={`stage-item-reshape-${edge}`}\n >\n <span\n className={cn(\n 'pointer-events-none rounded-full border-2 border-primary bg-background',\n edge === 'n' || edge === 's' ? 'h-2 w-4' : 'h-4 w-2'\n )}\n />\n </div>\n ))}\n </div>\n )\n})\n"],
5
+ "mappings": ";AAqOM,SACE,KADF;A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;AAAA,QAEd;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,OAAO,EAAE,OAAO,YAAY,MAAM;AAAA,YAEjC;AAAA;AAAA,QACH;AAAA,QAGD,YAAY,CAAC,YAAY,oBAAC,oBAAiB,MAAY;AAAA,QAGvD,YACC,QAAQ,IAAI,CAAC,EAAE,QAAQ,MAAM,KAAK,OAAO,MACvC;AAAA,UAAC;AAAA;AAAA,YAEC,WAAU;AAAA,YACV,OAAO,EAAE,MAAM,KAAK,QAAQ,aAAa,OAAO;AAAA,YAChD,eAAe,CAAC,UAAU,MAAM,OAAO,MAAM;AAAA,YAC7C,cAAY,mBAAmB,MAAM;AAAA,YACrC,eAAa,qBAAqB,MAAM;AAAA,YAExC,8BAAC,UAAK,WAAU,iFAAgF;AAAA;AAAA,UAP3F;AAAA,QAQP,CACD;AAAA,QACF,YACC,MAAM,IAAI,CAAC,EAAE,MAAM,MAAM,KAAK,QAAQ,OAAO,KAAK,MAChD;AAAA,UAAC;AAAA;AAAA,YAEC,WAAU;AAAA,YACV,OAAO,EAAE,MAAM,KAAK,QAAQ,aAAa,OAAO;AAAA,YAChD,eAAe,CAAC,UAAU,MAAM,OAAO,IAAI;AAAA,YAC3C,cAAY,4BAA4B,IAAI;AAAA,YAC5C,OAAM;AAAA,YACN,eAAa,sBAAsB,IAAI;AAAA,YAEvC;AAAA,cAAC;AAAA;AAAA,gBACC,WAAW;AAAA,kBACT;AAAA,kBACA,SAAS,OAAO,SAAS,MAAM,YAAY;AAAA,gBAC7C;AAAA;AAAA,YACF;AAAA;AAAA,UAbK;AAAA,QAcP,CACD;AAAA;AAAA;AAAA,EACL;AAEJ,CAAC;",
6
+ "names": ["StageItem"]
7
+ }
@@ -0,0 +1,6 @@
1
+ /** Text boxes' type as CSS (container units: it scales with the stage). */
2
+ import type { CSSProperties } from 'react';
3
+ import { type TextRun } from './boxes';
4
+ /** A size in points as CSS (container units). */
5
+ export declare const cqw: (points: number) => string;
6
+ export declare function runStyle(run: TextRun, font: string): CSSProperties;
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { DEFAULT_TEXT_SIZE, pointsToStage } from "./boxes.js";
3
+ import { TEXT_COLORS } from "./theme.js";
4
+ const cqw = (points) => `${pointsToStage(points) * 100}cqw`;
5
+ function runStyle(run, font) {
6
+ return {
7
+ fontSize: cqw(run.size ?? DEFAULT_TEXT_SIZE),
8
+ fontWeight: run.bold ? 700 : 400,
9
+ fontStyle: run.italic ? "italic" : void 0,
10
+ textDecoration: run.underline ? "underline" : void 0,
11
+ color: run.color ?? TEXT_COLORS.body,
12
+ fontFamily: run.font ? `"${run.font}", ${font}` : font
13
+ };
14
+ }
15
+ export {
16
+ cqw,
17
+ runStyle
18
+ };
19
+ //# sourceMappingURL=box-style.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/presentation/box-style.ts"],
4
+ "sourcesContent": ["/** Text boxes' type as CSS (container units: it scales with the stage). */\n\nimport type { CSSProperties } from 'react'\nimport { DEFAULT_TEXT_SIZE, pointsToStage, type TextRun } from './boxes'\nimport { TEXT_COLORS } from './theme'\n\n/** A size in points as CSS (container units). */\nexport const cqw = (points: number) => `${pointsToStage(points) * 100}cqw`\n\nexport function runStyle(run: TextRun, font: string): CSSProperties {\n return {\n fontSize: cqw(run.size ?? DEFAULT_TEXT_SIZE),\n fontWeight: run.bold ? 700 : 400,\n fontStyle: run.italic ? 'italic' : undefined,\n textDecoration: run.underline ? 'underline' : undefined,\n color: run.color ?? TEXT_COLORS.body,\n fontFamily: run.font ? `\"${run.font}\", ${font}` : font,\n }\n}\n"],
5
+ "mappings": ";AAGA,SAAS,mBAAmB,qBAAmC;AAC/D,SAAS,mBAAmB;AAGrB,MAAM,MAAM,CAAC,WAAmB,GAAG,cAAc,MAAM,IAAI,GAAG;AAE9D,SAAS,SAAS,KAAc,MAA6B;AAClE,SAAO;AAAA,IACL,UAAU,IAAI,IAAI,QAAQ,iBAAiB;AAAA,IAC3C,YAAY,IAAI,OAAO,MAAM;AAAA,IAC7B,WAAW,IAAI,SAAS,WAAW;AAAA,IACnC,gBAAgB,IAAI,YAAY,cAAc;AAAA,IAC9C,OAAO,IAAI,SAAS,YAAY;AAAA,IAChC,YAAY,IAAI,OAAO,IAAI,IAAI,IAAI,MAAM,IAAI,KAAK;AAAA,EACpD;AACF;",
6
+ "names": []
7
+ }