@pptx-editor.dev/react 0.0.1-placeholder → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/headless-hooks.tsx","../src/context.ts","../src/notes-target.ts","../src/TableControls.tsx","../src/chrome.tsx","../src/slot-override.ts","../src/ContextMenu.tsx","../src/slot.ts","../src/PptxEditorRoot.tsx","../src/Slideshow.tsx","../src/CanvasContextMenu.tsx","../src/context-menu-parts.tsx","../src/popups.tsx","../src/BackgroundDialog.tsx","../src/ColorSwatches.tsx","../src/ShapeControls.tsx","../src/dialog-parts.tsx","../src/color-mode.ts","../src/ImageAltTextDialog.tsx","../src/ImagePropertiesDialog.tsx","../src/PageSetupDialog.tsx","../src/ParagraphDialog.tsx","../src/dialog-form.tsx","../src/FontDialog.tsx","../src/dialog-color.tsx","../src/BulletsAndNumberingDialog.tsx","../src/ColumnsDialog.tsx","../src/menu-rows.tsx","../src/chrome-actions.tsx","../src/FindBar.tsx","../src/HyperLink.tsx","../src/useHyperlinkPopup.ts","../src/SlideControls.tsx","../src/menu-parts.tsx","../src/SlideSorter.tsx","../src/panes.tsx","../src/RailContextMenu.tsx","../src/RailSections.tsx","../src/rail-parts.tsx","../src/slide-drag.ts","../src/NotesPane.tsx","../src/EditNotice.tsx","../src/NotesView.tsx","../src/pane-state.ts","../src/ChromeTooltip.tsx","../src/Toolbar.tsx","../src/ShapeFormatControls.tsx","../src/toolbar-file-controls.tsx","../src/PictureControls.tsx","../src/toolbar-parts.tsx","../src/FontFamilyControl.tsx","../src/toolbar-size.tsx","../src/toolbar-measure.ts","../src/toolbar-action.tsx","../src/toolbar-named-parts.tsx","../src/FontNotice.tsx","../src/OpenFailure.tsx","../src/Loading.tsx","../src/Ribbon.tsx","../src/StatusBar.tsx","../src/HyperlinkPopup.tsx","../src/customization-hooks.ts","../src/usePptxSource.ts","../src/useParagraphFormat.ts","../src/useFontFormat.ts","../src/useBulletFormat.ts","../src/useFonts.ts","../src/useFontFamily.ts"],"sourcesContent":["/**\n * `@pptx-editor.dev/react` — the React adapter for PPTX Editor.\n *\n * Provider-first: `PptxEditor.Root` owns the engine instance; `.Viewport` scopes the styles;\n * `.Content` attaches the slide surface. Every piece of chrome is a hook consumer, and the\n * toolbar derives from the engine's `CHROME_GROUPS`.\n *\n * @packageDocumentation\n * @public\n */\n\nimport { createElement, forwardRef, useMemo, type FunctionComponent, type ReactNode } from 'react';\nimport type { ToolbarProps } from './Toolbar.tsx';\nimport { withChromeTranslate } from './headless-hooks.tsx';\nimport { MenuTableGrid } from './TableControls.tsx';\nimport {\n warnOpenFailureActions,\n type ColorMode,\n type EditorFontError,\n type EditorFontsOption,\n type EditorMode,\n type EditorModule,\n type PptxEditorInstance,\n} from '@pptx-editor.dev/core/editor';\nimport type { LocaleCatalog } from '@pptx-editor.dev/i18n';\nimport {\n PptxEditorContent,\n PptxEditorRoot,\n PptxEditorViewport,\n type PptxEditorRef,\n} from './PptxEditorRoot.tsx';\nimport { Toolbar as ToolbarRoot, ToolbarControl, ToolbarGroup, ToolbarSlot } from './Toolbar.tsx';\nimport { ToolbarAction, ToolbarSeparator } from './toolbar-action.tsx';\nimport { TOOLBAR_PARTS, type ToolbarNamedParts } from './toolbar-named-parts.tsx';\nimport {\n NotesPane,\n SidePanel,\n SlideRail as SlideRailRoot,\n ZoomPill,\n type NotesPaneProps,\n type SlideRailProps,\n} from './panes.tsx';\nimport {\n SlideRailAddSlide,\n SlideRailChooseLayout,\n SlideRailCollapse,\n SlideRailExpand,\n SlideRailDelete,\n SlideRailDuplicate,\n SlideRailMoveEarlier,\n SlideRailMoveLater,\n} from './rail-parts.tsx';\nimport { FontNotice } from './FontNotice.tsx';\nimport { EditNotice } from './EditNotice.tsx';\nimport {\n OpenFailure,\n type OpenFailureContext,\n type PptxEditorOpenFailureProps,\n} from './OpenFailure.tsx';\nimport { Loading } from './Loading.tsx';\nimport { PageSetupDialog } from './PageSetupDialog.tsx';\nimport { BackgroundDialog } from './BackgroundDialog.tsx';\nimport { ImageAltTextDialog } from './ImageAltTextDialog.tsx';\nimport { ImagePropertiesDialog } from './ImagePropertiesDialog.tsx';\nimport { ParagraphDialog } from './ParagraphDialog.tsx';\nimport { FontDialog } from './FontDialog.tsx';\nimport { BulletsAndNumberingDialog } from './BulletsAndNumberingDialog.tsx';\nimport { ColumnsDialog } from './ColumnsDialog.tsx';\nimport { Slideshow } from './Slideshow.tsx';\nimport { FindBar } from './FindBar.tsx';\nimport { DefaultWorkspace, SlideSorter } from './SlideSorter.tsx';\nimport type { PptxEditorPopups } from './popups.tsx';\nimport {\n MENU_PARTS,\n MENU_ROW_PARTS,\n Menu as MenuRoot,\n MenuEntry,\n MenuGroup,\n MenuSlotItem,\n type MenuPartComponent,\n type MenuProps,\n type MenuRowPartComponent,\n} from './menu-parts.tsx';\nimport {\n CONTEXT_MENU_ROW_PARTS,\n PptxEditorContextMenu as ContextMenuRoot,\n type PptxEditorContextMenuProps,\n} from './context-menu-parts.tsx';\nimport type { ContextMenuPartName, MenuRowPartName } from '@pptx-editor.dev/core/editor';\nimport { MenuRow, MenuSeparator, MenuSubmenu } from './ContextMenu.tsx';\nimport { Ribbon as RibbonRoot, RibbonTab, type RibbonProps } from './Ribbon.tsx';\nimport {\n StatusBar as StatusBarRoot,\n StatusBarNotes,\n StatusBarSlideNumber,\n StatusBarViews,\n StatusBarZoom,\n type StatusBarProps,\n} from './StatusBar.tsx';\n\nexport {\n PptxEditorContext,\n usePptxEditor,\n useEditorState,\n useEditorCommand,\n useEditorValueCommand,\n useTranslation,\n useSlideshow,\n translatorFor,\n SlideshowContext,\n type UseEditorCommandReturn,\n type UseEditorValueCommandReturn,\n type UseSlideshowReturn,\n} from './context.ts';\nexport {\n PptxEditorRoot,\n PptxEditorViewport,\n PptxEditorContent,\n type PptxEditorContentProps,\n type PptxEditorRef,\n type PptxEditorRootProps,\n type PptxEditorViewportProps,\n} from './PptxEditorRoot.tsx';\nexport {\n ToolbarControl,\n ToolbarGroup,\n ToolbarSlot,\n type ToolbarControlProps,\n type ToolbarProps,\n} from './Toolbar.tsx';\nexport type {\n ToolbarColorSplitComponent,\n ToolbarColorSplitProps,\n ToolbarGroupProps,\n ToolbarPartComponent,\n ToolbarPartProps,\n ToolbarSlotPartComponent,\n ToolbarSlotPartProps,\n ToolbarSlotBaseProps,\n ToolbarSlotProps,\n} from './toolbar-parts.tsx';\nexport {\n ToolbarAction,\n ToolbarSeparator,\n type ToolbarActionProps,\n type ToolbarSeparatorProps,\n} from './toolbar-action.tsx';\nexport type { ToolbarNamedParts } from './toolbar-named-parts.tsx';\nexport type {\n FontFamilyItemProps,\n FontFamilyNamespace,\n FontFamilyPartProps,\n FontFamilyProps,\n} from './FontFamilyControl.tsx';\nexport {\n definePopup,\n type DefinePopupOptions,\n useEditorDialog,\n type UseEditorDialogReturn,\n type PptxEditorDialogKey,\n type PptxEditorPopup,\n type PptxEditorPopups,\n type FindPopupProps,\n type HyperlinkPopupProps,\n} from './popups.tsx';\nexport { HyperlinkPopup } from './HyperlinkPopup.tsx';\nimport { HyperLink } from './HyperLink.tsx';\nexport {\n HyperLink,\n type HyperLinkActionProps,\n type HyperLinkNamespace,\n type HyperLinkPartProps,\n type HyperLinkProps,\n} from './HyperLink.tsx';\nexport {\n RailContextMenu,\n type RailContextMenuProps,\n type RailMenuState,\n} from './RailContextMenu.tsx';\nexport {\n SectionContextMenu,\n type SectionContextMenuProps,\n type SectionMenuState,\n} from './RailSections.tsx';\nexport {\n MenuEntry,\n MenuGroup,\n MenuSlotItem,\n type MenuEntryProps,\n type MenuGroupProps,\n type MenuSlotItemProps,\n type MenuPartComponent,\n type MenuProps,\n type MenuRowPartComponent,\n type MenuRowPartProps,\n} from './menu-parts.tsx';\nexport type {\n ContextMenuPartName,\n MenuNamedRow,\n MenuRowPartName,\n} from '@pptx-editor.dev/core/editor';\nexport {\n useContextMenuRequest,\n useContextMenuTarget,\n type ContextMenuRequest,\n type PptxEditorContextMenuProps,\n} from './context-menu-parts.tsx';\n\n/**\n * `PptxEditor.Toolbar` with its statics, as DOCX Editor's `DocxEditorToolbarNamespace`. @public\n */\nexport interface PptxEditorToolbarNamespace extends ToolbarNamedParts {\n /** The toolbar, with every registered group. See `ToolbarProps`. */\n (props: ToolbarProps): ReactNode;\n /** Changes, replaces, or hides one registered control. */\n readonly Slot: typeof ToolbarSlot;\n /** Changes a built-in group or adds a host group. */\n readonly Group: typeof ToolbarGroup;\n /** A host-owned action the chrome registry does not describe. */\n readonly Action: typeof ToolbarAction;\n /** A vertical rule between controls. */\n readonly Separator: typeof ToolbarSeparator;\n}\n\n/**\n * The toolbar, with its parts: `Toolbar.Slot` changes or replaces one registered control,\n * `Toolbar.Group` changes a built-in group or adds a host group, `Toolbar.Action` is a host's\n * own button, and the named parts (`Toolbar.Bold`, `Toolbar.FontFamily`, …) stand for one slot\n * each. @public\n */\nexport const Toolbar: PptxEditorToolbarNamespace = Object.assign(\n withChromeTranslate<ToolbarProps>(ToolbarRoot, 'Toolbar'),\n {\n ...TOOLBAR_PARTS,\n Slot: ToolbarSlot,\n Group: ToolbarGroup,\n Action: ToolbarAction,\n Separator: ToolbarSeparator,\n }\n);\n/**\n * The named rows of the menu bar (`Menu.Cut`, `Menu.PageSetup`, …), one per row of core's\n * `MENU_NAMED_PARTS`. Put one in the menu that holds its row. @public\n */\nexport type MenuNamedRows = { readonly [K in MenuRowPartName]: MenuRowPartComponent };\n\n/**\n * The named rows of the canvas context menu (`ContextMenu.Cut`, `ContextMenu.MergeCells`, …),\n * one per row of core's `CONTEXT_MENU_NAMED_PARTS`. @public\n */\nexport type ContextMenuNamedRows = {\n readonly [K in ContextMenuPartName]: MenuRowPartComponent;\n};\n\n/** The menu bar with its parts attached as statics. @public */\nexport interface MenuNamespace extends MenuNamedRows {\n /** The menu bar. See `MenuProps`. */\n (props: MenuProps): ReactNode;\n /** A menu of the bar: a built-in id changes it, another id adds a host menu. */\n readonly Entry: typeof MenuEntry;\n /** A row for a registered slot. */\n readonly Item: typeof MenuSlotItem;\n /** A host row: label, icon, shortcut, and an action. */\n readonly Row: typeof MenuRow;\n /** A labeled set of rows. */\n readonly Group: typeof MenuGroup;\n /** A line between rows. */\n readonly Separator: typeof MenuSeparator;\n /** A row that opens a nested panel. */\n readonly Submenu: typeof MenuSubmenu;\n /** The Insert > Table grid, for a host's own Table submenu (DOCX Editor's `Menu.TableGrid`). */\n readonly TableGrid: typeof MenuTableGrid;\n /** The File menu. */\n readonly File: MenuPartComponent;\n /** The Edit menu. */\n readonly Edit: MenuPartComponent;\n /** The View menu. */\n readonly View: MenuPartComponent;\n /** The Insert menu. */\n readonly Insert: MenuPartComponent;\n /** The Format menu. */\n readonly Format: MenuPartComponent;\n /** The Arrange menu. */\n readonly Arrange: MenuPartComponent;\n /** The Slide Show menu. */\n readonly SlideShow: MenuPartComponent;\n}\n\n/**\n * The menu bar (`PptxEditor.Menu`): File, Edit, View, Insert, Format, Arrange, and Slide Show,\n * with DOCX Editor's parts (`Entry`, `Item`, `Row`, `Group`, `Separator`, `Submenu`) and one\n * named part per menu (`Menu.File`, …). @public\n */\nexport const PptxEditorMenu: MenuNamespace = Object.assign(\n withChromeTranslate<MenuProps>(MenuRoot, 'Menu'),\n {\n ...MENU_ROW_PARTS,\n ...MENU_PARTS,\n Entry: MenuEntry,\n Item: MenuSlotItem,\n Row: MenuRow,\n Group: MenuGroup,\n Separator: MenuSeparator,\n Submenu: MenuSubmenu,\n TableGrid: MenuTableGrid,\n }\n);\n\n/** The canvas context menu with its parts attached as statics. @public */\nexport interface ContextMenuNamespace extends ContextMenuNamedRows {\n /** The canvas context menu, for the target that opened it. See `PptxEditorContextMenuProps`. */\n (props: PptxEditorContextMenuProps): ReactNode;\n /** A row for a registered slot; replaces or hides the built-in row of the same slot. */\n readonly Slot: typeof MenuSlotItem;\n /** A host row: label, icon, shortcut, and an action. */\n readonly Item: typeof MenuRow;\n /** A labeled set of rows. */\n readonly Group: typeof MenuGroup;\n /** A line between rows. */\n readonly Separator: typeof MenuSeparator;\n /** A row that opens a nested panel. */\n readonly Submenu: typeof MenuSubmenu;\n}\n\n/**\n * The slide canvas's context menu (`PptxEditor.ContextMenu`), with DOCX Editor's parts (`Slot`,\n * `Item`, `Group`, `Separator`, `Submenu`). Place it in the root or the viewport, or render it\n * in `popups.contextMenu`. @public\n */\nexport const PptxEditorContextMenu: ContextMenuNamespace = Object.assign(\n withChromeTranslate<PptxEditorContextMenuProps>(ContextMenuRoot, 'ContextMenu'),\n {\n ...CONTEXT_MENU_ROW_PARTS,\n Slot: MenuSlotItem,\n Item: MenuRow,\n Group: MenuGroup,\n Separator: MenuSeparator,\n Submenu: MenuSubmenu,\n }\n);\n\nexport { RibbonTab, type RibbonProps, type RibbonTabProps } from './Ribbon.tsx';\n\n/** The ribbon with its parts attached as statics. @public */\nexport interface RibbonNamespace {\n /** The ribbon. See `RibbonProps`. */\n (props: RibbonProps): ReactNode;\n /** A tab: a built-in id changes it, another id adds a host tab. */\n readonly Tab: typeof RibbonTab;\n}\n\n/**\n * The ribbon (`PptxEditor.Ribbon`): the reference PDF's tabs over the toolbar's\n * groups, with the Quick Access Toolbar and contextual tabs. Each tab panel takes toolbar\n * children (`Toolbar.Slot`, named parts, `Toolbar.Group`, `Toolbar.Action`) through\n * `Ribbon.Tab`. @public\n */\nexport const PptxEditorRibbon: RibbonNamespace = Object.assign(RibbonRoot, { Tab: RibbonTab });\n\nexport {\n StatusBarNotes,\n StatusBarSlideNumber,\n StatusBarViews,\n StatusBarZoom,\n type StatusBarNotesProps,\n type StatusBarPartProps,\n type StatusBarProps,\n} from './StatusBar.tsx';\n\n/** The status bar with its parts attached as statics. @public */\nexport interface StatusBarNamespace {\n /** The status bar. See `StatusBarProps`. */\n (props: StatusBarProps): ReactNode;\n /** \"Slide x of y\". */\n readonly SlideNumber: typeof StatusBarSlideNumber;\n /** The Notes button. */\n readonly Notes: typeof StatusBarNotes;\n /** The view switch. */\n readonly Views: typeof StatusBarViews;\n /** The zoom pill. */\n readonly Zoom: typeof StatusBarZoom;\n /** A host-owned button with the bar's styling: the same component as `Toolbar.Action`. */\n readonly Action: typeof ToolbarAction;\n}\n\n/**\n * The status bar (`PptxEditor.StatusBar`): slide x of y, the Notes button, the view switch,\n * and the zoom pill. @public\n */\nexport const PptxEditorStatusBar: StatusBarNamespace = Object.assign(\n withChromeTranslate<StatusBarProps>(StatusBarRoot, 'StatusBar'),\n {\n SlideNumber: StatusBarSlideNumber,\n Notes: StatusBarNotes,\n Views: StatusBarViews,\n Zoom: StatusBarZoom,\n Action: ToolbarAction,\n }\n);\n\nexport {\n SlideRailAddSlide,\n SlideRailChooseLayout,\n SlideRailCollapse,\n SlideRailExpand,\n SlideRailDelete,\n SlideRailDuplicate,\n SlideRailMoveEarlier,\n SlideRailMoveLater,\n type SlideRailPartProps,\n} from './rail-parts.tsx';\n\n/** The slide rail with its action parts attached as statics, as `StatusBarNamespace`. @public */\nexport interface SlideRailNamespace {\n /** The slide rail. See `SlideRailProps`. */\n (props: SlideRailProps): ReactNode;\n /** Add slide. */\n readonly AddSlide: typeof SlideRailAddSlide;\n /** The layout gallery button. */\n readonly ChooseLayout: typeof SlideRailChooseLayout;\n /** Duplicate the selected slides. */\n readonly Duplicate: typeof SlideRailDuplicate;\n /** Move the selected slides earlier. */\n readonly MoveEarlier: typeof SlideRailMoveEarlier;\n /** Move the selected slides later. */\n readonly MoveLater: typeof SlideRailMoveLater;\n /** Delete the selected slides. */\n readonly Delete: typeof SlideRailDelete;\n /** Hide thumbnails. */\n readonly Collapse: typeof SlideRailCollapse;\n /** Show thumbnails: the button of the folded strip. */\n readonly Expand: typeof SlideRailExpand;\n /** A host-owned button with the rail's styling: the same component as `Toolbar.Action`. */\n readonly Action: typeof ToolbarAction;\n}\n\n/**\n * The slide rail (`PptxEditor.SlideRail`) with its action parts: a named part child replaces\n * its button, `hidden` removes it, other children go after Delete, and `preset={false}` renders\n * only the children. @public\n */\nexport const SlideRail: SlideRailNamespace = Object.assign(\n withChromeTranslate<SlideRailProps>(SlideRailRoot, 'SlideRail'),\n {\n AddSlide: SlideRailAddSlide,\n ChooseLayout: SlideRailChooseLayout,\n Duplicate: SlideRailDuplicate,\n MoveEarlier: SlideRailMoveEarlier,\n MoveLater: SlideRailMoveLater,\n Delete: SlideRailDelete,\n Collapse: SlideRailCollapse,\n Expand: SlideRailExpand,\n Action: ToolbarAction,\n }\n);\n\nexport {\n NotesPane,\n ZoomPill,\n SidePanel,\n type NotesPaneProps,\n type PaneProps,\n type SidePanelProps,\n type SlideRailProps,\n type ZoomPillProps,\n} from './panes.tsx';\nexport { useNotesPane, type UseNotesPaneReturn } from './pane-state.ts';\nexport { useEditorColorMode, type UseEditorColorModeReturn } from './color-mode.ts';\nexport {\n ToolbarContext,\n useChromeTranslate,\n useDocumentSearch,\n useEditorCaret,\n useHistoryGroup,\n useToolbarContext,\n useToolbarLabel,\n useToolbarLabelFor,\n type ToolbarContextValue,\n type UseDocumentSearchResult,\n type UseHistoryGroupReturn,\n} from './headless-hooks.tsx';\nexport type {\n ChromeTranslate,\n DocumentSearchFindOptions,\n DocumentSearchState,\n EditorCaret,\n HistoryGroupBindingOptions,\n} from '@pptx-editor.dev/core/editor';\nexport {\n useEditorEvent,\n useEditorSnapshot,\n useScopeClassName,\n useZoom,\n type UseZoomResult,\n} from './customization-hooks.ts';\nexport type { PptxEditorEvents } from '@pptx-editor.dev/core/editor';\nexport type { ColorMode, ResolvedColorMode } from '@pptx-editor.dev/core/editor';\nexport { ShapeStyleGallery, type ShapeStyleGalleryProps } from './ShapeFormatControls.tsx';\nexport { FontNotice, type FontNoticeProps } from './FontNotice.tsx';\nexport { MenuTableGrid, type MenuTableGridProps } from './TableControls.tsx';\nexport { EditNotice, rejectionMessage, type EditNoticeProps } from './EditNotice.tsx';\nexport {\n OpenFailure,\n useOpenFailure,\n type OpenFailureContext,\n type PptxEditorOpenFailureProps,\n type UseOpenFailureOptions,\n type UseOpenFailureReturn,\n} from './OpenFailure.tsx';\nexport {\n useHyperlinkPopup,\n useHyperlinkPopupInstance,\n type UseHyperlinkPopupResult,\n} from './useHyperlinkPopup.ts';\nexport type {\n HyperlinkPopupActions,\n HyperlinkPopupLink,\n HyperlinkPopupMode,\n HyperlinkPopupState,\n} from '@pptx-editor.dev/core/editor';\nexport {\n useEditorHostDocument,\n usePptxSource,\n type UseEditorHostDocumentReturn,\n type UsePptxSourceResult,\n} from './usePptxSource.ts';\nexport type {\n PptxFontOrigin,\n PptxFontsInput,\n PptxFontsSource,\n PptxSource,\n UsePptxSourceOptions,\n} from '@pptx-editor.dev/core/editor';\nexport {\n Loading,\n LoadingSpinner,\n type LoadingComponent,\n type LoadingProps,\n type LoadingSpinnerProps,\n} from './Loading.tsx';\nexport {\n FillControl,\n GradientDialog,\n LineGlyph,\n LineMenuControl,\n ShapeGalleryControl,\n ShapeGrid,\n ShapeIcon,\n type FillControlProps,\n type GradientDialogProps,\n type LineGlyphProps,\n type LineMenuControlProps,\n type ShapeGalleryControlProps,\n type ShapeGridProps,\n type ShapeIconProps,\n} from './ShapeControls.tsx';\nexport { SlideSorter, type SlideSorterProps } from './SlideSorter.tsx';\nexport { requestSectionRename } from './RailSections.tsx';\nexport {\n LayoutControl,\n LayoutGallery,\n NewSlideControl,\n useSlideLayouts,\n type LayoutControlProps,\n type LayoutGalleryProps,\n type NewSlideControlProps,\n} from './SlideControls.tsx';\nexport { gradientCss } from '@pptx-editor.dev/core/editor';\nexport {\n PageSetupDialog,\n usePageSetupDialog,\n type PageSetupDialogFieldName,\n type PageSetupDialogFields,\n type PageSetupDialogProps,\n type UsePageSetupDialogReturn,\n} from './PageSetupDialog.tsx';\nexport {\n BackgroundDialog,\n useBackgroundDialog,\n type BackgroundDialogFieldName,\n type BackgroundDialogFields,\n type BackgroundDialogProps,\n type UseBackgroundDialogReturn,\n} from './BackgroundDialog.tsx';\nexport {\n ImageAltTextDialog,\n useImageAltTextDialog,\n type ImageAltTextDialogFieldName,\n type ImageAltTextDialogFields,\n type ImageAltTextDialogProps,\n type UseImageAltTextDialogReturn,\n} from './ImageAltTextDialog.tsx';\nexport {\n ImagePropertiesDialog,\n useImagePropertiesDialog,\n type ImagePropertiesDialogFieldName,\n type ImagePropertiesDialogFields,\n type ImagePropertiesDialogProps,\n type UseImagePropertiesDialogReturn,\n} from './ImagePropertiesDialog.tsx';\nexport type {\n DialogCustomizationProps,\n DialogPartProps,\n UseDialogReturn,\n} from './dialog-parts.tsx';\nexport {\n ParagraphDialog,\n useParagraphDialog,\n type ParagraphDialogFieldName,\n type ParagraphDialogProps,\n type UseParagraphDialogReturn,\n} from './ParagraphDialog.tsx';\nexport {\n FontDialog,\n useFontDialog,\n type FontDialogFieldName,\n type FontDialogProps,\n type UseFontDialogReturn,\n} from './FontDialog.tsx';\nexport {\n BulletsAndNumberingDialog,\n useBulletsAndNumberingDialog,\n type BulletsAndNumberingDialogFieldName,\n type BulletsAndNumberingDialogProps,\n type UseBulletsAndNumberingDialogReturn,\n} from './BulletsAndNumberingDialog.tsx';\nexport {\n ColumnsDialog,\n useColumnsDialog,\n type ColumnsDialogFieldName,\n type ColumnsDialogProps,\n type UseColumnsDialogReturn,\n} from './ColumnsDialog.tsx';\nexport { useParagraphFormat, type UseParagraphFormatReturn } from './useParagraphFormat.ts';\nexport { useFontFormat, type UseFontFormatReturn } from './useFontFormat.ts';\nexport { useBulletFormat, type UseBulletFormatReturn } from './useBulletFormat.ts';\n// The hook's value types, next to the hook, as DOCX Editor exports them with `useParagraphFormat`.\nexport type {\n BulletFormat,\n BulletFormatRead,\n FontFormatCommand,\n FontFormatRead,\n ParagraphFormatCommand,\n ParagraphFormatRead,\n} from '@pptx-editor.dev/core/editor';\nexport { useFonts, type FontsInput, type UseFontsReturn } from './useFonts.ts';\nexport { useFontFamily, type UseFontFamilyReturn } from './useFontFamily.ts';\nexport { EditorFontError } from '@pptx-editor.dev/core/editor';\nexport type {\n EditorFontErrorCode,\n FontConfiguration,\n FontFaceRequest,\n FontSource,\n FontSourceSubstitution,\n} from '@pptx-editor.dev/core/contracts';\n// The font-composition surface, re-exported as DOCX Editor's adapters do, so the common path\n// (a fonts package and an adapter) never needs a core import.\nexport {\n MAX_RESOLVER_FAMILIES,\n DEFAULT_FONT,\n composeFontConfiguration,\n composeFontOrigins,\n createFontSource,\n deferFonts,\n defineFontResolver,\n isFontResolver,\n loadFonts,\n type FontConfigurationBase,\n type FontConfigurationFragment,\n type FontLoadFailure,\n type FontLoadFailureReason,\n type FontOrigin,\n type FontResolutionRequest,\n type FontResolver,\n type FontResolverMark,\n type MarkedFontResolver,\n type FontUrlSource,\n type LoadFontsRequest,\n type LoadFontsResult,\n} from '@pptx-editor.dev/core/editor';\n// The core types that the adapter's own props, hooks, and parts use, re-exported as DOCX\n// Editor's adapters re-export `Editor`, `EditorCommand`, and `EditorSnapshot`, so a host types\n// its handlers with an import from this package only.\nexport type {\n BulletsDialogFields,\n CanvasMenuKind,\n ChromeControl,\n ChromeGroupId,\n ChromeMenuId,\n ChromeSlotId,\n ColumnsDialogFields,\n CommandResult,\n DocumentOpenFailure,\n EditorCommand,\n EditorExecOptions,\n EditorFontsOption,\n EditorMode,\n EditorModule,\n EditorRejection,\n EditorRemoval,\n EditorSnapshot,\n FontDialogFields,\n FontPickerGroup,\n FontPickerGroupId,\n FontPickerRow,\n GradientFill,\n ParagraphDialogFields,\n PptxEditorInstance,\n RibbonTabId,\n ShapeStyleChoice,\n ShapeStyleValue,\n SlideBackground,\n SlideLayoutSummary,\n SlideRailOrientation,\n SlideSection,\n SlideshowController,\n ToolbarShownValue,\n ToolbarValueMap,\n} from '@pptx-editor.dev/core/editor';\nexport { Slideshow } from './Slideshow.tsx';\nexport { FindBar, requestFindBar, type FindBarProps } from './FindBar.tsx';\nexport { platformShortcuts } from './context.ts';\nexport {\n Icon,\n ToolButton,\n Popover,\n MenuItem,\n keepFocus,\n type IconProps,\n type MenuItemProps,\n type PopoverProps,\n type ToolButtonProps,\n} from './chrome.tsx';\nexport {\n ContextMenu,\n MenuRow,\n MenuSeparator,\n MenuSubmenu,\n type ContextMenuPoint,\n type ContextMenuProps,\n type MenuRowProps,\n type MenuSubmenuProps,\n} from './ContextMenu.tsx';\n\n/** Props of the `<PptxEditor>` sugar component. @public */\nexport interface PptxEditorProps {\n /** `.pptx` bytes. Identity change loads the new document. */\n readonly document?: Uint8Array;\n /** `'edit'` (default) or `'view'`. Changes apply without a reload. */\n readonly mode?: EditorMode;\n /** UI locale catalog, as on `PptxEditor.Root`. English when omitted. */\n readonly locale?: LocaleCatalog;\n /** Fired once per instance after it is published, as on `PptxEditor.Root`. */\n readonly onReady?: (editor: PptxEditorInstance) => void;\n /** Fired after every change of editor state, as on `PptxEditor.Root`. */\n readonly onChange?: (editor: PptxEditorInstance) => void;\n /** Appended after the `pptx-default` class of the viewport. */\n readonly className?: string;\n /** Customize the dialogs the editor mounts, as on `PptxEditor.Root`. */\n readonly popups?: PptxEditorPopups;\n /** The chrome color mode, as on `PptxEditor.Root`. */\n readonly colorMode?: ColorMode;\n /** Font bytes for the host's faces, as on `PptxEditor.Root`. */\n readonly fonts?: EditorFontsOption;\n /** Called for each font failure, as on `PptxEditor.Root`. */\n readonly onFontError?: (error: EditorFontError) => void;\n /** Families the font picker offers, as on `PptxEditor.Root`. A change applies in place. */\n readonly fontFamilies?: readonly string[];\n /** Capability modules (`@pptx-editor.dev/pro`), as on `PptxEditor.Root`. Read at mount. */\n readonly modules?: readonly EditorModule[];\n /**\n * The notice for a file that does not open (`PptxEditor.OpenFailure`). An object is\n * `PptxEditorOpenFailureProps`, passed straight through. `false` removes the notice, for a host that\n * reports the failure itself through `useOpenFailure`. Default `true`.\n */\n readonly openFailure?: boolean | PptxEditorOpenFailureProps;\n /**\n * Your own buttons in the open-failure notice, before **Close**. It replaces\n * `openFailure.actions`; pass only one. With `openFailure={false}` it renders nothing. Both\n * cases print a development warning.\n */\n readonly renderOpenFailureActions?: (context: OpenFailureContext) => ReactNode;\n /**\n * The toolbar (`PptxEditor.Toolbar`). An object is `ToolbarProps`, passed straight through,\n * so `toolbar={{ children: <PptxEditor.Toolbar.Bold hidden /> }}` changes one control.\n * `false` removes it. Default `true`.\n */\n readonly toolbar?: boolean | ToolbarProps;\n /**\n * The menu bar (`PptxEditor.Menu`), above the toolbar. An object is `MenuProps`, passed\n * straight through, as DOCX Editor's `menu`. Default `false`: the packaged editor shows the\n * toolbar only.\n */\n readonly menu?: boolean | MenuProps;\n /**\n * The slide canvas's context menu. An object is `PptxEditorContextMenuProps`, passed straight\n * through, so `contextMenu={{ children: <PptxEditor.ContextMenu.Cut hidden /> }}` changes one\n * row. `false` shows no menu. It sets `popups.contextMenu`, and a `popups.contextMenu` entry\n * wins over it. Default `true`.\n */\n readonly contextMenu?: boolean | PptxEditorContextMenuProps;\n /**\n * The packaged link popup. `false` removes it, as `popups.hyperlink: false` does: a host\n * panel that reads `useHyperlinkPopup()` then opens for the link controls. A\n * `popups.hyperlink` entry wins over it. Default `true`.\n */\n readonly hyperlinkPopup?: boolean;\n /**\n * The slide rail (`PptxEditor.SlideRail`), as DOCX Editor's `navigation`. An object is\n * `SlideRailProps`, passed straight through, so `slideRail={{ open, onOpenChange }}` drives\n * it from your own chrome. `false` removes it. Default `true`.\n */\n readonly slideRail?: boolean | SlideRailProps;\n /**\n * The speaker notes pane (`PptxEditor.NotesPane`). An object is `NotesPaneProps`, passed\n * straight through. `false` removes it. Default `true`.\n */\n readonly notesPane?: boolean | NotesPaneProps;\n /** Extra content inside the viewport, after the slide show. */\n readonly children?: ReactNode;\n}\n\n/** The props an object value gives, or none for `true`. */\nconst partProps = <P extends object>(value: boolean | P | undefined): P =>\n typeof value === 'object' ? value : ({} as P);\n\n/**\n * The `popups` the sugar passes to the root: the host's entries, with `contextMenu` and\n * `hyperlinkPopup` mapped onto the same entries. A host entry wins.\n */\nfunction sugarPopups(\n popups: PptxEditorPopups | undefined,\n hyperlinkPopup: boolean | undefined,\n contextMenu: boolean | PptxEditorContextMenuProps | undefined\n): PptxEditorPopups | undefined {\n const linkOff = hyperlinkPopup === false && popups?.hyperlink === undefined;\n const menuEntry =\n popups?.contextMenu !== undefined || contextMenu === undefined || contextMenu === true\n ? undefined\n : contextMenu === false\n ? (false as const)\n : (props: PptxEditorContextMenuProps) =>\n createElement(PptxEditorContextMenu, { ...props, ...contextMenu });\n if (!linkOff && menuEntry === undefined) return popups;\n return {\n ...popups,\n ...(linkOff ? { hyperlink: false as const } : {}),\n ...(menuEntry !== undefined ? { contextMenu: menuEntry } : {}),\n };\n}\n\nconst OPEN_FAILURE_ACTION_NAMES = {\n actions: 'renderOpenFailureActions',\n off: 'openFailure={false}',\n} as const;\n\n/**\n * The complete default editor: toolbar, slide rail, canvas, speaker notes, zoom pill, and the\n * slide show (F5).\n * Sugar over the same primitives a custom layout composes. Takes a `ref` to a `PptxEditorRef`.\n *\n * @public\n */\nconst PptxEditorDefault = forwardRef<PptxEditorRef, PptxEditorProps>(function PptxEditor(\n {\n document,\n mode = 'edit',\n locale,\n onReady,\n onChange,\n className,\n popups,\n colorMode,\n fonts,\n onFontError,\n fontFamilies,\n modules,\n openFailure = true,\n renderOpenFailureActions,\n toolbar = true,\n menu = false,\n contextMenu,\n hyperlinkPopup,\n slideRail = true,\n notesPane = true,\n children,\n },\n ref\n) {\n warnOpenFailureActions(\n openFailure,\n renderOpenFailureActions !== undefined,\n OPEN_FAILURE_ACTION_NAMES\n );\n // Memoized, so stable props give the root the same `popups` at each render.\n const rootPopups = useMemo(\n () => sugarPopups(popups, hyperlinkPopup, contextMenu),\n [popups, hyperlinkPopup, contextMenu]\n );\n const dock =\n menu === false && toolbar === false\n ? null\n : createElement(\n 'div',\n { className: 'pptx-default__dock' },\n menu === false ? null : createElement(PptxEditorMenu, partProps(menu)),\n toolbar === false ? null : createElement(Toolbar, partProps(toolbar))\n );\n return createElement(\n PptxEditorRoot,\n {\n ref,\n ...(document ? { document } : {}),\n mode,\n ...(locale ? { locale } : {}),\n ...(onReady ? { onReady } : {}),\n ...(onChange ? { onChange } : {}),\n ...(rootPopups ? { popups: rootPopups } : {}),\n ...(colorMode ? { colorMode } : {}),\n ...(fonts ? { fonts } : {}),\n ...(onFontError ? { onFontError } : {}),\n ...(fontFamilies ? { fontFamilies } : {}),\n ...(modules ? { modules } : {}),\n },\n createElement(\n PptxEditorViewport,\n { className: `pptx-default${className ? ` ${className}` : ''}` },\n dock,\n createElement(DefaultWorkspace, {\n overlay:\n openFailure === false\n ? null\n : createElement(OpenFailure, {\n ...(typeof openFailure === 'object' ? openFailure : {}),\n ...(renderOpenFailureActions ? { actions: renderOpenFailureActions } : {}),\n }),\n normal: createElement(\n 'div',\n { className: 'pptx-default__workspace' },\n slideRail === false ? null : createElement(SlideRail, partProps(slideRail)),\n createElement(\n 'div',\n { className: 'pptx-default__main' },\n createElement(PptxEditorContent),\n createElement(FindBar),\n createElement(EditNotice),\n createElement(Loading, { overlay: true }),\n createElement(FontNotice),\n notesPane === false\n ? null\n : createElement(NotesPane as FunctionComponent<NotesPaneProps>, partProps(notesPane))\n )\n ),\n }),\n createElement(Slideshow),\n children\n )\n );\n});\n\n/** The compound namespace plus the sugar component. @public */\nexport const PptxEditor = Object.assign(PptxEditorDefault, {\n Root: PptxEditorRoot,\n Viewport: PptxEditorViewport,\n Content: PptxEditorContent,\n Toolbar,\n ToolbarControl,\n SlideRail,\n SlideSorter,\n NotesPane,\n ZoomPill,\n SidePanel,\n FontNotice,\n EditNotice,\n OpenFailure,\n Loading,\n PageSetupDialog,\n BackgroundDialog,\n ImageAltTextDialog,\n ImagePropertiesDialog,\n ParagraphDialog,\n FontDialog,\n BulletsAndNumberingDialog,\n ColumnsDialog,\n Slideshow,\n FindBar,\n HyperLink,\n Menu: PptxEditorMenu,\n ContextMenu: PptxEditorContextMenu,\n Ribbon: PptxEditorRibbon,\n StatusBar: PptxEditorStatusBar,\n});\n","/** @jsxImportSource react */\n// The hooks for a host's own chrome that keep DOCX Editor's names and shapes:\n// `useChromeTranslate` and the compounds' `t` prop, `useToolbarContext`, `useToolbarLabel`,\n// `useToolbarLabelFor`, `useHistoryGroup`, `useEditorCaret`, and `useDocumentSearch`. The\n// behavior is in core (`bind-history-group.ts`, `document-search.ts`, `editorCaretOf`); each\n// hook is a subscription and a call. The Vue twins are in `headless-hooks.ts` of the Vue\n// adapter.\n\nimport {\n createContext,\n createElement,\n useCallback,\n useContext,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n type ComponentType,\n type ReactNode,\n} from 'react';\nimport {\n IDLE_DOCUMENT_SEARCH,\n bindHistoryGroup,\n documentSearchOf,\n editorCaretOf,\n type ChromeTranslate,\n type DocumentSearchFindOptions,\n type DocumentSearchState,\n type EditorCaret,\n type EditorExecOptions,\n type FindMatch,\n type HistoryGroupBinding,\n type HistoryGroupBindingOptions,\n} from '@pptx-editor.dev/core/editor';\nimport type { Translate, TranslationKey } from '@pptx-editor.dev/i18n';\nimport { TranslationContext, useTranslation, usePptxEditor } from './context.ts';\n\n// --- Translation ----------------------------------------------------------------------------\n\n/**\n * The chrome's translation function, as DOCX Editor's `useChromeTranslate`: the `t` of the\n * nearest compound that takes one, else the root's `locale`. `overrides` wins for the keys it\n * holds. Use it for the labels of your own parts, so they follow the same language.\n *\n * @example\n * ```tsx\n * const t = useChromeTranslate();\n * <PptxEditor.Toolbar.Action label={t('toolbar.save')} onSelect={save} />\n * ```\n *\n * @public\n */\nexport function useChromeTranslate(overrides?: ReadonlyMap<string, string>): ChromeTranslate {\n const { t } = useTranslation();\n return useCallback(\n (key: string, params?: Readonly<Record<string, string | number>>) =>\n overrides?.get(key) ?? t(key as TranslationKey, params),\n [overrides, t]\n );\n}\n\n/** What a compound's `t` prop publishes to its parts, as DOCX Editor's toolbar context. @public */\nexport interface ToolbarContextValue {\n /** The host's `t` on the nearest compound, or undefined. */\n readonly t: ChromeTranslate | undefined;\n}\n\n/** The nearest compound's `t`. @public */\nexport const ToolbarContext = createContext<ToolbarContextValue>({ t: undefined });\n\n/** The nearest compound's published value, as DOCX Editor's `useToolbarContext`. @public */\nexport function useToolbarContext(): ToolbarContextValue {\n return useContext(ToolbarContext);\n}\n\n/**\n * The label for a key, given a host resolver: the host's translation, else the locale\n * catalog, as DOCX Editor's `useToolbarLabelFor`. @public\n */\nexport function useToolbarLabelFor(t: ChromeTranslate | undefined): (key: string) => string {\n const { t: catalog } = useTranslation();\n return useCallback((key: string) => t?.(key) ?? catalog(key as TranslationKey), [t, catalog]);\n}\n\n/** The label for a key: the nearest compound's `t`, else the locale catalog. @public */\nexport function useToolbarLabel(): (key: string) => string {\n return useToolbarLabelFor(useContext(ToolbarContext).t);\n}\n\n/**\n * Give a compound DOCX Editor's `t` prop: with `t`, every label of the compound and its parts\n * comes from the host's resolver. @internal\n */\nexport function withChromeTranslate<P extends { readonly t?: ChromeTranslate | undefined }>(\n Component: ComponentType<Omit<P, 't'>>,\n name: string\n): (props: P) => ReactNode {\n function Translated(props: P): ReactNode {\n const { t, ...rest } = props;\n // The providers always render, so a change of `t` between set and unset keeps the\n // compound mounted, with its state and focus. Without `t`, they pass on what is inherited.\n const inheritedHost = useContext(ToolbarContext).t;\n const inheritedTranslate = useContext(TranslationContext);\n const host = t ?? inheritedHost;\n const value = useMemo(() => ({ t: host }), [host]);\n const translate = (t as Translate | undefined) ?? inheritedTranslate;\n return (\n <ToolbarContext.Provider value={value}>\n <TranslationContext.Provider value={translate}>\n {createElement(Component, rest as Omit<P, 't'>)}\n </TranslationContext.Provider>\n </ToolbarContext.Provider>\n );\n }\n Object.defineProperty(Translated, 'name', { value: name });\n return Translated;\n}\n\n// --- History groups -------------------------------------------------------------------------\n\n/** What {@link useHistoryGroup} returns. @public */\nexport interface UseHistoryGroupReturn {\n /** Put it on the control: the slider, the stepper, or the color input. */\n readonly ref: (element: HTMLElement | null) => void;\n /** The options for each command of the gesture: `{ historyGroup }`. */\n readonly options: () => EditorExecOptions;\n}\n\n/**\n * One undo step for one gesture on your own control, as DOCX Editor's `useHistoryGroup`. Bind\n * the control with `ref`, and pass `options()` to each command that the gesture runs. A drag,\n * a held key, or a color pick is then one step of `editor.exec({ type: 'undo' })`.\n *\n * @example\n * ```tsx\n * const group = useHistoryGroup({ kind: 'range' });\n * const size = useEditorValueCommand('font.size');\n * <input type=\"range\" ref={group.ref} onChange={(e) => size.execute(+e.target.value, group.options())} />\n * ```\n *\n * @public\n */\nexport function useHistoryGroup({ kind }: HistoryGroupBindingOptions): UseHistoryGroupReturn {\n const editor = usePptxEditor();\n const [element, ref] = useState<HTMLElement | null>(null);\n const binding = useRef<HistoryGroupBinding | null>(null);\n useLayoutEffect(() => {\n if (!editor || !element) return;\n const current = bindHistoryGroup(editor, element, { kind });\n binding.current = current;\n return () => {\n current.dispose();\n binding.current = null;\n };\n }, [editor, element, kind]);\n const options = useCallback((): EditorExecOptions => {\n if (!binding.current) throw new Error('history group control is not mounted');\n return binding.current.options();\n }, []);\n return useMemo(() => ({ ref, options }), [options]);\n}\n\n// --- Caret ----------------------------------------------------------------------------------\n\n/**\n * The caret, as DOCX Editor's `useEditorCaret`: the text box, paragraph, and offset, or null\n * when no text is being edited. Compared by value, so a consumer re-renders only when the\n * caret moves.\n *\n * @public\n */\nexport function useEditorCaret(): EditorCaret | null {\n const editor = usePptxEditor();\n const cached = useRef<EditorCaret | null>(null);\n const subscribe = useCallback(\n (notify: () => void) => (editor ? editor.subscribe(notify) : () => undefined),\n [editor]\n );\n const read = useCallback((): EditorCaret | null => {\n cached.current = editor ? editorCaretOf(editor.snapshot(), cached.current) : null;\n return cached.current;\n }, [editor]);\n return useSyncExternalStore(subscribe, read, () => null);\n}\n\n// --- Search ---------------------------------------------------------------------------------\n\n/** What {@link useDocumentSearch} returns, as DOCX Editor's `UseDocumentSearchResult`. @public */\nexport interface UseDocumentSearchResult extends DocumentSearchState {\n /** Change the text to find. The matches update at once. */\n readonly setQuery: (query: string) => void;\n /** Search now and return the matches. `selectFirst` selects the first match. */\n readonly find: (query: string, options?: DocumentSearchFindOptions) => readonly FindMatch[];\n readonly setMatchCase: (value: boolean) => void;\n readonly setWholeWord: (value: boolean) => void;\n /** Select the match at `index` and show its slide. False for an index with no match. */\n readonly goTo: (index: number) => boolean;\n /** Select the next match, after the last one the first. */\n readonly next: () => boolean;\n /** Select the previous match, before the first one the last. */\n readonly previous: () => boolean;\n /** Empty the query and drop the matches. The selection stays. */\n readonly clear: () => void;\n}\n\nconst noSubscription = () => () => undefined;\nconst idleState = () => IDLE_DOCUMENT_SEARCH;\n\n/**\n * The editor's find session with no UI, for your own find bar, as DOCX Editor's\n * `useDocumentSearch`. Every hook on one editor shares the session. Outside a root, it has no\n * matches and every action does nothing.\n *\n * @public\n */\nexport function useDocumentSearch(): UseDocumentSearchResult {\n const editor = usePptxEditor();\n const search = useMemo(() => (editor ? documentSearchOf(editor) : null), [editor]);\n const state = useSyncExternalStore(\n search ? search.subscribe : noSubscription,\n search ? search.getState : idleState,\n idleState\n );\n const actions = useMemo(\n () => ({\n setQuery: (query: string) => search?.setQuery(query),\n find: (query: string, options?: DocumentSearchFindOptions) =>\n search?.find(query, options) ?? IDLE_DOCUMENT_SEARCH.matches,\n setMatchCase: (value: boolean) => search?.setMatchCase(value),\n setWholeWord: (value: boolean) => search?.setWholeWord(value),\n // No arguments: `onClick={search.next}` passes its event, which must not count.\n goTo: (index: number) => search?.goTo(index) ?? false,\n next: () => search?.next() ?? false,\n previous: () => search?.previous() ?? false,\n clear: () => search?.clear(),\n }),\n [search]\n );\n return useMemo(() => ({ ...state, ...actions }), [state, actions]);\n}\n","// Provider context and hooks. One multiplexed subscription per hook with slice memoization:\n// a selector that reads the slide count does not re-render on a bold toggle (docx-editor's\n// `useEditorState` contract).\n\nimport { createContext, useCallback, useContext, useMemo, useSyncExternalStore } from 'react';\nimport { createTranslator, type LocaleCatalog, type Translate } from '@pptx-editor.dev/i18n';\nimport { NOTES_SLOTS, useNotesTarget } from './notes-target.ts';\nimport {\n canRenameSectionInPlace,\n subscribeSectionRenamers,\n EMPTY_EDITOR_SNAPSHOT,\n editorCommandFor,\n platformShortcuts,\n runToolbarCommand,\n sameChromeCommandState,\n valueSlotOptions,\n valueSlotShown,\n type ChromeActionHost,\n type ChromeSlotId,\n type CommandResult,\n type EditorExecOptions,\n type ToolbarShownValue,\n type ToolbarSlotValue,\n type ToolbarValueMap,\n type EditorSnapshot,\n type PptxEditorInstance,\n type SlideshowController,\n warnOutsideRoot,\n} from '@pptx-editor.dev/core/editor';\n\nexport { platformShortcuts };\n\n/** The editor instance published by `PptxEditor.Root`. @public */\nexport const PptxEditorContext = createContext<PptxEditorInstance | null>(null);\n\n/** The translator published by `PptxEditor.Root` from its `locale` prop (English by default). @public */\nexport const TranslationContext = createContext<Translate>(createTranslator());\n\n/** The slide show of the editor in `PptxEditor.Root`. @public */\nexport interface UseSlideshowReturn {\n /** The running show, or null. `PptxEditor.Slideshow` paints it. */\n readonly controller: SlideshowController | null;\n /**\n * Start the show from the first shown slide or from the current slide. Does nothing without\n * an open document with slides. Viewing mode can present.\n */\n start(from: 'start' | 'current'): void;\n /** Close the show. */\n stop(): void;\n}\n\n/** The slide show outside `PptxEditor.Root`: also how `usePptxEditor` knows it has no root. */\nconst NO_SLIDESHOW: UseSlideshowReturn = {\n controller: null,\n start: () => undefined,\n stop: () => undefined,\n};\n\n/** The slide show published by `PptxEditor.Root`. @public */\nexport const SlideshowContext = createContext<UseSlideshowReturn>(NO_SLIDESHOW);\n\n/** The slide show of the editor in `PptxEditor.Root`. @public */\nexport function useSlideshow(): UseSlideshowReturn {\n return useContext(SlideshowContext);\n}\n\n/**\n * The editor instance, or null before it mounts. Outside `PptxEditor.Root` it is always null,\n * and a development warning says so, as for the other parts. @public\n */\nexport function usePptxEditor(): PptxEditorInstance | null {\n const editor = useContext(PptxEditorContext);\n // The root publishes its slide show with the editor; a host that provides only an editor\n // (`PptxEditorContext.Provider`) passes one, so neither case warns.\n const outside = useContext(SlideshowContext) === NO_SLIDESHOW;\n if (!editor && outside) warnOutsideRoot('usePptxEditor');\n return editor;\n}\n\nconst platformCache = new WeakMap<Translate, Translate>();\n\n/** The translator, with shortcut text for this platform. @public */\nexport function useTranslation(): { t: Translate } {\n const base = useContext(TranslationContext);\n let t = platformCache.get(base);\n if (!t) {\n t = (key, params) => platformShortcuts(base(key, params));\n platformCache.set(base, t);\n }\n return { t };\n}\n\n/** Build a translator for a locale catalog. @public */\nexport function translatorFor(locale?: LocaleCatalog): Translate {\n return createTranslator(locale);\n}\n\n/**\n * Subscribe to a slice of editor state. Re-renders only when `isEqual` says the slice changed\n * (default `Object.is`).\n *\n * @public\n */\nexport function useEditorState<T>(\n selector: (snapshot: EditorSnapshot) => T,\n isEqual: (a: T, b: T) => boolean = Object.is\n): T {\n const editor = usePptxEditor();\n const subscribe = useCallback(\n (notify: () => void) => (editor ? editor.subscribe(notify) : () => undefined),\n [editor]\n );\n // DOCX Editor's memo: `snapshot()` returns the same object until the state changes, so the\n // last slice is returned while the snapshot is unchanged. A selector that builds a new array\n // or object each call (`ribbonTabs(s)`) then gives `useSyncExternalStore` a stable value and\n // does not loop. A new snapshot runs the selector, and `isEqual` keeps an equal slice. The memo\n // is keyed on the selector, so a selector that reads new props never returns a stale slice.\n const select = useMemo(() => {\n let memo: { snapshot: EditorSnapshot; value: T } | null = null;\n return (snapshot: EditorSnapshot): T => {\n if (memo && memo.snapshot === snapshot) return memo.value;\n const next = selector(snapshot);\n if (memo && isEqual(memo.value, next)) {\n memo = { snapshot, value: memo.value };\n return memo.value;\n }\n memo = { snapshot, value: next };\n return next;\n };\n }, [selector, isEqual]);\n const get = useCallback(\n (): T => select(editor ? editor.snapshot() : EMPTY_EDITOR_SNAPSHOT),\n [editor, select]\n );\n return useSyncExternalStore(subscribe, get, get);\n}\n\n/** A chrome slot's state and its runner: one source of enabled state. @public */\nexport interface UseEditorCommandReturn {\n /**\n * Run the slot's command, with a value for value controls: the picked option's value, a\n * number of points for `font.size`, or `{ step: 1 }` / `{ step: -1 }` for its Increase and\n * Decrease Font Size buttons (`commandForSlotValue`). Returns true when the engine ran it and\n * false on a refusal, as in DOCX Editor.\n */\n readonly execute: (value?: unknown) => boolean;\n /** Whether the command can run now. */\n readonly isEnabled: boolean;\n /** Whether a toggle control shows as pressed. */\n readonly isActive: boolean;\n /**\n * Why the command cannot run: a catalog key, or the engine's own text. Show it with\n * `translateKeyOrText(t, reason)`.\n */\n readonly disabledReason: string | null;\n /** The value a value control shows (a font size, a family), when it has one. */\n readonly value?: string | number;\n}\n\nconst shallow = (a: UseEditorCommandReturn | null, b: UseEditorCommandReturn | null): boolean =>\n sameChromeCommandState(a, b);\n\n/**\n * The adapter actions of the enclosing `PptxEditor.Root` (dialogs, the link popup, find, the\n * show, a picture, the clipboard). @internal\n */\nexport const ChromeActionHostContext = createContext<ChromeActionHost | null>(null);\n\n/** A subscription that never calls back, for a slot that does not follow the rename registry. */\nconst NO_SUBSCRIPTION = (): (() => void) => () => {};\n\n/**\n * State and execution for one `ChromeSlotId`. A slot the adapter runs (a dialog, the link\n * popup, find, the slide show) runs through `PptxEditor.Root`, as a menu row does; outside a\n * root it is disabled with the reason. `useEditorCommand('text.link').execute(url)` sets the\n * link (`null` removes it) with or without the popup. While the speaker notes field has the\n * cursor, `text.bold`, `text.italic`, `text.underline`, and `text.strike` format the notes\n * text. `execute` takes any value, so a host can pass a\n * registry option's `value`; `useEditorValueCommand` types it. @public\n */\nexport function useEditorCommand(slot: ChromeSlotId): UseEditorCommandReturn {\n const editor = usePptxEditor();\n const host = useContext(ChromeActionHostContext);\n // Rename Section is on while a rail or a sorter can show the name field: follow them. Only\n // the two section slots that open the field listen.\n const section = slot === 'section.rename' || slot === 'section.add';\n const renamable = useSyncExternalStore(\n section ? subscribeSectionRenamers : NO_SUBSCRIPTION,\n () => section && canRenameSectionInPlace(editor),\n () => false\n );\n const select = useCallback((): UseEditorCommandReturn => {\n const { state, execute } = editorCommandFor(editor, slot, host, 'disabled.noRoot');\n return {\n execute: (value?: unknown) => execute(value),\n ...state,\n };\n // `renamable` changes the answer of `editorCommandFor` for the section slots.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [editor, slot, host, renamable]);\n const engine = useEditorState(\n select as unknown as (s: EditorSnapshot) => UseEditorCommandReturn,\n shallow as (a: UseEditorCommandReturn, b: UseEditorCommandReturn) => boolean\n );\n const notes = useNotesTarget(editor);\n const format = NOTES_SLOTS[slot];\n return useMemo(\n () =>\n notes && format\n ? {\n execute: () => notes.apply(format),\n isEnabled: !notes.readOnly && notes.canFormat,\n isActive: notes.formats[format],\n disabledReason: notes.readOnly\n ? 'disabled.viewing'\n : notes.canFormat\n ? null\n : 'disabled.selectNotesText',\n }\n : engine,\n [notes, format, engine]\n );\n}\n\n/** A typed value slot's state and runner, after DOCX Editor's `useEditorValueCommand`. @public */\nexport interface UseEditorValueCommandReturn<V, S = V> {\n /**\n * Run the slot's command with a value of its `ToolbarValueMap` type. The result says why the\n * engine refused it (`disabled.invalidValue`, `disabled.noEffectChange`). Pass\n * `{ historyGroup }` to make the values of one gesture (a slider drag) one undo step.\n */\n readonly execute: (value: V, options?: EditorExecOptions) => CommandResult;\n /** The value the slot shows (`ToolbarShownValue`), or null when it is mixed or unavailable. */\n readonly value: S | null;\n /**\n * The slot's fixed choices, from the registry (the Rotate, Align, line width, or Shape Effects\n * rows); none for a slot with a free value (`font.size`, `shape.fill`, `shape.styles`).\n */\n readonly options: readonly V[];\n /** Whether the command can run now. */\n readonly isEnabled: boolean;\n /** Why the command cannot run: a catalog key, or the engine's own text. */\n readonly disabledReason: string | null;\n}\n\n/**\n * State and execution for one typed value slot: `execute` takes the slot's `ToolbarValueMap`\n * type, so a typo in a value does not compile, and returns the engine's result. @public\n */\nexport function useEditorValueCommand<K extends keyof ToolbarValueMap>(\n slot: K\n): UseEditorValueCommandReturn<ToolbarValueMap[K], ToolbarShownValue<K>> {\n const editor = usePptxEditor();\n const cmd = useEditorCommand(slot);\n return useMemo(\n () => ({\n execute: (value: ToolbarValueMap[K], options?: EditorExecOptions): CommandResult =>\n runToolbarCommand(editor, slot, value as ToolbarSlotValue<K>, options),\n value: valueSlotShown(slot, cmd.value),\n options: valueSlotOptions(slot),\n isEnabled: cmd.isEnabled,\n disabledReason: cmd.disabledReason,\n }),\n [editor, slot, cmd]\n );\n}\n","// The speaker notes field that has focus, per editor. While it has focus, the toolbar's bold,\n// italic, underline, and strikethrough format the notes text. The registry lives in core\n// (`chrome-forms.ts`), so the React and Vue adapters read the same one.\n\nimport { useSyncExternalStore } from 'react';\nimport {\n NOTES_SLOTS,\n notesTargetOf,\n setNotesTarget,\n subscribeNotesTargets,\n type NotesTarget,\n type PptxEditorInstance,\n} from '@pptx-editor.dev/core/editor';\n\nexport { NOTES_SLOTS, setNotesTarget, type NotesTarget };\n\n/** The focused notes field of `editor`, or null. */\nexport function useNotesTarget(editor: PptxEditorInstance | null): NotesTarget | null {\n return useSyncExternalStore(\n subscribeNotesTargets,\n () => notesTargetOf(editor),\n () => null\n );\n}\n","/** @jsxImportSource react */\n// Table chrome: the Insert > Table grid, where a hover picks the size, and\n// the Table Design style list, which lists the deck's styles (`tableStyleChoices`). A menu\n// places the grid with `MenuTableGrid` (the demo's Insert > Table), a toolbar with the\n// `table.insert` slot.\n\nimport { useContext, useEffect, useRef, useState } from 'react';\nimport {\n TABLE_GRID_COLUMNS as GRID_COLUMNS,\n TABLE_GRID_ROWS as GRID_ROWS,\n tableGridKeyStep,\n tableGridMove,\n tableStyleChoices,\n type ChromeSlotId,\n} from '@pptx-editor.dev/core/editor';\nimport { Icon, MenuItem, Popover, ToolButton, keepFocus, useAriaDisabled } from './chrome.tsx';\nimport { useEditorCommand, useEditorState, usePptxEditor, useTranslation } from './context.ts';\nimport { MenuCloseContext } from './ContextMenu.tsx';\nimport { useSlot, type SlotPartProps } from './slot.ts';\nimport { useTriggerAttributes } from './slot-override.ts';\n\n/**\n * Props of `MenuTableGrid` (`PptxEditor.Menu.TableGrid`), DOCX Editor's `Menu.TableGrid` part\n * (`slot`, `className`), with the props a host menu or toolbar popup needs. @public\n */\nexport interface MenuTableGridProps {\n /** The slot whose enabled state gates the insert. Default `table.insert`. */\n readonly slot?: ChromeSlotId;\n /** Accessible name of the grid. Default: `table.insert` (\"Table\"). */\n readonly label?: string;\n /** Runs instead of the insert, with the picked size. */\n readonly onPick?: (rows: number, cols: number) => void;\n /** Runs after a table is inserted. Default: close the surrounding `PptxEditor.Menu`. */\n readonly onInserted?: () => void;\n /** Move the focus into the grid when it mounts, for a popup opened from the keyboard. */\n readonly autoFocus?: boolean;\n /** A class name added to the grid. */\n readonly className?: string;\n}\n\n/**\n * The Insert > Table grid, 10 columns by 8 rows, as DOCX Editor's `TableSizeGrid`: the cell\n * under the pointer (or focus) picks the size and each cell names it. A `grid` with one tab\n * stop; the arrows, Home, and End move inside it. The insert puts the caret in the new\n * table's first cell, and the editor takes the focus. @public\n */\nexport function MenuTableGrid({\n slot = 'table.insert',\n label,\n onPick,\n onInserted,\n autoFocus,\n className,\n}: MenuTableGridProps) {\n const { t } = useTranslation();\n const editor = usePptxEditor();\n const cmd = useEditorCommand(slot);\n const [size, setSize] = useState({ rows: 0, cols: 0 });\n // The cell that holds the grid's single tab stop.\n const [cursor, setCursor] = useState({ rows: 1, cols: 1 });\n const grid = useRef<HTMLDivElement>(null);\n const closeMenu = useContext(MenuCloseContext);\n // As DOCX Editor's `TableInsert`: an opened grid takes the focus on its tab-stop cell. The\n // popup places itself (and becomes visible) in its own effect after this one, so the focus\n // waits for the next frame: a hidden element takes no focus.\n useEffect(() => {\n if (!autoFocus) return;\n const frame = requestAnimationFrame(() =>\n grid.current?.querySelector<HTMLElement>('[tabindex=\"0\"]')?.focus()\n );\n return () => cancelAnimationFrame(frame);\n }, [autoFocus]);\n const pick = (rows: number, cols: number): void => {\n if (onPick) return onPick(rows, cols);\n // The slot gates the grid; the grid always inserts a table, as DOCX Editor's.\n const command = { type: 'insertTable' as const, rows, cols };\n if (!editor || !cmd.isEnabled || !editor.can(command).ok) return;\n // In a menu, the insert closes it, as DOCX Editor's grid does through the menu context.\n if (editor.exec(command).ok) (onInserted ?? closeMenu)?.();\n };\n const move = (step: { rows?: number; cols?: number; toCol?: number }): void =>\n setCursor((current) => {\n const next = tableGridMove(current, step);\n setSize(next);\n queueMicrotask(() =>\n grid.current?.querySelector<HTMLElement>(`[data-cell=\"${next.rows}x${next.cols}\"]`)?.focus()\n );\n return next;\n });\n return (\n <div\n ref={grid}\n role=\"grid\"\n aria-label={label ?? t('table.insert')}\n className={`pptx-table-grid${className ? ` ${className}` : ''}`}\n data-slot={slot}\n data-disabled={!onPick && !cmd.isEnabled ? '' : undefined}\n onMouseDown={keepFocus}\n onMouseLeave={() => setSize({ rows: 0, cols: 0 })}\n onKeyDown={(e) => {\n const step = tableGridKeyStep(e.key);\n if (!step) return;\n move(step);\n // The grid's arrows do not also walk the menu rows behind it.\n e.preventDefault();\n e.stopPropagation();\n }}\n >\n <div className=\"pptx-table-grid__cells\" data-columns={GRID_COLUMNS}>\n {Array.from({ length: GRID_ROWS }, (_, r) => (\n <div key={r} role=\"row\" className=\"pptx-table-grid__row\">\n {Array.from({ length: GRID_COLUMNS }, (_, c) => (\n <button\n key={c}\n type=\"button\"\n role=\"gridcell\"\n data-cell={`${r + 1}x${c + 1}`}\n tabIndex={cursor.rows === r + 1 && cursor.cols === c + 1 ? 0 : -1}\n className=\"pptx-table-grid__cell\"\n aria-label={t('table.gridSize', { cols: c + 1, rows: r + 1 })}\n data-active={r < size.rows && c < size.cols ? '' : undefined}\n onMouseEnter={() => setSize({ rows: r + 1, cols: c + 1 })}\n onFocus={() => setSize({ rows: r + 1, cols: c + 1 })}\n onClick={() => pick(r + 1, c + 1)}\n />\n ))}\n </div>\n ))}\n </div>\n {/* Not a live region: it would speak on every cell a pointer sweep crosses, and each\n cell already names its size. */}\n <p className=\"pptx-table-grid__label\" aria-hidden=\"true\">\n {size.rows ? t('table.gridSize', { cols: size.cols, rows: size.rows }) : t('table.insert')}\n </p>\n </div>\n );\n}\n\n/** Insert > Table as a control: a button that opens the grid. */\nexport function TableGridControl({ slot, control }: SlotPartProps) {\n const { cmd, label, reason } = useSlot(slot, control);\n const anchor = useRef<HTMLSpanElement>(null);\n const [open, setOpen] = useState(false);\n return (\n <>\n <span ref={anchor} className=\"pptx-toolbar__group\">\n <ToolButton\n slot={slot}\n label={label}\n paths={control.paths}\n disabled={!cmd.isEnabled}\n disabledReason={reason}\n hasPopup=\"dialog\"\n expanded={open}\n onClick={() => setOpen((o) => !o)}\n />\n </span>\n {open ? (\n // The popup anchors on the button, so Escape gives the focus back to it, as DOCX\n // Editor's `TableInsert`; it closes when the focus leaves the grid (Tab).\n <Popover\n anchor={anchor.current?.querySelector('button') ?? anchor.current}\n label={label}\n role=\"dialog\"\n onClose={() => setOpen(false)}\n >\n <div\n onBlur={(e) => {\n if (!e.currentTarget.contains(e.relatedTarget as Node | null)) setOpen(false);\n }}\n >\n <MenuTableGrid slot={slot} label={label} autoFocus onInserted={() => setOpen(false)} />\n </div>\n </Popover>\n ) : null}\n </>\n );\n}\n\n/** Table Design > Table styles: the deck's styles by name; the table's style is checked. */\nexport function TableStyleControl({ slot, control }: SlotPartProps) {\n const { cmd, label, reason, tip } = useSlot(slot, control);\n // A disabled trigger stays focusable and says why, as every other picker does.\n const off = useAriaDisabled(!cmd.isEnabled, reason);\n const { t } = useTranslation();\n const editor = usePptxEditor();\n const anchor = useRef<HTMLButtonElement>(null);\n const [open, setOpen] = useState(false);\n // The list comes from the open deck: read it again when the document changes.\n useEditorState((s) => s.revision);\n const styles = tableStyleChoices(editor);\n // Styles without a name are numbered among themselves, so the user can tell them apart.\n const unnamed = styles.filter((s) => !s.builtIn && !s.name);\n const trigger = useTriggerAttributes(slot, 'pptx-toolbar__button pptx-toolbar__button--wide', {\n disabled: !cmd.isEnabled,\n });\n return (\n <>\n <button\n ref={anchor}\n type=\"button\"\n {...trigger}\n data-slot={slot}\n aria-label={label}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n {...tip}\n {...off.attrs}\n onMouseDown={keepFocus}\n onClick={() => setOpen((o) => !o)}\n >\n <Icon paths={control.paths} />\n <Icon name=\"arrow_drop_down\" className=\"pptx-icon pptx-toolbar__caret\" />\n </button>\n {off.note}\n {open ? (\n <Popover anchor={anchor.current} onClose={() => setOpen(false)}>\n {styles.map((s) => (\n <MenuItem\n key={s.id}\n checked={s.id === cmd.value}\n onSelect={() => (cmd.execute(s.id), setOpen(false))}\n >\n {s.builtIn\n ? t('table.defaultStyle')\n : s.name || t('table.unnamedStyle', { n: unnamed.indexOf(s) + 1 })}\n </MenuItem>\n ))}\n </Popover>\n ) : null}\n </>\n );\n}\n","/** @jsxImportSource react */\n// Chrome building blocks: icons, buttons, and popover menus shared by the toolbar, rail, notes,\n// panel, and zoom pill. Every mousedown on chrome is prevented (except form fields) so it never\n// steals the slide selection or the text caret.\n\nimport {\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n type ReactElement,\n type ReactNode,\n type MouseEvent as ReactMouseEvent,\n useId,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport {\n chromeKeepsFocus,\n tooltipAttributes,\n focusMenuRowAtPointer,\n focusPopoverOnOpen,\n focusTextAfterChrome,\n ICON_PATHS,\n listenPopoverDismiss,\n popoverKeyDown,\n popoverScope,\n positionPopover,\n restorePopoverFocus,\n warnUnknownIcon,\n warnUnsupportedOverride,\n type PopoverAnchorRect,\n} from '@pptx-editor.dev/core/editor';\nimport {\n buttonRoleProps,\n renderAsChild,\n slotPartNames,\n useSlotOverride,\n type HostElementProps,\n} from './slot-override.ts';\n\n/**\n * Prevent chrome mousedown from moving focus (inputs keep their behavior). Chrome building\n * block, not a stable API. @internal\n */\nexport function keepFocus(e: ReactMouseEvent): void {\n if (chromeKeepsFocus(e.target)) e.preventDefault();\n}\n\n/**\n * Give the caret back to the slide text after a toolbar field or picker is done, as DOCX\n * Editor's pickers call `editor.focus()`: a format armed at the caret applies to what is typed,\n * and the next key (Cmd+Z) reaches the slide. Chrome building block. @internal\n */\nexport function focusText(editor: { focus(): void } | null, from?: Element | null): void {\n focusTextAfterChrome(editor, from);\n}\n\n/** The props of `Icon`. @public */\nexport interface IconProps {\n /** A Material Symbol name from `ICON_PATHS`. */\n name?: string;\n /** SVG path data, in place of `name`. */\n paths?: readonly string[] | null;\n /** The class of the `svg` element. Defaults to `pptx-icon`. */\n className?: string;\n}\n\n/** An inline Material Symbol. @public */\nexport function Icon({ name, paths, className = 'pptx-icon' }: IconProps) {\n const known = name ? ICON_PATHS[name] : undefined;\n if (name && !paths && !known) warnUnknownIcon(name);\n const d = paths ?? known ?? [];\n return (\n <svg className={className} viewBox=\"0 -960 960 960\" aria-hidden=\"true\">\n {d.map((p, i) => (\n <path key={i} d={p} />\n ))}\n </svg>\n );\n}\n\n/**\n * `aria-disabled` and the spoken reason for a raw toolbar trigger (a picker, a field), the same\n * rule as `ToolButton`: it stays a Tab and arrow stop, ignores clicks,\n * and names its reason through `aria-describedby`. Render `note` beside the element. @internal\n */\nexport function useAriaDisabled(\n disabled: boolean,\n reason: string | null | undefined\n): {\n attrs: {\n 'aria-disabled'?: true;\n 'aria-describedby'?: string;\n onClickCapture?: (e: { preventDefault(): void; stopPropagation(): void }) => void;\n };\n note: ReactNode;\n} {\n const id = useId();\n const said = disabled && reason ? reason : null;\n return {\n attrs: disabled\n ? {\n 'aria-disabled': true,\n ...(said ? { 'aria-describedby': id } : {}),\n onClickCapture: (e) => (e.preventDefault(), e.stopPropagation()),\n }\n : {},\n note: said ? (\n <span id={id} className=\"pptx-sr-only\" hidden>\n {said}\n </span>\n ) : null,\n };\n}\n\n/** The props of `ToolButton`. @internal */\nexport interface ToolButtonProps {\n /** The accessible name and tooltip of the button. */\n label: string;\n /** SVG path data for the icon, in place of `icon`. */\n paths?: readonly string[] | null;\n /** A Material Symbol name from `ICON_PATHS`. */\n icon?: string;\n /** Called when the person activates the button. */\n onClick: () => void;\n /** The button cannot run. It stays focusable and names `disabledReason`. */\n disabled?: boolean;\n /** Why the button is disabled; read after its name. */\n disabledReason?: string | null;\n /** For a toggle: whether it is on (`aria-pressed`). */\n pressed?: boolean;\n /** For a button that shows or hides a region: whether it is shown (`aria-expanded`). */\n expanded?: boolean;\n /** The id of the region the button shows or hides (`aria-controls`). */\n controls?: string;\n /** Content after the icon. */\n children?: ReactNode;\n /** A class name added to the button. */\n className?: string;\n /** The chrome slot this button drives, as `data-slot` for hosts and tests. */\n slot?: string;\n /** The popup this button opens (`aria-haspopup`); `expanded` says whether it is open. */\n hasPopup?: 'menu' | 'grid' | 'dialog';\n /** False for the main half of a color split: a host element cannot stand in for it. */\n asChild?: boolean;\n /** A host element that renders the button, from a part's own `asChild` (no slot override). */\n host?: ReactElement<HostElementProps> | null;\n}\n\n/** A toolbar icon button with tooltip and disabled reason. Not a stable API. @internal */\nexport function ToolButton(props: ToolButtonProps) {\n // `Toolbar.Slot` overrides for this slot: a host icon, a class name, or a host element.\n const override = useSlotOverride(props.slot);\n const reasonId = useId();\n if (override?.asChild && props.asChild === false)\n warnUnsupportedOverride(props.slot ?? '', 'asChild', slotPartNames(override));\n // A disabled control stays focusable (`aria-disabled`), so a keyboard user reaches it in the\n // toolbar and hears its reason through `aria-describedby`, as DOCX Editor's menus and table\n // chrome do. The reason text is `hidden`: a description still reads it, and the accessibility\n // tree shows it once, on the button, not again as loose text in the toolbar.\n const reason = props.disabled && props.disabledReason ? props.disabledReason : null;\n const onClick = props.disabled ? undefined : props.onClick;\n const className = ['pptx-toolbar__button', props.className, override?.className]\n .filter(Boolean)\n .join(' ');\n const icon =\n override?.icon !== undefined ? (\n override.icon\n ) : props.paths || props.icon ? (\n <Icon paths={props.paths} name={props.icon} />\n ) : null;\n const attributes = {\n className,\n 'aria-label': props.label,\n ...tooltipAttributes(props.label, props.disabled, props.disabledReason),\n 'data-slot': props.slot,\n // State as data attributes, the first step of the customization ladder.\n 'data-active': props.pressed ? '' : undefined,\n 'data-disabled': props.disabled ? '' : undefined,\n 'aria-pressed': props.pressed === undefined ? undefined : props.pressed,\n 'aria-haspopup': props.hasPopup,\n 'aria-expanded': props.hasPopup ? !!props.expanded : props.expanded,\n 'aria-controls': props.controls,\n 'aria-disabled': props.disabled ? true : undefined,\n 'aria-describedby': reason ? reasonId : undefined,\n onMouseDown: keepFocus,\n };\n const described = reason ? (\n <span id={reasonId} className=\"pptx-sr-only\" hidden>\n {reason}\n </span>\n ) : null;\n const hostElement =\n props.host ?? (override?.asChild && props.asChild !== false ? override.asChild : null);\n if (hostElement) {\n // The host element renders the control, after DOCX Editor's toolbar `Slot`: the props merge\n // into the child's (classes join, handlers run child-first). A host element that is not a\n // button gets `role=\"button\"`, a tab stop, and Enter and Space, so the label and the\n // pressed state stay valid ARIA and the keyboard can run it. It\n // cannot be disabled natively, so it says so with `aria-disabled` and gets no handler.\n const isButton = hostElement.type === 'button';\n return (\n <>\n {renderAsChild(hostElement, {\n ...attributes,\n ...(isButton ? { type: 'button' } : buttonRoleProps(onClick)),\n onClick,\n })}\n {described}\n </>\n );\n }\n return (\n <>\n <button type=\"button\" {...attributes} onClick={onClick}>\n {icon}\n {props.children}\n </button>\n {described}\n </>\n );\n}\n\n/** The props of `Popover`. @internal */\nexport interface PopoverProps {\n /** The element the panel opens under. */\n anchor: HTMLElement | null;\n /** Called when the panel closes: an outside click, Escape, or Tab. */\n onClose: () => void;\n /** The panel's content. */\n children: ReactNode;\n /** The edge of the anchor that the panel lines up with. Defaults to `start`. */\n align?: 'start' | 'end';\n /** The accessible name; defaults to the trigger's `aria-label`. */\n label?: string;\n /** `menu` (default) for rows, or `dialog` for a form or controls. */\n role?: 'menu' | 'dialog';\n /** The element id, for the trigger's `aria-controls`. */\n id?: string;\n /**\n * A dialog panel opened from the keyboard takes focus at its first control (a menu always\n * does), and Tab past its first or last control closes it and returns to the trigger.\n */\n focusFirst?: boolean;\n /**\n * A dialog with a field to type in (the font search): its field takes focus when it opens,\n * for pointer and keyboard users alike.\n */\n field?: boolean;\n /** A panel that takes no focus when it opens: the keys stay in the slide text. */\n passive?: boolean;\n /** A class name added to the panel. */\n className?: string;\n /**\n * A box in client pixels to open at instead of the anchor's own box (the link popup at the\n * selected text). Focus and dismissal still use `anchor`.\n */\n anchorRect?: PopoverAnchorRect | null;\n}\n\n/**\n * A popover anchored under an element, closed on outside click, Escape, or Tab.\n *\n * As a `menu` (the default) it follows the WAI-ARIA menu pattern, as DOCX Editor's menus do:\n * the arrow keys, Home, and End move through the rows (by grid rows in a swatch grid), and\n * every row is one `tabIndex=-1` stop. As a `dialog` it holds a form or controls (the font\n * search, the link field, the More card). With `field`, its field takes focus when it opens,\n * for pointer and keyboard users. Otherwise, when the trigger has focus at open (a keyboard\n * user), focus moves to the first row or control; after a pointer open the panel itself takes\n * focus (core's `focusPopoverOnOpen`), so typing and the arrow keys reach the popover, not the\n * slide text. Escape returns focus to the trigger. Another close gives focus back to where it\n * was before a pointer open (the slide text), else to the trigger, unless the popover moved it\n * on purpose. @internal\n */\nexport function Popover({\n anchor,\n onClose,\n children,\n align = 'start',\n label,\n role = 'menu',\n id,\n focusFirst = false,\n field = false,\n passive = false,\n className,\n anchorRect = null,\n}: PopoverProps) {\n const ref = useRef<HTMLDivElement>(null);\n const [pos, setPos] = useState<{\n left: number;\n top: number;\n maxHeight: number;\n scroll: boolean;\n } | null>(null);\n // Whether focus was inside the popover, so closing it gives focus back to the trigger\n // instead of dropping it on <body> when the popover unmounts.\n const focusInside = useRef(false);\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n // Before paint, and written to the node at once: React runs the focus effect below before\n // it re-renders with `pos`, and a browser does not focus into a `visibility: hidden` panel.\n useLayoutEffect(() => {\n if (!anchor) return;\n setPos(positionPopover(ref.current, anchor, align, anchorRect));\n }, [anchor, align, anchorRect]);\n // The element that had focus before the open, for the same trigger. StrictMode runs the\n // effect below twice: the second run finds focus already inside the panel and saves nothing,\n // so the first saved element is kept instead of falling back to the trigger on close.\n const back = useRef<{ anchor: HTMLElement | null; el: HTMLElement | null } | null>(null);\n useEffect(() => {\n // A pointer open moves focus into the panel too, so the keys reach the menu; closing gives\n // focus back to where it was (the slide text), and Escape to the trigger.\n const saved = focusPopoverOnOpen(ref.current, anchor, { role, focusFirst, field, passive });\n if (saved || back.current?.anchor !== anchor) back.current = { anchor, el: saved };\n return () => restorePopoverFocus(anchor, focusInside.current, back.current?.el ?? null);\n }, [anchor, role, focusFirst, field, passive]);\n useEffect(\n () =>\n listenPopoverDismiss({\n panel: () => ref.current,\n anchor,\n focusInside: () => focusInside.current,\n onClose: () => onCloseRef.current(),\n }),\n [anchor]\n );\n // The menu inherits tokens from the nearest editor scope by rendering inside it.\n const scope = popoverScope(anchor);\n return createPortal(\n <div\n ref={ref}\n id={id}\n className={className ? `pptx-menu ${className}` : 'pptx-menu'}\n role={role}\n aria-label={label ?? anchor?.getAttribute('aria-label') ?? undefined}\n tabIndex={-1}\n style={\n pos\n ? {\n left: pos.left,\n top: pos.top,\n maxHeight: pos.maxHeight,\n overflowY: pos.scroll ? 'auto' : undefined,\n }\n : { visibility: 'hidden', left: 0, top: 0 }\n }\n onMouseDown={keepFocus}\n // In a menu the pointer moves the focused row, so one row looks active.\n onMouseMove={role === 'menu' ? (e) => focusMenuRowAtPointer(ref.current, e) : undefined}\n onFocus={() => {\n focusInside.current = true;\n }}\n onKeyDown={(e) =>\n // Keys from a popover opened inside this one (React events bubble through portals) are\n // left alone.\n popoverKeyDown(ref.current, anchor, e, {\n role,\n focusFirst,\n onClose: () => onCloseRef.current(),\n })\n }\n >\n {children}\n </div>,\n scope\n );\n}\n\n/** The props of `MenuItem`. @internal */\nexport interface MenuItemProps {\n /** The row's content. */\n children: ReactNode;\n /** Called when the person activates the row. */\n onSelect: () => void;\n /** For a choice row: whether it is the current choice (`aria-checked`). */\n checked?: boolean;\n /** The row cannot run. */\n disabled?: boolean;\n /**\n * Why a disabled row cannot run. The row then stays focusable (`aria-disabled`) and names\n * the reason, so a keyboard or screen-reader user meets it too; it still does not run.\n */\n reason?: string;\n /** The row's tooltip. */\n title?: string;\n /** A row of a `listbox` (the font list) instead of a menu. */\n option?: boolean;\n /** An on/off setting: `menuitemcheckbox`. */\n checkbox?: boolean;\n /**\n * A hint read after the row's name (`aria-description`), so the name stays the label alone:\n * mark a visible hint in the row `aria-hidden`.\n */\n description?: string;\n}\n\n/**\n * A menu row: `menuitem`, or `menuitemradio` when `checked` is given (`menuitemcheckbox` with\n * `checkbox`, for an on/off setting), or `option` in a list box. Rows are `tabIndex=-1`: the\n * arrow keys move between them. @internal\n */\nexport function MenuItem({\n children,\n onSelect,\n checked,\n disabled,\n reason,\n title,\n option,\n checkbox,\n description,\n}: MenuItemProps) {\n const state = option\n ? { role: 'option', 'aria-selected': checked ?? false }\n : checked === undefined\n ? { role: 'menuitem' }\n : { role: checkbox ? 'menuitemcheckbox' : 'menuitemradio', 'aria-checked': checked };\n return (\n <button\n type=\"button\"\n {...state}\n tabIndex={-1}\n className=\"pptx-menu__item\"\n // A disabled row stays focusable, as `MenuRow` does, so the arrow keys reach it and a\n // keyboard or screen-reader user can read why; a `reason` is spoken and shown.\n aria-disabled={disabled || undefined}\n {...(disabled && reason\n ? { 'aria-description': reason, 'data-pptx-tooltip': reason }\n : title\n ? { 'data-pptx-tooltip': title }\n : {})}\n {...(description && !(disabled && reason) ? { 'aria-description': description } : {})}\n onClick={disabled ? undefined : onSelect}\n >\n {children}\n {/* The checked row of a menu shows a check mark, as DOCX Editor's menus and the context\n menu do. */}\n {checked && !option ? <Icon name=\"check\" className=\"pptx-icon pptx-menu__check\" /> : null}\n </button>\n );\n}\n","// A part-level context for one toolbar slot's host overrides (`Toolbar.Slot`): the icon, the\n// class name, and an `asChild` element. Every control reads it for its own slot, so a\n// customization reaches the control without new props, as in DOCX Editor's toolbar parts.\n\nimport { cloneElement, createContext, useContext, type ReactElement, type ReactNode } from 'react';\nimport { warnUnsupportedOverride, type ToolbarPartNames } from '@pptx-editor.dev/core/editor';\n\n/** Props of an element a host passes with `asChild`. */\nexport type HostElementProps = Record<string, unknown>;\n\n/** The part a named part's props came from (`Toolbar.Bold`), for warning text. @internal */\nexport const NAMED_PART = Symbol('pptxNamedPart');\n\n/** The overrides one `Toolbar.Slot` passes to the control it wraps. */\nexport interface SlotOverride {\n readonly slotId: string;\n readonly icon?: ReactNode;\n readonly className?: string;\n /** With `asChild`, the host element that the control renders as. */\n readonly asChild?: ReactElement<HostElementProps>;\n /** The named part (`Toolbar.Bold`) the override came from, for warning text. */\n readonly [NAMED_PART]?: string;\n}\n\nexport const SlotOverrideContext = createContext<SlotOverride | null>(null);\n\n/** The overrides for `slot`, or null when the nearest override names another slot. */\nexport function useSlotOverride(slot: string | undefined): SlotOverride | null {\n const override = useContext(SlotOverrideContext);\n return override && slot !== undefined && override.slotId === slot ? override : null;\n}\n\n/** State and class attributes for a control's trigger element. */\nexport interface TriggerAttributes {\n readonly className: string;\n readonly 'data-active'?: '';\n readonly 'data-disabled'?: '';\n}\n\n/**\n * The class name and state attributes for a control that renders a picker trigger, not a\n * `ToolButton`: a font list, a size stepper, a dropdown. Such a control has no single icon to\n * replace and no single element to hand over, so `icon` and `asChild` are refused with a\n * development warning; `className` and the state attributes apply.\n */\nexport function useTriggerAttributes(\n slot: string,\n base: string,\n state: { readonly disabled?: boolean; readonly active?: boolean }\n): TriggerAttributes {\n const override = useSlotOverride(slot);\n if (override?.icon !== undefined) warnUnsupportedOverride(slot, 'icon', slotPartNames(override));\n if (override?.asChild) warnUnsupportedOverride(slot, 'asChild', slotPartNames(override));\n return {\n className: [base, override?.className].filter(Boolean).join(' '),\n ...(state.active ? { 'data-active': '' as const } : {}),\n ...(state.disabled ? { 'data-disabled': '' as const } : {}),\n };\n}\n\n/**\n * The props that make a host element that is not a `<button>` act as one (WCAG 2.1.1): the\n * button role, a tab stop, and Enter and Space to activate. A link keeps its own Enter, which\n * already clicks it. `activate` gets the element. @internal\n */\nexport function buttonRoleProps(\n activate: ((target: Element) => void) | undefined\n): HostElementProps {\n return {\n role: 'button',\n tabIndex: 0,\n onKeyDown: (event: KeyboardEvent & { currentTarget: Element }) => {\n const link = event.currentTarget instanceof HTMLAnchorElement && event.currentTarget.href;\n if (event.key !== ' ' && (event.key !== 'Enter' || link)) return;\n event.preventDefault();\n activate?.(event.currentTarget);\n },\n };\n}\n\n/** The names warnings use for a slot: the named part when there is one. @internal */\nexport function slotPartNames(props: object | null | undefined): ToolbarPartNames | undefined {\n const named = (props as { [NAMED_PART]?: string } | null | undefined)?.[NAMED_PART];\n return named ? { slot: named, group: 'Toolbar.Group' } : undefined;\n}\n\nfunction composeHandlers(childHandler: unknown, slotHandler: unknown): unknown {\n if (typeof slotHandler !== 'function') return childHandler;\n if (typeof childHandler !== 'function') return slotHandler;\n return (event: { defaultPrevented: boolean }) => {\n childHandler(event);\n if (!event.defaultPrevented) slotHandler(event);\n };\n}\n\n/**\n * Render `child` with the control's props merged in, after DOCX Editor's toolbar `Slot`\n * (docx-editor/packages/react/src/editor/toolbar/Slot.tsx): class names join, styles merge\n * (child wins per property), handlers run child-first (the control's handler is skipped when\n * the child called `preventDefault()`), and other props keep the child's own value.\n */\nexport function renderAsChild(\n child: ReactElement<HostElementProps>,\n slotProps: HostElementProps\n): ReactElement {\n const childProps = child.props;\n const merged: HostElementProps = { ...slotProps, ...childProps };\n for (const key of Object.keys(slotProps)) {\n if (/^on[A-Z]/.test(key)) merged[key] = composeHandlers(childProps[key], slotProps[key]);\n else if (key === 'className')\n merged[key] = [slotProps[key], childProps[key]].filter(Boolean).join(' ');\n else if (key === 'style') merged[key] = Object.assign({}, slotProps[key], childProps[key]);\n }\n // The child keeps its ref: `cloneElement` keeps it in React 18, and React 19 keeps it in props.\n return cloneElement(child, merged);\n}\n","/** @jsxImportSource react */\n// Right-click menus and menu rows with an icon column, a label, and a shortcut hint.\n//\n// Adapted from DOCX Editor (eigenpal/docx-editor, packages/react/src/editor/contextmenu/\n// DocxEditorContextMenu.tsx and parts.tsx, and the `.docx-contextmenu` and\n// `.docx-menubar__item` rules of packages/core/src/styles/editor.css): the menu opens at the\n// pointer and flips to stay inside the window, focus moves into it and returns on close, and a\n// disabled row stays in the menu with the engine's reason as its tooltip. The rows share the\n// popover menu's keyboard rules (`menu-keyboard.ts`). PPTX Editor adds `MenuSubmenu`, the\n// cascading panel of the demo's Insert menu.\n\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactNode,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { sanitizeHref } from '@pptx-editor.dev/core/store';\nimport { Icon, keepFocus } from './chrome.tsx';\nimport {\n tooltipAttributes,\n focusEdge,\n focusMenuRowAtPointer,\n focusPanelFromPointer,\n handleMenuKey,\n listenContextMenuDismiss,\n panelKeyPressed,\n focusSurfaceOf,\n placeInViewport as placeAt,\n panelItems,\n placeSubmenu,\n submenuPanelKey,\n translateKeyOrText,\n inFixedView,\n placeInFixedFrame,\n} from '@pptx-editor.dev/core/editor';\nimport { PptxEditorContext, TranslationContext } from './context.ts';\n\n/** Closes the menu a row is in; `null` outside a packaged menu. @internal */\nexport const MenuCloseContext = createContext<(() => void) | null>(null);\n\n/** A point in client (viewport) pixels. @public */\nexport interface ContextMenuPoint {\n /** The horizontal position in CSS pixels from the left of the window. */\n readonly x: number;\n /** The vertical position in CSS pixels from the top of the window. */\n readonly y: number;\n}\n\n/** Props of `ContextMenu`. @public */\nexport interface ContextMenuProps {\n /** Where the menu opens: the pointer, or the focused element for a keyboard open. */\n readonly at: ContextMenuPoint;\n /** Called when the menu closes: a row ran, Escape, Tab, or a click outside. */\n readonly onClose: () => void;\n /** The accessible name of the menu. */\n readonly label: string;\n /** Opened from the keyboard (Shift+F10, the Menu key): focus goes to the first row. */\n readonly keyboard?: boolean;\n /** The element the menu opened on; its editor scope carries the theme tokens. */\n readonly owner?: HTMLElement | null;\n /** A class name added to the menu. */\n readonly className?: string;\n /** The menu's rows. */\n readonly children: ReactNode;\n}\n\n/**\n * Place a panel of size `w` × `h` at `at`, flipped, clamped, or capped (`maxHeight`) to stay\n * inside the window with a corner at the point. The\n * rule lives in core (`placeInViewport`), shared with the Vue adapter.\n */\nexport const placeInViewport: (\n at: ContextMenuPoint,\n w: number,\n h: number,\n vw: number,\n vh: number\n) => { left: number; top: number; maxHeight?: number } = placeAt;\n\n/** The editor scope an element lives in, so a portaled panel inherits its tokens. */\nconst scopeOf = (el: HTMLElement | null | undefined): HTMLElement =>\n (el?.closest('.pptx-editor') as HTMLElement | null) ?? document.body;\n\n/**\n * A context menu at a point. Closed by Escape (focus returns to where it was), Tab, a click\n * outside, or a window resize. The arrow keys, Home, and End move through the rows. @public\n */\nexport function ContextMenu({\n at,\n onClose,\n label,\n keyboard,\n owner,\n className,\n children,\n}: ContextMenuProps) {\n const ref = useRef<HTMLDivElement>(null);\n const editor = useContext(PptxEditorContext);\n // Read on close: the menu belongs to one editor for its whole life.\n const editorRef = useRef(editor);\n editorRef.current = editor;\n const [pos, setPos] = useState<{ left: number; top: number; maxHeight?: number } | null>(null);\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n useLayoutEffect(() => {\n const panel = ref.current;\n if (!panel) return;\n setPos(\n placeInFixedFrame(\n panel.parentElement,\n {\n width: panel.offsetWidth,\n height: panel.scrollHeight + panel.offsetHeight - panel.clientHeight,\n },\n (size, view) =>\n placeInViewport(inFixedView(at, view), size.width, size.height, view.width, view.height)\n )\n );\n }, [at]);\n useLayoutEffect(() => {\n const panel = ref.current;\n if (!panel) return;\n const back = panel.ownerDocument.activeElement as HTMLElement | null;\n return () => {\n // Focus returns only when it is still in the menu: a click elsewhere keeps its focus.\n const active = panel.ownerDocument.activeElement;\n const lost = !active || active === panel.ownerDocument.body || panel.contains(active);\n if (!lost) return;\n // On the slide, focus goes where typing works: the text input while text is selected\n // (a right press moves focus to the slide frame first).\n const owner = editorRef.current;\n if (back?.closest('.pptx-surface') && owner && focusSurfaceOf(owner)) return;\n if (back?.isConnected) back.focus({ preventScroll: true });\n };\n }, []);\n // Focus moves in once the panel is placed: a hidden panel cannot take focus.\n const placed = pos !== null;\n useEffect(() => {\n const panel = ref.current;\n if (!panel || !placed) return;\n // A pointer open focuses the panel, with no ring until a key is pressed.\n if (!keyboard || !focusEdge(panelItems(panel), 'first')) focusPanelFromPointer(panel);\n }, [placed, keyboard]);\n // A press outside, Escape, a blur, a resize, or a scroll closes it (core's\n // `listenContextMenuDismiss`).\n useEffect(\n () =>\n listenContextMenuDismiss(\n () => ref.current,\n () => onCloseRef.current()\n ),\n []\n );\n const onKeyDown = (e: ReactKeyboardEvent): void => {\n panelKeyPressed(ref.current);\n if (!ref.current?.contains(e.target as Node)) return;\n if (e.key === 'Escape' || e.key === 'Tab') {\n e.preventDefault();\n e.stopPropagation();\n onCloseRef.current();\n return;\n }\n if (handleMenuKey(ref.current, e.key)) {\n e.preventDefault();\n e.stopPropagation();\n }\n };\n return createPortal(\n <div\n ref={ref}\n className={['pptx-menu pptx-contextmenu', className].filter(Boolean).join(' ')}\n role=\"menu\"\n aria-label={label}\n tabIndex={-1}\n style={pos ?? { visibility: 'hidden', left: at.x, top: at.y }}\n onMouseDown={keepFocus}\n // The pointer moves the focused row, so one row looks active.\n onMouseMove={(e) => focusMenuRowAtPointer(ref.current, e)}\n onContextMenu={(e) => e.preventDefault()}\n onKeyDown={onKeyDown}\n >\n {children}\n </div>,\n scopeOf(owner)\n );\n}\n\n/** Props of `MenuRow`. @public */\nexport interface MenuRowProps {\n /** The row's text, and its accessible name. */\n readonly label: string;\n /**\n * A Material Symbol name from `ICON_PATHS`, or icon content (an element), as DOCX Editor's\n * `ContextMenuItem` and `Toolbar.Action` take.\n */\n readonly icon?: string | ReactNode;\n /** SVG path data for the icon, in place of `icon`. */\n readonly paths?: readonly string[] | null;\n /** Other icon content (a drawn shape or line), in place of `icon` and `paths`. */\n readonly glyph?: ReactNode;\n /** The shortcut hint, already in this platform's form (`useTranslation` gives it). */\n readonly shortcut?: string;\n /** The row cannot run. It stays focusable and names `reason`. */\n readonly disabled?: boolean;\n /** Why the row is disabled; shown as its tooltip. */\n readonly reason?: string | null;\n /** The same as `reason`, under DOCX Editor's and `Toolbar.Action`'s name. */\n readonly disabledReason?: string | null;\n /** A toggle that is on (Bold on bold text). */\n readonly active?: boolean;\n /** An on/off setting (View > Smart guides): a `menuitemcheckbox` with a check when on. */\n readonly checked?: boolean;\n /**\n * With `checked`, one choice of several (a Shadow preset, or View > Normal and Slide sorter):\n * a `menuitemradio` instead of a `menuitemcheckbox`.\n */\n readonly radio?: boolean;\n /** The chrome slot or command the row runs, as `data-slot` for hosts and tests. */\n readonly slot?: string;\n /** A class name added to the row. */\n readonly className?: string;\n /**\n * A web link: the row opens it in a new tab. Only `http`, `https`, `mailto`, `tel`, and `ftp`\n * links pass `sanitizeHref`; any other link disables the row.\n */\n readonly href?: string;\n /** Runs the row. Inside `PptxEditor.Menu` or `PptxEditor.ContextMenu`, the menu closes after. */\n readonly onSelect?: () => void;\n}\n\n/**\n * A menu row: icon, label, and shortcut. A disabled row stays focusable with `aria-disabled`,\n * so a keyboard or pointer user can read why. @public\n */\nexport function MenuRow(props: MenuRowProps) {\n const { label, icon, paths, glyph, shortcut, active, checked, slot, href } = props;\n const close = useContext(MenuCloseContext);\n const link = href === undefined ? null : sanitizeHref(href);\n const disabled = props.disabled || (link !== null && !link.ok);\n const reason = props.reason ?? props.disabledReason;\n const checkbox = checked === undefined ? {} : { 'aria-checked': checked };\n const shared = {\n role: checked === undefined ? 'menuitem' : props.radio ? 'menuitemradio' : 'menuitemcheckbox',\n ...checkbox,\n tabIndex: -1,\n className: ['pptx-menu__item pptx-menu__row', props.className].filter(Boolean).join(' '),\n 'aria-disabled': disabled || undefined,\n // The row shows its name; the tooltip adds only the reason, which is also its description.\n ...(disabled && reason ? { 'aria-description': reason, 'data-pptx-tooltip': reason } : {}),\n 'data-slot': slot,\n 'data-active': active ? '' : undefined,\n 'data-disabled': disabled ? '' : undefined,\n onClick: () => {\n if (disabled) return;\n props.onSelect?.();\n close?.();\n },\n };\n const content = (\n <>\n <span className=\"pptx-menu__icon\" aria-hidden=\"true\">\n {glyph ??\n (typeof icon === 'string' || paths ? (\n <Icon name={typeof icon === 'string' ? icon : undefined} paths={paths} />\n ) : (\n (icon ?? null)\n ))}\n </span>\n <span className=\"pptx-menu__label\">{label}</span>\n {checked ? <Icon name=\"check\" className=\"pptx-icon pptx-menu__check\" /> : null}\n {/* The shortcut is a visual hint; the row's accessible name is its label. */}\n {shortcut ? (\n <span className=\"pptx-menu__shortcut\" aria-hidden=\"true\">\n {shortcut}\n </span>\n ) : null}\n </>\n );\n if (link?.ok && !props.disabled)\n return (\n <a {...shared} href={link.href} target=\"_blank\" rel=\"noopener noreferrer\">\n {content}\n </a>\n );\n return (\n <button type=\"button\" {...shared}>\n {content}\n </button>\n );\n}\n\n/** A line between groups of rows. @public */\nexport function MenuSeparator() {\n return <div className=\"pptx-menu__sep\" role=\"separator\" />;\n}\n\n/** Props of `MenuSubmenu`. @public */\nexport interface MenuSubmenuProps {\n /** The row's label. Wins over `labelKey`. */\n readonly label?: string;\n /** A translation key for the label, as DOCX Editor's `Menu.Submenu` takes. */\n readonly labelKey?: string;\n /** A Material Symbol name, or icon content (an element). */\n readonly icon?: string | ReactNode;\n /** SVG path data for the icon, in place of `icon`. */\n readonly paths?: readonly string[] | null;\n /** Other icon content (a drawn shape or line), in place of `icon` and `paths`. */\n readonly glyph?: ReactNode;\n /** The row cannot open its panel. It stays focusable and names `reason`. */\n readonly disabled?: boolean;\n /** Why the row is disabled; shown as its tooltip. */\n readonly reason?: string | null;\n /** The submenu's own class, for a grid of shapes. */\n readonly className?: string;\n /** The rows of the cascading panel. */\n readonly children: ReactNode;\n}\n\n/**\n * A row that opens a cascading panel to its right (to its left at the window's edge). It opens\n * on hover, click, Enter, and ArrowRight, and closes on ArrowLeft and Escape, which give focus\n * back to the row. @public\n */\nexport function MenuSubmenu(props: MenuSubmenuProps) {\n const { icon, paths, glyph, disabled, reason, className, children } = props;\n const t = useContext(TranslationContext);\n const label = props.label ?? (props.labelKey ? translateKeyOrText(t, props.labelKey) : '');\n const row = useRef<HTMLButtonElement>(null);\n const panel = useRef<HTMLDivElement>(null);\n const [open, setOpen] = useState<false | 'pointer' | 'keyboard'>(false);\n const [pos, setPos] = useState<{ left: number; top: number } | null>(null);\n const close = useCallback((focusRow: boolean): void => {\n setOpen(false);\n setPos(null);\n if (focusRow) row.current?.focus();\n }, []);\n useLayoutEffect(() => {\n const r = row.current?.getBoundingClientRect();\n const p = panel.current;\n if (!open || !r || !p) return;\n setPos(\n placeInFixedFrame(\n p.parentElement,\n { width: p.offsetWidth, height: p.offsetHeight },\n (size, view) => placeSubmenu(inFixedView(r, view), size, view)\n )\n );\n }, [open]);\n // Focus moves in once the panel is placed: a hidden panel cannot take focus.\n useEffect(() => {\n if (pos && open === 'keyboard' && panel.current) focusEdge(panelItems(panel.current), 'first');\n }, [pos, open]);\n // Hovering another row of the parent menu closes this one, as in Google Slides.\n useEffect(() => {\n if (!open) return;\n const over = (e: Event): void => {\n const target = e.target as Node;\n const parent = row.current?.closest('.pptx-menu');\n if (!parent?.contains(target) || row.current?.contains(target)) return;\n close(false);\n };\n document.addEventListener('mouseover', over);\n return () => document.removeEventListener('mouseover', over);\n }, [open, close]);\n const onRowKey = (e: ReactKeyboardEvent): void => {\n if (disabled || (e.key !== 'ArrowRight' && e.key !== 'Enter' && e.key !== ' ')) return;\n e.preventDefault();\n e.stopPropagation();\n setOpen('keyboard');\n };\n const onPanelKey = (e: ReactKeyboardEvent): void => {\n if (submenuPanelKey(panel.current, e)) close(true);\n };\n return (\n <>\n <button\n ref={row}\n type=\"button\"\n role=\"menuitem\"\n tabIndex={-1}\n className=\"pptx-menu__item pptx-menu__row\"\n aria-haspopup=\"menu\"\n aria-expanded={!!open}\n aria-disabled={disabled || undefined}\n {...(disabled && reason\n ? { 'aria-description': reason, ...tooltipAttributes(label, true, reason) }\n : {})}\n data-open={open ? '' : undefined}\n onMouseEnter={() => !disabled && setOpen((o) => o || 'pointer')}\n onClick={() => !disabled && setOpen('keyboard')}\n onKeyDown={onRowKey}\n >\n <span className=\"pptx-menu__icon\" aria-hidden=\"true\">\n {glyph ??\n (typeof icon === 'string' || paths ? (\n <Icon name={typeof icon === 'string' ? icon : undefined} paths={paths} />\n ) : (\n (icon ?? null)\n ))}\n </span>\n <span className=\"pptx-menu__label\">{label}</span>\n <Icon name=\"chevron_right\" className=\"pptx-icon pptx-menu__caret\" />\n </button>\n {open\n ? createPortal(\n <div\n ref={panel}\n className={`pptx-menu pptx-menu--submenu${className ? ` ${className}` : ''}`}\n role=\"menu\"\n aria-label={label}\n style={pos ?? { visibility: 'hidden', left: 0, top: 0 }}\n onMouseDown={keepFocus}\n onMouseMove={(e) => focusMenuRowAtPointer(panel.current, e)}\n onKeyDown={onPanelKey}\n >\n {children}\n </div>,\n scopeOf(row.current)\n )\n : null}\n </>\n );\n}\n","// One chrome slot as a control sees it: the engine's command state, the registry's label, and\n// the tooltip that names the engine's reason when the control is disabled.\n\nimport { tooltipAttributes, translateKeyOrText } from '@pptx-editor.dev/core/editor';\nimport type {\n ChromeControl,\n ChromeSlotId,\n ChromeTooltipAttributes,\n} from '@pptx-editor.dev/core/editor';\n\nimport { useEditorCommand, useTranslation, type UseEditorCommandReturn } from './context.ts';\n\n/** Props of every slot part: the slot id and its registry entry. */\nexport interface SlotPartProps {\n readonly slot: ChromeSlotId;\n readonly control: ChromeControl;\n}\n\n/**\n * A slot's command, its translated label, and its tooltip attributes (with the reason on its\n * own line when disabled).\n */\nexport function useSlot(\n slot: ChromeSlotId,\n control: ChromeControl\n): {\n readonly cmd: UseEditorCommandReturn;\n readonly label: string;\n readonly reason: string | null;\n readonly tip: ChromeTooltipAttributes;\n} {\n const cmd = useEditorCommand(slot);\n const { t } = useTranslation();\n const label = t(control.labelKey);\n const reason = cmd.disabledReason ? translateKeyOrText(t, cmd.disabledReason) : null;\n return { cmd, label, reason, tip: tooltipAttributes(label, !cmd.isEnabled, reason) };\n}\n","/** @jsxImportSource react */\n// Provider-first host for the editor facade (docx-editor/packages/react/src/editor/DocxEditorRoot.tsx).\n//\n// `Root` renders no DOM of its own: it creates the instance in an effect (StrictMode-safe: a\n// fresh instance per effect run, destroyed on cleanup), publishes it through context, and lets\n// `Content` attach the surface wherever the host's tree puts it.\n\nimport {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\nimport {\n createEditorRefApi,\n createPptxEditor,\n localeContentKey,\n repaintSurfaceOf,\n reportFontError,\n translateKeyOrText,\n warnModulesChanged,\n type ColorMode,\n type CommandResult,\n type EditorCommand,\n type EditorExecOptions,\n type EditorSnapshot,\n type EditorFontError,\n type EditorFontsOption,\n type EditorMode,\n type EditorModule,\n type PptxEditorInstance,\n} from '@pptx-editor.dev/core/editor';\nimport type { LocaleCatalog } from '@pptx-editor.dev/i18n';\nimport {\n PptxEditorContext,\n SlideshowContext,\n TranslationContext,\n translatorFor,\n usePptxEditor,\n} from './context.ts';\nimport { useSlideshowHandle } from './Slideshow.tsx';\nimport { useCanvasContextMenu } from './CanvasContextMenu.tsx';\nimport { DialogProvider, type PptxEditorPopups } from './popups.tsx';\nimport { ChromeActionHostProvider } from './chrome-actions.tsx';\nimport { SlideSorterWatch } from './SlideSorter.tsx';\nimport { ChromeTooltip } from './ChromeTooltip.tsx';\nimport {\n ChromeDarkContext,\n ScopedByAncestorContext,\n useChromeDark,\n useResolvedDark,\n} from './color-mode.ts';\nimport { PaneStateContext, type PaneState } from './pane-state.ts';\n\n/** Props for `PptxEditor.Root`. Only `document` identity reloads the document. @public */\nexport interface PptxEditorRootProps {\n /** `.pptx` bytes. Identity change loads the new document. */\n readonly document?: Uint8Array;\n /** `'edit'` (default) or `'view'`. Changes apply without a reload. */\n readonly mode?: EditorMode;\n /** UI locale catalog; English when omitted. */\n readonly locale?: LocaleCatalog;\n /** Fired once per instance after it is published. */\n readonly onReady?: (editor: PptxEditorInstance) => void;\n /** Fired after every change of editor state. */\n readonly onChange?: (editor: PptxEditorInstance) => void;\n /**\n * Font bytes for the host's faces, as DOCX Editor's `fonts` prop: a `FontConfiguration`, a\n * fragment, or a `FontResolver` such as `packagedFonts()`. Use `useFonts(...)` for a stable\n * value. A change replaces the fonts in place (`setFonts`); the document, the selection, and\n * the undo history stay. Omitted, the packaged substitutes load and nothing is fetched.\n */\n readonly fonts?: EditorFontsOption;\n /** Called for each font failure: a failed origin, a refused face, or a failed resolution. */\n readonly onFontError?: (error: EditorFontError) => void;\n /**\n * Families the font picker offers besides the standard ones and the deck's own. A change\n * updates the picker in place (`setFontFamilies`); the document and the undo history stay.\n */\n readonly fontFamilies?: readonly string[];\n /**\n * Capability modules, as DOCX Editor's `modules` prop: the review and collaboration modules\n * of `@pptx-editor.dev/pro`. Read once, when the editor is created: a later change has no\n * effect and prints a development warning. Create the list once, outside the component.\n */\n readonly modules?: readonly EditorModule[];\n /** Customize the dialogs the editor mounts. Set an entry to `false` to turn one off. */\n readonly popups?: PptxEditorPopups;\n /**\n * The chrome color mode: `'light'` (default), `'dark'`, or `'system'`, which follows the\n * operating system. Only the chrome is themed; the slide keeps the deck's own colors.\n */\n readonly colorMode?: ColorMode;\n /** The editor's layout: a `PptxEditor.Viewport` with its parts. */\n readonly children?: ReactNode;\n}\n\n/**\n * The imperative handle of `PptxEditor` and `PptxEditor.Root`, as DOCX Editor's\n * `DocxEditorRef`, and the same members as the Vue adapter's. Every member forwards to the\n * editor instance and is safe to call before the editor mounts: `load` and `exec` refuse with\n * `disabled.noEditor`, `save` and `getEditor` return `null`, `focus` does nothing, and\n * `snapshot` returns an empty snapshot. Everything else is on the instance that `getEditor`\n * returns. @public\n */\nexport interface PptxEditorRef {\n /** Open `.pptx` bytes. Resolves when the presentation is open, or with the refusal. */\n load(bytes: Uint8Array): Promise<CommandResult>;\n /**\n * The presentation as `.pptx` bytes, or `null` when no presentation is open. The bytes own an\n * `ArrayBuffer`, so `new Blob([bytes])` takes them as they are.\n */\n save(): Uint8Array<ArrayBuffer> | null;\n /** The editor instance, or `null` before it mounts. */\n getEditor(): PptxEditorInstance | null;\n /** Give the keyboard back to the slide: the text caret, else the slide surface. */\n focus(): void;\n /** Run a command, as `editor.exec`. */\n exec(command: EditorCommand, options?: EditorExecOptions): CommandResult;\n /** The current editor state, as `editor.snapshot()`. */\n snapshot(): EditorSnapshot;\n}\n\n/** Owns the editor instance. Takes a `ref` to a `PptxEditorRef`. @public */\nexport const PptxEditorRoot = forwardRef<PptxEditorRef, PptxEditorRootProps>(\n function PptxEditorRoot(props, ref) {\n const { document: bytes, mode = 'edit', locale, onReady, onChange, children } = props;\n const [editor, setEditor] = useState<PptxEditorInstance | null>(null);\n // The live instance for the ref: read at each call, so the handle never goes stale.\n const live = useRef<PptxEditorInstance | null>(null);\n useImperativeHandle(ref, () => createEditorRefApi(() => live.current), []);\n const callbacks = useRef({ onReady, onChange, onFontError: props.onFontError });\n callbacks.current = { onReady, onChange, onFontError: props.onFontError };\n // The fonts the instance was created with: only a later change reaches `setFonts`.\n const createdFonts = useRef(props.fonts);\n // The same for `fontFamilies` and `setFontFamilies`.\n const createdFamilies = useRef(props.fontFamilies);\n // The modules the instance was created with: modules register at creation only.\n const createdModules = useRef(props.modules);\n\n // The translator follows the catalog's content, not its identity: an inline `locale={{...}}`\n // makes a new object on each render and must not retranslate or repaint.\n const localeKey = localeContentKey(locale);\n const translator = useRef<{ key: string; t: ReturnType<typeof translatorFor> } | null>(null);\n if (translator.current?.key !== localeKey)\n translator.current = { key: localeKey, t: translatorFor(locale) };\n const t = translator.current.t;\n const tRef = useRef(t);\n tRef.current = t;\n useEffect(() => {\n const instance = createPptxEditor({\n mode,\n ...(props.fontFamilies ? { fontFamilies: props.fontFamilies } : {}),\n ...(props.fonts ? { fonts: props.fonts } : {}),\n ...(props.modules ? { modules: props.modules } : {}),\n onFontError: (error) => reportFontError(error, callbacks.current.onFontError),\n translate: (key, params) => translateKeyOrText(tRef.current, key, params),\n });\n createdFonts.current = props.fonts;\n createdFamilies.current = props.fontFamilies;\n createdModules.current = props.modules;\n live.current = instance;\n setEditor(instance);\n callbacks.current.onReady?.(instance);\n const off = instance.subscribe(() => callbacks.current.onChange?.(instance));\n return () => {\n off();\n if (live.current === instance) live.current = null;\n instance.destroy();\n };\n // The instance lives for the component; mode and document apply through setters below.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (editor && bytes) void editor.load(bytes);\n }, [editor, bytes]);\n\n useEffect(() => {\n editor?.setMode(mode);\n }, [editor, mode]);\n\n // A `modules` change after creation has no effect: say so in development. The check is by\n // the identity of each module, so an inline array of the same modules does not warn.\n const modules = props.modules;\n useEffect(() => {\n if (editor) warnModulesChanged(createdModules.current, modules, 'PptxEditor.Root');\n }, [editor, modules]);\n\n // A new `fonts` value replaces the instance's fonts in place. The instance a remount just\n // created already has them, so only a change after creation reaches `setFonts`.\n const fonts = props.fonts;\n useEffect(() => {\n if (!editor || createdFonts.current === fonts) return;\n createdFonts.current = fonts;\n // Rejects only after destroy; font failures report through `onFontError`.\n editor.setFonts(fonts).catch(() => {});\n }, [editor, fonts]);\n\n // A new `fontFamilies` list updates the font picker in place. The instance compares by\n // content, so an inline array made on each render changes nothing.\n const fontFamilies = props.fontFamilies;\n useEffect(() => {\n if (!editor || createdFamilies.current === fontFamilies) return;\n createdFamilies.current = fontFamilies;\n editor.setFontFamilies(fontFamilies ?? []);\n }, [editor, fontFamilies]);\n\n // A locale change repaints the canvas once, for its placeholder prompts and frame labels,\n // which the engine translates through `tRef`. The repaint emits no `change`, so a host whose\n // `onChange` sets state does not loop.\n const painted = useRef(localeKey);\n useEffect(() => {\n if (!editor || painted.current === localeKey) return;\n painted.current = localeKey;\n repaintSurfaceOf(editor);\n }, [editor, localeKey]);\n\n const slideshow = useSlideshowHandle(editor);\n const dark = useResolvedDark(props.colorMode);\n const [notesOpen, setNotesOpen] = useState<boolean | undefined>(undefined);\n const notesRequest = useRef<((open: boolean) => void) | null>(null);\n const panes = useMemo<PaneState>(\n () => ({ notesOpen, setNotesOpen, notesRequest }),\n [notesOpen]\n );\n\n return (\n <PptxEditorContext.Provider value={editor}>\n <TranslationContext.Provider value={t}>\n <SlideshowContext.Provider value={slideshow}>\n <ChromeDarkContext.Provider value={dark}>\n <PaneStateContext.Provider value={panes}>\n <DialogProvider {...(props.popups ? { popups: props.popups } : {})}>\n <ChromeActionHostProvider>\n {children}\n <SlideSorterWatch />\n <ChromeTooltip />\n </ChromeActionHostProvider>\n </DialogProvider>\n </PaneStateContext.Provider>\n </ChromeDarkContext.Provider>\n </SlideshowContext.Provider>\n </TranslationContext.Provider>\n </PptxEditorContext.Provider>\n );\n }\n);\n\n/** The props of `PptxEditorViewport`. @public */\nexport interface PptxEditorViewportProps {\n /** Appended after the `pptx-editor` class. */\n className?: string;\n /** The chrome and the content of the editor. */\n children?: ReactNode;\n}\n\n/**\n * The editor's scroll and styling scope: carries the `.pptx-editor` class, and `dark` with it\n * when the root's `colorMode` resolves to dark. @public\n */\nexport function PptxEditorViewport({ className, children }: PptxEditorViewportProps) {\n const dark = useChromeDark();\n return (\n <div className={['pptx-editor', dark ? 'dark' : '', className].filter(Boolean).join(' ')}>\n <ScopedByAncestorContext.Provider value>{children}</ScopedByAncestorContext.Provider>\n </div>\n );\n}\n\n/** The props of `PptxEditorContent`. @public */\nexport interface PptxEditorContentProps {\n /** Appended after the `pptx-canvas` class. */\n className?: string;\n}\n\n/**\n * The slide canvas: attaches the engine surface in a layout effect. Right-click, Shift+F10, and\n * the Menu key open its context menu. @public\n */\nexport function PptxEditorContent({ className }: PptxEditorContentProps) {\n const editor = usePptxEditor();\n const host = useRef<HTMLDivElement>(null);\n const menu = useCanvasContextMenu();\n useLayoutEffect(() => {\n if (!editor || !host.current) return;\n editor.attach(host.current);\n return () => editor.detach();\n }, [editor]);\n return (\n <>\n <div\n ref={host}\n className={`pptx-canvas${className ? ` ${className}` : ''}`}\n data-pptx-canvas=\"\"\n onContextMenu={menu.onContextMenu}\n onKeyDown={menu.onKeyDown}\n />\n {menu.layer}\n </>\n );\n}\n","/** @jsxImportSource react */\n// The slide show: full screen (the Fullscreen API, or a window-covering overlay when the\n// browser refuses), one slide painted by the engine's `paintSlide`, the usual show keys, and an\n// auto-hiding control bar. Navigation state is the engine's `SlideshowController`; this\n// component only paints it and feeds input in. Full screen, the start keys, the show keys, the\n// screen size, and links are core's (`slideshow-screen.ts`), shared with the Vue\n// `PptxEditorSlideshow`.\n\nimport {\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n type MouseEvent as ReactMouseEvent,\n} from 'react';\nimport {\n SLIDESHOW_IDLE_MS,\n enterSlideshowScreen,\n fitSlideToScreen,\n listenSlideshowKeys,\n listenSlideshowStartKeys,\n observeSlideshowScreen,\n openSlideshowLink,\n paintSlideshowSlide,\n slideshowLinkUnder,\n startSlideshowController,\n translateKeyOrText,\n type PptxEditorInstance,\n type SlideshowController,\n type SlideshowScreenSize,\n} from '@pptx-editor.dev/core/editor';\nimport { Icon } from './chrome.tsx';\nimport {\n type UseSlideshowReturn,\n useEditorState,\n usePptxEditor,\n useSlideshow,\n useTranslation,\n} from './context.ts';\n\n/**\n * The slide show state `PptxEditor.Root` publishes: the running controller, and start and stop.\n * A show starts only on an open document with slides; viewing mode can present. @internal\n */\nexport function useSlideshowHandle(editor: PptxEditorInstance | null): UseSlideshowReturn {\n const [show, setShow] = useState<SlideshowController | null>(null);\n return useMemo(\n () => ({\n controller: show,\n start(from: 'start' | 'current') {\n const next = startSlideshowController(editor, from);\n if (next) setShow(next);\n },\n stop: () => setShow(null),\n }),\n [editor, show]\n );\n}\n\n/**\n * The slide show of the editor in `PptxEditor.Root`. Mount it once inside the viewport. It\n * shows nothing until a show starts: `useSlideshow().start(...)`, or the keys F5 (from the\n * start) and Shift+F5 or Ctrl/Cmd+Enter (from the current slide). @public\n */\nexport function Slideshow() {\n const editor = usePptxEditor();\n const show = useSlideshow();\n const anchor = useRef<HTMLSpanElement>(null);\n const { start } = show;\n\n // The show start keys, while focus is in this editor (or on nothing). The listener stays\n // registered while a show runs and reads the live state, so a start key pressed right after\n // a show ends is never lost in the gap before an effect could register it again.\n const running = useRef(show.controller !== null);\n running.current = show.controller !== null;\n const startRef = useRef(start);\n startRef.current = start;\n useEffect(() => {\n if (!editor) return;\n return listenSlideshowStartKeys(\n () => anchor.current,\n () => running.current,\n (from) => startRef.current(from)\n );\n }, [editor]);\n\n if (!editor || !show.controller) return <span ref={anchor} hidden />;\n return <SlideshowScreen editor={editor} controller={show.controller} onClose={show.stop} />;\n}\n\nfunction SlideshowScreen({\n editor,\n controller,\n onClose,\n}: {\n editor: PptxEditorInstance;\n controller: SlideshowController;\n onClose: () => void;\n}) {\n const { t } = useTranslation();\n const root = useRef<HTMLDivElement>(null);\n const slide = useRef<HTMLDivElement>(null);\n const subscribe = useCallback((cb: () => void) => controller.subscribe(cb), [controller]);\n const get = useCallback(() => controller.state, [controller]);\n const state = useSyncExternalStore(subscribe, get, get);\n const width = useEditorState((s) => s.slideWidth);\n const height = useEditorState((s) => s.slideHeight);\n const renderKey = useEditorState((s) => s.slides[state.index]?.key ?? '');\n const [size, setSize] = useState<SlideshowScreenSize>({ w: 0, h: 0, dpr: 1 });\n const [bar, setBar] = useState(false);\n const [link, setLink] = useState(false);\n const idle = useRef<ReturnType<typeof setTimeout> | null>(null);\n const overBar = useRef(false);\n\n // The deck can change under a running show (fonts load, a collaborator edits).\n useEffect(\n () => editor.subscribe(() => controller.update(editor.snapshot().slides)),\n [editor, controller]\n );\n\n // The show ended: the editor returns to the slide shown last.\n useEffect(() => {\n if (!state.done) return;\n editor.goToSlide(state.index);\n onClose();\n }, [state.done, state.index, editor, onClose]);\n\n // Full screen when the browser allows it; the fixed overlay covers the window otherwise\n // (core's `enterSlideshowScreen`). A layout effect, so focus returns in the same commit that\n // removes the show, not after the next paint.\n useLayoutEffect(() => {\n const el = root.current;\n if (!el) return;\n return enterSlideshowScreen(el);\n }, [controller]);\n\n // Every key goes to the show. A layout effect, so the listener leaves in the same commit as\n // the show: a start key pressed right after the show ends is not swallowed by a listener that\n // a passive cleanup has not removed.\n useLayoutEffect(() => listenSlideshowKeys(controller, () => root.current), [controller]);\n\n // The screen size, in CSS and device pixels.\n useLayoutEffect(() => {\n const el = root.current;\n if (!el) return;\n return observeSlideshowScreen(el, setSize);\n }, []);\n\n // Paint the slide on show with the editor's own painter.\n useLayoutEffect(() => {\n const el = slide.current;\n const session = editor.session;\n if (!el) return;\n if (!session || state.screen === 'end') {\n el.replaceChildren();\n return;\n }\n const svg = paintSlideshowSlide(el.ownerDocument, session, state.index, {\n frameLabel: (kind) =>\n t('canvas.placeholderObject', { kind: translateKeyOrText(t, `canvas.kinds.${kind}`) }),\n });\n el.replaceChildren(...(svg ? [svg] : []));\n }, [editor, state.index, state.screen, renderKey, t]);\n\n useEffect(\n () => () => {\n if (idle.current) clearTimeout(idle.current);\n },\n []\n );\n\n const fit = fitSlideToScreen(size.w, size.h, width, height, size.dpr);\n\n const linkAt = (e: ReactMouseEvent): string | null =>\n slideshowLinkUnder(editor.session, state, slide.current, width, height, e.clientX, e.clientY);\n\n const onMove = (e: ReactMouseEvent): void => {\n setBar(true);\n setLink(!!linkAt(e));\n if (idle.current) clearTimeout(idle.current);\n idle.current = setTimeout(() => {\n if (!overBar.current) setBar(false);\n }, SLIDESHOW_IDLE_MS);\n };\n\n const onClick = (e: ReactMouseEvent): void => {\n if (e.button !== 0) return;\n const href = linkAt(e);\n if (href) openSlideshowLink(e.currentTarget.ownerDocument, href);\n else controller.next();\n };\n\n const position = t('slideshow.position', {\n current: state.index + 1,\n total: state.slideCount,\n });\n return (\n <div\n ref={root}\n className=\"pptx-show\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={t('slideshow.ariaLabel')}\n tabIndex={-1}\n data-screen={state.screen}\n data-idle={!bar}\n data-link={link}\n onMouseMove={onMove}\n onClick={onClick}\n >\n <div\n ref={slide}\n className=\"pptx-show__slide\"\n data-slide-index={state.index}\n style={{ left: fit.left, top: fit.top, width: fit.width, height: fit.height }}\n />\n {state.screen === 'black' || state.screen === 'white' ? (\n <div className=\"pptx-show__blank\" data-color={state.screen} />\n ) : null}\n {state.screen === 'end' ? <div className=\"pptx-show__end\">{t('slideshow.end')}</div> : null}\n {state.typed ? (\n <div className=\"pptx-show__goto\" role=\"status\">\n {t('slideshow.goTo', { number: state.typed })}\n </div>\n ) : null}\n <div\n className=\"pptx-show__bar\"\n role=\"toolbar\"\n aria-label={t('slideshow.controls')}\n data-visible={bar}\n onClick={(e) => e.stopPropagation()}\n onMouseEnter={() => (overBar.current = true)}\n onMouseLeave={() => (overBar.current = false)}\n >\n <button\n type=\"button\"\n className=\"pptx-show__button\"\n aria-label={t('slideshow.previous')}\n title={t('slideshow.previous')}\n onClick={() => controller.previous()}\n >\n <Icon name=\"keyboard_arrow_left\" className=\"\" />\n </button>\n <span className=\"pptx-show__position\" aria-live=\"polite\">\n {position}\n </span>\n <button\n type=\"button\"\n className=\"pptx-show__button\"\n aria-label={t('slideshow.next')}\n title={t('slideshow.next')}\n onClick={() => controller.next()}\n >\n <Icon name=\"keyboard_arrow_right\" className=\"\" />\n </button>\n <button\n type=\"button\"\n className=\"pptx-show__button\"\n aria-label={t('slideshow.exit')}\n title={t('slideshow.exit')}\n onClick={() => controller.exit()}\n >\n <Icon name=\"close\" className=\"\" />\n </button>\n </div>\n </div>\n );\n}\n","/** @jsxImportSource react */\n// The slide canvas's context menu request. The engine surface stops the browser's own menu and\n// selects what is under the pointer first (`surface-context-menu.ts`); this hook reads the\n// selection, opens a menu request for it (shapes, text being edited, or empty slide area), and\n// renders the `popups.contextMenu` entry (or the entry of a `PptxEditor.ContextMenu` placed in\n// the root): the packaged `PptxEditor.ContextMenu` by default, a\n// host renderer, or nothing for `false`. The rows live in `context-menu-parts.tsx`.\n\nimport {\n useEffect,\n useMemo,\n useRef,\n useState,\n type KeyboardEvent as ReactKeyboardEvent,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n} from 'react';\nimport {\n canvasMenuKind,\n canvasMenuPoint,\n isContextMenuKey,\n type CanvasMenuKind,\n} from '@pptx-editor.dev/core/editor';\nimport type { ContextMenuPoint } from './ContextMenu.tsx';\nimport { usePptxEditor } from './context.ts';\nimport {\n ContextMenuTargetProvider,\n PptxEditorContextMenu,\n type ContextMenuRequest,\n} from './context-menu-parts.tsx';\nimport { useCanvasMenuEntry } from './popups.tsx';\n\ninterface CanvasMenuState {\n readonly at: ContextMenuPoint;\n readonly kind: CanvasMenuKind;\n readonly keyboard: boolean;\n readonly owner: HTMLElement;\n}\n\n/**\n * The canvas context menu. Returns the handlers the canvas host binds (right-click, Shift+F10,\n * and the Menu key) and the layer that renders the open menu.\n */\nexport function useCanvasContextMenu(): {\n readonly onContextMenu: (e: ReactMouseEvent<HTMLElement>) => void;\n readonly onKeyDown: (e: ReactKeyboardEvent<HTMLElement>) => void;\n readonly layer: ReactNode;\n} {\n const editor = usePptxEditor();\n const entry = useCanvasMenuEntry();\n const [menu, setMenu] = useState<CanvasMenuState | null>(null);\n // An entry that turns `false` (a placed menu turned `disabled`) closes the open menu.\n useEffect(() => {\n if (entry === false) setMenu(null);\n }, [entry]);\n const keyboardAt = useRef(0);\n const open = (owner: HTMLElement, at: ContextMenuPoint | null): void => {\n if (entry === false || !editor || editor.snapshot().status !== 'ready') return;\n const kind = canvasMenuKind(editor.snapshot());\n // From the keyboard: open at the selection, or at the middle of the canvas.\n const point = canvasMenuPoint(owner, at);\n setMenu({ at: point, kind, keyboard: at === null, owner });\n };\n const onContextMenu = (e: ReactMouseEvent<HTMLElement>): void => {\n e.preventDefault();\n // A Menu key press that also fires `contextmenu` opens the menu once.\n if (Date.now() - keyboardAt.current < 500) return;\n const pointer = e.clientX !== 0 || e.clientY !== 0;\n open(e.currentTarget, pointer ? { x: e.clientX, y: e.clientY } : null);\n };\n const onKeyDown = (e: ReactKeyboardEvent<HTMLElement>): void => {\n if (!isContextMenuKey(e)) return;\n e.preventDefault();\n e.stopPropagation();\n keyboardAt.current = Date.now();\n open(e.currentTarget, null);\n };\n const target = useMemo<ContextMenuRequest | null>(\n () => (menu ? { ...menu, close: () => setMenu(null) } : null),\n [menu]\n );\n const layer =\n target && entry !== false ? (\n <ContextMenuTargetProvider value={target}>\n {typeof entry === 'function' ? entry({}) : <PptxEditorContextMenu />}\n </ContextMenuTargetProvider>\n ) : null;\n return { onContextMenu, onKeyDown, layer };\n}\n","/** @jsxImportSource react */\n// `PptxEditor.ContextMenu`: the slide canvas's context menu as library parts, after DOCX\n// Editor's `DocxEditor.ContextMenu` (docx-editor/docs/site/content/customization/menus.mdx,\n// packages/react/src/editor/contextmenu/).\n//\n// The canvas opens a menu request (right-click, Shift+F10, the Menu key) for what is under the\n// pointer: shapes, text being edited, or empty slide area. The menu renders core's\n// `CANVAS_CONTEXT_MENUS` rows for that kind. `ContextMenu.Slot slotId` replaces or hides one\n// row in place, other children add rows at the end, and `preset={false}` keeps only the\n// children. The `popups.contextMenu` registry entry, or a menu placed in the root, decides\n// what the canvas renders.\n\nimport type { ChromeTranslate } from '@pptx-editor.dev/core/editor';\nimport {\n Children,\n Fragment,\n createContext,\n isValidElement,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n type ReactNode,\n} from 'react';\nimport {\n CANVAS_CONTEXT_MENUS,\n CONTEXT_MENU_NAMED_PARTS,\n arrangeMenuRows,\n canvasMenuLabelKey,\n warnMenuPart,\n type CanvasMenuKind,\n} from '@pptx-editor.dev/core/editor';\nimport {\n ContextMenu,\n MenuCloseContext,\n MenuSeparator,\n type ContextMenuPoint,\n} from './ContextMenu.tsx';\nimport { TranslationContext, useTranslation } from './context.ts';\nimport { ToolbarContext } from './headless-hooks.tsx';\nimport { useCanvasMenuRegistry } from './popups.tsx';\nimport { MenuEntries } from './menu-rows.tsx';\nimport { defineMenuRowParts, menuSlotRowOf } from './menu-parts.tsx';\n\n/** The named rows of the canvas context menu (`ContextMenu.Cut`, …), from core's table. */\nexport const CONTEXT_MENU_ROW_PARTS = defineMenuRowParts(CONTEXT_MENU_NAMED_PARTS);\n\n/** What a canvas context menu opened on, and where. @public */\nexport interface ContextMenuRequest {\n /**\n * Shapes, pictures only (`picture`, the picture menu), text being edited, or empty\n * slide area. A selection of pictures only reports `picture`, not `shapes`.\n */\n readonly kind: CanvasMenuKind;\n /** Where the menu opens, in client pixels. */\n readonly at: ContextMenuPoint;\n /** Opened from the keyboard: focus goes to the first row. */\n readonly keyboard: boolean;\n /** The canvas element the menu opened on. */\n readonly owner: HTMLElement;\n /** Close the menu. */\n readonly close: () => void;\n}\n\nconst TargetContext = createContext<ContextMenuRequest | null>(null);\n\n/** Provides the open menu request to `PptxEditor.ContextMenu`. @internal */\nexport const ContextMenuTargetProvider = TargetContext.Provider;\n\n/**\n * The open canvas context menu, for a host's own rows: what it opened on, where, and how to\n * close it. Null outside an open menu. @public\n */\nexport function useContextMenuRequest(): ContextMenuRequest | null {\n return useContext(TargetContext);\n}\n\n/**\n * The element the open context menu opened on (the slide canvas), or null while no menu is\n * open. The same hook as DOCX Editor's. @public\n */\nexport function useContextMenuTarget(): HTMLElement | null {\n return useContext(TargetContext)?.owner ?? null;\n}\n\n/** Props for `PptxEditor.ContextMenu`. @public */\nexport interface PptxEditorContextMenuProps {\n /**\n * Your translation function for this compound and its parts, as DOCX Editor's `t`. Without\n * it, the root's `locale` gives the labels.\n */\n readonly t?: ChromeTranslate;\n /** A class name added to the menu. */\n readonly className?: string;\n /**\n * `true` (default): the built-in rows for the target, with `ContextMenu.Slot` children\n * replacing their rows in place and other children added at the end. `false`: only the\n * children.\n */\n readonly preset?: boolean;\n /**\n * `true` shows no canvas menu, as DOCX Editor's `disabled`. An open menu closes. Default\n * `false`.\n */\n readonly disabled?: boolean;\n /** Called with `true` when the menu opens and `false` when it closes. */\n readonly onOpenChange?: (open: boolean) => void;\n /** `ContextMenu.Slot` children change built-in rows; other children add rows. */\n readonly children?: ReactNode;\n}\n\ntype NodeProps = Record<string, unknown> & { children?: ReactNode };\n\nconst flatten = (nodes: ReactNode): ReactNode[] =>\n Children.toArray(nodes).flatMap((node) =>\n isValidElement<NodeProps>(node) && node.type === Fragment\n ? flatten(node.props.children)\n : [node]\n );\n\n/**\n * The slide canvas's context menu. Place it in `PptxEditor.Root` or `PptxEditor.Viewport`, as\n * DOCX Editor's `DocxEditor.ContextMenu`, or render it from the `popups.contextMenu` entry. A\n * placed menu gives the canvas the same entry, and an explicit `popups.contextMenu` entry wins.\n *\n * @example\n * ```tsx\n * <PptxEditor.Root>\n * <PptxEditor.Viewport>\n * <PptxEditor.Content />\n * <PptxEditor.ContextMenu onOpenChange={setMenuOpen}>\n * <PptxEditor.ContextMenu.Slot slotId=\"format.painter\" hidden />\n * <PptxEditor.ContextMenu.Item label=\"Ask legal\" icon=\"info\" onSelect={askLegal} />\n * </PptxEditor.ContextMenu>\n * </PptxEditor.Viewport>\n * </PptxEditor.Root>\n * ```\n *\n * @public\n */\nexport function PptxEditorContextMenu(props: PptxEditorContextMenuProps): ReactNode {\n const target = useContextMenuRequest();\n const registry = useCanvasMenuRegistry();\n const placed = !target && registry !== null;\n usePlacedCanvasMenu(placed ? registry : null, props);\n useOpenChange(target && !props.disabled ? target : null, props);\n if (target) return <OpenContextMenu target={target} {...props} />;\n if (!placed) warnMenuPart('PptxEditor.ContextMenu', 'outsideContextMenu');\n return null;\n}\n\n/**\n * A menu placed in the root gives the canvas its entry: the same menu, with the `t` and the\n * locale of where it was placed, or `false` while it is `disabled`.\n */\nfunction usePlacedCanvasMenu(\n registry: ReturnType<typeof useCanvasMenuRegistry>,\n props: PptxEditorContextMenuProps\n): void {\n const token = useRef({}).current;\n const host = useContext(ToolbarContext);\n const translate = useContext(TranslationContext);\n const { disabled, className, preset, onOpenChange, children } = props;\n const entry = useMemo(\n () =>\n disabled\n ? (false as const)\n : () => (\n <ToolbarContext.Provider value={host}>\n <TranslationContext.Provider value={translate}>\n <PptxEditorContextMenu\n {...(className !== undefined ? { className } : {})}\n {...(preset !== undefined ? { preset } : {})}\n {...(onOpenChange ? { onOpenChange } : {})}\n >\n {children}\n </PptxEditorContextMenu>\n </TranslationContext.Provider>\n </ToolbarContext.Provider>\n ),\n [disabled, className, preset, onOpenChange, children, host, translate]\n );\n useLayoutEffect(() => {\n if (registry) registry.place(token, entry);\n }, [registry, token, entry]);\n useLayoutEffect(() => (registry ? () => registry.remove(token) : undefined), [registry, token]);\n}\n\n/** `onOpenChange` hears each open and close of the menu, once. */\nfunction useOpenChange(\n target: ContextMenuRequest | null,\n { onOpenChange }: PptxEditorContextMenuProps\n): void {\n const handler = useRef(onOpenChange);\n handler.current = onOpenChange;\n const open = target !== null;\n useEffect(() => {\n if (!open) return undefined;\n handler.current?.(true);\n return () => handler.current?.(false);\n }, [open]);\n}\n\nfunction OpenContextMenu({\n target,\n className,\n preset = true,\n disabled,\n children,\n}: PptxEditorContextMenuProps & { readonly target: ContextMenuRequest }): ReactNode {\n const { t } = useTranslation();\n // `disabled` turning on closes an open menu.\n useEffect(() => {\n if (disabled) target.close();\n }, [disabled, target]);\n if (disabled) return null;\n let content: ReactNode = children;\n if (preset) {\n // A hidden row for a row this target lacks (a text row on a shape) is no extra row.\n const {\n entries: shown,\n overrides,\n extras,\n } = arrangeMenuRows(CANVAS_CONTEXT_MENUS[target.kind], flatten(children), menuSlotRowOf);\n content = (\n <>\n <MenuEntries entries={shown} overrides={overrides} />\n {extras.length ? <MenuSeparator /> : null}\n {extras}\n </>\n );\n }\n const label = t(canvasMenuLabelKey(target.kind));\n return (\n <ContextMenu\n at={target.at}\n onClose={target.close}\n label={label}\n keyboard={target.keyboard}\n owner={target.owner}\n {...(className ? { className } : {})}\n >\n <MenuCloseContext.Provider value={target.close}>{content}</MenuCloseContext.Provider>\n </ContextMenu>\n );\n}\n","/** @jsxImportSource react */\n// The popups registry, after DOCX Editor's (docx-editor/packages/react/src/editor/popup-config.tsx,\n// popup-renderer.ts, dialog-host.tsx). `PptxEditor.Root` mounts the editor's dialogs. A host\n// changes one through `popups`: a render callback replaces the packaged dialog, and `false`\n// turns off automatic rendering. The operation behind a dialog never depends on it.\n//\n// Every packaged opener (the Format panel, the rail and canvas menus) and any host chrome open\n// a dialog with `useEditorDialog(key).open()`, so a host renderer receives the request from all\n// of them. As in DOCX Editor's dialog host, focus returns to the opener when the dialog closes,\n// and a dialog closes when the editor opens another document.\n\nimport {\n createContext,\n createElement,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n type ComponentType,\n type ReactNode,\n} from 'react';\nimport { BackgroundDialog, type BackgroundDialogProps } from './BackgroundDialog.tsx';\nimport { ImageAltTextDialog, type ImageAltTextDialogProps } from './ImageAltTextDialog.tsx';\nimport {\n ImagePropertiesDialog,\n type ImagePropertiesDialogProps,\n} from './ImagePropertiesDialog.tsx';\nimport { PageSetupDialog, type PageSetupDialogProps } from './PageSetupDialog.tsx';\nimport { ParagraphDialog, type ParagraphDialogProps } from './ParagraphDialog.tsx';\nimport { FontDialog, type FontDialogProps } from './FontDialog.tsx';\nimport {\n BulletsAndNumberingDialog,\n type BulletsAndNumberingDialogProps,\n} from './BulletsAndNumberingDialog.tsx';\nimport { ColumnsDialog, type ColumnsDialogProps } from './ColumnsDialog.tsx';\nimport { markReadingPopup } from '@pptx-editor.dev/core/editor';\nimport { usePptxEditor } from './context.ts';\nimport type { PptxEditorContextMenuProps } from './context-menu-parts.tsx';\nimport type { RailContextMenuProps } from './RailContextMenu.tsx';\nimport type { SectionContextMenuProps } from './RailSections.tsx';\n\n/** What a replacement link popup receives. @public */\nexport interface HyperlinkPopupProps {\n /**\n * The element the popup opens under: the toolbar's link button, else the element the request\n * came from (the slide for Ctrl/Cmd+K, a menu row's opener).\n */\n readonly anchor: HTMLElement | null;\n /** The link of the selection now, or an empty string. */\n readonly url: string;\n /**\n * `reading` after a click into linked text (the target, Copy, Edit, Unlink), `editing` for the\n * URL field. Absent means `editing`. `useHyperlinkPopup()` gives the state and the actions. A\n * renderer receives `reading` only when registered with `definePopup(C, { reading: true })`.\n */\n readonly mode?: 'reading' | 'editing';\n /** Close the popup. Apply the link with `editor.exec({ type: 'setLink', url })`. */\n readonly onClose: () => void;\n /** A class name added to the popup panel, for a host renderer that forwards these props. */\n readonly className?: string;\n}\n\n/** What a replacement find bar receives. @public */\nexport interface FindPopupProps {\n /** Opened to replace (Ctrl/Cmd+H), not only to find. */\n readonly replace: boolean;\n /** Close the bar. Run `editor.find` and `editor.replace` for the search itself. */\n readonly onClose: () => void;\n}\n\n/**\n * A render callback for an automatic popup. `false` disables automatic rendering. Same shape\n * as DOCX Editor's `DocxEditorPopup`. @public\n */\nexport type PptxEditorPopup<Props extends object> = false | ((props: Props) => ReactNode);\n\n/**\n * Register an ordinary component in the `popups` map while keeping its props and hooks.\n * Define the component outside the parent render function to keep its state across renders.\n *\n * @example\n * ```tsx\n * function AcmePageSetup({ open, onClose }: PageSetupDialogProps) {\n * return open ? <AcmeDialog title=\"Slide size\" onDismiss={onClose} /> : null;\n * }\n *\n * <PptxEditor.Root popups={{ pageSetup: definePopup(AcmePageSetup) }}>…</PptxEditor.Root>\n * ```\n *\n * @public\n */\nexport function definePopup<Props extends object>(\n component: ComponentType<Props>,\n options?: DefinePopupOptions\n): (props: Props) => ReactNode {\n const render = (props: Props): ReactNode => createElement(component, props);\n return options?.reading ? markReadingPopup(render) : render;\n}\n\n/** Options of `definePopup`. @public */\nexport interface DefinePopupOptions {\n /**\n * For `popups.hyperlink`: the renderer shows reading mode too, so a click into linked text\n * opens it with `mode: 'reading'`. Without it a renderer opens for the URL field alone.\n */\n readonly reading?: boolean;\n}\n\n/**\n * Render overrides for the dialogs the editor mounts. `false` disables one. A render callback\n * receives the session props (`open`, `onClose`) and can forward them to the packaged dialog\n * with its own options.\n *\n * @example\n * ```tsx\n * const popups: PptxEditorPopups = {\n * pageSetup: (props) => <PageSetupDialog {...props} theme={theme} onThemeChange={setTheme} />,\n * background: false,\n * };\n * ```\n *\n * @public\n */\nexport interface PptxEditorPopups {\n /** File > Page setup: slide size, appearance, and fonts. */\n pageSetup?: PptxEditorPopup<PageSetupDialogProps>;\n /** Format background: slide background fill. */\n background?: PptxEditorPopup<BackgroundDialogProps>;\n /** Format > Paragraph: alignment, indents, spacing before and after, and line spacing. */\n paragraph?: PptxEditorPopup<ParagraphDialogProps>;\n /**\n * The link popup (Ctrl/Cmd+K, the toolbar's link control, Insert > Link). `PptxEditor.Root`\n * hosts it, so it opens with no toolbar on the page. `false` turns links off in the chrome:\n * the link control and rows show as disabled; `setLink` keeps working from the API.\n */\n hyperlink?: PptxEditorPopup<HyperlinkPopupProps>;\n /**\n * The find and replace bar (Ctrl/Cmd+F, Ctrl/Cmd+H), rendered where `PptxEditor.FindBar`\n * stands. `false` turns it off; `editor.find` keeps working from the API.\n */\n find?: PptxEditorPopup<FindPopupProps>;\n /**\n * The slide canvas's context menu. A callback usually renders `PptxEditor.ContextMenu` with\n * host rows; `false` shows no menu. A `PptxEditor.ContextMenu` placed in the root or the\n * viewport gives the same entry, and this entry wins over it.\n */\n contextMenu?: PptxEditorPopup<PptxEditorContextMenuProps>;\n /**\n * The context menu of a slide in the slide rail and of a tile in the slide sorter. A callback\n * renders the host's menu, or `RailContextMenu` with its own options; `false` shows no menu.\n */\n railContextMenu?: PptxEditorPopup<RailContextMenuProps>;\n /** Format > Font: font, effects, offset, character spacing, and kerning. */\n font?: PptxEditorPopup<FontDialogProps>;\n /** Format > Bullets and Numbering: bullet or number style, size, color, and start number. */\n bulletsAndNumbering?: PptxEditorPopup<BulletsAndNumberingDialogProps>;\n /** Home > Columns > More Columns: the number of text columns and the spacing between them. */\n columns?: PptxEditorPopup<ColumnsDialogProps>;\n /**\n * The Alt Text dialog of the selected element (Picture Format and the context menu), as DOCX\n * Editor's `imageAltText`. `false` turns it off; `setAltText` keeps working from the API.\n */\n imageAltText?: PptxEditorPopup<ImageAltTextDialogProps>;\n /**\n * The Format Picture dialog: size, rotation, and crop position of the selected picture, as\n * DOCX Editor's `imageProperties`. `false` turns it off; `setImageProperties` keeps working.\n */\n imageProperties?: PptxEditorPopup<ImagePropertiesDialogProps>;\n /**\n * The menu of a section header in the slide rail and in the slide sorter (Rename, Remove,\n * Move, Collapse all). A callback renders the host's menu, or `SectionContextMenu` with its\n * own options; `false` shows no menu. The section commands keep working from the API.\n */\n sectionContextMenu?: PptxEditorPopup<SectionContextMenuProps>;\n}\n\n/** The modal dialogs the registry mounts and `useEditorDialog` opens. @public */\nexport type PptxEditorDialogKey =\n | 'pageSetup'\n | 'background'\n | 'paragraph'\n | 'font'\n | 'bulletsAndNumbering'\n | 'columns'\n | 'imageAltText'\n | 'imageProperties';\n\n/** What `useEditorDialog` returns. @public */\nexport interface UseEditorDialogReturn {\n /**\n * Show the dialog. Focus returns to `returnFocusTo`, or to the element that has focus now,\n * when it closes. Does nothing when the popup entry is `false`.\n */\n open(returnFocusTo?: HTMLElement | null): void;\n /** Hide the dialog. */\n close(): void;\n /** Whether the dialog shows now. */\n readonly isOpen: boolean;\n /** False when the popup entry is `false`: hide or disable the control that opens it. */\n readonly isAvailable: boolean;\n}\n\n/** The canvas menu entry that a `PptxEditor.ContextMenu` placed in the root gives. */\ntype CanvasMenuEntry = PptxEditorPopup<PptxEditorContextMenuProps>;\n\n/**\n * The `PptxEditor.ContextMenu` placed in the root or the viewport: it gives the canvas its menu\n * entry, as a `popups.contextMenu` entry does. The last one placed counts. @internal\n */\nexport interface CanvasMenuRegistry {\n get(): CanvasMenuEntry | undefined;\n place(token: object, entry: CanvasMenuEntry): void;\n remove(token: object): void;\n subscribe(listener: () => void): () => void;\n}\n\nfunction createCanvasMenuRegistry(): CanvasMenuRegistry {\n let current: { readonly token: object; readonly entry: CanvasMenuEntry } | null = null;\n const listeners = new Set<() => void>();\n const notify = (): void => {\n for (const listener of listeners) listener();\n };\n return {\n get: () => current?.entry,\n place(token, entry) {\n if (current?.token === token && current.entry === entry) return;\n current = { token, entry };\n notify();\n },\n remove(token) {\n if (current?.token !== token) return;\n current = null;\n notify();\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => void listeners.delete(listener);\n },\n };\n}\n\ninterface DialogHost {\n readonly active: PptxEditorDialogKey | null;\n readonly popups: PptxEditorPopups | undefined;\n readonly canvasMenus: CanvasMenuRegistry;\n open(key: PptxEditorDialogKey, returnFocusTo?: HTMLElement | null): void;\n close(): void;\n}\n\nconst DialogHostContext = createContext<DialogHost | null>(null);\n\n/** The element that should take focus back, or null when it is gone or is the page itself. */\nfunction focusTarget(el: Element | null | undefined): HTMLElement | null {\n // Check against the element's own window: `instanceof HTMLElement` is false across windows.\n const view = el?.ownerDocument.defaultView;\n if (!el || !view || !(el instanceof view.HTMLElement) || el === el.ownerDocument.body)\n return null;\n // A menu row unmounts with its menu: focus goes back to the editor's slide instead.\n if (el.closest('.pptx-menu'))\n return el.closest('.pptx-editor')?.querySelector<HTMLElement>('.pptx-surface__input') ?? null;\n return el;\n}\n\n/** Hosts the registry for one editor root, and renders the dialog that is open. */\nexport function DialogProvider({\n popups,\n children,\n}: {\n popups?: PptxEditorPopups;\n children?: ReactNode;\n}) {\n const editor = usePptxEditor();\n const [active, setActive] = useState<PptxEditorDialogKey | null>(null);\n const popupsRef = useRef(popups);\n popupsRef.current = popups;\n const opener = useRef<HTMLElement | null>(null);\n const [canvasMenus] = useState(createCanvasMenuRegistry);\n\n const open = useCallback((key: PptxEditorDialogKey, returnFocusTo?: HTMLElement | null) => {\n if (popupsRef.current?.[key] === false) return;\n opener.current =\n returnFocusTo === undefined\n ? focusTarget(typeof document === 'undefined' ? null : document.activeElement)\n : returnFocusTo;\n setActive(key);\n }, []);\n const close = useCallback(() => setActive(null), []);\n\n // Focus returns to the opener after the dialog unmounts, as in DOCX Editor's dialog host.\n useEffect(() => {\n if (active !== null) return;\n const target = opener.current;\n opener.current = null;\n if (target?.isConnected) target.focus({ preventScroll: true });\n }, [active]);\n\n // A dialog belongs to the document it opened on: close it when another document opens.\n useEffect(() => {\n if (!editor) return;\n let session = editor.session;\n return editor.subscribe(() => {\n if (editor.session === session) return;\n session = editor.session;\n setActive(null);\n });\n }, [editor]);\n\n // A popup entry that becomes `false` closes its open dialog.\n useEffect(() => {\n if (active !== null && popups?.[active] === false) setActive(null);\n }, [popups, active]);\n\n const host = useMemo<DialogHost>(\n () => ({ active, popups, canvasMenus, open, close }),\n [active, popups, canvasMenus, open, close]\n );\n return (\n <DialogHostContext.Provider value={host}>\n {children}\n <ActiveDialog host={host} />\n </DialogHostContext.Provider>\n );\n}\n\n/** One registry entry: the host's renderer, nothing for `false`, else the packaged dialog. */\nfunction renderEntry<Props extends object>(\n entry: PptxEditorPopup<Props> | undefined,\n Packaged: ComponentType<Props>,\n props: Props\n): ReactNode {\n if (entry === false) return null;\n return entry ? entry(props) : createElement(Packaged, props);\n}\n\nfunction ActiveDialog({ host }: { host: DialogHost }): ReactNode {\n const { active, popups, close } = host;\n const props = { open: true, onClose: close };\n if (active === 'pageSetup') return renderEntry(popups?.pageSetup, PageSetupDialog, props);\n if (active === 'background') return renderEntry(popups?.background, BackgroundDialog, props);\n if (active === 'paragraph') return renderEntry(popups?.paragraph, ParagraphDialog, props);\n if (active === 'font') return renderEntry(popups?.font, FontDialog, props);\n if (active === 'bulletsAndNumbering')\n return renderEntry(popups?.bulletsAndNumbering, BulletsAndNumberingDialog, props);\n if (active === 'columns') return renderEntry(popups?.columns, ColumnsDialog, props);\n if (active === 'imageAltText')\n return renderEntry(popups?.imageAltText, ImageAltTextDialog, props);\n if (active === 'imageProperties')\n return renderEntry(popups?.imageProperties, ImagePropertiesDialog, props);\n return null;\n}\n\n/** Open a modal registry dialog from a menu row or a toolbar control. @internal */\nexport function useDialogOpener(): (\n key: PptxEditorDialogKey,\n returnFocusTo?: HTMLElement | null\n) => void {\n const open = useContext(DialogHostContext)?.open;\n return useCallback(\n (key: PptxEditorDialogKey, returnFocusTo?: HTMLElement | null) => open?.(key, returnFocusTo),\n [open]\n );\n}\n\n/**\n * The registry entry for `key` in the enclosing `PptxEditor.Root`: a renderer, `false`, or\n * undefined for the packaged part. The parts that own a non-modal popup (the link control, the\n * find bar, the canvas, the rail) read it. @internal\n */\nexport function usePopupEntry<K extends keyof PptxEditorPopups>(key: K): PptxEditorPopups[K] {\n return useContext(DialogHostContext)?.popups?.[key];\n}\n\nconst noCanvasMenus = (): (() => void) => () => {};\nconst noCanvasMenu = (): undefined => undefined;\n\n/**\n * The canvas menu entry of the enclosing `PptxEditor.Root`: its `popups.contextMenu` entry,\n * else the entry of a `PptxEditor.ContextMenu` placed in the root, else undefined for the\n * packaged menu. An explicit `popups.contextMenu` entry wins. @internal\n */\nexport function useCanvasMenuEntry(): CanvasMenuEntry | undefined {\n const host = useContext(DialogHostContext);\n const registry = host?.canvasMenus;\n const placed = useSyncExternalStore(\n registry?.subscribe ?? noCanvasMenus,\n registry?.get ?? noCanvasMenu,\n registry?.get ?? noCanvasMenu\n );\n const explicit = host?.popups?.contextMenu;\n return explicit !== undefined ? explicit : placed;\n}\n\n/** Where a `PptxEditor.ContextMenu` placed in the root registers, or null outside a root. @internal */\nexport function useCanvasMenuRegistry(): CanvasMenuRegistry | null {\n return useContext(DialogHostContext)?.canvasMenus ?? null;\n}\n\n/** The whole `popups` map of the enclosing `PptxEditor.Root`. @internal */\nexport function usePopups(): PptxEditorPopups | undefined {\n return useContext(DialogHostContext)?.popups;\n}\n\n/**\n * Open, close, and read one of the editor's dialogs. The packaged openers use the same call,\n * so a host renderer in `popups` receives every request. Outside `PptxEditor.Root` it reports\n * the dialog as unavailable. It takes the dialog's key; the per-dialog hooks\n * (`usePageSetupDialog`, `useBackgroundDialog`, `useParagraphDialog`, `useFontDialog`,\n * `useBulletsAndNumberingDialog`, `useColumnsDialog`) read an open dialog's draft, as in DOCX Editor.\n *\n * @example\n * ```tsx\n * function PageSetupButton() {\n * const pageSetup = useEditorDialog('pageSetup');\n * if (!pageSetup.isAvailable) return null;\n * return <button onClick={() => pageSetup.open()}>Page setup</button>;\n * }\n * ```\n *\n * @public\n */\nexport function useEditorDialog(key: PptxEditorDialogKey): UseEditorDialogReturn {\n const host = useContext(DialogHostContext);\n const isOpen = host?.active === key;\n const isAvailable = host !== null && host.popups?.[key] !== false;\n const open = host?.open;\n const close = host?.close;\n return useMemo(\n () => ({\n open: (returnFocusTo?: HTMLElement | null) => open?.(key, returnFocusTo),\n close: () => close?.(),\n isOpen,\n isAvailable,\n }),\n [open, close, key, isOpen, isAvailable]\n );\n}\n","/** @jsxImportSource react */\n// The Format Background dialog (Format → Slide Background…): a color, a gradient, or a picture\n// for the current slide or every slide, or back to the layout's background. Built on the dialog\n// parts (`dialog-parts.tsx`): the choices write a draft, OK applies it as one undo step, and\n// Cancel discards it. The draft rules live in core\n// (`dialog-fields.ts`), so the Vue twin applies the same command.\n\nimport { useId, useMemo, useRef, useState, type ReactNode } from 'react';\nimport {\n BACKGROUND_GRADIENT_FALLBACK,\n backgroundDraftColor,\n backgroundDraftCommand,\n backgroundDraftFrom,\n backgroundPresetGradient,\n backgroundStatusKey,\n commitDialogCommand,\n gradientCss,\n sameBackground,\n translateDialogErrors,\n validateBackgroundDraft,\n type DialogDraft,\n type GradientFill,\n type SlideBackground,\n} from '@pptx-editor.dev/core/editor';\nimport { useEditorState, usePptxEditor, useTranslation } from './context.ts';\nimport { ToolButton } from './chrome.tsx';\nimport { ColorSwatches, Swatch, SwatchGroup, useThemeBases } from './ColorSwatches.tsx';\nimport { GradientDialog } from './ShapeControls.tsx';\nimport {\n DialogFrame,\n applyOnEnter,\n createDialogParts,\n useCloseOnNewDocument,\n useDialogDraft,\n type DialogCustomizationProps,\n type UseDialogReturn,\n} from './dialog-parts.tsx';\n\n/**\n * The draft of the Background dialog. `background` is the fill OK applies: a fill, `null` for\n * the layout's background, or `undefined` to keep the slide's own fill. @public\n */\nexport interface BackgroundDialogFields {\n /** The fill OK applies: a fill, `null` for the layout's background, `undefined` to keep the slide's own. */\n readonly background: SlideBackground | null | undefined;\n /** Apply the fill to every slide. */\n readonly allSlides: boolean;\n}\n\n/** The Background draft and its actions. @public */\nexport interface UseBackgroundDialogReturn extends UseDialogReturn<BackgroundDialogFields> {\n /** Pick the layout's background in the draft. */\n reset(): void;\n}\n\n/**\n * The field names of the Background dialog, for `BackgroundDialog.Field`: one per fill kind\n * (`SlideBackground['kind']`), and Apply to all slides. @public\n */\nexport type BackgroundDialogFieldName = 'solid' | 'gradient' | 'picture' | 'allSlides';\n\n/** Props for `PptxEditor.BackgroundDialog`. @public */\nexport interface BackgroundDialogProps extends DialogCustomizationProps {\n /** Whether the dialog is shown. The host owns this state. */\n readonly open: boolean;\n /** Called on Cancel, Escape, a click on the backdrop, and after OK. */\n readonly onClose: () => void;\n}\n\nconst IMAGE_TYPES = ['image/png', 'image/jpeg', 'image/gif'];\n\nconst parts = createDialogParts<BackgroundDialogFieldName, UseBackgroundDialogReturn>(\n 'BackgroundDialog'\n);\n\nfunction BackgroundDialogRoot(props: BackgroundDialogProps): ReactNode {\n return props.open ? <BackgroundDialogOpen {...props} /> : null;\n}\n\nfunction BackgroundDialogOpen({\n onClose,\n className,\n style,\n preset = true,\n children,\n}: BackgroundDialogProps): ReactNode {\n const { t } = useTranslation();\n const editor = usePptxEditor();\n const file = useRef<HTMLInputElement>(null);\n const current = useEditorState((s) => s.slideBackground);\n // Why OK cannot apply now, or null when it can.\n const refusal = useEditorState((s) =>\n s.status !== 'ready' ? 'disabled.noEditor' : s.mode !== 'edit' ? 'disabled.viewing' : null\n );\n const enabled = refusal === null;\n const [initial] = useState(() => backgroundDraftFrom(current));\n const [custom, setCustom] = useState<GradientFill | null>(null);\n // Every pick and picture read counts up, so a picture that finishes reading after a later\n // pick is dropped. `picked` turns on with a real pick (Reset too), so OK applies even a value\n // equal to the opening one; setting the opening value itself back (by identity) turns it off.\n const picks = useRef(0);\n const picked = useRef(false);\n const draft: DialogDraft<BackgroundDialogFields> = useDialogDraft(() => ({\n initial,\n validate: (values) => validateBackgroundDraft(values, initial, picked.current),\n resetValues: (): BackgroundDialogFields => ({\n background: null,\n allSlides: draft.values.allSlides,\n }),\n commit: (values) =>\n commitDialogCommand(editor, backgroundDraftCommand(values, initial, picked.current)),\n }));\n // One object per error change, so a host effect on `errors` runs only when they change.\n const translatedErrors = useMemo(() => translateDialogErrors(t, draft.errors), [t, draft.errors]);\n const state: UseBackgroundDialogReturn = {\n values: draft.values,\n setValue: (name, value) => {\n // Setting the value it already has is no pick, and going back to the opening value\n // undoes the pick: OK must not write the opening snapshot.\n if (name === 'background' && !Object.is(draft.values.background, value)) {\n picks.current += 1;\n picked.current = !Object.is(value, initial.background);\n }\n draft.setValue(name, value);\n },\n errors: translatedErrors,\n isEnabled: enabled,\n apply: () => {\n if (draft.apply()) onClose();\n },\n cancel: onClose,\n reset: () => {\n picks.current += 1;\n picked.current = true;\n draft.reset();\n },\n };\n const pick = (background: SlideBackground): void => state.setValue('background', background);\n const onFile = async (f: File | undefined): Promise<void> => {\n if (!f || !IMAGE_TYPES.includes(f.type)) return;\n const at = ++picks.current;\n let bytes: Uint8Array;\n try {\n bytes = new Uint8Array(await f.arrayBuffer());\n } catch {\n return; // An unreadable file picks nothing.\n }\n if (at === picks.current) pick({ kind: 'picture', bytes, mime: f.type });\n };\n const gradientFrom = backgroundPresetGradient;\n const bases = useThemeBases();\n const chosen = draft.values.background;\n const error = state.errors.allSlides ?? state.errors.background ?? state.errors.form;\n const selectedColor = backgroundDraftColor(draft.values);\n const errorId = useId();\n const presets = bases.map((b) => ({ base: b, gradient: gradientFrom(b.color) }));\n // What the draft holds, for the status line a screen reader announces. A swatch pick shows\n // as its pressed swatch instead.\n const statusKey = backgroundStatusKey(\n chosen,\n initial.background,\n presets.map((p) => p.gradient)\n );\n const status = statusKey ? t(statusKey) : '';\n useCloseOnNewDocument(onClose);\n return (\n <DialogFrame\n kind=\"background\"\n label={t('background.title')}\n className={className}\n style={style}\n onClose={onClose}\n onKeyDown={(event) => applyOnEnter(event, state.isEnabled, state.apply)}\n >\n <parts.Composition\n state={state}\n preset={preset}\n defaults={\n <>\n <div data-pptx-part=\"header\" className=\"pptx-dialog__header\">\n <h2 data-pptx-part=\"title\" className=\"pptx-dialog__title\">\n {t('background.title')}\n </h2>\n <ToolButton label={t('background.close')} icon=\"close\" onClick={onClose} />\n </div>\n <div data-pptx-part=\"body\" className=\"pptx-dialog__body\">\n <section\n data-pptx-part=\"field\"\n data-pptx-field=\"solid\"\n className=\"pptx-dialog__section\"\n >\n <h3 className=\"pptx-dialog__label\">{t('background.color')}</h3>\n <ColorSwatches\n menu={false}\n selected={selectedColor}\n onPick={(color) => pick({ kind: 'solid', color })}\n />\n </section>\n <section\n data-pptx-part=\"field\"\n data-pptx-field=\"gradient\"\n className=\"pptx-dialog__section\"\n >\n <h3 className=\"pptx-dialog__label\">{t('background.gradient')}</h3>\n {presets.length ? (\n <SwatchGroup label={t('toolbar.gradients')} roving>\n {presets.map(({ base: b, gradient: g }) => (\n <Swatch\n key={b.name}\n color={b.color}\n background={gradientCss(g)}\n name={t('toolbar.gradientPreset', { color: b.name })}\n menu={false}\n pressed={sameBackground(chosen, { kind: 'gradient', gradient: g })}\n onPick={() => pick({ kind: 'gradient', gradient: g })}\n />\n ))}\n </SwatchGroup>\n ) : null}\n <div className=\"pptx-gradient__row\">\n <button\n type=\"button\"\n className=\"pptx-button\"\n onClick={() =>\n setCustom(\n chosen?.kind === 'gradient'\n ? chosen.gradient\n : (current.gradient ??\n gradientFrom(bases[4]?.color ?? BACKGROUND_GRADIENT_FALLBACK))\n )\n }\n >\n {t('toolbar.gradientCustom')}\n </button>\n </div>\n </section>\n <section\n data-pptx-part=\"field\"\n data-pptx-field=\"picture\"\n className=\"pptx-dialog__section\"\n >\n <h3 className=\"pptx-dialog__label\">{t('background.image')}</h3>\n <div className=\"pptx-gradient__row\">\n <button\n type=\"button\"\n className=\"pptx-button\"\n onClick={() => file.current?.click()}\n >\n {t('background.chooseImage')}\n </button>\n <input\n ref={file}\n type=\"file\"\n accept={IMAGE_TYPES.join(',')}\n hidden\n onChange={(e) => {\n void onFile(e.target.files?.[0]);\n e.target.value = '';\n }}\n />\n </div>\n </section>\n <p role=\"status\" className=\"pptx-dialog__muted pptx-dialog__status\">\n {status}\n </p>\n <label data-pptx-part=\"field\" data-pptx-field=\"allSlides\" className=\"pptx-radio\">\n <input\n type=\"checkbox\"\n aria-invalid={state.errors.allSlides ? true : undefined}\n aria-describedby={state.errors.allSlides ? errorId : undefined}\n checked={draft.values.allSlides}\n onChange={(e) => draft.setValue('allSlides', e.target.checked)}\n />\n {t('background.allSlides')}\n </label>\n </div>\n <div data-pptx-part=\"footer\" className=\"pptx-dialog__footer\">\n <span id={errorId} data-pptx-part=\"error\" role=\"alert\" className=\"pptx-dialog__error\">\n {error ?? null}\n </span>\n <button\n type=\"button\"\n data-pptx-part=\"reset\"\n className=\"pptx-button pptx-dialog__reset\"\n disabled={!enabled}\n title={refusal ? t(refusal) : undefined}\n onClick={state.reset}\n >\n {t('background.reset')}\n </button>\n <button\n type=\"button\"\n data-pptx-part=\"cancel\"\n className=\"pptx-button\"\n onClick={state.cancel}\n >\n {t('dialog.cancel')}\n </button>\n <button\n type=\"button\"\n data-pptx-part=\"apply\"\n className=\"pptx-button pptx-button--primary\"\n disabled={!enabled}\n title={refusal ? t(refusal) : undefined}\n onClick={state.apply}\n >\n {t('dialog.ok')}\n </button>\n </div>\n </>\n }\n >\n {children}\n </parts.Composition>\n <GradientDialog\n open={custom !== null}\n initial={custom}\n onClose={() => setCustom(null)}\n onApply={(g) => {\n pick({ kind: 'gradient', gradient: g });\n setCustom(null);\n }}\n />\n </DialogFrame>\n );\n}\n\n/**\n * Read the draft of the enclosing Background dialog, for a host's own field inside it. It does\n * not open the dialog: `useEditorDialog('background').open()` does. @public\n */\nexport function useBackgroundDialog(): UseBackgroundDialogReturn {\n return parts.useState();\n}\n\n/**\n * Change the slide background, with replaceable parts (`Header`, `Title`, `Body`, `Footer`,\n * `Field`, `Error`, `Reset`, `Apply`, `Cancel`).\n *\n * @example\n * ```tsx\n * <PptxEditor.BackgroundDialog {...props}>\n * <PptxEditor.BackgroundDialog.Field name=\"picture\" hidden />\n * </PptxEditor.BackgroundDialog>\n * ```\n *\n * @public\n */\nexport const BackgroundDialog = Object.assign(BackgroundDialogRoot, {\n Header: parts.Header,\n Title: parts.Title,\n Body: parts.Body,\n Footer: parts.Footer,\n Field: parts.Field,\n Error: parts.Error,\n Reset: parts.Reset,\n Apply: parts.Apply,\n Cancel: parts.Cancel,\n});\n","/** @jsxImportSource react */\n// The swatch sections of every color menu and the background dialog: the deck's theme colors\n// (ten columns, each with its lighter and darker variants), the Standard Colors row, and a\n// custom color (a hex field and the browser's color selector), as DOCX Editor's color picker.\n\nimport {\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n type KeyboardEvent,\n type ReactNode,\n} from 'react';\nimport type { ColorChoice } from '@pptx-editor.dev/core/editor';\nimport { useEditorState, useTranslation } from './context.ts';\nimport {\n STANDARD_COLORS,\n customHexColor,\n customHexCurrent,\n customHexDraft,\n customHexSeed,\n swatchGridKeyDown,\n swatchName,\n swatchSelection,\n syncSwatchTabStops,\n themeBaseSwatches,\n themeSwatchChoice,\n} from '@pptx-editor.dev/core/editor';\n\n/** One named swatch. In a menu it is a `menuitem`; in a dialog, a button that shows its state. */\nexport function Swatch({\n color,\n name,\n menu,\n pressed,\n background,\n onPick,\n}: {\n color: string;\n name: string;\n menu: boolean;\n pressed?: boolean;\n /** CSS background when it is not the color itself (a gradient preview). */\n background?: string;\n onPick: () => void;\n}) {\n return (\n <button\n type=\"button\"\n className=\"pptx-swatch\"\n style={{ background: background ?? color }}\n aria-label={name}\n data-pptx-tooltip={name}\n // In a menu the current color is marked with `aria-current`; in a dialog it is pressed.\n {...(menu\n ? { role: 'menuitem', tabIndex: -1, ...(pressed ? { 'aria-current': true } : {}) }\n : { 'aria-pressed': !!pressed })}\n onClick={onPick}\n />\n );\n}\n\n/**\n * A labelled swatch section; `columns` lets the menu's arrow keys move by row. With `roving`\n * (a dialog), the section is one Tab stop, on the chosen swatch or the first, and the arrow\n * keys move by column and row, as a WAI-ARIA grid of buttons does.\n */\nexport function SwatchGroup({\n label,\n columns = 10,\n className,\n roving = false,\n children,\n}: {\n label: string;\n columns?: number;\n className?: string;\n roving?: boolean;\n children: ReactNode;\n}) {\n const grid = useRef<HTMLDivElement>(null);\n // After each render: the focused swatch keeps the stop, else the chosen one, else the first.\n useLayoutEffect(() => {\n if (roving) syncSwatchTabStops(grid.current);\n });\n const onKeyDown = (e: KeyboardEvent<HTMLDivElement>): void => {\n if (roving) swatchGridKeyDown(grid.current, e, columns);\n };\n return (\n <div role=\"group\" aria-label={label} className=\"pptx-swatches__section\">\n <p className=\"pptx-swatches__title\" aria-hidden=\"true\">\n {label}\n </p>\n <div\n ref={grid}\n className={`pptx-swatches${className ? ` ${className}` : ''}`}\n data-columns={columns}\n onKeyDown={onKeyDown}\n >\n {children}\n </div>\n </div>\n );\n}\n\n/**\n * The Custom Color section, after DOCX Editor's color picker: a hex field (`#` and six digits)\n * with Apply, and the browser's color selector, which applies when it closes. In a menu, the\n * fields join the arrow keys (`data-menu-field`) and Apply is a row.\n */\nexport function CustomColor({\n onPick,\n menu,\n selected,\n}: {\n onPick: (color: string) => void;\n menu: boolean;\n selected?: ColorChoice | null | undefined;\n}) {\n const { t } = useTranslation();\n const [draft, setDraft] = useState(() => customHexSeed(selected));\n const color = customHexColor(draft);\n // An empty field shows the current color: as its placeholder and in the selector.\n const rows = useEditorState((s) => s.themeColors);\n const current = customHexCurrent(selected, rows);\n const apply = (): void => {\n if (color) onPick(color);\n };\n // The DOM `change` event: the selector closed on a color, which applies it.\n const picker = useRef<HTMLInputElement>(null);\n const pick = useRef(onPick);\n pick.current = onPick;\n useEffect(() => {\n const el = picker.current;\n const done = (): void => {\n const picked = el ? customHexColor(el.value) : null;\n if (picked) pick.current(picked);\n };\n el?.addEventListener('change', done);\n return () => el?.removeEventListener('change', done);\n }, []);\n return (\n <div role=\"group\" aria-label={t('colors.customColor')} className=\"pptx-swatches__section\">\n <p className=\"pptx-swatches__title\" aria-hidden=\"true\">\n {t('colors.customColor')}\n </p>\n <div className=\"pptx-custom-color\">\n <input\n type=\"color\"\n className=\"pptx-custom-color__picker\"\n aria-label={t('colors.customPicker')}\n data-menu-field=\"\"\n tabIndex={menu ? -1 : undefined}\n ref={picker}\n value={(color ?? `#${current}`).toLowerCase()}\n // React's `onChange` is the `input` event: it follows the selector while it moves.\n onChange={(e) => setDraft(customHexDraft(e.currentTarget.value))}\n />\n <span className=\"pptx-custom-color__hash\" aria-hidden=\"true\">\n #\n </span>\n <input\n type=\"text\"\n className=\"pptx-custom-color__hex\"\n aria-label={t('colors.customHex')}\n data-menu-field=\"\"\n tabIndex={menu ? -1 : undefined}\n placeholder={current}\n maxLength={6}\n spellCheck={false}\n autoComplete=\"off\"\n value={draft}\n onChange={(e) => setDraft(customHexDraft(e.target.value))}\n onKeyDown={(e) => {\n if (e.key !== 'Enter') return;\n // The Enter that applies is this field's: a dialog does not apply on it too.\n e.preventDefault();\n e.stopPropagation();\n apply();\n }}\n />\n <button\n type=\"button\"\n className=\"pptx-button pptx-custom-color__apply\"\n {...(menu ? { role: 'menuitem', tabIndex: -1 } : {})}\n disabled={!color}\n onClick={apply}\n >\n {t('colors.customApply')}\n </button>\n </div>\n </div>\n );\n}\n\n/**\n * The theme colors and the standard colors. A theme swatch picks a theme color, which the\n * engine writes as `a:schemeClr` (so the color follows a theme change); a\n * standard swatch and a custom color pick their `#RRGGBB`. `onPick` also gets the color as\n * rendered, for the split button's preview. `selected` marks the current color.\n */\nexport function ColorSwatches({\n onPick,\n menu = true,\n selected,\n}: {\n onPick: (choice: ColorChoice, color: string) => void;\n menu?: boolean;\n selected?: ColorChoice | null;\n}) {\n const { t } = useTranslation();\n const rows = useEditorState((s) => s.themeColors);\n // A theme choice matches its slot and shift; a hex choice marks one swatch only.\n const isSelected = swatchSelection(selected, rows);\n return (\n <>\n {rows.length ? (\n <SwatchGroup\n label={t('colors.themeColors')}\n className=\"pptx-swatches--theme\"\n roving={!menu}\n >\n {rows.flatMap((row, r) =>\n row.map((s, c) => (\n <Swatch\n key={`${r}-${c}`}\n color={s.color}\n name={swatchName(t, s)}\n menu={menu}\n pressed={isSelected(s.color, s.slot, s.shift)}\n onPick={() => onPick(themeSwatchChoice(s), s.color)}\n />\n ))\n )}\n </SwatchGroup>\n ) : null}\n <SwatchGroup label={t('colors.standardColors')} roving={!menu}>\n {STANDARD_COLORS.map((s) => (\n <Swatch\n key={s.name}\n color={s.color}\n name={t(`colors.standard.${s.name}`)}\n menu={menu}\n pressed={isSelected(s.color)}\n onPick={() => onPick(s.color, s.color)}\n />\n ))}\n </SwatchGroup>\n <CustomColor menu={menu} selected={selected} onPick={(color) => onPick(color, color)} />\n </>\n );\n}\n\n/** The ten theme colors (the grid's first row), for gradient presets. */\nexport function useThemeBases(): readonly { color: string; name: string }[] {\n const { t } = useTranslation();\n const first = useEditorState((s) => s.themeColors[0]);\n return themeBaseSwatches(t, first);\n}\n","/** @jsxImportSource react */\n// Shape controls: the insert-shape gallery (previews drawn by the engine's own geometry), the\n// fill menu (theme colors and gradients), and the custom gradient dialog.\n\nimport { useEffect, useRef, useState, type PointerEvent as ReactPointerEvent } from 'react';\nimport {\n dialogInitialFocus,\n SHAPE_GALLERY,\n CROP_SHAPE_GALLERY,\n DEFAULT_GRADIENT,\n LINE_GLYPH_STROKE,\n defaultFillChoice,\n gradientAddStop,\n gradientAngleFrom,\n gradientDialogStart,\n gradientHandleKey,\n gradientPosAt,\n gradientRemoveStop,\n gradientSetStop,\n lineGlyphParts,\n lineGlyphTransform,\n lineSlotEnd,\n shapePreview,\n translateKeyOrText,\n type ChromeControl,\n type ChromeSlotId,\n type ColorChoice,\n type GradientFill,\n} from '@pptx-editor.dev/core/editor';\nimport {\n Icon,\n MenuItem,\n Popover,\n ToolButton,\n focusText,\n keepFocus,\n useAriaDisabled,\n} from './chrome.tsx';\nimport { useEditorState, usePptxEditor, useTranslation } from './context.ts';\nimport { useSlot } from './slot.ts';\nimport { useTriggerAttributes } from './slot-override.ts';\nimport { ColorSwatches, Swatch, SwatchGroup, useThemeBases } from './ColorSwatches.tsx';\nimport { colorMenuSelection, gradientCss, presetGradient } from '@pptx-editor.dev/core/editor';\n\n/** The props of `ShapeIcon`. @public */\nexport interface ShapeIconProps {\n /** The preset geometry name (`a:prstGeom/@prst`), such as `rect`. */\n preset: string;\n}\n\n/** A preset's preview, drawn from its spec geometry. @public */\nexport function ShapeIcon({ preset }: ShapeIconProps) {\n const preview = shapePreview(preset);\n if (!preview) return null;\n return (\n <svg viewBox={preview.viewBox} className=\"pptx-shape-icon\" aria-hidden=\"true\">\n {preview.paths.map((p, i) => (\n <path\n key={i}\n d={p.d}\n className={p.fill ? 'pptx-shape-icon__fill' : undefined}\n fill={p.fill ? undefined : 'none'}\n stroke={p.stroke ? 'currentColor' : 'none'}\n vectorEffect=\"non-scaling-stroke\"\n />\n ))}\n </svg>\n );\n}\n\n/** The props of `ShapeGrid`. @public */\nexport interface ShapeGridProps {\n /** The preset geometry names to show, in order. */\n presets: readonly string[];\n /** Called with the preset the person picked. */\n onPick: (preset: string) => void;\n}\n\n/**\n * One gallery category's presets as a grid of previews drawn from their spec geometry. Each\n * preview is a `menuitem`; the arrow keys move by grid rows (`data-columns`). @public\n */\nexport function ShapeGrid({ presets, onPick }: ShapeGridProps) {\n const { t } = useTranslation();\n return (\n <div className=\"pptx-shape-gallery__grid\" data-columns={8}>\n {presets.map((preset) => {\n const name = translateKeyOrText(t, `shapes.${preset}`);\n return (\n <button\n key={preset}\n type=\"button\"\n role=\"menuitem\"\n tabIndex={-1}\n className=\"pptx-shape-gallery__item\"\n aria-label={name}\n data-pptx-tooltip={name}\n onClick={() => onPick(preset)}\n >\n <ShapeIcon preset={preset} />\n </button>\n );\n })}\n </div>\n );\n}\n\n/** The props of `ShapeGalleryControl`. @public */\nexport interface ShapeGalleryControlProps {\n /** The chrome slot the control runs. */\n slot: ChromeSlotId;\n /** The registry entry of the control, from `CHROME_GROUPS`. */\n control: ChromeControl;\n}\n\n/** The insert-shape gallery: every category, every preset as its own preview. @public */\nexport function ShapeGalleryControl({ slot, control }: ShapeGalleryControlProps) {\n const { cmd, label, reason, tip } = useSlot(slot, control);\n const off = useAriaDisabled(!cmd.isEnabled, reason);\n const { t } = useTranslation();\n const anchor = useRef<HTMLButtonElement>(null);\n const [open, setOpen] = useState(false);\n const trigger = useTriggerAttributes(slot, 'pptx-toolbar__button pptx-toolbar__button--wide', {\n disabled: !cmd.isEnabled,\n });\n return (\n <>\n <button\n ref={anchor}\n type=\"button\"\n {...trigger}\n data-slot={slot}\n aria-label={label}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n {...tip}\n {...off.attrs}\n onMouseDown={keepFocus}\n onClick={() => setOpen((o) => !o)}\n >\n <Icon paths={control.paths} />\n <Icon name=\"arrow_drop_down\" className=\"pptx-icon pptx-toolbar__caret\" />\n </button>\n {off.note}\n {open ? (\n <Popover anchor={anchor.current} onClose={() => setOpen(false)}>\n <div className=\"pptx-shape-gallery\">\n {/* A picture is cropped to shapes with an inside: lines are left out (core). */}\n {(slot === 'image.cropToShape' ? CROP_SHAPE_GALLERY : SHAPE_GALLERY).map((category) => (\n <section\n key={category.id}\n className=\"pptx-shape-gallery__section\"\n role=\"group\"\n aria-label={t(category.labelKey)}\n >\n <h3 className=\"pptx-shape-gallery__title\" aria-hidden=\"true\">\n {t(category.labelKey)}\n </h3>\n <ShapeGrid\n presets={category.presets}\n onPick={(preset) => {\n cmd.execute(preset);\n setOpen(false);\n }}\n />\n </section>\n ))}\n </div>\n </Popover>\n ) : null}\n </>\n );\n}\n\n/** The props of `FillControl`. @public */\nexport interface FillControlProps {\n /** The chrome slot the control runs. */\n slot: ChromeSlotId;\n /** The registry entry of the control, from `CHROME_GROUPS`. */\n control: ChromeControl;\n}\n\n/**\n * Fill color: one menu with the theme and standard colors, Transparent, gradient presets from\n * the theme colors, and a custom gradient dialog. @public\n */\nexport function FillControl({ slot, control }: FillControlProps) {\n const { cmd, label, reason, tip } = useSlot(slot, control);\n const off = useAriaDisabled(!cmd.isEnabled, reason);\n const editor = usePptxEditor();\n const { t } = useTranslation();\n const current = useEditorState((s) => s.geometry?.gradient);\n // The solid fill of the selection, marked in the menu.\n const selected = useEditorState((s) => colorMenuSelection(slot, s));\n const bases = useThemeBases();\n const anchor = useRef<HTMLButtonElement>(null);\n const [open, setOpen] = useState(false);\n const [picked, setPicked] = useState<{ choice: ColorChoice; color: string } | null>(null);\n // Before a pick, the button applies the theme's Accent 1, the default fill of a new shape.\n const accent1 = bases[4]?.color;\n const last: { choice: ColorChoice; color: string } = picked ?? defaultFillChoice(accent1);\n const [dialog, setDialog] = useState<GradientFill | null>(null);\n const applyGradient = (g: GradientFill): void => {\n editor?.exec({ type: 'setShapeGradient', gradient: g });\n };\n return (\n <span className=\"pptx-toolbar__group\">\n <ToolButton\n slot={slot}\n label={label}\n paths={control.paths}\n disabled={!cmd.isEnabled}\n disabledReason={reason}\n onClick={() => cmd.execute(last.choice)}\n >\n <span className=\"pptx-toolbar__swatch\" style={{ background: last.color }} />\n </ToolButton>\n <button\n ref={anchor}\n type=\"button\"\n className=\"pptx-toolbar__button pptx-toolbar__step\"\n aria-label={label}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n {...tip}\n {...off.attrs}\n onMouseDown={keepFocus}\n onClick={() => setOpen((o) => !o)}\n >\n <Icon name=\"arrow_drop_down\" className=\"pptx-icon pptx-toolbar__caret\" />\n </button>\n {off.note}\n {open ? (\n <Popover anchor={anchor.current} label={label} onClose={() => setOpen(false)}>\n <ColorSwatches\n selected={selected}\n onPick={(choice, color) => {\n setPicked({ choice, color });\n cmd.execute(choice);\n focusText(editor, anchor.current);\n setOpen(false);\n }}\n />\n <MenuItem\n onSelect={() => (cmd.execute(null), focusText(editor, anchor.current), setOpen(false))}\n >\n {t('toolbar.transparent')}\n </MenuItem>\n <div className=\"pptx-menu__sep\" />\n {bases.length ? (\n <SwatchGroup label={t('toolbar.gradients')}>\n {bases.map((b) => {\n const g = presetGradient(b.color, 0.35, 0.35);\n return (\n <Swatch\n key={b.name}\n color={b.color}\n background={gradientCss(g)}\n name={t('toolbar.gradientPreset', { color: b.name })}\n menu\n onPick={() => {\n applyGradient(g);\n focusText(editor, anchor.current);\n setOpen(false);\n }}\n />\n );\n })}\n </SwatchGroup>\n ) : null}\n <MenuItem\n onSelect={() => {\n setDialog(current ?? presetGradient(last.color, 0.35, 0.35));\n setOpen(false);\n }}\n >\n <Icon name=\"add\" />\n {t('toolbar.gradientCustom')}\n </MenuItem>\n </Popover>\n ) : null}\n <GradientDialog\n open={dialog !== null}\n initial={dialog}\n onClose={() => setDialog(null)}\n onApply={(g) => {\n applyGradient(g);\n setDialog(null);\n }}\n />\n </span>\n );\n}\n\n/** Props for `PptxEditor.GradientDialog`. @public */\nexport interface GradientDialogProps {\n /** Whether the dialog shows. */\n readonly open: boolean;\n /** The gradient the dialog starts from. */\n readonly initial: GradientFill | null;\n /** Called when the dialog closes, applied or not. */\n readonly onClose: () => void;\n /** Called with the gradient the person applied. */\n readonly onApply: (gradient: GradientFill) => void;\n}\n\n/** The custom gradient dialog: type, angle, stops, rotation, and a preview. @public */\nexport function GradientDialog({ open, initial, onClose, onApply }: GradientDialogProps) {\n const { t } = useTranslation();\n const ref = useRef<HTMLDialogElement>(null);\n const bar = useRef<HTMLDivElement>(null);\n const [g, setG] = useState<GradientFill>(initial ?? DEFAULT_GRADIENT);\n const [selected, setSelected] = useState(0);\n const dragging = useRef<number | null>(null);\n\n useEffect(() => {\n const dialog = ref.current;\n if (!dialog) return;\n if (open) {\n setG(gradientDialogStart(initial));\n setSelected(0);\n if (!dialog.open) dialog.showModal();\n // The first field takes focus, as in every dialog, not the Close button.\n dialogInitialFocus(dialog)?.focus({ preventScroll: true });\n } else if (dialog.open) dialog.close();\n }, [open, initial]);\n\n const setStop = (i: number, patch: Partial<{ pos: number; color: string }>): void =>\n setG((cur) => gradientSetStop(cur, i, patch));\n const posAt = (clientX: number): number =>\n gradientPosAt(bar.current?.getBoundingClientRect(), clientX);\n const onHandleDown = (i: number) => (e: ReactPointerEvent<HTMLButtonElement>) => {\n setSelected(i);\n dragging.current = i;\n e.currentTarget.setPointerCapture(e.pointerId);\n };\n const onHandleMove = (e: ReactPointerEvent<HTMLButtonElement>) => {\n if (dragging.current !== null) setStop(dragging.current, { pos: posAt(e.clientX) });\n };\n const add = (): void => {\n const next = gradientAddStop(g, selected);\n setG(next.gradient);\n setSelected(next.selected);\n };\n const remove = (): void => {\n const next = gradientRemoveStop(g, selected);\n setG(next.gradient);\n setSelected(next.selected);\n };\n const stop = g.stops[Math.min(selected, g.stops.length - 1)];\n const css = gradientCss(g);\n\n return (\n <dialog\n ref={ref}\n className=\"pptx-dialog pptx-gradient\"\n data-pptx-dialog=\"gradient\"\n aria-labelledby=\"pptx-gradient-title\"\n onCancel={(e) => {\n e.preventDefault();\n onClose();\n }}\n onClick={(e) => {\n if (e.target === e.currentTarget) onClose();\n }}\n >\n {open ? (\n <>\n <div className=\"pptx-dialog__header\">\n <h2 id=\"pptx-gradient-title\" className=\"pptx-dialog__title\">\n {t('gradient.title')}\n </h2>\n <ToolButton label={t('gradient.close')} icon=\"close\" onClick={onClose} />\n </div>\n <div className=\"pptx-dialog__body\">\n <div className=\"pptx-gradient__top\">\n <div className=\"pptx-gradient__fields\">\n <div className=\"pptx-gradient__row\">\n <label className=\"pptx-field\">\n {t('gradient.type')}\n <select\n value={g.kind}\n onChange={(e) =>\n setG({ ...g, kind: e.target.value === 'radial' ? 'radial' : 'linear' })\n }\n >\n <option value=\"linear\">{t('gradient.linear')}</option>\n <option value=\"radial\">{t('gradient.radial')}</option>\n </select>\n </label>\n <label className=\"pptx-field\">\n {t('gradient.angle')}\n <span className=\"pptx-field__control\">\n <input\n type=\"number\"\n min={0}\n max={359}\n step={1}\n value={Math.round(g.angle)}\n disabled={g.kind === 'radial'}\n onChange={(e) => {\n const angle = gradientAngleFrom(e.target.value);\n if (angle !== null) setG({ ...g, angle });\n }}\n />\n <span className=\"pptx-field__unit\">°</span>\n </span>\n </label>\n </div>\n <div className=\"pptx-dialog__section\">\n <h3 className=\"pptx-dialog__label\">{t('gradient.stops')}</h3>\n <div className=\"pptx-gradient__row\">\n <button type=\"button\" className=\"pptx-button\" onClick={add}>\n {t('gradient.add')}\n </button>\n <button\n type=\"button\"\n className=\"pptx-button\"\n onClick={remove}\n disabled={g.stops.length <= 2}\n >\n {t('gradient.remove')}\n </button>\n <input\n type=\"color\"\n className=\"pptx-gradient__color\"\n aria-label={t('gradient.stopColor')}\n value={stop.color.toLowerCase()}\n onChange={(e) => setStop(selected, { color: e.target.value.toUpperCase() })}\n />\n </div>\n </div>\n <label className=\"pptx-radio\">\n <input\n type=\"checkbox\"\n checked={g.rotWithShape}\n onChange={(e) => setG({ ...g, rotWithShape: e.target.checked })}\n />\n {t('gradient.rotate')}\n </label>\n </div>\n <div className=\"pptx-dialog__section\">\n <h3 className=\"pptx-dialog__label\">{t('gradient.preview')}</h3>\n <div className=\"pptx-gradient__preview\" style={{ background: css }} />\n </div>\n </div>\n <div\n ref={bar}\n className=\"pptx-gradient__bar\"\n style={{ background: gradientCss({ ...g, kind: 'linear', angle: 0 }) }}\n >\n {g.stops.map((s, i) => (\n <button\n key={i}\n type=\"button\"\n className=\"pptx-gradient__handle\"\n aria-label={t('gradient.stopHandle', { percent: Math.round(s.pos * 100) })}\n aria-pressed={i === selected}\n style={{ left: `${s.pos * 100}%`, background: s.color }}\n onPointerDown={onHandleDown(i)}\n onPointerMove={onHandleMove}\n onPointerUp={() => (dragging.current = null)}\n onKeyDown={(e) => {\n const pos = gradientHandleKey(e.key, e.shiftKey, s.pos);\n if (pos !== null) setStop(i, { pos });\n }}\n />\n ))}\n </div>\n </div>\n <div className=\"pptx-dialog__footer\">\n <button type=\"button\" className=\"pptx-button\" onClick={onClose}>\n {t('gradient.cancel')}\n </button>\n <button\n type=\"button\"\n className=\"pptx-button pptx-button--primary\"\n onClick={() => onApply(g)}\n >\n {t('gradient.ok')}\n </button>\n </div>\n </>\n ) : null}\n </dialog>\n );\n}\n\n/** The props of `LineGlyph`. @public */\nexport interface LineGlyphProps {\n /** The line kind or line end to draw, as the line menus give it. */\n value: string;\n /** Draw the end at the start of the line (mirrored), for the line start menu. */\n start?: boolean;\n}\n\n/** Glyphs for line kinds and line ends, drawn at the right of a 48×24 box. @public */\nexport function LineGlyph({ value, start }: LineGlyphProps) {\n const solid = { fill: 'currentColor', stroke: 'none' } as const;\n return (\n <svg className=\"pptx-line-glyph\" viewBox=\"0 0 48 24\" aria-hidden=\"true\">\n <g transform={lineGlyphTransform(start)}>\n {lineGlyphParts(value, start).map((p, i) =>\n p.kind === 'dot' ? (\n <circle key={i} cx={p.cx} cy={p.cy} r={p.r} {...solid} />\n ) : p.kind === 'solid' ? (\n <path key={i} d={p.d} {...solid} />\n ) : (\n <path\n key={i}\n d={p.d}\n {...LINE_GLYPH_STROKE}\n {...(p.join ? { strokeLinejoin: 'round' as const } : {})}\n />\n )\n )}\n </g>\n </svg>\n );\n}\n\n/** The props of `LineMenuControl`. @public */\nexport interface LineMenuControlProps {\n /** The chrome slot the control runs. */\n slot: ChromeSlotId;\n /** The registry entry of the control, from `CHROME_GROUPS`. */\n control: ChromeControl;\n}\n\n/** The line tool and the line start and end menus, with each option drawn. @public */\nexport function LineMenuControl({ slot, control }: LineMenuControlProps) {\n const { cmd, label, reason, tip } = useSlot(slot, control);\n const off = useAriaDisabled(!cmd.isEnabled, reason);\n const editor = usePptxEditor();\n const { t } = useTranslation();\n const anchor = useRef<HTMLButtonElement>(null);\n const [open, setOpen] = useState(false);\n const isLine = useEditorState((s) => s.geometry?.lineHead !== undefined);\n // Line ends draw on the side they belong to; the line tool shows its kinds.\n const start = lineSlotEnd(slot);\n const shown = String(cmd.value ?? (start === undefined ? 'line' : 'none'));\n const trigger = useTriggerAttributes(slot, 'pptx-toolbar__button pptx-toolbar__button--wide', {\n disabled: !cmd.isEnabled,\n });\n // Line ends are contextual, as in Google Slides: they show only while a line is selected.\n if (start !== undefined && !isLine) return null;\n return (\n <>\n <button\n ref={anchor}\n type=\"button\"\n {...trigger}\n data-slot={slot}\n aria-label={label}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n {...tip}\n {...off.attrs}\n onMouseDown={keepFocus}\n onClick={() => setOpen((o) => !o)}\n >\n <LineGlyph value={shown} {...(start !== undefined ? { start } : {})} />\n <Icon name=\"arrow_drop_down\" className=\"pptx-icon pptx-toolbar__caret\" />\n </button>\n {off.note}\n {open ? (\n <Popover anchor={anchor.current} onClose={() => setOpen(false)}>\n {control.options?.map((o) => (\n <MenuItem\n key={o.value}\n // Line ends are a choice with a current value; the line tool inserts a kind.\n {...(control.toggle === 'choice' ? { checked: o.value === cmd.value } : {})}\n onSelect={() => (\n cmd.execute(o.value),\n focusText(editor, anchor.current),\n setOpen(false)\n )}\n >\n <LineGlyph value={o.value} {...(start !== undefined ? { start } : {})} />\n {t(o.labelKey)}\n </MenuItem>\n ))}\n </Popover>\n ) : null}\n </>\n );\n}\n","/** @jsxImportSource react */\n// Ported from DOCX Editor packages/react/src/editor/dialog-parts.tsx at 27720ad5\n// (`createDialogParts`, `DialogFrame`, `UseDialogReturn`).\n// PPTX changes: part markers are `data-pptx-*`, the draft lives in core, `createDialogParts`\n// takes the dialog's name for warnings, and the frame rules in core differ where noted there.\n//\n// Dialog named parts over a draft controller. A packaged dialog renders its default arrangement with each element\n// marked `data-pptx-part` (and `data-pptx-field` for a field). A host child with the same part\n// name replaces that element in place: it keeps the part's wiring and adds its own class,\n// style, and attributes, or takes the wiring onto its own element with `asChild`.\n// `preset={false}` renders only the host's children. The draft itself lives in core\n// (`createDialogDraft`), so the Vue twin behaves the same.\n\nimport {\n Children,\n Fragment,\n cloneElement,\n createContext,\n isValidElement,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n useSyncExternalStore,\n type CSSProperties,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport {\n DIALOG_FIELD_ATTRIBUTE,\n DIALOG_PART_ATTRIBUTE,\n createDialogDraft,\n dialogInitialFocus as initialFocus,\n dialogPartKey,\n dialogPartLabel,\n fromNestedDialog,\n isDialogBackdropPoint,\n returnAppliesFrom,\n trapTabWithin,\n warnDialogPart,\n type DialogDraft,\n type DialogDraftOptions,\n type DialogErrors,\n} from '@pptx-editor.dev/core/editor';\nimport { renderAsChild, type HostElementProps } from './slot-override.ts';\nimport { useChromeScopeClassName } from './color-mode.ts';\nimport { usePptxEditor } from './context.ts';\n\n/**\n * Presentation overrides for a dialog part. @public\n *\n * Anything beyond these members reaches the rendered element, so a part takes an `id`, an\n * `aria-*` label, or a `data-*` test hook. The part's own wiring wins every collision: a host\n * cannot replace Apply's handler or its `data-pptx-part` marker by passing one. To own the\n * element and its handler outright, pass `asChild` and supply your own.\n */\nexport interface DialogPartProps {\n /** A class name added to the part's element. */\n readonly className?: string;\n /** Inline styles for the part's element. */\n readonly style?: CSSProperties;\n /** Remove the part from the arrangement. */\n readonly hidden?: boolean;\n /** Apply the part's wiring to the single child element. */\n readonly asChild?: boolean;\n /** Content in place of the part's default content. */\n readonly children?: ReactNode;\n /** The id of the part's element. */\n readonly id?: string;\n /** The tooltip of the part's element. */\n readonly title?: string;\n /** The accessible name of the part's element. */\n readonly 'aria-label'?: string;\n /** `data-*` attributes, passed to the part's element. */\n readonly [attribute: `data-${string}`]: unknown;\n}\n\n/** Layout customization for a packaged dialog. @public */\nexport interface DialogCustomizationProps {\n /** A class name added to the dialog surface. */\n readonly className?: string;\n /** Styles added to the dialog surface. */\n readonly style?: CSSProperties;\n /**\n * `true` (default): the default arrangement, with named children replacing their parts in\n * place and other children appended. `false`: only the children.\n */\n readonly preset?: boolean;\n /** Named parts that replace the defaults, or the whole arrangement with `preset={false}`. */\n readonly children?: ReactNode;\n}\n\n/** A dialog's draft and actions, as its parts and a host's own fields read them. @public */\nexport interface UseDialogReturn<Fields extends object> {\n /** The draft values. */\n readonly values: Fields;\n /** Change one field of the draft. */\n setValue<K extends keyof Fields>(name: K, value: Fields[K]): void;\n /** Translated messages per field, and `form` for the whole draft. */\n readonly errors: Readonly<Partial<Record<Extract<keyof Fields, string> | 'form', string>>>;\n /** False when the dialog cannot apply now (no document, viewing mode). */\n readonly isEnabled: boolean;\n /** Validate and commit the draft. The dialog closes when the document took it. */\n apply(): void;\n /** Discard the draft and close. */\n cancel(): void;\n}\n\ntype NodeProps = Record<string, unknown> & { children?: ReactNode };\n\n/** The part key of a default element, read from its markers. */\nconst markerOf = (props: NodeProps): string | null =>\n dialogPartKey(props[DIALOG_PART_ATTRIBUTE], props[DIALOG_FIELD_ATTRIBUTE]);\n\n/** Every element in `nodes`, depth first, through fragments. */\nfunction visit(nodes: ReactNode, callback: (node: ReactElement<NodeProps>) => void): void {\n Children.forEach(nodes, (node) => {\n if (!isValidElement<NodeProps>(node)) return;\n callback(node);\n visit(node.props.children, callback);\n });\n}\n\n/** The top-level nodes of `nodes`, with fragments opened. */\nconst flatten = (nodes: ReactNode): ReactNode[] =>\n Children.toArray(nodes).flatMap((node) =>\n isValidElement<NodeProps>(node) && node.type === Fragment\n ? flatten(node.props.children)\n : [node]\n );\n\n/** The parts a `createDialogParts` call returns. @internal */\nexport interface DialogParts<Name extends string, State> {\n readonly Header: (props: DialogPartProps) => ReactNode;\n readonly Title: (props: DialogPartProps) => ReactNode;\n readonly Body: (props: DialogPartProps) => ReactNode;\n readonly Footer: (props: DialogPartProps) => ReactNode;\n readonly Apply: (props: DialogPartProps) => ReactNode;\n readonly Cancel: (props: DialogPartProps) => ReactNode;\n readonly Reset: (props: DialogPartProps) => ReactNode;\n readonly Error: (props: DialogPartProps) => ReactNode;\n /** One field of the dialog, by its field name. */\n readonly Field: (props: DialogPartProps & { readonly name: Name }) => ReactNode;\n /** Renders the default arrangement with the host's parts in place. Internal to dialogs. */\n readonly Composition: (props: {\n readonly defaults: ReactNode;\n readonly children?: ReactNode;\n readonly preset?: boolean;\n readonly state: State;\n }) => ReactNode;\n /** The dialog's draft, for a child of the dialog. Throws outside it. */\n readonly useState: () => State;\n /** A dialog-specific part, matched to the default element with this `data-pptx-part`. */\n readonly part: (name: string) => (props: DialogPartProps) => ReactNode;\n}\n\n/**\n * Build the named parts of one dialog. `Name` is the dialog's field names; `State` is what\n * `useState()` returns to a host's own controls. `dialogName` names the dialog in errors and\n * development warnings. The document state stays in the dialog's draft controller; the parts\n * only render. Every packaged dialog is built with it. @internal\n */\nexport function createDialogParts<Name extends string, State>(\n dialogName = 'Dialog'\n): DialogParts<Name, State> {\n const Context = createContext<{\n defaults: Map<string, ReactElement<NodeProps>>;\n overrides: Map<string, ReactElement<DialogPartProps>>;\n state: State;\n } | null>(null);\n const identities = new Map<unknown, string>();\n const keyOf = (node: ReactElement<NodeProps>): string | null => {\n const part = identities.get(node.type);\n return part === undefined ? null : dialogPartKey(part, node.props.name);\n };\n const label = (key: string): string => dialogPartLabel(dialogName, key);\n function useDialogState(): State {\n const context = useContext(Context);\n if (!context)\n throw new globalThis.Error(`${dialogName} parts must be rendered inside ${dialogName}.`);\n return context.state;\n }\n function replace(\n nodes: ReactNode,\n overrides: Map<string, ReactElement<DialogPartProps>>\n ): ReactNode {\n return Children.map(nodes, (node) => {\n if (!isValidElement<NodeProps>(node)) return node;\n const key = markerOf(node.props);\n if (key && overrides.has(key)) return overrides.get(key);\n return node.props.children === undefined\n ? node\n : cloneElement(node, { children: replace(node.props.children, overrides) });\n });\n }\n function makePart(part: string) {\n function Part(props: DialogPartProps & { name?: Name }): ReactNode {\n const context = useContext(Context);\n const key = dialogPartKey(part, props.name);\n if (!context) {\n if (key) warnDialogPart(label(key), 'outside');\n return null;\n }\n if (props.hidden) return null;\n const original = key ? context.defaults.get(key) : undefined;\n if (!original) {\n if (key)\n warnDialogPart(\n label(key),\n props.children != null && props.children !== false ? 'childrenOnly' : 'unknown'\n );\n return props.children ?? null;\n }\n // `hidden` and `name` steer this component; they are not element attributes.\n const { children, asChild, className, style, hidden: _hidden, name: _name, ...rest } = props;\n // The part's own wiring outranks anything the host passed, so a stray `onClick` or\n // `data-pptx-part` cannot silently detach the control from the dialog.\n // A default element's `undefined` (a `title` it sets only when disabled) leaves the\n // host's value in place.\n const wiring = Object.fromEntries(\n Object.entries(original.props).filter(([, value]) => value !== undefined)\n );\n const shared: NodeProps = {\n ...rest,\n ...wiring,\n className: [original.props.className, className].filter(Boolean).join(' '),\n style: { ...(original.props.style as CSSProperties | undefined), ...style },\n };\n // A field control (`NumberField`, `SelectField`) has no single element for `asChild`:\n // the host's content replaces the whole field and reads the draft with the dialog's hook.\n const control = (original.type as { dialogControl?: boolean }).dialogControl === true;\n if (control && (asChild || (children !== undefined && children !== null))) {\n if (asChild && key) warnDialogPart(label(key), 'controlAsChild');\n return <>{children}</>;\n }\n const only = asChild ? Children.toArray(children) : [];\n const child = only.length === 1 ? only[0] : undefined;\n if (asChild && !isValidElement<HostElementProps>(child) && key)\n warnDialogPart(label(key), 'asChild');\n if (asChild && isValidElement<HostElementProps>(child)) {\n // The host owns the element's look: forward the wiring and the host's own class and\n // style, never the packaged `pptx-dialog__*` classes.\n const {\n children: _defaultChildren,\n className: _presetClassName,\n style: _presetStyle,\n ...wiring\n } = shared;\n return renderAsChild(child, {\n ...wiring,\n ...(className ? { className } : {}),\n ...(style ? { style } : {}),\n });\n }\n // A misused `asChild` falls back to the packaged part with its packaged content.\n const content = asChild ? undefined : children;\n return cloneElement(\n original,\n shared,\n content === undefined ? replace(original.props.children, context.overrides) : content\n );\n }\n identities.set(Part, part);\n return Part;\n }\n function Composition({\n defaults,\n children,\n preset = true,\n state,\n }: {\n readonly defaults: ReactNode;\n readonly children?: ReactNode;\n readonly preset?: boolean;\n readonly state: State;\n }): ReactNode {\n const defaultMap = new Map<string, ReactElement<NodeProps>>();\n visit(defaults, (node) => {\n const key = markerOf(node.props);\n if (key) defaultMap.set(key, node);\n });\n // Only top-level parts replace a default in place, as in the Vue twin. A part inside a\n // host element renders where the host put it, and the default stays (it says so).\n const overrides = new Map<string, ReactElement<DialogPartProps>>();\n for (const node of flatten(children)) {\n if (!isValidElement<NodeProps>(node)) continue;\n const key = keyOf(node);\n if (key) {\n if (overrides.has(key)) warnDialogPart(label(key), 'duplicate');\n overrides.set(key, node as ReactElement<DialogPartProps>);\n } else if (preset)\n visit(node.props.children, (inner) => {\n const nested = keyOf(inner);\n if (nested) warnDialogPart(label(nested), 'nested');\n });\n }\n // A part with no default in place is never rendered by `replace`, so it says so here.\n if (preset)\n for (const [key, node] of overrides)\n if (!defaultMap.has(key) && !node.props.hidden) warnDialogPart(label(key), 'unknown');\n // A part whose default sits inside another part that brings its own children is dropped\n // with that default.\n if (preset)\n for (const [key, node] of overrides) {\n // Only an owner that really replaces its content drops what it held: a misused\n // `asChild` falls back to the packaged part, defaults and all.\n const only = Children.toArray(node.props.children);\n const replaces = node.props.asChild\n ? only.length === 1 && isValidElement(only[0])\n : node.props.children !== undefined;\n if (!replaces) continue;\n visit(defaultMap.get(key)?.props.children, (inner) => {\n const nested = markerOf(inner.props);\n if (nested && nested !== key && overrides.has(nested))\n warnDialogPart(label(nested), 'shadowed', label(key));\n });\n }\n const extras = flatten(children).filter(\n (node) => !isValidElement<NodeProps>(node) || !keyOf(node)\n );\n return (\n <Context.Provider value={{ defaults: defaultMap, overrides, state }}>\n {preset ? (\n <>\n {replace(defaults, overrides)}\n {extras}\n </>\n ) : (\n children\n )}\n </Context.Provider>\n );\n }\n return {\n Header: makePart('header'),\n Title: makePart('title'),\n Body: makePart('body'),\n Footer: makePart('footer'),\n Apply: makePart('apply'),\n Cancel: makePart('cancel'),\n Reset: makePart('reset'),\n Error: makePart('error'),\n Field: makePart('field') as (props: DialogPartProps & { readonly name: Name }) => ReactNode,\n Composition,\n useState: useDialogState,\n part: (name) => makePart(name) as (props: DialogPartProps) => ReactNode,\n };\n}\n\n/**\n * A draft for a dialog's lifetime: created when the component mounts, re-read on every change.\n * The dialog unmounts when it closes (the popups host renders it only while open), so the next\n * opening starts from the document again. @internal\n */\nexport function useDialogDraft<Fields extends object>(\n options: () => DialogDraftOptions<Fields>\n): DialogDraft<Fields> {\n // The draft is made once; its callbacks read the latest render's options, so a commit that\n // closes over host props (`onThemeChange`) never runs a stale copy.\n const latest = useRef<DialogDraftOptions<Fields> | null>(null);\n latest.current = options();\n const [draft] = useState(() => {\n const first = latest.current!;\n return createDialogDraft<Fields>({\n initial: first.initial,\n validate: (values) => latest.current!.validate?.(values) ?? ({} as DialogErrors<Fields>),\n commit: (values) => latest.current!.commit(values),\n resetValues: () => latest.current!.resetValues?.() ?? first.initial,\n });\n });\n useSyncExternalStore(\n draft.subscribe,\n () => draft.values,\n () => draft.values\n );\n useSyncExternalStore(\n draft.subscribe,\n () => draft.errors,\n () => draft.errors\n );\n return draft;\n}\n\n/** Props of `DialogFrame`. @internal */\nexport interface DialogFrameProps {\n /** The dialog's registry key, as `data-pptx-dialog`. */\n readonly kind: string;\n /** The accessible name. */\n readonly label: string;\n readonly className?: string;\n readonly style?: CSSProperties;\n /** Escape, a click on the backdrop, or the host closing it. */\n readonly onClose: () => void;\n /** Keys the frame does not handle itself (Enter to apply). */\n readonly onKeyDown?: (event: KeyboardEvent<HTMLDialogElement>) => void;\n readonly children: ReactNode;\n}\n\n/**\n * The native modal every packaged dialog renders in, after DOCX Editor's `DialogFrame`: it\n * opens as a modal on mount and closes on unmount, focuses its first control, keeps Tab inside,\n * closes on Escape and on a click on the backdrop, and gives focus back to the element that\n * had it. Outside an editor scope it carries the scope itself, so the tokens apply. @internal\n */\nexport function DialogFrame({\n kind,\n label,\n className,\n style,\n onClose,\n onKeyDown,\n children,\n}: DialogFrameProps): ReactNode {\n const ref = useRef<HTMLDialogElement>(null);\n const closeRef = useRef(onClose);\n closeRef.current = onClose;\n // Where the last press started: a press inside the panel that is released over the backdrop\n // is a text selection or a drag, not a dismissal.\n const pressedOutside = useRef(false);\n const [ownScope, setOwnScope] = useState(false);\n const scope = useChromeScopeClassName();\n useLayoutEffect(() => {\n const panel = ref.current;\n if (!panel) return;\n setOwnScope(!panel.parentElement?.closest('.pptx-editor'));\n const opener = panel.ownerDocument.activeElement as HTMLElement | null;\n if (typeof panel.showModal === 'function' && !panel.open) panel.showModal();\n else panel.setAttribute('open', ''); // DOM test environments; browsers use native modality.\n initialFocus(panel)?.focus({ preventScroll: true });\n return () => {\n // Unmounted while open: leave the modal state, so the page is not left inert.\n if (typeof panel.close === 'function' && panel.open) panel.close();\n if (opener?.isConnected) opener.focus({ preventScroll: true });\n };\n }, []);\n return (\n <dialog\n ref={ref}\n aria-modal=\"true\"\n aria-label={label}\n className={['pptx-dialog', ownScope ? scope : '', className].filter(Boolean).join(' ')}\n style={style}\n data-pptx-dialog={kind}\n onCancel={(event) => {\n // React dispatches `cancel` to every ancestor's handler: a nested dialog's own Escape\n // must close only that dialog.\n if (fromNestedDialog(event.currentTarget, event.target)) return;\n event.preventDefault();\n closeRef.current();\n }}\n onMouseDown={(event) => {\n pressedOutside.current = isDialogBackdropPoint(event.currentTarget, event);\n event.stopPropagation();\n }}\n onClick={(event) => {\n // As DOCX Editor: a click on the backdrop lands on the dialog element, outside its box.\n // The press must start there too (see `pressedOutside`).\n if (\n event.target === event.currentTarget &&\n pressedOutside.current &&\n isDialogBackdropPoint(event.currentTarget, event)\n )\n closeRef.current();\n pressedOutside.current = false;\n event.stopPropagation();\n }}\n onKeyDown={(event) => {\n // A dialog opened inside this one (the custom gradient editor) handles its own keys;\n // they still stop here, so they never reach the editor's shortcuts.\n if (fromNestedDialog(event.currentTarget, event.target)) {\n event.stopPropagation();\n return;\n }\n if (event.key === 'Escape' && !event.nativeEvent.isComposing) {\n event.preventDefault();\n closeRef.current();\n } else if (trapTabWithin(event.currentTarget, event.nativeEvent)) event.preventDefault();\n else if (!event.nativeEvent.isComposing && !event.defaultPrevented) onKeyDown?.(event);\n event.stopPropagation();\n }}\n >\n {children}\n </dialog>\n );\n}\n\n/**\n * Return in a field applies the draft, as a press on OK does: from any input (as\n * DOCX Editor), and from a radio of a radio group. A button, a link, and a text area keep\n * their own Return. @internal\n */\nexport function applyOnEnter(\n event: KeyboardEvent<HTMLDialogElement>,\n enabled: boolean,\n apply: () => void\n): void {\n if (event.key !== 'Enter' || !enabled || !returnAppliesFrom(event.target)) return;\n event.preventDefault();\n apply();\n}\n\n/**\n * Close a dialog when its editor opens another document, after DOCX Editor's\n * `useDialogDocument`: a retained draft never edits the replacement. The registry closes its\n * dialogs too; this covers a dialog the host renders itself. @internal\n */\nexport function useCloseOnNewDocument(onClose: () => void): void {\n const editor = usePptxEditor();\n const closeRef = useRef(onClose);\n closeRef.current = onClose;\n useEffect(() => {\n if (!editor) return;\n let session = editor.session;\n // Once per new document; `destroy()` leaves no session and closes nothing.\n return editor.subscribe(() => {\n if (editor.session === session) return;\n session = editor.session;\n if (session) closeRef.current();\n });\n }, [editor]);\n}\n","// The chrome color mode a `PptxEditor.Root` declares (`colorMode`), after DOCX Editor's\n// `packages/react/src/editor/color-mode-context.ts`. The dark palette is scoped to\n// `.pptx-editor.dark`. `Root` renders no element, so the viewport adds `dark` beside\n// `.pptx-editor`, and a part rendered outside the viewport (a dialog) puts the scope classes\n// on its own root element. Only the chrome is themed: the slide keeps the deck's own colors.\n\nimport { createContext, useContext, useSyncExternalStore } from 'react';\nimport {\n resolveDarkChrome,\n subscribeSystemDark,\n systemPrefersDark,\n type ColorMode,\n type ResolvedColorMode,\n} from '@pptx-editor.dev/core/editor';\n\n/**\n * True when the enclosing `Root` resolved a dark chrome. A `Root` that resolves one provides\n * it; without a provider the chrome is light.\n */\nexport const ChromeDarkContext = createContext(false);\n\n/** True inside `PptxEditor.Viewport`: an ancestor element already carries `.pptx-editor`. */\nexport const ScopedByAncestorContext = createContext(false);\n\nconst light = (): boolean => false;\nconst none = (): (() => void) => () => undefined;\n\n/** Whether `mode` is dark now. `'system'` follows the operating system and updates with it. */\nexport function useResolvedDark(mode: ColorMode | undefined): boolean {\n const follow = mode === 'system';\n const systemDark = useSyncExternalStore(\n follow ? subscribeSystemDark : none,\n follow ? systemPrefersDark : light,\n light\n );\n return resolveDarkChrome(mode, systemDark);\n}\n\n/** Whether the enclosing `Root` resolved a dark chrome. */\nexport function useChromeDark(): boolean {\n return useContext(ChromeDarkContext);\n}\n\n/** What `useEditorColorMode` returns. @public */\nexport interface UseEditorColorModeReturn {\n /** The resolved theme: `'dark'` or `'light'`. Re-renders when `colorMode` or the OS setting changes. */\n readonly colorMode: ResolvedColorMode;\n}\n\n// One object per theme, so the answer keeps its identity until the theme changes.\nconst LIGHT: UseEditorColorModeReturn = Object.freeze({ colorMode: 'light' });\nconst DARK: UseEditorColorModeReturn = Object.freeze({ colorMode: 'dark' });\n\n/**\n * The theme the enclosing `PptxEditor.Root` resolved from its `colorMode`, so parts you build\n * yourself (a portaled popover) can match the chrome. `'system'` follows the operating system\n * and re-renders when it changes. Outside a root, or without `colorMode`, it is `'light'`. The\n * same hook as DOCX Editor's.\n *\n * @example\n * ```tsx\n * function MyPanel() {\n * const { colorMode } = useEditorColorMode();\n * return <aside className={colorMode === 'dark' ? 'panel panel--dark' : 'panel'} />;\n * }\n * ```\n *\n * @public\n */\nexport function useEditorColorMode(): UseEditorColorModeReturn {\n return useContext(ChromeDarkContext) ? DARK : LIGHT;\n}\n\n/** The scope classes a self-scoping part adds to its root element. */\nexport function useChromeScopeClassName(): 'pptx-editor' | 'pptx-editor dark' {\n return useContext(ChromeDarkContext) ? 'pptx-editor dark' : 'pptx-editor';\n}\n","/** @jsxImportSource react */\n// The Alt Text dialog (Picture Format → Alt Text, and Edit Alt Text in the context menu): the\n// description and title of the selected element, and \"Mark as decorative\", as in the\n// Alt Text pane. The DOCX Editor equivalent is the `imageAltText` popup. Built on the dialog\n// parts (`dialog-parts.tsx`): the fields write a draft, OK applies it as one undo step, and\n// Cancel discards it. The draft rules live in core (`picture-fields.ts`), so the Vue twin\n// applies the same command.\n\nimport { useEffect, useId, useMemo, useRef, useState, type ReactNode } from 'react';\nimport {\n MAX_ALT_TEXT,\n altTextDraftCommand,\n altTextDraftFrom,\n commitDialogCommand,\n translateDialogErrors,\n translateKeyOrText,\n validateAltTextDraft,\n} from '@pptx-editor.dev/core/editor';\nimport { useEditorState, usePptxEditor, useTranslation } from './context.ts';\nimport { ToolButton } from './chrome.tsx';\nimport {\n DialogFrame,\n applyOnEnter,\n createDialogParts,\n useCloseOnNewDocument,\n useDialogDraft,\n type DialogCustomizationProps,\n type UseDialogReturn,\n} from './dialog-parts.tsx';\n\n/** The draft of the Alt Text dialog. @public */\nexport interface ImageAltTextDialogFields {\n /** The description a screen reader reads (`p:cNvPr/@descr`). */\n readonly description: string;\n /** The title (`p:cNvPr/@title`). */\n readonly title: string;\n /** Mark as decorative: a screen reader skips the element, and the description is dropped. */\n readonly decorative: boolean;\n}\n\n/** The Alt Text draft and its actions. @public */\nexport type UseImageAltTextDialogReturn = UseDialogReturn<ImageAltTextDialogFields>;\n\n/** The field names of the Alt Text dialog, for `ImageAltTextDialog.Field`. @public */\nexport type ImageAltTextDialogFieldName = 'description' | 'title' | 'decorative';\n\n/** Props for `PptxEditor.ImageAltTextDialog`. @public */\nexport interface ImageAltTextDialogProps extends DialogCustomizationProps {\n /** Whether the dialog is shown. The host owns this state. */\n readonly open: boolean;\n /** Called on Cancel, Escape, a click on the backdrop, and after OK. */\n readonly onClose: () => void;\n}\n\nconst parts = createDialogParts<ImageAltTextDialogFieldName, UseImageAltTextDialogReturn>(\n 'ImageAltTextDialog'\n);\n\nfunction ImageAltTextDialogRoot(props: ImageAltTextDialogProps): ReactNode {\n return props.open ? <ImageAltTextDialogOpen {...props} /> : null;\n}\n\nfunction ImageAltTextDialogOpen({\n onClose,\n className,\n style,\n preset = true,\n children,\n}: ImageAltTextDialogProps): ReactNode {\n const { t } = useTranslation();\n const editor = usePptxEditor();\n const id = useId();\n const current = useEditorState((s) => s.geometry?.altText);\n const enabled = useEditorState(\n (s) => s.status === 'ready' && s.mode === 'edit' && s.geometry !== null\n );\n const [initial] = useState(() => altTextDraftFrom(current));\n // The draft belongs to the object the dialog opened on: another selection, or the object's\n // removal, closes the dialog, so OK never applies one object's draft to another.\n const nodeId = useEditorState((s) => s.geometry?.nodeId ?? null);\n const [openedOn] = useState(nodeId);\n const closeRef = useRef(onClose);\n closeRef.current = onClose;\n useEffect(() => {\n if (nodeId !== openedOn) closeRef.current();\n }, [nodeId, openedOn]);\n useCloseOnNewDocument(onClose);\n const draft = useDialogDraft<ImageAltTextDialogFields>(() => ({\n initial,\n validate: validateAltTextDraft,\n commit: (values) => commitDialogCommand(editor, altTextDraftCommand(values, initial)),\n }));\n // The state gives messages; the raw keys stay inside, for focus.\n const translatedErrors = useMemo(() => translateDialogErrors(t, draft.errors), [t, draft.errors]);\n const state: UseImageAltTextDialogReturn = {\n values: draft.values,\n setValue: draft.setValue,\n errors: translatedErrors,\n isEnabled: enabled,\n apply: () => {\n if (draft.apply()) return onClose();\n // Focus the field with the error (WCAG 3.3.1), as Format Picture does.\n const bad = (['description', 'title'] as const).find(\n (f) => validateAltTextDraft(draft.values)[f]\n );\n if (bad) document.getElementById(`${id}-${bad}`)?.focus();\n },\n cancel: onClose,\n };\n const { description, title, decorative } = draft.values;\n // The first error, with the name of its field.\n const bad = draft.errors.description ? 'description' : draft.errors.title ? 'title' : null;\n const error = bad\n ? t('imageAltText.fieldError', {\n field: t(bad === 'description' ? 'imageAltText.description' : 'imageAltText.titleLabel'),\n message: translateKeyOrText(t, draft.errors[bad]!),\n })\n : draft.errors.form\n ? translateKeyOrText(t, draft.errors.form)\n : null;\n const invalid = (f: 'description' | 'title') =>\n draft.errors[f] ? { 'aria-invalid': true as const } : { 'aria-invalid': false as const };\n return (\n <DialogFrame\n kind=\"imageAltText\"\n label={t('imageAltText.title')}\n className={className}\n style={style}\n onClose={onClose}\n onKeyDown={(event) => applyOnEnter(event, state.isEnabled, state.apply)}\n >\n <parts.Composition\n state={state}\n preset={preset}\n defaults={\n <>\n <div data-pptx-part=\"header\" className=\"pptx-dialog__header\">\n <h2 data-pptx-part=\"title\" className=\"pptx-dialog__title\">\n {t('imageAltText.title')}\n </h2>\n <ToolButton label={t('imageAltText.close')} icon=\"close\" onClick={onClose} />\n </div>\n <div data-pptx-part=\"body\" className=\"pptx-dialog__body\">\n <section\n data-pptx-part=\"field\"\n data-pptx-field=\"description\"\n className=\"pptx-dialog__section\"\n >\n <label className=\"pptx-dialog__label\" htmlFor={`${id}-description`}>\n {t('imageAltText.description')}\n </label>\n <p className=\"pptx-dialog__muted\" id={`${id}-help`}>\n {t('imageAltText.descriptionHelp')}\n </p>\n <textarea\n id={`${id}-description`}\n className=\"pptx-dialog__textarea\"\n rows={5}\n value={description}\n disabled={decorative}\n {...invalid('description')}\n aria-describedby={[\n `${id}-help`,\n `${id}-count`,\n decorative ? `${id}-decorative-reason` : null,\n bad === 'description' ? `${id}-error` : null,\n ]\n .filter(Boolean)\n .join(' ')}\n onChange={(e) => draft.setValue('description', e.target.value)}\n />\n {decorative ? (\n <span className=\"pptx-sr-only\" id={`${id}-decorative-reason`}>\n {t('imageAltText.decorativeReason')}\n </span>\n ) : null}\n <span className=\"pptx-dialog__muted\" id={`${id}-count`}>\n {t('imageAltText.count', { count: description.length, max: MAX_ALT_TEXT })}\n </span>\n </section>\n <section\n data-pptx-part=\"field\"\n data-pptx-field=\"title\"\n className=\"pptx-dialog__section pptx-field\"\n >\n <label className=\"pptx-dialog__label\" htmlFor={`${id}-title`}>\n {t('imageAltText.titleLabel')}\n </label>\n <input\n id={`${id}-title`}\n type=\"text\"\n value={title}\n {...invalid('title')}\n aria-describedby={bad === 'title' ? `${id}-error` : undefined}\n onChange={(e) => draft.setValue('title', e.target.value)}\n />\n </section>\n <section\n data-pptx-part=\"field\"\n data-pptx-field=\"decorative\"\n className=\"pptx-dialog__section\"\n >\n <label className=\"pptx-radio\">\n <input\n type=\"checkbox\"\n checked={decorative}\n aria-describedby={`${id}-decorative-help`}\n onChange={(e) => draft.setValue('decorative', e.target.checked)}\n />\n {t('imageAltText.decorative')}\n </label>\n <p className=\"pptx-dialog__muted\" id={`${id}-decorative-help`}>\n {t('imageAltText.decorativeHelp')}\n </p>\n </section>\n </div>\n <div data-pptx-part=\"footer\" className=\"pptx-dialog__footer\">\n <span\n id={`${id}-error`}\n data-pptx-part=\"error\"\n role=\"alert\"\n className=\"pptx-dialog__error\"\n >\n {error}\n </span>\n <button\n type=\"button\"\n data-pptx-part=\"cancel\"\n className=\"pptx-button\"\n onClick={state.cancel}\n >\n {t('dialog.cancel')}\n </button>\n <button\n type=\"button\"\n data-pptx-part=\"apply\"\n className=\"pptx-button pptx-button--primary\"\n disabled={!state.isEnabled}\n onClick={state.apply}\n >\n {t('dialog.ok')}\n </button>\n </div>\n </>\n }\n >\n {children}\n </parts.Composition>\n </DialogFrame>\n );\n}\n\n/**\n * Read the draft of the enclosing Alt Text dialog, for a host's own field inside it. It does\n * not open the dialog: `useEditorDialog('imageAltText').open()` does. @public\n */\nexport function useImageAltTextDialog(): UseImageAltTextDialogReturn {\n return parts.useState();\n}\n\n/**\n * Alt text of the selected element: description, title, and \"Mark as decorative\", with\n * replaceable parts (`Header`, `Title`, `Body`, `Footer`, `Field`, `Error`, `Apply`, `Cancel`).\n *\n * @example\n * ```tsx\n * <PptxEditor.ImageAltTextDialog {...props}>\n * <PptxEditor.ImageAltTextDialog.Field name=\"title\" hidden />\n * </PptxEditor.ImageAltTextDialog>\n * ```\n *\n * @public\n */\nexport const ImageAltTextDialog = Object.assign(ImageAltTextDialogRoot, {\n Header: parts.Header,\n Title: parts.Title,\n Body: parts.Body,\n Footer: parts.Footer,\n Field: parts.Field,\n Error: parts.Error,\n Apply: parts.Apply,\n Cancel: parts.Cancel,\n});\n","/** @jsxImportSource react */\n// The Format Picture dialog (`image.properties`, Format > Format picture, and the canvas context\n// menu): the size, rotation, and crop position of the selected picture, as DOCX Editor's\n// `imageProperties` dialog. Built on the dialog parts (`dialog-parts.tsx`): the fields write a\n// draft, OK applies it as one `setImageProperties` (one undo step), and Cancel discards it.\n// The draft rules live in core (`picture-fields.ts`), so the Vue twin applies the same command.\n\nimport { useEffect, useId, useMemo, useRef, useState, type ReactNode } from 'react';\nimport {\n commitDialogCommand,\n picturePropertiesDraftCommand,\n picturePropertiesDraftFrom,\n picturePropertiesWithValue,\n translateDialogErrors,\n translateKeyOrText,\n validatePicturePropertiesDraft,\n} from '@pptx-editor.dev/core/editor';\nimport type { TranslationKey } from '@pptx-editor.dev/i18n';\nimport { useEditorState, usePptxEditor, useTranslation } from './context.ts';\nimport { ToolButton } from './chrome.tsx';\nimport {\n DialogFrame,\n applyOnEnter,\n createDialogParts,\n useCloseOnNewDocument,\n useDialogDraft,\n type DialogCustomizationProps,\n type UseDialogReturn,\n} from './dialog-parts.tsx';\n\n/** The draft of the Format Picture dialog, in inches, degrees, and percent. @public */\nexport interface ImagePropertiesDialogFields {\n /** Width in inches, on the slide (`SelectedImageState.widthEmu`). */\n readonly width: number;\n /** Height in inches, on the slide (`SelectedImageState.heightEmu`). */\n readonly height: number;\n /** Lock aspect ratio: a width change scales the height, and the other way round. */\n readonly lockAspect: boolean;\n /** Rotation in degrees, clockwise. */\n readonly rotation: number;\n /** Crop of the left edge, in percent of the image; a negative value adds space. */\n readonly cropLeft: number;\n /** Crop of the top edge, in percent of the image. */\n readonly cropTop: number;\n /** Crop of the right edge, in percent of the image. */\n readonly cropRight: number;\n /** Crop of the bottom edge, in percent of the image. */\n readonly cropBottom: number;\n}\n\n/** The Format Picture draft and its actions. @public */\nexport type UseImagePropertiesDialogReturn = UseDialogReturn<ImagePropertiesDialogFields>;\n\n/** The field names of the Format Picture dialog, for `ImagePropertiesDialog.Field`. @public */\nexport type ImagePropertiesDialogFieldName = 'size' | 'rotation' | 'crop';\n\n/** Props for `PptxEditor.ImagePropertiesDialog`. @public */\nexport interface ImagePropertiesDialogProps extends DialogCustomizationProps {\n /** Whether the dialog is shown. The host owns this state. */\n readonly open: boolean;\n /** Called on Cancel, Escape, a click on the backdrop, and after OK. */\n readonly onClose: () => void;\n}\n\nconst parts = createDialogParts<ImagePropertiesDialogFieldName, UseImagePropertiesDialogReturn>(\n 'ImagePropertiesDialog'\n);\n\ntype NumberField = Exclude<keyof ImagePropertiesDialogFields, 'lockAspect'>;\n\n/** The number fields in screen order (Height before Width), for errors and focus. */\nconst NUMBER_FIELDS: readonly NumberField[] = [\n 'height',\n 'width',\n 'rotation',\n 'cropLeft',\n 'cropTop',\n 'cropRight',\n 'cropBottom',\n];\n\n/** The label of each number field, to name the field an error is about. */\nconst FIELD_LABELS: Record<NumberField, TranslationKey> = {\n width: 'imageProperties.width',\n height: 'imageProperties.height',\n rotation: 'imageProperties.rotation',\n cropLeft: 'imageProperties.cropLeft',\n cropTop: 'imageProperties.cropTop',\n cropRight: 'imageProperties.cropRight',\n cropBottom: 'imageProperties.cropBottom',\n};\n\nconst textsOf = (fields: ImagePropertiesDialogFields): Record<NumberField, string> =>\n Object.fromEntries(NUMBER_FIELDS.map((f) => [f, String(fields[f])])) as Record<\n NumberField,\n string\n >;\n\nfunction ImagePropertiesDialogRoot(props: ImagePropertiesDialogProps): ReactNode {\n return props.open ? <ImagePropertiesDialogOpen {...props} /> : null;\n}\n\nfunction ImagePropertiesDialogOpen({\n onClose,\n className,\n style,\n preset = true,\n children,\n}: ImagePropertiesDialogProps): ReactNode {\n const { t } = useTranslation();\n const editor = usePptxEditor();\n const id = useId();\n const picture = useEditorState((s) => s.image);\n // Format Picture edits one picture.\n const enabled = useEditorState(\n (s) => s.status === 'ready' && s.mode === 'edit' && s.image?.count === 1\n );\n const [initial] = useState(() => picturePropertiesDraftFrom(picture));\n const [exactCrop] = useState(() => picture?.crop);\n // The draft belongs to the picture the dialog opened on: another selection, or the picture's\n // removal, closes the dialog, so OK never applies one picture's draft to another.\n const [openedOn] = useState(() => picture?.nodeId ?? null);\n const nodeId = picture?.nodeId ?? null;\n const closeRef = useRef(onClose);\n closeRef.current = onClose;\n useEffect(() => {\n if (nodeId !== openedOn) closeRef.current();\n }, [nodeId, openedOn]);\n useCloseOnNewDocument(onClose);\n const draft = useDialogDraft<ImagePropertiesDialogFields>(() => ({\n initial,\n validate: (values) => validatePicturePropertiesDraft(values, initial),\n commit: (values) =>\n commitDialogCommand(editor, picturePropertiesDraftCommand(values, initial, exactCrop)),\n }));\n // The state gives messages; the raw keys stay inside, for focus.\n const translatedErrors = useMemo(() => translateDialogErrors(t, draft.errors), [t, draft.errors]);\n const state: UseImagePropertiesDialogReturn = {\n values: draft.values,\n // A host part's setValue takes the packaged fields' rules: Lock aspect ratio and the shown text.\n setValue: (name, value) => {\n if (name !== 'lockAspect' && typeof value === 'number') set(name, String(value));\n else draft.setValue(name, value);\n },\n errors: translatedErrors,\n isEnabled: enabled,\n apply: () => {\n if (draft.apply()) return onClose();\n // Focus the first field with an error (WCAG 3.3.1).\n const bad = NUMBER_FIELDS.find(\n (f) => validatePicturePropertiesDraft(draft.values, initial)[f]\n );\n if (bad) document.getElementById(`${id}-${bad}`)?.focus();\n },\n cancel: onClose,\n };\n const values = draft.values;\n // The text of each field as typed; the draft holds the numbers.\n const [texts, setTexts] = useState<Record<NumberField, string>>(() => textsOf(initial));\n const set = (field: NumberField, text: string): void => {\n const value = text.trim() === '' ? NaN : Number(text);\n if (field === 'width' || field === 'height') {\n // The live draft, as in Vue: two calls in one event each see the other's value.\n const current = draft.values;\n const next = picturePropertiesWithValue(current, field, value, initial);\n const other = field === 'width' ? 'height' : 'width';\n draft.setValue('width', next.width);\n draft.setValue('height', next.height);\n setTexts((all) => ({\n ...all,\n [field]: text,\n ...(next[other] !== current[other] ? { [other]: String(next[other]) } : {}),\n }));\n } else {\n draft.setValue(field, value);\n setTexts((all) => ({ ...all, [field]: text }));\n }\n };\n // A picture locked against cropping (`noCrop`), resizing (`noResize`), or rotation (`noRot`)\n // keeps its crop, size, or rotation, as in DOCX Editor: the fields are off, and one note says why.\n const cropLocked = picture?.canCrop === false;\n const sizeLocked = picture?.canResize === false;\n const rotationLocked = picture?.canRotate === false;\n const lockNote = (field: NumberField): string | null =>\n field.startsWith('crop')\n ? cropLocked\n ? `${id}-crop-locked`\n : null\n : field === 'rotation'\n ? rotationLocked\n ? `${id}-rotation-locked`\n : null\n : sizeLocked\n ? `${id}-size-locked`\n : null;\n const number = (field: NumberField, label: string, unit: string): ReactNode => (\n <label className=\"pptx-field\" htmlFor={`${id}-${field}`}>\n {label}\n <span className=\"pptx-field__control\">\n <input\n id={`${id}-${field}`}\n type=\"number\"\n step={field === 'width' || field === 'height' ? 0.1 : 1}\n disabled={lockNote(field) !== null}\n aria-invalid={draft.errors[field] ? true : false}\n aria-describedby={\n [lockNote(field), draft.errors[field] ? `${id}-error` : null]\n .filter(Boolean)\n .join(' ') || undefined\n }\n value={texts[field]}\n onChange={(e) => set(field, e.target.value)}\n />\n <span className=\"pptx-field__unit\">{unit}</span>\n </span>\n </label>\n );\n // The first error, with the name of its field.\n const bad = NUMBER_FIELDS.find((f) => draft.errors[f]);\n const error = bad\n ? t('imageProperties.fieldError', {\n field: t(FIELD_LABELS[bad]),\n message: translateKeyOrText(t, draft.errors[bad]!),\n })\n : draft.errors.form\n ? translateKeyOrText(t, draft.errors.form)\n : null;\n return (\n <DialogFrame\n kind=\"imageProperties\"\n label={t('imageProperties.title')}\n className={className}\n style={style}\n onClose={onClose}\n onKeyDown={(event) => applyOnEnter(event, state.isEnabled, state.apply)}\n >\n <parts.Composition\n state={state}\n preset={preset}\n defaults={\n <>\n <div data-pptx-part=\"header\" className=\"pptx-dialog__header\">\n <h2 data-pptx-part=\"title\" className=\"pptx-dialog__title\">\n {t('imageProperties.title')}\n </h2>\n <ToolButton label={t('imageProperties.close')} icon=\"close\" onClick={onClose} />\n </div>\n <div data-pptx-part=\"body\" className=\"pptx-dialog__body\">\n <section\n data-pptx-part=\"field\"\n data-pptx-field=\"size\"\n className=\"pptx-dialog__section\"\n role=\"group\"\n aria-labelledby={`${id}-size`}\n >\n <h3 id={`${id}-size`} className=\"pptx-dialog__label\">\n {t('imageProperties.size')}\n </h3>\n {sizeLocked ? (\n <p id={`${id}-size-locked`} className=\"pptx-dialog__muted\">\n {t('disabled.sizeLocked')}\n </p>\n ) : null}\n <div className=\"pptx-panel__grid\">\n {number('height', t('imageProperties.height'), t('imageProperties.inches'))}\n {number('width', t('imageProperties.width'), t('imageProperties.inches'))}\n </div>\n <label className=\"pptx-radio\">\n <input\n type=\"checkbox\"\n checked={values.lockAspect}\n disabled={sizeLocked}\n aria-describedby={sizeLocked ? `${id}-size-locked` : undefined}\n onChange={(e) => draft.setValue('lockAspect', e.target.checked)}\n />\n {t('imageProperties.lockAspect')}\n </label>\n </section>\n <section\n data-pptx-part=\"field\"\n data-pptx-field=\"rotation\"\n className=\"pptx-dialog__section\"\n >\n {rotationLocked ? (\n <p id={`${id}-rotation-locked`} className=\"pptx-dialog__muted\">\n {t('disabled.rotationLocked')}\n </p>\n ) : null}\n <div className=\"pptx-panel__grid\">\n {number('rotation', t('imageProperties.rotation'), t('imageProperties.degrees'))}\n </div>\n </section>\n <section\n data-pptx-part=\"field\"\n data-pptx-field=\"crop\"\n className=\"pptx-dialog__section\"\n role=\"group\"\n aria-labelledby={`${id}-crop`}\n >\n <h3 id={`${id}-crop`} className=\"pptx-dialog__label\">\n {t('imageProperties.crop')}\n </h3>\n {cropLocked ? (\n <p id={`${id}-crop-locked`} className=\"pptx-dialog__muted\">\n {t('disabled.cropLocked')}\n </p>\n ) : null}\n <div className=\"pptx-panel__grid\">\n {number('cropLeft', t('imageProperties.cropLeft'), t('imageProperties.percent'))}\n {number('cropTop', t('imageProperties.cropTop'), t('imageProperties.percent'))}\n {number(\n 'cropRight',\n t('imageProperties.cropRight'),\n t('imageProperties.percent')\n )}\n {number(\n 'cropBottom',\n t('imageProperties.cropBottom'),\n t('imageProperties.percent')\n )}\n </div>\n </section>\n </div>\n <div data-pptx-part=\"footer\" className=\"pptx-dialog__footer\">\n <span\n id={`${id}-error`}\n data-pptx-part=\"error\"\n role=\"alert\"\n className=\"pptx-dialog__error\"\n >\n {error}\n </span>\n <button\n type=\"button\"\n data-pptx-part=\"cancel\"\n className=\"pptx-button\"\n onClick={state.cancel}\n >\n {t('dialog.cancel')}\n </button>\n <button\n type=\"button\"\n data-pptx-part=\"apply\"\n className=\"pptx-button pptx-button--primary\"\n disabled={!state.isEnabled}\n onClick={state.apply}\n >\n {t('dialog.ok')}\n </button>\n </div>\n </>\n }\n >\n {children}\n </parts.Composition>\n </DialogFrame>\n );\n}\n\n/**\n * Read the draft of the enclosing Format Picture dialog, for a host's own field inside it. It\n * does not open the dialog: `useEditorDialog('imageProperties').open()` does. @public\n */\nexport function useImagePropertiesDialog(): UseImagePropertiesDialogReturn {\n return parts.useState();\n}\n\n/**\n * Format Picture: size, rotation, and crop position of the selected picture, with replaceable\n * parts (`Header`, `Title`, `Body`, `Footer`, `Field`, `Error`, `Apply`, `Cancel`).\n *\n * @example\n * ```tsx\n * <PptxEditor.ImagePropertiesDialog {...props}>\n * <PptxEditor.ImagePropertiesDialog.Field name=\"rotation\" hidden />\n * </PptxEditor.ImagePropertiesDialog>\n * ```\n *\n * @public\n */\nexport const ImagePropertiesDialog = Object.assign(ImagePropertiesDialogRoot, {\n Header: parts.Header,\n Title: parts.Title,\n Body: parts.Body,\n Footer: parts.Footer,\n Field: parts.Field,\n Error: parts.Error,\n Apply: parts.Apply,\n Cancel: parts.Cancel,\n});\n","/** @jsxImportSource react */\n// The Page setup dialog (File → Page setup…): slide size, appearance, and fonts. The host owns\n// visibility (`open` / `onClose`), as with DOCX Editor's `PageSetupDialog`. Built on the dialog\n// parts (`dialog-parts.tsx`): every element is a named part a host can restyle, replace, or\n// hide, and the appearance choice is a draft that OK applies and Cancel discards.\n\nimport { useMemo, useState, type ReactNode } from 'react';\nimport {\n pageSetupSizeName,\n radioGroupStep,\n slideSizeInches,\n translateDialogErrors,\n} from '@pptx-editor.dev/core/editor';\nimport { ToolButton } from './chrome.tsx';\nimport { useEditorState, useTranslation } from './context.ts';\nimport {\n DialogFrame,\n applyOnEnter,\n createDialogParts,\n useCloseOnNewDocument,\n useDialogDraft,\n type DialogCustomizationProps,\n type UseDialogReturn,\n} from './dialog-parts.tsx';\n\n/**\n * The draft of the Page setup dialog. `theme` keeps the name of the dialog's `theme` and\n * `onThemeChange` props on `main`. @public\n */\nexport interface PageSetupDialogFields {\n /** The chrome theme the appearance choice shows. */\n readonly theme: 'light' | 'dark';\n}\n\n/** The Page setup draft and its actions. @public */\nexport type UsePageSetupDialogReturn = UseDialogReturn<PageSetupDialogFields>;\n\n/** The field names of the Page setup dialog, for `PageSetupDialog.Field`. @public */\nexport type PageSetupDialogFieldName = 'slideSize' | 'theme' | 'fonts' | 'substitutes';\n\n/** Props for `PptxEditor.PageSetupDialog`. @public */\nexport interface PageSetupDialogProps extends DialogCustomizationProps {\n /** Whether the dialog is shown. The host owns this state. */\n readonly open: boolean;\n /** Called on Cancel, Escape, a click on the backdrop, and after OK. */\n readonly onClose: () => void;\n /** The chrome theme; the appearance choice shows only with `onThemeChange`. */\n readonly theme?: 'light' | 'dark';\n /** Called by OK when the appearance choice changed. */\n readonly onThemeChange?: (theme: 'light' | 'dark') => void;\n}\n\nconst parts = createDialogParts<PageSetupDialogFieldName, UsePageSetupDialogReturn>(\n 'PageSetupDialog'\n);\nconst THEMES = ['light', 'dark'] as const;\n\nfunction PageSetupDialogRoot(props: PageSetupDialogProps): ReactNode {\n return props.open ? <PageSetupDialogOpen {...props} /> : null;\n}\n\nfunction PageSetupDialogOpen({\n onClose,\n theme = 'light',\n onThemeChange,\n className,\n style,\n preset = true,\n children,\n}: PageSetupDialogProps): ReactNode {\n const { t } = useTranslation();\n const width = useEditorState((s) => s.slideWidth);\n const height = useEditorState((s) => s.slideHeight);\n const embedded = useEditorState((s) => s.embeddedFontFaces);\n const substituted = useEditorState((s) => s.substitutedFonts);\n // OK reports a change from the opening choice only, as the Vue twin: a host theme change\n // while the dialog is open is not reverted by an untouched OK.\n const [opening] = useState(theme);\n const draft = useDialogDraft<PageSetupDialogFields>(() => ({\n initial: { theme: opening },\n commit: (values) => {\n if (values.theme !== opening) onThemeChange?.(values.theme);\n return { ok: true };\n },\n }));\n const translatedErrors = useMemo(() => translateDialogErrors(t, draft.errors), [t, draft.errors]);\n const state: UsePageSetupDialogReturn = {\n values: draft.values,\n setValue: draft.setValue,\n errors: translatedErrors,\n isEnabled: true,\n apply: () => {\n if (draft.apply()) onClose();\n },\n cancel: onClose,\n };\n const size = slideSizeInches(width, height);\n useCloseOnNewDocument(onClose);\n return (\n <DialogFrame\n kind=\"pageSetup\"\n label={t('pageSetup.title')}\n className={className}\n style={style}\n onClose={onClose}\n onKeyDown={(event) => applyOnEnter(event, state.isEnabled, state.apply)}\n >\n <parts.Composition\n state={state}\n preset={preset}\n defaults={\n <>\n <div data-pptx-part=\"header\" className=\"pptx-dialog__header\">\n <h2 data-pptx-part=\"title\" className=\"pptx-dialog__title\">\n {t('pageSetup.title')}\n </h2>\n <ToolButton label={t('pageSetup.close')} icon=\"close\" onClick={onClose} />\n </div>\n <div data-pptx-part=\"body\" className=\"pptx-dialog__body\">\n <section\n data-pptx-part=\"field\"\n data-pptx-field=\"slideSize\"\n className=\"pptx-dialog__section\"\n >\n <h3 className=\"pptx-dialog__label\">{t('pageSetup.slideSize')}</h3>\n <p className=\"pptx-dialog__value\">\n {t(`pageSetup.slideSizeName.${pageSetupSizeName(width, height)}`)}\n <span className=\"pptx-dialog__muted\">{t('pageSetup.slideSizeValue', size)}</span>\n </p>\n </section>\n {onThemeChange ? (\n <section\n data-pptx-part=\"field\"\n data-pptx-field=\"theme\"\n className=\"pptx-dialog__section\"\n >\n <h3 className=\"pptx-dialog__label\">{t('pageSetup.appearance')}</h3>\n <div\n className=\"pptx-segmented\"\n role=\"radiogroup\"\n aria-label={t('pageSetup.appearance')}\n onKeyDown={(event) => {\n const next = radioGroupStep(THEMES, draft.values.theme, event.key);\n if (!next) return;\n event.preventDefault();\n draft.setValue('theme', next);\n event.currentTarget\n .querySelector<HTMLElement>(`[data-value=\"${next}\"]`)\n ?.focus();\n }}\n >\n {THEMES.map((m) => (\n <button\n key={m}\n type=\"button\"\n role=\"radio\"\n data-value={m}\n aria-checked={draft.values.theme === m}\n tabIndex={draft.values.theme === m ? 0 : -1}\n onClick={() => draft.setValue('theme', m)}\n >\n {t(`pageSetup.${m}`)}\n </button>\n ))}\n </div>\n </section>\n ) : null}\n <section\n data-pptx-part=\"field\"\n data-pptx-field=\"fonts\"\n className=\"pptx-dialog__section\"\n >\n <h3 className=\"pptx-dialog__label\">{t('pageSetup.fonts')}</h3>\n <p className=\"pptx-dialog__value\">\n {embedded\n ? t('pageSetup.fontsEmbedded', { count: embedded })\n : t('pageSetup.fontsNone')}\n </p>\n {/* No substitutes: one line here, and no empty Substituted fonts section. */}\n {substituted.length === 0 ? (\n <p className=\"pptx-dialog__value\">{t('pageSetup.substitutesNone')}</p>\n ) : null}\n </section>\n {substituted.length > 0 ? (\n <section\n data-pptx-part=\"field\"\n data-pptx-field=\"substitutes\"\n className=\"pptx-dialog__section\"\n >\n <h3 className=\"pptx-dialog__label\">{t('pageSetup.substitutes')}</h3>\n <ul className=\"pptx-dialog__list\">\n {substituted.map((f) => (\n <li key={f.family}>\n {t('pageSetup.substitution', {\n family: f.family,\n substitute: f.substitute,\n })}\n {f.metricCompatible ? (\n <span className=\"pptx-chip pptx-chip--quiet\">\n {t('pageSetup.metricCompatible')}\n </span>\n ) : null}\n </li>\n ))}\n </ul>\n </section>\n ) : null}\n </div>\n <div data-pptx-part=\"footer\" className=\"pptx-dialog__footer\">\n <span data-pptx-part=\"error\" role=\"alert\" className=\"pptx-dialog__error\">\n {state.errors.form ?? null}\n </span>\n <button\n type=\"button\"\n data-pptx-part=\"cancel\"\n className=\"pptx-button\"\n onClick={state.cancel}\n >\n {t('dialog.cancel')}\n </button>\n <button\n type=\"button\"\n data-pptx-part=\"apply\"\n className=\"pptx-button pptx-button--primary\"\n disabled={!state.isEnabled}\n onClick={state.apply}\n >\n {t('dialog.ok')}\n </button>\n </div>\n </>\n }\n >\n {children}\n </parts.Composition>\n </DialogFrame>\n );\n}\n\n/**\n * Read the draft of the enclosing Page setup dialog, for a host's own field inside it. It does\n * not open the dialog: `useEditorDialog('pageSetup').open()` does. @public\n */\nexport function usePageSetupDialog(): UsePageSetupDialogReturn {\n return parts.useState();\n}\n\n/**\n * Page setup: slide size, appearance, and fonts, with replaceable parts (`Header`, `Title`,\n * `Body`, `Footer`, `Field`, `Error`, `Apply`, `Cancel`).\n *\n * @example\n * ```tsx\n * <PptxEditor.PageSetupDialog {...props}>\n * <PptxEditor.PageSetupDialog.Field name=\"substitutes\" hidden />\n * <PptxEditor.PageSetupDialog.Apply className=\"acme-primary\" />\n * </PptxEditor.PageSetupDialog>\n * ```\n *\n * @public\n */\nexport const PageSetupDialog = Object.assign(PageSetupDialogRoot, {\n Header: parts.Header,\n Title: parts.Title,\n Body: parts.Body,\n Footer: parts.Footer,\n Field: parts.Field,\n Error: parts.Error,\n Apply: parts.Apply,\n Cancel: parts.Cancel,\n});\n","/** @jsxImportSource react */\n// The Paragraph dialog (Format > Paragraph…, Line Spacing Options…, or the text context menu),\n// with alignment, indentation before text with a first-line or hanging indent,\n// spacing before and after, and line spacing. The fields seed from the selection when the dialog\n// opens; a field the selected paragraphs disagree about opens blank. OK sends only the fields\n// that changed as ONE `setParagraphFormat` command, so the dialog is one undo step (DOCX\n// Editor's `DocxEditorParagraphDialog` does the same). The form model is the engine's\n// (`paragraph-dialog-fields.ts`), so the Vue twin can share it. The host owns visibility.\n\nimport {\n formCommandRejection,\n lineAtFor,\n paragraphCommandOf,\n paragraphDialogError,\n paragraphFieldError,\n seedParagraphFields,\n specialByFor,\n withSpaceUnit,\n type LineRule,\n type ParagraphAlignment,\n type ParagraphDialogFields,\n type SpacingUnit,\n type SpecialIndent,\n} from '@pptx-editor.dev/core/editor';\nimport type { ReactNode } from 'react';\nimport { useEditorState, usePptxEditor, useTranslation } from './context.ts';\nimport {\n FormDialog,\n FormSection,\n NumberField,\n SelectField,\n fieldPart,\n formDialogState,\n useDialogDraft,\n type FormDialogParts,\n} from './dialog-form.tsx';\nimport {\n createDialogParts,\n type DialogCustomizationProps,\n type UseDialogReturn,\n} from './dialog-parts.tsx';\n\n/** Props for `PptxEditor.ParagraphDialog`. @public */\nexport interface ParagraphDialogProps extends DialogCustomizationProps {\n /** Whether the dialog is shown. The host owns this state. */\n readonly open: boolean;\n /** Called on Cancel, Escape, a click on the backdrop, and after OK applies. */\n readonly onClose: () => void;\n}\n\n/**\n * The field names of the Paragraph dialog, for `ParagraphDialog.Field`: a section (`general`,\n * `indentation`, `spacing`) or one field in it, named as its `ParagraphDialogFields` key. A\n * spacing field holds its unit list. @public\n */\nexport type ParagraphDialogFieldName =\n | 'general'\n | 'indentation'\n | 'spacing'\n | 'alignment'\n | 'indentLeft'\n | 'special'\n | 'specialBy'\n | 'spaceBefore'\n | 'spaceAfter'\n | 'lineRule'\n | 'lineAt';\n\n/** The Paragraph draft and its actions, for a host's own field inside the dialog. @public */\nexport type UseParagraphDialogReturn = UseDialogReturn<ParagraphDialogFields>;\n\nconst parts: FormDialogParts<ParagraphDialogFieldName, ParagraphDialogFields> = createDialogParts<\n ParagraphDialogFieldName,\n UseParagraphDialogReturn\n>('ParagraphDialog');\n\nconst ALIGNMENTS: readonly ParagraphAlignment[] = [\n 'left',\n 'center',\n 'right',\n 'justify',\n 'distributed',\n];\nconst SPECIALS: readonly SpecialIndent[] = ['none', 'firstLine', 'hanging'];\nconst LINE_RULES: readonly LineRule[] = ['single', 'onePointFive', 'double', 'exact', 'multiple'];\n\nfunction ParagraphDialogRoot({\n open,\n onClose,\n className,\n style,\n preset,\n children,\n}: ParagraphDialogProps): ReactNode {\n const { t } = useTranslation();\n const editor = usePptxEditor();\n const current = useEditorState((s) => s.format?.paragraph ?? null);\n const editable = useEditorState((s) => s.status === 'ready' && s.mode === 'edit');\n const { seed, draft, set, update, error, setError } = useDialogDraft(open, () =>\n seedParagraphFields(current)\n );\n const apply = (): void => {\n if (!draft || !seed) return;\n const problem = paragraphFieldError(seed, draft);\n if (problem) return setError(paragraphDialogError(t, problem));\n const command = paragraphCommandOf(seed, draft);\n if (!command) return onClose();\n const refused = formCommandRejection(\n t,\n editor?.exec({ type: 'setParagraphFormat', ...command })\n );\n if (refused === null) onClose();\n else setError({ message: refused });\n };\n const mixed = t('paragraphDialog.mixed');\n const inch = t('paragraphDialog.units.in');\n const choose = <K extends keyof ParagraphDialogFields>(k: K, v: ParagraphDialogFields[K]) =>\n set(k, v);\n const spacing = (side: 'Before' | 'After') => {\n if (!draft) return null;\n const key = `space${side}` as const;\n const unitKey = `space${side}Unit` as const;\n return (\n <div {...fieldPart(key)} className=\"pptx-field__pair\">\n <NumberField\n name={key}\n label={t(`paragraphDialog.fields.${key}`)}\n unit=\"\"\n step={draft[unitKey] === 'pt' ? '6' : '0.1'}\n min=\"0\"\n placeholder={seed?.[key] === '' ? mixed : undefined}\n value={draft[key]}\n onChange={(v) => set(key, v)}\n />\n <SelectField<SpacingUnit>\n name={unitKey}\n label={t('paragraphDialog.unitOf', { field: t(`paragraphDialog.fields.${key}`) })}\n hideLabel\n value={draft[unitKey]}\n options={(['pt', 'lines'] as const).map((u) => [u, t(`paragraphDialog.units.${u}`)])}\n onChange={(u) => seed && update((d) => withSpaceUnit(d, seed, key, u))}\n />\n </div>\n );\n };\n const state = formDialogState({\n draft,\n set,\n error,\n isEnabled: editable,\n onSubmit: apply,\n onClose,\n });\n return (\n <FormDialog\n name=\"paragraph\"\n className={className}\n style={style}\n preset={preset}\n parts={parts}\n state={state}\n hostChildren={children}\n title={t('paragraphDialog.title')}\n open={open}\n okLabel={t('paragraphDialog.ok')}\n cancelLabel={t('paragraphDialog.cancel')}\n closeLabel={t('paragraphDialog.close')}\n error={error}\n onClose={onClose}\n onSubmit={apply}\n >\n {draft ? (\n <>\n <FormSection {...fieldPart('general')} title={t('paragraphDialog.general')}>\n <SelectField\n {...fieldPart('alignment')}\n name=\"alignment\"\n label={t('paragraphDialog.fields.alignment')}\n mixed={mixed}\n value={draft.alignment}\n options={ALIGNMENTS.map((a) => [a, t(`paragraphDialog.align.${a}`)])}\n onChange={(v) => choose('alignment', v)}\n />\n </FormSection>\n <FormSection {...fieldPart('indentation')} title={t('paragraphDialog.indentation')}>\n <div className=\"pptx-dialog__grid\">\n <NumberField\n {...fieldPart('indentLeft')}\n name=\"indentLeft\"\n label={t('paragraphDialog.fields.indentLeft')}\n unit={inch}\n step=\"0.1\"\n min=\"0\"\n placeholder={seed?.indentLeft === '' ? mixed : undefined}\n value={draft.indentLeft}\n onChange={(v) => set('indentLeft', v)}\n />\n <SelectField\n {...fieldPart('special')}\n name=\"special\"\n label={t('paragraphDialog.fields.special')}\n mixed={mixed}\n value={draft.special}\n options={SPECIALS.map((s) => [s, t(`paragraphDialog.specials.${s}`)])}\n onChange={(v) => {\n set('special', v);\n set('specialBy', specialByFor(v, draft));\n }}\n />\n <NumberField\n {...fieldPart('specialBy')}\n name=\"specialBy\"\n label={t('paragraphDialog.fields.specialBy')}\n unit={inch}\n step=\"0.1\"\n min=\"0\"\n placeholder={seed?.specialBy === '' ? mixed : undefined}\n disabled={draft.special === 'none' || draft.special === ''}\n value={draft.specialBy}\n onChange={(v) => set('specialBy', v)}\n />\n </div>\n </FormSection>\n <FormSection {...fieldPart('spacing')} title={t('paragraphDialog.spacing')}>\n <div className=\"pptx-dialog__rows\">\n {spacing('Before')}\n {spacing('After')}\n <div className=\"pptx-field__pair\">\n <SelectField\n {...fieldPart('lineRule')}\n name=\"lineRule\"\n label={t('paragraphDialog.fields.lineRule')}\n mixed={mixed}\n value={draft.lineRule}\n options={LINE_RULES.map((r) => [r, t(`paragraphDialog.lineRules.${r}`)])}\n onChange={(rule) => {\n set('lineRule', rule);\n set('lineAt', lineAtFor(rule, draft));\n }}\n />\n <NumberField\n {...fieldPart('lineAt')}\n name=\"lineAt\"\n label={t('paragraphDialog.fields.lineAt')}\n unit={draft.lineRule === 'exact' ? t('paragraphDialog.units.pt') : ''}\n step={draft.lineRule === 'exact' ? '1' : '0.1'}\n min=\"0\"\n placeholder={seed?.lineAt === '' ? mixed : undefined}\n disabled={draft.lineRule !== 'exact' && draft.lineRule !== 'multiple'}\n value={draft.lineAt}\n onChange={(v) => set('lineAt', v)}\n />\n </div>\n </div>\n </FormSection>\n </>\n ) : null}\n </FormDialog>\n );\n}\n\n/**\n * Read the draft of the enclosing Paragraph dialog, for a host's own field inside it. It does\n * not open the dialog: `useEditorDialog('paragraph').open()` does. @public\n */\nexport function useParagraphDialog(): UseParagraphDialogReturn {\n return parts.useState();\n}\n\n/**\n * Format > Paragraph: alignment, indents, spacing, and line spacing of the selected paragraphs,\n * applied as one undo step, with replaceable parts (`Header`, `Title`, `Body`, `Footer`,\n * `Field`, `Error`, `Apply`, `Cancel`).\n *\n * @example\n * ```tsx\n * <PptxEditor.ParagraphDialog {...props}>\n * <PptxEditor.ParagraphDialog.Field name=\"indentation\" hidden />\n * </PptxEditor.ParagraphDialog>\n * ```\n *\n * @public\n */\nexport const ParagraphDialog = Object.assign(ParagraphDialogRoot, {\n Header: parts.Header,\n Title: parts.Title,\n Body: parts.Body,\n Footer: parts.Footer,\n Field: parts.Field,\n Error: parts.Error,\n Apply: parts.Apply,\n Cancel: parts.Cancel,\n});\n","/** @jsxImportSource react */\n// Shared parts of the form dialogs (Paragraph, Font, Bullets, and Columns): the modal frame with\n// OK and Cancel on the dialog named parts (`dialog-parts.tsx`), a draft that seeds once when the\n// dialog opens, and number, text, and select fields with a unit, a \"Mixed\" blank, and an error\n// state. Internal: each dialog exports its own parts.\n\nimport {\n useEffect,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactNode,\n} from 'react';\nimport {\n cssFontFamily,\n dialogErrorsOf,\n focusDialogInitialField,\n fieldPart as coreFieldPart,\n formPanelId,\n formTabId,\n formTabStep,\n markDialogError,\n type DialogError as CoreDialogError,\n} from '@pptx-editor.dev/core/editor';\nimport { ToolButton } from './chrome.tsx';\nimport { useEditorState, useTranslation } from './context.ts';\nimport {\n DialogFrame,\n applyOnEnter,\n type DialogParts,\n type UseDialogReturn,\n} from './dialog-parts.tsx';\n\n/** A problem the dialog shows: the message, and the field to mark and focus (by `name`). */\nexport type DialogError = CoreDialogError;\n\n/**\n * A draft of a dialog's fields. It seeds from `seedOf` when the dialog opens and never while it\n * is open, so a remote edit does not overwrite what the user types.\n */\nexport function useDialogDraft<D>(open: boolean, seedOf: () => D) {\n const seed = useRef<D | null>(null);\n const [draft, setDraft] = useState<D | null>(null);\n const [error, setError] = useState<DialogError | null>(null);\n const seedRef = useRef(seedOf);\n seedRef.current = seedOf;\n useEffect(() => {\n if (!open) {\n seed.current = null;\n setDraft(null);\n setError(null);\n return;\n }\n if (seed.current) return;\n seed.current = seedRef.current();\n setDraft(seed.current);\n }, [open]);\n const set = <K extends keyof D>(key: K, value: D[K]): void => {\n setDraft((d) => (d ? { ...d, [key]: value } : d));\n setError(null);\n };\n /** Change several fields at once (a pair of controls over one value). */\n const update = (change: (d: D) => D): void => {\n setDraft((d) => (d ? change(d) : d));\n setError(null);\n };\n return { seed: seed.current, draft, set, update, error, setError };\n}\n\n/** The named parts a form dialog exposes: `createDialogParts` over its draft. */\nexport type FormDialogParts<Name extends string, D extends object> = DialogParts<\n Name,\n UseDialogReturn<D>\n>;\n\n/**\n * The draft and actions a form dialog hands to its parts (`useParagraphDialog()` and the\n * like), in the shape of DOCX Editor's `UseDialogReturn`.\n */\nexport function formDialogState<D extends object>(args: {\n readonly draft: D | null;\n readonly set: <K extends keyof D>(key: K, value: D[K]) => void;\n readonly error: DialogError | null;\n readonly isEnabled: boolean;\n readonly onSubmit: () => void;\n readonly onClose: () => void;\n}): UseDialogReturn<D> | null {\n const { draft, error } = args;\n if (!draft) return null;\n const errors = dialogErrorsOf(error);\n return {\n values: draft,\n setValue: args.set,\n errors: errors as UseDialogReturn<D>['errors'],\n isEnabled: args.isEnabled,\n apply: args.onSubmit,\n cancel: args.onClose,\n };\n}\n\n/**\n * The modal frame of a form dialog on the dialog named parts (`dialog-parts.tsx`): `Header`,\n * `Title`, `Body`, `Footer`, `Field` (each section with a `name`), `Error`, `Apply`, and\n * `Cancel`, each replaceable by a host child, as in DOCX Editor. The frame is main's\n * `DialogFrame`: modal, Escape and backdrop close, Tab trap, focus return.\n */\nexport function FormDialog<Name extends string, D extends object>(props: {\n /** `data-pptx-dialog`: the registry key. */\n readonly name: string;\n /** A host class, after `pptx-dialog`. */\n readonly className?: string | undefined;\n readonly style?: CSSProperties | undefined;\n readonly title: string;\n readonly open: boolean;\n readonly okLabel: string;\n readonly cancelLabel: string;\n /** The accessible name of the header's close button. */\n readonly closeLabel: string;\n readonly error: DialogError | null;\n readonly onClose: () => void;\n readonly onSubmit: () => void;\n /** The dialog's parts, and the draft they read; null until the draft has seeded. */\n readonly parts: FormDialogParts<Name, D>;\n readonly state: UseDialogReturn<D> | null;\n /** `false`: only the host's children (`preset` of `DialogCustomizationProps`). */\n readonly preset?: boolean | undefined;\n /** The host's named parts and extra content. */\n readonly hostChildren?: ReactNode;\n /** The dialog's fields: `FormSection`s, each a `Field` part when it has a `name`. */\n readonly children: ReactNode;\n}) {\n const anchorRef = useRef<HTMLSpanElement>(null);\n const errorId = useId();\n const { t } = useTranslation();\n const viewing = useEditorState((s) => s.mode === 'view');\n const { open, onClose, error, state } = props;\n const ready = state !== null;\n // Mark the field the error names, tie it to the message, and move focus there. The dialog\n // carries `data-invalid` while an error shows, for host styles.\n useEffect(() => {\n markDialogError(anchorRef.current?.closest('dialog'), error, errorId);\n }, [error, errorId, ready]);\n // The fields mount after the draft seeds, after the frame focused its (empty) panel: focus the\n // first field then, unless a field took focus itself.\n useEffect(() => {\n const dialog = anchorRef.current?.closest('dialog');\n if (ready && dialog) focusDialogInitialField(dialog);\n }, [ready]);\n if (!open) return null;\n const { parts } = props;\n return (\n <DialogFrame\n kind={props.name}\n label={props.title}\n className={props.className}\n style={props.style}\n onClose={onClose}\n onKeyDown={(event) => applyOnEnter(event, state?.isEnabled ?? false, props.onSubmit)}\n >\n <span ref={anchorRef} hidden />\n {state ? (\n <parts.Composition\n state={state}\n preset={props.preset ?? true}\n defaults={\n <>\n <div data-pptx-part=\"header\" className=\"pptx-dialog__header\">\n <h2 data-pptx-part=\"title\" className=\"pptx-dialog__title\">\n {props.title}\n </h2>\n <ToolButton label={props.closeLabel} icon=\"close\" onClick={onClose} />\n </div>\n <div data-pptx-part=\"body\" className=\"pptx-dialog__body\">\n {props.children}\n </div>\n <div data-pptx-part=\"footer\" className=\"pptx-dialog__footer\">\n <span\n id={errorId}\n data-pptx-part=\"error\"\n role=\"alert\"\n className=\"pptx-dialog__error\"\n >\n {error?.message ?? null}\n </span>\n <button\n type=\"button\"\n data-pptx-part=\"cancel\"\n className=\"pptx-button\"\n onClick={onClose}\n >\n {props.cancelLabel}\n </button>\n <button\n type=\"button\"\n data-pptx-part=\"apply\"\n className=\"pptx-button pptx-button--primary\"\n disabled={!state.isEnabled}\n // A disabled OK says why, as every disabled control does.\n title={\n state.isEnabled\n ? undefined\n : t(viewing ? 'disabled.viewing' : 'disabled.noEditor')\n }\n onClick={props.onSubmit}\n >\n {props.okLabel}\n </button>\n </div>\n </>\n }\n >\n {props.hostChildren}\n </parts.Composition>\n ) : null}\n </DialogFrame>\n );\n}\n\n/**\n * The markers that make a `FormSection` or one field (`NumberField`, `SelectField`) the\n * dialog's `Field` part of `name`. They go on the element itself, where the dialog parts find\n * them. A section and each field in it are parts, as DOCX Editor names a part per field.\n */\nexport const fieldPart = coreFieldPart;\n\n/**\n * A titled group of fields: a fieldset with its legend. With `fieldPart(name)`, it is the\n * dialog's `Field` part of that name: a host part adds its class, style, and attributes here.\n */\nexport function FormSection({\n title,\n children,\n className,\n style,\n ...rest\n}: {\n readonly title: string;\n readonly children: ReactNode;\n readonly className?: string;\n readonly style?: CSSProperties;\n readonly [attribute: `data-${string}`]: unknown;\n}) {\n return (\n <fieldset\n {...rest}\n className={['pptx-dialog__section', className].filter(Boolean).join(' ')}\n style={style}\n >\n <legend className=\"pptx-dialog__label\">{title}</legend>\n {children}\n </fieldset>\n );\n}\n\n/**\n * What a field's `Field` part adds to its outer element: a class, a style, an id, a title, and\n * `data-*` and `aria-*` attributes.\n */\ninterface FieldPartAttributes {\n readonly className?: string;\n readonly style?: CSSProperties;\n readonly id?: string;\n readonly title?: string;\n readonly [attribute: `data-${string}`]: unknown;\n readonly [attribute: `aria-${string}`]: unknown;\n}\n\n/** The part attributes of a field's props, for its outer element. */\nfunction partAttributes(props: object): FieldPartAttributes {\n const out: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(props))\n if (\n key.startsWith('data-') ||\n key.startsWith('aria-') ||\n key === 'style' ||\n key === 'id' ||\n key === 'title'\n )\n out[key] = value;\n return out;\n}\n\n/**\n * Mark a field component as a dialog control: its `Field` part has no single element to give\n * `asChild` to, so a host's own content replaces the whole field (see `dialog-parts.tsx`).\n */\nexport function dialogControl<T extends object>(component: T): T {\n return Object.assign(component, { dialogControl: true });\n}\n\nconst fieldClass = (base: string, props: FieldPartAttributes): string =>\n [base, props.className].filter(Boolean).join(' ');\n\n/** A number field with its unit inside the box. An empty value shows `placeholder`. */\nexport function NumberField(\n props: FieldPartAttributes & {\n name: string;\n label: string;\n unit: string;\n step: string;\n min?: string;\n max?: string;\n value: string;\n placeholder?: string;\n disabled?: boolean;\n autoFocus?: boolean;\n onChange: (value: string) => void;\n }\n) {\n return (\n <label {...partAttributes(props)} className={fieldClass('pptx-field', props)}>\n {props.label}\n {props.unit ? <span className=\"pptx-visually-hidden\"> ({props.unit})</span> : null}\n <span className=\"pptx-field__control\">\n <input\n name={props.name}\n type=\"number\"\n inputMode=\"decimal\"\n step={props.step}\n min={props.min}\n max={props.max}\n // A disabled field shows no number and no placeholder.\n placeholder={props.disabled ? undefined : props.placeholder}\n disabled={props.disabled}\n autoFocus={props.autoFocus}\n value={props.disabled ? '' : props.value}\n onChange={(e) => props.onChange(e.target.value)}\n />\n {props.unit ? (\n <span className=\"pptx-field__unit\" aria-hidden=\"true\">\n {props.unit}\n </span>\n ) : null}\n </span>\n </label>\n );\n}\n\n/** A one-line text field with its label. */\nexport function TextField(\n props: FieldPartAttributes & {\n name: string;\n label: string;\n value: string;\n disabled?: boolean;\n /** Show the text in this font (a bullet character in its bullet font). */\n font?: string;\n /**\n * What the text shows as, inside the box at its end: a symbol font's character as its\n * Unicode twin, which reads the same where the symbol font is not installed.\n */\n preview?: string;\n onChange: (value: string) => void;\n }\n) {\n return (\n <label {...partAttributes(props)} className={fieldClass('pptx-field', props)}>\n {props.label}\n <span className=\"pptx-field__control\">\n <input\n name={props.name}\n type=\"text\"\n spellCheck={false}\n disabled={props.disabled}\n value={props.value}\n style={props.font ? { fontFamily: cssFontFamily(props.font) } : undefined}\n onChange={(e) => props.onChange(e.target.value)}\n />\n {props.preview && !props.disabled ? (\n <span className=\"pptx-field__unit\" aria-hidden=\"true\" data-preview=\"\">\n {props.preview}\n </span>\n ) : null}\n </span>\n </label>\n );\n}\n\n/**\n * A select with its label. `options` are value and label pairs. With `mixed`, an empty value\n * shows as that label (the selection disagrees and nothing is chosen yet).\n */\nexport function SelectField<V extends string>(\n props: FieldPartAttributes & {\n name: string;\n label: string;\n /** Keep the label for screen readers only (a unit list beside its number). */\n hideLabel?: boolean;\n value: V | '';\n options: readonly (readonly [V, string])[];\n mixed?: string;\n disabled?: boolean;\n autoFocus?: boolean;\n onChange: (value: V) => void;\n }\n) {\n return (\n <label {...partAttributes(props)} className={fieldClass('pptx-field', props)}>\n {props.hideLabel ? <span className=\"pptx-visually-hidden\">{props.label}</span> : props.label}\n <select\n name={props.name}\n value={props.value}\n disabled={props.disabled}\n autoFocus={props.autoFocus}\n onChange={(e) => props.onChange(e.target.value as V)}\n >\n {props.value === '' && props.mixed !== undefined ? (\n <option value=\"\" disabled>\n {props.mixed}\n </option>\n ) : null}\n {props.options.map(([value, label]) => (\n <option key={value} value={value}>\n {label}\n </option>\n ))}\n </select>\n </label>\n );\n}\n\n/**\n * The tabs of a form dialog, with the ARIA tabs pattern: a labelled tab list, one tab in the Tab\n * order, the arrow keys, Home, and End to move, and each tab tied to its panel.\n */\nexport function FormTabs<T extends string>(props: {\n readonly label: string;\n /** Prefix for the tab and panel ids (`useId()`). */\n readonly idBase: string;\n readonly tabs: readonly (readonly [T, string])[];\n readonly value: T;\n readonly onChange: (tab: T) => void;\n}) {\n const ids = props.tabs.map(([id]) => id);\n const move = (e: ReactKeyboardEvent<HTMLDivElement>): void => {\n const next = formTabStep(e.key, ids.indexOf(props.value), ids.length);\n if (next < 0) return;\n e.preventDefault();\n const tab = ids[next]!;\n props.onChange(tab);\n e.currentTarget.querySelector<HTMLElement>(`[data-tab=\"${tab}\"]`)?.focus();\n };\n return (\n <div className=\"pptx-segmented\" role=\"tablist\" aria-label={props.label} onKeyDown={move}>\n {props.tabs.map(([id, label]) => (\n <button\n key={id}\n id={tabId(props.idBase, id)}\n type=\"button\"\n role=\"tab\"\n aria-selected={props.value === id}\n aria-controls={panelId(props.idBase, id)}\n tabIndex={props.value === id ? 0 : -1}\n data-tab={id}\n onClick={() => props.onChange(id)}\n >\n {label}\n </button>\n ))}\n </div>\n );\n}\n\n/** The panel of the selected tab. */\nexport function FormTabPanel(props: {\n readonly idBase: string;\n readonly tab: string;\n /** A tab that is not shown: it keeps its space (`.pptx-dialog__panels`) but is hidden. */\n readonly inactive?: boolean;\n readonly children: ReactNode;\n}) {\n return (\n <div\n role=\"tabpanel\"\n id={panelId(props.idBase, props.tab)}\n aria-labelledby={tabId(props.idBase, props.tab)}\n className=\"pptx-dialog__rows\"\n {...(props.inactive ? { 'data-inactive': '', 'aria-hidden': true } : {})}\n >\n {props.children}\n </div>\n );\n}\n\nconst tabId = formTabId;\nconst panelId = formPanelId;\n\n/** A checkbox with a mixed state (the selected text disagrees), shown as indeterminate. */\nexport function CheckField(\n props: FieldPartAttributes & {\n readonly name: string;\n readonly label: string;\n readonly value: boolean | 'mixed';\n readonly onChange: (on: boolean) => void;\n }\n) {\n const ref = useRef<HTMLInputElement>(null);\n useEffect(() => {\n if (ref.current) ref.current.indeterminate = props.value === 'mixed';\n }, [props.value]);\n return (\n <label {...partAttributes(props)} className={fieldClass('pptx-radio', props)}>\n <input\n ref={ref}\n type=\"checkbox\"\n name={props.name}\n checked={props.value === true}\n onChange={(e) => props.onChange(e.target.checked)}\n />\n {props.label}\n </label>\n );\n}\n\ndialogControl(NumberField);\ndialogControl(SelectField);\ndialogControl(CheckField);\n","/** @jsxImportSource react */\n// The Font dialog (Format > Font…, the text context menu's Font…, or Character Spacing > More\n// Spacing…): the Font tab (Latin font, style, size; font color, underline\n// style and underline color; effects with the offset) and the Character Spacing tab (spacing\n// and kerning). The fields seed from the selected text when the dialog opens; a field the selected runs disagree about opens blank, and\n// a checkbox opens mixed. OK sends only the fields that changed as ONE `setFontFormat` command,\n// so the dialog is one undo step. The form model is the engine's (`font-dialog-fields.ts`), so\n// the Vue twin can share it. The host owns visibility (`open` / `onClose`).\n\nimport { useId, useState, type ReactNode } from 'react';\nimport {\n UNDERLINE_STYLES,\n fontCommandOf,\n fontDialogError,\n fontDialogFamilies,\n formCommandRejection,\n fontFieldError,\n seedFontFields,\n takeDialogSection,\n withExclusive,\n withScript,\n withSpacing,\n type FontDialogFields,\n type FontDialogTab,\n type FontStyleChoice,\n type SpacingChoice,\n} from '@pptx-editor.dev/core/editor';\nimport { useEditorState, usePptxEditor, useTranslation } from './context.ts';\nimport { ColorField } from './dialog-color.tsx';\nimport {\n CheckField,\n FormDialog,\n FormSection,\n FormTabPanel,\n FormTabs,\n NumberField,\n SelectField,\n fieldPart,\n formDialogState,\n useDialogDraft,\n type FormDialogParts,\n} from './dialog-form.tsx';\nimport {\n createDialogParts,\n type DialogCustomizationProps,\n type UseDialogReturn,\n} from './dialog-parts.tsx';\n\n/** Props for `PptxEditor.FontDialog`. @public */\nexport interface FontDialogProps extends DialogCustomizationProps {\n /** Whether the dialog is shown. The host owns this state. */\n readonly open: boolean;\n /** Called on Cancel, Escape, a click on the backdrop, and after OK applies. */\n readonly onClose: () => void;\n}\n\n/**\n * The field names of the Font dialog, for `FontDialog.Field`: a section of the Font tab\n * (`allText`, `effects`) or one field, named as its `FontDialogFields` key, on either tab.\n * @public\n */\nexport type FontDialogFieldName =\n | 'allText'\n | 'effects'\n | 'fontFamily'\n | 'style'\n | 'size'\n | 'color'\n | 'underline'\n | 'underlineColor'\n | 'strike'\n | 'doubleStrike'\n | 'superscript'\n | 'offset'\n | 'subscript'\n | 'smallCaps'\n | 'allCaps'\n | 'spacing'\n | 'by'\n | 'kerning'\n | 'kerningAt';\n\n/** The Font draft and its actions, for a host's own field inside the dialog. @public */\nexport type UseFontDialogReturn = UseDialogReturn<FontDialogFields>;\n\nconst parts: FormDialogParts<FontDialogFieldName, FontDialogFields> = createDialogParts<\n FontDialogFieldName,\n UseFontDialogReturn\n>('FontDialog');\n\nconst STYLES: readonly FontStyleChoice[] = ['regular', 'italic', 'bold', 'boldItalic'];\nconst SPACINGS: readonly SpacingChoice[] = ['normal', 'expanded', 'condensed'];\n\nfunction FontDialogRoot({\n open,\n onClose,\n className,\n style,\n preset,\n children,\n}: FontDialogProps): ReactNode {\n const { t } = useTranslation();\n const editor = usePptxEditor();\n const idBase = useId();\n const current = useEditorState((s) => s.format?.font ?? null);\n const textColor = useEditorState((s) => s.format?.color ?? null);\n const editable = useEditorState((s) => s.status === 'ready' && s.mode === 'edit');\n const [tab, setTab] = useState<FontDialogTab>('font');\n const { seed, draft, set, update, error, setError } = useDialogDraft(open, () => {\n setTab(takeDialogSection(editor, 'font') === 'spacing' ? 'spacing' : 'font');\n return seedFontFields(current);\n });\n const apply = (): void => {\n if (!draft || !seed) return;\n const problem = fontFieldError(seed, draft);\n if (problem) {\n // Show the field's tab first, so the error can mark and focus the field.\n setTab(problem.tab);\n return setError(fontDialogError(t, problem));\n }\n const command = fontCommandOf(seed, draft);\n if (!command) return onClose();\n const refused = formCommandRejection(t, editor?.exec({ ...command, type: 'setFontFormat' }));\n if (refused === null) onClose();\n else setError({ message: refused });\n };\n const mixed = t('fontDialog.mixed');\n const pt = t('fontDialog.points');\n const families = draft ? fontDialogFamilies(draft.fontFamily, editor?.fontFamilies() ?? []) : [];\n const blank = (k: 'size' | 'offset' | 'by' | 'kerningAt') =>\n seed?.[k] === '' ? mixed : undefined;\n const state = formDialogState({\n draft,\n set,\n error,\n isEnabled: editable,\n onSubmit: apply,\n onClose,\n });\n return (\n <FormDialog\n name=\"font\"\n className={className}\n style={style}\n preset={preset}\n parts={parts}\n state={state}\n hostChildren={children}\n title={t('fontDialog.title')}\n open={open}\n okLabel={t('fontDialog.ok')}\n cancelLabel={t('fontDialog.cancel')}\n closeLabel={t('fontDialog.close')}\n error={error}\n onClose={onClose}\n onSubmit={apply}\n >\n {draft ? (\n <>\n <FormTabs\n label={t('fontDialog.title')}\n idBase={idBase}\n tabs={(['font', 'spacing'] as const).map((id) => [id, t(`fontDialog.tabs.${id}`)])}\n value={tab}\n onChange={(next) => (setTab(next), setError(null))}\n />\n {/* Both tabs share one cell, so the dialog keeps its size when the tab changes. */}\n <div className=\"pptx-dialog__panels\">\n <FormTabPanel idBase={idBase} tab=\"font\" inactive={tab !== 'font'}>\n <div className=\"pptx-dialog__grid\">\n <SelectField\n {...fieldPart('fontFamily')}\n name=\"fontFamily\"\n label={t('fontDialog.fields.fontFamily')}\n autoFocus\n mixed={mixed}\n value={draft.fontFamily}\n options={families.map((f) => [f, f])}\n onChange={(v) => set('fontFamily', v)}\n />\n <SelectField\n {...fieldPart('style')}\n name=\"style\"\n label={t('fontDialog.fields.style')}\n mixed={mixed}\n value={draft.style}\n options={STYLES.map((s) => [s, t(`fontDialog.styles.${s}`)])}\n onChange={(v) => set('style', v)}\n />\n <NumberField\n {...fieldPart('size')}\n name=\"size\"\n label={t('fontDialog.fields.size')}\n unit={pt}\n step=\"1\"\n min=\"1\"\n placeholder={blank('size')}\n value={draft.size}\n onChange={(v) => set('size', v)}\n />\n </div>\n <FormSection {...fieldPart('allText')} title={t('fontDialog.allText')}>\n <div className=\"pptx-dialog__grid\">\n <ColorField\n {...fieldPart('color')}\n name=\"color\"\n label={t('fontDialog.fields.color')}\n value={draft.color}\n seed={seed?.color}\n current={textColor}\n onChange={(v) => set('color', v)}\n />\n <SelectField\n {...fieldPart('underline')}\n name=\"underline\"\n label={t('fontDialog.fields.underline')}\n mixed={mixed}\n value={draft.underline}\n options={UNDERLINE_STYLES.map((u) => [u, t(`fontDialog.underlines.${u}`)])}\n onChange={(v) => set('underline', v)}\n />\n <ColorField\n {...fieldPart('underlineColor')}\n name=\"underlineColor\"\n label={t('fontDialog.fields.underlineColor')}\n value={draft.underline === 'none' ? 'auto' : draft.underlineColor}\n seed={seed?.underlineColor}\n disabled={draft.underline === 'none'}\n onChange={(v) => set('underlineColor', v)}\n />\n </div>\n </FormSection>\n <FormSection {...fieldPart('effects')} title={t('fontDialog.effects')}>\n {/* Two columns: the strike and script pairs, then the caps pair. */}\n <div className=\"pptx-dialog__columns\">\n <div className=\"pptx-dialog__rows\">\n <CheckField\n {...fieldPart('strike')}\n name=\"strike\"\n label={t('fontDialog.strikethrough')}\n value={draft.strike}\n onChange={(on) => update((d) => withExclusive(d, 'strike', on))}\n />\n <CheckField\n {...fieldPart('doubleStrike')}\n name=\"doubleStrike\"\n label={t('fontDialog.doubleStrikethrough')}\n value={draft.doubleStrike}\n onChange={(on) => update((d) => withExclusive(d, 'doubleStrike', on))}\n />\n <CheckField\n {...fieldPart('superscript')}\n name=\"superscript\"\n label={t('fontDialog.superscript')}\n value={draft.superscript}\n onChange={(on) => update((d) => withScript(d, 'superscript', on))}\n />\n <CheckField\n {...fieldPart('subscript')}\n name=\"subscript\"\n label={t('fontDialog.subscript')}\n value={draft.subscript}\n onChange={(on) => update((d) => withScript(d, 'subscript', on))}\n />\n {/* The offset of either script: after both checkboxes, not between them. */}\n <NumberField\n {...fieldPart('offset')}\n name=\"offset\"\n label={t('fontDialog.fields.offset')}\n unit={t('fontDialog.percent')}\n step=\"1\"\n min=\"0\"\n placeholder={blank('offset')}\n disabled={draft.superscript !== true && draft.subscript !== true}\n value={draft.offset}\n onChange={(v) => set('offset', v)}\n />\n </div>\n <div className=\"pptx-dialog__rows\">\n <CheckField\n {...fieldPart('smallCaps')}\n name=\"smallCaps\"\n label={t('fontDialog.smallCaps')}\n value={draft.smallCaps}\n onChange={(on) => update((d) => withExclusive(d, 'smallCaps', on))}\n />\n <CheckField\n {...fieldPart('allCaps')}\n name=\"allCaps\"\n label={t('fontDialog.allCaps')}\n value={draft.allCaps}\n onChange={(on) => update((d) => withExclusive(d, 'allCaps', on))}\n />\n </div>\n </div>\n </FormSection>\n </FormTabPanel>\n <FormTabPanel idBase={idBase} tab=\"spacing\" inactive={tab !== 'spacing'}>\n <div className=\"pptx-dialog__inline\">\n <SelectField\n {...fieldPart('spacing')}\n name=\"spacing\"\n label={t('fontDialog.fields.spacing')}\n autoFocus\n mixed={mixed}\n value={draft.spacing}\n options={SPACINGS.map((s) => [s, t(`fontDialog.spacings.${s}`)])}\n onChange={(v) => update((d) => withSpacing(d, v))}\n />\n <NumberField\n {...fieldPart('by')}\n name=\"by\"\n label={t('fontDialog.fields.by')}\n unit={pt}\n step=\"0.1\"\n min=\"0\"\n placeholder={blank('by')}\n disabled={draft.spacing === 'normal' || draft.spacing === ''}\n value={draft.by}\n onChange={(v) => set('by', v)}\n />\n </div>\n <div className=\"pptx-dialog__inline\">\n <CheckField\n {...fieldPart('kerning')}\n name=\"kerning\"\n label={t('fontDialog.kerning')}\n value={draft.kerning}\n onChange={(on) => set('kerning', on)}\n />\n <NumberField\n {...fieldPart('kerningAt')}\n name=\"kerningAt\"\n label={t('fontDialog.fields.kerningAt')}\n unit={pt}\n step=\"1\"\n placeholder={blank('kerningAt')}\n disabled={draft.kerning !== true}\n value={draft.kerningAt}\n onChange={(v) => set('kerningAt', v)}\n />\n </div>\n </FormTabPanel>\n </div>\n </>\n ) : null}\n </FormDialog>\n );\n}\n\n/**\n * Read the draft of the enclosing Font dialog, for a host's own field inside it. It does not\n * open the dialog: `useEditorDialog('font').open()` does. @public\n */\nexport function useFontDialog(): UseFontDialogReturn {\n return parts.useState();\n}\n\n/**\n * Format > Font: the font, style, size, underline, effects, character spacing, and kerning of\n * the selected text, applied as one undo step, with replaceable parts (`Header`, `Title`,\n * `Body`, `Footer`, `Field`, `Error`, `Apply`, `Cancel`).\n *\n * @public\n */\nexport const FontDialog = Object.assign(FontDialogRoot, {\n Header: parts.Header,\n Title: parts.Title,\n Body: parts.Body,\n Footer: parts.Footer,\n Field: parts.Field,\n Error: parts.Error,\n Apply: parts.Apply,\n Cancel: parts.Cancel,\n});\n","/** @jsxImportSource react */\n// The color field of the form dialogs (Font color, Underline color, the bullet color): a list of\n// the inherited color, \"no change\", and the theme colors, and beside it a swatch button that\n// shows the current color and opens the color grid (theme tints and shades, standard\n// colors). The picks and the color OK sends live in core (`color-fields.ts`).\n\nimport { useEffect, useRef, useState, type CSSProperties } from 'react';\nimport {\n colorChoiceOf,\n colorPickLabel,\n colorPickOf,\n colorPicks,\n renderedColorOf,\n type ColorPick,\n} from '@pptx-editor.dev/core/editor';\nimport { ColorSwatches } from './ColorSwatches.tsx';\nimport { useEditorState, useTranslation } from './context.ts';\nimport { SelectField, dialogControl } from './dialog-form.tsx';\n\n/** A color pick as the slide renders it, or null for the inherited color and no change. */\nfunction useRenderedColor(pick: ColorPick, current: string | null): string | null {\n const rows = useEditorState((s) => s.themeColors);\n return renderedColorOf(pick, rows, current);\n}\n\n/** A color field: the list of picks and the swatch grid beside it. */\nexport function ColorField(props: {\n readonly name: string;\n readonly label: string;\n readonly value: ColorPick;\n /** The value the field opened with: `keep` and `mixed` are offered only then. */\n readonly seed: ColorPick | undefined;\n /** The color the selection has now (`#RRGGBB`): the swatch of \"Current color\" shows it. */\n readonly current?: string | null;\n readonly disabled?: boolean;\n readonly onChange: (pick: ColorPick) => void;\n readonly className?: string;\n readonly style?: CSSProperties;\n readonly [attribute: `data-${string}`]: unknown;\n}) {\n const { t } = useTranslation();\n const [open, setOpen] = useState(false);\n const panel = useRef<HTMLDivElement>(null);\n const button = useRef<HTMLButtonElement>(null);\n const rendered = useRenderedColor(props.value, props.current ?? null);\n const labelOf = (p: ColorPick): string => colorPickLabel(t, p);\n // The grid closes on a pick, on Escape (which does not close the dialog), and on a press\n // outside it.\n useEffect(() => {\n if (!open) return;\n const away = (e: PointerEvent): void => {\n const target = e.target as Node;\n if (!panel.current?.contains(target) && !button.current?.contains(target)) setOpen(false);\n };\n document.addEventListener('pointerdown', away, true);\n panel.current?.querySelector<HTMLElement>('button')?.focus();\n return () => document.removeEventListener('pointerdown', away, true);\n }, [open]);\n const data = Object.fromEntries(Object.entries(props).filter(([k]) => k.startsWith('data-')));\n return (\n <div\n {...data}\n className={['pptx-color-field', props.className].filter(Boolean).join(' ')}\n style={props.style}\n >\n <SelectField\n name={props.name}\n label={props.label}\n disabled={props.disabled}\n value={props.value}\n options={colorPicks(props.seed, props.value).map((p) => [p, labelOf(p)] as const)}\n onChange={props.onChange}\n />\n <button\n ref={button}\n type=\"button\"\n className=\"pptx-swatch pptx-color-field__button\"\n aria-label={t('colors.moreColors', { field: props.label })}\n aria-haspopup=\"true\"\n aria-expanded={open}\n disabled={props.disabled}\n data-color={rendered ?? undefined}\n style={rendered ? { background: rendered } : undefined}\n onClick={() => setOpen((o) => !o)}\n />\n {open ? (\n <div\n ref={panel}\n role=\"group\"\n aria-label={t('colors.moreColors', { field: props.label })}\n className=\"pptx-color-field__panel\"\n onKeyDown={(e) => {\n if (e.key !== 'Escape') return;\n e.preventDefault();\n e.stopPropagation();\n setOpen(false);\n button.current?.focus();\n }}\n >\n <ColorSwatches\n menu={false}\n selected={colorChoiceOf(props.value)}\n onPick={(choice) => {\n props.onChange(colorPickOf(choice));\n setOpen(false);\n button.current?.focus();\n }}\n />\n </div>\n ) : null}\n </div>\n );\n}\n\ndialogControl(ColorField);\n","/** @jsxImportSource react */\n// The Bullets and Numbering dialog (Format > Bullets and Numbering…, or the last row of the\n// Bullets and Numbering galleries): a Bulleted and a Numbered tab with the\n// gallery, the size as a percentage of the text, the color, and the start number. OK sends one\n// `setBulletFormat` command with only what changed, so the dialog is one undo step and a size or\n// color change keeps each paragraph's own bullet. The Bulleted tab also takes any character in\n// any font, through a Customize… symbol picker. The form model is the engine's\n// (`bullets-dialog-fields.ts`), so the Vue twin can share it. The host owns visibility.\n\nimport { useId, useState, type ReactNode } from 'react';\nimport {\n bulletCommandOf,\n bulletFieldsEnabled,\n bulletFontOptions,\n bulletStyleOptions,\n bulletsDialogError,\n bulletsFieldError,\n customBulletPreview,\n BULLET_TEXT_FONT,\n bulletFontMixed,\n editBulletGlyph,\n formCommandRejection,\n pickBulletStyle,\n seedBulletFields,\n takeDialogSection,\n type BulletFormatRead,\n type BulletsDialogFields,\n type BulletsDialogTab,\n} from '@pptx-editor.dev/core/editor';\nimport { useEditorState, usePptxEditor, useTranslation } from './context.ts';\nimport { ColorField } from './dialog-color.tsx';\nimport {\n FormDialog,\n FormTabPanel,\n FormTabs,\n NumberField,\n SelectField,\n TextField,\n fieldPart,\n formDialogState,\n useDialogDraft,\n type FormDialogParts,\n} from './dialog-form.tsx';\nimport {\n createDialogParts,\n type DialogCustomizationProps,\n type UseDialogReturn,\n} from './dialog-parts.tsx';\n\n/** Props for `PptxEditor.BulletsAndNumberingDialog`. @public */\nexport interface BulletsAndNumberingDialogProps extends DialogCustomizationProps {\n /** Whether the dialog is shown. The host owns this state. */\n readonly open: boolean;\n /** Called on Cancel, Escape, a click on the backdrop, and after OK applies. */\n readonly onClose: () => void;\n}\n\n/**\n * The field names of the Bullets and Numbering dialog, for `BulletsAndNumberingDialog.Field`:\n * the fields of a whole tab (`bullet`, `number`), or one field, named as its input: `style`,\n * `char`, `font`, `sizePercent`, and `color` on the Bulleted tab; `numberStyle`, `numberSizePercent`,\n * `numberColor`, and `startAt` on the Numbered tab. @public\n */\nexport type BulletsAndNumberingDialogFieldName =\n | 'bullet'\n | 'number'\n | 'style'\n | 'char'\n | 'font'\n | 'sizePercent'\n | 'color'\n | 'numberStyle'\n | 'numberSizePercent'\n | 'numberColor'\n | 'startAt';\n\n/** The Bullets and Numbering draft and its actions, for a host's own field. @public */\nexport type UseBulletsAndNumberingDialogReturn = UseDialogReturn<BulletsDialogFields>;\n\nconst parts: FormDialogParts<BulletsAndNumberingDialogFieldName, BulletsDialogFields> =\n createDialogParts<BulletsAndNumberingDialogFieldName, UseBulletsAndNumberingDialogReturn>(\n 'BulletsAndNumberingDialog'\n );\n\nconst TABS = ['bullet', 'number'] as const satisfies readonly BulletsDialogTab[];\n\nfunction BulletsAndNumberingDialogRoot({\n open,\n onClose,\n className,\n style,\n preset,\n children,\n}: BulletsAndNumberingDialogProps): ReactNode {\n const { t } = useTranslation();\n const editor = usePptxEditor();\n const idBase = useId();\n // Undefined: the selected paragraphs differ; null: they have no list.\n const current = useEditorState((s) => s.format?.bulletFormat);\n const editable = useEditorState((s) => s.status === 'ready' && s.mode === 'edit');\n const [opened, setOpened] = useState<BulletFormatRead | null | undefined>(null);\n const { seed, draft, set, update, error, setError } = useDialogDraft(open, () => {\n setOpened(current);\n const tab = takeDialogSection(editor, 'bulletsAndNumbering');\n return seedBulletFields(current, tab === 'bullet' || tab === 'number' ? tab : undefined);\n });\n const apply = (): void => {\n if (!draft || !seed) return;\n const problem = bulletsFieldError(seed, draft);\n if (problem) return setError(bulletsDialogError(t, problem, draft.kind));\n const format = bulletCommandOf(seed, draft);\n if (format === undefined) return onClose();\n const refused = formCommandRejection(t, editor?.exec({ type: 'setBulletFormat', format }));\n if (refused === null) onClose();\n else setError({ message: refused });\n };\n const mixed = t('bulletsAndNumberingDialog.mixed');\n const styleOptions = (kind: BulletsDialogTab): (readonly [string, string])[] =>\n bulletStyleOptions(t, kind, seed, draft, opened);\n // The Font field: the text font, the bullet fonts, then the deck's and the host's families.\n // Paragraphs whose bullets differ show \"Mixed\" until the user picks a style, a character, or\n // a font.\n const fonts: (readonly [string, string])[] = draft\n ? bulletFontOptions(t, seed, editor?.fontFamilies() ?? [])\n : [];\n const fontMixed = !!draft && !!seed && bulletFontMixed(seed, draft);\n // While a tab's style is None, its size, color, and start are dimmed.\n const off = (kind: BulletsDialogTab): boolean =>\n !draft || !bulletFieldsEnabled({ ...draft, kind });\n const fields = (kind: BulletsDialogTab) =>\n draft ? (\n <div className=\"pptx-dialog__grid\" {...fieldPart(kind)}>\n <SelectField\n {...fieldPart(kind === 'bullet' ? 'style' : 'numberStyle')}\n name={kind === 'bullet' ? 'style' : 'numberStyle'}\n label={t('bulletsAndNumberingDialog.style')}\n autoFocus\n mixed={mixed}\n value={draft[kind]}\n options={styleOptions(kind)}\n onChange={(v) =>\n kind === 'bullet' ? update((d) => pickBulletStyle(d, v)) : set(kind, v)\n }\n />\n {kind === 'bullet' ? (\n <>\n <TextField\n {...fieldPart('char')}\n name=\"char\"\n label={t('bulletsAndNumberingDialog.character')}\n disabled={off(kind)}\n value={draft.char}\n font={draft.font}\n // A symbol font's character also shows as its Unicode twin.\n preview={\n draft.char && customBulletPreview(draft) !== draft.char\n ? customBulletPreview(draft)\n : undefined\n }\n onChange={(v) => update((d) => editBulletGlyph(d, 'char', v, seed ?? undefined))}\n />\n <SelectField\n {...fieldPart('font')}\n name=\"font\"\n label={t('bulletsAndNumberingDialog.font')}\n disabled={off(kind)}\n value={draft.font || (fontMixed ? '' : BULLET_TEXT_FONT)}\n mixed={fontMixed ? mixed : undefined}\n options={fonts}\n onChange={(v) =>\n update((d) =>\n editBulletGlyph(d, 'font', v === BULLET_TEXT_FONT ? '' : v, seed ?? undefined)\n )\n }\n />\n </>\n ) : null}\n <NumberField\n {...fieldPart(kind === 'bullet' ? 'sizePercent' : 'numberSizePercent')}\n name={kind === 'bullet' ? 'sizePercent' : 'numberSizePercent'}\n label={t('bulletsAndNumberingDialog.size')}\n unit={t('bulletsAndNumberingDialog.ofText')}\n step=\"5\"\n min=\"25\"\n max=\"400\"\n disabled={off(kind)}\n placeholder={seed?.sizePercent === '' ? mixed : undefined}\n value={draft.sizePercent}\n onChange={(v) => set('sizePercent', v)}\n />\n <ColorField\n {...fieldPart(kind === 'bullet' ? 'color' : 'numberColor')}\n name={kind === 'bullet' ? 'color' : 'numberColor'}\n label={t('bulletsAndNumberingDialog.color')}\n disabled={off(kind)}\n value={draft.color}\n seed={seed?.color}\n onChange={(v) => set('color', v)}\n />\n {kind === 'number' ? (\n <NumberField\n {...fieldPart('startAt')}\n name=\"startAt\"\n label={t('bulletsAndNumberingDialog.startAt')}\n unit=\"\"\n step=\"1\"\n min=\"1\"\n max=\"32767\"\n disabled={off(kind)}\n placeholder={seed?.startAt === '' ? mixed : undefined}\n value={draft.startAt}\n onChange={(v) => set('startAt', v)}\n />\n ) : null}\n </div>\n ) : null;\n const state = formDialogState({\n draft,\n set,\n error,\n isEnabled: editable,\n onSubmit: apply,\n onClose,\n });\n return (\n <FormDialog\n name=\"bulletsAndNumbering\"\n className={className}\n style={style}\n preset={preset}\n parts={parts}\n state={state}\n hostChildren={children}\n title={t('bulletsAndNumberingDialog.title')}\n open={open}\n okLabel={t('bulletsAndNumberingDialog.ok')}\n cancelLabel={t('bulletsAndNumberingDialog.cancel')}\n closeLabel={t('bulletsAndNumberingDialog.close')}\n error={error}\n onClose={onClose}\n onSubmit={apply}\n >\n {draft ? (\n <>\n <FormTabs\n label={t('bulletsAndNumberingDialog.title')}\n idBase={idBase}\n tabs={TABS.map((id) => [id, t(`bulletsAndNumberingDialog.tabs.${id}`)])}\n value={draft.kind}\n onChange={(kind) => (set('kind', kind), setError(null))}\n />\n {/* Both tabs share one cell, so the dialog keeps its size when the tab changes. */}\n <div className=\"pptx-dialog__panels\">\n {TABS.map((kind) => (\n <FormTabPanel key={kind} idBase={idBase} tab={kind} inactive={draft.kind !== kind}>\n {fields(kind)}\n </FormTabPanel>\n ))}\n </div>\n </>\n ) : null}\n </FormDialog>\n );\n}\n\n/**\n * Read the draft of the enclosing Bullets and Numbering dialog, for a host's own field inside\n * it. It does not open the dialog: `useEditorDialog('bulletsAndNumbering').open()` does.\n * @public\n */\nexport function useBulletsAndNumberingDialog(): UseBulletsAndNumberingDialogReturn {\n return parts.useState();\n}\n\n/**\n * Format > Bullets and Numbering: the bullet or numbering style, size, color, and start number\n * of the selected paragraphs, applied as one undo step, with replaceable parts (`Header`,\n * `Title`, `Body`, `Footer`, `Field`, `Error`, `Apply`, `Cancel`).\n *\n * @public\n */\nexport const BulletsAndNumberingDialog = Object.assign(BulletsAndNumberingDialogRoot, {\n Header: parts.Header,\n Title: parts.Title,\n Body: parts.Body,\n Footer: parts.Footer,\n Field: parts.Field,\n Error: parts.Error,\n Apply: parts.Apply,\n Cancel: parts.Cancel,\n});\n","/** @jsxImportSource react */\n// The Columns dialog (Home > Columns > More Columns…): the number of columns\n// and the spacing between them, in inches. OK sends one `setColumns` command, so the dialog is\n// one undo step. The form model is the engine's (`columns-dialog-fields.ts`), so the Vue twin\n// can share it. The host owns visibility (`open` / `onClose`).\n\nimport type { ReactNode } from 'react';\nimport {\n columnsCommandOf,\n columnsDialogError,\n formCommandRejection,\n columnsFieldError,\n seedColumnsFields,\n type ColumnsDialogFields,\n} from '@pptx-editor.dev/core/editor';\nimport { useEditorState, usePptxEditor, useTranslation } from './context.ts';\nimport {\n FormDialog,\n NumberField,\n fieldPart,\n formDialogState,\n useDialogDraft,\n type FormDialogParts,\n} from './dialog-form.tsx';\nimport {\n createDialogParts,\n type DialogCustomizationProps,\n type UseDialogReturn,\n} from './dialog-parts.tsx';\n\n/** Props for `PptxEditor.ColumnsDialog`. @public */\nexport interface ColumnsDialogProps extends DialogCustomizationProps {\n /** Whether the dialog is shown. The host owns this state. */\n readonly open: boolean;\n /** Called on Cancel, Escape, a click on the backdrop, and after OK applies. */\n readonly onClose: () => void;\n}\n\n/**\n * The field names of the Columns dialog, for `ColumnsDialog.Field`: both fields (`columns`), or\n * one of them, named as its `ColumnsDialogFields` key. @public\n */\nexport type ColumnsDialogFieldName = 'columns' | 'count' | 'spacing';\n\n/** The Columns draft and its actions, for a host's own field inside the dialog. @public */\nexport type UseColumnsDialogReturn = UseDialogReturn<ColumnsDialogFields>;\n\nconst parts: FormDialogParts<ColumnsDialogFieldName, ColumnsDialogFields> = createDialogParts<\n ColumnsDialogFieldName,\n UseColumnsDialogReturn\n>('ColumnsDialog');\n\nfunction ColumnsDialogRoot({\n open,\n onClose,\n className,\n style,\n preset,\n children,\n}: ColumnsDialogProps): ReactNode {\n const { t } = useTranslation();\n const editor = usePptxEditor();\n // Undefined when the selected shapes differ: the fields open blank.\n const current = useEditorState((s) => s.format?.columns);\n const editable = useEditorState((s) => s.status === 'ready' && s.mode === 'edit');\n const { seed, draft, set, error, setError } = useDialogDraft(open, () =>\n seedColumnsFields(current)\n );\n const apply = (): void => {\n if (!draft || !seed) return;\n const problem = columnsFieldError(seed, draft);\n if (problem) return setError(columnsDialogError(t, problem));\n const command = columnsCommandOf(seed, draft);\n if (!command) return onClose();\n const refused = formCommandRejection(t, editor?.exec(command));\n if (refused === null) onClose();\n else setError({ message: refused });\n };\n const state = formDialogState({\n draft,\n set,\n error,\n isEnabled: editable,\n onSubmit: apply,\n onClose,\n });\n return (\n <FormDialog\n name=\"columns\"\n className={className}\n style={style}\n preset={preset}\n parts={parts}\n state={state}\n hostChildren={children}\n title={t('columnsDialog.title')}\n open={open}\n okLabel={t('columnsDialog.ok')}\n cancelLabel={t('columnsDialog.cancel')}\n closeLabel={t('columnsDialog.close')}\n error={error}\n onClose={onClose}\n onSubmit={apply}\n >\n {draft ? (\n <div className=\"pptx-dialog__grid\" {...fieldPart('columns')}>\n <NumberField\n {...fieldPart('count')}\n name=\"count\"\n label={t('columnsDialog.number')}\n unit=\"\"\n step=\"1\"\n min=\"1\"\n max=\"16\"\n placeholder={seed?.count === '' ? t('columnsDialog.mixed') : undefined}\n autoFocus\n value={draft.count}\n onChange={(v) => set('count', v)}\n />\n <NumberField\n {...fieldPart('spacing')}\n name=\"spacing\"\n label={t('columnsDialog.spacing')}\n unit={t('columnsDialog.inches')}\n step=\"0.1\"\n min=\"0\"\n placeholder={seed?.spacing === '' ? t('columnsDialog.mixed') : undefined}\n value={draft.spacing}\n onChange={(v) => set('spacing', v)}\n />\n </div>\n ) : null}\n </FormDialog>\n );\n}\n\n/**\n * Read the draft of the enclosing Columns dialog, for a host's own field inside it. It does not\n * open the dialog: `useEditorDialog('columns').open()` does. @public\n */\nexport function useColumnsDialog(): UseColumnsDialogReturn {\n return parts.useState();\n}\n\n/**\n * Home > Columns > More Columns: the number of text columns of the selected shapes and the\n * spacing between them, applied as one undo step, with replaceable parts (`Header`, `Title`,\n * `Body`, `Footer`, `Field`, `Error`, `Apply`, `Cancel`).\n *\n * @public\n */\nexport const ColumnsDialog = Object.assign(ColumnsDialogRoot, {\n Header: parts.Header,\n Title: parts.Title,\n Body: parts.Body,\n Footer: parts.Footer,\n Field: parts.Field,\n Error: parts.Error,\n Apply: parts.Apply,\n Cancel: parts.Cancel,\n});\n","/** @jsxImportSource react */\n// Menu rows over chrome slots, shared by `PptxEditor.Menu` and `PptxEditor.ContextMenu`, after\n// DOCX Editor's `Menu.Item` and `ContextMenu.Slot` (docx-editor/packages/react/src/editor/menu/\n// parts.tsx). A row takes its label, icon, shortcut, enabled state, and action from the slot's\n// registry entry and core's row rules (`resolveChromeMenuRow`, `chromeRowState`,\n// `runChromeRow`), so a menu row and its toolbar twin cannot drift. A slot that collects a\n// value (Insert > Shape, Insert > Line, Insert > Table, New Slide, Layout) opens a submenu of its\n// choices.\n\nimport { createContext, useContext, type ReactNode } from 'react';\nimport {\n SHAPE_GALLERY,\n chromeControlForSlot,\n chromeRowState,\n menuEntryKey,\n menuRowCheck,\n resolveChromeMenuRow,\n runChromeRow,\n sameChromeCommandState,\n surfaceInputIn,\n tidySeparators,\n translateKeyOrText,\n warnMenuPart,\n type ChromeCommandState,\n type ChromeMenuEntry,\n type ChromeMenuItemEntry,\n type ChromeSlotId,\n type EditorSnapshot,\n} from '@pptx-editor.dev/core/editor';\nimport type { TranslationKey } from '@pptx-editor.dev/i18n';\nimport { MenuCloseContext, MenuRow, MenuSeparator, MenuSubmenu } from './ContextMenu.tsx';\nimport { useEditorState, usePptxEditor, useTranslation } from './context.ts';\nimport { useChromeActionHost } from './chrome-actions.tsx';\nimport { LineGlyph, ShapeGrid, ShapeIcon } from './ShapeControls.tsx';\nimport { LayoutGallery } from './SlideControls.tsx';\nimport { MenuTableGrid } from './TableControls.tsx';\n\nexport { MenuCloseContext };\n\n/** The close function of the enclosing menu, or a no-op. */\nexport function useMenuClose(): () => void {\n return useContext(MenuCloseContext) ?? noop;\n}\n\nfunction noop(): void {}\n\n/** The host overrides of one registry row. @internal */\nexport interface SlotRowOverrides {\n readonly labelKey?: string;\n readonly shortcutKey?: string;\n readonly className?: string;\n /** Icon content in place of the registry icon. */\n readonly icon?: ReactNode;\n}\n\n/** A row's state, re-read when the editor changes. */\nfunction useRowState(slot: ChromeSlotId, value: string | undefined): ChromeCommandState {\n const editor = usePptxEditor();\n // The host knows which `popups` entries are off: their rows show disabled with the reason.\n const host = useChromeActionHost();\n return useEditorState(\n (() => chromeRowState(editor, slot, value, host)) as unknown as (\n s: EditorSnapshot\n ) => ChromeCommandState,\n sameChromeCommandState as (a: ChromeCommandState, b: ChromeCommandState) => boolean\n );\n}\n\n/** The icon props of a row: exactly one of `icon`, `glyph`, or `paths`. */\ntype SlotRowIcon =\n | { readonly icon: ReactNode }\n | { readonly glyph: ReactNode }\n | { readonly paths: readonly string[] | null };\n\n/** What every row kind takes from its registry row and the host overrides. */\ntype SlotRowCommon = {\n readonly label: string;\n readonly disabled: boolean;\n readonly reason: string | null;\n readonly className?: string;\n} & SlotRowIcon;\n\n/**\n * The one icon rule for every row kind, so no kind drops the host's icon. The host's `icon`\n * wins; `MenuRow` and `MenuSubmenu` read a string as a Material Symbol name and an element as\n * icon content. Insert > Line has no registry icon: its rows draw a line, as its options do.\n */\nfunction slotRowIcon(\n entry: ChromeMenuItemEntry,\n paths: readonly string[] | null,\n override: ReactNode | undefined\n): SlotRowIcon {\n if (override !== undefined) return { icon: override };\n if (entry.slot === 'insert.line' && (entry.value !== undefined || paths === null))\n return { glyph: <LineGlyph value={entry.value ?? 'line'} /> };\n return { paths };\n}\n\n/** One registry row: a slot, or a slot with a value. @internal */\nexport function SlotMenuRow({\n entry,\n overrides,\n}: {\n entry: ChromeMenuItemEntry;\n overrides?: SlotRowOverrides;\n}): ReactNode {\n const { t } = useTranslation();\n const editor = usePptxEditor();\n const host = useChromeActionHost();\n const close = useMenuClose();\n const state = useRowState(entry.slot, entry.value);\n const row = resolveChromeMenuRow(entry);\n const control = chromeControlForSlot(entry.slot);\n if (!row || !control) {\n warnMenuPart('Menu.Item', 'unknownSlot', entry.slot);\n return null;\n }\n const label = overrides?.labelKey\n ? translateKeyOrText(t, overrides.labelKey)\n : translateKeyOrText(t, row.labelKey, row.labelParams);\n const shortcutKey = overrides?.shortcutKey ?? row.shortcutKey;\n const reason = state.disabledReason ? translateKeyOrText(t, state.disabledReason) : null;\n // Every row kind (plain, toggle, submenu, gallery, value option) draws the same icon.\n const common: SlotRowCommon = {\n label,\n disabled: !state.isEnabled,\n reason,\n ...slotRowIcon(entry, row.paths, overrides?.icon),\n ...(overrides?.className ? { className: overrides.className } : {}),\n };\n // A slot that collects a value opens its choices, unless the row names one.\n if (entry.value === undefined && control.state.kind === 'value' && !entry.direct) {\n if (entry.slot === 'slide.add' || entry.slot === 'slide.layout')\n return <LayoutSubmenu slot={entry.slot} {...common} />;\n // Insert > Shape cascades its shape grid. Quick Styles is a gallery with no menu form yet,\n // so its row falls through to the disabled \"pick in the toolbar\" row below.\n if (entry.slot === 'insert.shape') return <GallerySubmenu slot={entry.slot} {...common} />;\n // Insert > Table: the size grid, as DOCX Editor's `Menu.TableGrid`.\n if (control.shape === 'tableGrid')\n return (\n <MenuSubmenu {...common}>\n <MenuTableGrid slot={entry.slot} label={label} autoFocus onInserted={close} />\n </MenuSubmenu>\n );\n // Shape Effects: one submenu for each effect kind, as its toolbar menu has.\n if (control.optionGroups?.length && control.options?.length)\n return (\n <MenuSubmenu {...common}>\n {control.optionGroups.map((group) => (\n <MenuSubmenu key={group.id} label={t(group.labelKey)}>\n {control\n .options!.filter((o) => o.group === group.id)\n .map((o) => (\n <SlotMenuRow\n key={o.value}\n entry={{ kind: 'item', slot: entry.slot, value: o.value }}\n />\n ))}\n </MenuSubmenu>\n ))}\n </MenuSubmenu>\n );\n if (control.options?.length)\n return (\n <MenuSubmenu {...common}>\n {control.options.map((o) => (\n <SlotMenuRow key={o.value} entry={{ kind: 'item', slot: entry.slot, value: o.value }} />\n ))}\n </MenuSubmenu>\n );\n // A picker with no menu form (a color, a font, a size) cannot run from a row.\n if (entry.slot !== 'text.link') {\n warnMenuPart('Menu.Item', 'valueRow', entry.slot);\n return <MenuRow {...common} disabled reason={t('menu.pickInToolbar')} slot={row.key} />;\n }\n }\n // A View setting (Smart guides) is a check row; a formatting toggle (Bold) shows as active,\n // as in a Format menu; an option of a choice slot is checked when in force.\n // A two-state row (Bold, Ruler) is a checkbox row and a choice row (View > Normal, a Shadow\n // preset) a radio row: `aria-checked` says whether it is on, as in DOCX Editor's menus.\n const { checked, radio } = menuRowCheck(row, control, state, entry.value);\n return (\n <MenuRow\n {...common}\n {...(shortcutKey ? { shortcut: translateKeyOrText(t, shortcutKey) } : {})}\n {...(checked !== undefined ? { checked } : {})}\n {...(radio ? { radio: true } : {})}\n slot={row.key}\n onSelect={() => {\n // A pointer press keeps the focus where it was (the slide's text input); a keyboard\n // user's focus is on the row, inside the editor scope. Either way the scope is found.\n const scope = document.activeElement?.closest('.pptx-editor') ?? null;\n close();\n runChromeRow(editor, host, entry.slot, entry.value, surfaceInputIn(scope));\n }}\n />\n );\n}\n\n/** Insert > Shape: one cascading grid per gallery category, drawn from the spec geometry. */\nfunction GallerySubmenu({ slot, ...common }: { slot: ChromeSlotId } & SlotRowCommon): ReactNode {\n const { t } = useTranslation();\n const editor = usePptxEditor();\n const host = useChromeActionHost();\n const close = useMenuClose();\n return (\n <MenuSubmenu {...common}>\n {SHAPE_GALLERY.map((category) => (\n <MenuSubmenu\n key={category.id}\n label={t(category.labelKey as TranslationKey)}\n glyph={<ShapeIcon preset={category.presets[0] ?? 'rect'} />}\n className=\"pptx-menu--shapes\"\n >\n <ShapeGrid\n presets={category.presets}\n onPick={(preset) => {\n close();\n runChromeRow(editor, host, slot, preset);\n }}\n />\n </MenuSubmenu>\n ))}\n </MenuSubmenu>\n );\n}\n\n/**\n * New Slide and Layout: the deck's layout gallery, each tile drawn by the engine. Layout marks\n * the current slide's layout.\n */\nfunction LayoutSubmenu({\n slot,\n ...common\n}: { slot: 'slide.add' | 'slide.layout' } & SlotRowCommon): ReactNode {\n const editor = usePptxEditor();\n const host = useChromeActionHost();\n const close = useMenuClose();\n const current = useEditorState((s) =>\n slot === 'slide.layout' ? (s.slides[s.currentSlide]?.layoutId ?? '') : ''\n );\n return (\n <MenuSubmenu {...common}>\n <LayoutGallery\n {...(slot === 'slide.layout' ? { value: current } : {})}\n onChange={(layoutId) => {\n close();\n runChromeRow(editor, host, slot, layoutId);\n }}\n />\n </MenuSubmenu>\n );\n}\n\n/** Render a list of registry entries, with host overrides by row key. @internal */\nexport function MenuEntries({\n entries,\n overrides,\n}: {\n entries: readonly ChromeMenuEntry[];\n /** Host rows that replace registry rows, by row key; `null` removes the row. */\n overrides?: ReadonlyMap<string, ReactNode | null>;\n}): ReactNode {\n const { t } = useTranslation();\n return entries.map((entry, i) => {\n if (entry.kind === 'separator') return <MenuSeparator key={`sep-${i}`} />;\n if (entry.kind === 'submenu')\n return (\n <MenuSubmenu key={entry.id} label={t(entry.labelKey)} paths={entry.paths}>\n <MenuEntries entries={entry.items} {...(overrides ? { overrides } : {})} />\n </MenuSubmenu>\n );\n const key = menuEntryKey(entry);\n if (overrides?.has(key))\n return (\n <RowDefaultsContext.Provider key={key} value={entry}>\n {overrides.get(key)}\n </RowDefaultsContext.Provider>\n );\n return <SlotMenuRow key={key} entry={entry} />;\n });\n}\n\n/**\n * The registry row a host row replaces in place: a `Menu.Item` there keeps the row's own label,\n * shortcut, and `direct` unless it sets its own. @internal\n */\nexport const RowDefaultsContext = createContext<ChromeMenuItemEntry | null>(null);\n\n/**\n * Drop separators a hidden row left behind: at the start, at the end, and two in a row. The rule\n * lives in core (`chrome-forms.ts`), so the Vue menus drop the same ones. @internal\n */\nexport { tidySeparators };\n","/** @jsxImportSource react */\n// The React side of core's `ChromeActionHost`: how a menu row or a toolbar control opens a\n// registry dialog, starts the slide show, opens the find bar or the link popup, and asks for a\n// picture. Core decides which of these a slot needs (`runChromeRow`); this module only connects\n// them to the adapter. `PptxEditor.Root` publishes one host and renders the link popup, as DOCX\n// Editor's root hosts its hyperlink dialog, so every opener works with no toolbar on the page.\n\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useState,\n useSyncExternalStore,\n type ReactNode,\n} from 'react';\nimport {\n SLOT_POPUP_KEYS,\n createHyperlinkPopupStore,\n focusSurfaceOf,\n hyperlinkEntryReads,\n linkPopupAnnouncement,\n listenLinkClicks,\n listenLinkPanelKey,\n linkPopupReturnsFocus,\n pickImageInto,\n requestLinkPopup,\n type ChromeActionHost,\n type ChromeSlotId,\n type HyperlinkPopupStore,\n} from '@pptx-editor.dev/core/editor';\nimport { ChromeActionHostContext, usePptxEditor, useSlideshow, useTranslation } from './context.ts';\nimport { requestFindBar } from './FindBar.tsx';\nimport { HyperLink, HyperlinkPopupContext as ControllerContext } from './HyperLink.tsx';\nimport { useDialogOpener, usePopupEntry, usePopups, type PptxEditorPopups } from './popups.tsx';\nimport {\n HyperlinkPopupContext,\n HyperlinkPopupViewsContext,\n useHyperlinkPopupBinding,\n} from './useHyperlinkPopup.ts';\n\n// Ask the `PptxEditor.Root` of an editor to open its link popup, as Ctrl/Cmd+K does. The\n// request and the anchor rules are core's (`overlays.ts`), shared with the Vue adapter.\nexport { requestLinkPopup };\n\n/** The reason key a `false` popups entry gives the slots it turns off. */\nconst OFF_REASONS: Readonly<Record<string, string>> = {\n hyperlink: 'link.unavailable',\n find: 'find.unavailable',\n pageSetup: 'dialog.unavailable',\n background: 'dialog.unavailable',\n imageAltText: 'dialog.unavailable',\n imageProperties: 'dialog.unavailable',\n paragraph: 'dialog.unavailable',\n font: 'dialog.unavailable',\n bulletsAndNumbering: 'dialog.unavailable',\n columns: 'dialog.unavailable',\n};\n\n/**\n * Why `slot` cannot run with these `popups`, or null. With `hyperlink: false`, a host panel\n * that reads `useHyperlinkPopup()` (`linkViews`) still opens for the link controls.\n */\nfunction popupReason(\n popups: PptxEditorPopups | undefined,\n slot: ChromeSlotId,\n dialog: string | undefined,\n linkViews: number\n): string | null {\n const key = dialog ?? SLOT_POPUP_KEYS[slot];\n if (!key || popups?.[key as keyof PptxEditorPopups] !== false) return null;\n if (key === 'hyperlink' && linkViews > 0) return null;\n return OFF_REASONS[key] ?? null;\n}\n\n/** How many find bars a root has mounted, so Find shows as disabled while there is none. */\nconst FindBarsContext = createContext<{\n readonly count: number;\n readonly register: () => () => void;\n} | null>(null);\n\n/** Count `PptxEditor.FindBar` in its root while it is mounted. @internal */\nexport function useRegisterFindBar(): void {\n const register = useContext(FindBarsContext)?.register;\n useEffect(() => register?.(), [register]);\n}\n\n/** The host this root's own contexts give, never an enclosing root's. */\nfunction useLocalChromeActionHost(findBars: number | null, linkViews = 0): ChromeActionHost {\n const editor = usePptxEditor();\n const openDialog = useDialogOpener();\n const show = useSlideshow();\n const popups = usePopups();\n return useMemo<ChromeActionHost>(\n () => ({\n openDialog,\n startSlideshow: (from) => show.start(from),\n openFind: (replace) => requestFindBar(editor, replace),\n openLink: () => requestLinkPopup(editor),\n pickImage: (target) => {\n if (editor) pickImageInto(editor, document, target);\n },\n unavailable: (slot, dialog) =>\n popupReason(popups, slot, dialog, linkViews) ??\n // Find shows its matches on the slide canvas, which the slide sorter does not show.\n (SLOT_POPUP_KEYS[slot] === 'find' && editor?.snapshot().presentationView === 'slideSorter'\n ? 'disabled.findSorter'\n : null) ??\n // Find needs a find bar to open: nothing answers the request without one.\n (findBars === 0 && SLOT_POPUP_KEYS[slot] === 'find' ? 'find.noBar' : null),\n }),\n [editor, openDialog, show, popups, findBars, linkViews]\n );\n}\n\n/** The adapter actions behind dialog, clipboard, show, find, link, and picture slots. */\nexport function useChromeActionHost(): ChromeActionHost {\n const published = useContext(ChromeActionHostContext);\n const local = useLocalChromeActionHost(null);\n return published ?? local;\n}\n\n/**\n * Publishes the root's action host, so `useEditorCommand` runs adapter slots. A root inside\n * another root publishes its own host. @internal\n */\nexport function ChromeActionHostProvider({ children }: { children?: ReactNode }) {\n const [findBars, setFindBars] = useState(0);\n const finds = useMemo(\n () => ({\n count: findBars,\n register: () => {\n setFindBars((n) => n + 1);\n return () => setFindBars((n) => n - 1);\n },\n }),\n [findBars]\n );\n // The root's one link popup state, which the packaged popup and `useHyperlinkPopup` share.\n const [linkStore] = useState(createHyperlinkPopupStore);\n const [linkViews, setLinkViews] = useState(0);\n const attachLinkView = useCallback(() => {\n setLinkViews((n) => n + 1);\n let attached = true;\n return () => {\n if (!attached) return;\n attached = false;\n setLinkViews((n) => n - 1);\n };\n }, []);\n const host = useLocalChromeActionHost(findBars, linkViews);\n return (\n <FindBarsContext.Provider value={finds}>\n <ChromeActionHostContext.Provider value={host}>\n <HyperlinkPopupContext.Provider value={linkStore}>\n <HyperlinkPopupViewsContext.Provider value={attachLinkView}>\n <LinkPopupBridge store={linkStore}>\n {children}\n <LinkPopupHost store={linkStore} views={linkViews} />\n </LinkPopupBridge>\n </HyperlinkPopupViewsContext.Provider>\n </HyperlinkPopupContext.Provider>\n </ChromeActionHostContext.Provider>\n </FindBarsContext.Provider>\n );\n}\n\n/** Publish the current controller to the compound parts and host-rendered children. */\nfunction LinkPopupBridge({ store, children }: { store: HyperlinkPopupStore; children: ReactNode }) {\n const state = useSyncExternalStore(store.subscribe, store.getState, store.getState);\n const errorId = useId();\n const controller = store.controller();\n return (\n <ControllerContext.Provider value={controller ? { controller, state, errorId } : null}>\n {children}\n </ControllerContext.Provider>\n );\n}\n\n/** The root's shared popup, including reading gestures and accessible announcements. */\nfunction LinkPopupHost({ store, views }: { store: HyperlinkPopupStore; views: number }): ReactNode {\n const editor = usePptxEditor();\n const entry = usePopupEntry('hyperlink');\n const { t } = useTranslation();\n useHyperlinkPopupBinding(store, true);\n const state = useSyncExternalStore(store.subscribe, store.getState, store.getState);\n const controller = store.controller();\n const off = entry === false;\n const reads = hyperlinkEntryReads(entry);\n useEffect(() => {\n if (off || !reads || !editor || !controller) return;\n const stopClicks = listenLinkClicks(editor, (at) => controller.openReading(at));\n const stopKey = listenLinkPanelKey(editor, () => controller.getState().mode === 'reading');\n return () => {\n stopClicks();\n stopKey();\n };\n }, [editor, controller, off, reads]);\n useEffect(() => {\n if (off && views === 0) store.close();\n }, [off, views, store]);\n // Check focus synchronously while the closing panel is still mounted.\n useEffect(() => {\n if (!controller || !editor) return;\n let open = controller.getState().mode !== 'closed';\n return controller.subscribe(() => {\n const now = controller.getState().mode !== 'closed';\n if (open && !now && linkPopupReturnsFocus(editor)) focusSurfaceOf(editor);\n open = now;\n });\n }, [controller, editor]);\n if (!controller) return null;\n let content: ReactNode = null;\n if (state.mode !== 'closed' && !off)\n content =\n typeof entry === 'function' ? (\n entry({ anchor: state.anchor, url: state.url, mode: state.mode, onClose: store.close })\n ) : (\n <HyperLink />\n );\n return (\n <>\n {content}\n <span className=\"pptx-sr-only\" role=\"status\" aria-live=\"polite\">\n {linkPopupAnnouncement(state, t)}\n </span>\n </>\n );\n}\n","/** @jsxImportSource react */\n// The find bar: find and replace over the engine's `editor.find`. Ctrl/Cmd+F opens it to find\n// and Ctrl/Cmd+H (or Ctrl/Cmd+Shift+H, which macOS leaves to the page) to replace. Enter and\n// Shift+Enter step through the matches; Escape closes it and returns the focus.\n//\n// The toolbar's `find` group and a host's menu open it with `requestFindBar`: an event that\n// names the editor, so a bar answers only its own editor (as the link popover does). The\n// requests, keys, counter, actions, and focus rules are core's (`overlays.ts`), shared with the\n// Vue adapter's `PptxEditorFindBar`.\n\nimport {\n dispatchFindRequest,\n findAsYouType,\n findBarOpener,\n findBarView,\n findFieldTakesFocus,\n focusAfterFindBar,\n listenFindRequests,\n onFindShown,\n onNewDocument,\n reserveFindBarSpace,\n runFindBarAction,\n type FindBarAction,\n} from '@pptx-editor.dev/core/editor';\nimport {\n useCallback,\n useEffect,\n useRef,\n useState,\n type KeyboardEvent,\n type ReactNode,\n} from 'react';\nimport type {\n ChromeTranslate,\n FindOptions,\n PptxEditorInstance,\n} from '@pptx-editor.dev/core/editor';\nimport { withChromeTranslate } from './headless-hooks.tsx';\nimport { ToolButton } from './chrome.tsx';\nimport { useEditorState, usePptxEditor, useTranslation } from './context.ts';\nimport { usePopupEntry } from './popups.tsx';\nimport { useRegisterFindBar } from './chrome-actions.tsx';\n\n/** Open the find bar of `editor`: to find, or with the replace row when `replace`. @public */\nexport function requestFindBar(editor: PptxEditorInstance | null, replace = false): void {\n dispatchFindRequest(editor, replace);\n}\n\n/** The props of `FindBar`. @public */\nexport interface FindBarProps {\n /**\n * Your translation function for the bar, as DOCX Editor's `t` on its find pane. Without it,\n * the root's `locale` gives the labels.\n */\n readonly t?: ChromeTranslate;\n /** Appended after the `pptx-find` class. */\n className?: string;\n}\n\n/** The find and replace bar. Render one inside the editor's viewport, over the canvas. @public */\nexport const FindBar: (props: FindBarProps) => ReactNode = withChromeTranslate<FindBarProps>(\n FindBarRoot,\n 'FindBar'\n);\n\nfunction FindBarRoot({ className }: Omit<FindBarProps, 't'>) {\n const editor = usePptxEditor();\n const { t } = useTranslation();\n // Find rows and controls are on only while a find bar can answer them.\n useRegisterFindBar();\n // `popups.find`: a renderer replaces the packaged bar here; `false` turns find off.\n const entry = usePopupEntry('find');\n const off = entry === false;\n const root = useRef<HTMLDivElement>(null);\n // Finds the editor scope when a host renderer replaces the packaged bar.\n const anchor = useRef<HTMLSpanElement>(null);\n const findInput = useRef<HTMLInputElement>(null);\n const returnTo = useRef<HTMLElement | null>(null);\n const [open, setOpen] = useState(false);\n const [replaceShown, setReplaceShown] = useState(false);\n const [focusCount, setFocusCount] = useState(0);\n const [query, setQuery] = useState('');\n const [replacement, setReplacement] = useState('');\n const [matchCase, setMatchCase] = useState(false);\n const [wholeWord, setWholeWord] = useState(false);\n const [status, setStatus] = useState<string | null>(null);\n // The counter reads the deck and the selection: render again when either moves.\n useEditorState((s) => s.revision);\n useEditorState((s) => s.selection);\n useEditorState((s) => s.currentSlide);\n // A step inside the speaker notes moves neither: find tells when it shows another match.\n const [, setShownCount] = useState(0);\n useEffect(\n () => (editor ? onFindShown(editor.find, () => setShownCount((n) => n + 1)) : undefined),\n [editor]\n );\n const editable = useEditorState((s) => s.status === 'ready' && s.mode === 'edit');\n const options: FindOptions = { matchCase, wholeWord };\n\n const show = useCallback(\n (replace: boolean) => {\n if (!open) {\n returnTo.current = findBarOpener();\n // A fresh Find shows only the find row; Replace opens both.\n setReplaceShown(replace);\n } else if (replace) setReplaceShown(true);\n setOpen(true);\n setFocusCount((n) => n + 1);\n },\n [open]\n );\n\n useEffect(() => {\n if (focusCount === 0) return;\n findInput.current?.focus();\n findInput.current?.select();\n }, [focusCount]);\n\n useEffect(() => {\n if (off || !editor) return;\n // The request for this editor, and Ctrl/Cmd+F and Ctrl/Cmd+H while the focus is in this\n // editor (or nowhere).\n return listenFindRequests(editor, () => root.current ?? anchor.current, show);\n }, [editor, show, off]);\n\n // The open bar keeps its height free above the slide (core's `reserveFindBarSpace`).\n const packaged = !off && typeof entry !== 'function';\n useEffect(() => (packaged ? reserveFindBarSpace(root.current) : undefined), [packaged]);\n\n // Another document: the bar closes and forgets the search, which names the old deck's text.\n useEffect(() => {\n if (!editor) return;\n return onNewDocument(editor, () => {\n setOpen(false);\n setQuery('');\n setReplacement('');\n setStatus(null);\n });\n }, [editor]);\n\n const run = (action: FindBarAction): void => {\n if (!editor || !query) return;\n setStatus(runFindBarAction(t, editor, action, query, replacement, options));\n // The buttons turn off with no match left: focus stays in the bar, in the find field.\n if (findFieldTakesFocus(editor, action, query, options)) findInput.current?.focus();\n };\n const step = (forward: boolean): void => run(forward ? 'next' : 'previous');\n const replaceOne = (): void => run('replace');\n const replaceAll = (): void => run('replaceAll');\n\n const close = (): void => {\n setOpen(false);\n setStatus(null);\n const back = returnTo.current;\n returnTo.current = null;\n focusAfterFindBar(editor, root.current, root.current ?? anchor.current, back);\n };\n\n const onBarKey = (e: KeyboardEvent): void => {\n if (e.key !== 'Escape') return;\n e.preventDefault();\n e.stopPropagation();\n close();\n };\n\n const { matches, counter, inNotes } = findBarView(t, editor, open, query, options);\n\n if (off) return null;\n if (typeof entry === 'function')\n return (\n <>\n <span ref={anchor} hidden />\n {open ? entry({ replace: replaceShown, onClose: close }) : null}\n </>\n );\n return (\n <div\n ref={root}\n className={`pptx-find${className ? ` ${className}` : ''}`}\n role=\"search\"\n aria-label={t('find.label')}\n hidden={!open}\n onKeyDown={onBarKey}\n >\n {open ? (\n <>\n <div className=\"pptx-find__row\">\n <ToolButton\n label={t('find.showReplace')}\n icon={replaceShown ? 'keyboard_arrow_up' : 'keyboard_arrow_down'}\n pressed={replaceShown}\n onClick={() => setReplaceShown((v) => !v)}\n />\n <input\n ref={findInput}\n className=\"pptx-find__input\"\n type=\"text\"\n aria-label={t('find.find')}\n placeholder={t('find.findPlaceholder')}\n value={query}\n onChange={(e) => {\n setQuery(e.target.value);\n setStatus(null);\n findAsYouType(editor, e.target.value, options);\n }}\n onKeyDown={(e) => {\n if (e.key !== 'Enter') return;\n e.preventDefault();\n step(!e.shiftKey);\n }}\n />\n <span className=\"pptx-find__count\" aria-live=\"polite\">\n {counter}\n </span>\n <ToolButton\n label={t('find.previous')}\n icon=\"keyboard_arrow_up\"\n disabled={!matches.length}\n onClick={() => step(false)}\n />\n <ToolButton\n label={t('find.next')}\n icon=\"keyboard_arrow_down\"\n disabled={!matches.length}\n onClick={() => step(true)}\n />\n <ToolButton label={t('find.close')} icon=\"close\" onClick={close} />\n </div>\n {replaceShown ? (\n <div className=\"pptx-find__row pptx-find__row--replace\">\n <input\n className=\"pptx-find__input\"\n type=\"text\"\n aria-label={t('find.replace')}\n placeholder={t('find.replacePlaceholder')}\n value={replacement}\n disabled={!editable}\n onChange={(e) => setReplacement(e.target.value)}\n onKeyDown={(e) => {\n if (e.key !== 'Enter') return;\n e.preventDefault();\n replaceOne();\n }}\n />\n <button\n type=\"button\"\n className=\"pptx-button\"\n disabled={!editable || !matches.length}\n onClick={replaceOne}\n >\n {t('find.replaceOne')}\n </button>\n <button\n type=\"button\"\n className=\"pptx-button\"\n disabled={!editable || !matches.length}\n onClick={replaceAll}\n >\n {t('find.replaceAll')}\n </button>\n </div>\n ) : null}\n <div className=\"pptx-find__options\">\n <label className=\"pptx-find__option\">\n <input\n type=\"checkbox\"\n checked={matchCase}\n onChange={(e) => setMatchCase(e.target.checked)}\n />\n {t('find.matchCase')}\n </label>\n <label className=\"pptx-find__option\">\n <input\n type=\"checkbox\"\n checked={wholeWord}\n onChange={(e) => setWholeWord(e.target.checked)}\n />\n {t('find.wholeWord')}\n </label>\n </div>\n {inNotes ? <p className=\"pptx-find__hint\">{t('find.inNotes')}</p> : null}\n {status ? (\n <p className=\"pptx-find__status\" role=\"status\">\n {status}\n </p>\n ) : null}\n </>\n ) : null}\n </div>\n );\n}\n","/** @jsxImportSource react */\n// `PptxEditor.HyperLink`: the link popup with named parts, after DOCX Editor's\n// `DocxEditor.HyperLink` (packages/react/src/editor/DocxEditorHyperLink.tsx at 6907dc963).\n// A click into linked text opens it in reading mode under the caret: the target, Copy, Edit,\n// and Unlink. Ctrl/Cmd+K, the link control, Insert > Link, and Edit open it in edit mode: the\n// URL field, Apply, and Cancel. The state is the root's (core's `createHyperlinkPopupController`),\n// so the toolbar, the keyboard, and a host panel agree.\n//\n// CUSTOMIZATION LADDER, the toolbar's five rungs:\n// 1. `className` / `data-mode` restyle the default parts with CSS\n// 2. `icon` swap an action's glyph (Copy, Edit, Unlink)\n// 3. `asChild` put a part's wiring on your own element\n// 4. in-place part override a `<HyperLink.Copy>` child replaces that part; `hidden`\n// removes it; `preset={false}` drops the defaults\n// 5. `useHyperlinkPopup()` the raw state and actions, for a UI of your own\n//\n// Render it from `popups.hyperlink` to change it; the root renders the default one. A renderer\n// shows reading mode only when registered with `definePopup(Component, { reading: true })`.\n// F6 moves focus from the slide text into an open reading panel.\n\nimport {\n Children,\n createContext,\n Fragment,\n isValidElement,\n useContext,\n useEffect,\n useMemo,\n useRef,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport {\n linkSelectionRect,\n openHyperlinkPopup,\n requestLinkPopup,\n translateKeyOrText,\n type HyperlinkPopupController,\n type HyperlinkPopupState,\n} from '@pptx-editor.dev/core/editor';\nimport { Icon, Popover } from './chrome.tsx';\nimport { usePptxEditor, useTranslation } from './context.ts';\nimport { renderAsChild, type HostElementProps } from './slot-override.ts';\n\n/** What `useHyperlinkPopup` returns. @public */\nexport interface UseHyperlinkPopupResult {\n readonly state: HyperlinkPopupState;\n /**\n * Open reading mode over the link at a text caret, or the URL field when there is none, under\n * `anchor` (default: the caret). DOCX Editor's argument order: `link` is `null` for the URL\n * field at once; the panel shows the link at the caret, so a given `link` only asks for\n * reading mode.\n */\n open(link?: { readonly url: string } | null, anchor?: HTMLElement | null): void;\n /** Open the URL field for the selection, as Ctrl/Cmd+K and the link control do. */\n openAtCaret(): void;\n close(): void;\n /** Copy the safe target. Resolves false when there is nothing safe to copy. */\n copy(): Promise<boolean>;\n /** Switch from reading to editing. */\n beginEdit(): void;\n setUrl(url: string): void;\n /** Apply the draft. False when the engine refused it; `state.error` says why. */\n commitEdit(): boolean;\n /** Remove the link, keeping its text. */\n unlink(): boolean;\n /** Open the safe target in a new tab, with no opener. False when there is none. */\n openTarget(): boolean;\n}\n\n/** The root's link popup state, published by `PptxEditor.Root`. @internal */\nexport interface HyperlinkPopupContextValue {\n readonly controller: HyperlinkPopupController;\n readonly state: HyperlinkPopupState;\n /** The id of the error message, so the URL field names it. */\n readonly errorId: string;\n}\n\n/** @internal */\nexport const HyperlinkPopupContext = createContext<HyperlinkPopupContextValue | null>(null);\n\nconst CLOSED_STATE: HyperlinkPopupState = {\n mode: 'closed',\n url: '',\n href: null,\n draft: '',\n error: null,\n copied: false,\n canEdit: false,\n anchor: null,\n};\n\n/**\n * The link popup's state and actions: the root's one state, so a host panel, the toolbar, and\n * Ctrl/Cmd+K agree. Call it in a part of the panel or in a `popups.hyperlink` renderer, which the\n * root renders inside the state; elsewhere it is closed and inert. @public\n */\nexport function useHyperlinkPopup(): UseHyperlinkPopupResult {\n const ctx = useContext(HyperlinkPopupContext);\n const editor = usePptxEditor();\n const c = ctx?.controller;\n return {\n state: ctx?.state ?? CLOSED_STATE,\n open: (link, anchor) => {\n if (c && editor) openHyperlinkPopup(c, editor, link, anchor);\n },\n openAtCaret: () => {\n if (editor) requestLinkPopup(editor);\n },\n close: () => c?.close(),\n copy: () => c?.copy() ?? Promise.resolve(false),\n beginEdit: () => c?.beginEdit(),\n setUrl: (url) => c?.setUrl(url),\n commitEdit: () => c?.commitEdit() ?? false,\n unlink: () => c?.unlink() ?? false,\n openTarget: () => c?.openTarget() ?? false,\n };\n}\n\n/** Shared props of every part. @public */\nexport interface HyperLinkPartProps {\n readonly className?: string;\n /** Put this part's wiring on the one child element instead of the default element. */\n readonly asChild?: boolean;\n /** Render nothing: inside the default arrangement this removes the part. */\n readonly hidden?: boolean;\n readonly children?: ReactNode;\n}\n\n/** Props of the action parts, which also take an icon. @public */\nexport interface HyperLinkActionProps extends HyperLinkPartProps {\n /** The glyph; falls back to `children`, then to the part's default icon. */\n readonly icon?: ReactNode;\n}\n\n/** Props of `PptxEditor.HyperLink`. @public */\nexport interface HyperLinkProps extends HyperLinkPartProps {\n /** Render the packaged parts. `false` renders only the panel and your children. */\n readonly preset?: boolean;\n}\n\n/** Keeps the caret: a press in the panel must not move it. Fields are exempt. */\nfunction guardMousedown(event: { target: EventTarget | null; preventDefault(): void }): void {\n const tag = (event.target as HTMLElement | null)?.tagName;\n if (tag === 'INPUT' || tag === 'SELECT' || tag === 'TEXTAREA') return;\n event.preventDefault();\n}\n\nconst join = (base: string, extra?: string): string => (extra ? `${base} ${extra}` : base);\n\n/** The part's own element, or its wiring on the host's child (`asChild`). */\nfunction render(\n asChild: boolean | undefined,\n children: ReactNode,\n props: HostElementProps,\n fallback: () => ReactElement\n): ReactElement | null {\n if (!asChild) return fallback();\n const only = Children.toArray(children);\n const child = only.length === 1 ? only[0] : null;\n return isValidElement<HostElementProps>(child) ? renderAsChild(child, props) : fallback();\n}\n\n/** The link popup panel. @public */\nfunction HyperLinkRoot({ className, asChild, hidden, preset = true, children }: HyperLinkProps) {\n const ctx = useContext(HyperlinkPopupContext);\n const { t } = useTranslation();\n const state = ctx?.state ?? CLOSED_STATE;\n const editor = usePptxEditor();\n const open = state.mode !== 'closed';\n // Capture the text box before the field takes focus. Keep it while the draft changes.\n const anchorRect = useMemo(\n () => (open && editor && state.anchor ? linkSelectionRect(editor) : null),\n [editor, open, state.anchor]\n );\n if (!ctx || !open) return null;\n // `hidden` drops the packaged panel only: the gestures stay, so a host renders its own UI.\n if (hidden) return <>{children}</>;\n const body = preset ? <HyperLinkPreset>{children}</HyperLinkPreset> : children;\n const reading = state.mode === 'reading';\n const inner = { className: 'pptx-link', 'data-mode': state.mode };\n return (\n <Popover\n anchor={state.anchor}\n anchorRect={anchorRect}\n role=\"dialog\"\n label={t(reading ? 'link.label' : state.url ? 'link.edit' : 'link.insert')}\n onClose={() => ctx.controller.close()}\n // Reading leaves the keys in the slide text; editing takes them in its field.\n passive={reading}\n field={!reading}\n className={join('pptx-link-popup', className)}\n >\n {render(asChild, children, inner, () => (\n <div {...inner}>{body}</div>\n ))}\n </Popover>\n );\n}\n\ntype PartName = 'Url' | 'Copy' | 'Edit' | 'Unlink' | 'Fields' | 'Error' | 'Apply' | 'Cancel';\ntype Marked = { pptxHyperLinkPart?: PartName };\n\n/** Each part child by its name, so the preset swaps it in place; other children follow. */\nfunction partOverrides(children: ReactNode): {\n parts: Partial<Record<PartName, ReactNode>>;\n extra: ReactNode[];\n} {\n const parts: Partial<Record<PartName, ReactNode>> = {};\n const extra: ReactNode[] = [];\n const visit = (node: ReactNode): void => {\n if (Array.isArray(node)) return void node.forEach(visit);\n if (!isValidElement(node)) {\n if (node !== null && node !== undefined && node !== false) extra.push(node);\n return;\n }\n // A fragment groups overrides; it is not content.\n if (node.type === Fragment) return visit((node.props as { children?: ReactNode }).children);\n const name = (node.type as Marked).pptxHyperLinkPart;\n if (name) parts[name] = node;\n else extra.push(node);\n };\n visit(children);\n return { parts, extra };\n}\n\n/** The default arrangement of the mode. A part child replaces its default copy. */\nfunction HyperLinkPreset({ children }: { children?: ReactNode }) {\n const { state } = useHyperlinkPopup();\n const { parts, extra } = partOverrides(children);\n const take = (name: PartName, fallback: ReactNode): ReactNode =>\n name in parts ? parts[name] : fallback;\n if (state.mode === 'editing')\n return (\n <>\n {/* An existing link keeps its target, Copy, and Open while it is edited. */}\n {state.url ? (\n <div className=\"pptx-link__row\">\n {take('Url', <HyperLinkUrl />)}\n <div className=\"pptx-link__tools\">{take('Copy', <HyperLinkCopy />)}</div>\n </div>\n ) : null}\n {take('Fields', <HyperLinkFields />)}\n {take('Error', <HyperLinkError />)}\n <div className=\"pptx-link__actions\">\n {/* Changing a link can also remove it, as the reading row can. */}\n {state.url && state.canEdit ? take('Unlink', <HyperLinkUnlink />) : null}\n {take('Cancel', <HyperLinkCancel />)}\n {take('Apply', <HyperLinkApply />)}\n </div>\n {extra}\n </>\n );\n return (\n <>\n <div className=\"pptx-link__row\">\n {take('Url', <HyperLinkUrl />)}\n <div className=\"pptx-link__tools\">\n {take('Copy', <HyperLinkCopy />)}\n {/* An action that can never run is absent, not disabled: a read-only editor. */}\n {state.canEdit ? take('Edit', <HyperLinkEdit />) : null}\n {state.canEdit ? take('Unlink', <HyperLinkUnlink />) : null}\n </div>\n </div>\n {take('Error', <HyperLinkError />)}\n {extra}\n </>\n );\n}\n\n/** The target. A safe link opens in a new tab; any other shows as text. @public */\nfunction HyperLinkUrl({ className, asChild, hidden, children }: HyperLinkPartProps) {\n const { state } = useHyperlinkPopup();\n const { t } = useTranslation();\n if (hidden || !state.url) return null;\n const text = <bdi dir=\"ltr\">{state.url}</bdi>;\n if (!state.href) {\n const props = {\n className: join('pptx-link__url', className),\n 'data-inert': '',\n title: t('link.unsafe'),\n };\n return render(asChild, children, props, () => <span {...props}>{children ?? text}</span>);\n }\n const props = {\n className: join('pptx-link__url', className),\n href: state.href,\n target: '_blank',\n rel: 'noopener noreferrer',\n title: t('link.open'),\n onMouseDown: guardMousedown,\n };\n return render(asChild, children, props, () => (\n <a {...props}>\n {children ?? text}\n <Icon name=\"open_in_new\" />\n </a>\n ));\n}\nHyperLinkUrl.pptxHyperLinkPart = 'Url' as const;\n\n/** An icon button of the reading row. */\nfunction ActionPart(\n { className, asChild, hidden, children, icon }: HyperLinkActionProps,\n part: string,\n label: string,\n glyph: string,\n onClick: () => void,\n extra: HostElementProps = {}\n): ReactElement | null {\n if (hidden) return null;\n const props: HostElementProps = {\n type: 'button',\n className: join(`pptx-link__action pptx-link__${part}`, className),\n 'aria-label': label,\n title: label,\n onMouseDown: guardMousedown,\n onClick,\n ...extra,\n };\n return render(asChild, children, props, () => (\n <button {...props}>{icon ?? children ?? <Icon name={glyph} />}</button>\n ));\n}\n\n/** Copy the safe target. @public */\nfunction HyperLinkCopy(props: HyperLinkActionProps) {\n const { state, copy } = useHyperlinkPopup();\n const { t } = useTranslation();\n if (!state.href) return null;\n const label = t(state.copied ? 'link.copied' : 'link.copy');\n return ActionPart(props, 'copy', label, 'content_copy', () => void copy(), {\n ...(state.copied ? { 'data-copied': '' } : {}),\n });\n}\nHyperLinkCopy.pptxHyperLinkPart = 'Copy' as const;\n\n/** Switch to the URL field. @public */\nfunction HyperLinkEdit(props: HyperLinkActionProps) {\n const { beginEdit } = useHyperlinkPopup();\n const { t } = useTranslation();\n return ActionPart(props, 'edit', t('link.edit'), 'edit', beginEdit);\n}\nHyperLinkEdit.pptxHyperLinkPart = 'Edit' as const;\n\n/** Remove the link, keeping its text. @public */\nfunction HyperLinkUnlink(props: HyperLinkActionProps) {\n const { unlink } = useHyperlinkPopup();\n const { t } = useTranslation();\n return ActionPart(props, 'unlink', t('link.remove'), 'link_off', () => void unlink());\n}\nHyperLinkUnlink.pptxHyperLinkPart = 'Unlink' as const;\n\n/** The URL field. Enter applies. @public */\nfunction HyperLinkFields({ className, hidden }: HyperLinkPartProps) {\n const ctx = useContext(HyperlinkPopupContext);\n const { state, setUrl, commitEdit } = useHyperlinkPopup();\n const { t } = useTranslation();\n const field = useRef<HTMLInputElement>(null);\n // After the popover is placed: a browser does not focus into a hidden panel.\n useEffect(() => {\n field.current?.focus({ preventScroll: true });\n field.current?.select();\n }, []);\n if (hidden) return null;\n return (\n <input\n ref={field}\n className={join('pptx-font-picker__search pptx-link__field', className)}\n type=\"url\"\n dir=\"ltr\"\n aria-label={t('link.label')}\n placeholder={t('link.placeholder')}\n value={state.draft}\n aria-invalid={state.error ? true : undefined}\n aria-describedby={state.error && ctx ? ctx.errorId : undefined}\n onChange={(e) => setUrl(e.target.value)}\n onKeyDown={(e) => {\n if (e.key !== 'Enter') return;\n // The Enter that applies must not reach the element focus moves to next.\n e.preventDefault();\n commitEdit();\n }}\n />\n );\n}\nHyperLinkFields.pptxHyperLinkPart = 'Fields' as const;\n\n/** Why the last Apply or Unlink was refused. @public */\nfunction HyperLinkError({ className, hidden }: HyperLinkPartProps) {\n const ctx = useContext(HyperlinkPopupContext);\n const { t } = useTranslation();\n const error = ctx?.state.error;\n if (hidden || !error) return null;\n return (\n <p id={ctx.errorId} role=\"alert\" className={join('pptx-link__error', className)}>\n {translateKeyOrText(t, error)}\n </p>\n );\n}\nHyperLinkError.pptxHyperLinkPart = 'Error' as const;\n\n/** Apply the draft. @public */\nfunction HyperLinkApply({ className, asChild, hidden, children }: HyperLinkPartProps) {\n const { state, commitEdit } = useHyperlinkPopup();\n const { t } = useTranslation();\n if (hidden) return null;\n const props: HostElementProps = {\n type: 'button',\n className: join('pptx-button pptx-button--primary pptx-link__apply', className),\n disabled: state.draft.trim().length === 0,\n onMouseDown: guardMousedown,\n onClick: () => void commitEdit(),\n };\n return render(asChild, children, props, () => (\n <button {...props}>{children ?? t('link.apply')}</button>\n ));\n}\nHyperLinkApply.pptxHyperLinkPart = 'Apply' as const;\n\n/** Close without applying. @public */\nfunction HyperLinkCancel({ className, asChild, hidden, children }: HyperLinkPartProps) {\n const { close } = useHyperlinkPopup();\n const { t } = useTranslation();\n if (hidden) return null;\n const props: HostElementProps = {\n type: 'button',\n className: join('pptx-button pptx-link__cancel', className),\n onMouseDown: guardMousedown,\n onClick: close,\n };\n return render(asChild, children, props, () => (\n <button {...props}>{children ?? t('link.cancel')}</button>\n ));\n}\nHyperLinkCancel.pptxHyperLinkPart = 'Cancel' as const;\n\n/** The link popup compound. @public */\nexport interface HyperLinkNamespace {\n (props: HyperLinkProps): ReactNode;\n readonly Url: typeof HyperLinkUrl;\n readonly Copy: typeof HyperLinkCopy;\n readonly Edit: typeof HyperLinkEdit;\n readonly Unlink: typeof HyperLinkUnlink;\n readonly Fields: typeof HyperLinkFields;\n readonly Error: typeof HyperLinkError;\n readonly Apply: typeof HyperLinkApply;\n readonly Cancel: typeof HyperLinkCancel;\n}\n\n/** `PptxEditor.HyperLink`: the link popup with named parts. @public */\nexport const HyperLink: HyperLinkNamespace = Object.assign(HyperLinkRoot, {\n Url: HyperLinkUrl,\n Copy: HyperLinkCopy,\n Edit: HyperLinkEdit,\n Unlink: HyperLinkUnlink,\n Fields: HyperLinkFields,\n Error: HyperLinkError,\n Apply: HyperLinkApply,\n Cancel: HyperLinkCancel,\n});\n","// The link popup's behavior with no UI, after DOCX Editor's `useHyperlinkPopup`. The state and\n// the actions are core's (`createHyperlinkPopupStore` in `overlays.ts`), shared with the Vue\n// adapter; these hooks subscribe to one store and bind it to the editor's link requests.\n\nimport {\n createContext,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n} from 'react';\nimport {\n createHyperlinkPopupStore,\n hyperlinkPopupActions,\n listenHyperlinkPopup,\n type HyperlinkPopupActions,\n type HyperlinkPopupState,\n type HyperlinkPopupStore,\n} from '@pptx-editor.dev/core/editor';\nimport { useEditorCommand, usePptxEditor } from './context.ts';\nimport {\n HyperlinkPopupContext as ControllerContext,\n useHyperlinkPopup as useControllerPopup,\n} from './HyperLink.tsx';\n\n/** What `useHyperlinkPopup` returns, as DOCX Editor's hook of the same name. @public */\nexport interface UseHyperlinkPopupResult extends HyperlinkPopupActions {\n /** Whether the popup shows, what it shows, and the draft. */\n readonly state: HyperlinkPopupState;\n}\n\n/** The link popup store of the enclosing `PptxEditor.Root`. @internal */\nexport const HyperlinkPopupContext = createContext<HyperlinkPopupStore | null>(null);\n\n/**\n * Counts the views of the root's link popup state: a host panel that calls\n * `useHyperlinkPopup()`. With `popups.hyperlink: false`, the link controls work while one is\n * mounted. @internal\n */\nexport const HyperlinkPopupViewsContext = createContext<(() => () => void) | null>(null);\n\n/** Bind `store` to the editor, and while `active`, to its link requests. @internal */\nexport function useHyperlinkPopupBinding(store: HyperlinkPopupStore, active: boolean): void {\n const editor = usePptxEditor();\n const enabled = useEditorCommand('text.link').isEnabled;\n const enabledRef = useRef(enabled);\n enabledRef.current = enabled;\n useEffect(() => {\n store.setEditor(editor);\n return () => store.setEditor(null);\n }, [store, editor]);\n useEffect(() => {\n if (!editor || !active) return undefined;\n // Requests for this editor only: another editor on the page opens its own popup.\n return listenHyperlinkPopup(store, editor, () => enabledRef.current);\n }, [store, editor, active]);\n}\n\n/** The state and actions of `store`, with a stable identity while the state does not change. */\nfunction useStoreResult(store: HyperlinkPopupStore): UseHyperlinkPopupResult {\n const state = useSyncExternalStore(store.subscribe, store.getState, store.getState);\n const actions = useMemo(() => hyperlinkPopupActions(store), [store]);\n return useMemo(() => ({ state, ...actions }), [state, actions]);\n}\n\n/**\n * The link popup's behavior, for your own link UI, as DOCX Editor's `useHyperlinkPopup`.\n *\n * Inside `PptxEditor.Root` it is the shared state that the packaged popup shows, so your panel,\n * the toolbar's link control, Insert > Link, and Ctrl/Cmd+K agree. With\n * `popups.hyperlink: false`, the link controls open your panel while it is mounted. Outside a\n * root it is a standalone instance, as `useHyperlinkPopupInstance()`.\n *\n * @example\n * ```tsx\n * function LinkPanel() {\n * const { state, setUrl, commitEdit, close } = useHyperlinkPopup();\n * if (state.mode === 'closed') return null;\n * return (\n * <form onSubmit={(e) => { e.preventDefault(); commitEdit(); }}>\n * <input value={state.draft} onChange={(e) => setUrl(e.target.value)} />\n * <button type=\"button\" onClick={close}>Cancel</button>\n * </form>\n * );\n * }\n * ```\n *\n * @public\n */\nexport function useHyperlinkPopup(): UseHyperlinkPopupResult {\n const provided = useContext(HyperlinkPopupContext);\n const controllerContext = useContext(ControllerContext);\n const controllerResult = useControllerPopup();\n const attach = useContext(HyperlinkPopupViewsContext);\n useEffect(() => (provided ? attach?.() : undefined), [provided, attach]);\n // Every render calls the same hooks: `provided` only decides whether the own store listens.\n const [own] = useState(createHyperlinkPopupStore);\n useHyperlinkPopupBinding(own, provided === null && controllerContext === null);\n const result = useStoreResult(provided ?? own);\n // A standalone packaged popup can still provide the existing controller context.\n return !provided && controllerContext ? controllerResult : result;\n}\n\n/**\n * A link popup of its own, as DOCX Editor's `useHyperlinkPopupInstance`. While `active`, it\n * opens for the link requests of the editor. Inside a root, prefer `useHyperlinkPopup()`: the\n * root's own popup also answers the requests.\n *\n * @public\n */\nexport function useHyperlinkPopupInstance(active = true): UseHyperlinkPopupResult {\n const [store] = useState(createHyperlinkPopupStore);\n useHyperlinkPopupBinding(store, active);\n return useStoreResult(store);\n}\n","/** @jsxImportSource react */\n// Slide chrome of the Home tab: the layout gallery, the New Slide split button, and the\n// Layout button. Each layout tile is the engine's own render of a new slide on that layout,\n// with its placeholder prompts (`renderLayoutThumbnail`).\n\nimport { memo, useEffect, useRef, useState } from 'react';\nimport {\n tooltipAttributes,\n layoutGalleryEnter,\n layoutGalleryKey,\n layoutGalleryTabStop,\n layoutMasterGroups,\n translateKeyOrText,\n type ChromeControl,\n type ChromeSlotId,\n type SlideLayoutSummary,\n} from '@pptx-editor.dev/core/editor';\nimport { Icon, Popover, ToolButton, keepFocus, useAriaDisabled } from './chrome.tsx';\nimport { useEditorState, usePptxEditor, useTranslation } from './context.ts';\nimport { useSlot } from './slot.ts';\nimport { buttonRoleProps, renderAsChild, useSlotOverride } from './slot-override.ts';\n\nconst EMPTY: readonly SlideLayoutSummary[] = [];\nconst sameLayouts = (a: readonly SlideLayoutSummary[], b: readonly SlideLayoutSummary[]) => a === b;\n\n/**\n * The deck's slide layouts (`EditorSnapshot.layouts`), in the order the galleries list them,\n * reference-stable while they do not change. For a host's own layout picker. @public\n */\nexport function useSlideLayouts(): readonly SlideLayoutSummary[] {\n return useEditorState((s) => s.layouts ?? EMPTY, sameLayouts);\n}\n\nconst LayoutThumb = memo(function LayoutThumb({ id, ratio }: { id: string; ratio: number }) {\n const editor = usePptxEditor();\n const box = useRef<HTMLSpanElement>(null);\n // Repaint when the document changes (a theme or master edit changes every layout) and when\n // fonts load: the slide summaries change with the font generation, as the rail's do. The\n // engine skips a paint whose package, layout, and fonts are the same.\n const revision = useEditorState((s) => s.revision);\n const slides = useEditorState((s) => s.slides);\n useEffect(() => {\n if (editor && box.current) editor.renderLayoutThumbnail(id, box.current);\n }, [editor, id, revision, slides]);\n return (\n <span\n ref={box}\n className=\"pptx-layout-gallery__thumb\"\n style={{ aspectRatio: String(1 / ratio) }}\n aria-hidden=\"true\"\n />\n );\n});\n\n/** Props of {@link LayoutGallery}, named as DOCX Editor's `StylePicker` names them. @public */\nexport interface LayoutGalleryProps {\n /** The layout to mark as the current one (`menuitemradio`, checked). Absent: plain rows. */\n readonly value?: string;\n /** Called with the picked layout's id (`SlideLayoutSummary.id`). */\n readonly onChange: (layoutId: string) => void;\n /** A class name added to the gallery's root element. */\n readonly className?: string;\n /** The layouts to show. Default: every layout of the deck (`useSlideLayouts`). */\n readonly layouts?: readonly SlideLayoutSummary[];\n /** Show the tiles but take no pick. Default: true while the deck is open for viewing. */\n readonly disabled?: boolean;\n /**\n * Why the gallery takes no pick, for the tiles' tooltips: a catalog key (such as\n * `useEditorCommand(slotId).disabledReason`) or text. Default: the viewing reason.\n */\n readonly disabledReason?: string | null;\n}\n\n/**\n * A grid of the deck's layouts, as the Layout and New Slide galleries show them: one\n * group per slide master, headed by its name, and each tile the engine's render of a new slide\n * on the layout, named below. The tiles are menu rows (`menuitem`, or `menuitemradio` with\n * `value`); arrow keys, Home, and End move between them, so the gallery works in any menu or\n * popup of the host. @public\n */\nexport function LayoutGallery({\n value: current,\n onChange,\n className,\n layouts: given,\n disabled,\n disabledReason,\n}: LayoutGalleryProps) {\n const deck = useSlideLayouts();\n const layouts = given ?? deck;\n const viewing = useEditorState((s) => s.mode === 'view');\n const off = disabled ?? viewing;\n const ratio = useEditorState((s) => s.slideHeight / s.slideWidth);\n const { t } = useTranslation();\n const entered = useRef(false);\n const reasonText = disabledReason\n ? translateKeyOrText(t, disabledReason)\n : viewing\n ? t('disabled.viewing')\n : null;\n // Every tile says the one reason through `aria-describedby`.\n const offTiles = useAriaDisabled(off, reasonText);\n if (!layouts.length)\n return <p className=\"pptx-layout-gallery__empty\">{t('layoutGallery.empty')}</p>;\n const masters = layoutMasterGroups(layouts);\n // One tile takes Tab focus: the current layout, or the first.\n const focusable = layoutGalleryTabStop(layouts, current);\n return (\n <div\n className={['pptx-layout-gallery', className].filter(Boolean).join(' ')}\n onFocus={(e) => {\n // A menu opened from the keyboard focuses its first row: start on the current layout.\n if (entered.current) return;\n entered.current = true;\n layoutGalleryEnter(e.currentTarget, e.target);\n }}\n onKeyDown={(e) => {\n // Left from the first column leaves the gallery: a submenu then closes.\n if (layoutGalleryKey(e.currentTarget, e.target, e.key)) {\n e.preventDefault();\n e.stopPropagation();\n }\n }}\n >\n {masters.map((m) => (\n <div key={m.id} className=\"pptx-layout-gallery__group\" role=\"group\" aria-label={m.name}>\n <div className=\"pptx-layout-gallery__header\" aria-hidden=\"true\">\n {m.name}\n </div>\n <div className=\"pptx-layout-gallery__grid\" data-columns={3}>\n {m.layouts.map((l) => (\n <button\n key={l.id}\n type=\"button\"\n role={current === undefined ? 'menuitem' : 'menuitemradio'}\n {...(current === undefined ? {} : { 'aria-checked': l.id === current })}\n tabIndex={l.id === focusable ? 0 : -1}\n className=\"pptx-layout-gallery__item\"\n data-layout-type={l.type}\n data-current={l.id === current ? '' : undefined}\n {...offTiles.attrs}\n {...tooltipAttributes(l.name, off, reasonText)}\n onClick={() => {\n if (!off) onChange(l.id);\n }}\n >\n <LayoutThumb id={l.id} ratio={ratio} />\n <span className=\"pptx-layout-gallery__name\">{l.name}</span>\n </button>\n ))}\n </div>\n </div>\n ))}\n {offTiles.note}\n </div>\n );\n}\n\n/** The props of `NewSlideControl`. @internal */\nexport interface NewSlideControlProps {\n /** The chrome slot the control runs. */\n slot: ChromeSlotId;\n /** The registry entry of the control, from `CHROME_GROUPS`. */\n control: ChromeControl;\n}\n\n/**\n * Home > New Slide: the button adds a slide on the default next layout; the arrow opens the\n * layout gallery. The toolbar's part for `slide.add`; hosts place it with `Toolbar.Slot`. @internal\n */\nexport function NewSlideControl({ slot, control }: NewSlideControlProps) {\n const { cmd, label, reason } = useSlot(slot, control);\n const caretOff = useAriaDisabled(!cmd.isEnabled, reason);\n const editor = usePptxEditor();\n const { t } = useTranslation();\n const anchor = useRef<HTMLButtonElement>(null);\n const [open, setOpen] = useState(false);\n // The caret is part of the split button: host overrides go to the main button, as for the\n // color pickers, so the caret keeps its own class.\n const choose = t('layoutGallery.choose');\n return (\n <span className=\"pptx-toolbar__group\">\n <ToolButton\n slot={slot}\n label={label}\n paths={control.paths}\n disabled={!cmd.isEnabled}\n disabledReason={reason}\n onClick={() => editor?.exec({ type: 'addSlide' })}\n />\n <button\n ref={anchor}\n type=\"button\"\n className=\"pptx-toolbar__button pptx-toolbar__caret-button\"\n data-disabled={cmd.isEnabled ? undefined : ''}\n aria-label={choose}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n {...tooltipAttributes(choose, !cmd.isEnabled, reason)}\n {...caretOff.attrs}\n onMouseDown={keepFocus}\n onClick={() => {\n if (cmd.isEnabled) setOpen((o) => !o);\n }}\n >\n <Icon name=\"arrow_drop_down\" className=\"pptx-icon pptx-toolbar__caret\" />\n </button>\n {caretOff.note}\n {open ? (\n <Popover anchor={anchor.current} onClose={() => setOpen(false)} label={label}>\n <LayoutGallery\n onChange={(id) => {\n setOpen(false);\n cmd.execute(id);\n }}\n />\n </Popover>\n ) : null}\n </span>\n );\n}\n\n/** The props of `LayoutControl`. @internal */\nexport interface LayoutControlProps {\n /** The chrome slot the control runs. */\n slot: ChromeSlotId;\n /** The registry entry of the control, from `CHROME_GROUPS`. */\n control: ChromeControl;\n}\n\n/**\n * Home > Layout: the layout gallery, with the current slide's layout marked. The trigger is one\n * button, so it takes the slot's `icon` and `asChild` as `ToolButton` does. The toolbar's part\n * for `slide.layout`; hosts place it with `Toolbar.Slot`. @internal\n */\nexport function LayoutControl({ slot, control }: LayoutControlProps) {\n const { cmd, label, tip, reason } = useSlot(slot, control);\n const override = useSlotOverride(slot);\n const [anchor, setAnchor] = useState<HTMLElement | null>(null);\n const [open, setOpen] = useState(false);\n const disabled = !cmd.isEnabled;\n // A disabled trigger stays focusable and says why (`aria-disabled`).\n const off = useAriaDisabled(disabled, reason);\n const toggle = (el: Element): void => {\n if (disabled || !(el instanceof HTMLElement)) return;\n setAnchor(el);\n setOpen((o) => !o);\n };\n const attributes = {\n className: ['pptx-toolbar__button pptx-toolbar__button--wide', override?.className]\n .filter(Boolean)\n .join(' '),\n 'data-slot': slot,\n 'data-disabled': disabled ? '' : undefined,\n 'aria-label': label,\n 'aria-haspopup': 'menu' as const,\n 'aria-expanded': open,\n ...tip,\n ...off.attrs,\n onMouseDown: keepFocus,\n onClick: (e: { currentTarget: Element }) => toggle(e.currentTarget),\n };\n const host = override?.asChild;\n return (\n <>\n {host ? (\n // A host element that is not a button gets the button role, a tab stop, and Enter and\n // Space, as `ToolButton` gives it.\n renderAsChild(host, {\n ...attributes,\n ...(host.type === 'button' ? { type: 'button' } : buttonRoleProps(toggle)),\n })\n ) : (\n <button type=\"button\" {...attributes}>\n {override?.icon !== undefined ? override.icon : <Icon paths={control.paths} />}\n <Icon name=\"arrow_drop_down\" className=\"pptx-icon pptx-toolbar__caret\" />\n </button>\n )}\n {off.note}\n {open ? (\n <Popover anchor={anchor} onClose={() => setOpen(false)}>\n <LayoutGallery\n value={typeof cmd.value === 'string' ? cmd.value : ''}\n onChange={(id) => {\n setOpen(false);\n cmd.execute(id);\n }}\n />\n </Popover>\n ) : null}\n </>\n );\n}\n\n/**\n * Home > Section > Add Section: adds a section at the current slide and starts renaming it, so it\n * asks for the name, where a rail or a sorter can show the name field\n * (`runSectionSlot`). The toolbar's part for `section.add`. @internal\n */\nexport function SectionAddControl({\n slot,\n control,\n}: {\n slot: ChromeSlotId;\n control: ChromeControl;\n}) {\n const { cmd, label, reason } = useSlot(slot, control);\n return (\n <ToolButton\n slot={slot}\n label={label}\n paths={control.paths}\n disabled={!cmd.isEnabled}\n disabledReason={reason}\n onClick={() => cmd.execute()}\n />\n );\n}\n\n/**\n * Home > Section > Rename Section: opens the name field of the current slide's section in the\n * rail or the sorter. Without one, it is off and says why (`disabled.noSectionPane`). The\n * toolbar's part for `section.rename`. @internal\n */\nexport function SectionRenameControl({\n slot,\n control,\n}: {\n slot: ChromeSlotId;\n control: ChromeControl;\n}) {\n const { cmd, label, reason } = useSlot(slot, control);\n return (\n <ToolButton\n slot={slot}\n label={label}\n paths={control.paths}\n disabled={!cmd.isEnabled}\n disabledReason={reason}\n onClick={() => cmd.execute()}\n />\n );\n}\n","/** @jsxImportSource react */\n// `PptxEditor.Menu`: the menu bar as library parts, after DOCX Editor's `DocxEditor.Menu`\n// (docx-editor/docs/site/content/customization/menus.mdx, packages/react/src/editor/menu/).\n//\n// The preset bar renders core's `CHROME_MENUS` (File, Edit, View, Insert, Format, Arrange,\n// Slide Show). A named menu child (`Menu.File`) changes its menu in place: `hidden` removes\n// it, `Menu.Item slotId` replaces or hides one row, other children add rows at its end, and\n// `preset={false}` keeps only its children. `Menu.Entry` with another id adds a host menu.\n// `preset={false}` on the bar renders only the children. Hiding a row changes the interface\n// only: its command still runs from the toolbar, the keyboard, and the API.\n\nimport type { ChromeTranslate } from '@pptx-editor.dev/core/editor';\nimport {\n Children,\n Fragment,\n isValidElement,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactNode,\n} from 'react';\nimport {\n arrangeMenuBar,\n arrangeMenuRows,\n menuBarClosedOnEscape,\n menuBarRestoresFocus,\n menuBarTriggerKey,\n menuBarArrow,\n menuPartName,\n translateKeyOrText,\n warnMenuPart,\n MENU_NAMED_PARTS,\n type ChromeMenu,\n type ChromeMenuId,\n type ChromeSlotId,\n type MenuNamedRow,\n} from '@pptx-editor.dev/core/editor';\nimport { Icon, Popover, keepFocus } from './chrome.tsx';\nimport { MenuCloseContext } from './ContextMenu.tsx';\nimport { useTranslation } from './context.ts';\nimport { MenuEntries, RowDefaultsContext, SlotMenuRow } from './menu-rows.tsx';\n\n/** Props for `Menu.Item` and `ContextMenu.Slot`: one registry row. @public */\nexport interface MenuSlotItemProps {\n /** The slot the row runs, for example `text.bold`. */\n readonly slotId: ChromeSlotId;\n /** The value a value slot runs with (`arrange.order` with `front`). */\n readonly value?: string;\n /** A translation key for the row's label, in place of the registry label. */\n readonly labelKey?: string;\n /** A translation key for the shortcut shown at the end of the row. */\n readonly shortcutKey?: string;\n /**\n * In place of the registry icon: a Material Symbol name (as `Menu.Row` reads it), or icon\n * content (an element).\n */\n readonly icon?: ReactNode;\n /**\n * Run the slot's command at once instead of opening its choices (a value slot such as\n * `slide.add`). Unset, the row runs as the registry row it replaces: Insert > New slide adds a\n * slide at once; `direct={false}` opens the layout gallery there.\n */\n readonly direct?: boolean;\n /** A class name added to the row. */\n readonly className?: string;\n /** Remove the row. Its command keeps working elsewhere. */\n readonly hidden?: boolean;\n}\n\n/**\n * A menu row for a registered slot: its label, icon, shortcut, enabled state, and action come\n * from the chrome registry. A slot that collects a value opens a submenu of its choices.\n * @public\n */\nexport function MenuSlotItem(props: MenuSlotItemProps): ReactNode {\n // In place of a registry row, the row keeps that row's own label and shortcut.\n const replaced = useContext(RowDefaultsContext);\n if (props.hidden) return null;\n const labelKey = props.labelKey ?? replaced?.labelKey;\n // In place of a registry row that runs its command, the row runs it too, unless it says not to.\n const inherited =\n !!replaced?.direct && replaced.slot === props.slotId && props.value === undefined;\n const direct = props.direct ?? inherited;\n // A row that opens choices does not show the shortcut of the direct row it replaces.\n const shortcutKey =\n props.shortcutKey ?? (inherited && !direct ? undefined : replaced?.shortcutKey);\n return (\n <SlotMenuRow\n entry={{\n kind: 'item',\n slot: props.slotId,\n ...(props.value !== undefined ? { value: props.value } : {}),\n ...(direct ? { direct: true as const } : {}),\n }}\n overrides={{\n ...(labelKey ? { labelKey } : {}),\n ...(shortcutKey ? { shortcutKey } : {}),\n ...(props.className ? { className: props.className } : {}),\n ...(props.icon !== undefined ? { icon: props.icon } : {}),\n }}\n />\n );\n}\n\n/** Props for a named menu row (`Menu.Cut`, `ContextMenu.Cut`, …), as DOCX Editor's. @public */\nexport interface MenuRowPartProps {\n /** The row's text, or a translation key, in place of the registry label. */\n readonly label?: string;\n /** A translation key for the row's label, in place of the registry label. */\n readonly labelKey?: string;\n /** A translation key for the shortcut shown at the end of the row. */\n readonly shortcutKey?: string;\n /** In place of the registry icon: a Material Symbol name, or icon content (an element). */\n readonly icon?: ReactNode;\n /** A class name added to the row. */\n readonly className?: string;\n /** Remove the row. Its command keeps working elsewhere. */\n readonly hidden?: boolean;\n}\n\n/** A named menu row: a `Menu.Item` with its slot pinned. @public */\nexport interface MenuRowPartComponent {\n (props: MenuRowPartProps): ReactNode;\n /** The registry row the part stands for. */\n readonly pptxMenuRow: MenuNamedRow;\n}\n\n/**\n * A named row, after DOCX Editor's `defineCommandRow`: a `Menu.Item` with its slot and value\n * pinned, and the row as a static (`pptxMenuRow`), so a menu finds it among its children.\n * @internal\n */\nexport function defineMenuRowPart(row: MenuNamedRow): MenuRowPartComponent {\n const Part = ({ label, labelKey, ...rest }: MenuRowPartProps): ReactNode => (\n <MenuSlotItem\n {...rest}\n slotId={row.slot}\n {...(row.value !== undefined ? { value: row.value } : {})}\n {...((label ?? labelKey) !== undefined ? { labelKey: label ?? labelKey } : {})}\n />\n );\n return Object.assign(Part, { pptxMenuRow: row });\n}\n\n/** The named rows of `table`, by name. @internal */\nexport function defineMenuRowParts<K extends string>(\n table: Readonly<Record<K, MenuNamedRow>>\n): Record<K, MenuRowPartComponent> {\n return Object.fromEntries(\n Object.entries<MenuNamedRow>(table).map(([name, row]) => [name, defineMenuRowPart(row)])\n ) as Record<K, MenuRowPartComponent>;\n}\n\n/**\n * The registry row a menu child names: a `Menu.Item`, or a named row with its row pinned. Null\n * for any other child. @internal\n */\nexport function menuSlotRowOf(node: ReactNode): MenuSlotItemProps | null {\n if (!isValidElement<NodeProps>(node)) return null;\n if (node.type === MenuSlotItem) return node.props as unknown as MenuSlotItemProps;\n const row = (node.type as { pptxMenuRow?: MenuNamedRow } | null)?.pptxMenuRow;\n if (!row) return null;\n return {\n ...(node.props as unknown as MenuRowPartProps),\n slotId: row.slot,\n ...(row.value !== undefined ? { value: row.value } : {}),\n };\n}\n\n/** The named rows of the menu bar, from core's table. */\nconst MENU_ROW_PARTS = defineMenuRowParts(MENU_NAMED_PARTS);\n\n/** Props for `Menu.Group`. @public */\nexport interface MenuGroupProps {\n /** A heading shown above the rows. Wins over `labelKey`. */\n readonly label?: string;\n /** A translation key for the heading. */\n readonly labelKey?: string;\n /** A class name added to the group. */\n readonly className?: string;\n /** Remove the group and its rows. */\n readonly hidden?: boolean;\n /** The group's rows. */\n readonly children?: ReactNode;\n}\n\n/** A labeled set of rows inside a menu. @public */\nexport function MenuGroup({ label, labelKey, className, hidden, children }: MenuGroupProps) {\n const { t } = useTranslation();\n if (hidden) return null;\n const heading = label ?? (labelKey ? translateKeyOrText(t, labelKey) : undefined);\n return (\n <div\n role=\"group\"\n aria-label={heading}\n className={['pptx-menu__group', className].filter(Boolean).join(' ')}\n >\n {heading ? (\n <div className=\"pptx-menu__heading\" aria-hidden=\"true\">\n {heading}\n </div>\n ) : null}\n {children}\n </div>\n );\n}\n\n/** Props for `Menu.Entry` and the named menus (`Menu.File`, …). @public */\nexport interface MenuEntryProps {\n /** A built-in menu id changes that menu; any other id adds a host menu. */\n readonly id: ChromeMenuId | (string & {});\n /** The menu's title. Wins over `labelKey`. Built-in menus keep their own title without it. */\n readonly label?: string;\n /** A translation key for the menu's title. */\n readonly labelKey?: string;\n /** Icon content before the title. */\n readonly icon?: ReactNode;\n /** A class name added to the menu's panel. */\n readonly className?: string;\n /** Remove the menu from the bar. */\n readonly hidden?: boolean;\n /**\n * `true` (default): the built-in rows, with `Menu.Item` children replacing their rows in\n * place and other children added at the end. `false`: only the children.\n */\n readonly preset?: boolean;\n /** For a host menu: the menu it follows. Without it, host menus follow the built-in ones. */\n readonly after?: ChromeMenuId | (string & {});\n /** The menu's rows: `Menu.Item` children change built-in rows; others add rows. */\n readonly children?: ReactNode;\n}\n\n/**\n * One menu of the bar. Inside `PptxEditor.Menu` it is a description the bar reads; the bar\n * renders it. @public\n */\nexport function MenuEntry(_props: MenuEntryProps): ReactNode {\n // `PptxEditor.Menu` reads its entries' props; rendered anywhere else, an entry says so.\n warnMenuPart('Menu.Entry', 'outsideBar');\n return null;\n}\n\n/** A named menu: a `Menu.Entry` with its id pinned. @public */\nexport interface MenuPartComponent {\n /** Changes the built-in menu the part stands for, as a `Menu.Entry` with its id. */\n (props: Omit<MenuEntryProps, 'id'>): ReactNode;\n /** The menu the part stands for. */\n readonly pptxMenu: ChromeMenuId;\n}\n\nfunction defineMenu(id: ChromeMenuId): MenuPartComponent {\n const Part = (_props: Omit<MenuEntryProps, 'id'>): ReactNode => {\n warnMenuPart(`Menu.${id[0]!.toUpperCase()}${id.slice(1)}`, 'outsideBar');\n return null;\n };\n return Object.assign(Part, { pptxMenu: id });\n}\n\n/** The named menus. */\nconst MENU_PARTS = {\n File: defineMenu('file'),\n Edit: defineMenu('edit'),\n View: defineMenu('view'),\n Insert: defineMenu('insert'),\n Format: defineMenu('format'),\n Arrange: defineMenu('arrange'),\n SlideShow: defineMenu('slideShow'),\n} as const;\n\ntype NodeProps = Record<string, unknown> & { children?: ReactNode };\n\n/** The direct children of `nodes`, with fragments opened. */\nconst flatten = (nodes: ReactNode): ReactNode[] =>\n Children.toArray(nodes).flatMap((node) =>\n isValidElement<NodeProps>(node) && node.type === Fragment\n ? flatten(node.props.children)\n : [node]\n );\n\n/** The menu a child describes: `Menu.Entry`, or a named menu with its pinned id. */\nfunction entryOf(node: ReactNode): MenuEntryProps | null {\n if (!isValidElement<NodeProps>(node)) return null;\n const pinned = (node.type as { pptxMenu?: ChromeMenuId } | null)?.pptxMenu;\n if (pinned) return { ...(node.props as Omit<MenuEntryProps, 'id'>), id: pinned };\n return node.type === MenuEntry ? (node.props as unknown as MenuEntryProps) : null;\n}\n\n/** One menu as the bar draws it. */\ninterface BarMenu {\n readonly id: string;\n readonly title: string;\n readonly icon?: ReactNode;\n readonly className?: string;\n readonly content: ReactNode;\n}\n\n/** The rows of a built-in menu after the host's children. */\nfunction builtInRows(menu: ChromeMenu, spec: MenuEntryProps | undefined): ReactNode {\n if (spec?.preset === false) return spec.children;\n const { entries, overrides, extras } = arrangeMenuRows(\n menu.entries,\n flatten(spec?.children),\n menuSlotRowOf,\n // A hidden row this menu does not have removes nothing, and says so.\n (slot) => warnMenuPart(`${menuPartName(menu.id)} > Menu.Item`, 'unmatchedHidden', slot)\n );\n return (\n <>\n <MenuEntries entries={entries} overrides={overrides} />\n {extras}\n </>\n );\n}\n\n/** Props for `PptxEditor.Menu`. @public */\nexport interface MenuProps {\n /**\n * Your translation function for this compound and its parts, as DOCX Editor's `t`. Without\n * it, the root's `locale` gives the labels.\n */\n readonly t?: ChromeTranslate;\n /** A class name added to the bar. */\n readonly className?: string;\n /**\n * `true` (default): the built-in menus, changed by named menu and `Menu.Entry` children;\n * other children follow the menus. `false`: only the children.\n */\n readonly preset?: boolean;\n /** Named menus and `Menu.Entry` children, and other content after the menus. */\n readonly children?: ReactNode;\n}\n\n/**\n * The menu bar: File, Edit, View, Insert, Format, Arrange, and Slide Show, from core's\n * `CHROME_MENUS`. Every row runs a registered slot, so its state and action are the toolbar's.\n *\n * @example\n * ```tsx\n * <PptxEditor.Menu>\n * <PptxEditor.Menu.File>\n * <PptxEditor.Menu.Row label=\"Open…\" icon=\"folder_open\" onSelect={openFile} />\n * </PptxEditor.Menu.File>\n * <PptxEditor.Menu.Edit>\n * <PptxEditor.Menu.Item slotId=\"more.delete\" hidden />\n * </PptxEditor.Menu.Edit>\n * <PptxEditor.Menu.Arrange hidden />\n * </PptxEditor.Menu>\n * ```\n *\n * @public\n */\nexport function Menu({ className, preset = true, children }: MenuProps): ReactNode {\n const { t } = useTranslation();\n const specs = new Map<string, MenuEntryProps>();\n const loose: ReactNode[] = [];\n for (const child of flatten(children)) {\n const spec = entryOf(child);\n if (spec) specs.set(spec.id, spec);\n else loose.push(child);\n }\n // With `preset={false}`, a named built-in menu still brings its title and rows, as in DOCX\n // Editor; `Menu.Entry preset={false}` keeps only its children.\n const menus: BarMenu[] = arrangeMenuBar(specs, preset, t).map(\n ({ id, title, spec, registry }) => ({\n id,\n title,\n ...(spec?.icon !== undefined ? { icon: spec.icon } : {}),\n ...(spec?.className ? { className: spec.className } : {}),\n content: registry ? builtInRows(registry, spec) : spec?.children,\n })\n );\n return <MenuBar className={className} menus={menus} extras={loose} />;\n}\n\nfunction MenuBar({\n className,\n menus,\n extras,\n}: {\n className: string | undefined;\n menus: readonly BarMenu[];\n extras: readonly ReactNode[];\n}): ReactNode {\n const { t } = useTranslation();\n const [open, setOpen] = useState<string | null>(null);\n // Roving tab stop, as DOCX Editor's menu bar: the bar is one Tab stop, the arrows move.\n const [active, setActive] = useState<string | null>(null);\n const stop = menus.some((m) => m.id === active) ? active : (menus[0]?.id ?? null);\n const triggers = useRef(new Map<string, HTMLButtonElement>());\n // Set when hover switched the bar to a menu: the click that follows must not close it\n // (DOCX Editor's `switchedByHover`).\n const switchedByHover = useRef(false);\n // A pointer open puts focus on the trigger so the arrow keys reach the menu; closing gives\n // focus back to where it was (the slide's text input, the slide), as the context menu does\n // and as DOCX Editor keeps pointer focus. A keyboard open, and Escape, return to the trigger.\n const restoreTo = useRef<HTMLElement | null>(null);\n const bar = useRef<HTMLDivElement>(null);\n const close = useCallback(() => setOpen(null), []);\n useEffect(() => {\n if (open !== null) return;\n const target = restoreTo.current;\n restoreTo.current = null;\n // Focus that a row moved on purpose (a dialog, the find bar, the link popup) stays there.\n if (target && menuBarRestoresFocus(target, bar.current)) target.focus({ preventScroll: true });\n }, [open]);\n const step = (from: string, by: -1 | 1, keepOpen: boolean): void => {\n const index = menus.findIndex((m) => m.id === from);\n const next = menus[(index + by + menus.length) % menus.length];\n if (!next) return;\n setActive(next.id);\n // The trigger takes focus first, so an open popover moves focus to its first row.\n triggers.current.get(next.id)?.focus();\n if (keepOpen) setOpen(next.id);\n };\n const rtl = (): boolean => {\n const first = triggers.current.values().next().value;\n return !!first && getComputedStyle(first).direction === 'rtl';\n };\n const onTriggerKey = (id: string, e: ReactKeyboardEvent): void => {\n const action = menuBarTriggerKey(e.key, rtl());\n if (!action) return;\n e.preventDefault();\n if (action.kind === 'step') step(id, action.by, open !== null);\n else if (action.kind === 'open') {\n setActive(id);\n setOpen(id);\n } else {\n const target = action.edge === 'first' ? menus[0] : menus[menus.length - 1];\n if (!target) return;\n setActive(target.id);\n triggers.current.get(target.id)?.focus();\n }\n };\n const onPanelKey = (id: string, e: ReactKeyboardEvent): void => {\n const by = menuBarArrow(e.key, rtl());\n if (!by) return;\n e.preventDefault();\n step(id, by, true);\n };\n return (\n <div\n ref={bar}\n role=\"menubar\"\n aria-label={t('menu.ariaLabel')}\n className={['pptx-menubar', className].filter(Boolean).join(' ')}\n >\n {menus.map((menu) => (\n <Fragment key={menu.id}>\n <button\n ref={(el) => {\n if (el) triggers.current.set(menu.id, el);\n else triggers.current.delete(menu.id);\n }}\n type=\"button\"\n role=\"menuitem\"\n className=\"pptx-menubar__trigger\"\n aria-haspopup=\"menu\"\n aria-expanded={open === menu.id}\n tabIndex={stop === menu.id ? 0 : -1}\n data-menu={menu.id}\n onMouseDown={keepFocus}\n onFocus={() => setActive(menu.id)}\n onKeyDown={(e) => onTriggerKey(menu.id, e)}\n onMouseEnter={() => {\n if (open !== null && open !== menu.id) {\n switchedByHover.current = true;\n setActive(menu.id);\n // Focus follows the open menu, so the old panel's cleanup cannot pull it back.\n triggers.current.get(menu.id)?.focus({ preventScroll: true });\n setOpen(menu.id);\n }\n }}\n onMouseLeave={() => (switchedByHover.current = false)}\n onClick={() => {\n if (switchedByHover.current) {\n switchedByHover.current = false;\n return;\n }\n setActive(menu.id);\n const trigger = triggers.current.get(menu.id);\n if (open === null) {\n const active = trigger?.ownerDocument.activeElement;\n restoreTo.current =\n active instanceof HTMLElement && active !== active.ownerDocument.body\n ? active\n : null;\n }\n // A pointer open puts focus on the trigger, so the arrow keys reach the menu\n // instead of moving a shape on the slide (the popover then focuses its first row).\n trigger?.focus({ preventScroll: true });\n setOpen((cur) => (cur === menu.id ? null : menu.id));\n }}\n >\n {/* The same icon rule as the rows: a string is a Material Symbol name. */}\n {typeof menu.icon === 'string' ? <Icon name={menu.icon} /> : (menu.icon ?? null)}\n {menu.title}\n </button>\n {open === menu.id ? (\n <Popover\n anchor={triggers.current.get(menu.id) ?? null}\n onClose={() => {\n // Escape leaves focus on the menubar item, not on the slide (WAI-ARIA menubar).\n if (menuBarClosedOnEscape(triggers.current.get(menu.id))) restoreTo.current = null;\n close();\n }}\n label={menu.title}\n >\n <MenuCloseContext.Provider value={close}>\n <div\n className={['pptx-menubar__panel', menu.className].filter(Boolean).join(' ')}\n data-menu={menu.id}\n onKeyDown={(e) => onPanelKey(menu.id, e)}\n >\n {menu.content}\n </div>\n </MenuCloseContext.Provider>\n </Popover>\n ) : null}\n </Fragment>\n ))}\n {extras}\n </div>\n );\n}\n\nexport { MENU_PARTS, MENU_ROW_PARTS };\n","/** @jsxImportSource react */\n// View > Slide Sorter: every slide as a thumbnail in a grid, grouped by section, as a\n// Slide Sorter view shows them. Click, Shift+click, and Ctrl/Cmd+click select slides; a drag\n// moves the selection; Delete, Ctrl/Cmd+D, and the context menu act on it; a double-click or\n// Enter opens the slide in the Normal view. Every edit goes through the same commands as the\n// rail, so it is one undo step.\n\nimport { useEffect, useRef, useState, type KeyboardEvent, type ReactNode } from 'react';\nimport {\n chromeControlForSlot,\n focusSorterOnShow,\n tooltipAttributes,\n groupSlideSections,\n focusCurrentSlideOrCanvas,\n openSlideInNormalView,\n sectionOfSlide,\n slideMenuPoint,\n slideSorterMounted,\n sorterKeyDown,\n translateKeyOrText,\n warnSlideSorterUnmounted,\n type SlideSummary,\n} from '@pptx-editor.dev/core/editor';\nimport { useEditorDialog } from './popups.tsx';\nimport { useEditorCommand, useEditorState, usePptxEditor, useTranslation } from './context.ts';\nimport { Icon, keepFocus, useAriaDisabled } from './chrome.tsx';\nimport { clickMode, Thumbnail, useFocusFollowsCurrent, ZoomPill } from './panes.tsx';\nimport { RailMenuHost, useSlideStep, type RailMenuState } from './RailContextMenu.tsx';\nimport {\n SectionNode,\n useCollapsedSections,\n useFocusAfterCollapse,\n useFocusCurrentAfterRender,\n useOpenCurrentSection,\n useSectionRenameRequests,\n useSlideSections,\n useSorterRegistration,\n} from './RailSections.tsx';\nimport { useSlideDrag } from './slide-drag.ts';\nimport { EditNotice } from './EditNotice.tsx';\n\nconst sameList = <T,>(a: readonly T[], b: readonly T[]): boolean =>\n a.length === b.length && a.every((v, i) => v === b[i]);\n\n/** Props of {@link SlideSorter}. @public */\nexport interface SlideSorterProps {\n /** A class name added to the sorter. */\n readonly className?: string;\n}\n\n/**\n * The slide sorter. Put it where the slide and the rail go in the Normal view, while\n * `snapshot().presentationView` is `slideSorter`. When the view becomes `slideSorter` and no\n * sorter of the editor is mounted, a development warning says so. @public\n */\nexport function SlideSorter({ className }: SlideSorterProps = {}) {\n const editor = usePptxEditor();\n const { t } = useTranslation();\n const slides = useEditorState((s) => s.slides, sameList);\n const current = useEditorState((s) => s.currentSlide);\n const selected = useEditorState((s) => s.selectedSlides, sameList);\n const ratio = useEditorState((s) => s.slideHeight / s.slideWidth);\n const readOnly = useEditorState((s) => s.mode === 'view');\n const sections = useSlideSections();\n const grouped = groupSlideSections(sections, slides.length);\n const collapsed = useCollapsedSections();\n useOpenCurrentSection(grouped);\n useSorterRegistration();\n const list = useRef<HTMLOListElement>(null);\n const { itemProps: dragProps } = useSlideDrag('x', selected, readOnly, grouped);\n const [menu, setMenu] = useState<RailMenuState | null>(null);\n const [renaming, setRenaming] = useState<string | null>(null);\n // The sorter renames in place, also while it is flat: Add Section in a deck without sections\n // asks for the name before the new header renders. The id waits in `renaming` until the\n // header mounts with its field.\n useSectionRenameRequests(setRenaming);\n const focusCurrent = useFocusCurrentAfterRender(list);\n useFocusAfterCollapse(list, collapsed);\n // Shown from a menu, the sorter takes focus on the current slide (core's `focusSorterOnShow`),\n // after the hooks above listen for focus.\n useEffect(() => (list.current ? focusSorterOnShow(list.current) : undefined), []);\n // Tab goes to the current slide, or to its section's header when that section is shut.\n const own = sectionOfSlide(grouped, current);\n const shut = !!own && collapsed.includes(own.id);\n const background = useEditorDialog('background');\n const count = slides.length;\n const stepTo = useSlideStep(selected, count);\n // Keyboard focus follows the current slide while a tile has it (after Ctrl+D, a drop, a\n // Delete of the last tile).\n const trackFocus = useFocusFollowsCurrent(list, '.pptx-sorter__item', current, count);\n\n /** Open slide `index` in the Normal view. */\n const openSlide = (index: number): void => openSlideInNormalView(editor, index, list.current);\n const openMenu = (index: number, item: HTMLElement, at: { x: number; y: number } | null) => {\n if (!editor) return;\n if (!editor.snapshot().selectedSlides.includes(index)) editor.selectSlide(index);\n setMenu({ at: slideMenuPoint(item, at), index, keyboard: !at, owner: item });\n };\n /** The sorter's keys (core's `sorterKeyDown`). */\n const onKeyDown = (e: KeyboardEvent): void =>\n sorterKeyDown(e, {\n editor,\n readOnly,\n selected,\n current,\n count,\n grouped,\n list: list.current,\n step: stepTo,\n openMenu: (index, item) => openMenu(index, item, null),\n focusCurrent,\n openSlide,\n });\n\n const item = (s: SlideSummary): ReactNode => (\n <li\n key={s.index}\n className=\"pptx-sorter__item\"\n role={grouped ? 'treeitem' : 'option'}\n aria-selected={selected.includes(s.index)}\n aria-current={s.index === current}\n aria-label={t(s.hidden ? 'rail.hiddenSlideLabel' : 'rail.slideLabel', {\n index: s.index + 1,\n })}\n data-hidden={s.hidden ? '' : undefined}\n data-index={s.index}\n {...dragProps(s.index)}\n tabIndex={s.index === current && !shut ? 0 : -1}\n onClick={(e) => {\n e.currentTarget.focus({ preventScroll: true });\n editor?.selectSlide(s.index, clickMode(e));\n }}\n onDoubleClick={() => openSlide(s.index)}\n onContextMenu={(e) => {\n e.preventDefault();\n const pointer = e.clientX !== 0 || e.clientY !== 0;\n openMenu(s.index, e.currentTarget, pointer ? { x: e.clientX, y: e.clientY } : null);\n }}\n >\n <Thumbnail slide={s} ratio={ratio} />\n <span className=\"pptx-sorter__number\">{s.index + 1}</span>\n </li>\n );\n\n return (\n <section\n className={['pptx-sorter', className].filter(Boolean).join(' ')}\n aria-label={t('sorter.ariaLabel')}\n >\n <ol\n ref={list}\n className=\"pptx-sorter__list\"\n role={grouped ? 'tree' : 'listbox'}\n aria-multiselectable=\"true\"\n aria-label={t('sorter.ariaLabel')}\n onKeyDown={onKeyDown}\n onFocus={trackFocus}\n >\n {grouped ? (\n grouped.map((sec) => (\n <SectionNode\n key={sec.id}\n section={sec}\n collapsed={collapsed.includes(sec.id)}\n renaming={renaming === sec.id}\n variant=\"sorter\"\n focusable={shut && own?.id === sec.id}\n onRename={() => setRenaming(sec.id)}\n onRenameEnd={() => setRenaming(null)}\n onRemoved={focusCurrent}\n >\n {slides.slice(sec.firstSlide, sec.firstSlide + sec.slideCount).map(item)}\n </SectionNode>\n ))\n ) : (\n <li role=\"presentation\" className=\"pptx-sorter__section\">\n <ol role=\"group\" className=\"pptx-sorter__grid\">\n {slides.map(item)}\n </ol>\n </li>\n )}\n </ol>\n <RailMenuHost\n open={\n menu\n ? {\n menu,\n onClose: () => setMenu(null),\n onSectionAdded: (id: string) => setRenaming(id),\n ...(background.isAvailable\n ? { onBackground: () => background.open(menu.owner) }\n : {}),\n }\n : null\n }\n />\n </section>\n );\n}\n\n/**\n * Normal and Slide Sorter as two buttons, as in a status bar: the default editor's\n * view switch, a one-of-two choice (`radiogroup`). Hosts place the `view.presentationView` slot\n * instead. @internal\n */\nexport function ViewSwitch() {\n const { t } = useTranslation();\n const cmd = useEditorCommand('view.presentationView');\n const options = chromeControlForSlot('view.presentationView')?.options ?? [];\n const off = !cmd.isEnabled;\n const reason = cmd.disabledReason ? translateKeyOrText(t, cmd.disabledReason) : null;\n // Off stays focusable, with the reason as its description.\n const offAttrs = useAriaDisabled(off, reason);\n const pick = (e: KeyboardEvent<HTMLElement>, step: number): void => {\n if (off) return;\n const at = options.findIndex((o) => o.value === cmd.value);\n const next = options[(at + step + options.length) % options.length];\n if (!next) return;\n cmd.execute(next.value);\n const buttons = e.currentTarget.parentElement?.querySelectorAll<HTMLElement>('[role=\"radio\"]');\n buttons?.[options.indexOf(next)]?.focus();\n };\n return (\n <div\n className=\"pptx-zoom pptx-view-switch\"\n role=\"radiogroup\"\n aria-label={t('toolbar.presentationView')}\n onMouseDown={keepFocus}\n >\n {options.map((o) => {\n const on = cmd.value === o.value;\n const label = t(o.labelKey);\n return (\n <button\n key={o.value}\n type=\"button\"\n role=\"radio\"\n aria-checked={on}\n aria-label={label}\n {...offAttrs.attrs}\n {...tooltipAttributes(label, off, reason)}\n tabIndex={on ? 0 : -1}\n className=\"pptx-toolbar__button pptx-view-switch__option\"\n data-active={on ? '' : undefined}\n data-disabled={off ? '' : undefined}\n onClick={() => !off && cmd.execute(o.value)}\n onKeyDown={(e) => {\n const step = { ArrowLeft: -1, ArrowUp: -1, ArrowRight: 1, ArrowDown: 1 }[e.key];\n if (!step) return;\n e.preventDefault();\n pick(e, step);\n }}\n >\n <Icon paths={o.paths ?? null} />\n </button>\n );\n })}\n {offAttrs.note}\n </div>\n );\n}\n\n/**\n * The default editor's workspace: `normal` (the rail, the slide, and the notes) in the Normal\n * view, the slide sorter in the Slide Sorter view. `status` (by default the view switch and the\n * zoom) stays mounted at the bottom right in both, so a view switch keeps the focus it has. When\n * the view changes and focus was in the part that went away, focus goes to the current slide in\n * the new view. `overlay` (the open-failure notice) shows over both views. @internal\n */\nexport function DefaultWorkspace({\n normal,\n status,\n overlay,\n}: {\n normal: ReactNode;\n status?: ReactNode;\n overlay?: ReactNode;\n}) {\n const editor = usePptxEditor();\n const view = useEditorState((s) => s.presentationView ?? 'normal');\n const box = useRef<HTMLDivElement>(null);\n const was = useRef(view);\n useEffect(() => {\n if (was.current === view) return;\n was.current = view;\n const active = box.current?.ownerDocument.activeElement;\n if (active && active !== active.ownerDocument.body && active.isConnected) return;\n focusCurrentSlideOrCanvas(box.current, editor);\n }, [view, editor]);\n return (\n <div ref={box} className=\"pptx-default__views\">\n {view === 'slideSorter' ? (\n <div className=\"pptx-default__workspace\">\n <div className=\"pptx-default__main\">\n <SlideSorter />\n <EditNotice />\n </div>\n </div>\n ) : (\n normal\n )}\n {overlay}\n {status === undefined ? (\n <div className=\"pptx-statusbar\">\n <ViewSwitch />\n <ZoomPill />\n </div>\n ) : (\n status\n )}\n </div>\n );\n}\n\n/**\n * Warns in development when the view becomes Slide Sorter and no slide sorter of the editor is\n * mounted. `PptxEditor.Root` renders it after its children, so a sorter that mounts with the\n * view change counts. @internal\n */\nexport function SlideSorterWatch(): null {\n const editor = usePptxEditor();\n const sorter = useEditorState((s) => s.presentationView === 'slideSorter');\n useEffect(() => {\n if (sorter && editor && !slideSorterMounted(editor)) warnSlideSorterUnmounted();\n }, [sorter, editor]);\n return null;\n}\n","/** @jsxImportSource react */\n// The slide rail, speaker notes, zoom pill, and side panel. Each is a hook consumer over the\n// editor; none holds document state of its own.\n\nimport type { ChromeTranslate } from '@pptx-editor.dev/core/editor';\nimport {\n memo,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties,\n type FocusEvent,\n type KeyboardEvent,\n type ReactNode,\n type RefObject,\n} from 'react';\nimport {\n ZOOM_MENU_LEVELS,\n tooltipAttributes,\n followCurrentSlide,\n groupSlideSections,\n keepCurrentSlideInView,\n radioGroupStep,\n railDragAxis,\n railKeyDown,\n railOrientationChrome,\n railRightToLeft,\n watchRailFold,\n resolveRailOrientation,\n runSlideStep,\n sectionOfSlide,\n slideClickMode,\n slideMenuPoint,\n stepCommand,\n zoomStep,\n zoomLimitReason,\n elementKindLabelKey,\n platformShortcuts,\n type SlideRailOrientation,\n type SlideSummary,\n} from '@pptx-editor.dev/core/editor';\nimport type { TranslationKey } from '@pptx-editor.dev/i18n';\nimport { Icon, MenuItem, Popover, ToolButton, keepFocus, useAriaDisabled } from './chrome.tsx';\nimport { useEditorDialog } from './popups.tsx';\nimport { RailMenuHost, useSlideStep, type RailMenuState } from './RailContextMenu.tsx';\nimport {\n RailActionsContext,\n railActionContent,\n railExpandContent,\n type RailActions,\n} from './rail-parts.tsx';\nimport { useSlideDrag } from './slide-drag.ts';\nimport { LayoutGallery } from './SlideControls.tsx';\nimport {\n SectionNode,\n useCollapsedSections,\n useFocusAfterCollapse,\n useFocusCurrentAfterRender,\n useOpenCurrentSection,\n useSectionRenameRequests,\n useSlideSections,\n} from './RailSections.tsx';\nimport { useEditorState, usePptxEditor, useTranslation } from './context.ts';\n\n/** The side panel's tabs, in order. */\nconst PANEL_TABS = ['format', 'comments'] as const;\n\nconst sameSlides = (a: readonly SlideSummary[], b: readonly SlideSummary[]): boolean =>\n a.length === b.length && a.every((s, i) => s === b[i]);\nconst sameIndices = (a: readonly number[], b: readonly number[]): boolean =>\n a.length === b.length && a.every((v, i) => v === b[i]);\n\n/** How a click selects slides: Shift+click a range, Ctrl/Cmd+click one more or one less. */\nexport const clickMode = slideClickMode;\n\n/** A slide thumbnail, repainted only when its slide renders differently. @internal */\nexport const Thumbnail = memo(function Thumbnail({\n slide,\n ratio,\n}: {\n slide: SlideSummary;\n ratio: number;\n}) {\n const editor = usePptxEditor();\n const box = useRef<HTMLDivElement>(null);\n useEffect(() => {\n if (editor && box.current) editor.renderThumbnail(slide.index, box.current);\n }, [editor, slide]);\n return <div ref={box} className=\"pptx-rail__thumb\" style={{ aspectRatio: String(1 / ratio) }} />;\n});\n\n/**\n * Keyboard focus follows the current slide of a slide list (the rail, the slide sorter) while\n * one of its items `item` has focus. When the focused item goes away (Delete on the last\n * slide, an undo that removes one), focus goes to the current item too, so the next key still\n * acts on the list. Returns the list's `onFocus` handler.\n */\nexport function useFocusFollowsCurrent(\n list: RefObject<HTMLElement | null>,\n item: string,\n current: number,\n count: number,\n shown = true\n): (e: FocusEvent) => void {\n const focused = useRef<HTMLElement | null>(null);\n useEffect(() => {\n followCurrentSlide(list.current, item, focused.current);\n }, [list, item, current, count, shown]);\n return (e) => {\n focused.current = (e.target as HTMLElement).closest?.<HTMLElement>(item) ?? null;\n };\n}\n\n/**\n * Props of the editor's panes, after DOCX Editor's `Navigation` (`open`, `onOpenChange`,\n * `paneWidth`). A pane given `open` is controlled by the host. @public\n */\nexport interface PaneProps {\n /** A class name added to the pane. */\n readonly className?: string;\n /** Whether the pane is open, controlled. Use with `onOpenChange`. */\n readonly open?: boolean;\n /** Whether the pane is open first, uncontrolled. Default `true`. */\n readonly defaultOpen?: boolean;\n /** Called when the user opens or closes the pane. */\n readonly onOpenChange?: (open: boolean) => void;\n /** The pane's width in CSS pixels (the slide rail). */\n readonly paneWidth?: number;\n /** Inline styles for the pane, after DOCX Editor's `Navigation`; a `width` here wins over `paneWidth`. */\n readonly style?: CSSProperties;\n}\n\n/** Props of `SlideRail`: the pane props, DOCX Editor's `toggle`, and `orientation`. @public */\nexport interface SlideRailProps extends PaneProps {\n /**\n * Your translation function for this compound and its parts, as DOCX Editor's `t`. Without\n * it, the root's `locale` gives the labels.\n */\n readonly t?: ChromeTranslate;\n /**\n * Where the rail runs. `vertical` (the default) is a column beside the slide. `horizontal` is\n * a row under it, for a tall, narrow host: the thumbnails scroll sideways, Left and Right\n * step, a drag reorders along the row, and Hide thumbnails folds the rail down.\n */\n readonly orientation?: SlideRailOrientation;\n /**\n * The built-in Hide thumbnails and Show thumbnails buttons. `false` removes them, for a host\n * that opens and closes the rail from its own chrome (`open`, `onOpenChange`).\n */\n readonly toggle?: boolean;\n /**\n * `true` (default): the packaged action buttons, with named part children\n * (`SlideRail.AddSlide`, `SlideRail.Delete`, …) in their places and other children after\n * Delete. `false`: only the children, in their order.\n */\n readonly preset?: boolean;\n /** Named part children replace their buttons; other children go after **Delete**. */\n readonly children?: ReactNode;\n}\n\n/** The grid columns of a horizontal rail's two action rows (`--pptx-rail-action-columns`). */\nfunction actionColumns(shown: number): CSSProperties {\n return {\n '--pptx-rail-action-columns': String(Math.max(1, Math.ceil(shown / 2))),\n } as CSSProperties;\n}\n\n/** The collapsed rail strip keeps the host's styles but not a width: it stays a narrow strip. */\nfunction stripStyle(style: CSSProperties | undefined): CSSProperties | undefined {\n if (!style || style.width === undefined) return style;\n const { width: _width, ...rest } = style;\n return rest;\n}\n\n/** A pane's inline style: its width from `paneWidth`, then the host's own styles. */\nfunction paneStyle(width: number | undefined, style: CSSProperties | undefined) {\n if (width === undefined) return style;\n return { width, ...style };\n}\n\n/** Open state of a pane: controlled by `open`, else its own. */\nfunction usePaneOpen(props: PaneProps) {\n const [own, setOwn] = useState(props.defaultOpen ?? true);\n const open = props.open ?? own;\n const setOpen = (next: boolean): void => {\n if (props.open === undefined) setOwn(next);\n props.onOpenChange?.(next);\n };\n return [open, setOpen] as const;\n}\n\n/**\n * The slide thumbnail rail with drag-to-reorder. Its last button hides it to a narrow strip\n * with a button that shows it again. @public\n */\nexport function SlideRail(props: SlideRailProps = {}) {\n const [open, setPaneOpen] = usePaneOpen(props);\n const toggle = props.toggle !== false;\n const rail = useRef<HTMLElement>(null);\n const listId = useId();\n // A toggle unmounts its own button: focus moves to the other toggle, never to the page.\n const focusToggle = useRef(false);\n const setOpen = (next: boolean): void => {\n focusToggle.current = rail.current?.contains(document.activeElement) ?? false;\n setPaneOpen(next);\n };\n const editor = usePptxEditor();\n const { t } = useTranslation();\n const slides = useEditorState((s) => s.slides, sameSlides);\n const current = useEditorState((s) => s.currentSlide);\n const selected = useEditorState((s) => s.selectedSlides, sameIndices);\n const ratio = useEditorState((s) => s.slideHeight / s.slideWidth);\n const readOnly = useEditorState((s) => s.mode === 'view');\n const list = useRef<HTMLOListElement>(null);\n const count = slides.length;\n const [menu, setMenu] = useState<RailMenuState | null>(null);\n const [gallery, setGallery] = useState<HTMLElement | null>(null);\n const actions = useRef<HTMLDivElement>(null);\n const sections = useSlideSections();\n // Sections group the rail when they cover every slide in order; otherwise it stays flat.\n const grouped = groupSlideSections(sections, count);\n const orientation = resolveRailOrientation(props.orientation, 'PptxEditor.SlideRail');\n // A right-to-left row mirrors the move buttons, as its arrow keys do. The direction comes\n // from the mounted rail, so it is read after the rail mounts or changes.\n const [rightToLeft, setRightToLeft] = useState(false);\n useLayoutEffect(() => setRightToLeft(railRightToLeft(rail.current)), [orientation, open]);\n const chrome = railOrientationChrome(orientation, rightToLeft);\n // A narrow horizontal rail (a phone) folds its secondary actions into one menu.\n const [folded, setFolded] = useState(false);\n useEffect(() => watchRailFold(rail.current, orientation, setFolded), [orientation, open]);\n const { itemProps: dragProps, cancel: cancelDrag } = useSlideDrag(\n railDragAxis(orientation),\n selected,\n readOnly,\n grouped\n );\n const collapsed = useCollapsedSections();\n const [renaming, setRenaming] = useState<string | null>(null);\n useOpenCurrentSection(grouped);\n // An open rail renames in place, also while it is flat: Add Section in a deck without sections\n // asks for the name before the new header renders. The id waits in `renaming` until the\n // header mounts with its field. A closed rail has no header, so it does not count.\n useSectionRenameRequests(setRenaming, open);\n const focusCurrent = useFocusCurrentAfterRender(list);\n useFocusAfterCollapse(list, collapsed);\n const background = useEditorDialog('background');\n const stepTarget = useSlideStep(selected, count);\n /**\n * Open the context menu on slide `index`. A slide outside the selection becomes the\n * selection; a slide inside a multi-selection keeps it.\n */\n const openMenu = (index: number, item: HTMLElement, at: { x: number; y: number } | null) => {\n if (!editor) return;\n if (!editor.snapshot().selectedSlides.includes(index)) editor.selectSlide(index);\n setMenu({ at: slideMenuPoint(item, at), index, keyboard: at === null, owner: item });\n };\n const moveBy = (step: -1 | 1): void => {\n runSlideStep(editor, stepCommand(selected, stepTarget(step)));\n };\n const trackFocus = useFocusFollowsCurrent(list, '.pptx-rail__item', current, count, open);\n // A resize (a host narrowing the panel) keeps the current slide in view too.\n useEffect(() => keepCurrentSlideInView(list.current, '.pptx-rail__item'), [open]);\n /** Why the rail's slide buttons are off, or null when they work. */\n const why = !editor ? t('disabled.noEditor') : readOnly ? t('disabled.viewing') : null;\n useEffect(() => {\n // Only when the toggle's own unmount lost focus: a host that vetoed the change and closes\n // the rail later from its own chrome keeps its focus.\n const active = document.activeElement;\n const lost = !active || active === document.body || rail.current?.contains(active);\n if (focusToggle.current && lost)\n rail.current?.querySelector<HTMLElement>('.pptx-rail__collapse')?.focus();\n // A closed rail drops its open menu, drag, and rename.\n if (!open) {\n setMenu(null);\n cancelDrag();\n setRenaming(null);\n }\n }, [open, cancelDrag]);\n // A toggle the host refused leaves no flag behind for a later change to act on.\n useEffect(() => {\n focusToggle.current = false;\n });\n /** Slide shortcuts while the rail has focus (core's `railKeyDown`). */\n const onKeyDown = (e: KeyboardEvent): void =>\n railKeyDown(e, {\n editor,\n readOnly,\n selected,\n current,\n count,\n grouped,\n list: list.current,\n orientation,\n step: stepTarget,\n openMenu: (index, item) => openMenu(index, item, null),\n focusCurrent,\n });\n /** One slide of the rail. */\n const item = (s: SlideSummary) => (\n <li\n key={s.index}\n className=\"pptx-rail__item\"\n role={grouped ? 'treeitem' : 'option'}\n aria-selected={selected.includes(s.index)}\n aria-current={s.index === current}\n aria-label={t(s.hidden ? 'rail.hiddenSlideLabel' : 'rail.slideLabel', {\n index: s.index + 1,\n })}\n data-hidden={s.hidden ? '' : undefined}\n data-index={s.index}\n {...dragProps(s.index)}\n tabIndex={s.index === current ? 0 : -1}\n onClick={(e) => {\n e.currentTarget.focus({ preventScroll: true });\n editor?.selectSlide(s.index, clickMode(e));\n }}\n onContextMenu={(e) => {\n e.preventDefault();\n // A keyboard-opened menu reports no pointer position: open at the slide.\n const pointer = e.clientX !== 0 || e.clientY !== 0;\n openMenu(s.index, e.currentTarget, pointer ? { x: e.clientX, y: e.clientY } : null);\n }}\n >\n <span className=\"pptx-rail__number\">{s.index + 1}</span>\n <Thumbnail slide={s} ratio={ratio} />\n </li>\n );\n const railActions: RailActions = {\n t,\n editor,\n why,\n selected,\n count,\n chrome,\n step: stepTarget,\n moveBy,\n galleryOpen: !!gallery,\n // A second click closes the gallery, as the toolbar's menu buttons do.\n // In a folded rail, the gallery opens at the overflow button that held its row.\n toggleGallery: () =>\n setGallery((shown) =>\n shown\n ? null\n : (actions.current?.querySelector<HTMLElement>('.pptx-rail__layouts, .pptx-rail__more') ??\n null)\n ),\n listId,\n open,\n toggle,\n collapse: () => setOpen(false),\n expand: () => setOpen(true),\n };\n const { content: actionContent, shown } = railActionContent(\n props.children,\n props.preset !== false,\n toggle,\n folded\n );\n const className = ['pptx-rail', props.className].filter(Boolean).join(' ');\n // Closed with no toggle, the rail leaves the page: the host's chrome opens it again.\n if (!open && !toggle) return null;\n if (!open)\n return (\n <nav\n ref={rail}\n className={`${className} pptx-rail--collapsed`}\n aria-label={t('rail.ariaLabel')}\n data-open=\"false\"\n data-orientation={orientation}\n style={stripStyle(props.style)}\n onMouseDown={keepFocus}\n >\n <RailActionsContext.Provider value={railActions}>\n {railExpandContent(props.children)}\n </RailActionsContext.Provider>\n </nav>\n );\n return (\n <nav\n ref={rail}\n className={className}\n aria-label={t('rail.ariaLabel')}\n data-open=\"true\"\n data-orientation={orientation}\n style={paneStyle(props.paneWidth, props.style)}\n >\n <ol\n ref={list}\n id={listId}\n className=\"pptx-rail__list\"\n role={grouped ? 'tree' : 'listbox'}\n aria-multiselectable=\"true\"\n aria-orientation={orientation}\n aria-label={t('rail.ariaLabel')}\n onKeyDown={onKeyDown}\n onFocus={trackFocus}\n >\n {grouped\n ? grouped.map((sec) => {\n const shut = collapsed.includes(sec.id);\n return (\n <SectionNode\n key={sec.id}\n section={sec}\n collapsed={shut}\n renaming={renaming === sec.id}\n variant=\"rail\"\n // A collapsed section that holds the current slide takes Tab in its place.\n focusable={shut && sectionOfSlide(grouped, current)?.id === sec.id}\n onRename={() => setRenaming(sec.id)}\n onRenameEnd={() => setRenaming(null)}\n onRemoved={focusCurrent}\n >\n {slides.slice(sec.firstSlide, sec.firstSlide + sec.slideCount).map(item)}\n </SectionNode>\n );\n })\n : slides.map(item)}\n </ol>\n <RailActionsContext.Provider value={railActions}>\n <div\n ref={actions}\n className=\"pptx-rail__actions\"\n style={actionColumns(shown)}\n onMouseDown={keepFocus}\n >\n {actionContent}\n </div>\n </RailActionsContext.Provider>\n {gallery ? (\n <Popover anchor={gallery} onClose={() => setGallery(null)} label={t('rail.chooseLayout')}>\n <LayoutGallery\n onChange={(layoutId) => {\n setGallery(null);\n editor?.exec({ type: 'addSlide', layoutId });\n }}\n />\n </Popover>\n ) : null}\n <RailMenuHost\n open={\n menu\n ? {\n menu,\n onClose: () => setMenu(null),\n onSectionAdded: (id: string) => setRenaming(id),\n ...(background.isAvailable\n ? { onBackground: () => background.open(menu.owner) }\n : {}),\n }\n : null\n }\n />\n </nav>\n );\n}\n\nexport { NotesPane, type NotesPaneProps } from './NotesPane.tsx';\n\n/** Props of `ZoomPill`. @public */\nexport interface ZoomPillProps {\n /** A class name added to the pill. */\n readonly className?: string;\n}\n\n/** The zoom pill (`– 100% ▾ +`). @public */\nexport function ZoomPill({ className }: ZoomPillProps = {}) {\n const editor = usePptxEditor();\n const { t } = useTranslation();\n const zoom = useEditorState((s) => s.zoom);\n const fit = useEditorState((s) => s.fitZoom);\n // The pill zooms the slide; a thumbnail zoom for the slide sorter is a later change (decisions).\n const off = useEditorState((s) => s.presentationView === 'slideSorter');\n const reason = off ? t('disabled.sorterZoom') : null;\n // The sorter draws no slide at the zoom: the level shows no number there, only why it is off.\n const levelLabel = off\n ? t('zoom.ariaLabel')\n : t('zoom.levelAriaLabel', { percent: Math.round(zoom * 100) });\n const anchor = useRef<HTMLButtonElement>(null);\n const [open, setOpen] = useState(false);\n // A view switch closes the zoom menu, so it does not open again on the way back.\n useEffect(() => {\n if (off) setOpen(false);\n }, [off]);\n const step = (dir: 1 | -1): void => {\n const next = zoomStep(zoom, dir);\n if (next) editor?.setZoom(next);\n };\n const levelOff = useAriaDisabled(off, reason);\n // A zoom button at the end of the range is off, and says why (zoom.ts).\n const limit = (dir: 1 | -1): string | null => {\n const key = zoomLimitReason(zoom, dir);\n return key ? t(key) : null;\n };\n return (\n <div\n className={['pptx-zoom', className].filter(Boolean).join(' ')}\n role=\"group\"\n aria-label={t('zoom.ariaLabel')}\n onMouseDown={keepFocus}\n >\n <ToolButton\n label={t('zoom.zoomOut')}\n icon=\"remove\"\n onClick={() => step(-1)}\n disabled={off || limit(-1) !== null}\n disabledReason={reason ?? limit(-1)}\n />\n <button\n ref={anchor}\n type=\"button\"\n className=\"pptx-zoom__level\"\n aria-label={levelLabel}\n {...tooltipAttributes(levelLabel, off, reason)}\n aria-haspopup=\"menu\"\n aria-expanded={open && !off}\n // Off stays focusable, so its tooltip says why; the reason is its\n // description too.\n {...levelOff.attrs}\n data-disabled={off ? '' : undefined}\n onClick={() => !off && setOpen((o) => !o)}\n >\n {off ? '\\u2013' : t('zoom.level', { percent: Math.round(zoom * 100) })}\n <Icon name=\"arrow_drop_down\" className=\"pptx-icon pptx-toolbar__caret\" />\n </button>\n {levelOff.note}\n <ToolButton\n label={t('zoom.zoomIn')}\n icon=\"add\"\n onClick={() => step(1)}\n disabled={off || limit(1) !== null}\n disabledReason={reason ?? limit(1)}\n />\n {open && !off ? (\n <Popover anchor={anchor.current} onClose={() => setOpen(false)} align=\"end\">\n <MenuItem checked={fit} onSelect={() => (editor?.setZoom('fit'), setOpen(false))}>\n {t('zoom.fit')}\n </MenuItem>\n {ZOOM_MENU_LEVELS.map((z) => (\n <MenuItem\n key={z}\n checked={!fit && Math.abs(z - zoom) < 0.001}\n onSelect={() => (editor?.setZoom(z), setOpen(false))}\n >\n {t('zoom.level', { percent: Math.round(z * 100) })}\n </MenuItem>\n ))}\n </Popover>\n ) : null}\n </div>\n );\n}\n\nconst EMU_PER_INCH = 914_400;\nconst inches = (emu: number): string => (emu / EMU_PER_INCH).toFixed(2);\n\n/** A number field that commits on Enter or blur and shows the document value otherwise. */\nfunction NumberField({\n label,\n value,\n unit,\n disabled,\n onCommit,\n}: {\n label: string;\n value: string;\n unit: string;\n disabled: boolean;\n onCommit: (value: number) => void;\n}) {\n const [draft, setDraft] = useState<string | null>(null);\n const commit = (): void => {\n // An empty field keeps the value: `Number('')` is 0, which would move the shape.\n const n = draft === null || draft.trim() === '' ? NaN : Number(draft.replace(',', '.'));\n if (Number.isFinite(n) && draft !== value) onCommit(n);\n setDraft(null);\n };\n return (\n <label className=\"pptx-field\">\n {label}\n <span className=\"pptx-field__control\">\n <input\n inputMode=\"decimal\"\n aria-label={label}\n value={draft ?? value}\n disabled={disabled}\n onChange={(e) => setDraft(e.target.value)}\n onBlur={commit}\n onKeyDown={(e) => {\n if (e.key === 'Enter') (e.currentTarget as HTMLInputElement).blur();\n if (e.key === 'Escape') setDraft(null);\n }}\n />\n <span className=\"pptx-field__unit\">{unit}</span>\n </span>\n </label>\n );\n}\n\n/** Position, size, rotation, and text fitting of the selected element. */\nfunction FormatTab() {\n const { t } = useTranslation();\n const editor = usePptxEditor();\n const geometry = useEditorState((s) => s.geometry);\n const table = useEditorState((s) => s.table);\n const readOnly = useEditorState((s) => s.mode === 'view');\n const selected = useEditorState((s) =>\n s.selection.kind === 'shapes' ? s.selection.nodeIds.length : 0\n );\n const background = useEditorDialog('background');\n if (!geometry)\n return selected > 1 ? (\n <div className=\"pptx-empty\">\n <p className=\"pptx-empty__title\">{t('panel.format.multipleTitle', { count: selected })}</p>\n <p className=\"pptx-empty__body\">{platformShortcuts(t('panel.format.multipleBody'))}</p>\n </div>\n ) : (\n <>\n <div className=\"pptx-panel__section\">\n <h3 className=\"pptx-panel__title\">{t('panel.format.slide')}</h3>\n {background.isAvailable ? (\n <button\n type=\"button\"\n className=\"pptx-button\"\n disabled={readOnly}\n onClick={(e) => background.open(e.currentTarget)}\n >\n {t('menu.background')}\n </button>\n ) : null}\n </div>\n <div className=\"pptx-empty\">\n <p className=\"pptx-empty__title\">{t('panel.format.emptyTitle')}</p>\n <p className=\"pptx-empty__body\">{t('panel.format.emptyBody')}</p>\n </div>\n </>\n );\n const g = geometry;\n const move = (patch: Partial<Record<'x' | 'y' | 'cx' | 'cy' | 'rot', number>>): void => {\n editor?.exec({\n type: 'setTransform',\n nodeId: g.nodeId,\n x: patch.x ?? g.x,\n y: patch.y ?? g.y,\n cx: Math.max(0, patch.cx ?? g.cx),\n cy: Math.max(0, patch.cy ?? g.cy),\n rot: patch.rot ?? g.rot,\n });\n };\n const inch = (v: number): number => Math.round(v * EMU_PER_INCH);\n const unit = t('panel.format.inchUnit');\n const field = (key: 'x' | 'y' | 'cx' | 'cy', labelKey: TranslationKey) => (\n <NumberField\n label={t(labelKey)}\n value={inches(g[key])}\n unit={unit}\n disabled={readOnly}\n onCommit={(v) => move({ [key]: inch(v) })}\n />\n );\n return (\n <>\n <div className=\"pptx-panel__section\">\n <h3 className=\"pptx-panel__title\">{t('panel.format.element')}</h3>\n <span className=\"pptx-chip\">{t(elementKindLabelKey(g, table))}</span>\n </div>\n <div className=\"pptx-panel__section\">\n <h3 className=\"pptx-panel__title\">{t('panel.format.size')}</h3>\n <div className=\"pptx-panel__grid\">\n {field('cx', 'panel.format.width')}\n {field('cy', 'panel.format.height')}\n </div>\n </div>\n <div className=\"pptx-panel__section\">\n <h3 className=\"pptx-panel__title\">{t('panel.format.position')}</h3>\n <div className=\"pptx-panel__grid\">\n {field('x', 'panel.format.x')}\n {field('y', 'panel.format.y')}\n </div>\n </div>\n <div className=\"pptx-panel__section\">\n <h3 className=\"pptx-panel__title\">{t('panel.format.rotation')}</h3>\n <div className=\"pptx-panel__grid\">\n <NumberField\n label={t('panel.format.angle')}\n value={String(Math.round(g.rot * 10) / 10)}\n unit=\"°\"\n disabled={readOnly}\n onCommit={(v) => move({ rot: ((v % 360) + 360) % 360 })}\n />\n </div>\n </div>\n {g.textFitting ? (\n <div className=\"pptx-panel__section\">\n <h3 className=\"pptx-panel__title\">{t('panel.format.textFitting')}</h3>\n <div className=\"pptx-radios\" role=\"radiogroup\" aria-label={t('panel.format.textFitting')}>\n {(['none', 'shrink', 'shape'] as const).map((mode) => (\n <label key={mode} className=\"pptx-radio\">\n <input\n type=\"radio\"\n name=\"pptx-text-fitting\"\n checked={g.textFitting === mode}\n disabled={readOnly}\n onChange={() => editor?.exec({ type: 'setAutofit', mode })}\n />\n {t(`panel.format.fitting.${mode}`)}\n </label>\n ))}\n </div>\n </div>\n ) : null}\n </>\n );\n}\n\n/** Props of `SidePanel`. The host shows or hides the panel by rendering it. @public */\nexport interface SidePanelProps {\n /** Shows a close button that calls it. */\n readonly onClose?: () => void;\n /** A class name added to the panel. */\n readonly className?: string;\n /** The panel's width in CSS pixels. */\n readonly paneWidth?: number;\n /** Inline styles for the panel; a `width` here wins over `paneWidth`. */\n readonly style?: CSSProperties;\n}\n\n/** The side panel: Format · Comments. @public */\nexport function SidePanel({ onClose, className, paneWidth, style }: SidePanelProps) {\n const { t } = useTranslation();\n const [tab, setTab] = useState<'format' | 'comments'>('format');\n return (\n <aside\n className={['pptx-panel', className].filter(Boolean).join(' ')}\n aria-label={t('panel.ariaLabel')}\n style={paneStyle(paneWidth, style)}\n onMouseDown={keepFocus}\n >\n <div className=\"pptx-panel__head\">\n <div\n className=\"pptx-tabs\"\n role=\"tablist\"\n // One Tab stop: the selected tab; the arrow keys move between tabs.\n onKeyDown={(e) => {\n const next = radioGroupStep(PANEL_TABS, tab, e.key);\n if (!next) return;\n e.preventDefault();\n setTab(next);\n e.currentTarget.querySelector<HTMLElement>(`[data-tab=\"${next}\"]`)?.focus();\n }}\n >\n {PANEL_TABS.map((id) => (\n <button\n key={id}\n type=\"button\"\n role=\"tab\"\n className=\"pptx-tabs__tab\"\n data-tab={id}\n aria-selected={tab === id}\n tabIndex={tab === id ? 0 : -1}\n onClick={() => setTab(id)}\n >\n {t(`panel.tabs.${id}`)}\n </button>\n ))}\n </div>\n {onClose ? <ToolButton label={t('panel.close')} icon=\"close\" onClick={onClose} /> : null}\n </div>\n <div className=\"pptx-panel__body\" role=\"tabpanel\">\n {tab === 'format' ? <FormatTab /> : null}\n {tab === 'comments' ? (\n <div className=\"pptx-empty\">\n <p className=\"pptx-empty__title\">{t('panel.comments.emptyTitle')}</p>\n <p className=\"pptx-empty__body\">{t('panel.comments.emptyBody')}</p>\n </div>\n ) : null}\n </div>\n </aside>\n );\n}\n","/** @jsxImportSource react */\n// The slide rail's context menu: right-click a thumbnail (or press Shift+F10 or the Menu key on\n// it). A slide outside the selection becomes the selection first; a slide inside a\n// multi-selection keeps it, so Duplicate, Delete, and Move act on every selected slide, as in\n// other slide editors such as Google Slides.\n\nimport type { ReactNode } from 'react';\nimport {\n addSectionAt,\n addSectionCommand,\n commandRowReason,\n groupSlideSections,\n layoutRowProbe,\n railOrientationChrome,\n railOrientationOf,\n railRightToLeft,\n runSlideStep,\n slideStep,\n stepCommand,\n translateKeyOrText,\n type SlideStep,\n} from '@pptx-editor.dev/core/editor';\nimport type { EditorCommand } from '@pptx-editor.dev/core/editor';\nimport type { SlideLayoutSummary } from '@pptx-editor.dev/core/contracts';\nimport {\n ContextMenu,\n MenuRow,\n MenuSeparator,\n MenuSubmenu,\n type ContextMenuPoint,\n} from './ContextMenu.tsx';\nimport { LayoutGallery } from './SlideControls.tsx';\nimport { useEditorState, usePptxEditor, useSlideshow, useTranslation } from './context.ts';\nimport { usePopupEntry } from './popups.tsx';\nimport { useSlideSections } from './RailSections.tsx';\n\nconst NO_LAYOUTS: readonly SlideLayoutSummary[] = [];\n\nconst sameIndices = (a: readonly number[], b: readonly number[]): boolean =>\n a.length === b.length && a.every((v, i) => v === b[i]);\n\n/** An open rail menu: where, on which slide, and how it opened. @public */\nexport interface RailMenuState {\n /** Where the menu opens: the pointer, or the slide for a keyboard open. */\n readonly at: ContextMenuPoint;\n /** The slide the menu opened on, from 0. */\n readonly index: number;\n /** Opened from the keyboard: focus goes to the first row. */\n readonly keyboard: boolean;\n /** The element the menu opened on; its editor scope carries the theme tokens. */\n readonly owner: HTMLElement | null;\n}\n\n/**\n * Where the selected slides land one step up or down, or null at the top or bottom\n * (`slideStep`): a step across a section header changes the section first.\n */\nexport function useSlideStep(\n selected: readonly number[],\n count: number\n): (step: -1 | 1) => SlideStep | null {\n const grouped = groupSlideSections(useSlideSections(), count);\n return (step) => slideStep(selected, count, step, grouped);\n}\n\n/**\n * The slide menu that the rail and the sorter open, as the `railContextMenu` popup entry says:\n * `false` shows none, a function renders the host's menu, otherwise the packaged menu.\n */\nexport function RailMenuHost({ open }: { open: RailContextMenuProps | null }): ReactNode {\n const entry = usePopupEntry('railContextMenu');\n if (!open || entry === false) return null;\n const props = open;\n return typeof entry === 'function' ? entry(props) : <RailContextMenu {...props} />;\n}\n\n/** Props of the context menu of a slide in the rail or the sorter, and of a `popups.railContextMenu` renderer. @public */\nexport interface RailContextMenuProps {\n /** Where the menu opens, on which slide, and how. */\n readonly menu: RailMenuState;\n /** Called when the menu closes. */\n readonly onClose: () => void;\n /** A section was added at the slide: the rail starts renaming it. */\n readonly onSectionAdded?: (sectionId: string) => void;\n /** Opens the background dialog; the row is left out when the dialog is turned off. */\n readonly onBackground?: () => void;\n}\n\n/**\n * The slide rail's context menu: new, duplicate, delete, and move slides, background, and\n * present from here. Rows act on every selected slide. @public\n */\nexport function RailContextMenu({\n menu,\n onClose,\n onBackground,\n onSectionAdded,\n}: RailContextMenuProps) {\n const editor = usePptxEditor();\n const show = useSlideshow();\n const { t } = useTranslation();\n // Re-render on every change, so each row's state is the engine's current answer.\n useEditorState((s) => s.revision);\n const selected = useEditorState((s) => s.selectedSlides, sameIndices);\n const count = useEditorState((s) => s.slides.length);\n const readOnly = useEditorState((s) => s.mode === 'view');\n const current = useEditorState((s) => s.slides[s.currentSlide]);\n const slides = useEditorState((s) => s.slides);\n const layouts = useEditorState((s) => s.layouts ?? NO_LAYOUTS);\n const many = selected.length > 1;\n /** A row bound to a command: disabled with the engine's reason when `can` refuses it. */\n const row = (\n command: EditorCommand | null,\n props: { label: string; icon: string; shortcut?: string; slot: string }\n ) => {\n const reason = commandRowReason(editor, command);\n return (\n <MenuRow\n {...props}\n disabled={!!reason}\n reason={reason ? translateKeyOrText(t, reason) : null}\n onSelect={() => {\n onClose();\n // A move step opens a collapsed section it lands in (`runSlideStep`).\n if (command?.type === 'moveSlides') runSlideStep(editor, command);\n else if (command) editor?.exec(command);\n }}\n />\n );\n };\n const stepTo = useSlideStep(selected, count);\n const up = stepCommand(selected, stepTo(-1));\n const down = stepCommand(selected, stepTo(1));\n // A row rail moves slides left and right: the rows say so, as the rail buttons do. A\n // right-to-left row mirrors them, as its arrow keys do.\n const move = railOrientationChrome(railOrientationOf(menu.owner), railRightToLeft(menu.owner));\n const canPresent = count > 0 && !!editor;\n return (\n <ContextMenu\n at={menu.at}\n onClose={onClose}\n label={t('contextMenu.railLabel')}\n keyboard={menu.keyboard}\n owner={menu.owner}\n >\n {row(\n { type: 'addSlide' },\n { label: t('contextMenu.newSlide'), icon: 'add', slot: 'slide.add' }\n )}\n {row(\n { type: 'duplicateSlides', indices: selected },\n {\n label: many\n ? t('contextMenu.duplicateSlides', { count: selected.length })\n : t('rail.duplicateSlide'),\n icon: 'content_copy',\n shortcut: t('contextMenu.shortcuts.duplicate'),\n slot: 'slide.duplicate',\n }\n )}\n {row(\n { type: 'deleteSlides', indices: selected },\n {\n label: many\n ? t('contextMenu.deleteSlides', { count: selected.length })\n : t('rail.deleteSlide'),\n icon: 'delete',\n shortcut: t('contextMenu.shortcuts.delete'),\n slot: 'slide.delete',\n }\n )}\n {(() => {\n const command = addSectionCommand(menu.index, t);\n const can = editor ? editor.can(command) : null;\n return (\n <MenuRow\n label={t('sections.add')}\n icon=\"view_agenda\"\n slot=\"section.add\"\n disabled={!can?.ok}\n reason={can && !can.ok ? translateKeyOrText(t, can.reason) : null}\n onSelect={() => {\n onClose();\n if (!editor) return;\n const added = addSectionAt(editor, command, menu.index);\n if (added) onSectionAdded?.(added);\n }}\n />\n );\n })()}\n <MenuSeparator />\n {(() => {\n // The engine's answer for a listed layout tells whether any layout can be picked: the\n // slide's own one when the deck lists it, else the first one.\n const reason = commandRowReason(\n editor,\n layoutRowProbe(layouts, current?.layoutId, selected)\n );\n return (\n <MenuSubmenu\n label={t('contextMenu.layout')}\n icon=\"dashboard\"\n disabled={!!reason}\n reason={reason ? translateKeyOrText(t, reason) : null}\n >\n <LayoutGallery\n value={current?.layoutId ?? ''}\n onChange={(layoutId) => {\n onClose();\n editor?.exec({ type: 'applyLayout', indices: selected, layoutId });\n }}\n />\n </MenuSubmenu>\n );\n })()}\n {row(\n { type: 'resetSlides', indices: selected },\n { label: t('contextMenu.resetSlide'), icon: 'restart_alt', slot: 'slide.reset' }\n )}\n {onBackground ? (\n <MenuRow\n label={t('contextMenu.background')}\n icon=\"wallpaper\"\n slot=\"slide.background\"\n disabled={readOnly}\n reason={t('disabled.viewing')}\n onSelect={() => {\n onClose();\n onBackground();\n }}\n />\n ) : null}\n {(() => {\n // Checked when every selected slide is hidden; the row then shows them, else hides them.\n const hidden = selected.length > 0 && selected.every((i) => slides[i]?.hidden);\n const command: EditorCommand = {\n type: 'setSlidesHidden',\n indices: selected,\n hidden: !hidden,\n };\n const can = editor ? editor.can(command) : null;\n return (\n <MenuRow\n label={t('contextMenu.hideSlide')}\n icon=\"visibility_off\"\n slot=\"slide.hide\"\n checked={hidden}\n disabled={!can?.ok}\n reason={can && !can.ok ? translateKeyOrText(t, can.reason) : null}\n onSelect={() => {\n onClose();\n editor?.exec(command);\n }}\n />\n );\n })()}\n <MenuSeparator />\n {row(up, {\n label: t(move.menuMoveEarlierLabel),\n icon: move.moveEarlierIcon,\n shortcut: t(move.menuMoveEarlierShortcut),\n slot: 'slide.moveUp',\n })}\n {row(down, {\n label: t(move.menuMoveLaterLabel),\n icon: move.moveLaterIcon,\n shortcut: t(move.menuMoveLaterShortcut),\n slot: 'slide.moveDown',\n })}\n <MenuSeparator />\n <MenuRow\n label={t('contextMenu.presentFromHere')}\n icon=\"slideshow\"\n slot=\"slide.present\"\n disabled={!canPresent}\n reason={t('disabled.noEditor')}\n onSelect={() => {\n onClose();\n editor?.goToSlide(menu.index);\n show.start('current');\n }}\n />\n </ContextMenu>\n );\n}\n","/** @jsxImportSource react */\n// Sections in the slide rail and the slide sorter (`p14:sectionLst`): a header per\n// section that collapses its slides (the arrow), selects them (a click on the name), renames in\n// place (double-click, F2, or the menu), and opens the section menu (Rename, Remove, Remove\n// with slides, Remove all, Move up and down, Collapse and Expand all). Which sections are\n// collapsed is the engine's view setting (`collapsedSections`): the rail and the sorter share\n// it, and it is never saved.\n//\n// In the rail and the sorter the sections are a tree (`tree` > `treeitem` > `group` >\n// `treeitem`), so the headers are in the keyboard order.\n\nimport {\n useCallback,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n useSyncExternalStore,\n type KeyboardEvent,\n type ReactNode,\n type RefObject,\n} from 'react';\nimport {\n canRenameSectionInPlace,\n focusCurrentSlideIn,\n openSectionOfCurrent,\n commandRowReason,\n refocusAfterCollapse,\n registerSectionRenamer,\n registerSlideSorter,\n requestSectionRenameIn,\n sectionHeaderKeyDown,\n sectionMenuPoint,\n selectSectionByName,\n subscribeSectionRenamers,\n toggleSlideSection,\n translateKeyOrText,\n type EditorCommand,\n type PptxEditorInstance,\n type SlideSection,\n} from '@pptx-editor.dev/core/editor';\nimport { Icon, keepFocus } from './chrome.tsx';\nimport { ContextMenu, MenuRow, MenuSeparator, type ContextMenuPoint } from './ContextMenu.tsx';\nimport { useEditorState, usePptxEditor, useTranslation } from './context.ts';\nimport { usePopupEntry } from './popups.tsx';\n\nconst EMPTY: readonly SlideSection[] = [];\nconst NO_IDS: readonly string[] = [];\n\n/** The deck's sections, reference-stable while they do not change. */\nexport function useSlideSections(): readonly SlideSection[] {\n return useEditorState((s) => s.sections ?? EMPTY);\n}\n\n/** The collapsed section ids, reference-stable while they do not change. */\nexport function useCollapsedSections(): readonly string[] {\n return useEditorState((s) => s.collapsedSections ?? NO_IDS);\n}\n\n/**\n * When the current slide changes, its section opens, so the current slide is in view. A\n * section the user collapses stays collapsed until then, and a click on the name of a\n * collapsed section selects its slides and keeps it collapsed.\n */\nexport function useOpenCurrentSection(grouped: readonly SlideSection[] | null): void {\n const editor = usePptxEditor();\n const current = useEditorState((s) => s.currentSlide);\n const was = useRef(current);\n useEffect(() => {\n if (was.current === current || !editor) return;\n was.current = current;\n openSectionOfCurrent(editor, grouped, current);\n }, [current, grouped, editor]);\n}\n\n/**\n * Returns a function that moves focus to the current slide of `list` after the next render:\n * after a section menu row removes sections, the section that had focus is gone only then. A\n * current slide in a collapsed section has no tile, so its section header takes focus.\n */\nexport function useFocusCurrentAfterRender(list: RefObject<HTMLElement | null>): () => void {\n const [request, setRequest] = useState(0);\n useEffect(() => {\n if (request) focusCurrentSlideIn(list.current);\n }, [request, list]);\n return useCallback(() => setRequest((n) => n + 1), []);\n}\n\n/**\n * After sections collapse (the arrow, Collapse all from a menu or the toolbar), a slide that had\n * focus can be gone: focus moves to the current slide, or to the header of its section when\n * that section is shut. Focus that went elsewhere on purpose stays there.\n */\nexport function useFocusAfterCollapse(\n list: RefObject<HTMLElement | null>,\n collapsed: readonly string[]\n): void {\n const focused = useRef<HTMLElement | null>(null);\n useEffect(() => {\n const root = list.current;\n if (!root) return;\n const onFocus = (e: FocusEvent): void => {\n focused.current = e.target as HTMLElement;\n };\n root.addEventListener('focusin', onFocus);\n return () => root.removeEventListener('focusin', onFocus);\n // Each render: the list element can mount after the first one (a rail that opens later).\n });\n useEffect(() => {\n refocusAfterCollapse(list.current, focused.current);\n }, [collapsed, list]);\n}\n\n/** Count a mounted slide sorter of the editor, for the Slide Sorter view's warning. */\nexport function useSorterRegistration(): void {\n const editor = usePptxEditor();\n useEffect(() => (editor ? registerSlideSorter(editor) : undefined), [editor]);\n}\n\n/**\n * Ask the slide rail or the slide sorter of `editor` to start renaming section `sectionId` in\n * place, as Home > Section > Rename Section does: what the `section.rename` slot runs. Use it\n * when you build your own section chrome. When neither is mounted, nothing opens and a\n * development warning says so. @public\n */\nexport function requestSectionRename(editor: PptxEditorInstance | null, sectionId: string): void {\n requestSectionRenameIn(editor, sectionId);\n}\n\n/**\n * Start renaming when `requestSectionRename` asks for this editor, while `enabled`: a closed\n * rail has no header to rename in, so it does not count. A flat rail or sorter counts: the\n * section that Add Section creates renders its header right after the request.\n */\nexport function useSectionRenameRequests(\n onRequest: (sectionId: string) => void,\n enabled = true\n): void {\n const editor = usePptxEditor();\n useEffect(() => {\n if (!editor || !enabled) return;\n return registerSectionRenamer(editor, onRequest);\n }, [editor, onRequest, enabled]);\n}\n\n/** Whether a mounted rail or sorter of this editor renames a section in place. */\nexport function useSectionRenameAvailable(): boolean {\n const editor = usePptxEditor();\n return useSyncExternalStore(\n subscribeSectionRenamers,\n () => canRenameSectionInPlace(editor),\n () => false\n );\n}\n\n/** An open section menu: where it opens, how it opened, and the element it belongs to. @public */\nexport interface SectionMenuState {\n /** The point where the menu opens, in viewport pixels. */\n readonly at: ContextMenuPoint;\n /**\n * Whether a key opened the menu (Shift+F10 or the Menu key). The menu then puts focus on its\n * first row; after a right-click, on the menu itself.\n */\n readonly keyboard: boolean;\n /** The element the menu belongs to: the section header. Focus goes back to it on close. */\n readonly owner: HTMLElement | null;\n}\n\n/**\n * Props of the section menu, and of a `popups.sectionContextMenu` renderer: the menu of a\n * section header in the slide rail and in the slide sorter. @public\n */\nexport interface SectionContextMenuProps {\n /** The section whose header opened the menu. */\n readonly section: SlideSection;\n /** Where the menu opens, and how. */\n readonly menu: SectionMenuState;\n /** Closes the menu. Call it when a row runs or the user dismisses the menu. */\n readonly onClose: () => void;\n /** Starts renaming the section in place, in the rail or the sorter that opened the menu. */\n readonly onRename: () => void;\n /** Call after a row removes sections: focus goes to the current slide after the render. */\n readonly onRemoved: () => void;\n}\n\n/**\n * One section: its header and its slides, a `treeitem` that takes focus and the section keys\n * (Right and Left expand and collapse, Enter selects its slides, F2 renames, Shift+F10 opens\n * the menu). Up and Down go to the rail or the sorter.\n */\nexport function SectionNode({\n section,\n collapsed,\n renaming,\n variant,\n focusable,\n onRename,\n onRenameEnd,\n onRemoved,\n children,\n}: {\n section: SlideSection;\n collapsed: boolean;\n renaming: boolean;\n /** The slide rail (a list of thumbnails) or the slide sorter (a grid of tiles). */\n variant: 'rail' | 'sorter';\n focusable: boolean;\n onRename: () => void;\n onRenameEnd: () => void;\n /** A menu row removed sections: the rail or the sorter moves focus after its render. */\n onRemoved: () => void;\n children: ReactNode;\n}) {\n const editor = usePptxEditor();\n const { t } = useTranslation();\n const readOnly = useEditorState((s) => s.mode === 'view');\n const [menu, setMenu] = useState<SectionMenuState | null>(null);\n const node = useRef<HTMLLIElement>(null);\n const menuEntry = usePopupEntry('sectionContextMenu');\n // Move up and Move down reorder the headers: the browser drops focus from a moved element,\n // so the header that had it takes it back after the move.\n const hadFocus = useRef(false);\n useLayoutEffect(() => {\n const el = node.current;\n const active = el?.ownerDocument.activeElement;\n if (hadFocus.current && el?.isConnected && (!active || active === el.ownerDocument.body))\n el.focus({ preventScroll: true });\n }, [section.firstSlide]);\n const label = t(section.slideCount === 1 ? 'sections.headerOne' : 'sections.header', {\n name: section.name,\n count: section.slideCount,\n });\n // A slide of the section that has focus goes away when it collapses: its header takes focus.\n const toggle = (): void => toggleSlideSection(editor, section, collapsed, node.current);\n const openMenu = (owner: HTMLElement, at: ContextMenuPoint | null): void =>\n setMenu({ at: at ?? sectionMenuPoint(owner), keyboard: !at, owner });\n const onKeyDown = (e: KeyboardEvent<HTMLLIElement>): void =>\n sectionHeaderKeyDown(e, e.currentTarget, {\n editor,\n readOnly,\n section,\n collapsed,\n toggle,\n rename: onRename,\n openMenu: (owner) => openMenu(owner, null),\n });\n const head = (\n <SectionHead\n section={section}\n collapsed={collapsed}\n renaming={renaming}\n label={label}\n onToggle={toggle}\n // Focus goes to the current slide of the selection, so Delete, Ctrl+D, and the other\n // slide keys act on the slides that the click selected. A shut section keeps focus.\n onSelect={() => selectSectionByName(editor, section, collapsed, node.current)}\n onRename={() => !readOnly && onRename()}\n onRenameEnd={(keyboard) => {\n onRenameEnd();\n // After Enter or Escape, focus goes back to the section. A blur keeps the focus where\n // the user put it.\n if (keyboard) node.current?.focus({ preventScroll: true });\n }}\n onMenu={(owner, at) => openMenu(owner, at)}\n />\n );\n const menuProps: SectionContextMenuProps | null = menu\n ? { section, menu, onClose: () => setMenu(null), onRename, onRemoved }\n : null;\n const menuPart =\n !menuProps || menuEntry === false ? null : typeof menuEntry === 'function' ? (\n menuEntry(menuProps)\n ) : (\n <SectionContextMenu {...menuProps} />\n );\n const sorter = variant === 'sorter';\n return (\n <li\n ref={node}\n onFocus={(e) => {\n if (e.target === e.currentTarget) hadFocus.current = true;\n }}\n onBlur={(e) => {\n // Focus that leaves is gone on purpose: to another element, to nothing (a click on an\n // empty part of the page), or out of the window. Two blurs keep it: one into the\n // section's menu, which gives focus back after its row runs, and one of a disconnected\n // element, which is the move of this header.\n const to = e.relatedTarget as HTMLElement | null;\n if (\n e.target === e.currentTarget &&\n e.currentTarget.isConnected &&\n !to?.closest('[role=\"menu\"]')\n )\n hadFocus.current = false;\n }}\n role=\"treeitem\"\n aria-expanded={!collapsed}\n aria-label={label}\n tabIndex={focusable ? 0 : -1}\n className={sorter ? 'pptx-sorter__section' : 'pptx-rail__section'}\n data-section={section.id}\n onKeyDown={onKeyDown}\n onContextMenu={(e) => {\n if (e.target !== e.currentTarget) return;\n e.preventDefault();\n openMenu(e.currentTarget, null);\n }}\n >\n {head}\n {collapsed ? null : (\n <ol role=\"group\" className={sorter ? 'pptx-sorter__grid' : 'pptx-rail__section-list'}>\n {children}\n </ol>\n )}\n {menuPart}\n </li>\n );\n}\n\n/** A section's header row: the arrow, the name (or its rename field), and the slide count. */\nfunction SectionHead({\n section,\n collapsed,\n renaming,\n label,\n onToggle,\n onSelect,\n onRename,\n onRenameEnd,\n onMenu,\n}: {\n section: SlideSection;\n collapsed: boolean;\n renaming: boolean;\n label: string;\n onToggle: () => void;\n onSelect: () => void;\n onRename: () => void;\n /** `keyboard`: Enter or Escape ended the rename, not a blur. */\n onRenameEnd: (keyboard: boolean) => void;\n onMenu: (owner: HTMLElement, at: ContextMenuPoint | null) => void;\n}) {\n const editor = usePptxEditor();\n const { t } = useTranslation();\n const [name, setName] = useState(section.name);\n const field = useRef<HTMLInputElement>(null);\n // Escape cancels: the field's blur that follows must not write the name.\n const cancelled = useRef(false);\n // The name when the rename starts; a rename from another replica does not reset the field.\n const current = useRef(section.name);\n current.current = section.name;\n // The field selects its whole name once it shows the name it starts from: a rename that\n // Escape cancelled leaves the typed text in the state until then.\n const [selectAll, setSelectAll] = useState(false);\n useEffect(() => {\n if (!renaming) return;\n cancelled.current = false;\n setName(current.current);\n setSelectAll(true);\n }, [renaming]);\n useLayoutEffect(() => {\n if (!selectAll || !renaming) return;\n setSelectAll(false);\n field.current?.focus();\n field.current?.select();\n }, [selectAll, renaming, name]);\n const commitName = (keyboard: boolean): void => {\n if (cancelled.current) return;\n cancelled.current = true;\n const next = name.trim();\n if (next && next !== section.name)\n editor?.exec({ type: 'renameSection', sectionId: section.id, name: next });\n onRenameEnd(keyboard);\n };\n return (\n <div\n className=\"pptx-rail__section-head\"\n data-collapsed={collapsed ? '' : undefined}\n // No tooltip while renaming: it would cover the slides under the field.\n data-pptx-tooltip={renaming ? undefined : label}\n onContextMenu={(e) => {\n e.preventDefault();\n e.stopPropagation();\n onMenu(e.currentTarget, { x: e.clientX, y: e.clientY });\n }}\n >\n <span\n className=\"pptx-rail__section-toggle\"\n aria-hidden=\"true\"\n onMouseDown={keepFocus}\n onClick={(e) => {\n e.stopPropagation();\n onToggle();\n }}\n >\n <Icon name={collapsed ? 'chevron_right' : 'expand_more'} />\n </span>\n {renaming ? (\n <input\n ref={field}\n className=\"pptx-rail__section-name-field\"\n aria-label={t('sections.nameLabel')}\n value={name}\n maxLength={255}\n onChange={(e) => setName(e.target.value)}\n onBlur={() => commitName(false)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') commitName(true);\n else if (e.key === 'Escape') {\n cancelled.current = true;\n onRenameEnd(true);\n } else {\n // Editing keys stay in the field: they never act on the rail.\n e.stopPropagation();\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n }}\n />\n ) : (\n <span\n className=\"pptx-rail__section-name\"\n onMouseDown={keepFocus}\n onClick={onSelect}\n onDoubleClick={onRename}\n >\n {section.name}\n </span>\n )}\n <span className=\"pptx-rail__section-count\" aria-hidden=\"true\">\n {section.slideCount}\n </span>\n </div>\n );\n}\n\n/**\n * The section menu: Rename, Remove, Remove with slides, Remove all, Move up\n * and down, Collapse and Expand all. Every row asks the engine whether it can run. @public\n */\nexport function SectionContextMenu({\n section,\n menu,\n onClose,\n onRename,\n onRemoved,\n}: SectionContextMenuProps) {\n const editor = usePptxEditor();\n const { t } = useTranslation();\n useEditorState((s) => s.revision);\n const id = section.id;\n const row = (\n command: EditorCommand,\n label: string,\n icon: string,\n slot: string,\n then?: () => void\n ) => {\n const reason = commandRowReason(editor, command);\n return (\n <MenuRow\n label={label}\n icon={icon}\n slot={slot}\n disabled={!!reason}\n reason={reason ? translateKeyOrText(t, reason) : null}\n onSelect={() => {\n onClose();\n if (editor?.exec(command).ok) then?.();\n }}\n />\n );\n };\n // Rename runs no command until the name is typed; it needs editing mode. The probe uses a\n // fixed valid name: the section's own name can come from a file and be invalid.\n const rename = editor?.can({ type: 'renameSection', sectionId: id, name: 'x' });\n return (\n <ContextMenu\n at={menu.at}\n onClose={onClose}\n label={t('sections.menuLabel')}\n keyboard={menu.keyboard}\n owner={menu.owner}\n >\n <MenuRow\n label={t('sections.rename')}\n icon=\"edit_note\"\n slot=\"section.rename\"\n disabled={!rename?.ok}\n reason={rename && !rename.ok ? translateKeyOrText(t, rename.reason) : null}\n onSelect={() => {\n onClose();\n onRename();\n }}\n />\n {row(\n { type: 'removeSection', sectionId: id },\n t('sections.remove'),\n 'remove',\n 'section.remove',\n onRemoved\n )}\n {row(\n { type: 'removeSection', sectionId: id, withSlides: true },\n t('sections.removeWithSlides'),\n 'delete',\n 'section.removeWithSlides',\n onRemoved\n )}\n {row(\n { type: 'removeAllSections' },\n t('sections.removeAll'),\n 'delete',\n 'section.removeAll',\n onRemoved\n )}\n <MenuSeparator />\n {row(\n { type: 'moveSection', sectionId: id, direction: -1 },\n t('sections.moveUp'),\n 'keyboard_arrow_up',\n 'section.moveUp'\n )}\n {row(\n { type: 'moveSection', sectionId: id, direction: 1 },\n t('sections.moveDown'),\n 'keyboard_arrow_down',\n 'section.moveDown'\n )}\n <MenuSeparator />\n {row(\n { type: 'setSectionsCollapsed', collapsed: true },\n t('sections.collapseAll'),\n 'unfold_less',\n 'section.collapseAll'\n )}\n {row(\n { type: 'setSectionsCollapsed', collapsed: false },\n t('sections.expandAll'),\n 'unfold_more',\n 'section.expandAll'\n )}\n </ContextMenu>\n );\n}\n","/** @jsxImportSource react */\n// The named parts of the slide rail's action row (`SlideRail.AddSlide`, `SlideRail.Delete`, …),\n// after DOCX Editor's `Navigation` parts and this adapter's `StatusBar` parts. Each part takes\n// `className`, `hidden`, `icon`, and `asChild` (the one element child renders the button). A named part child of `SlideRail` replaces its part in\n// place, other children go after Delete, and `preset={false}` renders only the children. The\n// parts read the rail's state from `RailActionsContext`, so they render only inside a rail.\n\nimport {\n Children,\n Fragment,\n createContext,\n isValidElement,\n useContext,\n useState,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport type {\n PptxEditorInstance,\n RailOrientationChrome,\n SlideStep,\n} from '@pptx-editor.dev/core/editor';\nimport { railOverflowPoint, warnAsChildChild } from '@pptx-editor.dev/core/editor';\nimport type { TranslationKey } from '@pptx-editor.dev/i18n';\nimport { ToolButton } from './chrome.tsx';\nimport { ContextMenu, MenuCloseContext, MenuRow, type ContextMenuPoint } from './ContextMenu.tsx';\nimport type { HostElementProps } from './slot-override.ts';\n\n/** Props of every named part of the slide rail's action row. @public */\nexport interface SlideRailPartProps {\n /** A class name added to the button. */\n readonly className?: string;\n /** Remove the button from the rail. */\n readonly hidden?: boolean;\n /** Icon content in place of the packaged icon, about 18 pixels. */\n readonly icon?: ReactNode;\n /**\n * Render the one element child as the button: it gets the part's label, state, disabled\n * reason, and click, as `SlideRail.Action` and `Toolbar.Action` do.\n */\n readonly asChild?: boolean;\n /** The element for `asChild`. */\n readonly children?: ReactNode;\n}\n\n/** What the rail hands its action parts. @internal */\nexport interface RailActions {\n readonly t: (key: TranslationKey) => string;\n readonly editor: PptxEditorInstance | null;\n /** Why the slide buttons are off, or null when they work. */\n readonly why: string | null;\n readonly selected: readonly number[];\n readonly count: number;\n readonly chrome: RailOrientationChrome;\n readonly step: (step: -1 | 1) => SlideStep | null;\n readonly moveBy: (step: -1 | 1) => void;\n readonly galleryOpen: boolean;\n readonly toggleGallery: () => void;\n readonly listId: string;\n /** Whether the rail is open: the action row shows, or the folded strip. */\n readonly open: boolean;\n /** The rail's `toggle`: `false` removes Hide thumbnails and Show thumbnails. */\n readonly toggle: boolean;\n readonly collapse: () => void;\n readonly expand: () => void;\n}\n\n/** The rail's state for its action parts. @internal */\nexport const RailActionsContext = createContext<RailActions | null>(null);\n\n/** Inside the overflow menu of a narrow rail, the parts render as menu rows. */\nconst RailOverflowContext = createContext(false);\n\ninterface RailButtonProps {\n readonly part: SlideRailPartProps;\n /** The part name in warnings, as `SlideRail.AddSlide`. */\n readonly name: string;\n readonly base: string;\n readonly label: string;\n readonly icon: string;\n readonly onClick: () => void;\n readonly disabled?: boolean;\n readonly disabledReason?: string | null;\n readonly hasPopup?: 'menu';\n readonly expanded?: boolean;\n readonly controls?: string;\n}\n\n/**\n * One rail button: the packaged icon or the host's, and the host class after the part class.\n * With `asChild`, the one element child renders the button; otherwise the packaged button\n * renders, with a warning.\n */\nfunction RailButton({ part, name, base, icon, ...rest }: RailButtonProps): ReactNode {\n // In the overflow menu of a narrow rail: the same action as a menu row.\n if (useContext(RailOverflowContext))\n return (\n <MenuRow\n label={rest.label}\n icon={part.icon === undefined ? icon : part.icon}\n disabled={!!rest.disabled}\n reason={rest.disabled ? (rest.disabledReason ?? null) : null}\n className={[base, part.className].filter(Boolean).join(' ')}\n onSelect={rest.onClick}\n />\n );\n const only = part.asChild ? Children.toArray(part.children) : [];\n const host =\n only.length === 1 && isValidElement<HostElementProps>(only[0])\n ? (only[0] as ReactElement<HostElementProps>)\n : null;\n if (part.asChild && !host) warnAsChildChild(rest.label, { slot: name, group: 'SlideRail' });\n return (\n <ToolButton\n {...rest}\n host={host}\n icon={part.icon === undefined ? icon : undefined}\n className={[base, part.className].filter(Boolean).join(' ')}\n >\n {part.icon}\n </ToolButton>\n );\n}\n\n/** Add slide, after the current slide. @public */\nexport function SlideRailAddSlide(props: SlideRailPartProps): ReactNode {\n const rail = useContext(RailActionsContext);\n if (!rail || props.hidden) return null;\n return (\n <RailButton\n part={props}\n name=\"SlideRail.AddSlide\"\n base=\"pptx-rail__add\"\n label={rail.t('rail.addSlide')}\n icon=\"add\"\n disabled={!!rail.why}\n disabledReason={rail.why}\n onClick={() => rail.editor?.exec({ type: 'addSlide' })}\n />\n );\n}\n\n/** The layout gallery: adds a slide with the layout the person picks. @public */\nexport function SlideRailChooseLayout(props: SlideRailPartProps): ReactNode {\n const rail = useContext(RailActionsContext);\n if (!rail || props.hidden) return null;\n return (\n <RailButton\n part={props}\n name=\"SlideRail.ChooseLayout\"\n base=\"pptx-rail__layouts\"\n label={rail.t('rail.chooseLayout')}\n icon=\"note_add\"\n hasPopup=\"menu\"\n expanded={rail.galleryOpen}\n disabled={!!rail.why}\n disabledReason={rail.why}\n onClick={rail.toggleGallery}\n />\n );\n}\n\n/** Duplicate the selected slides. @public */\nexport function SlideRailDuplicate(props: SlideRailPartProps): ReactNode {\n const rail = useContext(RailActionsContext);\n if (!rail || props.hidden) return null;\n return (\n <RailButton\n part={props}\n name=\"SlideRail.Duplicate\"\n base=\"pptx-rail__duplicate\"\n label={rail.t('rail.duplicateSlide')}\n icon=\"content_copy\"\n disabled={!!rail.why}\n disabledReason={rail.why}\n onClick={() => rail.editor?.exec({ type: 'duplicateSlides', indices: rail.selected })}\n />\n );\n}\n\n/** Move the selected slides one place earlier (up, or left in a horizontal rail). @public */\nexport function SlideRailMoveEarlier(props: SlideRailPartProps): ReactNode {\n const rail = useContext(RailActionsContext);\n if (!rail || props.hidden) return null;\n return (\n <RailButton\n part={props}\n name=\"SlideRail.MoveEarlier\"\n base=\"pptx-rail__move\"\n label={rail.t(rail.chrome.moveEarlierLabel)}\n icon={rail.chrome.moveEarlierIcon}\n disabled={!!rail.why || rail.step(-1) === null}\n disabledReason={rail.why ?? rail.t('disabled.slideEdge')}\n onClick={() => rail.moveBy(-1)}\n />\n );\n}\n\n/** Move the selected slides one place later (down, or right in a horizontal rail). @public */\nexport function SlideRailMoveLater(props: SlideRailPartProps): ReactNode {\n const rail = useContext(RailActionsContext);\n if (!rail || props.hidden) return null;\n return (\n <RailButton\n part={props}\n name=\"SlideRail.MoveLater\"\n base=\"pptx-rail__move\"\n label={rail.t(rail.chrome.moveLaterLabel)}\n icon={rail.chrome.moveLaterIcon}\n disabled={!!rail.why || rail.step(1) === null}\n disabledReason={rail.why ?? rail.t('disabled.slideEdge')}\n onClick={() => rail.moveBy(1)}\n />\n );\n}\n\n/** Delete the selected slides. The last slide stays. @public */\nexport function SlideRailDelete(props: SlideRailPartProps): ReactNode {\n const rail = useContext(RailActionsContext);\n if (!rail || props.hidden) return null;\n return (\n <RailButton\n part={props}\n name=\"SlideRail.Delete\"\n base=\"pptx-rail__delete\"\n label={rail.t('rail.deleteSlide')}\n icon=\"delete\"\n disabled={!!rail.why || rail.selected.length >= rail.count}\n disabledReason={rail.why ?? rail.t('disabled.lastSlide')}\n onClick={() => rail.editor?.exec({ type: 'deleteSlides', indices: rail.selected })}\n />\n );\n}\n\n/** Hide thumbnails: folds the rail to a narrow strip. `toggle={false}` on the rail removes it. @public */\nexport function SlideRailCollapse(props: SlideRailPartProps): ReactNode {\n const rail = useContext(RailActionsContext);\n if (!rail || props.hidden || !rail.toggle || !rail.open) return null;\n return (\n <RailButton\n part={props}\n name=\"SlideRail.Collapse\"\n base=\"pptx-rail__collapse\"\n label={rail.t('rail.collapse')}\n icon={rail.chrome.collapseIcon}\n expanded\n controls={rail.listId}\n onClick={rail.collapse}\n />\n );\n}\n\n/**\n * Show thumbnails: the one button of the folded rail strip, which opens the rail again. A\n * child of `SlideRail` replaces it in place; `hidden` leaves the strip with no button.\n * `toggle={false}` on the rail removes it. @public\n */\nexport function SlideRailExpand(props: SlideRailPartProps): ReactNode {\n const rail = useContext(RailActionsContext);\n if (!rail || props.hidden || !rail.toggle || rail.open) return null;\n return (\n <RailButton\n part={props}\n name=\"SlideRail.Expand\"\n base=\"pptx-rail__collapse pptx-rail__expand\"\n label={rail.t('rail.expand')}\n icon={rail.chrome.expandIcon}\n expanded={false}\n onClick={rail.expand}\n />\n );\n}\n\n/** The overflow button of the rail whose slide list has the id `listId`. */\nfunction overflowButtonOf(listId: string): HTMLElement | null {\n if (typeof document === 'undefined') return null;\n const rail = document.getElementById(listId)?.closest('.pptx-rail');\n return rail?.querySelector<HTMLElement>('.pptx-rail__more') ?? null;\n}\n\n/**\n * The overflow button of a narrow rail: the secondary actions (layouts, duplicate, move,\n * delete) in one menu, as the toolbar's More menu holds the controls that do not fit.\n */\nfunction SlideRailOverflow({ children }: { readonly children: ReactNode }): ReactNode {\n const rail = useContext(RailActionsContext);\n const [menu, setMenu] = useState<{\n readonly at: ContextMenuPoint;\n readonly owner: HTMLElement;\n } | null>(null);\n if (!rail) return null;\n const close = (): void => setMenu(null);\n return (\n <>\n <ToolButton\n label={rail.t('rail.moreActions')}\n icon=\"more_vert\"\n className=\"pptx-rail__more\"\n hasPopup=\"menu\"\n expanded={menu !== null}\n onClick={() => {\n const owner = overflowButtonOf(rail.listId);\n setMenu((open) => (open || !owner ? null : { at: railOverflowPoint(owner), owner }));\n }}\n />\n {menu ? (\n <ContextMenu\n at={menu.at}\n owner={menu.owner}\n // Focus goes to the first row, as the toolbar's menus take focus when they open.\n keyboard\n label={rail.t('rail.moreActions')}\n onClose={close}\n >\n <MenuCloseContext.Provider value={close}>\n <RailOverflowContext.Provider value>{children}</RailOverflowContext.Provider>\n </MenuCloseContext.Provider>\n </ContextMenu>\n ) : null}\n </>\n );\n}\n\n/** The named parts, in their packaged order. Collapse is last and follows the host children. */\nconst PARTS = [\n SlideRailAddSlide,\n SlideRailChooseLayout,\n SlideRailDuplicate,\n SlideRailMoveEarlier,\n SlideRailMoveLater,\n SlideRailDelete,\n] as const;\n\ntype NodeProps = Record<string, unknown> & { children?: ReactNode };\n\nconst flatten = (nodes: ReactNode): ReactNode[] =>\n Children.toArray(nodes).flatMap((node) =>\n isValidElement<NodeProps>(node) && node.type === Fragment\n ? flatten(node.props.children)\n : [node]\n );\n\n/**\n * A child that renders no button in the action row: a part with `hidden`, Show thumbnails\n * (it renders only in the folded strip), and Hide thumbnails under `toggle={false}`.\n */\nconst isHidden = (node: ReactNode, toggle: boolean): boolean =>\n isValidElement<NodeProps>(node) &&\n (node.props.hidden === true ||\n node.type === SlideRailExpand ||\n (!toggle && node.type === SlideRailCollapse));\n\n/**\n * The folded strip's content: the host's `SlideRail.Expand` child, or the packaged one.\n * @internal\n */\nexport function railExpandContent(children: ReactNode): ReactNode {\n const host = flatten(children).find(\n (node) => isValidElement(node) && node.type === SlideRailExpand\n );\n return host ?? <SlideRailExpand />;\n}\n\n/**\n * The rail's action row content and the number of buttons it shows: the packaged parts with\n * the host's named part children in their places and other children after Delete, or with\n * `preset` false only the children. A `folded` (narrow) rail shows New slide and one overflow\n * menu for the other parts. @internal\n */\nexport function railActionContent(\n children: ReactNode,\n preset: boolean,\n toggle: boolean,\n folded = false\n): { readonly content: ReactNode; readonly shown: number } {\n const nodes = flatten(children);\n if (!preset)\n return { content: children, shown: nodes.filter((node) => !isHidden(node, toggle)).length };\n const overrides = new Map<unknown, ReactNode>();\n const extras: ReactNode[] = [];\n for (const child of nodes) {\n const type = isValidElement(child) ? child.type : null;\n if (type && ((PARTS as readonly unknown[]).includes(type) || type === SlideRailCollapse))\n overrides.set(type, child);\n else if (type !== SlideRailExpand) extras.push(child);\n }\n const parts: ReactNode[] = PARTS.map((Part) => overrides.get(Part) ?? <Part />);\n // A narrow rail keeps New slide and folds the rest into one menu; a hidden part stays hidden.\n const [add, ...secondary] = parts;\n const folds = folded && secondary.some((node) => !isHidden(node, toggle));\n const list = folds\n ? [\n add,\n <SlideRailOverflow key=\"overflow\">\n {secondary.map((node, i) => (\n <Fragment key={i}>{node}</Fragment>\n ))}\n </SlideRailOverflow>,\n ...extras,\n ]\n : [...parts, ...extras];\n if (toggle) list.push(overrides.get(SlideRailCollapse) ?? <SlideRailCollapse />);\n return {\n content: (\n <>\n {list.map((node, i) => (\n <Fragment key={i}>{node}</Fragment>\n ))}\n </>\n ),\n shown: list.filter((node) => !isHidden(node, toggle)).length,\n };\n}\n","// Drag to reorder in a slide list: the slide rail (a column, `y`) and the slide sorter (a grid\n// read in rows, `x`). Dragging a selected slide moves the whole selection; another slide moves\n// alone. The drop is one `moveSlides` command, so it is one undo step. With sections, the drop\n// joins the section of the slide under the pointer: a drop before a section's first slide\n// (below its header) puts the block into that section. The rules live in core\n// (`pane-support.ts`), shared with the Vue adapter.\n\nimport { useCallback, useRef, useState, type DragEvent } from 'react';\nimport {\n dragOverSlide,\n dropSlideDrag,\n slideDropMarker,\n startSlideDrag,\n type SlideDrag,\n} from '@pptx-editor.dev/core/editor';\nimport type { SlideSection } from '@pptx-editor.dev/core/contracts';\nimport { usePptxEditor } from './context.ts';\n\n/**\n * The drag handlers and drop marker of each slide item of a list. `axis` is the direction in\n * which the list reads: `y` for the rail, `x` for the sorter's rows. `grouped` is the list's\n * sections (`groupSlideSections`), or null when it is flat. `cancel` drops a drag.\n */\nexport function useSlideDrag(\n axis: 'x' | 'y',\n selected: readonly number[],\n readOnly: boolean,\n grouped: readonly SlideSection[] | null = null\n) {\n const editor = usePptxEditor();\n // The drag lives in a ref, as Vue's `shallowRef`: a quick drag fires `dragover` before React\n // re-renders, and a handler that read the last render's state would not call\n // `preventDefault()`, so the browser would refuse the drop. The state copy only repaints the\n // drop marker.\n const dragRef = useRef<SlideDrag | null>(null);\n const [drag, setDragState] = useState<SlideDrag | null>(null);\n const setDrag = useCallback((next: SlideDrag | null) => {\n dragRef.current = next;\n setDragState(next);\n }, []);\n const itemProps = (index: number) => ({\n 'data-drop': slideDropMarker(drag, index),\n draggable: !readOnly,\n onDragStart: (e: DragEvent<HTMLElement>) => {\n e.dataTransfer.effectAllowed = 'move';\n setDrag(startSlideDrag(editor, selected, index));\n },\n onDragOver: (e: DragEvent<HTMLElement>) => {\n const current = dragRef.current;\n if (!current) return;\n e.preventDefault();\n setDrag(dragOverSlide(current, index, axis, e.currentTarget.getBoundingClientRect(), e));\n },\n onDragEnd: () => setDrag(null),\n onDrop: (e: DragEvent<HTMLElement>) => {\n e.preventDefault();\n const current = dragRef.current;\n if (!current || !editor) return;\n dropSlideDrag(editor, current, grouped);\n setDrag(null);\n },\n });\n const cancel = useCallback(() => setDrag(null), [setDrag]);\n return { itemProps, cancel };\n}\n","/** @jsxImportSource react */\n// The speaker notes pane: a collapsible field for the current slide's notes, with bold, italic,\n// and underline. The field shows the notes formatting while you read and while you type\n// (`NotesField`).\n\nimport {\n useCallback,\n useContext,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport {\n NOTES_FORMAT_BUTTONS,\n NO_NOTES_FORMATS,\n armNotesFormat,\n createNotesFindPainter,\n followNotesArm,\n notesCanFormat,\n notesCommittedRange,\n notesFieldParagraphs,\n notesFieldText,\n notesFormatRange,\n notesFormatsAt,\n notesSelection,\n onFindShown,\n sameNotesFormats,\n warnDuplicatePane,\n type NotesFormat,\n type NotesParagraph,\n} from '@pptx-editor.dev/core/editor';\nimport { ToolButton, keepFocus } from './chrome.tsx';\nimport { rejectionMessage } from './EditNotice.tsx';\nimport { NotesField, notesFieldFocused, type NotesCaret } from './NotesView.tsx';\nimport { useEditorState, usePptxEditor, useTranslation } from './context.ts';\nimport { setNotesTarget } from './notes-target.ts';\nimport { PaneStateContext } from './pane-state.ts';\nimport type { PaneProps } from './panes.tsx';\n\nconst NO_FORMATS = NO_NOTES_FORMATS;\n\n/**\n * Uncommitted notes text and the slide it belongs to, with the formats the field shows for it,\n * so the commit stores what the user saw while typing.\n */\ninterface NotesDraft {\n readonly slideId: string;\n readonly text: string;\n readonly paragraphs?: readonly NotesParagraph[];\n}\n\n/**\n * Props of `NotesPane`: the pane props, without a width (the notes take the slide's width),\n * and the format buttons. @public\n */\nexport interface NotesPaneProps extends Omit<PaneProps, 'paneWidth'> {\n /**\n * Show the pane's bold, italic, and underline buttons. Default true. Ctrl/Cmd+B, I, and U\n * work in the notes field either way.\n */\n readonly showFormatButtons?: boolean;\n}\n\n/**\n * The open state of a notes pane: controlled by `open`, else the root's (so host chrome built\n * on `useNotesPane` agrees), else its own. One notes pane owns the root's state; a second one\n * in the same root warns once and keeps its own value.\n */\nfunction useNotesOpen(props: NotesPaneProps) {\n const shared = useContext(PaneStateContext);\n const [own, setOwn] = useState(props.defaultOpen ?? true);\n const [owner, setOwner] = useState(false);\n const controlled = props.open !== undefined;\n const useShared = shared !== null && owner;\n const open = controlled\n ? props.open!\n : useShared\n ? (shared.notesOpen ?? props.defaultOpen ?? true)\n : own;\n const setOpenValue = (next: boolean): void => {\n if (!controlled) {\n if (useShared) shared.setNotesOpen(next);\n else setOwn(next);\n }\n props.onOpenChange?.(next);\n };\n // A toggle from `useNotesPane` goes through this pane, so a controlled pane tells its host.\n const request = useRef(setOpenValue);\n request.current = setOpenValue;\n const handler = useRef((next: boolean): void => request.current(next)).current;\n // The stable request slot decides ownership: the first pane takes it, and a later one warns\n // once and keeps its own state until the owner unmounts.\n const slot = shared?.notesRequest ?? null;\n useLayoutEffect(() => {\n if (slot?.current && slot.current !== handler) warnDuplicatePane('PptxEditor.NotesPane');\n }, [slot, handler]);\n // Also on each change of the root value: when the owner unmounts, the next change hands its\n // slot to a remaining pane.\n const rootValue = shared?.notesOpen;\n useLayoutEffect(() => {\n if (slot && !slot.current) {\n slot.current = handler;\n setOwner(true);\n }\n }, [slot, handler, rootValue]);\n useLayoutEffect(\n () => () => {\n if (slot?.current === handler) slot.current = null;\n },\n [slot, handler]\n );\n // The root follows the owning pane: its first value, and a controlled value.\n useLayoutEffect(() => {\n if (!shared || !owner) return;\n if (shared.notesOpen !== open) shared.setNotesOpen(open);\n });\n return [open, setOpenValue] as const;\n}\n\n/**\n * Collapsible speaker notes for the current slide. The text shown is the document's; only the\n * text typed since the field took focus is held here, bound to the slide it was typed on. It\n * is written to that slide (wherever the slide is now) when the field loses focus, when the\n * pointer goes down anywhere else, when the current slide changes, and before a format or an\n * undo. @public\n */\nexport function NotesPane(props: NotesPaneProps = {}) {\n const { className, showFormatButtons = true } = props;\n const editor = usePptxEditor();\n const { t } = useTranslation();\n const notes = useEditorState((s) => s.notes);\n const formatted = useEditorState((s) => s.notesFormatted);\n const slideId = useEditorState((s) => s.slides[s.currentSlide]?.id ?? null);\n const readOnly = useEditorState((s) => s.mode === 'view');\n const [open, setOpen] = useNotesOpen(props);\n const notesId = useId();\n const [draft, setDraft] = useState<NotesDraft | null>(null);\n const [refusal, setRefusal] = useState<string | null>(null);\n const [formats, setFormats] = useState(NO_FORMATS);\n const [canFormat, setCanFormat] = useState(false);\n const field = useRef<HTMLDivElement>(null);\n const pending = useRef<NotesDraft | null>(null);\n const bound = useRef<string | null>(null);\n const restore = useRef<NotesCaret | null>(null);\n // An engine without formatted notes still shows the plain text.\n const paragraphs = useMemo<readonly NotesParagraph[]>(\n () =>\n formatted ??\n notes.split('\\n').map((text) => ({\n runs: [{ text, bold: false, italic: false, underline: false, strike: false }],\n })),\n [formatted, notes]\n );\n\n /**\n * Write the draft to its own slide. A deleted slide takes its notes with it. `leaving` is\n * true when the field loses the focus: its selection is not put back.\n */\n const commit = useCallback(\n (leaving = false): void => {\n const d = pending.current;\n pending.current = null;\n setDraft(null);\n if (!editor || !d) return;\n // The field redraws from the written text, which `setNotes` cleans: while the field still\n // has the focus and holds the draft, its selection goes back at the offsets of the written\n // text. A field without the focus takes no selection back (see `NotesField`).\n const el = field.current;\n const selected =\n el && !leaving && !restore.current && notesFieldFocused(el) ? notesSelection(el) : null;\n if (el && selected) {\n const text = notesFieldText(el);\n if (text === d.text) restore.current = notesCommittedRange(text, selected);\n }\n const index = editor.snapshot().slides.findIndex((s) => s.id === d.slideId);\n if (index < 0) return;\n const r = editor.exec({\n type: 'setNotes',\n index,\n text: d.text,\n ...(d.paragraphs ? { paragraphs: d.paragraphs } : {}),\n });\n setRefusal(r.ok ? null : rejectionMessage(t, r));\n },\n [editor, t]\n );\n\n // The current slide changed under a draft (New slide, Delete slide, the rail): commit it.\n useEffect(() => {\n if (pending.current && pending.current.slideId !== slideId) commit();\n bound.current = slideId;\n }, [slideId, commit]);\n\n // Commit before a click anywhere else acts, so a rail or toolbar command sees the notes.\n useEffect(() => {\n if (!draft) return;\n const doc = field.current?.ownerDocument;\n const onPointerDown = (e: Event): void => {\n if (!field.current?.contains(e.target as Node)) commit();\n };\n doc?.addEventListener('pointerdown', onPointerDown, true);\n return () => doc?.removeEventListener('pointerdown', onPointerDown, true);\n }, [draft, commit]);\n\n // Closing, from this pane, the host, or `useNotesPane`, commits the draft first: the field\n // unmounts with no blur event. Unmount commits too.\n useLayoutEffect(() => {\n if (!open) commit();\n }, [open, commit]);\n useEffect(() => () => commit(), [commit]);\n\n /**\n * The B, I, and U buttons show the formats of the selected text. They take a pick only with\n * selected text or a caret in a word, as `applyFormat` needs.\n */\n const readFormats = useCallback((): void => {\n const el = field.current;\n // A caret that moved drops the format armed at it.\n if (el) followNotesArm(el);\n // A field without the focus formats nothing: its buttons and the toolbar show no format.\n const range = el && notesFieldFocused(el) ? notesSelection(el) : null;\n const next = el && range ? notesFormatsAt(el, range) : NO_FORMATS;\n setCanFormat(!!el && notesCanFormat(notesFieldText(el), range));\n // Every key and pointer move reads the formats: render only when one of them changed.\n setFormats((was) => (sameNotesFormats(was, next) ? was : next));\n }, []);\n\n // The notes take the editing focus: no shape stays selected on the slide,\n // and the toolbar's bold, italic, underline, and strikethrough format the notes text.\n const focused = useRef(false);\n const applyRef = useRef<(format: NotesFormat) => boolean>(() => false);\n const leaveSlide = useCallback((): void => {\n if (editor && editor.snapshot().selection.kind !== 'none')\n editor.setSelection({ kind: 'none' });\n }, [editor]);\n const [active, setActive] = useState(false);\n const onFocus = (): void => {\n focused.current = true;\n setActive(true);\n leaveSlide();\n if (editor)\n setNotesTarget(editor, { formats, readOnly, canFormat, apply: (f) => applyRef.current(f) });\n };\n const onBlur = (): void => {\n focused.current = false;\n setActive(false);\n if (editor) setNotesTarget(editor, null);\n commit(true);\n // Without the focus, B, I, and U have nothing to format.\n setCanFormat(false);\n setFormats(NO_FORMATS);\n };\n // While the field has the focus, every selection change (the keyboard, the pointer, a\n // script, the accessibility tree) updates the B, I, and U state. The focus can come back with\n // the same selection (window refocus, a script's focus()) and fire no selectionchange, so the\n // formats are read when the field becomes active too.\n useEffect(() => {\n const doc = field.current?.ownerDocument;\n if (!active || !doc) return;\n readFormats();\n doc.addEventListener('selectionchange', readFormats);\n return () => doc.removeEventListener('selectionchange', readFormats);\n }, [active, readFormats]);\n useEffect(() => {\n if (editor && focused.current)\n setNotesTarget(editor, { formats, readOnly, canFormat, apply: (f) => applyRef.current(f) });\n }, [editor, formats, readOnly, canFormat]);\n useEffect(\n () => () => {\n if (editor) setNotesTarget(editor, null);\n },\n [editor]\n );\n\n // The find bar's match in the notes: painted while find shows it, and not while the field\n // has the focus or holds a draft. A step inside the notes moves no slide or selection, so\n // find tells the pane when it shows another match.\n const painter = useMemo(() => createNotesFindPainter(), []);\n const [findCount, setFindCount] = useState(0);\n const selectionKind = useEditorState((s) => s.selection.kind);\n const revision = useEditorState((s) => s.revision);\n useEffect(\n () => (editor ? onFindShown(editor.find, () => setFindCount((n) => n + 1)) : undefined),\n [editor]\n );\n useEffect(() => {\n painter.paint(editor, open ? field.current : null, paragraphs, !!draft);\n }, [\n painter,\n editor,\n open,\n paragraphs,\n draft,\n active,\n findCount,\n selectionKind,\n revision,\n slideId,\n ]);\n useEffect(() => () => painter.stop(), [painter]);\n\n const onDraft = (text: string): void => {\n const id = pending.current?.slideId ?? bound.current ?? slideId;\n if (!id) return;\n const el = field.current;\n pending.current = {\n slideId: id,\n text,\n ...(el ? { paragraphs: notesFieldParagraphs(el) } : {}),\n };\n setDraft(pending.current);\n };\n\n /**\n * Bold, italic, or underline on the selected notes text, as one undo step. With a caret in a\n * word, the word takes the format; the caret stays where it was. With any other caret, the\n * format is armed: the next typed text takes it, as on the canvas.\n */\n const applyFormat = (format: NotesFormat): boolean => {\n const el = field.current;\n if (!editor || readOnly || !el) return false;\n const text = notesFieldText(el);\n const selected = notesSelection(el);\n const word = notesFormatRange(text, selected);\n if (!word && armNotesFormat(el, format)) {\n setRefusal(null);\n readFormats();\n return true;\n }\n if (!word) {\n setRefusal(t('disabled.selectNotesText'));\n return false;\n }\n // Typed text goes in first (its own undo step). `setNotes` drops characters a slide cannot\n // hold, so the offsets are counted in the text it writes.\n const range = notesCommittedRange(text, word)!;\n const caret = notesCommittedRange(text, selected);\n commit();\n const index = editor.snapshot().slides.findIndex((s) => s.id === slideId);\n if (index < 0) return false;\n restore.current = caret;\n const r = editor.exec({ type: 'formatNotes', index, ...range, format });\n if (!r.ok) restore.current = null;\n setRefusal(r.ok ? null : rejectionMessage(t, r));\n return r.ok;\n };\n applyRef.current = applyFormat;\n\n /** Undo and redo in the field act on the deck, after the draft is written. */\n const applyHistory = (kind: 'undo' | 'redo'): void => {\n const el = field.current;\n if (!editor || !el) return;\n const text = notesFieldText(el);\n const selected = notesSelection(el);\n const range = notesCommittedRange(text, selected);\n commit();\n const before = editor.snapshot().notesFormatted;\n restore.current = range;\n editor.exec({ type: kind });\n // The notes did not change: no redraw takes the selection, so drop it.\n if (editor.snapshot().notesFormatted === before) restore.current = null;\n // An undo can bring back a shape selection; the cursor stays in the notes, so it goes.\n leaveSlide();\n };\n\n return (\n <section\n className={['pptx-notes', className].filter(Boolean).join(' ')}\n aria-label={t('notes.title')}\n data-open={open ? 'true' : 'false'}\n style={props.style}\n >\n <div className=\"pptx-notes__head\" onMouseDown={keepFocus}>\n <span>{t('notes.title')}</span>\n {open && !readOnly && showFormatButtons ? (\n <div className=\"pptx-notes__format\" role=\"group\" aria-label={t('notes.format')}>\n {NOTES_FORMAT_BUTTONS.map(([format, icon, key]) => (\n <ToolButton\n key={format}\n label={t(key)}\n icon={icon}\n pressed={formats[format]}\n disabled={!canFormat}\n disabledReason={t('disabled.selectNotesText')}\n onClick={() => applyFormat(format)}\n />\n ))}\n </div>\n ) : null}\n <ToolButton\n label={open ? t('notes.collapse') : t('notes.expand')}\n icon={open ? 'keyboard_arrow_down' : 'keyboard_arrow_up'}\n expanded={open}\n {...(open ? { controls: notesId } : {})}\n onClick={() => {\n commit();\n setOpen(!open);\n }}\n />\n </div>\n {open ? (\n <NotesField\n id={notesId}\n paragraphs={paragraphs}\n drafting={!!draft && draft.slideId === slideId}\n label={t('notes.title')}\n placeholder={t('notes.placeholder')}\n readOnly={readOnly}\n fieldRef={field}\n restore={restore}\n onDraft={onDraft}\n onCommit={onBlur}\n onFormat={applyFormat}\n onHistory={applyHistory}\n onNewSlide={() => {\n // The field moves to the new slide: no caret comes back.\n commit(true);\n editor?.exec({ type: 'addSlide' });\n }}\n onSelection={readFormats}\n onFocus={onFocus}\n />\n ) : null}\n {refusal ? (\n <p className=\"pptx-notes__refusal\" role=\"alert\">\n {refusal}\n </p>\n ) : null}\n </section>\n );\n}\n","/** @jsxImportSource react */\n// The edit notice: says why the last edit was refused (a keystroke, a paste, a command), so a\n// refused edit never looks like an editor that stopped responding. After a Delete of shapes or\n// slides it says what went and offers Undo, for ten seconds; a pointer over it or the focus in\n// it holds it. It reads the engine's `lastRejection` and `lastRemoval` and holds no state of its\n// own besides the dismissal and the hold. The messages and the rules for when they show are\n// core's (`overlays.ts`), shared with the Vue `PptxEditorEditNotice`.\n\nimport {\n editNoticeShows,\n editNoticeTone,\n editRejectionMessage,\n editRemovalMessage,\n focusSurfaceOf,\n linkPopupShowsRejection,\n REMOVAL_NOTICE_MS,\n removalNoticeShows,\n} from '@pptx-editor.dev/core/editor';\nimport { useContext, useEffect, useState, useSyncExternalStore, type ReactNode } from 'react';\nimport type { ChromeTranslate, EditorRejection } from '@pptx-editor.dev/core/editor';\nimport { withChromeTranslate } from './headless-hooks.tsx';\nimport type { Translate } from '@pptx-editor.dev/i18n';\nimport { ToolButton, keepFocus } from './chrome.tsx';\nimport { useEditorState, usePptxEditor, useTranslation } from './context.ts';\nimport { usePopupEntry } from './popups.tsx';\nimport { HyperlinkPopupContext } from './useHyperlinkPopup.ts';\n\nconst NO_STORE = (): (() => void) => () => undefined;\nconst NO_STATE = (): null => null;\n\n/** The message for a refusal: its reason, with the detail where the reason names one. @public */\nexport function rejectionMessage(t: Translate, rejection: EditorRejection): string {\n return editRejectionMessage(t, rejection);\n}\n\n/** The props of `EditNotice`. @public */\nexport interface EditNoticeProps {\n /**\n * Your translation function for the notice, as DOCX Editor's `t` on its notices. Without it,\n * the root's `locale` gives the labels.\n */\n readonly t?: ChromeTranslate;\n /** Appended after the `pptx-edit-notice` class. */\n className?: string;\n}\n\n/**\n * Why the last edit was refused, or what the last Delete removed with an Undo action. Renders\n * nothing while edits apply, and nothing for a command that had nothing to do\n * (`EditorRejection.noop`). @public\n */\nexport const EditNotice: (props: EditNoticeProps) => ReactNode =\n withChromeTranslate<EditNoticeProps>(EditNoticeRoot, 'EditNotice');\n\nfunction EditNoticeRoot({ className }: Omit<EditNoticeProps, 't'>) {\n const editor = usePptxEditor();\n const { t } = useTranslation();\n const rejection = useEditorState((s) => s.lastRejection ?? null);\n const removal = useEditorState((s) => s.lastRemoval ?? null);\n const [dismissed, setDismissed] = useState<EditorRejection | null>(null);\n // The serial of the removal the user closed or that timed out.\n const [closed, setClosed] = useState<number | null>(null);\n const [held, setHeld] = useState(false);\n // A click on Undo or Dismiss removes the notice under the pointer, and no mouseleave or blur\n // follows: each new removal starts unheld.\n useEffect(() => setHeld(false), [removal?.serial]);\n const offered = removalNoticeShows(removal, closed);\n useEffect(() => {\n if (!offered || held) return;\n const serial = removal.serial;\n const timer = setTimeout(() => setClosed(serial), REMOVAL_NOTICE_MS);\n return () => clearTimeout(timer);\n }, [offered, held, removal]);\n // A refused link shows its reason in the open link popup: the notice does not repeat it, and\n // stays closed when the popup closes.\n const linkStore = useContext(HyperlinkPopupContext);\n const linkPopup = useSyncExternalStore(\n linkStore?.subscribe ?? NO_STORE,\n linkStore?.getState ?? NO_STATE,\n linkStore?.getState ?? NO_STATE\n );\n const covered =\n usePopupEntry('hyperlink') !== false && linkPopupShowsRejection(linkPopup, rejection);\n useEffect(() => {\n if (covered) setDismissed(rejection);\n }, [covered, rejection]);\n const classes = `pptx-edit-notice${className ? ` ${className}` : ''}`;\n if (!covered && editNoticeShows(rejection, dismissed))\n return (\n <div\n className={classes}\n // A state the edit cannot run in (view mode) is information, not an error.\n data-tone={editNoticeTone(rejection)}\n role=\"status\"\n onMouseDown={keepFocus}\n >\n <span className=\"pptx-edit-notice__text\">{rejectionMessage(t, rejection)}</span>\n <ToolButton\n label={t('notice.dismiss')}\n icon=\"close\"\n onClick={() => setDismissed(rejection)}\n />\n </div>\n );\n if (!offered) return null;\n return (\n <div\n className={classes}\n data-tone=\"info\"\n role=\"status\"\n onMouseDown={keepFocus}\n onMouseEnter={() => setHeld(true)}\n onMouseLeave={() => setHeld(false)}\n onFocus={() => setHeld(true)}\n onBlur={() => setHeld(false)}\n >\n <span className=\"pptx-edit-notice__text\">{editRemovalMessage(t, removal)}</span>\n <button\n type=\"button\"\n className=\"pptx-edit-notice__action\"\n onClick={() => {\n if (!editor) return;\n editor.exec({ type: 'undo' });\n // The button goes with the notice; the focus goes back to the slide.\n focusSurfaceOf(editor);\n }}\n >\n {t('notice.undo')}\n </button>\n <ToolButton\n label={t('notice.dismiss')}\n icon=\"close\"\n onClick={() => {\n setClosed(removal.serial);\n if (editor) focusSurfaceOf(editor);\n }}\n />\n </div>\n );\n}\n","/** @jsxImportSource react */\n// The speaker notes field: one editable element that shows each run's bold, italic, underline,\n// and strikethrough while you read and while you type. Typed\n// text is a draft that the pane commits as one `setNotes` (one undo step); formats go through\n// `formatNotes`. The core helpers (`renderNotes`, `notesSelection`) own the DOM, so React never\n// renders into the editable element and the caret stays where the user put it.\n\nimport { useEffect, useLayoutEffect, useRef, type KeyboardEvent } from 'react';\nimport {\n notesFieldBeforeInput,\n notesFieldFocused,\n notesFieldKeyDown,\n notesFieldText,\n notesFormatShortcut,\n notesSelection,\n renderNotes,\n selectNotes,\n type NotesFormat,\n type NotesParagraph,\n} from '@pptx-editor.dev/core/editor';\n\n/** The keyboard shortcut of a notes format (Ctrl/Cmd + B, I, U), or null. */\nexport const formatShortcut: (e: KeyboardEvent) => NotesFormat | null = notesFormatShortcut;\n\nexport { notesFieldFocused };\n\n/** A selection to put back after the field draws the committed notes. */\nexport interface NotesCaret {\n readonly start: number;\n readonly end: number;\n}\n\n/**\n * The notes field. `paragraphs` draw it whenever no draft is pending (`drafting` false); while a\n * draft is pending, the DOM is the user's text and stays as it is.\n */\nexport function NotesField({\n id,\n paragraphs,\n drafting,\n label,\n placeholder,\n readOnly,\n fieldRef,\n restore,\n onDraft,\n onCommit,\n onFormat,\n onHistory,\n onNewSlide,\n onSelection,\n onFocus,\n}: {\n id?: string;\n paragraphs: readonly NotesParagraph[];\n drafting: boolean;\n label: string;\n placeholder: string;\n readOnly: boolean;\n fieldRef: React.RefObject<HTMLDivElement | null>;\n /** Where the selection goes after the next draw (a format keeps its range). */\n restore: React.RefObject<NotesCaret | null>;\n onDraft: (text: string) => void;\n onCommit: () => void;\n onFormat: (format: NotesFormat) => void;\n onHistory: (kind: 'undo' | 'redo') => void;\n /** New Slide (Ctrl+M), as on the canvas. */\n onNewSlide?: () => void;\n onSelection: () => void;\n onFocus?: () => void;\n}) {\n const composing = useRef(false);\n // Draw the notes when they change and no draft holds the DOM; keep the caret where it was.\n // Only a focused field takes its selection back: a selection put into a field that lost the\n // focus (Tab, Escape) takes the focus back in Chromium, and the key is lost.\n useLayoutEffect(() => {\n const el = fieldRef.current;\n if (!el || drafting) return;\n const focused = notesFieldFocused(el);\n const keep = focused ? (restore.current ?? notesSelection(el)) : null;\n restore.current = null;\n renderNotes(el, paragraphs);\n if (keep) selectNotes(el, keep.start, keep.end);\n onSelection();\n }, [paragraphs, drafting, fieldRef, restore, onSelection]);\n\n // Typed text at a caret with an armed format goes into a run with that format. React's\n // `onBeforeInput` carries no `inputType`, so the native event is used.\n const draftRef = useRef(onDraft);\n draftRef.current = onDraft;\n useEffect(() => {\n const el = fieldRef.current;\n if (!el) return;\n const onBeforeInput = (e: Event): void =>\n notesFieldBeforeInput(e as InputEvent, el, {\n readOnly,\n onDraft: (text) => draftRef.current(text),\n });\n el.addEventListener('beforeinput', onBeforeInput);\n return () => el.removeEventListener('beforeinput', onBeforeInput);\n }, [fieldRef, readOnly]);\n\n const onKeyDown = (e: KeyboardEvent<HTMLDivElement>): void => {\n if (composing.current) return;\n notesFieldKeyDown(e, e.currentTarget, { readOnly, onDraft, onFormat, onHistory, onNewSlide });\n };\n return (\n <div\n ref={fieldRef}\n id={id}\n className=\"pptx-notes__text\"\n role=\"textbox\"\n aria-multiline=\"true\"\n aria-label={label}\n aria-placeholder={placeholder}\n aria-readonly={readOnly || undefined}\n data-placeholder={placeholder}\n contentEditable={readOnly ? 'false' : 'plaintext-only'}\n suppressContentEditableWarning\n spellCheck\n tabIndex={0}\n onKeyDown={onKeyDown}\n onInput={(e) => {\n if (!readOnly) onDraft(notesFieldText(e.currentTarget));\n }}\n onCompositionStart={() => (composing.current = true)}\n onCompositionEnd={(e) => {\n composing.current = false;\n if (!readOnly) onDraft(notesFieldText(e.currentTarget));\n }}\n onBlur={onCommit}\n onFocus={onFocus}\n onKeyUp={onSelection}\n onMouseUp={onSelection}\n />\n );\n}\n","// The open state of the speaker notes, which the notes pane draws and host chrome (a View menu\n// row, a Notes button) can toggle. `PptxEditor.Root` holds it, so they agree without the host\n// wiring them. A notes pane given `open` is controlled by the host instead, as DOCX Editor's\n// `Navigation` is: it mirrors that value into the root, and a toggle from the hook goes to its\n// `onOpenChange`.\n\nimport { createContext, useCallback, useContext, useMemo, useRef } from 'react';\nimport { warnOutsideRoot } from '@pptx-editor.dev/core/editor';\n\n/** The shared pane state. @internal */\nexport interface PaneState {\n /** Undefined until a notes pane or the host sets it. */\n readonly notesOpen: boolean | undefined;\n setNotesOpen(open: boolean): void;\n /** The mounted notes pane's handler: a controlled pane sends a change to its host. */\n readonly notesRequest: { current: ((open: boolean) => void) | null };\n}\n\n/** Provided by `PptxEditor.Root`. @internal */\nexport const PaneStateContext = createContext<PaneState | null>(null);\n\n/** What `useNotesPane` returns. @public */\nexport interface UseNotesPaneReturn {\n /** Whether the notes pane shows its text. */\n readonly open: boolean;\n /** Show or hide the notes text. A controlled pane gets the change through `onOpenChange`. */\n readonly setOpen: (open: boolean) => void;\n /** Show the notes text when hidden, and hide it when shown. */\n readonly toggle: () => void;\n}\n\n/**\n * The open state of the speaker notes that `PptxEditor.NotesPane` shows, after DOCX Editor's\n * `useNavigationPane`. Use it to build a notes toggle of your own. Outside `PptxEditor.Root` it\n * warns and does nothing. @public\n */\nexport function useNotesPane(): UseNotesPaneReturn {\n const state = useContext(PaneStateContext);\n if (!state) warnOutsideRoot('useNotesPane');\n const open = state?.notesOpen ?? true;\n // Stable functions, as DOCX Editor's `useNavigationPane`: a host effect that lists them runs\n // only when the root changes. `toggle` reads the value at call time.\n const latest = useRef(open);\n latest.current = open;\n const setNotesOpen = state?.setNotesOpen;\n const request = state?.notesRequest;\n const setOpen = useCallback(\n (next: boolean): void => {\n if (!setNotesOpen || !request) return;\n if (request.current) request.current(next);\n else {\n // Only an uncontrolled root takes the value at once; a host may refuse a pane's change.\n latest.current = next;\n setNotesOpen(next);\n }\n },\n // The setter and the request slot are stable for the root's life, so the functions keep\n // their identity when the notes open and close.\n [setNotesOpen, request]\n );\n const toggle = useCallback(() => setOpen(!latest.current), [setOpen]);\n return useMemo(() => ({ open, setOpen, toggle }), [open, setOpen, toggle]);\n}\n","/** @jsxImportSource react */\n// The chrome tooltip bubble, after DOCX Editor's `Tooltip` (packages/react/src/components/ui/\n// Tooltip.tsx). The editor root mounts one; it shows the `data-pptx-tooltip` label of the control\n// under the pointer, or of the control a keyboard user moved to, after core's delay, with a\n// disabled control's reason on its own line. Core's `chrome-tooltip.ts` owns the timing and the\n// position, and the Vue twin renders the same markup.\n\nimport { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\nimport {\n listenChromeTooltips,\n positionChromeTooltip,\n type ChromeTooltipState,\n} from '@pptx-editor.dev/core/editor';\n\n/** The tooltip bubble for every chrome control on the page. @internal */\nexport function ChromeTooltip() {\n const [state, setState] = useState<ChromeTooltipState | null>(null);\n const ref = useRef<HTMLDivElement>(null);\n useEffect(\n () => (typeof document === 'undefined' ? undefined : listenChromeTooltips(document, setState)),\n []\n );\n // Before paint: the bubble measures itself, then core places it.\n useLayoutEffect(() => {\n if (state && ref.current) positionChromeTooltip(ref.current, state.target);\n }, [state]);\n if (!state) return null;\n return createPortal(\n // Visual only: the control's `aria-label` and `aria-describedby` carry the same text.\n <div ref={ref} className=\"pptx-tooltip\" role=\"tooltip\" aria-hidden=\"true\">\n <span className=\"pptx-tooltip__label\">{state.label}</span>\n {state.reason ? <span className=\"pptx-tooltip__reason\">{state.reason}</span> : null}\n </div>,\n state.scope\n );\n}\n","/** @jsxImportSource react */\n// The floating formatting toolbar. Its arrangement derives FROM `CHROME_GROUPS`; it is never\n// hand-listed, so a slot added to the registry appears here without editing this file.\n\nimport type { ChromeTranslate } from '@pptx-editor.dev/core/editor';\nimport {\n Children,\n Fragment,\n isValidElement,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\nimport {\n colorMenuSelection,\n arrangeToolbarGroups,\n createToolbarFitMemory,\n observeToolbarFit,\n requestDialogSection,\n runChromeRow,\n surfaceInputIn,\n chromeControlForSlot,\n chromeSlotIsToggle,\n isToolbarBarSlot,\n TOOLBAR_NAMED_PARTS,\n toolbarCollapsedIds,\n toolbarColorResetKey,\n toolbarDropdownRow,\n toolbarGroupLabel,\n toolbarGroupPriority,\n toolbarPartKind,\n toolbarRowSection,\n toolbarSplitDefaultColor,\n toolbarContextOf,\n toolbarGroupsFor,\n translateKeyOrText,\n warnDuplicateSlot,\n warnSlotOutsideBar,\n warnUnknownSlot,\n type ChromeControl,\n type ChromeGroup,\n type ChromeSlotId,\n type ToolbarPartKind,\n type ToolbarPickedColor,\n} from '@pptx-editor.dev/core/editor';\nimport {\n Icon,\n MenuItem,\n Popover,\n ToolButton,\n focusText,\n keepFocus,\n useAriaDisabled,\n} from './chrome.tsx';\nimport { useEditorState, usePptxEditor, useTranslation } from './context.ts';\nimport { useSlot, type SlotPartProps } from './slot.ts';\nimport { ColorSwatches } from './ColorSwatches.tsx';\nimport { FillControl, LineMenuControl, ShapeGalleryControl } from './ShapeControls.tsx';\nimport { EffectMenuControl, ShapeStyleGalleryControl } from './ShapeFormatControls.tsx';\nimport {\n LayoutControl,\n NewSlideControl,\n SectionAddControl,\n SectionRenameControl,\n} from './SlideControls.tsx';\nimport { requestFindBar } from './FindBar.tsx';\nimport { ImageControl, LinkControl } from './toolbar-file-controls.tsx';\nimport { TableGridControl, TableStyleControl } from './TableControls.tsx';\nimport { CorrectionsControl } from './PictureControls.tsx';\nimport { usePopupEntry } from './popups.tsx';\nimport { useChromeActionHost } from './chrome-actions.tsx';\nimport {\n SlotControl,\n namedPartSlotProps,\n slotPartNames,\n type ToolbarGroupProps,\n type ToolbarOverrides,\n type ToolbarSlotProps,\n} from './toolbar-parts.tsx';\nimport { useTriggerAttributes } from './slot-override.ts';\nimport { SizeControl } from './toolbar-size.tsx';\nimport { FontFamilyControl } from './FontFamilyControl.tsx';\nimport { useDialogOpener } from './popups.tsx';\nimport { useRovingToolbar } from './toolbar-measure.ts';\nimport { useNotesTarget } from './notes-target.ts';\n\n/** The color a split color button applies before the user picks one (core's rule). */\nfunction useDefaultColor(slot: ChromeSlotId): ToolbarPickedColor {\n const text1 = useEditorState((s) => s.themeColors[0]?.[1]?.color);\n return toolbarSplitDefaultColor(slot, text1);\n}\n\nfunction IconControl({ slot, control }: SlotPartProps) {\n const { cmd, label, reason } = useSlot(slot, control);\n return (\n <ToolButton\n slot={slot}\n label={label}\n paths={control.paths}\n onClick={() => cmd.execute()}\n disabled={!cmd.isEnabled}\n disabledReason={reason}\n // The registry says which controls are toggles; `aria-pressed` goes on those only.\n pressed={chromeSlotIsToggle(slot) ? cmd.isActive : undefined}\n />\n );\n}\n\nfunction DropdownControl({ slot, control }: SlotPartProps) {\n const { cmd, label, reason, tip } = useSlot(slot, control);\n const off = useAriaDisabled(!cmd.isEnabled, reason);\n const { t } = useTranslation();\n const editor = usePptxEditor();\n const openDialog = useDialogOpener();\n const host = useChromeActionHost();\n const anchor = useRef<HTMLButtonElement>(null);\n const [open, setOpen] = useState(false);\n const current = control.options?.find((o) => o.value === cmd.value);\n // A dropdown with no icon is the arrow half of a split button (Bullets and Numbering).\n const icon = current?.paths ?? control.paths;\n const trigger = useTriggerAttributes(\n slot,\n `pptx-toolbar__button ${icon ? 'pptx-toolbar__button--wide' : 'pptx-toolbar__button--caret'}`,\n { disabled: !cmd.isEnabled }\n );\n return (\n <>\n <button\n ref={anchor}\n type=\"button\"\n {...trigger}\n data-slot={slot}\n aria-label={label}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n {...tip}\n {...off.attrs}\n onMouseDown={keepFocus}\n onClick={() => setOpen((o) => !o)}\n >\n {icon ? <Icon paths={icon} /> : null}\n <Icon name=\"arrow_drop_down\" className=\"pptx-icon pptx-toolbar__caret\" />\n </button>\n {off.note}\n {open ? (\n <Popover anchor={anchor.current} onClose={() => setOpen(false)}>\n {control.options?.map((o) => {\n // A dialog row (\"Line spacing options…\") opens its registry dialog; core's rule says\n // which rows are checked or off, with the reason.\n const row = toolbarDropdownRow(editor, host, slot, control, o, cmd.value);\n const dialog = row.dialog;\n return (\n <Fragment key={o.value}>\n {dialog ? <div className=\"pptx-menu__sep\" role=\"separator\" /> : null}\n <MenuItem\n {...(row.checked !== undefined ? { checked: row.checked } : {})}\n {...(row.refused\n ? {\n disabled: true,\n ...(row.reason ? { reason: translateKeyOrText(t, row.reason) } : {}),\n }\n : {})}\n onSelect={() => {\n // A pick gives the caret back to the slide text, so the\n // next key (typing, Cmd+Z) reaches the slide.\n if (!dialog) {\n cmd.execute(o.value);\n focusText(editor, anchor.current);\n setOpen(false);\n return;\n }\n setOpen(false);\n // Focus returns to the text when the dialog closes.\n const text = anchor.current\n ?.closest('.pptx-editor')\n ?.querySelector<HTMLElement>('.pptx-surface__input');\n const section = toolbarRowSection(slot);\n if (editor && section) requestDialogSection(editor, dialog, section);\n openDialog(dialog, text ?? anchor.current);\n }}\n >\n {o.paths ? (\n <Icon paths={o.paths} />\n ) : o.glyph || control.options?.some((x) => x.glyph) ? (\n // A row with no preview keeps the column, so the labels line up.\n <span className=\"pptx-menu__glyph\" aria-hidden=\"true\">\n {o.glyph}\n </span>\n ) : null}\n {t(o.labelKey, o.labelParams)}\n </MenuItem>\n </Fragment>\n );\n })}\n </Popover>\n ) : null}\n </>\n );\n}\n\nfunction ColorControl({ slot, control }: SlotPartProps) {\n const { cmd, label, reason, tip } = useSlot(slot, control);\n const editor = usePptxEditor();\n const { t } = useTranslation();\n const anchor = useRef<HTMLButtonElement>(null);\n const [open, setOpen] = useState(false);\n const fallback = useDefaultColor(slot);\n // The current color of the selection, marked in the menu.\n const selected = useEditorState((s) => colorMenuSelection(slot, s));\n const [picked, setPicked] = useState<ToolbarPickedColor | null>(null);\n const last = picked ?? fallback;\n // Shapes can be transparent; text returns to its inherited (automatic) color.\n const resetLabel = t(toolbarColorResetKey(slot));\n const off = useAriaDisabled(!cmd.isEnabled, reason);\n return (\n <span className=\"pptx-toolbar__group\">\n <ToolButton\n slot={slot}\n label={label}\n paths={control.paths}\n disabled={!cmd.isEnabled}\n disabledReason={reason}\n asChild={false}\n onClick={() => cmd.execute(last.choice)}\n >\n <span className=\"pptx-toolbar__swatch\" style={{ background: last.color }} />\n </ToolButton>\n <button\n ref={anchor}\n type=\"button\"\n className=\"pptx-toolbar__button pptx-toolbar__step\"\n aria-label={label}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n {...tip}\n {...off.attrs}\n onMouseDown={keepFocus}\n onClick={() => setOpen((o) => !o)}\n >\n <Icon name=\"arrow_drop_down\" className=\"pptx-icon pptx-toolbar__caret\" />\n </button>\n {off.note}\n {open ? (\n <Popover anchor={anchor.current} onClose={() => setOpen(false)}>\n <ColorSwatches\n selected={selected}\n onPick={(choice, color) => {\n setPicked({ choice, color });\n cmd.execute(choice);\n focusText(editor, anchor.current);\n setOpen(false);\n }}\n />\n <div className=\"pptx-menu__sep\" />\n <MenuItem\n onSelect={() => (cmd.execute(null), focusText(editor, anchor.current), setOpen(false))}\n >\n {resetLabel}\n </MenuItem>\n </Popover>\n ) : null}\n </span>\n );\n}\n\n/**\n * The link control: asks `PptxEditor.Root` for the link popup (`popups.hyperlink`, or the\n * packaged `HyperlinkPopup`) under this button. Ctrl/Cmd+K and Insert > Link ask the same\n * root, so the popup opens with or without this control.\n */\ntype SlotPart = (props: SlotPartProps) => ReactNode;\n\n/**\n * Slots whose control is more than its registry shape: a searchable font list, a link editor,\n * a fill with gradients, and line menus that draw each option. As in DOCX Editor's\n * `SHAPED_PARTS`, this picks a renderer; it never decides which slots the toolbar shows.\n */\nconst SHAPED_PARTS: Partial<Record<ChromeSlotId, SlotPart>> = {\n 'font.family': FontFamilyControl,\n 'text.link': LinkControl,\n 'insert.line': LineMenuControl,\n 'shape.fill': FillControl,\n 'shape.lineStart': LineMenuControl,\n 'shape.lineEnd': LineMenuControl,\n 'shape.styles': ShapeStyleGalleryControl,\n 'shape.effects': EffectMenuControl,\n 'slide.add': NewSlideControl,\n 'slide.layout': LayoutControl,\n 'section.add': SectionAddControl,\n 'section.rename': SectionRenameControl,\n 'table.style': TableStyleControl,\n 'image.corrections': CorrectionsControl,\n};\n\n/**\n * The renderer for each part kind (core's `toolbarPartKind`): a registry shape, or an adapter\n * part for a control that loads a file, opens a panel, or runs an adapter action.\n */\nconst KIND_PARTS: Record<ToolbarPartKind, SlotPart> = {\n icon: IconControl,\n stepper: SizeControl,\n dropdown: DropdownControl,\n colorSplit: ColorControl,\n gallery: ShapeGalleryControl,\n tableGrid: TableGridControl,\n load: ImageControl,\n panel: PanelControl,\n action: ActionControl,\n};\n\n/** The props of `ToolbarControl`. @public */\nexport interface ToolbarControlProps {\n /** The id of the group the control belongs to, such as `text`. */\n group: string;\n /** The registry entry of the control, from `CHROME_GROUPS`. */\n control: ChromeControl;\n}\n\n/** One control, by registry shape. @public */\nexport function ToolbarControl({ group, control }: ToolbarControlProps) {\n const slot = `${group}.${control.id}` as ChromeSlotId;\n const Part = SHAPED_PARTS[slot] ?? KIND_PARTS[toolbarPartKind(control)];\n return <Part slot={slot} control={control} />;\n}\n\n/** A control that opens a panel the adapter owns: the find bar, to find or to replace. */\nfunction PanelControl({ slot, control }: SlotPartProps) {\n const { cmd, label, reason } = useSlot(slot, control);\n const editor = usePptxEditor();\n const { t } = useTranslation();\n const off = usePopupEntry('find') === false;\n return (\n <ToolButton\n slot={slot}\n label={label}\n paths={control.paths}\n disabled={off || !cmd.isEnabled}\n disabledReason={off ? t('find.unavailable') : reason}\n onClick={() => requestFindBar(editor, slot === 'find.replace')}\n />\n );\n}\n\n/**\n * A control the adapter runs itself: a registry dialog (Page setup, Format background), the\n * clipboard, or the slide show. Core's `runChromeRow` picks the action.\n */\nfunction ActionControl({ slot, control }: SlotPartProps) {\n const { cmd, label, reason } = useSlot(slot, control);\n const editor = usePptxEditor();\n const { t } = useTranslation();\n const host = useChromeActionHost();\n // A `popups` entry of `false` turns the button off. A slot that also takes a value\n // (`image.altText`) keeps its command enabled, so the button asks the host here.\n const off = host.unavailable?.(slot) ?? null;\n const ref = useRef<HTMLSpanElement>(null);\n return (\n <span ref={ref} className=\"pptx-toolbar__group\">\n <ToolButton\n hasPopup={control.state.kind === 'dialog' ? 'dialog' : undefined}\n slot={slot}\n label={label}\n paths={control.paths}\n disabled={!!off || !cmd.isEnabled}\n disabledReason={off ? translateKeyOrText(t, off) : reason}\n onClick={() =>\n runChromeRow(\n editor,\n host,\n slot,\n undefined,\n surfaceInputIn(ref.current?.closest('.pptx-editor'))\n )\n }\n />\n </span>\n );\n}\n\n/**\n * One registered control. Inside a `Toolbar` with the preset on, it declares an override;\n * anywhere else (`preset={false}`, a group) it renders the control.\n *\n * @example\n * ```tsx\n * <PptxEditor.Toolbar>\n * <PptxEditor.Toolbar.Slot slotId=\"text.bold\" icon={<BoldIcon />} className=\"acme-bold\" />\n * <PptxEditor.Toolbar.Slot slotId=\"history.undo\" asChild>\n * <AcmeButton>Undo</AcmeButton>\n * </PptxEditor.Toolbar.Slot>\n * <PptxEditor.Toolbar.Slot slotId=\"text.strike\" hidden />\n * </PptxEditor.Toolbar>\n * ```\n *\n * @public\n */\nexport function ToolbarSlot(props: ToolbarSlotProps): ReactNode {\n const control = chromeControlForSlot(props.slotId);\n if (!control) {\n warnUnknownSlot(props.slotId);\n return null;\n }\n const group = props.slotId.slice(0, props.slotId.indexOf('.'));\n return (\n <SlotControl props={props} render={() => <ToolbarControl group={group} control={control} />} />\n );\n}\n\n/**\n * A group of controls. Inside a `Toolbar` with the preset on, a built-in id changes that group\n * and any other id adds a host group; with `preset={false}`, it renders its children. A host\n * group's accessible name is its `label`, else its translated `labelKey`, else its `id`.\n *\n * @example\n * ```tsx\n * <PptxEditor.Toolbar>\n * <PptxEditor.Toolbar.Group id=\"acme\" label=\"Acme\">\n * <button type=\"button\" onClick={askLegal}>Ask legal</button>\n * </PptxEditor.Toolbar.Group>\n * <PptxEditor.Toolbar.Group id=\"find\" hidden />\n * </PptxEditor.Toolbar>\n * ```\n *\n * @public\n */\nexport function ToolbarGroup(props: ToolbarGroupProps): ReactNode {\n const { t } = useTranslation();\n if (props.hidden) return null;\n return (\n <div\n className={['pptx-toolbar__group', props.className].filter(Boolean).join(' ')}\n role=\"group\"\n aria-label={toolbarGroupLabel(props, (key) => translateKeyOrText(t, key))}\n data-group={props.id}\n >\n {props.children}\n </div>\n );\n}\n\n/** The slot a named part (`Toolbar.Bold`) stands for, read from its static. */\nconst namedPartSlot = (type: unknown): ChromeSlotId | undefined =>\n (type as { pptxSlot?: ChromeSlotId } | null)?.pptxSlot;\n\n/** A named part's name by its slot, for warning text: `text.bold` → `Toolbar.Bold`. */\nconst NAMED_PART_BY_SLOT = new Map<string, string>(\n Object.entries(TOOLBAR_NAMED_PARTS).map(([name, slot]) => [slot, `Toolbar.${name}`])\n);\n\n/**\n * Read `Toolbar.Slot`, named part, and `Toolbar.Group` children as overrides of the preset.\n * Only direct children declare overrides. Other children (a loose `Toolbar.Action`, a host\n * element) go after the groups and never collapse, as in DOCX Editor.\n */\nfunction collectToolbarOverrides(\n children: ReactNode,\n inBar: (slot: string) => boolean = isToolbarBarSlot\n): ToolbarOverrides {\n const slots = new Map<string, ToolbarSlotProps>();\n const groups = new Map<string, ToolbarGroupProps>();\n const extras: ReactNode[] = [];\n // Fragments open (`{readOnly && <>…</>}`), and empty children (`''`, `false`) add nothing.\n for (const child of flattenChildren(children)) {\n if (child === '' || child === null || child === undefined || typeof child === 'boolean')\n continue;\n if (!isValidElement(child)) {\n extras.push(child);\n continue;\n }\n const named = namedPartSlot(child.type);\n if (child.type === ToolbarSlot || named) {\n const props = (\n named\n ? namedPartSlotProps(\n named,\n child.props as Record<string, unknown>,\n NAMED_PART_BY_SLOT.get(named)\n )\n : child.props\n ) as ToolbarSlotProps;\n const parts = slotPartNames(props);\n if (!chromeControlForSlot(props.slotId)) warnUnknownSlot(props.slotId, parts);\n else if (!inBar(props.slotId)) {\n // A registered control the preset bar does not draw (`Toolbar.SmartGuides`) goes after\n // the groups, as DOCX Editor appends it; a `Toolbar.Slot` says so (a named part does\n // not, as in DOCX Editor).\n // A hidden slot draws nothing, so it gets no warning.\n if (!named && !props.hidden) warnSlotOutsideBar(props.slotId, parts);\n if (!props.hidden) extras.push(child);\n continue;\n }\n if (slots.has(props.slotId)) warnDuplicateSlot(props.slotId, parts);\n slots.set(props.slotId, props);\n } else if (child.type === ToolbarGroup) {\n const props = child.props as ToolbarGroupProps;\n groups.set(props.id, props);\n } else extras.push(child);\n }\n return { slots, groups, extras };\n}\n\n/** Children with fragments opened, depth first. */\nfunction flattenChildren(nodes: ReactNode): ReactNode[] {\n const out: ReactNode[] = [];\n Children.forEach(nodes, (node) => {\n if (isValidElement<{ children?: ReactNode }>(node) && node.type === Fragment)\n out.push(...flattenChildren(node.props.children));\n else out.push(node);\n });\n return out;\n}\n\n/** Whether `nodes` renders anything: not only `null`, `false`, `''`, or empty fragments. */\nfunction hasContent(nodes: ReactNode): boolean {\n return flattenChildren(nodes).some(\n (node) => node !== '' && node !== null && node !== undefined && typeof node !== 'boolean'\n );\n}\n\n/** Props for `PptxEditor.Toolbar`. @public */\nexport interface ToolbarProps {\n /**\n * Your translation function for this compound and its parts, as DOCX Editor's `t`. Without\n * it, the root's `locale` gives the labels.\n */\n readonly t?: ChromeTranslate;\n /** A class name added to the bar. */\n readonly className?: string;\n /**\n * `true` (default): the registry's groups, changed by `Toolbar.Slot` and `Toolbar.Group`\n * children. `false`: only the children, in the order given.\n */\n readonly preset?: boolean;\n /**\n * `true` (default): groups that do not fit the width move into a More menu, lowest priority\n * first. `false`: the bar wraps to more rows instead. A `preset={false}` bar never measures\n * itself, so it always wraps, as in DOCX Editor.\n */\n readonly overflow?: boolean;\n /**\n * `true` (default): the bar shows only the groups that act on the selection (text, a shape,\n * a picture, a table, or nothing). `false`: every bar group shows for every selection,\n * disabled with the engine's reason where it cannot run, and the picture or table group\n * joins after them. Hiding a group never turns off its commands.\n */\n readonly contextual?: boolean;\n /** `Toolbar.Slot` and `Toolbar.Group` overrides, or the whole bar when `preset` is false. */\n readonly children?: ReactNode;\n}\n\n/** One group on the bar: built-in or host, already resolved against the overrides. */\ninterface BarItem {\n readonly id: string;\n readonly label: string | undefined;\n readonly content: ReactNode;\n readonly priority: number;\n readonly pinned: boolean;\n readonly className: string | undefined;\n /** The host's content for the group in the More menu. */\n readonly overflowContent: (() => ReactNode) | undefined;\n /**\n * What a built-in group shows in the More menu when it has `overflowContent`: its own\n * controls, then that content in place of the host's children, as DOCX Editor's\n * `hostPanelContent`. A host group's `overflowContent` replaces its controls.\n */\n readonly menuContent?: ReactNode;\n}\n\n/**\n * The toolbar. With the preset, its arrangement derives from `CHROME_GROUPS` (the\n * non-contextual groups, and the `image` group while every selected element is a picture); groups that do not fit the width move, in order from the end, into\n * a More menu. `Toolbar.Slot` and `Toolbar.Group` children change the preset; with\n * `preset={false}`, the children are the whole bar.\n *\n * @example\n * ```tsx\n * <PptxEditor.Toolbar preset={false}>\n * <PptxEditor.Toolbar.Slot slotId=\"history.undo\" />\n * <PptxEditor.Toolbar.Group id=\"formatting\" label=\"Formatting\">\n * <PptxEditor.Toolbar.Slot slotId=\"text.bold\" />\n * <PptxEditor.Toolbar.Slot slotId=\"text.italic\" />\n * </PptxEditor.Toolbar.Group>\n * </PptxEditor.Toolbar>\n * ```\n *\n * @public\n */\nexport function Toolbar({\n className,\n preset = true,\n overflow = true,\n contextual = true,\n children,\n}: ToolbarProps) {\n const { t } = useTranslation();\n // The bar shows the groups that act on the selection: text, a shape, a picture, a table, or\n // nothing (`toolbarContextOf`).\n const selection = useEditorState(toolbarContextOf);\n // A focused speaker notes field takes the text formatting (`NOTES_SLOTS`).\n const notes = useNotesTarget(usePptxEditor());\n const context = notes ? 'notes' : selection;\n if (!preset) return <HandBar className={className}>{children}</HandBar>;\n return (\n <PresetBar\n groups={toolbarGroupsFor(context, { contextual })}\n label={t('toolbar.ariaLabel')}\n className={className}\n overflow={overflow}\n inBar={(slot) => isToolbarBarSlot(slot, { contextual })}\n >\n {children}\n </PresetBar>\n );\n}\n\n/**\n * A preset bar over `groups`: the registry's controls with the host's `Toolbar.Slot`, named\n * part, and `Toolbar.Group` overrides, collapsed into a More menu by priority. The toolbar\n * draws the formatting groups; each ribbon tab draws its own groups. `inBar` says which slots\n * the bar draws (default: the slots of `groups`); another slot goes after the groups. @internal\n */\nexport function PresetBar({\n groups: barGroups,\n label,\n className,\n overflow,\n inBar,\n children,\n}: {\n groups: readonly ChromeGroup[];\n label: string;\n className?: string | undefined;\n overflow: boolean;\n inBar?: (slot: string) => boolean;\n children?: ReactNode;\n}) {\n const { t } = useTranslation();\n const own = new Set(barGroups.flatMap((g) => g.controls.map((c) => `${g.id}.${c.id}`)));\n const overrides = collectToolbarOverrides(children, inBar ?? ((slot) => own.has(slot)));\n const items: BarItem[] = [];\n for (const entry of arrangeToolbarGroups(overrides.groups, barGroups)) {\n const override = entry.override;\n const id = entry.kind === 'built-in' ? entry.group.id : entry.override.id;\n const placement = {\n priority: toolbarGroupPriority(id, override?.priority, barGroups),\n pinned: override?.pinned === true,\n className: override?.className,\n overflowContent: override?.overflowContent,\n };\n if (entry.kind === 'host') {\n // A group with nothing to render leaves the bar, as in DOCX Editor (`{ok && <Action/>}`).\n if (!hasContent(entry.override.children)) continue;\n items.push({\n ...placement,\n id: entry.override.id,\n label: toolbarGroupLabel(entry.override, (key) => translateKeyOrText(t, key)),\n content: entry.override.children,\n });\n continue;\n }\n const group = entry.group;\n const shown = group.controls.filter((c) => !overrides.slots.get(`${group.id}.${c.id}`)?.hidden);\n if (!shown.length && !hasContent(override?.children)) continue;\n const controls = shown.map((c) => (\n <SlotControl\n key={c.id}\n props={overrides.slots.get(`${group.id}.${c.id}`)}\n render={() => <ToolbarControl group={group.id} control={c} />}\n />\n ));\n items.push({\n ...placement,\n id: group.id,\n label: t(group.labelKey),\n content: (\n <>\n {controls}\n {override?.children}\n </>\n ),\n menuContent: placement.overflowContent ? (\n <>\n {controls}\n {placement.overflowContent()}\n </>\n ) : undefined,\n });\n }\n return (\n <PresetToolbar\n className={className}\n items={items}\n extras={overrides.extras}\n overflow={overflow}\n label={label}\n />\n );\n}\n\n/** A `preset={false}` bar: the host's children, wrapped, with roving focus. */\nfunction HandBar({ className, children }: { className?: string; children?: ReactNode }) {\n const { t } = useTranslation();\n const ref = useRef<HTMLDivElement>(null);\n const roving = useRovingToolbar(ref);\n return (\n <div\n ref={ref}\n className={['pptx-toolbar', 'pptx-toolbar--wrap', className].filter(Boolean).join(' ')}\n role=\"toolbar\"\n aria-label={t('toolbar.ariaLabel')}\n data-overflow=\"wrap\"\n onMouseDown={keepFocus}\n {...roving}\n >\n {children}\n </div>\n );\n}\n\nfunction PresetToolbar({\n className,\n items,\n extras,\n overflow,\n label,\n}: {\n className?: string | undefined;\n items: readonly BarItem[];\n extras: readonly ReactNode[];\n overflow: boolean;\n label: string;\n}) {\n const { t } = useTranslation();\n useEditorState((s) => s.status);\n // Contextual controls change the width; refit when they appear or go.\n const context = useEditorState((s) => `${s.selection.kind}|${s.geometry?.lineHead ?? ''}`);\n const ref = useRef<HTMLDivElement>(null);\n const more = useRef<HTMLButtonElement>(null);\n const fixed = useRef<HTMLDivElement>(null);\n const panelId = useId();\n // Widths and the collapsed set are keyed by group id, so a group that comes or goes does\n // not hand its width to its neighbour.\n const memory = useRef(createToolbarFitMemory());\n const count = items.length;\n const [collapsed, setCollapsed] = useState<readonly string[]>([]);\n const [open, setOpen] = useState(false);\n const shape = items.map((g) => `${g.id}:${g.priority}:${g.pinned ? 1 : 0}`).join('|');\n const itemsRef = useRef(items);\n itemsRef.current = items;\n\n useLayoutEffect(() => {\n const el = ref.current;\n if (!el) return;\n if (!overflow) {\n setCollapsed((cur) => (cur.length ? [] : cur));\n return;\n }\n const fit = (): void => {\n const next = toolbarCollapsedIds(\n el,\n itemsRef.current,\n memory.current,\n more.current,\n fixed.current\n );\n setCollapsed((cur) => (cur.join() === next.join() ? cur : next));\n };\n fit();\n return observeToolbarFit(el, fit);\n // `collapsed` re-runs the fit after groups come back, so their widths are measured again.\n }, [context, collapsed, count, shape, overflow]);\n\n const group = (index: number, inMenu: boolean) => {\n const g = items[index]!;\n return (\n <div\n key={g.id}\n className={['pptx-toolbar__group', g.className].filter(Boolean).join(' ')}\n role=\"group\"\n aria-label={g.label}\n data-group={g.id}\n data-group-index={inMenu ? undefined : index}\n >\n {/* The group's aria-label already names it: the heading is for sight only. */}\n {inMenu ? (\n <div className=\"pptx-toolbar__overflow-heading\" aria-hidden=\"true\">\n {g.label}\n </div>\n ) : null}\n {inMenu && g.overflowContent ? (g.menuContent ?? g.overflowContent()) : g.content}\n </div>\n );\n };\n const hiddenIds = new Set(collapsed);\n const visible = items.map((_, i) => i).filter((i) => !hiddenIds.has(items[i]!.id));\n const hidden = items.map((_, i) => i).filter((i) => hiddenIds.has(items[i]!.id));\n const roving = useRovingToolbar(ref);\n // The More menu closes for good when nothing is in it, so it does not reopen by itself.\n useEffect(() => {\n if (!hidden.length) setOpen(false);\n }, [hidden.length]);\n return (\n <div\n ref={ref}\n className={['pptx-toolbar', overflow ? '' : 'pptx-toolbar--wrap', className]\n .filter(Boolean)\n .join(' ')}\n role=\"toolbar\"\n aria-label={label}\n data-overflow={overflow ? 'menu' : 'wrap'}\n onMouseDown={keepFocus}\n {...roving}\n >\n {visible.map((index, i) => (\n <Fragment key={items[index]!.id}>\n {i > 0 ? <span className=\"pptx-toolbar__sep\" aria-hidden=\"true\" /> : null}\n {group(index, false)}\n </Fragment>\n ))}\n {extras.length ? (\n <>\n {visible.length ? <span className=\"pptx-toolbar__sep\" aria-hidden=\"true\" /> : null}\n <div ref={fixed} className=\"pptx-toolbar__group pptx-toolbar__fixed\" data-fixed=\"\">\n {extras}\n </div>\n </>\n ) : null}\n {hidden.length ? (\n <>\n {visible.length || extras.length ? (\n <span className=\"pptx-toolbar__sep\" aria-hidden=\"true\" />\n ) : null}\n <button\n ref={more}\n type=\"button\"\n className=\"pptx-toolbar__button\"\n aria-label={t('toolbar.more')}\n data-pptx-tooltip={t('toolbar.more')}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n data-active={open ? '' : undefined}\n aria-controls={open ? panelId : undefined}\n onMouseDown={keepFocus}\n onClick={() => setOpen((o) => !o)}\n onKeyDown={(event) => {\n // As DOCX Editor's More button: ArrowDown opens the panel at its first control.\n if (event.key !== 'ArrowDown') return;\n event.preventDefault();\n setOpen(true);\n }}\n >\n <Icon name=\"more_vert\" />\n </button>\n {open ? (\n <Popover\n id={panelId}\n anchor={more.current}\n align=\"end\"\n role=\"dialog\"\n focusFirst\n onClose={() => setOpen(false)}\n >\n <div className=\"pptx-toolbar__overflow\" onMouseDown={keepFocus}>\n {hidden.map((i) => group(i, true))}\n </div>\n </Popover>\n ) : null}\n </>\n ) : null}\n </div>\n );\n}\n","/** @jsxImportSource react */\n// The Shape Format controls whose look is more than an icon: the Shape Styles gallery, which\n// draws each theme style with the slide's theme colors, and the Shadow, Reflection, Glow, and\n// Soft Edges menus, which name their current choice. Both are slot renderers: the registry\n// says what they dispatch and when they are enabled (`chrome-shapes.ts`).\n\nimport { Fragment, useCallback, useRef, useState, type ReactNode } from 'react';\nimport {\n GLOW_ACCENTS,\n SHAPE_STYLE_GALLERY,\n chromeOptionChecked,\n effectSeparatorBefore,\n glowGridRows,\n shapeStyleChoice,\n shapeStylePreview,\n type ChromeControl,\n type ChromeSlotId,\n type ShapeStyleChoice,\n type ShapeStyleValue,\n} from '@pptx-editor.dev/core/editor';\nimport { Icon, Popover, keepFocus, useAriaDisabled } from './chrome.tsx';\nimport { MenuRow, MenuSeparator, MenuSubmenu } from './ContextMenu.tsx';\nimport { useEditorState, useTranslation } from './context.ts';\nimport { useSlot } from './slot.ts';\nimport { useTriggerAttributes } from './slot-override.ts';\n\nconst cellKey = (c: ShapeStyleChoice): string => `${c.row}.${c.color}`;\n\n/** The cell the trigger shows while the selection has no gallery style: Colored Fill, Accent 1. */\nconst DEFAULT_CELL: ShapeStyleChoice = { row: 'coloredFill', color: 'accent1' };\n\n/** One gallery cell: a small rounded box in the style's fill, outline, and text colors. */\nfunction StyleSwatch({\n cell,\n className = 'pptx-style-gallery__swatch',\n}: {\n cell: ShapeStyleChoice;\n className?: string;\n}): ReactNode {\n const { t } = useTranslation();\n const themeColors = useEditorState((s) => s.themeColors);\n const p = shapeStylePreview(cell, themeColors);\n return (\n <svg className={className} viewBox=\"0 0 40 28\" aria-hidden=\"true\">\n {p.effect > 0 ? (\n <rect\n x=\"4\"\n y=\"5\"\n width=\"34\"\n height=\"22\"\n rx=\"3\"\n className=\"pptx-style-gallery__shadow\"\n opacity={0.12 * p.effect}\n />\n ) : null}\n <rect\n x=\"2\"\n y=\"2\"\n width=\"34\"\n height=\"22\"\n rx=\"3\"\n fill={p.fill ?? 'none'}\n stroke={p.line ?? 'none'}\n strokeWidth={p.line ? 1.5 : 0}\n />\n <text x=\"19\" y=\"17\" textAnchor=\"middle\" fontSize=\"9\" fill={p.text}>\n {t('toolbar.shapeStyleSample')}\n </text>\n </svg>\n );\n}\n\n/** Props of `ShapeStyleGallery`. @public */\nexport interface ShapeStyleGalleryProps {\n /**\n * The cell to check: a cell, or the slot value (`row.color`, as\n * `useEditorValueCommand('shape.styles').value` gives it), or null for none.\n */\n readonly value?: ShapeStyleChoice | ShapeStyleValue | null;\n /** Called with the picked cell. */\n readonly onPick: (cell: ShapeStyleChoice) => void;\n /** A class name added to the gallery. */\n readonly className?: string;\n}\n\n/**\n * The Quick Styles gallery: six theme style rows of seven colors, drawn with the current\n * slide's theme. Put it in a popover or a menu. @public\n */\nexport function ShapeStyleGallery({ value, onPick, className }: ShapeStyleGalleryProps): ReactNode {\n const picked = shapeStyleChoice(value);\n const checked = picked ? cellKey(picked) : undefined;\n const { t } = useTranslation();\n return (\n <div\n className={['pptx-style-gallery', className].filter(Boolean).join(' ')}\n role=\"group\"\n aria-label={t('toolbar.shapeStyles')}\n // A grid for the arrow keys: Up and Down move by a row of colors.\n data-columns={SHAPE_STYLE_GALLERY[0]?.cells.length}\n >\n {SHAPE_STYLE_GALLERY.map(({ row, cells }) => (\n <div key={row} className=\"pptx-style-gallery__row\" role=\"presentation\">\n {cells.map((cell) => {\n const name = t('toolbar.shapeStyleCell', {\n row: t(`toolbar.shapeStyleRows.${cell.row}`),\n color: t(`toolbar.shapeStyleColors.${cell.color}`),\n });\n return (\n <button\n key={cellKey(cell)}\n type=\"button\"\n role=\"menuitemradio\"\n aria-checked={checked === cellKey(cell)}\n tabIndex={-1}\n className=\"pptx-menu__item pptx-style-gallery__cell\"\n aria-label={name}\n data-pptx-tooltip={name}\n data-style={cellKey(cell)}\n onClick={() => onPick(cell)}\n >\n <StyleSwatch cell={cell} />\n </button>\n );\n })}\n </div>\n ))}\n </div>\n );\n}\n\n/** The toolbar control of `shape.styles`: a trigger and the gallery in a popover. @internal */\nexport function ShapeStyleGalleryControl({\n slot,\n control,\n}: {\n slot: ChromeSlotId;\n control: ChromeControl;\n}): ReactNode {\n const { cmd, label, reason, tip } = useSlot(slot, control);\n // A disabled picker stays in the arrow order and says why.\n const off = useAriaDisabled(!cmd.isEnabled, reason);\n const anchor = useRef<HTMLButtonElement>(null);\n const [open, setOpen] = useState(false);\n const trigger = useTriggerAttributes(slot, 'pptx-toolbar__button pptx-toolbar__button--wide', {\n disabled: !cmd.isEnabled,\n });\n const current = shapeStyleChoice(cmd.value) ?? DEFAULT_CELL;\n return (\n <>\n <button\n ref={anchor}\n type=\"button\"\n {...trigger}\n data-slot={slot}\n aria-label={label}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n {...tip}\n {...off.attrs}\n onMouseDown={keepFocus}\n onClick={() => setOpen((o) => !o)}\n >\n <StyleSwatch cell={current} className=\"pptx-style-gallery__trigger\" />\n <Icon name=\"arrow_drop_down\" className=\"pptx-icon pptx-toolbar__caret\" />\n </button>\n {off.note}\n {open ? (\n <Popover anchor={anchor.current} onClose={() => setOpen(false)}>\n <ShapeStyleGallery\n value={shapeStyleChoice(cmd.value)}\n onPick={(cell) => {\n cmd.execute(cell);\n setOpen(false);\n }}\n />\n </Popover>\n ) : null}\n </>\n );\n}\n\n/** The Shape Effects trigger: a rounded box with an offset shadow, drawn, not an icon path. */\nfunction EffectsGlyph(): ReactNode {\n return (\n <svg className=\"pptx-icon pptx-effects-glyph\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <rect x=\"7\" y=\"7\" width=\"13\" height=\"13\" rx=\"2.5\" className=\"pptx-effects-glyph__shadow\" />\n <rect x=\"4\" y=\"4\" width=\"13\" height=\"13\" rx=\"2.5\" className=\"pptx-effects-glyph__box\" />\n </svg>\n );\n}\n\ntype EffectOption = NonNullable<ChromeControl['options']>[number];\n\n/**\n * Glow Variations: a grid with a row per size and a column per accent, each cell a box with a\n * glow in that accent. Up and Down move by a row (`data-columns`).\n */\nfunction GlowGrid({\n slot,\n options,\n value,\n onPick,\n}: {\n slot: ChromeSlotId;\n options: readonly EffectOption[];\n value: unknown;\n onPick: (value: string) => void;\n}): ReactNode {\n const { t } = useTranslation();\n const themeColors = useEditorState((s) => s.themeColors);\n const swatch = (accent: string): string =>\n themeColors[0]?.find((s) => s.slot === accent)?.color ?? '#808080';\n return (\n <div\n className=\"pptx-style-gallery pptx-glow-grid\"\n role=\"group\"\n aria-label={t('toolbar.glowVariationsLabel')}\n data-columns={GLOW_ACCENTS.length}\n >\n {glowGridRows(options).map(({ size, cells }) => (\n <div key={size} className=\"pptx-style-gallery__row\" role=\"presentation\">\n {cells.map(({ option: o, accent }) => {\n const name = t(o.labelKey, o.labelParams);\n return (\n <button\n key={o.value}\n type=\"button\"\n role=\"menuitemradio\"\n aria-checked={chromeOptionChecked(value, o.value)}\n tabIndex={-1}\n className=\"pptx-menu__item pptx-style-gallery__cell\"\n aria-label={name}\n data-pptx-tooltip={name}\n data-slot={slot}\n data-value={o.value}\n onClick={() => onPick(o.value)}\n >\n <svg className=\"pptx-style-gallery__swatch\" viewBox=\"0 0 40 28\" aria-hidden=\"true\">\n <rect\n x=\"9\"\n y=\"6\"\n width=\"22\"\n height=\"16\"\n rx=\"2\"\n fill=\"none\"\n stroke={swatch(accent)}\n strokeOpacity=\"0.4\"\n // The glow width follows the size: 18 pt draws twice as wide as 8 pt.\n strokeWidth={Number(size) / 2}\n />\n <rect x=\"9\" y=\"6\" width=\"22\" height=\"16\" rx=\"2\" className=\"pptx-glow-grid__box\" />\n </svg>\n </button>\n );\n })}\n </div>\n ))}\n </div>\n );\n}\n\n/**\n * The Shape Effects menu (`shape.effects`): one submenu per effect (Shadow, Reflection, Glow,\n * Soft Edges, the option groups of the registry), with each effect's current choice checked.\n * @internal\n */\nexport function EffectMenuControl({\n slot,\n control,\n}: {\n slot: ChromeSlotId;\n control: ChromeControl;\n}): ReactNode {\n const { cmd, label, reason, tip } = useSlot(slot, control);\n // A disabled picker stays in the arrow order and says why.\n const off = useAriaDisabled(!cmd.isEnabled, reason);\n const { t } = useTranslation();\n const anchor = useRef<HTMLButtonElement>(null);\n const [open, setOpen] = useState(false);\n const trigger = useTriggerAttributes(slot, 'pptx-toolbar__button pptx-toolbar__button--wide', {\n disabled: !cmd.isEnabled,\n });\n const close = useCallback(() => setOpen(false), []);\n return (\n <>\n <button\n ref={anchor}\n type=\"button\"\n {...trigger}\n data-slot={slot}\n aria-label={label}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n {...tip}\n {...off.attrs}\n onMouseDown={keepFocus}\n onClick={() => setOpen((o) => !o)}\n >\n <EffectsGlyph />\n <Icon name=\"arrow_drop_down\" className=\"pptx-icon pptx-toolbar__caret\" />\n </button>\n {off.note}\n {open ? (\n <Popover anchor={anchor.current} onClose={close}>\n {control.optionGroups?.map((group) => {\n const options = control.options?.filter((o) => o.group === group.id) ?? [];\n const pick = (value: string) => (cmd.execute(value), close());\n const row = (o: EffectOption) => (\n <MenuRow\n key={o.value}\n slot={slot}\n label={t(o.labelKey, o.labelParams)}\n checked={chromeOptionChecked(cmd.value, o.value)}\n radio\n onSelect={() => pick(o.value)}\n />\n );\n const [first, ...rest] = options;\n return (\n <MenuSubmenu key={group.id} label={t(group.labelKey)}>\n {group.id === 'glow' && first ? (\n <>\n {row(first)}\n <GlowGrid slot={slot} options={rest} value={cmd.value} onPick={pick} />\n </>\n ) : (\n // Shadows: a line between the outer and the inner presets (the Outer and\n // Inner sections).\n options.map((o, i) => (\n <Fragment key={o.value}>\n {effectSeparatorBefore(group.id, options, i) ? <MenuSeparator /> : null}\n {row(o)}\n </Fragment>\n ))\n )}\n </MenuSubmenu>\n );\n })}\n </Popover>\n ) : null}\n </>\n );\n}\n","/** @jsxImportSource react */\n// The toolbar controls that open a popup or a file picker: the link control and the picture\n// file controls (Insert Picture, Change Picture). Split from `Toolbar.tsx` for the line cap.\n\nimport { useRef } from 'react';\nimport { imageFileTypes, insertImageFile, translateKeyOrText } from '@pptx-editor.dev/core/editor';\nimport { ToolButton } from './chrome.tsx';\nimport { usePptxEditor, useTranslation } from './context.ts';\nimport { useSlot, type SlotPartProps } from './slot.ts';\nimport { requestLinkPopup, useChromeActionHost } from './chrome-actions.tsx';\n\n/** The link control: it opens the link popup (`popups.hyperlink`). @internal */\nexport function LinkControl({ slot, control }: SlotPartProps) {\n const { cmd, label, reason } = useSlot(slot, control);\n const editor = usePptxEditor();\n const { t } = useTranslation();\n // The button opens the popup, so a `popups.hyperlink` of `false` turns it off; the command\n // (`setLink`) keeps working.\n const off = useChromeActionHost().unavailable?.(slot) ?? null;\n const anchor = useRef<HTMLSpanElement>(null);\n return (\n <span ref={anchor} className=\"pptx-toolbar__group\">\n <ToolButton\n slot={slot}\n label={label}\n paths={control.paths}\n disabled={!!off || !cmd.isEnabled}\n disabledReason={off ? translateKeyOrText(t, off) : reason}\n pressed={typeof cmd.value === 'string' && cmd.value !== ''}\n onClick={() => requestLinkPopup(editor, anchor.current)}\n />\n </span>\n );\n}\n\n/** Insert Picture and Change Picture: a button over a hidden file input. @internal */\nexport function ImageControl({ slot, control }: SlotPartProps) {\n const { cmd, label, reason } = useSlot(slot, control);\n const editor = usePptxEditor();\n const input = useRef<HTMLInputElement>(null);\n // Insert > Picture adds a picture; Change Picture replaces the selected one's image.\n const target = control.state.kind === 'replace' ? 'replaceImage' : undefined;\n const onFile = async (file: File | undefined): Promise<void> => {\n if (file && editor) await insertImageFile(editor, file, target);\n };\n return (\n <>\n <ToolButton\n slot={slot}\n label={label}\n paths={control.paths}\n disabled={!cmd.isEnabled}\n disabledReason={reason}\n onClick={() => input.current?.click()}\n />\n <input\n ref={input}\n type=\"file\"\n accept={imageFileTypes(target)}\n hidden\n onChange={(e) => {\n const file = e.target.files?.[0];\n // Clear the input, so picking the same file again still fires `change`.\n e.target.value = '';\n void onFile(file);\n }}\n />\n </>\n );\n}\n","/** @jsxImportSource react */\n// The Picture Format controls whose look is more than a list: the Corrections gallery, a grid\n// with a row per contrast and a column per brightness, each cell a sample picture with that\n// correction. A slot renderer: the registry says what it dispatches and when it is enabled\n// (`chrome-picture.ts`); core draws the grid and the samples (`picture-corrections.ts`).\n\nimport { useRef, useState, type ReactNode } from 'react';\nimport {\n chromeOptionChecked,\n correctionGridRows,\n correctionPercent,\n correctionSwatch,\n type ChromeControl,\n type ChromeSlotId,\n} from '@pptx-editor.dev/core/editor';\nimport { Icon, Popover, keepFocus, useAriaDisabled } from './chrome.tsx';\nimport { useTranslation } from './context.ts';\nimport { useSlot } from './slot.ts';\nimport { useTriggerAttributes } from './slot-override.ts';\n\n/** One Corrections sample: the sample picture with a brightness and a contrast. */\nfunction CorrectionSwatch({\n brightness,\n contrast,\n}: {\n brightness: number;\n contrast: number;\n}): ReactNode {\n return (\n <svg className=\"pptx-corrections-grid__swatch\" viewBox=\"0 0 40 28\" aria-hidden=\"true\">\n {correctionSwatch(brightness, contrast).map((p) => (\n <path key={p.d} d={p.d} fill={p.fill} />\n ))}\n </svg>\n );\n}\n\n/** The toolbar control of `image.corrections`: a trigger and the grid in a popover. @internal */\nexport function CorrectionsControl({\n slot,\n control,\n}: {\n slot: ChromeSlotId;\n control: ChromeControl;\n}): ReactNode {\n const { cmd, label, reason, tip } = useSlot(slot, control);\n // A disabled picker stays in the arrow order and says why.\n const off = useAriaDisabled(!cmd.isEnabled, reason);\n const { t } = useTranslation();\n const anchor = useRef<HTMLButtonElement>(null);\n const [open, setOpen] = useState(false);\n const trigger = useTriggerAttributes(slot, 'pptx-toolbar__button pptx-toolbar__button--wide', {\n disabled: !cmd.isEnabled,\n });\n const rows = correctionGridRows(control.options ?? []);\n return (\n <>\n <button\n ref={anchor}\n type=\"button\"\n {...trigger}\n data-slot={slot}\n aria-label={label}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n {...tip}\n {...off.attrs}\n onMouseDown={keepFocus}\n onClick={() => setOpen((o) => !o)}\n >\n <Icon paths={control.paths} />\n <Icon name=\"arrow_drop_down\" className=\"pptx-icon pptx-toolbar__caret\" />\n </button>\n {off.note}\n {open ? (\n <Popover anchor={anchor.current} onClose={() => setOpen(false)}>\n <div\n className=\"pptx-style-gallery pptx-corrections-grid\"\n role=\"group\"\n aria-label={t('pictureFormat.brightnessContrast')}\n // A grid for the arrow keys: Up and Down move by a row of brightness values.\n data-columns={rows[0]?.cells.length}\n >\n {/* The axis labels: each cell names its values, so they are hidden from assistive technology. */}\n <div className=\"pptx-corrections-grid__title\" aria-hidden=\"true\">\n {t('pictureFormat.brightness')}\n </div>\n <div className=\"pptx-corrections-grid__head\" aria-hidden=\"true\">\n {rows[0]?.cells.map(({ brightness }) => (\n <span key={brightness} className=\"pptx-corrections-grid__label\">\n {t('pictureFormat.percent', { value: correctionPercent(brightness) })}\n </span>\n ))}\n </div>\n <div className=\"pptx-corrections-grid__body\" role=\"presentation\">\n <div className=\"pptx-corrections-grid__side\" aria-hidden=\"true\">\n {t('pictureFormat.contrast')}\n </div>\n <div className=\"pptx-corrections-grid__rows\" role=\"presentation\">\n {rows.map(({ contrast, cells }) => (\n <div key={contrast} className=\"pptx-style-gallery__row\" role=\"presentation\">\n <span\n className=\"pptx-corrections-grid__label pptx-corrections-grid__label--row\"\n aria-hidden=\"true\"\n >\n {t('pictureFormat.percent', { value: correctionPercent(contrast) })}\n </span>\n {cells.map(({ option: o, brightness, contrast: c }) => {\n const name = t(o.labelKey, o.labelParams);\n return (\n <button\n key={o.value}\n type=\"button\"\n role=\"menuitemradio\"\n aria-checked={chromeOptionChecked(cmd.value, o.value)}\n tabIndex={-1}\n className=\"pptx-menu__item pptx-style-gallery__cell\"\n aria-label={name}\n data-pptx-tooltip={name}\n data-slot={slot}\n data-value={o.value}\n onClick={() => {\n cmd.execute(o.value);\n setOpen(false);\n }}\n >\n <CorrectionSwatch brightness={brightness} contrast={c} />\n </button>\n );\n })}\n </div>\n ))}\n </div>\n </div>\n </div>\n </Popover>\n ) : null}\n </>\n );\n}\n","/** @jsxImportSource react */\n// Toolbar customization parts, after DOCX Editor's toolbar ladder\n// (docx-editor/docs/site/content/customization/toolbar.mdx):\n//\n// 1. `className`, and state as `data-active` / `data-disabled` on every control.\n// 2. `icon` on `Toolbar.Slot`.\n// 3. `asChild` on `Toolbar.Slot`: the host element renders the control.\n// 4. `Toolbar.Slot slotId` (replace one control, or `hidden`), `Toolbar.Group id` (change a\n// built-in group, or add a host group), and `preset={false}` (render only the children).\n// 5. The raw hooks (`useEditorCommand`, `useEditorState`) for chrome built from nothing.\n//\n// Hiding a control changes the interface only: the command still runs from menus, keys, and\n// the API.\n\nimport { Children, isValidElement, type ReactElement, type ReactNode } from 'react';\nimport type { ChromeGroupId, ChromeSlotId } from '@pptx-editor.dev/core/editor';\nimport {\n NAMED_PART,\n SlotOverrideContext,\n slotPartNames,\n type HostElementProps,\n} from './slot-override.ts';\nexport { NAMED_PART, slotPartNames } from './slot-override.ts';\nimport {\n TOOLBAR_COMPOUND_SLOTS,\n chromeControlForSlot,\n warnAsChildChild,\n warnIgnoredSlotAttributes,\n warnReplacedControlSetting,\n} from '@pptx-editor.dev/core/editor';\nimport { FontFamilyControl } from './FontFamilyControl.tsx';\n\n/** What every `Toolbar.Slot` takes. @public */\nexport interface ToolbarSlotBaseProps {\n /** The registered control, for example `text.bold`. */\n readonly slotId: ChromeSlotId;\n /** Remove the control from the toolbar. Its command keeps working elsewhere. */\n readonly hidden?: boolean;\n /** A host icon in place of the registry icon. Button controls only. */\n readonly icon?: ReactNode;\n /** A class name added to the control. */\n readonly className?: string;\n}\n\n/**\n * Props for `PptxEditor.Toolbar.Slot`. With `asChild`, the single child element renders the\n * control and receives its label, state, and click handler. Without it, children replace the\n * control in its place. @public\n */\nexport type ToolbarSlotProps = ToolbarSlotBaseProps &\n (\n | {\n /** Render the control as the single child element. Button controls only. */\n readonly asChild: true;\n /** The host element that renders the control. */\n readonly children: ReactElement;\n }\n | {\n readonly asChild?: false;\n /** Content that replaces the control in its place. */\n readonly children?: ReactNode;\n }\n );\n\n/**\n * Props for the named button parts (`Toolbar.Bold`, `Toolbar.Undo`, …), as DOCX Editor's: the\n * slot is pinned, and children are icon content (`icon`, else children, else the registry\n * icon), not a replacement. `<Toolbar.Bold hidden />` is\n * `<Toolbar.Slot slotId=\"text.bold\" hidden />`. @public\n */\nexport type ToolbarPartProps = Omit<ToolbarSlotBaseProps, 'slotId'> &\n (\n | {\n /** Render the control as the single child element. */\n readonly asChild: true;\n /** The host element that renders the control. */\n readonly children: ReactElement;\n }\n | {\n readonly asChild?: false;\n /** Icon content, when there is no `icon`. */\n readonly children?: ReactNode;\n }\n );\n\n/**\n * Props for the named picker parts (`Toolbar.FontFamily`, `Toolbar.FontColor`, …), as DOCX\n * Editor's slot parts: a picker is not one button, so it takes no `icon`, `asChild`, or\n * children. @public\n */\nexport interface ToolbarSlotPartProps {\n /** Remove the control from the toolbar. Its command keeps working elsewhere. */\n readonly hidden?: boolean;\n /** A class name added to the control's trigger. */\n readonly className?: string;\n}\n\n/**\n * Props for the named color split parts (`Toolbar.FontColor`, `Toolbar.Highlight`,\n * `Toolbar.ShapeFill`, `Toolbar.LineColor`), as DOCX Editor's `ToolbarColorSplitProps`: the\n * main half takes an `icon` (the glyph over the color bar). @public\n */\nexport interface ToolbarColorSplitProps extends ToolbarSlotPartProps {\n /** A host glyph over the color bar, in place of the registry icon. */\n readonly icon?: ReactNode;\n}\n\n/** A named color split part: a component with its slot as a static. @public */\nexport interface ToolbarColorSplitComponent {\n /** Changes, replaces, or hides the color control the part stands for. */\n (props: ToolbarColorSplitProps): ReactNode;\n /** The slot the part stands for. The toolbar reads it to place the part. */\n readonly pptxSlot: ChromeSlotId;\n}\n\n/** A named toolbar part: a `Toolbar.Slot` with its slot pinned. @public */\nexport interface ToolbarPartComponent {\n /** Changes, replaces, or hides the control the part stands for. */\n (props: ToolbarPartProps): ReactNode;\n /** The slot the part stands for. The toolbar reads it to place the part. */\n readonly pptxSlot: ChromeSlotId;\n}\n\n/** A named picker part: a component with its slot as a static. @public */\nexport interface ToolbarSlotPartComponent {\n /** Changes, replaces, or hides the control the part stands for. */\n (props: ToolbarSlotPartProps): ReactNode;\n /** The slot the part stands for. The toolbar reads it to place the part. */\n readonly pptxSlot: ChromeSlotId;\n}\n\n/**\n * The slot props a named part stands for: children of a button part are icon content (as in\n * DOCX Editor), and the part's name goes along for warning text. @internal\n */\nexport function namedPartSlotProps(\n slot: ChromeSlotId,\n props: Record<string, unknown>,\n partName: string | undefined\n): ToolbarSlotProps {\n const shape = chromeControlForSlot(slot)?.shape;\n // A picker part keeps its props as given, so a stray `icon` or `asChild` still warns.\n if (shape !== undefined && shape !== 'icon')\n return { ...props, slotId: slot, [NAMED_PART]: partName } as unknown as ToolbarSlotProps;\n const { children, icon, ...rest } = props as { children?: ReactNode; icon?: ReactNode };\n const asChild = (props as { asChild?: boolean }).asChild === true;\n return {\n ...rest,\n slotId: slot,\n ...(asChild ? { icon, children } : { icon: icon ?? children }),\n [NAMED_PART]: partName,\n } as unknown as ToolbarSlotProps;\n}\n\n/** Props for `PptxEditor.Toolbar.Group`. @public */\nexport interface ToolbarGroupProps {\n /** A built-in group id changes that group; any other id adds a host group. */\n readonly id: ChromeGroupId | (string & {});\n /** Remove the whole group and its separator, from the bar and the More menu. */\n readonly hidden?: boolean;\n /** The accessible name of a host group. Wins over `labelKey`. */\n readonly label?: string;\n /** A translation key for the name of a host group, used when there is no `label`. */\n readonly labelKey?: string;\n /**\n * Collapse priority: a lower number leaves the bar for the More menu first. Built-in groups\n * use 10 (the last group) up to 90 (history). A host group without one leaves first.\n */\n readonly priority?: number;\n /** Keep the group on the bar at every width. */\n readonly pinned?: boolean;\n /**\n * The group a host group follows. Without it, a host group follows every built-in group.\n * A built-in id ignores it, with a development warning.\n */\n readonly after?: ChromeGroupId | (string & {});\n /** A class name added to the group's element. */\n readonly className?: string;\n /**\n * Content for the group in the More menu: after the controls of a built-in group, as in\n * DOCX Editor, so a built-in id adds a menu-only row; in place of a host group's controls.\n */\n readonly overflowContent?: () => ReactNode;\n /** Controls added after the group's built-in controls, or the controls of a host group. */\n readonly children?: ReactNode;\n}\n\n/** The overrides declared as `Toolbar` children when the preset is on. */\nexport interface ToolbarOverrides {\n readonly slots: ReadonlyMap<string, ToolbarSlotProps>;\n readonly groups: ReadonlyMap<string, ToolbarGroupProps>;\n /** Other children: a loose `Toolbar.Action` or host element, after the groups. */\n readonly extras: readonly ReactNode[];\n}\n\n/** The one element child of an `asChild` slot, or null (with a warning) when there is not one. */\nfunction asChildElement(props: ToolbarSlotProps): ReactElement<HostElementProps> | null {\n const children = Children.toArray(props.children);\n const [child] = children;\n if (children.length === 1 && isValidElement<HostElementProps>(child)) return child;\n warnAsChildChild(props.slotId, slotPartNames(props));\n return null;\n}\n\n/** The props a slot part reads. Anything else (`style`, `data-*`, a listener) never reaches the control. */\nconst SLOT_PROPS: ReadonlySet<string> = new Set([\n 'slotId',\n 'hidden',\n 'icon',\n 'className',\n 'asChild',\n 'children',\n]);\n\n/** The control a slot renders, with the slot's overrides applied. */\nexport function SlotControl({\n props,\n render,\n}: {\n props: ToolbarSlotProps | undefined;\n render: () => ReactNode;\n}): ReactNode {\n if (!props) return render();\n if (props.hidden) return null;\n const parts = slotPartNames(props);\n const ignored = Object.keys(props).filter((key) => !SLOT_PROPS.has(key));\n warnIgnoredSlotAttributes(props.slotId, ignored, 'className', parts);\n // The children of a compound named part (`Toolbar.FontFamily`) compose its sub-parts inside\n // the control's root; any other slot's children replace the control.\n const named = (props as { [NAMED_PART]?: string })[NAMED_PART];\n const compose = !!named && TOOLBAR_COMPOUND_SLOTS.has(props.slotId);\n if (!props.asChild && props.children !== undefined && !compose) {\n // The children replace the control, so a setting for the control does nothing: say so.\n if (props.className) warnReplacedControlSetting(props.slotId, 'className', parts);\n if (props.icon !== undefined) warnReplacedControlSetting(props.slotId, 'icon', parts);\n return <>{props.children}</>;\n }\n const control = compose ? chromeControlForSlot(props.slotId) : null;\n const body =\n control && !props.asChild && props.children !== undefined\n ? () => (\n <FontFamilyControl slot={props.slotId} control={control}>\n {props.children}\n </FontFamilyControl>\n )\n : render;\n const child = props.asChild ? asChildElement(props) : null;\n return (\n <SlotOverrideContext.Provider\n value={{\n slotId: props.slotId,\n ...(props.icon !== undefined ? { icon: props.icon } : {}),\n ...(props.className ? { className: props.className } : {}),\n ...(child ? { asChild: child } : {}),\n // The named part's name, for warning text.\n [NAMED_PART]: named,\n }}\n >\n {body()}\n </SlotOverrideContext.Provider>\n );\n}\n","/** @jsxImportSource react */\n// The font family picker, after DOCX Editor's `FontFamily` toolbar compound\n// (docx-editor/packages/react/src/editor/toolbar/FontFamily.tsx): a root that holds the picker\n// state in a part-level context, and the `Trigger`, `Content`, and `Item` parts that read it.\n// With no children the root renders a trigger and a search field over a list box of groups (the\n// slide's theme fonts, labeled Headings and Body; the fonts in this presentation; all fonts),\n// each name drawn in its own face, the current family marked and scrolled into view when the\n// list opens. With children, a host composes the parts itself. Core's `font-picker.ts` builds\n// the groups and rows, and the Vue twin (`packages/vue/src/FontFamilyControl.tsx`) renders the\n// same markup.\n\nimport {\n createContext,\n useContext,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n type RefObject,\n} from 'react';\nimport {\n firstFontPickerFamily,\n focusFontOption,\n fontPickerGroups,\n fontPickerRow,\n isCurrentFontRow,\n revealCurrentFont,\n warnInvalidFontItem,\n warnPartOutsideCompound,\n type ChromeControl,\n type ChromeSlotId,\n type FontPickerGroup,\n type FontPickerRow,\n} from '@pptx-editor.dev/core/editor';\nimport { Icon, Popover, focusText, keepFocus, useAriaDisabled } from './chrome.tsx';\nimport { useEditorState, usePptxEditor, useTranslation } from './context.ts';\nimport { useSlot } from './slot.ts';\nimport { useTriggerAttributes } from './slot-override.ts';\nimport type { ToolbarSlotPartProps } from './toolbar-parts.tsx';\n\n/** The font the text uses: its family name and the theme font it comes from, if any. */\ninterface CurrentFont {\n readonly family: string | null;\n readonly theme: 'major' | 'minor' | null;\n}\n\n/** The picker state the parts share. */\ninterface FontFamilyState {\n readonly slot: ChromeSlotId;\n readonly label: string;\n readonly open: boolean;\n readonly setOpen: (next: boolean) => void;\n readonly query: string;\n readonly setQuery: (query: string) => void;\n readonly groups: readonly FontPickerGroup[];\n readonly current: CurrentFont;\n /** Apply a row's value (a theme font reference or a family) and close the list. */\n readonly pick: (value: string) => void;\n /** The row a host's `Item value` stands for, or null for a value that is not a font name. */\n readonly rowFor: (value: string) => FontPickerRow | null;\n readonly anchor: RefObject<HTMLButtonElement | null>;\n readonly list: RefObject<HTMLDivElement | null>;\n readonly trigger: ReturnType<typeof useTriggerAttributes>;\n readonly slotState: ReturnType<typeof useSlot>;\n readonly off: ReturnType<typeof useAriaDisabled>;\n}\n\nconst FontFamilyContext = createContext<FontFamilyState | null>(null);\n\n/** The shared state, or null (with a warning) outside `Toolbar.FontFamily`. */\nfunction useFontFamilyState(part: string): FontFamilyState | null {\n const state = useContext(FontFamilyContext);\n if (!state) warnPartOutsideCompound(`Toolbar.FontFamily.${part}`, 'Toolbar.FontFamily');\n return state;\n}\n\nconst join = (...names: (string | undefined)[]): string => names.filter(Boolean).join(' ');\n\n/** Props of `Toolbar.FontFamily.Trigger` and `Toolbar.FontFamily.Content`. @public */\nexport interface FontFamilyPartProps {\n /** A class name added to the part's element. */\n readonly className?: string;\n /** Content in place of the part's default content. */\n readonly children?: ReactNode;\n}\n\n/** Props of `Toolbar.FontFamily.Item`. @public */\nexport interface FontFamilyItemProps extends FontFamilyPartProps {\n /**\n * What the item applies: a family name, or a theme font reference (`+mj-lt` for the headings\n * font, `+mn-lt` for the body font), so the text follows a later theme change.\n */\n readonly value: string;\n}\n\n/**\n * The button that opens the list: the current family, or the label when the selection has no\n * one family. Children replace its content.\n */\nfunction FontFamilyTrigger({ className, children }: FontFamilyPartProps): ReactNode {\n const state = useFontFamilyState('Trigger');\n if (!state) return null;\n const { cmd, label, tip } = state.slotState;\n return (\n <>\n <button\n ref={state.anchor}\n type=\"button\"\n {...state.trigger}\n className={join(state.trigger.className, className)}\n data-slot={state.slot}\n aria-label={label}\n aria-haspopup=\"dialog\"\n aria-expanded={state.open}\n {...tip}\n {...state.off.attrs}\n onMouseDown={keepFocus}\n onClick={() => {\n state.setQuery('');\n state.setOpen(!state.open);\n }}\n >\n {children ?? (\n <>\n <span className=\"pptx-toolbar__family-label\">{cmd.value ?? label}</span>\n <Icon name=\"expand_more\" className=\"pptx-icon pptx-toolbar__caret\" />\n </>\n )}\n </button>\n {state.off.note}\n </>\n );\n}\n\n/** One family row: an `option` with the name in its own face and the theme role, if any. */\nfunction FontRow({\n row,\n className,\n children,\n}: {\n row: FontPickerRow;\n className?: string | undefined;\n children?: ReactNode;\n}): ReactNode {\n const { t } = useTranslation();\n const state = useContext(FontFamilyContext);\n if (!state) return null;\n const current = !row.disabled && isCurrentFontRow(row, state.current.family, state.current.theme);\n // The face is a quoted, validated family name (core's `fontFaceValue`), set as a custom\n // property through a style object, never a CSS string.\n const face = row.face ? ({ '--pptx-font-face': row.face } as CSSProperties) : undefined;\n return (\n <button\n type=\"button\"\n role=\"option\"\n aria-selected={current}\n tabIndex={-1}\n disabled={row.disabled}\n className={join('pptx-menu__item pptx-font-picker__option', className)}\n data-family={row.family || undefined}\n data-theme={row.theme ?? undefined}\n onClick={() => state.pick(row.value)}\n >\n {children ?? (\n <>\n {row.family ? (\n <span className=\"pptx-font-picker__face\" style={face}>\n {row.family}\n </span>\n ) : null}\n {row.roleKey ? <span className=\"pptx-font-picker__role\">{t(row.roleKey)}</span> : null}\n </>\n )}\n {current ? <Icon name=\"check\" className=\"pptx-icon pptx-menu__check\" /> : null}\n </button>\n );\n}\n\n/**\n * One option of the list: it applies `value` and carries the check mark while the text uses\n * that font. Children replace the name and role. A theme font that the slide's theme leaves\n * empty shows its role, disabled. A value that is not a font name renders nothing, with a\n * development warning.\n */\nfunction FontFamilyItem({ value, className, children }: FontFamilyItemProps): ReactNode {\n const state = useFontFamilyState('Item');\n if (!state) return null;\n const row = state.rowFor(value);\n if (!row) {\n warnInvalidFontItem('Toolbar.FontFamily.Item', value);\n return null;\n }\n return (\n <FontRow row={row} className={className}>\n {children}\n </FontRow>\n );\n}\n\n/** One labeled group of the list box. */\nfunction FontGroup({ group }: { group: FontPickerGroup }): ReactNode {\n const { t } = useTranslation();\n const id = useId();\n return (\n <div className=\"pptx-font-picker__group\" role=\"group\" aria-labelledby={id}>\n <div id={id} role=\"presentation\" className=\"pptx-menu__heading pptx-font-picker__heading\">\n {t(group.labelKey)}\n </div>\n {group.rows.map((row) => (\n <FontRow key={row.value} row={row} />\n ))}\n </div>\n );\n}\n\n/**\n * The list, while it is open. With no children: a search field over the theme, presentation,\n * and all-fonts groups. With children: a list box of the host's `Item` parts.\n */\nfunction FontFamilyContent({ className, children }: FontFamilyPartProps): ReactNode {\n const state = useFontFamilyState('Content');\n const { t } = useTranslation();\n if (!state || !state.open) return null;\n const { groups } = state;\n return (\n <Popover anchor={state.anchor.current} role=\"dialog\" field onClose={() => state.setOpen(false)}>\n <div className={join('pptx-font-picker', className)}>\n {children === undefined ? (\n <input\n className=\"pptx-font-picker__search\"\n type=\"search\"\n placeholder={t('toolbar.fontSearch')}\n aria-label={t('toolbar.fontSearch')}\n value={state.query}\n autoFocus\n onChange={(e) => state.setQuery(e.target.value)}\n onKeyDown={(e) => {\n if (e.key !== 'Enter') return;\n // The key stops here, so it does not press the trigger and open the list again.\n e.preventDefault();\n const first = firstFontPickerFamily(groups);\n if (first) state.pick(first);\n }}\n />\n ) : null}\n <div\n ref={state.list}\n className=\"pptx-font-picker__list\"\n role=\"listbox\"\n aria-label={state.label}\n >\n {children !== undefined ? (\n children\n ) : (\n <>\n {groups.map((g) => (\n <FontGroup key={g.id} group={g} />\n ))}\n {groups.length === 0 ? (\n <p className=\"pptx-font-picker__empty\">{t('toolbar.fontNone')}</p>\n ) : null}\n </>\n )}\n </div>\n </div>\n </Popover>\n );\n}\n\n/** Props of the font family root, as the toolbar renders it. @internal */\nexport interface FontFamilyControlProps {\n readonly slot: ChromeSlotId;\n readonly control: ChromeControl;\n /** `Trigger`, `Content`, and `Item` parts in place of the default trigger and list. */\n readonly children?: ReactNode;\n}\n\n/**\n * The font family picker: the toolbar's part for `font.family`, and the root of the\n * `Toolbar.FontFamily` compound. @internal\n */\nexport function FontFamilyControl({ slot, control, children }: FontFamilyControlProps) {\n const slotState = useSlot(slot, control);\n const { cmd, reason } = slotState;\n const off = useAriaDisabled(!cmd.isEnabled, reason);\n const editor = usePptxEditor();\n const anchor = useRef<HTMLButtonElement>(null);\n const list = useRef<HTMLDivElement>(null);\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState('');\n // The groups change with the deck (embedded and host fonts) and with the slide's theme.\n useEditorState((s) => s.revision);\n const slide = useEditorState((s) => s.currentSlide);\n const groups = open ? fontPickerGroups(editor, slide, query) : [];\n // The check mark follows what the text uses: a theme font marks its theme row only.\n const theme = useEditorState((s) => s.format?.fontFamilyTheme ?? null);\n const trigger = useTriggerAttributes(slot, 'pptx-toolbar__field pptx-toolbar__field--family', {\n disabled: !cmd.isEnabled,\n });\n // Once, when the list opens: the current family comes into view.\n useLayoutEffect(() => {\n if (open) revealCurrentFont(list.current);\n }, [open]);\n // After the popover took focus: a list with no search field focuses its current option, so\n // the arrow keys reach the host's `Item` parts.\n useEffect(() => {\n if (open) focusFontOption(list.current);\n }, [open]);\n const state: FontFamilyState = {\n slot,\n label: slotState.label,\n open,\n setOpen,\n query,\n setQuery,\n groups,\n current: { family: typeof cmd.value === 'string' ? cmd.value : null, theme },\n // A theme row applies its theme font reference (`+mj-lt`, `+mn-lt`), any other row its\n // family.\n pick: (value) => {\n cmd.execute(value);\n focusText(editor, anchor.current);\n setOpen(false);\n },\n rowFor: (value) => fontPickerRow(editor, slide, value),\n anchor,\n list,\n trigger,\n slotState,\n off,\n };\n return (\n <FontFamilyContext.Provider value={state}>\n {children ?? (\n <>\n <FontFamilyTrigger />\n <FontFamilyContent />\n </>\n )}\n </FontFamilyContext.Provider>\n );\n}\n\n/**\n * Props of `Toolbar.FontFamily`: a picker part's `className` and `hidden`, and children that\n * compose its `Trigger`, `Content`, and `Item` parts. @public\n */\nexport interface FontFamilyProps extends ToolbarSlotPartProps {\n /** `Toolbar.FontFamily.Trigger` and `Toolbar.FontFamily.Content`, in place of the defaults. */\n readonly children?: ReactNode;\n}\n\n/**\n * `Toolbar.FontFamily`: the `font.family` picker, as DOCX Editor's `FontFamily` compound. With\n * no children it renders the default trigger and list; with children, compose the `Trigger`,\n * `Content`, and `Item` parts around the shared state. @public\n */\nexport interface FontFamilyNamespace {\n /** Changes, hides, or recomposes the font family picker. */\n (props: FontFamilyProps): ReactNode;\n /** The slot the part stands for. The toolbar reads it to place the part. */\n readonly pptxSlot: ChromeSlotId;\n /** The button that opens the list. */\n readonly Trigger: (props: FontFamilyPartProps) => ReactNode;\n /** The list, while it is open. */\n readonly Content: (props: FontFamilyPartProps) => ReactNode;\n /** One option of the list. */\n readonly Item: (props: FontFamilyItemProps) => ReactNode;\n}\n\n/** The sub-parts of `Toolbar.FontFamily`, as DOCX Editor's `FontFamily` statics. @internal */\nexport const FONT_FAMILY_PARTS = {\n Trigger: FontFamilyTrigger,\n Content: FontFamilyContent,\n Item: FontFamilyItem,\n} as const;\n","/** @jsxImportSource react */\n// The toolbar's Font size control: Decrease, the size box, and Increase. Split from\n// `Toolbar.tsx`; the stepper shape of `CHROME_GROUPS` renders it.\n\nimport { useEffect, useId, useRef, useState } from 'react';\nimport { ToolButton, focusText, useAriaDisabled } from './chrome.tsx';\nimport { useEditorState, usePptxEditor, useTranslation } from './context.ts';\nimport { useSlot, type SlotPartProps } from './slot.ts';\nimport { useTriggerAttributes } from './slot-override.ts';\nimport {\n SIZE_ERROR_MS,\n parseToolbarSize,\n sizeErrorPlace,\n toolbarSizeRefusal,\n toolbarSizeText,\n} from '@pptx-editor.dev/core/editor';\n\n/** The `font.size` stepper. @internal */\nexport function SizeControl({ slot, control }: SlotPartProps) {\n const { cmd, label, reason, tip } = useSlot(slot, control);\n const editor = usePptxEditor();\n const { t } = useTranslation();\n // The steps are off over a mixed size, as DOCX Editor turns its steppers off.\n const mixed = useEditorState((s) => s.format?.font?.disagrees.fontSizePt === true);\n const [draft, setDraft] = useState<string | null>(null);\n const box = useRef<HTMLInputElement>(null);\n // Set when Enter or Escape has already handled the box, so the blur that follows does nothing.\n const handled = useRef(false);\n // Over a mixed size the box is blank, as the Font dialog's size field is.\n const value = toolbarSizeText(cmd.value, mixed);\n const off = useAriaDisabled(!cmd.isEnabled, reason);\n // A size out of range is refused with its range, under the box, and announced.\n const errorId = useId();\n const [error, setError] = useState<{ text: string; left: number; top: number } | null>(null);\n useEffect(() => {\n if (!error) return;\n const timer = setTimeout(() => setError(null), SIZE_ERROR_MS);\n return () => clearTimeout(timer);\n }, [error]);\n const commit = (): void => {\n const refusal = toolbarSizeRefusal(draft);\n const n = parseToolbarSize(draft);\n if (!handled.current && refusal)\n setError({ text: t(refusal.key, refusal.params), ...sizeErrorPlace(box.current) });\n else if (!handled.current && n !== null) cmd.execute(n);\n handled.current = false;\n setDraft(null);\n };\n // Enter and Escape hand the caret back to the text, as DOCX Editor's size box does, so a size\n // armed at a caret applies to the text typed next.\n const leave = (apply: boolean): void => {\n if (apply) commit();\n setDraft(null);\n handled.current = true;\n focusText(editor, box.current);\n if (box.current?.ownerDocument.activeElement === box.current) handled.current = false;\n };\n return (\n <span\n {...useTriggerAttributes(slot, 'pptx-toolbar__stepper', { disabled: !cmd.isEnabled })}\n data-slot={slot}\n >\n <ToolButton\n label={t('toolbar.fontSizeDecrease')}\n icon=\"remove\"\n className=\"pptx-toolbar__step\"\n disabled={!cmd.isEnabled || mixed}\n disabledReason={mixed ? t('disabled.mixedSize') : reason}\n onClick={() => cmd.execute({ step: -1 })}\n />\n <input\n ref={box}\n className=\"pptx-toolbar__size\"\n aria-label={label}\n {...tip}\n value={draft ?? value}\n {...(error ? { 'aria-invalid': true, 'aria-describedby': errorId } : {})}\n {...off.attrs}\n readOnly={!cmd.isEnabled}\n onChange={(e) => {\n setDraft(e.target.value);\n setError(null);\n }}\n onBlur={commit}\n onKeyDown={(e) => {\n // The key stops here: Enter must not reach the slide text, and Escape must not close a\n // More card around the box (focus goes to the text instead).\n if (e.key !== 'Enter' && e.key !== 'Escape') return;\n e.preventDefault();\n e.stopPropagation();\n leave(e.key === 'Enter');\n }}\n />\n <ToolButton\n label={t('toolbar.fontSizeIncrease')}\n icon=\"add\"\n className=\"pptx-toolbar__step\"\n disabled={!cmd.isEnabled || mixed}\n disabledReason={mixed ? t('disabled.mixedSize') : reason}\n onClick={() => cmd.execute({ step: 1 })}\n />\n {off.note}\n {error ? (\n <span\n id={errorId}\n role=\"alert\"\n className=\"pptx-toolbar__size-error\"\n style={{ left: error.left, top: error.top }}\n >\n {error.text}\n </span>\n ) : null}\n </span>\n );\n}\n","// The toolbar's measuring and focus helpers, kept apart from `Toolbar.tsx` (its 1,000-line cap):\n// roving focus here, and the room and separator measures from core. After DOCX Editor's\n// `toolbar-measure.ts` and `useToolbarOverflow`.\n\nimport { useLayoutEffect, useState, type KeyboardEvent as ReactKeyboardEvent } from 'react';\nimport {\n syncToolbarTabStop,\n toolbarArrowKey,\n toolbarFocusTracker,\n} from '@pptx-editor.dev/core/editor';\n\n// The room and separator measures live in core, shared with the Vue twin.\nexport { separatorCost, toolbarRoom } from '@pptx-editor.dev/core/editor';\n\n/**\n * One Tab stop and arrow keys for a toolbar element (`toolbar-focus.ts` in core): the control\n * that last had focus keeps the Tab stop, and the arrows move between the controls, disabled\n * ones too. When the focused control leaves the bar with its group (the selection changed),\n * the focus stays in the bar (`toolbarFocusTracker`).\n */\nexport function useRovingToolbar(ref: { readonly current: HTMLElement | null }) {\n const [tracker] = useState(toolbarFocusTracker);\n useLayoutEffect(() => {\n const bar = ref.current;\n if (!bar) return;\n syncToolbarTabStop(bar, bar.ownerDocument.activeElement);\n tracker.restore(bar);\n });\n return {\n onFocus: (event: { readonly target: EventTarget }) => {\n if (!ref.current) return;\n tracker.focus(ref.current, event.target);\n syncToolbarTabStop(ref.current, event.target as Element);\n },\n onBlur: (event: {\n readonly target: EventTarget;\n readonly relatedTarget: EventTarget | null;\n }) => {\n if (ref.current) tracker.blur(ref.current, event.target, event.relatedTarget);\n },\n onKeyDown: (event: ReactKeyboardEvent<HTMLDivElement>) => {\n const bar = ref.current;\n if (!bar) return;\n const rtl = getComputedStyle(bar).direction === 'rtl';\n if (toolbarArrowKey(bar, event.nativeEvent, rtl)) event.preventDefault();\n },\n };\n}\n","/** @jsxImportSource react */\n// Host-owned toolbar controls, after DOCX Editor's `ToolbarAction` and `ToolbarSeparator`\n// (docx-editor/packages/react/src/editor/toolbar/ToolbarAction.tsx, parts.tsx).\n//\n// `Toolbar.Slot` and the named parts are bound to a registered slot: the engine owns their\n// label, icon, and enabled state. A host's own action (\"Send for review\") has no slot and\n// never will. `Toolbar.Action` gives it the toolbar's button styling, state attributes, and\n// the caret guard (a chrome mousedown never moves the slide selection), so a host does not\n// copy private class names. It is not a way to fake a slot: enabled and pressed state are the\n// host's to supply.\n\nimport { Children, Fragment, isValidElement, type ReactElement, type ReactNode } from 'react';\nimport { tooltipAttributes, warnAsChildChild } from '@pptx-editor.dev/core/editor';\nimport { keepFocus, useAriaDisabled } from './chrome.tsx';\nimport { buttonRoleProps, renderAsChild, type HostElementProps } from './slot-override.ts';\n\n/** Props for `PptxEditor.Toolbar.Action`. @public */\nexport interface ToolbarActionProps {\n /** The accessible name and tooltip: a resolved string from the host's own catalog. */\n readonly label: string;\n /** Icon content, about 18 pixels, as the packaged icons. */\n readonly icon?: ReactNode;\n /** The pressed state, for an action that toggles: `aria-pressed` and `data-active`. */\n readonly active?: boolean;\n /** Turn the action off: the button stays focusable (`aria-disabled`) and `onSelect` does not run. */\n readonly disabled?: boolean;\n /** Why the action is disabled: in the tooltip and spoken through `aria-describedby`. */\n readonly disabledReason?: string;\n /** Runs the host's action. */\n readonly onSelect?: () => void;\n /** Merge the behavior onto the single child element instead of rendering a `<button>`. */\n readonly asChild?: boolean;\n /** A class name added to the button. */\n readonly className?: string;\n /** Visible content when there is no `icon`, or the element for `asChild`. */\n readonly children?: ReactNode;\n}\n\n/**\n * A host-owned toolbar action, styled and behaved like the packaged controls. Put it in a\n * `Toolbar.Group` so it collapses into the More menu with its group. A direct child of a\n * preset toolbar goes after the groups and never collapses, as in DOCX Editor. Without an\n * `icon` or children, it shows its `label` as text.\n *\n * @example\n * ```tsx\n * <PptxEditor.Toolbar>\n * <PptxEditor.Toolbar.Group id=\"review\" label=\"Review\" priority={15}>\n * <PptxEditor.Toolbar.Action label=\"Send for review\" icon={<SendIcon />} onSelect={send} />\n * </PptxEditor.Toolbar.Group>\n * </PptxEditor.Toolbar>\n * ```\n *\n * @public\n */\nexport function ToolbarAction(props: ToolbarActionProps): ReactNode {\n const { label, icon, active, disabled, disabledReason, onSelect, asChild, className, children } =\n props;\n // Focusable when disabled, with its reason spoken, as every toolbar control.\n const off = useAriaDisabled(!!disabled, disabledReason);\n const shared = {\n className: ['pptx-toolbar__button', className].filter(Boolean).join(' '),\n 'aria-label': label,\n ...tooltipAttributes(label, disabled, disabledReason),\n // The same presence attributes as the registered controls, so one stylesheet selects both.\n 'data-active': active ? '' : undefined,\n 'data-disabled': disabled ? '' : undefined,\n 'aria-pressed': active === undefined ? undefined : active,\n 'aria-describedby': off.attrs['aria-describedby'],\n onMouseDown: keepFocus,\n };\n const only = asChild ? Children.toArray(children) : [];\n const child =\n only.length === 1 && isValidElement<HostElementProps>(only[0])\n ? (only[0] as ReactElement<HostElementProps>)\n : null;\n if (asChild && !child) warnAsChildChild(label, ACTION_PARTS);\n // `onSelect` takes no argument: the event or the element never reaches it.\n const select = disabled ? undefined : () => onSelect?.();\n if (child) {\n const isButton = child.type === 'button';\n return (\n <>\n {renderAsChild(child, {\n ...shared,\n ...(isButton ? { type: 'button' } : buttonRoleProps(select)),\n 'aria-disabled': disabled ? true : undefined,\n onClick: select,\n })}\n {off.note}\n </>\n );\n }\n // A misused `asChild` falls back to the packaged button with the label.\n const own = asChild ? undefined : children;\n const content = icon ?? (own === null || own === false ? undefined : own);\n // Text needs room, laid out beside any icon: the label, or children with a text node in them\n // (`<SendIcon /> Send`). An element alone is icon content. The Vue twin uses the same rule.\n const text = icon == null && (content === undefined || hasText(content));\n const button = (\n <button\n type=\"button\"\n {...shared}\n className={[shared.className, text ? 'pptx-toolbar__button--text' : '']\n .filter(Boolean)\n .join(' ')}\n aria-disabled={disabled ? true : undefined}\n onClick={select}\n >\n {content ?? label}\n </button>\n );\n return off.note ? (\n <>\n {button}\n {off.note}\n </>\n ) : (\n button\n );\n}\n\n/** Whether children hold a text node at the top level (through fragments and arrays). */\nfunction hasText(node: ReactNode): boolean {\n if (typeof node === 'string' || typeof node === 'number') return String(node).trim() !== '';\n if (Array.isArray(node)) return node.some(hasText);\n return (\n isValidElement<{ children?: ReactNode }>(node) &&\n node.type === Fragment &&\n hasText(node.props.children)\n );\n}\n\n/** Warning names for `Toolbar.Action`: it is a part of its own, not a slot. */\nconst ACTION_PARTS = { slot: 'Toolbar.Action', group: 'Toolbar.Group' } as const;\n\n/** Props for `PptxEditor.Toolbar.Separator`. @public */\nexport interface ToolbarSeparatorProps {\n /** A class name added to the separator. */\n readonly className?: string;\n}\n\n/** A vertical rule between controls, for a `preset={false}` toolbar. @public */\nexport function ToolbarSeparator({ className }: ToolbarSeparatorProps): ReactNode {\n return (\n <span\n role=\"separator\"\n aria-orientation=\"vertical\"\n className={['pptx-toolbar__sep', className].filter(Boolean).join(' ')}\n />\n );\n}\n","/** @jsxImportSource react */\n// The named toolbar parts (`Toolbar.Bold`, `Toolbar.FontFamily`, …), after DOCX Editor's\n// `definePart` (docx-editor/packages/react/src/editor/toolbar/parts.tsx). Each part is a\n// `Toolbar.Slot` with its slot pinned, and carries the slot as a static (`pptxSlot`), so the\n// toolbar recognizes it among its children and puts it in the slot's place. The table of\n// names lives in core (`TOOLBAR_NAMED_PARTS`), so the Vue twin uses the same names.\n\nimport type { ReactNode } from 'react';\nimport { TOOLBAR_NAMED_PARTS, type ChromeSlotId } from '@pptx-editor.dev/core/editor';\nimport { ToolbarSlot } from './Toolbar.tsx';\nimport {\n namedPartSlotProps,\n type ToolbarColorSplitComponent,\n type ToolbarPartComponent,\n type ToolbarSlotPartComponent,\n} from './toolbar-parts.tsx';\nimport { FONT_FAMILY_PARTS, type FontFamilyNamespace } from './FontFamilyControl.tsx';\n\nfunction definePart(name: string, slot: ChromeSlotId): ToolbarPartComponent {\n const Part = (props: Record<string, unknown>): ReactNode => (\n <ToolbarSlot {...namedPartSlotProps(slot, props, `Toolbar.${name}`)} />\n );\n return Object.assign(Part, { pptxSlot: slot }) as unknown as ToolbarPartComponent;\n}\n\n/**\n * Every named toolbar part, attached to `PptxEditor.Toolbar` as statics: button parts take\n * `ToolbarPartProps`, picker parts `ToolbarSlotPartProps`, as in DOCX Editor. @public\n */\nexport interface ToolbarNamedParts {\n /** `history.undo`. */\n readonly Undo: ToolbarPartComponent;\n /** `history.redo`. */\n readonly Redo: ToolbarPartComponent;\n /** `font.family`, with its `Trigger`, `Content`, and `Item` parts. */\n readonly FontFamily: FontFamilyNamespace;\n /** `font.size`. */\n readonly FontSize: ToolbarSlotPartComponent;\n /** `text.bold`. */\n readonly Bold: ToolbarPartComponent;\n /** `text.italic`. */\n readonly Italic: ToolbarPartComponent;\n /** `text.underline`. */\n readonly Underline: ToolbarPartComponent;\n /** `text.strike`. */\n readonly Strike: ToolbarPartComponent;\n /** `text.color`. */\n readonly FontColor: ToolbarColorSplitComponent;\n /** `text.highlight`. */\n readonly Highlight: ToolbarColorSplitComponent;\n /** `text.link`. */\n readonly Link: ToolbarPartComponent;\n /** `format.clear`. */\n readonly ClearFormatting: ToolbarPartComponent;\n /** `text.characterSpacing`. */\n readonly CharacterSpacing: ToolbarSlotPartComponent;\n /** `text.changeCase`. */\n readonly ChangeCase: ToolbarSlotPartComponent;\n /** `text.dialog`: opens the Font dialog. */\n readonly Font: ToolbarPartComponent;\n /** `script.super`. */\n readonly Superscript: ToolbarPartComponent;\n /** `script.sub`. */\n readonly Subscript: ToolbarPartComponent;\n /** `paragraph.align`. */\n readonly Alignment: ToolbarSlotPartComponent;\n /** `paragraph.valign`. */\n readonly VerticalAlignment: ToolbarSlotPartComponent;\n /** `list.bullet`. */\n readonly BulletList: ToolbarPartComponent;\n /** `list.numbered`. */\n readonly NumberedList: ToolbarPartComponent;\n /** `list.bulletStyle`: the Bullets gallery. */\n readonly BulletStyle: ToolbarSlotPartComponent;\n /** `list.numberStyle`: the Numbering gallery. */\n readonly NumberStyle: ToolbarSlotPartComponent;\n /** `list.outdent`. */\n readonly Outdent: ToolbarPartComponent;\n /** `list.indent`. */\n readonly Indent: ToolbarPartComponent;\n /** `list.lineSpacing`. */\n readonly LineSpacing: ToolbarSlotPartComponent;\n /** `paragraph.dialog`: opens the Paragraph dialog. */\n readonly Paragraph: ToolbarPartComponent;\n /** `paragraph.textDirection`. */\n readonly TextDirection: ToolbarSlotPartComponent;\n /** `paragraph.autofit`. */\n readonly Autofit: ToolbarSlotPartComponent;\n /** `paragraph.columns`. */\n readonly Columns: ToolbarSlotPartComponent;\n /** `insert.textBox`. */\n readonly TextBox: ToolbarPartComponent;\n /** `insert.line`. */\n readonly Line: ToolbarSlotPartComponent;\n /** `insert.shape`. */\n readonly Shapes: ToolbarSlotPartComponent;\n /** `insert.image`. */\n readonly ImageInsert: ToolbarPartComponent;\n /** `shape.fill`. */\n readonly ShapeFill: ToolbarColorSplitComponent;\n /** `shape.lineColor`. */\n readonly LineColor: ToolbarColorSplitComponent;\n /** `shape.lineWidth`. */\n readonly LineWidth: ToolbarSlotPartComponent;\n /** `shape.lineStart`. */\n readonly LineStart: ToolbarSlotPartComponent;\n /** `shape.lineEnd`. */\n readonly LineEnd: ToolbarSlotPartComponent;\n /** `shape.lineDash`. */\n readonly LineDash: ToolbarSlotPartComponent;\n /** `shape.styles`. */\n readonly ShapeStyles: ToolbarSlotPartComponent;\n /** `shape.effects`. */\n readonly ShapeEffects: ToolbarSlotPartComponent;\n /** `shape.properties`. */\n readonly FormatShape: ToolbarPartComponent;\n /** `format.painter`. */\n readonly FormatPainter: ToolbarPartComponent;\n /** `arrange.order`. */\n readonly Order: ToolbarSlotPartComponent;\n /** `arrange.align`. */\n readonly AlignObjects: ToolbarSlotPartComponent;\n /** `arrange.group`. */\n readonly GroupObjects: ToolbarPartComponent;\n /** `arrange.ungroup`. */\n readonly UngroupObjects: ToolbarPartComponent;\n /** `arrange.rotate`. */\n readonly Rotate: ToolbarSlotPartComponent;\n /** `arrange.selectionPane`. */\n readonly SelectionPane: ToolbarPartComponent;\n /** `more.duplicate`. */\n readonly Duplicate: ToolbarPartComponent;\n /** `more.delete`. */\n readonly Delete: ToolbarPartComponent;\n /** `find.find`. */\n readonly Find: ToolbarPartComponent;\n /** `find.replace`. */\n readonly Replace: ToolbarPartComponent;\n /** `view.smartGuides`. */\n readonly SmartGuides: ToolbarPartComponent;\n /** `file.pageSetup`. */\n readonly PageSetup: ToolbarPartComponent;\n /** `edit.cut`. */\n readonly Cut: ToolbarPartComponent;\n /** `edit.copy`. */\n readonly Copy: ToolbarPartComponent;\n /** `edit.paste`. */\n readonly Paste: ToolbarPartComponent;\n /** `edit.selectAll`. */\n readonly SelectAll: ToolbarPartComponent;\n /** `slide.background`. */\n readonly FormatBackground: ToolbarPartComponent;\n /** `slide.add`: New slide, with its layout gallery. */\n readonly NewSlide: ToolbarPartComponent;\n /** `slide.layout`: the layout gallery of the current slide. */\n readonly SlideLayout: ToolbarPartComponent;\n /** `slide.reset`. */\n readonly ResetSlide: ToolbarPartComponent;\n /** `slide.hide`. */\n readonly HideSlide: ToolbarPartComponent;\n /** `view.presentationView`: the Normal or Slide sorter view. */\n readonly PresentationView: ToolbarPartComponent;\n /** `section.add`. */\n readonly AddSection: ToolbarPartComponent;\n /** `section.rename`. */\n readonly RenameSection: ToolbarPartComponent;\n /** `section.remove`. */\n readonly RemoveSection: ToolbarPartComponent;\n /** `section.removeAll`. */\n readonly RemoveAllSections: ToolbarPartComponent;\n /** `section.collapseAll`. */\n readonly CollapseAllSections: ToolbarPartComponent;\n /** `section.expandAll`. */\n readonly ExpandAllSections: ToolbarPartComponent;\n /** `view.playFromStart`. */\n readonly PlayFromStart: ToolbarPartComponent;\n /** `view.playFromCurrent`. */\n readonly PlayFromCurrent: ToolbarPartComponent;\n /** `image.corrections`. */\n readonly ImageCorrections: ToolbarPartComponent;\n /** `image.color`. */\n readonly ImageColor: ToolbarPartComponent;\n /** `image.transparency`. */\n readonly ImageTransparency: ToolbarPartComponent;\n /** `image.change`. */\n readonly ImageChange: ToolbarPartComponent;\n /** `image.reset`. */\n readonly ImageReset: ToolbarPartComponent;\n /** `image.styles`. */\n readonly ImageStyles: ToolbarPartComponent;\n /** `image.altText`. */\n readonly ImageAltText: ToolbarPartComponent;\n /** `image.crop`. */\n readonly ImageCrop: ToolbarPartComponent;\n /** `image.cropToShape`. */\n readonly ImageCropToShape: ToolbarPartComponent;\n /** `image.cropFit`. */\n readonly ImageCropFit: ToolbarPartComponent;\n /** `image.properties`. */\n readonly ImageProperties: ToolbarPartComponent;\n /** `table.insert`. */\n readonly TableInsert: ToolbarPartComponent;\n /** `table.style`. */\n readonly TableStyle: ToolbarSlotPartComponent;\n /** `table.headerRow`. */\n readonly TableHeaderRow: ToolbarPartComponent;\n /** `table.totalRow`. */\n readonly TableTotalRow: ToolbarPartComponent;\n /** `table.bandedRows`. */\n readonly TableBandedRows: ToolbarPartComponent;\n /** `table.firstColumn`. */\n readonly TableFirstColumn: ToolbarPartComponent;\n /** `table.lastColumn`. */\n readonly TableLastColumn: ToolbarPartComponent;\n /** `table.bandedColumns`. */\n readonly TableBandedColumns: ToolbarPartComponent;\n /** `table.cellFill`. */\n readonly TableCellFill: ToolbarColorSplitComponent;\n /** `table.borderTarget`. */\n readonly TableBorderTarget: ToolbarSlotPartComponent;\n /** `table.select`. */\n readonly TableSelect: ToolbarSlotPartComponent;\n /** `table.delete`. */\n readonly TableDelete: ToolbarSlotPartComponent;\n /** `table.insertRowAbove`. */\n readonly TableInsertRowAbove: ToolbarPartComponent;\n /** `table.insertRowBelow`. */\n readonly TableInsertRowBelow: ToolbarPartComponent;\n /** `table.insertColumnLeft`. */\n readonly TableInsertColumnLeft: ToolbarPartComponent;\n /** `table.insertColumnRight`. */\n readonly TableInsertColumnRight: ToolbarPartComponent;\n /** `table.mergeCells`. */\n readonly TableMergeCells: ToolbarPartComponent;\n /** `table.splitCell`. */\n readonly TableSplitCell: ToolbarSlotPartComponent;\n /** `table.distributeRows`. */\n readonly TableDistributeRows: ToolbarPartComponent;\n /** `table.distributeColumns`. */\n readonly TableDistributeColumns: ToolbarPartComponent;\n /** `table.cellMargins`. */\n readonly TableCellMargins: ToolbarSlotPartComponent;\n}\n\n/** The named parts, built from core's table. `FontFamily` carries its compound parts. */\nexport const TOOLBAR_PARTS = Object.fromEntries(\n Object.entries(TOOLBAR_NAMED_PARTS).map(([name, slot]) => {\n const part = definePart(name, slot);\n return [name, name === 'FontFamily' ? Object.assign(part, FONT_FAMILY_PARTS) : part];\n })\n) as unknown as ToolbarNamedParts;\n\n// Every name in core's table has a typed part here: a name added there and not here fails the\n// build, instead of reaching hosts as an untyped static.\ntype MissingPart = Exclude<keyof typeof TOOLBAR_NAMED_PARTS, keyof ToolbarNamedParts>;\nconst everyPartTyped: [MissingPart] extends [never] ? true : MissingPart = true;\nvoid everyPartTyped;\n","/** @jsxImportSource react */\n// The font substitution notice, matching DOCX Editor's: it lists the families that render with\n// a substitute that can change line breaks, and offers the fonts installed on this computer\n// where the browser supports it. Metric-compatible substitutes (Calibri → Carlito, …) are not\n// listed: their line breaks match the original font. The list and the local font request are\n// core's (`overlays.ts`), shared with the Vue `PptxEditorFontNotice`.\n\nimport { useEffect, useRef, useState, type ReactNode } from 'react';\nimport {\n applyLocalFonts,\n canQueryLocalFonts,\n fontNoticeFamilies,\n type ChromeTranslate,\n} from '@pptx-editor.dev/core/editor';\nimport { withChromeTranslate } from './headless-hooks.tsx';\nimport { ToolButton, keepFocus } from './chrome.tsx';\nimport { useEditorState, usePptxEditor, useTranslation } from './context.ts';\n\n/** The props of `FontNotice`. @public */\nexport interface FontNoticeProps {\n /**\n * Your translation function for the notice, as DOCX Editor's `t` on its font notice. Without\n * it, the root's `locale` gives the labels.\n */\n readonly t?: ChromeTranslate;\n /** Appended after the `pptx-font-notice` class. */\n className?: string;\n}\n\n/** The substitution notice. Renders nothing when every font is available. @public */\nexport const FontNotice: (props: FontNoticeProps) => ReactNode =\n withChromeTranslate<FontNoticeProps>(FontNoticeRoot, 'FontNotice');\n\nfunction FontNoticeRoot({ className }: Omit<FontNoticeProps, 't'>) {\n const editor = usePptxEditor();\n const { t } = useTranslation();\n const substituted = useEditorState((s) => s.substitutedFonts);\n // A newly opened document starts with no outcome of an earlier local font request.\n const loadState = useEditorState((s) => s.status);\n const missing = fontNoticeFamilies(substituted);\n const key = missing.join('|');\n const [dismissed, setDismissed] = useState<string | null>(null);\n // The outcome of a local font request, for the substituted families when it finished.\n const [outcome, setOutcome] = useState<{ text: string; key: string } | null>(null);\n const [busy, setBusy] = useState(false);\n // Each opened document starts a new round; a request from an earlier round reports nothing.\n // A request that adds fonts changes `key` itself, so only a load starts a round.\n const round = useRef(0);\n useEffect(() => {\n round.current += 1;\n setOutcome(null);\n }, [loadState]);\n // A later change to the substituted families makes the outcome stale.\n const status = outcome?.key === key ? outcome.text : null;\n if ((missing.length === 0 && !status) || dismissed === key) return null;\n const addLocalFonts = async (): Promise<void> => {\n if (!editor) return;\n setBusy(true);\n const asked = round.current;\n try {\n const result = await applyLocalFonts(editor, missing);\n const now = fontNoticeFamilies(editor.snapshot().substitutedFonts).join('|');\n if (asked === round.current) setOutcome({ text: t(result), key: now });\n } catch {\n // `setFonts` rejects only after the editor is destroyed; nothing is left to tell.\n } finally {\n setBusy(false);\n }\n };\n return (\n <div\n className={`pptx-font-notice${className ? ` ${className}` : ''}`}\n role=\"status\"\n onMouseDown={keepFocus}\n >\n <span className=\"pptx-font-notice__text\">\n {missing.length ? t('fonts.notice', { families: missing.join(', ') }) : status}\n {missing.length && status ? ` ${status}` : ''}\n </span>\n {missing.length && canQueryLocalFonts() ? (\n <button\n type=\"button\"\n className=\"pptx-font-notice__action\"\n disabled={busy || loadState === 'loading'}\n onClick={() => void addLocalFonts()}\n >\n {t('fonts.useLocal')}\n </button>\n ) : null}\n <ToolButton label={t('fonts.dismiss')} icon=\"close\" onClick={() => setDismissed(key)} />\n </div>\n );\n}\n","/** @jsxImportSource react */\n// The open-failure notice, after DOCX Editor's `DocxEditor.OpenFailure`: what a person sees when\n// the editor refuses a file (a damaged package, a file that is not a presentation). Without it a\n// refused open shows nothing, and the deck that was open looks like the new one. It reads\n// `snapshot().openFailure`, the same pull state every other consumer reads, so it also covers a\n// document passed at construction. The reason groups and their messages are core's\n// (`loading.ts`), shared with the Vue `PptxEditorOpenFailure`.\n//\n// The default text is generic on purpose: it explains the refusal and shows the stable code,\n// and names no contact. A host adds its own support action through `actions`.\n\nimport { useCallback, useId, useState, type CSSProperties, type ReactNode } from 'react';\nimport {\n OPEN_FAILURE_MESSAGE_KEYS,\n shownOpenFailure,\n type ChromeTranslate,\n type DocumentOpenFailure,\n} from '@pptx-editor.dev/core/editor';\nimport { useEditorState, useTranslation } from './context.ts';\nimport { withChromeTranslate } from './headless-hooks.tsx';\n\n/** Options for `useOpenFailure`, as DOCX Editor's `UseOpenFailureOptions`. @public */\nexport interface UseOpenFailureOptions {\n /** Your translation function for `message`. Without it, the root's `locale` gives it. */\n readonly t?: ChromeTranslate;\n}\n\n/** The current refused open, with the packaged message and a way to dismiss it. @public */\nexport interface UseOpenFailureReturn {\n /** The refused open, or `null` when there is none or the person dismissed it. */\n readonly failure: DocumentOpenFailure | null;\n /** The packaged, translated message for `failure`. */\n readonly message: string | null;\n /** Whether the deck that was open before stays open. */\n readonly kept: boolean;\n /**\n * Hide this refusal. A later refusal shows again, even for the same file. Pass the failure\n * your UI showed, so a late call cannot hide a newer refusal.\n */\n dismiss(failure?: DocumentOpenFailure | null): void;\n}\n\n/**\n * Reads the file the editor refused to open, for a host that shows it in its own UI, such as\n * a toast. Pair it with `openFailure={false}` on `<PptxEditor>`, so the packaged notice does not\n * show as well. Call it inside a `PptxEditor.Root`. @public\n */\nexport function useOpenFailure(options: UseOpenFailureOptions = {}): UseOpenFailureReturn {\n const current = useEditorState(shownOpenFailure);\n const kept = useEditorState((s) => s.status === 'ready');\n const { t: ambient } = useTranslation();\n const t = options.t ?? ambient;\n // Each refusal is a new object, so remembering the dismissed one by reference lets the next\n // refusal of the same file show again.\n const [dismissed, setDismissed] = useState<DocumentOpenFailure | null>(null);\n const failure = current !== null && current !== dismissed ? current : null;\n const dismiss = useCallback(\n (shown?: DocumentOpenFailure | null) => {\n if (!shown || shown === current) setDismissed(current);\n },\n [current]\n );\n return {\n failure,\n message: failure ? t(OPEN_FAILURE_MESSAGE_KEYS[failure.reason]) : null,\n kept,\n dismiss,\n };\n}\n\n/** What `actions` receives. @public */\nexport interface OpenFailureContext {\n /** The refused open: its stable `code` and its `reason`. */\n readonly failure: DocumentOpenFailure;\n /** The packaged, translated message for the failure. */\n readonly message: string;\n /** Close the notice. It calls `onDismiss`, as **Close** does. */\n dismiss(): void;\n}\n\n/** Props for `PptxEditor.OpenFailure`. @public */\nexport interface PptxEditorOpenFailureProps {\n /** The notice title. Defaults to the translated `openFailure.title`. */\n readonly title?: string;\n /** Your own message in place of the packaged one, as content or per failure. */\n readonly message?: ReactNode | ((failure: DocumentOpenFailure) => ReactNode);\n /** Show the stable error code under the message. Defaults to `true`. */\n readonly showCode?: boolean;\n /** Your own buttons, before **Close**. The notice shows no contact of its own. */\n readonly actions?: (context: OpenFailureContext) => ReactNode;\n /** The label of the **Close** button. Defaults to the translated `openFailure.close`. */\n readonly closeLabel?: string;\n /** Show the packaged **Close** button. Defaults to `true`. */\n readonly showClose?: boolean;\n /** Called after the person closes the notice, by any route. */\n readonly onDismiss?: (failure: DocumentOpenFailure) => void;\n /** Appended after the `pptx-open-failure` class. */\n readonly className?: string;\n /** Inline styles for the notice. */\n readonly style?: CSSProperties;\n /**\n * Your translation function for the notice, as DOCX Editor's `t`. Without it, the root's\n * `locale` gives the labels.\n */\n readonly t?: ChromeTranslate;\n}\n\n/**\n * A notice that explains why a file did not open, and says when the deck that was open stays\n * open. It shows nothing until the editor refuses a file, and shows again for each later\n * refusal. `<PptxEditor>` renders it by default; compose it yourself inside a positioned box in\n * a `PptxEditor.Root`:\n *\n * ```tsx\n * <PptxEditor.OpenFailure\n * actions={({ failure }) => (\n * <a className=\"pptx-open-failure__action\" href={`/support?code=${failure.code}`}>\n * Get help\n * </a>\n * )}\n * />\n * ```\n *\n * For a toast or a banner of your own, use `useOpenFailure`. @public\n */\nexport const OpenFailure: (props: PptxEditorOpenFailureProps) => ReactNode =\n withChromeTranslate<PptxEditorOpenFailureProps>(OpenFailureRoot, 'OpenFailure');\n\nfunction OpenFailureRoot({\n title,\n message,\n showCode = true,\n actions,\n closeLabel,\n showClose = true,\n onDismiss,\n className,\n style,\n}: Omit<PptxEditorOpenFailureProps, 't'>) {\n const { t } = useTranslation();\n const { failure, message: packaged, kept, dismiss } = useOpenFailure();\n const titleId = useId();\n if (!failure || packaged === null) return null;\n const close = (): void => {\n dismiss(failure);\n onDismiss?.(failure);\n };\n const context: OpenFailureContext = { failure, message: packaged, dismiss: close };\n const body = typeof message === 'function' ? message(failure) : (message ?? packaged);\n return (\n <div\n className={`pptx-open-failure${className ? ` ${className}` : ''}`}\n style={style}\n role=\"alert\"\n aria-labelledby={titleId}\n data-reason={failure.reason}\n >\n <div className=\"pptx-open-failure__text\">\n <p id={titleId} className=\"pptx-open-failure__title\">\n {title ?? t('openFailure.title')}\n </p>\n <div className=\"pptx-open-failure__message\">{body}</div>\n {kept ? <p className=\"pptx-open-failure__kept\">{t('openFailure.kept')}</p> : null}\n {showCode ? (\n <p className=\"pptx-open-failure__code\">{t('openFailure.code', { code: failure.code })}</p>\n ) : null}\n </div>\n <div className=\"pptx-open-failure__actions\">\n {actions?.(context)}\n {showClose ? (\n <button type=\"button\" className=\"pptx-open-failure__action\" onClick={close}>\n {closeLabel ?? t('openFailure.close')}\n </button>\n ) : null}\n </div>\n </div>\n );\n}\n","/** @jsxImportSource react */\n// The loading screen, after DOCX Editor's `DocxEditor.Loading`: what the editor shows while it\n// has no deck to paint yet, and while a deck opens. It reads the same snapshot as every other\n// part (`showsLoading` in core), so the screen and the chrome never disagree, and it renders\n// nothing once the deck is ready. The Vue twin is `PptxEditorLoading`.\n//\n// The engine publishes `loading` and then yields one frame before the parse, which blocks the\n// main thread for a large deck, so this screen paints first.\n//\n// It carries `pptx-editor` itself, as `PptxEditor.Viewport` does, so the `--doc-*` tokens\n// resolve wherever it is composed.\n\nimport type { CSSProperties, ReactNode } from 'react';\nimport { loadingSheetSize, sameLoadingSheetSize, showsLoading } from '@pptx-editor.dev/core/editor';\nimport { useChromeDark } from './color-mode.ts';\nimport { useEditorState, useTranslation } from './context.ts';\n\n/** Props for `PptxEditor.Loading`. @public */\nexport interface LoadingProps {\n /**\n * An extra host condition, OR-ed with the editor's own. The default already shows the screen\n * while the editor has no deck, so pass this only for work the editor cannot see, such as a\n * host that mounts the root after its own fetch.\n */\n readonly when?: boolean;\n /**\n * Pin the screen over the nearest positioned ancestor, so it covers the previous deck while\n * the next one opens. A short appearance delay keeps a fast open from flashing it. Without\n * `overlay`, the screen is an in-flow box that fills its parent.\n */\n readonly overlay?: boolean;\n /** Appended after the `pptx-editor pptx-loading` classes. */\n readonly className?: string;\n /** Inline styles for the loading container. */\n readonly style?: CSSProperties;\n /**\n * Your own indicator in place of the packaged spinner, centered on the slide-shaped sheet.\n * Include text for screen readers, as the packaged indicator does.\n */\n readonly indicator?: ReactNode;\n /** The whole loading screen in place of the packaged sheet. */\n readonly children?: ReactNode;\n}\n\n/** Props for `PptxEditor.Loading.Spinner`. @public */\nexport interface LoadingSpinnerProps {\n /** Appended after the `pptx-loading__spinner` class. */\n readonly className?: string;\n}\n\n/**\n * The packaged spinner on its own, to compose into custom `children`. It is decorative\n * (`aria-hidden`), so give the surrounding screen its own text. @public\n */\nexport function LoadingSpinner({ className }: LoadingSpinnerProps) {\n return (\n <span\n className={`pptx-loading__spinner${className ? ` ${className}` : ''}`}\n aria-hidden=\"true\"\n />\n );\n}\n\nfunction LoadingImpl({\n when = false,\n overlay = false,\n className,\n style,\n indicator,\n children,\n}: LoadingProps) {\n const loading = useEditorState(showsLoading);\n const sheet = useEditorState(loadingSheetSize, sameLoadingSheetSize);\n const dark = useChromeDark();\n const { t } = useTranslation();\n if (!when && !loading) return null;\n const classes = ['pptx-editor', dark ? 'dark' : '', 'pptx-loading'];\n if (overlay) classes.push('pptx-loading--overlay');\n if (className) classes.push(className);\n return (\n <div\n className={classes.filter(Boolean).join(' ')}\n style={style}\n role=\"status\"\n aria-live=\"polite\"\n >\n {children ?? (\n <div\n className=\"pptx-loading__sheet\"\n style={{ width: sheet.width, aspectRatio: `${sheet.width} / ${sheet.height}` }}\n >\n {indicator ?? (\n <>\n <LoadingSpinner />\n <span className=\"pptx-sr-only\">{t('app.loading')}</span>\n </>\n )}\n </div>\n )}\n </div>\n );\n}\n\n/** The loading part, with the packaged spinner as a static. @public */\nexport interface LoadingComponent {\n /** Renders the loading screen, or nothing once the deck is ready. */\n (props: LoadingProps): ReactNode;\n /** The packaged indicator, to compose into custom children. */\n readonly Spinner: typeof LoadingSpinner;\n}\n\n/**\n * Shows a slide-shaped sheet with a spinner while the editor has no deck, and while a deck\n * opens; renders nothing once the deck is ready. A parse failure clears it, so a broken file\n * never spins forever: report it from `snapshot().error`. Compose it inside a positioned box\n * with `overlay` to cover the previous deck while the next one opens:\n *\n * ```tsx\n * <PptxEditor.Root document={bytes}>\n * <PptxEditor.Viewport>\n * <div style={{ position: 'relative', flex: 1 }}>\n * <PptxEditor.Content />\n * <PptxEditor.Loading overlay />\n * </div>\n * </PptxEditor.Viewport>\n * </PptxEditor.Root>\n * ```\n *\n * Outside a `PptxEditor.Root` it always shows, because no editor reports otherwise.\n *\n * @public\n */\nexport const Loading: LoadingComponent = Object.assign(LoadingImpl, { Spinner: LoadingSpinner });\n","/** @jsxImportSource react */\n// `PptxEditor.Ribbon`: tabs over chrome groups. The ribbon is a layer over the toolbar: each tab panel is the toolbar's preset\n// bar with that tab's groups, so a tab keeps every rung of the customization ladder\n// (`Toolbar.Slot`, named parts, `Toolbar.Group`, `Toolbar.Action`, `hidden`, the More menu).\n// DOCX Editor has no ribbon; its equivalent of a tab is a `Toolbar` with `preset={false}` and\n// that tab's `Toolbar.Group`s. `PptxEditor.Toolbar` stays as the flat form of the same groups.\n//\n// The arrangement comes from core (`RIBBON_TABS`, `ribbonTabs`). The ribbon's only state is the\n// selected tab: controlled with `tab`, or uncontrolled with `defaultTab`.\n\nimport {\n Children,\n Fragment,\n isValidElement,\n useEffect,\n useId,\n useRef,\n useState,\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactNode,\n} from 'react';\nimport {\n arrangeRibbonTabs,\n ribbonInsertTab,\n ribbonShownTab,\n ribbonTabs,\n translateKeyOrText,\n warnRibbonChild,\n type EditorSnapshot,\n type RibbonTabId,\n type RibbonTabLayout,\n} from '@pptx-editor.dev/core/editor';\nimport { keepFocus } from './chrome.tsx';\nimport { useEditorState, useTranslation } from './context.ts';\nimport { PresetBar } from './Toolbar.tsx';\n\n/** Props for `PptxEditor.Ribbon.Tab`. @public */\nexport interface RibbonTabProps {\n /** A built-in tab id changes that tab; any other id adds a host tab. */\n readonly id: RibbonTabId | (string & {});\n /** The tab's title. Wins over `labelKey`. Built-in tabs keep their own title without it. */\n readonly label?: string;\n /** A translation key for the tab's title. */\n readonly labelKey?: string;\n /** Remove the tab. Its commands keep working from menus, keys, and the API. */\n readonly hidden?: boolean;\n /** For a host tab: the tab it follows. Without it, host tabs follow the built-in ones. */\n readonly after?: RibbonTabId | (string & {});\n /** A class name added to the tab's panel. */\n readonly className?: string;\n /**\n * `Toolbar.Slot`, named parts, `Toolbar.Group`, and `Toolbar.Action` for the tab's panel, as\n * toolbar children: they change the tab's groups, or are the groups of a host tab.\n */\n readonly children?: ReactNode;\n}\n\n/** One tab of the ribbon. Inside `PptxEditor.Ribbon` it is a description the ribbon reads. @public */\nexport function RibbonTab(_props: RibbonTabProps): ReactNode {\n return null;\n}\n\n/** Props for `PptxEditor.Ribbon`. @public */\nexport interface RibbonProps {\n /** A class name added to the ribbon. */\n readonly className?: string;\n /**\n * `true` (default): the tabs of `RIBBON_TABS`, changed by `Ribbon.Tab` children. `false`:\n * only the `Ribbon.Tab` children.\n */\n readonly preset?: boolean;\n /** The selected tab, controlled. Use with `onTabChange`. */\n readonly tab?: RibbonTabId | (string & {});\n /** The tab selected first, uncontrolled. Default `home`. */\n readonly defaultTab?: RibbonTabId | (string & {});\n /** Called when the user selects another tab. */\n readonly onTabChange?: (tab: string) => void;\n /** `false`: a tab's groups wrap instead of moving into the More menu. Default `true`. */\n readonly overflow?: boolean;\n /** `Ribbon.Tab` children. */\n readonly children?: ReactNode;\n}\n\ntype NodeProps = Record<string, unknown> & { children?: ReactNode };\n\nconst flatten = (nodes: ReactNode): ReactNode[] =>\n Children.toArray(nodes).flatMap((node) =>\n isValidElement<NodeProps>(node) && node.type === Fragment\n ? flatten(node.props.children)\n : [node]\n );\n\n/** Whether two tab layouts show the same tabs and groups. */\nfunction sameLayout(a: readonly RibbonTabLayout[], b: readonly RibbonTabLayout[]): boolean {\n const key = (l: readonly RibbonTabLayout[]) =>\n l.map((t) => `${t.tab.id}:${t.groups.map((g) => g.id).join(',')}`).join('|');\n return key(a) === key(b);\n}\n\nconst selectTabs = (s: EditorSnapshot): RibbonTabLayout[] => ribbonTabs(s);\n\n/**\n * The ribbon: the Quick Access Toolbar, the tab names, and the selected tab's groups, with\n * contextual tabs (Shape Format, Table Design, …) while the selection needs them.\n *\n * @example\n * ```tsx\n * <PptxEditor.Ribbon defaultTab=\"home\">\n * <PptxEditor.Ribbon.Tab id=\"home\">\n * <PptxEditor.Toolbar.Strike hidden />\n * </PptxEditor.Ribbon.Tab>\n * <PptxEditor.Ribbon.Tab id=\"view\" hidden />\n * <PptxEditor.Ribbon.Tab id=\"review\" label=\"Review\">\n * <PptxEditor.Toolbar.Group id=\"legal\" label=\"Legal\">\n * <PptxEditor.Toolbar.Action label=\"Ask legal\" onSelect={askLegal} />\n * </PptxEditor.Toolbar.Group>\n * </PptxEditor.Ribbon.Tab>\n * </PptxEditor.Ribbon>\n * ```\n *\n * @public\n */\nexport function Ribbon({\n className,\n preset = true,\n tab,\n defaultTab = 'home',\n onTabChange,\n overflow = true,\n children,\n}: RibbonProps): ReactNode {\n const { t } = useTranslation();\n const baseId = useId();\n const layout = useEditorState(selectTabs, sameLayout);\n const [own, setOwn] = useState<string>(defaultTab);\n const names = useRef(new Map<string, HTMLButtonElement>());\n const root = useRef<HTMLDivElement>(null);\n // Whether the keyboard focus is in the ribbon. A removed panel takes the focus with it and\n // sends no `focusout` with a target, so the flag stays set until the focus goes elsewhere.\n const focusInside = useRef(false);\n const specs = new Map<string, RibbonTabProps>();\n for (const child of flatten(children)) {\n if (isValidElement<NodeProps>(child) && child.type === RibbonTab) {\n const props = child.props as unknown as RibbonTabProps;\n specs.set(props.id, props);\n } else if (\n child !== null &&\n child !== undefined &&\n typeof child !== 'boolean' &&\n !(typeof child === 'string' && child.trim() === '')\n )\n warnRibbonChild('PptxEditor.Ribbon', 'Ribbon.Tab');\n }\n const { quickAccess, tabs } = arrangeRibbonTabs(\n layout,\n specs,\n preset,\n (key) => translateKeyOrText(t, key),\n 'Ribbon.Tab'\n );\n const wanted = tab ?? own;\n const { shown: current, fellBack } = ribbonShownTab(tabs, wanted);\n const shownId = current?.id;\n // A tab that went away (a contextual tab after the selection changed) gives way to Home: the\n // ribbon selects Home, so the gone tab does not come back by itself when its context does,\n // and a controlled host hears of it. The focus moves to the shown tab name.\n useEffect(() => {\n if (!fellBack || shownId === undefined) return;\n if (tab === undefined) setOwn(shownId);\n onTabChange?.(shownId);\n const active = root.current?.ownerDocument.activeElement;\n if (focusInside.current && (!active || active === active.ownerDocument.body))\n names.current.get(shownId)?.focus();\n // Only a change of the shown tab runs this; the callback is the host's latest.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [fellBack, shownId]);\n const select = (id: string): void => {\n if (tab === undefined) setOwn(id);\n onTabChange?.(id);\n };\n // An insert opens the new object's Format tab.\n const insertions = useEditorState((s) => s.insertions);\n const seen = useRef(insertions);\n const insertTab = ribbonInsertTab(tabs);\n useEffect(() => {\n if (insertions === seen.current) return;\n seen.current = insertions;\n if (insertTab !== null && insertTab !== wanted) select(insertTab);\n // Only a new insert runs this.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [insertions]);\n const onTabKey = (e: ReactKeyboardEvent): void => {\n const index = tabs.findIndex((d) => d.id === current?.id);\n const next =\n e.key === 'ArrowRight'\n ? tabs[(index + 1) % tabs.length]\n : e.key === 'ArrowLeft'\n ? tabs[(index - 1 + tabs.length) % tabs.length]\n : e.key === 'Home'\n ? tabs[0]\n : e.key === 'End'\n ? tabs[tabs.length - 1]\n : undefined;\n if (!next) return;\n e.preventDefault();\n select(next.id);\n names.current.get(next.id)?.focus();\n };\n const tabId = (id: string) => `${baseId}-tab-${id}`;\n const panelId = `${baseId}-panel`;\n return (\n <div\n ref={root}\n className={['pptx-ribbon', className].filter(Boolean).join(' ')}\n onFocus={() => {\n focusInside.current = true;\n }}\n onBlur={(e) => {\n const next = e.relatedTarget as Node | null;\n if (next && !e.currentTarget.contains(next)) focusInside.current = false;\n }}\n >\n <div className=\"pptx-ribbon__bar\">\n {quickAccess ? (\n <div className=\"pptx-ribbon__qat\">\n <PresetBar groups={quickAccess.groups} label={quickAccess.title} overflow={false}>\n {quickAccess.override?.children}\n </PresetBar>\n </div>\n ) : null}\n <div\n role=\"tablist\"\n aria-label={t('ribbon.ariaLabel')}\n className=\"pptx-ribbon__tabs\"\n onKeyDown={onTabKey}\n >\n {tabs.map((d) => {\n const selected = d.id === current?.id;\n return (\n <button\n key={d.id}\n ref={(el) => {\n if (el) names.current.set(d.id, el);\n else names.current.delete(d.id);\n }}\n type=\"button\"\n role=\"tab\"\n id={tabId(d.id)}\n className=\"pptx-ribbon__tab\"\n aria-selected={selected}\n aria-controls={selected ? panelId : undefined}\n tabIndex={selected ? 0 : -1}\n data-tab={d.id}\n data-contextual={d.contextual ? '' : undefined}\n onMouseDown={keepFocus}\n onClick={() => select(d.id)}\n >\n {d.title}\n </button>\n );\n })}\n </div>\n </div>\n {current ? (\n <div\n role=\"tabpanel\"\n id={panelId}\n aria-labelledby={tabId(current.id)}\n className={['pptx-ribbon__panel', current.override?.className].filter(Boolean).join(' ')}\n data-tab={current.id}\n >\n <PresetBar\n key={current.id}\n groups={current.groups}\n label={current.title}\n overflow={overflow}\n >\n {current.override?.children}\n </PresetBar>\n </div>\n ) : null}\n </div>\n );\n}\n","/** @jsxImportSource react */\n// `PptxEditor.StatusBar`: the status bar under the slide (openspec/\n// changes/editor-ui-parity/design.md, \"Ground truth\": slide x of y, notes, views, zoom).\n// The parts follow the customization ladder: each takes `className` and `hidden`, a named part\n// child replaces its part in place, other children follow the parts, and `preset={false}`\n// renders only the children. The view buttons and zoom are the editor's own `ViewSwitch` and\n// `ZoomPill`, so the bar adds no second control for the same action.\n\nimport type { ChromeTranslate } from '@pptx-editor.dev/core/editor';\nimport { Children, Fragment, isValidElement, type ReactNode } from 'react';\nimport { slideStatus, warnAsChildChild } from '@pptx-editor.dev/core/editor';\nimport { Icon, keepFocus } from './chrome.tsx';\nimport { ToolbarAction } from './toolbar-action.tsx';\nimport { useEditorState, useTranslation } from './context.ts';\nimport { useNotesPane } from './pane-state.ts';\nimport { ZoomPill } from './panes.tsx';\nimport { ViewSwitch } from './SlideSorter.tsx';\n\n/** Props of every status bar part. @public */\nexport interface StatusBarPartProps {\n /** A class name added to the part. */\n readonly className?: string;\n /** Remove the part from the status bar. */\n readonly hidden?: boolean;\n}\n\n/** \"Slide 2 of 5\". @public */\nexport function StatusBarSlideNumber({ className, hidden }: StatusBarPartProps): ReactNode {\n const { t } = useTranslation();\n const status = useEditorState(\n (s) => slideStatus(s),\n (a, b) => a?.current === b?.current && a?.total === b?.total\n );\n if (hidden) return null;\n return (\n <span\n className={['pptx-statusbar__slide', className].filter(Boolean).join(' ')}\n data-part=\"slideNumber\"\n aria-live=\"polite\"\n >\n {status ? t('statusBar.slide', status) : null}\n </span>\n );\n}\n\n/** The part name in warnings about `StatusBar.Notes`. */\nconst NOTES_PART = { slot: 'StatusBar.Notes', group: 'StatusBar' } as const;\n\n/** Props of `StatusBar.Notes`: the part props, and the ladder's `icon` and `asChild`. @public */\nexport interface StatusBarNotesProps extends StatusBarPartProps {\n /** Icon content in place of the packaged icon. */\n readonly icon?: ReactNode;\n /** Render the one element child as the button: it gets the label, state, and click. */\n readonly asChild?: boolean;\n /** The element for `asChild`. */\n readonly children?: ReactNode;\n}\n\n/** The Notes button: shows or hides the speaker notes (`useNotesPane`). @public */\nexport function StatusBarNotes({\n className,\n hidden,\n icon,\n asChild,\n children,\n}: StatusBarNotesProps): ReactNode {\n const { t } = useTranslation();\n const notes = useNotesPane();\n if (hidden) return null;\n // One element child, or the packaged Notes button with its icon (and a warning that names\n // this part).\n const only = asChild ? Children.toArray(children) : [];\n const host = only.length === 1 && isValidElement(only[0]);\n if (asChild && !host) warnAsChildChild('notes', NOTES_PART);\n return (\n <span className=\"pptx-statusbar__notes-part\" data-part=\"notes\">\n <ToolbarAction\n label={t('statusBar.notes')}\n icon={host ? undefined : (icon ?? <Icon name=\"edit_note\" />)}\n className={['pptx-statusbar__notes', className].filter(Boolean).join(' ')}\n active={notes.open}\n onSelect={notes.toggle}\n asChild={host}\n >\n {host ? children : null}\n </ToolbarAction>\n </span>\n );\n}\n\n/**\n * The view buttons: the editor's view switch (`view.presentationView`: Normal and Slide\n * Sorter), the same control as the default editor's status area. @public\n */\nexport function StatusBarViews({ className, hidden }: StatusBarPartProps): ReactNode {\n if (hidden) return null;\n return (\n <span\n className={['pptx-statusbar__views', className].filter(Boolean).join(' ')}\n data-part=\"views\"\n >\n <ViewSwitch />\n </span>\n );\n}\n\n/** Zoom out, the zoom level with its menu, and zoom in: the editor's `ZoomPill`. @public */\nexport function StatusBarZoom({ className, hidden }: StatusBarPartProps): ReactNode {\n if (hidden) return null;\n return (\n <span\n className={['pptx-statusbar__zoom', className].filter(Boolean).join(' ')}\n data-part=\"zoom\"\n >\n <ZoomPill />\n </span>\n );\n}\n\nconst PARTS = [StatusBarSlideNumber, StatusBarNotes, StatusBarViews, StatusBarZoom] as const;\n\n/** Props for `PptxEditor.StatusBar`. @public */\nexport interface StatusBarProps {\n /**\n * Your translation function for this compound and its parts, as DOCX Editor's `t`. Without\n * it, the root's `locale` gives the labels.\n */\n readonly t?: ChromeTranslate;\n /** A class name added to the bar. */\n readonly className?: string;\n /**\n * `true` (default): slide number, notes, views, and zoom, with named part children replacing\n * their parts in place and other children after the notes button. `false`: only the children.\n */\n readonly preset?: boolean;\n /** Named part children replace their parts; other children go after **Notes**. */\n readonly children?: ReactNode;\n}\n\ntype NodeProps = Record<string, unknown> & { children?: ReactNode };\n\nconst flatten = (nodes: ReactNode): ReactNode[] =>\n Children.toArray(nodes).flatMap((node) =>\n isValidElement<NodeProps>(node) && node.type === Fragment\n ? flatten(node.props.children)\n : [node]\n );\n\n/**\n * The status bar: \"Slide x of y\", the Notes button, the view buttons, and zoom.\n *\n * @example\n * ```tsx\n * <PptxEditor.StatusBar>\n * <PptxEditor.StatusBar.Views hidden />\n * <span className=\"acme-saved\">Saved</span>\n * </PptxEditor.StatusBar>\n * ```\n *\n * @public\n */\nexport function StatusBar({ className, preset = true, children }: StatusBarProps): ReactNode {\n const { t } = useTranslation();\n const bar = (content: ReactNode) => (\n <div\n role=\"group\"\n aria-label={t('statusBar.ariaLabel')}\n className={['pptx-statusbar', 'pptx-statusbar--bar', className].filter(Boolean).join(' ')}\n onMouseDown={keepFocus}\n >\n {content}\n </div>\n );\n if (!preset) return bar(children);\n const overrides = new Map<unknown, ReactNode>();\n const extras: ReactNode[] = [];\n for (const child of flatten(children)) {\n if (isValidElement(child) && (PARTS as readonly unknown[]).includes(child.type))\n overrides.set(child.type, child);\n else extras.push(child);\n }\n const part = (Part: (typeof PARTS)[number]) => overrides.get(Part) ?? <Part />;\n return bar(\n <>\n {part(StatusBarSlideNumber)}\n <span className=\"pptx-statusbar__spacer\" />\n {part(StatusBarNotes)}\n {extras}\n {part(StatusBarViews)}\n {part(StatusBarZoom)}\n </>\n );\n}\n","/** @jsxImportSource react */\n// The packaged link popup, kept for `popups.hyperlink` renderers that forward their props to it.\n// It renders `PptxEditor.HyperLink` (`HyperLink.tsx`): over the root's one popup state inside\n// `PptxEditor.Root`, else over a state of its own built from its props. `className` goes on the\n// panel.\n\nimport { useContext, useEffect, useId, useMemo, useSyncExternalStore, type ReactNode } from 'react';\nimport { hyperlinkPopupFromRequest } from '@pptx-editor.dev/core/editor';\nimport { usePptxEditor } from './context.ts';\nimport { HyperLink, HyperlinkPopupContext } from './HyperLink.tsx';\nimport type { HyperlinkPopupProps } from './popups.tsx';\n\n/**\n * The packaged link popup: `PptxEditor.HyperLink` with its default parts. A `popups.hyperlink`\n * renderer can forward its props to it, or render `PptxEditor.HyperLink` with its own parts.\n * @public\n */\nexport function HyperlinkPopup(props: HyperlinkPopupProps): ReactNode {\n const shared = useContext(HyperlinkPopupContext);\n const panel = <HyperLink {...(props.className ? { className: props.className } : {})} />;\n return shared ? panel : <OwnState {...props}>{panel}</OwnState>;\n}\n\n/** A popup rendered outside its root: a state of its own, from its props. */\nfunction OwnState({ children, ...props }: HyperlinkPopupProps & { children: ReactNode }) {\n const editor = usePptxEditor();\n const errorId = useId();\n const { anchor, url, mode, onClose } = props;\n // One state per opening: the props are what it opened with.\n const controller = useMemo(\n () => hyperlinkPopupFromRequest(editor, { anchor, url, onClose, ...(mode ? { mode } : {}) }),\n [editor, anchor] // eslint-disable-line react-hooks/exhaustive-deps\n );\n useEffect(() => () => controller.dispose(), [controller]);\n const state = useSyncExternalStore(\n controller.subscribe,\n controller.getState,\n controller.getState\n );\n return (\n <HyperlinkPopupContext.Provider value={{ controller, state, errorId }}>\n {children}\n </HyperlinkPopupContext.Provider>\n );\n}\n","// The hooks a host uses to build its own chrome, after DOCX Editor's `useZoom`,\n// `useEditorEvent`, `useEditorSnapshot`, and `useScopeClassName`. Each hook reads the editor\n// through its one subscription (`subscribe` and `snapshot`) and calls back into the instance:\n// no hook keeps a second copy of editor state. The Vue twins are in `customization-hooks.ts`\n// of the Vue adapter.\n\nimport { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n ZOOM_LEVELS,\n onEditorEvent,\n stepEditorZoom,\n zoomStep,\n type EditorSnapshot,\n type PptxEditorEvents,\n type PptxEditorInstance,\n} from '@pptx-editor.dev/core/editor';\nimport { useEditorState, usePptxEditor } from './context.ts';\nimport { ChromeDarkContext, ScopedByAncestorContext } from './color-mode.ts';\n\n/** What {@link useZoom} returns. @public */\nexport interface UseZoomResult {\n /** The zoom in force. 1 is 100 %. In fit mode it is the zoom that fits the slide. */\n readonly zoom: number;\n /** Whether the editor fits the slide to the window and follows its size. */\n readonly isFit: boolean;\n /** Set a fixed zoom, kept in the range 10 % to 400 %. Leaves fit mode. */\n readonly setZoom: (zoom: number) => void;\n /** Fit the slide to the window, and keep it fitted when the window changes size. */\n readonly fit: () => void;\n /** A fixed 100 %. */\n readonly reset: () => void;\n /** One step of `levels` in from the zoom in force. Does nothing at 400 %. */\n readonly zoomIn: () => void;\n /** One step of `levels` out from the zoom in force. Does nothing at 10 %. */\n readonly zoomOut: () => void;\n /** Whether `zoomIn` can step. */\n readonly canZoomIn: boolean;\n /** Whether `zoomOut` can step. */\n readonly canZoomOut: boolean;\n /** The steps the zoom buttons move through, so a custom control shows the same levels. */\n readonly levels: readonly number[];\n}\n\ninterface ZoomSlice {\n readonly zoom: number;\n readonly fit: boolean;\n}\n\nconst selectZoom = (s: EditorSnapshot): ZoomSlice => ({ zoom: s.zoom, fit: s.fitZoom });\nconst sameZoom = (a: ZoomSlice, b: ZoomSlice): boolean => a.zoom === b.zoom && a.fit === b.fit;\n\n/**\n * Read and set the slide zoom, as DOCX Editor's `useZoom`. Outside `PptxEditor.Root`, and\n * before the editor mounts, it reports 100 % and every action does nothing, so a control can\n * render unconditionally.\n *\n * @example\n * ```tsx\n * const { zoom, isFit, fit, zoomIn, canZoomIn } = useZoom();\n * <button onClick={fit} aria-pressed={isFit}>Fit</button>\n * <button onClick={zoomIn} disabled={!canZoomIn}>+</button>\n * <span>{Math.round(zoom * 100)}%</span>\n * ```\n *\n * @public\n */\nexport function useZoom(): UseZoomResult {\n const editor = usePptxEditor();\n const { zoom, fit } = useEditorState(selectZoom, sameZoom);\n const setZoom = useCallback((next: number) => editor?.setZoom(next), [editor]);\n return useMemo(() => {\n const next = zoomStep(zoom, 1);\n const previous = zoomStep(zoom, -1);\n return {\n zoom,\n isFit: fit,\n setZoom,\n fit: () => editor?.setZoom('fit'),\n reset: () => setZoom(1),\n zoomIn: () => stepEditorZoom(editor, 1),\n zoomOut: () => stepEditorZoom(editor, -1),\n canZoomIn: !!editor && next !== null,\n canZoomOut: !!editor && previous !== null,\n levels: ZOOM_LEVELS,\n };\n }, [editor, zoom, fit, setZoom]);\n}\n\n/**\n * Subscribe to an editor event (`'change'`, `'selectionChange'`, `'rejection'`,\n * `'openFailure'`) for the lifetime of the component, as DOCX Editor's `useEditorEvent`. It\n * does nothing until the nearest `PptxEditor.Root` creates the editor, and subscribes again\n * when the instance changes. A new handler on each render does not subscribe again; the\n * latest one is called.\n *\n * @example\n * ```tsx\n * useEditorEvent('rejection', (rejection) => toast(rejection.reason));\n * ```\n *\n * @public\n */\nexport function useEditorEvent<E extends keyof PptxEditorEvents>(\n event: E,\n handler: PptxEditorEvents[E]\n): void {\n const editor = usePptxEditor();\n const handlerRef = useRef(handler);\n handlerRef.current = handler;\n useEffect(() => {\n if (!editor) return undefined;\n const forward = ((...args: unknown[]) =>\n (handlerRef.current as (...a: unknown[]) => void)(...args)) as PptxEditorEvents[E];\n return onEditorEvent(editor, event, forward);\n }, [editor, event]);\n}\n\n/**\n * Re-render the caller each time `editor` publishes a change, as DOCX Editor's\n * `useEditorSnapshot`. Returns a counter that changes on each change, so it also serves as a\n * dependency. Prefer `useEditorState` with a selector: it re-renders only when its slice\n * changes.\n *\n * @public\n */\nexport function useEditorSnapshot(editor: PptxEditorInstance | null): number {\n const [revision, setRevision] = useState(0);\n useEffect(() => {\n if (!editor) return undefined;\n const bump = (): void => setRevision((n) => n + 1);\n const off = editor.subscribe(bump);\n bump();\n return off;\n }, [editor]);\n return revision;\n}\n\n/**\n * The scope classes a part you build yourself adds to its own root element, so the editor's\n * `--doc-*` tokens and chrome styles apply to it, as DOCX Editor's `useScopeClassName`. Inside\n * `PptxEditor.Viewport` it is `''`: the viewport already carries the scope. Outside it, it is\n * `'pptx-editor '`, or `'pptx-editor dark '` when the root's `colorMode` resolved dark. A part\n * that portals out of the viewport (to `document.body`) adds `pptx-editor` itself, with\n * `useEditorColorMode` for the theme.\n *\n * The value ends with a space, so it concatenates cleanly, and `''` collapses away.\n *\n * @example\n * ```tsx\n * const scope = useScopeClassName();\n * <aside className={`${scope}my-panel`} />\n * ```\n *\n * @public\n */\nexport function useScopeClassName(): '' | 'pptx-editor ' | 'pptx-editor dark ' {\n const scoped = useContext(ScopedByAncestorContext);\n const dark = useContext(ChromeDarkContext);\n if (scoped) return '';\n return dark ? 'pptx-editor dark ' : 'pptx-editor ';\n}\n","// Adapted from DOCX Editor `packages/react/src/editor/useDocxSource.ts` and\n// `useEditorHostDocument.ts` at commit 5993bd223.\n//\n// Opening a presentation, as a hook: fetch the bytes, resolve the fonts, keep the two from\n// racing, cancel both when the component unmounts or the source changes, and turn a failure\n// into a value to render. The rules (the two font paths, the fetch) are core's\n// (`pptx-source.ts`), shared with the Vue twin; this file owns only the React lifetime.\n\nimport { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';\nimport {\n editorHostDocument,\n fetchPptxSource,\n isAbortError,\n onEditorHostChange,\n pptxFontsShape,\n pptxSourceBytes,\n pptxSourceFontsResolver,\n resolveEagerPptxFonts,\n type FontResolver,\n type MarkedFontResolver,\n type PptxSource,\n type UsePptxSourceOptions,\n} from '@pptx-editor.dev/core/editor';\nimport type { FontConfiguration } from '@pptx-editor.dev/core/contracts';\nimport { usePptxEditor } from './context.ts';\n\n/** What `usePptxSource` returns, as DOCX Editor's `UseDocxSourceResult`. @public */\nexport interface UsePptxSourceResult {\n /** Bytes for the `document` prop; undefined until they arrive. */\n readonly document: Uint8Array | undefined;\n /**\n * What to give the `fonts` prop: a composed configuration on the eager path, a stable\n * resolver on the on-demand path, or undefined until there is something to give.\n */\n readonly fonts: FontConfiguration | FontResolver | undefined;\n /** Why the presentation could not be opened. A font failure never shows here. */\n readonly error: Error | null;\n /** True until the presentation arrives or fails, and while eager fonts load. */\n readonly isLoading: boolean;\n}\n\n/**\n * Load a presentation, and optionally its fonts, for `PptxEditor`, as DOCX Editor's\n * `useDocxSource`.\n *\n * ```tsx\n * const { document, fonts, error } = usePptxSource(url, { fonts: packagedFonts() });\n * if (error) return <p>{error.message}</p>;\n * return <PptxEditor document={document} fonts={fonts} />;\n * ```\n *\n * Eager fonts (a value, a promise, or a zero-argument loader) hold the deck back until they\n * settle, so the slides lay out once. An on-demand resolver (`packagedFonts()`,\n * `googleFonts()`) needs the parsed deck, so the bytes go through at once and the slides lay\n * out again when the faces arrive. A font failure never fails the deck.\n *\n * A URL is fetched with the browser's `fetch`, as written. Check a URL from user input first.\n *\n * @public\n */\nexport function usePptxSource(\n source: PptxSource | null | undefined,\n options: UsePptxSourceOptions = {}\n): UsePptxSourceResult {\n const [bytes, setBytes] = useState<Uint8Array | undefined>(undefined);\n const [fonts, setFonts] = useState<FontConfiguration | undefined>(undefined);\n const [error, setError] = useState<Error | null>(null);\n const [documentLoading, setDocumentLoading] = useState(source != null);\n // The path, read again at each render: a host that builds its origins later changes it.\n const shape = pptxFontsShape(options.fonts);\n const [fontsSettled, setFontsSettled] = useState(options.fonts === undefined);\n\n // Options are new at each render when written inline: read them from a ref, so a new object\n // does not start another fetch.\n const latest = useRef(options);\n latest.current = options;\n // One resolver for the hook's life, so the `fonts` prop keeps its identity.\n const resolver = useMemo<MarkedFontResolver>(\n () => pptxSourceFontsResolver(() => latest.current.fonts),\n []\n );\n\n // Fonts load once per path, not per deck: they belong to the app, not to the file.\n useEffect(() => {\n const fontsSource = latest.current.fonts;\n if (fontsSource === undefined) {\n setFonts(undefined);\n setFontsSettled(true);\n return undefined;\n }\n if (pptxFontsShape(fontsSource) === 'on-demand') {\n setFontsSettled(true);\n return undefined;\n }\n setFontsSettled(false);\n let live = true;\n void resolveEagerPptxFonts(fontsSource).then((composed) => {\n if (!live) return;\n if (composed) setFonts(composed);\n setFontsSettled(true);\n });\n return () => {\n live = false;\n };\n }, [shape]);\n\n useEffect(() => {\n if (source == null) {\n setBytes(undefined);\n setError(null);\n setDocumentLoading(false);\n return undefined;\n }\n const immediate = pptxSourceBytes(source);\n if (immediate) {\n setBytes(immediate);\n setError(null);\n setDocumentLoading(false);\n return undefined;\n }\n // `live` as well as the abort: a response already read can resolve after unmount.\n let live = true;\n const controller = new AbortController();\n setDocumentLoading(true);\n setError(null);\n fetchPptxSource(source as string | URL, latest.current.fetchOptions, controller.signal).then(\n (loaded) => {\n if (!live) return;\n setBytes(loaded);\n setDocumentLoading(false);\n },\n (cause: unknown) => {\n if (!live || isAbortError(cause)) return;\n setError(cause instanceof Error ? cause : new Error('could not open the presentation'));\n setDocumentLoading(false);\n }\n );\n return () => {\n live = false;\n controller.abort();\n };\n }, [source]);\n\n return {\n // Held back until eager fonts settle, so the first layout is the only layout.\n document: fontsSettled ? bytes : undefined,\n fonts: shape === 'on-demand' ? resolver : fonts,\n error,\n isLoading: documentLoading || !fontsSettled,\n };\n}\n\n/** What `useEditorHostDocument` returns: the host document, or null with no DOM. @public */\nexport type UseEditorHostDocumentReturn = Document | null;\n\nconst NOOP_UNSUBSCRIBE = (): void => {};\n\n/**\n * The document that the editor's slide is mounted in, as DOCX Editor's\n * `useEditorHostDocument`: an iframe's when the host mounted the editor there, else the page's\n * own. Null during server rendering. Your own chrome that adds document listeners, reads\n * focus, or adds a `<style>` uses it in place of the global `document`. Its `defaultView` is\n * the editor's window.\n *\n * @example\n * ```tsx\n * const hostDocument = useEditorHostDocument();\n * useEffect(() => {\n * if (!hostDocument) return;\n * hostDocument.addEventListener('keydown', onShortcut);\n * return () => hostDocument.removeEventListener('keydown', onShortcut);\n * }, [hostDocument]);\n * ```\n *\n * @public\n */\nexport function useEditorHostDocument(): UseEditorHostDocumentReturn {\n const editor = usePptxEditor();\n const subscribe = useCallback(\n (onChange: () => void) => (editor ? onEditorHostChange(editor, onChange) : NOOP_UNSUBSCRIBE),\n [editor]\n );\n const read = useCallback(\n (): Document | null =>\n editor\n ? editorHostDocument(editor)\n : typeof globalThis.document === 'undefined'\n ? null\n : globalThis.document,\n [editor]\n );\n return useSyncExternalStore(subscribe, read, () => null);\n}\n","// Paragraph formatting as a hook: the read side off the snapshot, the write side through the\n// engine's `setParagraphFormat` command. The packaged Paragraph dialog and any host chrome read\n// the same `ParagraphFormatRead`, so they cannot disagree. After DOCX Editor's\n// `useParagraphFormat` (docx-editor/packages/react/src/editor/useParagraphFormat.ts).\n\nimport { useCallback } from 'react';\nimport {\n chromeCommandState,\n sameParagraphFormat,\n type ParagraphFormatCommand,\n type ParagraphFormatRead,\n} from '@pptx-editor.dev/core/editor';\nimport { useEditorState, usePptxEditor } from './context.ts';\n\n/** What `useParagraphFormat` returns. @public */\nexport interface UseParagraphFormatReturn {\n /** The selected paragraphs' formatting, or null when no text is selected. */\n readonly format: ParagraphFormatRead | null;\n /** Whether the engine can write paragraph formatting now (text or a shape with text selected, editable). */\n readonly isEnabled: boolean;\n /** Write the given fields as ONE undo step. Returns whether the engine accepted them. */\n readonly apply: (update: ParagraphFormatCommand) => boolean;\n}\n\n/**\n * The selection's paragraph formatting, and the command to change it. `apply` sends one\n * `setParagraphFormat`, so a dialog's worth of changes is one undo step.\n *\n * @example\n * ```tsx\n * function SpaceAfterButton() {\n * const { isEnabled, apply } = useParagraphFormat();\n * return <button disabled={!isEnabled} onClick={() => apply({ spaceAfterPt: 12 })}>12 pt after</button>;\n * }\n * ```\n *\n * @public\n */\nexport function useParagraphFormat(): UseParagraphFormatReturn {\n const editor = usePptxEditor();\n const format = useEditorState((s) => s.format?.paragraph ?? null, sameParagraphFormat);\n // The engine's answer, not the dialog slot's: `popups.paragraph: false` hides the dialog,\n // never the operation.\n const isEnabled = useEditorState(() => chromeCommandState(editor, 'paragraph.dialog').isEnabled);\n const apply = useCallback(\n (update: ParagraphFormatCommand): boolean =>\n editor !== null && editor.exec({ ...update, type: 'setParagraphFormat' }).ok,\n [editor]\n );\n return { format, isEnabled, apply };\n}\n","// Font formatting as a hook, the twin of `useParagraphFormat`: the read side off the snapshot,\n// the write side through the engine's `setFontFormat` command. The packaged Font dialog and any\n// host chrome read the same `FontFormatRead`, so they cannot disagree.\n\nimport { useCallback } from 'react';\nimport {\n chromeCommandState,\n sameFontFormat,\n type FontFormatCommand,\n type FontFormatRead,\n} from '@pptx-editor.dev/core/editor';\nimport { useEditorState, usePptxEditor } from './context.ts';\n\n/** What `useFontFormat` returns. @public */\nexport interface UseFontFormatReturn {\n /** The font of the selected text, or of every run of the selected shapes; null with none. */\n readonly format: FontFormatRead | null;\n /** Whether the engine can write font formatting now (text or a shape with text selected, editable). */\n readonly isEnabled: boolean;\n /** Write the given fields as ONE undo step. Returns whether the engine accepted them. */\n readonly apply: (update: FontFormatCommand) => boolean;\n}\n\n/**\n * The font of the selected text (or of every run of the selected shapes), and the command to\n * change it. `apply` sends one `setFontFormat`, so\n * a dialog's worth of changes is one undo step.\n *\n * @example\n * ```tsx\n * function Loose() {\n * const { isEnabled, apply } = useFontFormat();\n * return <button disabled={!isEnabled} onClick={() => apply({ characterSpacingPt: 3 })}>Loose</button>;\n * }\n * ```\n *\n * @public\n */\nexport function useFontFormat(): UseFontFormatReturn {\n const editor = usePptxEditor();\n const format = useEditorState((s) => s.format?.font ?? null, sameFontFormat);\n // The engine's answer, not the dialog slot's: `popups.font: false` hides the dialog, never\n // the operation.\n const isEnabled = useEditorState(() => chromeCommandState(editor, 'text.dialog').isEnabled);\n const apply = useCallback(\n (update: FontFormatCommand): boolean =>\n editor !== null && editor.exec({ ...update, type: 'setFontFormat' }).ok,\n [editor]\n );\n return { format, isEnabled, apply };\n}\n","// The bullet format as a hook, the twin of `useFontFormat`: the read side off the snapshot, the\n// write side through the engine's `setBulletFormat` command. The packaged Bullets and Numbering\n// dialog and any host chrome read the same `BulletFormatRead`, so they cannot disagree.\n\nimport { useCallback } from 'react';\nimport {\n sameBulletFormat,\n type BulletFormat,\n type BulletFormatRead,\n} from '@pptx-editor.dev/core/editor';\nimport { useEditorCommand, useEditorState, usePptxEditor } from './context.ts';\n\n/** What `useBulletFormat` returns. @public */\nexport interface UseBulletFormatReturn {\n /**\n * The bullet format of the selected paragraphs: null when they have no list, undefined when\n * they differ or nothing with text is selected.\n */\n readonly format: BulletFormatRead | null | undefined;\n /** Whether the engine can write a bullet format now (text or a shape with text selected, editable). */\n readonly isEnabled: boolean;\n /**\n * Write a bullet format (null turns the list off) as ONE undo step. An omitted field keeps\n * each paragraph's value; with no `kind`, the size and color change and each paragraph keeps\n * its own bullet or number. Returns whether the engine accepted it.\n */\n readonly apply: (format: BulletFormat | null) => boolean;\n}\n\n/**\n * The bullet format of the selected paragraphs, and the command to change it. `apply` sends one\n * `setBulletFormat`, so a dialog's worth of changes is one undo step.\n *\n * @example\n * ```tsx\n * function Bigger() {\n * const { isEnabled, apply } = useBulletFormat();\n * return <button disabled={!isEnabled} onClick={() => apply({ sizePercent: 150 })}>Bigger bullets</button>;\n * }\n * ```\n *\n * @public\n */\nexport function useBulletFormat(): UseBulletFormatReturn {\n const editor = usePptxEditor();\n const format = useEditorState((s) => s.format?.bulletFormat, sameBulletFormat);\n const { isEnabled } = useEditorCommand('list.bulletStyle');\n const apply = useCallback(\n (next: BulletFormat | null): boolean =>\n editor !== null && editor.exec({ type: 'setBulletFormat', format: next }).ok,\n [editor]\n );\n return { format, isEnabled, apply };\n}\n","// Copied from DOCX Editor `packages/react/src/editor/useFonts.ts` at commit 5993bd223.\n// Keep the exported API equal to the source.\n\n// The stable-identity wrapper every font source needs before it can be a prop.\n//\n// `PptxEditor.Root` replaces its fonts when `fonts` changes identity, which is right for a\n// value — new bytes are a new font setup — and a trap for a function: `fonts={googleFonts()}`\n// is a fresh resolver on every render, so the editor would resolve and lay out its fonts\n// again on every render, forever. Awaiting a loader in the component has\n// the same shape of problem from the other end (`useState` + an effect, cancelled on\n// unmount, and nothing renders until it lands).\n//\n// `useFonts` gives back ONE resolver for the component's life, delegating to whatever was\n// passed most recently. Inline objects, inline `googleFonts()`, a promise, a bare\n// fragment: all fine, none of them replaces the fonts again.\n\nimport { useMemo, useRef } from 'react';\nimport {\n composeFontOrigins,\n defineFontResolver,\n type FontConfigurationFragment,\n type FontOrigin,\n type FontResolutionRequest,\n type FontResolver,\n type MarkedFontResolver,\n} from '@pptx-editor.dev/core/editor';\nimport type { FontConfiguration } from '@pptx-editor.dev/core/contracts';\n\n/**\n * What `useFonts` returns: one marked resolver for the component's life. Named for the\n * adapters' composable parity check (PPTX Editor addition).\n *\n * @public\n */\nexport type UseFontsReturn = MarkedFontResolver;\n\n/**\n * Anything that can describe fonts: a resolved configuration, a bare fragment, a promise\n * for either (what a loader like `defaultFonts()` returns), or an on-demand\n * {@link FontResolver} (what `packagedFonts()` and `googleFonts()` return).\n *\n * The resolver arm is BARE `FontResolver`, unmarked. `FontOrigin` — what a list position\n * takes — requires the `defineFontResolver` mark, because a list may also hold a\n * zero-argument loader and only the mark separates the two. There is no such ambiguity in\n * the first argument of {@link useFonts}, which has never accepted a loader, so it keeps\n * taking any resolver.\n *\n * @public\n */\nexport type FontsInput =\n | FontConfiguration\n | FontConfigurationFragment\n | FontResolver\n | Promise<FontConfiguration | FontConfigurationFragment | undefined>\n | undefined;\n\n/**\n * Merge font origins into one stable value for `PptxEditor.Root`'s `fonts` prop.\n *\n * ```tsx\n * // The bundled substitutes: the families this document names, plus its default face.\n * const fonts = useFonts(packagedFonts());\n *\n * // The same, plus the Google catalog for everything they do not cover.\n * const fonts = useFonts(packagedFonts(), googleFonts());\n *\n * // Brand faces first, then whatever is left.\n * const fonts = useFonts(brandFragment, packagedFonts());\n *\n * return <PptxEditor.Root fonts={fonts}>{children}</PptxEditor.Root>;\n * ```\n *\n * EVERY argument takes the same union, so adding an origin is adding an argument and\n * never a change of shape. Origins compose first-wins in argument order, exactly like\n * `composeFontConfiguration`: the first argument beats later ones, and any of them beats\n * a substitution for a family some origin supplies directly.\n *\n * They resolve ONE AFTER ANOTHER, not concurrently, so that each can be told which faces\n * the ones before it already cover and skip fetching them. That costs one extra origin's\n * latency on the critical path and saves a duplicate download — and, for a network origin,\n * a request that would have told a font host which families the document uses for nothing.\n * Order origins cheapest-first.\n *\n * The returned resolver never changes identity, so the editor is never rebuilt on account\n * of this prop. Arguments are re-read when opening a document or requesting a new family.\n * Changing them alone does not replace already loaded faces; reload the document for that.\n *\n * It is marked (`defineFontResolver`), so it can itself be an origin of another list or\n * the `fonts` option of `createPptxEditor` without being mistaken for a zero-argument loader.\n *\n * @public\n */\nexport function useFonts(\n source: FontsInput,\n ...fragments: readonly (FontConfigurationFragment | undefined)[]\n): UseFontsReturn;\n/**\n * The uniform form: every position takes the same {@link FontOrigin}, so composing two\n * resolvers is one extra argument.\n *\n * A resolver in any position but the first must carry the `defineFontResolver` mark. The\n * first position keeps the older, looser type so that every call that compiled before this\n * overload existed still compiles.\n *\n * @public\n */\nexport function useFonts(...origins: readonly FontOrigin[]): UseFontsReturn;\nexport function useFonts(...origins: readonly (FontsInput | FontOrigin)[]): UseFontsReturn {\n // Read at resolve time, not captured: the resolver below outlives every render.\n const latest = useRef<readonly (FontsInput | FontOrigin)[]>(origins);\n latest.current = origins;\n\n return useMemo<MarkedFontResolver>(\n () =>\n defineFontResolver((request: FontResolutionRequest) =>\n // `composeFontOrigins` calls EVERY function origin with the request and never\n // reads the mark, so an unmarked resolver in the first position behaves exactly as\n // it did before the mark existed.\n composeFontOrigins(latest.current as readonly FontOrigin[], request)\n ),\n []\n );\n}\n","// The font family picker's behavior as a hook, after DOCX Editor's `useFontFamily`\n// (docx-editor/packages/react/src/editor/toolbar/FontFamily.tsx): the current value, the\n// offerable families, the enabled state, and the setter, with no UI. A host that wants its own\n// picker takes the hook and ignores the `Toolbar.FontFamily` parts. PPTX Editor adds the groups\n// of core's `font-picker.ts` (the slide's theme fonts, the deck's fonts, all fonts), so a host\n// list can show the same groups as the packaged picker. The Vue twin is\n// `packages/vue/src/useFontFamily.ts`.\n\nimport { useCallback, useMemo } from 'react';\nimport {\n fontPickerGroups,\n isCurrentFontRow,\n type FontPickerGroup,\n type FontPickerRow,\n} from '@pptx-editor.dev/core/editor';\nimport { useEditorCommand, useEditorState, usePptxEditor } from './context.ts';\n\nconst NO_FAMILIES: readonly string[] = Object.freeze([]);\n\n/** What `useFontFamily` returns, as DOCX Editor's `UseFontFamilyResult`. @public */\nexport interface UseFontFamilyReturn {\n /** The family of the selected text, or null for a mixed selection or no selection. */\n readonly value: string | null;\n /**\n * The theme font the selected text uses (`major` for the headings font, `minor` for the body\n * font), or null when it names a family.\n */\n readonly theme: 'major' | 'minor' | null;\n /**\n * Apply a family, or a theme font reference (`+mj-lt`, `+mn-lt`) so the text follows a later\n * theme change. A refusal does nothing.\n */\n readonly setValue: (family: string) => void;\n /** Every family the editor offers: standard, configured, embedded, and the deck's own. */\n readonly options: readonly string[];\n /**\n * The packaged picker's groups for the current slide, empty groups left out: the theme fonts\n * (labeled Headings and Body), the other families the deck names, then all families.\n */\n readonly groups: readonly FontPickerGroup[];\n /** Whether a row is the font the selected text uses, for a check mark. */\n readonly isCurrent: (row: FontPickerRow) => boolean;\n /** Whether the engine can change the font now. */\n readonly isEnabled: boolean;\n /** Why the font cannot change: a catalog key, or the engine's own text. */\n readonly disabledReason: string | null;\n}\n\n/**\n * The font family picker's behavior, with no UI, as DOCX Editor's `useFontFamily`.\n *\n * @example\n * ```tsx\n * function FamilyList() {\n * const { groups, setValue, isCurrent, isEnabled } = useFontFamily();\n * return groups.flatMap((group) =>\n * group.rows.map((row) => (\n * <button key={row.value} disabled={!isEnabled || row.disabled} aria-pressed={isCurrent(row)}\n * onClick={() => setValue(row.value)}>{row.family}</button>\n * ))\n * );\n * }\n * ```\n *\n * @public\n */\nexport function useFontFamily(): UseFontFamilyReturn {\n const editor = usePptxEditor();\n const cmd = useEditorCommand('font.family');\n // The families change with the deck (embedded and host fonts) and with the slide's theme.\n const revision = useEditorState((s) => s.revision);\n const slide = useEditorState((s) => s.currentSlide);\n const theme = useEditorState((s) => s.format?.fontFamilyTheme ?? null);\n const value = typeof cmd.value === 'string' ? cmd.value : null;\n const choices = useMemo(\n () => ({\n groups: fontPickerGroups(editor, slide, ''),\n options: editor?.fontFamilies() ?? NO_FAMILIES,\n }),\n // `revision` is the change signal for the deck's fonts.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [editor, slide, revision]\n );\n const { execute } = cmd;\n const setValue = useCallback((family: string) => void execute(family), [execute]);\n const isCurrent = useCallback(\n (row: FontPickerRow) => !row.disabled && isCurrentFontRow(row, value, theme),\n [value, theme]\n );\n return useMemo(\n () => ({\n value,\n theme,\n setValue,\n options: choices.options,\n groups: choices.groups,\n isCurrent,\n isEnabled: cmd.isEnabled,\n disabledReason: cmd.disabledReason,\n }),\n [value, theme, setValue, choices, isCurrent, cmd.isEnabled, cmd.disabledReason]\n );\n}\n"],"mappings":";AAWA,SAAS,iBAAAA,gBAAe,cAAAC,aAAY,WAAAC,iBAAuD;;;ACH3F;AAAA,EACE,iBAAAC;AAAA,EACA;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA;AAAA,EACA,WAAAC;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAAC;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OASK;;;AC9BP,SAAS,eAAe,aAAa,YAAY,SAAS,wBAAAC,6BAA4B;AACtF,SAAS,wBAA4D;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AA,QACF;AAAA,MACF,CAAC;AAAA,MACDA,eAAc,SAAS;AAAA,MACvB;AAAA,IACF;AAAA,EACF;AACF,CAAC;AAGM,IAAMI,cAAa,OAAO,OAAO,mBAAmB;AAAA,EACzD,MAAM;AAAA,EACN,UAAU;AAAA,EACV,SAAS;AAAA,EACT,SAAAP;AAAA,EACA;AAAA,EACA,WAAAE;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,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,MAAM;AAAA,EACN,aAAaD;AAAA,EACb,QAAQ;AAAA,EACR,WAAW;AACb,CAAC;","names":["createElement","forwardRef","useMemo","createContext","useCallback","useContext","useMemo","useSyncExternalStore","useSyncExternalStore","memo","useSyncExternalStore","useCallback","createContext","useContext","useMemo","useSyncExternalStore","useContext","useEffect","useRef","useState","useLayoutEffect","useRef","useState","warnUnsupportedOverride","createContext","useContext","jsx","warnUnsupportedOverride","useRef","useState","useLayoutEffect","createContext","useCallback","useContext","useEffect","useLayoutEffect","useRef","useState","createPortal","tooltipAttributes","focusMenuRowAtPointer","Fragment","jsx","jsxs","createContext","useRef","useContext","useState","useLayoutEffect","owner","useEffect","createPortal","focusMenuRowAtPointer","useCallback","tooltipAttributes","tooltipAttributes","translateKeyOrText","translateKeyOrText","tooltipAttributes","Fragment","jsx","jsxs","useState","useRef","useContext","useEffect","_","useEffect","useLayoutEffect","useMemo","useRef","useState","translateKeyOrText","useCallback","useEffect","useLayoutEffect","useMemo","useRef","useState","useSyncExternalStore","translateKeyOrText","jsx","jsxs","useState","useMemo","useRef","useEffect","useCallback","useSyncExternalStore","useLayoutEffect","translateKeyOrText","useEffect","useMemo","useRef","useState","Children","Fragment","createContext","isValidElement","useContext","useEffect","useLayoutEffect","useMemo","useRef","arrangeMenuRows","warnMenuPart","createContext","createElement","useCallback","useContext","useEffect","useMemo","useRef","useState","useSyncExternalStore","useId","useMemo","useRef","useState","gradientCss","useEffect","useLayoutEffect","useRef","useState","Fragment","jsx","jsxs","useRef","useLayoutEffect","useState","useEffect","useEffect","useRef","useState","translateKeyOrText","Fragment","jsx","jsxs","translateKeyOrText","useRef","useState","useEffect","Fragment","cloneElement","createContext","useContext","useEffect","useLayoutEffect","useRef","useState","useSyncExternalStore","createContext","useContext","useSyncExternalStore","Fragment","jsx","jsxs","createContext","useContext","cloneElement","wiring","useRef","useState","useSyncExternalStore","useLayoutEffect","useEffect","Fragment","jsx","jsxs","useRef","useState","useMemo","useId","gradientCss","useEffect","useId","useMemo","useRef","useState","commitDialogCommand","translateDialogErrors","translateKeyOrText","Fragment","jsx","jsxs","parts","useId","useState","useRef","useEffect","commitDialogCommand","useMemo","translateDialogErrors","bad","translateKeyOrText","useEffect","useId","useMemo","useRef","useState","commitDialogCommand","translateDialogErrors","translateKeyOrText","Fragment","jsx","jsxs","parts","useId","useState","useRef","useEffect","values","commitDialogCommand","useMemo","translateDialogErrors","bad","translateKeyOrText","useMemo","useState","translateDialogErrors","Fragment","jsx","jsxs","parts","useState","useMemo","translateDialogErrors","useEffect","useId","useRef","useState","Fragment","jsx","jsxs","useDialogDraft","useRef","useState","useEffect","useId","parts","Fragment","jsx","jsxs","parts","useDialogDraft","useId","useState","formCommandRejection","useEffect","useRef","useState","jsx","jsxs","useState","useRef","useEffect","Fragment","jsx","jsxs","parts","useId","useState","useDialogDraft","formCommandRejection","useId","useState","formCommandRejection","takeDialogSection","Fragment","jsx","jsxs","parts","useId","useState","useDialogDraft","takeDialogSection","formCommandRejection","formCommandRejection","jsx","jsxs","parts","useDialogDraft","formCommandRejection","jsx","jsxs","render","createElement","createContext","useState","useRef","useCallback","useEffect","useMemo","useContext","useSyncExternalStore","createContext","useContext","SHAPE_GALLERY","sameChromeCommandState","translateKeyOrText","createContext","useCallback","useContext","useEffect","useId","useMemo","useState","useSyncExternalStore","createHyperlinkPopupStore","focusSurfaceOf","requestLinkPopup","useCallback","useEffect","useRef","useState","Fragment","jsx","jsxs","useRef","useState","useEffect","useCallback","Children","createContext","Fragment","isValidElement","useContext","useEffect","useMemo","useRef","translateKeyOrText","Fragment","jsx","jsxs","createContext","useContext","Children","isValidElement","useMemo","parts","visit","props","useRef","useEffect","translateKeyOrText","createContext","useContext","useEffect","useMemo","useRef","useState","useSyncExternalStore","HyperlinkPopupContext","createContext","useRef","useEffect","useSyncExternalStore","useMemo","useHyperlinkPopup","useContext","useState","Fragment","jsx","jsxs","createContext","useContext","useEffect","useMemo","requestLinkPopup","useState","createHyperlinkPopupStore","useCallback","jsx","HyperlinkPopupContext","jsxs","useSyncExternalStore","useId","focusSurfaceOf","Fragment","useEffect","useRef","useState","tooltipAttributes","translateKeyOrText","Fragment","jsx","jsxs","LayoutThumb","useRef","useEffect","translateKeyOrText","tooltipAttributes","useState","jsx","useContext","sameChromeCommandState","jsx","translateKeyOrText","SHAPE_GALLERY","createContext","Children","Fragment","isValidElement","useCallback","useContext","useEffect","useRef","useState","translateKeyOrText","warnMenuPart","Fragment","jsx","jsxs","useContext","isValidElement","translateKeyOrText","warnMenuPart","flatten","Children","useState","useRef","useCallback","useEffect","active","Fragment","jsx","jsxs","createContext","useContext","flatten","Children","isValidElement","warnMenuPart","useRef","useMemo","useLayoutEffect","useEffect","arrangeMenuRows","jsx","useState","useEffect","useRef","useMemo","useEffect","useRef","useState","chromeControlForSlot","tooltipAttributes","groupSlideSections","sectionOfSlide","slideMenuPoint","translateKeyOrText","memo","useEffect","useId","useLayoutEffect","useRef","useState","tooltipAttributes","groupSlideSections","radioGroupStep","railOrientationChrome","railRightToLeft","runSlideStep","stepCommand","platformShortcuts","commandRowReason","translateKeyOrText","useCallback","useEffect","useLayoutEffect","useRef","useState","useSyncExternalStore","canRenameSectionInPlace","subscribeSectionRenamers","translateKeyOrText","jsx","jsxs","EMPTY","useRef","useEffect","useState","useCallback","useState","useRef","useLayoutEffect","jsx","jsxs","useEffect","translateKeyOrText","jsx","jsxs","commandRowReason","translateKeyOrText","Children","Fragment","createContext","isValidElement","useContext","useState","Fragment","jsx","jsxs","createContext","useContext","Children","isValidElement","useState","flatten","parts","useCallback","useRef","useState","useRef","useState","useCallback","useCallback","useContext","useEffect","useId","useLayoutEffect","useMemo","useRef","useState","notesFieldText","notesSelection","onFindShown","focusSurfaceOf","useContext","useEffect","useState","useSyncExternalStore","jsx","jsxs","useState","useEffect","useContext","HyperlinkPopupContext","useSyncExternalStore","focusSurfaceOf","useEffect","useLayoutEffect","useRef","jsx","useRef","useLayoutEffect","useEffect","jsx","createContext","useCallback","useContext","useMemo","useRef","warnOutsideRoot","jsx","jsxs","useContext","useState","useRef","useLayoutEffect","useId","useMemo","useCallback","notesSelection","notesFieldText","useEffect","onFindShown","Fragment","jsx","jsxs","sameIndices","memo","Thumbnail","useRef","useEffect","useState","useId","groupSlideSections","useLayoutEffect","railRightToLeft","railOrientationChrome","item","runSlideStep","stepCommand","shown","tooltipAttributes","NumberField","platformShortcuts","radioGroupStep","jsx","jsxs","groupSlideSections","useRef","useState","useEffect","sectionOfSlide","item","slideMenuPoint","chromeControlForSlot","translateKeyOrText","tooltipAttributes","useEffect","useLayoutEffect","useRef","useState","createPortal","jsx","jsxs","Fragment","jsx","jsxs","PptxEditorRoot","useState","useRef","useEffect","translateKeyOrText","useMemo","useLayoutEffect","Children","Fragment","isValidElement","useEffect","useId","useLayoutEffect","useRef","useState","colorMenuSelection","runChromeRow","surfaceInputIn","chromeControlForSlot","translateKeyOrText","Fragment","useCallback","useRef","useState","Fragment","jsx","jsxs","useRef","useState","useCallback","useRef","translateKeyOrText","Fragment","jsx","jsxs","useRef","translateKeyOrText","requestLinkPopup","useRef","useState","chromeOptionChecked","Fragment","jsx","jsxs","useRef","useState","chromeOptionChecked","Children","isValidElement","chromeControlForSlot","warnAsChildChild","createContext","useContext","useEffect","useId","useLayoutEffect","useRef","useState","Fragment","jsx","jsxs","createContext","useContext","join","useId","useRef","useState","useLayoutEffect","useEffect","Fragment","jsx","chromeControlForSlot","Children","isValidElement","warnAsChildChild","render","parts","useEffect","useId","useRef","useState","jsx","jsxs","useState","useRef","useId","useEffect","useLayoutEffect","useState","Fragment","jsx","jsxs","useRef","useState","translateKeyOrText","colorMenuSelection","runChromeRow","surfaceInputIn","chromeControlForSlot","isValidElement","parts","Children","panelId","useId","useLayoutEffect","useEffect","Children","Fragment","isValidElement","tooltipAttributes","warnAsChildChild","Fragment","jsx","jsxs","tooltipAttributes","Children","isValidElement","warnAsChildChild","TOOLBAR_NAMED_PARTS","jsx","TOOLBAR_NAMED_PARTS","useEffect","useRef","useState","jsx","jsxs","useState","useRef","useEffect","useCallback","useId","useState","jsx","jsxs","useState","useCallback","useId","Fragment","jsx","jsxs","Children","Fragment","isValidElement","useEffect","useId","useRef","useState","translateKeyOrText","jsx","jsxs","flatten","Children","isValidElement","Fragment","useId","useState","useRef","translateKeyOrText","useEffect","tabId","panelId","Children","Fragment","isValidElement","warnAsChildChild","Fragment","jsx","jsxs","Children","isValidElement","warnAsChildChild","PARTS","flatten","useContext","useEffect","useId","useMemo","useSyncExternalStore","jsx","useContext","useId","useMemo","useEffect","useSyncExternalStore","useCallback","useContext","useEffect","useMemo","useRef","useState","zoomStep","useCallback","useMemo","zoomStep","useRef","useEffect","useState","useContext","useCallback","useEffect","useMemo","useRef","useState","useSyncExternalStore","useState","useRef","useMemo","useEffect","useCallback","useSyncExternalStore","gradientCss","useCallback","useCallback","useCallback","chromeCommandState","chromeCommandState","useCallback","useCallback","useCallback","useMemo","useRef","useCallback","useMemo","fontPickerGroups","isCurrentFontRow","useMemo","fontPickerGroups","useCallback","isCurrentFontRow","composeFontOrigins","defineFontResolver","Toolbar","PptxEditorContextMenu","SlideRail","createElement","forwardRef","document","useMemo","PptxEditor"]}