import { PptxAppProperties, PptxCoreProperties, PptxCustomProperty, PptxElement, PptxHandoutMaster, PptxHeaderFooter, PptxHandler, PptxNotesMaster, PptxSaveFormat, PptxSection, PptxSlide, PptxSlideMaster, PptxSlideSize, PptxTheme, PptxPresentationProperties, PptxCustomShow, PptxTagCollection, TextSegment } from 'pptx-viewer-core'; import { DeckSaveIntent, ElementClipboardPayload, FontEmbeddingDescriptor, TemplateElementMap } from 'pptx-viewer-shared'; import { EditorAnimationController } from './editor-animation-controller'; import { EditorArrangeController } from './editor-arrange-controller'; import { EditorBackgroundController } from './editor-background-controller'; import { EditorClipboardController } from './editor-clipboard-controller'; import { LoadDocumentArgs } from './editor-document-lifecycle'; import { EditorSnapshot } from './editor-document-state'; import { EditorElementController } from './editor-element-controller'; import { EditorEquationController } from './editor-equation-controller.svelte'; import { EditorFormatPainterController } from './editor-format-painter-controller.svelte'; import { EditorHistoryState } from './editor-history-state.svelte'; import { EditorInkController } from './editor-ink-controller.svelte'; import { EditorMasterController, MasterViewTarget } from './editor-master-controller'; import { ElementBoxPatch } from './editor-mutations'; import { EditorPresentationMetadata } from './editor-presentation-metadata.svelte'; import { EditorSectionController } from './editor-section-controller'; import { EditorSelection } from './editor-selection.svelte'; import { EditorSlidesController } from './editor-slides-controller'; import { EditorTemplateController } from './editor-template-controller'; import { EditorTransitionController } from './editor-transition-controller'; import { ZOrderDirection } from './editor-zorder'; import { TableCellSelection } from './table-cell-selection.svelte'; export interface EditorStateDeps { getCurrent(): number; getHandler(): PptxHandler | null; /** * The `p:sldSz` a save should write, resolved from the viewer's EMU slide * size and its pixel canvas by the shared `resolveSlideSizeSelection`. * Optional so out-of-tree mounts (and the unit tests) can omit it, in which * case core re-emits the load-time dimensions verbatim. */ getSlideSize?: () => PptxSlideSize | undefined; onChange?: () => void; } export declare class EditorState { #private; slides: PptxSlide[]; templateElementsBySlideId: TemplateElementMap; slideMasters: PptxSlideMaster[]; notesMaster: PptxNotesMaster | undefined; handoutMaster: PptxHandoutMaster | undefined; sections: PptxSection[]; readonly presentationMetadata: EditorPresentationMetadata; coreProperties: PptxCoreProperties | undefined; appProperties: PptxAppProperties | undefined; customProperties: PptxCustomProperty[]; /** * The deck's `ppt/tags/*.xml` name/value metadata. Seeded from the load via * {@link adoptTagCollections} and edited by the inspector's Tags section; * carried through the undo snapshot and re-emitted on save. */ tagCollections: PptxTagCollection[]; /** * The deck's active theme, kept here so the Home tab's font dropdown can * lead with the theme fonts. Set by the viewer once a deck is loaded; * deliberately outside {@link EditorSnapshot} because it is not content the * undo stack owns. */ theme: PptxTheme | undefined; /** * Families the deck embeds, offered as their own font-dropdown group. Write * through {@link adoptEmbeddedFontFamilies} so {@link embedFonts} is reseeded * with them. */ embeddedFontFamilies: readonly string[]; /** * File > Fonts > "Embed fonts in the file". Session state like * {@link savePassword}, not document content, so undo never restores it. * Seeded from the loaded deck (see {@link adoptEmbeddedFontFamilies}): a deck * that arrived with embedded fonts keeps them on save, so the switch has to * start "on" or turning it off would be the only way to describe what save * already does. Read by `saveEditorDocument`. */ embedFonts: boolean; /** * Families the user registered from a local font file this session * (File > Options > Fonts, off by default). Session state, never persisted: * the font binary is the user's, not ours to store. */ customFontFamilies: readonly string[]; masterViewTarget: MasterViewTarget | null; readonly selection: EditorSelection; /** The block of table cells marquee'd inside the selected table, if any. */ readonly tableCells: TableCellSelection; editable: boolean; dirty: boolean; /** * Monotonic counter bumped by {@link setSlides}, i.e. every time a freshly * loaded deck is installed as the working document. * * It exists because the loader's own `loadCount` is bumped in an EARLIER * flush than the one that writes these slides: the seeding effect * (`viewer-effects.svelte.ts`) reacts to `loadCount`, so by the time it calls * `setSlides` the autosave effect has already run once, seen the new count * against the old slides, and settled. The slide reassignment that followed * then looked exactly like a user edit, and merely OPENING a deck wrote a * crash-recovery snapshot. This counter changes in the SAME synchronous block * as the slides it describes, so the reseed can never be misread again. */ seedNonce: number; editTemplateMode: boolean; interactionActive: boolean; clipboard: ElementClipboardPayload | null; /** * File ▸ Info ▸ Protect Presentation state. Deliberately NOT part of * {@link EditorSnapshot}: the secret is session state, not document content, * so undo must never restore or clear it. {@link saveIntent} feeds it to the * shared `planDeckSave`, which routes a protected save through * `saveEncrypted` (an OLE2 container) instead of `save` (a plain ZIP). */ passwordProtected: boolean; savePassword: string | null; /** Undo/redo stack; the `canUndo` / `canRedo` getters below mirror it. */ readonly history: EditorHistoryState; readonly clipboardOps: EditorClipboardController; readonly elementOps: EditorElementController; readonly templateOps: EditorTemplateController; readonly slidesOps: EditorSlidesController; readonly sectionOps: EditorSectionController; readonly arrangeOps: EditorArrangeController; readonly backgroundOps: EditorBackgroundController; readonly transitionOps: EditorTransitionController; readonly animationOps: EditorAnimationController; readonly inkOps: EditorInkController; readonly masterOps: EditorMasterController; readonly formatPainter: EditorFormatPainterController; readonly equationOps: EditorEquationController; constructor(deps: EditorStateDeps); get canUndo(): boolean; get headerFooter(): PptxHeaderFooter; get presentationProperties(): PptxPresentationProperties; get customShows(): PptxCustomShow[]; get canRedo(): boolean; get selectedElementId(): string | null; get selectedElement(): PptxElement | undefined; get selectedElements(): PptxElement[]; get activeElements(): PptxElement[]; get renderedSlides(): PptxSlide[]; get hasClipboard(): boolean; get currentSlideIndex(): number; /** The loaded core handler, or null before a deck is open. Used by the * Slides group for layout switching (`applyLayoutToSlide`). */ getHandler(): PptxHandler | null; /** * The `p:sldSz` the next save should write, or undefined to leave the * load-time dimensions alone. Slide size lives on the loader (it is not * content the undo stack owns), so it reaches the save through this dep the * same way the handler does. */ getSlideSize(): PptxSlideSize | undefined; /** Adopt a freshly loaded deck as the working document (see `loadEditorDocument`). */ setSlides(...args: LoadDocumentArgs): void; /** Adopt a remote (collaboration) snapshot; see `applyRemoteEditorSlides`. */ applyRemoteSlides(slides: PptxSlide[]): void; reset(): void; select(id: string | null): void; /** The element with `id` on the surface the pointer acts on, or undefined. */ elementById(id: string): PptxElement | undefined; /** * May the pointer act on `id` at all? Two gates, both of which must pass: * the template rule (an inherited master/layout node is inert unless * edit-template mode is on) and the element's own authored `a:spLocks`. The * lock half was missing entirely, which is why a `noSelect` shape from a * real deck was as selectable and draggable as any other. */ isElementInteractive(id: string): boolean; setTemplateEditing(enabled: boolean): void; /** Apply the File > Options "maximum number of undos" value. */ setHistoryDepth(depth: number): void; pushHistory(): void; commitChange(): void; /** Patch geometry without history for live gesture preview frames. */ patchGeometry: (id: string, box: ElementBoxPatch) => void; replaceActiveElements(elements: PptxElement[]): void; /** Commit a replacement active element collection as one undo step. */ commitActiveElements(elements: PptxElement[]): void; /** * Replace the whole slide array with history (the generic multi-slide * mutation entry point: slide add/duplicate/delete, arrange group ops, * and find/replace all route through this so every change is a single * undoable step). No-op when not editable. */ commitSlides(next: PptxSlide[]): void; /** A deep clone of the whole editable document (one undo entry, or save input). */ snapshot(): EditorSnapshot; /** * Adopt the families a freshly loaded deck embeds, and reseed * {@link embedFonts} to the position that describes the file save would write * right now. Deliberately not an undo step: the parsed font list is not a * user edit. */ adoptEmbeddedFontFamilies(families: readonly string[]): void; /** How File > Fonts should render its toggle for the loaded deck. */ get fontEmbedding(): FontEmbeddingDescriptor; /** The Protect-Presentation state every save path hands to `planDeckSave`. */ saveIntent(): DeckSaveIntent; /** File ▸ Info ▸ Protect Presentation: arm password encryption for saves. */ setSavePassword(password: string): void; /** File ▸ Info ▸ Protect Presentation: back to saving in the clear. */ clearSavePassword(): void; deleteSelected: () => void; duplicateSelected: () => string | null; applyElementPatch: (id: string, patch: Partial) => void; patchSelected: (patch: Partial) => void; insertElement: (element: PptxElement) => string | null; reorderSelected: (direction: ZOrderDirection) => void; nudgeSelected: (dx: number, dy: number) => void; commitInlineText: (id: string, text: string) => void; commitNotes: (notes: string, notesSegments?: TextSegment[]) => void; updateDocumentProperties(core: PptxCoreProperties, app: PptxAppProperties, custom: PptxCustomProperty[]): void; /** * Seed the deck's tag parts straight after a load. Deliberately NOT an undo * step: the load already cleared history, and treating the parsed value as * a user edit would mark a pristine deck dirty. */ adoptTagCollections(tags: readonly PptxTagCollection[]): void; /** Replace the tag collections as one undoable edit (inspector Tags section). */ updateTagCollections(next: readonly PptxTagCollection[]): void; undo(): void; redo(): void; save(format?: PptxSaveFormat): Promise; } //# sourceMappingURL=editor-state.svelte.d.ts.map