@pptx-editor.dev/react 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +476 -388
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -987,8 +987,8 @@ import {
|
|
|
987
987
|
useImperativeHandle,
|
|
988
988
|
useLayoutEffect as useLayoutEffect19,
|
|
989
989
|
useMemo as useMemo19,
|
|
990
|
-
useRef as
|
|
991
|
-
useState as
|
|
990
|
+
useRef as useRef49,
|
|
991
|
+
useState as useState51
|
|
992
992
|
} from "react";
|
|
993
993
|
import {
|
|
994
994
|
churnWarning,
|
|
@@ -997,7 +997,7 @@ import {
|
|
|
997
997
|
localeContentKey,
|
|
998
998
|
repaintSurfaceOf,
|
|
999
999
|
reportFontError,
|
|
1000
|
-
translateKeyOrText as
|
|
1000
|
+
translateKeyOrText as translateKeyOrText21,
|
|
1001
1001
|
warnModulesChanged
|
|
1002
1002
|
} from "@pptx-editor.dev/core/editor";
|
|
1003
1003
|
|
|
@@ -6986,7 +6986,7 @@ function useCanvasContextMenu() {
|
|
|
6986
6986
|
const open = (owner, at) => {
|
|
6987
6987
|
if (entry === false || !editor || editor.snapshot().status !== "ready") return;
|
|
6988
6988
|
const kind = canvasMenuKind(editor.snapshot());
|
|
6989
|
-
const point = canvasMenuPoint(owner, at);
|
|
6989
|
+
const point = canvasMenuPoint(owner, at, editor.snapshot().selection.kind === "text");
|
|
6990
6990
|
setMenu({ at: point, kind, keyboard: at === null, owner });
|
|
6991
6991
|
};
|
|
6992
6992
|
const onContextMenu = (e) => {
|
|
@@ -7014,8 +7014,8 @@ function useCanvasContextMenu() {
|
|
|
7014
7014
|
import {
|
|
7015
7015
|
useEffect as useEffect37,
|
|
7016
7016
|
useLayoutEffect as useLayoutEffect17,
|
|
7017
|
-
useRef as
|
|
7018
|
-
useState as
|
|
7017
|
+
useRef as useRef47,
|
|
7018
|
+
useState as useState49
|
|
7019
7019
|
} from "react";
|
|
7020
7020
|
import {
|
|
7021
7021
|
STATUS_BAR_VIEW_OPTIONS,
|
|
@@ -7031,7 +7031,7 @@ import {
|
|
|
7031
7031
|
slideSorterMounted,
|
|
7032
7032
|
sorterKeyDown,
|
|
7033
7033
|
trackNotesInset,
|
|
7034
|
-
translateKeyOrText as
|
|
7034
|
+
translateKeyOrText as translateKeyOrText20,
|
|
7035
7035
|
warnSlideSorterUnmounted
|
|
7036
7036
|
} from "@pptx-editor.dev/core/editor";
|
|
7037
7037
|
|
|
@@ -7043,8 +7043,8 @@ import {
|
|
|
7043
7043
|
useLayoutEffect as useLayoutEffect16,
|
|
7044
7044
|
useMemo as useMemo18,
|
|
7045
7045
|
useReducer,
|
|
7046
|
-
useRef as
|
|
7047
|
-
useState as
|
|
7046
|
+
useRef as useRef46,
|
|
7047
|
+
useState as useState48
|
|
7048
7048
|
} from "react";
|
|
7049
7049
|
import {
|
|
7050
7050
|
ZOOM_MENU_LEVELS,
|
|
@@ -8414,7 +8414,7 @@ function RenameField(props) {
|
|
|
8414
8414
|
}
|
|
8415
8415
|
|
|
8416
8416
|
// src/SidePanel.tsx
|
|
8417
|
-
import { useEffect as useEffect32, useRef as
|
|
8417
|
+
import { useEffect as useEffect32, useRef as useRef43, useState as useState45 } from "react";
|
|
8418
8418
|
import {
|
|
8419
8419
|
SIDE_PANEL_TAB_ICONS,
|
|
8420
8420
|
listenPaneRequests,
|
|
@@ -9435,12 +9435,12 @@ function DiagramTextPane() {
|
|
|
9435
9435
|
}
|
|
9436
9436
|
|
|
9437
9437
|
// src/FormatPanel.tsx
|
|
9438
|
-
import { useEffect as useEffect31, useLayoutEffect as useLayoutEffect13, useRef as
|
|
9438
|
+
import { useEffect as useEffect31, useLayoutEffect as useLayoutEffect13, useRef as useRef42, useState as useState44 } from "react";
|
|
9439
9439
|
import {
|
|
9440
9440
|
chromeControlForSlot as chromeControlForSlot6,
|
|
9441
9441
|
formatSectionsOf,
|
|
9442
9442
|
formatControlMixed,
|
|
9443
|
-
formatTargetKey as
|
|
9443
|
+
formatTargetKey as formatTargetKey6,
|
|
9444
9444
|
formatSelectionCategory,
|
|
9445
9445
|
formatSectionOpen,
|
|
9446
9446
|
setFormatSectionOpen,
|
|
@@ -11137,25 +11137,110 @@ function FormatLineWidth() {
|
|
|
11137
11137
|
);
|
|
11138
11138
|
}
|
|
11139
11139
|
|
|
11140
|
+
// src/FormatFillTransparency.tsx
|
|
11141
|
+
import { useCallback as useCallback14, useRef as useRef39, useState as useState42 } from "react";
|
|
11142
|
+
import {
|
|
11143
|
+
formatFillTransparency,
|
|
11144
|
+
formatTargetKey as formatTargetKey3,
|
|
11145
|
+
translateKeyOrText as translateKeyOrText17
|
|
11146
|
+
} from "@pptx-editor.dev/core/editor";
|
|
11147
|
+
import { jsx as jsx48, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
11148
|
+
function FormatFillTransparency() {
|
|
11149
|
+
const editor = usePptxEditor();
|
|
11150
|
+
const snapshot = useEditorState((s) => s);
|
|
11151
|
+
const { t } = useTranslation();
|
|
11152
|
+
const [preview, setPreview] = useState42(null);
|
|
11153
|
+
const [error, setError] = useState42(null);
|
|
11154
|
+
const field = formatFillTransparency(editor);
|
|
11155
|
+
const key = `${editor?.session?.id}:${formatTargetKey3(snapshot)}`;
|
|
11156
|
+
const commit = (percent) => {
|
|
11157
|
+
if (!editor || !field || `${editor.session?.id}:${formatTargetKey3(editor.snapshot())}` !== key)
|
|
11158
|
+
return t("disabled.invalidValue");
|
|
11159
|
+
if (percent === field.value) return null;
|
|
11160
|
+
const result = editor.exec({
|
|
11161
|
+
type: "patchShapeFormat",
|
|
11162
|
+
target: field.target,
|
|
11163
|
+
patch: field.patch(percent)
|
|
11164
|
+
});
|
|
11165
|
+
return result.ok ? null : translateKeyOrText17(t, result.reason);
|
|
11166
|
+
};
|
|
11167
|
+
const latest = useRef39(commit);
|
|
11168
|
+
latest.current = commit;
|
|
11169
|
+
const attached = useRef39(null);
|
|
11170
|
+
const slider = useCallback14((el) => {
|
|
11171
|
+
attached.current?.();
|
|
11172
|
+
attached.current = null;
|
|
11173
|
+
if (!el) return;
|
|
11174
|
+
const release = () => {
|
|
11175
|
+
setPreview(null);
|
|
11176
|
+
setError(latest.current(Number(el.value)));
|
|
11177
|
+
};
|
|
11178
|
+
el.addEventListener("change", release);
|
|
11179
|
+
attached.current = () => el.removeEventListener("change", release);
|
|
11180
|
+
}, []);
|
|
11181
|
+
if (!field) return null;
|
|
11182
|
+
const label = t(field.labelKey);
|
|
11183
|
+
const value = preview ?? field.value;
|
|
11184
|
+
const disabled = snapshot.mode === "view";
|
|
11185
|
+
return /* @__PURE__ */ jsxs43("div", { className: "pptx-format-transparency", "data-format-fill-transparency": "", children: [
|
|
11186
|
+
/* @__PURE__ */ jsx48(
|
|
11187
|
+
"input",
|
|
11188
|
+
{
|
|
11189
|
+
ref: slider,
|
|
11190
|
+
type: "range",
|
|
11191
|
+
className: "pptx-format-transparency__slider",
|
|
11192
|
+
"data-format-slider": field.id,
|
|
11193
|
+
"aria-label": label,
|
|
11194
|
+
"aria-valuetext": `${value}${field.unit}`,
|
|
11195
|
+
min: field.min,
|
|
11196
|
+
max: field.max,
|
|
11197
|
+
step: 1,
|
|
11198
|
+
value,
|
|
11199
|
+
disabled,
|
|
11200
|
+
onChange: (e) => setPreview(Number(e.target.value)),
|
|
11201
|
+
onBlur: () => setPreview(null)
|
|
11202
|
+
}
|
|
11203
|
+
),
|
|
11204
|
+
/* @__PURE__ */ jsx48(
|
|
11205
|
+
FormatNumberField,
|
|
11206
|
+
{
|
|
11207
|
+
label,
|
|
11208
|
+
property: field.id,
|
|
11209
|
+
value: String(value),
|
|
11210
|
+
unit: field.unit,
|
|
11211
|
+
min: field.min,
|
|
11212
|
+
max: field.max,
|
|
11213
|
+
disabled,
|
|
11214
|
+
onCommit: (percent) => {
|
|
11215
|
+
setError(null);
|
|
11216
|
+
return commit(percent);
|
|
11217
|
+
}
|
|
11218
|
+
},
|
|
11219
|
+
key
|
|
11220
|
+
),
|
|
11221
|
+
error ? /* @__PURE__ */ jsx48("span", { className: "pptx-chart-pane__error", role: "alert", children: error }) : null
|
|
11222
|
+
] });
|
|
11223
|
+
}
|
|
11224
|
+
|
|
11140
11225
|
// src/FormatDetails.tsx
|
|
11141
|
-
import { useState as
|
|
11226
|
+
import { useState as useState43, useRef as useRef41, useLayoutEffect as useLayoutEffect12 } from "react";
|
|
11142
11227
|
import {
|
|
11143
11228
|
chromeControlForSlot as chromeControlForSlot5,
|
|
11144
11229
|
createGradientStopIdentity,
|
|
11145
11230
|
colorChoiceOf as colorChoiceOf2,
|
|
11146
11231
|
colorPickOf as colorPickOf3,
|
|
11147
11232
|
formatPropertyGroups,
|
|
11148
|
-
formatTargetKey as
|
|
11149
|
-
translateKeyOrText as
|
|
11233
|
+
formatTargetKey as formatTargetKey4,
|
|
11234
|
+
translateKeyOrText as translateKeyOrText18
|
|
11150
11235
|
} from "@pptx-editor.dev/core/editor";
|
|
11151
11236
|
|
|
11152
11237
|
// src/FormatGradientPicker.tsx
|
|
11153
|
-
import { useRef as
|
|
11238
|
+
import { useRef as useRef40 } from "react";
|
|
11154
11239
|
import {
|
|
11155
11240
|
gradientPreviewCss,
|
|
11156
11241
|
gradientPreviewStops
|
|
11157
11242
|
} from "@pptx-editor.dev/core/editor";
|
|
11158
|
-
import { jsx as
|
|
11243
|
+
import { jsx as jsx49, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
11159
11244
|
function FormatGradientPicker({
|
|
11160
11245
|
gradient,
|
|
11161
11246
|
selected,
|
|
@@ -11163,7 +11248,7 @@ function FormatGradientPicker({
|
|
|
11163
11248
|
}) {
|
|
11164
11249
|
const { t } = useTranslation();
|
|
11165
11250
|
const rows = useEditorState((s) => s.themeColors);
|
|
11166
|
-
const root =
|
|
11251
|
+
const root = useRef40(null);
|
|
11167
11252
|
const stops = gradientPreviewStops(gradient, rows);
|
|
11168
11253
|
const background = gradientPreviewCss(stops);
|
|
11169
11254
|
const label = (index) => `${t("inspector.gradientStop", { index: index + 1 })} \xB7 ${Math.round(stops[index].position * 100)}%`;
|
|
@@ -11174,8 +11259,8 @@ function FormatGradientPicker({
|
|
|
11174
11259
|
const buttons = root.current?.querySelectorAll("[data-format-stop-marker]");
|
|
11175
11260
|
buttons?.[index]?.focus();
|
|
11176
11261
|
};
|
|
11177
|
-
return /* @__PURE__ */
|
|
11178
|
-
/* @__PURE__ */
|
|
11262
|
+
return /* @__PURE__ */ jsxs44("div", { className: "pptx-gradient-picker", ref: root, children: [
|
|
11263
|
+
/* @__PURE__ */ jsx49(
|
|
11179
11264
|
"div",
|
|
11180
11265
|
{
|
|
11181
11266
|
className: "pptx-gradient-picker__ramp",
|
|
@@ -11184,7 +11269,7 @@ function FormatGradientPicker({
|
|
|
11184
11269
|
"aria-label": t(background ? "gradient.preview" : "inspector.previewUnavailable")
|
|
11185
11270
|
}
|
|
11186
11271
|
),
|
|
11187
|
-
/* @__PURE__ */
|
|
11272
|
+
/* @__PURE__ */ jsx49("div", { className: "pptx-gradient-picker__markers", role: "group", "aria-label": t("gradient.stops"), children: stops.map((stop, index) => /* @__PURE__ */ jsx49(
|
|
11188
11273
|
"button",
|
|
11189
11274
|
{
|
|
11190
11275
|
type: "button",
|
|
@@ -11202,7 +11287,7 @@ function FormatGradientPicker({
|
|
|
11202
11287
|
move(next);
|
|
11203
11288
|
}
|
|
11204
11289
|
},
|
|
11205
|
-
children: /* @__PURE__ */
|
|
11290
|
+
children: /* @__PURE__ */ jsx49(
|
|
11206
11291
|
"span",
|
|
11207
11292
|
{
|
|
11208
11293
|
style: stop.color ? { backgroundColor: stop.color, opacity: stop.opacity } : void 0
|
|
@@ -11211,16 +11296,16 @@ function FormatGradientPicker({
|
|
|
11211
11296
|
},
|
|
11212
11297
|
stop.id
|
|
11213
11298
|
)) }),
|
|
11214
|
-
/* @__PURE__ */
|
|
11299
|
+
/* @__PURE__ */ jsxs44("label", { className: "pptx-field", children: [
|
|
11215
11300
|
t("inspector.selectStop"),
|
|
11216
|
-
/* @__PURE__ */
|
|
11301
|
+
/* @__PURE__ */ jsx49(
|
|
11217
11302
|
"select",
|
|
11218
11303
|
{
|
|
11219
11304
|
"data-format-stop-select": "",
|
|
11220
11305
|
"aria-label": t("inspector.selectStop"),
|
|
11221
11306
|
value: selected,
|
|
11222
11307
|
onChange: (e) => onSelect(e.target.value),
|
|
11223
|
-
children: stops.map((stop, index) => /* @__PURE__ */
|
|
11308
|
+
children: stops.map((stop, index) => /* @__PURE__ */ jsx49("option", { value: stop.id, children: label(index) }, stop.id))
|
|
11224
11309
|
}
|
|
11225
11310
|
)
|
|
11226
11311
|
] })
|
|
@@ -11228,18 +11313,18 @@ function FormatGradientPicker({
|
|
|
11228
11313
|
}
|
|
11229
11314
|
|
|
11230
11315
|
// src/FormatDetails.tsx
|
|
11231
|
-
import { jsx as
|
|
11316
|
+
import { jsx as jsx50, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
11232
11317
|
function FormatDetails({ section }) {
|
|
11233
11318
|
const editor = usePptxEditor();
|
|
11234
11319
|
const { t } = useTranslation();
|
|
11235
11320
|
const snapshot = useEditorState((s) => s);
|
|
11236
11321
|
const offered = useOfferedControl("shape.effects", chromeControlForSlot5("shape.effects"));
|
|
11237
11322
|
const effectsAvailable = offered?.options?.some((option) => option.value === "reflection.tightTouching") === true;
|
|
11238
|
-
const [error, setError] =
|
|
11239
|
-
const root =
|
|
11240
|
-
const stopIdentity =
|
|
11241
|
-
const [selectedStop, setSelectedStop] =
|
|
11242
|
-
const [focusStop, setFocusStop] =
|
|
11323
|
+
const [error, setError] = useState43(null);
|
|
11324
|
+
const root = useRef41(null);
|
|
11325
|
+
const stopIdentity = useRef41(createGradientStopIdentity());
|
|
11326
|
+
const [selectedStop, setSelectedStop] = useState43(null);
|
|
11327
|
+
const [focusStop, setFocusStop] = useState43(null);
|
|
11243
11328
|
useLayoutEffect12(() => {
|
|
11244
11329
|
if (focusStop === null) return;
|
|
11245
11330
|
setFocusStop(null);
|
|
@@ -11249,17 +11334,17 @@ function FormatDetails({ section }) {
|
|
|
11249
11334
|
if (snapshot.selection.kind === "shapes" && snapshot.selection.nodeIds.length > 1) return null;
|
|
11250
11335
|
if (!read) return null;
|
|
11251
11336
|
if (!read.ok)
|
|
11252
|
-
return /* @__PURE__ */
|
|
11337
|
+
return /* @__PURE__ */ jsx50("p", { className: "pptx-empty__body", role: "status", children: translateKeyOrText18(t, read.reason) });
|
|
11253
11338
|
const detail = read.format;
|
|
11254
11339
|
if (section === "effects" && detail.effectsReason)
|
|
11255
|
-
return /* @__PURE__ */
|
|
11340
|
+
return /* @__PURE__ */ jsx50("p", { className: "pptx-empty__body", role: "status", children: translateKeyOrText18(t, detail.effectsReason) });
|
|
11256
11341
|
const identity = (id) => stopIdentity.current.identity(detail.gradient?.stops ?? [], id);
|
|
11257
11342
|
const activeStop = detail.gradient?.stops.find(
|
|
11258
11343
|
(stop) => selectedStop !== null && identity(stop.id) === selectedStop
|
|
11259
11344
|
) ?? detail.gradient?.stops[0];
|
|
11260
|
-
const key = `${editor?.session?.id}:${
|
|
11345
|
+
const key = `${editor?.session?.id}:${formatTargetKey4(snapshot)}`;
|
|
11261
11346
|
const apply = (patch) => {
|
|
11262
|
-
if (!editor || `${editor.session?.id}:${
|
|
11347
|
+
if (!editor || `${editor.session?.id}:${formatTargetKey4(editor.snapshot())}` !== key)
|
|
11263
11348
|
return t("disabled.invalidValue");
|
|
11264
11349
|
const result = editor.exec({ type: "patchShapeFormat", target: detail.target, patch });
|
|
11265
11350
|
if (result.ok && patch.kind === "gradient") {
|
|
@@ -11268,12 +11353,12 @@ function FormatDetails({ section }) {
|
|
|
11268
11353
|
stopIdentity.current.patched(detail.gradient.stops, next.format.gradient.stops, patch);
|
|
11269
11354
|
}
|
|
11270
11355
|
}
|
|
11271
|
-
return result.ok ? null :
|
|
11356
|
+
return result.ok ? null : translateKeyOrText18(t, result.reason);
|
|
11272
11357
|
};
|
|
11273
11358
|
const disabled = snapshot.mode === "view";
|
|
11274
11359
|
const unavailable = (id) => !effectsAvailable && (id === "reflection" || id === "shadow" && detail.shadow?.kind === "inner");
|
|
11275
|
-
return /* @__PURE__ */
|
|
11276
|
-
section === "fill" && detail.gradient && activeStop ? /* @__PURE__ */
|
|
11360
|
+
return /* @__PURE__ */ jsxs45("div", { className: "pptx-format-details", ref: root, children: [
|
|
11361
|
+
section === "fill" && detail.gradient && activeStop ? /* @__PURE__ */ jsx50(
|
|
11277
11362
|
FormatGradientPicker,
|
|
11278
11363
|
{
|
|
11279
11364
|
gradient: detail.gradient,
|
|
@@ -11281,18 +11366,18 @@ function FormatDetails({ section }) {
|
|
|
11281
11366
|
onSelect: (id) => setSelectedStop(identity(id))
|
|
11282
11367
|
}
|
|
11283
11368
|
) : null,
|
|
11284
|
-
formatPropertyGroups(detail, section).filter((group) => group.index === void 0 || group.id === activeStop?.id).map((group) => /* @__PURE__ */
|
|
11369
|
+
formatPropertyGroups(detail, section).filter((group) => group.index === void 0 || group.id === activeStop?.id).map((group) => /* @__PURE__ */ jsxs45(
|
|
11285
11370
|
"fieldset",
|
|
11286
11371
|
{
|
|
11287
11372
|
className: "pptx-format-property-group",
|
|
11288
11373
|
"data-format-stop": group.index,
|
|
11289
11374
|
children: [
|
|
11290
|
-
/* @__PURE__ */
|
|
11291
|
-
/* @__PURE__ */
|
|
11292
|
-
unavailable(group.id) ? /* @__PURE__ */
|
|
11375
|
+
/* @__PURE__ */ jsx50("legend", { children: t(group.labelKey, group.index ? { index: group.index } : void 0) }),
|
|
11376
|
+
/* @__PURE__ */ jsxs45("div", { className: "pptx-format-property-fields", children: [
|
|
11377
|
+
unavailable(group.id) ? /* @__PURE__ */ jsx50("p", { className: "pptx-empty__body", role: "status", children: t("inspector.effectUnavailable") }) : null,
|
|
11293
11378
|
group.colors.map((field) => {
|
|
11294
11379
|
const pick = field.color ? colorPickOf3(field.color) : "keep";
|
|
11295
|
-
return /* @__PURE__ */
|
|
11380
|
+
return /* @__PURE__ */ jsx50(
|
|
11296
11381
|
ColorField,
|
|
11297
11382
|
{
|
|
11298
11383
|
name: field.id,
|
|
@@ -11309,7 +11394,7 @@ function FormatDetails({ section }) {
|
|
|
11309
11394
|
"color"
|
|
11310
11395
|
);
|
|
11311
11396
|
}),
|
|
11312
|
-
group.numbers.map((field) => /* @__PURE__ */
|
|
11397
|
+
group.numbers.map((field) => /* @__PURE__ */ jsx50(
|
|
11313
11398
|
FormatNumberField,
|
|
11314
11399
|
{
|
|
11315
11400
|
value: String(field.value),
|
|
@@ -11324,7 +11409,7 @@ function FormatDetails({ section }) {
|
|
|
11324
11409
|
field.id.split(".").at(-1)
|
|
11325
11410
|
))
|
|
11326
11411
|
] }),
|
|
11327
|
-
group.index !== void 0 ? /* @__PURE__ */
|
|
11412
|
+
group.index !== void 0 ? /* @__PURE__ */ jsx50(
|
|
11328
11413
|
"button",
|
|
11329
11414
|
{
|
|
11330
11415
|
type: "button",
|
|
@@ -11351,7 +11436,7 @@ function FormatDetails({ section }) {
|
|
|
11351
11436
|
},
|
|
11352
11437
|
identity(group.id)
|
|
11353
11438
|
)),
|
|
11354
|
-
section === "fill" && detail.gradient ? /* @__PURE__ */
|
|
11439
|
+
section === "fill" && detail.gradient ? /* @__PURE__ */ jsx50("div", { className: "pptx-format-detail-actions", children: /* @__PURE__ */ jsx50(
|
|
11355
11440
|
"button",
|
|
11356
11441
|
{
|
|
11357
11442
|
type: "button",
|
|
@@ -11380,7 +11465,7 @@ function FormatDetails({ section }) {
|
|
|
11380
11465
|
children: t("gradient.add")
|
|
11381
11466
|
}
|
|
11382
11467
|
) }) : null,
|
|
11383
|
-
error ? /* @__PURE__ */
|
|
11468
|
+
error ? /* @__PURE__ */ jsx50("p", { role: "alert", className: "pptx-chart-pane__error", children: error }) : null
|
|
11384
11469
|
] }, key);
|
|
11385
11470
|
}
|
|
11386
11471
|
|
|
@@ -11392,10 +11477,10 @@ import {
|
|
|
11392
11477
|
formatPanelSize,
|
|
11393
11478
|
platformShortcuts as platformShortcuts2,
|
|
11394
11479
|
formatPanelKeys,
|
|
11395
|
-
formatTargetKey as
|
|
11396
|
-
translateKeyOrText as
|
|
11480
|
+
formatTargetKey as formatTargetKey5,
|
|
11481
|
+
translateKeyOrText as translateKeyOrText19
|
|
11397
11482
|
} from "@pptx-editor.dev/core/editor";
|
|
11398
|
-
import { Fragment as Fragment39, jsx as
|
|
11483
|
+
import { Fragment as Fragment39, jsx as jsx51, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
11399
11484
|
var EMU_PER_INCH = 914400;
|
|
11400
11485
|
var inches = (emu) => String(Number((emu / EMU_PER_INCH).toFixed(6)));
|
|
11401
11486
|
function FormatGeometry() {
|
|
@@ -11413,13 +11498,13 @@ function FormatGeometry() {
|
|
|
11413
11498
|
);
|
|
11414
11499
|
const background = useEditorDialog("background");
|
|
11415
11500
|
if (!geometry)
|
|
11416
|
-
return selected > 1 ? /* @__PURE__ */
|
|
11417
|
-
/* @__PURE__ */
|
|
11418
|
-
/* @__PURE__ */
|
|
11419
|
-
] }) : /* @__PURE__ */
|
|
11420
|
-
/* @__PURE__ */
|
|
11421
|
-
/* @__PURE__ */
|
|
11422
|
-
background.isAvailable ? /* @__PURE__ */
|
|
11501
|
+
return selected > 1 ? /* @__PURE__ */ jsxs46("div", { className: "pptx-empty", children: [
|
|
11502
|
+
/* @__PURE__ */ jsx51("p", { className: "pptx-empty__title", children: t("panel.format.multipleTitle", { count: selected }) }),
|
|
11503
|
+
/* @__PURE__ */ jsx51("p", { className: "pptx-empty__body", children: platformShortcuts2(t("panel.format.multipleBody")) })
|
|
11504
|
+
] }) : /* @__PURE__ */ jsxs46(Fragment39, { children: [
|
|
11505
|
+
/* @__PURE__ */ jsxs46("div", { className: "pptx-panel__section", children: [
|
|
11506
|
+
/* @__PURE__ */ jsx51("h3", { className: "pptx-panel__title", children: t(panelTitle) }),
|
|
11507
|
+
background.isAvailable ? /* @__PURE__ */ jsx51(
|
|
11423
11508
|
"button",
|
|
11424
11509
|
{
|
|
11425
11510
|
type: "button",
|
|
@@ -11430,21 +11515,21 @@ function FormatGeometry() {
|
|
|
11430
11515
|
}
|
|
11431
11516
|
) : null
|
|
11432
11517
|
] }),
|
|
11433
|
-
/* @__PURE__ */
|
|
11434
|
-
/* @__PURE__ */
|
|
11435
|
-
/* @__PURE__ */
|
|
11518
|
+
/* @__PURE__ */ jsxs46("div", { className: "pptx-empty", children: [
|
|
11519
|
+
/* @__PURE__ */ jsx51("p", { className: "pptx-empty__title", children: t("panel.format.emptyTitle") }),
|
|
11520
|
+
/* @__PURE__ */ jsx51("p", { className: "pptx-empty__body", children: t(panelBody) })
|
|
11436
11521
|
] })
|
|
11437
11522
|
] });
|
|
11438
11523
|
const g = geometry;
|
|
11439
|
-
const target = editor ? `${editor.session?.id}:${
|
|
11524
|
+
const target = editor ? `${editor.session?.id}:${formatTargetKey5(editor.snapshot())}` : "";
|
|
11440
11525
|
const run = (command) => {
|
|
11441
|
-
if (!editor || `${editor.session?.id}:${
|
|
11526
|
+
if (!editor || `${editor.session?.id}:${formatTargetKey5(editor.snapshot())}` !== target)
|
|
11442
11527
|
return t("disabled.invalidValue");
|
|
11443
11528
|
const result = editor.exec(command);
|
|
11444
|
-
return result.ok ? null :
|
|
11529
|
+
return result.ok ? null : translateKeyOrText19(t, result.reason);
|
|
11445
11530
|
};
|
|
11446
11531
|
const move = (patch) => {
|
|
11447
|
-
if (!editor || `${editor.session?.id}:${
|
|
11532
|
+
if (!editor || `${editor.session?.id}:${formatTargetKey5(editor.snapshot())}` !== target)
|
|
11448
11533
|
return t("disabled.invalidValue");
|
|
11449
11534
|
const current = editor.snapshot().geometry;
|
|
11450
11535
|
if (!current || current.nodeId !== g.nodeId) return t("disabled.invalidValue");
|
|
@@ -11460,7 +11545,7 @@ function FormatGeometry() {
|
|
|
11460
11545
|
};
|
|
11461
11546
|
const inch = (v) => Math.round(v * EMU_PER_INCH);
|
|
11462
11547
|
const unit = t("panel.format.inchUnit");
|
|
11463
|
-
const field = (key, labelKey) => /* @__PURE__ */
|
|
11548
|
+
const field = (key, labelKey) => /* @__PURE__ */ jsx51(
|
|
11464
11549
|
FormatNumberField,
|
|
11465
11550
|
{
|
|
11466
11551
|
label: t(labelKey),
|
|
@@ -11472,19 +11557,19 @@ function FormatGeometry() {
|
|
|
11472
11557
|
onCommit: (v) => move(key === "cx" || key === "cy" ? formatPanelSize(g, key, inch(v)) : { [key]: inch(v) })
|
|
11473
11558
|
}
|
|
11474
11559
|
);
|
|
11475
|
-
return /* @__PURE__ */
|
|
11476
|
-
/* @__PURE__ */
|
|
11477
|
-
/* @__PURE__ */
|
|
11478
|
-
/* @__PURE__ */
|
|
11560
|
+
return /* @__PURE__ */ jsxs46(Fragment39, { children: [
|
|
11561
|
+
/* @__PURE__ */ jsxs46("div", { className: "pptx-panel__section", children: [
|
|
11562
|
+
/* @__PURE__ */ jsx51("h3", { className: "pptx-panel__title", children: t("panel.format.element") }),
|
|
11563
|
+
/* @__PURE__ */ jsx51("span", { className: "pptx-chip", children: t(elementKindLabelKey(g, table, { chart, diagram })) })
|
|
11479
11564
|
] }),
|
|
11480
|
-
/* @__PURE__ */
|
|
11481
|
-
/* @__PURE__ */
|
|
11482
|
-
/* @__PURE__ */
|
|
11565
|
+
/* @__PURE__ */ jsxs46("div", { className: "pptx-panel__section", children: [
|
|
11566
|
+
/* @__PURE__ */ jsx51("h3", { className: "pptx-panel__title", children: t("panel.format.size") }),
|
|
11567
|
+
/* @__PURE__ */ jsxs46("div", { className: "pptx-panel__grid", children: [
|
|
11483
11568
|
field("cx", "panel.format.width"),
|
|
11484
11569
|
field("cy", "panel.format.height")
|
|
11485
11570
|
] }),
|
|
11486
|
-
/* @__PURE__ */
|
|
11487
|
-
/* @__PURE__ */
|
|
11571
|
+
/* @__PURE__ */ jsxs46("label", { className: "pptx-radio", children: [
|
|
11572
|
+
/* @__PURE__ */ jsx51(
|
|
11488
11573
|
"input",
|
|
11489
11574
|
{
|
|
11490
11575
|
type: "checkbox",
|
|
@@ -11496,16 +11581,16 @@ function FormatGeometry() {
|
|
|
11496
11581
|
t("imageProperties.lockAspect")
|
|
11497
11582
|
] })
|
|
11498
11583
|
] }),
|
|
11499
|
-
/* @__PURE__ */
|
|
11500
|
-
/* @__PURE__ */
|
|
11501
|
-
/* @__PURE__ */
|
|
11584
|
+
/* @__PURE__ */ jsxs46("div", { className: "pptx-panel__section", children: [
|
|
11585
|
+
/* @__PURE__ */ jsx51("h3", { className: "pptx-panel__title", children: t("panel.format.position") }),
|
|
11586
|
+
/* @__PURE__ */ jsxs46("div", { className: "pptx-panel__grid", children: [
|
|
11502
11587
|
field("x", "panel.format.x"),
|
|
11503
11588
|
field("y", "panel.format.y")
|
|
11504
11589
|
] })
|
|
11505
11590
|
] }),
|
|
11506
|
-
elementRotates(g, table) ? /* @__PURE__ */
|
|
11507
|
-
/* @__PURE__ */
|
|
11508
|
-
/* @__PURE__ */
|
|
11591
|
+
elementRotates(g, table) ? /* @__PURE__ */ jsxs46("div", { className: "pptx-panel__section", children: [
|
|
11592
|
+
/* @__PURE__ */ jsx51("h3", { className: "pptx-panel__title", children: t("panel.format.rotation") }),
|
|
11593
|
+
/* @__PURE__ */ jsx51("div", { className: "pptx-panel__grid", children: /* @__PURE__ */ jsx51(
|
|
11509
11594
|
FormatNumberField,
|
|
11510
11595
|
{
|
|
11511
11596
|
label: t("panel.format.angle"),
|
|
@@ -11519,10 +11604,10 @@ function FormatGeometry() {
|
|
|
11519
11604
|
}
|
|
11520
11605
|
) })
|
|
11521
11606
|
] }) : null,
|
|
11522
|
-
table ? /* @__PURE__ */
|
|
11523
|
-
/* @__PURE__ */
|
|
11524
|
-
/* @__PURE__ */
|
|
11525
|
-
/* @__PURE__ */
|
|
11607
|
+
table ? /* @__PURE__ */ jsxs46("div", { className: "pptx-panel__section", children: [
|
|
11608
|
+
/* @__PURE__ */ jsx51("h3", { className: "pptx-panel__title", children: t("panel.format.table") }),
|
|
11609
|
+
/* @__PURE__ */ jsxs46("div", { className: "pptx-panel__grid", children: [
|
|
11610
|
+
/* @__PURE__ */ jsx51(
|
|
11526
11611
|
FormatNumberField,
|
|
11527
11612
|
{
|
|
11528
11613
|
label: t("panel.format.rowHeight"),
|
|
@@ -11534,7 +11619,7 @@ function FormatGeometry() {
|
|
|
11534
11619
|
onCommit: (v) => run({ type: "setRowHeight", height: inch(v) })
|
|
11535
11620
|
}
|
|
11536
11621
|
),
|
|
11537
|
-
/* @__PURE__ */
|
|
11622
|
+
/* @__PURE__ */ jsx51(
|
|
11538
11623
|
FormatNumberField,
|
|
11539
11624
|
{
|
|
11540
11625
|
label: t("panel.format.columnWidth"),
|
|
@@ -11547,8 +11632,8 @@ function FormatGeometry() {
|
|
|
11547
11632
|
}
|
|
11548
11633
|
)
|
|
11549
11634
|
] }),
|
|
11550
|
-
/* @__PURE__ */
|
|
11551
|
-
/* @__PURE__ */
|
|
11635
|
+
/* @__PURE__ */ jsx51("div", { className: "pptx-radios", role: "group", "aria-label": t("panel.format.styleOptions"), children: TABLE_OPTION_ROWS.map(({ option, labelKey }) => /* @__PURE__ */ jsxs46("label", { className: "pptx-radio", children: [
|
|
11636
|
+
/* @__PURE__ */ jsx51(
|
|
11552
11637
|
"input",
|
|
11553
11638
|
{
|
|
11554
11639
|
type: "checkbox",
|
|
@@ -11560,10 +11645,10 @@ function FormatGeometry() {
|
|
|
11560
11645
|
t(labelKey)
|
|
11561
11646
|
] }, option)) })
|
|
11562
11647
|
] }) : null,
|
|
11563
|
-
g.textFitting ? /* @__PURE__ */
|
|
11564
|
-
/* @__PURE__ */
|
|
11565
|
-
/* @__PURE__ */
|
|
11566
|
-
/* @__PURE__ */
|
|
11648
|
+
g.textFitting ? /* @__PURE__ */ jsxs46("div", { className: "pptx-panel__section", children: [
|
|
11649
|
+
/* @__PURE__ */ jsx51("h3", { className: "pptx-panel__title", children: t("panel.format.textFitting") }),
|
|
11650
|
+
/* @__PURE__ */ jsx51("div", { className: "pptx-radios", role: "radiogroup", "aria-label": t("panel.format.textFitting"), children: ["none", "shrink", "shape"].map((mode) => /* @__PURE__ */ jsxs46("label", { className: "pptx-radio", children: [
|
|
11651
|
+
/* @__PURE__ */ jsx51(
|
|
11567
11652
|
"input",
|
|
11568
11653
|
{
|
|
11569
11654
|
type: "radio",
|
|
@@ -11580,21 +11665,21 @@ function FormatGeometry() {
|
|
|
11580
11665
|
}
|
|
11581
11666
|
|
|
11582
11667
|
// src/FormatPanel.tsx
|
|
11583
|
-
import { jsx as
|
|
11668
|
+
import { jsx as jsx52, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
11584
11669
|
function FormatSection({ section }) {
|
|
11585
11670
|
const { t } = useTranslation();
|
|
11586
11671
|
const editor = usePptxEditor();
|
|
11587
11672
|
const background = useEditorDialog("background");
|
|
11588
11673
|
const snapshot = useEditorState((s) => s);
|
|
11589
|
-
const [, refresh] =
|
|
11674
|
+
const [, refresh] = useState44(0);
|
|
11590
11675
|
useEffect31(
|
|
11591
11676
|
() => editor ? listenFormatSectionExpansion(editor, () => refresh((n) => n + 1)) : void 0,
|
|
11592
11677
|
[editor]
|
|
11593
11678
|
);
|
|
11594
11679
|
const category = formatSelectionCategory(snapshot);
|
|
11595
11680
|
const expanded = formatSectionOpen(editor, category, section.id);
|
|
11596
|
-
return /* @__PURE__ */
|
|
11597
|
-
/* @__PURE__ */
|
|
11681
|
+
return /* @__PURE__ */ jsxs47("details", { className: "pptx-format-disclosure", open: expanded, children: [
|
|
11682
|
+
/* @__PURE__ */ jsx52(
|
|
11598
11683
|
"summary",
|
|
11599
11684
|
{
|
|
11600
11685
|
"data-format-toggle": section.id,
|
|
@@ -11606,14 +11691,17 @@ function FormatSection({ section }) {
|
|
|
11606
11691
|
children: t(section.labelKey)
|
|
11607
11692
|
}
|
|
11608
11693
|
),
|
|
11609
|
-
/* @__PURE__ */
|
|
11610
|
-
section.id === "geometry" ? /* @__PURE__ */
|
|
11611
|
-
section.id === "fill" || section.id === "effects" ? /* @__PURE__ */
|
|
11612
|
-
section.id === "geometry" ? null : section.id === "chart" ? /* @__PURE__ */
|
|
11613
|
-
|
|
11614
|
-
|
|
11615
|
-
|
|
11616
|
-
|
|
11694
|
+
/* @__PURE__ */ jsxs47("div", { className: "pptx-format-section-body", children: [
|
|
11695
|
+
section.id === "geometry" ? /* @__PURE__ */ jsx52(FormatGeometry, {}) : null,
|
|
11696
|
+
section.id === "fill" || section.id === "effects" ? /* @__PURE__ */ jsx52(FormatDetails, { section: section.id }) : null,
|
|
11697
|
+
section.id === "geometry" ? null : section.id === "chart" ? /* @__PURE__ */ jsx52(ChartDataPane, {}) : section.id === "diagram" ? /* @__PURE__ */ jsx52(DiagramTextPane, {}) : /* @__PURE__ */ jsx52("div", { className: "pptx-format-controls", children: section.slots.filter((slot) => slot !== "slide.background" || background.isAvailable).flatMap((slot) => [
|
|
11698
|
+
/* @__PURE__ */ jsxs47("div", { className: "pptx-format-control", "data-format-slot": slot, children: [
|
|
11699
|
+
slot !== "shape.lineWidth" ? /* @__PURE__ */ jsx52("span", { className: "pptx-format-control__label", children: t(chromeControlForSlot6(slot).labelKey) }) : null,
|
|
11700
|
+
formatControlMixed(editor, slot) ? /* @__PURE__ */ jsx52("span", { className: "pptx-format-mixed", children: t("inspector.mixed") }) : null,
|
|
11701
|
+
slot === "shape.lineWidth" ? /* @__PURE__ */ jsx52(FormatLineWidth, {}) : /* @__PURE__ */ jsx52(ToolbarSlot, { slotId: slot })
|
|
11702
|
+
] }, slot),
|
|
11703
|
+
slot === "shape.fill" ? /* @__PURE__ */ jsx52(FormatFillTransparency, {}, "fill.transparency") : null
|
|
11704
|
+
]) })
|
|
11617
11705
|
] })
|
|
11618
11706
|
] });
|
|
11619
11707
|
}
|
|
@@ -11621,9 +11709,9 @@ function FormatPanel({ sections, sectionContent, className, children }) {
|
|
|
11621
11709
|
const editor = usePptxEditor();
|
|
11622
11710
|
const snapshot = useEditorState((s) => s);
|
|
11623
11711
|
const { t } = useTranslation();
|
|
11624
|
-
const root =
|
|
11712
|
+
const root = useRef42(null);
|
|
11625
11713
|
const category = formatSelectionCategory(snapshot);
|
|
11626
|
-
const previousCategory =
|
|
11714
|
+
const previousCategory = useRef42(category);
|
|
11627
11715
|
useLayoutEffect13(() => {
|
|
11628
11716
|
if (previousCategory.current !== category) {
|
|
11629
11717
|
const scroller = root.current?.closest(".pptx-panel__body");
|
|
@@ -11631,10 +11719,10 @@ function FormatPanel({ sections, sectionContent, className, children }) {
|
|
|
11631
11719
|
previousCategory.current = category;
|
|
11632
11720
|
}
|
|
11633
11721
|
}, [category]);
|
|
11634
|
-
const target = `${editor?.session?.id ?? ""}:${
|
|
11635
|
-
return /* @__PURE__ */
|
|
11636
|
-
snapshot.selection.kind === "shapes" && snapshot.selection.nodeIds.length > 1 ? /* @__PURE__ */
|
|
11637
|
-
/* @__PURE__ */
|
|
11722
|
+
const target = `${editor?.session?.id ?? ""}:${formatTargetKey6(snapshot)}`;
|
|
11723
|
+
return /* @__PURE__ */ jsxs47("div", { ref: root, className: ["pptx-format-panel", className].filter(Boolean).join(" "), children: [
|
|
11724
|
+
snapshot.selection.kind === "shapes" && snapshot.selection.nodeIds.length > 1 ? /* @__PURE__ */ jsx52("p", { className: "pptx-panel__title", children: t("panel.format.multipleTitle", { count: snapshot.selection.nodeIds.length }) }) : snapshot.geometry ? /* @__PURE__ */ jsx52("p", { className: "pptx-panel__title", children: snapshot.geometry.name }) : null,
|
|
11725
|
+
/* @__PURE__ */ jsx52("div", { className: "pptx-format-sections", children: formatSectionsOf(snapshot, sections).map((section) => /* @__PURE__ */ jsx52("div", { "data-format-section": section.id, children: sectionContent?.[section.id] !== void 0 ? sectionContent[section.id] : /* @__PURE__ */ jsx52(
|
|
11638
11726
|
FormatSection,
|
|
11639
11727
|
{
|
|
11640
11728
|
section
|
|
@@ -11646,17 +11734,17 @@ function FormatPanel({ sections, sectionContent, className, children }) {
|
|
|
11646
11734
|
}
|
|
11647
11735
|
|
|
11648
11736
|
// src/SidePanel.tsx
|
|
11649
|
-
import { jsx as
|
|
11737
|
+
import { jsx as jsx53, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
11650
11738
|
function PackagedPane({ tab }) {
|
|
11651
11739
|
const { t } = useTranslation();
|
|
11652
|
-
if (tab === "format") return /* @__PURE__ */
|
|
11653
|
-
if (tab === "chart") return /* @__PURE__ */
|
|
11654
|
-
if (tab === "diagram") return /* @__PURE__ */
|
|
11655
|
-
if (tab === "selection") return /* @__PURE__ */
|
|
11656
|
-
if (tab === "animations") return /* @__PURE__ */
|
|
11657
|
-
return /* @__PURE__ */
|
|
11658
|
-
/* @__PURE__ */
|
|
11659
|
-
/* @__PURE__ */
|
|
11740
|
+
if (tab === "format") return /* @__PURE__ */ jsx53(FormatPanel, {});
|
|
11741
|
+
if (tab === "chart") return /* @__PURE__ */ jsx53(ChartDataPane, {});
|
|
11742
|
+
if (tab === "diagram") return /* @__PURE__ */ jsx53(DiagramTextPane, {});
|
|
11743
|
+
if (tab === "selection") return /* @__PURE__ */ jsx53(SelectionPane, {});
|
|
11744
|
+
if (tab === "animations") return /* @__PURE__ */ jsx53(AnimationsPane, {});
|
|
11745
|
+
return /* @__PURE__ */ jsxs48("div", { className: "pptx-empty", children: [
|
|
11746
|
+
/* @__PURE__ */ jsx53("p", { className: "pptx-empty__title", children: t("panel.comments.emptyTitle") }),
|
|
11747
|
+
/* @__PURE__ */ jsx53("p", { className: "pptx-empty__body", children: t("panel.comments.emptyBody") })
|
|
11660
11748
|
] });
|
|
11661
11749
|
}
|
|
11662
11750
|
function SidePanel({
|
|
@@ -11670,7 +11758,7 @@ function SidePanel({
|
|
|
11670
11758
|
}) {
|
|
11671
11759
|
const { t } = useTranslation();
|
|
11672
11760
|
const editor = usePptxEditor();
|
|
11673
|
-
const [own, setOwn] =
|
|
11761
|
+
const [own, setOwn] = useState45(shown ?? "format");
|
|
11674
11762
|
const tab = shown ?? own;
|
|
11675
11763
|
const chartSelected = useEditorState((s) => !!s.chart);
|
|
11676
11764
|
const diagramSelected = useEditorState((s) => !!s.diagram);
|
|
@@ -11679,10 +11767,10 @@ function SidePanel({
|
|
|
11679
11767
|
setOwn(next);
|
|
11680
11768
|
onTabChange?.(next);
|
|
11681
11769
|
};
|
|
11682
|
-
const latest =
|
|
11770
|
+
const latest = useRef43(setTab);
|
|
11683
11771
|
latest.current = setTab;
|
|
11684
|
-
const root =
|
|
11685
|
-
const [asked, setAsked] =
|
|
11772
|
+
const root = useRef43(null);
|
|
11773
|
+
const [asked, setAsked] = useState45(null);
|
|
11686
11774
|
useEffect32(
|
|
11687
11775
|
() => editor ? listenPaneRequests(editor, (pane, request) => {
|
|
11688
11776
|
takePaneRequest(editor);
|
|
@@ -11706,7 +11794,7 @@ function SidePanel({
|
|
|
11706
11794
|
);
|
|
11707
11795
|
(current ?? root.current?.querySelector(`[data-tab="${asked.pane}"]`))?.focus();
|
|
11708
11796
|
}, [asked]);
|
|
11709
|
-
return /* @__PURE__ */
|
|
11797
|
+
return /* @__PURE__ */ jsxs48(
|
|
11710
11798
|
"aside",
|
|
11711
11799
|
{
|
|
11712
11800
|
ref: root,
|
|
@@ -11715,8 +11803,8 @@ function SidePanel({
|
|
|
11715
11803
|
style: paneStyle(paneWidth, style),
|
|
11716
11804
|
onMouseDown: keepFocus,
|
|
11717
11805
|
children: [
|
|
11718
|
-
/* @__PURE__ */
|
|
11719
|
-
/* @__PURE__ */
|
|
11806
|
+
/* @__PURE__ */ jsxs48("div", { className: "pptx-panel__head", children: [
|
|
11807
|
+
/* @__PURE__ */ jsx53(
|
|
11720
11808
|
"div",
|
|
11721
11809
|
{
|
|
11722
11810
|
className: "pptx-tabs",
|
|
@@ -11728,7 +11816,7 @@ function SidePanel({
|
|
|
11728
11816
|
setTab(next);
|
|
11729
11817
|
e.currentTarget.querySelector(`[data-tab="${next}"]`)?.focus();
|
|
11730
11818
|
},
|
|
11731
|
-
children: tabs.map((id) => /* @__PURE__ */
|
|
11819
|
+
children: tabs.map((id) => /* @__PURE__ */ jsxs48(
|
|
11732
11820
|
"button",
|
|
11733
11821
|
{
|
|
11734
11822
|
type: "button",
|
|
@@ -11741,23 +11829,23 @@ function SidePanel({
|
|
|
11741
11829
|
tabIndex: tab === id ? 0 : -1,
|
|
11742
11830
|
onClick: () => setTab(id),
|
|
11743
11831
|
children: [
|
|
11744
|
-
/* @__PURE__ */
|
|
11745
|
-
tab === id ? /* @__PURE__ */
|
|
11832
|
+
/* @__PURE__ */ jsx53(Icon, { name: SIDE_PANEL_TAB_ICONS[id] }),
|
|
11833
|
+
tab === id ? /* @__PURE__ */ jsx53("span", { className: "pptx-tabs__label", "aria-hidden": "true", children: t(`panel.tabs.${id}`) }) : null
|
|
11746
11834
|
]
|
|
11747
11835
|
},
|
|
11748
11836
|
id
|
|
11749
11837
|
))
|
|
11750
11838
|
}
|
|
11751
11839
|
),
|
|
11752
|
-
onClose ? /* @__PURE__ */
|
|
11840
|
+
onClose ? /* @__PURE__ */ jsx53(ToolButton, { label: t("panel.close"), icon: "close", onClick: onClose }) : null
|
|
11753
11841
|
] }),
|
|
11754
|
-
/* @__PURE__ */
|
|
11842
|
+
/* @__PURE__ */ jsx53(
|
|
11755
11843
|
"div",
|
|
11756
11844
|
{
|
|
11757
11845
|
className: "pptx-panel__body",
|
|
11758
11846
|
role: "tabpanel",
|
|
11759
11847
|
onKeyDown: (e) => panelHistoryKey(e, editor),
|
|
11760
|
-
children: panes?.[tab] !== void 0 ? panes[tab] : /* @__PURE__ */
|
|
11848
|
+
children: panes?.[tab] !== void 0 ? panes[tab] : /* @__PURE__ */ jsx53(PackagedPane, { tab })
|
|
11761
11849
|
}
|
|
11762
11850
|
)
|
|
11763
11851
|
]
|
|
@@ -11770,14 +11858,14 @@ import { listenPaneRequests as listenPaneRequests2, requestPane } from "@pptx-ed
|
|
|
11770
11858
|
|
|
11771
11859
|
// src/NotesPane.tsx
|
|
11772
11860
|
import {
|
|
11773
|
-
useCallback as
|
|
11861
|
+
useCallback as useCallback15,
|
|
11774
11862
|
useContext as useContext19,
|
|
11775
11863
|
useEffect as useEffect35,
|
|
11776
11864
|
useId as useId20,
|
|
11777
11865
|
useLayoutEffect as useLayoutEffect15,
|
|
11778
11866
|
useMemo as useMemo17,
|
|
11779
|
-
useRef as
|
|
11780
|
-
useState as
|
|
11867
|
+
useRef as useRef45,
|
|
11868
|
+
useState as useState47
|
|
11781
11869
|
} from "react";
|
|
11782
11870
|
import {
|
|
11783
11871
|
NOTES_FORMAT_BUTTONS,
|
|
@@ -11809,8 +11897,8 @@ import {
|
|
|
11809
11897
|
REMOVAL_NOTICE_MS,
|
|
11810
11898
|
removalNoticeShows
|
|
11811
11899
|
} from "@pptx-editor.dev/core/editor";
|
|
11812
|
-
import { useContext as useContext18, useEffect as useEffect33, useState as
|
|
11813
|
-
import { jsx as
|
|
11900
|
+
import { useContext as useContext18, useEffect as useEffect33, useState as useState46, useSyncExternalStore as useSyncExternalStore11 } from "react";
|
|
11901
|
+
import { jsx as jsx54, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
11814
11902
|
var NO_STORE = () => () => void 0;
|
|
11815
11903
|
var NO_STATE = () => null;
|
|
11816
11904
|
function rejectionMessage(t, rejection) {
|
|
@@ -11822,9 +11910,9 @@ function EditNoticeRoot({ className }) {
|
|
|
11822
11910
|
const { t } = useTranslation();
|
|
11823
11911
|
const rejection = useEditorState((s) => s.lastRejection ?? null);
|
|
11824
11912
|
const removal = useEditorState((s) => s.lastRemoval ?? null);
|
|
11825
|
-
const [dismissed, setDismissed] =
|
|
11826
|
-
const [closed, setClosed] =
|
|
11827
|
-
const [held, setHeld] =
|
|
11913
|
+
const [dismissed, setDismissed] = useState46(null);
|
|
11914
|
+
const [closed, setClosed] = useState46(null);
|
|
11915
|
+
const [held, setHeld] = useState46(false);
|
|
11828
11916
|
useEffect33(() => setHeld(false), [removal?.serial]);
|
|
11829
11917
|
const offered = removalNoticeShows(removal, closed);
|
|
11830
11918
|
useEffect33(() => {
|
|
@@ -11845,7 +11933,7 @@ function EditNoticeRoot({ className }) {
|
|
|
11845
11933
|
}, [covered, rejection]);
|
|
11846
11934
|
const classes = `pptx-edit-notice${className ? ` ${className}` : ""}`;
|
|
11847
11935
|
if (!covered && editNoticeShows(rejection, dismissed))
|
|
11848
|
-
return /* @__PURE__ */
|
|
11936
|
+
return /* @__PURE__ */ jsxs49(
|
|
11849
11937
|
"div",
|
|
11850
11938
|
{
|
|
11851
11939
|
className: classes,
|
|
@@ -11853,8 +11941,8 @@ function EditNoticeRoot({ className }) {
|
|
|
11853
11941
|
role: "status",
|
|
11854
11942
|
onMouseDown: keepFocus,
|
|
11855
11943
|
children: [
|
|
11856
|
-
/* @__PURE__ */
|
|
11857
|
-
/* @__PURE__ */
|
|
11944
|
+
/* @__PURE__ */ jsx54("span", { className: "pptx-edit-notice__text", children: rejectionMessage(t, rejection) }),
|
|
11945
|
+
/* @__PURE__ */ jsx54(
|
|
11858
11946
|
ToolButton,
|
|
11859
11947
|
{
|
|
11860
11948
|
label: t("notice.dismiss"),
|
|
@@ -11866,7 +11954,7 @@ function EditNoticeRoot({ className }) {
|
|
|
11866
11954
|
}
|
|
11867
11955
|
);
|
|
11868
11956
|
if (!offered) return null;
|
|
11869
|
-
return /* @__PURE__ */
|
|
11957
|
+
return /* @__PURE__ */ jsxs49(
|
|
11870
11958
|
"div",
|
|
11871
11959
|
{
|
|
11872
11960
|
className: classes,
|
|
@@ -11878,8 +11966,8 @@ function EditNoticeRoot({ className }) {
|
|
|
11878
11966
|
onFocus: () => setHeld(true),
|
|
11879
11967
|
onBlur: () => setHeld(false),
|
|
11880
11968
|
children: [
|
|
11881
|
-
/* @__PURE__ */
|
|
11882
|
-
/* @__PURE__ */
|
|
11969
|
+
/* @__PURE__ */ jsx54("span", { className: "pptx-edit-notice__text", children: editRemovalMessage(t, removal) }),
|
|
11970
|
+
/* @__PURE__ */ jsx54(
|
|
11883
11971
|
"button",
|
|
11884
11972
|
{
|
|
11885
11973
|
type: "button",
|
|
@@ -11892,7 +11980,7 @@ function EditNoticeRoot({ className }) {
|
|
|
11892
11980
|
children: t("notice.undo")
|
|
11893
11981
|
}
|
|
11894
11982
|
),
|
|
11895
|
-
/* @__PURE__ */
|
|
11983
|
+
/* @__PURE__ */ jsx54(
|
|
11896
11984
|
ToolButton,
|
|
11897
11985
|
{
|
|
11898
11986
|
label: t("notice.dismiss"),
|
|
@@ -11909,7 +11997,7 @@ function EditNoticeRoot({ className }) {
|
|
|
11909
11997
|
}
|
|
11910
11998
|
|
|
11911
11999
|
// src/NotesView.tsx
|
|
11912
|
-
import { useEffect as useEffect34, useLayoutEffect as useLayoutEffect14, useRef as
|
|
12000
|
+
import { useEffect as useEffect34, useLayoutEffect as useLayoutEffect14, useRef as useRef44 } from "react";
|
|
11913
12001
|
import {
|
|
11914
12002
|
notesFieldBeforeInput,
|
|
11915
12003
|
notesFieldFocused,
|
|
@@ -11920,7 +12008,7 @@ import {
|
|
|
11920
12008
|
renderNotes,
|
|
11921
12009
|
selectNotes
|
|
11922
12010
|
} from "@pptx-editor.dev/core/editor";
|
|
11923
|
-
import { jsx as
|
|
12011
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
11924
12012
|
function NotesField({
|
|
11925
12013
|
id,
|
|
11926
12014
|
paragraphs,
|
|
@@ -11938,7 +12026,7 @@ function NotesField({
|
|
|
11938
12026
|
onSelection,
|
|
11939
12027
|
onFocus
|
|
11940
12028
|
}) {
|
|
11941
|
-
const composing =
|
|
12029
|
+
const composing = useRef44(false);
|
|
11942
12030
|
useLayoutEffect14(() => {
|
|
11943
12031
|
const el = fieldRef.current;
|
|
11944
12032
|
if (!el || drafting) return;
|
|
@@ -11949,7 +12037,7 @@ function NotesField({
|
|
|
11949
12037
|
if (keep) selectNotes(el, keep.start, keep.end);
|
|
11950
12038
|
onSelection();
|
|
11951
12039
|
}, [paragraphs, drafting, fieldRef, restore, onSelection]);
|
|
11952
|
-
const draftRef =
|
|
12040
|
+
const draftRef = useRef44(onDraft);
|
|
11953
12041
|
draftRef.current = onDraft;
|
|
11954
12042
|
useEffect34(() => {
|
|
11955
12043
|
const el = fieldRef.current;
|
|
@@ -11965,7 +12053,7 @@ function NotesField({
|
|
|
11965
12053
|
if (composing.current) return;
|
|
11966
12054
|
notesFieldKeyDown(e, e.currentTarget, { readOnly, onDraft, onFormat, onHistory, onNewSlide });
|
|
11967
12055
|
};
|
|
11968
|
-
return /* @__PURE__ */
|
|
12056
|
+
return /* @__PURE__ */ jsx55(
|
|
11969
12057
|
"div",
|
|
11970
12058
|
{
|
|
11971
12059
|
ref: fieldRef,
|
|
@@ -11999,12 +12087,12 @@ function NotesField({
|
|
|
11999
12087
|
}
|
|
12000
12088
|
|
|
12001
12089
|
// src/NotesPane.tsx
|
|
12002
|
-
import { jsx as
|
|
12090
|
+
import { jsx as jsx56, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
12003
12091
|
var NO_FORMATS = NO_NOTES_FORMATS;
|
|
12004
12092
|
function useNotesOpen(props) {
|
|
12005
12093
|
const shared = useContext19(PaneStateContext);
|
|
12006
|
-
const [own, setOwn] =
|
|
12007
|
-
const [owner, setOwner] =
|
|
12094
|
+
const [own, setOwn] = useState47(props.defaultOpen ?? true);
|
|
12095
|
+
const [owner, setOwner] = useState47(false);
|
|
12008
12096
|
const controlled = props.open !== void 0;
|
|
12009
12097
|
const useShared = shared !== null && owner;
|
|
12010
12098
|
const open = controlled ? props.open : useShared ? shared.notesOpen ?? props.defaultOpen ?? true : own;
|
|
@@ -12015,9 +12103,9 @@ function useNotesOpen(props) {
|
|
|
12015
12103
|
}
|
|
12016
12104
|
props.onOpenChange?.(next);
|
|
12017
12105
|
};
|
|
12018
|
-
const request =
|
|
12106
|
+
const request = useRef45(setOpenValue);
|
|
12019
12107
|
request.current = setOpenValue;
|
|
12020
|
-
const handler =
|
|
12108
|
+
const handler = useRef45((next) => request.current(next)).current;
|
|
12021
12109
|
const slot = shared?.notesRequest ?? null;
|
|
12022
12110
|
useLayoutEffect15(() => {
|
|
12023
12111
|
if (slot?.current && slot.current !== handler) warnDuplicatePane("PptxEditor.NotesPane");
|
|
@@ -12043,7 +12131,7 @@ function useNotesOpen(props) {
|
|
|
12043
12131
|
}
|
|
12044
12132
|
function NotesPane(props = {}) {
|
|
12045
12133
|
const master = useEditorState((s) => s.presentationView === "slideMaster");
|
|
12046
|
-
return master ? null : /* @__PURE__ */
|
|
12134
|
+
return master ? null : /* @__PURE__ */ jsx56(NotesPaneBody, { ...props });
|
|
12047
12135
|
}
|
|
12048
12136
|
function NotesPaneBody(props) {
|
|
12049
12137
|
const { className, showFormatButtons = true } = props;
|
|
@@ -12055,21 +12143,21 @@ function NotesPaneBody(props) {
|
|
|
12055
12143
|
const readOnly = useEditorState((s) => s.mode === "view");
|
|
12056
12144
|
const [open, setOpen] = useNotesOpen(props);
|
|
12057
12145
|
const notesId = useId20();
|
|
12058
|
-
const [draft, setDraft] =
|
|
12059
|
-
const [refusal, setRefusal] =
|
|
12060
|
-
const [formats, setFormats] =
|
|
12061
|
-
const [canFormat, setCanFormat] =
|
|
12062
|
-
const field =
|
|
12063
|
-
const pending =
|
|
12064
|
-
const bound =
|
|
12065
|
-
const restore =
|
|
12146
|
+
const [draft, setDraft] = useState47(null);
|
|
12147
|
+
const [refusal, setRefusal] = useState47(null);
|
|
12148
|
+
const [formats, setFormats] = useState47(NO_FORMATS);
|
|
12149
|
+
const [canFormat, setCanFormat] = useState47(false);
|
|
12150
|
+
const field = useRef45(null);
|
|
12151
|
+
const pending = useRef45(null);
|
|
12152
|
+
const bound = useRef45(null);
|
|
12153
|
+
const restore = useRef45(null);
|
|
12066
12154
|
const paragraphs = useMemo17(
|
|
12067
12155
|
() => formatted ?? notes.split("\n").map((text) => ({
|
|
12068
12156
|
runs: [{ text, bold: false, italic: false, underline: false, strike: false }]
|
|
12069
12157
|
})),
|
|
12070
12158
|
[formatted, notes]
|
|
12071
12159
|
);
|
|
12072
|
-
const commit =
|
|
12160
|
+
const commit = useCallback15(
|
|
12073
12161
|
(leaving = false) => {
|
|
12074
12162
|
const d = pending.current;
|
|
12075
12163
|
pending.current = null;
|
|
@@ -12110,7 +12198,7 @@ function NotesPaneBody(props) {
|
|
|
12110
12198
|
if (!open) commit();
|
|
12111
12199
|
}, [open, commit]);
|
|
12112
12200
|
useEffect35(() => () => commit(), [commit]);
|
|
12113
|
-
const readFormats =
|
|
12201
|
+
const readFormats = useCallback15(() => {
|
|
12114
12202
|
const el = field.current;
|
|
12115
12203
|
if (el) followNotesArm(el);
|
|
12116
12204
|
const range = el && notesFieldFocused(el) ? notesSelection2(el) : null;
|
|
@@ -12118,13 +12206,13 @@ function NotesPaneBody(props) {
|
|
|
12118
12206
|
setCanFormat(!!el && notesCanFormat(notesFieldText2(el), range));
|
|
12119
12207
|
setFormats((was) => sameNotesFormats(was, next) ? was : next);
|
|
12120
12208
|
}, []);
|
|
12121
|
-
const focused =
|
|
12122
|
-
const applyRef =
|
|
12123
|
-
const leaveSlide =
|
|
12209
|
+
const focused = useRef45(false);
|
|
12210
|
+
const applyRef = useRef45(() => false);
|
|
12211
|
+
const leaveSlide = useCallback15(() => {
|
|
12124
12212
|
if (editor && editor.snapshot().selection.kind !== "none")
|
|
12125
12213
|
editor.setSelection({ kind: "none" });
|
|
12126
12214
|
}, [editor]);
|
|
12127
|
-
const [active, setActive] =
|
|
12215
|
+
const [active, setActive] = useState47(false);
|
|
12128
12216
|
const onFocus = () => {
|
|
12129
12217
|
focused.current = true;
|
|
12130
12218
|
setActive(true);
|
|
@@ -12158,7 +12246,7 @@ function NotesPaneBody(props) {
|
|
|
12158
12246
|
[editor]
|
|
12159
12247
|
);
|
|
12160
12248
|
const painter = useMemo17(() => createNotesFindPainter(), []);
|
|
12161
|
-
const [findCount, setFindCount] =
|
|
12249
|
+
const [findCount, setFindCount] = useState47(0);
|
|
12162
12250
|
const selectionKind = useEditorState((s) => s.selection.kind);
|
|
12163
12251
|
const revision = useEditorState((s) => s.revision);
|
|
12164
12252
|
useEffect35(
|
|
@@ -12231,7 +12319,7 @@ function NotesPaneBody(props) {
|
|
|
12231
12319
|
if (editor.snapshot().notesFormatted === before) restore.current = null;
|
|
12232
12320
|
leaveSlide();
|
|
12233
12321
|
};
|
|
12234
|
-
return /* @__PURE__ */
|
|
12322
|
+
return /* @__PURE__ */ jsxs50(
|
|
12235
12323
|
"section",
|
|
12236
12324
|
{
|
|
12237
12325
|
className: ["pptx-notes", className].filter(Boolean).join(" "),
|
|
@@ -12239,9 +12327,9 @@ function NotesPaneBody(props) {
|
|
|
12239
12327
|
"data-open": open ? "true" : "false",
|
|
12240
12328
|
style: props.style,
|
|
12241
12329
|
children: [
|
|
12242
|
-
/* @__PURE__ */
|
|
12243
|
-
/* @__PURE__ */
|
|
12244
|
-
open && !readOnly && showFormatButtons ? /* @__PURE__ */
|
|
12330
|
+
/* @__PURE__ */ jsxs50("div", { className: "pptx-notes__head", onMouseDown: keepFocus, children: [
|
|
12331
|
+
/* @__PURE__ */ jsx56("span", { children: t("notes.title") }),
|
|
12332
|
+
open && !readOnly && showFormatButtons ? /* @__PURE__ */ jsx56("div", { className: "pptx-notes__format", role: "group", "aria-label": t("notes.format"), children: NOTES_FORMAT_BUTTONS.map(([format, icon, key]) => /* @__PURE__ */ jsx56(
|
|
12245
12333
|
ToolButton,
|
|
12246
12334
|
{
|
|
12247
12335
|
label: t(key),
|
|
@@ -12253,7 +12341,7 @@ function NotesPaneBody(props) {
|
|
|
12253
12341
|
},
|
|
12254
12342
|
format
|
|
12255
12343
|
)) }) : null,
|
|
12256
|
-
/* @__PURE__ */
|
|
12344
|
+
/* @__PURE__ */ jsx56(
|
|
12257
12345
|
ToolButton,
|
|
12258
12346
|
{
|
|
12259
12347
|
label: open ? t("notes.collapse") : t("notes.expand"),
|
|
@@ -12267,7 +12355,7 @@ function NotesPaneBody(props) {
|
|
|
12267
12355
|
}
|
|
12268
12356
|
)
|
|
12269
12357
|
] }),
|
|
12270
|
-
open ? /* @__PURE__ */
|
|
12358
|
+
open ? /* @__PURE__ */ jsx56(
|
|
12271
12359
|
NotesField,
|
|
12272
12360
|
{
|
|
12273
12361
|
id: notesId,
|
|
@@ -12290,14 +12378,14 @@ function NotesPaneBody(props) {
|
|
|
12290
12378
|
onFocus
|
|
12291
12379
|
}
|
|
12292
12380
|
) : null,
|
|
12293
|
-
refusal ? /* @__PURE__ */
|
|
12381
|
+
refusal ? /* @__PURE__ */ jsx56("p", { className: "pptx-notes__refusal", role: "alert", children: refusal }) : null
|
|
12294
12382
|
]
|
|
12295
12383
|
}
|
|
12296
12384
|
);
|
|
12297
12385
|
}
|
|
12298
12386
|
|
|
12299
12387
|
// src/panes.tsx
|
|
12300
|
-
import { jsx as
|
|
12388
|
+
import { jsx as jsx57, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
12301
12389
|
var sameSlides = (a, b) => a.length === b.length && a.every((s, i) => s === b[i]);
|
|
12302
12390
|
var sameIndices2 = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
|
|
12303
12391
|
var clickMode = slideClickMode;
|
|
@@ -12306,12 +12394,12 @@ var Thumbnail = memo2(function Thumbnail2({
|
|
|
12306
12394
|
ratio
|
|
12307
12395
|
}) {
|
|
12308
12396
|
const editor = usePptxEditor();
|
|
12309
|
-
const box =
|
|
12397
|
+
const box = useRef46(null);
|
|
12310
12398
|
useEffect36(() => {
|
|
12311
12399
|
if (!editor || !box.current) return void 0;
|
|
12312
12400
|
return editor.renderThumbnail(slide.index, box.current, { defer: true });
|
|
12313
12401
|
}, [editor, slide]);
|
|
12314
|
-
return /* @__PURE__ */
|
|
12402
|
+
return /* @__PURE__ */ jsx57(
|
|
12315
12403
|
"div",
|
|
12316
12404
|
{
|
|
12317
12405
|
ref: box,
|
|
@@ -12324,7 +12412,7 @@ var Thumbnail = memo2(function Thumbnail2({
|
|
|
12324
12412
|
});
|
|
12325
12413
|
var RailItem = memo2(function RailItem2(props) {
|
|
12326
12414
|
const { slide: s, on } = props;
|
|
12327
|
-
return /* @__PURE__ */
|
|
12415
|
+
return /* @__PURE__ */ jsxs51(
|
|
12328
12416
|
"li",
|
|
12329
12417
|
{
|
|
12330
12418
|
className: "pptx-rail__item",
|
|
@@ -12345,15 +12433,15 @@ var RailItem = memo2(function RailItem2(props) {
|
|
|
12345
12433
|
onClick: (e) => on.click(s.index, e),
|
|
12346
12434
|
onContextMenu: (e) => on.menu(s.index, e),
|
|
12347
12435
|
children: [
|
|
12348
|
-
/* @__PURE__ */
|
|
12349
|
-
/* @__PURE__ */
|
|
12350
|
-
/* @__PURE__ */
|
|
12436
|
+
/* @__PURE__ */ jsx57("span", { className: "pptx-rail__number", "aria-hidden": "true", children: s.index + 1 }),
|
|
12437
|
+
/* @__PURE__ */ jsx57("span", { className: "pptx-sr-only", children: props.name }),
|
|
12438
|
+
/* @__PURE__ */ jsx57(Thumbnail, { slide: s, ratio: props.ratio })
|
|
12351
12439
|
]
|
|
12352
12440
|
}
|
|
12353
12441
|
);
|
|
12354
12442
|
});
|
|
12355
12443
|
function useFocusFollowsCurrent(list, item, current, count, shown = true) {
|
|
12356
|
-
const focused =
|
|
12444
|
+
const focused = useRef46(null);
|
|
12357
12445
|
useEffect36(() => {
|
|
12358
12446
|
followCurrentSlide(list.current, item, focused.current);
|
|
12359
12447
|
}, [list, item, current, count, shown]);
|
|
@@ -12373,14 +12461,14 @@ function stripStyle(style) {
|
|
|
12373
12461
|
}
|
|
12374
12462
|
function useProgressiveMount(total, needed, opening, loading) {
|
|
12375
12463
|
const [, grow] = useReducer((n) => n + 1, 0);
|
|
12376
|
-
const [mount] =
|
|
12464
|
+
const [mount] = useState48(() => createProgressiveMount(grow));
|
|
12377
12465
|
useEffect36(() => () => mount.dispose(), [mount]);
|
|
12378
12466
|
const shown = mount.limit(total, needed, opening, loading);
|
|
12379
12467
|
useEffect36(() => mount.follow(total));
|
|
12380
12468
|
return shown;
|
|
12381
12469
|
}
|
|
12382
12470
|
function usePaneOpen(props) {
|
|
12383
|
-
const [own, setOwn] =
|
|
12471
|
+
const [own, setOwn] = useState48(props.defaultOpen ?? true);
|
|
12384
12472
|
const open = props.open ?? own;
|
|
12385
12473
|
const setOpen = (next) => {
|
|
12386
12474
|
if (props.open === void 0) setOwn(next);
|
|
@@ -12391,14 +12479,14 @@ function usePaneOpen(props) {
|
|
|
12391
12479
|
function SlideRail(props = {}) {
|
|
12392
12480
|
const master = useEditorState((s) => s.presentationView === "slideMaster");
|
|
12393
12481
|
const [open, onOpenChange] = usePaneOpen(props);
|
|
12394
|
-
return master ? /* @__PURE__ */
|
|
12482
|
+
return master ? /* @__PURE__ */ jsx57(MasterRail, { ...props }) : /* @__PURE__ */ jsx57(SlideList, { ...props, ...{ open, onOpenChange } });
|
|
12395
12483
|
}
|
|
12396
12484
|
function SlideList(props) {
|
|
12397
12485
|
const [open, setPaneOpen] = usePaneOpen(props);
|
|
12398
12486
|
const toggle = props.toggle !== false;
|
|
12399
|
-
const rail =
|
|
12487
|
+
const rail = useRef46(null);
|
|
12400
12488
|
const listId = useId21();
|
|
12401
|
-
const focusToggle =
|
|
12489
|
+
const focusToggle = useRef46(false);
|
|
12402
12490
|
const setOpen = (next) => {
|
|
12403
12491
|
focusToggle.current = rail.current?.contains(document.activeElement) ?? false;
|
|
12404
12492
|
setPaneOpen(next);
|
|
@@ -12410,22 +12498,22 @@ function SlideList(props) {
|
|
|
12410
12498
|
const selected = useEditorState((s) => s.selectedSlides, sameIndices2);
|
|
12411
12499
|
const ratio = useEditorState((s) => s.slideHeight / s.slideWidth);
|
|
12412
12500
|
const readOnly = useEditorState((s) => s.mode === "view");
|
|
12413
|
-
const list =
|
|
12501
|
+
const list = useRef46(null);
|
|
12414
12502
|
const count = slides.length;
|
|
12415
12503
|
const opening = useEditorState((s) => (s.pendingSlides ?? 0) > 0);
|
|
12416
12504
|
const loading = useEditorState((s) => s.isOpening === true);
|
|
12417
12505
|
const mounted = useProgressiveMount(count, current, opening, loading);
|
|
12418
|
-
const [menu, setMenu] =
|
|
12419
|
-
const [gallery, setGallery] =
|
|
12420
|
-
const actions =
|
|
12506
|
+
const [menu, setMenu] = useState48(null);
|
|
12507
|
+
const [gallery, setGallery] = useState48(null);
|
|
12508
|
+
const actions = useRef46(null);
|
|
12421
12509
|
const sections = useSlideSections();
|
|
12422
12510
|
const grouped = groupSlideSections2(sections, count);
|
|
12423
12511
|
const inView = grouped ? mountedSections(grouped, mounted) : null;
|
|
12424
12512
|
const orientation = resolveRailOrientation2(props.orientation, "PptxEditor.SlideRail");
|
|
12425
|
-
const [rightToLeft, setRightToLeft] =
|
|
12513
|
+
const [rightToLeft, setRightToLeft] = useState48(false);
|
|
12426
12514
|
useLayoutEffect16(() => setRightToLeft(railRightToLeft2(rail.current)), [orientation, open]);
|
|
12427
12515
|
const chrome = railOrientationChrome2(orientation, rightToLeft);
|
|
12428
|
-
const [folded, setFolded] =
|
|
12516
|
+
const [folded, setFolded] = useState48(false);
|
|
12429
12517
|
useEffect36(() => watchRailFold(rail.current, orientation, setFolded), [orientation, open]);
|
|
12430
12518
|
const {
|
|
12431
12519
|
itemProps: dragProps,
|
|
@@ -12433,7 +12521,7 @@ function SlideList(props) {
|
|
|
12433
12521
|
marker: dropMarker
|
|
12434
12522
|
} = useSlideDrag(railDragAxis(orientation), selected, readOnly, grouped);
|
|
12435
12523
|
const collapsed = useCollapsedSections();
|
|
12436
|
-
const [renaming, setRenaming] =
|
|
12524
|
+
const [renaming, setRenaming] = useState48(null);
|
|
12437
12525
|
useOpenCurrentSection(grouped);
|
|
12438
12526
|
useSectionRenameRequests(setRenaming, open);
|
|
12439
12527
|
const focusCurrent = useFocusCurrentAfterRender(list);
|
|
@@ -12478,8 +12566,8 @@ function SlideList(props) {
|
|
|
12478
12566
|
openMenu: (index, item2) => openMenu(index, item2, null),
|
|
12479
12567
|
focusCurrent
|
|
12480
12568
|
});
|
|
12481
|
-
const [memoItem] =
|
|
12482
|
-
const latest =
|
|
12569
|
+
const [memoItem] = useState48(() => createItemMemo());
|
|
12570
|
+
const latest = useRef46({ editor, dragProps, openMenu });
|
|
12483
12571
|
useLayoutEffect16(() => {
|
|
12484
12572
|
latest.current = { editor, dragProps, openMenu };
|
|
12485
12573
|
});
|
|
@@ -12512,7 +12600,7 @@ function SlideList(props) {
|
|
|
12512
12600
|
const here = s.index === current;
|
|
12513
12601
|
const drop = dropMarker(s.index);
|
|
12514
12602
|
const inputs = [place?.setSize, place?.posInSet, ratio, chosen, here, role, t, labels];
|
|
12515
|
-
return memoItem(s, [...inputs, drop, readOnly, on], () => /* @__PURE__ */
|
|
12603
|
+
return memoItem(s, [...inputs, drop, readOnly, on], () => /* @__PURE__ */ jsx57(
|
|
12516
12604
|
RailItem,
|
|
12517
12605
|
{
|
|
12518
12606
|
setSize: place?.setSize,
|
|
@@ -12560,7 +12648,7 @@ function SlideList(props) {
|
|
|
12560
12648
|
const className = ["pptx-rail", props.className].filter(Boolean).join(" ");
|
|
12561
12649
|
if (!open && !toggle) return null;
|
|
12562
12650
|
if (!open)
|
|
12563
|
-
return /* @__PURE__ */
|
|
12651
|
+
return /* @__PURE__ */ jsx57(
|
|
12564
12652
|
"nav",
|
|
12565
12653
|
{
|
|
12566
12654
|
ref: rail,
|
|
@@ -12570,10 +12658,10 @@ function SlideList(props) {
|
|
|
12570
12658
|
"data-orientation": orientation,
|
|
12571
12659
|
style: stripStyle(props.style),
|
|
12572
12660
|
onMouseDown: keepFocus,
|
|
12573
|
-
children: /* @__PURE__ */
|
|
12661
|
+
children: /* @__PURE__ */ jsx57(RailActionsContext.Provider, { value: railActions, children: railExpandContent(props.children) })
|
|
12574
12662
|
}
|
|
12575
12663
|
);
|
|
12576
|
-
return /* @__PURE__ */
|
|
12664
|
+
return /* @__PURE__ */ jsxs51(
|
|
12577
12665
|
"nav",
|
|
12578
12666
|
{
|
|
12579
12667
|
ref: rail,
|
|
@@ -12583,7 +12671,7 @@ function SlideList(props) {
|
|
|
12583
12671
|
"data-orientation": orientation,
|
|
12584
12672
|
style: paneStyle(props.paneWidth, props.style),
|
|
12585
12673
|
children: [
|
|
12586
|
-
/* @__PURE__ */
|
|
12674
|
+
/* @__PURE__ */ jsx57(
|
|
12587
12675
|
"ol",
|
|
12588
12676
|
{
|
|
12589
12677
|
ref: list,
|
|
@@ -12597,7 +12685,7 @@ function SlideList(props) {
|
|
|
12597
12685
|
onFocus: trackFocus,
|
|
12598
12686
|
children: grouped && inView ? inView.sections.map((sec) => {
|
|
12599
12687
|
const shut = collapsed.includes(sec.id);
|
|
12600
|
-
return /* @__PURE__ */
|
|
12688
|
+
return /* @__PURE__ */ jsx57(
|
|
12601
12689
|
SectionNode,
|
|
12602
12690
|
{
|
|
12603
12691
|
section: sec,
|
|
@@ -12615,7 +12703,7 @@ function SlideList(props) {
|
|
|
12615
12703
|
}) : slides.slice(0, mounted).map(item)
|
|
12616
12704
|
}
|
|
12617
12705
|
),
|
|
12618
|
-
/* @__PURE__ */
|
|
12706
|
+
/* @__PURE__ */ jsx57(RailActionsContext.Provider, { value: railActions, children: /* @__PURE__ */ jsx57(
|
|
12619
12707
|
"div",
|
|
12620
12708
|
{
|
|
12621
12709
|
ref: actions,
|
|
@@ -12625,7 +12713,7 @@ function SlideList(props) {
|
|
|
12625
12713
|
children: actionContent
|
|
12626
12714
|
}
|
|
12627
12715
|
) }),
|
|
12628
|
-
gallery ? /* @__PURE__ */
|
|
12716
|
+
gallery ? /* @__PURE__ */ jsx57(Popover, { anchor: gallery, onClose: () => setGallery(null), label: t("rail.chooseLayout"), children: /* @__PURE__ */ jsx57(
|
|
12629
12717
|
LayoutGallery,
|
|
12630
12718
|
{
|
|
12631
12719
|
onChange: (layoutId) => {
|
|
@@ -12634,7 +12722,7 @@ function SlideList(props) {
|
|
|
12634
12722
|
}
|
|
12635
12723
|
}
|
|
12636
12724
|
) }) : null,
|
|
12637
|
-
/* @__PURE__ */
|
|
12725
|
+
/* @__PURE__ */ jsx57(
|
|
12638
12726
|
RailMenuHost,
|
|
12639
12727
|
{
|
|
12640
12728
|
open: menu ? {
|
|
@@ -12657,8 +12745,8 @@ function ZoomPill({ className } = {}) {
|
|
|
12657
12745
|
const off = useEditorState((s) => s.presentationView === "slideSorter");
|
|
12658
12746
|
const reason = off ? t("disabled.sorterZoom") : null;
|
|
12659
12747
|
const levelLabel = off ? t("zoom.ariaLabel") : t("zoom.levelAriaLabel", { percent: Math.round(zoom * 100) });
|
|
12660
|
-
const anchor =
|
|
12661
|
-
const [open, setOpen] =
|
|
12748
|
+
const anchor = useRef46(null);
|
|
12749
|
+
const [open, setOpen] = useState48(false);
|
|
12662
12750
|
useEffect36(() => {
|
|
12663
12751
|
if (off) setOpen(false);
|
|
12664
12752
|
}, [off]);
|
|
@@ -12671,7 +12759,7 @@ function ZoomPill({ className } = {}) {
|
|
|
12671
12759
|
const key = zoomLimitReason(zoom, dir);
|
|
12672
12760
|
return key ? t(key) : null;
|
|
12673
12761
|
};
|
|
12674
|
-
return /* @__PURE__ */
|
|
12762
|
+
return /* @__PURE__ */ jsxs51(
|
|
12675
12763
|
"div",
|
|
12676
12764
|
{
|
|
12677
12765
|
className: ["pptx-zoom", className].filter(Boolean).join(" "),
|
|
@@ -12679,7 +12767,7 @@ function ZoomPill({ className } = {}) {
|
|
|
12679
12767
|
"aria-label": t("zoom.ariaLabel"),
|
|
12680
12768
|
onMouseDown: keepFocus,
|
|
12681
12769
|
children: [
|
|
12682
|
-
/* @__PURE__ */
|
|
12770
|
+
/* @__PURE__ */ jsx57(
|
|
12683
12771
|
ToolButton,
|
|
12684
12772
|
{
|
|
12685
12773
|
label: t("zoom.zoomOut"),
|
|
@@ -12689,7 +12777,7 @@ function ZoomPill({ className } = {}) {
|
|
|
12689
12777
|
disabledReason: reason ?? limit(-1)
|
|
12690
12778
|
}
|
|
12691
12779
|
),
|
|
12692
|
-
/* @__PURE__ */
|
|
12780
|
+
/* @__PURE__ */ jsxs51(
|
|
12693
12781
|
"button",
|
|
12694
12782
|
{
|
|
12695
12783
|
ref: anchor,
|
|
@@ -12704,12 +12792,12 @@ function ZoomPill({ className } = {}) {
|
|
|
12704
12792
|
onClick: () => !off && setOpen((o) => !o),
|
|
12705
12793
|
children: [
|
|
12706
12794
|
off ? "\u2013" : t("zoom.level", { percent: Math.round(zoom * 100) }),
|
|
12707
|
-
/* @__PURE__ */
|
|
12795
|
+
/* @__PURE__ */ jsx57(Icon, { name: "arrow_drop_down", className: "pptx-icon pptx-toolbar__caret" })
|
|
12708
12796
|
]
|
|
12709
12797
|
}
|
|
12710
12798
|
),
|
|
12711
12799
|
levelOff.note,
|
|
12712
|
-
/* @__PURE__ */
|
|
12800
|
+
/* @__PURE__ */ jsx57(
|
|
12713
12801
|
ToolButton,
|
|
12714
12802
|
{
|
|
12715
12803
|
label: t("zoom.zoomIn"),
|
|
@@ -12719,9 +12807,9 @@ function ZoomPill({ className } = {}) {
|
|
|
12719
12807
|
disabledReason: reason ?? limit(1)
|
|
12720
12808
|
}
|
|
12721
12809
|
),
|
|
12722
|
-
open && !off ? /* @__PURE__ */
|
|
12723
|
-
/* @__PURE__ */
|
|
12724
|
-
ZOOM_MENU_LEVELS.map((z) => /* @__PURE__ */
|
|
12810
|
+
open && !off ? /* @__PURE__ */ jsxs51(Popover, { anchor: anchor.current, onClose: () => setOpen(false), align: "end", children: [
|
|
12811
|
+
/* @__PURE__ */ jsx57(MenuItem, { checked: fit, onSelect: () => (editor?.setZoom("fit"), setOpen(false)), children: t("zoom.fit") }),
|
|
12812
|
+
ZOOM_MENU_LEVELS.map((z) => /* @__PURE__ */ jsx57(
|
|
12725
12813
|
MenuItem,
|
|
12726
12814
|
{
|
|
12727
12815
|
checked: !fit && Math.abs(z - zoom) < 1e-3,
|
|
@@ -12737,7 +12825,7 @@ function ZoomPill({ className } = {}) {
|
|
|
12737
12825
|
}
|
|
12738
12826
|
|
|
12739
12827
|
// src/SlideSorter.tsx
|
|
12740
|
-
import { jsx as
|
|
12828
|
+
import { jsx as jsx58, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
12741
12829
|
var sameList = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
|
|
12742
12830
|
function SlideSorter({ className } = {}) {
|
|
12743
12831
|
const editor = usePptxEditor();
|
|
@@ -12752,15 +12840,15 @@ function SlideSorter({ className } = {}) {
|
|
|
12752
12840
|
const collapsed = useCollapsedSections();
|
|
12753
12841
|
useOpenCurrentSection(grouped);
|
|
12754
12842
|
useSorterRegistration();
|
|
12755
|
-
const list =
|
|
12843
|
+
const list = useRef47(null);
|
|
12756
12844
|
const { itemProps: dragProps } = useSlideDrag("x", selected, readOnly, grouped);
|
|
12757
|
-
const [menu, setMenu] =
|
|
12758
|
-
const [renaming, setRenaming] =
|
|
12845
|
+
const [menu, setMenu] = useState49(null);
|
|
12846
|
+
const [renaming, setRenaming] = useState49(null);
|
|
12759
12847
|
useSectionRenameRequests(setRenaming);
|
|
12760
12848
|
const focusCurrent = useFocusCurrentAfterRender(list);
|
|
12761
12849
|
useFocusAfterCollapse(list, collapsed);
|
|
12762
12850
|
useEffect37(() => list.current ? focusSorterOnShow(list.current) : void 0, []);
|
|
12763
|
-
const editorNow =
|
|
12851
|
+
const editorNow = useRef47(editor);
|
|
12764
12852
|
editorNow.current = editor;
|
|
12765
12853
|
useLayoutEffect17(() => {
|
|
12766
12854
|
const el = list.current;
|
|
@@ -12793,7 +12881,7 @@ function SlideSorter({ className } = {}) {
|
|
|
12793
12881
|
focusCurrent,
|
|
12794
12882
|
openSlide
|
|
12795
12883
|
});
|
|
12796
|
-
const item = (s) => /* @__PURE__ */
|
|
12884
|
+
const item = (s) => /* @__PURE__ */ jsxs52(
|
|
12797
12885
|
"li",
|
|
12798
12886
|
{
|
|
12799
12887
|
className: "pptx-sorter__item",
|
|
@@ -12815,20 +12903,20 @@ function SlideSorter({ className } = {}) {
|
|
|
12815
12903
|
openMenu(s.index, e.currentTarget, pointer ? { x: e.clientX, y: e.clientY } : null);
|
|
12816
12904
|
},
|
|
12817
12905
|
children: [
|
|
12818
|
-
/* @__PURE__ */
|
|
12819
|
-
/* @__PURE__ */
|
|
12820
|
-
/* @__PURE__ */
|
|
12906
|
+
/* @__PURE__ */ jsx58(Thumbnail, { slide: s, ratio }),
|
|
12907
|
+
/* @__PURE__ */ jsx58("span", { className: "pptx-sorter__number", "aria-hidden": "true", children: s.index + 1 }),
|
|
12908
|
+
/* @__PURE__ */ jsx58("span", { className: "pptx-sr-only", children: slideItemName2(t, s) })
|
|
12821
12909
|
]
|
|
12822
12910
|
},
|
|
12823
12911
|
s.id
|
|
12824
12912
|
);
|
|
12825
|
-
return /* @__PURE__ */
|
|
12913
|
+
return /* @__PURE__ */ jsxs52(
|
|
12826
12914
|
"section",
|
|
12827
12915
|
{
|
|
12828
12916
|
className: ["pptx-sorter", className].filter(Boolean).join(" "),
|
|
12829
12917
|
"aria-label": t("sorter.ariaLabel"),
|
|
12830
12918
|
children: [
|
|
12831
|
-
/* @__PURE__ */
|
|
12919
|
+
/* @__PURE__ */ jsx58(
|
|
12832
12920
|
"ol",
|
|
12833
12921
|
{
|
|
12834
12922
|
ref: list,
|
|
@@ -12838,7 +12926,7 @@ function SlideSorter({ className } = {}) {
|
|
|
12838
12926
|
"aria-label": t("sorter.ariaLabel"),
|
|
12839
12927
|
onKeyDown,
|
|
12840
12928
|
onFocus: trackFocus,
|
|
12841
|
-
children: grouped ? grouped.map((sec) => /* @__PURE__ */
|
|
12929
|
+
children: grouped ? grouped.map((sec) => /* @__PURE__ */ jsx58(
|
|
12842
12930
|
SectionNode,
|
|
12843
12931
|
{
|
|
12844
12932
|
section: sec,
|
|
@@ -12852,10 +12940,10 @@ function SlideSorter({ className } = {}) {
|
|
|
12852
12940
|
children: slides.slice(sec.firstSlide, sec.firstSlide + sec.slideCount).map(item)
|
|
12853
12941
|
},
|
|
12854
12942
|
sec.id
|
|
12855
|
-
)) : /* @__PURE__ */
|
|
12943
|
+
)) : /* @__PURE__ */ jsx58("li", { role: "presentation", className: "pptx-sorter__section", children: /* @__PURE__ */ jsx58("ol", { role: "group", className: "pptx-sorter__grid", children: slides.map(item) }) })
|
|
12856
12944
|
}
|
|
12857
12945
|
),
|
|
12858
|
-
/* @__PURE__ */
|
|
12946
|
+
/* @__PURE__ */ jsx58(
|
|
12859
12947
|
RailMenuHost,
|
|
12860
12948
|
{
|
|
12861
12949
|
open: menu ? {
|
|
@@ -12875,7 +12963,7 @@ function ViewSwitch() {
|
|
|
12875
12963
|
const cmd = useEditorCommand("view.presentationView");
|
|
12876
12964
|
const options = STATUS_BAR_VIEW_OPTIONS;
|
|
12877
12965
|
const off = !cmd.isEnabled;
|
|
12878
|
-
const reason = cmd.disabledReason ?
|
|
12966
|
+
const reason = cmd.disabledReason ? translateKeyOrText20(t, cmd.disabledReason) : null;
|
|
12879
12967
|
const offAttrs = useAriaDisabled(off, reason);
|
|
12880
12968
|
const pick = (e, step) => {
|
|
12881
12969
|
if (off) return;
|
|
@@ -12886,7 +12974,7 @@ function ViewSwitch() {
|
|
|
12886
12974
|
const buttons = e.currentTarget.parentElement?.querySelectorAll('[role="radio"]');
|
|
12887
12975
|
buttons?.[options.indexOf(next)]?.focus();
|
|
12888
12976
|
};
|
|
12889
|
-
return /* @__PURE__ */
|
|
12977
|
+
return /* @__PURE__ */ jsxs52(
|
|
12890
12978
|
"div",
|
|
12891
12979
|
{
|
|
12892
12980
|
className: "pptx-zoom pptx-view-switch",
|
|
@@ -12898,7 +12986,7 @@ function ViewSwitch() {
|
|
|
12898
12986
|
const on = cmd.value === o.value;
|
|
12899
12987
|
const tabStop = on || i === 0 && !options.some((x) => x.value === cmd.value);
|
|
12900
12988
|
const label = t(o.labelKey);
|
|
12901
|
-
return /* @__PURE__ */
|
|
12989
|
+
return /* @__PURE__ */ jsx58(
|
|
12902
12990
|
"button",
|
|
12903
12991
|
{
|
|
12904
12992
|
type: "button",
|
|
@@ -12918,7 +13006,7 @@ function ViewSwitch() {
|
|
|
12918
13006
|
e.preventDefault();
|
|
12919
13007
|
pick(e, step);
|
|
12920
13008
|
},
|
|
12921
|
-
children: /* @__PURE__ */
|
|
13009
|
+
children: /* @__PURE__ */ jsx58(Icon, { paths: o.paths ?? null })
|
|
12922
13010
|
},
|
|
12923
13011
|
o.value
|
|
12924
13012
|
);
|
|
@@ -12935,8 +13023,8 @@ function DefaultWorkspace({
|
|
|
12935
13023
|
}) {
|
|
12936
13024
|
const editor = usePptxEditor();
|
|
12937
13025
|
const view = useEditorState((s) => s.presentationView ?? "normal");
|
|
12938
|
-
const box =
|
|
12939
|
-
const was =
|
|
13026
|
+
const box = useRef47(null);
|
|
13027
|
+
const was = useRef47(view);
|
|
12940
13028
|
useEffect37(() => {
|
|
12941
13029
|
if (was.current === view) return;
|
|
12942
13030
|
was.current = view;
|
|
@@ -12944,7 +13032,7 @@ function DefaultWorkspace({
|
|
|
12944
13032
|
if (active && active !== active.ownerDocument.body && active.isConnected) return;
|
|
12945
13033
|
focusCurrentSlideOrCanvas(box.current, editor);
|
|
12946
13034
|
}, [view, editor]);
|
|
12947
|
-
const inset =
|
|
13035
|
+
const inset = useRef47(null);
|
|
12948
13036
|
useEffect37(() => {
|
|
12949
13037
|
if (!box.current) return;
|
|
12950
13038
|
const tracker = trackNotesInset(box.current);
|
|
@@ -12957,16 +13045,16 @@ function DefaultWorkspace({
|
|
|
12957
13045
|
useEffect37(() => {
|
|
12958
13046
|
inset.current?.refresh();
|
|
12959
13047
|
});
|
|
12960
|
-
return /* @__PURE__ */
|
|
12961
|
-
view === "slideSorter" ? /* @__PURE__ */
|
|
12962
|
-
/* @__PURE__ */
|
|
12963
|
-
/* @__PURE__ */
|
|
13048
|
+
return /* @__PURE__ */ jsxs52("div", { ref: box, className: "pptx-default__views", children: [
|
|
13049
|
+
view === "slideSorter" ? /* @__PURE__ */ jsx58("div", { className: "pptx-default__workspace", children: /* @__PURE__ */ jsxs52("div", { className: "pptx-default__main", children: [
|
|
13050
|
+
/* @__PURE__ */ jsx58(SlideSorter, {}),
|
|
13051
|
+
/* @__PURE__ */ jsx58(EditNotice, {})
|
|
12964
13052
|
] }) }) : normal,
|
|
12965
13053
|
overlay,
|
|
12966
|
-
status === void 0 ? /* @__PURE__ */
|
|
12967
|
-
/* @__PURE__ */
|
|
12968
|
-
/* @__PURE__ */
|
|
12969
|
-
/* @__PURE__ */
|
|
13054
|
+
status === void 0 ? /* @__PURE__ */ jsxs52("div", { className: "pptx-statusbar", children: [
|
|
13055
|
+
/* @__PURE__ */ jsx58(ReadOnlyBadge, {}),
|
|
13056
|
+
/* @__PURE__ */ jsx58(ViewSwitch, {}),
|
|
13057
|
+
/* @__PURE__ */ jsx58(ZoomPill, {})
|
|
12970
13058
|
] }) : status
|
|
12971
13059
|
] });
|
|
12972
13060
|
}
|
|
@@ -12974,7 +13062,7 @@ function ReadOnlyBadge() {
|
|
|
12974
13062
|
const { t } = useTranslation();
|
|
12975
13063
|
const damaged = useEditorState((s) => s.readOnlyReason === "damaged-slide");
|
|
12976
13064
|
if (!damaged) return null;
|
|
12977
|
-
return /* @__PURE__ */
|
|
13065
|
+
return /* @__PURE__ */ jsx58("span", { className: "pptx-statusbar__read-only", role: "status", "data-reason": "damaged-slide", children: t("statusBar.readOnlyDamaged") });
|
|
12978
13066
|
}
|
|
12979
13067
|
function SlideSorterWatch() {
|
|
12980
13068
|
const editor = usePptxEditor();
|
|
@@ -12986,16 +13074,16 @@ function SlideSorterWatch() {
|
|
|
12986
13074
|
}
|
|
12987
13075
|
|
|
12988
13076
|
// src/ChromeTooltip.tsx
|
|
12989
|
-
import { useEffect as useEffect38, useLayoutEffect as useLayoutEffect18, useRef as
|
|
13077
|
+
import { useEffect as useEffect38, useLayoutEffect as useLayoutEffect18, useRef as useRef48, useState as useState50 } from "react";
|
|
12990
13078
|
import { createPortal as createPortal3 } from "react-dom";
|
|
12991
13079
|
import {
|
|
12992
13080
|
listenChromeTooltips,
|
|
12993
13081
|
positionChromeTooltip
|
|
12994
13082
|
} from "@pptx-editor.dev/core/editor";
|
|
12995
|
-
import { jsx as
|
|
13083
|
+
import { jsx as jsx59, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
12996
13084
|
function ChromeTooltip() {
|
|
12997
|
-
const [state, setState] =
|
|
12998
|
-
const ref =
|
|
13085
|
+
const [state, setState] = useState50(null);
|
|
13086
|
+
const ref = useRef48(null);
|
|
12999
13087
|
useEffect38(
|
|
13000
13088
|
() => typeof document === "undefined" ? void 0 : listenChromeTooltips(document, setState),
|
|
13001
13089
|
[]
|
|
@@ -13006,7 +13094,7 @@ function ChromeTooltip() {
|
|
|
13006
13094
|
if (!state) return null;
|
|
13007
13095
|
return createPortal3(
|
|
13008
13096
|
// Visual only: the control's `aria-label` and `aria-describedby` carry the same text.
|
|
13009
|
-
/* @__PURE__ */
|
|
13097
|
+
/* @__PURE__ */ jsxs53(
|
|
13010
13098
|
"div",
|
|
13011
13099
|
{
|
|
13012
13100
|
ref,
|
|
@@ -13015,8 +13103,8 @@ function ChromeTooltip() {
|
|
|
13015
13103
|
"aria-hidden": "true",
|
|
13016
13104
|
"data-instant": state.instant || void 0,
|
|
13017
13105
|
children: [
|
|
13018
|
-
/* @__PURE__ */
|
|
13019
|
-
state.reason ? /* @__PURE__ */
|
|
13106
|
+
/* @__PURE__ */ jsx59("span", { className: "pptx-tooltip__label", children: state.label }),
|
|
13107
|
+
state.reason ? /* @__PURE__ */ jsx59("span", { className: "pptx-tooltip__reason", children: state.reason }) : null
|
|
13020
13108
|
]
|
|
13021
13109
|
}
|
|
13022
13110
|
),
|
|
@@ -13025,24 +13113,24 @@ function ChromeTooltip() {
|
|
|
13025
13113
|
}
|
|
13026
13114
|
|
|
13027
13115
|
// src/PptxEditorRoot.tsx
|
|
13028
|
-
import { Fragment as Fragment40, jsx as
|
|
13116
|
+
import { Fragment as Fragment40, jsx as jsx60, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
13029
13117
|
var PptxEditorRoot = forwardRef(
|
|
13030
13118
|
function PptxEditorRoot2(props, ref) {
|
|
13031
13119
|
const { document: bytes, mode = "edit", locale, onReady, onChange, children } = props;
|
|
13032
|
-
const [editor, setEditor] =
|
|
13033
|
-
const live =
|
|
13120
|
+
const [editor, setEditor] = useState51(null);
|
|
13121
|
+
const live = useRef49(null);
|
|
13034
13122
|
useImperativeHandle(ref, () => createEditorRefApi(() => live.current), []);
|
|
13035
|
-
const callbacks =
|
|
13123
|
+
const callbacks = useRef49({ onReady, onChange, onFontError: props.onFontError });
|
|
13036
13124
|
callbacks.current = { onReady, onChange, onFontError: props.onFontError };
|
|
13037
|
-
const createdFonts =
|
|
13038
|
-
const createdFamilies =
|
|
13039
|
-
const createdModules =
|
|
13125
|
+
const createdFonts = useRef49(props.fonts);
|
|
13126
|
+
const createdFamilies = useRef49(props.fontFamilies);
|
|
13127
|
+
const createdModules = useRef49(props.modules);
|
|
13040
13128
|
const localeKey = localeContentKey(locale);
|
|
13041
|
-
const translator =
|
|
13129
|
+
const translator = useRef49(null);
|
|
13042
13130
|
if (translator.current?.key !== localeKey)
|
|
13043
13131
|
translator.current = { key: localeKey, t: translatorFor(locale) };
|
|
13044
13132
|
const t = translator.current.t;
|
|
13045
|
-
const tRef =
|
|
13133
|
+
const tRef = useRef49(t);
|
|
13046
13134
|
tRef.current = t;
|
|
13047
13135
|
useEffect39(() => {
|
|
13048
13136
|
const instance = createPptxEditor({
|
|
@@ -13054,7 +13142,7 @@ var PptxEditorRoot = forwardRef(
|
|
|
13054
13142
|
...props.readClipboardDrawing ? { readClipboardDrawing: props.readClipboardDrawing } : {},
|
|
13055
13143
|
...props.author ? { author: props.author } : {},
|
|
13056
13144
|
onFontError: (error) => reportFontError(error, callbacks.current.onFontError),
|
|
13057
|
-
translate: (key, params) =>
|
|
13145
|
+
translate: (key, params) => translateKeyOrText21(tRef.current, key, params)
|
|
13058
13146
|
});
|
|
13059
13147
|
createdFonts.current = props.fonts;
|
|
13060
13148
|
createdFamilies.current = props.fontFamilies;
|
|
@@ -13069,8 +13157,8 @@ var PptxEditorRoot = forwardRef(
|
|
|
13069
13157
|
instance.destroy();
|
|
13070
13158
|
};
|
|
13071
13159
|
}, []);
|
|
13072
|
-
const [documentChurn] =
|
|
13073
|
-
const [fontsChurn] =
|
|
13160
|
+
const [documentChurn] = useState51(() => churnWarning("PptxEditor.Root", "document"));
|
|
13161
|
+
const [fontsChurn] = useState51(() => churnWarning("PptxEditor.Root", "fonts"));
|
|
13074
13162
|
useEffect39(() => {
|
|
13075
13163
|
if (!editor || !bytes) return;
|
|
13076
13164
|
documentChurn();
|
|
@@ -13101,7 +13189,7 @@ var PptxEditorRoot = forwardRef(
|
|
|
13101
13189
|
createdFamilies.current = fontFamilies;
|
|
13102
13190
|
editor.setFontFamilies(fontFamilies ?? []);
|
|
13103
13191
|
}, [editor, fontFamilies]);
|
|
13104
|
-
const painted =
|
|
13192
|
+
const painted = useRef49(localeKey);
|
|
13105
13193
|
useEffect39(() => {
|
|
13106
13194
|
if (!editor || painted.current === localeKey) return;
|
|
13107
13195
|
painted.current = localeKey;
|
|
@@ -13109,16 +13197,16 @@ var PptxEditorRoot = forwardRef(
|
|
|
13109
13197
|
}, [editor, localeKey]);
|
|
13110
13198
|
const slideshow = useSlideshowHandle(editor);
|
|
13111
13199
|
const dark = useResolvedDark(props.colorMode);
|
|
13112
|
-
const [notesOpen, setNotesOpen] =
|
|
13113
|
-
const notesRequest =
|
|
13200
|
+
const [notesOpen, setNotesOpen] = useState51(void 0);
|
|
13201
|
+
const notesRequest = useRef49(null);
|
|
13114
13202
|
const panes = useMemo19(
|
|
13115
13203
|
() => ({ notesOpen, setNotesOpen, notesRequest }),
|
|
13116
13204
|
[notesOpen]
|
|
13117
13205
|
);
|
|
13118
|
-
return /* @__PURE__ */
|
|
13206
|
+
return /* @__PURE__ */ jsx60(PptxEditorContext.Provider, { value: editor, children: /* @__PURE__ */ jsx60(TranslationContext.Provider, { value: t, children: /* @__PURE__ */ jsx60(SlideshowContext.Provider, { value: slideshow, children: /* @__PURE__ */ jsx60(ChromeDarkContext.Provider, { value: dark, children: /* @__PURE__ */ jsx60(PaneStateContext.Provider, { value: panes, children: /* @__PURE__ */ jsx60(DialogProvider, { ...props.popups ? { popups: props.popups } : {}, children: /* @__PURE__ */ jsxs54(ChromeActionHostProvider, { children: [
|
|
13119
13207
|
children,
|
|
13120
|
-
/* @__PURE__ */
|
|
13121
|
-
/* @__PURE__ */
|
|
13208
|
+
/* @__PURE__ */ jsx60(SlideSorterWatch, {}),
|
|
13209
|
+
/* @__PURE__ */ jsx60(ChromeTooltip, {})
|
|
13122
13210
|
] }) }) }) }) }) }) });
|
|
13123
13211
|
}
|
|
13124
13212
|
);
|
|
@@ -13126,32 +13214,32 @@ function viewportLandmark(t, label) {
|
|
|
13126
13214
|
if (label === false) return {};
|
|
13127
13215
|
return {
|
|
13128
13216
|
role: "region",
|
|
13129
|
-
"aria-label": label ?
|
|
13217
|
+
"aria-label": label ? translateKeyOrText21(t, label) : t("viewport.ariaLabel")
|
|
13130
13218
|
};
|
|
13131
13219
|
}
|
|
13132
13220
|
function PptxEditorViewport({ className, label, children }) {
|
|
13133
13221
|
const dark = useChromeDark();
|
|
13134
13222
|
const { t } = useTranslation();
|
|
13135
|
-
return /* @__PURE__ */
|
|
13223
|
+
return /* @__PURE__ */ jsx60(
|
|
13136
13224
|
"div",
|
|
13137
13225
|
{
|
|
13138
13226
|
className: ["pptx-editor", dark ? "dark" : "", className].filter(Boolean).join(" "),
|
|
13139
13227
|
...viewportLandmark(t, label),
|
|
13140
|
-
children: /* @__PURE__ */
|
|
13228
|
+
children: /* @__PURE__ */ jsx60(ScopedByAncestorContext.Provider, { value: true, children })
|
|
13141
13229
|
}
|
|
13142
13230
|
);
|
|
13143
13231
|
}
|
|
13144
13232
|
function PptxEditorContent({ className }) {
|
|
13145
13233
|
const editor = usePptxEditor();
|
|
13146
|
-
const host =
|
|
13234
|
+
const host = useRef49(null);
|
|
13147
13235
|
const menu = useCanvasContextMenu();
|
|
13148
13236
|
useLayoutEffect19(() => {
|
|
13149
13237
|
if (!editor || !host.current) return;
|
|
13150
13238
|
editor.attach(host.current);
|
|
13151
13239
|
return () => editor.detach();
|
|
13152
13240
|
}, [editor]);
|
|
13153
|
-
return /* @__PURE__ */
|
|
13154
|
-
/* @__PURE__ */
|
|
13241
|
+
return /* @__PURE__ */ jsxs54(Fragment40, { children: [
|
|
13242
|
+
/* @__PURE__ */ jsx60(
|
|
13155
13243
|
"div",
|
|
13156
13244
|
{
|
|
13157
13245
|
ref: host,
|
|
@@ -13159,7 +13247,7 @@ function PptxEditorContent({ className }) {
|
|
|
13159
13247
|
"data-pptx-canvas": "",
|
|
13160
13248
|
onContextMenu: menu.onContextMenu,
|
|
13161
13249
|
onKeyDown: menu.onKeyDown,
|
|
13162
|
-
children: /* @__PURE__ */
|
|
13250
|
+
children: /* @__PURE__ */ jsx60("div", { className: "pptx-master-slot", children: /* @__PURE__ */ jsx60(MasterViewBar, {}) })
|
|
13163
13251
|
}
|
|
13164
13252
|
),
|
|
13165
13253
|
menu.layer
|
|
@@ -13169,7 +13257,7 @@ function PptxEditorContent({ className }) {
|
|
|
13169
13257
|
// src/toolbar-action.tsx
|
|
13170
13258
|
import { Children as Children8, Fragment as Fragment41, isValidElement as isValidElement8 } from "react";
|
|
13171
13259
|
import { tooltipAttributes as tooltipAttributes7, warnAsChildChild as warnAsChildChild3 } from "@pptx-editor.dev/core/editor";
|
|
13172
|
-
import { Fragment as Fragment42, jsx as
|
|
13260
|
+
import { Fragment as Fragment42, jsx as jsx61, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
13173
13261
|
function ToolbarAction(props) {
|
|
13174
13262
|
const { label, icon, active, disabled, disabledReason, onSelect, asChild, className, children } = props;
|
|
13175
13263
|
const off = useAriaDisabled(!!disabled, disabledReason);
|
|
@@ -13190,7 +13278,7 @@ function ToolbarAction(props) {
|
|
|
13190
13278
|
const select = disabled ? void 0 : () => onSelect?.();
|
|
13191
13279
|
if (child) {
|
|
13192
13280
|
const isButton = child.type === "button";
|
|
13193
|
-
return /* @__PURE__ */
|
|
13281
|
+
return /* @__PURE__ */ jsxs55(Fragment42, { children: [
|
|
13194
13282
|
renderAsChild(child, {
|
|
13195
13283
|
...shared,
|
|
13196
13284
|
...isButton ? { type: "button" } : buttonRoleProps(select),
|
|
@@ -13203,7 +13291,7 @@ function ToolbarAction(props) {
|
|
|
13203
13291
|
const own = asChild ? void 0 : children;
|
|
13204
13292
|
const content = icon ?? (own === null || own === false ? void 0 : own);
|
|
13205
13293
|
const text = icon == null && (content === void 0 || hasText(content));
|
|
13206
|
-
const button = /* @__PURE__ */
|
|
13294
|
+
const button = /* @__PURE__ */ jsx61(
|
|
13207
13295
|
"button",
|
|
13208
13296
|
{
|
|
13209
13297
|
type: "button",
|
|
@@ -13214,7 +13302,7 @@ function ToolbarAction(props) {
|
|
|
13214
13302
|
children: content ?? label
|
|
13215
13303
|
}
|
|
13216
13304
|
);
|
|
13217
|
-
return off.note ? /* @__PURE__ */
|
|
13305
|
+
return off.note ? /* @__PURE__ */ jsxs55(Fragment42, { children: [
|
|
13218
13306
|
button,
|
|
13219
13307
|
off.note
|
|
13220
13308
|
] }) : button;
|
|
@@ -13226,7 +13314,7 @@ function hasText(node) {
|
|
|
13226
13314
|
}
|
|
13227
13315
|
var ACTION_PARTS = { slot: "Toolbar.Action", group: "Toolbar.Group" };
|
|
13228
13316
|
function ToolbarSeparator({ className }) {
|
|
13229
|
-
return /* @__PURE__ */
|
|
13317
|
+
return /* @__PURE__ */ jsx61(
|
|
13230
13318
|
"span",
|
|
13231
13319
|
{
|
|
13232
13320
|
role: "separator",
|
|
@@ -13238,9 +13326,9 @@ function ToolbarSeparator({ className }) {
|
|
|
13238
13326
|
|
|
13239
13327
|
// src/toolbar-named-parts.tsx
|
|
13240
13328
|
import { TOOLBAR_NAMED_PARTS as TOOLBAR_NAMED_PARTS2 } from "@pptx-editor.dev/core/editor";
|
|
13241
|
-
import { jsx as
|
|
13329
|
+
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
13242
13330
|
function definePart(name, slot) {
|
|
13243
|
-
const Part = (props) => /* @__PURE__ */
|
|
13331
|
+
const Part = (props) => /* @__PURE__ */ jsx62(ToolbarSlot, { ...namedPartSlotProps(slot, props, `Toolbar.${name}`) });
|
|
13244
13332
|
return Object.assign(Part, { pptxSlot: slot });
|
|
13245
13333
|
}
|
|
13246
13334
|
var TOOLBAR_PARTS = Object.fromEntries(
|
|
@@ -13251,14 +13339,14 @@ var TOOLBAR_PARTS = Object.fromEntries(
|
|
|
13251
13339
|
);
|
|
13252
13340
|
|
|
13253
13341
|
// src/FontNotice.tsx
|
|
13254
|
-
import { useEffect as useEffect40, useRef as
|
|
13342
|
+
import { useEffect as useEffect40, useRef as useRef50, useState as useState52 } from "react";
|
|
13255
13343
|
import {
|
|
13256
13344
|
applyLocalFonts,
|
|
13257
13345
|
canQueryLocalFonts,
|
|
13258
13346
|
fontNoticeFamilies,
|
|
13259
13347
|
fontNoticeList
|
|
13260
13348
|
} from "@pptx-editor.dev/core/editor";
|
|
13261
|
-
import { jsx as
|
|
13349
|
+
import { jsx as jsx63, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
13262
13350
|
var FontNotice = withChromeTranslate(FontNoticeRoot, "FontNotice");
|
|
13263
13351
|
function FontNoticeRoot({ className }) {
|
|
13264
13352
|
const editor = usePptxEditor();
|
|
@@ -13267,10 +13355,10 @@ function FontNoticeRoot({ className }) {
|
|
|
13267
13355
|
const loadState = useEditorState((s) => s.status);
|
|
13268
13356
|
const missing = fontNoticeFamilies(substituted);
|
|
13269
13357
|
const key = missing.join("|");
|
|
13270
|
-
const [dismissed, setDismissed] =
|
|
13271
|
-
const [outcome, setOutcome] =
|
|
13272
|
-
const [busy, setBusy] =
|
|
13273
|
-
const round =
|
|
13358
|
+
const [dismissed, setDismissed] = useState52(null);
|
|
13359
|
+
const [outcome, setOutcome] = useState52(null);
|
|
13360
|
+
const [busy, setBusy] = useState52(false);
|
|
13361
|
+
const round = useRef50(0);
|
|
13274
13362
|
useEffect40(() => {
|
|
13275
13363
|
round.current += 1;
|
|
13276
13364
|
setOutcome(null);
|
|
@@ -13290,18 +13378,18 @@ function FontNoticeRoot({ className }) {
|
|
|
13290
13378
|
setBusy(false);
|
|
13291
13379
|
}
|
|
13292
13380
|
};
|
|
13293
|
-
return /* @__PURE__ */
|
|
13381
|
+
return /* @__PURE__ */ jsxs56(
|
|
13294
13382
|
"div",
|
|
13295
13383
|
{
|
|
13296
13384
|
className: `pptx-font-notice${className ? ` ${className}` : ""}`,
|
|
13297
13385
|
role: "status",
|
|
13298
13386
|
onMouseDown: keepFocus,
|
|
13299
13387
|
children: [
|
|
13300
|
-
/* @__PURE__ */
|
|
13388
|
+
/* @__PURE__ */ jsxs56("span", { className: "pptx-font-notice__text", children: [
|
|
13301
13389
|
missing.length ? t("fonts.notice", { families: fontNoticeList(missing, t) }) : status,
|
|
13302
13390
|
missing.length && status ? ` ${status}` : ""
|
|
13303
13391
|
] }),
|
|
13304
|
-
missing.length && canQueryLocalFonts() ? /* @__PURE__ */
|
|
13392
|
+
missing.length && canQueryLocalFonts() ? /* @__PURE__ */ jsx63(
|
|
13305
13393
|
"button",
|
|
13306
13394
|
{
|
|
13307
13395
|
type: "button",
|
|
@@ -13311,7 +13399,7 @@ function FontNoticeRoot({ className }) {
|
|
|
13311
13399
|
children: t("fonts.useLocal")
|
|
13312
13400
|
}
|
|
13313
13401
|
) : null,
|
|
13314
|
-
/* @__PURE__ */
|
|
13402
|
+
/* @__PURE__ */ jsx63(ToolButton, { label: t("fonts.dismiss"), icon: "close", onClick: () => setDismissed(key) })
|
|
13315
13403
|
]
|
|
13316
13404
|
}
|
|
13317
13405
|
);
|
|
@@ -13319,11 +13407,11 @@ function FontNoticeRoot({ className }) {
|
|
|
13319
13407
|
|
|
13320
13408
|
// src/OpenFailure.tsx
|
|
13321
13409
|
import {
|
|
13322
|
-
useCallback as
|
|
13410
|
+
useCallback as useCallback16,
|
|
13323
13411
|
useEffect as useEffect41,
|
|
13324
13412
|
useId as useId22,
|
|
13325
|
-
useRef as
|
|
13326
|
-
useState as
|
|
13413
|
+
useRef as useRef51,
|
|
13414
|
+
useState as useState53
|
|
13327
13415
|
} from "react";
|
|
13328
13416
|
import {
|
|
13329
13417
|
copyOpenFailureReport,
|
|
@@ -13332,15 +13420,15 @@ import {
|
|
|
13332
13420
|
openFailureKey,
|
|
13333
13421
|
shownOpenFailure
|
|
13334
13422
|
} from "@pptx-editor.dev/core/editor";
|
|
13335
|
-
import { jsx as
|
|
13423
|
+
import { jsx as jsx64, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
13336
13424
|
function useOpenFailure(options = {}) {
|
|
13337
13425
|
const current = useEditorState(shownOpenFailure);
|
|
13338
13426
|
const kept = useEditorState((s) => s.status === "ready");
|
|
13339
13427
|
const { t: ambient } = useTranslation();
|
|
13340
13428
|
const t = options.t ?? ambient;
|
|
13341
|
-
const [dismissed, setDismissed] =
|
|
13429
|
+
const [dismissed, setDismissed] = useState53(null);
|
|
13342
13430
|
const failure = current !== null && current !== dismissed ? current : null;
|
|
13343
|
-
const dismiss =
|
|
13431
|
+
const dismiss = useCallback16(
|
|
13344
13432
|
(shown) => {
|
|
13345
13433
|
if (!shown || shown === current) setDismissed(current);
|
|
13346
13434
|
},
|
|
@@ -13369,9 +13457,9 @@ function OpenFailureRoot({
|
|
|
13369
13457
|
const { t } = useTranslation();
|
|
13370
13458
|
const { failure, message: packaged, kept, dismiss } = useOpenFailure();
|
|
13371
13459
|
const titleId = useId22();
|
|
13372
|
-
const [copy, setCopy] =
|
|
13373
|
-
const reportRef =
|
|
13374
|
-
const rootRef =
|
|
13460
|
+
const [copy, setCopy] = useState53(null);
|
|
13461
|
+
const reportRef = useRef51(null);
|
|
13462
|
+
const rootRef = useRef51(null);
|
|
13375
13463
|
const editor = usePptxEditor();
|
|
13376
13464
|
useEffect41(() => {
|
|
13377
13465
|
if (copy && !copy.copied) reportRef.current?.focus();
|
|
@@ -13391,7 +13479,7 @@ function OpenFailureRoot({
|
|
|
13391
13479
|
};
|
|
13392
13480
|
const context = { failure, message: packaged, dismiss: close };
|
|
13393
13481
|
const body = typeof message === "function" ? message(failure) : message ?? packaged;
|
|
13394
|
-
return /* @__PURE__ */
|
|
13482
|
+
return /* @__PURE__ */ jsxs57(
|
|
13395
13483
|
"div",
|
|
13396
13484
|
{
|
|
13397
13485
|
ref: rootRef,
|
|
@@ -13401,14 +13489,14 @@ function OpenFailureRoot({
|
|
|
13401
13489
|
"aria-labelledby": titleId,
|
|
13402
13490
|
"data-reason": failure.reason,
|
|
13403
13491
|
children: [
|
|
13404
|
-
/* @__PURE__ */
|
|
13405
|
-
/* @__PURE__ */
|
|
13406
|
-
/* @__PURE__ */
|
|
13407
|
-
kept ? /* @__PURE__ */
|
|
13408
|
-
showCode ? /* @__PURE__ */
|
|
13492
|
+
/* @__PURE__ */ jsxs57("div", { className: "pptx-open-failure__text", role: "alert", children: [
|
|
13493
|
+
/* @__PURE__ */ jsx64("p", { id: titleId, className: "pptx-open-failure__title", children: title ?? t("openFailure.title") }),
|
|
13494
|
+
/* @__PURE__ */ jsx64("div", { className: "pptx-open-failure__message", children: body }),
|
|
13495
|
+
kept ? /* @__PURE__ */ jsx64("p", { className: "pptx-open-failure__kept", children: t("openFailure.kept") }) : null,
|
|
13496
|
+
showCode ? /* @__PURE__ */ jsx64("p", { className: "pptx-open-failure__code", children: t("openFailure.code", { code: failure.code }) }) : null
|
|
13409
13497
|
] }),
|
|
13410
|
-
/* @__PURE__ */
|
|
13411
|
-
copyShown && !copyShown.copied ? /* @__PURE__ */
|
|
13498
|
+
/* @__PURE__ */ jsx64("p", { className: "pptx-open-failure__status", role: "status", children: copyShown ? t(copyShown.copied ? "openFailure.copied" : "openFailure.copyFailed") : null }),
|
|
13499
|
+
copyShown && !copyShown.copied ? /* @__PURE__ */ jsx64(
|
|
13412
13500
|
"textarea",
|
|
13413
13501
|
{
|
|
13414
13502
|
ref: reportRef,
|
|
@@ -13420,9 +13508,9 @@ function OpenFailureRoot({
|
|
|
13420
13508
|
onFocus: (e) => e.currentTarget.select()
|
|
13421
13509
|
}
|
|
13422
13510
|
) : null,
|
|
13423
|
-
/* @__PURE__ */
|
|
13511
|
+
/* @__PURE__ */ jsxs57("div", { className: "pptx-open-failure__actions", children: [
|
|
13424
13512
|
actions?.(context),
|
|
13425
|
-
showCopy ? /* @__PURE__ */
|
|
13513
|
+
showCopy ? /* @__PURE__ */ jsx64(
|
|
13426
13514
|
"button",
|
|
13427
13515
|
{
|
|
13428
13516
|
type: "button",
|
|
@@ -13431,7 +13519,7 @@ function OpenFailureRoot({
|
|
|
13431
13519
|
children: t("openFailure.copyDetails")
|
|
13432
13520
|
}
|
|
13433
13521
|
) : null,
|
|
13434
|
-
showClose ? /* @__PURE__ */
|
|
13522
|
+
showClose ? /* @__PURE__ */ jsx64("button", { type: "button", className: "pptx-open-failure__action", onClick: close, children: closeLabel ?? t("openFailure.close") }) : null
|
|
13435
13523
|
] })
|
|
13436
13524
|
]
|
|
13437
13525
|
},
|
|
@@ -13441,9 +13529,9 @@ function OpenFailureRoot({
|
|
|
13441
13529
|
|
|
13442
13530
|
// src/Loading.tsx
|
|
13443
13531
|
import { loadingSheetSize, sameLoadingSheetSize, showsLoading } from "@pptx-editor.dev/core/editor";
|
|
13444
|
-
import { Fragment as Fragment43, jsx as
|
|
13532
|
+
import { Fragment as Fragment43, jsx as jsx65, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
13445
13533
|
function LoadingSpinner({ className }) {
|
|
13446
|
-
return /* @__PURE__ */
|
|
13534
|
+
return /* @__PURE__ */ jsx65(
|
|
13447
13535
|
"span",
|
|
13448
13536
|
{
|
|
13449
13537
|
className: `pptx-loading__spinner${className ? ` ${className}` : ""}`,
|
|
@@ -13467,21 +13555,21 @@ function LoadingImpl({
|
|
|
13467
13555
|
const classes = ["pptx-editor", dark ? "dark" : "", "pptx-loading"];
|
|
13468
13556
|
if (overlay) classes.push("pptx-loading--overlay");
|
|
13469
13557
|
if (className) classes.push(className);
|
|
13470
|
-
return /* @__PURE__ */
|
|
13558
|
+
return /* @__PURE__ */ jsx65(
|
|
13471
13559
|
"div",
|
|
13472
13560
|
{
|
|
13473
13561
|
className: classes.filter(Boolean).join(" "),
|
|
13474
13562
|
style,
|
|
13475
13563
|
role: "status",
|
|
13476
13564
|
"aria-live": "polite",
|
|
13477
|
-
children: children ?? /* @__PURE__ */
|
|
13565
|
+
children: children ?? /* @__PURE__ */ jsx65(
|
|
13478
13566
|
"div",
|
|
13479
13567
|
{
|
|
13480
13568
|
className: "pptx-loading__sheet",
|
|
13481
13569
|
style: { width: sheet.width, aspectRatio: `${sheet.width} / ${sheet.height}` },
|
|
13482
|
-
children: indicator ?? /* @__PURE__ */
|
|
13483
|
-
/* @__PURE__ */
|
|
13484
|
-
/* @__PURE__ */
|
|
13570
|
+
children: indicator ?? /* @__PURE__ */ jsxs58(Fragment43, { children: [
|
|
13571
|
+
/* @__PURE__ */ jsx65(LoadingSpinner, {}),
|
|
13572
|
+
/* @__PURE__ */ jsx65("span", { className: "pptx-sr-only", children: t("app.loading") })
|
|
13485
13573
|
] })
|
|
13486
13574
|
}
|
|
13487
13575
|
)
|
|
@@ -13504,18 +13592,18 @@ import {
|
|
|
13504
13592
|
isValidElement as isValidElement9,
|
|
13505
13593
|
useEffect as useEffect42,
|
|
13506
13594
|
useId as useId23,
|
|
13507
|
-
useRef as
|
|
13508
|
-
useState as
|
|
13595
|
+
useRef as useRef52,
|
|
13596
|
+
useState as useState54
|
|
13509
13597
|
} from "react";
|
|
13510
13598
|
import {
|
|
13511
13599
|
arrangeRibbonTabs,
|
|
13512
13600
|
ribbonInsertTab,
|
|
13513
13601
|
ribbonShownTab,
|
|
13514
13602
|
ribbonTabs,
|
|
13515
|
-
translateKeyOrText as
|
|
13603
|
+
translateKeyOrText as translateKeyOrText22,
|
|
13516
13604
|
warnRibbonChild
|
|
13517
13605
|
} from "@pptx-editor.dev/core/editor";
|
|
13518
|
-
import { jsx as
|
|
13606
|
+
import { jsx as jsx66, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
13519
13607
|
function RibbonTab(_props) {
|
|
13520
13608
|
return null;
|
|
13521
13609
|
}
|
|
@@ -13539,10 +13627,10 @@ function Ribbon({
|
|
|
13539
13627
|
const { t } = useTranslation();
|
|
13540
13628
|
const baseId = useId23();
|
|
13541
13629
|
const layout = useEditorState(selectTabs, sameLayout);
|
|
13542
|
-
const [own, setOwn] =
|
|
13543
|
-
const names =
|
|
13544
|
-
const root =
|
|
13545
|
-
const focusInside =
|
|
13630
|
+
const [own, setOwn] = useState54(defaultTab);
|
|
13631
|
+
const names = useRef52(/* @__PURE__ */ new Map());
|
|
13632
|
+
const root = useRef52(null);
|
|
13633
|
+
const focusInside = useRef52(false);
|
|
13546
13634
|
const specs = /* @__PURE__ */ new Map();
|
|
13547
13635
|
for (const child of flatten5(children)) {
|
|
13548
13636
|
if (isValidElement9(child) && child.type === RibbonTab) {
|
|
@@ -13555,7 +13643,7 @@ function Ribbon({
|
|
|
13555
13643
|
layout,
|
|
13556
13644
|
specs,
|
|
13557
13645
|
preset,
|
|
13558
|
-
(key) =>
|
|
13646
|
+
(key) => translateKeyOrText22(t, key),
|
|
13559
13647
|
"Ribbon.Tab"
|
|
13560
13648
|
);
|
|
13561
13649
|
const wanted = tab ?? own;
|
|
@@ -13574,7 +13662,7 @@ function Ribbon({
|
|
|
13574
13662
|
onTabChange?.(id);
|
|
13575
13663
|
};
|
|
13576
13664
|
const insertions = useEditorState((s) => s.insertions);
|
|
13577
|
-
const seen =
|
|
13665
|
+
const seen = useRef52(insertions);
|
|
13578
13666
|
const insertTab = ribbonInsertTab(tabs);
|
|
13579
13667
|
useEffect42(() => {
|
|
13580
13668
|
if (insertions === seen.current) return;
|
|
@@ -13591,7 +13679,7 @@ function Ribbon({
|
|
|
13591
13679
|
};
|
|
13592
13680
|
const tabId2 = (id) => `${baseId}-tab-${id}`;
|
|
13593
13681
|
const panelId2 = `${baseId}-panel`;
|
|
13594
|
-
return /* @__PURE__ */
|
|
13682
|
+
return /* @__PURE__ */ jsxs59(
|
|
13595
13683
|
"div",
|
|
13596
13684
|
{
|
|
13597
13685
|
ref: root,
|
|
@@ -13604,9 +13692,9 @@ function Ribbon({
|
|
|
13604
13692
|
if (next && !e.currentTarget.contains(next)) focusInside.current = false;
|
|
13605
13693
|
},
|
|
13606
13694
|
children: [
|
|
13607
|
-
/* @__PURE__ */
|
|
13608
|
-
quickAccess ? /* @__PURE__ */
|
|
13609
|
-
/* @__PURE__ */
|
|
13695
|
+
/* @__PURE__ */ jsxs59("div", { className: "pptx-ribbon__bar", children: [
|
|
13696
|
+
quickAccess ? /* @__PURE__ */ jsx66("div", { className: "pptx-ribbon__qat", children: /* @__PURE__ */ jsx66(PresetBar, { groups: quickAccess.groups, label: quickAccess.title, overflow: false, children: quickAccess.override?.children }) }) : null,
|
|
13697
|
+
/* @__PURE__ */ jsx66(
|
|
13610
13698
|
"div",
|
|
13611
13699
|
{
|
|
13612
13700
|
role: "tablist",
|
|
@@ -13615,7 +13703,7 @@ function Ribbon({
|
|
|
13615
13703
|
onKeyDown: onTabKey,
|
|
13616
13704
|
children: tabs.map((d) => {
|
|
13617
13705
|
const selected = d.id === current?.id;
|
|
13618
|
-
return /* @__PURE__ */
|
|
13706
|
+
return /* @__PURE__ */ jsx66(
|
|
13619
13707
|
"button",
|
|
13620
13708
|
{
|
|
13621
13709
|
ref: (el) => {
|
|
@@ -13641,7 +13729,7 @@ function Ribbon({
|
|
|
13641
13729
|
}
|
|
13642
13730
|
)
|
|
13643
13731
|
] }),
|
|
13644
|
-
current ? /* @__PURE__ */
|
|
13732
|
+
current ? /* @__PURE__ */ jsx66(
|
|
13645
13733
|
"div",
|
|
13646
13734
|
{
|
|
13647
13735
|
role: "tabpanel",
|
|
@@ -13649,7 +13737,7 @@ function Ribbon({
|
|
|
13649
13737
|
"aria-labelledby": tabId2(current.id),
|
|
13650
13738
|
className: ["pptx-ribbon__panel", current.override?.className].filter(Boolean).join(" "),
|
|
13651
13739
|
"data-tab": current.id,
|
|
13652
|
-
children: /* @__PURE__ */
|
|
13740
|
+
children: /* @__PURE__ */ jsx66(
|
|
13653
13741
|
PresetBar,
|
|
13654
13742
|
{
|
|
13655
13743
|
groups: current.groups,
|
|
@@ -13669,7 +13757,7 @@ function Ribbon({
|
|
|
13669
13757
|
// src/StatusBar.tsx
|
|
13670
13758
|
import { Children as Children10, Fragment as Fragment45, isValidElement as isValidElement10 } from "react";
|
|
13671
13759
|
import { slideStatus, warnAsChildChild as warnAsChildChild4 } from "@pptx-editor.dev/core/editor";
|
|
13672
|
-
import { Fragment as Fragment46, jsx as
|
|
13760
|
+
import { Fragment as Fragment46, jsx as jsx67, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
13673
13761
|
function StatusBarSlideNumber({ className, hidden }) {
|
|
13674
13762
|
const { t } = useTranslation();
|
|
13675
13763
|
const status = useEditorState(
|
|
@@ -13677,7 +13765,7 @@ function StatusBarSlideNumber({ className, hidden }) {
|
|
|
13677
13765
|
(a, b) => a?.current === b?.current && a?.total === b?.total
|
|
13678
13766
|
);
|
|
13679
13767
|
if (hidden) return null;
|
|
13680
|
-
return /* @__PURE__ */
|
|
13768
|
+
return /* @__PURE__ */ jsx67(
|
|
13681
13769
|
"span",
|
|
13682
13770
|
{
|
|
13683
13771
|
className: ["pptx-statusbar__slide", className].filter(Boolean).join(" "),
|
|
@@ -13701,11 +13789,11 @@ function StatusBarNotes({
|
|
|
13701
13789
|
const only = asChild ? Children10.toArray(children) : [];
|
|
13702
13790
|
const host = only.length === 1 && isValidElement10(only[0]);
|
|
13703
13791
|
if (asChild && !host) warnAsChildChild4("notes", NOTES_PART);
|
|
13704
|
-
return /* @__PURE__ */
|
|
13792
|
+
return /* @__PURE__ */ jsx67("span", { className: "pptx-statusbar__notes-part", "data-part": "notes", children: /* @__PURE__ */ jsx67(
|
|
13705
13793
|
ToolbarAction,
|
|
13706
13794
|
{
|
|
13707
13795
|
label: t("statusBar.notes"),
|
|
13708
|
-
icon: host ? void 0 : icon ?? /* @__PURE__ */
|
|
13796
|
+
icon: host ? void 0 : icon ?? /* @__PURE__ */ jsx67(Icon, { name: "edit_note" }),
|
|
13709
13797
|
className: ["pptx-statusbar__notes", className].filter(Boolean).join(" "),
|
|
13710
13798
|
active: notes.open,
|
|
13711
13799
|
onSelect: notes.toggle,
|
|
@@ -13716,23 +13804,23 @@ function StatusBarNotes({
|
|
|
13716
13804
|
}
|
|
13717
13805
|
function StatusBarViews({ className, hidden }) {
|
|
13718
13806
|
if (hidden) return null;
|
|
13719
|
-
return /* @__PURE__ */
|
|
13807
|
+
return /* @__PURE__ */ jsx67(
|
|
13720
13808
|
"span",
|
|
13721
13809
|
{
|
|
13722
13810
|
className: ["pptx-statusbar__views", className].filter(Boolean).join(" "),
|
|
13723
13811
|
"data-part": "views",
|
|
13724
|
-
children: /* @__PURE__ */
|
|
13812
|
+
children: /* @__PURE__ */ jsx67(ViewSwitch, {})
|
|
13725
13813
|
}
|
|
13726
13814
|
);
|
|
13727
13815
|
}
|
|
13728
13816
|
function StatusBarZoom({ className, hidden }) {
|
|
13729
13817
|
if (hidden) return null;
|
|
13730
|
-
return /* @__PURE__ */
|
|
13818
|
+
return /* @__PURE__ */ jsx67(
|
|
13731
13819
|
"span",
|
|
13732
13820
|
{
|
|
13733
13821
|
className: ["pptx-statusbar__zoom", className].filter(Boolean).join(" "),
|
|
13734
13822
|
"data-part": "zoom",
|
|
13735
|
-
children: /* @__PURE__ */
|
|
13823
|
+
children: /* @__PURE__ */ jsx67(ZoomPill, {})
|
|
13736
13824
|
}
|
|
13737
13825
|
);
|
|
13738
13826
|
}
|
|
@@ -13742,7 +13830,7 @@ var flatten6 = (nodes) => Children10.toArray(nodes).flatMap(
|
|
|
13742
13830
|
);
|
|
13743
13831
|
function StatusBar({ className, preset = true, children }) {
|
|
13744
13832
|
const { t } = useTranslation();
|
|
13745
|
-
const bar = (content) => /* @__PURE__ */
|
|
13833
|
+
const bar = (content) => /* @__PURE__ */ jsx67(
|
|
13746
13834
|
"div",
|
|
13747
13835
|
{
|
|
13748
13836
|
role: "group",
|
|
@@ -13754,9 +13842,9 @@ function StatusBar({ className, preset = true, children }) {
|
|
|
13754
13842
|
);
|
|
13755
13843
|
if (!preset)
|
|
13756
13844
|
return bar(
|
|
13757
|
-
/* @__PURE__ */
|
|
13845
|
+
/* @__PURE__ */ jsxs60(Fragment46, { children: [
|
|
13758
13846
|
children,
|
|
13759
|
-
/* @__PURE__ */
|
|
13847
|
+
/* @__PURE__ */ jsx67(ReadOnlyBadge, {})
|
|
13760
13848
|
] })
|
|
13761
13849
|
);
|
|
13762
13850
|
const overrides = /* @__PURE__ */ new Map();
|
|
@@ -13766,12 +13854,12 @@ function StatusBar({ className, preset = true, children }) {
|
|
|
13766
13854
|
overrides.set(child.type, child);
|
|
13767
13855
|
else extras.push(child);
|
|
13768
13856
|
}
|
|
13769
|
-
const part = (Part) => overrides.get(Part) ?? /* @__PURE__ */
|
|
13857
|
+
const part = (Part) => overrides.get(Part) ?? /* @__PURE__ */ jsx67(Part, {});
|
|
13770
13858
|
return bar(
|
|
13771
|
-
/* @__PURE__ */
|
|
13859
|
+
/* @__PURE__ */ jsxs60(Fragment46, { children: [
|
|
13772
13860
|
part(StatusBarSlideNumber),
|
|
13773
|
-
/* @__PURE__ */
|
|
13774
|
-
/* @__PURE__ */
|
|
13861
|
+
/* @__PURE__ */ jsx67(ReadOnlyBadge, {}),
|
|
13862
|
+
/* @__PURE__ */ jsx67("span", { className: "pptx-statusbar__spacer" }),
|
|
13775
13863
|
part(StatusBarNotes),
|
|
13776
13864
|
extras,
|
|
13777
13865
|
part(StatusBarViews),
|
|
@@ -13783,11 +13871,11 @@ function StatusBar({ className, preset = true, children }) {
|
|
|
13783
13871
|
// src/HyperlinkPopup.tsx
|
|
13784
13872
|
import { useContext as useContext20, useEffect as useEffect43, useId as useId24, useMemo as useMemo20, useSyncExternalStore as useSyncExternalStore12 } from "react";
|
|
13785
13873
|
import { hyperlinkPopupFromRequest } from "@pptx-editor.dev/core/editor";
|
|
13786
|
-
import { jsx as
|
|
13874
|
+
import { jsx as jsx68 } from "react/jsx-runtime";
|
|
13787
13875
|
function HyperlinkPopup(props) {
|
|
13788
13876
|
const shared = useContext20(HyperlinkPopupContext);
|
|
13789
|
-
const panel = /* @__PURE__ */
|
|
13790
|
-
return shared ? panel : /* @__PURE__ */
|
|
13877
|
+
const panel = /* @__PURE__ */ jsx68(HyperLink, { ...props.className ? { className: props.className } : {} });
|
|
13878
|
+
return shared ? panel : /* @__PURE__ */ jsx68(OwnState, { ...props, children: panel });
|
|
13791
13879
|
}
|
|
13792
13880
|
function OwnState({ children, ...props }) {
|
|
13793
13881
|
const editor = usePptxEditor();
|
|
@@ -13804,11 +13892,11 @@ function OwnState({ children, ...props }) {
|
|
|
13804
13892
|
controller.getState,
|
|
13805
13893
|
controller.getState
|
|
13806
13894
|
);
|
|
13807
|
-
return /* @__PURE__ */
|
|
13895
|
+
return /* @__PURE__ */ jsx68(HyperlinkPopupContext.Provider, { value: { controller, state, errorId }, children });
|
|
13808
13896
|
}
|
|
13809
13897
|
|
|
13810
13898
|
// src/customization-hooks.ts
|
|
13811
|
-
import { useCallback as
|
|
13899
|
+
import { useCallback as useCallback17, useContext as useContext21, useEffect as useEffect44, useMemo as useMemo21, useRef as useRef53, useState as useState55 } from "react";
|
|
13812
13900
|
import {
|
|
13813
13901
|
ZOOM_LEVELS,
|
|
13814
13902
|
onEditorEvent,
|
|
@@ -13820,7 +13908,7 @@ var sameZoom = (a, b) => a.zoom === b.zoom && a.fit === b.fit;
|
|
|
13820
13908
|
function useZoom() {
|
|
13821
13909
|
const editor = usePptxEditor();
|
|
13822
13910
|
const { zoom, fit } = useEditorState(selectZoom, sameZoom);
|
|
13823
|
-
const setZoom =
|
|
13911
|
+
const setZoom = useCallback17((next) => editor?.setZoom(next), [editor]);
|
|
13824
13912
|
return useMemo21(() => {
|
|
13825
13913
|
const next = zoomStep2(zoom, 1);
|
|
13826
13914
|
const previous = zoomStep2(zoom, -1);
|
|
@@ -13840,7 +13928,7 @@ function useZoom() {
|
|
|
13840
13928
|
}
|
|
13841
13929
|
function useEditorEvent(event, handler) {
|
|
13842
13930
|
const editor = usePptxEditor();
|
|
13843
|
-
const handlerRef =
|
|
13931
|
+
const handlerRef = useRef53(handler);
|
|
13844
13932
|
handlerRef.current = handler;
|
|
13845
13933
|
useEffect44(() => {
|
|
13846
13934
|
if (!editor) return void 0;
|
|
@@ -13849,7 +13937,7 @@ function useEditorEvent(event, handler) {
|
|
|
13849
13937
|
}, [editor, event]);
|
|
13850
13938
|
}
|
|
13851
13939
|
function useEditorSnapshot(editor) {
|
|
13852
|
-
const [revision, setRevision] =
|
|
13940
|
+
const [revision, setRevision] = useState55(0);
|
|
13853
13941
|
useEffect44(() => {
|
|
13854
13942
|
if (!editor) return void 0;
|
|
13855
13943
|
const bump = () => setRevision((n) => n + 1);
|
|
@@ -13867,7 +13955,7 @@ function useScopeClassName() {
|
|
|
13867
13955
|
}
|
|
13868
13956
|
|
|
13869
13957
|
// src/usePptxSource.ts
|
|
13870
|
-
import { useCallback as
|
|
13958
|
+
import { useCallback as useCallback18, useEffect as useEffect45, useMemo as useMemo22, useRef as useRef54, useState as useState56, useSyncExternalStore as useSyncExternalStore13 } from "react";
|
|
13871
13959
|
import {
|
|
13872
13960
|
editorHostDocument,
|
|
13873
13961
|
fetchPptxSource,
|
|
@@ -13879,13 +13967,13 @@ import {
|
|
|
13879
13967
|
watchEagerPptxFonts
|
|
13880
13968
|
} from "@pptx-editor.dev/core/editor";
|
|
13881
13969
|
function usePptxSource(source, options = {}) {
|
|
13882
|
-
const [bytes, setBytes] =
|
|
13883
|
-
const [fonts, setFonts] =
|
|
13884
|
-
const [error, setError] =
|
|
13885
|
-
const [documentLoading, setDocumentLoading] =
|
|
13970
|
+
const [bytes, setBytes] = useState56(void 0);
|
|
13971
|
+
const [fonts, setFonts] = useState56(void 0);
|
|
13972
|
+
const [error, setError] = useState56(null);
|
|
13973
|
+
const [documentLoading, setDocumentLoading] = useState56(source != null);
|
|
13886
13974
|
const shape = pptxFontsShape(options.fonts);
|
|
13887
|
-
const [fontsSettled, setFontsSettled] =
|
|
13888
|
-
const latest =
|
|
13975
|
+
const [fontsSettled, setFontsSettled] = useState56(options.fonts === void 0);
|
|
13976
|
+
const latest = useRef54(options);
|
|
13889
13977
|
latest.current = options;
|
|
13890
13978
|
const resolver = useMemo22(
|
|
13891
13979
|
() => pptxSourceFontsResolver(() => latest.current.fonts),
|
|
@@ -13955,11 +14043,11 @@ var NOOP_UNSUBSCRIBE = () => {
|
|
|
13955
14043
|
};
|
|
13956
14044
|
function useEditorHostDocument() {
|
|
13957
14045
|
const editor = usePptxEditor();
|
|
13958
|
-
const subscribe =
|
|
14046
|
+
const subscribe = useCallback18(
|
|
13959
14047
|
(onChange) => editor ? onEditorHostChange(editor, onChange) : NOOP_UNSUBSCRIBE,
|
|
13960
14048
|
[editor]
|
|
13961
14049
|
);
|
|
13962
|
-
const read =
|
|
14050
|
+
const read = useCallback18(
|
|
13963
14051
|
() => editor ? editorHostDocument(editor) : typeof globalThis.document === "undefined" ? null : globalThis.document,
|
|
13964
14052
|
[editor]
|
|
13965
14053
|
);
|
|
@@ -13970,7 +14058,7 @@ function useEditorHostDocument() {
|
|
|
13970
14058
|
import { gradientCss as gradientCss3 } from "@pptx-editor.dev/core/editor";
|
|
13971
14059
|
|
|
13972
14060
|
// src/useParagraphFormat.ts
|
|
13973
|
-
import { useCallback as
|
|
14061
|
+
import { useCallback as useCallback19 } from "react";
|
|
13974
14062
|
import {
|
|
13975
14063
|
chromeCommandState,
|
|
13976
14064
|
sameParagraphFormat
|
|
@@ -13979,7 +14067,7 @@ function useParagraphFormat() {
|
|
|
13979
14067
|
const editor = usePptxEditor();
|
|
13980
14068
|
const format = useEditorState((s) => s.format?.paragraph ?? null, sameParagraphFormat);
|
|
13981
14069
|
const isEnabled = useEditorState(() => chromeCommandState(editor, "paragraph.dialog").isEnabled);
|
|
13982
|
-
const apply =
|
|
14070
|
+
const apply = useCallback19(
|
|
13983
14071
|
(update) => editor !== null && editor.exec({ ...update, type: "setParagraphFormat" }).ok,
|
|
13984
14072
|
[editor]
|
|
13985
14073
|
);
|
|
@@ -13987,7 +14075,7 @@ function useParagraphFormat() {
|
|
|
13987
14075
|
}
|
|
13988
14076
|
|
|
13989
14077
|
// src/useFontFormat.ts
|
|
13990
|
-
import { useCallback as
|
|
14078
|
+
import { useCallback as useCallback20 } from "react";
|
|
13991
14079
|
import {
|
|
13992
14080
|
chromeCommandState as chromeCommandState2,
|
|
13993
14081
|
sameFontFormat
|
|
@@ -13996,7 +14084,7 @@ function useFontFormat() {
|
|
|
13996
14084
|
const editor = usePptxEditor();
|
|
13997
14085
|
const format = useEditorState((s) => s.format?.font ?? null, sameFontFormat);
|
|
13998
14086
|
const isEnabled = useEditorState(() => chromeCommandState2(editor, "text.dialog").isEnabled);
|
|
13999
|
-
const apply =
|
|
14087
|
+
const apply = useCallback20(
|
|
14000
14088
|
(update) => editor !== null && editor.exec({ ...update, type: "setFontFormat" }).ok,
|
|
14001
14089
|
[editor]
|
|
14002
14090
|
);
|
|
@@ -14004,7 +14092,7 @@ function useFontFormat() {
|
|
|
14004
14092
|
}
|
|
14005
14093
|
|
|
14006
14094
|
// src/useBulletFormat.ts
|
|
14007
|
-
import { useCallback as
|
|
14095
|
+
import { useCallback as useCallback21 } from "react";
|
|
14008
14096
|
import {
|
|
14009
14097
|
sameBulletFormat
|
|
14010
14098
|
} from "@pptx-editor.dev/core/editor";
|
|
@@ -14012,7 +14100,7 @@ function useBulletFormat() {
|
|
|
14012
14100
|
const editor = usePptxEditor();
|
|
14013
14101
|
const format = useEditorState((s) => s.format?.bulletFormat, sameBulletFormat);
|
|
14014
14102
|
const { isEnabled } = useEditorCommand("list.bulletStyle");
|
|
14015
|
-
const apply =
|
|
14103
|
+
const apply = useCallback21(
|
|
14016
14104
|
(next) => editor !== null && editor.exec({ type: "setBulletFormat", format: next }).ok,
|
|
14017
14105
|
[editor]
|
|
14018
14106
|
);
|
|
@@ -14020,21 +14108,21 @@ function useBulletFormat() {
|
|
|
14020
14108
|
}
|
|
14021
14109
|
|
|
14022
14110
|
// src/useReviewAuthors.ts
|
|
14023
|
-
import { useCallback as
|
|
14111
|
+
import { useCallback as useCallback22 } from "react";
|
|
14024
14112
|
var NONE = Object.freeze([]);
|
|
14025
14113
|
function useReviewAuthors() {
|
|
14026
14114
|
const editor = usePptxEditor();
|
|
14027
|
-
return useEditorState(
|
|
14115
|
+
return useEditorState(useCallback22(() => editor?.getReviewAuthors() ?? NONE, [editor]));
|
|
14028
14116
|
}
|
|
14029
14117
|
|
|
14030
14118
|
// src/useFonts.ts
|
|
14031
|
-
import { useMemo as useMemo23, useRef as
|
|
14119
|
+
import { useMemo as useMemo23, useRef as useRef55 } from "react";
|
|
14032
14120
|
import {
|
|
14033
14121
|
composeFontOrigins,
|
|
14034
14122
|
defineFontResolver
|
|
14035
14123
|
} from "@pptx-editor.dev/core/editor";
|
|
14036
14124
|
function useFonts(...origins) {
|
|
14037
|
-
const latest =
|
|
14125
|
+
const latest = useRef55(origins);
|
|
14038
14126
|
latest.current = origins;
|
|
14039
14127
|
return useMemo23(
|
|
14040
14128
|
() => defineFontResolver(
|
|
@@ -14050,7 +14138,7 @@ function useFonts(...origins) {
|
|
|
14050
14138
|
}
|
|
14051
14139
|
|
|
14052
14140
|
// src/useFontFamily.ts
|
|
14053
|
-
import { useCallback as
|
|
14141
|
+
import { useCallback as useCallback23, useMemo as useMemo24 } from "react";
|
|
14054
14142
|
import {
|
|
14055
14143
|
fontPickerGroups as fontPickerGroups2,
|
|
14056
14144
|
isCurrentFontRow as isCurrentFontRow2
|
|
@@ -14073,8 +14161,8 @@ function useFontFamily() {
|
|
|
14073
14161
|
[editor, slide, revision]
|
|
14074
14162
|
);
|
|
14075
14163
|
const { execute } = cmd;
|
|
14076
|
-
const setValue =
|
|
14077
|
-
const isCurrent =
|
|
14164
|
+
const setValue = useCallback23((family) => void execute(family), [execute]);
|
|
14165
|
+
const isCurrent = useCallback23(
|
|
14078
14166
|
(row) => !row.disabled && isCurrentFontRow2(row, value, theme),
|
|
14079
14167
|
[value, theme]
|
|
14080
14168
|
);
|