@pptx-editor.dev/react 0.6.0 → 0.7.0-canary.20261120032841.sha-d450255

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
@@ -55,6 +55,7 @@ import {
55
55
  platformShortcuts,
56
56
  runToolbarCommand,
57
57
  sameChromeCommandState,
58
+ translateKeyOrText,
58
59
  valueSlotOptions,
59
60
  valueSlotShown,
60
61
  warnOutsideRoot
@@ -147,15 +148,17 @@ function useEditorCommand(slot) {
147
148
  );
148
149
  const notes = useNotesTarget(editor);
149
150
  const format = NOTES_SLOTS[slot];
150
- return useMemo(
151
- () => notes && format ? {
151
+ const { t } = useTranslation();
152
+ return useMemo(() => {
153
+ const state = notes && format ? {
152
154
  execute: () => notes.apply(format),
153
155
  isEnabled: !notes.readOnly && notes.canFormat,
154
156
  isActive: notes.formats[format],
155
157
  disabledReason: notes.readOnly ? "disabled.viewing" : notes.canFormat ? null : "disabled.selectNotesText"
156
- } : engine,
157
- [notes, format, engine]
158
- );
158
+ } : engine;
159
+ const reason = state.disabledReason ? translateKeyOrText(t, state.disabledReason) : null;
160
+ return reason === state.disabledReason ? state : { ...state, disabledReason: reason };
161
+ }, [notes, format, engine, t]);
159
162
  }
160
163
  function useOfferedControl(slot, control) {
161
164
  const editor = usePptxEditor();
@@ -571,7 +574,7 @@ import {
571
574
  panelItems,
572
575
  placeSubmenu,
573
576
  submenuPanelKey,
574
- translateKeyOrText,
577
+ translateKeyOrText as translateKeyOrText2,
575
578
  inFixedView,
576
579
  placeInFixedFrame
577
580
  } from "@pptx-editor.dev/core/editor";
@@ -709,7 +712,7 @@ function MenuSeparator() {
709
712
  function MenuSubmenu(props) {
710
713
  const { icon, paths, glyph, disabled, reason, className, children } = props;
711
714
  const t = useContext4(TranslationContext);
712
- const label = props.label ?? (props.labelKey ? translateKeyOrText(t, props.labelKey) : "");
715
+ const label = props.label ?? (props.labelKey ? translateKeyOrText2(t, props.labelKey) : "");
713
716
  const row = useRef3(null);
714
717
  const panel = useRef3(null);
715
718
  const [open, setOpen] = useState3(false);
@@ -799,12 +802,12 @@ function MenuSubmenu(props) {
799
802
  }
800
803
 
801
804
  // src/slot.ts
802
- import { tooltipAttributes as tooltipAttributes3, translateKeyOrText as translateKeyOrText2 } from "@pptx-editor.dev/core/editor";
805
+ import { tooltipAttributes as tooltipAttributes3 } from "@pptx-editor.dev/core/editor";
803
806
  function useSlot(slot, control) {
804
807
  const cmd = useEditorCommand(slot);
805
808
  const { t } = useTranslation();
806
809
  const label = t(control.labelKey);
807
- const reason = cmd.disabledReason ? translateKeyOrText2(t, cmd.disabledReason) : null;
810
+ const reason = cmd.disabledReason;
808
811
  return { cmd, label, reason, tip: tooltipAttributes3(label, !cmd.isEnabled, reason) };
809
812
  }
810
813
 
@@ -983,11 +986,11 @@ import {
983
986
  // src/PptxEditorRoot.tsx
984
987
  import {
985
988
  forwardRef,
986
- useEffect as useEffect39,
989
+ useEffect as useEffect40,
987
990
  useImperativeHandle,
988
991
  useLayoutEffect as useLayoutEffect19,
989
992
  useMemo as useMemo19,
990
- useRef as useRef49,
993
+ useRef as useRef48,
991
994
  useState as useState51
992
995
  } from "react";
993
996
  import {
@@ -997,7 +1000,7 @@ import {
997
1000
  localeContentKey,
998
1001
  repaintSurfaceOf,
999
1002
  reportFontError,
1000
- translateKeyOrText as translateKeyOrText21,
1003
+ translateKeyOrText as translateKeyOrText20,
1001
1004
  warnModulesChanged
1002
1005
  } from "@pptx-editor.dev/core/editor";
1003
1006
 
@@ -7012,9 +7015,9 @@ function useCanvasContextMenu() {
7012
7015
 
7013
7016
  // src/SlideSorter.tsx
7014
7017
  import {
7015
- useEffect as useEffect37,
7018
+ useEffect as useEffect38,
7016
7019
  useLayoutEffect as useLayoutEffect17,
7017
- useRef as useRef47,
7020
+ useRef as useRef46,
7018
7021
  useState as useState49
7019
7022
  } from "react";
7020
7023
  import {
@@ -7031,19 +7034,18 @@ import {
7031
7034
  slideSorterMounted,
7032
7035
  sorterKeyDown,
7033
7036
  trackNotesInset,
7034
- translateKeyOrText as translateKeyOrText20,
7035
7037
  warnSlideSorterUnmounted
7036
7038
  } from "@pptx-editor.dev/core/editor";
7037
7039
 
7038
7040
  // src/panes.tsx
7039
7041
  import {
7040
7042
  memo as memo2,
7041
- useEffect as useEffect36,
7043
+ useEffect as useEffect37,
7042
7044
  useId as useId21,
7043
7045
  useLayoutEffect as useLayoutEffect16,
7044
7046
  useMemo as useMemo18,
7045
- useReducer,
7046
- useRef as useRef46,
7047
+ useReducer as useReducer2,
7048
+ useRef as useRef45,
7047
7049
  useState as useState48
7048
7050
  } from "react";
7049
7051
  import {
@@ -8414,7 +8416,7 @@ function RenameField(props) {
8414
8416
  }
8415
8417
 
8416
8418
  // src/SidePanel.tsx
8417
- import { useEffect as useEffect32, useRef as useRef43, useState as useState45 } from "react";
8419
+ import { useEffect as useEffect33, useRef as useRef42, useState as useState45 } from "react";
8418
8420
  import {
8419
8421
  SIDE_PANEL_TAB_ICONS,
8420
8422
  listenPaneRequests,
@@ -8425,7 +8427,7 @@ import {
8425
8427
  } from "@pptx-editor.dev/core/editor";
8426
8428
 
8427
8429
  // src/AnimationsPane.tsx
8428
- import { useEffect as useEffect26, useId as useId13, useState as useState31 } from "react";
8430
+ import { useEffect as useEffect27, useId as useId13, useState as useState32 } from "react";
8429
8431
  import {
8430
8432
  ANIMATION_PRESET_GROUPS,
8431
8433
  ANIMATION_TRIGGERS,
@@ -8434,9 +8436,29 @@ import {
8434
8436
  animationListParts,
8435
8437
  animationStartLabel,
8436
8438
  parseSeconds,
8439
+ sameFormatNumber,
8437
8440
  secondsText,
8438
8441
  transitionKindLabelKey
8439
8442
  } from "@pptx-editor.dev/core/editor";
8443
+
8444
+ // src/live-field.ts
8445
+ import { useEffect as useEffect26, useReducer, useRef as useRef29, useState as useState31 } from "react";
8446
+ import { createLiveField } from "@pptx-editor.dev/core/editor";
8447
+ function useLiveField(host, scope) {
8448
+ const [, render2] = useReducer((n) => n + 1, 0);
8449
+ const latest = useRef29(host);
8450
+ latest.current = host;
8451
+ const [field] = useState31(() => createLiveField(() => latest.current, render2));
8452
+ const [seen, setSeen] = useState31(scope);
8453
+ if (!Object.is(seen, scope)) {
8454
+ setSeen(scope);
8455
+ field.sync();
8456
+ }
8457
+ useEffect26(() => () => field.dispose(), [field]);
8458
+ return field;
8459
+ }
8460
+
8461
+ // src/AnimationsPane.tsx
8440
8462
  import { jsx as jsx35, jsxs as jsxs32 } from "react/jsx-runtime";
8441
8463
  function SecondsField({
8442
8464
  label,
@@ -8445,20 +8467,23 @@ function SecondsField({
8445
8467
  onCommit
8446
8468
  }) {
8447
8469
  const { t } = useTranslation();
8470
+ const editor = usePptxEditor();
8448
8471
  const errorId = useId13();
8449
- const [draft, setDraft] = useState31(null);
8450
- const [invalid, setInvalid] = useState31(false);
8451
8472
  const shown = secondsText(ms);
8452
- const reset = () => {
8453
- setDraft(null);
8454
- setInvalid(false);
8455
- };
8456
- const commit = () => {
8457
- if (draft === null) return;
8458
- const value = draft === shown ? null : parseSeconds(draft);
8459
- if (draft === shown || value !== null && onCommit(value)) reset();
8460
- else setInvalid(true);
8461
- };
8473
+ const field = useLiveField(
8474
+ {
8475
+ editor,
8476
+ value: () => shown,
8477
+ same: sameFormatNumber,
8478
+ write(text, options, final) {
8479
+ const value = parseSeconds(text);
8480
+ if (value !== null && onCommit(value, options)) return null;
8481
+ return final ? t("panel.animations.invalidTime") : void 0;
8482
+ }
8483
+ },
8484
+ shown
8485
+ );
8486
+ const invalid = field.error !== null;
8462
8487
  return /* @__PURE__ */ jsxs32("label", { className: "pptx-field", children: [
8463
8488
  label,
8464
8489
  /* @__PURE__ */ jsxs32("span", { className: "pptx-field__control", children: [
@@ -8469,20 +8494,21 @@ function SecondsField({
8469
8494
  "aria-label": label,
8470
8495
  "aria-invalid": invalid,
8471
8496
  "aria-describedby": invalid ? errorId : void 0,
8472
- value: draft ?? shown,
8497
+ value: field.draft ?? shown,
8473
8498
  disabled,
8474
- "data-draft": draft !== null,
8475
- onChange: (e) => setDraft(e.target.value),
8476
- onBlur: commit,
8499
+ "data-draft": field.draft !== null,
8500
+ onChange: (e) => field.input(e.target.value, e.nativeEvent.isComposing === true),
8501
+ onCompositionEnd: (e) => field.input(e.currentTarget.value),
8502
+ onBlur: () => field.commit(),
8477
8503
  onKeyDown: (e) => {
8478
- if (e.key === "Enter") commit();
8479
- if (e.key === "Escape") reset();
8504
+ if (e.key === "Enter") field.commit();
8505
+ if (e.key === "Escape") field.cancel();
8480
8506
  }
8481
8507
  }
8482
8508
  ),
8483
8509
  /* @__PURE__ */ jsx35("span", { className: "pptx-field__unit", children: t("panel.animations.secondsUnit") })
8484
8510
  ] }),
8485
- invalid ? /* @__PURE__ */ jsx35("span", { id: errorId, className: "pptx-animations__error", role: "alert", children: t("panel.animations.invalidTime") }) : null
8511
+ invalid ? /* @__PURE__ */ jsx35("span", { id: errorId, className: "pptx-animations__error", role: "alert", children: field.error }) : null
8486
8512
  ] });
8487
8513
  }
8488
8514
  function TransitionSection({ disabled }) {
@@ -8492,7 +8518,7 @@ function TransitionSection({ disabled }) {
8492
8518
  const slideCount = useEditorState((s) => s.slides.length);
8493
8519
  const kindId = useId13();
8494
8520
  if (!transition) return null;
8495
- const set = (change) => editor?.exec({ type: "setTransition", ...change }).ok === true;
8521
+ const set = (change, options) => editor?.exec({ type: "setTransition", ...change }, options).ok === true;
8496
8522
  return /* @__PURE__ */ jsxs32("div", { className: "pptx-panel__section", children: [
8497
8523
  /* @__PURE__ */ jsx35("h3", { className: "pptx-panel__title", children: t("panel.animations.transition") }),
8498
8524
  /* @__PURE__ */ jsxs32("label", { className: "pptx-field", htmlFor: kindId, children: [
@@ -8519,7 +8545,7 @@ function TransitionSection({ disabled }) {
8519
8545
  label: t("panel.animations.duration"),
8520
8546
  ms: transition.durationMs,
8521
8547
  disabled: disabled || transition.kind === "none",
8522
- onCommit: (ms) => set({ durationMs: ms })
8548
+ onCommit: (ms, options) => set({ durationMs: ms }, options)
8523
8549
  }
8524
8550
  ),
8525
8551
  /* @__PURE__ */ jsx35(
@@ -8528,7 +8554,7 @@ function TransitionSection({ disabled }) {
8528
8554
  label: t("panel.animations.advanceAfter"),
8529
8555
  ms: transition.advanceAfterMs ?? 0,
8530
8556
  disabled: disabled || transition.advanceAfterMs === null,
8531
- onCommit: (ms) => set({ advanceAfterMs: ms })
8557
+ onCommit: (ms, options) => set({ advanceAfterMs: ms }, options)
8532
8558
  }
8533
8559
  )
8534
8560
  ] }),
@@ -8620,7 +8646,7 @@ function EffectFields({
8620
8646
  const editor = usePptxEditor();
8621
8647
  const startId = useId13();
8622
8648
  const off = disabled || !effect.editable;
8623
- const timing = (change) => editor?.exec({ type: "setAnimationTiming", effectId: effect.id, ...change }).ok === true;
8649
+ const timing = (change, options) => editor?.exec({ type: "setAnimationTiming", effectId: effect.id, ...change }, options).ok === true;
8624
8650
  return /* @__PURE__ */ jsxs32("div", { className: "pptx-panel__section pptx-animations__fields", children: [
8625
8651
  /* @__PURE__ */ jsxs32("label", { className: "pptx-field", htmlFor: startId, children: [
8626
8652
  t("panel.animations.start"),
@@ -8643,7 +8669,7 @@ function EffectFields({
8643
8669
  label: t("panel.animations.delay"),
8644
8670
  ms: effect.delayMs,
8645
8671
  disabled: off,
8646
- onCommit: (ms) => timing({ delayMs: ms })
8672
+ onCommit: (ms, options) => timing({ delayMs: ms }, options)
8647
8673
  }
8648
8674
  ),
8649
8675
  /* @__PURE__ */ jsx35(
@@ -8652,7 +8678,7 @@ function EffectFields({
8652
8678
  label: t("panel.animations.duration"),
8653
8679
  ms: effect.durationMs ?? 0,
8654
8680
  disabled: off || effect.durationMs === null,
8655
- onCommit: (ms) => timing({ durationMs: ms })
8681
+ onCommit: (ms, options) => timing({ durationMs: ms }, options)
8656
8682
  }
8657
8683
  )
8658
8684
  ] }),
@@ -8693,12 +8719,12 @@ function AnimationsPane() {
8693
8719
  const animations = useEditorState((s) => s.animations);
8694
8720
  const readOnly = useEditorState((s) => s.status !== "ready" || s.mode === "view");
8695
8721
  const hasSelection = useEditorState((s) => s.selection.kind !== "none");
8696
- const [preset, setPreset] = useState31("fade");
8722
+ const [preset, setPreset] = useState32("fade");
8697
8723
  const slide = useEditorState((s) => s.currentSlide);
8698
- const [chosen, setChosen] = useState31(null);
8724
+ const [chosen, setChosen] = useState32(null);
8699
8725
  const presetId = useId13();
8700
8726
  const listId = useId13();
8701
- useEffect26(() => {
8727
+ useEffect27(() => {
8702
8728
  if (!editor) return;
8703
8729
  editor.exec({ type: "showAnimationOrder", show: true });
8704
8730
  return () => void editor.exec({ type: "showAnimationOrder", show: false });
@@ -8782,7 +8808,7 @@ function AnimationsPane() {
8782
8808
  }
8783
8809
 
8784
8810
  // src/ChartDataPane.tsx
8785
- import { useId as useId14, useRef as useRef29, useState as useState32 } from "react";
8811
+ import { useId as useId14, useRef as useRef30, useState as useState33 } from "react";
8786
8812
  import {
8787
8813
  CHART_LEGEND_CHOICES,
8788
8814
  CHART_TYPE_CHOICES,
@@ -8800,7 +8826,8 @@ import {
8800
8826
  focusChartRow,
8801
8827
  colorPickOf as colorPickOf2,
8802
8828
  nextChartCategoryLabel,
8803
- renderedColorOf as renderedColorOf2
8829
+ renderedColorOf as renderedColorOf2,
8830
+ sameFormatNumber as sameFormatNumber2
8804
8831
  } from "@pptx-editor.dev/core/editor";
8805
8832
  import { Fragment as Fragment29, jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
8806
8833
  function ChartField({
@@ -8813,25 +8840,20 @@ function ChartField({
8813
8840
  onCommit
8814
8841
  }) {
8815
8842
  const errorId = useId14();
8816
- const [draft, setDraft] = useState32(null);
8817
- const [error, setError] = useState32(null);
8818
- const [scope, setScope] = useState32(draftKey);
8819
- if (scope !== draftKey) {
8820
- setScope(draftKey);
8821
- setDraft(null);
8822
- setError(null);
8823
- }
8824
- const reset = () => {
8825
- setDraft(null);
8826
- setError(null);
8827
- };
8828
- const commit = () => {
8829
- if (draft === null) return;
8830
- if (draft === value) return reset();
8831
- const refused = onCommit(draft);
8832
- if (refused === null) reset();
8833
- else setError(refused);
8834
- };
8843
+ const editor = usePptxEditor();
8844
+ const field = useLiveField(
8845
+ {
8846
+ editor,
8847
+ value: () => value,
8848
+ ...numeric ? { same: sameFormatNumber2 } : {},
8849
+ write: (text, options, final) => {
8850
+ const refused = onCommit(text, options);
8851
+ return refused === null || final ? refused : void 0;
8852
+ }
8853
+ },
8854
+ `${draftKey}\0${value}`
8855
+ );
8856
+ const error = field.error;
8835
8857
  return /* @__PURE__ */ jsxs33("label", { className: "pptx-field pptx-chart-pane__field", children: [
8836
8858
  visibleLabel ? /* @__PURE__ */ jsx36("span", { className: "pptx-chart-pane__label", children: visibleLabel }) : null,
8837
8859
  /* @__PURE__ */ jsx36(
@@ -8841,14 +8863,15 @@ function ChartField({
8841
8863
  inputMode: numeric ? "decimal" : void 0,
8842
8864
  "aria-invalid": error !== null,
8843
8865
  "aria-describedby": error !== null ? errorId : void 0,
8844
- value: draft ?? value,
8866
+ value: field.draft ?? value,
8845
8867
  disabled,
8846
- "data-draft": draft !== null,
8847
- onChange: (e) => setDraft(e.target.value),
8848
- onBlur: commit,
8868
+ "data-draft": field.draft !== null,
8869
+ onChange: (e) => field.input(e.target.value, e.nativeEvent.isComposing === true),
8870
+ onCompositionEnd: (e) => field.input(e.currentTarget.value),
8871
+ onBlur: () => field.commit(),
8849
8872
  onKeyDown: (e) => {
8850
- if (e.key === "Enter") commit();
8851
- if (e.key === "Escape") reset();
8873
+ if (e.key === "Enter") field.commit();
8874
+ if (e.key === "Escape") field.cancel();
8852
8875
  }
8853
8876
  }
8854
8877
  ),
@@ -8886,7 +8909,7 @@ function SeriesCard({
8886
8909
  visibleLabel: t("chartData.name"),
8887
8910
  value: series.name,
8888
8911
  disabled,
8889
- onCommit: (text) => apply({ type: "seriesName", series: index, text })
8912
+ onCommit: (text, options) => apply({ type: "seriesName", series: index, text }, options)
8890
8913
  }
8891
8914
  ),
8892
8915
  /* @__PURE__ */ jsx36("div", { className: "pptx-panel__grid", children: data.categories.map((c, i) => /* @__PURE__ */ jsx36(
@@ -8898,7 +8921,7 @@ function SeriesCard({
8898
8921
  value: chartValueText(series.values[i]),
8899
8922
  numeric: true,
8900
8923
  disabled,
8901
- onCommit: (text) => apply({ type: "value", series: index, category: i, text })
8924
+ onCommit: (text, options) => apply({ type: "value", series: index, category: i, text }, options)
8902
8925
  },
8903
8926
  i
8904
8927
  )) }),
@@ -8951,7 +8974,7 @@ function ChartFormatSection({
8951
8974
  const { t } = useTranslation();
8952
8975
  const editor = usePptxEditor();
8953
8976
  const rows = useEditorState((s) => s.themeColors);
8954
- const [typeNote, setTypeNote] = useState32(null);
8977
+ const [typeNote, setTypeNote] = useState33(null);
8955
8978
  const read = editor ? editor.chartFormat(nodeId) : null;
8956
8979
  if (!read?.ok) return null;
8957
8980
  const format = read.format;
@@ -9003,7 +9026,7 @@ function ChartFormatSection({
9003
9026
  visibleLabel: t("chartFormat.titleText"),
9004
9027
  value: format.title,
9005
9028
  disabled,
9006
- onCommit: (text) => run(chartTitleCommand(format, "title", text))
9029
+ onCommit: (text, options) => run(chartTitleCommand(format, "title", text), options)
9007
9030
  }
9008
9031
  ) }) : null,
9009
9032
  /* @__PURE__ */ jsx36(
@@ -9056,7 +9079,7 @@ function ChartFormatSection({
9056
9079
  visibleLabel: t(axisLabels.category),
9057
9080
  value: format.axisTitles?.category ?? "",
9058
9081
  disabled: disabled || !format.axes,
9059
- onCommit: (text) => run(chartTitleCommand(format, "categoryAxisTitle", text))
9082
+ onCommit: (text, options) => run(chartTitleCommand(format, "categoryAxisTitle", text), options)
9060
9083
  }
9061
9084
  ),
9062
9085
  /* @__PURE__ */ jsx36(
@@ -9067,7 +9090,7 @@ function ChartFormatSection({
9067
9090
  visibleLabel: t(axisLabels.value),
9068
9091
  value: format.axisTitles?.value ?? "",
9069
9092
  disabled: disabled || !format.axes,
9070
- onCommit: (text) => run(chartTitleCommand(format, "valueAxisTitle", text))
9093
+ onCommit: (text, options) => run(chartTitleCommand(format, "valueAxisTitle", text), options)
9071
9094
  }
9072
9095
  )
9073
9096
  ] }),
@@ -9099,10 +9122,10 @@ function ChartDataPane() {
9099
9122
  useEditorState((s) => s.revision);
9100
9123
  const readOnly = useEditorState((s) => s.mode === "view");
9101
9124
  const read = editor && chart ? editor.chartData(chart.nodeId) : null;
9102
- const [refusal, setRefusal] = useState32(null);
9103
- const pane = useRef29(null);
9104
- const [open, setOpen] = useState32(() => /* @__PURE__ */ new Set([0]));
9105
- const [draftScope, setDraftScope] = useState32({ key: "", reset: 0 });
9125
+ const [refusal, setRefusal] = useState33(null);
9126
+ const pane = useRef30(null);
9127
+ const [open, setOpen] = useState33(() => /* @__PURE__ */ new Set([0]));
9128
+ const [draftScope, setDraftScope] = useState33({ key: "", reset: 0 });
9106
9129
  if (!chart || !read)
9107
9130
  return /* @__PURE__ */ jsxs33("div", { className: "pptx-empty", children: [
9108
9131
  /* @__PURE__ */ jsx36("p", { className: "pptx-empty__title", children: t("chartData.emptyTitle") }),
@@ -9122,19 +9145,19 @@ function ChartDataPane() {
9122
9145
  if (nextScope !== draftScope) setDraftScope(nextScope);
9123
9146
  const draftKey = String(nextScope.reset);
9124
9147
  const disabled = readOnly || !chart.editable;
9125
- const apply = (change) => {
9148
+ const apply = (change, options) => {
9126
9149
  const command = chartPaneCommand(data, change);
9127
9150
  if (!command.ok) return t(command.error);
9128
- const result = editor?.exec(command.command);
9151
+ const result = editor?.exec(command.command, options);
9129
9152
  setRefusal(null);
9130
9153
  return !result || result.ok ? null : t(result.reason);
9131
9154
  };
9132
- const runFormat = (command) => {
9155
+ const runFormat = (command, options) => {
9133
9156
  if (!command) {
9134
9157
  setRefusal(null);
9135
9158
  return null;
9136
9159
  }
9137
- const result = editor?.exec(command);
9160
+ const result = editor?.exec(command, options);
9138
9161
  const reason = !result || result.ok ? null : t(result.reason);
9139
9162
  setRefusal(reason);
9140
9163
  return reason;
@@ -9180,7 +9203,7 @@ function ChartDataPane() {
9180
9203
  value: c.label,
9181
9204
  numeric: xy,
9182
9205
  disabled,
9183
- onCommit: (text) => apply({ type: "label", category: i, text })
9206
+ onCommit: (text, options) => apply({ type: "label", category: i, text }, options)
9184
9207
  }
9185
9208
  ),
9186
9209
  /* @__PURE__ */ jsx36(
@@ -9253,7 +9276,7 @@ function ChartDataPane() {
9253
9276
  }
9254
9277
 
9255
9278
  // src/DiagramTextPane.tsx
9256
- import { useEffect as useEffect27, useId as useId15, useRef as useRef30, useState as useState33 } from "react";
9279
+ import { useEffect as useEffect28, useId as useId15, useRef as useRef31, useState as useState34 } from "react";
9257
9280
  import { jsx as jsx37, jsxs as jsxs34 } from "react/jsx-runtime";
9258
9281
  function NodeField({
9259
9282
  label,
@@ -9264,19 +9287,20 @@ function NodeField({
9264
9287
  onCommit
9265
9288
  }) {
9266
9289
  const errorId = useId15();
9267
- const [draft, setDraft] = useState33(null);
9268
- const [error, setError] = useState33(null);
9269
- const reset = () => {
9270
- setDraft(null);
9271
- setError(null);
9272
- };
9273
- const commit = () => {
9274
- if (draft === null) return;
9275
- if (draft === value) return reset();
9276
- const refused = onCommit(draft);
9277
- if (refused === null) reset();
9278
- else setError(refused);
9279
- };
9290
+ const editor = usePptxEditor();
9291
+ const field = useLiveField(
9292
+ {
9293
+ editor,
9294
+ value: () => value,
9295
+ write: (text, options, final) => {
9296
+ const refused = onCommit(text, options);
9297
+ return refused === null || final ? refused : void 0;
9298
+ }
9299
+ },
9300
+ value
9301
+ );
9302
+ const draft = field.draft;
9303
+ const error = field.error;
9280
9304
  const shown = draft ?? value;
9281
9305
  return /* @__PURE__ */ jsxs34("label", { className: "pptx-field pptx-diagram-pane__field", children: [
9282
9306
  /* @__PURE__ */ jsx37(
@@ -9290,15 +9314,16 @@ function NodeField({
9290
9314
  readOnly,
9291
9315
  "data-node": node,
9292
9316
  "data-draft": draft !== null,
9293
- onChange: (e) => setDraft(e.target.value),
9294
- onBlur: commit,
9317
+ onChange: (e) => field.input(e.target.value, e.nativeEvent.isComposing === true),
9318
+ onCompositionEnd: (e) => field.input(e.currentTarget.value),
9319
+ onBlur: () => field.commit(),
9295
9320
  onKeyDown: (e) => {
9296
9321
  if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) {
9297
9322
  e.preventDefault();
9298
9323
  e.stopPropagation();
9299
- commit();
9324
+ field.commit();
9300
9325
  }
9301
- if (e.key === "Escape") reset();
9326
+ if (e.key === "Escape") field.cancel();
9302
9327
  }
9303
9328
  }
9304
9329
  ),
@@ -9310,13 +9335,13 @@ function DiagramTextPane() {
9310
9335
  const editor = usePptxEditor();
9311
9336
  const diagram = useEditorState((s) => s.diagram ?? null);
9312
9337
  const readOnly = useEditorState((s) => s.mode === "view");
9313
- const [refusal, setRefusal] = useState33(
9338
+ const [refusal, setRefusal] = useState34(
9314
9339
  null
9315
9340
  );
9316
9341
  const noteId = useId15();
9317
- const root = useRef30(null);
9318
- const [focus, setFocus] = useState33(null);
9319
- useEffect27(() => {
9342
+ const root = useRef31(null);
9343
+ const [focus, setFocus] = useState34(null);
9344
+ useEffect28(() => {
9320
9345
  if (!focus) return;
9321
9346
  setFocus(null);
9322
9347
  const fields = [...root.current?.querySelectorAll("textarea") ?? []];
@@ -9329,8 +9354,8 @@ function DiagramTextPane() {
9329
9354
  /* @__PURE__ */ jsx37("p", { className: "pptx-empty__body", children: t("diagram.pane.emptyBody") })
9330
9355
  ] });
9331
9356
  const frame = diagram.nodeId;
9332
- const apply = (command) => {
9333
- const result = editor?.exec(command);
9357
+ const apply = (command, options) => {
9358
+ const result = editor?.exec(command, options);
9334
9359
  return !result || result.ok ? null : t(result.reason);
9335
9360
  };
9336
9361
  const run = (command, index) => {
@@ -9368,7 +9393,7 @@ function DiagramTextPane() {
9368
9393
  node: node.node,
9369
9394
  readOnly: readOnly || !node.editable,
9370
9395
  ...node.editable ? {} : { note: `${noteId}-${i}` },
9371
- onCommit: (text) => apply({ type: "setDiagramText", nodeId: frame, node: node.node, text })
9396
+ onCommit: (text, options) => apply({ type: "setDiagramText", nodeId: frame, node: node.node, text }, options)
9372
9397
  }
9373
9398
  ),
9374
9399
  /* @__PURE__ */ jsxs34("div", { className: "pptx-diagram-pane__actions", children: [
@@ -9435,7 +9460,7 @@ function DiagramTextPane() {
9435
9460
  }
9436
9461
 
9437
9462
  // src/FormatPanel.tsx
9438
- import { useEffect as useEffect31, useLayoutEffect as useLayoutEffect13, useRef as useRef42, useState as useState44 } from "react";
9463
+ import { useEffect as useEffect32, useLayoutEffect as useLayoutEffect13, useRef as useRef41, useState as useState44 } from "react";
9439
9464
  import {
9440
9465
  chromeControlForSlot as chromeControlForSlot6,
9441
9466
  formatSectionsOf,
@@ -9452,11 +9477,11 @@ import {
9452
9477
  Children as Children7,
9453
9478
  Fragment as Fragment37,
9454
9479
  isValidElement as isValidElement7,
9455
- useEffect as useEffect30,
9480
+ useEffect as useEffect31,
9456
9481
  useId as useId18,
9457
9482
  useLayoutEffect as useLayoutEffect11,
9458
- useRef as useRef37,
9459
- useState as useState40
9483
+ useRef as useRef38,
9484
+ useState as useState41
9460
9485
  } from "react";
9461
9486
  import {
9462
9487
  colorMenuSelection as colorMenuSelection2,
@@ -9489,7 +9514,7 @@ import {
9489
9514
  } from "@pptx-editor.dev/core/editor";
9490
9515
 
9491
9516
  // src/ShapeFormatControls.tsx
9492
- import { Fragment as Fragment30, useCallback as useCallback12, useRef as useRef31, useState as useState34 } from "react";
9517
+ import { Fragment as Fragment30, useCallback as useCallback12, useRef as useRef32, useState as useState35 } from "react";
9493
9518
  import {
9494
9519
  GLOW_ACCENTS,
9495
9520
  SHAPE_STYLE_GALLERY,
@@ -9580,8 +9605,8 @@ function ShapeStyleGalleryControl({
9580
9605
  }) {
9581
9606
  const { cmd, label, reason, tip } = useSlot(slot, control);
9582
9607
  const off = useAriaDisabled(!cmd.isEnabled, reason);
9583
- const anchor = useRef31(null);
9584
- const [open, setOpen] = useState34(false);
9608
+ const anchor = useRef32(null);
9609
+ const [open, setOpen] = useState35(false);
9585
9610
  const trigger = useTriggerAttributes(slot, "pptx-toolbar__button pptx-toolbar__button--wide", {
9586
9611
  disabled: !cmd.isEnabled
9587
9612
  });
@@ -9688,8 +9713,8 @@ function EffectMenuControl({
9688
9713
  const { cmd, label, reason, tip } = useSlot(slot, control);
9689
9714
  const off = useAriaDisabled(!cmd.isEnabled, reason);
9690
9715
  const { t } = useTranslation();
9691
- const anchor = useRef31(null);
9692
- const [open, setOpen] = useState34(false);
9716
+ const anchor = useRef32(null);
9717
+ const [open, setOpen] = useState35(false);
9693
9718
  const trigger = useTriggerAttributes(slot, "pptx-toolbar__button pptx-toolbar__button--wide", {
9694
9719
  disabled: !cmd.isEnabled
9695
9720
  });
@@ -9748,7 +9773,7 @@ function EffectMenuControl({
9748
9773
  }
9749
9774
 
9750
9775
  // src/TextEffectsControl.tsx
9751
- import { useCallback as useCallback13, useRef as useRef32, useState as useState35 } from "react";
9776
+ import { useCallback as useCallback13, useRef as useRef33, useState as useState36 } from "react";
9752
9777
  import {
9753
9778
  TEXT_WARP_GALLERY,
9754
9779
  chromeOptionChecked as chromeOptionChecked2,
@@ -9813,8 +9838,8 @@ function TextEffectsMenuControl({
9813
9838
  const { cmd, label, reason, tip } = useSlot(slot, control);
9814
9839
  const off = useAriaDisabled(!cmd.isEnabled, reason);
9815
9840
  const { t } = useTranslation();
9816
- const anchor = useRef32(null);
9817
- const [open, setOpen] = useState35(false);
9841
+ const anchor = useRef33(null);
9842
+ const [open, setOpen] = useState36(false);
9818
9843
  const trigger = useTriggerAttributes(slot, "pptx-toolbar__button pptx-toolbar__button--wide", {
9819
9844
  disabled: !cmd.isEnabled
9820
9845
  });
@@ -9862,7 +9887,7 @@ function TextEffectsMenuControl({
9862
9887
  }
9863
9888
 
9864
9889
  // src/toolbar-file-controls.tsx
9865
- import { useRef as useRef33 } from "react";
9890
+ import { useRef as useRef34 } from "react";
9866
9891
  import {
9867
9892
  captureImageTarget,
9868
9893
  imageFileTypes,
@@ -9875,7 +9900,7 @@ function LinkControl({ slot, control }) {
9875
9900
  const editor = usePptxEditor();
9876
9901
  const { t } = useTranslation();
9877
9902
  const off = useChromeActionHost().unavailable?.(slot) ?? null;
9878
- const anchor = useRef33(null);
9903
+ const anchor = useRef34(null);
9879
9904
  return /* @__PURE__ */ jsx40("span", { ref: anchor, className: "pptx-toolbar__group", children: /* @__PURE__ */ jsx40(
9880
9905
  ToolButton,
9881
9906
  {
@@ -9892,8 +9917,8 @@ function LinkControl({ slot, control }) {
9892
9917
  function ImageControl({ slot, control }) {
9893
9918
  const { cmd, label, reason } = useSlot(slot, control);
9894
9919
  const editor = usePptxEditor();
9895
- const input = useRef33(null);
9896
- const pickerTarget = useRef33(void 0);
9920
+ const input = useRef34(null);
9921
+ const pickerTarget = useRef34(void 0);
9897
9922
  const target = control.state.kind === "replace" ? "replaceImage" : void 0;
9898
9923
  const onFile = async (file) => {
9899
9924
  const isCurrent = pickerTarget.current;
@@ -9933,7 +9958,7 @@ function ImageControl({ slot, control }) {
9933
9958
  }
9934
9959
 
9935
9960
  // src/PictureControls.tsx
9936
- import { useRef as useRef34, useState as useState36 } from "react";
9961
+ import { useRef as useRef35, useState as useState37 } from "react";
9937
9962
  import {
9938
9963
  chromeOptionChecked as chromeOptionChecked3,
9939
9964
  correctionGridRows,
@@ -9954,8 +9979,8 @@ function CorrectionsControl({
9954
9979
  const { cmd, label, reason, tip } = useSlot(slot, control);
9955
9980
  const off = useAriaDisabled(!cmd.isEnabled, reason);
9956
9981
  const { t } = useTranslation();
9957
- const anchor = useRef34(null);
9958
- const [open, setOpen] = useState36(false);
9982
+ const anchor = useRef35(null);
9983
+ const [open, setOpen] = useState37(false);
9959
9984
  const trigger = useTriggerAttributes(slot, "pptx-toolbar__button pptx-toolbar__button--wide", {
9960
9985
  disabled: !cmd.isEnabled
9961
9986
  });
@@ -10048,11 +10073,11 @@ import {
10048
10073
  import {
10049
10074
  createContext as createContext15,
10050
10075
  useContext as useContext17,
10051
- useEffect as useEffect28,
10076
+ useEffect as useEffect29,
10052
10077
  useId as useId16,
10053
10078
  useLayoutEffect as useLayoutEffect9,
10054
- useRef as useRef35,
10055
- useState as useState37
10079
+ useRef as useRef36,
10080
+ useState as useState38
10056
10081
  } from "react";
10057
10082
  import {
10058
10083
  firstFontPickerFamily,
@@ -10198,10 +10223,10 @@ function FontFamilyControl({ slot, control, children }) {
10198
10223
  const { cmd, reason } = slotState;
10199
10224
  const off = useAriaDisabled(!cmd.isEnabled, reason);
10200
10225
  const editor = usePptxEditor();
10201
- const anchor = useRef35(null);
10202
- const list = useRef35(null);
10203
- const [open, setOpen] = useState37(false);
10204
- const [query, setQuery] = useState37("");
10226
+ const anchor = useRef36(null);
10227
+ const list = useRef36(null);
10228
+ const [open, setOpen] = useState38(false);
10229
+ const [query, setQuery] = useState38("");
10205
10230
  useEditorState((s) => s.revision);
10206
10231
  const slide = useEditorState((s) => s.currentSlide);
10207
10232
  const groups = open ? fontPickerGroups(editor, slide, query) : [];
@@ -10212,7 +10237,7 @@ function FontFamilyControl({ slot, control, children }) {
10212
10237
  useLayoutEffect9(() => {
10213
10238
  if (open) revealCurrentFont(list.current);
10214
10239
  }, [open]);
10215
- useEffect28(() => {
10240
+ useEffect29(() => {
10216
10241
  if (open) focusFontOption(list.current);
10217
10242
  }, [open]);
10218
10243
  const state = {
@@ -10315,7 +10340,7 @@ function SlotControl({
10315
10340
  }
10316
10341
 
10317
10342
  // src/toolbar-size.tsx
10318
- import { useEffect as useEffect29, useId as useId17, useRef as useRef36, useState as useState38 } from "react";
10343
+ import { useEffect as useEffect30, useId as useId17, useRef as useRef37, useState as useState39 } from "react";
10319
10344
  import {
10320
10345
  SIZE_ERROR_MS,
10321
10346
  parseToolbarSize,
@@ -10329,14 +10354,14 @@ function SizeControl({ slot, control }) {
10329
10354
  const editor = usePptxEditor();
10330
10355
  const { t } = useTranslation();
10331
10356
  const mixed = useEditorState((s) => s.format?.font?.disagrees.fontSizePt === true);
10332
- const [draft, setDraft] = useState38(null);
10333
- const box = useRef36(null);
10334
- const handled = useRef36(false);
10357
+ const [draft, setDraft] = useState39(null);
10358
+ const box = useRef37(null);
10359
+ const handled = useRef37(false);
10335
10360
  const value = toolbarSizeText(cmd.value, mixed);
10336
10361
  const off = useAriaDisabled(!cmd.isEnabled, reason);
10337
10362
  const errorId = useId17();
10338
- const [error, setError] = useState38(null);
10339
- useEffect29(() => {
10363
+ const [error, setError] = useState39(null);
10364
+ useEffect30(() => {
10340
10365
  if (!error) return;
10341
10366
  const timer = setTimeout(() => setError(null), SIZE_ERROR_MS);
10342
10367
  return () => clearTimeout(timer);
@@ -10426,7 +10451,7 @@ function SizeControl({ slot, control }) {
10426
10451
  }
10427
10452
 
10428
10453
  // src/toolbar-measure.ts
10429
- import { useLayoutEffect as useLayoutEffect10, useState as useState39 } from "react";
10454
+ import { useLayoutEffect as useLayoutEffect10, useState as useState40 } from "react";
10430
10455
  import {
10431
10456
  syncToolbarTabStop,
10432
10457
  toolbarArrowKey,
@@ -10434,7 +10459,7 @@ import {
10434
10459
  } from "@pptx-editor.dev/core/editor";
10435
10460
  import { separatorCost, toolbarRoom } from "@pptx-editor.dev/core/editor";
10436
10461
  function useRovingToolbar(ref) {
10437
- const [tracker] = useState39(toolbarFocusTracker);
10462
+ const [tracker] = useState40(toolbarFocusTracker);
10438
10463
  useLayoutEffect10(() => {
10439
10464
  const bar = ref.current;
10440
10465
  if (!bar) return;
@@ -10487,8 +10512,8 @@ function DropdownControl({ slot, control }) {
10487
10512
  const editor = usePptxEditor();
10488
10513
  const openDialog = useDialogOpener();
10489
10514
  const host = useChromeActionHost();
10490
- const anchor = useRef37(null);
10491
- const [open, setOpen] = useState40(false);
10515
+ const anchor = useRef38(null);
10516
+ const [open, setOpen] = useState41(false);
10492
10517
  const current = control.options?.find((o) => o.value === cmd.value);
10493
10518
  const offered = useOfferedControl(slot, control) ?? control;
10494
10519
  const icon = current?.paths ?? control.paths;
@@ -10562,11 +10587,11 @@ function ColorControl({ slot, control }) {
10562
10587
  const { cmd, label, reason, tip } = useSlot(slot, control);
10563
10588
  const editor = usePptxEditor();
10564
10589
  const { t } = useTranslation();
10565
- const anchor = useRef37(null);
10566
- const [open, setOpen] = useState40(false);
10590
+ const anchor = useRef38(null);
10591
+ const [open, setOpen] = useState41(false);
10567
10592
  const fallback = useDefaultColor(slot);
10568
10593
  const selected = useEditorState((s) => colorMenuSelection2(slot, s));
10569
- const [picked, setPicked] = useState40(null);
10594
+ const [picked, setPicked] = useState41(null);
10570
10595
  const last = picked ?? fallback;
10571
10596
  const resetLabel = t(toolbarColorResetKey(slot));
10572
10597
  const off = useAriaDisabled(!cmd.isEnabled, reason);
@@ -10683,7 +10708,7 @@ function ActionControl({ slot, control }) {
10683
10708
  const { t } = useTranslation();
10684
10709
  const host = useChromeActionHost();
10685
10710
  const off = host.unavailable?.(slot) ?? null;
10686
- const ref = useRef37(null);
10711
+ const ref = useRef38(null);
10687
10712
  return /* @__PURE__ */ jsx45("span", { ref, className: "pptx-toolbar__group", children: /* @__PURE__ */ jsx45(
10688
10713
  ToolButton,
10689
10714
  {
@@ -10871,7 +10896,7 @@ function PresetBar({
10871
10896
  }
10872
10897
  function HandBar({ className, children }) {
10873
10898
  const { t } = useTranslation();
10874
- const ref = useRef37(null);
10899
+ const ref = useRef38(null);
10875
10900
  const roving = useRovingToolbar(ref);
10876
10901
  return /* @__PURE__ */ jsx45(
10877
10902
  "div",
@@ -10897,16 +10922,16 @@ function PresetToolbar({
10897
10922
  const { t } = useTranslation();
10898
10923
  useEditorState((s) => s.status);
10899
10924
  const context = useEditorState((s) => `${formatTargetKey(s)}|${formatSelectionHasLineEnds2(s)}`);
10900
- const ref = useRef37(null);
10901
- const more = useRef37(null);
10902
- const fixed = useRef37(null);
10925
+ const ref = useRef38(null);
10926
+ const more = useRef38(null);
10927
+ const fixed = useRef38(null);
10903
10928
  const panelId2 = useId18();
10904
- const memory = useRef37(createToolbarFitMemory());
10929
+ const memory = useRef38(createToolbarFitMemory());
10905
10930
  const count = items.length;
10906
- const [collapsed, setCollapsed] = useState40([]);
10907
- const [open, setOpen] = useState40(false);
10931
+ const [collapsed, setCollapsed] = useState41([]);
10932
+ const [open, setOpen] = useState41(false);
10908
10933
  const shape = items.map((g) => `${g.id}:${g.priority}:${g.pinned ? 1 : 0}`).join("|");
10909
- const itemsRef = useRef37(items);
10934
+ const itemsRef = useRef38(items);
10910
10935
  itemsRef.current = items;
10911
10936
  useLayoutEffect11(() => {
10912
10937
  const el = ref.current;
@@ -10950,7 +10975,7 @@ function PresetToolbar({
10950
10975
  const visible = items.map((_, i) => i).filter((i) => !hiddenIds.has(items[i].id));
10951
10976
  const hidden = items.map((_, i) => i).filter((i) => hiddenIds.has(items[i].id));
10952
10977
  const roving = useRovingToolbar(ref);
10953
- useEffect30(() => {
10978
+ useEffect31(() => {
10954
10979
  if (!hidden.length) setOpen(false);
10955
10980
  }, [hidden.length]);
10956
10981
  return /* @__PURE__ */ jsxs41(
@@ -11018,7 +11043,11 @@ function PresetToolbar({
11018
11043
  import { formatLineState, formatTargetKey as formatTargetKey2, translateKeyOrText as translateKeyOrText16 } from "@pptx-editor.dev/core/editor";
11019
11044
 
11020
11045
  // src/FormatNumberField.tsx
11021
- import { useId as useId19, useRef as useRef38, useState as useState41 } from "react";
11046
+ import { useId as useId19 } from "react";
11047
+ import {
11048
+ parseFormatNumber,
11049
+ sameFormatNumber as sameFormatNumber3
11050
+ } from "@pptx-editor.dev/core/editor";
11022
11051
  import { jsx as jsx46, jsxs as jsxs42 } from "react/jsx-runtime";
11023
11052
  function FormatNumberField({
11024
11053
  label,
@@ -11030,43 +11059,41 @@ function FormatNumberField({
11030
11059
  exclusiveMin,
11031
11060
  mixed = true,
11032
11061
  max,
11062
+ step = 1,
11063
+ inline,
11064
+ placeholder,
11033
11065
  onCommit
11034
11066
  }) {
11035
11067
  const { t } = useTranslation();
11068
+ const editor = usePptxEditor();
11036
11069
  const errorId = useId19();
11037
- const [draft, setDraft] = useState41(null);
11038
- const pending = useRef38(null);
11039
- const [error, setError] = useState41(null);
11040
- const [source, setSource] = useState41(value);
11041
- const reset = () => {
11042
- pending.current = null;
11043
- setDraft(null);
11044
- setError(null);
11045
- };
11046
- if (source !== value) {
11047
- setSource(value);
11048
- reset();
11049
- }
11050
- const commit = () => {
11051
- if (pending.current === null) return;
11052
- const text = pending.current;
11053
- const number = text.trim() === "" ? NaN : Number(text.replace(",", "."));
11054
- if (!Number.isFinite(number) || min !== void 0 && (number < min || exclusiveMin && number === min) || max !== void 0 && number > max) {
11055
- setError(
11056
- min !== void 0 && max !== void 0 ? t(exclusiveMin ? "inspector.numberRangeExclusive" : "inspector.numberRange", {
11057
- min,
11058
- max
11059
- }) : min !== void 0 ? t("inspector.numberMinimum", { min }) : t("disabled.invalidValue")
11060
- );
11061
- return;
11062
- }
11063
- if (value !== null && number === Number(value)) return reset();
11064
- const refused = onCommit(number);
11065
- if (refused) setError(refused);
11066
- else reset();
11067
- };
11068
- return /* @__PURE__ */ jsxs42("label", { className: "pptx-field", children: [
11069
- label,
11070
+ const field = useLiveField(
11071
+ {
11072
+ editor,
11073
+ value: () => value,
11074
+ same: sameFormatNumber3,
11075
+ write(text, options, final) {
11076
+ const parsed = parseFormatNumber(text, { min, max, exclusiveMin });
11077
+ if (!parsed.ok)
11078
+ return final || !parsed.incomplete ? t(parsed.key, parsed.params) : void 0;
11079
+ if (value !== null && parsed.value === Number(value)) return null;
11080
+ return onCommit(parsed.value, options);
11081
+ }
11082
+ },
11083
+ value
11084
+ );
11085
+ const nudge = (direction, large) => {
11086
+ const parsed = parseFormatNumber(field.draft ?? value ?? "", {});
11087
+ if (!parsed.ok) return;
11088
+ let next = Math.round((parsed.value + direction * step * (large ? 10 : 1)) * 1e3) / 1e3;
11089
+ if (max !== void 0) next = Math.min(max, next);
11090
+ if (min !== void 0) next = Math.max(min, next);
11091
+ if (exclusiveMin && min !== void 0 && next <= min) return;
11092
+ field.input(String(next));
11093
+ };
11094
+ const error = field.error;
11095
+ return /* @__PURE__ */ jsxs42("label", { className: inline ? "pptx-field pptx-field--inline" : "pptx-field", children: [
11096
+ inline ? /* @__PURE__ */ jsx46("span", { className: "pptx-field__label", children: label }) : label,
11070
11097
  /* @__PURE__ */ jsxs42("span", { className: "pptx-field__control", children: [
11071
11098
  /* @__PURE__ */ jsx46(
11072
11099
  "input",
@@ -11074,26 +11101,27 @@ function FormatNumberField({
11074
11101
  inputMode: "decimal",
11075
11102
  "aria-label": label,
11076
11103
  "data-format-property": property,
11077
- value: draft ?? value ?? "",
11078
- placeholder: value === null && mixed ? t("inspector.mixed") : void 0,
11104
+ value: field.draft ?? value ?? "",
11105
+ placeholder: value === null ? mixed ? t("inspector.mixed") : placeholder : void 0,
11079
11106
  disabled,
11080
11107
  "aria-invalid": !!error,
11081
11108
  "aria-describedby": error ? errorId : void 0,
11082
- "data-draft": draft !== null,
11083
- onChange: (e) => {
11084
- pending.current = e.target.value;
11085
- setDraft(e.target.value);
11086
- },
11087
- onBlur: commit,
11109
+ "data-draft": field.draft !== null,
11110
+ onChange: (e) => field.input(e.target.value, e.nativeEvent.isComposing === true),
11111
+ onCompositionEnd: (e) => field.input(e.currentTarget.value),
11112
+ onBlur: () => field.commit(),
11088
11113
  onKeyDown: (e) => {
11089
- if (e.key === "Enter" && !e.nativeEvent.isComposing) {
11114
+ if (e.nativeEvent.isComposing) return;
11115
+ if (e.key === "Enter") {
11090
11116
  e.preventDefault();
11091
- commit();
11092
- }
11093
- if (e.key === "Escape") {
11117
+ field.commit();
11118
+ } else if (e.key === "Escape") {
11094
11119
  e.preventDefault();
11095
11120
  e.stopPropagation();
11096
- reset();
11121
+ field.cancel();
11122
+ } else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
11123
+ e.preventDefault();
11124
+ nudge(e.key === "ArrowUp" ? 1 : -1, e.shiftKey);
11097
11125
  }
11098
11126
  }
11099
11127
  }
@@ -11105,7 +11133,7 @@ function FormatNumberField({
11105
11133
  }
11106
11134
 
11107
11135
  // src/FormatLineWidth.tsx
11108
- import { jsx as jsx47 } from "react/jsx-runtime";
11136
+ import { jsx as jsx47, jsxs as jsxs43 } from "react/jsx-runtime";
11109
11137
  function FormatLineWidth() {
11110
11138
  const editor = usePptxEditor();
11111
11139
  const snapshot = useEditorState((s) => s);
@@ -11113,92 +11141,81 @@ function FormatLineWidth() {
11113
11141
  const line = formatLineState(editor);
11114
11142
  if (!line) return null;
11115
11143
  const key = `${editor?.session?.id}:${formatTargetKey2(snapshot)}`;
11116
- return /* @__PURE__ */ jsx47(
11117
- FormatNumberField,
11118
- {
11119
- label: t("inspector.lineWidth"),
11120
- property: "line.width",
11121
- value: line.width === null ? null : String(Math.round(line.width * 100) / 100),
11122
- unit: "pt",
11123
- min: 0,
11124
- exclusiveMin: true,
11125
- mixed: line.widthMixed,
11126
- max: 1584,
11127
- disabled: snapshot.mode === "view",
11128
- onCommit: (points) => {
11129
- if (!editor || `${editor.session?.id}:${formatTargetKey2(editor.snapshot())}` !== key)
11130
- return t("disabled.invalidValue");
11131
- if (points === line.width) return null;
11132
- const result = editor.exec({ type: "setLineWidth", points });
11133
- return result.ok ? null : translateKeyOrText16(t, result.reason);
11134
- }
11135
- },
11136
- key
11137
- );
11144
+ return /* @__PURE__ */ jsxs43("div", { className: "pptx-format-line-width", children: [
11145
+ /* @__PURE__ */ jsx47(
11146
+ FormatNumberField,
11147
+ {
11148
+ label: t("inspector.lineWidth"),
11149
+ property: "line.width",
11150
+ value: line.width === null ? null : String(Math.round(line.width * 100) / 100),
11151
+ unit: "pt",
11152
+ min: 0,
11153
+ exclusiveMin: true,
11154
+ mixed: line.widthMixed,
11155
+ max: 1584,
11156
+ step: 0.25,
11157
+ inline: true,
11158
+ placeholder: t("inspector.noLine"),
11159
+ disabled: snapshot.mode === "view",
11160
+ onCommit: (points, options) => {
11161
+ if (!editor || `${editor.session?.id}:${formatTargetKey2(editor.snapshot())}` !== key)
11162
+ return t("disabled.invalidValue");
11163
+ if (points === line.width) return null;
11164
+ const result = editor.exec({ type: "setLineWidth", points }, options);
11165
+ return result.ok ? null : translateKeyOrText16(t, result.reason);
11166
+ }
11167
+ },
11168
+ key
11169
+ ),
11170
+ /* @__PURE__ */ jsx47(ToolbarSlot, { slotId: "shape.lineWidth" })
11171
+ ] });
11138
11172
  }
11139
11173
 
11140
11174
  // src/FormatFillTransparency.tsx
11141
- import { useCallback as useCallback14, useRef as useRef39, useState as useState42 } from "react";
11175
+ import { useState as useState42 } from "react";
11142
11176
  import {
11143
11177
  formatFillTransparency,
11144
11178
  formatTargetKey as formatTargetKey3,
11145
11179
  translateKeyOrText as translateKeyOrText17
11146
11180
  } from "@pptx-editor.dev/core/editor";
11147
- import { jsx as jsx48, jsxs as jsxs43 } from "react/jsx-runtime";
11181
+ import { jsx as jsx48, jsxs as jsxs44 } from "react/jsx-runtime";
11148
11182
  function FormatFillTransparency() {
11149
11183
  const editor = usePptxEditor();
11150
11184
  const snapshot = useEditorState((s) => s);
11151
11185
  const { t } = useTranslation();
11152
- const [preview, setPreview] = useState42(null);
11153
11186
  const [error, setError] = useState42(null);
11187
+ const group = useHistoryGroup({ kind: "range" });
11154
11188
  const field = formatFillTransparency(editor);
11155
11189
  const key = `${editor?.session?.id}:${formatTargetKey3(snapshot)}`;
11156
- const commit = (percent) => {
11190
+ const commit = (percent, options) => {
11157
11191
  if (!editor || !field || `${editor.session?.id}:${formatTargetKey3(editor.snapshot())}` !== key)
11158
11192
  return t("disabled.invalidValue");
11159
11193
  if (percent === field.value) return null;
11160
- const result = editor.exec({
11161
- type: "patchShapeFormat",
11162
- target: field.target,
11163
- patch: field.patch(percent)
11164
- });
11194
+ const result = editor.exec(
11195
+ { type: "patchShapeFormat", target: field.target, patch: field.patch(percent) },
11196
+ options
11197
+ );
11165
11198
  return result.ok ? null : translateKeyOrText17(t, result.reason);
11166
11199
  };
11167
- const latest = useRef39(commit);
11168
- latest.current = commit;
11169
- const attached = useRef39(null);
11170
- const slider = useCallback14((el) => {
11171
- attached.current?.();
11172
- attached.current = null;
11173
- if (!el) return;
11174
- const release = () => {
11175
- setPreview(null);
11176
- setError(latest.current(Number(el.value)));
11177
- };
11178
- el.addEventListener("change", release);
11179
- attached.current = () => el.removeEventListener("change", release);
11180
- }, []);
11181
11200
  if (!field) return null;
11182
11201
  const label = t(field.labelKey);
11183
- const value = preview ?? field.value;
11184
11202
  const disabled = snapshot.mode === "view";
11185
- return /* @__PURE__ */ jsxs43("div", { className: "pptx-format-transparency", "data-format-fill-transparency": "", children: [
11203
+ return /* @__PURE__ */ jsxs44("div", { className: "pptx-format-transparency", "data-format-fill-transparency": "", children: [
11186
11204
  /* @__PURE__ */ jsx48(
11187
11205
  "input",
11188
11206
  {
11189
- ref: slider,
11207
+ ref: group.ref,
11190
11208
  type: "range",
11191
11209
  className: "pptx-format-transparency__slider",
11192
11210
  "data-format-slider": field.id,
11193
11211
  "aria-label": label,
11194
- "aria-valuetext": `${value}${field.unit}`,
11212
+ "aria-valuetext": `${field.value}${field.unit}`,
11195
11213
  min: field.min,
11196
11214
  max: field.max,
11197
11215
  step: 1,
11198
- value,
11216
+ value: field.value,
11199
11217
  disabled,
11200
- onChange: (e) => setPreview(Number(e.target.value)),
11201
- onBlur: () => setPreview(null)
11218
+ onChange: (e) => setError(commit(Number(e.target.value), group.options()))
11202
11219
  }
11203
11220
  ),
11204
11221
  /* @__PURE__ */ jsx48(
@@ -11206,14 +11223,14 @@ function FormatFillTransparency() {
11206
11223
  {
11207
11224
  label,
11208
11225
  property: field.id,
11209
- value: String(value),
11226
+ value: String(field.value),
11210
11227
  unit: field.unit,
11211
11228
  min: field.min,
11212
11229
  max: field.max,
11213
11230
  disabled,
11214
- onCommit: (percent) => {
11231
+ onCommit: (percent, options) => {
11215
11232
  setError(null);
11216
- return commit(percent);
11233
+ return commit(percent, options);
11217
11234
  }
11218
11235
  },
11219
11236
  key
@@ -11223,7 +11240,7 @@ function FormatFillTransparency() {
11223
11240
  }
11224
11241
 
11225
11242
  // src/FormatDetails.tsx
11226
- import { useState as useState43, useRef as useRef41, useLayoutEffect as useLayoutEffect12 } from "react";
11243
+ import { useState as useState43, useRef as useRef40, useLayoutEffect as useLayoutEffect12 } from "react";
11227
11244
  import {
11228
11245
  chromeControlForSlot as chromeControlForSlot5,
11229
11246
  createGradientStopIdentity,
@@ -11235,12 +11252,12 @@ import {
11235
11252
  } from "@pptx-editor.dev/core/editor";
11236
11253
 
11237
11254
  // src/FormatGradientPicker.tsx
11238
- import { useRef as useRef40 } from "react";
11255
+ import { useRef as useRef39 } from "react";
11239
11256
  import {
11240
11257
  gradientPreviewCss,
11241
11258
  gradientPreviewStops
11242
11259
  } from "@pptx-editor.dev/core/editor";
11243
- import { jsx as jsx49, jsxs as jsxs44 } from "react/jsx-runtime";
11260
+ import { jsx as jsx49, jsxs as jsxs45 } from "react/jsx-runtime";
11244
11261
  function FormatGradientPicker({
11245
11262
  gradient,
11246
11263
  selected,
@@ -11248,7 +11265,7 @@ function FormatGradientPicker({
11248
11265
  }) {
11249
11266
  const { t } = useTranslation();
11250
11267
  const rows = useEditorState((s) => s.themeColors);
11251
- const root = useRef40(null);
11268
+ const root = useRef39(null);
11252
11269
  const stops = gradientPreviewStops(gradient, rows);
11253
11270
  const background = gradientPreviewCss(stops);
11254
11271
  const label = (index) => `${t("inspector.gradientStop", { index: index + 1 })} \xB7 ${Math.round(stops[index].position * 100)}%`;
@@ -11259,7 +11276,7 @@ function FormatGradientPicker({
11259
11276
  const buttons = root.current?.querySelectorAll("[data-format-stop-marker]");
11260
11277
  buttons?.[index]?.focus();
11261
11278
  };
11262
- return /* @__PURE__ */ jsxs44("div", { className: "pptx-gradient-picker", ref: root, children: [
11279
+ return /* @__PURE__ */ jsxs45("div", { className: "pptx-gradient-picker", ref: root, children: [
11263
11280
  /* @__PURE__ */ jsx49(
11264
11281
  "div",
11265
11282
  {
@@ -11296,7 +11313,7 @@ function FormatGradientPicker({
11296
11313
  },
11297
11314
  stop.id
11298
11315
  )) }),
11299
- /* @__PURE__ */ jsxs44("label", { className: "pptx-field", children: [
11316
+ /* @__PURE__ */ jsxs45("label", { className: "pptx-field", children: [
11300
11317
  t("inspector.selectStop"),
11301
11318
  /* @__PURE__ */ jsx49(
11302
11319
  "select",
@@ -11313,7 +11330,7 @@ function FormatGradientPicker({
11313
11330
  }
11314
11331
 
11315
11332
  // src/FormatDetails.tsx
11316
- import { jsx as jsx50, jsxs as jsxs45 } from "react/jsx-runtime";
11333
+ import { jsx as jsx50, jsxs as jsxs46 } from "react/jsx-runtime";
11317
11334
  function FormatDetails({ section }) {
11318
11335
  const editor = usePptxEditor();
11319
11336
  const { t } = useTranslation();
@@ -11321,8 +11338,8 @@ function FormatDetails({ section }) {
11321
11338
  const offered = useOfferedControl("shape.effects", chromeControlForSlot5("shape.effects"));
11322
11339
  const effectsAvailable = offered?.options?.some((option) => option.value === "reflection.tightTouching") === true;
11323
11340
  const [error, setError] = useState43(null);
11324
- const root = useRef41(null);
11325
- const stopIdentity = useRef41(createGradientStopIdentity());
11341
+ const root = useRef40(null);
11342
+ const stopIdentity = useRef40(createGradientStopIdentity());
11326
11343
  const [selectedStop, setSelectedStop] = useState43(null);
11327
11344
  const [focusStop, setFocusStop] = useState43(null);
11328
11345
  useLayoutEffect12(() => {
@@ -11343,10 +11360,10 @@ function FormatDetails({ section }) {
11343
11360
  (stop) => selectedStop !== null && identity(stop.id) === selectedStop
11344
11361
  ) ?? detail.gradient?.stops[0];
11345
11362
  const key = `${editor?.session?.id}:${formatTargetKey4(snapshot)}`;
11346
- const apply = (patch) => {
11363
+ const apply = (patch, options) => {
11347
11364
  if (!editor || `${editor.session?.id}:${formatTargetKey4(editor.snapshot())}` !== key)
11348
11365
  return t("disabled.invalidValue");
11349
- const result = editor.exec({ type: "patchShapeFormat", target: detail.target, patch });
11366
+ const result = editor.exec({ type: "patchShapeFormat", target: detail.target, patch }, options);
11350
11367
  if (result.ok && patch.kind === "gradient") {
11351
11368
  const next = editor.shapeFormat();
11352
11369
  if (next.ok && next.format.gradient && detail.gradient) {
@@ -11357,7 +11374,7 @@ function FormatDetails({ section }) {
11357
11374
  };
11358
11375
  const disabled = snapshot.mode === "view";
11359
11376
  const unavailable = (id) => !effectsAvailable && (id === "reflection" || id === "shadow" && detail.shadow?.kind === "inner");
11360
- return /* @__PURE__ */ jsxs45("div", { className: "pptx-format-details", ref: root, children: [
11377
+ return /* @__PURE__ */ jsxs46("div", { className: "pptx-format-details", ref: root, children: [
11361
11378
  section === "fill" && detail.gradient && activeStop ? /* @__PURE__ */ jsx50(
11362
11379
  FormatGradientPicker,
11363
11380
  {
@@ -11366,14 +11383,14 @@ function FormatDetails({ section }) {
11366
11383
  onSelect: (id) => setSelectedStop(identity(id))
11367
11384
  }
11368
11385
  ) : null,
11369
- formatPropertyGroups(detail, section).filter((group) => group.index === void 0 || group.id === activeStop?.id).map((group) => /* @__PURE__ */ jsxs45(
11386
+ formatPropertyGroups(detail, section).filter((group) => group.index === void 0 || group.id === activeStop?.id).map((group) => /* @__PURE__ */ jsxs46(
11370
11387
  "fieldset",
11371
11388
  {
11372
11389
  className: "pptx-format-property-group",
11373
11390
  "data-format-stop": group.index,
11374
11391
  children: [
11375
11392
  /* @__PURE__ */ jsx50("legend", { children: t(group.labelKey, group.index ? { index: group.index } : void 0) }),
11376
- /* @__PURE__ */ jsxs45("div", { className: "pptx-format-property-fields", children: [
11393
+ /* @__PURE__ */ jsxs46("div", { className: "pptx-format-property-fields", children: [
11377
11394
  unavailable(group.id) ? /* @__PURE__ */ jsx50("p", { className: "pptx-empty__body", role: "status", children: t("inspector.effectUnavailable") }) : null,
11378
11395
  group.colors.map((field) => {
11379
11396
  const pick = field.color ? colorPickOf3(field.color) : "keep";
@@ -11404,7 +11421,7 @@ function FormatDetails({ section }) {
11404
11421
  max: field.max,
11405
11422
  label: t(field.labelKey),
11406
11423
  disabled: disabled || unavailable(group.id),
11407
- onCommit: (value) => apply(field.patch(value))
11424
+ onCommit: (value, options) => apply(field.patch(value), options)
11408
11425
  },
11409
11426
  field.id.split(".").at(-1)
11410
11427
  ))
@@ -11480,7 +11497,7 @@ import {
11480
11497
  formatTargetKey as formatTargetKey5,
11481
11498
  translateKeyOrText as translateKeyOrText19
11482
11499
  } from "@pptx-editor.dev/core/editor";
11483
- import { Fragment as Fragment39, jsx as jsx51, jsxs as jsxs46 } from "react/jsx-runtime";
11500
+ import { Fragment as Fragment39, jsx as jsx51, jsxs as jsxs47 } from "react/jsx-runtime";
11484
11501
  var EMU_PER_INCH = 914400;
11485
11502
  var inches = (emu) => String(Number((emu / EMU_PER_INCH).toFixed(6)));
11486
11503
  function FormatGeometry() {
@@ -11498,11 +11515,11 @@ function FormatGeometry() {
11498
11515
  );
11499
11516
  const background = useEditorDialog("background");
11500
11517
  if (!geometry)
11501
- return selected > 1 ? /* @__PURE__ */ jsxs46("div", { className: "pptx-empty", children: [
11518
+ return selected > 1 ? /* @__PURE__ */ jsxs47("div", { className: "pptx-empty", children: [
11502
11519
  /* @__PURE__ */ jsx51("p", { className: "pptx-empty__title", children: t("panel.format.multipleTitle", { count: selected }) }),
11503
11520
  /* @__PURE__ */ jsx51("p", { className: "pptx-empty__body", children: platformShortcuts2(t("panel.format.multipleBody")) })
11504
- ] }) : /* @__PURE__ */ jsxs46(Fragment39, { children: [
11505
- /* @__PURE__ */ jsxs46("div", { className: "pptx-panel__section", children: [
11521
+ ] }) : /* @__PURE__ */ jsxs47(Fragment39, { children: [
11522
+ /* @__PURE__ */ jsxs47("div", { className: "pptx-panel__section", children: [
11506
11523
  /* @__PURE__ */ jsx51("h3", { className: "pptx-panel__title", children: t(panelTitle) }),
11507
11524
  background.isAvailable ? /* @__PURE__ */ jsx51(
11508
11525
  "button",
@@ -11515,33 +11532,36 @@ function FormatGeometry() {
11515
11532
  }
11516
11533
  ) : null
11517
11534
  ] }),
11518
- /* @__PURE__ */ jsxs46("div", { className: "pptx-empty", children: [
11535
+ /* @__PURE__ */ jsxs47("div", { className: "pptx-empty", children: [
11519
11536
  /* @__PURE__ */ jsx51("p", { className: "pptx-empty__title", children: t("panel.format.emptyTitle") }),
11520
11537
  /* @__PURE__ */ jsx51("p", { className: "pptx-empty__body", children: t(panelBody) })
11521
11538
  ] })
11522
11539
  ] });
11523
11540
  const g = geometry;
11524
11541
  const target = editor ? `${editor.session?.id}:${formatTargetKey5(editor.snapshot())}` : "";
11525
- const run = (command) => {
11542
+ const run = (command, options) => {
11526
11543
  if (!editor || `${editor.session?.id}:${formatTargetKey5(editor.snapshot())}` !== target)
11527
11544
  return t("disabled.invalidValue");
11528
- const result = editor.exec(command);
11545
+ const result = editor.exec(command, options);
11529
11546
  return result.ok ? null : translateKeyOrText19(t, result.reason);
11530
11547
  };
11531
- const move = (patch) => {
11548
+ const move = (patch, options) => {
11532
11549
  if (!editor || `${editor.session?.id}:${formatTargetKey5(editor.snapshot())}` !== target)
11533
11550
  return t("disabled.invalidValue");
11534
11551
  const current = editor.snapshot().geometry;
11535
11552
  if (!current || current.nodeId !== g.nodeId) return t("disabled.invalidValue");
11536
- return run({
11537
- type: "setTransform",
11538
- nodeId: g.nodeId,
11539
- x: patch.x ?? current.x,
11540
- y: patch.y ?? current.y,
11541
- cx: patch.cx ?? current.cx,
11542
- cy: patch.cy ?? current.cy,
11543
- rot: patch.rot ?? current.rot
11544
- });
11553
+ return run(
11554
+ {
11555
+ type: "setTransform",
11556
+ nodeId: g.nodeId,
11557
+ x: patch.x ?? current.x,
11558
+ y: patch.y ?? current.y,
11559
+ cx: patch.cx ?? current.cx,
11560
+ cy: patch.cy ?? current.cy,
11561
+ rot: patch.rot ?? current.rot
11562
+ },
11563
+ options
11564
+ );
11545
11565
  };
11546
11566
  const inch = (v) => Math.round(v * EMU_PER_INCH);
11547
11567
  const unit = t("panel.format.inchUnit");
@@ -11554,21 +11574,24 @@ function FormatGeometry() {
11554
11574
  value: inches(g[key]),
11555
11575
  unit,
11556
11576
  disabled: readOnly,
11557
- onCommit: (v) => move(key === "cx" || key === "cy" ? formatPanelSize(g, key, inch(v)) : { [key]: inch(v) })
11577
+ onCommit: (v, options) => move(
11578
+ key === "cx" || key === "cy" ? formatPanelSize(g, key, inch(v)) : { [key]: inch(v) },
11579
+ options
11580
+ )
11558
11581
  }
11559
11582
  );
11560
- return /* @__PURE__ */ jsxs46(Fragment39, { children: [
11561
- /* @__PURE__ */ jsxs46("div", { className: "pptx-panel__section", children: [
11583
+ return /* @__PURE__ */ jsxs47(Fragment39, { children: [
11584
+ /* @__PURE__ */ jsxs47("div", { className: "pptx-panel__section", children: [
11562
11585
  /* @__PURE__ */ jsx51("h3", { className: "pptx-panel__title", children: t("panel.format.element") }),
11563
11586
  /* @__PURE__ */ jsx51("span", { className: "pptx-chip", children: t(elementKindLabelKey(g, table, { chart, diagram })) })
11564
11587
  ] }),
11565
- /* @__PURE__ */ jsxs46("div", { className: "pptx-panel__section", children: [
11588
+ /* @__PURE__ */ jsxs47("div", { className: "pptx-panel__section", children: [
11566
11589
  /* @__PURE__ */ jsx51("h3", { className: "pptx-panel__title", children: t("panel.format.size") }),
11567
- /* @__PURE__ */ jsxs46("div", { className: "pptx-panel__grid", children: [
11590
+ /* @__PURE__ */ jsxs47("div", { className: "pptx-panel__grid", children: [
11568
11591
  field("cx", "panel.format.width"),
11569
11592
  field("cy", "panel.format.height")
11570
11593
  ] }),
11571
- /* @__PURE__ */ jsxs46("label", { className: "pptx-radio", children: [
11594
+ /* @__PURE__ */ jsxs47("label", { className: "pptx-radio", children: [
11572
11595
  /* @__PURE__ */ jsx51(
11573
11596
  "input",
11574
11597
  {
@@ -11581,14 +11604,14 @@ function FormatGeometry() {
11581
11604
  t("imageProperties.lockAspect")
11582
11605
  ] })
11583
11606
  ] }),
11584
- /* @__PURE__ */ jsxs46("div", { className: "pptx-panel__section", children: [
11607
+ /* @__PURE__ */ jsxs47("div", { className: "pptx-panel__section", children: [
11585
11608
  /* @__PURE__ */ jsx51("h3", { className: "pptx-panel__title", children: t("panel.format.position") }),
11586
- /* @__PURE__ */ jsxs46("div", { className: "pptx-panel__grid", children: [
11609
+ /* @__PURE__ */ jsxs47("div", { className: "pptx-panel__grid", children: [
11587
11610
  field("x", "panel.format.x"),
11588
11611
  field("y", "panel.format.y")
11589
11612
  ] })
11590
11613
  ] }),
11591
- elementRotates(g, table) ? /* @__PURE__ */ jsxs46("div", { className: "pptx-panel__section", children: [
11614
+ elementRotates(g, table) ? /* @__PURE__ */ jsxs47("div", { className: "pptx-panel__section", children: [
11592
11615
  /* @__PURE__ */ jsx51("h3", { className: "pptx-panel__title", children: t("panel.format.rotation") }),
11593
11616
  /* @__PURE__ */ jsx51("div", { className: "pptx-panel__grid", children: /* @__PURE__ */ jsx51(
11594
11617
  FormatNumberField,
@@ -11600,13 +11623,13 @@ function FormatGeometry() {
11600
11623
  value: String(Math.round(g.rot * 10) / 10),
11601
11624
  unit: "\xB0",
11602
11625
  disabled: readOnly,
11603
- onCommit: (v) => move({ rot: v })
11626
+ onCommit: (v, options) => move({ rot: v }, options)
11604
11627
  }
11605
11628
  ) })
11606
11629
  ] }) : null,
11607
- table ? /* @__PURE__ */ jsxs46("div", { className: "pptx-panel__section", children: [
11630
+ table ? /* @__PURE__ */ jsxs47("div", { className: "pptx-panel__section", children: [
11608
11631
  /* @__PURE__ */ jsx51("h3", { className: "pptx-panel__title", children: t("panel.format.table") }),
11609
- /* @__PURE__ */ jsxs46("div", { className: "pptx-panel__grid", children: [
11632
+ /* @__PURE__ */ jsxs47("div", { className: "pptx-panel__grid", children: [
11610
11633
  /* @__PURE__ */ jsx51(
11611
11634
  FormatNumberField,
11612
11635
  {
@@ -11616,7 +11639,7 @@ function FormatGeometry() {
11616
11639
  value: inches(table.rowHeight),
11617
11640
  unit,
11618
11641
  disabled: readOnly,
11619
- onCommit: (v) => run({ type: "setRowHeight", height: inch(v) })
11642
+ onCommit: (v, options) => run({ type: "setRowHeight", height: inch(v) }, options)
11620
11643
  }
11621
11644
  ),
11622
11645
  /* @__PURE__ */ jsx51(
@@ -11628,11 +11651,11 @@ function FormatGeometry() {
11628
11651
  value: inches(table.columnWidth),
11629
11652
  unit,
11630
11653
  disabled: readOnly,
11631
- onCommit: (v) => run({ type: "setColumnWidth", width: inch(v) })
11654
+ onCommit: (v, options) => run({ type: "setColumnWidth", width: inch(v) }, options)
11632
11655
  }
11633
11656
  )
11634
11657
  ] }),
11635
- /* @__PURE__ */ jsx51("div", { className: "pptx-radios", role: "group", "aria-label": t("panel.format.styleOptions"), children: TABLE_OPTION_ROWS.map(({ option, labelKey }) => /* @__PURE__ */ jsxs46("label", { className: "pptx-radio", children: [
11658
+ /* @__PURE__ */ jsx51("div", { className: "pptx-radios", role: "group", "aria-label": t("panel.format.styleOptions"), children: TABLE_OPTION_ROWS.map(({ option, labelKey }) => /* @__PURE__ */ jsxs47("label", { className: "pptx-radio", children: [
11636
11659
  /* @__PURE__ */ jsx51(
11637
11660
  "input",
11638
11661
  {
@@ -11645,9 +11668,9 @@ function FormatGeometry() {
11645
11668
  t(labelKey)
11646
11669
  ] }, option)) })
11647
11670
  ] }) : null,
11648
- g.textFitting ? /* @__PURE__ */ jsxs46("div", { className: "pptx-panel__section", children: [
11671
+ g.textFitting ? /* @__PURE__ */ jsxs47("div", { className: "pptx-panel__section", children: [
11649
11672
  /* @__PURE__ */ jsx51("h3", { className: "pptx-panel__title", children: t("panel.format.textFitting") }),
11650
- /* @__PURE__ */ jsx51("div", { className: "pptx-radios", role: "radiogroup", "aria-label": t("panel.format.textFitting"), children: ["none", "shrink", "shape"].map((mode) => /* @__PURE__ */ jsxs46("label", { className: "pptx-radio", children: [
11673
+ /* @__PURE__ */ jsx51("div", { className: "pptx-radios", role: "radiogroup", "aria-label": t("panel.format.textFitting"), children: ["none", "shrink", "shape"].map((mode) => /* @__PURE__ */ jsxs47("label", { className: "pptx-radio", children: [
11651
11674
  /* @__PURE__ */ jsx51(
11652
11675
  "input",
11653
11676
  {
@@ -11665,20 +11688,20 @@ function FormatGeometry() {
11665
11688
  }
11666
11689
 
11667
11690
  // src/FormatPanel.tsx
11668
- import { jsx as jsx52, jsxs as jsxs47 } from "react/jsx-runtime";
11691
+ import { jsx as jsx52, jsxs as jsxs48 } from "react/jsx-runtime";
11669
11692
  function FormatSection({ section }) {
11670
11693
  const { t } = useTranslation();
11671
11694
  const editor = usePptxEditor();
11672
11695
  const background = useEditorDialog("background");
11673
11696
  const snapshot = useEditorState((s) => s);
11674
11697
  const [, refresh] = useState44(0);
11675
- useEffect31(
11698
+ useEffect32(
11676
11699
  () => editor ? listenFormatSectionExpansion(editor, () => refresh((n) => n + 1)) : void 0,
11677
11700
  [editor]
11678
11701
  );
11679
11702
  const category = formatSelectionCategory(snapshot);
11680
11703
  const expanded = formatSectionOpen(editor, category, section.id);
11681
- return /* @__PURE__ */ jsxs47("details", { className: "pptx-format-disclosure", open: expanded, children: [
11704
+ return /* @__PURE__ */ jsxs48("details", { className: "pptx-format-disclosure", open: expanded, children: [
11682
11705
  /* @__PURE__ */ jsx52(
11683
11706
  "summary",
11684
11707
  {
@@ -11691,13 +11714,13 @@ function FormatSection({ section }) {
11691
11714
  children: t(section.labelKey)
11692
11715
  }
11693
11716
  ),
11694
- /* @__PURE__ */ jsxs47("div", { className: "pptx-format-section-body", children: [
11717
+ /* @__PURE__ */ jsxs48("div", { className: "pptx-format-section-body", children: [
11695
11718
  section.id === "geometry" ? /* @__PURE__ */ jsx52(FormatGeometry, {}) : null,
11696
11719
  section.id === "fill" || section.id === "effects" ? /* @__PURE__ */ jsx52(FormatDetails, { section: section.id }) : null,
11697
11720
  section.id === "geometry" ? null : section.id === "chart" ? /* @__PURE__ */ jsx52(ChartDataPane, {}) : section.id === "diagram" ? /* @__PURE__ */ jsx52(DiagramTextPane, {}) : /* @__PURE__ */ jsx52("div", { className: "pptx-format-controls", children: section.slots.filter((slot) => slot !== "slide.background" || background.isAvailable).flatMap((slot) => [
11698
- /* @__PURE__ */ jsxs47("div", { className: "pptx-format-control", "data-format-slot": slot, children: [
11721
+ /* @__PURE__ */ jsxs48("div", { className: "pptx-format-control", "data-format-slot": slot, children: [
11699
11722
  slot !== "shape.lineWidth" ? /* @__PURE__ */ jsx52("span", { className: "pptx-format-control__label", children: t(chromeControlForSlot6(slot).labelKey) }) : null,
11700
- formatControlMixed(editor, slot) ? /* @__PURE__ */ jsx52("span", { className: "pptx-format-mixed", children: t("inspector.mixed") }) : null,
11723
+ slot !== "shape.lineWidth" && formatControlMixed(editor, slot) ? /* @__PURE__ */ jsx52("span", { className: "pptx-format-mixed", children: t("inspector.mixed") }) : null,
11701
11724
  slot === "shape.lineWidth" ? /* @__PURE__ */ jsx52(FormatLineWidth, {}) : /* @__PURE__ */ jsx52(ToolbarSlot, { slotId: slot })
11702
11725
  ] }, slot),
11703
11726
  slot === "shape.fill" ? /* @__PURE__ */ jsx52(FormatFillTransparency, {}, "fill.transparency") : null
@@ -11709,9 +11732,9 @@ function FormatPanel({ sections, sectionContent, className, children }) {
11709
11732
  const editor = usePptxEditor();
11710
11733
  const snapshot = useEditorState((s) => s);
11711
11734
  const { t } = useTranslation();
11712
- const root = useRef42(null);
11735
+ const root = useRef41(null);
11713
11736
  const category = formatSelectionCategory(snapshot);
11714
- const previousCategory = useRef42(category);
11737
+ const previousCategory = useRef41(category);
11715
11738
  useLayoutEffect13(() => {
11716
11739
  if (previousCategory.current !== category) {
11717
11740
  const scroller = root.current?.closest(".pptx-panel__body");
@@ -11720,7 +11743,7 @@ function FormatPanel({ sections, sectionContent, className, children }) {
11720
11743
  }
11721
11744
  }, [category]);
11722
11745
  const target = `${editor?.session?.id ?? ""}:${formatTargetKey6(snapshot)}`;
11723
- return /* @__PURE__ */ jsxs47("div", { ref: root, className: ["pptx-format-panel", className].filter(Boolean).join(" "), children: [
11746
+ return /* @__PURE__ */ jsxs48("div", { ref: root, className: ["pptx-format-panel", className].filter(Boolean).join(" "), children: [
11724
11747
  snapshot.selection.kind === "shapes" && snapshot.selection.nodeIds.length > 1 ? /* @__PURE__ */ jsx52("p", { className: "pptx-panel__title", children: t("panel.format.multipleTitle", { count: snapshot.selection.nodeIds.length }) }) : snapshot.geometry ? /* @__PURE__ */ jsx52("p", { className: "pptx-panel__title", children: snapshot.geometry.name }) : null,
11725
11748
  /* @__PURE__ */ jsx52("div", { className: "pptx-format-sections", children: formatSectionsOf(snapshot, sections).map((section) => /* @__PURE__ */ jsx52("div", { "data-format-section": section.id, children: sectionContent?.[section.id] !== void 0 ? sectionContent[section.id] : /* @__PURE__ */ jsx52(
11726
11749
  FormatSection,
@@ -11734,7 +11757,7 @@ function FormatPanel({ sections, sectionContent, className, children }) {
11734
11757
  }
11735
11758
 
11736
11759
  // src/SidePanel.tsx
11737
- import { jsx as jsx53, jsxs as jsxs48 } from "react/jsx-runtime";
11760
+ import { jsx as jsx53, jsxs as jsxs49 } from "react/jsx-runtime";
11738
11761
  function PackagedPane({ tab }) {
11739
11762
  const { t } = useTranslation();
11740
11763
  if (tab === "format") return /* @__PURE__ */ jsx53(FormatPanel, {});
@@ -11742,7 +11765,7 @@ function PackagedPane({ tab }) {
11742
11765
  if (tab === "diagram") return /* @__PURE__ */ jsx53(DiagramTextPane, {});
11743
11766
  if (tab === "selection") return /* @__PURE__ */ jsx53(SelectionPane, {});
11744
11767
  if (tab === "animations") return /* @__PURE__ */ jsx53(AnimationsPane, {});
11745
- return /* @__PURE__ */ jsxs48("div", { className: "pptx-empty", children: [
11768
+ return /* @__PURE__ */ jsxs49("div", { className: "pptx-empty", children: [
11746
11769
  /* @__PURE__ */ jsx53("p", { className: "pptx-empty__title", children: t("panel.comments.emptyTitle") }),
11747
11770
  /* @__PURE__ */ jsx53("p", { className: "pptx-empty__body", children: t("panel.comments.emptyBody") })
11748
11771
  ] });
@@ -11767,11 +11790,11 @@ function SidePanel({
11767
11790
  setOwn(next);
11768
11791
  onTabChange?.(next);
11769
11792
  };
11770
- const latest = useRef43(setTab);
11793
+ const latest = useRef42(setTab);
11771
11794
  latest.current = setTab;
11772
- const root = useRef43(null);
11795
+ const root = useRef42(null);
11773
11796
  const [asked, setAsked] = useState45(null);
11774
- useEffect32(
11797
+ useEffect33(
11775
11798
  () => editor ? listenPaneRequests(editor, (pane, request) => {
11776
11799
  takePaneRequest(editor);
11777
11800
  latest.current(pane);
@@ -11779,13 +11802,13 @@ function SidePanel({
11779
11802
  }) : void 0,
11780
11803
  [editor]
11781
11804
  );
11782
- useEffect32(() => {
11805
+ useEffect33(() => {
11783
11806
  const request = takePaneRequest(editor);
11784
11807
  if (!request) return;
11785
11808
  latest.current(request.pane);
11786
11809
  if (request.focus) setAsked({ pane: request.pane });
11787
11810
  }, [editor]);
11788
- useEffect32(() => {
11811
+ useEffect33(() => {
11789
11812
  if (!asked) return;
11790
11813
  const body = root.current?.querySelector(".pptx-panel__body");
11791
11814
  if (body?.contains(body.ownerDocument.activeElement)) return;
@@ -11794,7 +11817,7 @@ function SidePanel({
11794
11817
  );
11795
11818
  (current ?? root.current?.querySelector(`[data-tab="${asked.pane}"]`))?.focus();
11796
11819
  }, [asked]);
11797
- return /* @__PURE__ */ jsxs48(
11820
+ return /* @__PURE__ */ jsxs49(
11798
11821
  "aside",
11799
11822
  {
11800
11823
  ref: root,
@@ -11803,7 +11826,7 @@ function SidePanel({
11803
11826
  style: paneStyle(paneWidth, style),
11804
11827
  onMouseDown: keepFocus,
11805
11828
  children: [
11806
- /* @__PURE__ */ jsxs48("div", { className: "pptx-panel__head", children: [
11829
+ /* @__PURE__ */ jsxs49("div", { className: "pptx-panel__head", children: [
11807
11830
  /* @__PURE__ */ jsx53(
11808
11831
  "div",
11809
11832
  {
@@ -11816,7 +11839,7 @@ function SidePanel({
11816
11839
  setTab(next);
11817
11840
  e.currentTarget.querySelector(`[data-tab="${next}"]`)?.focus();
11818
11841
  },
11819
- children: tabs.map((id) => /* @__PURE__ */ jsxs48(
11842
+ children: tabs.map((id) => /* @__PURE__ */ jsxs49(
11820
11843
  "button",
11821
11844
  {
11822
11845
  type: "button",
@@ -11858,13 +11881,13 @@ import { listenPaneRequests as listenPaneRequests2, requestPane } from "@pptx-ed
11858
11881
 
11859
11882
  // src/NotesPane.tsx
11860
11883
  import {
11861
- useCallback as useCallback15,
11884
+ useCallback as useCallback14,
11862
11885
  useContext as useContext19,
11863
- useEffect as useEffect35,
11886
+ useEffect as useEffect36,
11864
11887
  useId as useId20,
11865
11888
  useLayoutEffect as useLayoutEffect15,
11866
11889
  useMemo as useMemo17,
11867
- useRef as useRef45,
11890
+ useRef as useRef44,
11868
11891
  useState as useState47
11869
11892
  } from "react";
11870
11893
  import {
@@ -11897,8 +11920,8 @@ import {
11897
11920
  REMOVAL_NOTICE_MS,
11898
11921
  removalNoticeShows
11899
11922
  } from "@pptx-editor.dev/core/editor";
11900
- import { useContext as useContext18, useEffect as useEffect33, useState as useState46, useSyncExternalStore as useSyncExternalStore11 } from "react";
11901
- import { jsx as jsx54, jsxs as jsxs49 } from "react/jsx-runtime";
11923
+ import { useContext as useContext18, useEffect as useEffect34, useState as useState46, useSyncExternalStore as useSyncExternalStore11 } from "react";
11924
+ import { jsx as jsx54, jsxs as jsxs50 } from "react/jsx-runtime";
11902
11925
  var NO_STORE = () => () => void 0;
11903
11926
  var NO_STATE = () => null;
11904
11927
  function rejectionMessage(t, rejection) {
@@ -11913,9 +11936,9 @@ function EditNoticeRoot({ className }) {
11913
11936
  const [dismissed, setDismissed] = useState46(null);
11914
11937
  const [closed, setClosed] = useState46(null);
11915
11938
  const [held, setHeld] = useState46(false);
11916
- useEffect33(() => setHeld(false), [removal?.serial]);
11939
+ useEffect34(() => setHeld(false), [removal?.serial]);
11917
11940
  const offered = removalNoticeShows(removal, closed);
11918
- useEffect33(() => {
11941
+ useEffect34(() => {
11919
11942
  if (!offered || held) return;
11920
11943
  const serial = removal.serial;
11921
11944
  const timer = setTimeout(() => setClosed(serial), REMOVAL_NOTICE_MS);
@@ -11928,12 +11951,12 @@ function EditNoticeRoot({ className }) {
11928
11951
  linkStore?.getState ?? NO_STATE
11929
11952
  );
11930
11953
  const covered = usePopupEntry("hyperlink") !== false && linkPopupShowsRejection(linkPopup, rejection) || fieldShowsRejection(rejection);
11931
- useEffect33(() => {
11954
+ useEffect34(() => {
11932
11955
  if (covered) setDismissed(rejection);
11933
11956
  }, [covered, rejection]);
11934
11957
  const classes = `pptx-edit-notice${className ? ` ${className}` : ""}`;
11935
11958
  if (!covered && editNoticeShows(rejection, dismissed))
11936
- return /* @__PURE__ */ jsxs49(
11959
+ return /* @__PURE__ */ jsxs50(
11937
11960
  "div",
11938
11961
  {
11939
11962
  className: classes,
@@ -11954,7 +11977,7 @@ function EditNoticeRoot({ className }) {
11954
11977
  }
11955
11978
  );
11956
11979
  if (!offered) return null;
11957
- return /* @__PURE__ */ jsxs49(
11980
+ return /* @__PURE__ */ jsxs50(
11958
11981
  "div",
11959
11982
  {
11960
11983
  className: classes,
@@ -11997,7 +12020,7 @@ function EditNoticeRoot({ className }) {
11997
12020
  }
11998
12021
 
11999
12022
  // src/NotesView.tsx
12000
- import { useEffect as useEffect34, useLayoutEffect as useLayoutEffect14, useRef as useRef44 } from "react";
12023
+ import { useEffect as useEffect35, useLayoutEffect as useLayoutEffect14, useRef as useRef43 } from "react";
12001
12024
  import {
12002
12025
  notesFieldBeforeInput,
12003
12026
  notesFieldFocused,
@@ -12026,7 +12049,7 @@ function NotesField({
12026
12049
  onSelection,
12027
12050
  onFocus
12028
12051
  }) {
12029
- const composing = useRef44(false);
12052
+ const composing = useRef43(false);
12030
12053
  useLayoutEffect14(() => {
12031
12054
  const el = fieldRef.current;
12032
12055
  if (!el || drafting) return;
@@ -12037,9 +12060,9 @@ function NotesField({
12037
12060
  if (keep) selectNotes(el, keep.start, keep.end);
12038
12061
  onSelection();
12039
12062
  }, [paragraphs, drafting, fieldRef, restore, onSelection]);
12040
- const draftRef = useRef44(onDraft);
12063
+ const draftRef = useRef43(onDraft);
12041
12064
  draftRef.current = onDraft;
12042
- useEffect34(() => {
12065
+ useEffect35(() => {
12043
12066
  const el = fieldRef.current;
12044
12067
  if (!el) return;
12045
12068
  const onBeforeInput = (e) => notesFieldBeforeInput(e, el, {
@@ -12087,7 +12110,7 @@ function NotesField({
12087
12110
  }
12088
12111
 
12089
12112
  // src/NotesPane.tsx
12090
- import { jsx as jsx56, jsxs as jsxs50 } from "react/jsx-runtime";
12113
+ import { jsx as jsx56, jsxs as jsxs51 } from "react/jsx-runtime";
12091
12114
  var NO_FORMATS = NO_NOTES_FORMATS;
12092
12115
  function useNotesOpen(props) {
12093
12116
  const shared = useContext19(PaneStateContext);
@@ -12103,9 +12126,9 @@ function useNotesOpen(props) {
12103
12126
  }
12104
12127
  props.onOpenChange?.(next);
12105
12128
  };
12106
- const request = useRef45(setOpenValue);
12129
+ const request = useRef44(setOpenValue);
12107
12130
  request.current = setOpenValue;
12108
- const handler = useRef45((next) => request.current(next)).current;
12131
+ const handler = useRef44((next) => request.current(next)).current;
12109
12132
  const slot = shared?.notesRequest ?? null;
12110
12133
  useLayoutEffect15(() => {
12111
12134
  if (slot?.current && slot.current !== handler) warnDuplicatePane("PptxEditor.NotesPane");
@@ -12147,17 +12170,17 @@ function NotesPaneBody(props) {
12147
12170
  const [refusal, setRefusal] = useState47(null);
12148
12171
  const [formats, setFormats] = useState47(NO_FORMATS);
12149
12172
  const [canFormat, setCanFormat] = useState47(false);
12150
- const field = useRef45(null);
12151
- const pending = useRef45(null);
12152
- const bound = useRef45(null);
12153
- const restore = useRef45(null);
12173
+ const field = useRef44(null);
12174
+ const pending = useRef44(null);
12175
+ const bound = useRef44(null);
12176
+ const restore = useRef44(null);
12154
12177
  const paragraphs = useMemo17(
12155
12178
  () => formatted ?? notes.split("\n").map((text) => ({
12156
12179
  runs: [{ text, bold: false, italic: false, underline: false, strike: false }]
12157
12180
  })),
12158
12181
  [formatted, notes]
12159
12182
  );
12160
- const commit = useCallback15(
12183
+ const commit = useCallback14(
12161
12184
  (leaving = false) => {
12162
12185
  const d = pending.current;
12163
12186
  pending.current = null;
@@ -12181,11 +12204,11 @@ function NotesPaneBody(props) {
12181
12204
  },
12182
12205
  [editor, t]
12183
12206
  );
12184
- useEffect35(() => {
12207
+ useEffect36(() => {
12185
12208
  if (pending.current && pending.current.slideId !== slideId) commit();
12186
12209
  bound.current = slideId;
12187
12210
  }, [slideId, commit]);
12188
- useEffect35(() => {
12211
+ useEffect36(() => {
12189
12212
  if (!draft) return;
12190
12213
  const doc = field.current?.ownerDocument;
12191
12214
  const onPointerDown = (e) => {
@@ -12197,8 +12220,8 @@ function NotesPaneBody(props) {
12197
12220
  useLayoutEffect15(() => {
12198
12221
  if (!open) commit();
12199
12222
  }, [open, commit]);
12200
- useEffect35(() => () => commit(), [commit]);
12201
- const readFormats = useCallback15(() => {
12223
+ useEffect36(() => () => commit(), [commit]);
12224
+ const readFormats = useCallback14(() => {
12202
12225
  const el = field.current;
12203
12226
  if (el) followNotesArm(el);
12204
12227
  const range = el && notesFieldFocused(el) ? notesSelection2(el) : null;
@@ -12206,9 +12229,9 @@ function NotesPaneBody(props) {
12206
12229
  setCanFormat(!!el && notesCanFormat(notesFieldText2(el), range));
12207
12230
  setFormats((was) => sameNotesFormats(was, next) ? was : next);
12208
12231
  }, []);
12209
- const focused = useRef45(false);
12210
- const applyRef = useRef45(() => false);
12211
- const leaveSlide = useCallback15(() => {
12232
+ const focused = useRef44(false);
12233
+ const applyRef = useRef44(() => false);
12234
+ const leaveSlide = useCallback14(() => {
12212
12235
  if (editor && editor.snapshot().selection.kind !== "none")
12213
12236
  editor.setSelection({ kind: "none" });
12214
12237
  }, [editor]);
@@ -12228,18 +12251,18 @@ function NotesPaneBody(props) {
12228
12251
  setCanFormat(false);
12229
12252
  setFormats(NO_FORMATS);
12230
12253
  };
12231
- useEffect35(() => {
12254
+ useEffect36(() => {
12232
12255
  const doc = field.current?.ownerDocument;
12233
12256
  if (!active || !doc) return;
12234
12257
  readFormats();
12235
12258
  doc.addEventListener("selectionchange", readFormats);
12236
12259
  return () => doc.removeEventListener("selectionchange", readFormats);
12237
12260
  }, [active, readFormats]);
12238
- useEffect35(() => {
12261
+ useEffect36(() => {
12239
12262
  if (editor && focused.current)
12240
12263
  setNotesTarget(editor, { formats, readOnly, canFormat, apply: (f) => applyRef.current(f) });
12241
12264
  }, [editor, formats, readOnly, canFormat]);
12242
- useEffect35(
12265
+ useEffect36(
12243
12266
  () => () => {
12244
12267
  if (editor) setNotesTarget(editor, null);
12245
12268
  },
@@ -12249,11 +12272,11 @@ function NotesPaneBody(props) {
12249
12272
  const [findCount, setFindCount] = useState47(0);
12250
12273
  const selectionKind = useEditorState((s) => s.selection.kind);
12251
12274
  const revision = useEditorState((s) => s.revision);
12252
- useEffect35(
12275
+ useEffect36(
12253
12276
  () => editor ? onFindShown2(editor.find, () => setFindCount((n) => n + 1)) : void 0,
12254
12277
  [editor]
12255
12278
  );
12256
- useEffect35(() => {
12279
+ useEffect36(() => {
12257
12280
  painter.paint(editor, open ? field.current : null, paragraphs, !!draft);
12258
12281
  }, [
12259
12282
  painter,
@@ -12267,7 +12290,7 @@ function NotesPaneBody(props) {
12267
12290
  revision,
12268
12291
  slideId
12269
12292
  ]);
12270
- useEffect35(() => () => painter.stop(), [painter]);
12293
+ useEffect36(() => () => painter.stop(), [painter]);
12271
12294
  const onDraft = (text) => {
12272
12295
  const id = pending.current?.slideId ?? bound.current ?? slideId;
12273
12296
  if (!id) return;
@@ -12319,7 +12342,7 @@ function NotesPaneBody(props) {
12319
12342
  if (editor.snapshot().notesFormatted === before) restore.current = null;
12320
12343
  leaveSlide();
12321
12344
  };
12322
- return /* @__PURE__ */ jsxs50(
12345
+ return /* @__PURE__ */ jsxs51(
12323
12346
  "section",
12324
12347
  {
12325
12348
  className: ["pptx-notes", className].filter(Boolean).join(" "),
@@ -12327,7 +12350,7 @@ function NotesPaneBody(props) {
12327
12350
  "data-open": open ? "true" : "false",
12328
12351
  style: props.style,
12329
12352
  children: [
12330
- /* @__PURE__ */ jsxs50("div", { className: "pptx-notes__head", onMouseDown: keepFocus, children: [
12353
+ /* @__PURE__ */ jsxs51("div", { className: "pptx-notes__head", onMouseDown: keepFocus, children: [
12331
12354
  /* @__PURE__ */ jsx56("span", { children: t("notes.title") }),
12332
12355
  open && !readOnly && showFormatButtons ? /* @__PURE__ */ jsx56("div", { className: "pptx-notes__format", role: "group", "aria-label": t("notes.format"), children: NOTES_FORMAT_BUTTONS.map(([format, icon, key]) => /* @__PURE__ */ jsx56(
12333
12356
  ToolButton,
@@ -12385,7 +12408,7 @@ function NotesPaneBody(props) {
12385
12408
  }
12386
12409
 
12387
12410
  // src/panes.tsx
12388
- import { jsx as jsx57, jsxs as jsxs51 } from "react/jsx-runtime";
12411
+ import { jsx as jsx57, jsxs as jsxs52 } from "react/jsx-runtime";
12389
12412
  var sameSlides = (a, b) => a.length === b.length && a.every((s, i) => s === b[i]);
12390
12413
  var sameIndices2 = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
12391
12414
  var clickMode = slideClickMode;
@@ -12394,8 +12417,8 @@ var Thumbnail = memo2(function Thumbnail2({
12394
12417
  ratio
12395
12418
  }) {
12396
12419
  const editor = usePptxEditor();
12397
- const box = useRef46(null);
12398
- useEffect36(() => {
12420
+ const box = useRef45(null);
12421
+ useEffect37(() => {
12399
12422
  if (!editor || !box.current) return void 0;
12400
12423
  return editor.renderThumbnail(slide.index, box.current, { defer: true });
12401
12424
  }, [editor, slide]);
@@ -12412,7 +12435,7 @@ var Thumbnail = memo2(function Thumbnail2({
12412
12435
  });
12413
12436
  var RailItem = memo2(function RailItem2(props) {
12414
12437
  const { slide: s, on } = props;
12415
- return /* @__PURE__ */ jsxs51(
12438
+ return /* @__PURE__ */ jsxs52(
12416
12439
  "li",
12417
12440
  {
12418
12441
  className: "pptx-rail__item",
@@ -12441,8 +12464,8 @@ var RailItem = memo2(function RailItem2(props) {
12441
12464
  );
12442
12465
  });
12443
12466
  function useFocusFollowsCurrent(list, item, current, count, shown = true) {
12444
- const focused = useRef46(null);
12445
- useEffect36(() => {
12467
+ const focused = useRef45(null);
12468
+ useEffect37(() => {
12446
12469
  followCurrentSlide(list.current, item, focused.current);
12447
12470
  }, [list, item, current, count, shown]);
12448
12471
  return (e) => {
@@ -12460,11 +12483,11 @@ function stripStyle(style) {
12460
12483
  return rest;
12461
12484
  }
12462
12485
  function useProgressiveMount(total, needed, opening, loading) {
12463
- const [, grow] = useReducer((n) => n + 1, 0);
12486
+ const [, grow] = useReducer2((n) => n + 1, 0);
12464
12487
  const [mount] = useState48(() => createProgressiveMount(grow));
12465
- useEffect36(() => () => mount.dispose(), [mount]);
12488
+ useEffect37(() => () => mount.dispose(), [mount]);
12466
12489
  const shown = mount.limit(total, needed, opening, loading);
12467
- useEffect36(() => mount.follow(total));
12490
+ useEffect37(() => mount.follow(total));
12468
12491
  return shown;
12469
12492
  }
12470
12493
  function usePaneOpen(props) {
@@ -12484,9 +12507,9 @@ function SlideRail(props = {}) {
12484
12507
  function SlideList(props) {
12485
12508
  const [open, setPaneOpen] = usePaneOpen(props);
12486
12509
  const toggle = props.toggle !== false;
12487
- const rail = useRef46(null);
12510
+ const rail = useRef45(null);
12488
12511
  const listId = useId21();
12489
- const focusToggle = useRef46(false);
12512
+ const focusToggle = useRef45(false);
12490
12513
  const setOpen = (next) => {
12491
12514
  focusToggle.current = rail.current?.contains(document.activeElement) ?? false;
12492
12515
  setPaneOpen(next);
@@ -12498,14 +12521,14 @@ function SlideList(props) {
12498
12521
  const selected = useEditorState((s) => s.selectedSlides, sameIndices2);
12499
12522
  const ratio = useEditorState((s) => s.slideHeight / s.slideWidth);
12500
12523
  const readOnly = useEditorState((s) => s.mode === "view");
12501
- const list = useRef46(null);
12524
+ const list = useRef45(null);
12502
12525
  const count = slides.length;
12503
12526
  const opening = useEditorState((s) => (s.pendingSlides ?? 0) > 0);
12504
12527
  const loading = useEditorState((s) => s.isOpening === true);
12505
12528
  const mounted = useProgressiveMount(count, current, opening, loading);
12506
12529
  const [menu, setMenu] = useState48(null);
12507
12530
  const [gallery, setGallery] = useState48(null);
12508
- const actions = useRef46(null);
12531
+ const actions = useRef45(null);
12509
12532
  const sections = useSlideSections();
12510
12533
  const grouped = groupSlideSections2(sections, count);
12511
12534
  const inView = grouped ? mountedSections(grouped, mounted) : null;
@@ -12514,7 +12537,7 @@ function SlideList(props) {
12514
12537
  useLayoutEffect16(() => setRightToLeft(railRightToLeft2(rail.current)), [orientation, open]);
12515
12538
  const chrome = railOrientationChrome2(orientation, rightToLeft);
12516
12539
  const [folded, setFolded] = useState48(false);
12517
- useEffect36(() => watchRailFold(rail.current, orientation, setFolded), [orientation, open]);
12540
+ useEffect37(() => watchRailFold(rail.current, orientation, setFolded), [orientation, open]);
12518
12541
  const {
12519
12542
  itemProps: dragProps,
12520
12543
  cancel: cancelDrag,
@@ -12537,9 +12560,9 @@ function SlideList(props) {
12537
12560
  runSlideStep2(editor, stepCommand2(selected, stepTarget(step)));
12538
12561
  };
12539
12562
  const trackFocus = useFocusFollowsCurrent(list, ".pptx-rail__item", current, count, open);
12540
- useEffect36(() => keepCurrentSlideInView2(list.current, ".pptx-rail__item"), [open]);
12563
+ useEffect37(() => keepCurrentSlideInView2(list.current, ".pptx-rail__item"), [open]);
12541
12564
  const why = !editor ? t("disabled.noEditor") : readOnly ? t("disabled.viewing") : null;
12542
- useEffect36(() => {
12565
+ useEffect37(() => {
12543
12566
  const active = document.activeElement;
12544
12567
  const lost = !active || active === document.body || rail.current?.contains(active);
12545
12568
  if (focusToggle.current && lost)
@@ -12550,7 +12573,7 @@ function SlideList(props) {
12550
12573
  setRenaming(null);
12551
12574
  }
12552
12575
  }, [open, cancelDrag]);
12553
- useEffect36(() => {
12576
+ useEffect37(() => {
12554
12577
  focusToggle.current = false;
12555
12578
  });
12556
12579
  const onKeyDown = (e) => railKeyDown(e, {
@@ -12567,7 +12590,7 @@ function SlideList(props) {
12567
12590
  focusCurrent
12568
12591
  });
12569
12592
  const [memoItem] = useState48(() => createItemMemo());
12570
- const latest = useRef46({ editor, dragProps, openMenu });
12593
+ const latest = useRef45({ editor, dragProps, openMenu });
12571
12594
  useLayoutEffect16(() => {
12572
12595
  latest.current = { editor, dragProps, openMenu };
12573
12596
  });
@@ -12661,7 +12684,7 @@ function SlideList(props) {
12661
12684
  children: /* @__PURE__ */ jsx57(RailActionsContext.Provider, { value: railActions, children: railExpandContent(props.children) })
12662
12685
  }
12663
12686
  );
12664
- return /* @__PURE__ */ jsxs51(
12687
+ return /* @__PURE__ */ jsxs52(
12665
12688
  "nav",
12666
12689
  {
12667
12690
  ref: rail,
@@ -12745,9 +12768,9 @@ function ZoomPill({ className } = {}) {
12745
12768
  const off = useEditorState((s) => s.presentationView === "slideSorter");
12746
12769
  const reason = off ? t("disabled.sorterZoom") : null;
12747
12770
  const levelLabel = off ? t("zoom.ariaLabel") : t("zoom.levelAriaLabel", { percent: Math.round(zoom * 100) });
12748
- const anchor = useRef46(null);
12771
+ const anchor = useRef45(null);
12749
12772
  const [open, setOpen] = useState48(false);
12750
- useEffect36(() => {
12773
+ useEffect37(() => {
12751
12774
  if (off) setOpen(false);
12752
12775
  }, [off]);
12753
12776
  const step = (dir) => {
@@ -12759,7 +12782,7 @@ function ZoomPill({ className } = {}) {
12759
12782
  const key = zoomLimitReason(zoom, dir);
12760
12783
  return key ? t(key) : null;
12761
12784
  };
12762
- return /* @__PURE__ */ jsxs51(
12785
+ return /* @__PURE__ */ jsxs52(
12763
12786
  "div",
12764
12787
  {
12765
12788
  className: ["pptx-zoom", className].filter(Boolean).join(" "),
@@ -12777,7 +12800,7 @@ function ZoomPill({ className } = {}) {
12777
12800
  disabledReason: reason ?? limit(-1)
12778
12801
  }
12779
12802
  ),
12780
- /* @__PURE__ */ jsxs51(
12803
+ /* @__PURE__ */ jsxs52(
12781
12804
  "button",
12782
12805
  {
12783
12806
  ref: anchor,
@@ -12807,7 +12830,7 @@ function ZoomPill({ className } = {}) {
12807
12830
  disabledReason: reason ?? limit(1)
12808
12831
  }
12809
12832
  ),
12810
- open && !off ? /* @__PURE__ */ jsxs51(Popover, { anchor: anchor.current, onClose: () => setOpen(false), align: "end", children: [
12833
+ open && !off ? /* @__PURE__ */ jsxs52(Popover, { anchor: anchor.current, onClose: () => setOpen(false), align: "end", children: [
12811
12834
  /* @__PURE__ */ jsx57(MenuItem, { checked: fit, onSelect: () => (editor?.setZoom("fit"), setOpen(false)), children: t("zoom.fit") }),
12812
12835
  ZOOM_MENU_LEVELS.map((z) => /* @__PURE__ */ jsx57(
12813
12836
  MenuItem,
@@ -12825,7 +12848,7 @@ function ZoomPill({ className } = {}) {
12825
12848
  }
12826
12849
 
12827
12850
  // src/SlideSorter.tsx
12828
- import { jsx as jsx58, jsxs as jsxs52 } from "react/jsx-runtime";
12851
+ import { jsx as jsx58, jsxs as jsxs53 } from "react/jsx-runtime";
12829
12852
  var sameList = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
12830
12853
  function SlideSorter({ className } = {}) {
12831
12854
  const editor = usePptxEditor();
@@ -12840,15 +12863,15 @@ function SlideSorter({ className } = {}) {
12840
12863
  const collapsed = useCollapsedSections();
12841
12864
  useOpenCurrentSection(grouped);
12842
12865
  useSorterRegistration();
12843
- const list = useRef47(null);
12866
+ const list = useRef46(null);
12844
12867
  const { itemProps: dragProps } = useSlideDrag("x", selected, readOnly, grouped);
12845
12868
  const [menu, setMenu] = useState49(null);
12846
12869
  const [renaming, setRenaming] = useState49(null);
12847
12870
  useSectionRenameRequests(setRenaming);
12848
12871
  const focusCurrent = useFocusCurrentAfterRender(list);
12849
12872
  useFocusAfterCollapse(list, collapsed);
12850
- useEffect37(() => list.current ? focusSorterOnShow(list.current) : void 0, []);
12851
- const editorNow = useRef47(editor);
12873
+ useEffect38(() => list.current ? focusSorterOnShow(list.current) : void 0, []);
12874
+ const editorNow = useRef46(editor);
12852
12875
  editorNow.current = editor;
12853
12876
  useLayoutEffect17(() => {
12854
12877
  const el = list.current;
@@ -12881,7 +12904,7 @@ function SlideSorter({ className } = {}) {
12881
12904
  focusCurrent,
12882
12905
  openSlide
12883
12906
  });
12884
- const item = (s) => /* @__PURE__ */ jsxs52(
12907
+ const item = (s) => /* @__PURE__ */ jsxs53(
12885
12908
  "li",
12886
12909
  {
12887
12910
  className: "pptx-sorter__item",
@@ -12910,7 +12933,7 @@ function SlideSorter({ className } = {}) {
12910
12933
  },
12911
12934
  s.id
12912
12935
  );
12913
- return /* @__PURE__ */ jsxs52(
12936
+ return /* @__PURE__ */ jsxs53(
12914
12937
  "section",
12915
12938
  {
12916
12939
  className: ["pptx-sorter", className].filter(Boolean).join(" "),
@@ -12963,7 +12986,7 @@ function ViewSwitch() {
12963
12986
  const cmd = useEditorCommand("view.presentationView");
12964
12987
  const options = STATUS_BAR_VIEW_OPTIONS;
12965
12988
  const off = !cmd.isEnabled;
12966
- const reason = cmd.disabledReason ? translateKeyOrText20(t, cmd.disabledReason) : null;
12989
+ const reason = cmd.disabledReason;
12967
12990
  const offAttrs = useAriaDisabled(off, reason);
12968
12991
  const pick = (e, step) => {
12969
12992
  if (off) return;
@@ -12974,7 +12997,7 @@ function ViewSwitch() {
12974
12997
  const buttons = e.currentTarget.parentElement?.querySelectorAll('[role="radio"]');
12975
12998
  buttons?.[options.indexOf(next)]?.focus();
12976
12999
  };
12977
- return /* @__PURE__ */ jsxs52(
13000
+ return /* @__PURE__ */ jsxs53(
12978
13001
  "div",
12979
13002
  {
12980
13003
  className: "pptx-zoom pptx-view-switch",
@@ -13023,17 +13046,17 @@ function DefaultWorkspace({
13023
13046
  }) {
13024
13047
  const editor = usePptxEditor();
13025
13048
  const view = useEditorState((s) => s.presentationView ?? "normal");
13026
- const box = useRef47(null);
13027
- const was = useRef47(view);
13028
- useEffect37(() => {
13049
+ const box = useRef46(null);
13050
+ const was = useRef46(view);
13051
+ useEffect38(() => {
13029
13052
  if (was.current === view) return;
13030
13053
  was.current = view;
13031
13054
  const active = box.current?.ownerDocument.activeElement;
13032
13055
  if (active && active !== active.ownerDocument.body && active.isConnected) return;
13033
13056
  focusCurrentSlideOrCanvas(box.current, editor);
13034
13057
  }, [view, editor]);
13035
- const inset = useRef47(null);
13036
- useEffect37(() => {
13058
+ const inset = useRef46(null);
13059
+ useEffect38(() => {
13037
13060
  if (!box.current) return;
13038
13061
  const tracker = trackNotesInset(box.current);
13039
13062
  inset.current = tracker;
@@ -13042,16 +13065,16 @@ function DefaultWorkspace({
13042
13065
  inset.current = null;
13043
13066
  };
13044
13067
  }, []);
13045
- useEffect37(() => {
13068
+ useEffect38(() => {
13046
13069
  inset.current?.refresh();
13047
13070
  });
13048
- return /* @__PURE__ */ jsxs52("div", { ref: box, className: "pptx-default__views", children: [
13049
- view === "slideSorter" ? /* @__PURE__ */ jsx58("div", { className: "pptx-default__workspace", children: /* @__PURE__ */ jsxs52("div", { className: "pptx-default__main", children: [
13071
+ return /* @__PURE__ */ jsxs53("div", { ref: box, className: "pptx-default__views", children: [
13072
+ view === "slideSorter" ? /* @__PURE__ */ jsx58("div", { className: "pptx-default__workspace", children: /* @__PURE__ */ jsxs53("div", { className: "pptx-default__main", children: [
13050
13073
  /* @__PURE__ */ jsx58(SlideSorter, {}),
13051
13074
  /* @__PURE__ */ jsx58(EditNotice, {})
13052
13075
  ] }) }) : normal,
13053
13076
  overlay,
13054
- status === void 0 ? /* @__PURE__ */ jsxs52("div", { className: "pptx-statusbar", children: [
13077
+ status === void 0 ? /* @__PURE__ */ jsxs53("div", { className: "pptx-statusbar", children: [
13055
13078
  /* @__PURE__ */ jsx58(ReadOnlyBadge, {}),
13056
13079
  /* @__PURE__ */ jsx58(ViewSwitch, {}),
13057
13080
  /* @__PURE__ */ jsx58(ZoomPill, {})
@@ -13067,24 +13090,24 @@ function ReadOnlyBadge() {
13067
13090
  function SlideSorterWatch() {
13068
13091
  const editor = usePptxEditor();
13069
13092
  const sorter = useEditorState((s) => s.presentationView === "slideSorter");
13070
- useEffect37(() => {
13093
+ useEffect38(() => {
13071
13094
  if (sorter && editor && !slideSorterMounted(editor)) warnSlideSorterUnmounted();
13072
13095
  }, [sorter, editor]);
13073
13096
  return null;
13074
13097
  }
13075
13098
 
13076
13099
  // src/ChromeTooltip.tsx
13077
- import { useEffect as useEffect38, useLayoutEffect as useLayoutEffect18, useRef as useRef48, useState as useState50 } from "react";
13100
+ import { useEffect as useEffect39, useLayoutEffect as useLayoutEffect18, useRef as useRef47, useState as useState50 } from "react";
13078
13101
  import { createPortal as createPortal3 } from "react-dom";
13079
13102
  import {
13080
13103
  listenChromeTooltips,
13081
13104
  positionChromeTooltip
13082
13105
  } from "@pptx-editor.dev/core/editor";
13083
- import { jsx as jsx59, jsxs as jsxs53 } from "react/jsx-runtime";
13106
+ import { jsx as jsx59, jsxs as jsxs54 } from "react/jsx-runtime";
13084
13107
  function ChromeTooltip() {
13085
13108
  const [state, setState] = useState50(null);
13086
- const ref = useRef48(null);
13087
- useEffect38(
13109
+ const ref = useRef47(null);
13110
+ useEffect39(
13088
13111
  () => typeof document === "undefined" ? void 0 : listenChromeTooltips(document, setState),
13089
13112
  []
13090
13113
  );
@@ -13094,7 +13117,7 @@ function ChromeTooltip() {
13094
13117
  if (!state) return null;
13095
13118
  return createPortal3(
13096
13119
  // Visual only: the control's `aria-label` and `aria-describedby` carry the same text.
13097
- /* @__PURE__ */ jsxs53(
13120
+ /* @__PURE__ */ jsxs54(
13098
13121
  "div",
13099
13122
  {
13100
13123
  ref,
@@ -13113,26 +13136,26 @@ function ChromeTooltip() {
13113
13136
  }
13114
13137
 
13115
13138
  // src/PptxEditorRoot.tsx
13116
- import { Fragment as Fragment40, jsx as jsx60, jsxs as jsxs54 } from "react/jsx-runtime";
13139
+ import { Fragment as Fragment40, jsx as jsx60, jsxs as jsxs55 } from "react/jsx-runtime";
13117
13140
  var PptxEditorRoot = forwardRef(
13118
13141
  function PptxEditorRoot2(props, ref) {
13119
13142
  const { document: bytes, mode = "edit", locale, onReady, onChange, children } = props;
13120
13143
  const [editor, setEditor] = useState51(null);
13121
- const live = useRef49(null);
13144
+ const live = useRef48(null);
13122
13145
  useImperativeHandle(ref, () => createEditorRefApi(() => live.current), []);
13123
- const callbacks = useRef49({ onReady, onChange, onFontError: props.onFontError });
13146
+ const callbacks = useRef48({ onReady, onChange, onFontError: props.onFontError });
13124
13147
  callbacks.current = { onReady, onChange, onFontError: props.onFontError };
13125
- const createdFonts = useRef49(props.fonts);
13126
- const createdFamilies = useRef49(props.fontFamilies);
13127
- const createdModules = useRef49(props.modules);
13148
+ const createdFonts = useRef48(props.fonts);
13149
+ const createdFamilies = useRef48(props.fontFamilies);
13150
+ const createdModules = useRef48(props.modules);
13128
13151
  const localeKey = localeContentKey(locale);
13129
- const translator = useRef49(null);
13152
+ const translator = useRef48(null);
13130
13153
  if (translator.current?.key !== localeKey)
13131
13154
  translator.current = { key: localeKey, t: translatorFor(locale) };
13132
13155
  const t = translator.current.t;
13133
- const tRef = useRef49(t);
13156
+ const tRef = useRef48(t);
13134
13157
  tRef.current = t;
13135
- useEffect39(() => {
13158
+ useEffect40(() => {
13136
13159
  const instance = createPptxEditor({
13137
13160
  mode,
13138
13161
  ...props.fontFamilies ? { fontFamilies: props.fontFamilies } : {},
@@ -13142,7 +13165,7 @@ var PptxEditorRoot = forwardRef(
13142
13165
  ...props.readClipboardDrawing ? { readClipboardDrawing: props.readClipboardDrawing } : {},
13143
13166
  ...props.author ? { author: props.author } : {},
13144
13167
  onFontError: (error) => reportFontError(error, callbacks.current.onFontError),
13145
- translate: (key, params) => translateKeyOrText21(tRef.current, key, params)
13168
+ translate: (key, params) => translateKeyOrText20(tRef.current, key, params)
13146
13169
  });
13147
13170
  createdFonts.current = props.fonts;
13148
13171
  createdFamilies.current = props.fontFamilies;
@@ -13159,24 +13182,24 @@ var PptxEditorRoot = forwardRef(
13159
13182
  }, []);
13160
13183
  const [documentChurn] = useState51(() => churnWarning("PptxEditor.Root", "document"));
13161
13184
  const [fontsChurn] = useState51(() => churnWarning("PptxEditor.Root", "fonts"));
13162
- useEffect39(() => {
13185
+ useEffect40(() => {
13163
13186
  if (!editor || !bytes) return;
13164
13187
  documentChurn();
13165
13188
  void editor.load(bytes);
13166
13189
  }, [editor, bytes, documentChurn]);
13167
- useEffect39(() => {
13190
+ useEffect40(() => {
13168
13191
  editor?.setMode(mode);
13169
13192
  }, [editor, mode]);
13170
13193
  const author = props.author;
13171
- useEffect39(() => {
13194
+ useEffect40(() => {
13172
13195
  editor?.setAuthor(author);
13173
13196
  }, [editor, author]);
13174
13197
  const modules = props.modules;
13175
- useEffect39(() => {
13198
+ useEffect40(() => {
13176
13199
  if (editor) warnModulesChanged(createdModules.current, modules, "PptxEditor.Root");
13177
13200
  }, [editor, modules]);
13178
13201
  const fonts = props.fonts;
13179
- useEffect39(() => {
13202
+ useEffect40(() => {
13180
13203
  if (!editor || createdFonts.current === fonts) return;
13181
13204
  createdFonts.current = fonts;
13182
13205
  fontsChurn();
@@ -13184,13 +13207,13 @@ var PptxEditorRoot = forwardRef(
13184
13207
  });
13185
13208
  }, [editor, fonts, fontsChurn]);
13186
13209
  const fontFamilies = props.fontFamilies;
13187
- useEffect39(() => {
13210
+ useEffect40(() => {
13188
13211
  if (!editor || createdFamilies.current === fontFamilies) return;
13189
13212
  createdFamilies.current = fontFamilies;
13190
13213
  editor.setFontFamilies(fontFamilies ?? []);
13191
13214
  }, [editor, fontFamilies]);
13192
- const painted = useRef49(localeKey);
13193
- useEffect39(() => {
13215
+ const painted = useRef48(localeKey);
13216
+ useEffect40(() => {
13194
13217
  if (!editor || painted.current === localeKey) return;
13195
13218
  painted.current = localeKey;
13196
13219
  repaintSurfaceOf(editor);
@@ -13198,12 +13221,12 @@ var PptxEditorRoot = forwardRef(
13198
13221
  const slideshow = useSlideshowHandle(editor);
13199
13222
  const dark = useResolvedDark(props.colorMode);
13200
13223
  const [notesOpen, setNotesOpen] = useState51(void 0);
13201
- const notesRequest = useRef49(null);
13224
+ const notesRequest = useRef48(null);
13202
13225
  const panes = useMemo19(
13203
13226
  () => ({ notesOpen, setNotesOpen, notesRequest }),
13204
13227
  [notesOpen]
13205
13228
  );
13206
- return /* @__PURE__ */ jsx60(PptxEditorContext.Provider, { value: editor, children: /* @__PURE__ */ jsx60(TranslationContext.Provider, { value: t, children: /* @__PURE__ */ jsx60(SlideshowContext.Provider, { value: slideshow, children: /* @__PURE__ */ jsx60(ChromeDarkContext.Provider, { value: dark, children: /* @__PURE__ */ jsx60(PaneStateContext.Provider, { value: panes, children: /* @__PURE__ */ jsx60(DialogProvider, { ...props.popups ? { popups: props.popups } : {}, children: /* @__PURE__ */ jsxs54(ChromeActionHostProvider, { children: [
13229
+ return /* @__PURE__ */ jsx60(PptxEditorContext.Provider, { value: editor, children: /* @__PURE__ */ jsx60(TranslationContext.Provider, { value: t, children: /* @__PURE__ */ jsx60(SlideshowContext.Provider, { value: slideshow, children: /* @__PURE__ */ jsx60(ChromeDarkContext.Provider, { value: dark, children: /* @__PURE__ */ jsx60(PaneStateContext.Provider, { value: panes, children: /* @__PURE__ */ jsx60(DialogProvider, { ...props.popups ? { popups: props.popups } : {}, children: /* @__PURE__ */ jsxs55(ChromeActionHostProvider, { children: [
13207
13230
  children,
13208
13231
  /* @__PURE__ */ jsx60(SlideSorterWatch, {}),
13209
13232
  /* @__PURE__ */ jsx60(ChromeTooltip, {})
@@ -13214,7 +13237,7 @@ function viewportLandmark(t, label) {
13214
13237
  if (label === false) return {};
13215
13238
  return {
13216
13239
  role: "region",
13217
- "aria-label": label ? translateKeyOrText21(t, label) : t("viewport.ariaLabel")
13240
+ "aria-label": label ? translateKeyOrText20(t, label) : t("viewport.ariaLabel")
13218
13241
  };
13219
13242
  }
13220
13243
  function PptxEditorViewport({ className, label, children }) {
@@ -13231,14 +13254,14 @@ function PptxEditorViewport({ className, label, children }) {
13231
13254
  }
13232
13255
  function PptxEditorContent({ className }) {
13233
13256
  const editor = usePptxEditor();
13234
- const host = useRef49(null);
13257
+ const host = useRef48(null);
13235
13258
  const menu = useCanvasContextMenu();
13236
13259
  useLayoutEffect19(() => {
13237
13260
  if (!editor || !host.current) return;
13238
13261
  editor.attach(host.current);
13239
13262
  return () => editor.detach();
13240
13263
  }, [editor]);
13241
- return /* @__PURE__ */ jsxs54(Fragment40, { children: [
13264
+ return /* @__PURE__ */ jsxs55(Fragment40, { children: [
13242
13265
  /* @__PURE__ */ jsx60(
13243
13266
  "div",
13244
13267
  {
@@ -13257,7 +13280,7 @@ function PptxEditorContent({ className }) {
13257
13280
  // src/toolbar-action.tsx
13258
13281
  import { Children as Children8, Fragment as Fragment41, isValidElement as isValidElement8 } from "react";
13259
13282
  import { tooltipAttributes as tooltipAttributes7, warnAsChildChild as warnAsChildChild3 } from "@pptx-editor.dev/core/editor";
13260
- import { Fragment as Fragment42, jsx as jsx61, jsxs as jsxs55 } from "react/jsx-runtime";
13283
+ import { Fragment as Fragment42, jsx as jsx61, jsxs as jsxs56 } from "react/jsx-runtime";
13261
13284
  function ToolbarAction(props) {
13262
13285
  const { label, icon, active, disabled, disabledReason, onSelect, asChild, className, children } = props;
13263
13286
  const off = useAriaDisabled(!!disabled, disabledReason);
@@ -13278,7 +13301,7 @@ function ToolbarAction(props) {
13278
13301
  const select = disabled ? void 0 : () => onSelect?.();
13279
13302
  if (child) {
13280
13303
  const isButton = child.type === "button";
13281
- return /* @__PURE__ */ jsxs55(Fragment42, { children: [
13304
+ return /* @__PURE__ */ jsxs56(Fragment42, { children: [
13282
13305
  renderAsChild(child, {
13283
13306
  ...shared,
13284
13307
  ...isButton ? { type: "button" } : buttonRoleProps(select),
@@ -13302,7 +13325,7 @@ function ToolbarAction(props) {
13302
13325
  children: content ?? label
13303
13326
  }
13304
13327
  );
13305
- return off.note ? /* @__PURE__ */ jsxs55(Fragment42, { children: [
13328
+ return off.note ? /* @__PURE__ */ jsxs56(Fragment42, { children: [
13306
13329
  button,
13307
13330
  off.note
13308
13331
  ] }) : button;
@@ -13339,14 +13362,14 @@ var TOOLBAR_PARTS = Object.fromEntries(
13339
13362
  );
13340
13363
 
13341
13364
  // src/FontNotice.tsx
13342
- import { useEffect as useEffect40, useRef as useRef50, useState as useState52 } from "react";
13365
+ import { useEffect as useEffect41, useRef as useRef49, useState as useState52 } from "react";
13343
13366
  import {
13344
13367
  applyLocalFonts,
13345
13368
  canQueryLocalFonts,
13346
13369
  fontNoticeFamilies,
13347
13370
  fontNoticeList
13348
13371
  } from "@pptx-editor.dev/core/editor";
13349
- import { jsx as jsx63, jsxs as jsxs56 } from "react/jsx-runtime";
13372
+ import { jsx as jsx63, jsxs as jsxs57 } from "react/jsx-runtime";
13350
13373
  var FontNotice = withChromeTranslate(FontNoticeRoot, "FontNotice");
13351
13374
  function FontNoticeRoot({ className }) {
13352
13375
  const editor = usePptxEditor();
@@ -13358,8 +13381,8 @@ function FontNoticeRoot({ className }) {
13358
13381
  const [dismissed, setDismissed] = useState52(null);
13359
13382
  const [outcome, setOutcome] = useState52(null);
13360
13383
  const [busy, setBusy] = useState52(false);
13361
- const round = useRef50(0);
13362
- useEffect40(() => {
13384
+ const round = useRef49(0);
13385
+ useEffect41(() => {
13363
13386
  round.current += 1;
13364
13387
  setOutcome(null);
13365
13388
  }, [loadState]);
@@ -13378,14 +13401,14 @@ function FontNoticeRoot({ className }) {
13378
13401
  setBusy(false);
13379
13402
  }
13380
13403
  };
13381
- return /* @__PURE__ */ jsxs56(
13404
+ return /* @__PURE__ */ jsxs57(
13382
13405
  "div",
13383
13406
  {
13384
13407
  className: `pptx-font-notice${className ? ` ${className}` : ""}`,
13385
13408
  role: "status",
13386
13409
  onMouseDown: keepFocus,
13387
13410
  children: [
13388
- /* @__PURE__ */ jsxs56("span", { className: "pptx-font-notice__text", children: [
13411
+ /* @__PURE__ */ jsxs57("span", { className: "pptx-font-notice__text", children: [
13389
13412
  missing.length ? t("fonts.notice", { families: fontNoticeList(missing, t) }) : status,
13390
13413
  missing.length && status ? ` ${status}` : ""
13391
13414
  ] }),
@@ -13407,10 +13430,10 @@ function FontNoticeRoot({ className }) {
13407
13430
 
13408
13431
  // src/OpenFailure.tsx
13409
13432
  import {
13410
- useCallback as useCallback16,
13411
- useEffect as useEffect41,
13433
+ useCallback as useCallback15,
13434
+ useEffect as useEffect42,
13412
13435
  useId as useId22,
13413
- useRef as useRef51,
13436
+ useRef as useRef50,
13414
13437
  useState as useState53
13415
13438
  } from "react";
13416
13439
  import {
@@ -13420,7 +13443,7 @@ import {
13420
13443
  openFailureKey,
13421
13444
  shownOpenFailure
13422
13445
  } from "@pptx-editor.dev/core/editor";
13423
- import { jsx as jsx64, jsxs as jsxs57 } from "react/jsx-runtime";
13446
+ import { jsx as jsx64, jsxs as jsxs58 } from "react/jsx-runtime";
13424
13447
  function useOpenFailure(options = {}) {
13425
13448
  const current = useEditorState(shownOpenFailure);
13426
13449
  const kept = useEditorState((s) => s.status === "ready");
@@ -13428,7 +13451,7 @@ function useOpenFailure(options = {}) {
13428
13451
  const t = options.t ?? ambient;
13429
13452
  const [dismissed, setDismissed] = useState53(null);
13430
13453
  const failure = current !== null && current !== dismissed ? current : null;
13431
- const dismiss = useCallback16(
13454
+ const dismiss = useCallback15(
13432
13455
  (shown) => {
13433
13456
  if (!shown || shown === current) setDismissed(current);
13434
13457
  },
@@ -13458,10 +13481,10 @@ function OpenFailureRoot({
13458
13481
  const { failure, message: packaged, kept, dismiss } = useOpenFailure();
13459
13482
  const titleId = useId22();
13460
13483
  const [copy, setCopy] = useState53(null);
13461
- const reportRef = useRef51(null);
13462
- const rootRef = useRef51(null);
13484
+ const reportRef = useRef50(null);
13485
+ const rootRef = useRef50(null);
13463
13486
  const editor = usePptxEditor();
13464
- useEffect41(() => {
13487
+ useEffect42(() => {
13465
13488
  if (copy && !copy.copied) reportRef.current?.focus();
13466
13489
  }, [copy]);
13467
13490
  if (!failure || packaged === null) return null;
@@ -13479,7 +13502,7 @@ function OpenFailureRoot({
13479
13502
  };
13480
13503
  const context = { failure, message: packaged, dismiss: close };
13481
13504
  const body = typeof message === "function" ? message(failure) : message ?? packaged;
13482
- return /* @__PURE__ */ jsxs57(
13505
+ return /* @__PURE__ */ jsxs58(
13483
13506
  "div",
13484
13507
  {
13485
13508
  ref: rootRef,
@@ -13489,7 +13512,7 @@ function OpenFailureRoot({
13489
13512
  "aria-labelledby": titleId,
13490
13513
  "data-reason": failure.reason,
13491
13514
  children: [
13492
- /* @__PURE__ */ jsxs57("div", { className: "pptx-open-failure__text", role: "alert", children: [
13515
+ /* @__PURE__ */ jsxs58("div", { className: "pptx-open-failure__text", role: "alert", children: [
13493
13516
  /* @__PURE__ */ jsx64("p", { id: titleId, className: "pptx-open-failure__title", children: title ?? t("openFailure.title") }),
13494
13517
  /* @__PURE__ */ jsx64("div", { className: "pptx-open-failure__message", children: body }),
13495
13518
  kept ? /* @__PURE__ */ jsx64("p", { className: "pptx-open-failure__kept", children: t("openFailure.kept") }) : null,
@@ -13508,7 +13531,7 @@ function OpenFailureRoot({
13508
13531
  onFocus: (e) => e.currentTarget.select()
13509
13532
  }
13510
13533
  ) : null,
13511
- /* @__PURE__ */ jsxs57("div", { className: "pptx-open-failure__actions", children: [
13534
+ /* @__PURE__ */ jsxs58("div", { className: "pptx-open-failure__actions", children: [
13512
13535
  actions?.(context),
13513
13536
  showCopy ? /* @__PURE__ */ jsx64(
13514
13537
  "button",
@@ -13529,7 +13552,7 @@ function OpenFailureRoot({
13529
13552
 
13530
13553
  // src/Loading.tsx
13531
13554
  import { loadingSheetSize, sameLoadingSheetSize, showsLoading } from "@pptx-editor.dev/core/editor";
13532
- import { Fragment as Fragment43, jsx as jsx65, jsxs as jsxs58 } from "react/jsx-runtime";
13555
+ import { Fragment as Fragment43, jsx as jsx65, jsxs as jsxs59 } from "react/jsx-runtime";
13533
13556
  function LoadingSpinner({ className }) {
13534
13557
  return /* @__PURE__ */ jsx65(
13535
13558
  "span",
@@ -13567,7 +13590,7 @@ function LoadingImpl({
13567
13590
  {
13568
13591
  className: "pptx-loading__sheet",
13569
13592
  style: { width: sheet.width, aspectRatio: `${sheet.width} / ${sheet.height}` },
13570
- children: indicator ?? /* @__PURE__ */ jsxs58(Fragment43, { children: [
13593
+ children: indicator ?? /* @__PURE__ */ jsxs59(Fragment43, { children: [
13571
13594
  /* @__PURE__ */ jsx65(LoadingSpinner, {}),
13572
13595
  /* @__PURE__ */ jsx65("span", { className: "pptx-sr-only", children: t("app.loading") })
13573
13596
  ] })
@@ -13590,9 +13613,9 @@ import {
13590
13613
  Children as Children9,
13591
13614
  Fragment as Fragment44,
13592
13615
  isValidElement as isValidElement9,
13593
- useEffect as useEffect42,
13616
+ useEffect as useEffect43,
13594
13617
  useId as useId23,
13595
- useRef as useRef52,
13618
+ useRef as useRef51,
13596
13619
  useState as useState54
13597
13620
  } from "react";
13598
13621
  import {
@@ -13600,10 +13623,10 @@ import {
13600
13623
  ribbonInsertTab,
13601
13624
  ribbonShownTab,
13602
13625
  ribbonTabs,
13603
- translateKeyOrText as translateKeyOrText22,
13626
+ translateKeyOrText as translateKeyOrText21,
13604
13627
  warnRibbonChild
13605
13628
  } from "@pptx-editor.dev/core/editor";
13606
- import { jsx as jsx66, jsxs as jsxs59 } from "react/jsx-runtime";
13629
+ import { jsx as jsx66, jsxs as jsxs60 } from "react/jsx-runtime";
13607
13630
  function RibbonTab(_props) {
13608
13631
  return null;
13609
13632
  }
@@ -13628,9 +13651,9 @@ function Ribbon({
13628
13651
  const baseId = useId23();
13629
13652
  const layout = useEditorState(selectTabs, sameLayout);
13630
13653
  const [own, setOwn] = useState54(defaultTab);
13631
- const names = useRef52(/* @__PURE__ */ new Map());
13632
- const root = useRef52(null);
13633
- const focusInside = useRef52(false);
13654
+ const names = useRef51(/* @__PURE__ */ new Map());
13655
+ const root = useRef51(null);
13656
+ const focusInside = useRef51(false);
13634
13657
  const specs = /* @__PURE__ */ new Map();
13635
13658
  for (const child of flatten5(children)) {
13636
13659
  if (isValidElement9(child) && child.type === RibbonTab) {
@@ -13643,13 +13666,13 @@ function Ribbon({
13643
13666
  layout,
13644
13667
  specs,
13645
13668
  preset,
13646
- (key) => translateKeyOrText22(t, key),
13669
+ (key) => translateKeyOrText21(t, key),
13647
13670
  "Ribbon.Tab"
13648
13671
  );
13649
13672
  const wanted = tab ?? own;
13650
13673
  const { shown: current, fellBack } = ribbonShownTab(tabs, wanted);
13651
13674
  const shownId = current?.id;
13652
- useEffect42(() => {
13675
+ useEffect43(() => {
13653
13676
  if (!fellBack || shownId === void 0) return;
13654
13677
  if (tab === void 0) setOwn(shownId);
13655
13678
  onTabChange?.(shownId);
@@ -13662,9 +13685,9 @@ function Ribbon({
13662
13685
  onTabChange?.(id);
13663
13686
  };
13664
13687
  const insertions = useEditorState((s) => s.insertions);
13665
- const seen = useRef52(insertions);
13688
+ const seen = useRef51(insertions);
13666
13689
  const insertTab = ribbonInsertTab(tabs);
13667
- useEffect42(() => {
13690
+ useEffect43(() => {
13668
13691
  if (insertions === seen.current) return;
13669
13692
  seen.current = insertions;
13670
13693
  if (insertTab !== null && insertTab !== wanted) select(insertTab);
@@ -13679,7 +13702,7 @@ function Ribbon({
13679
13702
  };
13680
13703
  const tabId2 = (id) => `${baseId}-tab-${id}`;
13681
13704
  const panelId2 = `${baseId}-panel`;
13682
- return /* @__PURE__ */ jsxs59(
13705
+ return /* @__PURE__ */ jsxs60(
13683
13706
  "div",
13684
13707
  {
13685
13708
  ref: root,
@@ -13692,7 +13715,7 @@ function Ribbon({
13692
13715
  if (next && !e.currentTarget.contains(next)) focusInside.current = false;
13693
13716
  },
13694
13717
  children: [
13695
- /* @__PURE__ */ jsxs59("div", { className: "pptx-ribbon__bar", children: [
13718
+ /* @__PURE__ */ jsxs60("div", { className: "pptx-ribbon__bar", children: [
13696
13719
  quickAccess ? /* @__PURE__ */ jsx66("div", { className: "pptx-ribbon__qat", children: /* @__PURE__ */ jsx66(PresetBar, { groups: quickAccess.groups, label: quickAccess.title, overflow: false, children: quickAccess.override?.children }) }) : null,
13697
13720
  /* @__PURE__ */ jsx66(
13698
13721
  "div",
@@ -13757,7 +13780,7 @@ function Ribbon({
13757
13780
  // src/StatusBar.tsx
13758
13781
  import { Children as Children10, Fragment as Fragment45, isValidElement as isValidElement10 } from "react";
13759
13782
  import { slideStatus, warnAsChildChild as warnAsChildChild4 } from "@pptx-editor.dev/core/editor";
13760
- import { Fragment as Fragment46, jsx as jsx67, jsxs as jsxs60 } from "react/jsx-runtime";
13783
+ import { Fragment as Fragment46, jsx as jsx67, jsxs as jsxs61 } from "react/jsx-runtime";
13761
13784
  function StatusBarSlideNumber({ className, hidden }) {
13762
13785
  const { t } = useTranslation();
13763
13786
  const status = useEditorState(
@@ -13842,7 +13865,7 @@ function StatusBar({ className, preset = true, children }) {
13842
13865
  );
13843
13866
  if (!preset)
13844
13867
  return bar(
13845
- /* @__PURE__ */ jsxs60(Fragment46, { children: [
13868
+ /* @__PURE__ */ jsxs61(Fragment46, { children: [
13846
13869
  children,
13847
13870
  /* @__PURE__ */ jsx67(ReadOnlyBadge, {})
13848
13871
  ] })
@@ -13856,7 +13879,7 @@ function StatusBar({ className, preset = true, children }) {
13856
13879
  }
13857
13880
  const part = (Part) => overrides.get(Part) ?? /* @__PURE__ */ jsx67(Part, {});
13858
13881
  return bar(
13859
- /* @__PURE__ */ jsxs60(Fragment46, { children: [
13882
+ /* @__PURE__ */ jsxs61(Fragment46, { children: [
13860
13883
  part(StatusBarSlideNumber),
13861
13884
  /* @__PURE__ */ jsx67(ReadOnlyBadge, {}),
13862
13885
  /* @__PURE__ */ jsx67("span", { className: "pptx-statusbar__spacer" }),
@@ -13869,7 +13892,7 @@ function StatusBar({ className, preset = true, children }) {
13869
13892
  }
13870
13893
 
13871
13894
  // src/HyperlinkPopup.tsx
13872
- import { useContext as useContext20, useEffect as useEffect43, useId as useId24, useMemo as useMemo20, useSyncExternalStore as useSyncExternalStore12 } from "react";
13895
+ import { useContext as useContext20, useEffect as useEffect44, useId as useId24, useMemo as useMemo20, useSyncExternalStore as useSyncExternalStore12 } from "react";
13873
13896
  import { hyperlinkPopupFromRequest } from "@pptx-editor.dev/core/editor";
13874
13897
  import { jsx as jsx68 } from "react/jsx-runtime";
13875
13898
  function HyperlinkPopup(props) {
@@ -13886,7 +13909,7 @@ function OwnState({ children, ...props }) {
13886
13909
  [editor, anchor]
13887
13910
  // eslint-disable-line react-hooks/exhaustive-deps
13888
13911
  );
13889
- useEffect43(() => () => controller.dispose(), [controller]);
13912
+ useEffect44(() => () => controller.dispose(), [controller]);
13890
13913
  const state = useSyncExternalStore12(
13891
13914
  controller.subscribe,
13892
13915
  controller.getState,
@@ -13896,7 +13919,7 @@ function OwnState({ children, ...props }) {
13896
13919
  }
13897
13920
 
13898
13921
  // src/customization-hooks.ts
13899
- import { useCallback as useCallback17, useContext as useContext21, useEffect as useEffect44, useMemo as useMemo21, useRef as useRef53, useState as useState55 } from "react";
13922
+ import { useCallback as useCallback16, useContext as useContext21, useEffect as useEffect45, useMemo as useMemo21, useRef as useRef52, useState as useState55 } from "react";
13900
13923
  import {
13901
13924
  ZOOM_LEVELS,
13902
13925
  onEditorEvent,
@@ -13908,7 +13931,7 @@ var sameZoom = (a, b) => a.zoom === b.zoom && a.fit === b.fit;
13908
13931
  function useZoom() {
13909
13932
  const editor = usePptxEditor();
13910
13933
  const { zoom, fit } = useEditorState(selectZoom, sameZoom);
13911
- const setZoom = useCallback17((next) => editor?.setZoom(next), [editor]);
13934
+ const setZoom = useCallback16((next) => editor?.setZoom(next), [editor]);
13912
13935
  return useMemo21(() => {
13913
13936
  const next = zoomStep2(zoom, 1);
13914
13937
  const previous = zoomStep2(zoom, -1);
@@ -13928,9 +13951,9 @@ function useZoom() {
13928
13951
  }
13929
13952
  function useEditorEvent(event, handler) {
13930
13953
  const editor = usePptxEditor();
13931
- const handlerRef = useRef53(handler);
13954
+ const handlerRef = useRef52(handler);
13932
13955
  handlerRef.current = handler;
13933
- useEffect44(() => {
13956
+ useEffect45(() => {
13934
13957
  if (!editor) return void 0;
13935
13958
  const forward = ((...args) => handlerRef.current(...args));
13936
13959
  return onEditorEvent(editor, event, forward);
@@ -13938,7 +13961,7 @@ function useEditorEvent(event, handler) {
13938
13961
  }
13939
13962
  function useEditorSnapshot(editor) {
13940
13963
  const [revision, setRevision] = useState55(0);
13941
- useEffect44(() => {
13964
+ useEffect45(() => {
13942
13965
  if (!editor) return void 0;
13943
13966
  const bump = () => setRevision((n) => n + 1);
13944
13967
  const off = editor.subscribe(bump);
@@ -13955,7 +13978,7 @@ function useScopeClassName() {
13955
13978
  }
13956
13979
 
13957
13980
  // src/usePptxSource.ts
13958
- import { useCallback as useCallback18, useEffect as useEffect45, useMemo as useMemo22, useRef as useRef54, useState as useState56, useSyncExternalStore as useSyncExternalStore13 } from "react";
13981
+ import { useCallback as useCallback17, useEffect as useEffect46, useMemo as useMemo22, useRef as useRef53, useState as useState56, useSyncExternalStore as useSyncExternalStore13 } from "react";
13959
13982
  import {
13960
13983
  editorHostDocument,
13961
13984
  fetchPptxSource,
@@ -13973,13 +13996,13 @@ function usePptxSource(source, options = {}) {
13973
13996
  const [documentLoading, setDocumentLoading] = useState56(source != null);
13974
13997
  const shape = pptxFontsShape(options.fonts);
13975
13998
  const [fontsSettled, setFontsSettled] = useState56(options.fonts === void 0);
13976
- const latest = useRef54(options);
13999
+ const latest = useRef53(options);
13977
14000
  latest.current = options;
13978
14001
  const resolver = useMemo22(
13979
14002
  () => pptxSourceFontsResolver(() => latest.current.fonts),
13980
14003
  []
13981
14004
  );
13982
- useEffect45(() => {
14005
+ useEffect46(() => {
13983
14006
  const fontsSource = latest.current.fonts;
13984
14007
  if (fontsSource === void 0) {
13985
14008
  setFonts(void 0);
@@ -13996,7 +14019,7 @@ function usePptxSource(source, options = {}) {
13996
14019
  release: () => setFontsSettled(true)
13997
14020
  });
13998
14021
  }, [shape]);
13999
- useEffect45(() => {
14022
+ useEffect46(() => {
14000
14023
  if (source == null) {
14001
14024
  setBytes(void 0);
14002
14025
  setError(null);
@@ -14043,11 +14066,11 @@ var NOOP_UNSUBSCRIBE = () => {
14043
14066
  };
14044
14067
  function useEditorHostDocument() {
14045
14068
  const editor = usePptxEditor();
14046
- const subscribe = useCallback18(
14069
+ const subscribe = useCallback17(
14047
14070
  (onChange) => editor ? onEditorHostChange(editor, onChange) : NOOP_UNSUBSCRIBE,
14048
14071
  [editor]
14049
14072
  );
14050
- const read = useCallback18(
14073
+ const read = useCallback17(
14051
14074
  () => editor ? editorHostDocument(editor) : typeof globalThis.document === "undefined" ? null : globalThis.document,
14052
14075
  [editor]
14053
14076
  );
@@ -14058,7 +14081,7 @@ function useEditorHostDocument() {
14058
14081
  import { gradientCss as gradientCss3 } from "@pptx-editor.dev/core/editor";
14059
14082
 
14060
14083
  // src/useParagraphFormat.ts
14061
- import { useCallback as useCallback19 } from "react";
14084
+ import { useCallback as useCallback18 } from "react";
14062
14085
  import {
14063
14086
  chromeCommandState,
14064
14087
  sameParagraphFormat
@@ -14067,7 +14090,7 @@ function useParagraphFormat() {
14067
14090
  const editor = usePptxEditor();
14068
14091
  const format = useEditorState((s) => s.format?.paragraph ?? null, sameParagraphFormat);
14069
14092
  const isEnabled = useEditorState(() => chromeCommandState(editor, "paragraph.dialog").isEnabled);
14070
- const apply = useCallback19(
14093
+ const apply = useCallback18(
14071
14094
  (update) => editor !== null && editor.exec({ ...update, type: "setParagraphFormat" }).ok,
14072
14095
  [editor]
14073
14096
  );
@@ -14075,7 +14098,7 @@ function useParagraphFormat() {
14075
14098
  }
14076
14099
 
14077
14100
  // src/useFontFormat.ts
14078
- import { useCallback as useCallback20 } from "react";
14101
+ import { useCallback as useCallback19 } from "react";
14079
14102
  import {
14080
14103
  chromeCommandState as chromeCommandState2,
14081
14104
  sameFontFormat
@@ -14084,7 +14107,7 @@ function useFontFormat() {
14084
14107
  const editor = usePptxEditor();
14085
14108
  const format = useEditorState((s) => s.format?.font ?? null, sameFontFormat);
14086
14109
  const isEnabled = useEditorState(() => chromeCommandState2(editor, "text.dialog").isEnabled);
14087
- const apply = useCallback20(
14110
+ const apply = useCallback19(
14088
14111
  (update) => editor !== null && editor.exec({ ...update, type: "setFontFormat" }).ok,
14089
14112
  [editor]
14090
14113
  );
@@ -14092,7 +14115,7 @@ function useFontFormat() {
14092
14115
  }
14093
14116
 
14094
14117
  // src/useBulletFormat.ts
14095
- import { useCallback as useCallback21 } from "react";
14118
+ import { useCallback as useCallback20 } from "react";
14096
14119
  import {
14097
14120
  sameBulletFormat
14098
14121
  } from "@pptx-editor.dev/core/editor";
@@ -14100,7 +14123,7 @@ function useBulletFormat() {
14100
14123
  const editor = usePptxEditor();
14101
14124
  const format = useEditorState((s) => s.format?.bulletFormat, sameBulletFormat);
14102
14125
  const { isEnabled } = useEditorCommand("list.bulletStyle");
14103
- const apply = useCallback21(
14126
+ const apply = useCallback20(
14104
14127
  (next) => editor !== null && editor.exec({ type: "setBulletFormat", format: next }).ok,
14105
14128
  [editor]
14106
14129
  );
@@ -14108,21 +14131,21 @@ function useBulletFormat() {
14108
14131
  }
14109
14132
 
14110
14133
  // src/useReviewAuthors.ts
14111
- import { useCallback as useCallback22 } from "react";
14134
+ import { useCallback as useCallback21 } from "react";
14112
14135
  var NONE = Object.freeze([]);
14113
14136
  function useReviewAuthors() {
14114
14137
  const editor = usePptxEditor();
14115
- return useEditorState(useCallback22(() => editor?.getReviewAuthors() ?? NONE, [editor]));
14138
+ return useEditorState(useCallback21(() => editor?.getReviewAuthors() ?? NONE, [editor]));
14116
14139
  }
14117
14140
 
14118
14141
  // src/useFonts.ts
14119
- import { useMemo as useMemo23, useRef as useRef55 } from "react";
14142
+ import { useMemo as useMemo23, useRef as useRef54 } from "react";
14120
14143
  import {
14121
14144
  composeFontOrigins,
14122
14145
  defineFontResolver
14123
14146
  } from "@pptx-editor.dev/core/editor";
14124
14147
  function useFonts(...origins) {
14125
- const latest = useRef55(origins);
14148
+ const latest = useRef54(origins);
14126
14149
  latest.current = origins;
14127
14150
  return useMemo23(
14128
14151
  () => defineFontResolver(
@@ -14138,7 +14161,7 @@ function useFonts(...origins) {
14138
14161
  }
14139
14162
 
14140
14163
  // src/useFontFamily.ts
14141
- import { useCallback as useCallback23, useMemo as useMemo24 } from "react";
14164
+ import { useCallback as useCallback22, useMemo as useMemo24 } from "react";
14142
14165
  import {
14143
14166
  fontPickerGroups as fontPickerGroups2,
14144
14167
  isCurrentFontRow as isCurrentFontRow2
@@ -14161,8 +14184,8 @@ function useFontFamily() {
14161
14184
  [editor, slide, revision]
14162
14185
  );
14163
14186
  const { execute } = cmd;
14164
- const setValue = useCallback23((family) => void execute(family), [execute]);
14165
- const isCurrent = useCallback23(
14187
+ const setValue = useCallback22((family) => void execute(family), [execute]);
14188
+ const isCurrent = useCallback22(
14166
14189
  (row) => !row.disabled && isCurrentFontRow2(row, value, theme),
14167
14190
  [value, theme]
14168
14191
  );