pptx-svelte-viewer 2.14.0 → 2.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -8633,6 +8633,64 @@ interface ViewerFontSource {
8633
8633
  weight?: string | number;
8634
8634
  style?: 'normal' | 'italic';
8635
8635
  }
8636
+ //#endregion
8637
+ //#region src/render/session-restore.d.ts
8638
+ /**
8639
+ * session-restore: keep the deck a host app has open across a page refresh.
8640
+ *
8641
+ * A host (the demo apps, or any embedder) owns the bytes it hands to the
8642
+ * viewer, so a plain reload drops them and the user lands back on the file
8643
+ * dropzone with their presentation gone. This store remembers the open deck in
8644
+ * IndexedDB and hands it back on the next load.
8645
+ *
8646
+ * Scope is deliberately per-tab: the record is keyed by an id kept in
8647
+ * `sessionStorage`, which survives a reload but NOT a new tab. Refreshing
8648
+ * restores the deck this tab had open, while a second tab opened on the same
8649
+ * origin still starts on the landing page, and two tabs holding different decks
8650
+ * never steal each other's content.
8651
+ *
8652
+ * `restoreSessionDeck` additionally prefers a NEWER autosave snapshot for the
8653
+ * same file (see `./autosave-store`), so a refresh mid-edit comes back with the
8654
+ * edited deck rather than the pristine bytes that were first opened.
8655
+ *
8656
+ * Every operation is best-effort: a blocked IndexedDB, a partitioned
8657
+ * `sessionStorage`, or an exhausted quota degrades to "no restore", never to a
8658
+ * thrown error in the host.
8659
+ */
8660
+ /** A deck remembered for the current tab. */
8661
+ interface SessionDeck {
8662
+ /** File name the deck was opened under, used as the autosave key. */
8663
+ fileName: string;
8664
+ /** The presentation bytes. */
8665
+ data: Uint8Array;
8666
+ /** When these bytes were remembered (epoch ms). */
8667
+ timestamp: number;
8668
+ }
8669
+ /**
8670
+ * This tab's session id, or `null` when `sessionStorage` is unavailable (a
8671
+ * sandboxed iframe, or a browser with storage disabled).
8672
+ *
8673
+ * @param create Mint and persist an id when the tab does not have one yet.
8674
+ * Reads pass `false` so a fresh tab never claims another tab's record.
8675
+ */
8676
+ declare function getSessionTabId(create?: boolean): string | null;
8677
+ /**
8678
+ * Remember `data` as the deck this tab has open, so the next load can restore
8679
+ * it. Resolves `false` when the browser refused to store it; callers treat that
8680
+ * as "no restore available later", never as an error.
8681
+ */
8682
+ declare function rememberSessionDeck(fileName: string, data: Uint8Array): Promise<boolean>;
8683
+ /** The deck remembered for this tab, or `null` when there is nothing to restore. */
8684
+ declare function loadSessionDeck(): Promise<SessionDeck | null>;
8685
+ /** Forget this tab's deck (the host closed it, or handed the tab to another flow). */
8686
+ declare function forgetSessionDeck(): Promise<void>;
8687
+ /**
8688
+ * The deck to reopen on load: this tab's remembered bytes, upgraded to a newer
8689
+ * autosave snapshot of the same file when the viewer wrote one after they were
8690
+ * remembered. Without that upgrade a refresh mid-edit would silently roll the
8691
+ * presentation back to the state it was opened in.
8692
+ */
8693
+ declare function restoreSessionDeck(): Promise<SessionDeck | null>;
8636
8694
  declare function parsePresentationSessionId(hash: string): string | null;
8637
8695
  declare function loadPresentationDeck(sessionId: string): Promise<Uint8Array | null>;
8638
8696
  interface AutosaveRecord {
@@ -9381,5 +9439,5 @@ declare const PowerPointViewer: Component<PowerPointViewerProps, PowerPointViewe
9381
9439
  */
9382
9440
  type AutosaveStatus = 'idle' | 'disabled' | 'saving' | 'saved' | 'error';
9383
9441
 
9384
- export { PowerPointViewer, defaultCssVars, defaultRadius, defaultThemeColors, deleteAutosaveSnapshot, exportAllSlidesToSvg, exportAllSlidesToSvgBlobs, exportSlideAsSvg, exportSlideToSvg, exportSlideToSvgBlob, getAutosaveSnapshot, listAutosaveSnapshots, loadPresentationDeck, parsePresentationSessionId, registerTranslations, themeToCssVars, vermilionDarkColors, vermilionDarkTheme, vermilionLightColors, vermilionLightTheme, vermilionRadius };
9385
- export type { AutosaveRecord, AutosaveStatus, CanvasSize, CollaborationConfig, CollaborationRole, CollaborationTransport, ExportGifOptions, ExportPdfOptions, ExportVideoOptions, PowerPointViewerApi, PowerPointViewerProps, PptxAiBridge, PptxAiConfig, PptxAiConnection, PptxAiContextStrategy, PptxAiToolName, PptxAiUIMessage, PptxAiWritePolicy, PrintOptions, SvgExportAllOptions, SvgExportSingleSlideOptions, TranslationDictionary, Translator, ViewerLoadDetail, ViewerTheme, ViewerThemeColors };
9442
+ export { PowerPointViewer, defaultCssVars, defaultRadius, defaultThemeColors, deleteAutosaveSnapshot, exportAllSlidesToSvg, exportAllSlidesToSvgBlobs, exportSlideAsSvg, exportSlideToSvg, exportSlideToSvgBlob, forgetSessionDeck, getAutosaveSnapshot, getSessionTabId, listAutosaveSnapshots, loadPresentationDeck, loadSessionDeck, parsePresentationSessionId, registerTranslations, rememberSessionDeck, restoreSessionDeck, themeToCssVars, vermilionDarkColors, vermilionDarkTheme, vermilionLightColors, vermilionLightTheme, vermilionRadius };
9443
+ export type { AutosaveRecord, AutosaveStatus, CanvasSize, CollaborationConfig, CollaborationRole, CollaborationTransport, ExportGifOptions, ExportPdfOptions, ExportVideoOptions, PowerPointViewerApi, PowerPointViewerProps, PptxAiBridge, PptxAiConfig, PptxAiConnection, PptxAiContextStrategy, PptxAiToolName, PptxAiUIMessage, PptxAiWritePolicy, PrintOptions, SessionDeck, SvgExportAllOptions, SvgExportSingleSlideOptions, TranslationDictionary, Translator, ViewerLoadDetail, ViewerTheme, ViewerThemeColors };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EACX,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,2BAA2B,GAC3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,oBAAoB,EACpB,yBAAyB,EACzB,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,GACpB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACX,UAAU,EACV,mBAAmB,EACnB,i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B,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,GACX,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACX,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,iBAAiB,GACjB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAIrE,OAAO,EACN,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAItF,OAAO,EACN,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,kBAAkB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACN,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,GACf,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAC9C,YAAY,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC"}
package/dist/index.js CHANGED
@@ -1,26 +1,31 @@
1
- import { $ as e, G as a, H as o, J as t, K as i, Q as r, U as l, W as n, X as m, Y as S, Z as d, a as p, c as v, et as g, l as h, o as T, q as u, s as x, t as A, tt as f } from "./export-XXVZWCfW.js";
2
- import { i as P } from "./translator-CUlfH48o.js";
1
+ import { $ as e, G as o, H as a, J as t, K as i, Q as r, U as l, W as n, X as S, Y as m, Z as d, a as p, at as v, c as g, et as T, it as h, l as u, nt as k, o as D, ot as c, q as f, rt as x, s as A, t as C, tt as b } from "./export-DbAQ7rQu.js";
2
+ import { i as V } from "./translator-CUlfH48o.js";
3
3
  import "./i18n.js";
4
4
  export {
5
- A as PowerPointViewer,
6
- o as defaultCssVars,
5
+ C as PowerPointViewer,
6
+ a as defaultCssVars,
7
7
  l as defaultRadius,
8
8
  n as defaultThemeColors,
9
- a as deleteAutosaveSnapshot,
9
+ o as deleteAutosaveSnapshot,
10
10
  p as exportAllSlidesToSvg,
11
- T as exportAllSlidesToSvgBlobs,
12
- x as exportSlideAsSvg,
13
- v as exportSlideToSvg,
14
- h as exportSlideToSvgBlob,
15
- i as getAutosaveSnapshot,
16
- u as listAutosaveSnapshots,
17
- t as loadPresentationDeck,
18
- S as parsePresentationSessionId,
19
- P as registerTranslations,
20
- m as themeToCssVars,
21
- d as vermilionDarkColors,
22
- r as vermilionDarkTheme,
23
- e as vermilionLightColors,
24
- g as vermilionLightTheme,
25
- f as vermilionRadius
11
+ D as exportAllSlidesToSvgBlobs,
12
+ A as exportSlideAsSvg,
13
+ g as exportSlideToSvg,
14
+ u as exportSlideToSvgBlob,
15
+ i as forgetSessionDeck,
16
+ f as getAutosaveSnapshot,
17
+ t as getSessionTabId,
18
+ m as listAutosaveSnapshots,
19
+ S as loadPresentationDeck,
20
+ d as loadSessionDeck,
21
+ r as parsePresentationSessionId,
22
+ V as registerTranslations,
23
+ e as rememberSessionDeck,
24
+ T as restoreSessionDeck,
25
+ b as themeToCssVars,
26
+ k as vermilionDarkColors,
27
+ x as vermilionDarkTheme,
28
+ h as vermilionLightColors,
29
+ v as vermilionLightTheme,
30
+ c as vermilionRadius
26
31
  };
@@ -1,22 +1,22 @@
1
- import { A as e, O as a, a as s, c as t, d as i, f as l, g as S, i as n, k as o, l as v, n as d, nt as b, o as g, r as p, rt as c, s as x, t as w, u as T } from "../export-XXVZWCfW.js";
1
+ import { A as e, O as a, a as s, c as t, ct as i, d as l, f as S, g as n, i as v, k as o, l as d, n as b, o as c, r as g, s as p, st as x, t as w, u as T } from "../export-DbAQ7rQu.js";
2
2
  var m = e, A = o, P = a;
3
3
  export {
4
4
  w as PowerPointViewer,
5
- n as PresentationLoader,
5
+ v as PresentationLoader,
6
6
  m as Ribbon,
7
7
  P as SlideCanvas,
8
- p as ViewerState,
8
+ g as ViewerState,
9
9
  A as ViewerToolbar,
10
10
  T as clampSlideIndex,
11
- S as createSvelteAiBridge,
12
- d as createViewerState,
11
+ n as createSvelteAiBridge,
12
+ b as createViewerState,
13
13
  s as exportAllSlidesToSvg,
14
- g as exportAllSlidesToSvgBlobs,
15
- x as exportSlideAsSvg,
14
+ c as exportAllSlidesToSvgBlobs,
15
+ p as exportSlideAsSvg,
16
16
  t as exportSlideToSvg,
17
- v as exportSlideToSvgBlob,
18
- i as fitScale,
19
- l as resolveNavigationKey,
20
- b as zoomInPercent,
21
- c as zoomOutPercent
17
+ d as exportSlideToSvgBlob,
18
+ l as fitScale,
19
+ S as resolveNavigationKey,
20
+ x as zoomInPercent,
21
+ i as zoomOutPercent
22
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pptx-svelte-viewer",
3
- "version": "2.14.0",
3
+ "version": "2.15.1",
4
4
  "description": "Svelte 5 PowerPoint viewer and editor component: render, edit, present, and export PPTX slides in the browser.",
5
5
  "keywords": [
6
6
  "office",
@@ -70,7 +70,7 @@
70
70
  "html2canvas-pro": "^2.3.2",
71
71
  "jspdf": "^4.2.1",
72
72
  "jszip": "^3.10.1",
73
- "pptx-viewer-mcp": "^2.0.2"
73
+ "pptx-viewer-mcp": "^2.1.0"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@ai-sdk/svelte": "^5.0.31",