pptx-react-viewer 4.50.0 → 4.51.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +38 -4
  3. package/dist/{AiChatPanel-WYAL24DX.js → AiChatPanel-EV22O7UO.js} +19 -20
  4. package/dist/AiChatPanel-EV22O7UO.js.br +0 -0
  5. package/dist/AiChatPanel-EV22O7UO.js.gz +0 -0
  6. package/dist/{AiChatPanel-VJV5OEG2.mjs → AiChatPanel-R323KNGN.mjs} +1 -2
  7. package/dist/AiChatPanel-R323KNGN.mjs.br +0 -0
  8. package/dist/AiChatPanel-R323KNGN.mjs.gz +0 -0
  9. package/dist/{chunk-QHGEPW5G.mjs → chunk-ACFR4LFQ.mjs} +15 -18
  10. package/dist/chunk-ACFR4LFQ.mjs.br +0 -0
  11. package/dist/chunk-ACFR4LFQ.mjs.gz +0 -0
  12. package/dist/{chunk-5JJQLK7N.mjs → chunk-ETJ752B5.mjs} +151 -48
  13. package/dist/chunk-ETJ752B5.mjs.br +0 -0
  14. package/dist/chunk-ETJ752B5.mjs.gz +0 -0
  15. package/dist/{chunk-D5NXYXPP.js → chunk-V3XADJ2O.js} +213 -216
  16. package/dist/chunk-V3XADJ2O.js.br +0 -0
  17. package/dist/chunk-V3XADJ2O.js.gz +0 -0
  18. package/dist/{chunk-4OF7X5EE.js → chunk-VI5DQRQZ.js} +693 -589
  19. package/dist/chunk-VI5DQRQZ.js.br +0 -0
  20. package/dist/chunk-VI5DQRQZ.js.gz +0 -0
  21. package/dist/{chunk-JWNBTFZZ.js → chunk-Z22RD3E2.js} +41 -6
  22. package/dist/chunk-Z22RD3E2.js.br +0 -0
  23. package/dist/chunk-Z22RD3E2.js.gz +0 -0
  24. package/dist/{chunk-77IXTLKU.mjs → chunk-ZCGYPCZM.mjs} +35 -5
  25. package/dist/chunk-ZCGYPCZM.mjs.br +0 -0
  26. package/dist/chunk-ZCGYPCZM.mjs.gz +0 -0
  27. package/dist/index.d.ts +51 -12
  28. package/dist/index.js +28 -24
  29. package/dist/index.js.br +0 -0
  30. package/dist/index.js.gz +0 -0
  31. package/dist/index.mjs +3 -3
  32. package/dist/index.mjs.br +0 -0
  33. package/dist/index.mjs.gz +0 -0
  34. package/dist/internals.js +81 -81
  35. package/dist/internals.js.br +0 -0
  36. package/dist/internals.js.gz +0 -0
  37. package/dist/internals.mjs +2 -2
  38. package/dist/internals.mjs.br +0 -0
  39. package/dist/internals.mjs.gz +0 -0
  40. package/dist/viewer/index.d.ts +51 -12
  41. package/dist/viewer/index.js +23 -19
  42. package/dist/viewer/index.js.br +0 -0
  43. package/dist/viewer/index.js.gz +0 -0
  44. package/dist/viewer/index.mjs +3 -3
  45. package/dist/viewer/index.mjs.br +0 -0
  46. package/dist/viewer/index.mjs.gz +0 -0
  47. package/package.json +3 -3
  48. package/dist/AiChatPanel-VJV5OEG2.mjs.br +0 -0
  49. package/dist/AiChatPanel-VJV5OEG2.mjs.gz +0 -0
  50. package/dist/AiChatPanel-WYAL24DX.js.br +0 -0
  51. package/dist/AiChatPanel-WYAL24DX.js.gz +0 -0
  52. package/dist/chunk-4OF7X5EE.js.br +0 -0
  53. package/dist/chunk-4OF7X5EE.js.gz +0 -0
  54. package/dist/chunk-5JJQLK7N.mjs.br +0 -0
  55. package/dist/chunk-5JJQLK7N.mjs.gz +0 -0
  56. package/dist/chunk-77IXTLKU.mjs.br +0 -0
  57. package/dist/chunk-77IXTLKU.mjs.gz +0 -0
  58. package/dist/chunk-D5NXYXPP.js.br +0 -0
  59. package/dist/chunk-D5NXYXPP.js.gz +0 -0
  60. package/dist/chunk-JWNBTFZZ.js.br +0 -0
  61. package/dist/chunk-JWNBTFZZ.js.gz +0 -0
  62. package/dist/chunk-QHGEPW5G.mjs.br +0 -0
  63. package/dist/chunk-QHGEPW5G.mjs.gz +0 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,25 @@ A release listed with no entries carried no Conventional Commit in this package'
7
7
  scope: scripts/release-plan.mjs releases whenever any published file changes, not only on
8
8
  conventional commits.
9
9
 
10
+ ## [4.51.0](https://github.com/ChristopherVR/ooxml/releases/tag/pptx-react-viewer@4.51.0) - 2026-10-23
11
+
12
+ ### Features
13
+
14
+ - **react:** Let hosts translate the viewer through PptxI18nProvider ([d171dc1](https://github.com/ChristopherVR/ooxml/commit/d171dc1ccabdea3c27cac11db9971fd5d23bdab7))
15
+
16
+ ### Bug Fixes
17
+
18
+ - **xlsx:** Close the open code scanning alerts in core ([0f6b643](https://github.com/ChristopherVR/ooxml/commit/0f6b64306e57958a097caaf7085d63479766acb3))
19
+ - **pptx:** Apply theme picks in place and keep theme tiles stable ([ecb6385](https://github.com/ChristopherVR/ooxml/commit/ecb6385a8e211b60461f842eb4a88945555796e5))
20
+
21
+ ### Refactor
22
+
23
+ - **react:** Route translations through an internal useTranslation hook ([cbe1912](https://github.com/ChristopherVR/ooxml/commit/cbe1912f38747ca01a07fc7475c0103574b5fb62))
24
+
25
+ ### Testing
26
+
27
+ - **pptx:** Copy fixture Buffers by value in the chart save harnesses ([#181](https://github.com/ChristopherVR/ooxml/issues/181)) ([90ce9e4](https://github.com/ChristopherVR/ooxml/commit/90ce9e4704be388ef1ee8723c0b745c3457f07e7))
28
+
10
29
  ## [4.50.0](https://github.com/ChristopherVR/ooxml/releases/tag/pptx-react-viewer@4.50.0) - 2026-10-23
11
30
 
12
31
  ### Features
package/README.md CHANGED
@@ -128,9 +128,9 @@ const bytes = await viewerRef.current?.getContent(); // Uint8Array of a valid .p
128
128
  | `defaultThemeKey` | `string` | n/a | Initial File > Options > Appearance selection when no persisted preference exists |
129
129
  | `availableThemes` | `ThemeCatalogEntry[]` | n/a | Theme choices offered by File > Options > Appearance (defaults to the built-in catalog) |
130
130
  | `onThemeChange` | `(key: string) => void` | n/a | Host hook for the appearance picker; when set, the host owns persisting the choice |
131
- | `defaultLocale` | `string` | n/a | Initial locale code when no persisted preference exists |
132
- | `availableLocales` | `LocaleCatalogEntry[]` | n/a | Locale choices offered by File > Options > Language (defaults to the registered i18next locales) |
133
- | `onLocaleChange` | `(code: string) => void` | n/a | Host hook for the language picker; when set, the host owns applying/persisting the switch |
131
+ | `defaultLocale` | `string` | n/a | Initial locale code when no persisted preference exists. Ignored inside a `PptxI18nProvider`, whose `locale` is the language |
132
+ | `availableLocales` | `LocaleCatalogEntry[]` | n/a | Locale choices offered by File > Options > Language (defaults to the registered i18next locales; inside a `PptxI18nProvider` no default: pass two or more with `onLocaleChange`) |
133
+ | `onLocaleChange` | `(code: string) => void` | n/a | Host hook for the language picker; when set, the host owns applying/persisting the switch. Inside a `PptxI18nProvider` the host always owns it, and without this callback the Language category is left out |
134
134
  | `accountAuth` | `AccountAuthConfig` | n/a | Optional sign-in hook point for File > Account (disabled unless `enabled: true`) |
135
135
 
136
136
  ### `PowerPointViewerHandle` (via `ref`)
@@ -267,7 +267,41 @@ The underlying palettes (`vermilionLightColors`, `vermilionDarkColors`) and radi
267
267
 
268
268
  ## Localization (i18n)
269
269
 
270
- UI labels go through [i18next](https://www.i18next.com/) / [react-i18next](https://react.i18next.com/) with dotted keys such as `pptx.statusBar.allSaved`. Initialise an i18next instance and wrap your app in `I18nextProvider` (the demo's `demos/pptx/demo-react/i18n.ts` shows a minimal config, including a `parseMissingKeyHandler` that derives Title Case labels for any key you don't explicitly translate). `pptx-react-viewer/i18n` exports `translationsEn` (the English dictionary), `keyToLabel` (the fallback), and a `TranslationKey` type you can use to type-check a new locale dictionary (`Record<TranslationKey, string>`) at compile time. Add a new language by supplying a resource bundle under its language code. See the [Localization guide](https://christophervr.github.io/ooxml/pptx/guide/localization) for full wiring examples and how to contribute a translation upstream; the live demo's language picker is a working reference.
270
+ UI labels go through [i18next](https://www.i18next.com/) / [react-i18next](https://react.i18next.com/) with dotted keys such as `pptx.statusBar.allSaved`, or through your own i18n library with `PptxI18nProvider` (see below). Initialise an i18next instance and wrap your app in `I18nextProvider` (the demo's `demos/pptx/demo-react/i18n.ts` shows a minimal config, including a `parseMissingKeyHandler` that derives Title Case labels for any key you don't explicitly translate). `pptx-react-viewer/i18n` exports `translationsEn` (the English dictionary), `keyToLabel` (the fallback), and a `TranslationKey` type you can use to type-check a new locale dictionary (`Record<TranslationKey, string>`) at compile time. Add a new language by supplying a resource bundle under its language code. See the [Localization guide](https://christophervr.github.io/ooxml/pptx/guide/localization) for full wiring examples and how to contribute a translation upstream; the live demo's language picker is a working reference.
271
+
272
+ ### Use your own i18n library
273
+
274
+ To translate the viewer with Lingui, FormatJS or any other library, wrap it (or the standalone building blocks) in `PptxI18nProvider` and pass a `translate(key, params)` function plus the active `locale`:
275
+
276
+ ```tsx
277
+ import { i18n } from '@lingui/core';
278
+ import { useLingui } from '@lingui/react';
279
+ import { LOCALE_CATALOG, PowerPointViewer, PptxI18nProvider } from 'pptx-react-viewer';
280
+ import type { PptxTranslate } from 'pptx-react-viewer';
281
+
282
+ import { dynamicActivate } from './i18n'; // loads a catalog, then calls i18n.activate(code)
283
+
284
+ // Module level, so it never changes: the viewer re-translates when `locale` changes.
285
+ const translate: PptxTranslate = (key, params) => i18n._(key, params);
286
+ const LOCALES = LOCALE_CATALOG.filter((entry) => ['en', 'fr'].includes(entry.code));
287
+
288
+ function TranslatedViewer({ content }: { content: Uint8Array }) {
289
+ const { i18n: active } = useLingui(); // re-renders when the language changes
290
+ return (
291
+ <PptxI18nProvider locale={active.locale} translate={translate}>
292
+ <PowerPointViewer
293
+ content={content}
294
+ availableLocales={LOCALES}
295
+ onLocaleChange={(code) => void dynamicActivate(code)}
296
+ />
297
+ </PptxI18nProvider>
298
+ );
299
+ }
300
+ ```
301
+
302
+ `translate` receives the viewer's params unchanged: `defaultValue`, `count` and the values of the `{{name}}` placeholders. Use the same names in your catalog (`{name}` in ICU syntax); `count` is a plain value, so pluralise in your catalog. `{{name}}` placeholders left in the text you return are filled too, so the shipped dictionaries work as they are: `const translate: PptxTranslate = (key) => translationsFr[key];`. A miss (the key itself, an empty string, nothing, or a throw) shows the built-in English text, then the call's default text, then a label derived from the key, never a raw key. Keep `translate` stable (a module-level function or `useCallback`): the viewer re-translates whenever `translate` or `locale` changes.
303
+
304
+ Inside a provider the host owns the language: the viewer never calls `changeLanguage`, ignores `defaultLocale` and never restores a stored language choice. File > Options > Language appears only with `onLocaleChange` and two or more `availableLocales`; a pick calls `onLocaleChange`, and the selection follows `locale` (`fr-CA` selects an offered `fr`). A `PowerPointViewer` reads the provider nearest above it; a provider rendered inside the viewer is ignored. `i18next` and `react-i18next` stay required peer dependencies in 4.x: install them, but inside a provider the viewer does not use them. `PptxI18nProvider` is React-only: the Vue and Angular bindings delegate to vue-i18n and ngx-translate, and Vanilla and Svelte take `messages` dictionaries.
271
305
 
272
306
  ## How it's built
273
307
 
@@ -1,9 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkJWNBTFZZ_js = require('./chunk-JWNBTFZZ.js');
3
+ var chunkZ22RD3E2_js = require('./chunk-Z22RD3E2.js');
4
4
  require('./chunk-PIRHQTI4.js');
5
5
  var react = require('react');
6
- var reactI18next = require('react-i18next');
7
6
  var lu = require('react-icons/lu');
8
7
  var ai = require('ooxml-ui/pptx/ai');
9
8
  var jsxRuntime = require('react/jsx-runtime');
@@ -302,7 +301,7 @@ function AiComposer({
302
301
  prefillText,
303
302
  prefillNonce
304
303
  }) {
305
- const { t } = reactI18next.useTranslation();
304
+ const { t } = chunkZ22RD3E2_js.useTranslation();
306
305
  const [value, setValue] = react.useState("");
307
306
  const textareaRef = react.useRef(null);
308
307
  const appliedNonce = react.useRef(void 0);
@@ -365,7 +364,7 @@ function AiComposer({
365
364
  disabled: value.trim().length === 0,
366
365
  title: t("pptx.ai.send"),
367
366
  "aria-label": t("pptx.ai.send"),
368
- className: chunkJWNBTFZZ_js.cn(
367
+ className: chunkZ22RD3E2_js.cn(
369
368
  "shrink-0 rounded-sm p-1.5 transition-colors",
370
369
  value.trim().length === 0 ? "text-muted-foreground/50" : "bg-primary text-primary-foreground hover:bg-primary/90"
371
370
  ),
@@ -387,7 +386,7 @@ function AiFocusBar({
387
386
  onStopPick,
388
387
  onClearPicks
389
388
  }) {
390
- const { t } = reactI18next.useTranslation();
389
+ const { t } = chunkZ22RD3E2_js.useTranslation();
391
390
  const chips = ai.focusTargetChips(targets, slides);
392
391
  const twoTables = ai.isTwoTableFocus(targets, slides);
393
392
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-b border-border bg-secondary/30", children: [
@@ -396,7 +395,7 @@ function AiFocusBar({
396
395
  chips.map((chip) => /* @__PURE__ */ jsxRuntime.jsx(
397
396
  "span",
398
397
  {
399
- className: chunkJWNBTFZZ_js.cn(
398
+ className: chunkZ22RD3E2_js.cn(
400
399
  "inline-flex max-w-[10rem] items-center rounded-full px-2 py-0.5 text-[11px]",
401
400
  hasPicks || isPinned ? "bg-primary/15 text-primary" : "bg-muted text-muted-foreground"
402
401
  ),
@@ -433,7 +432,7 @@ function AiFocusBar({
433
432
  title: t("pptx.ai.pickElement"),
434
433
  "aria-label": t("pptx.ai.pickAria"),
435
434
  "aria-pressed": pickMode,
436
- className: chunkJWNBTFZZ_js.cn(
435
+ className: chunkZ22RD3E2_js.cn(
437
436
  "rounded-sm p-1 max-md:min-w-[44px]! max-md:min-h-[44px]! flex items-center justify-center",
438
437
  pickMode ? "bg-primary text-primary-foreground" : "text-muted-foreground hover:bg-accent"
439
438
  ),
@@ -502,7 +501,7 @@ function relativeTime(from, now = Date.now()) {
502
501
  return `${weeks}w ago`;
503
502
  }
504
503
  function AiHistoryList({ chats, activeChatId, onResume, onDelete }) {
505
- const { t } = reactI18next.useTranslation();
504
+ const { t } = chunkZ22RD3E2_js.useTranslation();
506
505
  if (chats.length === 0) {
507
506
  return /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-3 py-4 text-center text-[12px] text-muted-foreground", children: t("pptx.ai.historyEmpty") });
508
507
  }
@@ -512,7 +511,7 @@ function AiHistoryList({ chats, activeChatId, onResume, onDelete }) {
512
511
  {
513
512
  type: "button",
514
513
  onClick: () => onResume(chat.id),
515
- className: chunkJWNBTFZZ_js.cn(
514
+ className: chunkZ22RD3E2_js.cn(
516
515
  "flex min-w-0 flex-1 items-start gap-2 rounded-sm px-2 py-1.5 text-left hover:bg-accent",
517
516
  chat.id === activeChatId && "bg-accent/60"
518
517
  ),
@@ -551,7 +550,7 @@ function AiHistoryMenu({
551
550
  onNewChat,
552
551
  onClose
553
552
  }) {
554
- const { t } = reactI18next.useTranslation();
553
+ const { t } = chunkZ22RD3E2_js.useTranslation();
555
554
  const ref = react.useRef(null);
556
555
  react.useEffect(() => {
557
556
  const handler = (e) => {
@@ -617,7 +616,7 @@ function appliedThemeFromPart(part) {
617
616
  return { summary: out.summary ?? "Theme updated", previous: out.previous ?? {} };
618
617
  }
619
618
  function AiAppliedThemeCard({ summary, onUndo }) {
620
- const { t } = reactI18next.useTranslation();
619
+ const { t } = chunkZ22RD3E2_js.useTranslation();
621
620
  const [undone, setUndone] = react.useState(false);
622
621
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 rounded-md border border-primary/30 bg-primary/5 px-2.5 py-1.5 text-[12px]", children: [
623
622
  /* @__PURE__ */ jsxRuntime.jsx(lu.LuPalette, { className: "w-3.5 h-3.5 shrink-0 text-primary" }),
@@ -663,7 +662,7 @@ var ICONS = {
663
662
  tool: lu.LuWrench
664
663
  };
665
664
  function AiToolCallCard({ part }) {
666
- const { t } = reactI18next.useTranslation();
665
+ const { t } = chunkZ22RD3E2_js.useTranslation();
667
666
  const failed = part.state === "output-error";
668
667
  const done = part.state === "output-available";
669
668
  const running = !failed && !done;
@@ -676,17 +675,17 @@ function AiToolCallCard({ part }) {
676
675
  /* @__PURE__ */ jsxRuntime.jsx(
677
676
  Icon,
678
677
  {
679
- className: chunkJWNBTFZZ_js.cn(
678
+ className: chunkZ22RD3E2_js.cn(
680
679
  "w-3.5 h-3.5 shrink-0",
681
680
  failed ? "text-destructive" : "text-muted-foreground"
682
681
  )
683
682
  }
684
683
  ),
685
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: chunkJWNBTFZZ_js.cn("truncate", failed ? "text-destructive" : "text-foreground"), children: activity.label }),
684
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: chunkZ22RD3E2_js.cn("truncate", failed ? "text-destructive" : "text-foreground"), children: activity.label }),
686
685
  /* @__PURE__ */ jsxRuntime.jsxs(
687
686
  "span",
688
687
  {
689
- className: chunkJWNBTFZZ_js.cn(
688
+ className: chunkZ22RD3E2_js.cn(
690
689
  "ml-auto inline-flex items-center gap-1 rounded-sm px-1.5 py-0.5 text-[10px]",
691
690
  failed ? "bg-destructive/15 text-destructive" : done ? "bg-primary/10 text-primary" : "bg-muted text-muted-foreground"
692
691
  ),
@@ -711,7 +710,7 @@ function AiToolCallCard({ part }) {
711
710
  ] });
712
711
  }
713
712
  function AiMessageList({ messages, isStreaming, bridge }) {
714
- const { t } = reactI18next.useTranslation();
713
+ const { t } = chunkZ22RD3E2_js.useTranslation();
715
714
  const endRef = react.useRef(null);
716
715
  react.useEffect(() => {
717
716
  endRef.current?.scrollIntoView({ block: "end" });
@@ -734,7 +733,7 @@ function AiMessageList({ messages, isStreaming, bridge }) {
734
733
  /* @__PURE__ */ jsxRuntime.jsx(
735
734
  "div",
736
735
  {
737
- className: chunkJWNBTFZZ_js.cn(
736
+ className: chunkZ22RD3E2_js.cn(
738
737
  "mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full",
739
738
  isUser ? "bg-secondary text-muted-foreground" : "bg-primary/15 text-primary"
740
739
  ),
@@ -780,7 +779,7 @@ function AiMessageList({ messages, isStreaming, bridge }) {
780
779
  ] });
781
780
  }
782
781
  function AiProposalCard({ proposal, onAccept, onReject }) {
783
- const { t } = reactI18next.useTranslation();
782
+ const { t } = chunkZ22RD3E2_js.useTranslation();
784
783
  const lines = proposal.summary.map(ai.humanizeDiffLine);
785
784
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-md border border-primary/40 bg-primary/5 p-2.5", children: [
786
785
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-primary", children: t("pptx.ai.proposedChange") }),
@@ -822,7 +821,7 @@ function AiConversation({
822
821
  aiPanel,
823
822
  deckId
824
823
  }) {
825
- const { t } = reactI18next.useTranslation();
824
+ const { t } = chunkZ22RD3E2_js.useTranslation();
826
825
  const chat = useAiConversation(useChat, session, config, bridge, {
827
826
  // Live "AI as a collaborator" focus: as each tool runs, navigate to and
828
827
  // highlight the slide / element(s) it touches so the canvas mirrors the
@@ -987,7 +986,7 @@ function AiChatPanel({
987
986
  onClose,
988
987
  panelWidth
989
988
  }) {
990
- const { t } = reactI18next.useTranslation();
989
+ const { t } = chunkZ22RD3E2_js.useTranslation();
991
990
  const { state, session, initError } = useAiChat(bridge, config);
992
991
  const deckId = react.useMemo(() => ai.deckIdFromBridge(bridge), [bridge]);
993
992
  return /* @__PURE__ */ jsxRuntime.jsxs(
Binary file
Binary file
@@ -1,7 +1,6 @@
1
- import { cn } from './chunk-77IXTLKU.mjs';
1
+ import { useTranslation, cn } from './chunk-ZCGYPCZM.mjs';
2
2
  import './chunk-UV2HVMKZ.mjs';
3
3
  import { useMemo, useRef, useState, useEffect, useReducer, useCallback } from 'react';
4
- import { useTranslation } from 'react-i18next';
5
4
  import { LuSparkles, LuX, LuLoaderCircle, LuTriangleAlert, LuHistory, LuMessageSquarePlus, LuTrash2, LuPlus, LuGitMerge, LuCrosshair, LuPinOff, LuPin, LuUser, LuBot, LuCheck, LuSquare, LuSend, LuMessageSquare, LuPalette, LuUndo2, LuWrench, LuStickyNote, LuFilm, LuNavigation, LuSearch, LuMove, LuChartColumn, LuLayoutTemplate, LuTable, LuShapes, LuType, LuEye } from 'react-icons/lu';
6
5
  import { deckIdFromBridge, isAiAvailable, createAiChatSession, extractReadyToolCalls, toolCanvasTarget, createChatHistoryStore, focusTargetChips, isTwoTableFocus, mergeTablesDirective, toRenderableParts, humanizeDiffLine, buildDeckContext, describeToolActivity, summarizeToolArgs, toolLabel } from 'ooxml-ui/pptx/ai';
7
6
  import { jsxs, jsx } from 'react/jsx-runtime';
Binary file
Binary file
@@ -1,11 +1,10 @@
1
- import { cloneTemplateElementsBySlideId, cloneSlide, cloneHistorySnapshot, MIN_ELEMENT_SIZE, ZOOM_TO_SELECTION_PADDING, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, partitionTemplateElements, isTemplateElementId, DEFAULT_TABLE_ROWS, DEFAULT_TABLE_COLUMNS, comparePresentation, UNGROUPED_SECTION_ID, DEFAULT_SECTION_GROUP_ID, stopAllPersistentAudio, buildSaveSlides, MAX_ZOOM_SCALE, MIN_ZOOM_SCALE, getImageEffectsOpacity, getImageEffectsFilter, getImageRenderStyle, cn, isEditableTextElement, getShapeVisualStyle, getTextStyleForElement, DEFAULT_TEXT_COLOR, renderVectorShape, isConnectorOrLineElement, build3DExtrusionData, getImageSurfaceStyle, getTextLayoutStyle, renderTableElement, renderMediaElement, shouldRenderFallbackLabel, getElementLabel, normalizeHexColor, makeCloneId, DEFAULT_TEXT_FONT_SIZE, buildPdfFromTiledImageData, GRID_SIZE, copyFormatFromElement, hasCopyableFormat, isImageTiled, getDuotoneColors, DEFAULT_STROKE_COLOR, DEFAULT_FILL_COLOR, buildCssGradientFromShapeStyle, getCropShapeClipPath, getElementTransform, hasDagDuotoneEffect, renderDagDuotoneSvgFilter, getImageSurfaceMaskStyle, getTextWarpStyle, getTextCompensationTransform, renderTextSegments, buildReactChartViewModel, renderChartElement, buildInkGroupStrokes, getInkReplayStyles, INK_REPLAY_KEYFRAMES, buildContentPartStrokes, getContentPartReplayStyles, buildTextBody3DSceneStyle, rerouteConnectorsForMovedElements, applyReroutedConnectors, updateCellTextStyleInRawXml, updateCellTextInRawXml, splitCell, updateMergeAttrsInRawXml, mergeCells, buildNotesPdf, canvasToJpegData, applyFormatToElement, isPpactionUrl, parsePpactionUrl, getImageTilingStyle, buildCacheKey, DEFAULT_COLOR_CHANGE_TOLERANCE, getCachedResult, applyColorChange, setCachedResult, colorWithOpacity, normalizeStrokeDashType, getSvgStrokeDasharray, getCompoundLineOffsets, getCompoundLineWidths, getConnectorPathGeometry, buildLineShadowCss, buildLineGlowFilter, renderConnectorMarker, getAriaRoleDescription as getAriaRoleDescription$1, getAriaLabel as getAriaLabel$1, getAriaRole, DEFAULT_FONT_FAMILY, ACTION_BUTTON_PRESETS, isUrlSafe, safeOpenUrl as safeOpenUrl$1, substituteFieldText, HYPERLINK_COLOR } from './chunk-77IXTLKU.mjs';
1
+ import { cloneTemplateElementsBySlideId, cloneSlide, cloneHistorySnapshot, MIN_ELEMENT_SIZE, ZOOM_TO_SELECTION_PADDING, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, partitionTemplateElements, isTemplateElementId, DEFAULT_TABLE_ROWS, DEFAULT_TABLE_COLUMNS, useTranslation, comparePresentation, UNGROUPED_SECTION_ID, DEFAULT_SECTION_GROUP_ID, stopAllPersistentAudio, buildSaveSlides, MAX_ZOOM_SCALE, MIN_ZOOM_SCALE, getImageEffectsOpacity, getImageEffectsFilter, getImageRenderStyle, cn, isEditableTextElement, getShapeVisualStyle, getTextStyleForElement, DEFAULT_TEXT_COLOR, renderVectorShape, isConnectorOrLineElement, build3DExtrusionData, getImageSurfaceStyle, getTextLayoutStyle, renderTableElement, renderMediaElement, shouldRenderFallbackLabel, getElementLabel, normalizeHexColor, makeCloneId, DEFAULT_TEXT_FONT_SIZE, buildPdfFromTiledImageData, GRID_SIZE, copyFormatFromElement, hasCopyableFormat, isImageTiled, getDuotoneColors, DEFAULT_STROKE_COLOR, DEFAULT_FILL_COLOR, buildCssGradientFromShapeStyle, getCropShapeClipPath, getElementTransform, hasDagDuotoneEffect, renderDagDuotoneSvgFilter, getImageSurfaceMaskStyle, getTextWarpStyle, getTextCompensationTransform, renderTextSegments, buildReactChartViewModel, renderChartElement, buildInkGroupStrokes, getInkReplayStyles, INK_REPLAY_KEYFRAMES, buildContentPartStrokes, getContentPartReplayStyles, buildTextBody3DSceneStyle, rerouteConnectorsForMovedElements, applyReroutedConnectors, updateCellTextStyleInRawXml, updateCellTextInRawXml, splitCell, updateMergeAttrsInRawXml, mergeCells, buildNotesPdf, canvasToJpegData, applyFormatToElement, isPpactionUrl, parsePpactionUrl, getImageTilingStyle, buildCacheKey, DEFAULT_COLOR_CHANGE_TOLERANCE, getCachedResult, applyColorChange, setCachedResult, colorWithOpacity, normalizeStrokeDashType, getSvgStrokeDasharray, getCompoundLineOffsets, getCompoundLineWidths, getConnectorPathGeometry, buildLineShadowCss, buildLineGlowFilter, renderConnectorMarker, getAriaRoleDescription as getAriaRoleDescription$1, getAriaLabel as getAriaLabel$1, getAriaRole, DEFAULT_FONT_FAMILY, ACTION_BUTTON_PRESETS, isUrlSafe, safeOpenUrl as safeOpenUrl$1, substituteFieldText, HYPERLINK_COLOR } from './chunk-ZCGYPCZM.mjs';
2
2
  import { defineThreeViewElement, MIN_TOUCH_TARGET_PX, computeVirtualRange, DEFAULT_VIRTUAL_OVERSCAN, createCollaborationSessionController, registerCollaborationTeardown, createPresenceProjector, BROADCAST_THROTTLE_MS, sanitizeColor, createEditorHistoryController, createWheelStepBuffer, createViewerZoomStore, clampZoomScale, mapEditingWheel, createActiveAnimationGroup, cancelBuildReveal, clearPlaybackTimers, PresentationAnimationController, resolveMediaTimeNodeElementIds, resolveMediaBookmarkTimesMs, advanceMainSequence, playGroup, PRESENTATION_HASH, PRESENTATION_NONCE_KEY, PRESENTATION_CHANNEL_NAME, swapPresentationWindows, PRESENTATION_MESSAGE_ORIGIN, clearAudienceContent, buildPresentationAudienceUrl, resolveAudienceScreenPlacement, placeAudienceWindow, storeAudienceContent, isPresentationSessionMessage, endAudienceDisplay, createPresentationKeyBuffer, acceptsPresentationInput, resolveAutoAdvanceDelayMs, resolveShowBackward, resolveShowForward, beginZoomExcursion, buildZoomTransitionOverride, createPresenterShowGuard, firstShowSlideIndex, attachPresentationVisibilityPause, presentationEntrySlideIndex, buildMorphTransitionPlan, morphOptionToMode, buildMorphAnimationRules, findInSlides, applyFindReplacements, visibleTemplateElements, createCollaborationLivePatcher, reportInlineTextDraft, initialInspectorOpen, createPresentationLoadResources, collectMediaElements, resolveMediaElementSource, collectImagePaths, applyImagePathPatches, resolveTableCellImageUrls, resolveTableStyleImageUrls, resolveTextFillBlipUrls, seedRecentColors, resolveAuthoredCustomShowId, GlyphOutlineFontCache, buildInitialGuides, readOnlyRecommendation, compatibilityWarningToasts, resolveInitialSlideIndex, resolveAutosaveIntervalMs, createAutosaveController, saveAutosaveSnapshot, updateMasterViewElement, updateElement, masterViewElements, replaceMasterViewElements, addSection, renameSection, deleteSection, moveSectionUp, moveSectionDown, moveSlidesToSection, canMergeShapes, canInteractWithElement, prepareHtml2CanvasClone, html2canvasCaptureScope, slideProgressPercent, slideStatusLabel, EXPORT_ASSEMBLING_PERCENT, EXPORT_DONE_PERCENT, isExportAbortError, DEFAULT_VIEWER_OPTIONS, resolveImageResolutionScale, applyAcceptSlide, applyAcceptAllSlides, collectUsedFonts, describeFontEmbedding, isMobileViewport, resolveAuthoredSlideRange, mayLeaveSlideShow, buildDeckSaveOptions, resolveSlideSizeSelection, saveDeckWithPassword, createAutosaveRecoveryController, discardAutosaveRecovery, probeAutosaveRecovery, shouldLoopContinuously, applyRehearsalTimings, rasterResultToPngBlob, downloadBlob, elementPictureFilename, canEditElementPoints, selectTrustedEmbeddedFonts, resolveFontWeight, resolveFontItalic, collectReferencedFontFamilies, resolveGoogleWebfontHref, syncGoogleWebfontStylesheet, selectGoogleWebfontFamilies, fetchGoogleWebfontOutlineBytes, dispatchEditorKey, isFeatureEnabled, parentSelection, textFontSizePtToPx, stepFontSizePt, textFontSizePxToPt, cycleSelectableElement, createCustomizationController, prepareElementForInsertion, slideSpaceElement, autosaveStatusKind, createViewerOptionsStore, observeYDocSlides, LOCAL_SYNC_ORIGIN, readSlidesFromYDoc, shouldRoomSlidesReplaceLoad, reconcileSlidesInYDoc, shouldAutoFollowBroadcaster, detectTouchDevice, detectOrientation, deriveViewportBreakpoints, createTouchGestureRecognizer, isKeyboardOpen, scopeLayoutOptionsToSlide, INITIAL_READ_ONLY_SESSION, readOnlySessionActions, applyReadOnlySessionEvent, readOnlyBannerVisible, readOnlyLocked, viewerPreferencesFromViewProperties, DEFAULT_VIEWER_PREFERENCES, viewPropertiesPatchFromPreferences, resolveCollaborationConfig, openPptxFile, readBackstageRecentFile, resolveCollaborationShellEditability, resolveCollaborationShellState, getResizeHandleHitAreaStyle, resolveElementInteractivity, getBackgroundAnimationState, getShapeEffectLayerPlacement, buildTextStyleOverrideCss, isElementRendered, resolveElementAriaAttributes, isMediaFullscreenActive, shouldRenderHitTarget, elementHitTargetStyle, getShapeEffectAnimationLayerStyle, inlineElementPointerEvents, isHollowShapeElement, LINK_TOOLTIP_HOST_CLASS, resolvePalette as resolvePalette$1, mediaTransportVisible, oleActionsVisible, getGroupChildParentFill, deviceStrokeStageStyle, MORPH_CROSSFADE_GROUP_STYLE, MORPH_CROSSFADE_HALF_STYLE, getSlideTransitionAnimations, getFragmentedTransitionDescriptor, SLIDE_TRANSITION_KEYFRAMES, isActionHidden, buildInlineTextCommitPatch, resolveInlineEditAutoFitHeight, resolveInlineEditNormAutofitShrink, setPendingCaretPoint, resolveGroupDoubleClickTarget, filterInteractableIds, beginShapeAdjustment, buildElementClipboardPayload, contextMenuInspectorAnchor, savedPresentationFileName, deliverSavedPresentation, exportDeckJson, mapCustomizedEditorKey, isEditorTextInputTarget, groupElements, generateElementId, ungroupElements, alignElements, distributeElements, newTableElement, createDefaultChartElement, readViewportMetrics, computeKeyboardInset, planMergeShapes, applyMergeShapesPlan, mapPresentationKey, lastShowSlideIndex, mapPresentationWheel, openPendingPrintWindow, computeColorFilter, filterHiddenSlideIndices, computeSlideIndices, buildPrintDocument, finishPrintWindow, buildPrintHtmlDocument, buildOutlineHtml, buildSlidesHtml, buildNotesHtml, buildHandoutsHtml, createBlankSlide, insertSlidePaste, applySlidePasteTemplates, makeSlideId, buildSlideTemplateSlide, templateSchemeFromTheme, needsOwnedSession, openOwnedCollaboration, resolveViewportFitOptions, editorViewportFitFor, calculateViewportFit, observeViewportClientSize, scheduleAutoAdvanceChain, computeEntranceAnimationDelay, createPresentationSessionId, resolveTransitionDurationMs, resolveTransitionSoundAction, runPresentationAction, safeOpenUrl, buildRunProgramNotice, toggleStageElementMedia, resolveOleVerbTarget, downloadDataUrl, openUrlInNewTab, createPresenterTimer, createInitialPresentationSnapshot, mergePresentationSnapshot, resetPresenterTimer, presenterElapsed, stepPresenterZoom, togglePresenterTimer, addCommentToList, removeCommentFromList, editCommentInList, toggleCommentResolvedInList, slideSpaceMembers, remapTextToSegments, getInlineEditorSelectionResult, buildInlineListStylePatch, applyActiveInlineListFormatting, applyListStyleUpdate, setPendingSelectionRestore, applyTextStyleUpdate, toggleSelectionBullets, transformInlineListCase, applyCaseTransformToSegments, transformTextCase, createGestureController, resolveExportCaptureDecision, recordProgressPercent, computeGridSpacingPx as computeGridSpacingPx$1, resolveShowSlideIndexes, groupSlidesBySection, masterViewPseudoSlide, overlayMasterViewInlineSnapshot, overlayInlineTextSnapshot, rasterizeElement, cloneElementForPaste, applyPasteSpecialFormat, buildRasterPictureElement, cloneElementUpdates, assertElementUpdateTarget, prepareElementUpdateBatch, createWriteBackScheduler, writeBackReport, createSyncGate, observeExternalCollaborationReadiness, resolveHistoryDepth, createBackstagePresentation, buildFieldSubstitutionContext, getImageColorWashStyle, attachRotateHandlePlacement, getSelectionControlArtworkStyle, getSelectionOutlineColor, paintedStrokeWidth, ensureActionAffordanceStyles, resolveElementActionAffordance, actionAffordanceLabels, paintedElementSize, MEDIA_FULLSCREEN_OVERLAY_STYLE, elementContainerHeightStyle, getAnimationOpacity, resolveElementHighlightClick, applyHighlightClickStyle, getComputedEffectStyle, getSoftEdgeSvgFilter, getEffectStyleSource, getBevelLightingSvgFilter, buildStrokeOutline, buildHollowHitOutline, buildSubpathFillOverlay, strokeOutlineViewBox, buildSummaryZoomView, readEditableText, placeCaretAt, takePendingCaretPoint, getPendingSelectionRestore, restoreSegmentSelection, mapInlineTextFormatKey, mapInlineEditorChord, subscribeBarFacePicturePixelSamples, getBarFacePicturePixelSampleVersion, ensureChartInteractionStyles, applyChartPartHighlight, resolveRevealedChartData, formatAxisValue, chartFormatTargetFromEvent, resolveOleType, getOleAriaLabel, getOleTypeColor, getOleTypeLabel, filterRenderedElements, resolveGroupChildFill, isLinkedTextBox, getOverflowSegments, shouldUseSvgWarp, getTextBodyRotationTransform, placeholderPromptDescriptor, getAriaRoleDescription, getAriaLabel, elementIdSelector, TOOLBAR_TABS, resolveGroupPressTarget, scrollInspectorSectionIntoView, computeScrollDelta, replyToCommentInList, removeTableElementColumn, insertTableElementColumn, removeTableElementRow, insertTableElementRow, withCellStyle, setCellText, pickSupportedMimeType, WEBM_MIME_CANDIDATES, fpsToFrameIntervalMs, segmentFrameCount, stopCaptureStream, GIF_POST_CAPTURE_MAX_SIDE, encodeGif, rasterizeElementTiles, placeTileOnPage, PDF_SLIDES_PAGE_WIDTH_PT, PDF_SLIDES_PAGE_HEIGHT_PT, createSnapshotTextPositions, resolvePresentationAction, getImageSvgFilters, getCachedNativeImageSize, probeNativeImageSize, buildDuotoneCacheKey, getDuotoneCachedResult, applyDuotone, setDuotoneCachedResult, svgLineCap, screenStrokeWidth, connectorWrapperTransform, ACTION_INDICATOR_CLASS, ACTION_INDICATOR_ICON_PATH, LINK_TOOLTIP_CLASS, LINK_TOOLTIP_PANEL_CLASS, LINK_TOOLTIP_LABEL_CLASS, LINK_TOOLTIP_HINT_CLASS, modelDataToBlobUrl, resolveZoomNavigationTarget, inlineListBodyText, createInlineListSeed, readListActivationSelection, createInlineListModelObserver, attachCollaborationInlineEditor, bindInlineListParagraph, bindInlineListRun, attachInlineListController, restoreInlineListBodySelection, isBulletMarkerSegment, resolveChartThreeViewSpec, applyChart3DDrag, applyChart3DSelect, canDrillDown, findChartPartTarget, withChartTitle, resolveSmartArtThreeViewSpec, measureSvgViewportRect, isBrowserOpenableMime, formatBytes, getOleDisplayName, getOleBadgeLabel, hasGlyphEnvelope, buildGlyphEnvelopeBlock, getWarpPath, isWedgeCalloutPresetShape, getAriaRole as getAriaRole$1, isElementActionable, buildSmartArtPresetData, classifyMediaType, getDraggedShapeAdjustments, computeMarqueeHitIds, mergeAdditiveSelection, rasterizeElementTiledToCanvas, borrowExternalCollaborationAwareness, observeExternalCollaborationSession, publishLiveGeometry, clampGifDimensions, rasterResultToPngDataUrl, shouldConfirmExternalHyperlink, advanceChartMarkDrag, advanceChartValueDrag, resolveChartKind, buildChartMarkDragGeometry, beginChartMarkDrag, beginChartValueDrag, findSmartArtNodeText, commitSmartArtNodeFill, commitSmartArtNodeText, groupIntoParagraphs as groupIntoParagraphs$1, createGlyphOutlineLookup, applyMotionPathPreset, resolveRevealedSmartArtNodes, resolveRevealedDrawingShapes, buildSmartArtA11y, computeSmartArtElementLayout, flattenNodes, computeInlineEditorRect, smartArtNodeAtPoint, SMARTART_DEFAULT_PALETTE, computeDrawingViewBox, projectDrawingShapes, resolveRevealedDrawingShapeNodeIds, styleShadowFilter, buildChromeStyle, centeredSvgTextLines, rebuildDrawingShapesIfCleared, shouldCommitSmartArtNodeText, bringForward, sendBackward, bringToFront, sendToBack } from 'ooxml-ui/pptx';
3
3
  export { DUOTONE_PRESETS, MOBILE_BREAKPOINT, SLIDE_TRANSITION_KEYFRAMES, TABLET_BREAKPOINT, clearAudienceContent, computeVirtualRange, downloadBlob, getSlideTransitionAnimations, loadAudienceContent, storeAudienceContent } from 'ooxml-ui/pptx';
4
4
  import React17, { useRef, useState, useCallback, useEffect, useSyncExternalStore, useMemo, useContext, useLayoutEffect, createContext, useImperativeHandle, Suspense } from 'react';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
- import { PptxHandler, EncryptedFileError, hasShapeProperties, applyThemeToData, THEME_PRESETS, themeColorSchemesEqual, guidePxToEmu, hasTextProperties, isInkElement, duplicateSlide, buildThemeColorMap, reResolveSlideColors, reResolveElementColors, isImageLikeElement, SvgExporter, reResolveElementFonts, getSubstituteFontFamily, elementActionToPptxAction, setSmartArtNodeStyle, updateSmartArtNodeText } from 'ooxml-core/pptx';
6
+ import { PptxHandler, EncryptedFileError, hasShapeProperties, applyThemeToData, THEME_PRESETS, themeColorSchemesEqual, guidePxToEmu, hasTextProperties, isInkElement, duplicateSlide, buildThemeColorMap, reResolveSlideColors, reResolveElementColors, reResolveSlideFonts, reResolveElementFonts, isImageLikeElement, SvgExporter, getSubstituteFontFamily, elementActionToPptxAction, setSmartArtNodeStyle, updateSmartArtNodeText } from 'ooxml-core/pptx';
7
7
  import { translationsEn } from 'ooxml-ui/pptx/i18n';
8
- import { useTranslation } from 'react-i18next';
9
8
  import { flushSync } from 'react-dom';
10
9
  import { LuRotateCw } from 'react-icons/lu';
11
10
 
@@ -8373,8 +8372,19 @@ function useThemeHandlers(input) {
8373
8372
  return;
8374
8373
  }
8375
8374
  await handler.updateThemeFontScheme(fontScheme);
8375
+ const previousFonts = theme?.fontScheme;
8376
+ bumpHistory();
8377
+ setSlides((prev) => reResolveSlideFonts(prev, previousFonts, fontScheme));
8378
+ setTemplateElementsBySlideId(
8379
+ (prev) => Object.fromEntries(
8380
+ Object.entries(prev).map(([slideId, elements]) => [
8381
+ slideId,
8382
+ reResolveElementFonts(elements, previousFonts, fontScheme)
8383
+ ])
8384
+ )
8385
+ );
8376
8386
  setTheme((prev) => prev ? { ...prev, fontScheme } : { fontScheme });
8377
- await refreshContentAfterThemeChange();
8387
+ history.markDirty();
8378
8388
  };
8379
8389
  const handleUpdateThemeName = async (name) => {
8380
8390
  const handler = handlerRef.current;
@@ -8396,20 +8406,7 @@ function useThemeHandlers(input) {
8396
8406
  }
8397
8407
  await refreshContentAfterThemeChange();
8398
8408
  };
8399
- const handleApplyThemeData = async (colorScheme, fontScheme, themeName) => {
8400
- const handler = handlerRef.current;
8401
- if (!handler) {
8402
- return;
8403
- }
8404
- await handler.applyTheme(colorScheme, fontScheme, themeName);
8405
- setTheme((prev) => ({
8406
- ...prev,
8407
- colorScheme,
8408
- fontScheme,
8409
- ...themeName && { name: themeName }
8410
- }));
8411
- await refreshContentAfterThemeChange();
8412
- };
8409
+ const handleApplyThemeData = (colorScheme, fontScheme, themeName) => applyThemeEditorEdit(input, { colorScheme, fontScheme, name: themeName ?? theme?.name ?? "" });
8413
8410
  const handleSetTemplateBackground = (path, backgroundColor) => {
8414
8411
  const handler = handlerRef.current;
8415
8412
  if (!handler) {
Binary file
Binary file