@pptx-editor.dev/react 0.1.0 → 0.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.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/index.ts
2
- import { createElement as createElement3, forwardRef as forwardRef2, useMemo as useMemo22 } from "react";
2
+ import { createElement as createElement3, forwardRef as forwardRef2, useMemo as useMemo23 } from "react";
3
3
 
4
4
  // src/headless-hooks.tsx
5
5
  import {
@@ -23,6 +23,7 @@ import {
23
23
  // src/context.ts
24
24
  import { createContext, useCallback, useContext, useMemo, useSyncExternalStore as useSyncExternalStore2 } from "react";
25
25
  import { createTranslator } from "@pptx-editor.dev/i18n";
26
+ import { drawingRenderersVersion, subscribeDrawingRenderers } from "@pptx-editor.dev/core/layout";
26
27
 
27
28
  // src/notes-target.ts
28
29
  import { useSyncExternalStore } from "react";
@@ -43,6 +44,8 @@ function useNotesTarget(editor) {
43
44
  // src/context.ts
44
45
  import {
45
46
  canRenameSectionInPlace,
47
+ chromeControlForSlot,
48
+ chromeOfferedControl,
46
49
  subscribeSectionRenamers,
47
50
  EMPTY_EDITOR_SNAPSHOT,
48
51
  editorCommandFor,
@@ -144,18 +147,32 @@ function useEditorCommand(slot) {
144
147
  [notes, format, engine]
145
148
  );
146
149
  }
150
+ function useOfferedControl(slot, control) {
151
+ const editor = usePptxEditor();
152
+ const renderers = useSyncExternalStore2(
153
+ subscribeDrawingRenderers,
154
+ drawingRenderersVersion,
155
+ drawingRenderersVersion
156
+ );
157
+ const select = useCallback(
158
+ () => (void renderers, control ? chromeOfferedControl(slot, control, editor) : void 0),
159
+ [slot, control, editor, renderers]
160
+ );
161
+ return useEditorState(select);
162
+ }
147
163
  function useEditorValueCommand(slot) {
148
164
  const editor = usePptxEditor();
149
165
  const cmd = useEditorCommand(slot);
166
+ const offered = useOfferedControl(slot, chromeControlForSlot(slot));
150
167
  return useMemo(
151
168
  () => ({
152
169
  execute: (value, options) => runToolbarCommand(editor, slot, value, options),
153
170
  value: valueSlotShown(slot, cmd.value),
154
- options: valueSlotOptions(slot),
171
+ options: (void offered, valueSlotOptions(slot, editor)),
155
172
  isEnabled: cmd.isEnabled,
156
173
  disabledReason: cmd.disabledReason
157
174
  }),
158
- [editor, slot, cmd]
175
+ [editor, slot, cmd, offered]
159
176
  );
160
177
  }
161
178
 
@@ -958,8 +975,8 @@ import {
958
975
  forwardRef,
959
976
  useEffect as useEffect28,
960
977
  useImperativeHandle,
961
- useLayoutEffect as useLayoutEffect13,
962
- useMemo as useMemo16,
978
+ useLayoutEffect as useLayoutEffect14,
979
+ useMemo as useMemo17,
963
980
  useRef as useRef30,
964
981
  useState as useState32
965
982
  } from "react";
@@ -4665,7 +4682,7 @@ function useEditorDialog(key) {
4665
4682
  import { createContext as createContext11, useContext as useContext12 } from "react";
4666
4683
  import {
4667
4684
  SHAPE_GALLERY as SHAPE_GALLERY2,
4668
- chromeControlForSlot,
4685
+ chromeControlForSlot as chromeControlForSlot2,
4669
4686
  chromeRowState,
4670
4687
  menuEntryKey,
4671
4688
  menuRowCheck,
@@ -5677,7 +5694,8 @@ function SlotMenuRow({
5677
5694
  const close = useMenuClose();
5678
5695
  const state = useRowState(entry.slot, entry.value);
5679
5696
  const row = resolveChromeMenuRow(entry);
5680
- const control = chromeControlForSlot(entry.slot);
5697
+ const control = chromeControlForSlot2(entry.slot);
5698
+ const offeredControl = useOfferedControl(entry.slot, entry.value === void 0 ? control : null);
5681
5699
  if (!row || !control) {
5682
5700
  warnMenuPart("Menu.Item", "unknownSlot", entry.slot);
5683
5701
  return null;
@@ -5698,16 +5716,17 @@ function SlotMenuRow({
5698
5716
  if (entry.slot === "insert.shape") return /* @__PURE__ */ jsx24(GallerySubmenu, { slot: entry.slot, ...common });
5699
5717
  if (control.shape === "tableGrid")
5700
5718
  return /* @__PURE__ */ jsx24(MenuSubmenu, { ...common, children: /* @__PURE__ */ jsx24(MenuTableGrid, { slot: entry.slot, label, autoFocus: true, onInserted: close }) });
5701
- if (control.optionGroups?.length && control.options?.length)
5702
- return /* @__PURE__ */ jsx24(MenuSubmenu, { ...common, children: control.optionGroups.map((group) => /* @__PURE__ */ jsx24(MenuSubmenu, { label: t(group.labelKey), children: control.options.filter((o) => o.group === group.id).map((o) => /* @__PURE__ */ jsx24(
5719
+ const offered = offeredControl ?? control;
5720
+ if (offered.optionGroups?.length && offered.options?.length)
5721
+ return /* @__PURE__ */ jsx24(MenuSubmenu, { ...common, children: offered.optionGroups.map((group) => /* @__PURE__ */ jsx24(MenuSubmenu, { label: t(group.labelKey), children: offered.options.filter((o) => o.group === group.id).map((o) => /* @__PURE__ */ jsx24(
5703
5722
  SlotMenuRow,
5704
5723
  {
5705
5724
  entry: { kind: "item", slot: entry.slot, value: o.value }
5706
5725
  },
5707
5726
  o.value
5708
5727
  )) }, group.id)) });
5709
- if (control.options?.length)
5710
- return /* @__PURE__ */ jsx24(MenuSubmenu, { ...common, children: control.options.map((o) => /* @__PURE__ */ jsx24(SlotMenuRow, { entry: { kind: "item", slot: entry.slot, value: o.value } }, o.value)) });
5728
+ if (offered.options?.length)
5729
+ return /* @__PURE__ */ jsx24(MenuSubmenu, { ...common, children: offered.options.map((o) => /* @__PURE__ */ jsx24(SlotMenuRow, { entry: { kind: "item", slot: entry.slot, value: o.value } }, o.value)) });
5711
5730
  if (entry.slot !== "text.link") {
5712
5731
  warnMenuPart("Menu.Item", "valueRow", entry.slot);
5713
5732
  return /* @__PURE__ */ jsx24(MenuRow, { ...common, disabled: true, reason: t("menu.pickInToolbar"), slot: row.key });
@@ -6220,18 +6239,26 @@ function useCanvasContextMenu() {
6220
6239
  }
6221
6240
 
6222
6241
  // src/SlideSorter.tsx
6223
- import { useEffect as useEffect26, useRef as useRef28, useState as useState30 } from "react";
6224
6242
  import {
6225
- chromeControlForSlot as chromeControlForSlot2,
6243
+ useEffect as useEffect26,
6244
+ useLayoutEffect as useLayoutEffect12,
6245
+ useRef as useRef28,
6246
+ useState as useState30
6247
+ } from "react";
6248
+ import {
6249
+ chromeControlForSlot as chromeControlForSlot3,
6226
6250
  focusSorterOnShow,
6227
6251
  tooltipAttributes as tooltipAttributes6,
6228
6252
  groupSlideSections as groupSlideSections3,
6229
6253
  focusCurrentSlideOrCanvas,
6230
6254
  openSlideInNormalView,
6255
+ refocusAfterSorterHides,
6231
6256
  sectionOfSlide as sectionOfSlide2,
6257
+ slideItemName as slideItemName2,
6232
6258
  slideMenuPoint as slideMenuPoint2,
6233
6259
  slideSorterMounted,
6234
6260
  sorterKeyDown,
6261
+ trackNotesInset,
6235
6262
  translateKeyOrText as translateKeyOrText13,
6236
6263
  warnSlideSorterUnmounted
6237
6264
  } from "@pptx-editor.dev/core/editor";
@@ -6242,15 +6269,21 @@ import {
6242
6269
  useEffect as useEffect25,
6243
6270
  useId as useId10,
6244
6271
  useLayoutEffect as useLayoutEffect11,
6272
+ useMemo as useMemo16,
6273
+ useReducer,
6245
6274
  useRef as useRef27,
6246
6275
  useState as useState29
6247
6276
  } from "react";
6248
6277
  import {
6249
6278
  ZOOM_MENU_LEVELS,
6279
+ createProgressiveMount,
6280
+ mountedSections,
6281
+ railItemPosition,
6250
6282
  tooltipAttributes as tooltipAttributes5,
6251
6283
  followCurrentSlide,
6252
6284
  groupSlideSections as groupSlideSections2,
6253
6285
  keepCurrentSlideInView,
6286
+ panelHistoryKey,
6254
6287
  radioGroupStep as radioGroupStep2,
6255
6288
  railDragAxis,
6256
6289
  railKeyDown,
@@ -6261,11 +6294,16 @@ import {
6261
6294
  runSlideStep as runSlideStep2,
6262
6295
  sectionOfSlide,
6263
6296
  slideClickMode,
6297
+ slideItemName,
6298
+ slideItemLabels,
6299
+ createItemMemo,
6264
6300
  slideMenuPoint,
6265
6301
  stepCommand as stepCommand2,
6266
6302
  zoomStep,
6267
6303
  zoomLimitReason,
6268
6304
  elementKindLabelKey,
6305
+ elementRotates,
6306
+ TABLE_OPTION_ROWS,
6269
6307
  platformShortcuts as platformShortcuts2
6270
6308
  } from "@pptx-editor.dev/core/editor";
6271
6309
 
@@ -7166,7 +7204,8 @@ function useSlideDrag(axis, selected, readOnly, grouped = null) {
7166
7204
  }
7167
7205
  });
7168
7206
  const cancel = useCallback10(() => setDrag(null), [setDrag]);
7169
- return { itemProps, cancel };
7207
+ const marker = (index) => slideDropMarker(drag, index);
7208
+ return { itemProps, cancel, marker };
7170
7209
  }
7171
7210
 
7172
7211
  // src/NotesPane.tsx
@@ -7734,9 +7773,49 @@ var Thumbnail = memo2(function Thumbnail2({
7734
7773
  const editor = usePptxEditor();
7735
7774
  const box = useRef27(null);
7736
7775
  useEffect25(() => {
7737
- if (editor && box.current) editor.renderThumbnail(slide.index, box.current);
7776
+ if (!editor || !box.current) return void 0;
7777
+ return editor.renderThumbnail(slide.index, box.current, { defer: true });
7738
7778
  }, [editor, slide]);
7739
- return /* @__PURE__ */ jsx34("div", { ref: box, className: "pptx-rail__thumb", style: { aspectRatio: String(1 / ratio) } });
7779
+ return /* @__PURE__ */ jsx34(
7780
+ "div",
7781
+ {
7782
+ ref: box,
7783
+ className: "pptx-rail__thumb",
7784
+ "data-pending": slide.pending ? "" : void 0,
7785
+ style: { aspectRatio: String(1 / ratio) },
7786
+ "aria-hidden": "true"
7787
+ }
7788
+ );
7789
+ });
7790
+ var RailItem = memo2(function RailItem2(props) {
7791
+ const { slide: s, on } = props;
7792
+ return /* @__PURE__ */ jsxs30(
7793
+ "li",
7794
+ {
7795
+ className: "pptx-rail__item",
7796
+ role: props.role,
7797
+ "aria-setsize": props.setSize,
7798
+ "aria-posinset": props.posInSet,
7799
+ "aria-selected": props.selected,
7800
+ "aria-current": props.current,
7801
+ "data-hidden": s.hidden ? "" : void 0,
7802
+ "data-index": s.index,
7803
+ "data-drop": props.drop,
7804
+ draggable: props.draggable,
7805
+ onDragStart: (e) => on.dragStart(s.index, e),
7806
+ onDragOver: (e) => on.dragOver(s.index, e),
7807
+ onDragEnd: () => on.dragEnd(s.index),
7808
+ onDrop: (e) => on.drop(s.index, e),
7809
+ tabIndex: props.current ? 0 : -1,
7810
+ onClick: (e) => on.click(s.index, e),
7811
+ onContextMenu: (e) => on.menu(s.index, e),
7812
+ children: [
7813
+ /* @__PURE__ */ jsx34("span", { className: "pptx-rail__number", "aria-hidden": "true", children: s.index + 1 }),
7814
+ /* @__PURE__ */ jsx34("span", { className: "pptx-sr-only", children: props.name }),
7815
+ /* @__PURE__ */ jsx34(Thumbnail, { slide: s, ratio: props.ratio })
7816
+ ]
7817
+ }
7818
+ );
7740
7819
  });
7741
7820
  function useFocusFollowsCurrent(list, item, current, count, shown = true) {
7742
7821
  const focused = useRef27(null);
@@ -7761,6 +7840,14 @@ function paneStyle(width, style) {
7761
7840
  if (width === void 0) return style;
7762
7841
  return { width, ...style };
7763
7842
  }
7843
+ function useProgressiveMount(total, needed, opening, loading) {
7844
+ const [, grow] = useReducer((n) => n + 1, 0);
7845
+ const [mount] = useState29(() => createProgressiveMount(grow));
7846
+ useEffect25(() => () => mount.dispose(), [mount]);
7847
+ const shown = mount.limit(total, needed, opening, loading);
7848
+ useEffect25(() => mount.follow(total));
7849
+ return shown;
7850
+ }
7764
7851
  function usePaneOpen(props) {
7765
7852
  const [own, setOwn] = useState29(props.defaultOpen ?? true);
7766
7853
  const open = props.open ?? own;
@@ -7789,23 +7876,26 @@ function SlideRail(props = {}) {
7789
7876
  const readOnly = useEditorState((s) => s.mode === "view");
7790
7877
  const list = useRef27(null);
7791
7878
  const count = slides.length;
7879
+ const opening = useEditorState((s) => (s.pendingSlides ?? 0) > 0);
7880
+ const loading = useEditorState((s) => s.isOpening === true);
7881
+ const mounted = useProgressiveMount(count, current, opening, loading);
7792
7882
  const [menu, setMenu] = useState29(null);
7793
7883
  const [gallery, setGallery] = useState29(null);
7794
7884
  const actions = useRef27(null);
7795
7885
  const sections = useSlideSections();
7796
7886
  const grouped = groupSlideSections2(sections, count);
7887
+ const inView = grouped ? mountedSections(grouped, mounted) : null;
7797
7888
  const orientation = resolveRailOrientation(props.orientation, "PptxEditor.SlideRail");
7798
7889
  const [rightToLeft, setRightToLeft] = useState29(false);
7799
7890
  useLayoutEffect11(() => setRightToLeft(railRightToLeft2(rail.current)), [orientation, open]);
7800
7891
  const chrome = railOrientationChrome2(orientation, rightToLeft);
7801
7892
  const [folded, setFolded] = useState29(false);
7802
7893
  useEffect25(() => watchRailFold(rail.current, orientation, setFolded), [orientation, open]);
7803
- const { itemProps: dragProps, cancel: cancelDrag } = useSlideDrag(
7804
- railDragAxis(orientation),
7805
- selected,
7806
- readOnly,
7807
- grouped
7808
- );
7894
+ const {
7895
+ itemProps: dragProps,
7896
+ cancel: cancelDrag,
7897
+ marker: dropMarker
7898
+ } = useSlideDrag(railDragAxis(orientation), selected, readOnly, grouped);
7809
7899
  const collapsed = useCollapsedSections();
7810
7900
  const [renaming, setRenaming] = useState29(null);
7811
7901
  useOpenCurrentSection(grouped);
@@ -7852,36 +7942,58 @@ function SlideRail(props = {}) {
7852
7942
  openMenu: (index, item2) => openMenu(index, item2, null),
7853
7943
  focusCurrent
7854
7944
  });
7855
- const item = (s) => /* @__PURE__ */ jsxs30(
7856
- "li",
7857
- {
7858
- className: "pptx-rail__item",
7859
- role: grouped ? "treeitem" : "option",
7860
- "aria-selected": selected.includes(s.index),
7861
- "aria-current": s.index === current,
7862
- "aria-label": t(s.hidden ? "rail.hiddenSlideLabel" : "rail.slideLabel", {
7863
- index: s.index + 1
7864
- }),
7865
- "data-hidden": s.hidden ? "" : void 0,
7866
- "data-index": s.index,
7867
- ...dragProps(s.index),
7868
- tabIndex: s.index === current ? 0 : -1,
7869
- onClick: (e) => {
7945
+ const [memoItem] = useState29(() => createItemMemo());
7946
+ const latest = useRef27({ editor, dragProps, openMenu });
7947
+ useLayoutEffect11(() => {
7948
+ latest.current = { editor, dragProps, openMenu };
7949
+ });
7950
+ const on = useMemo16(
7951
+ () => ({
7952
+ click: (index, e) => {
7870
7953
  e.currentTarget.focus({ preventScroll: true });
7871
- editor?.selectSlide(s.index, clickMode(e));
7954
+ latest.current.editor?.selectSlide(index, clickMode(e));
7872
7955
  },
7873
- onContextMenu: (e) => {
7956
+ menu: (index, e) => {
7874
7957
  e.preventDefault();
7875
7958
  const pointer = e.clientX !== 0 || e.clientY !== 0;
7876
- openMenu(s.index, e.currentTarget, pointer ? { x: e.clientX, y: e.clientY } : null);
7959
+ const at = pointer ? { x: e.clientX, y: e.clientY } : null;
7960
+ latest.current.openMenu(index, e.currentTarget, at);
7877
7961
  },
7878
- children: [
7879
- /* @__PURE__ */ jsx34("span", { className: "pptx-rail__number", children: s.index + 1 }),
7880
- /* @__PURE__ */ jsx34(Thumbnail, { slide: s, ratio })
7881
- ]
7882
- },
7883
- s.index
7962
+ dragStart: (index, e) => latest.current.dragProps(index).onDragStart(e),
7963
+ dragOver: (index, e) => latest.current.dragProps(index).onDragOver(e),
7964
+ dragEnd: (index) => latest.current.dragProps(index).onDragEnd(),
7965
+ drop: (index, e) => latest.current.dragProps(index).onDrop(e)
7966
+ }),
7967
+ []
7884
7968
  );
7969
+ const itemLimit = inView ? inView.limit : mounted;
7970
+ const isSelected = new Set(selected);
7971
+ const labels = slideItemLabels(t);
7972
+ const item = (s) => {
7973
+ const place = railItemPosition(s.index, count, itemLimit, grouped);
7974
+ const role = grouped ? "treeitem" : "option";
7975
+ const chosen = isSelected.has(s.index);
7976
+ const here = s.index === current;
7977
+ const drop = dropMarker(s.index);
7978
+ const inputs = [place?.setSize, place?.posInSet, ratio, chosen, here, role, t, labels];
7979
+ return memoItem(s, [...inputs, drop, readOnly, on], () => /* @__PURE__ */ jsx34(
7980
+ RailItem,
7981
+ {
7982
+ setSize: place?.setSize,
7983
+ posInSet: place?.posInSet,
7984
+ slide: s,
7985
+ ratio,
7986
+ selected: chosen,
7987
+ current: here,
7988
+ role,
7989
+ name: slideItemName(t, s),
7990
+ drop,
7991
+ draggable: !readOnly,
7992
+ on
7993
+ },
7994
+ s.id
7995
+ ));
7996
+ };
7885
7997
  const railActions = {
7886
7998
  t,
7887
7999
  editor,
@@ -7947,7 +8059,7 @@ function SlideRail(props = {}) {
7947
8059
  "aria-label": t("rail.ariaLabel"),
7948
8060
  onKeyDown,
7949
8061
  onFocus: trackFocus,
7950
- children: grouped ? grouped.map((sec) => {
8062
+ children: grouped && inView ? inView.sections.map((sec) => {
7951
8063
  const shut = collapsed.includes(sec.id);
7952
8064
  return /* @__PURE__ */ jsx34(
7953
8065
  SectionNode,
@@ -7960,11 +8072,11 @@ function SlideRail(props = {}) {
7960
8072
  onRename: () => setRenaming(sec.id),
7961
8073
  onRenameEnd: () => setRenaming(null),
7962
8074
  onRemoved: focusCurrent,
7963
- children: slides.slice(sec.firstSlide, sec.firstSlide + sec.slideCount).map(item)
8075
+ children: slides.slice(sec.firstSlide, Math.min(sec.firstSlide + sec.slideCount, inView.limit)).map(item)
7964
8076
  },
7965
8077
  sec.id
7966
8078
  );
7967
- }) : slides.map(item)
8079
+ }) : slides.slice(0, mounted).map(item)
7968
8080
  }
7969
8081
  ),
7970
8082
  /* @__PURE__ */ jsx34(RailActionsContext.Provider, { value: railActions, children: /* @__PURE__ */ jsx34(
@@ -8112,10 +8224,11 @@ function NumberField2({
8112
8224
  "aria-label": label,
8113
8225
  value: draft ?? value,
8114
8226
  disabled,
8227
+ "data-draft": draft !== null,
8115
8228
  onChange: (e) => setDraft(e.target.value),
8116
8229
  onBlur: commit,
8117
8230
  onKeyDown: (e) => {
8118
- if (e.key === "Enter") e.currentTarget.blur();
8231
+ if (e.key === "Enter") commit();
8119
8232
  if (e.key === "Escape") setDraft(null);
8120
8233
  }
8121
8234
  }
@@ -8200,7 +8313,7 @@ function FormatTab() {
8200
8313
  field("y", "panel.format.y")
8201
8314
  ] })
8202
8315
  ] }),
8203
- /* @__PURE__ */ jsxs30("div", { className: "pptx-panel__section", children: [
8316
+ elementRotates(g, table) ? /* @__PURE__ */ jsxs30("div", { className: "pptx-panel__section", children: [
8204
8317
  /* @__PURE__ */ jsx34("h3", { className: "pptx-panel__title", children: t("panel.format.rotation") }),
8205
8318
  /* @__PURE__ */ jsx34("div", { className: "pptx-panel__grid", children: /* @__PURE__ */ jsx34(
8206
8319
  NumberField2,
@@ -8212,7 +8325,44 @@ function FormatTab() {
8212
8325
  onCommit: (v) => move({ rot: (v % 360 + 360) % 360 })
8213
8326
  }
8214
8327
  ) })
8215
- ] }),
8328
+ ] }) : null,
8329
+ table ? /* @__PURE__ */ jsxs30("div", { className: "pptx-panel__section", children: [
8330
+ /* @__PURE__ */ jsx34("h3", { className: "pptx-panel__title", children: t("panel.format.table") }),
8331
+ /* @__PURE__ */ jsxs30("div", { className: "pptx-panel__grid", children: [
8332
+ /* @__PURE__ */ jsx34(
8333
+ NumberField2,
8334
+ {
8335
+ label: t("panel.format.rowHeight"),
8336
+ value: inches(table.rowHeight),
8337
+ unit,
8338
+ disabled: readOnly,
8339
+ onCommit: (v) => editor?.exec({ type: "setRowHeight", height: inch(v) })
8340
+ }
8341
+ ),
8342
+ /* @__PURE__ */ jsx34(
8343
+ NumberField2,
8344
+ {
8345
+ label: t("panel.format.columnWidth"),
8346
+ value: inches(table.columnWidth),
8347
+ unit,
8348
+ disabled: readOnly,
8349
+ onCommit: (v) => editor?.exec({ type: "setColumnWidth", width: inch(v) })
8350
+ }
8351
+ )
8352
+ ] }),
8353
+ /* @__PURE__ */ jsx34("div", { className: "pptx-radios", role: "group", "aria-label": t("panel.format.styleOptions"), children: TABLE_OPTION_ROWS.map(({ option, labelKey }) => /* @__PURE__ */ jsxs30("label", { className: "pptx-radio", children: [
8354
+ /* @__PURE__ */ jsx34(
8355
+ "input",
8356
+ {
8357
+ type: "checkbox",
8358
+ checked: table.options.includes(option),
8359
+ disabled: readOnly,
8360
+ onChange: () => editor?.exec({ type: "toggleTableStyleOption", option })
8361
+ }
8362
+ ),
8363
+ t(labelKey)
8364
+ ] }, option)) })
8365
+ ] }) : null,
8216
8366
  g.textFitting ? /* @__PURE__ */ jsxs30("div", { className: "pptx-panel__section", children: [
8217
8367
  /* @__PURE__ */ jsx34("h3", { className: "pptx-panel__title", children: t("panel.format.textFitting") }),
8218
8368
  /* @__PURE__ */ jsx34("div", { className: "pptx-radios", role: "radiogroup", "aria-label": t("panel.format.textFitting"), children: ["none", "shrink", "shape"].map((mode) => /* @__PURE__ */ jsxs30("label", { className: "pptx-radio", children: [
@@ -8233,6 +8383,7 @@ function FormatTab() {
8233
8383
  }
8234
8384
  function SidePanel({ onClose, className, paneWidth, style }) {
8235
8385
  const { t } = useTranslation();
8386
+ const editor = usePptxEditor();
8236
8387
  const [tab, setTab] = useState29("format");
8237
8388
  return /* @__PURE__ */ jsxs30(
8238
8389
  "aside",
@@ -8273,13 +8424,21 @@ function SidePanel({ onClose, className, paneWidth, style }) {
8273
8424
  ),
8274
8425
  onClose ? /* @__PURE__ */ jsx34(ToolButton, { label: t("panel.close"), icon: "close", onClick: onClose }) : null
8275
8426
  ] }),
8276
- /* @__PURE__ */ jsxs30("div", { className: "pptx-panel__body", role: "tabpanel", children: [
8277
- tab === "format" ? /* @__PURE__ */ jsx34(FormatTab, {}) : null,
8278
- tab === "comments" ? /* @__PURE__ */ jsxs30("div", { className: "pptx-empty", children: [
8279
- /* @__PURE__ */ jsx34("p", { className: "pptx-empty__title", children: t("panel.comments.emptyTitle") }),
8280
- /* @__PURE__ */ jsx34("p", { className: "pptx-empty__body", children: t("panel.comments.emptyBody") })
8281
- ] }) : null
8282
- ] })
8427
+ /* @__PURE__ */ jsxs30(
8428
+ "div",
8429
+ {
8430
+ className: "pptx-panel__body",
8431
+ role: "tabpanel",
8432
+ onKeyDown: (e) => panelHistoryKey(e, editor),
8433
+ children: [
8434
+ tab === "format" ? /* @__PURE__ */ jsx34(FormatTab, {}) : null,
8435
+ tab === "comments" ? /* @__PURE__ */ jsxs30("div", { className: "pptx-empty", children: [
8436
+ /* @__PURE__ */ jsx34("p", { className: "pptx-empty__title", children: t("panel.comments.emptyTitle") }),
8437
+ /* @__PURE__ */ jsx34("p", { className: "pptx-empty__body", children: t("panel.comments.emptyBody") })
8438
+ ] }) : null
8439
+ ]
8440
+ }
8441
+ )
8283
8442
  ]
8284
8443
  }
8285
8444
  );
@@ -8309,6 +8468,14 @@ function SlideSorter({ className } = {}) {
8309
8468
  const focusCurrent = useFocusCurrentAfterRender(list);
8310
8469
  useFocusAfterCollapse(list, collapsed);
8311
8470
  useEffect26(() => list.current ? focusSorterOnShow(list.current) : void 0, []);
8471
+ const editorNow = useRef28(editor);
8472
+ editorNow.current = editor;
8473
+ useLayoutEffect12(() => {
8474
+ const el = list.current;
8475
+ return () => {
8476
+ if (el) refocusAfterSorterHides(el, editorNow.current);
8477
+ };
8478
+ }, []);
8312
8479
  const own = sectionOfSlide2(grouped, current);
8313
8480
  const shut = !!own && collapsed.includes(own.id);
8314
8481
  const background = useEditorDialog("background");
@@ -8341,9 +8508,6 @@ function SlideSorter({ className } = {}) {
8341
8508
  role: grouped ? "treeitem" : "option",
8342
8509
  "aria-selected": selected.includes(s.index),
8343
8510
  "aria-current": s.index === current,
8344
- "aria-label": t(s.hidden ? "rail.hiddenSlideLabel" : "rail.slideLabel", {
8345
- index: s.index + 1
8346
- }),
8347
8511
  "data-hidden": s.hidden ? "" : void 0,
8348
8512
  "data-index": s.index,
8349
8513
  ...dragProps(s.index),
@@ -8360,10 +8524,11 @@ function SlideSorter({ className } = {}) {
8360
8524
  },
8361
8525
  children: [
8362
8526
  /* @__PURE__ */ jsx35(Thumbnail, { slide: s, ratio }),
8363
- /* @__PURE__ */ jsx35("span", { className: "pptx-sorter__number", children: s.index + 1 })
8527
+ /* @__PURE__ */ jsx35("span", { className: "pptx-sorter__number", "aria-hidden": "true", children: s.index + 1 }),
8528
+ /* @__PURE__ */ jsx35("span", { className: "pptx-sr-only", children: slideItemName2(t, s) })
8364
8529
  ]
8365
8530
  },
8366
- s.index
8531
+ s.id
8367
8532
  );
8368
8533
  return /* @__PURE__ */ jsxs31(
8369
8534
  "section",
@@ -8416,7 +8581,7 @@ function SlideSorter({ className } = {}) {
8416
8581
  function ViewSwitch() {
8417
8582
  const { t } = useTranslation();
8418
8583
  const cmd = useEditorCommand("view.presentationView");
8419
- const options = chromeControlForSlot2("view.presentationView")?.options ?? [];
8584
+ const options = chromeControlForSlot3("view.presentationView")?.options ?? [];
8420
8585
  const off = !cmd.isEnabled;
8421
8586
  const reason = cmd.disabledReason ? translateKeyOrText13(t, cmd.disabledReason) : null;
8422
8587
  const offAttrs = useAriaDisabled(off, reason);
@@ -8486,6 +8651,19 @@ function DefaultWorkspace({
8486
8651
  if (active && active !== active.ownerDocument.body && active.isConnected) return;
8487
8652
  focusCurrentSlideOrCanvas(box.current, editor);
8488
8653
  }, [view, editor]);
8654
+ const inset = useRef28(null);
8655
+ useEffect26(() => {
8656
+ if (!box.current) return;
8657
+ const tracker = trackNotesInset(box.current);
8658
+ inset.current = tracker;
8659
+ return () => {
8660
+ tracker.dispose();
8661
+ inset.current = null;
8662
+ };
8663
+ }, []);
8664
+ useEffect26(() => {
8665
+ inset.current?.refresh();
8666
+ });
8489
8667
  return /* @__PURE__ */ jsxs31("div", { ref: box, className: "pptx-default__views", children: [
8490
8668
  view === "slideSorter" ? /* @__PURE__ */ jsx35("div", { className: "pptx-default__workspace", children: /* @__PURE__ */ jsxs31("div", { className: "pptx-default__main", children: [
8491
8669
  /* @__PURE__ */ jsx35(SlideSorter, {}),
@@ -8493,11 +8671,18 @@ function DefaultWorkspace({
8493
8671
  ] }) }) : normal,
8494
8672
  overlay,
8495
8673
  status === void 0 ? /* @__PURE__ */ jsxs31("div", { className: "pptx-statusbar", children: [
8674
+ /* @__PURE__ */ jsx35(ReadOnlyBadge, {}),
8496
8675
  /* @__PURE__ */ jsx35(ViewSwitch, {}),
8497
8676
  /* @__PURE__ */ jsx35(ZoomPill, {})
8498
8677
  ] }) : status
8499
8678
  ] });
8500
8679
  }
8680
+ function ReadOnlyBadge() {
8681
+ const { t } = useTranslation();
8682
+ const damaged = useEditorState((s) => s.readOnlyReason === "damaged-slide");
8683
+ if (!damaged) return null;
8684
+ return /* @__PURE__ */ jsx35("span", { className: "pptx-statusbar__read-only", role: "status", "data-reason": "damaged-slide", children: t("statusBar.readOnlyDamaged") });
8685
+ }
8501
8686
  function SlideSorterWatch() {
8502
8687
  const editor = usePptxEditor();
8503
8688
  const sorter = useEditorState((s) => s.presentationView === "slideSorter");
@@ -8508,7 +8693,7 @@ function SlideSorterWatch() {
8508
8693
  }
8509
8694
 
8510
8695
  // src/ChromeTooltip.tsx
8511
- import { useEffect as useEffect27, useLayoutEffect as useLayoutEffect12, useRef as useRef29, useState as useState31 } from "react";
8696
+ import { useEffect as useEffect27, useLayoutEffect as useLayoutEffect13, useRef as useRef29, useState as useState31 } from "react";
8512
8697
  import { createPortal as createPortal3 } from "react-dom";
8513
8698
  import {
8514
8699
  listenChromeTooltips,
@@ -8522,7 +8707,7 @@ function ChromeTooltip() {
8522
8707
  () => typeof document === "undefined" ? void 0 : listenChromeTooltips(document, setState),
8523
8708
  []
8524
8709
  );
8525
- useLayoutEffect12(() => {
8710
+ useLayoutEffect13(() => {
8526
8711
  if (state && ref.current) positionChromeTooltip(ref.current, state.target);
8527
8712
  }, [state]);
8528
8713
  if (!state) return null;
@@ -8562,6 +8747,7 @@ var PptxEditorRoot = forwardRef(
8562
8747
  ...props.fontFamilies ? { fontFamilies: props.fontFamilies } : {},
8563
8748
  ...props.fonts ? { fonts: props.fonts } : {},
8564
8749
  ...props.modules ? { modules: props.modules } : {},
8750
+ ...props.autoCorrect === false ? { autoCorrect: false } : {},
8565
8751
  onFontError: (error) => reportFontError(error, callbacks.current.onFontError),
8566
8752
  translate: (key, params) => translateKeyOrText14(tRef.current, key, params)
8567
8753
  });
@@ -8611,7 +8797,7 @@ var PptxEditorRoot = forwardRef(
8611
8797
  const dark = useResolvedDark(props.colorMode);
8612
8798
  const [notesOpen, setNotesOpen] = useState32(void 0);
8613
8799
  const notesRequest = useRef30(null);
8614
- const panes = useMemo16(
8800
+ const panes = useMemo17(
8615
8801
  () => ({ notesOpen, setNotesOpen, notesRequest }),
8616
8802
  [notesOpen]
8617
8803
  );
@@ -8622,15 +8808,30 @@ var PptxEditorRoot = forwardRef(
8622
8808
  ] }) }) }) }) }) }) });
8623
8809
  }
8624
8810
  );
8625
- function PptxEditorViewport({ className, children }) {
8811
+ function viewportLandmark(t, label) {
8812
+ if (label === false) return {};
8813
+ return {
8814
+ role: "region",
8815
+ "aria-label": label ? translateKeyOrText14(t, label) : t("viewport.ariaLabel")
8816
+ };
8817
+ }
8818
+ function PptxEditorViewport({ className, label, children }) {
8626
8819
  const dark = useChromeDark();
8627
- return /* @__PURE__ */ jsx37("div", { className: ["pptx-editor", dark ? "dark" : "", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx37(ScopedByAncestorContext.Provider, { value: true, children }) });
8820
+ const { t } = useTranslation();
8821
+ return /* @__PURE__ */ jsx37(
8822
+ "div",
8823
+ {
8824
+ className: ["pptx-editor", dark ? "dark" : "", className].filter(Boolean).join(" "),
8825
+ ...viewportLandmark(t, label),
8826
+ children: /* @__PURE__ */ jsx37(ScopedByAncestorContext.Provider, { value: true, children })
8827
+ }
8828
+ );
8628
8829
  }
8629
8830
  function PptxEditorContent({ className }) {
8630
8831
  const editor = usePptxEditor();
8631
8832
  const host = useRef30(null);
8632
8833
  const menu = useCanvasContextMenu();
8633
- useLayoutEffect13(() => {
8834
+ useLayoutEffect14(() => {
8634
8835
  if (!editor || !host.current) return;
8635
8836
  editor.attach(host.current);
8636
8837
  return () => editor.detach();
@@ -8657,7 +8858,7 @@ import {
8657
8858
  isValidElement as isValidElement7,
8658
8859
  useEffect as useEffect31,
8659
8860
  useId as useId13,
8660
- useLayoutEffect as useLayoutEffect16,
8861
+ useLayoutEffect as useLayoutEffect17,
8661
8862
  useRef as useRef36,
8662
8863
  useState as useState38
8663
8864
  } from "react";
@@ -8669,7 +8870,7 @@ import {
8669
8870
  requestDialogSection,
8670
8871
  runChromeRow as runChromeRow2,
8671
8872
  surfaceInputIn as surfaceInputIn2,
8672
- chromeControlForSlot as chromeControlForSlot4,
8873
+ chromeControlForSlot as chromeControlForSlot5,
8673
8874
  chromeSlotIsToggle,
8674
8875
  isToolbarBarSlot,
8675
8876
  TOOLBAR_NAMED_PARTS,
@@ -8895,6 +9096,7 @@ function EffectMenuControl({
8895
9096
  disabled: !cmd.isEnabled
8896
9097
  });
8897
9098
  const close = useCallback13(() => setOpen(false), []);
9099
+ const offered = useOfferedControl(slot, control) ?? control;
8898
9100
  return /* @__PURE__ */ jsxs34(Fragment30, { children: [
8899
9101
  /* @__PURE__ */ jsxs34(
8900
9102
  "button",
@@ -8917,8 +9119,8 @@ function EffectMenuControl({
8917
9119
  }
8918
9120
  ),
8919
9121
  off.note,
8920
- open ? /* @__PURE__ */ jsx38(Popover, { anchor: anchor.current, onClose: close, children: control.optionGroups?.map((group) => {
8921
- const options = control.options?.filter((o) => o.group === group.id) ?? [];
9122
+ open ? /* @__PURE__ */ jsx38(Popover, { anchor: anchor.current, onClose: close, children: offered.optionGroups?.map((group) => {
9123
+ const options = offered.options?.filter((o) => o.group === group.id) ?? [];
8922
9124
  const pick = (value) => (cmd.execute(value), close());
8923
9125
  const row = (o) => /* @__PURE__ */ jsx38(
8924
9126
  MenuRow,
@@ -8934,7 +9136,7 @@ function EffectMenuControl({
8934
9136
  const [first, ...rest] = options;
8935
9137
  return /* @__PURE__ */ jsx38(MenuSubmenu, { label: t(group.labelKey), children: group.id === "glow" && first ? /* @__PURE__ */ jsxs34(Fragment30, { children: [
8936
9138
  row(first),
8937
- /* @__PURE__ */ jsx38(GlowGrid, { slot, options: rest, value: cmd.value, onPick: pick })
9139
+ rest.length ? /* @__PURE__ */ jsx38(GlowGrid, { slot, options: rest, value: cmd.value, onPick: pick }) : null
8938
9140
  ] }) : (
8939
9141
  // Shadows: a line between the outer and the inner presets (the Outer and
8940
9142
  // Inner sections).
@@ -9113,7 +9315,7 @@ function CorrectionsControl({
9113
9315
  import { Children as Children6, isValidElement as isValidElement6 } from "react";
9114
9316
  import {
9115
9317
  TOOLBAR_COMPOUND_SLOTS,
9116
- chromeControlForSlot as chromeControlForSlot3,
9318
+ chromeControlForSlot as chromeControlForSlot4,
9117
9319
  warnAsChildChild as warnAsChildChild2,
9118
9320
  warnIgnoredSlotAttributes,
9119
9321
  warnReplacedControlSetting
@@ -9125,7 +9327,7 @@ import {
9125
9327
  useContext as useContext19,
9126
9328
  useEffect as useEffect29,
9127
9329
  useId as useId11,
9128
- useLayoutEffect as useLayoutEffect14,
9330
+ useLayoutEffect as useLayoutEffect15,
9129
9331
  useRef as useRef34,
9130
9332
  useState as useState35
9131
9333
  } from "react";
@@ -9284,7 +9486,7 @@ function FontFamilyControl({ slot, control, children }) {
9284
9486
  const trigger = useTriggerAttributes(slot, "pptx-toolbar__field pptx-toolbar__field--family", {
9285
9487
  disabled: !cmd.isEnabled
9286
9488
  });
9287
- useLayoutEffect14(() => {
9489
+ useLayoutEffect15(() => {
9288
9490
  if (open) revealCurrentFont(list.current);
9289
9491
  }, [open]);
9290
9492
  useEffect29(() => {
@@ -9327,7 +9529,7 @@ var FONT_FAMILY_PARTS = {
9327
9529
  // src/toolbar-parts.tsx
9328
9530
  import { Fragment as Fragment34, jsx as jsx42 } from "react/jsx-runtime";
9329
9531
  function namedPartSlotProps(slot, props, partName) {
9330
- const shape = chromeControlForSlot3(slot)?.shape;
9532
+ const shape = chromeControlForSlot4(slot)?.shape;
9331
9533
  if (shape !== void 0 && shape !== "icon")
9332
9534
  return { ...props, slotId: slot, [NAMED_PART]: partName };
9333
9535
  const { children, icon, ...rest } = props;
@@ -9370,7 +9572,7 @@ function SlotControl({
9370
9572
  if (props.icon !== void 0) warnReplacedControlSetting(props.slotId, "icon", parts9);
9371
9573
  return /* @__PURE__ */ jsx42(Fragment34, { children: props.children });
9372
9574
  }
9373
- const control = compose ? chromeControlForSlot3(props.slotId) : null;
9575
+ const control = compose ? chromeControlForSlot4(props.slotId) : null;
9374
9576
  const body = control && !props.asChild && props.children !== void 0 ? () => /* @__PURE__ */ jsx42(FontFamilyControl, { slot: props.slotId, control, children: props.children }) : render2;
9375
9577
  const child = props.asChild ? asChildElement(props) : null;
9376
9578
  return /* @__PURE__ */ jsx42(
@@ -9501,7 +9703,7 @@ function SizeControl({ slot, control }) {
9501
9703
  }
9502
9704
 
9503
9705
  // src/toolbar-measure.ts
9504
- import { useLayoutEffect as useLayoutEffect15, useState as useState37 } from "react";
9706
+ import { useLayoutEffect as useLayoutEffect16, useState as useState37 } from "react";
9505
9707
  import {
9506
9708
  syncToolbarTabStop,
9507
9709
  toolbarArrowKey,
@@ -9510,7 +9712,7 @@ import {
9510
9712
  import { separatorCost, toolbarRoom } from "@pptx-editor.dev/core/editor";
9511
9713
  function useRovingToolbar(ref) {
9512
9714
  const [tracker] = useState37(toolbarFocusTracker);
9513
- useLayoutEffect15(() => {
9715
+ useLayoutEffect16(() => {
9514
9716
  const bar = ref.current;
9515
9717
  if (!bar) return;
9516
9718
  syncToolbarTabStop(bar, bar.ownerDocument.activeElement);
@@ -9565,6 +9767,7 @@ function DropdownControl({ slot, control }) {
9565
9767
  const anchor = useRef36(null);
9566
9768
  const [open, setOpen] = useState38(false);
9567
9769
  const current = control.options?.find((o) => o.value === cmd.value);
9770
+ const offered = useOfferedControl(slot, control) ?? control;
9568
9771
  const icon = current?.paths ?? control.paths;
9569
9772
  const trigger = useTriggerAttributes(
9570
9773
  slot,
@@ -9593,7 +9796,7 @@ function DropdownControl({ slot, control }) {
9593
9796
  }
9594
9797
  ),
9595
9798
  off.note,
9596
- open ? /* @__PURE__ */ jsx44(Popover, { anchor: anchor.current, onClose: () => setOpen(false), children: control.options?.map((o) => {
9799
+ open ? /* @__PURE__ */ jsx44(Popover, { anchor: anchor.current, onClose: () => setOpen(false), children: offered.options?.map((o) => {
9597
9800
  const row = toolbarDropdownRow(editor, host, slot, control, o, cmd.value);
9598
9801
  const dialog = row.dialog;
9599
9802
  return /* @__PURE__ */ jsxs39(Fragment35, { children: [
@@ -9620,7 +9823,7 @@ function DropdownControl({ slot, control }) {
9620
9823
  openDialog(dialog, text ?? anchor.current);
9621
9824
  },
9622
9825
  children: [
9623
- o.paths ? /* @__PURE__ */ jsx44(Icon, { paths: o.paths }) : o.glyph || control.options?.some((x) => x.glyph) ? (
9826
+ o.paths ? /* @__PURE__ */ jsx44(Icon, { paths: o.paths }) : o.glyph || offered.options?.some((x) => x.glyph) ? (
9624
9827
  // A row with no preview keeps the column, so the labels line up.
9625
9828
  /* @__PURE__ */ jsx44("span", { className: "pptx-menu__glyph", "aria-hidden": "true", children: o.glyph })
9626
9829
  ) : null,
@@ -9775,7 +9978,7 @@ function ActionControl({ slot, control }) {
9775
9978
  ) });
9776
9979
  }
9777
9980
  function ToolbarSlot(props) {
9778
- const control = chromeControlForSlot4(props.slotId);
9981
+ const control = chromeControlForSlot5(props.slotId);
9779
9982
  if (!control) {
9780
9983
  warnUnknownSlot(props.slotId);
9781
9984
  return null;
@@ -9820,7 +10023,7 @@ function collectToolbarOverrides(children, inBar = isToolbarBarSlot) {
9820
10023
  NAMED_PART_BY_SLOT.get(named)
9821
10024
  ) : child.props;
9822
10025
  const parts9 = slotPartNames(props);
9823
- if (!chromeControlForSlot4(props.slotId)) warnUnknownSlot(props.slotId, parts9);
10026
+ if (!chromeControlForSlot5(props.slotId)) warnUnknownSlot(props.slotId, parts9);
9824
10027
  else if (!inBar(props.slotId)) {
9825
10028
  if (!named && !props.hidden) warnSlotOutsideBar(props.slotId, parts9);
9826
10029
  if (!props.hidden) extras.push(child);
@@ -9979,7 +10182,7 @@ function PresetToolbar({
9979
10182
  const shape = items.map((g) => `${g.id}:${g.priority}:${g.pinned ? 1 : 0}`).join("|");
9980
10183
  const itemsRef = useRef36(items);
9981
10184
  itemsRef.current = items;
9982
- useLayoutEffect16(() => {
10185
+ useLayoutEffect17(() => {
9983
10186
  const el = ref.current;
9984
10187
  if (!el) return;
9985
10188
  if (!overflow) {
@@ -10614,7 +10817,13 @@ function StatusBar({ className, preset = true, children }) {
10614
10817
  children: content
10615
10818
  }
10616
10819
  );
10617
- if (!preset) return bar(children);
10820
+ if (!preset)
10821
+ return bar(
10822
+ /* @__PURE__ */ jsxs45(Fragment42, { children: [
10823
+ children,
10824
+ /* @__PURE__ */ jsx51(ReadOnlyBadge, {})
10825
+ ] })
10826
+ );
10618
10827
  const overrides = /* @__PURE__ */ new Map();
10619
10828
  const extras = [];
10620
10829
  for (const child of flatten6(children)) {
@@ -10626,6 +10835,7 @@ function StatusBar({ className, preset = true, children }) {
10626
10835
  return bar(
10627
10836
  /* @__PURE__ */ jsxs45(Fragment42, { children: [
10628
10837
  part(StatusBarSlideNumber),
10838
+ /* @__PURE__ */ jsx51(ReadOnlyBadge, {}),
10629
10839
  /* @__PURE__ */ jsx51("span", { className: "pptx-statusbar__spacer" }),
10630
10840
  part(StatusBarNotes),
10631
10841
  extras,
@@ -10636,7 +10846,7 @@ function StatusBar({ className, preset = true, children }) {
10636
10846
  }
10637
10847
 
10638
10848
  // src/HyperlinkPopup.tsx
10639
- import { useContext as useContext20, useEffect as useEffect34, useId as useId16, useMemo as useMemo17, useSyncExternalStore as useSyncExternalStore12 } from "react";
10849
+ import { useContext as useContext20, useEffect as useEffect34, useId as useId16, useMemo as useMemo18, useSyncExternalStore as useSyncExternalStore12 } from "react";
10640
10850
  import { hyperlinkPopupFromRequest } from "@pptx-editor.dev/core/editor";
10641
10851
  import { jsx as jsx52 } from "react/jsx-runtime";
10642
10852
  function HyperlinkPopup(props) {
@@ -10648,7 +10858,7 @@ function OwnState({ children, ...props }) {
10648
10858
  const editor = usePptxEditor();
10649
10859
  const errorId = useId16();
10650
10860
  const { anchor, url, mode, onClose } = props;
10651
- const controller = useMemo17(
10861
+ const controller = useMemo18(
10652
10862
  () => hyperlinkPopupFromRequest(editor, { anchor, url, onClose, ...mode ? { mode } : {} }),
10653
10863
  [editor, anchor]
10654
10864
  // eslint-disable-line react-hooks/exhaustive-deps
@@ -10663,7 +10873,7 @@ function OwnState({ children, ...props }) {
10663
10873
  }
10664
10874
 
10665
10875
  // src/customization-hooks.ts
10666
- import { useCallback as useCallback15, useContext as useContext21, useEffect as useEffect35, useMemo as useMemo18, useRef as useRef39, useState as useState42 } from "react";
10876
+ import { useCallback as useCallback15, useContext as useContext21, useEffect as useEffect35, useMemo as useMemo19, useRef as useRef39, useState as useState42 } from "react";
10667
10877
  import {
10668
10878
  ZOOM_LEVELS,
10669
10879
  onEditorEvent,
@@ -10676,7 +10886,7 @@ function useZoom() {
10676
10886
  const editor = usePptxEditor();
10677
10887
  const { zoom, fit } = useEditorState(selectZoom, sameZoom);
10678
10888
  const setZoom = useCallback15((next) => editor?.setZoom(next), [editor]);
10679
- return useMemo18(() => {
10889
+ return useMemo19(() => {
10680
10890
  const next = zoomStep2(zoom, 1);
10681
10891
  const previous = zoomStep2(zoom, -1);
10682
10892
  return {
@@ -10722,7 +10932,7 @@ function useScopeClassName() {
10722
10932
  }
10723
10933
 
10724
10934
  // src/usePptxSource.ts
10725
- import { useCallback as useCallback16, useEffect as useEffect36, useMemo as useMemo19, useRef as useRef40, useState as useState43, useSyncExternalStore as useSyncExternalStore13 } from "react";
10935
+ import { useCallback as useCallback16, useEffect as useEffect36, useMemo as useMemo20, useRef as useRef40, useState as useState43, useSyncExternalStore as useSyncExternalStore13 } from "react";
10726
10936
  import {
10727
10937
  editorHostDocument,
10728
10938
  fetchPptxSource,
@@ -10742,7 +10952,7 @@ function usePptxSource(source, options = {}) {
10742
10952
  const [fontsSettled, setFontsSettled] = useState43(options.fonts === void 0);
10743
10953
  const latest = useRef40(options);
10744
10954
  latest.current = options;
10745
- const resolver = useMemo19(
10955
+ const resolver = useMemo20(
10746
10956
  () => pptxSourceFontsResolver(() => latest.current.fonts),
10747
10957
  []
10748
10958
  );
@@ -10880,7 +11090,7 @@ function useBulletFormat() {
10880
11090
  }
10881
11091
 
10882
11092
  // src/useFonts.ts
10883
- import { useMemo as useMemo20, useRef as useRef41 } from "react";
11093
+ import { useMemo as useMemo21, useRef as useRef41 } from "react";
10884
11094
  import {
10885
11095
  composeFontOrigins,
10886
11096
  defineFontResolver
@@ -10888,7 +11098,7 @@ import {
10888
11098
  function useFonts(...origins) {
10889
11099
  const latest = useRef41(origins);
10890
11100
  latest.current = origins;
10891
- return useMemo20(
11101
+ return useMemo21(
10892
11102
  () => defineFontResolver(
10893
11103
  (request) => (
10894
11104
  // `composeFontOrigins` calls EVERY function origin with the request and never
@@ -10902,7 +11112,7 @@ function useFonts(...origins) {
10902
11112
  }
10903
11113
 
10904
11114
  // src/useFontFamily.ts
10905
- import { useCallback as useCallback20, useMemo as useMemo21 } from "react";
11115
+ import { useCallback as useCallback20, useMemo as useMemo22 } from "react";
10906
11116
  import {
10907
11117
  fontPickerGroups as fontPickerGroups2,
10908
11118
  isCurrentFontRow as isCurrentFontRow2
@@ -10915,7 +11125,7 @@ function useFontFamily() {
10915
11125
  const slide = useEditorState((s) => s.currentSlide);
10916
11126
  const theme = useEditorState((s) => s.format?.fontFamilyTheme ?? null);
10917
11127
  const value = typeof cmd.value === "string" ? cmd.value : null;
10918
- const choices = useMemo21(
11128
+ const choices = useMemo22(
10919
11129
  () => ({
10920
11130
  groups: fontPickerGroups2(editor, slide, ""),
10921
11131
  options: editor?.fontFamilies() ?? NO_FAMILIES
@@ -10930,7 +11140,7 @@ function useFontFamily() {
10930
11140
  (row) => !row.disabled && isCurrentFontRow2(row, value, theme),
10931
11141
  [value, theme]
10932
11142
  );
10933
- return useMemo21(
11143
+ return useMemo22(
10934
11144
  () => ({
10935
11145
  value,
10936
11146
  theme,
@@ -11046,6 +11256,7 @@ var PptxEditorDefault = forwardRef2(function PptxEditor({
11046
11256
  onFontError,
11047
11257
  fontFamilies,
11048
11258
  modules,
11259
+ autoCorrect,
11049
11260
  openFailure = true,
11050
11261
  renderOpenFailureActions,
11051
11262
  toolbar = true,
@@ -11061,7 +11272,7 @@ var PptxEditorDefault = forwardRef2(function PptxEditor({
11061
11272
  renderOpenFailureActions !== void 0,
11062
11273
  OPEN_FAILURE_ACTION_NAMES
11063
11274
  );
11064
- const rootPopups = useMemo22(
11275
+ const rootPopups = useMemo23(
11065
11276
  () => sugarPopups(popups, hyperlinkPopup, contextMenu),
11066
11277
  [popups, hyperlinkPopup, contextMenu]
11067
11278
  );
@@ -11085,7 +11296,8 @@ var PptxEditorDefault = forwardRef2(function PptxEditor({
11085
11296
  ...fonts ? { fonts } : {},
11086
11297
  ...onFontError ? { onFontError } : {},
11087
11298
  ...fontFamilies ? { fontFamilies } : {},
11088
- ...modules ? { modules } : {}
11299
+ ...modules ? { modules } : {},
11300
+ ...autoCorrect === false ? { autoCorrect } : {}
11089
11301
  },
11090
11302
  createElement3(
11091
11303
  PptxEditorViewport,
@@ -11286,4 +11498,3 @@ export {
11286
11498
  useTranslation,
11287
11499
  useZoom
11288
11500
  };
11289
- //# sourceMappingURL=index.js.map