@arbidocs/blocks 0.5.121 → 0.5.122
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ClippingMediaViewer-B6WG7Q64.cjs → ClippingMediaViewer-IEIBT74X.cjs} +8 -8
- package/dist/{ClippingMediaViewer-B6WG7Q64.cjs.map → ClippingMediaViewer-IEIBT74X.cjs.map} +1 -1
- package/dist/{ClippingPdfViewer-6GCVTV3V.cjs → ClippingPdfViewer-OGYLMVCE.cjs} +5 -5
- package/dist/{ClippingPdfViewer-6GCVTV3V.cjs.map → ClippingPdfViewer-OGYLMVCE.cjs.map} +1 -1
- package/dist/{ConnectedCallDock-DC5V5OUJ.cjs → ConnectedCallDock-XJOYVVAH.cjs} +21 -21
- package/dist/{ConnectedCallDock-DC5V5OUJ.cjs.map → ConnectedCallDock-XJOYVVAH.cjs.map} +1 -1
- package/dist/{ConnectedCallRoom-FQLXWTFB.cjs → ConnectedCallRoom-CUDYAPQK.cjs} +14 -14
- package/dist/{ConnectedCallRoom-FQLXWTFB.cjs.map → ConnectedCallRoom-CUDYAPQK.cjs.map} +1 -1
- package/dist/{ConnectedNativeDocxComparison-4Q5S7VLD.cjs → ConnectedNativeDocxComparison-QKHCYD6W.cjs} +16 -16
- package/dist/{ConnectedNativeDocxComparison-4Q5S7VLD.cjs.map → ConnectedNativeDocxComparison-QKHCYD6W.cjs.map} +1 -1
- package/dist/ConnectedPresentation-AU25OW25.cjs +321 -0
- package/dist/ConnectedPresentation-AU25OW25.cjs.map +1 -0
- package/dist/{ConnectedProductionSetDialog-4EAY6KAZ.cjs → ConnectedProductionSetDialog-LHB4VQWC.cjs} +3 -3
- package/dist/{ConnectedProductionSetDialog-4EAY6KAZ.cjs.map → ConnectedProductionSetDialog-LHB4VQWC.cjs.map} +1 -1
- package/dist/{ConnectedSlidesTab-7QDE2CZD.cjs → ConnectedSlidesTab-I75LKKN7.cjs} +40 -38
- package/dist/ConnectedSlidesTab-I75LKKN7.cjs.map +1 -0
- package/dist/{ConnectedStreamedWordArtifact-FFOQJBOI.cjs → ConnectedStreamedWordArtifact-AG62232A.cjs} +16 -16
- package/dist/{ConnectedStreamedWordArtifact-FFOQJBOI.cjs.map → ConnectedStreamedWordArtifact-AG62232A.cjs.map} +1 -1
- package/dist/{DocumentReviewCard-SNWVEZ7S.cjs → DocumentReviewCard-M53XFLI2.cjs} +15 -15
- package/dist/{DocumentReviewCard-SNWVEZ7S.cjs.map → DocumentReviewCard-M53XFLI2.cjs.map} +1 -1
- package/dist/{FilesViewerDialog-IZI63FOV.cjs → FilesViewerDialog-4352KIOG.cjs} +50 -49
- package/dist/FilesViewerDialog-4352KIOG.cjs.map +1 -0
- package/dist/{WorkspaceTableView-TEIRB6VJ.cjs → WorkspaceTableView-3XYAV4BV.cjs} +8 -8
- package/dist/{WorkspaceTableView-TEIRB6VJ.cjs.map → WorkspaceTableView-3XYAV4BV.cjs.map} +1 -1
- package/dist/agents/index.cjs +297 -297
- package/dist/{ai-KBYNRNZ6.cjs → ai-IEIR7SC2.cjs} +25 -25
- package/dist/ai-IEIR7SC2.cjs.map +1 -0
- package/dist/calls/index.cjs +121 -121
- package/dist/chat/index.cjs +1 -1
- package/dist/{chunk-NLOETJCB.cjs → chunk-2F57IO7S.cjs} +12 -12
- package/dist/{chunk-NLOETJCB.cjs.map → chunk-2F57IO7S.cjs.map} +1 -1
- package/dist/chunk-2RLA6QO2.cjs +174 -0
- package/dist/chunk-2RLA6QO2.cjs.map +1 -0
- package/dist/{chunk-Q6DQGGP4.cjs → chunk-325GVZE6.cjs} +3 -3
- package/dist/{chunk-Q6DQGGP4.cjs.map → chunk-325GVZE6.cjs.map} +1 -1
- package/dist/{chunk-XTR26TNE.cjs → chunk-4TTX6ZNS.cjs} +20 -4
- package/dist/chunk-4TTX6ZNS.cjs.map +1 -0
- package/dist/{chunk-BVAT4EVC.cjs → chunk-5QERK4PK.cjs} +35 -35
- package/dist/{chunk-BVAT4EVC.cjs.map → chunk-5QERK4PK.cjs.map} +1 -1
- package/dist/{chunk-GX2EBMJW.cjs → chunk-6OK7ESTL.cjs} +7 -6
- package/dist/chunk-6OK7ESTL.cjs.map +1 -0
- package/dist/{chunk-C2OICDMI.cjs → chunk-7557LDAN.cjs} +10 -10
- package/dist/{chunk-C2OICDMI.cjs.map → chunk-7557LDAN.cjs.map} +1 -1
- package/dist/{chunk-474GPLCM.cjs → chunk-7L4X6QN2.cjs} +6 -6
- package/dist/{chunk-474GPLCM.cjs.map → chunk-7L4X6QN2.cjs.map} +1 -1
- package/dist/{chunk-52KGMAO5.cjs → chunk-7NLO7ASW.cjs} +15 -15
- package/dist/{chunk-52KGMAO5.cjs.map → chunk-7NLO7ASW.cjs.map} +1 -1
- package/dist/{chunk-H5OLHP2U.cjs → chunk-7OPOPYV6.cjs} +3 -3
- package/dist/{chunk-H5OLHP2U.cjs.map → chunk-7OPOPYV6.cjs.map} +1 -1
- package/dist/{chunk-W6B3RYTX.cjs → chunk-7PN3YENO.cjs} +4 -4
- package/dist/{chunk-W6B3RYTX.cjs.map → chunk-7PN3YENO.cjs.map} +1 -1
- package/dist/{chunk-734NPQNR.cjs → chunk-ADDQKZ5I.cjs} +4 -4
- package/dist/{chunk-734NPQNR.cjs.map → chunk-ADDQKZ5I.cjs.map} +1 -1
- package/dist/{chunk-JQLWKNJO.cjs → chunk-ALK3PUUB.cjs} +4 -4
- package/dist/{chunk-JQLWKNJO.cjs.map → chunk-ALK3PUUB.cjs.map} +1 -1
- package/dist/{chunk-4VZZWYEC.cjs → chunk-BQ5RIWWT.cjs} +3 -3
- package/dist/{chunk-4VZZWYEC.cjs.map → chunk-BQ5RIWWT.cjs.map} +1 -1
- package/dist/{chunk-ENGL7P3I.cjs → chunk-CQQQIZU4.cjs} +27 -27
- package/dist/{chunk-ENGL7P3I.cjs.map → chunk-CQQQIZU4.cjs.map} +1 -1
- package/dist/{chunk-3SCNXNHI.cjs → chunk-E3L5DB5F.cjs} +5 -5
- package/dist/{chunk-3SCNXNHI.cjs.map → chunk-E3L5DB5F.cjs.map} +1 -1
- package/dist/{chunk-VJ5ZLRBD.cjs → chunk-GFUOCGY6.cjs} +8 -3
- package/dist/chunk-GFUOCGY6.cjs.map +1 -0
- package/dist/{chunk-RYVZDFVO.cjs → chunk-JJZOL5MG.cjs} +3 -3
- package/dist/{chunk-RYVZDFVO.cjs.map → chunk-JJZOL5MG.cjs.map} +1 -1
- package/dist/{chunk-QFXILJMJ.cjs → chunk-K4763GD5.cjs} +17 -174
- package/dist/chunk-K4763GD5.cjs.map +1 -0
- package/dist/{chunk-EHP6OH5D.cjs → chunk-KA3F6TIH.cjs} +11 -11
- package/dist/{chunk-EHP6OH5D.cjs.map → chunk-KA3F6TIH.cjs.map} +1 -1
- package/dist/{chunk-UUENH4BJ.cjs → chunk-KXIRVKCJ.cjs} +3 -3
- package/dist/{chunk-UUENH4BJ.cjs.map → chunk-KXIRVKCJ.cjs.map} +1 -1
- package/dist/{chunk-4RBQ44RY.cjs → chunk-MLA2BJ2Y.cjs} +28 -28
- package/dist/{chunk-4RBQ44RY.cjs.map → chunk-MLA2BJ2Y.cjs.map} +1 -1
- package/dist/{chunk-DR2AH7JL.cjs → chunk-NG2EE7HR.cjs} +48 -48
- package/dist/{chunk-DR2AH7JL.cjs.map → chunk-NG2EE7HR.cjs.map} +1 -1
- package/dist/{chunk-4NPCDS2X.cjs → chunk-NY3YUCOW.cjs} +3 -3
- package/dist/{chunk-4NPCDS2X.cjs.map → chunk-NY3YUCOW.cjs.map} +1 -1
- package/dist/{chunk-JZEYHDWJ.cjs → chunk-OHHKBURG.cjs} +76 -76
- package/dist/chunk-OHHKBURG.cjs.map +1 -0
- package/dist/{chunk-AY6EZSZB.cjs → chunk-QG2U2JGX.cjs} +4 -4
- package/dist/{chunk-AY6EZSZB.cjs.map → chunk-QG2U2JGX.cjs.map} +1 -1
- package/dist/{chunk-5534FYXP.cjs → chunk-SDRYSLOX.cjs} +4 -4
- package/dist/{chunk-5534FYXP.cjs.map → chunk-SDRYSLOX.cjs.map} +1 -1
- package/dist/{chunk-2W5E62EY.cjs → chunk-SGYSDABK.cjs} +6 -6
- package/dist/{chunk-2W5E62EY.cjs.map → chunk-SGYSDABK.cjs.map} +1 -1
- package/dist/{chunk-EATIFPKP.cjs → chunk-T73BHNQX.cjs} +4 -4
- package/dist/{chunk-EATIFPKP.cjs.map → chunk-T73BHNQX.cjs.map} +1 -1
- package/dist/{chunk-4IOYQLKG.cjs → chunk-TP5PGWIO.cjs} +3 -3
- package/dist/{chunk-4IOYQLKG.cjs.map → chunk-TP5PGWIO.cjs.map} +1 -1
- package/dist/{chunk-GKVE5JGB.cjs → chunk-UFT22LAB.cjs} +3 -3
- package/dist/{chunk-GKVE5JGB.cjs.map → chunk-UFT22LAB.cjs.map} +1 -1
- package/dist/{chunk-Q3XJUXID.cjs → chunk-USNTRL22.cjs} +215 -199
- package/dist/chunk-USNTRL22.cjs.map +1 -0
- package/dist/{chunk-7VUJGHMY.cjs → chunk-UTJ223TI.cjs} +178 -82
- package/dist/chunk-UTJ223TI.cjs.map +1 -0
- package/dist/{chunk-FKFQCK3C.cjs → chunk-V6MW7B4B.cjs} +4 -4
- package/dist/{chunk-FKFQCK3C.cjs.map → chunk-V6MW7B4B.cjs.map} +1 -1
- package/dist/{chunk-2PZT3J34.cjs → chunk-VWBYE3XY.cjs} +6 -6
- package/dist/{chunk-2PZT3J34.cjs.map → chunk-VWBYE3XY.cjs.map} +1 -1
- package/dist/{chunk-GQXPNIRE.cjs → chunk-WAV762GP.cjs} +6 -6
- package/dist/{chunk-GQXPNIRE.cjs.map → chunk-WAV762GP.cjs.map} +1 -1
- package/dist/{chunk-5LTIZ44D.cjs → chunk-WFMWKPGY.cjs} +14 -7
- package/dist/chunk-WFMWKPGY.cjs.map +1 -0
- package/dist/{chunk-KP5AITQ4.cjs → chunk-WRLGLZIA.cjs} +7 -7
- package/dist/{chunk-KP5AITQ4.cjs.map → chunk-WRLGLZIA.cjs.map} +1 -1
- package/dist/{chunk-MZ2KZXNU.cjs → chunk-WXUU3COI.cjs} +3 -3
- package/dist/{chunk-MZ2KZXNU.cjs.map → chunk-WXUU3COI.cjs.map} +1 -1
- package/dist/{chunk-NAJN32MF.cjs → chunk-XF355M7O.cjs} +13 -13
- package/dist/{chunk-NAJN32MF.cjs.map → chunk-XF355M7O.cjs.map} +1 -1
- package/dist/{chunk-GPX5VC57.cjs → chunk-XGM4VVNV.cjs} +50 -50
- package/dist/{chunk-GPX5VC57.cjs.map → chunk-XGM4VVNV.cjs.map} +1 -1
- package/dist/connect/docx.cjs +19 -19
- package/dist/connect/index.cjs +996 -995
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/viewer.cjs +38 -37
- package/dist/connection/conversation/ConnectedMessage.js +1 -1
- package/dist/connection/conversation/ConnectedMessage.js.map +2 -2
- package/dist/connection/presentation/ConnectedSlidesTab.js +5 -3
- package/dist/connection/presentation/ConnectedSlidesTab.js.map +2 -2
- package/dist/connection/presentation/PresentationPill.js +3 -8
- package/dist/connection/presentation/PresentationPill.js.map +2 -2
- package/dist/connection/presentation/requests.d.ts +5 -0
- package/dist/connection/presentation/requests.js +8 -1
- package/dist/connection/presentation/requests.js.map +2 -2
- package/dist/connection/viewer/ViewerPdfPane.js +4 -1
- package/dist/connection/viewer/ViewerPdfPane.js.map +2 -2
- package/dist/connection/viewer/documentPlace.d.ts +5 -4
- package/dist/connection/viewer/documentPlace.js +2 -2
- package/dist/connection/viewer/documentPlace.js.map +2 -2
- package/dist/connection/viewer/pdf/PdfClipOutlines.d.ts +11 -0
- package/dist/connection/viewer/pdf/PdfClipOutlines.js +42 -0
- package/dist/connection/viewer/pdf/PdfClipOutlines.js.map +7 -0
- package/dist/connection/viewer/pdf/clipOutlines.d.ts +17 -0
- package/dist/connection/viewer/pdf/clipOutlines.js +24 -0
- package/dist/connection/viewer/pdf/clipOutlines.js.map +7 -0
- package/dist/connection/viewer/pdf/passageHighlights.d.ts +2 -0
- package/dist/connection/viewer/pdf/passageHighlights.js +12 -1
- package/dist/connection/viewer/pdf/passageHighlights.js.map +2 -2
- package/dist/connection/viewer/pdf/usePdfClipOutlines.d.ts +7 -0
- package/dist/connection/viewer/pdf/usePdfClipOutlines.js +36 -0
- package/dist/connection/viewer/pdf/usePdfClipOutlines.js.map +7 -0
- package/dist/connection/viewer/pdf/usePdfPassageHighlights.js +11 -2
- package/dist/connection/viewer/pdf/usePdfPassageHighlights.js.map +2 -2
- package/dist/dashboards/index.cjs +1 -1
- package/dist/embed/index.cjs +39 -39
- package/dist/files/index.cjs +224 -224
- package/dist/index.cjs +1597 -1596
- package/dist/index.cjs.map +1 -1
- package/dist/presentation/PresentControls.d.ts +11 -0
- package/dist/presentation/PresentControls.js +117 -0
- package/dist/presentation/PresentControls.js.map +7 -0
- package/dist/presentation/PresenterView.js +36 -5
- package/dist/presentation/PresenterView.js.map +2 -2
- package/dist/presentation/SlidesEditor.js +17 -1
- package/dist/presentation/SlidesEditor.js.map +2 -2
- package/dist/presentation/panel-id.d.ts +12 -2
- package/dist/presentation/panel-id.js +6 -1
- package/dist/presentation/panel-id.js.map +2 -2
- package/dist/presentation/slide-layout.d.ts +5 -1
- package/dist/presentation/slide-layout.js +16 -0
- package/dist/presentation/slide-layout.js.map +2 -2
- package/dist/settings/index.cjs +146 -146
- package/dist/shell/PanelPortal.js +13 -4
- package/dist/shell/PanelPortal.js.map +2 -2
- package/dist/shell/index.cjs +92 -91
- package/dist/shell/panel-windows.js +1 -0
- package/dist/shell/panel-windows.js.map +2 -2
- package/dist/studio/index.cjs +28 -28
- package/dist/styles.css +1 -1
- package/dist/workflow-canvas/index.cjs +53 -53
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/dist/ConnectedPresentation-4HLDZDWV.cjs +0 -183
- package/dist/ConnectedPresentation-4HLDZDWV.cjs.map +0 -1
- package/dist/ConnectedSlidesTab-7QDE2CZD.cjs.map +0 -1
- package/dist/FilesViewerDialog-IZI63FOV.cjs.map +0 -1
- package/dist/ai-KBYNRNZ6.cjs.map +0 -1
- package/dist/chunk-5LTIZ44D.cjs.map +0 -1
- package/dist/chunk-7VUJGHMY.cjs.map +0 -1
- package/dist/chunk-GX2EBMJW.cjs.map +0 -1
- package/dist/chunk-JZEYHDWJ.cjs.map +0 -1
- package/dist/chunk-Q3XJUXID.cjs.map +0 -1
- package/dist/chunk-QFXILJMJ.cjs.map +0 -1
- package/dist/chunk-VJ5ZLRBD.cjs.map +0 -1
- package/dist/chunk-XTR26TNE.cjs.map +0 -1
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/OpenConversationButton.tsx","../src/nav/actions.ts","../src/nav/manifest.ts"],"names":["hrefFor","useBlocksEnvironment","jsxs","ActionLink","cn","buttonVariants","jsx","MessagesSquare","createElement"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/components/OpenConversationButton.tsx","../src/nav/actions.ts","../src/nav/manifest.ts"],"names":["hrefFor","useBlocksEnvironment","jsxs","ActionLink","cn","buttonVariants","jsx","MessagesSquare","createElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBO,SAAS,sBAAA,CAAuB;AAAA,EACrC,cAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,KAAA,GAAQ,gBAAA;AAAA,EACR,SAAA;AAAA,EACA;AACF,CAAA,EAAgC;AAC9B,EAAA,MAAM,EAAE,OAAA,EAAAA,QAAAA,EAAS,gBAAA,KAAqBC,sCAAA,EAAqB;AAC3D,EAAA,IAAI,CAAC,gBAAgB,OAAO,IAAA;AAC5B,EAAA,uBACEC,eAAA;AAAA,IAACC,4BAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAMH,SAAQ,EAAE,IAAA,EAAM,gBAA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AAA,GAAI,MAAA;AACjF,MAAA,IAAI,MAAA,SAAe,GAAA,EAAI;AAAA,WAClB,OAAA,CAAQ,YAAY,EAAE,CAAA;AAAA,IAC7B;AAAA,GACF;AACF;ACjDO,SAAS,iBAAiB,QAAA,EAAoC;AACnE,EAAA,MAAM,QAAQ,QAAA,CAAS,OAAA,CAAQ,CAAC,OAAA,KAAY,QAAQ,KAAK,CAAA;AACzD,EAAA,OAAO;AAAA,IACL,QAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAQ,OAAA,EAIM;AACZ,MAAA,OAAO,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,MAAU;AAAA,QAC1B,IAAI,IAAA,CAAK,EAAA;AAAA,QACT,OAAO,IAAA,CAAK,KAAA;AAAA,QACZ,MAAMC,mBAAA,CAAc,IAAA,CAAK,MAAM,EAAE,SAAA,EAAW,UAAU,CAAA;AAAA,QACtD,GAAG,OAAA,CAAQ,SAAA,GAAY,IAAI,CAAA;AAAA,QAC3B,UAAU,MAAM;AACd,UAAA,OAAA,CAAQ,cAAA,IAAiB;AACzB,UAAA,OAAA,CAAQ,WAAW,IAAI,CAAA;AAAA,QACzB;AAAA,OACF,CAAE,CAAA;AAAA,IACJ;AAAA,GACF;AACF","file":"index.cjs","sourcesContent":["import { MessagesSquare } from 'lucide-react'\nimport { buttonVariants, cn } from '@arbidocs/react/ui'\nimport { useBlocksEnvironment } from '../provider/environment'\nimport { ActionLink } from './ActionLink'\n\nexport interface OpenConversationButtonProps {\n /** The conversation behind an AI result; none: nothing is rendered. */\n conversationId: string | null | undefined\n /** The workspace it is in, for its link. */\n workspaceId?: string | null\n /** A message to scroll to. */\n messageId?: string\n /** Default \"Open in thread\". */\n label?: string\n className?: string\n testId?: string\n}\n\n/**\n * \"Open in thread\": the full conversation behind an AI result (a brief, a translation, a draft),\n * to check its sources and follow up. A real link where the host gives one (`hrefFor`), opened with\n * `openConversation`.\n */\nexport function OpenConversationButton({\n conversationId,\n workspaceId,\n messageId,\n label = 'Open in thread',\n className,\n testId,\n}: OpenConversationButtonProps) {\n const { hrefFor, openConversation } = useBlocksEnvironment()\n if (!conversationId) return null\n return (\n <ActionLink\n href={hrefFor({ kind: 'conversation', conversationId, workspaceId, messageId })}\n onSelect={() =>\n openConversation(conversationId, {\n ...(messageId && { messageId }),\n ...(workspaceId && { workspaceId }),\n })\n }\n className={cn(buttonVariants({ variant: 'outline', size: 'sm' }), className)}\n data-testid={testId}\n >\n <MessagesSquare className=\"size-3.5\" aria-hidden />\n {label}\n </ActionLink>\n )\n}\n","import type { ArbiFeature } from '@arbidocs/react'\n\n/** Who is asking, for an action's `available` (the same gates the primary UI applies). */\nexport interface ActionContext {\n /** The open workspace; `null` outside one. */\n workspaceId: string | null\n /** The viewer is a member of the open workspace. */\n isMember: boolean\n /** The viewer's role there (`owner`, `collaborator`, `guest`); `null` when not a member. */\n role: string | null\n /** A temporary-access (external) account. */\n isTemporaryAccess: boolean\n /** Whether the account may create projects; `undefined` until known. */\n canCreateProjects: boolean | undefined\n isFeatureOn: (feature: ArbiFeature) => boolean\n}\n\n/** A parameter-light action, supplied by a host and usable outside React. */\nexport interface ActionDefinition<Id extends string = string> {\n id: Id\n label: string\n category: string\n /**\n * An icon name, so the catalogue stays independent of a renderer. The palette draws the lucide\n * icons its catalogue names (`connection/command/icons.ts`); any other name, a generic glyph.\n */\n icon: string\n keywords?: readonly string[]\n /** Offered (in the command palette) only when it says so. Dispatch is not gated. */\n available?: (context: ActionContext) => boolean\n /** `false`: dispatch only, never listed (a second name for another row's effect). */\n listed?: boolean\n run: () => void\n}\n\n/** One catalogue for picker options, tip CTAs, palettes and validated remote dispatch. */\nexport function defineActions<Id extends string, Action extends ActionDefinition<Id>>(\n actions: Partial<Record<Id, Action>>,\n options: { scopedIds?: readonly Id[]; onUnknown?: (id: Id) => void } = {}\n) {\n const scoped = new Set<string>(options.scopedIds)\n return {\n actions,\n options: (Object.values(actions) as Action[]).map(({ id, label, category }) => ({\n value: id,\n label,\n category,\n })),\n isActionId(value: string): value is Id {\n return scoped.has(value) || Object.prototype.hasOwnProperty.call(actions, value)\n },\n run(id: Id): void {\n const action = Object.prototype.hasOwnProperty.call(actions, id) ? actions[id] : undefined\n if (action) action.run()\n else options.onUnknown?.(id)\n },\n }\n}\n","import { createElement } from 'react'\nimport type { AppNavItem, AppNavSection } from './types'\nimport type { NavItem } from '../shell/types'\n\n/**\n * A host's destinations, once: the items are also the command palette's nav contract. Resolve\n * their state and handlers for ShellSidebar or MobileTabBar without copying the catalogue.\n */\nexport function defineNavigation(sections: readonly AppNavSection[]) {\n const items = sections.flatMap((section) => section.items)\n return {\n sections,\n items,\n resolve(options: {\n beforeNavigate?: () => void\n onNavigate: (item: AppNavItem) => void\n itemProps?: (item: AppNavItem) => Partial<Omit<NavItem, 'id' | 'label' | 'onSelect'>>\n }): NavItem[] {\n return items.map((item) => ({\n id: item.id,\n label: item.label,\n icon: createElement(item.icon, { className: 'size-5' }),\n ...options.itemProps?.(item),\n onSelect: () => {\n options.beforeNavigate?.()\n options.onNavigate(item)\n },\n }))\n },\n }\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The presented slides' controls, bottom left: previous and next slide (with where you are),
|
|
3
|
+
* blank, full screen and stop. Like a slideshow's, they show while the pointer moves (or a key is
|
|
4
|
+
* pressed) and fade after a moment, with the pointer, so a shared screen rarely shows them.
|
|
5
|
+
*/
|
|
6
|
+
export interface PresentControlsProps {
|
|
7
|
+
/** The window presented in (full screen is that window's). */
|
|
8
|
+
view: Window | null;
|
|
9
|
+
shown: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function PresentControls({ view, shown }: PresentControlsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ChevronLeft, ChevronRight, EyeOff, Maximize, Square } from "lucide-react";
|
|
4
|
+
import { cn } from "@arbidocs/react/ui";
|
|
5
|
+
import { usePresentation } from "./store.js";
|
|
6
|
+
import { toggleFullscreen } from "./usePresenterKeys.js";
|
|
7
|
+
const CONTROL = "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";
|
|
8
|
+
function Control({
|
|
9
|
+
label,
|
|
10
|
+
onClick,
|
|
11
|
+
disabled,
|
|
12
|
+
children,
|
|
13
|
+
testId
|
|
14
|
+
}) {
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
"button",
|
|
17
|
+
{
|
|
18
|
+
type: "button",
|
|
19
|
+
className: CONTROL,
|
|
20
|
+
title: label,
|
|
21
|
+
"aria-label": label,
|
|
22
|
+
disabled,
|
|
23
|
+
onClick: (event) => {
|
|
24
|
+
event.stopPropagation();
|
|
25
|
+
onClick();
|
|
26
|
+
},
|
|
27
|
+
"data-testid": testId,
|
|
28
|
+
children
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
function PresentControls({ view, shown }) {
|
|
33
|
+
const current = usePresentation((s) => s.current);
|
|
34
|
+
const count = usePresentation((s) => s.slides.length);
|
|
35
|
+
const blank = usePresentation((s) => s.blank);
|
|
36
|
+
const actions = usePresentation.getState();
|
|
37
|
+
return /* @__PURE__ */ jsxs(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
className: cn(
|
|
41
|
+
"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",
|
|
42
|
+
shown ? "opacity-100" : "pointer-events-none opacity-0"
|
|
43
|
+
),
|
|
44
|
+
onPointerDown: (event) => event.stopPropagation(),
|
|
45
|
+
onDoubleClick: (event) => event.stopPropagation(),
|
|
46
|
+
role: "toolbar",
|
|
47
|
+
"aria-label": "Slideshow",
|
|
48
|
+
"data-testid": "present-controls",
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ jsx(
|
|
51
|
+
Control,
|
|
52
|
+
{
|
|
53
|
+
label: "Previous slide (\u2190)",
|
|
54
|
+
onClick: () => actions.goTo(current - 1),
|
|
55
|
+
disabled: current === 0,
|
|
56
|
+
testId: "present-previous",
|
|
57
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { className: "size-4" })
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ jsxs(
|
|
61
|
+
"span",
|
|
62
|
+
{
|
|
63
|
+
className: "min-w-12 text-center text-xs tabular-nums text-white/85",
|
|
64
|
+
"data-testid": "present-position",
|
|
65
|
+
children: [
|
|
66
|
+
current + 1,
|
|
67
|
+
" / ",
|
|
68
|
+
count
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ jsx(
|
|
73
|
+
Control,
|
|
74
|
+
{
|
|
75
|
+
label: "Next slide (\u2192, or click the slide)",
|
|
76
|
+
onClick: () => actions.goTo(current + 1),
|
|
77
|
+
disabled: current >= count - 1,
|
|
78
|
+
testId: "present-next",
|
|
79
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-4" })
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
/* @__PURE__ */ jsx("div", { className: "mx-1 h-4 w-px bg-white/25" }),
|
|
83
|
+
/* @__PURE__ */ jsx(
|
|
84
|
+
Control,
|
|
85
|
+
{
|
|
86
|
+
label: blank ? "Show the slide (B)" : "Blank the screen (B)",
|
|
87
|
+
onClick: () => actions.setBlank(!blank),
|
|
88
|
+
testId: "present-blank",
|
|
89
|
+
children: /* @__PURE__ */ jsx(EyeOff, { className: cn("size-4", blank && "text-amber-300") })
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ jsx(
|
|
93
|
+
Control,
|
|
94
|
+
{
|
|
95
|
+
label: "Full screen (F)",
|
|
96
|
+
onClick: () => view && toggleFullscreen(view),
|
|
97
|
+
testId: "present-fullscreen",
|
|
98
|
+
children: /* @__PURE__ */ jsx(Maximize, { className: "size-4" })
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
/* @__PURE__ */ jsx(
|
|
102
|
+
Control,
|
|
103
|
+
{
|
|
104
|
+
label: "Stop presenting (Esc)",
|
|
105
|
+
onClick: () => actions.setPresenting(false),
|
|
106
|
+
testId: "present-stop",
|
|
107
|
+
children: /* @__PURE__ */ jsx(Square, { className: "size-3.5 fill-current" })
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
export {
|
|
115
|
+
PresentControls
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=PresentControls.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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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A,QACA;AAAA,UAAC;AAAA;AAAA,YACC,WAAU;AAAA,YACV,eAAY;AAAA,YAEX;AAAA,wBAAU;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
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useEffect, useState } from "react";
|
|
4
4
|
import { PresentationStage } from "./PresentationStage.js";
|
|
5
5
|
import { SlidesEditor } from "./SlidesEditor.js";
|
|
6
6
|
import { STAGE_ASPECT } from "./model.js";
|
|
7
7
|
import { usePresentation } from "./store.js";
|
|
8
8
|
import { toggleFullscreen, usePresenterKeys } from "./usePresenterKeys.js";
|
|
9
|
+
import { PresentControls } from "./PresentControls.js";
|
|
9
10
|
const PRESENT_WIDTH = 1280;
|
|
10
11
|
function useStageShapedWindow(view, presenting) {
|
|
11
12
|
useEffect(() => {
|
|
@@ -34,6 +35,28 @@ function useStageShapedWindow(view, presenting) {
|
|
|
34
35
|
};
|
|
35
36
|
}, [view, presenting]);
|
|
36
37
|
}
|
|
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
|
+
}
|
|
37
60
|
function PresenterView({ onPresent, ...editor }) {
|
|
38
61
|
const presenting = usePresentation((s) => s.presenting);
|
|
39
62
|
const [view, setView] = useState(null);
|
|
@@ -42,16 +65,24 @@ function PresenterView({ onPresent, ...editor }) {
|
|
|
42
65
|
}, []);
|
|
43
66
|
usePresenterKeys(presenting ? view : null, true);
|
|
44
67
|
useStageShapedWindow(view, presenting);
|
|
68
|
+
const active = usePointerActive(presenting ? view : null);
|
|
45
69
|
if (presenting) {
|
|
46
|
-
return /* @__PURE__ */
|
|
70
|
+
return /* @__PURE__ */ jsxs(
|
|
47
71
|
"div",
|
|
48
72
|
{
|
|
49
73
|
ref: rootRef,
|
|
50
|
-
className: "h-full w-full select-none bg-black",
|
|
51
|
-
style: { cursor: "none" },
|
|
74
|
+
className: "relative h-full w-full select-none bg-black",
|
|
75
|
+
style: { cursor: active ? "default" : "none" },
|
|
76
|
+
onClick: () => {
|
|
77
|
+
const state = usePresentation.getState();
|
|
78
|
+
state.goTo(state.current + 1);
|
|
79
|
+
},
|
|
52
80
|
onDoubleClick: () => view && toggleFullscreen(view),
|
|
53
81
|
"data-testid": "presentation-present",
|
|
54
|
-
children:
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ jsx(PresentationStage, {}),
|
|
84
|
+
/* @__PURE__ */ jsx(PresentControls, { view, shown: active })
|
|
85
|
+
]
|
|
55
86
|
}
|
|
56
87
|
);
|
|
57
88
|
}
|
|
@@ -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'\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 if (presenting) {\n return (\n <div\n ref={rootRef}\n className=\"h-full w-full select-none bg-black\"\n style={{ cursor: 'none' }}\n onDoubleClick={() => view && toggleFullscreen(view)}\n data-testid=\"presentation-present\"\n >\n <PresentationStage />\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": ";
|
|
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;A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E,GACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -251,6 +251,7 @@ function SlidesEditor({
|
|
|
251
251
|
const slideIds = useMemo(() => ids.split(" "), [ids]);
|
|
252
252
|
const current = usePresentation((s) => s.current);
|
|
253
253
|
const captions = usePresentation((s) => s.captions);
|
|
254
|
+
const presenting = usePresentation((s) => s.presenting);
|
|
254
255
|
const [selection, setSelection] = useState(null);
|
|
255
256
|
const [view, setView] = useState(null);
|
|
256
257
|
const list = useRef(null);
|
|
@@ -326,7 +327,22 @@ function SlidesEditor({
|
|
|
326
327
|
)
|
|
327
328
|
] })
|
|
328
329
|
] }),
|
|
329
|
-
/* @__PURE__ */ jsxs(
|
|
330
|
+
presenting ? /* @__PURE__ */ jsxs(
|
|
331
|
+
Button,
|
|
332
|
+
{
|
|
333
|
+
type: "button",
|
|
334
|
+
size: "sm",
|
|
335
|
+
variant: "destructive",
|
|
336
|
+
className: "ml-0.5 h-8 rounded-full",
|
|
337
|
+
onClick: () => usePresentation.getState().setPresenting(false),
|
|
338
|
+
title: "Stop presenting (the presentation window closes)",
|
|
339
|
+
"data-testid": "presentation-stop-button",
|
|
340
|
+
children: [
|
|
341
|
+
/* @__PURE__ */ jsx(Square, { className: "size-3 fill-current" }),
|
|
342
|
+
"Stop presenting"
|
|
343
|
+
]
|
|
344
|
+
}
|
|
345
|
+
) : /* @__PURE__ */ jsxs(
|
|
330
346
|
Button,
|
|
331
347
|
{
|
|
332
348
|
type: "button",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/presentation/SlidesEditor.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * The presentation editor: its slides one under the other, scrolled like a PDF's pages, each one\n * edited where it is \u2014 clips dragged, resized and reshaped on it, its title and points typed on\n * it. Hovering a slide shows its actions (layout, move up or down, duplicate, delete); between two\n * slides, + inserts one. One small floating bar holds the rest (Design, the host's Save and other\n * actions, Present, \"\u2026\"), so no header takes room from the slides. The clips collected for the\n * presentation wait in the tray along the bottom, to be dragged onto any slide.\n *\n * The same editor shows wherever the host mounts it (the viewer's tab, or its own window).\n */\n\nimport { memo, useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'\nimport {\n ArrowDown,\n ArrowUp,\n Circle,\n Copy,\n Minus,\n MoreHorizontal,\n Play,\n Plus,\n RectangleHorizontal,\n Shapes,\n Square,\n Trash2,\n Type,\n} from 'lucide-react'\nimport {\n Button,\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n cn,\n} from '@arbidocs/react/ui'\nimport { ClipTray } from './ClipTray'\nimport { DesignMenu } from './DesignMenu'\nimport { LayoutMenu } from './LayoutMenu'\nimport { Notice } from './Notice'\nimport { PresentationStage } from './PresentationStage'\nimport type { SlideTextEditing } from './SlideDecor'\nimport { usePresentation } from './store'\nimport { newBox, type BoxShape } from './boxes'\nimport { accentColor, isLightBackground } from './theme'\nimport { usePresenterKeys } from './usePresenterKeys'\n\nexport interface SlidesEditorProps {\n /** Present: the host opens the shareable window. */\n onPresent: () => void\n /** In the floating bar, before Present (e.g. Save, pop out). */\n actions?: ReactNode\n /** At the top of the \"\u2026\" menu (e.g. New from template, Save as, Export). */\n menuItems?: ReactNode\n /** First in the clip tray (e.g. Generate image). */\n trayStart?: ReactNode\n onChooseLogo?: () => void\n onEditImage?: (clipId: string) => void\n onCropImage?: (clipId: string) => void\n}\n\ninterface Selection {\n index: number\n clipId: string\n}\n\n/** A small icon button of a slide's hover bar. */\nfunction SlideAction({\n label,\n onClick,\n disabled,\n children,\n}: {\n label: string\n onClick: () => void\n disabled?: boolean\n children: ReactNode\n}) {\n return (\n <Button\n type=\"button\"\n size=\"icon\"\n variant=\"ghost\"\n className=\"size-7 text-muted-foreground hover:text-foreground pointer-coarse:size-10\"\n title={label}\n aria-label={label}\n disabled={disabled}\n onClick={onClick}\n >\n {children}\n </Button>\n )\n}\n\nconst SlideCard = memo(function SlideCard({\n index,\n count,\n current,\n selected,\n onSelect,\n onEditImage,\n onCropImage,\n}: {\n index: number\n count: number\n current: boolean\n selected: string | null\n onSelect: (index: number, clipId: string | null) => void\n onEditImage?: (clipId: string) => void\n onCropImage?: (clipId: string) => void\n}) {\n const empty = usePresentation((s) => {\n const slide = s.slides[index]\n return (\n !!slide &&\n !slide.items.length &&\n !slide.boxes.length &&\n slide.layout !== 'title' &&\n slide.layout !== 'section'\n )\n })\n const notes = usePresentation((s) => s.slides[index]?.notes ?? '')\n const textEditing = useMemo<SlideTextEditing>(\n () => ({\n onTitle: (title) => usePresentation.getState().setSlideCaption(title, index),\n onPoints: (points) => usePresentation.getState().setSlidePoints(points, index),\n }),\n [index]\n )\n const select = useCallback((clipId: string | null) => onSelect(index, clipId), [onSelect, index])\n const actions = usePresentation.getState()\n return (\n <div className=\"group relative flex gap-2\" data-testid={`slide-${index}`}>\n {/* The gutter: the slide's number, and its actions on hover (always on a touch screen's\n current slide), clear of the slide itself. */}\n <div className=\"flex w-9 shrink-0 flex-col items-center gap-0.5\">\n <span\n className={cn(\n 'py-1 text-xs tabular-nums',\n current ? 'font-semibold text-foreground' : 'text-muted-foreground'\n )}\n >\n {index + 1}\n </span>\n <div\n className={cn(\n 'flex flex-col items-center gap-0.5 transition-opacity',\n 'opacity-0 focus-within:opacity-100 group-hover:opacity-100',\n current && 'pointer-coarse:opacity-100'\n )}\n data-testid={`slide-actions-${index}`}\n >\n <LayoutMenu index={index} compact />\n <SlideAction\n label=\"Move up\"\n disabled={index === 0}\n onClick={() => actions.moveSlide(index, index - 1)}\n >\n <ArrowUp className=\"size-3.5\" />\n </SlideAction>\n <SlideAction\n label=\"Move down\"\n disabled={index === count - 1}\n onClick={() => actions.moveSlide(index, index + 1)}\n >\n <ArrowDown className=\"size-3.5\" />\n </SlideAction>\n <SlideAction label=\"Duplicate\" onClick={() => actions.duplicateSlide(index)}>\n <Copy className=\"size-3.5\" />\n </SlideAction>\n <SlideAction label=\"Delete slide\" onClick={() => actions.removeSlide(index)}>\n <Trash2 className=\"size-3.5\" />\n </SlideAction>\n </div>\n </div>\n <div\n className={cn(\n 'relative aspect-video min-w-0 flex-1 rounded-sm',\n current && 'ring-1 ring-primary/40 ring-offset-4 ring-offset-transparent'\n )}\n >\n <PresentationStage\n editable\n slideIndex={index}\n selected={selected}\n onSelect={select}\n onEditImage={onEditImage}\n onCropImage={onCropImage}\n textEditing={textEditing}\n overlay={\n empty && (\n <div className=\"pointer-events-none absolute inset-x-0 bottom-[8%] flex justify-center\">\n <span className=\"rounded-full bg-black/40 px-3 py-1 text-[1.4cqw] text-white/70\">\n Drag a clip here from the tray\n </span>\n </div>\n )\n }\n />\n {(notes || current) && (\n <textarea\n value={notes}\n rows={notes.split('\\n').length}\n placeholder=\"Speaker notes\"\n onChange={(event) =>\n usePresentation.getState().setSlideNotes(event.target.value, index)\n }\n className=\"mt-2 block w-full resize-none rounded-sm border-0 bg-transparent px-1 py-0.5 text-xs text-muted-foreground placeholder:text-muted-foreground/50 focus:bg-background focus:text-foreground focus:outline-none focus:ring-1 focus:ring-ring\"\n aria-label={`Speaker notes for slide ${index + 1}`}\n data-testid={`slide-notes-${index}`}\n />\n )}\n </div>\n </div>\n )\n})\n\nconst INSERTS: { shape: BoxShape; label: string; icon: ReactNode }[] = [\n { shape: 'text', label: 'Text box', icon: <Type className=\"size-4\" /> },\n { shape: 'rect', label: 'Rectangle', icon: <Square className=\"size-4\" /> },\n {\n shape: 'roundRect',\n label: 'Rounded rectangle',\n icon: <RectangleHorizontal className=\"size-4\" />,\n },\n { shape: 'ellipse', label: 'Ellipse', icon: <Circle className=\"size-4\" /> },\n { shape: 'line', label: 'Line', icon: <Minus className=\"size-4\" /> },\n]\n\n/** Insert a text box or a shape on the current slide; it is selected, ready to type in. */\nfunction InsertMenu({ onInserted }: { onInserted: (index: number, boxId: string) => void }) {\n const insert = (shape: BoxShape) => {\n const state = usePresentation.getState()\n const slide = state.slides[state.current]\n const box = newBox(shape, accentColor(state.theme.accent))\n // On a light slide (an imported deck's), text is dark.\n const dark = isLightBackground(slide?.background)\n const { id, ...rest } = dark\n ? {\n ...box,\n paragraphs: box.paragraphs.map((p) => ({\n ...p,\n runs: p.runs.map((r) => ({ color: '#1f2328', ...r })),\n })),\n }\n : box\n void id\n onInserted(state.current, state.addBox(rest))\n }\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n type=\"button\"\n size=\"icon\"\n variant=\"ghost\"\n className=\"size-8 text-muted-foreground hover:text-foreground pointer-coarse:size-11\"\n title=\"Insert a text box or shape\"\n aria-label=\"Insert\"\n data-testid=\"slides-insert\"\n >\n <Shapes className=\"size-4\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {INSERTS.map(({ shape, label, icon }) => (\n <DropdownMenuItem\n key={shape}\n onSelect={() => insert(shape)}\n data-testid={`slides-insert-${shape}`}\n >\n {icon}\n <span className=\"ml-2\">{label}</span>\n </DropdownMenuItem>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n\n/** Between two slides (and after the last): + inserts a slide there, shown on hover. */\nfunction InsertSlide({ after, always }: { after: number; always?: boolean }) {\n return (\n <div className=\"group/insert relative flex h-8 items-center justify-center pl-11\">\n <button\n type=\"button\"\n onClick={() => usePresentation.getState().addSlide(undefined, after)}\n className={cn(\n 'flex items-center gap-1 rounded-full border border-dashed border-border bg-background px-2.5 py-0.5 text-xs text-muted-foreground transition-opacity hover:border-solid hover:text-foreground focus-visible:opacity-100',\n !always && 'opacity-0 group-hover/insert:opacity-100 pointer-coarse:opacity-100'\n )}\n aria-label={`New slide after slide ${after + 1}`}\n data-testid={`slide-insert-${after}`}\n >\n <Plus className=\"size-3\" />\n Slide\n </button>\n </div>\n )\n}\n\nexport function SlidesEditor({\n onPresent,\n actions,\n menuItems,\n trayStart,\n onChooseLogo,\n onEditImage,\n onCropImage,\n}: SlidesEditorProps) {\n const ids = usePresentation((s) => s.slides.map((slide) => slide.id).join(' '))\n const slideIds = useMemo(() => ids.split(' '), [ids])\n const current = usePresentation((s) => s.current)\n const captions = usePresentation((s) => s.captions)\n const [selection, setSelection] = useState<Selection | null>(null)\n const [view, setView] = useState<Window | null>(null)\n const list = useRef<HTMLDivElement>(null)\n const rootRef = useCallback((node: HTMLDivElement | null) => {\n if (node) setView(node.ownerDocument.defaultView)\n }, [])\n\n const onSelect = useCallback((index: number, clipId: string | null) => {\n setSelection(clipId ? { index, clipId } : null)\n }, [])\n const keySelection = useMemo(\n () => ({ clipId: selection?.clipId ?? null, clear: () => setSelection(null) }),\n [selection]\n )\n usePresenterKeys(view, false, keySelection)\n\n // A slide added, duplicated or moved becomes the current one: brought into view.\n useEffect(() => {\n const card = list.current?.querySelector(`[data-testid=\"slide-${current}\"]`)\n card?.scrollIntoView?.({ block: 'nearest', behavior: 'smooth' })\n }, [current, slideIds.length])\n\n return (\n <div\n ref={rootRef}\n className=\"relative flex h-full min-h-0 flex-col bg-muted/30\"\n data-testid=\"slides-editor\"\n >\n <div ref={list} className=\"min-h-0 flex-1 overflow-y-auto\">\n <div className=\"mx-auto flex max-w-[1100px] flex-col pb-6 pl-2 pr-6 pt-14\">\n {slideIds.map((id, index) => (\n <div key={id}>\n <SlideCard\n index={index}\n count={slideIds.length}\n current={index === current}\n selected={selection?.index === index ? selection.clipId : null}\n onSelect={onSelect}\n onEditImage={onEditImage}\n onCropImage={onCropImage}\n />\n <InsertSlide after={index} always={index === slideIds.length - 1} />\n </div>\n ))}\n </div>\n </div>\n\n {/* The rest, in one small floating bar: no header row. */}\n <div\n className=\"absolute right-4 top-2.5 z-40 flex items-center gap-0.5 rounded-full border border-border bg-background p-1 shadow-md\"\n data-testid=\"slides-toolbar\"\n >\n <DesignMenu onChooseLogo={onChooseLogo} />\n <InsertMenu onInserted={(index, boxId) => setSelection({ index, clipId: boxId })} />\n {actions}\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n type=\"button\"\n size=\"icon\"\n variant=\"ghost\"\n className=\"size-8 text-muted-foreground hover:text-foreground pointer-coarse:size-11\"\n title=\"More\"\n aria-label=\"More\"\n >\n <MoreHorizontal className=\"size-4\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {menuItems}\n {menuItems && <DropdownMenuSeparator />}\n <DropdownMenuCheckboxItem\n checked={captions}\n onCheckedChange={(on) => usePresentation.getState().setCaptions(!!on)}\n >\n Show source labels\n </DropdownMenuCheckboxItem>\n </DropdownMenuContent>\n </DropdownMenu>\n <Button\n type=\"button\"\n size=\"sm\"\n className=\"ml-0.5 h-8 rounded-full\"\n onClick={() => {\n setSelection(null)\n onPresent()\n }}\n title=\"Present: the slides alone, in a window to share or put full screen\"\n data-testid=\"presentation-present-button\"\n >\n <Play className=\"size-3.5\" />\n Present\n </Button>\n </div>\n\n <ClipTray start={trayStart} />\n <Notice />\n </div>\n )\n}\n"],
|
|
5
|
-
"mappings": ";AAgFI,cAiEI,YAjEJ;AArEJ,SAAS,MAAM,aAAa,WAAW,SAAS,QAAQ,gBAAgC;AACxF;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,SAAS,yBAAyB;AAElC,SAAS,uBAAuB;AAChC,SAAS,cAA6B;AACtC,SAAS,aAAa,yBAAyB;AAC/C,SAAS,wBAAwB;AAsBjC,SAAS,YAAY;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAKG;AAC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AM,EAAE,OAAO;AAChD,QAAM,WAAW,gBAAgB,CAAC,MAAM,EAAE,QAAQ;
|
|
4
|
+
"sourcesContent": ["/**\n * The presentation editor: its slides one under the other, scrolled like a PDF's pages, each one\n * edited where it is \u2014 clips dragged, resized and reshaped on it, its title and points typed on\n * it. Hovering a slide shows its actions (layout, move up or down, duplicate, delete); between two\n * slides, + inserts one. One small floating bar holds the rest (Design, the host's Save and other\n * actions, Present, \"\u2026\"), so no header takes room from the slides. The clips collected for the\n * presentation wait in the tray along the bottom, to be dragged onto any slide.\n *\n * The same editor shows wherever the host mounts it (the viewer's tab, or its own window).\n */\n\nimport { memo, useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'\nimport {\n ArrowDown,\n ArrowUp,\n Circle,\n Copy,\n Minus,\n MoreHorizontal,\n Play,\n Plus,\n RectangleHorizontal,\n Shapes,\n Square,\n Trash2,\n Type,\n} from 'lucide-react'\nimport {\n Button,\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n cn,\n} from '@arbidocs/react/ui'\nimport { ClipTray } from './ClipTray'\nimport { DesignMenu } from './DesignMenu'\nimport { LayoutMenu } from './LayoutMenu'\nimport { Notice } from './Notice'\nimport { PresentationStage } from './PresentationStage'\nimport type { SlideTextEditing } from './SlideDecor'\nimport { usePresentation } from './store'\nimport { newBox, type BoxShape } from './boxes'\nimport { accentColor, isLightBackground } from './theme'\nimport { usePresenterKeys } from './usePresenterKeys'\n\nexport interface SlidesEditorProps {\n /** Present: the host opens the shareable window. */\n onPresent: () => void\n /** In the floating bar, before Present (e.g. Save, pop out). */\n actions?: ReactNode\n /** At the top of the \"\u2026\" menu (e.g. New from template, Save as, Export). */\n menuItems?: ReactNode\n /** First in the clip tray (e.g. Generate image). */\n trayStart?: ReactNode\n onChooseLogo?: () => void\n onEditImage?: (clipId: string) => void\n onCropImage?: (clipId: string) => void\n}\n\ninterface Selection {\n index: number\n clipId: string\n}\n\n/** A small icon button of a slide's hover bar. */\nfunction SlideAction({\n label,\n onClick,\n disabled,\n children,\n}: {\n label: string\n onClick: () => void\n disabled?: boolean\n children: ReactNode\n}) {\n return (\n <Button\n type=\"button\"\n size=\"icon\"\n variant=\"ghost\"\n className=\"size-7 text-muted-foreground hover:text-foreground pointer-coarse:size-10\"\n title={label}\n aria-label={label}\n disabled={disabled}\n onClick={onClick}\n >\n {children}\n </Button>\n )\n}\n\nconst SlideCard = memo(function SlideCard({\n index,\n count,\n current,\n selected,\n onSelect,\n onEditImage,\n onCropImage,\n}: {\n index: number\n count: number\n current: boolean\n selected: string | null\n onSelect: (index: number, clipId: string | null) => void\n onEditImage?: (clipId: string) => void\n onCropImage?: (clipId: string) => void\n}) {\n const empty = usePresentation((s) => {\n const slide = s.slides[index]\n return (\n !!slide &&\n !slide.items.length &&\n !slide.boxes.length &&\n slide.layout !== 'title' &&\n slide.layout !== 'section'\n )\n })\n const notes = usePresentation((s) => s.slides[index]?.notes ?? '')\n const textEditing = useMemo<SlideTextEditing>(\n () => ({\n onTitle: (title) => usePresentation.getState().setSlideCaption(title, index),\n onPoints: (points) => usePresentation.getState().setSlidePoints(points, index),\n }),\n [index]\n )\n const select = useCallback((clipId: string | null) => onSelect(index, clipId), [onSelect, index])\n const actions = usePresentation.getState()\n return (\n <div className=\"group relative flex gap-2\" data-testid={`slide-${index}`}>\n {/* The gutter: the slide's number, and its actions on hover (always on a touch screen's\n current slide), clear of the slide itself. */}\n <div className=\"flex w-9 shrink-0 flex-col items-center gap-0.5\">\n <span\n className={cn(\n 'py-1 text-xs tabular-nums',\n current ? 'font-semibold text-foreground' : 'text-muted-foreground'\n )}\n >\n {index + 1}\n </span>\n <div\n className={cn(\n 'flex flex-col items-center gap-0.5 transition-opacity',\n 'opacity-0 focus-within:opacity-100 group-hover:opacity-100',\n current && 'pointer-coarse:opacity-100'\n )}\n data-testid={`slide-actions-${index}`}\n >\n <LayoutMenu index={index} compact />\n <SlideAction\n label=\"Move up\"\n disabled={index === 0}\n onClick={() => actions.moveSlide(index, index - 1)}\n >\n <ArrowUp className=\"size-3.5\" />\n </SlideAction>\n <SlideAction\n label=\"Move down\"\n disabled={index === count - 1}\n onClick={() => actions.moveSlide(index, index + 1)}\n >\n <ArrowDown className=\"size-3.5\" />\n </SlideAction>\n <SlideAction label=\"Duplicate\" onClick={() => actions.duplicateSlide(index)}>\n <Copy className=\"size-3.5\" />\n </SlideAction>\n <SlideAction label=\"Delete slide\" onClick={() => actions.removeSlide(index)}>\n <Trash2 className=\"size-3.5\" />\n </SlideAction>\n </div>\n </div>\n <div\n className={cn(\n 'relative aspect-video min-w-0 flex-1 rounded-sm',\n current && 'ring-1 ring-primary/40 ring-offset-4 ring-offset-transparent'\n )}\n >\n <PresentationStage\n editable\n slideIndex={index}\n selected={selected}\n onSelect={select}\n onEditImage={onEditImage}\n onCropImage={onCropImage}\n textEditing={textEditing}\n overlay={\n empty && (\n <div className=\"pointer-events-none absolute inset-x-0 bottom-[8%] flex justify-center\">\n <span className=\"rounded-full bg-black/40 px-3 py-1 text-[1.4cqw] text-white/70\">\n Drag a clip here from the tray\n </span>\n </div>\n )\n }\n />\n {(notes || current) && (\n <textarea\n value={notes}\n rows={notes.split('\\n').length}\n placeholder=\"Speaker notes\"\n onChange={(event) =>\n usePresentation.getState().setSlideNotes(event.target.value, index)\n }\n className=\"mt-2 block w-full resize-none rounded-sm border-0 bg-transparent px-1 py-0.5 text-xs text-muted-foreground placeholder:text-muted-foreground/50 focus:bg-background focus:text-foreground focus:outline-none focus:ring-1 focus:ring-ring\"\n aria-label={`Speaker notes for slide ${index + 1}`}\n data-testid={`slide-notes-${index}`}\n />\n )}\n </div>\n </div>\n )\n})\n\nconst INSERTS: { shape: BoxShape; label: string; icon: ReactNode }[] = [\n { shape: 'text', label: 'Text box', icon: <Type className=\"size-4\" /> },\n { shape: 'rect', label: 'Rectangle', icon: <Square className=\"size-4\" /> },\n {\n shape: 'roundRect',\n label: 'Rounded rectangle',\n icon: <RectangleHorizontal className=\"size-4\" />,\n },\n { shape: 'ellipse', label: 'Ellipse', icon: <Circle className=\"size-4\" /> },\n { shape: 'line', label: 'Line', icon: <Minus className=\"size-4\" /> },\n]\n\n/** Insert a text box or a shape on the current slide; it is selected, ready to type in. */\nfunction InsertMenu({ onInserted }: { onInserted: (index: number, boxId: string) => void }) {\n const insert = (shape: BoxShape) => {\n const state = usePresentation.getState()\n const slide = state.slides[state.current]\n const box = newBox(shape, accentColor(state.theme.accent))\n // On a light slide (an imported deck's), text is dark.\n const dark = isLightBackground(slide?.background)\n const { id, ...rest } = dark\n ? {\n ...box,\n paragraphs: box.paragraphs.map((p) => ({\n ...p,\n runs: p.runs.map((r) => ({ color: '#1f2328', ...r })),\n })),\n }\n : box\n void id\n onInserted(state.current, state.addBox(rest))\n }\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n type=\"button\"\n size=\"icon\"\n variant=\"ghost\"\n className=\"size-8 text-muted-foreground hover:text-foreground pointer-coarse:size-11\"\n title=\"Insert a text box or shape\"\n aria-label=\"Insert\"\n data-testid=\"slides-insert\"\n >\n <Shapes className=\"size-4\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {INSERTS.map(({ shape, label, icon }) => (\n <DropdownMenuItem\n key={shape}\n onSelect={() => insert(shape)}\n data-testid={`slides-insert-${shape}`}\n >\n {icon}\n <span className=\"ml-2\">{label}</span>\n </DropdownMenuItem>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n\n/** Between two slides (and after the last): + inserts a slide there, shown on hover. */\nfunction InsertSlide({ after, always }: { after: number; always?: boolean }) {\n return (\n <div className=\"group/insert relative flex h-8 items-center justify-center pl-11\">\n <button\n type=\"button\"\n onClick={() => usePresentation.getState().addSlide(undefined, after)}\n className={cn(\n 'flex items-center gap-1 rounded-full border border-dashed border-border bg-background px-2.5 py-0.5 text-xs text-muted-foreground transition-opacity hover:border-solid hover:text-foreground focus-visible:opacity-100',\n !always && 'opacity-0 group-hover/insert:opacity-100 pointer-coarse:opacity-100'\n )}\n aria-label={`New slide after slide ${after + 1}`}\n data-testid={`slide-insert-${after}`}\n >\n <Plus className=\"size-3\" />\n Slide\n </button>\n </div>\n )\n}\n\nexport function SlidesEditor({\n onPresent,\n actions,\n menuItems,\n trayStart,\n onChooseLogo,\n onEditImage,\n onCropImage,\n}: SlidesEditorProps) {\n const ids = usePresentation((s) => s.slides.map((slide) => slide.id).join(' '))\n const slideIds = useMemo(() => ids.split(' '), [ids])\n const current = usePresentation((s) => s.current)\n const captions = usePresentation((s) => s.captions)\n // Presenting in the presentation's own window: Present becomes Stop presenting.\n const presenting = usePresentation((s) => s.presenting)\n const [selection, setSelection] = useState<Selection | null>(null)\n const [view, setView] = useState<Window | null>(null)\n const list = useRef<HTMLDivElement>(null)\n const rootRef = useCallback((node: HTMLDivElement | null) => {\n if (node) setView(node.ownerDocument.defaultView)\n }, [])\n\n const onSelect = useCallback((index: number, clipId: string | null) => {\n setSelection(clipId ? { index, clipId } : null)\n }, [])\n const keySelection = useMemo(\n () => ({ clipId: selection?.clipId ?? null, clear: () => setSelection(null) }),\n [selection]\n )\n usePresenterKeys(view, false, keySelection)\n\n // A slide added, duplicated or moved becomes the current one: brought into view.\n useEffect(() => {\n const card = list.current?.querySelector(`[data-testid=\"slide-${current}\"]`)\n card?.scrollIntoView?.({ block: 'nearest', behavior: 'smooth' })\n }, [current, slideIds.length])\n\n return (\n <div\n ref={rootRef}\n className=\"relative flex h-full min-h-0 flex-col bg-muted/30\"\n data-testid=\"slides-editor\"\n >\n <div ref={list} className=\"min-h-0 flex-1 overflow-y-auto\">\n <div className=\"mx-auto flex max-w-[1100px] flex-col pb-6 pl-2 pr-6 pt-14\">\n {slideIds.map((id, index) => (\n <div key={id}>\n <SlideCard\n index={index}\n count={slideIds.length}\n current={index === current}\n selected={selection?.index === index ? selection.clipId : null}\n onSelect={onSelect}\n onEditImage={onEditImage}\n onCropImage={onCropImage}\n />\n <InsertSlide after={index} always={index === slideIds.length - 1} />\n </div>\n ))}\n </div>\n </div>\n\n {/* The rest, in one small floating bar: no header row. */}\n <div\n className=\"absolute right-4 top-2.5 z-40 flex items-center gap-0.5 rounded-full border border-border bg-background p-1 shadow-md\"\n data-testid=\"slides-toolbar\"\n >\n <DesignMenu onChooseLogo={onChooseLogo} />\n <InsertMenu onInserted={(index, boxId) => setSelection({ index, clipId: boxId })} />\n {actions}\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n type=\"button\"\n size=\"icon\"\n variant=\"ghost\"\n className=\"size-8 text-muted-foreground hover:text-foreground pointer-coarse:size-11\"\n title=\"More\"\n aria-label=\"More\"\n >\n <MoreHorizontal className=\"size-4\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {menuItems}\n {menuItems && <DropdownMenuSeparator />}\n <DropdownMenuCheckboxItem\n checked={captions}\n onCheckedChange={(on) => usePresentation.getState().setCaptions(!!on)}\n >\n Show source labels\n </DropdownMenuCheckboxItem>\n </DropdownMenuContent>\n </DropdownMenu>\n {presenting ? (\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"destructive\"\n className=\"ml-0.5 h-8 rounded-full\"\n onClick={() => usePresentation.getState().setPresenting(false)}\n title=\"Stop presenting (the presentation window closes)\"\n data-testid=\"presentation-stop-button\"\n >\n <Square className=\"size-3 fill-current\" />\n Stop presenting\n </Button>\n ) : (\n <Button\n type=\"button\"\n size=\"sm\"\n className=\"ml-0.5 h-8 rounded-full\"\n onClick={() => {\n setSelection(null)\n onPresent()\n }}\n title=\"Present: the slides alone, in a window to share or put full screen\"\n data-testid=\"presentation-present-button\"\n >\n <Play className=\"size-3.5\" />\n Present\n </Button>\n )}\n </div>\n\n <ClipTray start={trayStart} />\n <Notice />\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAgFI,cAiEI,YAjEJ;AArEJ,SAAS,MAAM,aAAa,WAAW,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sBACT,iBAAiB,CAAC,OAAO,gBAAgB,SAAS,EAAE,YAAY,CAAC,CAAC,EAAE;AAAA,sBACrE;AAAA;AAAA,kBAED;AAAA,mBACF;AAAA,iBACF;AAAA,cACC,aACC;AAAA,gBAAC;AAAA;AAAA,kBACC,MAAK;AAAA,kBACL,MAAK;AAAA,kBACL,SAAQ;AAAA,kBACR,WAAU;AAAA,kBACV,SAAS,MAAM,gBAAgB,SAAS,EAAE,cAAc,KAAK;AAAA,kBAC7D,OAAM;AAAA,kBACN,eAAY;AAAA,kBAEZ;AAAA,wCAAC,UAAO,WAAU,uBAAsB;AAAA,oBAAE;AAAA;AAAA;AAAA,cAE5C,IAEA;AAAA,gBAAC;AAAA;AAAA,kBACC,MAAK;AAAA,kBACL,MAAK;AAAA,kBACL,WAAU;AAAA,kBACV,SAAS,MAAM;AACb,iCAAa,IAAI;AACjB,8BAAU;AAAA,kBACZ;AAAA,kBACA,OAAM;AAAA,kBACN,eAAY;AAAA,kBAEZ;AAAA,wCAAC,QAAK,WAAU,YAAW;AAAA,oBAAE;AAAA;AAAA;AAAA,cAE/B;AAAA;AAAA;AAAA,QAEJ;AAAA,QAEA,oBAAC,YAAS,OAAO,WAAW;AAAA,QAC5B,oBAAC,UAAO;AAAA;AAAA;AAAA,EACV;AAEJ;",
|
|
6
6
|
"names": ["SlideCard"]
|
|
7
7
|
}
|
|
@@ -19,14 +19,24 @@ export declare const isLegacyPresentationFile: (fileName: string | null | undefi
|
|
|
19
19
|
type Session = {
|
|
20
20
|
openPanel(panelId: string, mode: 'popout' | 'docked' | 'overlay' | 'main'): void;
|
|
21
21
|
};
|
|
22
|
+
type Windows = {
|
|
23
|
+
createPopupWindow(panelId: string, onClose?: () => void, title?: string): string | null;
|
|
24
|
+
};
|
|
22
25
|
/**
|
|
23
26
|
* Open the presentation's own window (a pop-out: call it from a click), to edit the presentation
|
|
24
27
|
* there, or (`present`) only to present it: that window closes when presenting ends. Recorded, so
|
|
25
28
|
* a window the saved layout restores after a reload, with nothing in it (a presentation lives in
|
|
26
29
|
* memory), is closed rather than reopened.
|
|
30
|
+
*
|
|
31
|
+
* Given the host's panel `windows`, the browser window opens at once, in the click, and the panel
|
|
32
|
+
* adopts it. The panel would otherwise open it only once the presentation's code has loaded: by
|
|
33
|
+
* then the click's permission to open a window has passed, and the browser blocks it as an
|
|
34
|
+
* unrequested pop-up (asking whether to allow pop-ups), where a document popped out opens at once.
|
|
27
35
|
*/
|
|
28
|
-
export declare function openPresentation(session: Session, { present }?: {
|
|
29
|
-
present?: boolean
|
|
36
|
+
export declare function openPresentation(session: Session, { present, windows, title, }?: {
|
|
37
|
+
present?: boolean;
|
|
38
|
+
windows?: Windows;
|
|
39
|
+
title?: string;
|
|
30
40
|
}): void;
|
|
31
41
|
export declare const presentationOpenedInThisPage: () => boolean;
|
|
32
42
|
/** The window was opened only to present (it closes when presenting ends). */
|
|
@@ -5,9 +5,14 @@ const LEGACY_PRESENTATION_SUFFIX = ".presentation.json";
|
|
|
5
5
|
const isLegacyPresentationFile = (fileName) => !!fileName && fileName.endsWith(LEGACY_PRESENTATION_SUFFIX);
|
|
6
6
|
let openedInThisPage = false;
|
|
7
7
|
let presentOnly = false;
|
|
8
|
-
function openPresentation(session, {
|
|
8
|
+
function openPresentation(session, {
|
|
9
|
+
present = false,
|
|
10
|
+
windows,
|
|
11
|
+
title = "Presentation"
|
|
12
|
+
} = {}) {
|
|
9
13
|
openedInThisPage = true;
|
|
10
14
|
presentOnly = present;
|
|
15
|
+
windows?.createPopupWindow(`panel-${PRESENTATION_PANEL}`, void 0, title);
|
|
11
16
|
session.openPanel(PRESENTATION_PANEL, "popout");
|
|
12
17
|
}
|
|
13
18
|
const presentationOpenedInThisPage = () => openedInThisPage;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/presentation/panel-id.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * The presentation window's entry points, for any surface. Light: no PDF engine, no presentation\n * module (that loads with the window or the viewer's slides tab).\n *\n * A presentation is edited in the viewer's slides tab, or in a window of its own (`openPresentation`)\n * beside the documents its clips come from; Present always shows in that window, alone, to share.\n */\n\n/** The session's panel for the presentation's own window (`ConnectedPresentation`). */\nexport const PRESENTATION_PANEL = 'presentation-panel'\n\n/**\n * The names presentations were saved under before they were known by their folder (a saved\n * presentation is now `<title>.pdf` in Files \u203A Presentations): `.presentation.pdf`, and\n * `.presentation.json` (the editable data alone, from before presentations were PDFs).\n */\nexport const PRESENTATION_FILE_SUFFIX = '.presentation.pdf'\nexport const LEGACY_PRESENTATION_SUFFIX = '.presentation.json'\n\n/** A presentation saved before it was a PDF: its data alone, no slides to view. */\nexport const isLegacyPresentationFile = (fileName: string | null | undefined): boolean =>\n !!fileName && fileName.endsWith(LEGACY_PRESENTATION_SUFFIX)\n\ntype Session = { openPanel(panelId: string, mode: 'popout' | 'docked' | 'overlay' | 'main'): void }\n\nlet openedInThisPage = false\nlet presentOnly = false\n\n/**\n * Open the presentation's own window (a pop-out: call it from a click), to edit the presentation\n * there, or (`present`) only to present it: that window closes when presenting ends. Recorded, so\n * a window the saved layout restores after a reload, with nothing in it (a presentation lives in\n * memory), is closed rather than reopened.\n */\nexport function openPresentation(session: Session
|
|
5
|
-
"mappings": ";AASO,MAAM,qBAAqB;AAO3B,MAAM,2BAA2B;AACjC,MAAM,6BAA6B;AAGnC,MAAM,2BAA2B,CAAC,aACvC,CAAC,CAAC,YAAY,SAAS,SAAS,0BAA0B;
|
|
4
|
+
"sourcesContent": ["/**\n * The presentation window's entry points, for any surface. Light: no PDF engine, no presentation\n * module (that loads with the window or the viewer's slides tab).\n *\n * A presentation is edited in the viewer's slides tab, or in a window of its own (`openPresentation`)\n * beside the documents its clips come from; Present always shows in that window, alone, to share.\n */\n\n/** The session's panel for the presentation's own window (`ConnectedPresentation`). */\nexport const PRESENTATION_PANEL = 'presentation-panel'\n\n/**\n * The names presentations were saved under before they were known by their folder (a saved\n * presentation is now `<title>.pdf` in Files \u203A Presentations): `.presentation.pdf`, and\n * `.presentation.json` (the editable data alone, from before presentations were PDFs).\n */\nexport const PRESENTATION_FILE_SUFFIX = '.presentation.pdf'\nexport const LEGACY_PRESENTATION_SUFFIX = '.presentation.json'\n\n/** A presentation saved before it was a PDF: its data alone, no slides to view. */\nexport const isLegacyPresentationFile = (fileName: string | null | undefined): boolean =>\n !!fileName && fileName.endsWith(LEGACY_PRESENTATION_SUFFIX)\n\ntype Session = { openPanel(panelId: string, mode: 'popout' | 'docked' | 'overlay' | 'main'): void }\ntype Windows = {\n createPopupWindow(panelId: string, onClose?: () => void, title?: string): string | null\n}\n\nlet openedInThisPage = false\nlet presentOnly = false\n\n/**\n * Open the presentation's own window (a pop-out: call it from a click), to edit the presentation\n * there, or (`present`) only to present it: that window closes when presenting ends. Recorded, so\n * a window the saved layout restores after a reload, with nothing in it (a presentation lives in\n * memory), is closed rather than reopened.\n *\n * Given the host's panel `windows`, the browser window opens at once, in the click, and the panel\n * adopts it. The panel would otherwise open it only once the presentation's code has loaded: by\n * then the click's permission to open a window has passed, and the browser blocks it as an\n * unrequested pop-up (asking whether to allow pop-ups), where a document popped out opens at once.\n */\nexport function openPresentation(\n session: Session,\n {\n present = false,\n windows,\n title = 'Presentation',\n }: { present?: boolean; windows?: Windows; title?: string } = {}\n): void {\n openedInThisPage = true\n presentOnly = present\n windows?.createPopupWindow(`panel-${PRESENTATION_PANEL}`, undefined, title)\n session.openPanel(PRESENTATION_PANEL, 'popout')\n}\n\nexport const presentationOpenedInThisPage = (): boolean => openedInThisPage\n\n/** The window was opened only to present (it closes when presenting ends). */\nexport const presentationWindowOnlyPresents = (): boolean => presentOnly\n"],
|
|
5
|
+
"mappings": ";AASO,MAAM,qBAAqB;AAO3B,MAAM,2BAA2B;AACjC,MAAM,6BAA6B;AAGnC,MAAM,2BAA2B,CAAC,aACvC,CAAC,CAAC,YAAY,SAAS,SAAS,0BAA0B;AAO5D,IAAI,mBAAmB;AACvB,IAAI,cAAc;AAaX,SAAS,iBACd,SACA;AAAA,EACE,UAAU;AAAA,EACV;AAAA,EACA,QAAQ;AACV,IAA8D,CAAC,GACzD;AACN,qBAAmB;AACnB,gBAAc;AACd,WAAS,kBAAkB,SAAS,kBAAkB,IAAI,QAAW,KAAK;AAC1E,UAAQ,UAAU,oBAAoB,QAAQ;AAChD;AAEO,MAAM,+BAA+B,MAAe;AAGpD,MAAM,iCAAiC,MAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -46,7 +46,11 @@ export declare const LAYOUT_INFO: Record<SlideLayout, {
|
|
|
46
46
|
label: string;
|
|
47
47
|
text?: string;
|
|
48
48
|
}>;
|
|
49
|
-
export declare function slideGeometry(
|
|
49
|
+
export declare function slideGeometry(
|
|
50
|
+
/** `items`, when given: a points slide with none puts its text across the slide. */
|
|
51
|
+
slide: Pick<Slide, 'layout' | 'caption'> & {
|
|
52
|
+
items?: readonly unknown[];
|
|
53
|
+
}, options: {
|
|
50
54
|
labels: boolean;
|
|
51
55
|
logo: LogoCorner | null;
|
|
52
56
|
}): SlideGeometry;
|
|
@@ -87,6 +87,22 @@ function slideGeometry(slide, options) {
|
|
|
87
87
|
logo,
|
|
88
88
|
reserve: { top, below, bottom, inset }
|
|
89
89
|
};
|
|
90
|
+
if (slide.layout === "points" && slide.items && slide.items.length === 0) {
|
|
91
|
+
const y = STAGE_MARGIN + top;
|
|
92
|
+
geometry.text = {
|
|
93
|
+
x: TEXT_INSET,
|
|
94
|
+
y,
|
|
95
|
+
w: 1 - 2 * TEXT_INSET,
|
|
96
|
+
h: 1 - y - STAGE_MARGIN - bottom,
|
|
97
|
+
size: 0.024,
|
|
98
|
+
weight: 400,
|
|
99
|
+
align: "left",
|
|
100
|
+
tone: "body",
|
|
101
|
+
bullets: true,
|
|
102
|
+
leading: 1.45
|
|
103
|
+
};
|
|
104
|
+
return geometry;
|
|
105
|
+
}
|
|
90
106
|
if (slide.layout === "points") {
|
|
91
107
|
const y = STAGE_MARGIN + top;
|
|
92
108
|
geometry.text = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/presentation/slide-layout.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Where a slide's parts go, by its layout: its title, the accent rule, its text (points, or a\n * subtitle), the logo in the footer, and the room its clips are arranged in. One description,\n * drawn by the stage, the saved PDF and the PowerPoint export alike.\n *\n * All positions are fractions of the stage (x, w of its width; y, h of its height); type sizes\n * are fractions of the stage width.\n */\n\nimport { CAPTION_SPACE, STAGE_MARGIN, type Reserve, type Slide, type SlideLayout } from './model'\nimport type { LogoCorner } from './theme'\n\n/** Text sits this far in from the stage's sides: a generous margin. */\nconst TEXT_INSET = 0.06\n\nexport interface TextBox {\n x: number\n y: number\n w: number\n h: number\n /** Type size, a fraction of the stage width. */\n size: number\n weight: 400 | 600 | 700\n align: 'left' | 'center'\n tone: 'title' | 'body' | 'muted'\n /** Lines start with a bullet in the accent colour. */\n bullets?: boolean\n /** Line height, a multiple of the type size. */\n leading: number\n /** Where the text sits in its box, top to bottom (default top). */\n anchor?: 'top' | 'middle' | 'bottom'\n}\n\nexport interface Box {\n x: number\n y: number\n w: number\n h: number\n}\n\nexport interface SlideGeometry {\n /** Where its title goes (none on a blank slide: its text is in its boxes). */\n title: TextBox | null\n /** The accent rule (under or above the title), when the slide shows a title. */\n rule: Box | null\n /** Where its points (or subtitle) go, if this layout has text. */\n text: TextBox | null\n logo: Box | null\n /** The room its clips keep free (they are arranged in the rest). */\n reserve: Reserve\n}\n\nexport const LAYOUT_INFO: Record<SlideLayout, { label: string; text?: string }> = {\n clips: { label: 'Title and clips' },\n points: { label: 'Clips and points', text: 'One point per line' },\n compare: { label: 'Side by side' },\n title: { label: 'Title slide', text: 'Subtitle' },\n section: { label: 'Section', text: 'Subtitle' },\n free: { label: 'Blank' },\n}\n\n/** The footer's height while a logo shows. */\nconst FOOTER = 0.085\n\nexport function slideGeometry(\n slide: Pick<Slide, 'layout' | 'caption'
|
|
5
|
-
"mappings": ";AASA,SAAS,eAAe,oBAAgE;AAIxF,MAAM,aAAa;AAuCZ,MAAM,cAAqE;AAAA,EAChF,OAAO,EAAE,OAAO,kBAAkB;AAAA,EAClC,QAAQ,EAAE,OAAO,oBAAoB,MAAM,qBAAqB;AAAA,EAChE,SAAS,EAAE,OAAO,eAAe;AAAA,EACjC,OAAO,EAAE,OAAO,eAAe,MAAM,WAAW;AAAA,EAChD,SAAS,EAAE,OAAO,WAAW,MAAM,WAAW;AAAA,EAC9C,MAAM,EAAE,OAAO,QAAQ;AACzB;AAGA,MAAM,SAAS;AAER,SAAS,
|
|
4
|
+
"sourcesContent": ["/**\n * Where a slide's parts go, by its layout: its title, the accent rule, its text (points, or a\n * subtitle), the logo in the footer, and the room its clips are arranged in. One description,\n * drawn by the stage, the saved PDF and the PowerPoint export alike.\n *\n * All positions are fractions of the stage (x, w of its width; y, h of its height); type sizes\n * are fractions of the stage width.\n */\n\nimport { CAPTION_SPACE, STAGE_MARGIN, type Reserve, type Slide, type SlideLayout } from './model'\nimport type { LogoCorner } from './theme'\n\n/** Text sits this far in from the stage's sides: a generous margin. */\nconst TEXT_INSET = 0.06\n\nexport interface TextBox {\n x: number\n y: number\n w: number\n h: number\n /** Type size, a fraction of the stage width. */\n size: number\n weight: 400 | 600 | 700\n align: 'left' | 'center'\n tone: 'title' | 'body' | 'muted'\n /** Lines start with a bullet in the accent colour. */\n bullets?: boolean\n /** Line height, a multiple of the type size. */\n leading: number\n /** Where the text sits in its box, top to bottom (default top). */\n anchor?: 'top' | 'middle' | 'bottom'\n}\n\nexport interface Box {\n x: number\n y: number\n w: number\n h: number\n}\n\nexport interface SlideGeometry {\n /** Where its title goes (none on a blank slide: its text is in its boxes). */\n title: TextBox | null\n /** The accent rule (under or above the title), when the slide shows a title. */\n rule: Box | null\n /** Where its points (or subtitle) go, if this layout has text. */\n text: TextBox | null\n logo: Box | null\n /** The room its clips keep free (they are arranged in the rest). */\n reserve: Reserve\n}\n\nexport const LAYOUT_INFO: Record<SlideLayout, { label: string; text?: string }> = {\n clips: { label: 'Title and clips' },\n points: { label: 'Clips and points', text: 'One point per line' },\n compare: { label: 'Side by side' },\n title: { label: 'Title slide', text: 'Subtitle' },\n section: { label: 'Section', text: 'Subtitle' },\n free: { label: 'Blank' },\n}\n\n/** The footer's height while a logo shows. */\nconst FOOTER = 0.085\n\nexport function slideGeometry(\n /** `items`, when given: a points slide with none puts its text across the slide. */\n slide: Pick<Slide, 'layout' | 'caption'> & { items?: readonly unknown[] },\n options: { labels: boolean; logo: LogoCorner | null }\n): SlideGeometry {\n const below = options.labels ? CAPTION_SPACE : 0\n const bottom = options.logo ? FOOTER : 0\n const logo: Box | null = options.logo\n ? {\n x: options.logo === 'bl' ? TEXT_INSET : 1 - TEXT_INSET - 0.16,\n y: 1 - 0.03 - 0.055,\n w: 0.16,\n h: 0.055,\n }\n : null\n const hasTitle = slide.caption.trim() !== ''\n\n // Blank: nothing of its own but the logo; whatever is placed on it goes anywhere.\n if (slide.layout === 'free') {\n return { title: null, rule: null, text: null, logo, reserve: { top: 0, below, bottom } }\n }\n\n if (slide.layout === 'title' || slide.layout === 'section') {\n const centred = slide.layout === 'title'\n const title: TextBox = centred\n ? {\n x: 0.1,\n y: 0.28,\n w: 0.8,\n h: 0.2,\n size: 0.052,\n weight: 700,\n align: 'center',\n tone: 'title',\n leading: 1.1,\n // Just above the rule, however many lines it takes.\n anchor: 'bottom',\n }\n : {\n x: TEXT_INSET + 0.02,\n y: 0.36,\n w: 0.8,\n h: 0.18,\n size: 0.046,\n weight: 700,\n align: 'left',\n tone: 'title',\n leading: 1.1,\n }\n return {\n title,\n rule: centred\n ? { x: 0.47, y: 0.505, w: 0.06, h: 0.007 }\n : { x: TEXT_INSET + 0.02, y: 0.33, w: 0.07, h: 0.008 },\n text: {\n x: title.x,\n y: centred ? 0.545 : 0.555,\n w: title.w,\n h: 0.1,\n size: 0.021,\n weight: 400,\n align: title.align,\n tone: 'muted',\n leading: 1.3,\n },\n logo,\n // Clips, if any, go under the text.\n reserve: { top: 0.62, below, bottom },\n }\n }\n\n const title: TextBox = {\n x: TEXT_INSET,\n y: 0.05,\n w: 1 - 2 * TEXT_INSET,\n h: 0.075,\n size: 0.03,\n weight: 600,\n align: 'left',\n tone: 'title',\n leading: 1.15,\n }\n const top = hasTitle ? 0.14 : 0\n // Clips line up with the slide's text (its title, its points); with none, they take the room.\n const inset = hasTitle || slide.layout === 'points' ? TEXT_INSET - STAGE_MARGIN : 0\n const geometry: SlideGeometry = {\n title,\n rule: hasTitle ? { x: TEXT_INSET, y: 0.128, w: 0.045, h: 0.006 } : null,\n text: null,\n logo,\n reserve: { top, below, bottom, inset },\n }\n if (slide.layout === 'points' && slide.items && slide.items.length === 0) {\n // Points alone: across the slide, under its title (no room kept for clips that are not there).\n const y = STAGE_MARGIN + top\n geometry.text = {\n x: TEXT_INSET,\n y,\n w: 1 - 2 * TEXT_INSET,\n h: 1 - y - STAGE_MARGIN - bottom,\n size: 0.024,\n weight: 400,\n align: 'left',\n tone: 'body',\n bullets: true,\n leading: 1.45,\n }\n return geometry\n }\n if (slide.layout === 'points') {\n const y = STAGE_MARGIN + top\n geometry.text = {\n x: 0.6,\n y,\n w: 1 - 0.6 - TEXT_INSET,\n h: 1 - y - STAGE_MARGIN - bottom - below,\n // Level with the clips, which are centred in their room.\n anchor: 'middle',\n size: 0.0195,\n weight: 400,\n align: 'left',\n tone: 'body',\n bullets: true,\n leading: 1.45,\n }\n geometry.reserve = { ...geometry.reserve, right: 0.4 - inset }\n }\n if (slide.layout === 'compare') geometry.reserve = { ...geometry.reserve, columns: 2 }\n return geometry\n}\n\n/** The lines of a slide's text (blank lines dropped). */\nexport const textLines = (text: string): string[] =>\n text\n .split('\\n')\n .map((line) => line.trim())\n .filter(Boolean)\n"],
|
|
5
|
+
"mappings": ";AASA,SAAS,eAAe,oBAAgE;AAIxF,MAAM,aAAa;AAuCZ,MA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