pptx-svelte-viewer 4.54.0 → 4.55.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.
- package/CHANGELOG.md +57 -0
- package/README.md +1 -1
- package/dist/{AiChatPanel-BnehJ42a.js → AiChatPanel-B1FwoK_F.js} +50 -50
- package/dist/ai-assistant-registry-CUKUJBDS.js +5 -0
- package/dist/ai.d.ts +14 -0
- package/dist/ai.js +8 -0
- package/dist/context-BYZ6OEju.js +14 -0
- package/dist/{export-v7cYEprs.js → export-BJPif0uf.js} +7455 -7560
- package/dist/index.d.ts +3056 -7
- package/dist/index.js +55 -53
- package/dist/internals.js +1 -1
- package/dist/{transition-overlay-BKRKblpi.js → transition-overlay-BSugeWHT.js} +707 -716
- package/dist/viewer/index.d.ts +535 -435
- package/dist/viewer/index.js +25 -24
- package/dist/x-ahsysihf.js +279 -0
- package/dist/{y-webrtc-DTI3MqYF.js → y-webrtc-UWmmFjVf.js} +3 -3
- package/package.json +9 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as ooxml_ui_pptx from 'ooxml-ui/pptx';
|
|
2
|
-
import { PrintSettings, ViewportFitOptions, ViewerFontSource, ViewerTheme, ThemeCatalogEntry, AccountAuthConfig, GoogleFontsOption, PptxLoadLimits, ToolbarActionId, RibbonAddInTab, ViewerCustomization,
|
|
3
|
-
export { AutosaveRecord, BACKSTAGE_CARD_IDS, BACKSTAGE_PAGE_IDS, BackstageCustomization, CANVAS_CONTEXT_MENU_COMMAND_IDS, CanvasSize, CollaborationConfig, CollaborationRole, CollaborationShellState, CollaborationState, CollaborationTransport, ConnectionStatus, ContextMenuCustomization, EDITOR_SHORTCUT_ACTION_IDS, ELEMENT_CONTEXT_MENU_COMMAND_IDS, ElementUpdate, ElementUpdateOptions, ExternalCollaborationAwareness, ExternalCollaborationSession, ExternalCollaborationSnapshot, HostCanvasMenuContext, HostElementMenuContext, HostMenuCommand, KeyboardCustomization, OPTIONS_PAGE_IDS, OPTIONS_SECTION_IDS, OPTIONS_SETTING_IDS, OptionsCustomization, OptionsPageId, OptionsSectionId, OptionsSettingId, OptionsSettingValues, PPTX_OPEN_ACCEPT, PRESENTATION_OPEN_EXTENSIONS, RIBBON_CONTROL_IDS, RIBBON_GROUP_IDS, RIBBON_TAB_IDS, RemoteCursor, ResolvedCustomization, RibbonContextualTabId, RibbonControlId, RibbonCustomization, RibbonGroupId, SanitizedPresence, SavedPresentationFormat, SessionDeck, ShortcutChord, TOOLBAR_BUTTON_IDS, VIEWER_DIALOG_IDS, VIEWER_EXPORT_FORMAT_IDS, VIEWER_FEATURE_IDS, VIEWER_PANEL_IDS, ViewerCustomization, ViewerCustomizationApi, ViewerDialogId, ViewerExportFormatId, ViewerFeatureId, ViewerPanelId, ViewerTheme, ViewerThemeColors, ViewportFitOptions, ViewportFitPadding, createImageElementFromFile, defaultCssVars, defaultRadius, defaultThemeColors, deleteAutosaveSnapshot, describeCollaborationShellState, forgetSessionDeck, getAutosaveSnapshot, getSessionTabId, isLegacyBinaryPresentation, isSupportedPresentationFile, listAutosaveSnapshots, loadPresentationDeck, loadSessionDeck, parsePresentationSessionId, presentationBaseName, rememberSessionDeck, restoreSessionDeck, savedPresentationFileName, themeToCssVars, vermilionDarkColors, vermilionDarkTheme, vermilionLightColors, vermilionLightTheme, vermilionRadius } from 'ooxml-ui/pptx';
|
|
2
|
+
import { PrintSettings, CanvasSize, RasterizeElementResult, RasterizeElementTilesResult, ViewportFitOptions, ViewerFontSource, ViewerTheme, ThemeCatalogEntry, AccountAuthConfig, GoogleFontsOption, PptxLoadLimits, ToolbarActionId, RibbonAddInTab, ViewerCustomization, DocumentStorage, ViewerAutosaveStatus, AutosaveRecord, ConnectionStatus, CollaborationInput, CollaborationConfig, CollaborationState, PowerPointViewerAPI, ViewerCustomizationApi, PptxAutosaveStatusKind, DeckSaveIntent, InlineTextDraft, AnimationGroup, AlignEdge, DistributeAxis, MergeShapeOperation, PasteSpecialFormat, CropSession, CropElementUpdate, TemplateElementMap, HistoryTheme, ElementBoxPatch, EditorHistoryController, InkStrokeView, InkPoint, MasterViewCrudAction, MasterViewCrudActionId, FreeformToolKind, EditPointsElementPatch, SlideTemplateId, SlideTemplateBuildOptions, SlidePasteRequest, RibbonTransitionDraft, CellCoord, CellRect, PendingInlineTextEdit, InlineListController, ElementClipboardPayload, TableStyleSaveOptions, FontEmbeddingDescriptor, InlineTextEditSnapshot, SnapGuideInput, CollaborationLivePatcher, InlineTextDraftSink, ResolvedKeyboardCustomization, MarqueeRect, ShapeAdjustmentHandleDescriptor, SnapLine, ResizeHandleId, ConnectorEndpointKind, CollaborationInlineEditor, FindResult, CollaborationTransport, YDocLike, YjsFactories, CollabProviderHandle, CollaborationHistoryTarget, RemoteCursor, SanitizedPresence, CollabLoadOrigin, BroadcastConfig, ElementAnimationState, AuthoredSlideRange, RunProgramNotice, ZoomNavigationTarget, PresentationSnapshot, AutosaveRecoveryPrompt, CompatibilityWarningToast, SlideSizeEmu, LoadLimitTranslate, ReadOnlyRecommendation, ReadOnlyBannerPasswordError, ViewerOptions, ViewerOptionsStoreInit, ViewerPreferences, ToolbarTabId, ViewerOptionsGroupId, ViewerOptionPrimitive, ViewerOptionsConstraints, CompareResult, Guide, DeckViewPreferences, CollaborationShellState, ViewerMode, AutosaveDisabledReason, MobileSheetKey, FieldSubstitutionContext, SlidesPaneLayoutGalleryRequest } from 'ooxml-ui/pptx';
|
|
3
|
+
export { AutosaveRecord, BACKSTAGE_CARD_IDS, BACKSTAGE_PAGE_IDS, BackstageCustomization, CANVAS_CONTEXT_MENU_COMMAND_IDS, CanvasSize, CollaborationConfig, CollaborationRole, CollaborationShellState, CollaborationState, CollaborationTransport, ConnectionStatus, ContextMenuCustomization, EDITOR_SHORTCUT_ACTION_IDS, ELEMENT_CONTEXT_MENU_COMMAND_IDS, ElementUpdate, ElementUpdateOptions, ExternalCollaborationAwareness, ExternalCollaborationSession, ExternalCollaborationSnapshot, HostCanvasMenuContext, HostElementMenuContext, HostMenuCommand, KeyboardCustomization, OPTIONS_PAGE_IDS, OPTIONS_SECTION_IDS, OPTIONS_SETTING_IDS, OptionsCustomization, OptionsPageId, OptionsSectionId, OptionsSettingId, OptionsSettingValues, PPTX_OPEN_ACCEPT, PRESENTATION_OPEN_EXTENSIONS, RIBBON_CONTROL_IDS, RIBBON_GROUP_IDS, RIBBON_TAB_IDS, RemoteCursor, ResolvedCustomization, RibbonContextualTabId, RibbonControlId, RibbonCustomization, RibbonGroupId, SanitizedPresence, SavedPresentationFormat, SessionDeck, ShortcutChord, SlidesPaneLayoutGalleryRequest, TOOLBAR_BUTTON_IDS, VIEWER_DIALOG_IDS, VIEWER_EXPORT_FORMAT_IDS, VIEWER_FEATURE_IDS, VIEWER_PANEL_IDS, ViewerCustomization, ViewerCustomizationApi, ViewerDialogId, ViewerExportFormatId, ViewerFeatureId, ViewerPanelId, ViewerTheme, ViewerThemeColors, ViewportFitOptions, ViewportFitPadding, createImageElementFromFile, defaultCssVars, defaultRadius, defaultThemeColors, deleteAutosaveSnapshot, describeCollaborationShellState, forgetSessionDeck, getAutosaveSnapshot, getSessionTabId, isLegacyBinaryPresentation, isSupportedPresentationFile, listAutosaveSnapshots, loadPresentationDeck, loadSessionDeck, parsePresentationSessionId, presentationBaseName, rememberSessionDeck, restoreSessionDeck, savedPresentationFileName, themeToCssVars, vermilionDarkColors, vermilionDarkTheme, vermilionLightColors, vermilionLightTheme, vermilionRadius } from 'ooxml-ui/pptx';
|
|
4
4
|
import { Component } from 'svelte';
|
|
5
|
-
import { PptxAiConfig } from 'ooxml-ui/pptx/ai';
|
|
5
|
+
import { PptxAiConfig, PptxAiBridge } from 'ooxml-ui/pptx/ai';
|
|
6
6
|
export { PptxAiBridge, PptxAiConfig, PptxAiConnection, PptxAiContextStrategy, PptxAiToolName, PptxAiUIMessage, PptxAiWritePolicy } from 'ooxml-ui/pptx/ai';
|
|
7
|
+
import { PptxAiAssistant, PptxAiFocusedTarget, AiChangeBatch, AiCanvasHighlight, ToolCanvasTarget } from 'ooxml-ui/pptx/ai/host';
|
|
8
|
+
export { PptxAiAssistant } from 'ooxml-ui/pptx/ai/host';
|
|
7
9
|
import { LocaleCatalogEntry } from 'ooxml-ui/pptx/i18n';
|
|
8
|
-
import {
|
|
10
|
+
import { PptxSlide, PptxData, SvgExportOptions, PptxCoreProperties, PptxSaveFormat, PptxSlideMaster, PptxNotesMaster, PptxHandoutMaster, PptxSection, PptxHandler, PptxAnimationPreset, PptxElement, PptxHeaderFooter, PptxPresentationProperties, PptxCustomShow, PptxAppProperties, PptxCustomProperty, PptxTagCollection, TextSegment, MasterViewTab, ShapePptxElement, PptxLayoutOption, PptxLayoutPreview, PptxTransitionType, PptxSlideTransition, PptxTableData, PptxTheme, PptxViewProperties, PptxModernCommentAuthor, PptxCommentAuthor, PptxSlideSize, PptxThemeOption, PptxHandlerSaveOptions, PptxCompatibilityWarning, PptxModifyVerifier, PptxEmbeddedFont, PptxThemeColorScheme, ParsedTableStyleMap, PptxHandlerLoadOptions } from 'ooxml-core/pptx';
|
|
9
11
|
import { Options } from 'html2canvas-pro';
|
|
10
12
|
|
|
11
13
|
/**
|
|
@@ -80,6 +82,12 @@ interface ExportGifOptions {
|
|
|
80
82
|
*/
|
|
81
83
|
/** Options for the print flow: any subset of the shared print settings. */
|
|
82
84
|
type PrintOptions = Partial<PrintSettings>;
|
|
85
|
+
/**
|
|
86
|
+
* Render a complete HTML document into a print surface and trigger printing.
|
|
87
|
+
* Returns `false` when the surface could not be opened (e.g. a custom
|
|
88
|
+
* `window.open`-based opener hit a popup blocker).
|
|
89
|
+
*/
|
|
90
|
+
type OpenPrintWindow = (htmlDocument: string) => boolean;
|
|
83
91
|
|
|
84
92
|
/**
|
|
85
93
|
* Video (WebM) export driven by the shared `video-plan` maths: segment timing
|
|
@@ -110,6 +118,9 @@ interface ExportVideoOptions {
|
|
|
110
118
|
signal?: AbortSignal;
|
|
111
119
|
}
|
|
112
120
|
|
|
121
|
+
/** Rasterise the slide at `index` to an `HTMLCanvasElement`. Injected so the
|
|
122
|
+
* controller stays DOM-capture-free and unit-testable. */
|
|
123
|
+
type RasterizeSlide = (index: number, scaleMultiplier?: number) => Promise<HTMLCanvasElement>;
|
|
113
124
|
/** Per-slide progress callback: `(currentSlideIndex, totalSlides)`. */
|
|
114
125
|
type ExportProgress = (current: number, total: number) => void;
|
|
115
126
|
/** Options for the multi-slide PDF export (progress + cooperative cancel). */
|
|
@@ -119,6 +130,105 @@ interface ExportPdfOptions {
|
|
|
119
130
|
/** Abort the export early; the loop checks this between slides. */
|
|
120
131
|
signal?: AbortSignal;
|
|
121
132
|
}
|
|
133
|
+
interface ExportControllerDeps {
|
|
134
|
+
/** Live slide count; read fresh on every call. */
|
|
135
|
+
getSlideCount(): number;
|
|
136
|
+
/** Active slide index (0-based); the PNG export's default target. */
|
|
137
|
+
getCurrent(): number;
|
|
138
|
+
/** Live slide canvas size (px), for the PDF page size. */
|
|
139
|
+
getCanvasSize(): CanvasSize;
|
|
140
|
+
/** Live slide list (print needs slide notes/titles, not just the count). */
|
|
141
|
+
getSlides(): PptxSlide[];
|
|
142
|
+
rasterizeSlide: RasterizeSlide;
|
|
143
|
+
/**
|
|
144
|
+
* PNG-export / "copy slide as image" only: returns the full
|
|
145
|
+
* `RasterizeElementResult` (tiled `png-bytes` included) instead of a
|
|
146
|
+
* plain canvas. Optional so existing test fixtures that only configure
|
|
147
|
+
* `rasterizeSlide` keep working; `exportSlidePng`/`copySlideAsImage` fall
|
|
148
|
+
* back to wrapping `rasterizeSlide`'s canvas when omitted.
|
|
149
|
+
*/
|
|
150
|
+
rasterizeSlideToRaster?: (index: number, scaleMultiplier?: number) => Promise<RasterizeElementResult>;
|
|
151
|
+
/**
|
|
152
|
+
* PDF export only: returns the raw per-tile canvases (no PNG stitching)
|
|
153
|
+
* instead of a plain canvas. Optional so existing test fixtures that only
|
|
154
|
+
* configure `rasterizeSlide` keep working; `exportPdf` falls back to
|
|
155
|
+
* placing a single full-page image (today's behaviour) when omitted.
|
|
156
|
+
*/
|
|
157
|
+
rasterizeSlideToTiles?: (index: number, scaleMultiplier?: number) => Promise<RasterizeElementTilesResult>;
|
|
158
|
+
/** Print-surface opener override; see `export-print.ts` for the default. */
|
|
159
|
+
openPrintWindow?: OpenPrintWindow;
|
|
160
|
+
/** Base file name (without extension) for downloads. Defaults to `presentation`. */
|
|
161
|
+
fileName?: string;
|
|
162
|
+
/** Live presentation data for the deck-JSON export; undefined before a load. */
|
|
163
|
+
getDeckData?(): PptxData | undefined;
|
|
164
|
+
/** Source file name for the deck-JSON download (`deck.pptx` -> `deck.json`). */
|
|
165
|
+
getFileName?(): string | undefined;
|
|
166
|
+
/** Options > Advanced > "Print hidden slides". Defaults to `false` (excluded). */
|
|
167
|
+
getIncludeHiddenSlides?(): boolean;
|
|
168
|
+
/** Options > Advanced > "High quality" raster scale for the print fallback path. */
|
|
169
|
+
getPrintHighQuality?(): boolean;
|
|
170
|
+
/** Live translator, for the print window title. English when omitted. */
|
|
171
|
+
getTranslator?(): Translator;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Export controller (runes class): render slides to PNG / PDF / animated GIF /
|
|
175
|
+
* WebM video, plus the print flow. Started as a Svelte port of Vue's
|
|
176
|
+
* `useExport` composable (`packages/vue/src/viewer/composables/useExport.ts`)
|
|
177
|
+
* and now also covers React's `useExportHandlers` GIF/video surface (via
|
|
178
|
+
* `export-gif.ts` / `export-video.ts`) and Vue's `usePrint`
|
|
179
|
+
* (`export-print.ts`), reshaped as a `$state`-backed class to match this
|
|
180
|
+
* package's runes-class convention (see `EditorState` in
|
|
181
|
+
* `../editor/editor-state.svelte.ts`) rather than Vue `Ref`s.
|
|
182
|
+
*
|
|
183
|
+
* Rasterisation is delegated to the injected `rasterizeSlide` (the host owns
|
|
184
|
+
* the off-screen `SlideStage` mount + `html2canvas-pro`, see
|
|
185
|
+
* `rasterize-slide.ts`). `jspdf` is loaded lazily so it stays out of the main
|
|
186
|
+
* bundle.
|
|
187
|
+
*/
|
|
188
|
+
declare class ExportController {
|
|
189
|
+
#private;
|
|
190
|
+
/** True while an export is running (disable UI / show a spinner). */
|
|
191
|
+
exporting: boolean;
|
|
192
|
+
constructor(deps: ExportControllerDeps);
|
|
193
|
+
/** Export a single slide as a PNG download. Defaults to the current slide. */
|
|
194
|
+
exportSlidePng(index?: number): Promise<void>;
|
|
195
|
+
/** Copy a slide to the system clipboard as a PNG image. */
|
|
196
|
+
copySlideAsImage(index?: number): Promise<void>;
|
|
197
|
+
/**
|
|
198
|
+
* Serialize the live deck to `pptx-viewer-json` and trigger the download.
|
|
199
|
+
* Pure data serialization (shared `exportDeckJson`): synchronous, no
|
|
200
|
+
* rasterization pipeline, no progress modal, no `exporting` toggle.
|
|
201
|
+
*/
|
|
202
|
+
exportJson(): void;
|
|
203
|
+
/** Export every slide as a multi-page PDF download (one slide per page). */
|
|
204
|
+
exportPdf(options?: ExportPdfOptions): Promise<void>;
|
|
205
|
+
/**
|
|
206
|
+
* Export every slide as an animated GIF download. Frame delays come from
|
|
207
|
+
* the shared `planGifFrames` plan (default duration + per-slide overrides);
|
|
208
|
+
* see `export-gif.ts`. Supports progress + AbortSignal like `exportPdf`.
|
|
209
|
+
*/
|
|
210
|
+
exportGif(options?: ExportGifOptions): Promise<void>;
|
|
211
|
+
/**
|
|
212
|
+
* Export every slide as a WebM video download (MediaRecorder over a canvas
|
|
213
|
+
* capture stream, timing from the shared `planVideoSegments` plan); see
|
|
214
|
+
* `export-video.ts`. Supports progress + AbortSignal like `exportPdf`.
|
|
215
|
+
*/
|
|
216
|
+
exportVideo(options?: ExportVideoOptions): Promise<void>;
|
|
217
|
+
/**
|
|
218
|
+
* Assemble the shared print document for the given (partial) settings and
|
|
219
|
+
* open it in the print surface (hidden iframe by default; see
|
|
220
|
+
* `export-print.ts` for the popup-blocker caveats of custom openers).
|
|
221
|
+
* Resolves `true` when the print surface opened.
|
|
222
|
+
*/
|
|
223
|
+
print(options?: PrintOptions): Promise<boolean>;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
interface ExportWiring {
|
|
227
|
+
/** The reactive PNG/PDF export controller (`exporting` drives a spinner). */
|
|
228
|
+
controller: ExportController;
|
|
229
|
+
/** Tear down the off-screen capture stage (component destroy). */
|
|
230
|
+
destroy(): void;
|
|
231
|
+
}
|
|
122
232
|
|
|
123
233
|
type SvgExportSingleSlideOptions = SvgExportOptions;
|
|
124
234
|
type SvgExportAllOptions = SvgExportOptions;
|
|
@@ -133,6 +243,16 @@ declare function exportAllSlidesToSvg(data: PptxData, options?: SvgExportAllOpti
|
|
|
133
243
|
/** Export the selected presentation slides as SVG Blobs. */
|
|
134
244
|
declare function exportAllSlidesToSvgBlobs(data: PptxData, options?: SvgExportAllOptions): Blob[];
|
|
135
245
|
|
|
246
|
+
/** The imperative export API exposed on the `PowerPointViewer` instance. */
|
|
247
|
+
interface ExportingApi {
|
|
248
|
+
exportSlidePng(index?: number): Promise<void>;
|
|
249
|
+
copySlideAsImage(index?: number): Promise<void>;
|
|
250
|
+
exportPdf(options?: ExportPdfOptions): Promise<void>;
|
|
251
|
+
exportGif(options?: ExportGifOptions): Promise<void>;
|
|
252
|
+
exportVideo(options?: ExportVideoOptions): Promise<void>;
|
|
253
|
+
print(options?: PrintOptions): Promise<boolean>;
|
|
254
|
+
}
|
|
255
|
+
|
|
136
256
|
/**
|
|
137
257
|
* A drop-in wrapper around `html2canvas-pro` that first normalises modern CSS
|
|
138
258
|
* colour functions (oklch/oklab/lch/lab/color()) to sRGB and applies the
|
|
@@ -506,8 +626,14 @@ interface PowerPointViewerProps extends ViewportFitOptions {
|
|
|
506
626
|
* The panel (and the optional `@ai-sdk/svelte` + `ai` peers it needs) is
|
|
507
627
|
* lazily loaded only when first opened; leaving this undefined ships no AI UI
|
|
508
628
|
* and never pulls the SDK. See `pptx-viewer-shared/ai`'s `PptxAiConfig`.
|
|
629
|
+
*
|
|
630
|
+
* Pass a plain `PptxAiConfig` (supported and not deprecated), or the opaque
|
|
631
|
+
* handle `createAiAssistant(config)` returns (from `pptx-svelte-viewer/ai`,
|
|
632
|
+
* the opt-in entry that brings the chat panel). Both open the same panel.
|
|
633
|
+
* Only a value from `createAiAssistant` is read as a handle; any other value
|
|
634
|
+
* is a plain config, which the viewer does not validate.
|
|
509
635
|
*/
|
|
510
|
-
ai?: PptxAiConfig;
|
|
636
|
+
ai?: PptxAiConfig | PptxAiAssistant;
|
|
511
637
|
}
|
|
512
638
|
/**
|
|
513
639
|
* Imperative editing API exposed on the `<PowerPointViewer>` component
|
|
@@ -583,6 +709,61 @@ interface PowerPointViewerApi extends PowerPointViewerAPI, ViewerCustomizationAp
|
|
|
583
709
|
*/
|
|
584
710
|
declare const PowerPointViewer: Component<PowerPointViewerProps, PowerPointViewerApi>;
|
|
585
711
|
|
|
712
|
+
/**
|
|
713
|
+
* ExportUiState: reactive state behind the toolbar `ExportMenu` and the
|
|
714
|
+
* `ExportProgressModal`. Svelte port of Vue's `useExportProgress` composable:
|
|
715
|
+
* it owns the modal state (open / title / progress / status), the
|
|
716
|
+
* `AbortController` the export loops check between slides, and wraps each
|
|
717
|
+
* multi-slide export (PDF / GIF / WebM) in a `begin -> run -> end` envelope.
|
|
718
|
+
* All percentage maths + status labels come from `pptx-viewer-shared`
|
|
719
|
+
* (`export-progress.ts`) so every binding shows identical progress.
|
|
720
|
+
*
|
|
721
|
+
* PNG (single slide, fast) and print (opens its own surface) run without the
|
|
722
|
+
* modal; the menu trigger still disables via {@link exporting} while they run.
|
|
723
|
+
*/
|
|
724
|
+
interface ExportUiDeps {
|
|
725
|
+
controller: ExportController;
|
|
726
|
+
getTranslator(): Translator;
|
|
727
|
+
/**
|
|
728
|
+
* Fired after an export completes successfully (Options > Accessibility
|
|
729
|
+
* "feedback with sound" hook); not called on abort or failure.
|
|
730
|
+
*/
|
|
731
|
+
onComplete?(): void;
|
|
732
|
+
}
|
|
733
|
+
declare class ExportUiState {
|
|
734
|
+
#private;
|
|
735
|
+
/** Whether the progress modal is visible. */
|
|
736
|
+
open: boolean;
|
|
737
|
+
/** Modal heading (e.g. "Export as PDF"). */
|
|
738
|
+
title: string;
|
|
739
|
+
/** Current progress, 0-100. */
|
|
740
|
+
progress: number;
|
|
741
|
+
/** Status line under the bar (e.g. "Rendering slide 3 of 10..."). */
|
|
742
|
+
status: string;
|
|
743
|
+
constructor(deps: ExportUiDeps);
|
|
744
|
+
/** True while any export runs (disables the menu trigger). */
|
|
745
|
+
get exporting(): boolean;
|
|
746
|
+
/** Export the current slide as PNG (no modal; quick single capture). */
|
|
747
|
+
runPng(): void;
|
|
748
|
+
/**
|
|
749
|
+
* Export the deck as a `pptx-viewer-json` download (no modal; a pure,
|
|
750
|
+
* synchronous serialization with no capture pipeline).
|
|
751
|
+
*/
|
|
752
|
+
runJson(): void;
|
|
753
|
+
/** Copy the current slide to the system image clipboard. */
|
|
754
|
+
runCopyImage(): void;
|
|
755
|
+
/** Run the PDF export with the progress modal wired. */
|
|
756
|
+
runPdf(): Promise<void>;
|
|
757
|
+
/** Run the animated-GIF export with the progress modal wired. */
|
|
758
|
+
runGif(): Promise<void>;
|
|
759
|
+
/** Run the WebM video export with the progress modal wired. */
|
|
760
|
+
runVideo(): Promise<void>;
|
|
761
|
+
/** Run the print flow (no modal; the print surface takes over). */
|
|
762
|
+
runPrint(options?: PrintOptions): void;
|
|
763
|
+
/** Cancel the in-flight export (aborts the loop, closes the modal). */
|
|
764
|
+
cancel(): void;
|
|
765
|
+
}
|
|
766
|
+
|
|
586
767
|
/**
|
|
587
768
|
* autosave.svelte.ts: the Svelte adapter of the shared recovery autosave engine
|
|
588
769
|
* (`createAutosaveController` in `ooxml-ui/pptx`).
|
|
@@ -596,6 +777,2874 @@ declare const PowerPointViewer: Component<PowerPointViewerProps, PowerPointViewe
|
|
|
596
777
|
*/
|
|
597
778
|
/** The `state` of the one shared `PptxAutosaveStatus`. */
|
|
598
779
|
type AutosaveStatus = PptxAutosaveStatusKind;
|
|
780
|
+
interface AutosaveDeps {
|
|
781
|
+
/**
|
|
782
|
+
* Master on/off: the resolved activation (`resolveAutosaveActivation` in
|
|
783
|
+
* shared), which folds the host policy, the user's toggle, editability and
|
|
784
|
+
* the collaboration read-only veto into one answer.
|
|
785
|
+
*/
|
|
786
|
+
getEnabled: () => boolean;
|
|
787
|
+
/** Debounce window in milliseconds, and the ceiling on deferring a save. */
|
|
788
|
+
getIntervalMs: () => number;
|
|
789
|
+
/** IndexedDB record key (host `filePath`); autosave is disabled without one. */
|
|
790
|
+
getFilePath: () => string | undefined;
|
|
791
|
+
/** Host `storage` prop: recovery snapshots go to its recovery methods when it has them. */
|
|
792
|
+
getStorage?: () => DocumentStorage | undefined;
|
|
793
|
+
/** The current editable slides (watched for edits). */
|
|
794
|
+
getSlides: () => PptxSlide[];
|
|
795
|
+
/**
|
|
796
|
+
* True while a Design gallery hover preview shows over the slides, and the identities of the
|
|
797
|
+
* stores a preview swaps: the effect then tells an edit from a preview and its restore.
|
|
798
|
+
*/
|
|
799
|
+
getPreviewHeld?: () => boolean;
|
|
800
|
+
getDocumentKey?: () => readonly unknown[];
|
|
801
|
+
getSlideMasters?: () => PptxSlideMaster[];
|
|
802
|
+
getNotesMaster?: () => PptxNotesMaster | undefined;
|
|
803
|
+
getHandoutMaster?: () => PptxHandoutMaster | undefined;
|
|
804
|
+
getSections?: () => PptxSection[];
|
|
805
|
+
/** The live core handler used to serialize slides to `.pptx` bytes. */
|
|
806
|
+
getHandler: () => PptxHandler | null;
|
|
807
|
+
/**
|
|
808
|
+
* The Protect-Presentation state, forwarded to the shared save decision.
|
|
809
|
+
* Optional, and deliberately inert: a recovery snapshot is written in the
|
|
810
|
+
* clear whatever it says (see `deck-save-encryption` in
|
|
811
|
+
* `pptx-viewer-shared`). It is threaded through so the snapshot path uses
|
|
812
|
+
* the same one decision function as every real save.
|
|
813
|
+
*/
|
|
814
|
+
getSaveIntent?: () => DeckSaveIntent;
|
|
815
|
+
/**
|
|
816
|
+
* Monotonic load counter: a change means a fresh presentation was seeded (not
|
|
817
|
+
* a user edit), so the watcher clears dirty instead of arming a save.
|
|
818
|
+
*/
|
|
819
|
+
getLoadCount: () => number;
|
|
820
|
+
/**
|
|
821
|
+
* Monotonic SEED counter, bumped in the same synchronous block that installs
|
|
822
|
+
* the loaded slides (`EditorState.seedNonce`).
|
|
823
|
+
*
|
|
824
|
+
* `getLoadCount` alone is not enough, because the loader bumps it in an
|
|
825
|
+
* earlier flush than the effect that copies its slides into the editor: this
|
|
826
|
+
* watcher ran once on the count change (old slides, so nothing to do) and
|
|
827
|
+
* then a second time on the slide reassignment, with the count already
|
|
828
|
+
* settled - indistinguishable from an edit. Merely OPENING a deck therefore
|
|
829
|
+
* marked it dirty and wrote a crash-recovery snapshot, so the next visit
|
|
830
|
+
* offered to recover unsaved changes that never existed.
|
|
831
|
+
*/
|
|
832
|
+
getSeedNonce?: () => number;
|
|
833
|
+
/** The element whose inline editor is open; a closed editor's draft is dropped. */
|
|
834
|
+
getInlineEditingId?: () => string | null;
|
|
835
|
+
/** Host callback with the freshly-serialized bytes on each successful save. */
|
|
836
|
+
onSaved?: (bytes: Uint8Array) => void;
|
|
837
|
+
}
|
|
838
|
+
declare class AutosaveController {
|
|
839
|
+
#private;
|
|
840
|
+
constructor(deps: AutosaveDeps);
|
|
841
|
+
/** Current autosave lifecycle status (reactive). */
|
|
842
|
+
get status(): AutosaveStatus;
|
|
843
|
+
/** Whether there are edits no snapshot has captured yet (reactive). */
|
|
844
|
+
get isDirty(): boolean;
|
|
845
|
+
/** Epoch ms of the last successful save, or null (reactive). */
|
|
846
|
+
get lastSavedAt(): number | null;
|
|
847
|
+
/** In-progress inline text: a changed draft is an edit and goes into the snapshot. */
|
|
848
|
+
noteInlineDraft(draft: InlineTextDraft | null): void;
|
|
849
|
+
/** Force an immediate save, bypassing the interval. */
|
|
850
|
+
save(): Promise<void>;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
/**
|
|
854
|
+
* The chart Format pane's state: which chart element it targets (Chart
|
|
855
|
+
* Format > Current Selection, a click or double-click on the chart, the
|
|
856
|
+
* context menu) and whether the pane is open. Every decision about what a
|
|
857
|
+
* click hits and what an edit writes lives in `ooxml-ui/pptx`; this is only
|
|
858
|
+
* the runes holder the ribbon strip, the canvas chart and the pane share.
|
|
859
|
+
*
|
|
860
|
+
* The target belongs to one chart element: selecting another chart reads as
|
|
861
|
+
* the chart area again, as in PowerPoint, without an effect to reset it.
|
|
862
|
+
*/
|
|
863
|
+
declare class ChartFormatState {
|
|
864
|
+
#private;
|
|
865
|
+
/** The pane was opened (and not closed since). */
|
|
866
|
+
open: boolean;
|
|
867
|
+
/** The current target of chart `elementId`. */
|
|
868
|
+
targetFor(elementId: string | null | undefined): string;
|
|
869
|
+
/** Make `target` the current element of chart `elementId`. */
|
|
870
|
+
setTarget(elementId: string, target: string): void;
|
|
871
|
+
/** Open the pane on chart `elementId`, optionally retargeting it first. */
|
|
872
|
+
openPane(elementId: string, target?: string): void;
|
|
873
|
+
close(): void;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* Element-animation actions for the ribbon's Animations tab, split out of
|
|
878
|
+
* `EditorState` to keep it under the repo's 300-LOC budget.
|
|
879
|
+
*
|
|
880
|
+
* Animation data lives on the SLIDE (`PptxSlide.animations`, keyed by
|
|
881
|
+
* `elementId`), not on the element itself, matching how the presentation
|
|
882
|
+
* playback state machine reads it (`buildClickGroups` in
|
|
883
|
+
* `presentation/animation-playback.svelte.ts`). Both actions target the
|
|
884
|
+
* currently selected element and route through the shared
|
|
885
|
+
* `animation-authoring.ts` "coarse group preset" model (`applyAnimationPreset`
|
|
886
|
+
* / `removeElementAnimation`), the same one the Vue/vanilla ribbons use:
|
|
887
|
+
* applying a preset sets one of entrance/emphasis/exit without touching the
|
|
888
|
+
* others; remove drops the whole entry. Both mutations go through
|
|
889
|
+
* `EditorState.commitSlides`, so they are history-integrated (undoable).
|
|
890
|
+
*/
|
|
891
|
+
declare class EditorAnimationController {
|
|
892
|
+
#private;
|
|
893
|
+
constructor(editor: EditorState);
|
|
894
|
+
addAnimation(group: AnimationGroup, preset: PptxAnimationPreset): void;
|
|
895
|
+
removeAnimation(): void;
|
|
896
|
+
/**
|
|
897
|
+
* Apply a catalogue motion path (ribbon gallery / inspector select) to the
|
|
898
|
+
* selection. A path is NOT one of the three preset buckets: it upserts the
|
|
899
|
+
* `motionPath` field on the same animation entry, so an element can travel a
|
|
900
|
+
* path AND fade in, exactly as PowerPoint allows.
|
|
901
|
+
*/
|
|
902
|
+
applyMotionPath(presetId: string): void;
|
|
903
|
+
/**
|
|
904
|
+
* Write a raw path string (the canvas end-handle drag), bypassing the
|
|
905
|
+
* catalogue: a dragged path no longer matches any preset, and pinning it to
|
|
906
|
+
* one would silently discard the drag.
|
|
907
|
+
*/
|
|
908
|
+
setMotionPath(path: string): void;
|
|
909
|
+
/** Drop the motion path, and the whole entry when nothing else is left on it. */
|
|
910
|
+
clearMotionPath(): void;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* The Home tab's multi-select-aware Arrange group (align / distribute /
|
|
915
|
+
* flip / group / ungroup), split out of `EditorState` to keep it under the
|
|
916
|
+
* repo's 300-LOC budget. Reads `editor.selection.ids` (the ordered
|
|
917
|
+
* multi-selection) rather than just the primary id, matching React's
|
|
918
|
+
* `selectedElementIds` semantics.
|
|
919
|
+
*/
|
|
920
|
+
declare class EditorArrangeController {
|
|
921
|
+
#private;
|
|
922
|
+
constructor(editor: EditorState);
|
|
923
|
+
/** Align the selection to `edge`: to each other, or a lone element to the slide. */
|
|
924
|
+
alignSelected(edge: AlignEdge): void;
|
|
925
|
+
/** Distribute the selected elements evenly along `axis` (needs >= 3 selected). */
|
|
926
|
+
distributeSelected(axis: DistributeAxis): void;
|
|
927
|
+
/** Flip every selected element across `axis`. */
|
|
928
|
+
flipSelected(axis: 'horizontal' | 'vertical'): void;
|
|
929
|
+
/** Group the selected elements (needs >= 2 selected). Selects the new group. */
|
|
930
|
+
groupSelected(): void;
|
|
931
|
+
/** Ungroup the primary selected group element. Selects the ungrouped children. */
|
|
932
|
+
ungroupSelected(): void;
|
|
933
|
+
/**
|
|
934
|
+
* Merge Shapes (Union / Combine / Fragment / Intersect / Subtract) over the
|
|
935
|
+
* selection IN SELECTION ORDER, so the first-selected shape's formatting
|
|
936
|
+
* survives. One undo step; selects the new shape(s). False when a no-op.
|
|
937
|
+
*/
|
|
938
|
+
mergeSelected(operation: MergeShapeOperation): boolean;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* Slide-background actions for the ribbon's Design tab "Format Background"
|
|
943
|
+
* panel, split out of `EditorState` to keep it under the repo's 300-LOC
|
|
944
|
+
* budget (mirrors `EditorSlidesController` / `EditorArrangeController`).
|
|
945
|
+
*
|
|
946
|
+
* Solid-colour fill only (matches the docked panel's scope: a single colour
|
|
947
|
+
* input); clearing removes every background field so the slide falls back to
|
|
948
|
+
* its layout/master background. Both mutations route through
|
|
949
|
+
* `EditorState.commitSlides`, so they are history-integrated (undoable) like
|
|
950
|
+
* every other ribbon mutation.
|
|
951
|
+
*/
|
|
952
|
+
declare class EditorBackgroundController {
|
|
953
|
+
#private;
|
|
954
|
+
constructor(editor: EditorState);
|
|
955
|
+
/** Set the current slide's background to a solid colour. */
|
|
956
|
+
setSlideBackgroundColor(color: string): void;
|
|
957
|
+
/** Clear every background field on the current slide (fall back to layout/master). */
|
|
958
|
+
clearSlideBackground(): void;
|
|
959
|
+
/** Toggle PowerPoint's "Hide Background Graphics" (`p:sld/@showMasterSp`). */
|
|
960
|
+
setHideBackgroundGraphics(hide: boolean): void;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* Ctrl+C/X/V and the Home tab's Clipboard group, split out of `EditorState`
|
|
965
|
+
* to keep it under the repo's 300-LOC budget. Operates entirely through
|
|
966
|
+
* `EditorState`'s public surface (`slides`, `selection`, `currentSlideIndex`,
|
|
967
|
+
* `commitSlides`), the same contract a component would use.
|
|
968
|
+
*/
|
|
969
|
+
declare class EditorClipboardController {
|
|
970
|
+
#private;
|
|
971
|
+
constructor(editor: EditorState);
|
|
972
|
+
/** Copy the primary selected element to the clipboard (works read-only, like React). */
|
|
973
|
+
copySelected(): void;
|
|
974
|
+
/** Copy the primary selected element then delete it (with history). */
|
|
975
|
+
cutSelected(): void;
|
|
976
|
+
/** Paste the clipboard payload onto the current slide (fresh id, offset, selects it). */
|
|
977
|
+
pasteClipboard(): string | null;
|
|
978
|
+
/**
|
|
979
|
+
* Paste Special (Ctrl+Alt+V) / the dialog's OK: paste the clipboard with
|
|
980
|
+
* `format` already applied.
|
|
981
|
+
*/
|
|
982
|
+
pasteWithFormat(format: PasteSpecialFormat): string | null;
|
|
983
|
+
/**
|
|
984
|
+
* Re-derive an already-pasted element (the Paste Options toolbar) from its
|
|
985
|
+
* own pristine source clone. Non-cumulative: every choice starts over from
|
|
986
|
+
* the clone `pasteClipboard`/`pasteWithFormat` recorded, matching
|
|
987
|
+
* PowerPoint's own toolbar. "Picture" is handled by the caller (it needs a
|
|
988
|
+
* DOM rasterize step this controller does not perform) via `replaceElement`.
|
|
989
|
+
*/
|
|
990
|
+
reformatPasted(elementId: string, sourceClone: PptxElement, format: PasteSpecialFormat): void;
|
|
991
|
+
/** Replace one element by id, e.g. after rasterizing it to a picture. */
|
|
992
|
+
replaceElement(elementId: string, next: PptxElement): void;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
/**
|
|
996
|
+
* On-canvas picture crop mode (Picture Format > Crop), driven by the shared
|
|
997
|
+
* `picture-crop` lifecycle:
|
|
998
|
+
*
|
|
999
|
+
* - {@link enter}: the ribbon Crop button or the picture context menu's Crop.
|
|
1000
|
+
* - {@link preview}: handle and pan drags write the picture LIVE, with no
|
|
1001
|
+
* history, so the normal renderer shows the new `a:srcRect` as it changes.
|
|
1002
|
+
* - {@link commit}: Enter, a click outside, a selection or slide change, or
|
|
1003
|
+
* Crop again. Rewinds the picture to the entry snapshot, records history
|
|
1004
|
+
* there, then re-applies the result: exactly ONE undo step, whose undo
|
|
1005
|
+
* restores the pre-crop picture (none when nothing changed).
|
|
1006
|
+
* - {@link cancel}: Escape writes the snapshot back and leaves no undo step.
|
|
1007
|
+
*/
|
|
1008
|
+
declare class EditorCropController {
|
|
1009
|
+
#private;
|
|
1010
|
+
session: CropSession | null;
|
|
1011
|
+
constructor(editor: EditorState);
|
|
1012
|
+
get active(): boolean;
|
|
1013
|
+
/** The picture being cropped, as it is right now. */
|
|
1014
|
+
get element(): PptxElement | undefined;
|
|
1015
|
+
/** Editable, exactly one element selected, and it is a croppable picture. */
|
|
1016
|
+
get canCrop(): boolean;
|
|
1017
|
+
/** Enter crop mode on the selected picture. False when it cannot be cropped. */
|
|
1018
|
+
enter(): boolean;
|
|
1019
|
+
/** The ribbon Crop toggle: enter, or commit when already cropping. */
|
|
1020
|
+
toggle(): void;
|
|
1021
|
+
/** Apply a live crop update onto the picture without recording history. */
|
|
1022
|
+
preview(update: CropElementUpdate): void;
|
|
1023
|
+
/** End the session, leaving one undo step when the picture changed. */
|
|
1024
|
+
commit(): void;
|
|
1025
|
+
/** End the session and restore the picture as it was on entry, with no undo step. */
|
|
1026
|
+
cancel(): void;
|
|
1027
|
+
/**
|
|
1028
|
+
* Enter commits and Escape cancels while cropping; the key is consumed so
|
|
1029
|
+
* the editor's own Enter/Escape action does not also run. True when handled.
|
|
1030
|
+
*/
|
|
1031
|
+
handleKey(event: KeyboardEvent): boolean;
|
|
1032
|
+
/** Commit when the selection moved off the picture or the slide changed. */
|
|
1033
|
+
syncContext(selectedIds: readonly string[], slideIndex: number): void;
|
|
1034
|
+
/**
|
|
1035
|
+
* A one-click crop (aspect ratio, Fill, Fit) on the selected picture. Inside
|
|
1036
|
+
* a session it joins the session's single undo step; otherwise it is one
|
|
1037
|
+
* undoable update of its own.
|
|
1038
|
+
*/
|
|
1039
|
+
applyOnce(update: CropElementUpdate): void;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
interface EditorSnapshot {
|
|
1043
|
+
slides: PptxSlide[];
|
|
1044
|
+
templateElementsBySlideId: TemplateElementMap;
|
|
1045
|
+
slideMasters: PptxSlideMaster[];
|
|
1046
|
+
notesMaster: PptxNotesMaster | undefined;
|
|
1047
|
+
handoutMaster: PptxHandoutMaster | undefined;
|
|
1048
|
+
sections: PptxSection[];
|
|
1049
|
+
headerFooter: PptxHeaderFooter;
|
|
1050
|
+
presentationProperties: PptxPresentationProperties;
|
|
1051
|
+
customShows: PptxCustomShow[];
|
|
1052
|
+
coreProperties: PptxCoreProperties | undefined;
|
|
1053
|
+
appProperties: PptxAppProperties | undefined;
|
|
1054
|
+
customProperties: PptxCustomProperty[];
|
|
1055
|
+
/** `ppt/tags/*.xml` name/value metadata, editable in the inspector. */
|
|
1056
|
+
tagCollections: PptxTagCollection[];
|
|
1057
|
+
/** The theme's schemes, name and masters' theme parts, so Undo takes a theme change back too. */
|
|
1058
|
+
theme?: HistoryTheme | undefined;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
/**
|
|
1062
|
+
* Deck-level lifecycle for {@link EditorState}: adopting a freshly loaded
|
|
1063
|
+
* document, resetting, taking a remote (collaboration) snapshot, restoring an
|
|
1064
|
+
* undo snapshot, editing document metadata, and serialising back to bytes.
|
|
1065
|
+
*
|
|
1066
|
+
* These are free functions over the state rather than methods because
|
|
1067
|
+
* `EditorState` is already a facade over thirteen focused controllers, and
|
|
1068
|
+
* document lifecycle is simply the fourteenth concern; keeping it here is what
|
|
1069
|
+
* holds that file within the repo's file-size budget.
|
|
1070
|
+
*/
|
|
1071
|
+
/**
|
|
1072
|
+
* Everything a load hands the editor, in the order `PptxHandler` produces it.
|
|
1073
|
+
* Declared once here as a labelled tuple so `EditorState.setSlides` can forward
|
|
1074
|
+
* it verbatim without restating eleven parameters (and their defaults).
|
|
1075
|
+
*/
|
|
1076
|
+
type LoadDocumentArgs = [
|
|
1077
|
+
slides: PptxSlide[],
|
|
1078
|
+
slideMasters?: PptxSlideMaster[],
|
|
1079
|
+
notesMaster?: PptxNotesMaster,
|
|
1080
|
+
handoutMaster?: PptxHandoutMaster,
|
|
1081
|
+
sections?: PptxSection[],
|
|
1082
|
+
coreProperties?: PptxCoreProperties,
|
|
1083
|
+
appProperties?: PptxAppProperties,
|
|
1084
|
+
customProperties?: PptxCustomProperty[],
|
|
1085
|
+
headerFooter?: PptxHeaderFooter,
|
|
1086
|
+
presentationProperties?: PptxPresentationProperties,
|
|
1087
|
+
customShows?: PptxCustomShow[]
|
|
1088
|
+
];
|
|
1089
|
+
|
|
1090
|
+
/**
|
|
1091
|
+
* Z-order (paint-order) reordering for the Svelte editor.
|
|
1092
|
+
*
|
|
1093
|
+
* The array-level primitives (`bringToFront`, `sendToBack`, `bringForward`,
|
|
1094
|
+
* `sendBackward`) are the shared, framework-agnostic operations from
|
|
1095
|
+
* `pptx-viewer-shared` (`render/element-operations`), where array index 0 is
|
|
1096
|
+
* the back and the last index is the front. This module only lifts them to the
|
|
1097
|
+
* slide-array shape the editor state stores, reusing the shared
|
|
1098
|
+
* `reorderElementOnSlide` helper as the other mutations do.
|
|
1099
|
+
*/
|
|
1100
|
+
/** Which way to move the selected element through the paint-order stack. */
|
|
1101
|
+
type ZOrderDirection = 'front' | 'back' | 'forward' | 'backward';
|
|
1102
|
+
|
|
1103
|
+
/** History-integrated element and notes mutations for {@link EditorState}. */
|
|
1104
|
+
declare class EditorElementController {
|
|
1105
|
+
#private;
|
|
1106
|
+
constructor(editor: EditorState);
|
|
1107
|
+
resetNudge(): void;
|
|
1108
|
+
patchGeometry(id: string, box: ElementBoxPatch): void;
|
|
1109
|
+
/**
|
|
1110
|
+
* Merge `patch` into `id` WITHOUT history, the dirty flag or a change event:
|
|
1111
|
+
* a live frame its caller commits later as one undo step (a gesture frame, or
|
|
1112
|
+
* a shade of a colour picker drag, which shared `createLiveColorInput` puts
|
|
1113
|
+
* back before its one committed edit).
|
|
1114
|
+
*/
|
|
1115
|
+
previewElement(id: string, patch: Partial<PptxElement>): void;
|
|
1116
|
+
deleteSelected(): void;
|
|
1117
|
+
duplicateSelected(): string | null;
|
|
1118
|
+
applyElementPatch(id: string, patch: Partial<PptxElement>): void;
|
|
1119
|
+
patchSelected(build: Partial<PptxElement> | ((element: PptxElement, snapshot?: ooxml_ui_pptx.InlineTextEditSnapshot) => Partial<PptxElement>)): void;
|
|
1120
|
+
insertElement(element: PptxElement): string | null;
|
|
1121
|
+
reorderSelected(direction: ZOrderDirection): void;
|
|
1122
|
+
nudgeSelected(dx: number, dy: number): void;
|
|
1123
|
+
commitInlineText(id: string, rawText: string, snapshot?: ooxml_ui_pptx.InlineTextEditSnapshot): void;
|
|
1124
|
+
commitNotes(notes: string, notesSegments?: TextSegment[]): void;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
/** Existing-equation edit state with history-integrated OMML replacement. */
|
|
1128
|
+
declare class EditorEquationController {
|
|
1129
|
+
private readonly editor;
|
|
1130
|
+
editingId: string | null;
|
|
1131
|
+
constructor(editor: EditorState);
|
|
1132
|
+
open(id: string): boolean;
|
|
1133
|
+
get omml(): Record<string, unknown> | null;
|
|
1134
|
+
apply(omml: Record<string, unknown>): void;
|
|
1135
|
+
close(): void;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
/** One-shot Format Painter state and history-integrated application. */
|
|
1139
|
+
declare class EditorFormatPainterController {
|
|
1140
|
+
#private;
|
|
1141
|
+
private readonly editor;
|
|
1142
|
+
constructor(editor: EditorState);
|
|
1143
|
+
get active(): boolean;
|
|
1144
|
+
get enabled(): boolean;
|
|
1145
|
+
toggle(): void;
|
|
1146
|
+
applyTo(id: string): boolean;
|
|
1147
|
+
cancel(): void;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
* The editor's undo/redo stack: the shared history controller (one stack, one
|
|
1152
|
+
* default depth for every binding), read through the Svelte controller adapter
|
|
1153
|
+
* so `canUndo` / `canRedo` and the labels are reactive without any manual
|
|
1154
|
+
* re-sync after a mutation.
|
|
1155
|
+
*/
|
|
1156
|
+
declare class EditorHistoryState {
|
|
1157
|
+
#private;
|
|
1158
|
+
readonly controller: EditorHistoryController<EditorSnapshot>;
|
|
1159
|
+
get canUndo(): boolean;
|
|
1160
|
+
get canRedo(): boolean;
|
|
1161
|
+
/** Description of the action Undo would revert, when one was recorded. */
|
|
1162
|
+
get undoLabel(): string | undefined;
|
|
1163
|
+
/** Description of the action Redo would re-apply, when one was recorded. */
|
|
1164
|
+
get redoLabel(): string | undefined;
|
|
1165
|
+
/** Kept for callers; the controller adapter keeps the flags current on its own. */
|
|
1166
|
+
sync(): void;
|
|
1167
|
+
/**
|
|
1168
|
+
* Apply the File > Options "maximum number of undos" value. The oldest
|
|
1169
|
+
* entries beyond the new maximum are dropped; the rest stay undoable.
|
|
1170
|
+
*/
|
|
1171
|
+
setDepth(depth: number): void;
|
|
1172
|
+
record(snapshot: EditorSnapshot, label?: string): void;
|
|
1173
|
+
clear(): void;
|
|
1174
|
+
/**
|
|
1175
|
+
* Drop the undo and redo steps that would bring back a state `reaches` matches, with the steps
|
|
1176
|
+
* behind them: a Slide Master view command removed a layout the package cannot get back.
|
|
1177
|
+
*/
|
|
1178
|
+
forget(reaches: (snapshot: EditorSnapshot) => boolean): void;
|
|
1179
|
+
undo(current: EditorSnapshot): EditorSnapshot | undefined;
|
|
1180
|
+
redo(current: EditorSnapshot): EditorSnapshot | undefined;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
/**
|
|
1184
|
+
* The ribbon Draw tab's active tool. `'select'` means "not drawing": the
|
|
1185
|
+
* stage's normal selection/drag/resize gestures own the pointer, matching
|
|
1186
|
+
* React's `DrawingTool` / Angular's `DrawTool`.
|
|
1187
|
+
*
|
|
1188
|
+
* `freeform` shares the pen's gesture but commits a custom-geometry SHAPE
|
|
1189
|
+
* rather than an ink stroke (closed only when the stroke ends back on its
|
|
1190
|
+
* start point), so the result is editable/fillable like any other shape; see
|
|
1191
|
+
* `editor-freeform.ts`.
|
|
1192
|
+
*/
|
|
1193
|
+
type InkDrawTool = 'select' | 'pen' | 'highlighter' | 'eraser' | 'freeform';
|
|
1194
|
+
/**
|
|
1195
|
+
* EditorInkController: the ribbon Draw tab's tool/colour/width state plus the
|
|
1196
|
+
* pure element-factory / erase mutations, split out of `EditorState` to keep
|
|
1197
|
+
* it under the repo's 300-LOC budget (mirrors `EditorArrangeController` /
|
|
1198
|
+
* `EditorBackgroundController`). Instantiated as `EditorState.inkOps`.
|
|
1199
|
+
*
|
|
1200
|
+
* The actual pointer-event lifecycle (accumulating a stroke's points, driving
|
|
1201
|
+
* the live preview) lives in `editor-ink-gesture.ts`, owned by
|
|
1202
|
+
* `EditorController`; this class only holds the tool/colour/width state the
|
|
1203
|
+
* gesture controller reads and the two mutations it calls into
|
|
1204
|
+
* ({@link commitStroke}, {@link eraseElementAt}), both of which route through
|
|
1205
|
+
* `EditorState` so they participate in undo/redo like every other edit.
|
|
1206
|
+
*/
|
|
1207
|
+
declare class EditorInkController {
|
|
1208
|
+
#private;
|
|
1209
|
+
/** The active draw tool. `'select'` hands the stage back to normal editing gestures. */
|
|
1210
|
+
tool: InkDrawTool;
|
|
1211
|
+
/** Stroke colour for new pen/highlighter strokes. */
|
|
1212
|
+
color: string;
|
|
1213
|
+
/** Stroke width (px, element space) for new pen/highlighter strokes. */
|
|
1214
|
+
width: number;
|
|
1215
|
+
/** SVG path `d` for the in-progress stroke's live preview, or `''` when idle. */
|
|
1216
|
+
livePathD: string;
|
|
1217
|
+
/**
|
|
1218
|
+
* The in-progress stroke's render view (plain path, pressure circles, or
|
|
1219
|
+
* tilt nib marks), from the shared `buildLiveInkStrokeView`: the same
|
|
1220
|
+
* decision `InkView.svelte` makes for a committed stroke (via
|
|
1221
|
+
* `buildInkStrokes`), fed the SAME accumulated points {@link commitStroke}
|
|
1222
|
+
* hands to `strokeToInkElement`. `null` while idle.
|
|
1223
|
+
*/
|
|
1224
|
+
liveStrokeView: InkStrokeView | null;
|
|
1225
|
+
constructor(editor: EditorState);
|
|
1226
|
+
/** True whenever a tool other than `select` is active: the stage hands pointer gestures to ink drawing. */
|
|
1227
|
+
get isDrawing(): boolean;
|
|
1228
|
+
/**
|
|
1229
|
+
* Switch the active tool. Clears the current selection when entering a draw
|
|
1230
|
+
* tool so the selection overlay's resize/rotate handles (which own their
|
|
1231
|
+
* own `pointerdown` and would otherwise race a drawing gesture over the
|
|
1232
|
+
* same screen area) are not rendered while drawing.
|
|
1233
|
+
*/
|
|
1234
|
+
setTool(tool: InkDrawTool): void;
|
|
1235
|
+
setColor(color: string): void;
|
|
1236
|
+
setWidth(width: number): void;
|
|
1237
|
+
/**
|
|
1238
|
+
* Update the live preview while a pen/highlighter/freeform stroke is in
|
|
1239
|
+
* progress: both the plain `livePathD` (kept for existing consumers) and
|
|
1240
|
+
* `liveStrokeView`, the same plain-path/pressure-circle/tilt-nib decision
|
|
1241
|
+
* a committed stroke gets from `buildInkStrokes`, built from the identical
|
|
1242
|
+
* accumulated points.
|
|
1243
|
+
*/
|
|
1244
|
+
previewStroke(points: readonly InkPoint[]): void;
|
|
1245
|
+
/**
|
|
1246
|
+
* Finalise the in-progress stroke (undoable via `EditorState.insertElement`),
|
|
1247
|
+
* or discard it silently when too short (a plain tap) or the tool changed
|
|
1248
|
+
* mid-gesture. Pen/highlighter commit an `ink` element; freeform commits a
|
|
1249
|
+
* custom-geometry `shape` (closed only when the stroke returns to its start).
|
|
1250
|
+
*/
|
|
1251
|
+
commitStroke(points: readonly InkPoint[]): void;
|
|
1252
|
+
/**
|
|
1253
|
+
* Hit-test `ink`/`contentPart` elements on the current slide at `point`
|
|
1254
|
+
* (topmost first) and delete the first match, with history. `contentPart`
|
|
1255
|
+
* is included because ink saved via the Draw tab reloads in that shape, so
|
|
1256
|
+
* it must stay erasable after a save/reload round-trip. No-op when nothing
|
|
1257
|
+
* is hit.
|
|
1258
|
+
*/
|
|
1259
|
+
eraseElementAt(point: InkPoint): void;
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
interface MasterViewTarget {
|
|
1263
|
+
tab: MasterViewTab;
|
|
1264
|
+
masterIndex: number;
|
|
1265
|
+
layoutIndex: number | null;
|
|
1266
|
+
}
|
|
1267
|
+
/** Routes the active editing layer into a parsed slide master or layout. */
|
|
1268
|
+
declare class EditorMasterController {
|
|
1269
|
+
private readonly editor;
|
|
1270
|
+
constructor(editor: EditorState);
|
|
1271
|
+
enter(masterIndex?: number, layoutIndex?: number | null): void;
|
|
1272
|
+
enterTab(tab: MasterViewTab): void;
|
|
1273
|
+
exit(): void;
|
|
1274
|
+
/** The document shape the shared master-view rules operate on. */
|
|
1275
|
+
private document;
|
|
1276
|
+
activeElements(): PptxElement[] | null;
|
|
1277
|
+
replace(elements: PptxElement[]): boolean;
|
|
1278
|
+
cloneMasters(): PptxSlideMaster[];
|
|
1279
|
+
cloneNotesMaster(): PptxNotesMaster | undefined;
|
|
1280
|
+
cloneHandoutMaster(): PptxHandoutMaster | undefined;
|
|
1281
|
+
setHandoutSlidesPerPage(slidesPerPage: number): void;
|
|
1282
|
+
setBackgroundColor(backgroundColor: string): void;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
interface MasterViewCrudPrompts {
|
|
1286
|
+
/** Ask for the new layout/master name; null/empty cancels the rename. */
|
|
1287
|
+
promptName(currentName: string): string | null;
|
|
1288
|
+
/** Surface a rejection (`notFound` / `inUse` / `lastMaster`) as translated copy. */
|
|
1289
|
+
notify(message: string): void;
|
|
1290
|
+
translate(key: string): string;
|
|
1291
|
+
}
|
|
1292
|
+
/** Drives the sidebar's Insert/Duplicate/Delete/Rename commands on {@link EditorState}. */
|
|
1293
|
+
declare class EditorMasterCrudController {
|
|
1294
|
+
private readonly editor;
|
|
1295
|
+
constructor(editor: EditorState);
|
|
1296
|
+
/** The sidebar's action list (enabled/disabled + reason) for the current target. */
|
|
1297
|
+
actions(): MasterViewCrudAction[];
|
|
1298
|
+
/**
|
|
1299
|
+
* Run one command against the CURRENT master-view target. A no-op outside
|
|
1300
|
+
* master view, on a read-only deck, or when the action is disabled for the
|
|
1301
|
+
* target (mirrors the sidebar's own gating, so a stray call through the
|
|
1302
|
+
* public API cannot bypass it).
|
|
1303
|
+
*/
|
|
1304
|
+
run(id: MasterViewCrudActionId, prompts: MasterViewCrudPrompts): Promise<boolean>;
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
/**
|
|
1308
|
+
* EditorOutlineController: state for the two outline-authoring modes, Edit
|
|
1309
|
+
* Points on one shape and the armed Freeform: Shape / Curve drawing tool
|
|
1310
|
+
* (Svelte counterpart of React's `useEditPointsState` + `useOutlineAuthoring`).
|
|
1311
|
+
* At most one is active: arming a tool ends Edit Points and starting Edit
|
|
1312
|
+
* Points disarms the tool. Every behaviour (hit targets, drags, the vertex /
|
|
1313
|
+
* segment menu, the element patch) lives in the shared sessions; this only
|
|
1314
|
+
* holds which mode is on and routes their results through `EditorState`, so
|
|
1315
|
+
* each commit is one undo step. Instantiated as `EditorState.outlineOps`.
|
|
1316
|
+
*/
|
|
1317
|
+
declare class EditorOutlineController {
|
|
1318
|
+
#private;
|
|
1319
|
+
/** The shape in Edit Points mode, or null. */
|
|
1320
|
+
editPointsId: string | null;
|
|
1321
|
+
/** The armed click-to-place drawing tool, or null. */
|
|
1322
|
+
freeformTool: FreeformToolKind | null;
|
|
1323
|
+
constructor(editor: EditorState);
|
|
1324
|
+
/** The shape being edited, while it still exists on the active layer. */
|
|
1325
|
+
get editPointsElement(): PptxElement | undefined;
|
|
1326
|
+
/** Enter Edit Points on `id` when the shape allows it (not `noEditPoints`). */
|
|
1327
|
+
startEditPoints(id: string): void;
|
|
1328
|
+
exitEditPoints(): void;
|
|
1329
|
+
/** Apply one Edit Points edit as one undo step. */
|
|
1330
|
+
commitEditPoints(id: string, patch: EditPointsElementPatch): void;
|
|
1331
|
+
/** Arm (or, with null, disarm) a drawing tool. */
|
|
1332
|
+
armFreeformTool(tool: FreeformToolKind | null): void;
|
|
1333
|
+
/** Insert a drawn freeform (selected, one undo step) and disarm. */
|
|
1334
|
+
commitFreeform(shape: ShapePptxElement): void;
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
interface PresentationMetadataHost {
|
|
1338
|
+
readonly editable: boolean;
|
|
1339
|
+
pushHistory(): void;
|
|
1340
|
+
commitChange(): void;
|
|
1341
|
+
}
|
|
1342
|
+
/** Owns presentation-level metadata and its undoable editor mutations. */
|
|
1343
|
+
declare class EditorPresentationMetadata {
|
|
1344
|
+
private readonly host;
|
|
1345
|
+
headerFooter: PptxHeaderFooter;
|
|
1346
|
+
presentationProperties: PptxPresentationProperties;
|
|
1347
|
+
customShows: PptxCustomShow[];
|
|
1348
|
+
constructor(host: PresentationMetadataHost);
|
|
1349
|
+
/**
|
|
1350
|
+
* Deep-copy a value that may be a rune PROXY.
|
|
1351
|
+
*
|
|
1352
|
+
* The dialogs build their edits in `$state`, so what reaches these setters is
|
|
1353
|
+
* a reactive proxy, and `structuredClone` throws `DataCloneError` on one. The
|
|
1354
|
+
* Header & Footer panel hit exactly that: "Apply to All" threw before it ever
|
|
1355
|
+
* assigned, so setting a footer silently did nothing and the canvas kept the
|
|
1356
|
+
* string the deck was loaded with. `$state.snapshot` is a pass-through for a
|
|
1357
|
+
* plain object, so this is safe for every caller.
|
|
1358
|
+
*/
|
|
1359
|
+
private static clone;
|
|
1360
|
+
set(headerFooter?: PptxHeaderFooter, presentationProperties?: PptxPresentationProperties, customShows?: PptxCustomShow[]): void;
|
|
1361
|
+
updatePresentationProperties(next: PptxPresentationProperties): void;
|
|
1362
|
+
/**
|
|
1363
|
+
* Fold a picker's recent-colours list into `presentationProperties.mruColors`
|
|
1364
|
+
* WITHOUT pushing undo history (wave-4 B6): PowerPoint's colour-picker MRU
|
|
1365
|
+
* is not an undoable edit, mirroring how `editor.viewProperties` writes back
|
|
1366
|
+
* the View > Grid/Guides/Snap toggles outside `pushHistory`/`commitChange`.
|
|
1367
|
+
*/
|
|
1368
|
+
setMruColorsSilently(mruColors: readonly string[]): void;
|
|
1369
|
+
updateHeaderFooter(next: PptxHeaderFooter): void;
|
|
1370
|
+
updateCustomShows(next: PptxCustomShow[]): void;
|
|
1371
|
+
private commit;
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
/** History-aware section CRUD and grouping for the Svelte editor. */
|
|
1375
|
+
declare class EditorSectionController {
|
|
1376
|
+
private readonly editor;
|
|
1377
|
+
constructor(editor: EditorState);
|
|
1378
|
+
get groups(): ooxml_ui_pptx.SectionSlideGroup<PptxSection>[];
|
|
1379
|
+
add(name: string, afterSlideIndex?: number): string | null;
|
|
1380
|
+
rename(sectionId: string, name: string): void;
|
|
1381
|
+
delete(sectionId: string): void;
|
|
1382
|
+
moveUp(sectionId: string): void;
|
|
1383
|
+
moveDown(sectionId: string): void;
|
|
1384
|
+
moveSlides(slideIndexes: number[], targetSectionId: string): void;
|
|
1385
|
+
toggle(sectionId: string): void;
|
|
1386
|
+
private commit;
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
declare class EditorSelection {
|
|
1390
|
+
#private;
|
|
1391
|
+
/** All selected ids in selection order (primary last). */
|
|
1392
|
+
get ids(): readonly string[];
|
|
1393
|
+
/** The primary selected id (last selected), or null when empty. */
|
|
1394
|
+
get primary(): string | null;
|
|
1395
|
+
/** Number of selected elements. */
|
|
1396
|
+
get size(): number;
|
|
1397
|
+
/** True when `id` is part of the selection. */
|
|
1398
|
+
has(id: string): boolean;
|
|
1399
|
+
/** Replace the selection with a single id (or clear it with `null`). */
|
|
1400
|
+
set(id: string | null): void;
|
|
1401
|
+
/** Replace the selection with an explicit id list (primary = last). */
|
|
1402
|
+
setAll(ids: readonly string[]): void;
|
|
1403
|
+
/** Additive (shift/ctrl-click) toggle: add `id`, or remove it when present. */
|
|
1404
|
+
toggle(id: string): void;
|
|
1405
|
+
/** Clear the selection. */
|
|
1406
|
+
clear(): void;
|
|
1407
|
+
/** Drop ids that no longer resolve to an element (after remote/undo edits). */
|
|
1408
|
+
prune(exists: (id: string) => boolean): void;
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
/**
|
|
1412
|
+
* The Home tab's Slides group (new / duplicate / delete slide), split out of
|
|
1413
|
+
* `EditorState` to keep it under the repo's 300-LOC budget. Every method
|
|
1414
|
+
* returns the new active slide index (or `null` on a no-op) so the caller
|
|
1415
|
+
* (the Slides group, via the host's slide-navigation callback) can move the
|
|
1416
|
+
* viewer to it; `EditorState` itself has no concept of "the active slide"
|
|
1417
|
+
* beyond the `getCurrent` dependency it already reads for element ops.
|
|
1418
|
+
*/
|
|
1419
|
+
declare class EditorSlidesController {
|
|
1420
|
+
#private;
|
|
1421
|
+
constructor(editor: EditorState);
|
|
1422
|
+
/** Insert a blank slide after the current one. Returns its new index, or null when not editable. */
|
|
1423
|
+
insertSlideAfterCurrent(): number | null;
|
|
1424
|
+
/**
|
|
1425
|
+
* Insert a blank slide after `index` (the thumbnail context menu's New
|
|
1426
|
+
* Slide, and Enter on a focused thumbnail, both of which may target a slide
|
|
1427
|
+
* other than the currently active one). Returns the new index, or null
|
|
1428
|
+
* when not editable.
|
|
1429
|
+
*/
|
|
1430
|
+
insertSlideAfter(index: number): number | null;
|
|
1431
|
+
/**
|
|
1432
|
+
* Insert a shared-catalogue template slide after the current one, as one
|
|
1433
|
+
* undoable step (Home > Slide Templates gallery). The caller (the gallery
|
|
1434
|
+
* launcher, which can read the render context) passes the deck's scheme and
|
|
1435
|
+
* canvas size in `options` so the slide inherits the theme; without them
|
|
1436
|
+
* the shared builder falls back to the Office default scheme at 1280x720.
|
|
1437
|
+
* Returns the new index, or null when not editable.
|
|
1438
|
+
*/
|
|
1439
|
+
insertSlideFromTemplate(templateId: SlideTemplateId, options?: SlideTemplateBuildOptions): number | null;
|
|
1440
|
+
/** Duplicate the current slide. Returns its new index, or null when not editable. */
|
|
1441
|
+
duplicateCurrentSlide(): number | null;
|
|
1442
|
+
/** Delete the current slide. Returns the new active index, or null (not editable / only slide). */
|
|
1443
|
+
deleteCurrentSlide(): number | null;
|
|
1444
|
+
/**
|
|
1445
|
+
* Duplicate the slide at an arbitrary index (the sorter's context-menu
|
|
1446
|
+
* target, which need not be the active slide). Returns the index the
|
|
1447
|
+
* caller should navigate to so the active slide stays the same logical
|
|
1448
|
+
* slide the user was looking at, or null when not editable.
|
|
1449
|
+
*/
|
|
1450
|
+
duplicateSlideAtIndex(index: number): number | null;
|
|
1451
|
+
pasteSlides(request: SlidePasteRequest): number | null;
|
|
1452
|
+
/**
|
|
1453
|
+
* Delete the slide at an arbitrary index (the sorter's context-menu
|
|
1454
|
+
* target). Returns the index the caller should navigate to, or null (not
|
|
1455
|
+
* editable / only slide).
|
|
1456
|
+
*/
|
|
1457
|
+
deleteSlideAtIndex(index: number): number | null;
|
|
1458
|
+
/** Toggle the hidden flag on the slide at `index` (the sorter's context-menu target). */
|
|
1459
|
+
toggleSlideHidden(index: number): void;
|
|
1460
|
+
/** Duplicate every selected slide (the thumbnail context menu's multi-select bulk Duplicate). */
|
|
1461
|
+
duplicateSlides(indexes: readonly number[]): void;
|
|
1462
|
+
/** Delete every selected slide (the thumbnail context menu's multi-select bulk Delete). */
|
|
1463
|
+
deleteSlides(indexes: readonly number[]): void;
|
|
1464
|
+
/** Toggle hidden on every selected slide (the thumbnail context menu's multi-select bulk Hide/Show). */
|
|
1465
|
+
toggleSlidesHidden(indexes: readonly number[]): void;
|
|
1466
|
+
/**
|
|
1467
|
+
* The layouts available for the current slide (its master's layouts),
|
|
1468
|
+
* resolved via the core `getAvailableLayoutsForSlide` API. Empty when no
|
|
1469
|
+
* deck is loaded. Backs the Home tab's Layout dropdown (React parity).
|
|
1470
|
+
*/
|
|
1471
|
+
availableLayouts(): Promise<PptxLayoutOption[]>;
|
|
1472
|
+
/**
|
|
1473
|
+
* Artwork thumbnails for the New Slide / Layout galleries, keyed by path.
|
|
1474
|
+
*
|
|
1475
|
+
* A method rather than state: parsing every layout part is only worth doing
|
|
1476
|
+
* once a gallery is opened, and core memoises the result.
|
|
1477
|
+
*/
|
|
1478
|
+
layoutPreviews(): Promise<ReadonlyMap<string, PptxLayoutPreview>>;
|
|
1479
|
+
/**
|
|
1480
|
+
* Insert a blank slide after the current one that already points at
|
|
1481
|
+
* `layoutPath` (Home > New Slide's layout gallery), then let the handler
|
|
1482
|
+
* populate its placeholders. Returns the new index, or null when not editable.
|
|
1483
|
+
*/
|
|
1484
|
+
insertSlideFromLayout(layoutPath: string, layoutName?: string): number | null;
|
|
1485
|
+
/** Re-map the current slide onto `layoutPath`. Returns its index, or null when not editable. */
|
|
1486
|
+
applyLayout(layoutPath: string): Promise<number | null>;
|
|
1487
|
+
/**
|
|
1488
|
+
* Reset the current slide by re-applying its own layout, restoring inherited
|
|
1489
|
+
* placeholder geometry/formatting (React's Home > Reset). Returns the slide
|
|
1490
|
+
* index, or null when the slide has no known layout path.
|
|
1491
|
+
*/
|
|
1492
|
+
resetSlide(): Promise<number | null>;
|
|
1493
|
+
/** Move an arbitrary thumbnail slide. Returns the selected target index on success. */
|
|
1494
|
+
moveSlide(fromIndex: number, toIndex: number): number | null;
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
/** Active-layer routing for normal slide content versus inherited template elements. */
|
|
1498
|
+
declare class EditorTemplateController {
|
|
1499
|
+
#private;
|
|
1500
|
+
constructor(editor: EditorState);
|
|
1501
|
+
activeElements(): PptxElement[];
|
|
1502
|
+
/**
|
|
1503
|
+
* The element list that OWNS `elementId`. Slide elements stay interactive
|
|
1504
|
+
* while edit-template mode is on, so a mode-routed lookup handed a slide
|
|
1505
|
+
* element's z-order op the template store, where it does not exist.
|
|
1506
|
+
*/
|
|
1507
|
+
elementsOwning(elementId: string): PptxElement[];
|
|
1508
|
+
/** Replace the element list that owns `elementId` (see {@link elementsOwning}). */
|
|
1509
|
+
replaceOwning(elementId: string, elements: PptxElement[]): void;
|
|
1510
|
+
renderedSlides(): PptxSlide[];
|
|
1511
|
+
replace(elements: PptxElement[]): void;
|
|
1512
|
+
commit(elements: PptxElement[]): void;
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
/**
|
|
1516
|
+
* Slide-transition actions for the ribbon's Transitions tab, split out of
|
|
1517
|
+
* `EditorState` to keep it under the repo's 300-LOC budget. Playback already
|
|
1518
|
+
* reads `PptxSlide.transition` (see `presentation/presentation-controller.svelte.ts`),
|
|
1519
|
+
* so this only needs to write that same field, routed through
|
|
1520
|
+
* `EditorState.commitSlides` so it is history-integrated (undoable).
|
|
1521
|
+
*
|
|
1522
|
+
* `applyTransition` covers both the preset gallery buttons and the duration
|
|
1523
|
+
* input (the tab re-applies the currently-selected preset whenever the
|
|
1524
|
+
* duration changes), plus the "Apply to All Slides" checkbox: when
|
|
1525
|
+
* `applyToAll` is true every slide gets the same fresh `{ type, durationMs }`
|
|
1526
|
+
* transition; otherwise only the current slide is patched, preserving any
|
|
1527
|
+
* advanced fields (direction, sound, ...) it already carried.
|
|
1528
|
+
*/
|
|
1529
|
+
declare class EditorTransitionController {
|
|
1530
|
+
#private;
|
|
1531
|
+
constructor(editor: EditorState);
|
|
1532
|
+
applyTransition(type: PptxTransitionType, durationMs: number, applyToAll: boolean): void;
|
|
1533
|
+
/**
|
|
1534
|
+
* Commit the Transitions tab's whole draft (preset + duration + the Advance
|
|
1535
|
+
* Slide modifiers) in one undoable step.
|
|
1536
|
+
*
|
|
1537
|
+
* The draft, and what it means for a slide's `p:transition`, is decided in
|
|
1538
|
+
* `pptx-viewer-shared` (`ribbon-transitions`) so every binding writes the
|
|
1539
|
+
* same fields; this only routes the result through `commitSlides`. Unlike
|
|
1540
|
+
* `applyTransition`'s apply-to-all, the draft is MERGED onto each target so a
|
|
1541
|
+
* slide keeps its authored direction / spokes / sound.
|
|
1542
|
+
*/
|
|
1543
|
+
applyRibbonDraft(draft: RibbonTransitionDraft, applyToAll: boolean): void;
|
|
1544
|
+
/**
|
|
1545
|
+
* Merge a raw partial change onto the ACTIVE slide's transition, for
|
|
1546
|
+
* controls that write a single field outside the ribbon draft (currently
|
|
1547
|
+
* the Sound picker: a freshly-picked file's `soundData` has no equivalent
|
|
1548
|
+
* in {@link RibbonTransitionDraft}).
|
|
1549
|
+
*/
|
|
1550
|
+
applyChange(changes: Partial<PptxSlideTransition>): void;
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
/**
|
|
1554
|
+
* The block of table cells the user has marquee'd on the canvas.
|
|
1555
|
+
*
|
|
1556
|
+
* Svelte shipped without this model at all: `context-menu-dispatch` hard-coded
|
|
1557
|
+
* `hasMultiCellSelection: false`, so PowerPoint's "Merge Cells" could never be
|
|
1558
|
+
* offered and a user could only ever merge one cell rightwards or downwards.
|
|
1559
|
+
*
|
|
1560
|
+
* None of the rectangle math lives here. `computeSelectionRect` in
|
|
1561
|
+
* `pptx-viewer-shared` owns it, and it is merge-AWARE: dragging across a cell
|
|
1562
|
+
* that already spans expands the rectangle to cover the whole span, so the
|
|
1563
|
+
* highlighted block is always a real rectangle in model coordinates. (The
|
|
1564
|
+
* vanilla binding carries a private `rectangle()` helper that ignores spans;
|
|
1565
|
+
* that is a bug, not a second model, and is deliberately not copied.)
|
|
1566
|
+
*
|
|
1567
|
+
* @module editor/table-cell-selection
|
|
1568
|
+
*/
|
|
1569
|
+
/** A click on a `<td>`, in model (unmerged) coordinates. */
|
|
1570
|
+
interface TableCellPoint {
|
|
1571
|
+
rowIndex: number;
|
|
1572
|
+
columnIndex: number;
|
|
1573
|
+
}
|
|
1574
|
+
declare class TableCellSelection {
|
|
1575
|
+
/** The table element the range belongs to, or null when there is none. */
|
|
1576
|
+
elementId: string | null;
|
|
1577
|
+
/** Where the range started (the un-shifted click). */
|
|
1578
|
+
anchor: CellCoord | null;
|
|
1579
|
+
/** The current rectangle, already expanded over any merged cells it meets. */
|
|
1580
|
+
rect: CellRect | null;
|
|
1581
|
+
/** Every cell in the current range, row-major. Empty when there is none. */
|
|
1582
|
+
get cells(): CellCoord[];
|
|
1583
|
+
/** True once the range covers a block, i.e. once merging becomes possible. */
|
|
1584
|
+
get hasBlock(): boolean;
|
|
1585
|
+
/** The range on `elementId`, or an empty array when it belongs elsewhere. */
|
|
1586
|
+
cellsFor(elementId: string | null | undefined): CellCoord[];
|
|
1587
|
+
/** Is this cell of this element inside the highlighted block? */
|
|
1588
|
+
contains(elementId: string, row: number, col: number): boolean;
|
|
1589
|
+
/** A plain click: the range collapses to the clicked cell, which anchors it. */
|
|
1590
|
+
begin(elementId: string, cell: TableCellPoint, tableData: PptxTableData): void;
|
|
1591
|
+
/**
|
|
1592
|
+
* A Shift-click: stretch anchor -> cell into a rectangle. Falls back to
|
|
1593
|
+
* anchoring when there is no anchor yet (or it belongs to another table), so
|
|
1594
|
+
* a Shift-click is never a no-op.
|
|
1595
|
+
*/
|
|
1596
|
+
extend(elementId: string, cell: TableCellPoint, tableData: PptxTableData): void;
|
|
1597
|
+
clear(): void;
|
|
1598
|
+
/** Drop the range when the element selection has moved off its table. */
|
|
1599
|
+
syncElement(selectedElementId: string | null): void;
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
interface EditorStateDeps {
|
|
1603
|
+
getCurrent(): number;
|
|
1604
|
+
getHandler(): PptxHandler | null;
|
|
1605
|
+
/**
|
|
1606
|
+
* The `p:sldSz` a save should write, resolved from the viewer's EMU slide
|
|
1607
|
+
* size and its pixel canvas by the shared `resolveSlideSizeSelection`.
|
|
1608
|
+
* Optional so out-of-tree mounts (and the unit tests) can omit it, in which
|
|
1609
|
+
* case core re-emits the load-time dimensions verbatim.
|
|
1610
|
+
*/
|
|
1611
|
+
getSlideSize?: () => PptxSlideSize | undefined;
|
|
1612
|
+
/**
|
|
1613
|
+
* The slide canvas in px, the bounds a lone element aligns against
|
|
1614
|
+
* (PowerPoint's "Align to Slide"). Optional for out-of-tree mounts and the
|
|
1615
|
+
* unit tests, where a single-element align is then a no-op.
|
|
1616
|
+
*/
|
|
1617
|
+
getCanvasSize?: () => {
|
|
1618
|
+
width: number;
|
|
1619
|
+
height: number;
|
|
1620
|
+
} | undefined;
|
|
1621
|
+
/** Host `authorName` prop: the comment/reply author that wins over Options > General. */
|
|
1622
|
+
getAuthorName?: () => string | undefined;
|
|
1623
|
+
/**
|
|
1624
|
+
* The `tableStyles`/`tableStylesDefaultId`/`tableStylesToDelete` save
|
|
1625
|
+
* options (see `pptx-viewer-shared`'s `tableStyleSaveOptions`). Table style
|
|
1626
|
+
* DEFINITION edits live on the loader (like slide size), not the undo
|
|
1627
|
+
* stack, so they reach the save through this dep the same way. Optional
|
|
1628
|
+
* for out-of-tree mounts and the unit tests.
|
|
1629
|
+
*/
|
|
1630
|
+
getTableStyleOptions?: () => TableStyleSaveOptions;
|
|
1631
|
+
/**
|
|
1632
|
+
* Adopt a fresh handler in place of the loaded one. Master-view CRUD
|
|
1633
|
+
* (`masterCrud`) rebuilds the package through core and comes back with a
|
|
1634
|
+
* new `PptxHandler`; the loader owns handler lifecycle, so it disposes the
|
|
1635
|
+
* previous one here unless `keepPrevious` (a master command and a slide
|
|
1636
|
+
* paste keep it, since the slides on screen still show its pictures).
|
|
1637
|
+
* Optional for out-of-tree mounts and the unit tests.
|
|
1638
|
+
*/
|
|
1639
|
+
setHandler?: (handler: PptxHandler, keepPrevious?: boolean, data?: PptxData) => void;
|
|
1640
|
+
onChange?: () => void;
|
|
1641
|
+
/**
|
|
1642
|
+
* The loaded deck's theme parts; an undo back to the loaded theme restores
|
|
1643
|
+
* the primary part's name. Optional for out-of-tree mounts and the unit tests.
|
|
1644
|
+
*/
|
|
1645
|
+
getThemeOptions?: () => readonly PptxThemeOption[];
|
|
1646
|
+
/**
|
|
1647
|
+
* An undo or redo put a recorded theme back in {@link EditorState.theme};
|
|
1648
|
+
* the viewer publishes it as it does a gallery pick's theme.
|
|
1649
|
+
*/
|
|
1650
|
+
onThemeRestored?: (theme: PptxTheme) => void;
|
|
1651
|
+
/** The host's `onpropertieschange`: the core fields a user edit changed. */
|
|
1652
|
+
onCorePropertiesChange?: (updates: Partial<PptxCoreProperties>) => void;
|
|
1653
|
+
}
|
|
1654
|
+
declare class EditorState {
|
|
1655
|
+
#private;
|
|
1656
|
+
/** Mounted UI reader only; not persisted or included in editor history. */
|
|
1657
|
+
readPendingInlineTextEdit?: () => PendingInlineTextEdit | undefined;
|
|
1658
|
+
inlineListController?: InlineListController;
|
|
1659
|
+
cancelInlineListEdit?: () => void;
|
|
1660
|
+
/**
|
|
1661
|
+
* Options > Proofing > AutoCorrect, applied to committed inline-edit text.
|
|
1662
|
+
* Identity until `useViewerOptionsWiring` installs the real transform (the
|
|
1663
|
+
* options store is constructed after `EditorState`).
|
|
1664
|
+
*/
|
|
1665
|
+
transformCommittedText: (text: string, previous?: string) => string;
|
|
1666
|
+
slides: PptxSlide[];
|
|
1667
|
+
templateElementsBySlideId: TemplateElementMap;
|
|
1668
|
+
slideMasters: PptxSlideMaster[];
|
|
1669
|
+
notesMaster: PptxNotesMaster | undefined;
|
|
1670
|
+
handoutMaster: PptxHandoutMaster | undefined;
|
|
1671
|
+
sections: PptxSection[];
|
|
1672
|
+
readonly presentationMetadata: EditorPresentationMetadata;
|
|
1673
|
+
coreProperties: PptxCoreProperties | undefined;
|
|
1674
|
+
appProperties: PptxAppProperties | undefined;
|
|
1675
|
+
customProperties: PptxCustomProperty[];
|
|
1676
|
+
/**
|
|
1677
|
+
* The deck's `ppt/tags/*.xml` name/value metadata. Seeded from the load via
|
|
1678
|
+
* {@link adoptTagCollections} and edited by the inspector's Tags section;
|
|
1679
|
+
* carried through the undo snapshot and re-emitted on save.
|
|
1680
|
+
*/
|
|
1681
|
+
tagCollections: PptxTagCollection[];
|
|
1682
|
+
/**
|
|
1683
|
+
* The deck's active theme, kept here so the Home tab's font dropdown can
|
|
1684
|
+
* lead with the theme fonts and the Design galleries mark the applied one.
|
|
1685
|
+
* Set by the viewer once a deck is loaded. Its colour scheme, font scheme
|
|
1686
|
+
* and name are recorded in every {@link EditorSnapshot}, so Undo takes a
|
|
1687
|
+
* theme pick back with the slides.
|
|
1688
|
+
*/
|
|
1689
|
+
theme: PptxTheme | undefined;
|
|
1690
|
+
/**
|
|
1691
|
+
* True while a Design gallery hover preview shows over the slides. Autosave and collaboration
|
|
1692
|
+
* read {@link committedRenderedSlides} instead of the live slides for that time.
|
|
1693
|
+
*/
|
|
1694
|
+
deckStyleHeld: boolean;
|
|
1695
|
+
/** `renderedSlides` as they were when the preview began (see {@link deckStyleHeld}). */
|
|
1696
|
+
heldRenderedSlides: PptxSlide[] | null;
|
|
1697
|
+
/**
|
|
1698
|
+
* `ppt/viewProps.xml`, seeded from the load and kept in sync with the View >
|
|
1699
|
+
* Grid/Guides/Snap toggles (wave 4 #5: `viewPropertiesPatchFromPreferences`
|
|
1700
|
+
* writes the toggle state back in here). Deliberately outside
|
|
1701
|
+
* {@link EditorSnapshot}, like {@link theme}: PowerPoint does not undo a view
|
|
1702
|
+
* toggle, so this is session state that `saveEditorDocument` reads directly,
|
|
1703
|
+
* never something `pushHistory`/`commitChange` touches.
|
|
1704
|
+
*/
|
|
1705
|
+
viewProperties: PptxViewProperties | undefined;
|
|
1706
|
+
/**
|
|
1707
|
+
* Modern comment authors (`ppt/authors.xml`, Office 2021 `p188:author`),
|
|
1708
|
+
* seeded from the load. Read-only round-trip metadata, like {@link theme}:
|
|
1709
|
+
* the comment panel's @-mention typeahead (wave-4 B5) reads this to match
|
|
1710
|
+
* against, never something a binding edits or that undo restores.
|
|
1711
|
+
*/
|
|
1712
|
+
modernCommentAuthors: PptxModernCommentAuthor[];
|
|
1713
|
+
/**
|
|
1714
|
+
* Legacy comment authors (`ppt/commentAuthors.xml`), offered to the
|
|
1715
|
+
* @-mention typeahead alongside {@link modernCommentAuthors}. Same
|
|
1716
|
+
* read-only, non-undo lifecycle.
|
|
1717
|
+
*/
|
|
1718
|
+
commentAuthors: PptxCommentAuthor[];
|
|
1719
|
+
/**
|
|
1720
|
+
* Families the deck embeds, offered as their own font-dropdown group. Write
|
|
1721
|
+
* through {@link adoptEmbeddedFontFamilies} so {@link embedFonts} is reseeded
|
|
1722
|
+
* with them.
|
|
1723
|
+
*/
|
|
1724
|
+
embeddedFontFamilies: readonly string[];
|
|
1725
|
+
/**
|
|
1726
|
+
* File > Fonts > "Embed fonts in the file". Session state like
|
|
1727
|
+
* {@link savePassword}, not document content, so undo never restores it.
|
|
1728
|
+
* Seeded from the loaded deck (see {@link adoptEmbeddedFontFamilies}): a deck
|
|
1729
|
+
* that arrived with embedded fonts keeps them on save, so the switch has to
|
|
1730
|
+
* start "on" or turning it off would be the only way to describe what save
|
|
1731
|
+
* already does. Read by `saveEditorDocument`.
|
|
1732
|
+
*/
|
|
1733
|
+
embedFonts: boolean;
|
|
1734
|
+
/**
|
|
1735
|
+
* Families the user registered from a local font file this session
|
|
1736
|
+
* (File > Options > Fonts, off by default). Session state, never persisted:
|
|
1737
|
+
* the font binary is the user's, not ours to store.
|
|
1738
|
+
*/
|
|
1739
|
+
customFontFamilies: readonly string[];
|
|
1740
|
+
masterViewTarget: MasterViewTarget | null;
|
|
1741
|
+
readonly selection: EditorSelection;
|
|
1742
|
+
/** The block of table cells marquee'd inside the selected table, if any. */
|
|
1743
|
+
readonly tableCells: TableCellSelection;
|
|
1744
|
+
editable: boolean;
|
|
1745
|
+
dirty: boolean;
|
|
1746
|
+
/**
|
|
1747
|
+
* Monotonic counter bumped by {@link setSlides}, i.e. every time a freshly
|
|
1748
|
+
* loaded deck is installed as the working document.
|
|
1749
|
+
*
|
|
1750
|
+
* It exists because the loader's own `loadCount` is bumped in an EARLIER
|
|
1751
|
+
* flush than the one that writes these slides: the seeding effect
|
|
1752
|
+
* (`viewer-effects.svelte.ts`) reacts to `loadCount`, so by the time it calls
|
|
1753
|
+
* `setSlides` the autosave effect has already run once, seen the new count
|
|
1754
|
+
* against the old slides, and settled. The slide reassignment that followed
|
|
1755
|
+
* then looked exactly like a user edit, and merely OPENING a deck wrote a
|
|
1756
|
+
* crash-recovery snapshot. This counter changes in the SAME synchronous block
|
|
1757
|
+
* as the slides it describes, so the reseed can never be misread again.
|
|
1758
|
+
*/
|
|
1759
|
+
seedNonce: number;
|
|
1760
|
+
editTemplateMode: boolean;
|
|
1761
|
+
interactionActive: boolean;
|
|
1762
|
+
clipboard: ElementClipboardPayload | null;
|
|
1763
|
+
/** Ctrl/Cmd+Alt+V dialog visibility. */
|
|
1764
|
+
pasteSpecialDialogOpen: boolean;
|
|
1765
|
+
/** Shared theme editor stays mounted across ribbon/mobile layout changes. */
|
|
1766
|
+
themeEditorOpen: boolean;
|
|
1767
|
+
/** The Paste Options toolbar's target: the elements a normal paste just inserted. */
|
|
1768
|
+
pasteOptionsToolbar: {
|
|
1769
|
+
id: string;
|
|
1770
|
+
sourceClone: PptxElement;
|
|
1771
|
+
}[] | null;
|
|
1772
|
+
/**
|
|
1773
|
+
* File ▸ Info ▸ Protect Presentation state. Deliberately NOT part of
|
|
1774
|
+
* {@link EditorSnapshot}: the secret is session state, not document content,
|
|
1775
|
+
* so undo must never restore or clear it. {@link saveIntent} feeds it to the
|
|
1776
|
+
* shared `planDeckSave`, which routes a protected save through
|
|
1777
|
+
* `saveEncrypted` (an OLE2 container) instead of `save` (a plain ZIP).
|
|
1778
|
+
*/
|
|
1779
|
+
passwordProtected: boolean;
|
|
1780
|
+
savePassword: string | null;
|
|
1781
|
+
/** Undo/redo stack; the `canUndo` / `canRedo` getters below mirror it. */
|
|
1782
|
+
readonly history: EditorHistoryState;
|
|
1783
|
+
readonly clipboardOps: EditorClipboardController;
|
|
1784
|
+
readonly elementOps: EditorElementController;
|
|
1785
|
+
readonly templateOps: EditorTemplateController;
|
|
1786
|
+
readonly slidesOps: EditorSlidesController;
|
|
1787
|
+
readonly sectionOps: EditorSectionController;
|
|
1788
|
+
readonly arrangeOps: EditorArrangeController;
|
|
1789
|
+
/** On-canvas picture crop mode (ribbon Crop / context-menu Crop). */
|
|
1790
|
+
readonly cropOps: EditorCropController;
|
|
1791
|
+
/** The chart Format pane's target element and open state. */
|
|
1792
|
+
readonly chartFormat: ChartFormatState;
|
|
1793
|
+
readonly backgroundOps: EditorBackgroundController;
|
|
1794
|
+
readonly transitionOps: EditorTransitionController;
|
|
1795
|
+
readonly animationOps: EditorAnimationController;
|
|
1796
|
+
readonly inkOps: EditorInkController;
|
|
1797
|
+
/** Edit Points and the Freeform: Shape / Curve tools. */
|
|
1798
|
+
readonly outlineOps: EditorOutlineController;
|
|
1799
|
+
readonly masterOps: EditorMasterController;
|
|
1800
|
+
readonly masterCrud: EditorMasterCrudController;
|
|
1801
|
+
readonly formatPainter: EditorFormatPainterController;
|
|
1802
|
+
readonly equationOps: EditorEquationController;
|
|
1803
|
+
constructor(deps: EditorStateDeps);
|
|
1804
|
+
get canUndo(): boolean;
|
|
1805
|
+
get undoLabel(): string | undefined;
|
|
1806
|
+
get redoLabel(): string | undefined;
|
|
1807
|
+
get headerFooter(): PptxHeaderFooter;
|
|
1808
|
+
get presentationProperties(): PptxPresentationProperties;
|
|
1809
|
+
get customShows(): PptxCustomShow[];
|
|
1810
|
+
/** The colour picker's "Recent colours" row (`p:clrMru`), most-recent-first. */
|
|
1811
|
+
get mruColors(): string[];
|
|
1812
|
+
/**
|
|
1813
|
+
* The deck's resolved theme colour map (scheme key -> hex), for every
|
|
1814
|
+
* colour picker's "Theme Colors" grid (`buildThemeColorSwatchGrid`).
|
|
1815
|
+
* `undefined` before a theme has loaded.
|
|
1816
|
+
*/
|
|
1817
|
+
get themeColorMap(): Record<string, string> | undefined;
|
|
1818
|
+
/**
|
|
1819
|
+
* Record a colour just picked in ANY colour picker (fill, line, text,
|
|
1820
|
+
* background, table cell, chart series, ...) into the recent-colours row
|
|
1821
|
+
* (wave-4 B6). Writes `presentationProperties.mruColors` OUTSIDE the undo
|
|
1822
|
+
* stack, like the view-preferences write-back.
|
|
1823
|
+
*/
|
|
1824
|
+
recordRecentColor(hex: string): void;
|
|
1825
|
+
get canRedo(): boolean;
|
|
1826
|
+
get selectedElementId(): string | null;
|
|
1827
|
+
get selectedElement(): PptxElement | undefined;
|
|
1828
|
+
get selectedElements(): PptxElement[];
|
|
1829
|
+
get activeElements(): PptxElement[];
|
|
1830
|
+
get renderedSlides(): PptxSlide[];
|
|
1831
|
+
/** The slides the document really holds: not what a Design gallery hover preview shows. */
|
|
1832
|
+
get committedRenderedSlides(): PptxSlide[];
|
|
1833
|
+
get hasClipboard(): boolean;
|
|
1834
|
+
get currentSlideIndex(): number;
|
|
1835
|
+
/** The loaded core handler, or null before a deck is open. Used by the
|
|
1836
|
+
* Slides group for layout switching (`applyLayoutToSlide`). */
|
|
1837
|
+
getHandler(): PptxHandler | null;
|
|
1838
|
+
/** The loaded deck's theme parts (see `EditorStateDeps.getThemeOptions`). */
|
|
1839
|
+
themeOptions(): readonly PptxThemeOption[];
|
|
1840
|
+
/** Publish a theme an undo or redo put back (see `EditorStateDeps.onThemeRestored`). */
|
|
1841
|
+
onThemeRestored(theme: PptxTheme): void;
|
|
1842
|
+
/** Hand a rebuilt handler to the loader (see `EditorStateDeps.setHandler`). */
|
|
1843
|
+
adoptHandler(handler: PptxHandler, keepPrevious?: boolean, data?: PptxData): void;
|
|
1844
|
+
/**
|
|
1845
|
+
* The `p:sldSz` the next save should write, or undefined to leave the
|
|
1846
|
+
* load-time dimensions alone. Slide size lives on the loader (it is not
|
|
1847
|
+
* content the undo stack owns), so it reaches the save through this dep the
|
|
1848
|
+
* same way the handler does.
|
|
1849
|
+
*/
|
|
1850
|
+
getSlideSize(): PptxSlideSize | undefined;
|
|
1851
|
+
/** The host `authorName` prop, or undefined (see {@link EditorStateDeps.getAuthorName}). */
|
|
1852
|
+
get hostAuthorName(): string | undefined;
|
|
1853
|
+
/** The slide canvas in px (see {@link EditorStateDeps.getCanvasSize}). */
|
|
1854
|
+
getCanvasSize(): {
|
|
1855
|
+
width: number;
|
|
1856
|
+
height: number;
|
|
1857
|
+
} | undefined;
|
|
1858
|
+
/**
|
|
1859
|
+
* The table style save options the next save should forward, or `{}` to
|
|
1860
|
+
* leave `ppt/tableStyles.xml` alone. See {@link EditorStateDeps.getTableStyleOptions}.
|
|
1861
|
+
*/
|
|
1862
|
+
getTableStyleOptions(): TableStyleSaveOptions;
|
|
1863
|
+
/** Adopt a freshly loaded deck as the working document (see `loadEditorDocument`). */
|
|
1864
|
+
setSlides(...args: LoadDocumentArgs): void;
|
|
1865
|
+
/** Adopt a load's masters/properties but keep the live slides and editing session. */
|
|
1866
|
+
adoptLoadedParts(...args: LoadDocumentArgs): void;
|
|
1867
|
+
/** Adopt a remote (collaboration) snapshot; see `applyRemoteEditorSlides`. */
|
|
1868
|
+
applyRemoteSlides(slides: PptxSlide[]): void;
|
|
1869
|
+
reset(): void;
|
|
1870
|
+
select(id: string | null): void;
|
|
1871
|
+
/**
|
|
1872
|
+
* The element with `id` on the surface the pointer acts on, or undefined. A
|
|
1873
|
+
* member of an (enterable) group resolves too, in slide space (shared
|
|
1874
|
+
* `slideSpaceElement`), so a member selected by drilling into its group
|
|
1875
|
+
* behaves like a top-level element for the chrome, drag and inline editor.
|
|
1876
|
+
*/
|
|
1877
|
+
elementById(id: string): PptxElement | undefined;
|
|
1878
|
+
/**
|
|
1879
|
+
* May the pointer act on `id` at all? Two gates, both of which must pass:
|
|
1880
|
+
* the template rule (an inherited master/layout node is inert unless
|
|
1881
|
+
* edit-template mode is on) and the element's own authored `a:spLocks`. The
|
|
1882
|
+
* lock half was missing entirely, which is why a `noSelect` shape from a
|
|
1883
|
+
* real deck was as selectable and draggable as any other.
|
|
1884
|
+
*/
|
|
1885
|
+
isElementInteractive(id: string): boolean;
|
|
1886
|
+
setTemplateEditing(enabled: boolean): void;
|
|
1887
|
+
/** Apply the File > Options "maximum number of undos" value. */
|
|
1888
|
+
setHistoryDepth(depth: number): void;
|
|
1889
|
+
pushHistory(label?: string): void;
|
|
1890
|
+
commitChange(): void;
|
|
1891
|
+
/** Patch geometry without history for live gesture preview frames. */
|
|
1892
|
+
patchGeometry: (id: string, box: ElementBoxPatch) => void;
|
|
1893
|
+
/** Merge a live frame into an element without history (a colour picker drag's shade). */
|
|
1894
|
+
previewElement: (id: string, patch: Partial<PptxElement>) => void;
|
|
1895
|
+
replaceActiveElements(elements: PptxElement[]): void;
|
|
1896
|
+
/** Commit a replacement active element collection as one undo step. */
|
|
1897
|
+
commitActiveElements(elements: PptxElement[]): void;
|
|
1898
|
+
/**
|
|
1899
|
+
* Replace the whole slide array with history (the generic multi-slide
|
|
1900
|
+
* mutation entry point: slide add/duplicate/delete, arrange group ops,
|
|
1901
|
+
* and find/replace all route through this so every change is a single
|
|
1902
|
+
* undoable step). No-op when not editable.
|
|
1903
|
+
*/
|
|
1904
|
+
commitSlides(next: PptxSlide[], label?: string): void;
|
|
1905
|
+
/** A deep clone of the whole editable document (one undo entry, or save input). */
|
|
1906
|
+
snapshot(): EditorSnapshot;
|
|
1907
|
+
/**
|
|
1908
|
+
* Adopt the families a freshly loaded deck embeds, and reseed
|
|
1909
|
+
* {@link embedFonts} to the position that describes the file save would write
|
|
1910
|
+
* right now. Deliberately not an undo step: the parsed font list is not a
|
|
1911
|
+
* user edit.
|
|
1912
|
+
*/
|
|
1913
|
+
adoptEmbeddedFontFamilies(families: readonly string[]): void;
|
|
1914
|
+
/** How File > Fonts should render its toggle for the loaded deck. */
|
|
1915
|
+
get fontEmbedding(): FontEmbeddingDescriptor;
|
|
1916
|
+
/** The Protect-Presentation state every save path hands to `planDeckSave`. */
|
|
1917
|
+
saveIntent(): DeckSaveIntent;
|
|
1918
|
+
/** File ▸ Info ▸ Protect Presentation: arm password encryption for saves. */
|
|
1919
|
+
setSavePassword(password: string): void;
|
|
1920
|
+
/** File ▸ Info ▸ Protect Presentation: back to saving in the clear. */
|
|
1921
|
+
clearSavePassword(): void;
|
|
1922
|
+
deleteSelected: () => void;
|
|
1923
|
+
duplicateSelected: () => string | null;
|
|
1924
|
+
applyElementPatch: (id: string, patch: Partial<PptxElement>) => void;
|
|
1925
|
+
patchSelected: (patch: Partial<PptxElement> | ((element: PptxElement, snapshot?: InlineTextEditSnapshot) => Partial<PptxElement>)) => void;
|
|
1926
|
+
insertElement: (element: PptxElement) => string | null;
|
|
1927
|
+
reorderSelected: (direction: ZOrderDirection) => void;
|
|
1928
|
+
nudgeSelected: (dx: number, dy: number) => void;
|
|
1929
|
+
commitInlineText: (id: string, text: string, snapshot?: InlineTextEditSnapshot) => void;
|
|
1930
|
+
commitNotes: (notes: string, notesSegments?: TextSegment[]) => void;
|
|
1931
|
+
/**
|
|
1932
|
+
* Replace the document properties as one undoable edit. `reported` is what the host's
|
|
1933
|
+
* `onpropertieschange` hears (the dialog's saved core by default); pass `null` for an
|
|
1934
|
+
* edit that is not a user change to the core properties (app or custom ones, the AI).
|
|
1935
|
+
*/
|
|
1936
|
+
updateDocumentProperties(core: PptxCoreProperties, app: PptxAppProperties, custom: PptxCustomProperty[], reported?: Partial<PptxCoreProperties> | null): void;
|
|
1937
|
+
/**
|
|
1938
|
+
* Seed the deck's tag parts straight after a load. Deliberately NOT an undo
|
|
1939
|
+
* step: the load already cleared history, and treating the parsed value as
|
|
1940
|
+
* a user edit would mark a pristine deck dirty.
|
|
1941
|
+
*/
|
|
1942
|
+
adoptTagCollections(tags: readonly PptxTagCollection[]): void;
|
|
1943
|
+
/** Replace the tag collections as one undoable edit (inspector Tags section). */
|
|
1944
|
+
updateTagCollections(next: readonly PptxTagCollection[]): void;
|
|
1945
|
+
undo(): void;
|
|
1946
|
+
redo(): void;
|
|
1947
|
+
save(format?: PptxSaveFormat): Promise<Uint8Array>;
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
/**
|
|
1951
|
+
* What the canvas context menu offers, and what each command does.
|
|
1952
|
+
*
|
|
1953
|
+
* The item list is deliberately NOT decided here: `buildContextMenuEntries` in
|
|
1954
|
+
* `pptx-viewer-shared` owns the command ids, labels, order and separators for
|
|
1955
|
+
* all five bindings, so a command added there appears in all five at once. This
|
|
1956
|
+
* module only supplies the context (what is selected, which table cell was
|
|
1957
|
+
* right-clicked) and routes the chosen id at the editor's existing operations.
|
|
1958
|
+
* Svelte's menu used to hand-write its own items, which is exactly how it ended
|
|
1959
|
+
* up shipping without Group, Ungroup, Add Comment, Edit Hyperlink, or a single
|
|
1960
|
+
* table command.
|
|
1961
|
+
*
|
|
1962
|
+
* It lives in a plain `.ts` module rather than inside `ElementContextMenu.svelte`
|
|
1963
|
+
* so the SFC stays thin presentation (repo convention) and so the dispatch is
|
|
1964
|
+
* unit-testable without mounting a component.
|
|
1965
|
+
*
|
|
1966
|
+
* @module editor/context-menu-dispatch
|
|
1967
|
+
*/
|
|
1968
|
+
/** The table cell a right-click landed on, in model (unmerged) coordinates. */
|
|
1969
|
+
interface ContextMenuCellTarget {
|
|
1970
|
+
rowIndex: number;
|
|
1971
|
+
columnIndex: number;
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
/**
|
|
1975
|
+
* Shared value types for the Svelte editing layer.
|
|
1976
|
+
*/
|
|
1977
|
+
/** Box geometry in element (unscaled slide) px. */
|
|
1978
|
+
interface OverlayBox {
|
|
1979
|
+
x: number;
|
|
1980
|
+
y: number;
|
|
1981
|
+
width: number;
|
|
1982
|
+
height: number;
|
|
1983
|
+
rotation: number;
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
interface EditorControllerDeps {
|
|
1987
|
+
getScale(): number;
|
|
1988
|
+
getCurrent(): number;
|
|
1989
|
+
getPresenting(): boolean;
|
|
1990
|
+
/** Synchronous host permission, before reactive teardown clears the native editor. */
|
|
1991
|
+
getEditable?(): boolean;
|
|
1992
|
+
getStageRoot(): Element | null;
|
|
1993
|
+
getHolderEl(): HTMLElement | null;
|
|
1994
|
+
/**
|
|
1995
|
+
* The focusable viewer root. The stage gesture preventDefault()s the click, so
|
|
1996
|
+
* focus has to be put back here or the root's keydown listener stops seeing
|
|
1997
|
+
* anything (see `armEditorKeyboard`).
|
|
1998
|
+
*/
|
|
1999
|
+
getRootEl?(): HTMLElement | null;
|
|
2000
|
+
onCursorMove?(x: number, y: number): void;
|
|
2001
|
+
/**
|
|
2002
|
+
* Open the canvas context menu at viewport `x`/`y`. `cell` is the table cell
|
|
2003
|
+
* the right-click landed on (null elsewhere): the menu's row / column /
|
|
2004
|
+
* merge commands need a target, and this binding has no cell-selection
|
|
2005
|
+
* model, so the cell under the pointer is the target.
|
|
2006
|
+
*/
|
|
2007
|
+
onContextMenu?(x: number, y: number, cell: ContextMenuCellTarget | null): void;
|
|
2008
|
+
/**
|
|
2009
|
+
* Open the EMPTY-CANVAS context menu at viewport `x`/`y` (no element under
|
|
2010
|
+
* the cursor). Mutually exclusive with {@link onContextMenu}: opening one
|
|
2011
|
+
* closes the other.
|
|
2012
|
+
*/
|
|
2013
|
+
onCanvasContextMenu?(x: number, y: number): void;
|
|
2014
|
+
getSnapToGrid?(): boolean;
|
|
2015
|
+
/**
|
|
2016
|
+
* Grid spacing in CSS px for snap-to-grid, derived from the deck's
|
|
2017
|
+
* authored `viewProperties.gridSpacing` (falls back to a default when the
|
|
2018
|
+
* deck has none). NEVER derive this from `presentationProperties` --
|
|
2019
|
+
* `p:gridSpacing` lives under `p:viewPr`, not `p:presentationPr`, and a
|
|
2020
|
+
* real PowerPoint file never populates the latter.
|
|
2021
|
+
*/
|
|
2022
|
+
getGridSize?(): number;
|
|
2023
|
+
getSnapToShape?(): boolean;
|
|
2024
|
+
getGuides?(): readonly SnapGuideInput[];
|
|
2025
|
+
/**
|
|
2026
|
+
* Transform inline-editor text at commit time (File > Options > Proofing
|
|
2027
|
+
* AutoCorrect); identity when unset.
|
|
2028
|
+
*/
|
|
2029
|
+
transformCommittedText?(text: string, previous?: string): string;
|
|
2030
|
+
/**
|
|
2031
|
+
* Collaboration live-preview channel. Inline text only reaches the slides
|
|
2032
|
+
* state on commit, so peers saw nothing while a peer typed; each keystroke is
|
|
2033
|
+
* published through this instead. Omit outside a collaborative viewer.
|
|
2034
|
+
*/
|
|
2035
|
+
getLivePatcher?(): CollaborationLivePatcher | undefined;
|
|
2036
|
+
/** The autosave engine: typing that was never committed still counts as an edit. */
|
|
2037
|
+
getAutosave?(): InlineTextDraftSink | undefined;
|
|
2038
|
+
/** The slide the inline-edited element belongs to (live-preview lookup). */
|
|
2039
|
+
getActiveSlide?(): PptxSlide | undefined;
|
|
2040
|
+
/**
|
|
2041
|
+
* Show or hide the keyboard-shortcut cheat sheet ("?"). The panel is parity
|
|
2042
|
+
* UI state owned by the shell, so the controller only signals the intent.
|
|
2043
|
+
*/
|
|
2044
|
+
toggleShortcuts?(): void;
|
|
2045
|
+
/** Close the cheat sheet on Escape; true when it was open (Escape consumed). */
|
|
2046
|
+
closeShortcuts?(): boolean;
|
|
2047
|
+
/**
|
|
2048
|
+
* Open or close the find bar (Ctrl/Cmd+F). Like the cheat sheet, the panel is
|
|
2049
|
+
* shell-owned UI state, so the controller only signals the intent.
|
|
2050
|
+
*/
|
|
2051
|
+
toggleFind?(): void;
|
|
2052
|
+
/**
|
|
2053
|
+
* Open the find bar already switched to its Replace row (Ctrl/Cmd+H). The
|
|
2054
|
+
* panel has no distinct find-only/replace mode, so this is the same panel
|
|
2055
|
+
* `toggleFind` opens; kept as its own hook only so a host can tell the two
|
|
2056
|
+
* chords apart if it ever grows one.
|
|
2057
|
+
*/
|
|
2058
|
+
toggleFindReplace?(): void;
|
|
2059
|
+
/**
|
|
2060
|
+
* Insert a new slide after the active one (Ctrl+M). Optional because the
|
|
2061
|
+
* deck-level API this calls is constructed after the controller (see
|
|
2062
|
+
* `create-viewer-state.svelte.ts`), so a host wires it in once it exists.
|
|
2063
|
+
*/
|
|
2064
|
+
newSlide?(): void;
|
|
2065
|
+
/** Host keyboard customisation (disabled / remapped editor shortcuts). */
|
|
2066
|
+
getKeyboardCustomization?(): ResolvedKeyboardCustomization | undefined;
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
interface EditorMarqueeRect extends MarqueeRect {
|
|
2070
|
+
additive: boolean;
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
/**
|
|
2074
|
+
* What the selection overlay is allowed to offer, given the authored
|
|
2075
|
+
* `a:spLocks` on the selected element(s).
|
|
2076
|
+
*
|
|
2077
|
+
* The lock composition itself is NOT decided here: `canInteractWithElement` in
|
|
2078
|
+
* `pptx-viewer-shared` is the one decision function all five bindings consult,
|
|
2079
|
+
* and this module only folds its per-element verdict into the collective one an
|
|
2080
|
+
* overlay drawn around N elements needs. Keeping it in a plain `.ts` module
|
|
2081
|
+
* (rather than inside `EditorController` or the overlay SFC) keeps both of
|
|
2082
|
+
* those within the repo's file-size budget and makes the rule unit-testable
|
|
2083
|
+
* without a component mount.
|
|
2084
|
+
*
|
|
2085
|
+
* @module editor/editor-selection-interactivity
|
|
2086
|
+
*/
|
|
2087
|
+
/** The chrome the overlay may draw for the current selection. */
|
|
2088
|
+
interface SelectionInteractivity {
|
|
2089
|
+
/** Draw (and honour) the eight resize handles. */
|
|
2090
|
+
resizable: boolean;
|
|
2091
|
+
/** Draw (and honour) the rotate stem + knob. */
|
|
2092
|
+
rotatable: boolean;
|
|
2093
|
+
/**
|
|
2094
|
+
* The amber adjustment diamonds, one per `a:avLst` guide. Empty when there
|
|
2095
|
+
* is none to draw; PowerPoint shows several on most presets (`quadArrow`
|
|
2096
|
+
* three, `callout3` four), and offering only the first left the rest
|
|
2097
|
+
* unreachable.
|
|
2098
|
+
*/
|
|
2099
|
+
adjust: ShapeAdjustmentHandleDescriptor[];
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
declare class EditorController {
|
|
2103
|
+
#private;
|
|
2104
|
+
snapLines: readonly SnapLine[];
|
|
2105
|
+
editingId: string | null;
|
|
2106
|
+
marquee: EditorMarqueeRect | null;
|
|
2107
|
+
/**
|
|
2108
|
+
* The hyperlink dialog, opened by Ctrl+K or the Insert-tab/context-menu
|
|
2109
|
+
* buttons. Lives here (not on the always-mounted `ViewerStage`) so the
|
|
2110
|
+
* keyboard shortcut has one flag to flip regardless of which of those two
|
|
2111
|
+
* pre-existing triggers a host renders.
|
|
2112
|
+
*/
|
|
2113
|
+
hyperlinkOpen: boolean;
|
|
2114
|
+
constructor(editor: EditorState, deps: EditorControllerDeps);
|
|
2115
|
+
/** The elements the pointer acts on (slide, or master/layout), for overlays. */
|
|
2116
|
+
get activeElements(): PptxElement[];
|
|
2117
|
+
get overlayBox(): OverlayBox | null;
|
|
2118
|
+
/**
|
|
2119
|
+
* Which selection chrome the authored `a:spLocks` still permit, plus the
|
|
2120
|
+
* shape-adjustment descriptor. The overlay only ever sees an `OverlayBox`,
|
|
2121
|
+
* so the element-level verdict is computed here and passed down as a prop.
|
|
2122
|
+
*/
|
|
2123
|
+
get interactivity(): SelectionInteractivity;
|
|
2124
|
+
get editing(): boolean;
|
|
2125
|
+
get selectionCount(): number;
|
|
2126
|
+
get editingElement(): PptxElement | undefined;
|
|
2127
|
+
/**
|
|
2128
|
+
* The group the selection has drilled into (shared `parentSelection`), in
|
|
2129
|
+
* slide space, for its dashed frame; null when the selection is top-level.
|
|
2130
|
+
*/
|
|
2131
|
+
get enteredGroup(): PptxElement | null;
|
|
2132
|
+
/** True when editing owns the keyboard (a selection or inline edit is live). */
|
|
2133
|
+
capturesKeyboard(): boolean;
|
|
2134
|
+
onStagePointerDown: (event: PointerEvent) => void;
|
|
2135
|
+
onStagePointerMove: (event: PointerEvent) => void;
|
|
2136
|
+
/**
|
|
2137
|
+
* A click that ends a press on the already-selected group member (see
|
|
2138
|
+
* `#pressEdit`) opens its text, caret where the click landed. A drag (the
|
|
2139
|
+
* pointer travelled) or any other click does nothing here.
|
|
2140
|
+
*/
|
|
2141
|
+
onStageClick: (event: MouseEvent) => void;
|
|
2142
|
+
onStageDblClick: (event: MouseEvent) => void;
|
|
2143
|
+
/** Select the right-clicked element and expose the edit context menu. */
|
|
2144
|
+
onStageContextMenu: (event: MouseEvent) => void;
|
|
2145
|
+
onHandlePointerDown: (handle: ResizeHandleId, event: PointerEvent) => void;
|
|
2146
|
+
onRotatePointerDown: (event: PointerEvent) => void;
|
|
2147
|
+
onAdjustPointerDown: (event: PointerEvent, descriptor: ShapeAdjustmentHandleDescriptor) => void;
|
|
2148
|
+
hasActivePointerInteraction(): boolean;
|
|
2149
|
+
/** Live connector-endpoint drag position in SLIDE px, or null when idle. */
|
|
2150
|
+
connectorEndpointDrag: {
|
|
2151
|
+
kind: ConnectorEndpointKind;
|
|
2152
|
+
x: number;
|
|
2153
|
+
y: number;
|
|
2154
|
+
} | null;
|
|
2155
|
+
/** The selected connector, when exactly one connector is selected. */
|
|
2156
|
+
get selectedConnector(): PptxElement | null;
|
|
2157
|
+
onConnectorEndpointPointerDown: (kind: ConnectorEndpointKind, event: PointerEvent) => void;
|
|
2158
|
+
onKeyDown: (event: KeyboardEvent) => void;
|
|
2159
|
+
/** Open the inline text editor over `id` when the element carries text. */
|
|
2160
|
+
enterInlineEdit(id: string): void;
|
|
2161
|
+
/**
|
|
2162
|
+
* Mirror the in-progress inline text to collaborators. Touches no editor
|
|
2163
|
+
* state or history: the commit path stays the single source of truth.
|
|
2164
|
+
*/
|
|
2165
|
+
previewInline(id: string, text: string): void;
|
|
2166
|
+
/** Native editor capability stays scoped to this controller's active slide. */
|
|
2167
|
+
get inlineCollaboration(): {
|
|
2168
|
+
patcher: ooxml_ui_pptx.CollaborationLivePatcher;
|
|
2169
|
+
slideId: string;
|
|
2170
|
+
} | undefined;
|
|
2171
|
+
/** Open the hyperlink dialog for the current selection (Ctrl+K). */
|
|
2172
|
+
openHyperlink(): void;
|
|
2173
|
+
/**
|
|
2174
|
+
* Apply an element patch built by a formatting shortcut, mid-edit or not.
|
|
2175
|
+
* `InlineTextEditor` has no access to `EditorState`, only to this
|
|
2176
|
+
* controller and the element it is editing, so this is its way to reach
|
|
2177
|
+
* the same `patchSelected` the root keyboard handler and the ribbon use.
|
|
2178
|
+
*/
|
|
2179
|
+
patchSelected(patch: Partial<PptxElement> | ((element: PptxElement) => Partial<PptxElement>)): void;
|
|
2180
|
+
/** Arm the format painter from the current selection (Ctrl+Shift+C). */
|
|
2181
|
+
copyFormat(): void;
|
|
2182
|
+
/** Apply the copied format to the current selection (Ctrl+Shift+V). */
|
|
2183
|
+
pasteFormat(): void;
|
|
2184
|
+
/** Open the find bar (Ctrl+F), including mid-edit; see `EditorControllerDeps`. */
|
|
2185
|
+
toggleFind(): void;
|
|
2186
|
+
/** Open the find bar's replace row (Ctrl+H), including mid-edit. */
|
|
2187
|
+
toggleFindReplace(): void;
|
|
2188
|
+
/** Commit the inline editor's text onto the element and close it. */
|
|
2189
|
+
commitInline(id: string, text: string, snapshot?: InlineTextEditSnapshot): void;
|
|
2190
|
+
/** Register a live reader with this viewer's document and editing session. */
|
|
2191
|
+
registerInlineReader(id: string, controller?: InlineListController | CollaborationInlineEditor, cancel?: () => void): void;
|
|
2192
|
+
/** Retain authoritative accepted text before a host-only permission veto. */
|
|
2193
|
+
retainAcceptedInlineText(permissionLossOnly?: boolean): boolean;
|
|
2194
|
+
/** Close the inline editor without further mutation. */
|
|
2195
|
+
closeInline(): void;
|
|
2196
|
+
/** Tear down window listeners (component destroy). */
|
|
2197
|
+
destroy(): void;
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
/**
|
|
2201
|
+
* Where the canvas context menu opened, and on which table cell.
|
|
2202
|
+
*
|
|
2203
|
+
* Owned by the viewer shell and handed straight to `ElementContextMenu`; the
|
|
2204
|
+
* cell is what turns the shared menu's table block on and gives it a target.
|
|
2205
|
+
*/
|
|
2206
|
+
interface StageContextMenu {
|
|
2207
|
+
x: number;
|
|
2208
|
+
y: number;
|
|
2209
|
+
cell: ContextMenuCellTarget | null;
|
|
2210
|
+
}
|
|
2211
|
+
/** Where the empty-canvas (no element hit) context menu opened. */
|
|
2212
|
+
interface StageCanvasContextMenu {
|
|
2213
|
+
x: number;
|
|
2214
|
+
y: number;
|
|
2215
|
+
}
|
|
2216
|
+
|
|
2217
|
+
/**
|
|
2218
|
+
* Reactive Find & Replace panel state for the Home tab's Editing group.
|
|
2219
|
+
* The session (matches, current match, replace plans, the search after a
|
|
2220
|
+
* replace) is the shared `find-replace-session` model, kept here in
|
|
2221
|
+
* `$state.raw`; this class adds the panel's open flag and routes every replace
|
|
2222
|
+
* through the host's history-tracked commit so undo/redo cover it.
|
|
2223
|
+
*/
|
|
2224
|
+
interface FindReplaceDeps {
|
|
2225
|
+
getSlides(): readonly PptxSlide[];
|
|
2226
|
+
/** Commit a fully-replaced slide array (pushes history, marks dirty). */
|
|
2227
|
+
commitSlides(next: PptxSlide[]): void;
|
|
2228
|
+
/** Called with the match's slide and element (null for a speaker-notes match). */
|
|
2229
|
+
onNavigate?(slideIndex: number, elementId: string | null): void;
|
|
2230
|
+
}
|
|
2231
|
+
declare class FindReplaceState {
|
|
2232
|
+
#private;
|
|
2233
|
+
open: boolean;
|
|
2234
|
+
constructor(deps: FindReplaceDeps);
|
|
2235
|
+
/** The query; setting it searches. */
|
|
2236
|
+
get query(): string;
|
|
2237
|
+
set query(query: string);
|
|
2238
|
+
get replacement(): string;
|
|
2239
|
+
set replacement(replacement: string);
|
|
2240
|
+
get matchCase(): boolean;
|
|
2241
|
+
set matchCase(matchCase: boolean);
|
|
2242
|
+
get includeNotes(): boolean;
|
|
2243
|
+
set includeNotes(includeNotes: boolean);
|
|
2244
|
+
get includeChartTitles(): boolean;
|
|
2245
|
+
set includeChartTitles(includeChartTitles: boolean);
|
|
2246
|
+
get includeChartData(): boolean;
|
|
2247
|
+
set includeChartData(includeChartData: boolean);
|
|
2248
|
+
get results(): readonly FindResult[];
|
|
2249
|
+
/** Zero-based current match; -1 when there is none. */
|
|
2250
|
+
get index(): number;
|
|
2251
|
+
get hasResults(): boolean;
|
|
2252
|
+
get matchCount(): number;
|
|
2253
|
+
toggle(): void;
|
|
2254
|
+
/** Close the panel; its matches go with it. */
|
|
2255
|
+
close(): void;
|
|
2256
|
+
/** Re-run the search from the current query and scopes and jump to the first match. */
|
|
2257
|
+
search(): void;
|
|
2258
|
+
next(): void;
|
|
2259
|
+
prev(): void;
|
|
2260
|
+
/** Replace the current match, then move on to the next one. */
|
|
2261
|
+
replaceCurrent(): void;
|
|
2262
|
+
/** Replace every match of the current query, then search again. */
|
|
2263
|
+
replaceAll(): void;
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
/**
|
|
2267
|
+
* ChromeUiState: reactive open/collapsed state for the editing chrome's side
|
|
2268
|
+
* panels, mirroring React's `useViewerState` flags (`isSidebarCollapsed`,
|
|
2269
|
+
* `isInspectorPaneOpen`, `inspectorTab`). Owned by `PowerPointViewer` and
|
|
2270
|
+
* threaded to both the ribbon's primary row (the toggle buttons) and
|
|
2271
|
+
* `ViewerBody` (which gates the thumbnail rail and inspector pane on it).
|
|
2272
|
+
*/
|
|
2273
|
+
/** The inspector pane's tab strip, matching React's `InspectorTab`. */
|
|
2274
|
+
type InspectorTabId = 'elements' | 'properties' | 'comments';
|
|
2275
|
+
declare class ChromeUiState {
|
|
2276
|
+
constructor(inspectorInitiallyOpen?: boolean);
|
|
2277
|
+
/** Left thumbnail rail visibility (React: `isSidebarCollapsed`). */
|
|
2278
|
+
sidebarCollapsed: boolean;
|
|
2279
|
+
/** Right inspector pane visibility (React: `isInspectorPaneOpen`). */
|
|
2280
|
+
inspectorOpen: boolean;
|
|
2281
|
+
/** Active inspector tab (React defaults to Properties). */
|
|
2282
|
+
inspectorTab: InspectorTabId;
|
|
2283
|
+
toggleSidebar(): void;
|
|
2284
|
+
toggleInspector(): void;
|
|
2285
|
+
setInspectorTab(tab: InspectorTabId): void;
|
|
2286
|
+
/** Comments toolbar button: toggle the inspector's Comments tab. */
|
|
2287
|
+
toggleComments(): void;
|
|
2288
|
+
/** True when the inspector is showing the Comments tab. */
|
|
2289
|
+
get commentsOpen(): boolean;
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
/** A fully-wired collaboration session: the doc, its factories, and transport. */
|
|
2293
|
+
interface CollabSession {
|
|
2294
|
+
/** The live Y.Doc (structural view used by the shared reconcile helpers). */
|
|
2295
|
+
ydoc: YDocLike;
|
|
2296
|
+
/** Factories the shared reconcile helpers use to build Y.Map/Array/Text. */
|
|
2297
|
+
factories: YjsFactories;
|
|
2298
|
+
/** The normalised transport provider handle. */
|
|
2299
|
+
provider: CollabProviderHandle;
|
|
2300
|
+
/** Tear down the provider and destroy the doc. */
|
|
2301
|
+
destroy: () => void;
|
|
2302
|
+
}
|
|
2303
|
+
/**
|
|
2304
|
+
* Build a live session for the given transport + config. Injectable so tests
|
|
2305
|
+
* can substitute an in-memory fake (see `collaboration.svelte.ts`).
|
|
2306
|
+
*/
|
|
2307
|
+
type CollabSessionFactory = (transport: CollaborationTransport, config: CollaborationConfig) => Promise<CollabSession>;
|
|
2308
|
+
|
|
2309
|
+
interface CollaborationDeps {
|
|
2310
|
+
/** Read the current local slides (broadcast granularly on change). */
|
|
2311
|
+
getSlides: () => PptxSlide[];
|
|
2312
|
+
/** The editor history; Undo and Redo go through the room's own history while it is writable. */
|
|
2313
|
+
getHistory?: () => CollaborationHistoryTarget | undefined;
|
|
2314
|
+
/** Apply a remote peer's slide snapshot into the editable slides. */
|
|
2315
|
+
applyRemoteSlides: (slides: PptxSlide[]) => void;
|
|
2316
|
+
/** Live host `collaboration` config; watched to auto start/stop a session. */
|
|
2317
|
+
getConfig: () => CollaborationConfig | undefined;
|
|
2318
|
+
/** Return the loaded source bytes for elected-writer (role 'owner') write-back. */
|
|
2319
|
+
getSourceBytes?: () => Uint8Array | null;
|
|
2320
|
+
/**
|
|
2321
|
+
* Session-level save options (view properties, table styles, tags, deck
|
|
2322
|
+
* properties, ...), built the same way as the Save/Export path
|
|
2323
|
+
* (`buildDeckSaveOptions`). Without this the elected-writer write-back
|
|
2324
|
+
* dropped every session-level edit outside `slides`.
|
|
2325
|
+
*/
|
|
2326
|
+
getSaveOptions?: () => PptxHandlerSaveOptions;
|
|
2327
|
+
/** Slide canvas width/height (unscaled px), used to clamp incoming cursor coordinates. */
|
|
2328
|
+
getCanvasWidth?: () => number | undefined;
|
|
2329
|
+
getCanvasHeight?: () => number | undefined;
|
|
2330
|
+
/** Fired when a session starts (host observability). */
|
|
2331
|
+
onStart?: (config: CollaborationConfig) => void;
|
|
2332
|
+
/** Fired when a session stops (host observability). */
|
|
2333
|
+
onStop?: () => void;
|
|
2334
|
+
/** Session factory seam (defaults to the real yjs + transport wiring). */
|
|
2335
|
+
createSession?: CollabSessionFactory;
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2338
|
+
/**
|
|
2339
|
+
* The collaboration controller. Construct it once during component setup: it
|
|
2340
|
+
* registers the effects (auto start/stop from the config, granular publish of
|
|
2341
|
+
* local edits) itself, so no further wiring is needed in the SFC.
|
|
2342
|
+
*/
|
|
2343
|
+
declare class CollaborationController {
|
|
2344
|
+
#private;
|
|
2345
|
+
/** Interim Y.Doc channel for in-flight inline text (dormant when stopped). */
|
|
2346
|
+
get livePatcher(): ooxml_ui_pptx.CollaborationLivePatcher;
|
|
2347
|
+
constructor(deps: CollaborationDeps);
|
|
2348
|
+
/** Live connection status (reactive). */
|
|
2349
|
+
get status(): ConnectionStatus;
|
|
2350
|
+
/** A borrowed host session's readiness reports its status here. */
|
|
2351
|
+
set status(next: ConnectionStatus);
|
|
2352
|
+
/** Whether a session is live (reactive). */
|
|
2353
|
+
get active(): boolean;
|
|
2354
|
+
/** The requested viewer role forbids editing, including while attachment is pending. */
|
|
2355
|
+
get readOnly(): boolean;
|
|
2356
|
+
/** Remote cursors on the current slide (reactive). */
|
|
2357
|
+
get cursors(): RemoteCursor[];
|
|
2358
|
+
/** Remote collaborators in the session (reactive). */
|
|
2359
|
+
get remotePresences(): SanitizedPresence[];
|
|
2360
|
+
/** Followed peer's client id, or null when free (reactive). */
|
|
2361
|
+
get followedClientId(): number | null;
|
|
2362
|
+
/** The config the active session was started with (null when stopped); the
|
|
2363
|
+
* Share dialog's active view reads the local user's name/colour from this. */
|
|
2364
|
+
get activeCollaboration(): CollaborationConfig | null;
|
|
2365
|
+
/** The shared `CollaborationState` a host reads (`oncollaborationchange`), reactive. */
|
|
2366
|
+
get state(): CollaborationState;
|
|
2367
|
+
/** Total connected participants (self + remote peers), reactive. */
|
|
2368
|
+
get connectedCount(): number;
|
|
2369
|
+
/** Publish a cursor move (slide-space px); no-op when no session is active. */
|
|
2370
|
+
setCursor(x: number, y: number, activeSlideIndex?: number): void;
|
|
2371
|
+
/** Publish the local selection; no-op when no session is active. */
|
|
2372
|
+
setSelection(selectedElementId: string | undefined, activeSlideIndex?: number): void;
|
|
2373
|
+
/** Publish the local active-slide index (drives peer follow-along). */
|
|
2374
|
+
setActiveSlide(index: number): void;
|
|
2375
|
+
/** Follow the given peer's active slide, or `null` to stop following. */
|
|
2376
|
+
followUser(clientId: number | null): void;
|
|
2377
|
+
/**
|
|
2378
|
+
* Re-adopt the shared doc's slides after a local content load committed a
|
|
2379
|
+
* parsed deck to viewer state (see `adoptDocSlidesAfterLoad`). The load
|
|
2380
|
+
* pipeline calls this synchronously right after it applies, i.e. before the
|
|
2381
|
+
* publish effect can flush the freshly loaded slides into the doc, so a
|
|
2382
|
+
* late joiner's bootstrap deck never clobbers the room's synced content.
|
|
2383
|
+
*/
|
|
2384
|
+
adoptDocAfterLoad(origin?: CollabLoadOrigin): void;
|
|
2385
|
+
/** Start (or restart) a session with the given config (dialog-driven). */
|
|
2386
|
+
start(config: CollaborationConfig): Promise<void>;
|
|
2387
|
+
stop(): void;
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
/** Prefilled values for the Share dialog's form (Broadcast reuses `serverUrl`). */
|
|
2391
|
+
interface ShareDefaultsInput {
|
|
2392
|
+
roomId?: string;
|
|
2393
|
+
userName?: string;
|
|
2394
|
+
serverUrl?: string;
|
|
2395
|
+
}
|
|
2396
|
+
declare class CollaborationDialogsState {
|
|
2397
|
+
#private;
|
|
2398
|
+
shareOpen: boolean;
|
|
2399
|
+
broadcastOpen: boolean;
|
|
2400
|
+
constructor(collab: CollaborationController, getShareDefaults: () => ShareDefaultsInput | undefined, getAuthorName?: () => string | undefined);
|
|
2401
|
+
/** Number of connected participants (including the local user), when active. */
|
|
2402
|
+
get connectedCount(): number;
|
|
2403
|
+
/** The shareable follow link for the current (or last) broadcast, once known. */
|
|
2404
|
+
get broadcastViewerUrl(): string | undefined;
|
|
2405
|
+
openShare(): void;
|
|
2406
|
+
openBroadcast(): void;
|
|
2407
|
+
readonly onShareStart: (config: CollaborationConfig) => void;
|
|
2408
|
+
readonly onShareStop: () => void;
|
|
2409
|
+
readonly onBroadcastStart: (config: BroadcastConfig) => void;
|
|
2410
|
+
readonly onBroadcastStop: () => void;
|
|
2411
|
+
/**
|
|
2412
|
+
* Retry the active session after a connection error: prefers the host's
|
|
2413
|
+
* live `collaboration` prop, falling back to whatever config either dialog
|
|
2414
|
+
* last started (since a dialog-started session has no corresponding prop).
|
|
2415
|
+
*/
|
|
2416
|
+
retry(propConfig: CollaborationConfig | undefined): void;
|
|
2417
|
+
}
|
|
2418
|
+
|
|
2419
|
+
/**
|
|
2420
|
+
* Reactive viewer chrome state (runes-based): current slide, zoom mode, and
|
|
2421
|
+
* fullscreen flag. The Svelte analogue of the Vue binding's `useViewerState`
|
|
2422
|
+
* essentials, kept out of the SFC so it is unit-testable without a DOM.
|
|
2423
|
+
*/
|
|
2424
|
+
declare class ViewerState {
|
|
2425
|
+
#private;
|
|
2426
|
+
/** Number of slides in the loaded presentation. */
|
|
2427
|
+
slideCount: number;
|
|
2428
|
+
/** Active slide index (0-based). */
|
|
2429
|
+
current: number;
|
|
2430
|
+
/** True while the viewer root is the fullscreen element. */
|
|
2431
|
+
isFullscreen: boolean;
|
|
2432
|
+
/** Manual zoom percent, or `null` for fit-to-viewport. */
|
|
2433
|
+
get zoomPercent(): number | null;
|
|
2434
|
+
set zoomPercent(percent: number | null);
|
|
2435
|
+
/** Reset for a freshly-loaded presentation. */
|
|
2436
|
+
reset(slideCount: number, initialSlide?: number): void;
|
|
2437
|
+
/** Keep navigation bounds aligned when editor operations change the deck. */
|
|
2438
|
+
setSlideCount(slideCount: number): void;
|
|
2439
|
+
goTo(index: number): void;
|
|
2440
|
+
/**
|
|
2441
|
+
* Go to `index` for a selection the caller makes there straight away: the slide-change effect
|
|
2442
|
+
* keeps that selection instead of dropping it.
|
|
2443
|
+
*/
|
|
2444
|
+
goToWithSelection(index: number): void;
|
|
2445
|
+
/**
|
|
2446
|
+
* Whether the slide change that landed on `index` came with its own selection (see
|
|
2447
|
+
* {@link goToWithSelection}). Asking drops the note, so it holds for one slide change only.
|
|
2448
|
+
*/
|
|
2449
|
+
takeSelectionSlide(index: number): boolean;
|
|
2450
|
+
next(): void;
|
|
2451
|
+
prev(): void;
|
|
2452
|
+
first(): void;
|
|
2453
|
+
last(): void;
|
|
2454
|
+
/**
|
|
2455
|
+
* Zoom one step in/out from the currently-effective percent. While in fit
|
|
2456
|
+
* mode the state does not know the fitted percent (it depends on viewport
|
|
2457
|
+
* measurements), so the component passes it in.
|
|
2458
|
+
*/
|
|
2459
|
+
zoomIn(effectivePercent: number): void;
|
|
2460
|
+
zoomOut(effectivePercent: number): void;
|
|
2461
|
+
zoomToFit(): void;
|
|
2462
|
+
/**
|
|
2463
|
+
* Apply a keyboard navigation key. Returns true when the key was handled
|
|
2464
|
+
* (so the caller can `preventDefault()`).
|
|
2465
|
+
*/
|
|
2466
|
+
handleNavigationKey(key: string): boolean;
|
|
2467
|
+
}
|
|
2468
|
+
|
|
2469
|
+
/**
|
|
2470
|
+
* The navigation / zoom / mode / slide / element half of the imperative
|
|
2471
|
+
* `PowerPointViewer` instance API. The undo/redo/save half lives in
|
|
2472
|
+
* `editing-api.ts` and the export half in `export/exporting-api.ts`.
|
|
2473
|
+
*/
|
|
2474
|
+
type DeckApi = Omit<PowerPointViewerAPI, 'getContent' | 'undo' | 'redo' | 'canUndo' | 'canRedo'>;
|
|
2475
|
+
|
|
2476
|
+
/** The imperative editing API exposed on the `PowerPointViewer` instance. */
|
|
2477
|
+
interface EditingApi {
|
|
2478
|
+
undo(): void;
|
|
2479
|
+
redo(): void;
|
|
2480
|
+
canUndo(): boolean;
|
|
2481
|
+
canRedo(): boolean;
|
|
2482
|
+
deleteSelected(): void;
|
|
2483
|
+
getSelectedElementId(): string | null;
|
|
2484
|
+
save(format?: PptxSaveFormat): Promise<Uint8Array>;
|
|
2485
|
+
/** Save As `format` (reported to host storage as `saveAs`). */
|
|
2486
|
+
downloadAs(format: PptxSaveFormat, fileName?: string): Promise<void>;
|
|
2487
|
+
/** File > Save as `.pptx` (reported to host storage as `save`). */
|
|
2488
|
+
downloadPptx(fileName?: string): Promise<void>;
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
/**
|
|
2492
|
+
* `AnimationPlayback`: native-timing (`p:timing`) animation playback for the
|
|
2493
|
+
* Svelte binding's presentation mode, driven by the shared, framework-agnostic
|
|
2494
|
+
* {@link PresentationAnimationController}. The runes analogue of the Vue
|
|
2495
|
+
* `useAnimationPlayback` composable, kept out of the SFC so it is unit-testable.
|
|
2496
|
+
*
|
|
2497
|
+
* This replaces the older preset (`PptxElementAnimation`) click-group model for
|
|
2498
|
+
* the slide show: the controller builds a timeline engine from the slide's
|
|
2499
|
+
* `nativeAnimations` (expanding staged text builds), which can represent native
|
|
2500
|
+
* staged chart / SmartArt builds (`p:bldChart` / `p:bldDgm`) and colour
|
|
2501
|
+
* animations (`p:animClr`) that the preset model could not. It mirrors the Vue /
|
|
2502
|
+
* React bindings.
|
|
2503
|
+
*
|
|
2504
|
+
* The class owns the reactive per-element state map, the keyframes CSS, and the
|
|
2505
|
+
* interactive / hover trigger-shape id sets; the controller stays pure. The
|
|
2506
|
+
* clock (timers, requestAnimationFrame) + DOM effects live in the shared
|
|
2507
|
+
* {@link module:render/animation-playback-engine}, wired here with the local
|
|
2508
|
+
* `./animation-sound` player.
|
|
2509
|
+
*
|
|
2510
|
+
* NOTE: the editor / inspector animation PREVIEW still uses the older shared
|
|
2511
|
+
* `buildClickGroups` model (see `AnimationsTab` / `editor-animation-controller`);
|
|
2512
|
+
* this class is only the running slide show.
|
|
2513
|
+
*/
|
|
2514
|
+
interface AnimationPlaybackDeps {
|
|
2515
|
+
/** The current slide to build the native-animation timeline for. */
|
|
2516
|
+
getSlide(): PptxSlide | undefined;
|
|
2517
|
+
/** Presentation-level switch parsed from `p:showPr`. */
|
|
2518
|
+
getShowWithAnimation?(): boolean | undefined;
|
|
2519
|
+
/** Host-provided action-sound player (resolves + plays embedded sounds). */
|
|
2520
|
+
onPlayActionSound?: (soundPath: string) => void;
|
|
2521
|
+
/** Root element to scope media-command (`p:cmd`) target lookups to. */
|
|
2522
|
+
frameRoot?: () => HTMLElement | null;
|
|
2523
|
+
/**
|
|
2524
|
+
* The slide canvas size (px), in the same unit the elements' own
|
|
2525
|
+
* `x`/`y`/`width`/`height` are authored in. Lets `PresentationAnimationController
|
|
2526
|
+
* .fromSlide` resolve a `p:anim` formula that needs the animated shape's real
|
|
2527
|
+
* box (e.g. Grow And Turn's `-#ppt_w/2` fly-in) instead of falling back.
|
|
2528
|
+
*/
|
|
2529
|
+
getCanvasSize?(): {
|
|
2530
|
+
width: number;
|
|
2531
|
+
height: number;
|
|
2532
|
+
} | undefined;
|
|
2533
|
+
/** The deck's resolved theme colour map, for a scheme-colour (`a:schemeClr`) animation stop. */
|
|
2534
|
+
getThemeColorMap?(): Readonly<Record<string, string>> | undefined;
|
|
2535
|
+
/**
|
|
2536
|
+
* `viewerOptions.advanced.pixelateMosaicAnimation`. `true` plays the
|
|
2537
|
+
* blocky mosaic reveal for `p:animEffect/@filter="pixelate"`; omitted or
|
|
2538
|
+
* `false` (the default, matching PowerPoint's own behaviour) snaps the
|
|
2539
|
+
* element to its end state. See `resolveFilterEffect`'s doc in
|
|
2540
|
+
* `pptx-viewer-shared`'s `animation-filter-effects.ts`.
|
|
2541
|
+
*/
|
|
2542
|
+
getPixelateMosaicAnimation?(): boolean | undefined;
|
|
2543
|
+
}
|
|
2544
|
+
declare class AnimationPlayback {
|
|
2545
|
+
#private;
|
|
2546
|
+
constructor(deps: AnimationPlaybackDeps);
|
|
2547
|
+
/** Reactive per-element native-animation state (visibility, build, colour). */
|
|
2548
|
+
get elementStates(): Map<string, ElementAnimationState>;
|
|
2549
|
+
/** The per-slide `@keyframes` CSS to inject once per slide. */
|
|
2550
|
+
get keyframesCss(): string;
|
|
2551
|
+
/** Shape ids that trigger an interactive (`onShapeClick`) sequence. */
|
|
2552
|
+
get interactiveTriggerShapeIds(): ReadonlySet<string>;
|
|
2553
|
+
/** Shape ids that trigger a hover (`onHover`) sequence. */
|
|
2554
|
+
get hoverTriggerShapeIds(): ReadonlySet<string>;
|
|
2555
|
+
/** True once every main-timeline click-group has been revealed. */
|
|
2556
|
+
get isComplete(): boolean;
|
|
2557
|
+
/** Clear all pending timers + the in-flight staged-build RAF. */
|
|
2558
|
+
clearTimers(): void;
|
|
2559
|
+
/** Whether the active slide was seeded as fully built (backward entry). */
|
|
2560
|
+
get seededCompleted(): boolean;
|
|
2561
|
+
/**
|
|
2562
|
+
* Rebuild the controller for the current slide and replay from the start. The
|
|
2563
|
+
* controller builds the timeline engine (expanding text-build animations) and
|
|
2564
|
+
* derives keyframes CSS, trigger-shape ids, and the tracked element id list.
|
|
2565
|
+
*/
|
|
2566
|
+
reset(options?: {
|
|
2567
|
+
completed?: boolean;
|
|
2568
|
+
stopped?: boolean;
|
|
2569
|
+
}): void;
|
|
2570
|
+
/**
|
|
2571
|
+
* Reveal the next click-group. Returns `true` if a group was revealed, `false`
|
|
2572
|
+
* when playback is complete or animations are disabled (so the caller can fall
|
|
2573
|
+
* through to slide navigation).
|
|
2574
|
+
*/
|
|
2575
|
+
advance(): boolean;
|
|
2576
|
+
/** Play an interactive shape's sequence; `true` when it triggered one. */
|
|
2577
|
+
handleInteractiveShapeClick(shapeId: string): boolean;
|
|
2578
|
+
/** Play a hover shape's sequence; `true` when it triggered one. */
|
|
2579
|
+
handleHoverStart(shapeId: string): boolean;
|
|
2580
|
+
/** Reset a hover shape's sequence so the next hover replays it. */
|
|
2581
|
+
handleHoverEnd(shapeId: string): void;
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
/**
|
|
2585
|
+
* `PresentationController`: the runes state machine wiring the Svelte viewer's
|
|
2586
|
+
* fullscreen (presentation) mode to the framework-agnostic animation and
|
|
2587
|
+
* slide-transition helpers in `pptx-viewer-shared`.
|
|
2588
|
+
*
|
|
2589
|
+
* It owns:
|
|
2590
|
+
* - an {@link AnimationPlayback} for the current slide's click-stepped element
|
|
2591
|
+
* builds, and
|
|
2592
|
+
* - the transient slide-transition state (outgoing + incoming slide + the
|
|
2593
|
+
* resolved transition) rendered by `PresentationTransitionOverlay`.
|
|
2594
|
+
*
|
|
2595
|
+
* `advance()` implements the on-click contract: reveal the next animation build
|
|
2596
|
+
* first, and only advance the slide once the slide's builds are exhausted.
|
|
2597
|
+
* `onSlideChange` / `start` / `stop` are driven from a `$effect` in the viewer
|
|
2598
|
+
* (see `usePresentationEffects`) as the fullscreen flag and current slide move.
|
|
2599
|
+
*
|
|
2600
|
+
* Matches the Vue binding's presentation-mode behaviour (its parity bar):
|
|
2601
|
+
* click-stepped element animations, CSS-driven slide transitions on every slide
|
|
2602
|
+
* change, entrance elements hidden until revealed. Since the native-timing
|
|
2603
|
+
* migration it also drives staged chart / SmartArt builds (`p:bldChart` /
|
|
2604
|
+
* `p:bldDgm`), `p:animClr` colour animations, withPrevious / afterPrevious
|
|
2605
|
+
* auto-advance, and interactive / hover trigger sequences. Still no presenter
|
|
2606
|
+
* view (React-only).
|
|
2607
|
+
*/
|
|
2608
|
+
interface TransitionState {
|
|
2609
|
+
/** The outgoing (previous) slide, rendered in the exit layer. */
|
|
2610
|
+
outgoing: PptxSlide | undefined;
|
|
2611
|
+
/** The incoming (new) slide, rendered in the entrance layer. */
|
|
2612
|
+
incoming: PptxSlide | undefined;
|
|
2613
|
+
/** The incoming slide's transition (drives the CSS animation shorthands). */
|
|
2614
|
+
transition: PptxSlideTransition;
|
|
2615
|
+
}
|
|
2616
|
+
interface PresentationControllerDeps {
|
|
2617
|
+
/** The live, editable slide array (single source of truth). */
|
|
2618
|
+
getSlides(): PptxSlide[];
|
|
2619
|
+
/** The active slide index (0-based). */
|
|
2620
|
+
getCurrentIndex(): number;
|
|
2621
|
+
/** Navigate to a slide index (clamped by the caller's viewer state). */
|
|
2622
|
+
navigate(index: number): void;
|
|
2623
|
+
/** Presentation-level switch parsed from `p:showPr`. */
|
|
2624
|
+
getShowWithAnimation?(): boolean | undefined;
|
|
2625
|
+
/** Host-provided action-sound player (resolves + plays embedded sounds). */
|
|
2626
|
+
onPlayActionSound?: (soundPath: string) => void;
|
|
2627
|
+
/** The live presentation stage root, to scope media-command lookups to. */
|
|
2628
|
+
getFrameRoot?(): HTMLElement | null;
|
|
2629
|
+
/**
|
|
2630
|
+
* The slide canvas size (px), for a `p:anim` formula needing the animated
|
|
2631
|
+
* shape's real box (e.g. Grow And Turn's `-#ppt_w/2` fly-in).
|
|
2632
|
+
*/
|
|
2633
|
+
getCanvasSize?(): {
|
|
2634
|
+
width: number;
|
|
2635
|
+
height: number;
|
|
2636
|
+
} | undefined;
|
|
2637
|
+
/** The deck's resolved theme colour map, for a scheme-colour (`a:schemeClr`) animation stop. */
|
|
2638
|
+
getThemeColorMap?(): Readonly<Record<string, string>> | undefined;
|
|
2639
|
+
/** End the show (host leaves presentation mode). */
|
|
2640
|
+
exit?(): void;
|
|
2641
|
+
/** `p:showPr` "end with black slide"; defaults to on, like PowerPoint. */
|
|
2642
|
+
getEndWithBlackSlide?(): boolean | undefined;
|
|
2643
|
+
/**
|
|
2644
|
+
* `viewerOptions.advanced.pixelateMosaicAnimation`. `true` plays the
|
|
2645
|
+
* blocky mosaic reveal for `p:animEffect/@filter="pixelate"`; omitted or
|
|
2646
|
+
* `false` (the default, matching PowerPoint's own behaviour) snaps the
|
|
2647
|
+
* element to its end state. See `resolveFilterEffect`'s doc in
|
|
2648
|
+
* `pptx-viewer-shared`'s `animation-filter-effects.ts`.
|
|
2649
|
+
*/
|
|
2650
|
+
getPixelateMosaicAnimation?(): boolean | undefined;
|
|
2651
|
+
/**
|
|
2652
|
+
* Slide Show > Set Up Show > "Loop continuously until 'Esc'"
|
|
2653
|
+
* (`p:presentationPr/@loopContinuously`), or the implicit loop of a kiosk
|
|
2654
|
+
* (`showType === 'kiosk'`) show. When true, advancing past the last slide
|
|
2655
|
+
* wraps to the show's first slide instead of raising the black end screen
|
|
2656
|
+
* or exiting.
|
|
2657
|
+
*/
|
|
2658
|
+
getLoopContinuously?(): boolean | undefined;
|
|
2659
|
+
/**
|
|
2660
|
+
* Membership of the custom show the user selected, or null/undefined for the
|
|
2661
|
+
* whole deck. Restricts and reorders the show; hiding still wins over it.
|
|
2662
|
+
*/
|
|
2663
|
+
getActiveCustomShow?(): {
|
|
2664
|
+
slideRIds: string[];
|
|
2665
|
+
} | null | undefined;
|
|
2666
|
+
/**
|
|
2667
|
+
* Trust Center gate for an on-slide Action Setting that opens an external
|
|
2668
|
+
* URL (Options > Trust Center > "Confirm before opening external
|
|
2669
|
+
* hyperlinks"). Forwarded to `PresentationActionRunner.confirmUrl`;
|
|
2670
|
+
* omitted opens unconditionally.
|
|
2671
|
+
*/
|
|
2672
|
+
confirmUrl?(url: string): boolean;
|
|
2673
|
+
/**
|
|
2674
|
+
* The `p:showPr/p:sldRg` authored slide-range restriction (deck opens into
|
|
2675
|
+
* slides `fromIndex..toIndex` rather than the whole deck), when no custom
|
|
2676
|
+
* show is active. `resolveShowSlideIndexes` applies hiding and the active
|
|
2677
|
+
* custom show first, same as `getActiveCustomShow`; this is the third,
|
|
2678
|
+
* lowest-precedence restriction.
|
|
2679
|
+
*/
|
|
2680
|
+
getAuthoredRange?(): AuthoredSlideRange | null | undefined;
|
|
2681
|
+
/**
|
|
2682
|
+
* The deck's custom shows, for `ppaction://customshow?id=<id>` (wave-4
|
|
2683
|
+
* B7): the runner resolves `id` against this list to find the show's
|
|
2684
|
+
* membership.
|
|
2685
|
+
*/
|
|
2686
|
+
getCustomShows?(): readonly PptxCustomShow[];
|
|
2687
|
+
/** Current active custom show id (or null for the whole deck), read back by `returnAfter`. */
|
|
2688
|
+
getActiveCustomShowId?(): string | null;
|
|
2689
|
+
/** Switch the active custom show (mirrors {@link getActiveCustomShow}'s source of truth). */
|
|
2690
|
+
setActiveCustomShowId?(id: string | null): void;
|
|
2691
|
+
}
|
|
2692
|
+
declare class PresentationController {
|
|
2693
|
+
#private;
|
|
2694
|
+
readonly playback: AnimationPlayback;
|
|
2695
|
+
constructor(deps: PresentationControllerDeps);
|
|
2696
|
+
/**
|
|
2697
|
+
* `a:hlinkHover/@highlightClick`: the same flash as the click version, held
|
|
2698
|
+
* for the duration of the hover rather than timed. Called from
|
|
2699
|
+
* `attachPresentationTriggerListeners`'s `mouseover`, alongside (but
|
|
2700
|
+
* independent of) the native-animation hover trigger it already drives.
|
|
2701
|
+
*/
|
|
2702
|
+
applyHoverHighlight(target: unknown): void;
|
|
2703
|
+
/** Clear whatever `applyHoverHighlight` last set, on leaving the stage. */
|
|
2704
|
+
clearHoverHighlight(): void;
|
|
2705
|
+
/** The active slide-transition overlay state, or `null` when none is playing. */
|
|
2706
|
+
/** Whether the black "End of slide show" screen should be rendered. */
|
|
2707
|
+
get endOfShowVisible(): boolean;
|
|
2708
|
+
get transition(): TransitionState | null;
|
|
2709
|
+
/** The `ppaction://program` notices currently up, oldest first. */
|
|
2710
|
+
get runProgramNotices(): readonly RunProgramNotice[];
|
|
2711
|
+
/** Dismiss one run-program notice by id. */
|
|
2712
|
+
dismissRunProgramNotice(id: string): void;
|
|
2713
|
+
/** Reactive per-element native-animation state (visibility, build, colour). */
|
|
2714
|
+
get elementStates(): Map<string, ElementAnimationState>;
|
|
2715
|
+
/** The per-slide native-animation `@keyframes` CSS to inject. */
|
|
2716
|
+
get keyframesCss(): string;
|
|
2717
|
+
/** Shape ids that trigger an interactive (`onShapeClick`) sequence. */
|
|
2718
|
+
get interactiveTriggerShapeIds(): ReadonlySet<string>;
|
|
2719
|
+
/** Shape ids that trigger a hover (`onHover`) sequence. */
|
|
2720
|
+
get hoverTriggerShapeIds(): ReadonlySet<string>;
|
|
2721
|
+
/** Play an interactive shape's sequence; `true` when it triggered one. */
|
|
2722
|
+
handleInteractiveShapeClick(shapeId: string): boolean;
|
|
2723
|
+
/** Play a hover shape's sequence; `true` when it triggered one. */
|
|
2724
|
+
handleHoverStart(shapeId: string): boolean;
|
|
2725
|
+
/** Reset a hover shape's sequence so the next hover replays it. */
|
|
2726
|
+
handleHoverEnd(shapeId: string): void;
|
|
2727
|
+
/**
|
|
2728
|
+
* A click landing on the running show's stage.
|
|
2729
|
+
*
|
|
2730
|
+
* PowerPoint reads an on-slide Action Setting (`a:hlinkClick`) first: the
|
|
2731
|
+
* shape's link runs and the show does NOT also step on. Only what is left
|
|
2732
|
+
* over reaches {@link advance}. Without this a deck navigated by its own
|
|
2733
|
+
* on-slide buttons (a wheel of `ppaction://hlinksldjump` slices, say) went to
|
|
2734
|
+
* the NEXT slide on every click instead of to the one that was clicked.
|
|
2735
|
+
*/
|
|
2736
|
+
handleStageClick(target: unknown): void;
|
|
2737
|
+
/**
|
|
2738
|
+
* The on-click advance contract: reveal the next element-animation build if
|
|
2739
|
+
* one remains, otherwise advance to the next slide.
|
|
2740
|
+
*
|
|
2741
|
+
* `fromClick` marks a click/tap/swipe on the slide, which is PowerPoint's
|
|
2742
|
+
* "on mouse click" advance: it still steps the remaining animation builds,
|
|
2743
|
+
* but once they are exhausted it advances the slide only when the current
|
|
2744
|
+
* slide's transition allows it (advanceOnClick !== false). Keyboard and the
|
|
2745
|
+
* on-screen next button pass `fromClick = false` and are never gated.
|
|
2746
|
+
*/
|
|
2747
|
+
advance(fromClick?: boolean): void;
|
|
2748
|
+
/**
|
|
2749
|
+
* Backward slide change, skipping hidden slides. Called only after
|
|
2750
|
+
* {@link retreat} declines (it owns the end screen and the replay of a slide
|
|
2751
|
+
* entered backward). Stays put at the start of the show: PowerPoint never
|
|
2752
|
+
* wraps a backward press off the first slide.
|
|
2753
|
+
*/
|
|
2754
|
+
previousSlide(): void;
|
|
2755
|
+
/**
|
|
2756
|
+
* The deck index the show should OPEN on when entered from `activeIndex`
|
|
2757
|
+
* (wave-4 B1): `activeIndex` itself when the show includes it ("From
|
|
2758
|
+
* Current Slide"), otherwise the nearest show slide, per
|
|
2759
|
+
* `presentationEntrySlideIndex`. Every entry point (status-bar button,
|
|
2760
|
+
* ribbon From Current Slide, `setMode('present')`, the mobile toolbar) must
|
|
2761
|
+
* seed the presentation index with this instead of the raw active slide, or
|
|
2762
|
+
* a deck authored with a `p:showPr/p:sldRg` range (or a custom show that
|
|
2763
|
+
* excludes the active slide) opens on a slide the show does not include.
|
|
2764
|
+
*/
|
|
2765
|
+
entryIndex(activeIndex: number): number;
|
|
2766
|
+
/** Home: the show's first slide, which is not slide 1 when that one is hidden. */
|
|
2767
|
+
firstSlide(): void;
|
|
2768
|
+
/** End: the show's last slide, skipping trailing hidden slides. */
|
|
2769
|
+
lastSlide(): void;
|
|
2770
|
+
/**
|
|
2771
|
+
* Handle a Slide Zoom / Section Zoom / Summary Zoom tile click: navigates
|
|
2772
|
+
* to the target slide, playing the zoom's own `zmPr/@transitionDur` when
|
|
2773
|
+
* authored, and (when `returnToParent` is set) arms an excursion so the
|
|
2774
|
+
* next forward {@link advance} past the target's range returns to the
|
|
2775
|
+
* slide the zoom was clicked from instead of continuing linearly through
|
|
2776
|
+
* the deck.
|
|
2777
|
+
*/
|
|
2778
|
+
navigateToZoomTarget(target: ZoomNavigationTarget): void;
|
|
2779
|
+
/**
|
|
2780
|
+
* Raise the black end-of-slide-show screen without ending anything.
|
|
2781
|
+
*
|
|
2782
|
+
* Used by an audience display when the presenter ends the session and the
|
|
2783
|
+
* browser refuses to close the tab: the room sees the end screen, never the
|
|
2784
|
+
* editor.
|
|
2785
|
+
*/
|
|
2786
|
+
showEndOfShow(): void;
|
|
2787
|
+
/**
|
|
2788
|
+
* Backward input. Dismisses the end screen when it is up; on a slide entered
|
|
2789
|
+
* backward it replays that slide's builds from the start rather than leaving
|
|
2790
|
+
* it, so a presenter who overshot can watch the build again (PowerPoint).
|
|
2791
|
+
* Returns true when the press was consumed here.
|
|
2792
|
+
*/
|
|
2793
|
+
retreat(): boolean;
|
|
2794
|
+
/** Entering presentation: seed builds for the current slide, drop any overlay. */
|
|
2795
|
+
start(): void;
|
|
2796
|
+
/** Leaving presentation: clear timers, reset builds, drop any overlay. */
|
|
2797
|
+
stop(): void;
|
|
2798
|
+
/**
|
|
2799
|
+
* The presented slide changed: reset the new slide's builds and, when the
|
|
2800
|
+
* incoming slide carries a real transition, play it over the frame.
|
|
2801
|
+
*/
|
|
2802
|
+
onSlideChange(previousIndex: number, nextIndex: number): void;
|
|
2803
|
+
/** The transition overlay finished its animation: drop it. */
|
|
2804
|
+
endTransition(): void;
|
|
2805
|
+
}
|
|
2806
|
+
|
|
2807
|
+
interface PresenterSessionOptions {
|
|
2808
|
+
getSource: () => Uint8Array | ArrayBuffer | null | undefined;
|
|
2809
|
+
getSlideIndex: () => number;
|
|
2810
|
+
onAudienceSlide: (index: number) => void;
|
|
2811
|
+
onAudienceExit: () => void;
|
|
2812
|
+
}
|
|
2813
|
+
declare class PresenterSession {
|
|
2814
|
+
private readonly options;
|
|
2815
|
+
audienceOpen: boolean;
|
|
2816
|
+
snapshot: PresentationSnapshot;
|
|
2817
|
+
readonly audienceSessionId: string | null;
|
|
2818
|
+
readonly isAudience: boolean;
|
|
2819
|
+
private channel;
|
|
2820
|
+
private audienceWindow;
|
|
2821
|
+
private presenterSessionId;
|
|
2822
|
+
private sequence;
|
|
2823
|
+
constructor(options: PresenterSessionOptions);
|
|
2824
|
+
connect(): void;
|
|
2825
|
+
openAudience(): boolean;
|
|
2826
|
+
/**
|
|
2827
|
+
* Move the console to the audience screen and the audience display to this
|
|
2828
|
+
* one (the presenter console's "Swap Displays"). Resolves `false` when there
|
|
2829
|
+
* is no audience window, when the browser withholds the Window Management
|
|
2830
|
+
* permission, or when both windows already sit on the same screen, which is
|
|
2831
|
+
* why the strip's control is disabled until a display is open.
|
|
2832
|
+
*/
|
|
2833
|
+
swapDisplays(): Promise<boolean>;
|
|
2834
|
+
sync(slideIndex?: number): void;
|
|
2835
|
+
updateSnapshot(patch: Partial<PresentationSnapshot>): void;
|
|
2836
|
+
closeAudience(): void;
|
|
2837
|
+
dispose(): void;
|
|
2838
|
+
private getChannel;
|
|
2839
|
+
}
|
|
2840
|
+
|
|
2841
|
+
/**
|
|
2842
|
+
* autosave-recovery.svelte.ts: the Svelte adapter of the shared crash-recovery
|
|
2843
|
+
* offer (`createAutosaveRecoveryController` in `ooxml-ui/pptx`).
|
|
2844
|
+
*
|
|
2845
|
+
* It registers its own probing `$effect` in the constructor, so a caller only
|
|
2846
|
+
* has to construct it during component initialisation and render `prompt` when
|
|
2847
|
+
* it is non-null. The probe runs once per loaded deck (`getLoadCount`).
|
|
2848
|
+
*/
|
|
2849
|
+
interface AutosaveRecoveryDeps {
|
|
2850
|
+
/** IndexedDB record key (host `filePath`). Nothing to look up without one. */
|
|
2851
|
+
getFilePath: () => string | undefined;
|
|
2852
|
+
/** Public document name rendered in the recovery message. */
|
|
2853
|
+
getFileName?: () => string | undefined;
|
|
2854
|
+
/** Host `storage` prop: recovery snapshots go to its recovery methods when it has them. */
|
|
2855
|
+
getStorage?: () => DocumentStorage | undefined;
|
|
2856
|
+
/**
|
|
2857
|
+
* Whether recovery snapshots are permitted at all, which is the HOST prop
|
|
2858
|
+
* (`autosave !== false`) and not the user's toggle: someone who merely
|
|
2859
|
+
* switched AutoSave off should still be offered the pre-crash snapshot that
|
|
2860
|
+
* was written while it was on.
|
|
2861
|
+
*/
|
|
2862
|
+
getAutosaveAllowed: () => boolean;
|
|
2863
|
+
getLoading: () => boolean;
|
|
2864
|
+
getError: () => string | null;
|
|
2865
|
+
getSlideCount: () => number;
|
|
2866
|
+
/** Monotonic load counter: the probe runs once per loaded deck. */
|
|
2867
|
+
getLoadCount: () => number;
|
|
2868
|
+
/** The loader's own load path, the same one the backstage recent list uses. */
|
|
2869
|
+
load: (bytes: Uint8Array) => Promise<void> | void;
|
|
2870
|
+
/** The host's `onautosaverecovery`: called with the record when a snapshot is offered. */
|
|
2871
|
+
onOffered?: (record: AutosaveRecord) => void;
|
|
2872
|
+
}
|
|
2873
|
+
declare class AutosaveRecoveryController {
|
|
2874
|
+
#private;
|
|
2875
|
+
constructor(deps: AutosaveRecoveryDeps);
|
|
2876
|
+
/** The prompt to render, or null when there is nothing to recover (reactive). */
|
|
2877
|
+
get prompt(): AutosaveRecoveryPrompt | null;
|
|
2878
|
+
/** The destructive delete is still pending (reactive). */
|
|
2879
|
+
get discarding(): boolean;
|
|
2880
|
+
/** Take the snapshot and load its bytes in place without deleting it. */
|
|
2881
|
+
restore(): Promise<void>;
|
|
2882
|
+
/** Decline the snapshot: delete it, and never load it. */
|
|
2883
|
+
discard(): Promise<void>;
|
|
2884
|
+
/** Close the prompt without touching the stored snapshot. */
|
|
2885
|
+
dismiss(): void;
|
|
2886
|
+
}
|
|
2887
|
+
|
|
2888
|
+
/**
|
|
2889
|
+
* CompatToastsState: the fidelity-loss toast stack shown after a load whose
|
|
2890
|
+
* parse reported `PptxCompatibilityWarning`s (unmodelled markup, external
|
|
2891
|
+
* image references, a chart workbook that could not be written back, and so
|
|
2892
|
+
* on). Svelte port of Vue's `useCompatibilityToasts` composable.
|
|
2893
|
+
*
|
|
2894
|
+
* Toasts do not auto-hide (they are load diagnostics, not transient
|
|
2895
|
+
* notices): they persist until dismissed, and `reset()` clears them for a
|
|
2896
|
+
* newly loaded document, called from the same load-commit hook that resets
|
|
2897
|
+
* the read-only recommendation.
|
|
2898
|
+
*/
|
|
2899
|
+
declare class CompatToastsState {
|
|
2900
|
+
#private;
|
|
2901
|
+
constructor(deps: {
|
|
2902
|
+
getWarnings(): readonly PptxCompatibilityWarning[];
|
|
2903
|
+
});
|
|
2904
|
+
/** Every toast this load produced, dismissed ones excluded, capped at the visible limit. */
|
|
2905
|
+
get visibleToasts(): CompatibilityWarningToast[];
|
|
2906
|
+
/** How many more toasts exist beyond the visible limit. */
|
|
2907
|
+
get overflowCount(): number;
|
|
2908
|
+
dismiss(id: string): void;
|
|
2909
|
+
dismissAll(): void;
|
|
2910
|
+
/** Clear the dismissal state (and any notice) for a newly loaded document. */
|
|
2911
|
+
reset(): void;
|
|
2912
|
+
/** Show a notice (a failed Save) in the stack; shown again if it was dismissed. */
|
|
2913
|
+
notify(toast: CompatibilityWarningToast): void;
|
|
2914
|
+
}
|
|
2915
|
+
|
|
2916
|
+
/** Live viewer accessors + the panel-open hook the controller closes over. */
|
|
2917
|
+
interface AiPanelControllerDeps {
|
|
2918
|
+
getActiveSlideIndex(): number;
|
|
2919
|
+
getSelectedElementId(): string | null;
|
|
2920
|
+
getSelectedElementIds(): readonly string[];
|
|
2921
|
+
/** The primary selected element, for building the "Fix with AI" directive. */
|
|
2922
|
+
getSelectedElement(): PptxElement | undefined;
|
|
2923
|
+
/** Open the panel (askAboutSelection / fixSelection / startPicking need it). */
|
|
2924
|
+
openPanel(): void;
|
|
2925
|
+
}
|
|
2926
|
+
declare class AiPanelController {
|
|
2927
|
+
#private;
|
|
2928
|
+
constructor(deps: AiPanelControllerDeps);
|
|
2929
|
+
/** Pinned focus override (null follows the live selection). */
|
|
2930
|
+
get pinnedFocus(): PptxAiFocusedTarget[] | null;
|
|
2931
|
+
/** One-shot composer prefill. `nonce` bumps on every ask/fix. */
|
|
2932
|
+
get prefill(): {
|
|
2933
|
+
text: string;
|
|
2934
|
+
nonce: number;
|
|
2935
|
+
};
|
|
2936
|
+
/** True while the user is picking element(s) on the canvas for the assistant. */
|
|
2937
|
+
get pickMode(): boolean;
|
|
2938
|
+
/** The elements the user has explicitly handed to the assistant. */
|
|
2939
|
+
get pickTargets(): PptxAiFocusedTarget[];
|
|
2940
|
+
/** The batch of just-applied element changes the canvas should animate. */
|
|
2941
|
+
get changeBatch(): AiChangeBatch | null;
|
|
2942
|
+
/** Focused targets derived live from the current canvas selection. */
|
|
2943
|
+
get liveFocusTargets(): PptxAiFocusedTarget[];
|
|
2944
|
+
/** True when there are explicit picks (they win over a pin / live selection). */
|
|
2945
|
+
get hasPicks(): boolean;
|
|
2946
|
+
/** The targets the assistant should scope to: picks > pin > live selection. */
|
|
2947
|
+
get effectiveTargets(): PptxAiFocusedTarget[];
|
|
2948
|
+
/** Whether a pin is currently the active focus (no picks override it). */
|
|
2949
|
+
get isPinned(): boolean;
|
|
2950
|
+
/** Element rings the canvas should draw (picks + the live tool focus). */
|
|
2951
|
+
get canvasHighlights(): AiCanvasHighlight[];
|
|
2952
|
+
/** True while the canvas should tween colour changes (AI is active). */
|
|
2953
|
+
get canvasAnimating(): boolean;
|
|
2954
|
+
pinFocus(): void;
|
|
2955
|
+
clearPinnedFocus(): void;
|
|
2956
|
+
/** Open the panel scoped to the current selection, empty composer (focused). */
|
|
2957
|
+
askAboutSelection(): void;
|
|
2958
|
+
/** Open the panel scoped to the current selection, prefilled fix directive. */
|
|
2959
|
+
fixSelection(): void;
|
|
2960
|
+
/** Enter pick mode (the next canvas element clicks become picks). */
|
|
2961
|
+
startPicking(): void;
|
|
2962
|
+
/** Leave pick mode without clearing the accumulated picks. */
|
|
2963
|
+
stopPicking(): void;
|
|
2964
|
+
/** Add one clicked canvas element to the pick set (and highlight it). */
|
|
2965
|
+
addPick(slideIndex: number, elementId: string): void;
|
|
2966
|
+
/** Empty the pick set and leave pick mode. */
|
|
2967
|
+
clearPicks(): void;
|
|
2968
|
+
/**
|
|
2969
|
+
* Flash a transient "the AI is working on this" highlight for a running tool,
|
|
2970
|
+
* and enable colour tweening for a short settle window. Pass `null` to just
|
|
2971
|
+
* enable tweening (e.g. a theme-colour edit with no single element target).
|
|
2972
|
+
*/
|
|
2973
|
+
flashToolTarget(target: ToolCanvasTarget | null): void;
|
|
2974
|
+
/**
|
|
2975
|
+
* Push (or clear) the change batch the AI apply path published, so the canvas
|
|
2976
|
+
* overlay animates the just-applied edit. Pass `null` to clear once settled.
|
|
2977
|
+
*/
|
|
2978
|
+
showChangeBatch(batch: AiChangeBatch | null): void;
|
|
2979
|
+
/** Cancel the pending flash timer (call on teardown). */
|
|
2980
|
+
dispose(): void;
|
|
2981
|
+
}
|
|
2982
|
+
|
|
2983
|
+
/**
|
|
2984
|
+
* Reactive load pipeline for the Svelte viewer: the runes port of the Vue
|
|
2985
|
+
* `useLoadContent` composable's viewer subset.
|
|
2986
|
+
*
|
|
2987
|
+
* All heavy lifting (ZIP, XML parse, theme/master/layout resolution, chart
|
|
2988
|
+
* enrichment via `PptxSlideLoaderService.enrichChartData`) happens inside
|
|
2989
|
+
* `PptxHandler.load` in `pptx-viewer-core`; this class only wires the async
|
|
2990
|
+
* load into Svelte reactivity and manages Blob-URL / handler lifecycle.
|
|
2991
|
+
*/
|
|
2992
|
+
declare class PresentationLoader {
|
|
2993
|
+
#private;
|
|
2994
|
+
/** Parsed slides with lazily-loaded image URLs patched in. */
|
|
2995
|
+
slides: PptxSlide[];
|
|
2996
|
+
/** Parsed slide-master hierarchy for the dedicated master workspace. */
|
|
2997
|
+
slideMasters: PptxSlideMaster[];
|
|
2998
|
+
notesMaster: PptxNotesMaster | undefined;
|
|
2999
|
+
handoutMaster: PptxHandoutMaster | undefined;
|
|
3000
|
+
sections: PptxSection[];
|
|
3001
|
+
headerFooter: PptxHeaderFooter;
|
|
3002
|
+
firstSlideNumber: number | undefined;
|
|
3003
|
+
presentationProperties: PptxPresentationProperties;
|
|
3004
|
+
/**
|
|
3005
|
+
* View properties (`ppt/viewProps.xml`, `p:viewPr`): grid spacing, snap /
|
|
3006
|
+
* guide toggles, last view, splitter state, etc. `gridSpacing` lives here,
|
|
3007
|
+
* NOT on `presentationProperties` -- `p:gridSpacing` is a child of
|
|
3008
|
+
* `p:viewPr`, and a real PowerPoint file never populates it under
|
|
3009
|
+
* `p:presentationPr`.
|
|
3010
|
+
*/
|
|
3011
|
+
viewProperties: PptxViewProperties | undefined;
|
|
3012
|
+
/** Write-protection verifier from `p:modifyVerifier` (`presentation.xml`). */
|
|
3013
|
+
modifyVerifier: PptxModifyVerifier | undefined;
|
|
3014
|
+
/**
|
|
3015
|
+
* Every compatibility warning the load (and any save/patch so far this
|
|
3016
|
+
* session) has raised, from `handler.getCompatibilityWarnings()`: unmodelled
|
|
3017
|
+
* markup round-tripped only via `rawXml`, an external image reference that
|
|
3018
|
+
* cannot be embedded, and so on. Feeds the compat-toast stack (wave 4 #3).
|
|
3019
|
+
*/
|
|
3020
|
+
compatibilityWarnings: PptxCompatibilityWarning[];
|
|
3021
|
+
customShows: PptxCustomShow[];
|
|
3022
|
+
/** Modern comment authors (`ppt/authors.xml`, Office 2021 `p188:author`), for the @-mention typeahead (wave-4 B5). */
|
|
3023
|
+
modernCommentAuthors: PptxModernCommentAuthor[];
|
|
3024
|
+
/** Legacy comment authors (`ppt/commentAuthors.xml`), round-tripped and offered to the typeahead alongside the modern list. */
|
|
3025
|
+
commentAuthors: PptxCommentAuthor[];
|
|
3026
|
+
coreProperties: PptxCoreProperties | undefined;
|
|
3027
|
+
appProperties: PptxAppProperties | undefined;
|
|
3028
|
+
customProperties: PptxCustomProperty[];
|
|
3029
|
+
/** Parsed `ppt/tags/*.xml` collections, editable in the inspector's Tags section. */
|
|
3030
|
+
tagCollections: PptxTagCollection[];
|
|
3031
|
+
embeddedFonts: PptxEmbeddedFont[];
|
|
3032
|
+
hasDigitalSignatures: boolean;
|
|
3033
|
+
digitalSignatureCount: number;
|
|
3034
|
+
isPasswordProtected: boolean;
|
|
3035
|
+
/** Whether the loaded package contains a VBA project. */
|
|
3036
|
+
hasMacros: boolean;
|
|
3037
|
+
notesCanvasSize: CanvasSize | undefined;
|
|
3038
|
+
/** Packaged theme parts (`ppt/theme/*.xml`) selectable in the inspector. */
|
|
3039
|
+
themeOptions: PptxThemeOption[];
|
|
3040
|
+
/** Slide canvas size in pixels. */
|
|
3041
|
+
canvasSize: CanvasSize;
|
|
3042
|
+
/**
|
|
3043
|
+
* The deck's `p:sldSz` in EMU, seeded from the parse and re-written by the
|
|
3044
|
+
* inspector's Slide Size preset / orientation controls.
|
|
3045
|
+
*
|
|
3046
|
+
* Held alongside {@link canvasSize} rather than derived from it because the
|
|
3047
|
+
* pixel size is lossy: Ledger is 12179300 EMU (1278.5px), so a round-trip
|
|
3048
|
+
* through an integer pixel would move it 6350 EMU and cost the deck its
|
|
3049
|
+
* `ppSlideSizeLedgerPaper` identity. `resolveSlideSizeSelection` decides
|
|
3050
|
+
* which of the two wins at save time.
|
|
3051
|
+
*/
|
|
3052
|
+
slideSize: SlideSizeEmu | undefined;
|
|
3053
|
+
/** Archive-path -> displayable URL map for media + poster frames. */
|
|
3054
|
+
mediaDataUrls: Map<string, string>;
|
|
3055
|
+
/** Presentation theme colours used to resolve scheme-based table styles. */
|
|
3056
|
+
colorScheme: PptxThemeColorScheme | undefined;
|
|
3057
|
+
presentationTheme: PptxTheme | undefined;
|
|
3058
|
+
/** Parsed presentation table-style definitions keyed by style id. */
|
|
3059
|
+
tableStyleMap: ParsedTableStyleMap | undefined;
|
|
3060
|
+
/** `ppt/tableStyles.xml`'s `<a:tblStyleLst @def>` default style GUID. */
|
|
3061
|
+
tableStylesDefaultId: string | undefined;
|
|
3062
|
+
/**
|
|
3063
|
+
* Style GUIDs deleted from `tableStyleMap` via the table style editor,
|
|
3064
|
+
* pending removal from `ppt/tableStyles.xml` on the next save. See
|
|
3065
|
+
* `tableStyleSaveOptions` / `applyTableStyleDelete` in `pptx-viewer-shared`.
|
|
3066
|
+
*/
|
|
3067
|
+
tableStylesToDelete: string[];
|
|
3068
|
+
/** True while a load is in flight. */
|
|
3069
|
+
loading: boolean;
|
|
3070
|
+
/** Error message from the last failed load, or null. */
|
|
3071
|
+
error: string | null;
|
|
3072
|
+
/** True when the file is password-protected and could not be opened. */
|
|
3073
|
+
isEncrypted: boolean;
|
|
3074
|
+
/** The live `PptxHandler` for the loaded file (or null). */
|
|
3075
|
+
handler: PptxHandler | null;
|
|
3076
|
+
/** Incremented after each successful load (drives `load` callbacks). */
|
|
3077
|
+
loadCount: number;
|
|
3078
|
+
/**
|
|
3079
|
+
* Why the deck now loaded was loaded. A collaboration room may replace the
|
|
3080
|
+
* host's own `source` (a late joiner's bootstrap) but never a file the user
|
|
3081
|
+
* opened during the session (`shouldRoomSlidesReplaceLoad`).
|
|
3082
|
+
*/
|
|
3083
|
+
loadOrigin: CollabLoadOrigin;
|
|
3084
|
+
/**
|
|
3085
|
+
* Options-derived load flags for `PptxHandler.load`: Trust Center > "Allow
|
|
3086
|
+
* external content", which core reads as `allowExternalImages`, and the
|
|
3087
|
+
* host `limits` prop. The composition root overwrites this once
|
|
3088
|
+
* `ViewerOptionsState` exists, so every load call site (open file, restore
|
|
3089
|
+
* version, collaboration bootstrap, ...) picks up the live Trust Center
|
|
3090
|
+
* value without threading options through each of them individually. Left
|
|
3091
|
+
* as its safe default (external images blocked) for callers that never set
|
|
3092
|
+
* it, e.g. this class used stand-alone in a test.
|
|
3093
|
+
*/
|
|
3094
|
+
getLoadOptions: () => Pick<PptxHandlerLoadOptions, 'allowExternalImages' | 'limits'>;
|
|
3095
|
+
/**
|
|
3096
|
+
* Translates the load-error text for a deck over a load limit (host
|
|
3097
|
+
* `limits` prop). Set by the composition root; left unset, the error keeps
|
|
3098
|
+
* the core's English message.
|
|
3099
|
+
*/
|
|
3100
|
+
translate: LoadLimitTranslate | undefined;
|
|
3101
|
+
/** Parse a `.pptx` buffer into reactive viewer state. */
|
|
3102
|
+
load(raw: Uint8Array | ArrayBuffer, origin?: CollabLoadOrigin): Promise<void>;
|
|
3103
|
+
/**
|
|
3104
|
+
* Replace the live handler with one core rebuilt (master-view CRUD returns
|
|
3105
|
+
* a fresh package rather than a patch). Disposes the previous handler; the
|
|
3106
|
+
* Blob URLs stay valid because the media parts are unchanged.
|
|
3107
|
+
*/
|
|
3108
|
+
adoptHandler(next: PptxHandler, keepPrevious?: boolean, data?: PptxData): void;
|
|
3109
|
+
/** Cancel in-flight loads, revoke Blob URLs, dispose the handler. */
|
|
3110
|
+
dispose(): void;
|
|
3111
|
+
}
|
|
3112
|
+
|
|
3113
|
+
interface AiCluster {
|
|
3114
|
+
/** The SDK-free bridge handed to the (lazily imported) chat panel. */
|
|
3115
|
+
readonly bridge: PptxAiBridge;
|
|
3116
|
+
/** On-canvas scope: focus targets, pick mode, live tool-focus highlights. */
|
|
3117
|
+
readonly panel: AiPanelController;
|
|
3118
|
+
/** Whether the right-side chat panel is open (ribbon Sparkles toggle). */
|
|
3119
|
+
panelOpen: boolean;
|
|
3120
|
+
/** Element rings to draw on the active slide; empty when AI is disabled. */
|
|
3121
|
+
readonly canvasHighlights: readonly AiCanvasHighlight[];
|
|
3122
|
+
}
|
|
3123
|
+
|
|
3124
|
+
/**
|
|
3125
|
+
* ReadOnlyRecommendationState: the Trust-Center-style banner shown when a
|
|
3126
|
+
* loaded deck asks to be opened read-only (`p:modifyVerifier`, or `docProps/
|
|
3127
|
+
* custom.xml`'s "Mark as Final"), and the lock that goes with it. Svelte port
|
|
3128
|
+
* of Vue's `useReadOnlyRecommendation` composable.
|
|
3129
|
+
*
|
|
3130
|
+
* `locked` is meant to be ANDed into the SAME `getEditable` gate the viewer
|
|
3131
|
+
* already reads (Protected View, collaboration read-only), not a second
|
|
3132
|
+
* editability mechanism. `reset()` is called from the load-commit hook
|
|
3133
|
+
* (`onContentApplied`) so a newly opened document is evaluated fresh even if
|
|
3134
|
+
* a previous one was unlocked.
|
|
3135
|
+
*
|
|
3136
|
+
* The session (banner hidden, Edit anyway, the prompt and its check) and its
|
|
3137
|
+
* transitions are the shared `read-only-session` model; this keeps it in
|
|
3138
|
+
* `$state.raw` (each transition replaces the whole value).
|
|
3139
|
+
*/
|
|
3140
|
+
declare class ReadOnlyRecommendationState {
|
|
3141
|
+
#private;
|
|
3142
|
+
constructor(deps: {
|
|
3143
|
+
getModifyVerifier(): PptxModifyVerifier | undefined;
|
|
3144
|
+
getCustomProperties(): PptxCustomProperty[];
|
|
3145
|
+
});
|
|
3146
|
+
/** The current recommendation (`kind: null` when the deck asks for nothing). */
|
|
3147
|
+
get recommendation(): ReadOnlyRecommendation;
|
|
3148
|
+
/** Whether the banner should render. */
|
|
3149
|
+
get showBanner(): boolean;
|
|
3150
|
+
/** Whether editing should currently be blocked because of this recommendation. */
|
|
3151
|
+
get locked(): boolean;
|
|
3152
|
+
/** Whether the inline password prompt should render instead of the two buttons. */
|
|
3153
|
+
get passwordPromptOpen(): boolean;
|
|
3154
|
+
/** Reason the last password attempt failed, or null before any attempt / after success. */
|
|
3155
|
+
get passwordError(): ReadOnlyBannerPasswordError | null;
|
|
3156
|
+
/** True while {@link submitPassword}'s check is in flight (disables the form). */
|
|
3157
|
+
get checkingPassword(): boolean;
|
|
3158
|
+
/**
|
|
3159
|
+
* "Edit anyway": lifts the lock and hides the banner for this document, or
|
|
3160
|
+
* (when `recommendation.requiresPassword` is set) opens the inline
|
|
3161
|
+
* password prompt instead of unlocking immediately.
|
|
3162
|
+
*/
|
|
3163
|
+
editAnyway(): void;
|
|
3164
|
+
/** "Dismiss": hides the banner but leaves the lock (if any) in place. */
|
|
3165
|
+
dismiss(): void;
|
|
3166
|
+
/** Close the password prompt without unlocking. */
|
|
3167
|
+
cancelPasswordPrompt(): void;
|
|
3168
|
+
/** Check `password` against the deck's `modifyVerifier`; unlocks on a match. */
|
|
3169
|
+
submitPassword(password: string): Promise<void>;
|
|
3170
|
+
/** Re-arm the recommendation for a newly loaded document. */
|
|
3171
|
+
reset(): void;
|
|
3172
|
+
}
|
|
3173
|
+
|
|
3174
|
+
/**
|
|
3175
|
+
* ViewerOptionsState: the runes wrapper around the shared File > Options
|
|
3176
|
+
* store. Owns the reactive `options` snapshot (updated via the store's
|
|
3177
|
+
* subscribe callback, persisted by the store to the shared
|
|
3178
|
+
* `pptx-viewer-prefs` localStorage entry) plus the derived behavior values
|
|
3179
|
+
* the viewer wires: history depth, ribbon visibility, print defaults,
|
|
3180
|
+
* screen tips, root classes, trust gates, and feedback sounds.
|
|
3181
|
+
*/
|
|
3182
|
+
declare class ViewerOptionsState {
|
|
3183
|
+
#private;
|
|
3184
|
+
/** Reactive File > Options snapshot; a new object per change. */
|
|
3185
|
+
options: ViewerOptions;
|
|
3186
|
+
constructor(init?: ViewerOptionsStoreInit);
|
|
3187
|
+
/** The legacy six-toggle projection of the current options. */
|
|
3188
|
+
get preferences(): ViewerPreferences;
|
|
3189
|
+
/** Undo depth for the editor history (Advanced > maximum undos). */
|
|
3190
|
+
get historyDepth(): number;
|
|
3191
|
+
/** Ribbon tabs unticked in Customize Ribbon (File never hides). */
|
|
3192
|
+
get hiddenRibbonTabIds(): readonly ToolbarTabId[];
|
|
3193
|
+
/** Print dialog seed, or undefined for "use most recent settings". */
|
|
3194
|
+
get printDefaults(): Partial<PrintSettings> | undefined;
|
|
3195
|
+
/** Viewer-root CSS classes reflecting display-affecting options. */
|
|
3196
|
+
get rootClasses(): string[];
|
|
3197
|
+
setValue(group: ViewerOptionsGroupId, key: string, value: ViewerOptionPrimitive): void;
|
|
3198
|
+
/** Host locks + defaults (from the `customization` prop); see the shared store. */
|
|
3199
|
+
setConstraints(constraints: ViewerOptionsConstraints): void;
|
|
3200
|
+
/** True when the host locked `<group>.<key>`. */
|
|
3201
|
+
isLocked(group: ViewerOptionsGroupId, key: string): boolean;
|
|
3202
|
+
/** Restore a snapshot wholesale (the dialog's Cancel semantics). */
|
|
3203
|
+
restore(snapshot: ViewerOptions): void;
|
|
3204
|
+
setRibbonTabHidden(tabId: ToolbarTabId, hidden: boolean): void;
|
|
3205
|
+
setQuickAccessCommands(commandIds: readonly string[]): void;
|
|
3206
|
+
reset(group?: ViewerOptionsGroupId): void;
|
|
3207
|
+
/**
|
|
3208
|
+
* Push the legacy preference toggles (ribbon View tab, title-bar autosave)
|
|
3209
|
+
* back into the options model. Only writes when a value actually differs,
|
|
3210
|
+
* so the bidirectional sync with `preferences` cannot loop.
|
|
3211
|
+
*/
|
|
3212
|
+
applyPreferences(prefs: ViewerPreferences): void;
|
|
3213
|
+
/** Tooltip text under the current ScreenTip style, or undefined for none. */
|
|
3214
|
+
screenTip(label: string, description?: string, shortcut?: string): string | undefined;
|
|
3215
|
+
/**
|
|
3216
|
+
* Trust Center gate for following an external hyperlink. Returns true when
|
|
3217
|
+
* navigation may proceed (gate off, non-http(s) target, or confirmed).
|
|
3218
|
+
*/
|
|
3219
|
+
confirmHyperlink(href: string, message: string): boolean;
|
|
3220
|
+
/** Accessibility > "feedback with sound" cue for a completed action. */
|
|
3221
|
+
playFeedback(): void;
|
|
3222
|
+
/**
|
|
3223
|
+
* Options > Save > "Save AutoRecover information every N minutes", in
|
|
3224
|
+
* seconds. The autosave cadence whenever the host passed no explicit
|
|
3225
|
+
* `autosaveIntervalMs`; the host-vs-user precedence itself is decided by
|
|
3226
|
+
* `resolveAutosaveIntervalMs` in shared, not re-invented here.
|
|
3227
|
+
*/
|
|
3228
|
+
get autosaveIntervalSeconds(): number;
|
|
3229
|
+
/** Wire the host `storage` prop, so the cache sweeps run against the host's recovery store. */
|
|
3230
|
+
bindStorage(storage: () => DocumentStorage | undefined): void;
|
|
3231
|
+
/**
|
|
3232
|
+
* Options > Save > "Delete cached files": drop all recovery snapshots (IndexedDB, or the
|
|
3233
|
+
* host's recovery store when it lists its copies; otherwise retention is the host's job).
|
|
3234
|
+
*/
|
|
3235
|
+
clearCache(): Promise<void>;
|
|
3236
|
+
/**
|
|
3237
|
+
* Options > Save > "keep the last AutoRecover version": whether a
|
|
3238
|
+
* successful `.pptx` save should discard the AutoRecover snapshot for the
|
|
3239
|
+
* deck just saved (the real file on disk already has the work, so the
|
|
3240
|
+
* snapshot is stale unless the user asked to keep it).
|
|
3241
|
+
*/
|
|
3242
|
+
get shouldDiscardAutosaveOnSave(): boolean;
|
|
3243
|
+
/** Options > Save > "clear cache on close": whether to wipe snapshots now. */
|
|
3244
|
+
get shouldClearCacheOnClose(): boolean;
|
|
3245
|
+
/** Options > Save > "cache retention": prune snapshots older than N days. */
|
|
3246
|
+
pruneExpiredCache(): Promise<void>;
|
|
3247
|
+
dispose(): void;
|
|
3248
|
+
}
|
|
3249
|
+
|
|
3250
|
+
declare class CompareController {
|
|
3251
|
+
#private;
|
|
3252
|
+
result: CompareResult | null;
|
|
3253
|
+
open: boolean;
|
|
3254
|
+
accepted: Set<number>;
|
|
3255
|
+
rejected: Set<number>;
|
|
3256
|
+
/**
|
|
3257
|
+
* @param allowExternalImages Read on each Compare: whether the incoming deck
|
|
3258
|
+
* may reference linked http(s) content (the resolved host switch or Trust
|
|
3259
|
+
* Center option). Off when omitted.
|
|
3260
|
+
*/
|
|
3261
|
+
constructor(editor: EditorState, allowExternalImages?: () => boolean);
|
|
3262
|
+
chooseFile(): Promise<void>;
|
|
3263
|
+
accept(index: number): void;
|
|
3264
|
+
reject(index: number): void;
|
|
3265
|
+
acceptAll(): void;
|
|
3266
|
+
}
|
|
3267
|
+
|
|
3268
|
+
/** DOM getters {@link PresentToolbarChrome.attach} needs from the component. */
|
|
3269
|
+
interface PresentToolbarChromeTargets {
|
|
3270
|
+
/**
|
|
3271
|
+
* The positioned show surface the bar floats over. Used only for the
|
|
3272
|
+
* bottom-trigger-zone fast path; a missing container still shows the bar on
|
|
3273
|
+
* any movement, exactly as React's wrapper does.
|
|
3274
|
+
*/
|
|
3275
|
+
getContainer: () => HTMLElement | null;
|
|
3276
|
+
/**
|
|
3277
|
+
* File > Options > Advanced > "Show popup toolbar" (default true). When it
|
|
3278
|
+
* returns `false`, `mousemove` never auto-reveals the bar; `toggleVisible`
|
|
3279
|
+
* (PowerPoint's Ctrl+H) still works. Read fresh on every `mousemove`.
|
|
3280
|
+
*/
|
|
3281
|
+
popupToolbarEnabled?: () => boolean;
|
|
3282
|
+
}
|
|
3283
|
+
declare class PresentToolbarChrome {
|
|
3284
|
+
#private;
|
|
3285
|
+
/** Whether the bar is currently faded in and accepting pointer events. */
|
|
3286
|
+
visible: boolean;
|
|
3287
|
+
/** Epoch ms the show started; the shared element ticks the elapsed readout from it. */
|
|
3288
|
+
startedAt: number;
|
|
3289
|
+
/**
|
|
3290
|
+
* Wire the document listeners and the one-second tick. Returns a teardown,
|
|
3291
|
+
* so a component can hand it straight to `$effect`.
|
|
3292
|
+
*/
|
|
3293
|
+
attach(targets: PresentToolbarChromeTargets): () => void;
|
|
3294
|
+
/** Pointer entered the bar: pin it open until the pointer leaves again. */
|
|
3295
|
+
enter(): void;
|
|
3296
|
+
/** Pointer left the bar: restart the auto-hide countdown. */
|
|
3297
|
+
leave(): void;
|
|
3298
|
+
/**
|
|
3299
|
+
* PowerPoint's Ctrl+H: flip the show chrome. Deliberately the same `visible`
|
|
3300
|
+
* flag auto-hide writes, and it re-arms the countdown when it reveals the bar,
|
|
3301
|
+
* so the shortcut leaves the toolbar in a state the pointer can still govern.
|
|
3302
|
+
*/
|
|
3303
|
+
toggleVisible(): void;
|
|
3304
|
+
}
|
|
3305
|
+
|
|
3306
|
+
type PresentationInkTool = 'none' | 'pen' | 'highlighter' | 'eraser' | 'laser';
|
|
3307
|
+
interface PresentationStroke {
|
|
3308
|
+
id: string;
|
|
3309
|
+
points: InkPoint[];
|
|
3310
|
+
color: string;
|
|
3311
|
+
width: number;
|
|
3312
|
+
tool: 'pen' | 'highlighter';
|
|
3313
|
+
}
|
|
3314
|
+
declare class PresentationAnnotations {
|
|
3315
|
+
#private;
|
|
3316
|
+
tool: PresentationInkTool;
|
|
3317
|
+
/**
|
|
3318
|
+
* Pen and highlighter carry SEPARATE colours, as they do in PowerPoint and
|
|
3319
|
+
* in every other binding. This used to be one `color` field with the
|
|
3320
|
+
* highlighter hardcoded to `#fde047`, which made the show toolbar's
|
|
3321
|
+
* highlighter palette a lie: picking a colour changed the pen instead.
|
|
3322
|
+
* The defaults are `PEN_COLORS[0]` and `HIGHLIGHTER_COLORS[0]`.
|
|
3323
|
+
*/
|
|
3324
|
+
penColor: string;
|
|
3325
|
+
highlighterColor: string;
|
|
3326
|
+
current: PresentationStroke | null;
|
|
3327
|
+
bySlide: Map<number, PresentationStroke[]>;
|
|
3328
|
+
laser: InkPoint | null;
|
|
3329
|
+
get count(): number;
|
|
3330
|
+
get slideCount(): number;
|
|
3331
|
+
strokes(index: number): PresentationStroke[];
|
|
3332
|
+
pointerDown(index: number, point: InkPoint): void;
|
|
3333
|
+
pointerMove(index: number, point: InkPoint): void;
|
|
3334
|
+
pointerUp(index: number): void;
|
|
3335
|
+
erase(index: number, point: InkPoint): void;
|
|
3336
|
+
clear(): void;
|
|
3337
|
+
keep(editor: EditorState): void;
|
|
3338
|
+
}
|
|
3339
|
+
|
|
3340
|
+
declare class RehearseState {
|
|
3341
|
+
#private;
|
|
3342
|
+
active: boolean;
|
|
3343
|
+
paused: boolean;
|
|
3344
|
+
summaryOpen: boolean;
|
|
3345
|
+
times: Map<number, number>;
|
|
3346
|
+
current: number;
|
|
3347
|
+
elapsedMs: number;
|
|
3348
|
+
start(index: number): void;
|
|
3349
|
+
tick(): void;
|
|
3350
|
+
move(index: number): void;
|
|
3351
|
+
togglePause(): void;
|
|
3352
|
+
finish(): void;
|
|
3353
|
+
record(): void;
|
|
3354
|
+
save(editor: EditorState): void;
|
|
3355
|
+
discard(): void;
|
|
3356
|
+
get totalMs(): number;
|
|
3357
|
+
}
|
|
3358
|
+
|
|
3359
|
+
/** Reactive state for the optional parity dialogs and presentation tools. */
|
|
3360
|
+
declare class ViewerParityUiState {
|
|
3361
|
+
readonly compare: CompareController;
|
|
3362
|
+
readonly annotations: PresentationAnnotations;
|
|
3363
|
+
/**
|
|
3364
|
+
* The show toolbar's fade/auto-hide state. It lives here, not inside
|
|
3365
|
+
* `PresentationToolbar.svelte`, because PowerPoint's Ctrl+H toggles the show
|
|
3366
|
+
* chrome from the keyboard handler, which is nowhere near that component: a
|
|
3367
|
+
* second visibility flag over there would be overwritten by the next mouse
|
|
3368
|
+
* move, so the shortcut and the countdown share this one.
|
|
3369
|
+
*/
|
|
3370
|
+
readonly showChrome: PresentToolbarChrome;
|
|
3371
|
+
/** PowerPoint's Ctrl+S "See All Slides" grid, over the running show. */
|
|
3372
|
+
allSlidesOpen: boolean;
|
|
3373
|
+
/**
|
|
3374
|
+
* Slide-show right-click menu position, or null when closed. Shown while
|
|
3375
|
+
* presenting when Options > Advanced > "Show menu on right mouse click" is
|
|
3376
|
+
* on.
|
|
3377
|
+
*/
|
|
3378
|
+
presentationContextMenu: {
|
|
3379
|
+
x: number;
|
|
3380
|
+
y: number;
|
|
3381
|
+
} | null;
|
|
3382
|
+
readonly rehearse: RehearseState;
|
|
3383
|
+
setupSlideShowOpen: boolean;
|
|
3384
|
+
headerFooterOpen: boolean;
|
|
3385
|
+
settingsOpen: boolean;
|
|
3386
|
+
shortcutsOpen: boolean;
|
|
3387
|
+
keepAnnotationsOpen: boolean;
|
|
3388
|
+
printSettingsOpen: boolean;
|
|
3389
|
+
subtitlesEnabled: boolean;
|
|
3390
|
+
customShowsOpen: boolean;
|
|
3391
|
+
/**
|
|
3392
|
+
* The custom show a started slide show is restricted to, or null for the
|
|
3393
|
+
* whole deck. Shows were definable and persisted here, but nothing held an
|
|
3394
|
+
* active one, so selecting a show changed nothing about what presented.
|
|
3395
|
+
*
|
|
3396
|
+
* A playback choice for this session, not an edit: it deliberately does NOT
|
|
3397
|
+
* live on `EditorPresentationMetadata`, so selecting a show neither enters
|
|
3398
|
+
* the undo history nor marks the document dirty.
|
|
3399
|
+
*/
|
|
3400
|
+
activeCustomShowId: string | null;
|
|
3401
|
+
selectionPaneOpen: boolean;
|
|
3402
|
+
slideSorterOpen: boolean;
|
|
3403
|
+
/** View tab > Reading View: the deck at full window size, not a slide show. */
|
|
3404
|
+
readingViewOpen: boolean;
|
|
3405
|
+
/** View tab > Outline View: the deck as one editable indented text document. */
|
|
3406
|
+
outlineViewOpen: boolean;
|
|
3407
|
+
/** View > H/V Guides. Also seeded from the deck's `slideViewPr/@showGuides`. */
|
|
3408
|
+
showGuides: boolean;
|
|
3409
|
+
/**
|
|
3410
|
+
* "Snap to shape" (View ▸ Snap Objects to Other Objects): the on-drag
|
|
3411
|
+
* alignment-guide snap. Also seeded from the deck's
|
|
3412
|
+
* `slideViewPr/@snapToObjects` (shared's `DeckViewPreferences.snapToObjects`
|
|
3413
|
+
* field; this binding's own historical name for the same toggle).
|
|
3414
|
+
*/
|
|
3415
|
+
snapToShape: boolean;
|
|
3416
|
+
guides: Guide[];
|
|
3417
|
+
/**
|
|
3418
|
+
* Also carries the deck-authored `snapToObjects`/`showGuides`/
|
|
3419
|
+
* `gridSpacingCx`/`gridSpacingCy` fields (`DeckViewPreferences`, a superset
|
|
3420
|
+
* of the base `ViewerPreferences` toggles), even though `showGuides` and
|
|
3421
|
+
* `snapToShape` above are the fields this binding actually reads: keeping
|
|
3422
|
+
* them here too is what lets `viewerPreferencesFromViewProperties` seed (and
|
|
3423
|
+
* `viewPropertiesPatchFromPreferences` later read back) a single object.
|
|
3424
|
+
*/
|
|
3425
|
+
preferences: DeckViewPreferences;
|
|
3426
|
+
/**
|
|
3427
|
+
* Whether a deck this viewer opens besides the main one (Compare, Reuse
|
|
3428
|
+
* Slides) may reference linked http(s) content: the resolved host
|
|
3429
|
+
* `allowExternalContent` switch or Trust Center option, read on each use.
|
|
3430
|
+
*/
|
|
3431
|
+
readonly allowExternalImages: () => boolean;
|
|
3432
|
+
constructor(editor: EditorState, allowExternalImages?: () => boolean);
|
|
3433
|
+
syncAutosave(enabled: boolean): void;
|
|
3434
|
+
updatePreferences(next: DeckViewPreferences, onAutosaveChange: (enabled: boolean) => void): void;
|
|
3435
|
+
}
|
|
3436
|
+
|
|
3437
|
+
/**
|
|
3438
|
+
* Everything the ribbon, toolbar, and canvas need, returned from
|
|
3439
|
+
* {@link createViewerState}. Reactive/derived fields are exposed as
|
|
3440
|
+
* getters (some paired with setters for the plain local UI flags) so reads
|
|
3441
|
+
* anywhere, not just inside an `$effect`, stay live.
|
|
3442
|
+
*/
|
|
3443
|
+
interface ViewerStateBag {
|
|
3444
|
+
readonly loader: PresentationLoader;
|
|
3445
|
+
readonly viewer: ViewerState;
|
|
3446
|
+
readonly editor: EditorState;
|
|
3447
|
+
readonly controller: EditorController;
|
|
3448
|
+
readonly parityUi: ViewerParityUiState;
|
|
3449
|
+
/**
|
|
3450
|
+
* The deck's own `p:modifyVerifier` / "Mark as Final" read-only
|
|
3451
|
+
* recommendation and lock (wave 4 #2), mirroring the Protected View banner
|
|
3452
|
+
* mechanism rather than inventing a second one.
|
|
3453
|
+
*/
|
|
3454
|
+
readonly readOnlyRec: ReadOnlyRecommendationState;
|
|
3455
|
+
/** Fidelity-loss toast stack (wave 4 #3), fed by `loader.compatibilityWarnings`. */
|
|
3456
|
+
readonly compatToasts: CompatToastsState;
|
|
3457
|
+
readonly chromeUi: ChromeUiState;
|
|
3458
|
+
readonly findReplace: FindReplaceState;
|
|
3459
|
+
readonly collab: CollaborationController;
|
|
3460
|
+
/** Shared authorization, canonical session readiness, status and presence for host chrome. */
|
|
3461
|
+
readonly shellState: CollaborationShellState;
|
|
3462
|
+
readonly dialogs: CollaborationDialogsState;
|
|
3463
|
+
readonly autosaveCtl: AutosaveController;
|
|
3464
|
+
/** The "recover unsaved changes?" probe + prompt for the loaded deck. */
|
|
3465
|
+
readonly autosaveRecovery: AutosaveRecoveryController;
|
|
3466
|
+
readonly presentation: PresentationController;
|
|
3467
|
+
readonly presenterSession: PresenterSession;
|
|
3468
|
+
readonly exportWiring: ExportWiring;
|
|
3469
|
+
readonly exportUi: ExportUiState;
|
|
3470
|
+
/** The full PowerPoint File > Options model (persisted), provided via context. */
|
|
3471
|
+
readonly optionsState: ViewerOptionsState;
|
|
3472
|
+
/** AI assistant bridge + on-canvas focus controller + panel open flag. */
|
|
3473
|
+
readonly ai: AiCluster;
|
|
3474
|
+
readonly t: Translator;
|
|
3475
|
+
/** Imperative undo/redo/save/download API, matching `PowerPointViewerApi`'s editing subset. */
|
|
3476
|
+
readonly editingApi: EditingApi;
|
|
3477
|
+
/** Imperative PNG/PDF/GIF/video/print API, matching `PowerPointViewerApi`'s export subset. */
|
|
3478
|
+
readonly exportingApi: ExportingApi;
|
|
3479
|
+
/** Imperative navigation/zoom/mode/slide/element API (the rest of `PowerPointViewerApi`). */
|
|
3480
|
+
readonly deck: DeckApi;
|
|
3481
|
+
/** Effective scale (fit-to-viewport x user zoom), matching the main canvas. */
|
|
3482
|
+
readonly scale: number;
|
|
3483
|
+
/** User-facing zoom percent (rounded, never below 1). */
|
|
3484
|
+
readonly effectivePercent: number;
|
|
3485
|
+
readonly displaySlides: EditorState['renderedSlides'];
|
|
3486
|
+
readonly activeSlide: EditorState['renderedSlides'][number] | undefined;
|
|
3487
|
+
readonly chromeVisible: boolean;
|
|
3488
|
+
/** True when in-place editing is actually available (editable, not presenting, not read-only). */
|
|
3489
|
+
readonly editingActive: boolean;
|
|
3490
|
+
/** True once the ribbon (vs. the compact `ViewerToolbar`) should be shown. */
|
|
3491
|
+
readonly showRibbon: boolean;
|
|
3492
|
+
readonly viewerMode: ViewerMode;
|
|
3493
|
+
/** True while the autosave debounce/write cycle is armed. */
|
|
3494
|
+
readonly autosaveActive: boolean;
|
|
3495
|
+
/**
|
|
3496
|
+
* The live editable flag: seeded from the host `editable` prop, then
|
|
3497
|
+
* writable so an AI edit, `deck.setMode()` or Trust Center's Protected View
|
|
3498
|
+
* can flip it without waiting on the host.
|
|
3499
|
+
*/
|
|
3500
|
+
editable: boolean;
|
|
3501
|
+
/**
|
|
3502
|
+
* Whether the Protected View banner should show: the host allows editing,
|
|
3503
|
+
* Trust Center > "Open presentations in Protected View" is still blocking
|
|
3504
|
+
* it, and the user hasn't lifted it via {@link enableEditing} for this
|
|
3505
|
+
* document yet.
|
|
3506
|
+
*/
|
|
3507
|
+
readonly protectedViewActive: boolean;
|
|
3508
|
+
/** Lift Protected View's read-only lock for the current document (File > Options > Trust Center). */
|
|
3509
|
+
enableEditing(): void;
|
|
3510
|
+
/**
|
|
3511
|
+
* The EFFECTIVE title-bar AutoSave state: the user's preference, or false
|
|
3512
|
+
* when the host vetoed autosave (the switch renders off and inert rather
|
|
3513
|
+
* than pretending to work). Mutate via {@link setAutosaveEnabled}, which
|
|
3514
|
+
* also fires `onautosavetoggle`.
|
|
3515
|
+
*/
|
|
3516
|
+
readonly autosaveEnabled: boolean;
|
|
3517
|
+
/** False only when the host passed `autosave={false}`; the toggle is then inert. */
|
|
3518
|
+
readonly autosaveToggleAvailable: boolean;
|
|
3519
|
+
/** Why autosave is not running, for a host that wants to explain it. */
|
|
3520
|
+
readonly autosaveDisabledReason: AutosaveDisabledReason | undefined;
|
|
3521
|
+
setAutosaveEnabled(enabled: boolean): void;
|
|
3522
|
+
presenterMode: boolean;
|
|
3523
|
+
/** `Date.now()` timestamp of the last `enterPresenterView()` call; the presenter view's elapsed-time display. */
|
|
3524
|
+
readonly presenterStartedAt: number;
|
|
3525
|
+
stageContextMenu: StageContextMenu | null;
|
|
3526
|
+
stageCanvasContextMenu: StageCanvasContextMenu | null;
|
|
3527
|
+
readonly activeMobileSheet: MobileSheetKey;
|
|
3528
|
+
setActiveMobileSheet(next: MobileSheetKey): void;
|
|
3529
|
+
readonly notesExpanded: boolean;
|
|
3530
|
+
versionHistoryOpen: boolean;
|
|
3531
|
+
readonly signatureWarningOpen: boolean;
|
|
3532
|
+
enterPresenterView(): void;
|
|
3533
|
+
closeSignatureWarning(): void;
|
|
3534
|
+
/** File > Open > "Browse this device" (host override, else the native picker). */
|
|
3535
|
+
openFile(): void;
|
|
3536
|
+
/** Run a Quick Access Toolbar command by catalog id (unknown ids no-op). */
|
|
3537
|
+
runQuickAccessCommand(id: string): void;
|
|
3538
|
+
/**
|
|
3539
|
+
* Deck-level OOXML field-substitution context (date/time, header/footer,
|
|
3540
|
+
* document properties, plus the active slide's number and title), also
|
|
3541
|
+
* published to descendants via `provideFieldContext`.
|
|
3542
|
+
*/
|
|
3543
|
+
fieldContext(): FieldSubstitutionContext;
|
|
3544
|
+
onNotesToggle(): void;
|
|
3545
|
+
onNotesCommit(notes: string, segments?: TextSegment[]): void;
|
|
3546
|
+
onFullscreenToggle(): void;
|
|
3547
|
+
onFullscreenChange(): void;
|
|
3548
|
+
onKeydown(event: KeyboardEvent): void;
|
|
3549
|
+
/** PowerPoint navigates a running show on the wheel; inert while editing. */
|
|
3550
|
+
onWheel(event: WheelEvent): void;
|
|
3551
|
+
downloadPptx(fileName?: string): Promise<void>;
|
|
3552
|
+
downloadAs(format: PptxSaveFormat, fileName?: string): Promise<void>;
|
|
3553
|
+
/** Tear down every constructed controller (call from the host's `onDestroy`). */
|
|
3554
|
+
destroy(): void;
|
|
3555
|
+
}
|
|
3556
|
+
|
|
3557
|
+
/**
|
|
3558
|
+
* The theme and table style map the thumbnails resolve table colours from,
|
|
3559
|
+
* as returned by `buildSlidesPaneTableStyleContext`.
|
|
3560
|
+
*/
|
|
3561
|
+
interface SlidesPaneTableStyleContext {
|
|
3562
|
+
theme: PptxTheme | undefined;
|
|
3563
|
+
tableStyleMap: ParsedTableStyleMap | undefined;
|
|
3564
|
+
}
|
|
3565
|
+
/** Props of the standalone `SlidesPane` (the slide thumbnail rail). */
|
|
3566
|
+
interface SlidesPaneProps {
|
|
3567
|
+
/**
|
|
3568
|
+
* The slides as the canvas renders them, with their layout and master
|
|
3569
|
+
* elements merged in (`ViewerStateBag.displaySlides`), so each thumbnail
|
|
3570
|
+
* draws what the canvas draws.
|
|
3571
|
+
*/
|
|
3572
|
+
slides: PptxSlide[];
|
|
3573
|
+
/** Zero-based index of the slide shown on the canvas; its row is marked `aria-current`. */
|
|
3574
|
+
activeSlideIndex: number;
|
|
3575
|
+
/** The deck's slide size in CSS px; thumbnails are scaled down from it. */
|
|
3576
|
+
canvasSize: CanvasSize;
|
|
3577
|
+
/** Resolved media data URLs (`PresentationLoader.mediaDataUrls`) for images and video posters. */
|
|
3578
|
+
mediaDataUrls: Map<string, string>;
|
|
3579
|
+
/** The deck's sections; with any, the rail groups thumbnails under collapsible headers. */
|
|
3580
|
+
sections?: PptxSection[];
|
|
3581
|
+
/**
|
|
3582
|
+
* Whether the rail edits the deck: drag reordering, the context menus, the
|
|
3583
|
+
* Enter shortcut and the "New slide" footer. Default `false` (read-only, no footer).
|
|
3584
|
+
*/
|
|
3585
|
+
canEdit?: boolean;
|
|
3586
|
+
/**
|
|
3587
|
+
* Deck-wide field context (`buildSlidesPaneFieldContext`): date/time,
|
|
3588
|
+
* header/footer, document properties and the deck start number
|
|
3589
|
+
* (`p:presentation/@firstSlideNum`). Each thumbnail re-points the slide
|
|
3590
|
+
* number and title at its own slide. When omitted, the rail uses the context
|
|
3591
|
+
* of the enclosing `createViewerState`, if any.
|
|
3592
|
+
*/
|
|
3593
|
+
fieldContext?: FieldSubstitutionContext;
|
|
3594
|
+
/**
|
|
3595
|
+
* Theme and table style map for table thumbnails
|
|
3596
|
+
* (`buildSlidesPaneTableStyleContext`). When omitted, the rail uses the
|
|
3597
|
+
* context of the enclosing `createViewerState`, if any.
|
|
3598
|
+
*/
|
|
3599
|
+
tableStyleContext?: SlidesPaneTableStyleContext;
|
|
3600
|
+
/** A thumbnail was clicked: show that slide. Selecting never edits the deck. */
|
|
3601
|
+
onselectslide: (index: number) => void;
|
|
3602
|
+
/** A thumbnail was dragged from `fromIndex` and dropped on `toIndex`. */
|
|
3603
|
+
onmoveslide?: (fromIndex: number, toIndex: number) => void;
|
|
3604
|
+
/** The footer's "New slide" button. The footer renders only with `canEdit` and this callback. */
|
|
3605
|
+
onaddslide?: () => void;
|
|
3606
|
+
/** Insert a slide after `index` (the context menu's New Slide, and Enter on a thumbnail). */
|
|
3607
|
+
onaddslideafter?: (index: number) => void;
|
|
3608
|
+
/** Duplicate every selected slide (multi-selection with Ctrl/Shift click). */
|
|
3609
|
+
onduplicateslides?: (indexes: number[]) => void;
|
|
3610
|
+
/** Delete every selected slide. */
|
|
3611
|
+
ondeleteslides?: (indexes: number[]) => void;
|
|
3612
|
+
/** Toggle hidden on every selected slide. */
|
|
3613
|
+
onhideslides?: (indexes: number[]) => void;
|
|
3614
|
+
/**
|
|
3615
|
+
* The context menu's "Layout" entry. The rail first makes the slide active
|
|
3616
|
+
* through `onselectslide`, then calls this with the slide and the click
|
|
3617
|
+
* point, so a host can open its own Layout gallery there.
|
|
3618
|
+
*/
|
|
3619
|
+
onopenlayoutgallery?: (request: SlidesPaneLayoutGalleryRequest) => void;
|
|
3620
|
+
/** Add a section starting after slide `index` (context menus' Add Section). */
|
|
3621
|
+
onaddsection?: (index: number) => void;
|
|
3622
|
+
/** Rename a section (double-click or the section menu's Rename). */
|
|
3623
|
+
onrenamesection?: (sectionId: string, name: string) => void;
|
|
3624
|
+
/** Delete a section; its slides stay in the deck. */
|
|
3625
|
+
ondeletesection?: (sectionId: string) => void;
|
|
3626
|
+
/** Move a section, with its slides, one place up. */
|
|
3627
|
+
onmovesectionup?: (sectionId: string) => void;
|
|
3628
|
+
/** Move a section, with its slides, one place down. */
|
|
3629
|
+
onmovesectiondown?: (sectionId: string) => void;
|
|
3630
|
+
/** Collapse or expand a section's thumbnails. */
|
|
3631
|
+
ontogglesection?: (sectionId: string) => void;
|
|
3632
|
+
}
|
|
3633
|
+
/** Options of {@link createSlidesPaneProps}. */
|
|
3634
|
+
interface CreateSlidesPanePropsOptions {
|
|
3635
|
+
/** See {@link SlidesPaneProps.onopenlayoutgallery}. */
|
|
3636
|
+
onopenlayoutgallery?: (request: SlidesPaneLayoutGalleryRequest) => void;
|
|
3637
|
+
}
|
|
3638
|
+
/**
|
|
3639
|
+
* `SlidesPane` props over a `createViewerState` bag, wired like the full
|
|
3640
|
+
* viewer's rail: the same merged slides, sections, slide and section
|
|
3641
|
+
* operations (so edits share the undo history and collaboration sync) and the
|
|
3642
|
+
* canvas's field and table contexts. Every value is a live getter, so spread
|
|
3643
|
+
* the result as is: `<SlidesPane {...createSlidesPaneProps(state)} />`.
|
|
3644
|
+
*/
|
|
3645
|
+
declare function createSlidesPaneProps(state: ViewerStateBag, options?: CreateSlidesPanePropsOptions): SlidesPaneProps;
|
|
3646
|
+
|
|
3647
|
+
declare const SlidesPane: Component<SlidesPaneProps>;
|
|
599
3648
|
|
|
600
|
-
export { PowerPointViewer, exportAllSlidesToSvg, exportAllSlidesToSvgBlobs, exportSlideAsSvg, exportSlideToSvg, exportSlideToSvgBlob, registerTranslations, renderToCanvas };
|
|
601
|
-
export type { AutosaveStatus, ExportGifOptions, ExportPdfOptions, ExportVideoOptions, PowerPointViewerApi, PowerPointViewerProps, PrintOptions, SvgExportAllOptions, SvgExportSingleSlideOptions, TranslationDictionary, Translator, ViewerLoadDetail };
|
|
3649
|
+
export { PowerPointViewer, SlidesPane, createSlidesPaneProps, exportAllSlidesToSvg, exportAllSlidesToSvgBlobs, exportSlideAsSvg, exportSlideToSvg, exportSlideToSvgBlob, registerTranslations, renderToCanvas };
|
|
3650
|
+
export type { AutosaveStatus, CreateSlidesPanePropsOptions, ExportGifOptions, ExportPdfOptions, ExportVideoOptions, PowerPointViewerApi, PowerPointViewerProps, PrintOptions, SlidesPaneProps, SlidesPaneTableStyleContext, SvgExportAllOptions, SvgExportSingleSlideOptions, TranslationDictionary, Translator, ViewerLoadDetail };
|