pptx-svelte-viewer 4.46.0 → 4.47.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.
@@ -1,12 +1,12 @@
1
1
  import * as svelte from 'svelte';
2
2
  import { Component } from 'svelte';
3
3
  import * as ooxml_ui_pptx from 'ooxml-ui/pptx';
4
- import { PrintSettings, CanvasSize, RasterizeElementResult, RasterizeElementTilesResult, ViewportFitOptions, ViewerFontSource, ViewerTheme, ThemeCatalogEntry, AccountAuthConfig, ToolbarActionId, RibbonAddInTab, ViewerCustomization, CollaborationInput, CollaborationConfig, CollaborationState, PowerPointViewerAPI, ViewerCustomizationApi, RemoteCursor, SanitizedPresence, DeckSaveIntent, AnimationGroup, AlignEdge, DistributeAxis, MergeShapeOperation, PasteSpecialFormat, CropSession, CropElementUpdate, TemplateElementMap, ElementBoxPatch, InkStrokeView, InkPoint, MasterViewCrudAction, MasterViewCrudActionId, FreeformToolKind, EditPointsElementPatch, SlideTemplateId, SlideTemplateBuildOptions, SlidePasteRequest, RibbonTransitionDraft, CellCoord, CellRect, PendingInlineTextEdit, InlineListController, ElementClipboardPayload, TableStyleSaveOptions, FontEmbeddingDescriptor, InlineTextEditSnapshot, SnapGuideInput, CollaborationLivePatcher, ResolvedKeyboardCustomization, MarqueeRect, ShapeAdjustmentHandleDescriptor, SnapLine, ResizeHandleId, ConnectorEndpointKind, CollaborationInlineEditor, FindResult, ViewerPreferences, ViewportFitPadding, SlideSizeEmu, CollabLoadOrigin, AwarenessLike, CollaborationTransport, YDocLike, YjsFactories, ConnectionStatus, BroadcastConfig, ElementAnimationState, AuthoredSlideRange, RunProgramNotice, ZoomNavigationTarget, PresentationSnapshot, AutosaveRecoveryPrompt, CompatibilityWarningToast, ReadOnlyRecommendation, ModifyPasswordCheckResult, ViewerOptions, ViewerOptionsStoreInit, ToolbarTabId, ViewerOptionsGroupId, ViewerOptionPrimitive, ViewerOptionsConstraints, CompareResult, Guide, DeckViewPreferences, ResolvedCustomization, ViewerMode, CollaborationShellState, AutosaveDisabledReason, MobileSheetKey, FieldSubstitutionContext } from 'ooxml-ui/pptx';
4
+ import { PrintSettings, CanvasSize, RasterizeElementResult, RasterizeElementTilesResult, ViewportFitOptions, ViewerFontSource, ViewerTheme, ThemeCatalogEntry, AccountAuthConfig, ToolbarActionId, RibbonAddInTab, ViewerCustomization, DocumentStorage, ViewerAutosaveStatus, AutosaveRecord, ConnectionStatus, CollaborationInput, CollaborationConfig, CollaborationState, PowerPointViewerAPI, ViewerCustomizationApi, RemoteCursor, SanitizedPresence, DeckSaveIntent, AnimationGroup, AlignEdge, DistributeAxis, MergeShapeOperation, PasteSpecialFormat, CropSession, CropElementUpdate, TemplateElementMap, ElementBoxPatch, InkStrokeView, InkPoint, MasterViewCrudAction, MasterViewCrudActionId, FreeformToolKind, EditPointsElementPatch, SlideTemplateId, SlideTemplateBuildOptions, SlidePasteRequest, RibbonTransitionDraft, CellCoord, CellRect, PendingInlineTextEdit, InlineListController, ElementClipboardPayload, TableStyleSaveOptions, FontEmbeddingDescriptor, InlineTextEditSnapshot, SnapGuideInput, CollaborationLivePatcher, ResolvedKeyboardCustomization, MarqueeRect, ShapeAdjustmentHandleDescriptor, SnapLine, ResizeHandleId, ConnectorEndpointKind, CollaborationInlineEditor, FindResult, ViewerPreferences, ViewportFitPadding, SlideSizeEmu, CollabLoadOrigin, AwarenessLike, CollaborationTransport, YDocLike, YjsFactories, BroadcastConfig, ElementAnimationState, AuthoredSlideRange, RunProgramNotice, ZoomNavigationTarget, PresentationSnapshot, AutosaveRecoveryPrompt, CompatibilityWarningToast, ReadOnlyRecommendation, ModifyPasswordCheckResult, ViewerOptions, ViewerOptionsStoreInit, ToolbarTabId, ViewerOptionsGroupId, ViewerOptionPrimitive, ViewerOptionsConstraints, CompareResult, Guide, DeckViewPreferences, ResolvedCustomization, ViewerMode, CollaborationShellState, AutosaveDisabledReason, MobileSheetKey, FieldSubstitutionContext } from 'ooxml-ui/pptx';
5
5
  export { CanvasSize, CollaborationShellState, CollaborationState, ConnectionStatus, ExternalCollaborationAwareness, ExternalCollaborationSession, ExternalCollaborationSnapshot, InlineListController, InlineListReadResult, InlineTextEditSnapshot, RemoteCursor, SanitizedPresence, ViewerTheme, zoomInPercent, zoomOutPercent } from 'ooxml-ui/pptx';
6
6
  import { PptxAiConfig, PptxAiNotifyLevel, PptxAiBridge, PptxAiFocusedTarget, AiChangeBatch, AiCanvasHighlight, ToolCanvasTarget } from 'ooxml-ui/pptx/ai';
7
7
  export { PptxAiBridge, PptxAiConfig, PptxAiConnection, PptxAiContextStrategy, PptxAiToolName, PptxAiUIMessage, PptxAiWritePolicy } from 'ooxml-ui/pptx/ai';
8
8
  import { LocaleCatalogEntry } from 'ooxml-ui/pptx/i18n';
9
- import { PptxSlide, PptxData, SvgExportOptions, PptxSaveFormat, PptxElement, PptxChartData, PptxComment, PptxSlideMaster, PptxNotesMaster, PptxHandoutMaster, PptxSection, PptxHandler, PptxAnimationPreset, PptxHeaderFooter, PptxPresentationProperties, PptxCustomShow, PptxCoreProperties, PptxAppProperties, PptxCustomProperty, PptxTagCollection, TextSegment, MasterViewTab, ShapePptxElement, PptxLayoutOption, PptxLayoutPreview, PptxTransitionType, PptxSlideTransition, PptxTableData, PptxTheme, PptxViewProperties, PptxModernCommentAuthor, PptxCommentAuthor, PptxSlideSize, ParsedTableStyleMap, PptxModifyVerifier, PptxCompatibilityWarning, PptxEmbeddedFont, PptxThemeOption, PptxThemeColorScheme, PptxHandlerLoadOptions, PptxHandlerSaveOptions } from 'ooxml-core/pptx';
9
+ import { PptxSlide, PptxData, SvgExportOptions, PptxCoreProperties, PptxSaveFormat, PptxElement, PptxChartData, PptxComment, PptxSlideMaster, PptxNotesMaster, PptxHandoutMaster, PptxSection, PptxHandler, PptxAnimationPreset, PptxHeaderFooter, PptxPresentationProperties, PptxCustomShow, PptxAppProperties, PptxCustomProperty, PptxTagCollection, TextSegment, MasterViewTab, ShapePptxElement, PptxLayoutOption, PptxLayoutPreview, PptxTransitionType, PptxSlideTransition, PptxTableData, PptxTheme, PptxViewProperties, PptxModernCommentAuthor, PptxCommentAuthor, PptxSlideSize, ParsedTableStyleMap, PptxModifyVerifier, PptxCompatibilityWarning, PptxEmbeddedFont, PptxThemeOption, PptxThemeColorScheme, PptxHandlerLoadOptions, PptxHandlerSaveOptions } from 'ooxml-core/pptx';
10
10
 
11
11
  /**
12
12
  * Animated-GIF export capture/encode pipeline. All the pure logic is shared:
@@ -415,6 +415,12 @@ interface PowerPointViewerProps extends ViewportFitOptions {
415
415
  * the toolbar. Default false (read-only viewer).
416
416
  */
417
417
  editable?: boolean;
418
+ /**
419
+ * Makes the deck read-only (default `false`). It is the inverse of the edit switch: true wins
420
+ * over it, false only lifts this restriction, so editing still needs the edit switch and
421
+ * is never granted over a collaboration `viewer` role or `capabilities.edit`.
422
+ */
423
+ readOnly?: boolean;
418
424
  /** Optional class name applied to the root element. */
419
425
  class?: string;
420
426
  /** Optional display name shown in the desktop title bar. */
@@ -498,8 +504,29 @@ interface PowerPointViewerProps extends ViewportFitOptions {
498
504
  * @default 120000 (Options > Save, "every 2 minutes")
499
505
  */
500
506
  autosaveIntervalMs?: number;
507
+ /**
508
+ * Host-owned storage (`DocumentStorage` from `ooxml-core/embedding`). When set,
509
+ * Save and Save As hand the bytes to `storage.save()` instead of downloading
510
+ * them, and recovery autosave snapshots go to the storage's recovery methods
511
+ * (`readRecovery` / `writeRecovery` / `clearRecovery`) instead of IndexedDB
512
+ * when it provides them.
513
+ */
514
+ storage?: DocumentStorage;
501
515
  /** Fired with the serialized `.pptx` bytes after each successful autosave. */
502
516
  onautosave?: (bytes: Uint8Array) => void;
517
+ /** Fired on every autosave lifecycle transition (`idle`, `saving`, `saved`, `error`). */
518
+ onautosavestatus?: (status: ViewerAutosaveStatus) => void;
519
+ /**
520
+ * Fired when a recovery snapshot left by a previous session is found for this deck. The
521
+ * built-in recovery prompt is shown as well.
522
+ */
523
+ onautosaverecovery?: (record: AutosaveRecord) => void;
524
+ /** Fired with the changed fields when the user edits the document properties. */
525
+ onpropertieschange?: (updates: Partial<PptxCoreProperties>) => void;
526
+ /** Fired when presentation (slide show) mode is entered (`true`) or left (`false`). */
527
+ onpresentationchange?: (presenting: boolean) => void;
528
+ /** Fired on every collaboration connection-status transition. */
529
+ oncollaborationstatus?: (status: ConnectionStatus) => void;
503
530
  /**
504
531
  * Real-time collaboration configuration. When provided, the viewer connects
505
532
  * to the room (y-websocket or serverless y-webrtc), publishes local edits
@@ -800,6 +827,8 @@ interface AutosaveDeps {
800
827
  getIntervalMs: () => number;
801
828
  /** IndexedDB record key (host `filePath`); autosave is disabled without one. */
802
829
  getFilePath: () => string | undefined;
830
+ /** Host `storage` prop: recovery snapshots go to its recovery methods when it has them. */
831
+ getStorage?: () => DocumentStorage | undefined;
803
832
  /** The current editable slides (watched for edits). */
804
833
  getSlides: () => PptxSlide[];
805
834
  /**
@@ -1692,6 +1721,8 @@ interface EditorStateDeps {
1692
1721
  */
1693
1722
  setHandler?: (handler: PptxHandler, keepPrevious?: boolean, data?: PptxData) => void;
1694
1723
  onChange?: () => void;
1724
+ /** The host's `onpropertieschange`: the core fields a user edit changed. */
1725
+ onCorePropertiesChange?: (updates: Partial<PptxCoreProperties>) => void;
1695
1726
  }
1696
1727
  declare class EditorState {
1697
1728
  #private;
@@ -1963,7 +1994,12 @@ declare class EditorState {
1963
1994
  nudgeSelected: (dx: number, dy: number) => void;
1964
1995
  commitInlineText: (id: string, text: string, snapshot?: InlineTextEditSnapshot) => void;
1965
1996
  commitNotes: (notes: string, notesSegments?: TextSegment[]) => void;
1966
- updateDocumentProperties(core: PptxCoreProperties, app: PptxAppProperties, custom: PptxCustomProperty[]): void;
1997
+ /**
1998
+ * Replace the document properties as one undoable edit. `reported` is what the host's
1999
+ * `onpropertieschange` hears (the dialog's saved core by default); pass `null` for an
2000
+ * edit that is not a user change to the core properties (app or custom ones, the AI).
2001
+ */
2002
+ updateDocumentProperties(core: PptxCoreProperties, app: PptxAppProperties, custom: PptxCustomProperty[], reported?: Partial<PptxCoreProperties> | null): void;
1967
2003
  /**
1968
2004
  * Seed the deck's tag parts straight after a load. Deliberately NOT an undo
1969
2005
  * step: the load already cleared history, and treating the parsed value as
@@ -2346,6 +2382,9 @@ interface RibbonProps {
2346
2382
  onundo: () => void;
2347
2383
  onredo: () => void;
2348
2384
  onsave: () => void;
2385
+ /** File > Save (backstage Save item); falls back to {@link ondownload}. */
2386
+ onsavefile?: () => void;
2387
+ /** Save As > PowerPoint Presentation (.pptx). */
2349
2388
  ondownload: () => void;
2350
2389
  ondownloadppsx: () => void;
2351
2390
  ondownloadpptm: () => void;
@@ -2884,7 +2923,9 @@ interface EditingApi {
2884
2923
  deleteSelected(): void;
2885
2924
  getSelectedElementId(): string | null;
2886
2925
  save(format?: PptxSaveFormat): Promise<Uint8Array>;
2926
+ /** Save As `format` (reported to host storage as `saveAs`). */
2887
2927
  downloadAs(format: PptxSaveFormat, fileName?: string): Promise<void>;
2928
+ /** File > Save as `.pptx` (reported to host storage as `save`). */
2888
2929
  downloadPptx(fileName?: string): Promise<void>;
2889
2930
  }
2890
2931
 
@@ -3259,6 +3300,8 @@ interface AutosaveRecoveryDeps {
3259
3300
  getFilePath: () => string | undefined;
3260
3301
  /** Public document name rendered in the recovery message. */
3261
3302
  getFileName?: () => string | undefined;
3303
+ /** Host `storage` prop: recovery snapshots go to its recovery methods when it has them. */
3304
+ getStorage?: () => DocumentStorage | undefined;
3262
3305
  /**
3263
3306
  * Whether recovery snapshots are permitted at all, which is the HOST prop
3264
3307
  * (`autosave !== false`) and not the user's toggle: someone who merely
@@ -3273,6 +3316,8 @@ interface AutosaveRecoveryDeps {
3273
3316
  getLoadCount: () => number;
3274
3317
  /** The loader's own load path, the same one the backstage recent list uses. */
3275
3318
  load: (bytes: Uint8Array) => Promise<void> | void;
3319
+ /** The host's `onautosaverecovery`: called with the record when a snapshot is offered. */
3320
+ onOffered?: (record: AutosaveRecord) => void;
3276
3321
  }
3277
3322
  declare class AutosaveRecoveryController {
3278
3323
  #private;
@@ -3311,8 +3356,10 @@ declare class CompatToastsState {
3311
3356
  get overflowCount(): number;
3312
3357
  dismiss(id: string): void;
3313
3358
  dismissAll(): void;
3314
- /** Clear the dismissal state for a newly loaded document. */
3359
+ /** Clear the dismissal state (and any notice) for a newly loaded document. */
3315
3360
  reset(): void;
3361
+ /** Show a notice (a failed Save) in the stack; shown again if it was dismissed. */
3362
+ notify(toast: CompatibilityWarningToast): void;
3316
3363
  }
3317
3364
 
3318
3365
  /** Live viewer accessors + the panel-open hook the controller closes over. */
@@ -3499,7 +3546,12 @@ declare class ViewerOptionsState {
3499
3546
  * `resolveAutosaveIntervalMs` in shared, not re-invented here.
3500
3547
  */
3501
3548
  get autosaveIntervalSeconds(): number;
3502
- /** Options > Save > "Delete cached files": drop all recovery snapshots. */
3549
+ /** Wire the host `storage` prop, so the cache sweeps run against the host's recovery store. */
3550
+ bindStorage(storage: () => DocumentStorage | undefined): void;
3551
+ /**
3552
+ * Options > Save > "Delete cached files": drop all recovery snapshots (IndexedDB, or the
3553
+ * host's recovery store when it lists its copies; otherwise retention is the host's job).
3554
+ */
3503
3555
  clearCache(): Promise<void>;
3504
3556
  /**
3505
3557
  * Options > Save > "keep the last AutoRecover version": whether a
@@ -3714,6 +3766,8 @@ interface CreateViewerStateOptions {
3714
3766
  getAutosave: () => boolean | undefined;
3715
3767
  autosaveIntervalMs?: number;
3716
3768
  getFilePath: () => string | undefined;
3769
+ /** Host `storage` prop: Save goes to `storage.save()`; recovery copies to its recovery methods. */
3770
+ getStorage?: () => DocumentStorage | undefined;
3717
3771
  /** Host `authorName` prop: comment/reply author and the broadcast presenter name. */
3718
3772
  getAuthorName?: () => string | undefined;
3719
3773
  getInitialSlide: () => number;
@@ -3754,6 +3808,11 @@ interface CreateViewerStateOptions {
3754
3808
  onautosave?: (bytes: Uint8Array) => void;
3755
3809
  /** Fired when the host toggles AutoSave (title bar / Settings dialog). */
3756
3810
  onautosavetoggle?: (enabled: boolean) => void;
3811
+ onautosavestatus?: (status: ViewerAutosaveStatus) => void;
3812
+ onautosaverecovery?: (record: AutosaveRecord) => void;
3813
+ onpropertieschange?: (updates: Partial<PptxCoreProperties>) => void;
3814
+ onpresentationchange?: (presenting: boolean) => void;
3815
+ oncollaborationstatus?: (status: ConnectionStatus) => void;
3757
3816
  onstartcollaboration?: (config: CollaborationConfig) => void;
3758
3817
  oncollaborationchange?: (state: CollaborationState) => void;
3759
3818
  onstopcollaboration?: () => void;
@@ -1,5 +1,5 @@
1
- import "../transition-overlay-Ca1_ksUi.js";
2
- import { S as e, _ as a, a as S, b as o, c as v, d as n, f as d, g as r, h as b, i as p, l as c, m, n as g, o as x, p as w, r as C, s as T, t as $, u as y, v as s, x as t } from "../export-BK-HTwwB.js";
1
+ import "../transition-overlay-C-ut2gr6.js";
2
+ import { S as e, _ as a, a as S, b as o, c as v, d as n, f as d, g as r, h as b, i as p, l as c, m, n as g, o as x, p as w, r as C, s as T, t as $, u as y, v as s, x as t } from "../export-Bh9pAUzY.js";
3
3
  var P = e, V = t, u = s, A = a, R = r, f = o;
4
4
  export {
5
5
  A as CollaborationCursors,
@@ -1,4 +1,4 @@
1
- import { M as Fe, N as pr, j as gr } from "./transition-overlay-Ca1_ksUi.js";
1
+ import { M as Fe, N as pr, j as gr } from "./transition-overlay-C-ut2gr6.js";
2
2
  import { $ as yr, A as br, B as Ct, D as mr, E as ut, F as _r, G as Ye, H as vr, I as Mt, J as je, K as wr, L as lt, M as se, O as Er, P as ae, R as ce, S as Cr, T as Rr, U as Rt, V as Sr, W as St, X as Tr, Y as ht, Z as Ar, _ as kr, a as Or, at as xr, b as Ge, c as Nr, d as Lr, et as Mr, f as Dr, g as Ir, i as Tt, it as Pr, j as it, k as Dt, l as jr, m as Ur, n as Br, nt as ft, o as It, ot as Fr, p as $r, q as Pt, r as $e, rt as jt, s as qr, st, t as Wr, tt as dt, u as Hr, v as Vr, w as Ut, x as Yr, y as Gr, z as Le } from "./awareness-BwmJcSKy.js";
3
3
  import "yjs";
4
4
  var zr = 1200, Kr = 2500, qe = 3e4, ot = (r) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pptx-svelte-viewer",
3
- "version": "4.46.0",
3
+ "version": "4.47.0",
4
4
  "description": "pptx-viewer for Svelte 5: a PowerPoint viewer and editor component to render, edit, present, and export PPTX slides in the browser.",
5
5
  "keywords": [
6
6
  "office",
@@ -116,8 +116,8 @@
116
116
  "html2canvas-pro": "^2.5.2",
117
117
  "jspdf": "^4.2.1",
118
118
  "jszip": "^3.10.2",
119
- "ooxml-core": "^1.23.0",
120
- "ooxml-ui": "^1.22.0",
119
+ "ooxml-core": "^1.24.0",
120
+ "ooxml-ui": "^1.23.0",
121
121
  "opentype.js": "^2.0.0"
122
122
  },
123
123
  "devDependencies": {