@pptx-editor.dev/vue 0.6.0 → 0.6.1-canary.20261119032858.sha-95106bb

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +559 -464
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  getCurrentInstance as getCurrentInstance3,
5
5
  h as h22,
6
6
  mergeProps as mergeProps2,
7
- shallowRef as shallowRef38
7
+ shallowRef as shallowRef39
8
8
  } from "vue";
9
9
  import {
10
10
  createEditorRefApi as createEditorRefApi2,
@@ -20,8 +20,8 @@ import {
20
20
  onMounted as onMounted22,
21
21
  onUnmounted as onUnmounted6,
22
22
  provide as provide18,
23
- shallowRef as shallowRef32,
24
- watch as watch39
23
+ shallowRef as shallowRef33,
24
+ watch as watch38
25
25
  } from "vue";
26
26
  import {
27
27
  churnWarning,
@@ -8729,12 +8729,12 @@ function useCanvasContextMenu() {
8729
8729
  import {
8730
8730
  computed as computed24,
8731
8731
  defineComponent as defineComponent57,
8732
- onBeforeUnmount as onBeforeUnmount13,
8732
+ onBeforeUnmount as onBeforeUnmount14,
8733
8733
  onMounted as onMounted20,
8734
8734
  onUpdated as onUpdated5,
8735
- ref as ref41,
8736
- shallowRef as shallowRef30,
8737
- watch as watch37
8735
+ ref as ref40,
8736
+ shallowRef as shallowRef31,
8737
+ watch as watch36
8738
8738
  } from "vue";
8739
8739
  import {
8740
8740
  STATUS_BAR_VIEW_OPTIONS,
@@ -8913,15 +8913,15 @@ import {
8913
8913
  computed as computed22,
8914
8914
  defineComponent as defineComponent55,
8915
8915
  nextTick as nextTick9,
8916
- onBeforeUnmount as onBeforeUnmount11,
8916
+ onBeforeUnmount as onBeforeUnmount12,
8917
8917
  onMounted as onMounted19,
8918
8918
  onUnmounted as onUnmounted4,
8919
8919
  onUpdated as onUpdated4,
8920
8920
  provide as provide17,
8921
- ref as ref40,
8922
- shallowRef as shallowRef28,
8921
+ ref as ref39,
8922
+ shallowRef as shallowRef29,
8923
8923
  useId as useId21,
8924
- watch as watch35
8924
+ watch as watch34
8925
8925
  } from "vue";
8926
8926
  import {
8927
8927
  ZOOM_MENU_LEVELS,
@@ -12212,8 +12212,8 @@ import {
12212
12212
  defineComponent as defineComponent54,
12213
12213
  nextTick as nextTick8,
12214
12214
  onMounted as onMounted18,
12215
- ref as ref39,
12216
- watch as watch34
12215
+ ref as ref38,
12216
+ watch as watch33
12217
12217
  } from "vue";
12218
12218
  import {
12219
12219
  listenPaneRequests,
@@ -12526,7 +12526,7 @@ var PptxEditorSelectionPane = defineComponent43({
12526
12526
  });
12527
12527
 
12528
12528
  // src/AnimationsPane.tsx
12529
- import { computed as computed20, defineComponent as defineComponent44, onBeforeUnmount as onBeforeUnmount10, ref as ref31, useId as useId17, watch as watch30 } from "vue";
12529
+ import { computed as computed20, defineComponent as defineComponent44, onBeforeUnmount as onBeforeUnmount11, ref as ref31, useId as useId17, watch as watch31 } from "vue";
12530
12530
  import {
12531
12531
  ANIMATION_PRESET_GROUPS,
12532
12532
  ANIMATION_TRIGGERS,
@@ -12535,9 +12535,46 @@ import {
12535
12535
  animationListParts,
12536
12536
  animationStartLabel,
12537
12537
  parseSeconds,
12538
+ sameFormatNumber,
12538
12539
  secondsText,
12539
12540
  transitionKindLabelKey
12540
12541
  } from "@pptx-editor.dev/core/editor";
12542
+
12543
+ // src/live-field.ts
12544
+ import { onBeforeUnmount as onBeforeUnmount10, shallowRef as shallowRef28, watch as watch30 } from "vue";
12545
+ import { createLiveField } from "@pptx-editor.dev/core/editor";
12546
+ function useLiveField(host, scope) {
12547
+ const version = shallowRef28(0);
12548
+ const field = createLiveField(host, () => {
12549
+ version.value++;
12550
+ });
12551
+ watch30(
12552
+ scope,
12553
+ () => {
12554
+ field.sync();
12555
+ version.value++;
12556
+ },
12557
+ { flush: "sync" }
12558
+ );
12559
+ onBeforeUnmount10(() => field.dispose());
12560
+ return {
12561
+ get draft() {
12562
+ void version.value;
12563
+ return field.draft;
12564
+ },
12565
+ get error() {
12566
+ void version.value;
12567
+ return field.error;
12568
+ },
12569
+ input: (text2, composing) => field.input(text2, composing),
12570
+ commit: () => field.commit(),
12571
+ cancel: () => field.cancel(),
12572
+ sync: () => field.sync(),
12573
+ dispose: () => field.dispose()
12574
+ };
12575
+ }
12576
+
12577
+ // src/AnimationsPane.tsx
12541
12578
  import { jsx as jsx36, jsxs as jsxs30 } from "vue/jsx-runtime";
12542
12579
  var SecondsField = defineComponent44({
12543
12580
  name: "PptxAnimationSecondsField",
@@ -12545,52 +12582,60 @@ var SecondsField = defineComponent44({
12545
12582
  label: { type: String, required: true },
12546
12583
  ms: { type: Number, required: true },
12547
12584
  disabled: { type: Boolean, required: true },
12548
- onCommit: { type: Function, required: true }
12585
+ onCommit: {
12586
+ type: Function,
12587
+ required: true
12588
+ }
12549
12589
  },
12550
12590
  setup(props) {
12551
12591
  const { t } = useTranslation();
12592
+ const editor = usePptxEditor();
12552
12593
  const errorId = useId17();
12553
- const draft = ref31(null);
12554
- const invalid = ref31(false);
12555
- const reset = () => {
12556
- draft.value = null;
12557
- invalid.value = false;
12558
- };
12559
- const commit = () => {
12560
- const d = draft.value;
12561
- if (d === null) return;
12562
- const shown = secondsText(props.ms);
12563
- const value = d === shown ? null : parseSeconds(d);
12564
- if (d === shown || value !== null && props.onCommit(value)) reset();
12565
- else invalid.value = true;
12566
- };
12567
- return () => /* @__PURE__ */ jsxs30("label", { class: "pptx-field", children: [
12568
- props.label,
12569
- /* @__PURE__ */ jsxs30("span", { class: "pptx-field__control", children: [
12570
- /* @__PURE__ */ jsx36(
12571
- "input",
12572
- {
12573
- inputmode: "decimal",
12574
- "aria-label": props.label,
12575
- "aria-invalid": invalid.value,
12576
- "aria-describedby": invalid.value ? errorId : void 0,
12577
- value: draft.value ?? secondsText(props.ms),
12578
- disabled: props.disabled,
12579
- "data-draft": draft.value !== null,
12580
- onInput: (e) => {
12581
- draft.value = e.target.value;
12582
- },
12583
- onBlur: commit,
12584
- onKeydown: (e) => {
12585
- if (e.key === "Enter") commit();
12586
- if (e.key === "Escape") reset();
12594
+ const field = useLiveField(
12595
+ () => ({
12596
+ editor: editor.value,
12597
+ value: () => secondsText(props.ms),
12598
+ same: sameFormatNumber,
12599
+ write(text2, options, final) {
12600
+ const value = parseSeconds(text2);
12601
+ if (value !== null && props.onCommit(value, options)) return null;
12602
+ return final ? t("panel.animations.invalidTime") : void 0;
12603
+ }
12604
+ }),
12605
+ () => props.ms
12606
+ );
12607
+ return () => {
12608
+ const invalid = field.error !== null;
12609
+ return /* @__PURE__ */ jsxs30("label", { class: "pptx-field", children: [
12610
+ props.label,
12611
+ /* @__PURE__ */ jsxs30("span", { class: "pptx-field__control", children: [
12612
+ /* @__PURE__ */ jsx36(
12613
+ "input",
12614
+ {
12615
+ inputmode: "decimal",
12616
+ "aria-label": props.label,
12617
+ "aria-invalid": invalid,
12618
+ "aria-describedby": invalid ? errorId : void 0,
12619
+ value: field.draft ?? secondsText(props.ms),
12620
+ disabled: props.disabled,
12621
+ "data-draft": field.draft !== null,
12622
+ onInput: (e) => field.input(
12623
+ e.target.value,
12624
+ e.isComposing === true
12625
+ ),
12626
+ onCompositionend: (e) => field.input(e.target.value),
12627
+ onBlur: () => field.commit(),
12628
+ onKeydown: (e) => {
12629
+ if (e.key === "Enter") field.commit();
12630
+ if (e.key === "Escape") field.cancel();
12631
+ }
12587
12632
  }
12588
- }
12589
- ),
12590
- /* @__PURE__ */ jsx36("span", { class: "pptx-field__unit", children: t("panel.animations.secondsUnit") })
12591
- ] }),
12592
- invalid.value ? /* @__PURE__ */ jsx36("span", { id: errorId, class: "pptx-animations__error", role: "alert", children: t("panel.animations.invalidTime") }) : null
12593
- ] });
12633
+ ),
12634
+ /* @__PURE__ */ jsx36("span", { class: "pptx-field__unit", children: t("panel.animations.secondsUnit") })
12635
+ ] }),
12636
+ invalid ? /* @__PURE__ */ jsx36("span", { id: errorId, class: "pptx-animations__error", role: "alert", children: field.error }) : null
12637
+ ] });
12638
+ };
12594
12639
  }
12595
12640
  });
12596
12641
  var TransitionSection = defineComponent44({
@@ -12602,7 +12647,7 @@ var TransitionSection = defineComponent44({
12602
12647
  const transition = useEditorState((s) => s.animations?.transition);
12603
12648
  const slideCount = useEditorState((s) => s.slides.length);
12604
12649
  const kindId = useId17();
12605
- const set = (change) => editor.value?.exec({ type: "setTransition", ...change }).ok === true;
12650
+ const set = (change, options) => editor.value?.exec({ type: "setTransition", ...change }, options).ok === true;
12606
12651
  return () => {
12607
12652
  const tr = transition.value;
12608
12653
  if (!tr) return null;
@@ -12633,7 +12678,7 @@ var TransitionSection = defineComponent44({
12633
12678
  label: t("panel.animations.duration"),
12634
12679
  ms: tr.durationMs,
12635
12680
  disabled: disabled || tr.kind === "none",
12636
- onCommit: (ms) => set({ durationMs: ms })
12681
+ onCommit: (ms, options) => set({ durationMs: ms }, options)
12637
12682
  }
12638
12683
  ),
12639
12684
  /* @__PURE__ */ jsx36(
@@ -12642,7 +12687,7 @@ var TransitionSection = defineComponent44({
12642
12687
  label: t("panel.animations.advanceAfter"),
12643
12688
  ms: tr.advanceAfterMs ?? 0,
12644
12689
  disabled: disabled || tr.advanceAfterMs === null,
12645
- onCommit: (ms) => set({ advanceAfterMs: ms })
12690
+ onCommit: (ms, options) => set({ advanceAfterMs: ms }, options)
12646
12691
  }
12647
12692
  )
12648
12693
  ] }),
@@ -12750,7 +12795,7 @@ var EffectFields = defineComponent44({
12750
12795
  return () => {
12751
12796
  const effect = props.effect;
12752
12797
  const off = props.disabled || !effect.editable;
12753
- const timing = (change) => editor.value?.exec({ type: "setAnimationTiming", effectId: effect.id, ...change }).ok === true;
12798
+ const timing = (change, options) => editor.value?.exec({ type: "setAnimationTiming", effectId: effect.id, ...change }, options).ok === true;
12754
12799
  const move = (to) => editor.value?.exec({ type: "moveAnimation", effectId: effect.id, to });
12755
12800
  return /* @__PURE__ */ jsxs30("div", { class: "pptx-panel__section pptx-animations__fields", children: [
12756
12801
  /* @__PURE__ */ jsxs30("label", { class: "pptx-field", for: startId, children: [
@@ -12774,7 +12819,7 @@ var EffectFields = defineComponent44({
12774
12819
  label: t("panel.animations.delay"),
12775
12820
  ms: effect.delayMs,
12776
12821
  disabled: off,
12777
- onCommit: (ms) => timing({ delayMs: ms })
12822
+ onCommit: (ms, options) => timing({ delayMs: ms }, options)
12778
12823
  }
12779
12824
  ),
12780
12825
  /* @__PURE__ */ jsx36(
@@ -12783,7 +12828,7 @@ var EffectFields = defineComponent44({
12783
12828
  label: t("panel.animations.duration"),
12784
12829
  ms: effect.durationMs ?? 0,
12785
12830
  disabled: off || effect.durationMs === null,
12786
- onCommit: (ms) => timing({ durationMs: ms })
12831
+ onCommit: (ms, options) => timing({ durationMs: ms }, options)
12787
12832
  }
12788
12833
  )
12789
12834
  ] }),
@@ -12833,7 +12878,7 @@ var AnimationsPane = defineComponent44({
12833
12878
  const chosen = ref31(null);
12834
12879
  const presetId = useId17();
12835
12880
  const listId = useId17();
12836
- watch30(
12881
+ watch31(
12837
12882
  editor,
12838
12883
  (e, _old, onCleanup) => {
12839
12884
  if (!e) return;
@@ -12842,7 +12887,7 @@ var AnimationsPane = defineComponent44({
12842
12887
  },
12843
12888
  { immediate: true }
12844
12889
  );
12845
- onBeforeUnmount10(() => void editor.value?.exec({ type: "showAnimationOrder", show: false }));
12890
+ onBeforeUnmount11(() => void editor.value?.exec({ type: "showAnimationOrder", show: false }));
12846
12891
  const effects = computed20(() => animations.value?.effects ?? []);
12847
12892
  const add = () => {
12848
12893
  const e = editor.value;
@@ -12930,7 +12975,7 @@ var AnimationsPane = defineComponent44({
12930
12975
  });
12931
12976
 
12932
12977
  // src/ChartDataPane.tsx
12933
- import { defineComponent as defineComponent45, ref as ref32, useId as useId18, watch as watch31 } from "vue";
12978
+ import { defineComponent as defineComponent45, ref as ref32, useId as useId18 } from "vue";
12934
12979
  import {
12935
12980
  CHART_LEGEND_CHOICES,
12936
12981
  CHART_TYPE_CHOICES,
@@ -12948,7 +12993,8 @@ import {
12948
12993
  focusChartRow,
12949
12994
  colorPickOf as colorPickOf2,
12950
12995
  nextChartCategoryLabel,
12951
- renderedColorOf as renderedColorOf2
12996
+ renderedColorOf as renderedColorOf2,
12997
+ sameFormatNumber as sameFormatNumber2
12952
12998
  } from "@pptx-editor.dev/core/editor";
12953
12999
  import { Fragment as Fragment23, jsx as jsx37, jsxs as jsxs31 } from "vue/jsx-runtime";
12954
13000
  var ChartField = defineComponent45({
@@ -12960,49 +13006,55 @@ var ChartField = defineComponent45({
12960
13006
  value: { type: String, required: true },
12961
13007
  numeric: { type: Boolean, default: false },
12962
13008
  disabled: { type: Boolean, required: true },
12963
- onCommit: { type: Function, required: true }
13009
+ onCommit: {
13010
+ type: Function,
13011
+ required: true
13012
+ }
12964
13013
  },
12965
13014
  setup(props) {
12966
13015
  const errorId = useId18();
12967
- const draft = ref32(null);
12968
- const error = ref32(null);
12969
- const reset = () => {
12970
- draft.value = null;
12971
- error.value = null;
12972
- };
12973
- watch31(() => props.draftKey, reset, { flush: "sync" });
12974
- const commit = () => {
12975
- const d = draft.value;
12976
- if (d === null) return;
12977
- if (d === props.value) return reset();
12978
- const refused = props.onCommit(d);
12979
- if (refused === null) reset();
12980
- else error.value = refused;
12981
- };
12982
- return () => /* @__PURE__ */ jsxs31("label", { class: "pptx-field pptx-chart-pane__field", children: [
12983
- props.visibleLabel ? /* @__PURE__ */ jsx37("span", { class: "pptx-chart-pane__label", children: props.visibleLabel }) : null,
12984
- /* @__PURE__ */ jsx37(
12985
- "input",
12986
- {
12987
- "aria-label": props.label,
12988
- inputmode: props.numeric ? "decimal" : void 0,
12989
- "aria-invalid": error.value !== null,
12990
- "aria-describedby": error.value !== null ? errorId : void 0,
12991
- value: draft.value ?? props.value,
12992
- disabled: props.disabled,
12993
- "data-draft": draft.value !== null,
12994
- onInput: (e) => {
12995
- draft.value = e.target.value;
12996
- },
12997
- onBlur: commit,
12998
- onKeydown: (e) => {
12999
- if (e.key === "Enter") commit();
13000
- if (e.key === "Escape") reset();
13001
- }
13016
+ const editor = usePptxEditor();
13017
+ const field = useLiveField(
13018
+ () => ({
13019
+ editor: editor.value,
13020
+ value: () => props.value,
13021
+ ...props.numeric ? { same: sameFormatNumber2 } : {},
13022
+ write: (text2, options, final) => {
13023
+ const refused = props.onCommit(text2, options);
13024
+ return refused === null || final ? refused : void 0;
13002
13025
  }
13003
- ),
13004
- error.value !== null ? /* @__PURE__ */ jsx37("span", { id: errorId, class: "pptx-chart-pane__error", role: "alert", children: error.value }) : null
13005
- ] });
13026
+ }),
13027
+ () => `${props.draftKey}\0${props.value}`
13028
+ );
13029
+ return () => {
13030
+ const error = field.error;
13031
+ return /* @__PURE__ */ jsxs31("label", { class: "pptx-field pptx-chart-pane__field", children: [
13032
+ props.visibleLabel ? /* @__PURE__ */ jsx37("span", { class: "pptx-chart-pane__label", children: props.visibleLabel }) : null,
13033
+ /* @__PURE__ */ jsx37(
13034
+ "input",
13035
+ {
13036
+ "aria-label": props.label,
13037
+ inputmode: props.numeric ? "decimal" : void 0,
13038
+ "aria-invalid": error !== null,
13039
+ "aria-describedby": error !== null ? errorId : void 0,
13040
+ value: field.draft ?? props.value,
13041
+ disabled: props.disabled,
13042
+ "data-draft": field.draft !== null,
13043
+ onInput: (e) => field.input(
13044
+ e.target.value,
13045
+ e.isComposing === true
13046
+ ),
13047
+ onCompositionend: (e) => field.input(e.target.value),
13048
+ onBlur: () => field.commit(),
13049
+ onKeydown: (e) => {
13050
+ if (e.key === "Enter") field.commit();
13051
+ if (e.key === "Escape") field.cancel();
13052
+ }
13053
+ }
13054
+ ),
13055
+ error !== null ? /* @__PURE__ */ jsx37("span", { id: errorId, class: "pptx-chart-pane__error", role: "alert", children: error }) : null
13056
+ ] });
13057
+ };
13006
13058
  }
13007
13059
  });
13008
13060
  var SeriesCard = defineComponent45({
@@ -13044,7 +13096,7 @@ var SeriesCard = defineComponent45({
13044
13096
  visibleLabel: t("chartData.name"),
13045
13097
  value: series.name,
13046
13098
  disabled,
13047
- onCommit: (text2) => props.apply({ type: "seriesName", series: index, text: text2 })
13099
+ onCommit: (text2, options) => props.apply({ type: "seriesName", series: index, text: text2 }, options)
13048
13100
  }
13049
13101
  ),
13050
13102
  /* @__PURE__ */ jsx37("div", { class: "pptx-panel__grid", children: data.categories.map((c, i) => /* @__PURE__ */ jsx37(
@@ -13056,7 +13108,7 @@ var SeriesCard = defineComponent45({
13056
13108
  value: chartValueText(series.values[i]),
13057
13109
  numeric: true,
13058
13110
  disabled,
13059
- onCommit: (text2) => props.apply({ type: "value", series: index, category: i, text: text2 })
13111
+ onCommit: (text2, options) => props.apply({ type: "value", series: index, category: i, text: text2 }, options)
13060
13112
  },
13061
13113
  i
13062
13114
  )) }),
@@ -13181,7 +13233,7 @@ var ChartFormatSection = defineComponent45({
13181
13233
  visibleLabel: t("chartFormat.titleText"),
13182
13234
  value: format.title,
13183
13235
  disabled,
13184
- onCommit: (text2) => run(chartTitleCommand(format, "title", text2))
13236
+ onCommit: (text2, options) => run(chartTitleCommand(format, "title", text2), options)
13185
13237
  }
13186
13238
  ) }) : null,
13187
13239
  /* @__PURE__ */ jsx37(
@@ -13234,7 +13286,7 @@ var ChartFormatSection = defineComponent45({
13234
13286
  visibleLabel: t(axisLabels.category),
13235
13287
  value: format.axisTitles?.category ?? "",
13236
13288
  disabled: disabled || !format.axes,
13237
- onCommit: (text2) => run(chartTitleCommand(format, "categoryAxisTitle", text2))
13289
+ onCommit: (text2, options) => run(chartTitleCommand(format, "categoryAxisTitle", text2), options)
13238
13290
  }
13239
13291
  ),
13240
13292
  /* @__PURE__ */ jsx37(
@@ -13245,7 +13297,7 @@ var ChartFormatSection = defineComponent45({
13245
13297
  visibleLabel: t(axisLabels.value),
13246
13298
  value: format.axisTitles?.value ?? "",
13247
13299
  disabled: disabled || !format.axes,
13248
- onCommit: (text2) => run(chartTitleCommand(format, "valueAxisTitle", text2))
13300
+ onCommit: (text2, options) => run(chartTitleCommand(format, "valueAxisTitle", text2), options)
13249
13301
  }
13250
13302
  )
13251
13303
  ] }),
@@ -13315,19 +13367,19 @@ var ChartDataPane = defineComponent45({
13315
13367
  }
13316
13368
  const draftKey = String(draftScope.reset);
13317
13369
  const disabled = readOnly.value || !selected.editable;
13318
- const apply = (change) => {
13370
+ const apply = (change, options) => {
13319
13371
  const command = chartPaneCommand(data, change);
13320
13372
  if (!command.ok) return t(command.error);
13321
- const result = editor.value?.exec(command.command);
13373
+ const result = editor.value?.exec(command.command, options);
13322
13374
  refusal.value = null;
13323
13375
  return !result || result.ok ? null : t(result.reason);
13324
13376
  };
13325
- const runFormat = (command) => {
13377
+ const runFormat = (command, options) => {
13326
13378
  if (!command) {
13327
13379
  refusal.value = null;
13328
13380
  return null;
13329
13381
  }
13330
- const result = editor.value?.exec(command);
13382
+ const result = editor.value?.exec(command, options);
13331
13383
  const reason = !result || result.ok ? null : t(result.reason);
13332
13384
  refusal.value = reason;
13333
13385
  return reason;
@@ -13366,7 +13418,7 @@ var ChartDataPane = defineComponent45({
13366
13418
  value: c.label,
13367
13419
  numeric: xy,
13368
13420
  disabled,
13369
- onCommit: (text2) => apply({ type: "label", category: i, text: text2 })
13421
+ onCommit: (text2, options) => apply({ type: "label", category: i, text: text2 }, options)
13370
13422
  }
13371
13423
  ),
13372
13424
  /* @__PURE__ */ jsx37(
@@ -13454,53 +13506,58 @@ var NodeField = defineComponent46({
13454
13506
  readOnly: { type: Boolean, required: true },
13455
13507
  /** The id of a note that describes the field, if any. */
13456
13508
  note: { type: String, default: void 0 },
13457
- onCommit: { type: Function, required: true }
13509
+ onCommit: {
13510
+ type: Function,
13511
+ required: true
13512
+ }
13458
13513
  },
13459
13514
  setup(props) {
13460
13515
  const errorId = useId19();
13461
- const draft = ref33(null);
13462
- const error = ref33(null);
13463
- const reset = () => {
13464
- draft.value = null;
13465
- error.value = null;
13466
- };
13467
- const commit = () => {
13468
- const d = draft.value;
13469
- if (d === null) return;
13470
- if (d === props.value) return reset();
13471
- const refused = props.onCommit(d);
13472
- if (refused === null) reset();
13473
- else error.value = refused;
13474
- };
13516
+ const editor = usePptxEditor();
13517
+ const field = useLiveField(
13518
+ () => ({
13519
+ editor: editor.value,
13520
+ value: () => props.value,
13521
+ write: (text2, options, final) => {
13522
+ const refused = props.onCommit(text2, options);
13523
+ return refused === null || final ? refused : void 0;
13524
+ }
13525
+ }),
13526
+ () => props.value
13527
+ );
13475
13528
  return () => {
13476
- const shown = draft.value ?? props.value;
13529
+ const draft = field.draft;
13530
+ const error = field.error;
13531
+ const shown = draft ?? props.value;
13477
13532
  return /* @__PURE__ */ jsxs32("label", { class: "pptx-field pptx-diagram-pane__field", children: [
13478
13533
  /* @__PURE__ */ jsx38(
13479
13534
  "textarea",
13480
13535
  {
13481
13536
  "aria-label": props.label,
13482
- "aria-invalid": error.value !== null,
13483
- "aria-describedby": [error.value !== null ? errorId : null, props.note].filter(Boolean).join(" ") || void 0,
13537
+ "aria-invalid": error !== null,
13538
+ "aria-describedby": [error !== null ? errorId : null, props.note].filter(Boolean).join(" ") || void 0,
13484
13539
  rows: Math.min(6, shown.split("\n").length),
13485
13540
  value: shown,
13486
13541
  readonly: props.readOnly,
13487
13542
  "data-node": props.node,
13488
- "data-draft": draft.value !== null,
13489
- onInput: (e) => {
13490
- draft.value = e.target.value;
13491
- },
13492
- onBlur: commit,
13543
+ "data-draft": draft !== null,
13544
+ onInput: (e) => field.input(
13545
+ e.target.value,
13546
+ e.isComposing === true
13547
+ ),
13548
+ onCompositionend: (e) => field.input(e.target.value),
13549
+ onBlur: () => field.commit(),
13493
13550
  onKeydown: (e) => {
13494
13551
  if (e.key === "Enter" && !e.shiftKey && !e.isComposing) {
13495
13552
  e.preventDefault();
13496
13553
  e.stopPropagation();
13497
- commit();
13554
+ field.commit();
13498
13555
  }
13499
- if (e.key === "Escape") reset();
13556
+ if (e.key === "Escape") field.cancel();
13500
13557
  }
13501
13558
  }
13502
13559
  ),
13503
- error.value !== null ? /* @__PURE__ */ jsx38("span", { id: errorId, class: "pptx-chart-pane__error", role: "alert", children: error.value }) : null
13560
+ error !== null ? /* @__PURE__ */ jsx38("span", { id: errorId, class: "pptx-chart-pane__error", role: "alert", children: error }) : null
13504
13561
  ] });
13505
13562
  };
13506
13563
  }
@@ -13530,8 +13587,8 @@ var DiagramTextPane = defineComponent46({
13530
13587
  /* @__PURE__ */ jsx38("p", { class: "pptx-empty__body", children: t("diagram.pane.emptyBody") })
13531
13588
  ] });
13532
13589
  const frame = selected.nodeId;
13533
- const apply = (command) => {
13534
- const result = editor.value?.exec(command);
13590
+ const apply = (command, options) => {
13591
+ const result = editor.value?.exec(command, options);
13535
13592
  return !result || result.ok ? null : t(result.reason);
13536
13593
  };
13537
13594
  const run = (command, index) => {
@@ -13575,7 +13632,10 @@ var DiagramTextPane = defineComponent46({
13575
13632
  node: node.node,
13576
13633
  readOnly: readOnly.value || !node.editable,
13577
13634
  note: node.editable ? void 0 : `${noteId}-${i}`,
13578
- onCommit: (text2) => apply({ type: "setDiagramText", nodeId: frame, node: node.node, text: text2 })
13635
+ onCommit: (text2, options) => apply(
13636
+ { type: "setDiagramText", nodeId: frame, node: node.node, text: text2 },
13637
+ options
13638
+ )
13579
13639
  }
13580
13640
  ),
13581
13641
  /* @__PURE__ */ jsxs32("div", { class: "pptx-diagram-pane__actions", children: [
@@ -13649,8 +13709,8 @@ var DiagramTextPane = defineComponent46({
13649
13709
  // src/FormatPanel.tsx
13650
13710
  import {
13651
13711
  defineComponent as defineComponent53,
13652
- ref as ref38,
13653
- watch as watch33
13712
+ ref as ref37,
13713
+ watch as watch32
13654
13714
  } from "vue";
13655
13715
  import {
13656
13716
  chromeControlForSlot as chromeControlForSlot7,
@@ -13665,10 +13725,18 @@ import {
13665
13725
 
13666
13726
  // src/FormatLineWidth.tsx
13667
13727
  import { defineComponent as defineComponent48 } from "vue";
13668
- import { formatLineState, formatTargetKey as formatTargetKey2, translateKeyOrText as translateKeyOrText16 } from "@pptx-editor.dev/core/editor";
13728
+ import {
13729
+ formatLineState,
13730
+ formatTargetKey as formatTargetKey2,
13731
+ translateKeyOrText as translateKeyOrText16
13732
+ } from "@pptx-editor.dev/core/editor";
13669
13733
 
13670
13734
  // src/FormatNumberField.tsx
13671
- import { defineComponent as defineComponent47, ref as ref34, watch as watch32, useId as useId20 } from "vue";
13735
+ import { defineComponent as defineComponent47, useId as useId20 } from "vue";
13736
+ import {
13737
+ parseFormatNumber,
13738
+ sameFormatNumber as sameFormatNumber3
13739
+ } from "@pptx-editor.dev/core/editor";
13672
13740
  import { jsx as jsx39, jsxs as jsxs33 } from "vue/jsx-runtime";
13673
13741
  var FormatNumberField = defineComponent47({
13674
13742
  name: "FormatNumberField",
@@ -13682,74 +13750,99 @@ var FormatNumberField = defineComponent47({
13682
13750
  exclusiveMin: Boolean,
13683
13751
  mixed: { type: Boolean, default: true },
13684
13752
  max: Number,
13685
- onCommit: { type: Function, required: true }
13753
+ /** The Arrow Up and Arrow Down increment. Shift multiplies it by 10. */
13754
+ step: { type: Number, default: 1 },
13755
+ /** Show the label beside the field, as the other rows of a format section do. */
13756
+ inline: Boolean,
13757
+ /** The hint for a field without a value that is not a mixed selection. */
13758
+ placeholder: { type: String, default: void 0 },
13759
+ onCommit: {
13760
+ type: Function,
13761
+ required: true
13762
+ }
13686
13763
  },
13687
13764
  setup(props) {
13688
13765
  const { t } = useTranslation();
13766
+ const editor = usePptxEditor();
13689
13767
  const errorId = useId20();
13690
- const draft = ref34(null);
13691
- const error = ref34(null);
13692
- const reset = () => {
13693
- draft.value = null;
13694
- error.value = null;
13695
- };
13696
- watch32(() => props.value, reset, { flush: "sync" });
13697
- const commit = () => {
13698
- if (draft.value === null) return;
13699
- const number = draft.value.trim() === "" ? NaN : Number(draft.value.replace(",", "."));
13700
- if (!Number.isFinite(number) || props.min !== void 0 && (number < props.min || props.exclusiveMin && number === props.min) || props.max !== void 0 && number > props.max) {
13701
- error.value = props.min !== void 0 && props.max !== void 0 ? t(props.exclusiveMin ? "inspector.numberRangeExclusive" : "inspector.numberRange", {
13702
- min: props.min,
13703
- max: props.max
13704
- }) : props.min !== void 0 ? t("inspector.numberMinimum", { min: props.min }) : t("disabled.invalidValue");
13705
- return;
13706
- }
13707
- if (props.value !== null && number === Number(props.value)) return reset();
13708
- const refused = props.onCommit(number);
13709
- if (refused) error.value = refused;
13710
- else reset();
13768
+ const field = useLiveField(
13769
+ () => ({
13770
+ editor: editor.value,
13771
+ value: () => props.value,
13772
+ same: sameFormatNumber3,
13773
+ write(text2, options, final) {
13774
+ const parsed = parseFormatNumber(text2, {
13775
+ min: props.min,
13776
+ max: props.max,
13777
+ exclusiveMin: props.exclusiveMin
13778
+ });
13779
+ if (!parsed.ok)
13780
+ return final || !parsed.incomplete ? t(parsed.key, parsed.params) : void 0;
13781
+ if (props.value !== null && parsed.value === Number(props.value)) return null;
13782
+ return props.onCommit(parsed.value, options);
13783
+ }
13784
+ }),
13785
+ () => props.value
13786
+ );
13787
+ const nudge = (direction, large) => {
13788
+ const parsed = parseFormatNumber(field.draft ?? props.value ?? "", {});
13789
+ if (!parsed.ok) return;
13790
+ const delta = direction * props.step * (large ? 10 : 1);
13791
+ let next = Math.round((parsed.value + delta) * 1e3) / 1e3;
13792
+ if (props.max !== void 0) next = Math.min(props.max, next);
13793
+ if (props.min !== void 0) next = Math.max(props.min, next);
13794
+ if (props.exclusiveMin && props.min !== void 0 && next <= props.min) return;
13795
+ field.input(String(next));
13711
13796
  };
13712
- return () => /* @__PURE__ */ jsxs33("label", { class: "pptx-field", children: [
13713
- props.label,
13714
- /* @__PURE__ */ jsxs33("span", { class: "pptx-field__control", children: [
13715
- /* @__PURE__ */ jsx39(
13716
- "input",
13717
- {
13718
- inputmode: "decimal",
13719
- "aria-label": props.label,
13720
- "data-format-property": props.property,
13721
- value: draft.value ?? props.value ?? "",
13722
- placeholder: props.value === null && props.mixed ? t("inspector.mixed") : void 0,
13723
- disabled: props.disabled,
13724
- "aria-invalid": !!error.value,
13725
- "aria-describedby": error.value ? errorId : void 0,
13726
- "data-draft": draft.value !== null,
13727
- onInput: (e) => {
13728
- draft.value = e.target.value;
13729
- },
13730
- onBlur: commit,
13731
- onKeydown: (e) => {
13732
- if (e.key === "Enter" && !e.isComposing) {
13733
- e.preventDefault();
13734
- commit();
13735
- }
13736
- if (e.key === "Escape") {
13737
- e.preventDefault();
13738
- e.stopPropagation();
13739
- reset();
13797
+ return () => {
13798
+ const error = field.error;
13799
+ return /* @__PURE__ */ jsxs33("label", { class: props.inline ? "pptx-field pptx-field--inline" : "pptx-field", children: [
13800
+ props.inline ? /* @__PURE__ */ jsx39("span", { class: "pptx-field__label", children: props.label }) : props.label,
13801
+ /* @__PURE__ */ jsxs33("span", { class: "pptx-field__control", children: [
13802
+ /* @__PURE__ */ jsx39(
13803
+ "input",
13804
+ {
13805
+ inputmode: "decimal",
13806
+ "aria-label": props.label,
13807
+ "data-format-property": props.property,
13808
+ value: field.draft ?? props.value ?? "",
13809
+ placeholder: props.value === null ? props.mixed ? t("inspector.mixed") : props.placeholder : void 0,
13810
+ disabled: props.disabled,
13811
+ "aria-invalid": !!error,
13812
+ "aria-describedby": error ? errorId : void 0,
13813
+ "data-draft": field.draft !== null,
13814
+ onInput: (e) => field.input(
13815
+ e.target.value,
13816
+ e.isComposing === true
13817
+ ),
13818
+ onCompositionend: (e) => field.input(e.target.value),
13819
+ onBlur: () => field.commit(),
13820
+ onKeydown: (e) => {
13821
+ if (e.isComposing) return;
13822
+ if (e.key === "Enter") {
13823
+ e.preventDefault();
13824
+ field.commit();
13825
+ } else if (e.key === "Escape") {
13826
+ e.preventDefault();
13827
+ e.stopPropagation();
13828
+ field.cancel();
13829
+ } else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
13830
+ e.preventDefault();
13831
+ nudge(e.key === "ArrowUp" ? 1 : -1, e.shiftKey);
13832
+ }
13740
13833
  }
13741
13834
  }
13742
- }
13743
- ),
13744
- /* @__PURE__ */ jsx39("span", { class: "pptx-field__unit", children: props.unit })
13745
- ] }),
13746
- error.value ? /* @__PURE__ */ jsx39("span", { id: errorId, class: "pptx-chart-pane__error", role: "alert", children: error.value }) : null
13747
- ] });
13835
+ ),
13836
+ /* @__PURE__ */ jsx39("span", { class: "pptx-field__unit", children: props.unit })
13837
+ ] }),
13838
+ error ? /* @__PURE__ */ jsx39("span", { id: errorId, class: "pptx-chart-pane__error", role: "alert", children: error }) : null
13839
+ ] });
13840
+ };
13748
13841
  }
13749
13842
  });
13750
13843
 
13751
13844
  // src/FormatLineWidth.tsx
13752
- import { jsx as jsx40 } from "vue/jsx-runtime";
13845
+ import { jsx as jsx40, jsxs as jsxs34 } from "vue/jsx-runtime";
13753
13846
  var FormatLineWidth = defineComponent48({
13754
13847
  name: "FormatLineWidth",
13755
13848
  setup() {
@@ -13760,68 +13853,73 @@ var FormatLineWidth = defineComponent48({
13760
13853
  const line = formatLineState(editor.value);
13761
13854
  if (!line) return null;
13762
13855
  const key = `${editor.value?.session?.id}:${formatTargetKey2(snapshot.value)}`;
13763
- return /* @__PURE__ */ jsx40(
13764
- FormatNumberField,
13765
- {
13766
- label: t("inspector.lineWidth"),
13767
- property: "line.width",
13768
- value: line.width === null ? null : String(Math.round(line.width * 100) / 100),
13769
- unit: "pt",
13770
- min: 0,
13771
- exclusiveMin: true,
13772
- mixed: line.widthMixed,
13773
- max: 1584,
13774
- disabled: snapshot.value.mode === "view",
13775
- onCommit: (points) => {
13776
- if (!editor.value || `${editor.value.session?.id}:${formatTargetKey2(editor.value.snapshot())}` !== key)
13777
- return t("disabled.invalidValue");
13778
- if (points === line.width) return null;
13779
- const result = editor.value.exec({ type: "setLineWidth", points });
13780
- return result.ok ? null : translateKeyOrText16(t, result.reason);
13781
- }
13782
- },
13783
- key
13784
- );
13856
+ return /* @__PURE__ */ jsxs34("div", { class: "pptx-format-line-width", children: [
13857
+ /* @__PURE__ */ jsx40(
13858
+ FormatNumberField,
13859
+ {
13860
+ label: t("inspector.lineWidth"),
13861
+ property: "line.width",
13862
+ value: line.width === null ? null : String(Math.round(line.width * 100) / 100),
13863
+ unit: "pt",
13864
+ min: 0,
13865
+ exclusiveMin: true,
13866
+ mixed: line.widthMixed,
13867
+ max: 1584,
13868
+ step: 0.25,
13869
+ inline: true,
13870
+ placeholder: t("inspector.noLine"),
13871
+ disabled: snapshot.value.mode === "view",
13872
+ onCommit: (points, options) => {
13873
+ if (!editor.value || `${editor.value.session?.id}:${formatTargetKey2(editor.value.snapshot())}` !== key)
13874
+ return t("disabled.invalidValue");
13875
+ if (points === line.width) return null;
13876
+ const result = editor.value.exec({ type: "setLineWidth", points }, options);
13877
+ return result.ok ? null : translateKeyOrText16(t, result.reason);
13878
+ }
13879
+ },
13880
+ key
13881
+ ),
13882
+ /* @__PURE__ */ jsx40(ToolbarSlot, { slotId: "shape.lineWidth" })
13883
+ ] });
13785
13884
  };
13786
13885
  }
13787
13886
  });
13788
13887
 
13789
13888
  // src/FormatFillTransparency.tsx
13790
- import { defineComponent as defineComponent49, ref as ref35 } from "vue";
13889
+ import { defineComponent as defineComponent49, ref as ref34 } from "vue";
13791
13890
  import {
13792
13891
  formatFillTransparency,
13793
13892
  formatTargetKey as formatTargetKey3,
13794
13893
  translateKeyOrText as translateKeyOrText17
13795
13894
  } from "@pptx-editor.dev/core/editor";
13796
- import { jsx as jsx41, jsxs as jsxs34 } from "vue/jsx-runtime";
13895
+ import { jsx as jsx41, jsxs as jsxs35 } from "vue/jsx-runtime";
13797
13896
  var FormatFillTransparency = defineComponent49({
13798
13897
  name: "FormatFillTransparency",
13799
13898
  setup() {
13800
13899
  const editor = usePptxEditor();
13801
13900
  const snapshot = useEditorState((s) => s);
13802
13901
  const { t } = useTranslation();
13803
- const preview = ref35(null);
13804
- const error = ref35(null);
13902
+ const group = useHistoryGroup({ kind: "range" });
13903
+ const error = ref34(null);
13805
13904
  return () => {
13806
13905
  const field = formatFillTransparency(editor.value);
13807
13906
  if (!field) return null;
13808
13907
  const key = `${editor.value?.session?.id}:${formatTargetKey3(snapshot.value)}`;
13809
- const commit = (percent) => {
13908
+ const commit = (percent, options) => {
13810
13909
  const instance = editor.value;
13811
13910
  if (!instance || `${instance.session?.id}:${formatTargetKey3(instance.snapshot())}` !== key)
13812
13911
  return t("disabled.invalidValue");
13813
13912
  if (percent === field.value) return null;
13814
- const result = instance.exec({
13815
- type: "patchShapeFormat",
13816
- target: field.target,
13817
- patch: field.patch(percent)
13818
- });
13913
+ const result = instance.exec(
13914
+ { type: "patchShapeFormat", target: field.target, patch: field.patch(percent) },
13915
+ options
13916
+ );
13819
13917
  return result.ok ? null : translateKeyOrText17(t, result.reason);
13820
13918
  };
13821
13919
  const label = t(field.labelKey);
13822
- const value = preview.value ?? field.value;
13920
+ const value = field.value;
13823
13921
  const disabled = snapshot.value.mode === "view";
13824
- return /* @__PURE__ */ jsxs34("div", { class: "pptx-format-transparency", "data-format-fill-transparency": "", children: [
13922
+ return /* @__PURE__ */ jsxs35("div", { class: "pptx-format-transparency", "data-format-fill-transparency": "", children: [
13825
13923
  /* @__PURE__ */ jsx41(
13826
13924
  "input",
13827
13925
  {
@@ -13835,15 +13933,9 @@ var FormatFillTransparency = defineComponent49({
13835
13933
  step: 1,
13836
13934
  value,
13837
13935
  disabled,
13936
+ ref: group.ref,
13838
13937
  onInput: (e) => {
13839
- preview.value = Number(e.target.value);
13840
- },
13841
- onChange: (e) => {
13842
- preview.value = null;
13843
- error.value = commit(Number(e.target.value));
13844
- },
13845
- onBlur: () => {
13846
- preview.value = null;
13938
+ error.value = commit(Number(e.target.value), group.options());
13847
13939
  }
13848
13940
  }
13849
13941
  ),
@@ -13857,9 +13949,9 @@ var FormatFillTransparency = defineComponent49({
13857
13949
  min: field.min,
13858
13950
  max: field.max,
13859
13951
  disabled,
13860
- onCommit: (percent) => {
13952
+ onCommit: (percent, options) => {
13861
13953
  error.value = null;
13862
- return commit(percent);
13954
+ return commit(percent, options);
13863
13955
  }
13864
13956
  },
13865
13957
  key
@@ -13871,7 +13963,7 @@ var FormatFillTransparency = defineComponent49({
13871
13963
  });
13872
13964
 
13873
13965
  // src/FormatDetails.tsx
13874
- import { defineComponent as defineComponent51, ref as ref37, nextTick as nextTick7 } from "vue";
13966
+ import { defineComponent as defineComponent51, ref as ref36, nextTick as nextTick7 } from "vue";
13875
13967
  import {
13876
13968
  chromeControlForSlot as chromeControlForSlot6,
13877
13969
  createGradientStopIdentity,
@@ -13883,12 +13975,12 @@ import {
13883
13975
  } from "@pptx-editor.dev/core/editor";
13884
13976
 
13885
13977
  // src/FormatGradientPicker.tsx
13886
- import { defineComponent as defineComponent50, ref as ref36 } from "vue";
13978
+ import { defineComponent as defineComponent50, ref as ref35 } from "vue";
13887
13979
  import {
13888
13980
  gradientPreviewCss,
13889
13981
  gradientPreviewStops
13890
13982
  } from "@pptx-editor.dev/core/editor";
13891
- import { jsx as jsx42, jsxs as jsxs35 } from "vue/jsx-runtime";
13983
+ import { jsx as jsx42, jsxs as jsxs36 } from "vue/jsx-runtime";
13892
13984
  var FormatGradientPicker = defineComponent50({
13893
13985
  name: "FormatGradientPicker",
13894
13986
  props: {
@@ -13899,7 +13991,7 @@ var FormatGradientPicker = defineComponent50({
13899
13991
  setup(props) {
13900
13992
  const { t } = useTranslation();
13901
13993
  const rows = useEditorState((s) => s.themeColors);
13902
- const root = ref36(null);
13994
+ const root = ref35(null);
13903
13995
  return () => {
13904
13996
  const stops = gradientPreviewStops(props.gradient, rows.value);
13905
13997
  const background = gradientPreviewCss(stops);
@@ -13913,7 +14005,7 @@ var FormatGradientPicker = defineComponent50({
13913
14005
  );
13914
14006
  buttons?.[index]?.focus();
13915
14007
  };
13916
- return /* @__PURE__ */ jsxs35("div", { class: "pptx-gradient-picker", ref: root, children: [
14008
+ return /* @__PURE__ */ jsxs36("div", { class: "pptx-gradient-picker", ref: root, children: [
13917
14009
  /* @__PURE__ */ jsx42(
13918
14010
  "div",
13919
14011
  {
@@ -13950,7 +14042,7 @@ var FormatGradientPicker = defineComponent50({
13950
14042
  },
13951
14043
  stop.id
13952
14044
  )) }),
13953
- /* @__PURE__ */ jsxs35("label", { class: "pptx-field", children: [
14045
+ /* @__PURE__ */ jsxs36("label", { class: "pptx-field", children: [
13954
14046
  t("inspector.selectStop"),
13955
14047
  /* @__PURE__ */ jsx42(
13956
14048
  "select",
@@ -13969,7 +14061,7 @@ var FormatGradientPicker = defineComponent50({
13969
14061
  });
13970
14062
 
13971
14063
  // src/FormatDetails.tsx
13972
- import { jsx as jsx43, jsxs as jsxs36 } from "vue/jsx-runtime";
14064
+ import { jsx as jsx43, jsxs as jsxs37 } from "vue/jsx-runtime";
13973
14065
  var FormatDetails = defineComponent51({
13974
14066
  props: { section: { type: String, required: true } },
13975
14067
  setup(props) {
@@ -13977,10 +14069,10 @@ var FormatDetails = defineComponent51({
13977
14069
  const { t } = useTranslation();
13978
14070
  const snapshot = useEditorState((s) => s);
13979
14071
  const offered = useOfferedControl("shape.effects", chromeControlForSlot6("shape.effects"));
13980
- const root = ref37(null);
14072
+ const root = ref36(null);
13981
14073
  const stopIdentity = createGradientStopIdentity();
13982
- const selectedStop = ref37(null);
13983
- const error = ref37(null);
14074
+ const selectedStop = ref36(null);
14075
+ const error = ref36(null);
13984
14076
  return () => {
13985
14077
  const read = editor.value?.shapeFormat();
13986
14078
  if (snapshot.value.selection.kind === "shapes" && snapshot.value.selection.nodeIds.length > 1)
@@ -13996,14 +14088,13 @@ var FormatDetails = defineComponent51({
13996
14088
  (stop) => selectedStop.value !== null && identity(stop.id) === selectedStop.value
13997
14089
  ) ?? detail.gradient?.stops[0];
13998
14090
  const key = `${editor.value?.session?.id}:${formatTargetKey4(snapshot.value)}`;
13999
- const apply = (patch) => {
14091
+ const apply = (patch, options) => {
14000
14092
  if (!editor.value || `${editor.value.session?.id}:${formatTargetKey4(editor.value.snapshot())}` !== key)
14001
14093
  return t("disabled.invalidValue");
14002
- const result = editor.value.exec({
14003
- type: "patchShapeFormat",
14004
- target: detail.target,
14005
- patch
14006
- });
14094
+ const result = editor.value.exec(
14095
+ { type: "patchShapeFormat", target: detail.target, patch },
14096
+ options
14097
+ );
14007
14098
  if (result.ok && patch.kind === "gradient") {
14008
14099
  const next = editor.value.shapeFormat();
14009
14100
  if (next.ok && next.format.gradient && detail.gradient) {
@@ -14015,7 +14106,7 @@ var FormatDetails = defineComponent51({
14015
14106
  const disabled = snapshot.value.mode === "view";
14016
14107
  const effectsAvailable = offered.value?.options?.some((option) => option.value === "reflection.tightTouching") === true;
14017
14108
  const unavailable = (id) => !effectsAvailable && (id === "reflection" || id === "shadow" && detail.shadow?.kind === "inner");
14018
- return /* @__PURE__ */ jsxs36("div", { class: "pptx-format-details", ref: root, children: [
14109
+ return /* @__PURE__ */ jsxs37("div", { class: "pptx-format-details", ref: root, children: [
14019
14110
  props.section === "fill" && detail.gradient && activeStop ? /* @__PURE__ */ jsx43(
14020
14111
  FormatGradientPicker,
14021
14112
  {
@@ -14026,14 +14117,14 @@ var FormatDetails = defineComponent51({
14026
14117
  }
14027
14118
  }
14028
14119
  ) : null,
14029
- formatPropertyGroups(detail, props.section).filter((group) => group.index === void 0 || group.id === activeStop?.id).map((group) => /* @__PURE__ */ jsxs36(
14120
+ formatPropertyGroups(detail, props.section).filter((group) => group.index === void 0 || group.id === activeStop?.id).map((group) => /* @__PURE__ */ jsxs37(
14030
14121
  "fieldset",
14031
14122
  {
14032
14123
  class: "pptx-format-property-group",
14033
14124
  "data-format-stop": group.index,
14034
14125
  children: [
14035
14126
  /* @__PURE__ */ jsx43("legend", { children: t(group.labelKey, group.index ? { index: group.index } : void 0) }),
14036
- /* @__PURE__ */ jsxs36("div", { class: "pptx-format-property-fields", children: [
14127
+ /* @__PURE__ */ jsxs37("div", { class: "pptx-format-property-fields", children: [
14037
14128
  unavailable(group.id) ? /* @__PURE__ */ jsx43("p", { class: "pptx-empty__body", role: "status", children: t("inspector.effectUnavailable") }) : null,
14038
14129
  group.colors.map((field) => {
14039
14130
  const pick = field.color ? colorPickOf3(field.color) : "keep";
@@ -14064,7 +14155,7 @@ var FormatDetails = defineComponent51({
14064
14155
  max: field.max,
14065
14156
  label: t(field.labelKey),
14066
14157
  disabled: disabled || unavailable(group.id),
14067
- onCommit: (value) => apply(field.patch(value))
14158
+ onCommit: (value, options) => apply(field.patch(value), options)
14068
14159
  },
14069
14160
  field.id.split(".").at(-1)
14070
14161
  ))
@@ -14143,7 +14234,7 @@ import {
14143
14234
  formatTargetKey as formatTargetKey5,
14144
14235
  translateKeyOrText as translateKeyOrText19
14145
14236
  } from "@pptx-editor.dev/core/editor";
14146
- import { jsx as jsx44, jsxs as jsxs37 } from "vue/jsx-runtime";
14237
+ import { jsx as jsx44, jsxs as jsxs38 } from "vue/jsx-runtime";
14147
14238
  var EMU_PER_INCH = 914400;
14148
14239
  var inches = (emu) => String(Number((emu / EMU_PER_INCH).toFixed(6)));
14149
14240
  var FormatGeometry = defineComponent52({
@@ -14165,11 +14256,11 @@ var FormatGeometry = defineComponent52({
14165
14256
  return () => {
14166
14257
  const g = geometry.value;
14167
14258
  if (!g)
14168
- return selected.value > 1 ? /* @__PURE__ */ jsxs37("div", { class: "pptx-empty", children: [
14259
+ return selected.value > 1 ? /* @__PURE__ */ jsxs38("div", { class: "pptx-empty", children: [
14169
14260
  /* @__PURE__ */ jsx44("p", { class: "pptx-empty__title", children: t("panel.format.multipleTitle", { count: selected.value }) }),
14170
14261
  /* @__PURE__ */ jsx44("p", { class: "pptx-empty__body", children: platformShortcuts2(t("panel.format.multipleBody")) })
14171
14262
  ] }) : [
14172
- /* @__PURE__ */ jsxs37("div", { class: "pptx-panel__section", children: [
14263
+ /* @__PURE__ */ jsxs38("div", { class: "pptx-panel__section", children: [
14173
14264
  /* @__PURE__ */ jsx44("h3", { class: "pptx-panel__title", children: t(panelTitle.value) }),
14174
14265
  background.isAvailable.value ? /* @__PURE__ */ jsx44(
14175
14266
  "button",
@@ -14182,41 +14273,44 @@ var FormatGeometry = defineComponent52({
14182
14273
  }
14183
14274
  ) : null
14184
14275
  ] }),
14185
- /* @__PURE__ */ jsxs37("div", { class: "pptx-empty", children: [
14276
+ /* @__PURE__ */ jsxs38("div", { class: "pptx-empty", children: [
14186
14277
  /* @__PURE__ */ jsx44("p", { class: "pptx-empty__title", children: t("panel.format.emptyTitle") }),
14187
14278
  /* @__PURE__ */ jsx44("p", { class: "pptx-empty__body", children: t(panelBody.value) })
14188
14279
  ] })
14189
14280
  ];
14190
14281
  const target = editor.value ? `${editor.value.session?.id}:${formatTargetKey5(editor.value.snapshot())}` : "";
14191
- const run = (command) => {
14282
+ const run = (command, options) => {
14192
14283
  if (!editor.value || `${editor.value.session?.id}:${formatTargetKey5(editor.value.snapshot())}` !== target)
14193
14284
  return t("disabled.invalidValue");
14194
- const result = editor.value.exec(command);
14285
+ const result = editor.value.exec(command, options);
14195
14286
  return result.ok ? null : translateKeyOrText19(t, result.reason);
14196
14287
  };
14197
- const move = (patch) => {
14288
+ const move = (patch, options) => {
14198
14289
  if (!editor.value || `${editor.value.session?.id}:${formatTargetKey5(editor.value.snapshot())}` !== target)
14199
14290
  return t("disabled.invalidValue");
14200
14291
  const current = editor.value.snapshot().geometry;
14201
14292
  if (!current || current.nodeId !== g.nodeId) return t("disabled.invalidValue");
14202
- return run({
14203
- type: "setTransform",
14204
- nodeId: g.nodeId,
14205
- x: patch.x ?? current.x,
14206
- y: patch.y ?? current.y,
14207
- cx: patch.cx ?? current.cx,
14208
- cy: patch.cy ?? current.cy,
14209
- rot: patch.rot ?? current.rot
14210
- });
14293
+ return run(
14294
+ {
14295
+ type: "setTransform",
14296
+ nodeId: g.nodeId,
14297
+ x: patch.x ?? current.x,
14298
+ y: patch.y ?? current.y,
14299
+ cx: patch.cx ?? current.cx,
14300
+ cy: patch.cy ?? current.cy,
14301
+ rot: patch.rot ?? current.rot
14302
+ },
14303
+ options
14304
+ );
14211
14305
  };
14212
14306
  const inch = (v) => Math.round(v * EMU_PER_INCH);
14213
14307
  const unit = t("panel.format.inchUnit");
14214
14308
  const tableSection = () => {
14215
14309
  const tb = table.value;
14216
14310
  if (!tb) return null;
14217
- return /* @__PURE__ */ jsxs37("div", { class: "pptx-panel__section", children: [
14311
+ return /* @__PURE__ */ jsxs38("div", { class: "pptx-panel__section", children: [
14218
14312
  /* @__PURE__ */ jsx44("h3", { class: "pptx-panel__title", children: t("panel.format.table") }),
14219
- /* @__PURE__ */ jsxs37("div", { class: "pptx-panel__grid", children: [
14313
+ /* @__PURE__ */ jsxs38("div", { class: "pptx-panel__grid", children: [
14220
14314
  /* @__PURE__ */ jsx44(
14221
14315
  FormatNumberField,
14222
14316
  {
@@ -14226,7 +14320,7 @@ var FormatGeometry = defineComponent52({
14226
14320
  value: inches(tb.rowHeight),
14227
14321
  unit,
14228
14322
  disabled: readOnly.value,
14229
- onCommit: (v) => run({ type: "setRowHeight", height: inch(v) })
14323
+ onCommit: (v, options) => run({ type: "setRowHeight", height: inch(v) }, options)
14230
14324
  }
14231
14325
  ),
14232
14326
  /* @__PURE__ */ jsx44(
@@ -14238,11 +14332,11 @@ var FormatGeometry = defineComponent52({
14238
14332
  value: inches(tb.columnWidth),
14239
14333
  unit,
14240
14334
  disabled: readOnly.value,
14241
- onCommit: (v) => run({ type: "setColumnWidth", width: inch(v) })
14335
+ onCommit: (v, options) => run({ type: "setColumnWidth", width: inch(v) }, options)
14242
14336
  }
14243
14337
  )
14244
14338
  ] }),
14245
- /* @__PURE__ */ jsx44("div", { class: "pptx-radios", role: "group", "aria-label": t("panel.format.styleOptions"), children: TABLE_OPTION_ROWS.map(({ option, labelKey }) => /* @__PURE__ */ jsxs37("label", { class: "pptx-radio", children: [
14339
+ /* @__PURE__ */ jsx44("div", { class: "pptx-radios", role: "group", "aria-label": t("panel.format.styleOptions"), children: TABLE_OPTION_ROWS.map(({ option, labelKey }) => /* @__PURE__ */ jsxs38("label", { class: "pptx-radio", children: [
14246
14340
  /* @__PURE__ */ jsx44(
14247
14341
  "input",
14248
14342
  {
@@ -14265,23 +14359,24 @@ var FormatGeometry = defineComponent52({
14265
14359
  value: inches(g[key]),
14266
14360
  unit,
14267
14361
  disabled: readOnly.value,
14268
- onCommit: (v) => move(
14269
- key === "cx" || key === "cy" ? formatPanelSize(g, key, inch(v)) : { [key]: inch(v) }
14362
+ onCommit: (v, options) => move(
14363
+ key === "cx" || key === "cy" ? formatPanelSize(g, key, inch(v)) : { [key]: inch(v) },
14364
+ options
14270
14365
  )
14271
14366
  }
14272
14367
  );
14273
14368
  return [
14274
- /* @__PURE__ */ jsxs37("div", { class: "pptx-panel__section", children: [
14369
+ /* @__PURE__ */ jsxs38("div", { class: "pptx-panel__section", children: [
14275
14370
  /* @__PURE__ */ jsx44("h3", { class: "pptx-panel__title", children: t("panel.format.element") }),
14276
14371
  /* @__PURE__ */ jsx44("span", { class: "pptx-chip", children: t(elementKindLabelKey(g, table.value, { chart: chart.value, diagram: diagram.value })) })
14277
14372
  ] }),
14278
- /* @__PURE__ */ jsxs37("div", { class: "pptx-panel__section", children: [
14373
+ /* @__PURE__ */ jsxs38("div", { class: "pptx-panel__section", children: [
14279
14374
  /* @__PURE__ */ jsx44("h3", { class: "pptx-panel__title", children: t("panel.format.size") }),
14280
- /* @__PURE__ */ jsxs37("div", { class: "pptx-panel__grid", children: [
14375
+ /* @__PURE__ */ jsxs38("div", { class: "pptx-panel__grid", children: [
14281
14376
  field("cx", "panel.format.width"),
14282
14377
  field("cy", "panel.format.height")
14283
14378
  ] }),
14284
- /* @__PURE__ */ jsxs37("label", { class: "pptx-radio", children: [
14379
+ /* @__PURE__ */ jsxs38("label", { class: "pptx-radio", children: [
14285
14380
  /* @__PURE__ */ jsx44(
14286
14381
  "input",
14287
14382
  {
@@ -14297,14 +14392,14 @@ var FormatGeometry = defineComponent52({
14297
14392
  t("imageProperties.lockAspect")
14298
14393
  ] })
14299
14394
  ] }),
14300
- /* @__PURE__ */ jsxs37("div", { class: "pptx-panel__section", children: [
14395
+ /* @__PURE__ */ jsxs38("div", { class: "pptx-panel__section", children: [
14301
14396
  /* @__PURE__ */ jsx44("h3", { class: "pptx-panel__title", children: t("panel.format.position") }),
14302
- /* @__PURE__ */ jsxs37("div", { class: "pptx-panel__grid", children: [
14397
+ /* @__PURE__ */ jsxs38("div", { class: "pptx-panel__grid", children: [
14303
14398
  field("x", "panel.format.x"),
14304
14399
  field("y", "panel.format.y")
14305
14400
  ] })
14306
14401
  ] }),
14307
- elementRotates(g, table.value) ? /* @__PURE__ */ jsxs37("div", { class: "pptx-panel__section", children: [
14402
+ elementRotates(g, table.value) ? /* @__PURE__ */ jsxs38("div", { class: "pptx-panel__section", children: [
14308
14403
  /* @__PURE__ */ jsx44("h3", { class: "pptx-panel__title", children: t("panel.format.rotation") }),
14309
14404
  /* @__PURE__ */ jsx44("div", { class: "pptx-panel__grid", children: /* @__PURE__ */ jsx44(
14310
14405
  FormatNumberField,
@@ -14316,14 +14411,14 @@ var FormatGeometry = defineComponent52({
14316
14411
  value: String(Math.round(g.rot * 10) / 10),
14317
14412
  unit: "\xB0",
14318
14413
  disabled: readOnly.value,
14319
- onCommit: (v) => move({ rot: v })
14414
+ onCommit: (v, options) => move({ rot: v }, options)
14320
14415
  }
14321
14416
  ) })
14322
14417
  ] }) : null,
14323
14418
  tableSection(),
14324
- g.textFitting ? /* @__PURE__ */ jsxs37("div", { class: "pptx-panel__section", children: [
14419
+ g.textFitting ? /* @__PURE__ */ jsxs38("div", { class: "pptx-panel__section", children: [
14325
14420
  /* @__PURE__ */ jsx44("h3", { class: "pptx-panel__title", children: t("panel.format.textFitting") }),
14326
- /* @__PURE__ */ jsx44("div", { class: "pptx-radios", role: "radiogroup", "aria-label": t("panel.format.textFitting"), children: ["none", "shrink", "shape"].map((mode) => /* @__PURE__ */ jsxs37("label", { class: "pptx-radio", children: [
14421
+ /* @__PURE__ */ jsx44("div", { class: "pptx-radios", role: "radiogroup", "aria-label": t("panel.format.textFitting"), children: ["none", "shrink", "shape"].map((mode) => /* @__PURE__ */ jsxs38("label", { class: "pptx-radio", children: [
14327
14422
  /* @__PURE__ */ jsx44(
14328
14423
  "input",
14329
14424
  {
@@ -14343,7 +14438,7 @@ var FormatGeometry = defineComponent52({
14343
14438
  });
14344
14439
 
14345
14440
  // src/FormatPanel.tsx
14346
- import { jsx as jsx45, jsxs as jsxs38 } from "vue/jsx-runtime";
14441
+ import { jsx as jsx45, jsxs as jsxs39 } from "vue/jsx-runtime";
14347
14442
  var formatSectionProps = {
14348
14443
  section: { type: Object, required: true }
14349
14444
  };
@@ -14355,8 +14450,8 @@ var FormatSection = defineComponent53({
14355
14450
  const editor = usePptxEditor();
14356
14451
  const background = useEditorDialog("background");
14357
14452
  const snapshot = useEditorState((s) => s);
14358
- const expansion = ref38(0);
14359
- watch33(
14453
+ const expansion = ref37(0);
14454
+ watch32(
14360
14455
  editor,
14361
14456
  (instance, _old, onCleanup) => {
14362
14457
  if (instance)
@@ -14373,7 +14468,7 @@ var FormatSection = defineComponent53({
14373
14468
  const section = props.section;
14374
14469
  const category = formatSelectionCategory(snapshot.value);
14375
14470
  const expanded = formatSectionOpen(editor.value, category, section.id);
14376
- return /* @__PURE__ */ jsxs38("details", { class: "pptx-format-disclosure", open: expanded, children: [
14471
+ return /* @__PURE__ */ jsxs39("details", { class: "pptx-format-disclosure", open: expanded, children: [
14377
14472
  /* @__PURE__ */ jsx45(
14378
14473
  "summary",
14379
14474
  {
@@ -14386,13 +14481,13 @@ var FormatSection = defineComponent53({
14386
14481
  children: t(section.labelKey)
14387
14482
  }
14388
14483
  ),
14389
- /* @__PURE__ */ jsxs38("div", { class: "pptx-format-section-body", children: [
14484
+ /* @__PURE__ */ jsxs39("div", { class: "pptx-format-section-body", children: [
14390
14485
  section.id === "geometry" ? /* @__PURE__ */ jsx45(FormatGeometry, {}) : null,
14391
14486
  section.id === "fill" || section.id === "effects" ? /* @__PURE__ */ jsx45(FormatDetails, { section: section.id }) : null,
14392
14487
  section.id === "geometry" ? null : section.id === "chart" ? /* @__PURE__ */ jsx45(ChartDataPane, {}) : section.id === "diagram" ? /* @__PURE__ */ jsx45(DiagramTextPane, {}) : /* @__PURE__ */ jsx45("div", { class: "pptx-format-controls", children: section.slots.filter((slot) => slot !== "slide.background" || background.isAvailable.value).flatMap((slot) => [
14393
- /* @__PURE__ */ jsxs38("div", { class: "pptx-format-control", "data-format-slot": slot, children: [
14488
+ /* @__PURE__ */ jsxs39("div", { class: "pptx-format-control", "data-format-slot": slot, children: [
14394
14489
  slot !== "shape.lineWidth" ? /* @__PURE__ */ jsx45("span", { class: "pptx-format-control__label", children: t(chromeControlForSlot7(slot).labelKey) }) : null,
14395
- formatControlMixed(editor.value, slot) ? /* @__PURE__ */ jsx45("span", { class: "pptx-format-mixed", children: t("inspector.mixed") }) : null,
14490
+ slot !== "shape.lineWidth" && formatControlMixed(editor.value, slot) ? /* @__PURE__ */ jsx45("span", { class: "pptx-format-mixed", children: t("inspector.mixed") }) : null,
14396
14491
  slot === "shape.lineWidth" ? /* @__PURE__ */ jsx45(FormatLineWidth, {}) : /* @__PURE__ */ jsx45(ToolbarSlot, { slotId: slot })
14397
14492
  ] }, slot),
14398
14493
  slot === "shape.fill" ? /* @__PURE__ */ jsx45(FormatFillTransparency, {}, "fill.transparency") : null
@@ -14414,8 +14509,8 @@ var FormatPanel = defineComponent53({
14414
14509
  const editor = usePptxEditor();
14415
14510
  const snapshot = useEditorState((s) => s);
14416
14511
  const { t } = useTranslation();
14417
- const root = ref38(null);
14418
- watch33(
14512
+ const root = ref37(null);
14513
+ watch32(
14419
14514
  () => formatSelectionCategory(snapshot.value),
14420
14515
  (category, previous) => {
14421
14516
  if (category !== previous) {
@@ -14425,7 +14520,7 @@ var FormatPanel = defineComponent53({
14425
14520
  },
14426
14521
  { flush: "post" }
14427
14522
  );
14428
- return () => /* @__PURE__ */ jsxs38("div", { ref: root, class: ["pptx-format-panel", props.className], children: [
14523
+ return () => /* @__PURE__ */ jsxs39("div", { ref: root, class: ["pptx-format-panel", props.className], children: [
14429
14524
  snapshot.value.selection.kind === "shapes" && snapshot.value.selection.nodeIds.length > 1 ? /* @__PURE__ */ jsx45("p", { class: "pptx-panel__title", children: t("panel.format.multipleTitle", { count: snapshot.value.selection.nodeIds.length }) }) : snapshot.value.geometry ? /* @__PURE__ */ jsx45("p", { class: "pptx-panel__title", children: snapshot.value.geometry.name }) : null,
14430
14525
  /* @__PURE__ */ jsx45("div", { class: "pptx-format-sections", children: formatSectionsOf(snapshot.value, props.sections).map((section) => /* @__PURE__ */ jsx45("div", { "data-format-section": section.id, children: slots[section.id] ? slots[section.id]() : /* @__PURE__ */ jsx45(
14431
14526
  FormatSection,
@@ -14440,7 +14535,7 @@ var FormatPanel = defineComponent53({
14440
14535
  });
14441
14536
 
14442
14537
  // src/SidePanel.tsx
14443
- import { jsx as jsx46, jsxs as jsxs39 } from "vue/jsx-runtime";
14538
+ import { jsx as jsx46, jsxs as jsxs40 } from "vue/jsx-runtime";
14444
14539
  var sidePanelProps = {
14445
14540
  /** The panel's width in CSS pixels. */
14446
14541
  paneWidth: { type: Number, default: void 0 },
@@ -14459,7 +14554,7 @@ function packagedPane(tab, t) {
14459
14554
  if (tab === "diagram") return /* @__PURE__ */ jsx46(DiagramTextPane, {});
14460
14555
  if (tab === "selection") return /* @__PURE__ */ jsx46(PptxEditorSelectionPane, {});
14461
14556
  if (tab === "animations") return /* @__PURE__ */ jsx46(AnimationsPane, {});
14462
- return /* @__PURE__ */ jsxs39("div", { class: "pptx-empty", children: [
14557
+ return /* @__PURE__ */ jsxs40("div", { class: "pptx-empty", children: [
14463
14558
  /* @__PURE__ */ jsx46("p", { class: "pptx-empty__title", children: t("panel.comments.emptyTitle") }),
14464
14559
  /* @__PURE__ */ jsx46("p", { class: "pptx-empty__body", children: t("panel.comments.emptyBody") })
14465
14560
  ] });
@@ -14479,7 +14574,7 @@ var PptxEditorSidePanel = defineComponent54({
14479
14574
  setup(props, { attrs, emit, slots }) {
14480
14575
  const { t } = useTranslation();
14481
14576
  const editor = usePptxEditor();
14482
- const own = ref39(props.tab ?? "format");
14577
+ const own = ref38(props.tab ?? "format");
14483
14578
  const tab = computed21(() => props.tab ?? own.value);
14484
14579
  const chartSelected = useEditorState((s) => !!s.chart);
14485
14580
  const diagramSelected = useEditorState((s) => !!s.diagram);
@@ -14491,7 +14586,7 @@ var PptxEditorSidePanel = defineComponent54({
14491
14586
  emit("tabChange", next);
14492
14587
  emit("update:tab", next);
14493
14588
  };
14494
- const root = ref39(null);
14589
+ const root = ref38(null);
14495
14590
  const focusTab = (pane) => void nextTick8(() => {
14496
14591
  const body = root.value?.querySelector(".pptx-panel__body");
14497
14592
  if (body?.contains(body.ownerDocument.activeElement)) return;
@@ -14500,7 +14595,7 @@ var PptxEditorSidePanel = defineComponent54({
14500
14595
  );
14501
14596
  (current ?? root.value?.querySelector(`[data-tab="${pane}"]`))?.focus();
14502
14597
  });
14503
- watch34(
14598
+ watch33(
14504
14599
  editor,
14505
14600
  (e, _old, onCleanup) => {
14506
14601
  if (!e) return;
@@ -14523,7 +14618,7 @@ var PptxEditorSidePanel = defineComponent54({
14523
14618
  return () => {
14524
14619
  const { class: hostClass, style: hostStyle, ...rest } = attrs;
14525
14620
  const style = [hostStyle, props.style];
14526
- return /* @__PURE__ */ jsxs39(
14621
+ return /* @__PURE__ */ jsxs40(
14527
14622
  "aside",
14528
14623
  {
14529
14624
  ref: root,
@@ -14533,7 +14628,7 @@ var PptxEditorSidePanel = defineComponent54({
14533
14628
  style: props.paneWidth === void 0 ? style : [{ width: `${props.paneWidth}px` }, ...style],
14534
14629
  onMousedown: keepFocus,
14535
14630
  children: [
14536
- /* @__PURE__ */ jsxs39("div", { class: "pptx-panel__head", children: [
14631
+ /* @__PURE__ */ jsxs40("div", { class: "pptx-panel__head", children: [
14537
14632
  /* @__PURE__ */ jsx46(
14538
14633
  "div",
14539
14634
  {
@@ -14546,7 +14641,7 @@ var PptxEditorSidePanel = defineComponent54({
14546
14641
  setTab(next);
14547
14642
  e.currentTarget.querySelector(`[data-tab="${next}"]`)?.focus();
14548
14643
  },
14549
- children: tabs.value.map((id) => /* @__PURE__ */ jsxs39(
14644
+ children: tabs.value.map((id) => /* @__PURE__ */ jsxs40(
14550
14645
  "button",
14551
14646
  {
14552
14647
  type: "button",
@@ -14586,7 +14681,7 @@ var PptxEditorSidePanel = defineComponent54({
14586
14681
  });
14587
14682
 
14588
14683
  // src/panes.tsx
14589
- import { jsx as jsx47, jsxs as jsxs40 } from "vue/jsx-runtime";
14684
+ import { jsx as jsx47, jsxs as jsxs41 } from "vue/jsx-runtime";
14590
14685
  var sameSlides2 = (a, b) => a.length === b.length && a.every((s, i) => s === b[i]);
14591
14686
  var sameIndices2 = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
14592
14687
  var clickMode = slideClickMode;
@@ -14598,15 +14693,15 @@ var Thumbnail = defineComponent55({
14598
14693
  },
14599
14694
  setup(props) {
14600
14695
  const editor = usePptxEditor();
14601
- const box = ref40(null);
14696
+ const box = ref39(null);
14602
14697
  let dispose = null;
14603
14698
  const paint = () => {
14604
14699
  dispose?.();
14605
14700
  dispose = editor.value && box.value ? editor.value.renderThumbnail(props.slide.index, box.value, { defer: true }) : null;
14606
14701
  };
14607
14702
  onMounted19(paint);
14608
- watch35(() => [editor.value, props.slide], paint, { flush: "post" });
14609
- onBeforeUnmount11(() => {
14703
+ watch34(() => [editor.value, props.slide], paint, { flush: "post" });
14704
+ onBeforeUnmount12(() => {
14610
14705
  dispose?.();
14611
14706
  dispose = null;
14612
14707
  });
@@ -14642,7 +14737,7 @@ var RailItem = defineComponent55({
14642
14737
  setup(props) {
14643
14738
  return () => {
14644
14739
  const { slide: s, on } = props;
14645
- return /* @__PURE__ */ jsxs40(
14740
+ return /* @__PURE__ */ jsxs41(
14646
14741
  "li",
14647
14742
  {
14648
14743
  class: "pptx-rail__item",
@@ -14674,7 +14769,7 @@ var RailItem = defineComponent55({
14674
14769
  });
14675
14770
  function useFocusFollowsCurrent(list, item, watched) {
14676
14771
  let focused = null;
14677
- watch35(
14772
+ watch34(
14678
14773
  () => watched().join("|"),
14679
14774
  () => followCurrentSlide(list.value, item, focused),
14680
14775
  { flush: "post" }
@@ -14730,7 +14825,7 @@ function restAttrs(attrs) {
14730
14825
  return rest;
14731
14826
  }
14732
14827
  function usePaneOpen(props, emit) {
14733
- const own = ref40(props.defaultOpen ?? true);
14828
+ const own = ref39(props.defaultOpen ?? true);
14734
14829
  return {
14735
14830
  open: computed22(() => props.open ?? own.value),
14736
14831
  setOpen: (next) => {
@@ -14746,7 +14841,7 @@ var SlideRailRoot = defineComponent55({
14746
14841
  emits: { "update:open": (_open) => true },
14747
14842
  setup(props, { attrs, emit, slots }) {
14748
14843
  const pane = usePaneOpen(props, emit);
14749
- const rail = ref40(null);
14844
+ const rail = ref39(null);
14750
14845
  const listId = useId21();
14751
14846
  let focusToggle = false;
14752
14847
  const setOpen = (next) => {
@@ -14763,24 +14858,24 @@ var SlideRailRoot = defineComponent55({
14763
14858
  const selected = useEditorState((s) => s.selectedSlides, sameIndices2);
14764
14859
  const ratio = useEditorState((s) => s.slideHeight / s.slideWidth);
14765
14860
  const readOnly = useEditorState((s) => s.mode === "view");
14766
- const list = ref40(null);
14861
+ const list = ref39(null);
14767
14862
  const count = () => slides.value.length;
14768
14863
  const opening = useEditorState((s) => (s.pendingSlides ?? 0) > 0);
14769
14864
  const loading = useEditorState((s) => s.isOpening === true);
14770
- const grown = ref40(0);
14865
+ const grown = ref39(0);
14771
14866
  const mount = createProgressiveMount(() => grown.value += 1);
14772
14867
  onMounted19(() => mount.follow(count()));
14773
14868
  onUpdated4(() => mount.follow(count()));
14774
14869
  onUnmounted4(() => mount.dispose());
14775
- const menu = shallowRef28(null);
14776
- const gallery = shallowRef28(null);
14777
- const actions = ref40(null);
14870
+ const menu = shallowRef29(null);
14871
+ const gallery = shallowRef29(null);
14872
+ const actions = ref39(null);
14778
14873
  const sections = useSlideSections();
14779
14874
  const grouped = computed22(() => groupSlideSections2(sections.value, count()));
14780
14875
  const orientation = () => resolveRailOrientation2(props.orientation, "PptxEditorSlideRail");
14781
14876
  const drag = useSlideDrag(() => railDragAxis(orientation()), selected, readOnly, grouped);
14782
- const folded = shallowRef28(false);
14783
- watch35(
14877
+ const folded = shallowRef29(false);
14878
+ watch34(
14784
14879
  () => [rail.value, orientation(), pane.open.value],
14785
14880
  ([el, axis], _old, onCleanup) => onCleanup(
14786
14881
  watchRailFold(el, axis, (next) => {
@@ -14789,14 +14884,14 @@ var SlideRailRoot = defineComponent55({
14789
14884
  ),
14790
14885
  { flush: "post", immediate: true }
14791
14886
  );
14792
- const rightToLeft = shallowRef28(false);
14887
+ const rightToLeft = shallowRef29(false);
14793
14888
  const readDirection = () => {
14794
14889
  rightToLeft.value = railRightToLeft2(rail.value);
14795
14890
  };
14796
14891
  onMounted19(readDirection);
14797
14892
  onUpdated4(readDirection);
14798
14893
  const collapsed = useCollapsedSections();
14799
- const renaming = ref40(null);
14894
+ const renaming = ref39(null);
14800
14895
  useOpenCurrentSection(grouped);
14801
14896
  useSectionRenameRequests(
14802
14897
  (id) => {
@@ -14826,12 +14921,12 @@ var SlideRailRoot = defineComponent55({
14826
14921
  count(),
14827
14922
  pane.open.value
14828
14923
  ]);
14829
- watch35(
14924
+ watch34(
14830
14925
  list,
14831
14926
  (el, _old, onCleanup) => onCleanup(keepCurrentSlideInView2(el, ".pptx-rail__item")),
14832
14927
  { flush: "post" }
14833
14928
  );
14834
- watch35(
14929
+ watch34(
14835
14930
  () => pane.open.value,
14836
14931
  (open) => {
14837
14932
  const active = document.activeElement;
@@ -14975,7 +15070,7 @@ var SlideRailRoot = defineComponent55({
14975
15070
  itemLimit = inView ? inView.limit : mounted;
14976
15071
  isSelected = new Set(selected.value);
14977
15072
  labels = slideItemLabels(t);
14978
- return /* @__PURE__ */ jsxs40(
15073
+ return /* @__PURE__ */ jsxs41(
14979
15074
  "nav",
14980
15075
  {
14981
15076
  ...restAttrs(attrs),
@@ -15103,9 +15198,9 @@ var PptxEditorZoomPill = defineComponent55({
15103
15198
  const fit = useEditorState((s) => s.fitZoom);
15104
15199
  const off = useEditorState((s) => s.presentationView === "slideSorter");
15105
15200
  const reason = () => off.value ? t("disabled.sorterZoom") : null;
15106
- const anchor = ref40(null);
15107
- const open = ref40(false);
15108
- watch35(off, (now) => {
15201
+ const anchor = ref39(null);
15202
+ const open = ref39(false);
15203
+ watch34(off, (now) => {
15109
15204
  if (now) open.value = false;
15110
15205
  });
15111
15206
  const step = (dir) => {
@@ -15123,7 +15218,7 @@ var PptxEditorZoomPill = defineComponent55({
15123
15218
  };
15124
15219
  return () => {
15125
15220
  const levelLabel = off.value ? t("zoom.ariaLabel") : t("zoom.levelAriaLabel", { percent: Math.round(zoom.value * 100) });
15126
- return /* @__PURE__ */ jsxs40(
15221
+ return /* @__PURE__ */ jsxs41(
15127
15222
  "div",
15128
15223
  {
15129
15224
  class: ["pptx-zoom", props.className],
@@ -15141,7 +15236,7 @@ var PptxEditorZoomPill = defineComponent55({
15141
15236
  disabledReason: reason() ?? limit(-1)
15142
15237
  }
15143
15238
  ),
15144
- /* @__PURE__ */ jsxs40(
15239
+ /* @__PURE__ */ jsxs41(
15145
15240
  "button",
15146
15241
  {
15147
15242
  ref: anchor,
@@ -15206,10 +15301,10 @@ var PptxEditorZoomPill = defineComponent55({
15206
15301
  import {
15207
15302
  computed as computed23,
15208
15303
  defineComponent as defineComponent56,
15209
- onBeforeUnmount as onBeforeUnmount12,
15304
+ onBeforeUnmount as onBeforeUnmount13,
15210
15305
  onScopeDispose as onScopeDispose8,
15211
- shallowRef as shallowRef29,
15212
- watch as watch36,
15306
+ shallowRef as shallowRef30,
15307
+ watch as watch35,
15213
15308
  watchEffect as watchEffect2
15214
15309
  } from "vue";
15215
15310
  import {
@@ -15223,7 +15318,7 @@ import {
15223
15318
  REMOVAL_NOTICE_MS,
15224
15319
  removalNoticeShows
15225
15320
  } from "@pptx-editor.dev/core/editor";
15226
- import { jsx as jsx48, jsxs as jsxs41 } from "vue/jsx-runtime";
15321
+ import { jsx as jsx48, jsxs as jsxs42 } from "vue/jsx-runtime";
15227
15322
  function rejectionMessage(t, rejection) {
15228
15323
  return editRejectionMessage(t, rejection);
15229
15324
  }
@@ -15241,9 +15336,9 @@ var PptxEditorEditNotice = defineComponent56({
15241
15336
  const { t } = useChromeTranslateScope(() => props.t);
15242
15337
  const rejection = useEditorState((s) => s.lastRejection ?? null);
15243
15338
  const removal = useEditorState((s) => s.lastRemoval ?? null);
15244
- const dismissed = shallowRef29(null);
15339
+ const dismissed = shallowRef30(null);
15245
15340
  const linkStore = injectHyperlinkPopupStore();
15246
- const linkPopup = shallowRef29(linkStore?.getState() ?? null);
15341
+ const linkPopup = shallowRef30(linkStore?.getState() ?? null);
15247
15342
  if (linkStore)
15248
15343
  onScopeDispose8(
15249
15344
  linkStore.subscribe(() => {
@@ -15254,16 +15349,16 @@ var PptxEditorEditNotice = defineComponent56({
15254
15349
  const covered = computed23(
15255
15350
  () => linkEntry() !== false && linkPopupShowsRejection(linkPopup.value, rejection.value) || fieldShowsRejection(rejection.value)
15256
15351
  );
15257
- watch36(
15352
+ watch35(
15258
15353
  covered,
15259
15354
  (now) => {
15260
15355
  if (now) dismissed.value = rejection.value;
15261
15356
  },
15262
15357
  { immediate: true }
15263
15358
  );
15264
- const closed = shallowRef29(null);
15265
- const held = shallowRef29(false);
15266
- watch36(
15359
+ const closed = shallowRef30(null);
15360
+ const held = shallowRef30(false);
15361
+ watch35(
15267
15362
  () => removal.value?.serial,
15268
15363
  () => {
15269
15364
  held.value = false;
@@ -15279,12 +15374,12 @@ var PptxEditorEditNotice = defineComponent56({
15279
15374
  }, REMOVAL_NOTICE_MS);
15280
15375
  onCleanup(() => clearTimeout(timer));
15281
15376
  });
15282
- onBeforeUnmount12(() => clearTimeout(timer));
15377
+ onBeforeUnmount13(() => clearTimeout(timer));
15283
15378
  return () => {
15284
15379
  const classes = ["pptx-edit-notice", attrs.class, props.className];
15285
15380
  const refused = rejection.value;
15286
15381
  if (!covered.value && editNoticeShows(refused, dismissed.value))
15287
- return /* @__PURE__ */ jsxs41(
15382
+ return /* @__PURE__ */ jsxs42(
15288
15383
  "div",
15289
15384
  {
15290
15385
  ...attrs,
@@ -15309,7 +15404,7 @@ var PptxEditorEditNotice = defineComponent56({
15309
15404
  );
15310
15405
  const removed = removal.value;
15311
15406
  if (!removalNoticeShows(removed, closed.value)) return null;
15312
- return /* @__PURE__ */ jsxs41(
15407
+ return /* @__PURE__ */ jsxs42(
15313
15408
  "div",
15314
15409
  {
15315
15410
  ...attrs,
@@ -15356,7 +15451,7 @@ var PptxEditorEditNotice = defineComponent56({
15356
15451
  });
15357
15452
 
15358
15453
  // src/SlideSorter.tsx
15359
- import { jsx as jsx49, jsxs as jsxs42 } from "vue/jsx-runtime";
15454
+ import { jsx as jsx49, jsxs as jsxs43 } from "vue/jsx-runtime";
15360
15455
  var sameList = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
15361
15456
  var slideSorterProps = {
15362
15457
  /** A class name added to the sorter, as React's `className`. A host `class` also works. */
@@ -15379,10 +15474,10 @@ var PptxEditorSlideSorter = defineComponent57({
15379
15474
  const collapsed = useCollapsedSections();
15380
15475
  useOpenCurrentSection(grouped);
15381
15476
  useSorterRegistration();
15382
- const list = ref41(null);
15477
+ const list = ref40(null);
15383
15478
  const drag = useSlideDrag("x", selected, readOnly, grouped);
15384
- const menu = shallowRef30(null);
15385
- const renaming = ref41(null);
15479
+ const menu = shallowRef31(null);
15480
+ const renaming = ref40(null);
15386
15481
  useSectionRenameRequests((id) => {
15387
15482
  renaming.value = id;
15388
15483
  });
@@ -15393,7 +15488,7 @@ var PptxEditorSlideSorter = defineComponent57({
15393
15488
  onMounted20(() => {
15394
15489
  if (list.value) stopFocus = focusSorterOnShow(list.value);
15395
15490
  });
15396
- onBeforeUnmount13(() => {
15491
+ onBeforeUnmount14(() => {
15397
15492
  stopFocus();
15398
15493
  if (list.value) refocusAfterSorterHides(list.value, editor.value);
15399
15494
  });
@@ -15431,7 +15526,7 @@ var PptxEditorSlideSorter = defineComponent57({
15431
15526
  const groups = grouped.value;
15432
15527
  const own = sectionOfSlide2(groups, current.value);
15433
15528
  const shut = !!own && collapsed.value.includes(own.id);
15434
- const item = (s) => /* @__PURE__ */ jsxs42(
15529
+ const item = (s) => /* @__PURE__ */ jsxs43(
15435
15530
  "li",
15436
15531
  {
15437
15532
  class: "pptx-sorter__item",
@@ -15464,7 +15559,7 @@ var PptxEditorSlideSorter = defineComponent57({
15464
15559
  },
15465
15560
  s.id
15466
15561
  );
15467
- return /* @__PURE__ */ jsxs42("section", { class: ["pptx-sorter", props.className], "aria-label": t("sorter.ariaLabel"), children: [
15562
+ return /* @__PURE__ */ jsxs43("section", { class: ["pptx-sorter", props.className], "aria-label": t("sorter.ariaLabel"), children: [
15468
15563
  /* @__PURE__ */ jsx49(
15469
15564
  "ol",
15470
15565
  {
@@ -15554,7 +15649,7 @@ var ViewSwitch = defineComponent57({
15554
15649
  ArrowRight: 1,
15555
15650
  ArrowDown: 1
15556
15651
  };
15557
- return () => /* @__PURE__ */ jsxs42(
15652
+ return () => /* @__PURE__ */ jsxs43(
15558
15653
  "div",
15559
15654
  {
15560
15655
  class: "pptx-zoom pptx-view-switch",
@@ -15604,8 +15699,8 @@ var DefaultWorkspace = defineComponent57({
15604
15699
  setup(_props, { slots }) {
15605
15700
  const editor = usePptxEditor();
15606
15701
  const view = useEditorState((s) => s.presentationView ?? "normal");
15607
- const box = ref41(null);
15608
- watch37(
15702
+ const box = ref40(null);
15703
+ watch36(
15609
15704
  view,
15610
15705
  () => {
15611
15706
  const active = box.value?.ownerDocument.activeElement;
@@ -15619,17 +15714,17 @@ var DefaultWorkspace = defineComponent57({
15619
15714
  if (box.value) inset = trackNotesInset(box.value);
15620
15715
  });
15621
15716
  onUpdated5(() => inset?.refresh());
15622
- onBeforeUnmount13(() => {
15717
+ onBeforeUnmount14(() => {
15623
15718
  inset?.dispose();
15624
15719
  inset = null;
15625
15720
  });
15626
- return () => /* @__PURE__ */ jsxs42("div", { ref: box, class: "pptx-default__views", children: [
15627
- view.value === "slideSorter" ? /* @__PURE__ */ jsx49("div", { class: "pptx-default__workspace", children: /* @__PURE__ */ jsxs42("div", { class: "pptx-default__main", children: [
15721
+ return () => /* @__PURE__ */ jsxs43("div", { ref: box, class: "pptx-default__views", children: [
15722
+ view.value === "slideSorter" ? /* @__PURE__ */ jsx49("div", { class: "pptx-default__workspace", children: /* @__PURE__ */ jsxs43("div", { class: "pptx-default__main", children: [
15628
15723
  /* @__PURE__ */ jsx49(PptxEditorSlideSorter, {}),
15629
15724
  /* @__PURE__ */ jsx49(PptxEditorEditNotice, {})
15630
15725
  ] }) }) : slots.normal?.(),
15631
15726
  slots.overlay?.(),
15632
- slots.status ? slots.status() : /* @__PURE__ */ jsxs42("div", { class: "pptx-statusbar", children: [
15727
+ slots.status ? slots.status() : /* @__PURE__ */ jsxs43("div", { class: "pptx-statusbar", children: [
15633
15728
  /* @__PURE__ */ jsx49(ReadOnlyBadge, {}),
15634
15729
  /* @__PURE__ */ jsx49(ViewSwitch, {}),
15635
15730
  /* @__PURE__ */ jsx49(PptxEditorZoomPill, {})
@@ -15642,7 +15737,7 @@ var SlideSorterWatch = defineComponent57({
15642
15737
  setup() {
15643
15738
  const editor = usePptxEditor();
15644
15739
  const sorter = useEditorState((s) => s.presentationView === "slideSorter");
15645
- watch37(
15740
+ watch36(
15646
15741
  [sorter, editor],
15647
15742
  ([on, ed]) => {
15648
15743
  if (on && ed && !slideSorterMounted(ed)) warnSlideSorterUnmounted();
@@ -15654,23 +15749,23 @@ var SlideSorterWatch = defineComponent57({
15654
15749
  });
15655
15750
 
15656
15751
  // src/ChromeTooltip.tsx
15657
- import { Teleport as Teleport4, defineComponent as defineComponent58, onMounted as onMounted21, onUnmounted as onUnmounted5, ref as ref42, shallowRef as shallowRef31, watch as watch38 } from "vue";
15752
+ import { Teleport as Teleport4, defineComponent as defineComponent58, onMounted as onMounted21, onUnmounted as onUnmounted5, ref as ref41, shallowRef as shallowRef32, watch as watch37 } from "vue";
15658
15753
  import {
15659
15754
  listenChromeTooltips,
15660
15755
  positionChromeTooltip
15661
15756
  } from "@pptx-editor.dev/core/editor";
15662
- import { jsx as jsx50, jsxs as jsxs43 } from "vue/jsx-runtime";
15757
+ import { jsx as jsx50, jsxs as jsxs44 } from "vue/jsx-runtime";
15663
15758
  var ChromeTooltip = defineComponent58({
15664
15759
  name: "ChromeTooltip",
15665
15760
  setup() {
15666
- const state = shallowRef31(null);
15667
- const bubble = ref42(null);
15761
+ const state = shallowRef32(null);
15762
+ const bubble = ref41(null);
15668
15763
  let stop = null;
15669
15764
  onMounted21(() => {
15670
15765
  stop = listenChromeTooltips(document, (next) => state.value = next);
15671
15766
  });
15672
15767
  onUnmounted5(() => stop?.());
15673
- watch38(
15768
+ watch37(
15674
15769
  [state, bubble],
15675
15770
  ([next, el]) => {
15676
15771
  if (next && el) positionChromeTooltip(el, next.target);
@@ -15680,7 +15775,7 @@ var ChromeTooltip = defineComponent58({
15680
15775
  return () => {
15681
15776
  const s = state.value;
15682
15777
  if (!s) return null;
15683
- return /* @__PURE__ */ jsx50(Teleport4, { to: s.scope, children: /* @__PURE__ */ jsxs43(
15778
+ return /* @__PURE__ */ jsx50(Teleport4, { to: s.scope, children: /* @__PURE__ */ jsxs44(
15684
15779
  "div",
15685
15780
  {
15686
15781
  ref: bubble,
@@ -15771,12 +15866,12 @@ var PptxEditorRoot = defineComponent59({
15771
15866
  let createdFonts;
15772
15867
  let createdFamilies;
15773
15868
  let createdModules;
15774
- const editor = shallowRef32(null);
15775
- const t = shallowRef32(createTranslator2(props.locale));
15869
+ const editor = shallowRef33(null);
15870
+ const t = shallowRef33(createTranslator2(props.locale));
15776
15871
  providePptxEditor(editor);
15777
15872
  provide18(pptxTranslationKey, t);
15778
15873
  expose(createEditorRefApi(() => editor.value));
15779
- watch39(
15874
+ watch38(
15780
15875
  () => localeContentKey(props.locale),
15781
15876
  () => {
15782
15877
  t.value = createTranslator2(props.locale);
@@ -15813,7 +15908,7 @@ var PptxEditorRoot = defineComponent59({
15813
15908
  });
15814
15909
  const documentChurn = churnWarning("PptxEditorRoot", "document");
15815
15910
  const fontsChurn = churnWarning("PptxEditorRoot", "fonts");
15816
- watch39(
15911
+ watch38(
15817
15912
  () => props.document,
15818
15913
  (bytes) => {
15819
15914
  if (!editor.value || !bytes) return;
@@ -15821,21 +15916,21 @@ var PptxEditorRoot = defineComponent59({
15821
15916
  void editor.value.load(bytes);
15822
15917
  }
15823
15918
  );
15824
- watch39(
15919
+ watch38(
15825
15920
  () => props.mode,
15826
15921
  (mode) => editor.value?.setMode(mode)
15827
15922
  );
15828
- watch39(
15923
+ watch38(
15829
15924
  () => props.author,
15830
15925
  (author) => editor.value?.setAuthor(author)
15831
15926
  );
15832
- watch39(
15927
+ watch38(
15833
15928
  () => props.modules,
15834
15929
  (modules) => {
15835
15930
  if (editor.value) warnModulesChanged(createdModules, modules, "PptxEditorRoot");
15836
15931
  }
15837
15932
  );
15838
- watch39(
15933
+ watch38(
15839
15934
  () => [editor.value, props.fonts],
15840
15935
  ([instance2, fonts]) => {
15841
15936
  if (!instance2 || createdFonts === fonts) return;
@@ -15846,7 +15941,7 @@ var PptxEditorRoot = defineComponent59({
15846
15941
  },
15847
15942
  { flush: "post" }
15848
15943
  );
15849
- watch39(
15944
+ watch38(
15850
15945
  () => [editor.value, props.fontFamilies],
15851
15946
  ([instance2, families]) => {
15852
15947
  if (!instance2 || createdFamilies === families) return;
@@ -15916,7 +16011,7 @@ var PptxEditorContent = defineComponent59({
15916
16011
  setup(props, { attrs }) {
15917
16012
  const editorRef = usePptxEditor();
15918
16013
  const menu = useCanvasContextMenu();
15919
- const host = shallowRef32(null);
16014
+ const host = shallowRef33(null);
15920
16015
  let attached = null;
15921
16016
  const sync = () => {
15922
16017
  const editor = editorRef.value;
@@ -15931,7 +16026,7 @@ var PptxEditorContent = defineComponent59({
15931
16026
  }
15932
16027
  };
15933
16028
  onMounted22(sync);
15934
- watch39(editorRef, sync);
16029
+ watch38(editorRef, sync);
15935
16030
  onUnmounted6(() => {
15936
16031
  attached?.detach();
15937
16032
  attached = null;
@@ -16042,11 +16137,11 @@ import {
16042
16137
  computed as computed25,
16043
16138
  defineComponent as defineComponent62,
16044
16139
  nextTick as nextTick10,
16045
- onBeforeUnmount as onBeforeUnmount14,
16046
- ref as ref43,
16047
- shallowRef as shallowRef33,
16140
+ onBeforeUnmount as onBeforeUnmount15,
16141
+ ref as ref42,
16142
+ shallowRef as shallowRef34,
16048
16143
  useId as useId22,
16049
- watch as watch41
16144
+ watch as watch40
16050
16145
  } from "vue";
16051
16146
  import {
16052
16147
  NOTES_FORMAT_BUTTONS,
@@ -16068,7 +16163,7 @@ import {
16068
16163
  } from "@pptx-editor.dev/core/editor";
16069
16164
 
16070
16165
  // src/NotesView.tsx
16071
- import { defineComponent as defineComponent61, onMounted as onMounted23, watch as watch40 } from "vue";
16166
+ import { defineComponent as defineComponent61, onMounted as onMounted23, watch as watch39 } from "vue";
16072
16167
  import {
16073
16168
  notesFieldBeforeInput,
16074
16169
  notesFieldFocused,
@@ -16114,7 +16209,7 @@ var NotesField = defineComponent61({
16114
16209
  props.onSelection();
16115
16210
  };
16116
16211
  onMounted23(draw);
16117
- watch40(() => [props.paragraphs, props.drafting], draw, { flush: "post" });
16212
+ watch39(() => [props.paragraphs, props.drafting], draw, { flush: "post" });
16118
16213
  const onKeydown = (e) => {
16119
16214
  if (composing) return;
16120
16215
  notesFieldKeyDown(e, e.currentTarget, {
@@ -16166,7 +16261,7 @@ var NotesField = defineComponent61({
16166
16261
  });
16167
16262
 
16168
16263
  // src/NotesPane.tsx
16169
- import { jsx as jsx52, jsxs as jsxs44 } from "vue/jsx-runtime";
16264
+ import { jsx as jsx52, jsxs as jsxs45 } from "vue/jsx-runtime";
16170
16265
  var notesPaneProps = {
16171
16266
  /** Whether the pane is open, controlled. Use with the `update:open` event (`v-model:open`). */
16172
16267
  open: { type: Boolean, default: void 0 },
@@ -16184,8 +16279,8 @@ var notesPaneProps = {
16184
16279
  };
16185
16280
  function useNotesOpen(props, emit) {
16186
16281
  const shared = usePaneState();
16187
- const own = ref43(props.defaultOpen ?? true);
16188
- const owner = ref43(false);
16282
+ const own = ref42(props.defaultOpen ?? true);
16283
+ const owner = ref42(false);
16189
16284
  const open = computed25(
16190
16285
  () => props.open !== void 0 ? props.open : shared && owner.value ? shared.notesOpen.value ?? props.defaultOpen ?? true : own.value
16191
16286
  );
@@ -16206,11 +16301,11 @@ function useNotesOpen(props, emit) {
16206
16301
  }
16207
16302
  };
16208
16303
  claim();
16209
- watch41(() => shared?.notesOpen.value, claim);
16210
- onBeforeUnmount14(() => {
16304
+ watch40(() => shared?.notesOpen.value, claim);
16305
+ onBeforeUnmount15(() => {
16211
16306
  if (slot?.current === handler) slot.current = null;
16212
16307
  });
16213
- watch41(
16308
+ watch40(
16214
16309
  [open, owner],
16215
16310
  () => {
16216
16311
  if (!shared || !owner.value) return;
@@ -16233,11 +16328,11 @@ var PptxEditorNotesPane = defineComponent62({
16233
16328
  const readOnly = useEditorState((s) => s.mode === "view");
16234
16329
  const pane = useNotesOpen(props, emit);
16235
16330
  const notesId = useId22();
16236
- const draft = shallowRef33(null);
16237
- const refusal = ref43(null);
16238
- const formats = shallowRef33(NO_NOTES_FORMATS);
16239
- const canFormat = ref43(false);
16240
- const field = ref43(null);
16331
+ const draft = shallowRef34(null);
16332
+ const refusal = ref42(null);
16333
+ const formats = shallowRef34(NO_NOTES_FORMATS);
16334
+ const canFormat = ref42(false);
16335
+ const field = ref42(null);
16241
16336
  let pending = null;
16242
16337
  let bound = null;
16243
16338
  const restore = { value: null };
@@ -16268,7 +16363,7 @@ var PptxEditorNotesPane = defineComponent62({
16268
16363
  });
16269
16364
  refusal.value = r.ok ? null : rejectionMessage(t, r);
16270
16365
  };
16271
- watch41(
16366
+ watch40(
16272
16367
  slideId,
16273
16368
  (id) => {
16274
16369
  if (pending && pending.slideId !== id) commit();
@@ -16276,7 +16371,7 @@ var PptxEditorNotesPane = defineComponent62({
16276
16371
  },
16277
16372
  { immediate: true }
16278
16373
  );
16279
- watch41(draft, (d, _old, onCleanup) => {
16374
+ watch40(draft, (d, _old, onCleanup) => {
16280
16375
  if (!d) return;
16281
16376
  const doc = field.value?.ownerDocument;
16282
16377
  const onPointerDown = (e) => {
@@ -16285,14 +16380,14 @@ var PptxEditorNotesPane = defineComponent62({
16285
16380
  doc?.addEventListener("pointerdown", onPointerDown, true);
16286
16381
  onCleanup(() => doc?.removeEventListener("pointerdown", onPointerDown, true));
16287
16382
  });
16288
- watch41(
16383
+ watch40(
16289
16384
  () => pane.open.value,
16290
16385
  (open) => {
16291
16386
  if (!open) commit();
16292
16387
  },
16293
16388
  { flush: "post" }
16294
16389
  );
16295
- onBeforeUnmount14(() => commit());
16390
+ onBeforeUnmount15(() => commit());
16296
16391
  const readFormats = () => {
16297
16392
  const el = field.value;
16298
16393
  if (el) followNotesArm(el);
@@ -16306,7 +16401,7 @@ var PptxEditorNotesPane = defineComponent62({
16306
16401
  const ed = editor.value;
16307
16402
  if (ed && ed.snapshot().selection.kind !== "none") ed.setSelection({ kind: "none" });
16308
16403
  };
16309
- const active = ref43(false);
16404
+ const active = ref42(false);
16310
16405
  const target = () => ({
16311
16406
  formats: formats.value,
16312
16407
  readOnly: readOnly.value,
@@ -16327,7 +16422,7 @@ var PptxEditorNotesPane = defineComponent62({
16327
16422
  canFormat.value = false;
16328
16423
  formats.value = NO_NOTES_FORMATS;
16329
16424
  };
16330
- watch41(
16425
+ watch40(
16331
16426
  active,
16332
16427
  (on, _old, onCleanup) => {
16333
16428
  const doc = field.value?.ownerDocument;
@@ -16340,10 +16435,10 @@ var PptxEditorNotesPane = defineComponent62({
16340
16435
  );
16341
16436
  const painter = createNotesFindPainter();
16342
16437
  let mounted = true;
16343
- const findCount = ref43(0);
16438
+ const findCount = ref42(0);
16344
16439
  const selectionKind = useEditorState((s) => s.selection.kind);
16345
16440
  const revision = useEditorState((s) => s.revision);
16346
- watch41(
16441
+ watch40(
16347
16442
  editor,
16348
16443
  (ed, _old, onCleanup) => {
16349
16444
  if (ed)
@@ -16355,7 +16450,7 @@ var PptxEditorNotesPane = defineComponent62({
16355
16450
  },
16356
16451
  { immediate: true }
16357
16452
  );
16358
- watch41(
16453
+ watch40(
16359
16454
  [
16360
16455
  editor,
16361
16456
  () => pane.open.value,
@@ -16378,17 +16473,17 @@ var PptxEditorNotesPane = defineComponent62({
16378
16473
  }),
16379
16474
  { flush: "post", immediate: true }
16380
16475
  );
16381
- onBeforeUnmount14(() => {
16476
+ onBeforeUnmount15(() => {
16382
16477
  mounted = false;
16383
16478
  painter.stop();
16384
16479
  });
16385
- watch41([editor, formats, readOnly, canFormat], () => {
16480
+ watch40([editor, formats, readOnly, canFormat], () => {
16386
16481
  if (editor.value && focused) setNotesTarget(editor.value, target());
16387
16482
  });
16388
- watch41(editor, (_next, was) => {
16483
+ watch40(editor, (_next, was) => {
16389
16484
  if (was) setNotesTarget(was, null);
16390
16485
  });
16391
- onBeforeUnmount14(() => {
16486
+ onBeforeUnmount15(() => {
16392
16487
  if (editor.value) setNotesTarget(editor.value, null);
16393
16488
  });
16394
16489
  const onDraft = (text2) => {
@@ -16442,7 +16537,7 @@ var PptxEditorNotesPane = defineComponent62({
16442
16537
  if (masterView.value) return null;
16443
16538
  const open = pane.open.value;
16444
16539
  const d = draft.value;
16445
- return /* @__PURE__ */ jsxs44(
16540
+ return /* @__PURE__ */ jsxs45(
16446
16541
  "section",
16447
16542
  {
16448
16543
  class: ["pptx-notes", props.className],
@@ -16450,7 +16545,7 @@ var PptxEditorNotesPane = defineComponent62({
16450
16545
  "aria-label": t("notes.title"),
16451
16546
  "data-open": open ? "true" : "false",
16452
16547
  children: [
16453
- /* @__PURE__ */ jsxs44("div", { class: "pptx-notes__head", onMousedown: keepFocus, children: [
16548
+ /* @__PURE__ */ jsxs45("div", { class: "pptx-notes__head", onMousedown: keepFocus, children: [
16454
16549
  /* @__PURE__ */ jsx52("span", { children: t("notes.title") }),
16455
16550
  open && !readOnly.value && props.showFormatButtons ? /* @__PURE__ */ jsx52("div", { class: "pptx-notes__format", role: "group", "aria-label": t("notes.format"), children: NOTES_FORMAT_BUTTONS.map(([format, icon, key]) => /* @__PURE__ */ jsx52(
16456
16551
  ToolButton,
@@ -16514,7 +16609,7 @@ import {
16514
16609
  computed as computed26,
16515
16610
  defineComponent as defineComponent63,
16516
16611
  nextTick as nextTick11,
16517
- shallowRef as shallowRef34,
16612
+ shallowRef as shallowRef35,
16518
16613
  useId as useId23
16519
16614
  } from "vue";
16520
16615
  import {
@@ -16524,13 +16619,13 @@ import {
16524
16619
  openFailureKey,
16525
16620
  shownOpenFailure
16526
16621
  } from "@pptx-editor.dev/core/editor";
16527
- import { jsx as jsx53, jsxs as jsxs45 } from "vue/jsx-runtime";
16622
+ import { jsx as jsx53, jsxs as jsxs46 } from "vue/jsx-runtime";
16528
16623
  function useOpenFailure(options = {}) {
16529
16624
  const current = useEditorState(shownOpenFailure);
16530
16625
  const ready = useEditorState((s) => s.status === "ready");
16531
16626
  const { t: ambient } = useTranslation();
16532
16627
  const t = options.t ?? ambient;
16533
- const dismissed = shallowRef34(null);
16628
+ const dismissed = shallowRef35(null);
16534
16629
  const failure = computed26(
16535
16630
  () => current.value !== null && current.value !== dismissed.value ? current.value : null
16536
16631
  );
@@ -16595,9 +16690,9 @@ var PptxEditorOpenFailure = defineComponent63({
16595
16690
  const { t } = useChromeTranslateScope(() => props.t);
16596
16691
  const { failure, message, kept, dismiss } = useOpenFailure({ t });
16597
16692
  const titleId = useId23();
16598
- const copy = shallowRef34(null);
16599
- const reportRef = shallowRef34(null);
16600
- const rootRef = shallowRef34(null);
16693
+ const copy = shallowRef35(null);
16694
+ const reportRef = shallowRef35(null);
16695
+ const rootRef = shallowRef35(null);
16601
16696
  const editor = usePptxEditor();
16602
16697
  return () => {
16603
16698
  const shown = failure.value;
@@ -16617,7 +16712,7 @@ var PptxEditorOpenFailure = defineComponent63({
16617
16712
  if (focused) editor.value?.focus();
16618
16713
  };
16619
16714
  const context = { failure: shown, message: packaged, dismiss: close };
16620
- return /* @__PURE__ */ jsxs45(
16715
+ return /* @__PURE__ */ jsxs46(
16621
16716
  "div",
16622
16717
  {
16623
16718
  ref: rootRef,
@@ -16627,7 +16722,7 @@ var PptxEditorOpenFailure = defineComponent63({
16627
16722
  "aria-labelledby": titleId,
16628
16723
  "data-reason": shown.reason,
16629
16724
  children: [
16630
- /* @__PURE__ */ jsxs45("div", { class: "pptx-open-failure__text", role: "alert", children: [
16725
+ /* @__PURE__ */ jsxs46("div", { class: "pptx-open-failure__text", role: "alert", children: [
16631
16726
  /* @__PURE__ */ jsx53("p", { id: titleId, class: "pptx-open-failure__title", children: props.title ?? t("openFailure.title") }),
16632
16727
  /* @__PURE__ */ jsx53("div", { class: "pptx-open-failure__message", children: slots.message ? slots.message(context) : typeof props.message === "function" ? props.message(shown) : props.message ?? packaged }),
16633
16728
  kept.value ? /* @__PURE__ */ jsx53("p", { class: "pptx-open-failure__kept", children: t("openFailure.kept") }) : null,
@@ -16646,7 +16741,7 @@ var PptxEditorOpenFailure = defineComponent63({
16646
16741
  onFocus: (e) => e.currentTarget.select()
16647
16742
  }
16648
16743
  ) : null,
16649
- /* @__PURE__ */ jsxs45("div", { class: "pptx-open-failure__actions", children: [
16744
+ /* @__PURE__ */ jsxs46("div", { class: "pptx-open-failure__actions", children: [
16650
16745
  slots.actions ? slots.actions(context) : props.actions?.(context),
16651
16746
  props.showCopy ? /* @__PURE__ */ jsx53(
16652
16747
  "button",
@@ -16671,9 +16766,9 @@ var PptxEditorOpenFailure = defineComponent63({
16671
16766
  import {
16672
16767
  computed as computed27,
16673
16768
  defineComponent as defineComponent64,
16674
- ref as ref44,
16675
- shallowRef as shallowRef35,
16676
- watch as watch42
16769
+ ref as ref43,
16770
+ shallowRef as shallowRef36,
16771
+ watch as watch41
16677
16772
  } from "vue";
16678
16773
  import {
16679
16774
  applyLocalFonts,
@@ -16681,7 +16776,7 @@ import {
16681
16776
  fontNoticeFamilies,
16682
16777
  fontNoticeList
16683
16778
  } from "@pptx-editor.dev/core/editor";
16684
- import { jsx as jsx54, jsxs as jsxs46 } from "vue/jsx-runtime";
16779
+ import { jsx as jsx54, jsxs as jsxs47 } from "vue/jsx-runtime";
16685
16780
  var pptxEditorFontNoticeProps = {
16686
16781
  ...chromeTranslateProp,
16687
16782
  /** A class name added to the notice, as React's `className`. A host `class` also works. */
@@ -16698,12 +16793,12 @@ var PptxEditorFontNotice = defineComponent64({
16698
16793
  const loadState = useEditorState((s) => s.status);
16699
16794
  const missing = computed27(() => fontNoticeFamilies(substituted.value));
16700
16795
  const key = computed27(() => missing.value.join("|"));
16701
- const dismissed = shallowRef35(null);
16702
- const outcome = shallowRef35(null);
16796
+ const dismissed = shallowRef36(null);
16797
+ const outcome = shallowRef36(null);
16703
16798
  const status = computed27(() => outcome.value?.key === key.value ? outcome.value.text : null);
16704
- const busy = ref44(false);
16799
+ const busy = ref43(false);
16705
16800
  let round = 0;
16706
- watch42(loadState, () => {
16801
+ watch41(loadState, () => {
16707
16802
  round += 1;
16708
16803
  outcome.value = null;
16709
16804
  });
@@ -16724,7 +16819,7 @@ var PptxEditorFontNotice = defineComponent64({
16724
16819
  return () => {
16725
16820
  const families = missing.value;
16726
16821
  if (families.length === 0 && !status.value || dismissed.value === key.value) return null;
16727
- return /* @__PURE__ */ jsxs46(
16822
+ return /* @__PURE__ */ jsxs47(
16728
16823
  "div",
16729
16824
  {
16730
16825
  ...attrs,
@@ -16732,7 +16827,7 @@ var PptxEditorFontNotice = defineComponent64({
16732
16827
  role: "status",
16733
16828
  onMousedown: keepFocus,
16734
16829
  children: [
16735
- /* @__PURE__ */ jsxs46("span", { class: "pptx-font-notice__text", children: [
16830
+ /* @__PURE__ */ jsxs47("span", { class: "pptx-font-notice__text", children: [
16736
16831
  families.length ? t("fonts.notice", { families: fontNoticeList(families, t) }) : status.value,
16737
16832
  families.length && status.value ? ` ${status.value}` : ""
16738
16833
  ] }),
@@ -16769,8 +16864,8 @@ import {
16769
16864
  h as h20,
16770
16865
  isVNode as isVNode7,
16771
16866
  normalizeClass as normalizeClass7,
16772
- ref as ref45,
16773
- watch as watch43,
16867
+ ref as ref44,
16868
+ watch as watch42,
16774
16869
  nextTick as nextTick12,
16775
16870
  Comment as Comment4,
16776
16871
  Text as Text4,
@@ -16862,20 +16957,20 @@ var PptxEditorRibbon = Object.assign(
16862
16957
  const { t } = useTranslation();
16863
16958
  const baseId = useId24();
16864
16959
  const layout = useEditorState((s) => ribbonTabs(s), sameLayout);
16865
- const own = ref45(props.defaultTab);
16960
+ const own = ref44(props.defaultTab);
16866
16961
  const names = /* @__PURE__ */ new Map();
16867
- const root = ref45(null);
16962
+ const root = ref44(null);
16868
16963
  let focusInside = false;
16869
16964
  const select = (id) => {
16870
16965
  if (props.tab === void 0) own.value = id;
16871
16966
  emit("update:tab", id);
16872
16967
  emit("tabChange", id);
16873
16968
  };
16874
- const shown = ref45({
16969
+ const shown = ref44({
16875
16970
  id: void 0,
16876
16971
  fellBack: false
16877
16972
  });
16878
- watch43(
16973
+ watch42(
16879
16974
  () => `${shown.value.fellBack}|${shown.value.id ?? ""}`,
16880
16975
  async () => {
16881
16976
  const { id, fellBack } = shown.value;
@@ -16889,7 +16984,7 @@ var PptxEditorRibbon = Object.assign(
16889
16984
  );
16890
16985
  const insertions = useEditorState((s) => s.insertions);
16891
16986
  let insertTab = null;
16892
- watch43(insertions, async () => {
16987
+ watch42(insertions, async () => {
16893
16988
  await nextTick12();
16894
16989
  if (insertTab !== null && insertTab !== (props.tab ?? own.value)) select(insertTab);
16895
16990
  });
@@ -17178,9 +17273,9 @@ import {
17178
17273
  computed as computed28,
17179
17274
  getCurrentScope as getCurrentScope6,
17180
17275
  onScopeDispose as onScopeDispose9,
17181
- shallowRef as shallowRef36,
17276
+ shallowRef as shallowRef37,
17182
17277
  toValue as toValue8,
17183
- watch as watch44
17278
+ watch as watch43
17184
17279
  } from "vue";
17185
17280
  import {
17186
17281
  ZOOM_LEVELS,
@@ -17212,7 +17307,7 @@ function useZoom() {
17212
17307
  function useEditorEvent(event, handler) {
17213
17308
  const editor = usePptxEditor();
17214
17309
  if (!getCurrentScope6()) return;
17215
- watch44(
17310
+ watch43(
17216
17311
  editor,
17217
17312
  (instance, _prev, onCleanup) => {
17218
17313
  if (instance) onCleanup(onEditorEvent(instance, event, handler));
@@ -17221,9 +17316,9 @@ function useEditorEvent(event, handler) {
17221
17316
  );
17222
17317
  }
17223
17318
  function useEditorSnapshot(editor) {
17224
- const revision = shallowRef36(0);
17319
+ const revision = shallowRef37(0);
17225
17320
  if (!getCurrentScope6()) return revision;
17226
- const stop = watch44(
17321
+ const stop = watch43(
17227
17322
  () => toValue8(editor),
17228
17323
  (instance, _prev, onCleanup) => {
17229
17324
  if (!instance) return;
@@ -17245,9 +17340,9 @@ function useScopeClassName() {
17245
17340
  // src/usePptxSource.ts
17246
17341
  import {
17247
17342
  computed as computed29,
17248
- shallowRef as shallowRef37,
17343
+ shallowRef as shallowRef38,
17249
17344
  toValue as toValue9,
17250
- watch as watch45
17345
+ watch as watch44
17251
17346
  } from "vue";
17252
17347
  import {
17253
17348
  editorHostDocument,
@@ -17260,13 +17355,13 @@ import {
17260
17355
  watchEagerPptxFonts
17261
17356
  } from "@pptx-editor.dev/core/editor";
17262
17357
  function usePptxSource(source, options = {}) {
17263
- const bytes = shallowRef37(void 0);
17264
- const fonts = shallowRef37(void 0);
17265
- const error = shallowRef37(null);
17266
- const documentLoading = shallowRef37(toValue9(source) != null);
17267
- const fontsSettled = shallowRef37(toValue9(options).fonts === void 0);
17358
+ const bytes = shallowRef38(void 0);
17359
+ const fonts = shallowRef38(void 0);
17360
+ const error = shallowRef38(null);
17361
+ const documentLoading = shallowRef38(toValue9(source) != null);
17362
+ const fontsSettled = shallowRef38(toValue9(options).fonts === void 0);
17268
17363
  const resolver = pptxSourceFontsResolver(() => toValue9(options).fonts);
17269
- watch45(
17364
+ watch44(
17270
17365
  () => pptxFontsShape(toValue9(options).fonts),
17271
17366
  (_shape, _previous, onCleanup) => {
17272
17367
  const fontsSource = toValue9(options).fonts;
@@ -17291,7 +17386,7 @@ function usePptxSource(source, options = {}) {
17291
17386
  },
17292
17387
  { immediate: true }
17293
17388
  );
17294
- watch45(
17389
+ watch44(
17295
17390
  () => toValue9(source),
17296
17391
  (next, _previous, onCleanup) => {
17297
17392
  if (next == null) {
@@ -17339,12 +17434,12 @@ function usePptxSource(source, options = {}) {
17339
17434
  }
17340
17435
  function useEditorHostDocument() {
17341
17436
  const editorRef = usePptxEditor();
17342
- const current = shallowRef37(null);
17437
+ const current = shallowRef38(null);
17343
17438
  const read = () => {
17344
17439
  const editor = editorRef.value;
17345
17440
  current.value = editor ? editorHostDocument(editor) : typeof globalThis.document === "undefined" ? null : globalThis.document;
17346
17441
  };
17347
- watch45(
17442
+ watch44(
17348
17443
  () => editorRef.value,
17349
17444
  (editor, _previous, onCleanup) => {
17350
17445
  read();
@@ -17532,7 +17627,7 @@ var PptxEditorDefault = defineComponent67({
17532
17627
  slots: Object,
17533
17628
  setup(props, { attrs, emit, expose, slots }) {
17534
17629
  const instance = getCurrentInstance3();
17535
- const root = shallowRef38(null);
17630
+ const root = shallowRef39(null);
17536
17631
  expose(createEditorRefApi2(() => root.value?.getEditor() ?? null));
17537
17632
  return () => {
17538
17633
  warnOpenFailureActions(