pptx-svelte-viewer 1.0.0 → 1.2.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.
@@ -17,6 +17,12 @@ export type Translator = (key: string, params?: Record<string, string | number>)
17
17
  * merged over earlier ones, so hosts can override individual keys.
18
18
  */
19
19
  export declare function registerTranslations(locale: string, dictionary: TranslationDictionary): void;
20
+ /**
21
+ * List every locale code with a registered dictionary: `en` (built in) plus
22
+ * anything added via {@link registerTranslations}. Used by File > Options'
23
+ * Language tab to offer only locales the host has actually wired up.
24
+ */
25
+ export declare function getRegisteredLocales(): string[];
20
26
  /** Interpolate `{{name}}` placeholders (the shared-dictionary convention). */
21
27
  export declare function interpolate(message: string, params: Record<string, string | number> | undefined): string;
22
28
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"translator.d.ts","sourceRoot":"","sources":["../../src/i18n/translator.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,oEAAoE;AACpE,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3D,4EAA4E;AAC5E,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,MAAM,CAAC;AAI3F;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,qBAAqB,GAAG,IAAI,CAG5F;AAED,8EAA8E;AAC9E,wBAAgB,WAAW,CAC1B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,SAAS,GACjD,MAAM,CAQR;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACxB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GACtC,MAAM,CAOR;AAED,kEAAkE;AAClE,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,MAAM,GAAG,UAAU,CAEpE"}
1
+ {"version":3,"file":"translator.d.ts","sourceRoot":"","sources":["../../src/i18n/translator.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,oEAAoE;AACpE,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE3D,4EAA4E;AAC5E,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,MAAM,CAAC;AAI3F;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,qBAAqB,GAAG,IAAI,CAG5F;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAE/C;AAED,8EAA8E;AAC9E,wBAAgB,WAAW,CAC1B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,SAAS,GACjD,MAAM,CAQR;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACxB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GACtC,MAAM,CAOR;AAED,kEAAkE;AAClE,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,MAAM,GAAG,UAAU,CAEpE"}
package/dist/i18n.d.ts CHANGED
@@ -22,6 +22,23 @@ type TranslationKey = keyof typeof translationsEn;
22
22
  */
23
23
  declare function keyToLabel(key: string): string;
24
24
 
25
+ /** One selectable entry in the viewer chrome's built-in language picker (File > Options > Language). */
26
+ interface LocaleCatalogEntry {
27
+ /** BCP-47-ish locale code, e.g. `'en'`, `'fr'`. Matches `pptx-viewer-locales`' exports. */
28
+ code: string;
29
+ /** English display name, used before a translation dictionary for the target locale is loaded. */
30
+ label: string;
31
+ /** The locale's own name for itself, e.g. `'Français'` for `fr`. */
32
+ nativeLabel: string;
33
+ }
34
+ /**
35
+ * Built-in language choices offered by File > Options > Language when a host
36
+ * doesn't supply its own `availableLocales`. Mirrors the locales shipped by
37
+ * the optional `pptx-viewer-locales` package (English needs no dictionary,
38
+ * it's the viewer's own baseline).
39
+ */
40
+ declare const LOCALE_CATALOG: readonly LocaleCatalogEntry[];
41
+
25
42
  /**
26
43
  * Minimal, dependency-free translation layer for the Svelte binding.
27
44
  *
@@ -41,6 +58,12 @@ type Translator = (key: string, params?: Record<string, string | number>) => str
41
58
  * merged over earlier ones, so hosts can override individual keys.
42
59
  */
43
60
  declare function registerTranslations(locale: string, dictionary: TranslationDictionary): void;
61
+ /**
62
+ * List every locale code with a registered dictionary: `en` (built in) plus
63
+ * anything added via {@link registerTranslations}. Used by File > Options'
64
+ * Language tab to offer only locales the host has actually wired up.
65
+ */
66
+ declare function getRegisteredLocales(): string[];
44
67
  /** Interpolate `{{name}}` placeholders (the shared-dictionary convention). */
45
68
  declare function interpolate(message: string, params: Record<string, string | number> | undefined): string;
46
69
  /**
@@ -52,5 +75,5 @@ declare function translate(locale: string, key: string, params?: Record<string,
52
75
  /** Build a {@link Translator} bound to a (lazily-read) locale. */
53
76
  declare function createTranslator(getLocale: () => string): Translator;
54
77
 
55
- export { createTranslator, interpolate, keyToLabel, registerTranslations, translate, translationsEn };
56
- export type { TranslationDictionary, TranslationKey, Translator };
78
+ export { LOCALE_CATALOG, createTranslator, getRegisteredLocales, interpolate, keyToLabel, registerTranslations, translate, translationsEn };
79
+ export type { LocaleCatalogEntry, TranslationDictionary, TranslationKey, Translator };
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACrE,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnG,YAAY,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACrF,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EACN,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,oBAAoB,EACpB,SAAS,GACT,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/i18n.js CHANGED
@@ -1,9 +1,11 @@
1
- import { a as r, i as s, n as t, o as e, r as n, t as o } from "./translator-X_R9mNNj.js";
1
+ import { a as s, c as e, i as t, n as r, o, r as n, s as i, t as l } from "./translator-D4a_pxY4.js";
2
2
  export {
3
- o as createTranslator,
4
- t as interpolate,
5
- r as keyToLabel,
6
- n as registerTranslations,
3
+ o as LOCALE_CATALOG,
4
+ l as createTranslator,
5
+ r as getRegisteredLocales,
6
+ n as interpolate,
7
+ i as keyToLabel,
8
+ t as registerTranslations,
7
9
  s as translate,
8
10
  e as translationsEn
9
11
  };
package/dist/index.d.ts CHANGED
@@ -6504,6 +6504,16 @@ declare const vermilionLightTheme: ViewerTheme;
6504
6504
  /** Dark vermilion theme, ready for the viewer's `theme` prop. */
6505
6505
  declare const vermilionDarkTheme: ViewerTheme;
6506
6506
 
6507
+ /** One selectable entry in the viewer chrome's built-in theme picker (File > Options > Appearance). */
6508
+ interface ThemeCatalogEntry {
6509
+ /** Stable identifier persisted to storage and passed to `onThemeChange`. */
6510
+ key: string;
6511
+ /** `pptx.*` translation key for the entry's display label. */
6512
+ labelKey: string;
6513
+ /** The theme to apply, or `undefined` to reset to the built-in default. */
6514
+ theme: ViewerTheme | undefined;
6515
+ }
6516
+
6507
6517
  /**
6508
6518
  * Framework-agnostic public types shared by the viewer bindings.
6509
6519
  *
@@ -6719,6 +6729,21 @@ declare function listAutosaveSnapshots(): Promise<Array<{
6719
6729
  * Delete an autosave snapshot by file path.
6720
6730
  */
6721
6731
  declare function deleteAutosaveSnapshot(filePath: string): Promise<boolean>;
6732
+ /**
6733
+ * Optional hook point for hosts that want to wire a real sign-in flow into
6734
+ * File > Account. Disabled by default: the Account page renders nothing
6735
+ * extra unless a host explicitly opts in by passing `enabled: true`.
6736
+ * See docs/guide for wiring instructions.
6737
+ */
6738
+ interface AccountAuthConfig {
6739
+ enabled: boolean;
6740
+ onSignIn: () => void;
6741
+ signedInUser?: {
6742
+ name: string;
6743
+ email?: string;
6744
+ avatarUrl?: string;
6745
+ };
6746
+ }
6722
6747
 
6723
6748
  /**
6724
6749
  * Toolbar action / ribbon-tab visibility: a single, framework-agnostic
@@ -6789,6 +6814,16 @@ interface PrintSettings {
6789
6814
  customRangeTo: number;
6790
6815
  }
6791
6816
 
6817
+ /** One selectable entry in the viewer chrome's built-in language picker (File > Options > Language). */
6818
+ interface LocaleCatalogEntry {
6819
+ /** BCP-47-ish locale code, e.g. `'en'`, `'fr'`. Matches `pptx-viewer-locales`' exports. */
6820
+ code: string;
6821
+ /** English display name, used before a translation dictionary for the target locale is loaded. */
6822
+ label: string;
6823
+ /** The locale's own name for itself, e.g. `'Français'` for `fr`. */
6824
+ nativeLabel: string;
6825
+ }
6826
+
6792
6827
  /**
6793
6828
  * Animated-GIF export capture/encode pipeline. All the pure logic is shared:
6794
6829
  * `planGifFrames` derives the per-slide frame delays (default duration +
@@ -6934,6 +6969,49 @@ interface PowerPointViewerProps {
6934
6969
  theme?: ViewerTheme;
6935
6970
  /** UI locale (BCP 47). English ships built in; register others via `pptx-svelte-viewer/i18n`. */
6936
6971
  locale?: string;
6972
+ /**
6973
+ * Initial File > Options > Appearance selection: a key into `availableThemes`
6974
+ * (or the built-in `THEME_CATALOG` when unset). Falls back to a value
6975
+ * persisted in `localStorage` (see `pptx-viewer-shared`'s
6976
+ * `readStoredViewerPrefs`), then `'default'`. Once the user picks a theme
6977
+ * from the Design tab or Options, that choice (`themeKey`) is the single
6978
+ * source of truth for `effectiveTheme` for the rest of the session; the
6979
+ * `theme` prop above still wins whenever the resolved key is `'default'`
6980
+ * (its entry maps to `undefined`), preserving prior host-prop precedence.
6981
+ */
6982
+ defaultThemeKey?: string;
6983
+ /** Theme choices offered by File > Options > Appearance. Defaults to the built-in `THEME_CATALOG`. */
6984
+ availableThemes?: readonly ThemeCatalogEntry[];
6985
+ /**
6986
+ * Fired when the user picks a theme (Design tab or File > Options >
6987
+ * Appearance) with the selected catalog key. Supplying this hands
6988
+ * persistence to the host; without it, the choice is written to
6989
+ * `localStorage` automatically.
6990
+ */
6991
+ onThemeChange?: (themeKey: string) => void;
6992
+ /**
6993
+ * Initial File > Options > Language selection (locale code). Falls back to
6994
+ * a value persisted in `localStorage`, then the `locale` prop. Once the
6995
+ * user picks a language from Options, that choice always wins over `locale`
6996
+ * for the rest of the session: unlike `theme`, there is no "host forces
6997
+ * this language no matter what" case in this binding.
6998
+ */
6999
+ defaultLocale?: string;
7000
+ /** Language choices offered by File > Options > Language. Defaults to every locale registered via `pptx-svelte-viewer/i18n`'s `registerTranslations`, labelled from the shared `LOCALE_CATALOG`. */
7001
+ availableLocales?: readonly LocaleCatalogEntry[];
7002
+ /**
7003
+ * Fired when the user picks a language from File > Options > Language with
7004
+ * the selected locale code. Supplying this hands persistence to the host;
7005
+ * without it, the choice is written to `localStorage` automatically. Note
7006
+ * this only switches which registered dictionary is read; registering the
7007
+ * dictionary itself is a separate step (`registerTranslations`).
7008
+ */
7009
+ onLocaleChange?: (locale: string) => void;
7010
+ /**
7011
+ * Optional hook point for a real sign-in flow in File > Account. Disabled
7012
+ * by default (renders nothing extra) unless `enabled: true`.
7013
+ */
7014
+ accountAuth?: AccountAuthConfig;
6937
7015
  /** Slide shown after load (0-based, clamped). Default 0. */
6938
7016
  initialSlide?: number;
6939
7017
  /** Show the thumbnail sidebar. Default true. */
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
- import { C as e, D as a, E as o, S as r, T as t, _ as i, b as l, d as n, f as m, g as S, h as d, l as p, m as v, p as g, t as h, u as T, v as u, w as x, x as f, y as A } from "./export-tBg928r6.js";
2
- import { r as D } from "./translator-X_R9mNNj.js";
1
+ import { C as e, D as a, E as o, S as t, T as i, _ as r, b as l, d as n, f as m, g as S, h as d, l as p, m as v, p as g, t as h, u as T, v as u, w as x, x as f, y as A } from "./export-CalS6VEm.js";
2
+ import { i as D } from "./translator-D4a_pxY4.js";
3
3
  import "./i18n.js";
4
4
  export {
5
5
  h as PowerPointViewer,
6
6
  v as defaultCssVars,
7
7
  d as defaultRadius,
8
8
  S as defaultThemeColors,
9
- i as deleteAutosaveSnapshot,
9
+ r as deleteAutosaveSnapshot,
10
10
  p as exportAllSlidesToSvg,
11
11
  T as exportAllSlidesToSvgBlobs,
12
12
  n as exportSlideAsSvg,
@@ -17,10 +17,10 @@ export {
17
17
  l as loadPresentationDeck,
18
18
  f as parsePresentationSessionId,
19
19
  D as registerTranslations,
20
- r as themeToCssVars,
20
+ t as themeToCssVars,
21
21
  e as vermilionDarkColors,
22
22
  x as vermilionDarkTheme,
23
- t as vermilionLightColors,
23
+ i as vermilionLightColors,
24
24
  o as vermilionLightTheme,
25
25
  a as vermilionRadius
26
26
  };