@hussmartinez/image-sdk 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/assets/image/render.worker.js +1 -1
- package/dist/element.d.ts +25 -0
- package/dist/element.js +2 -2
- package/dist/index.d.ts +25 -0
- package/dist/index.js +1 -1
- package/dist/lazy/{inline-worker-BVCwAPZU.js → inline-worker-Cvw0Gpxf.js} +2 -2
- package/dist/lazy/{inline-worker-BVCwAPZU.js.map → inline-worker-Cvw0Gpxf.js.map} +1 -1
- package/dist/react.d.ts +78 -0
- package/dist/react.js +1 -1
- package/dist/shared/{core-cKo2m54U.js → core-CAX3GOaj.js} +27 -3
- package/dist/shared/{core-cKo2m54U.js.map → core-CAX3GOaj.js.map} +1 -1
- package/dist/shared/{editor-Dv5EU2YJ.js → editor-DziYqEP3.js} +189 -58
- package/dist/shared/editor-DziYqEP3.js.map +1 -0
- package/dist/styles.css +90 -3
- package/package.json +8 -7
- package/dist/shared/editor-Dv5EU2YJ.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as createImageReducer, F as DEVELOP_ADJUSTMENTS, G as placement, I as FILTER_PRESETS, K as createImageProcessor, M as MAX_METADATA_LENGTH, P as longerThan, V as createImageRenderer, _ as outputSize, a as compositionDeltaToSource, c as fitAspect, d as nudgeCropOnScreen, f as wholeCrop, i as aspectRatio, l as handleInSource, n as createImageSession, o as cropInComposition, p as compositionSize, q as createImageEngine, r as ASPECT_PRESETS, s as dragHandle, t as imageMessages, tt as isImageError, u as moveCrop } from "./core-
|
|
1
|
+
import { D as createImageReducer, F as DEVELOP_ADJUSTMENTS, G as placement, I as FILTER_PRESETS, K as createImageProcessor, M as MAX_METADATA_LENGTH, P as longerThan, V as createImageRenderer, _ as outputSize, a as compositionDeltaToSource, c as fitAspect, d as nudgeCropOnScreen, f as wholeCrop, i as aspectRatio, l as handleInSource, n as createImageSession, o as cropInComposition, p as compositionSize, q as createImageEngine, r as ASPECT_PRESETS, s as dragHandle, t as imageMessages, tt as isImageError, u as moveCrop } from "./core-CAX3GOaj.js";
|
|
2
2
|
import { applyCommands, createMessages, createShortcutRegistry, createStore, createToolRegistry, defineTool } from "@hussmartinez/sdk-core";
|
|
3
|
-
import { AnnouncerProvider, Button, CropIcon, Dialog, DownloadIcon, Field, FileDropZone, FitIcon, FlipHorizontalIcon, FlipVerticalIcon, IconButton, NumberField, OpenIcon, ProgressBar, RedoIcon, RotateLeftIcon, RotateRightIcon, SearchIcon, SegmentedControl, Slider, Spinner, TextField, Toolbar, ToolbarGroup, UiMessagesProvider, UndoIcon, ZoomInIcon, ZoomOutIcon, useAnnounce, usePlatform } from "@hussmartinez/ui/react";
|
|
3
|
+
import { AnnouncerProvider, Button, CloseIcon, CropIcon, Dialog, DownloadIcon, Field, FileDropZone, FitIcon, FlipHorizontalIcon, FlipVerticalIcon, IconButton, NumberField, OpenIcon, ProgressBar, RedoIcon, RotateLeftIcon, RotateRightIcon, SearchIcon, SegmentedControl, Slider, Spinner, TextField, Toolbar, ToolbarGroup, UiMessagesProvider, UndoIcon, ZoomInIcon, ZoomOutIcon, useAnnounce, usePlatform } from "@hussmartinez/ui/react";
|
|
4
4
|
import { createContext, forwardRef, useContext, useEffect, useId, useImperativeHandle, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
// src/features/tool-types.ts
|
|
@@ -419,13 +419,13 @@ var EXTENSIONS = {
|
|
|
419
419
|
jpeg: "jpg",
|
|
420
420
|
webp: "webp"
|
|
421
421
|
};
|
|
422
|
-
var FIELDS = [
|
|
422
|
+
var FIELDS$1 = [
|
|
423
423
|
"title",
|
|
424
424
|
"description",
|
|
425
425
|
"artist",
|
|
426
426
|
"copyright"
|
|
427
427
|
];
|
|
428
|
-
var KINDS = [
|
|
428
|
+
var KINDS$1 = [
|
|
429
429
|
"location",
|
|
430
430
|
"camera",
|
|
431
431
|
"timestamps",
|
|
@@ -450,7 +450,7 @@ function changes(plan, draft) {
|
|
|
450
450
|
type: "image.setOutput",
|
|
451
451
|
output: draft.output
|
|
452
452
|
});
|
|
453
|
-
for (const field of FIELDS) if (plan.metadata[field] !== draft.metadata[field]) commands.push({
|
|
453
|
+
for (const field of FIELDS$1) if (plan.metadata[field] !== draft.metadata[field]) commands.push({
|
|
454
454
|
type: "image.setMetadata",
|
|
455
455
|
field,
|
|
456
456
|
value: draft.metadata[field]
|
|
@@ -583,8 +583,8 @@ function ImageExportDialog(props) {
|
|
|
583
583
|
};
|
|
584
584
|
const composition = compositionSize(plan, source);
|
|
585
585
|
const size = outputSize(current.output, composition);
|
|
586
|
-
const removed = KINDS.filter((kind) => source.metadata[kind]);
|
|
587
|
-
const kept = FIELDS.filter((field) => current.metadata[field] !== "");
|
|
586
|
+
const removed = KINDS$1.filter((kind) => source.metadata[kind]);
|
|
587
|
+
const kept = FIELDS$1.filter((field) => current.metadata[field] !== "");
|
|
588
588
|
const exporting = phase.kind === "exporting";
|
|
589
589
|
const footer = phase.kind === "done" ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Button, {
|
|
590
590
|
variant: "secondary",
|
|
@@ -643,13 +643,22 @@ function ImageExportDialog(props) {
|
|
|
643
643
|
current.format === "png" ? null : /* @__PURE__ */ jsx(Field, {
|
|
644
644
|
label: messages.t("export.quality"),
|
|
645
645
|
className: "hm-image-slider-field",
|
|
646
|
-
children: /* @__PURE__ */
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
646
|
+
children: (control) => /* @__PURE__ */ jsxs("div", {
|
|
647
|
+
className: "hm-image-adjust-row",
|
|
648
|
+
children: [/* @__PURE__ */ jsx(Slider, {
|
|
649
|
+
...control,
|
|
650
|
+
min: 1,
|
|
651
|
+
max: 100,
|
|
652
|
+
step: 1,
|
|
653
|
+
largeStep: 10,
|
|
654
|
+
value: current.quality,
|
|
655
|
+
formatValue: (quality) => messages.t("export.qualityValue", { quality }),
|
|
656
|
+
onValueChange: (quality) => update({ quality: Math.round(quality) })
|
|
657
|
+
}), /* @__PURE__ */ jsx("output", {
|
|
658
|
+
className: "hm-image-adjust-value",
|
|
659
|
+
"aria-hidden": "true",
|
|
660
|
+
children: messages.t("export.qualityValue", { quality: current.quality })
|
|
661
|
+
})]
|
|
653
662
|
})
|
|
654
663
|
}),
|
|
655
664
|
/* @__PURE__ */ jsx(SegmentedControl, {
|
|
@@ -714,7 +723,7 @@ function ImageExportDialog(props) {
|
|
|
714
723
|
}),
|
|
715
724
|
/* @__PURE__ */ jsx("div", {
|
|
716
725
|
className: "hm-image-export-fields",
|
|
717
|
-
children: FIELDS.map((field) => /* @__PURE__ */ jsx(Field, {
|
|
726
|
+
children: FIELDS$1.map((field) => /* @__PURE__ */ jsx(Field, {
|
|
718
727
|
label: messages.t(`export.field.${field}`),
|
|
719
728
|
children: /* @__PURE__ */ jsx(TextField, {
|
|
720
729
|
autoComplete: "off",
|
|
@@ -925,7 +934,19 @@ function ImageAdjustPanel(props) {
|
|
|
925
934
|
return /* @__PURE__ */ jsxs("section", {
|
|
926
935
|
className: ["hm-image-adjust-panel", props.className].filter(Boolean).join(" "),
|
|
927
936
|
"aria-label": messages.t("develop.panel"),
|
|
928
|
-
children: [
|
|
937
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
938
|
+
className: "hm-image-adjust-actions",
|
|
939
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
940
|
+
variant: "secondary",
|
|
941
|
+
disabled: changed.length === 0,
|
|
942
|
+
onClick: () => {
|
|
943
|
+
reset(Object.fromEntries(changed.map((name) => [name, 0])));
|
|
944
|
+
first.current?.focus();
|
|
945
|
+
announce(messages.t("develop.wasReset"));
|
|
946
|
+
},
|
|
947
|
+
children: messages.t("develop.resetAll")
|
|
948
|
+
})
|
|
949
|
+
}), DEVELOP_ADJUSTMENTS.map((name, index) => {
|
|
929
950
|
const label = messages.t(`develop.${name}`);
|
|
930
951
|
return /* @__PURE__ */ jsx(Field, {
|
|
931
952
|
label,
|
|
@@ -964,15 +985,6 @@ function ImageAdjustPanel(props) {
|
|
|
964
985
|
]
|
|
965
986
|
})
|
|
966
987
|
}, name);
|
|
967
|
-
}), /* @__PURE__ */ jsx(Button, {
|
|
968
|
-
variant: "secondary",
|
|
969
|
-
disabled: changed.length === 0,
|
|
970
|
-
onClick: () => {
|
|
971
|
-
reset(Object.fromEntries(changed.map((name) => [name, 0])));
|
|
972
|
-
first.current?.focus();
|
|
973
|
-
announce(messages.t("develop.wasReset"));
|
|
974
|
-
},
|
|
975
|
-
children: messages.t("develop.resetAll")
|
|
976
988
|
})]
|
|
977
989
|
});
|
|
978
990
|
}
|
|
@@ -1029,27 +1041,83 @@ function ImageFilterPanel(props) {
|
|
|
1029
1041
|
}) : null]
|
|
1030
1042
|
});
|
|
1031
1043
|
}
|
|
1044
|
+
// src/react/panels/InfoPanel.tsx
|
|
1045
|
+
var KINDS = [
|
|
1046
|
+
"location",
|
|
1047
|
+
"camera",
|
|
1048
|
+
"timestamps",
|
|
1049
|
+
"thumbnail",
|
|
1050
|
+
"colourProfile",
|
|
1051
|
+
"other"
|
|
1052
|
+
];
|
|
1053
|
+
var FIELDS = [
|
|
1054
|
+
"title",
|
|
1055
|
+
"description",
|
|
1056
|
+
"artist",
|
|
1057
|
+
"copyright"
|
|
1058
|
+
];
|
|
1059
|
+
function ImageInfoPanel(props) {
|
|
1060
|
+
const { plan, source } = useImageDocument();
|
|
1061
|
+
const messages = useImageMessages();
|
|
1062
|
+
if (!plan || !source) return null;
|
|
1063
|
+
const carried = KINDS.filter((kind) => source.metadata[kind]);
|
|
1064
|
+
const kept = FIELDS.filter((field) => plan.metadata[field] !== "");
|
|
1065
|
+
return /* @__PURE__ */ jsx("section", {
|
|
1066
|
+
className: ["hm-image-info-panel", props.className].filter(Boolean).join(" "),
|
|
1067
|
+
"aria-label": messages.t("info.panel"),
|
|
1068
|
+
children: /* @__PURE__ */ jsxs("dl", {
|
|
1069
|
+
className: "hm-image-info-list",
|
|
1070
|
+
children: [
|
|
1071
|
+
/* @__PURE__ */ jsx("dt", { children: messages.t("info.size") }),
|
|
1072
|
+
/* @__PURE__ */ jsx("dd", { children: messages.t("info.sizeValue", {
|
|
1073
|
+
width: source.width,
|
|
1074
|
+
height: source.height
|
|
1075
|
+
}) }),
|
|
1076
|
+
/* @__PURE__ */ jsx("dt", { children: messages.t("info.format") }),
|
|
1077
|
+
/* @__PURE__ */ jsx("dd", { children: messages.t(`info.formats.${source.format}`) }),
|
|
1078
|
+
source.frames > 1 ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("dt", { children: messages.t("info.frames") }), /* @__PURE__ */ jsx("dd", { children: source.frames })] }) : null,
|
|
1079
|
+
/* @__PURE__ */ jsx("dt", { children: messages.t("info.fileSize") }),
|
|
1080
|
+
/* @__PURE__ */ jsx("dd", { children: messages.t("info.fileSizeValue", { size: source.fileSize }) }),
|
|
1081
|
+
/* @__PURE__ */ jsx("dt", { children: messages.t("info.metadata") }),
|
|
1082
|
+
/* @__PURE__ */ jsx("dd", { children: carried.length > 0 ? /* @__PURE__ */ jsx("ul", { children: carried.map((kind) => /* @__PURE__ */ jsx("li", { children: messages.t(`export.kind.${kind}`) }, kind)) }) : messages.t("info.metadataNone") }),
|
|
1083
|
+
/* @__PURE__ */ jsx("dt", { children: messages.t("info.kept") }),
|
|
1084
|
+
/* @__PURE__ */ jsx("dd", { children: kept.length > 0 ? /* @__PURE__ */ jsx("ul", { children: kept.map((field) => /* @__PURE__ */ jsx("li", { children: messages.t(`export.field.${field}`) }, field)) }) : messages.t("info.keptNone") })
|
|
1085
|
+
]
|
|
1086
|
+
})
|
|
1087
|
+
});
|
|
1088
|
+
}
|
|
1032
1089
|
// src/react/panels/Inspector.tsx
|
|
1033
|
-
|
|
1090
|
+
var PANELS = [
|
|
1091
|
+
"adjust",
|
|
1092
|
+
"filters",
|
|
1093
|
+
"info"
|
|
1094
|
+
];
|
|
1095
|
+
function ImageInspector(props) {
|
|
1034
1096
|
const { plan } = useImageDocument();
|
|
1035
1097
|
const [editor] = useImageEditorState();
|
|
1036
1098
|
const messages = useImageMessages();
|
|
1037
|
-
const [
|
|
1099
|
+
const [chosen, setPanel] = useState("adjust");
|
|
1038
1100
|
if (editor.tool === "crop") return /* @__PURE__ */ jsx(ImageCropPanel, {});
|
|
1039
1101
|
if (!plan) return null;
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
label: messages.t("inspector.
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1102
|
+
const panels = PANELS.filter((name) => props.features?.[name] !== false);
|
|
1103
|
+
const first = panels[0];
|
|
1104
|
+
if (first === void 0) return null;
|
|
1105
|
+
const panel = panels.includes(chosen) ? chosen : first;
|
|
1106
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1107
|
+
panels.length > 1 ? /* @__PURE__ */ jsx(SegmentedControl, {
|
|
1108
|
+
label: messages.t("inspector.label"),
|
|
1109
|
+
value: panel,
|
|
1110
|
+
size: "small",
|
|
1111
|
+
options: panels.map((name) => ({
|
|
1112
|
+
value: name,
|
|
1113
|
+
label: messages.t(`inspector.${name}`)
|
|
1114
|
+
})),
|
|
1115
|
+
onValueChange: (value) => setPanel(value)
|
|
1116
|
+
}) : null,
|
|
1117
|
+
panel === "adjust" ? /* @__PURE__ */ jsx(ImageAdjustPanel, {}) : null,
|
|
1118
|
+
panel === "filters" ? /* @__PURE__ */ jsx(ImageFilterPanel, {}) : null,
|
|
1119
|
+
panel === "info" ? /* @__PURE__ */ jsx(ImageInfoPanel, {}) : null
|
|
1120
|
+
] });
|
|
1053
1121
|
}
|
|
1054
1122
|
// src/react/crop/CropFrame.tsx
|
|
1055
1123
|
var HANDLES = [
|
|
@@ -1179,6 +1247,52 @@ function CropFrame(props) {
|
|
|
1179
1247
|
}, handle))]
|
|
1180
1248
|
});
|
|
1181
1249
|
}
|
|
1250
|
+
// src/react/stage/StageNotices.tsx
|
|
1251
|
+
function warningValues(limit, source) {
|
|
1252
|
+
if (limit === "maxFileSize") return { actual: source.fileSize };
|
|
1253
|
+
if (limit === "maxFrames") return { actual: source.frames };
|
|
1254
|
+
return {};
|
|
1255
|
+
}
|
|
1256
|
+
function StageNotices() {
|
|
1257
|
+
const { source, warnings, status } = useImageDocument();
|
|
1258
|
+
const messages = useImageMessages();
|
|
1259
|
+
const id = useId();
|
|
1260
|
+
const [dismissed, setDismissed] = useState(() => /* @__PURE__ */ new Set());
|
|
1261
|
+
if (!source || status !== "ready") return null;
|
|
1262
|
+
const t = messages.t;
|
|
1263
|
+
const notices = [];
|
|
1264
|
+
for (const limit of warnings) {
|
|
1265
|
+
if (limit === "maxSessionSize" || limit === "maxLayers") continue;
|
|
1266
|
+
notices.push({
|
|
1267
|
+
key: `${source.id}:${limit}`,
|
|
1268
|
+
text: t(`warnings.${limit}`, warningValues(limit, source))
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1271
|
+
if (source.metadata.colourProfile) notices.push({
|
|
1272
|
+
key: `${source.id}:colourProfile`,
|
|
1273
|
+
text: messages.t("notices.colourProfile")
|
|
1274
|
+
});
|
|
1275
|
+
const shown = notices.filter((notice) => !dismissed.has(notice.key));
|
|
1276
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1277
|
+
className: "hm-image-stage-notices",
|
|
1278
|
+
role: "status",
|
|
1279
|
+
"aria-label": messages.t("notices.label"),
|
|
1280
|
+
children: shown.length > 0 ? /* @__PURE__ */ jsx("ul", { children: shown.map((notice, index) => /* @__PURE__ */ jsxs("li", {
|
|
1281
|
+
className: "hm-image-stage-notice",
|
|
1282
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1283
|
+
id: `${id}-${index}`,
|
|
1284
|
+
children: notice.text
|
|
1285
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
1286
|
+
label: messages.t("notices.dismiss"),
|
|
1287
|
+
"aria-describedby": `${id}-${index}`,
|
|
1288
|
+
icon: /* @__PURE__ */ jsx(CloseIcon, {}),
|
|
1289
|
+
size: "small",
|
|
1290
|
+
variant: "quiet",
|
|
1291
|
+
onClick: () => setDismissed((before) => new Set(before).add(notice.key))
|
|
1292
|
+
})]
|
|
1293
|
+
}, notice.key)) }) : null
|
|
1294
|
+
});
|
|
1295
|
+
}
|
|
1182
1296
|
// src/react/stage/ImageStage.tsx
|
|
1183
1297
|
var CROP_INSET = 24;
|
|
1184
1298
|
function useStageSize(element) {
|
|
@@ -1301,6 +1415,12 @@ function ImageStage(props) {
|
|
|
1301
1415
|
inset
|
|
1302
1416
|
]);
|
|
1303
1417
|
const className = ["hm-image-stage", props.className].filter(Boolean).join(" ");
|
|
1418
|
+
const empty = status === "empty" && !snapshot.opening;
|
|
1419
|
+
const error = snapshot.error ? /* @__PURE__ */ jsx("p", {
|
|
1420
|
+
className: "hm-image-stage-error",
|
|
1421
|
+
role: "alert",
|
|
1422
|
+
children: messages.error(snapshot.error)
|
|
1423
|
+
}) : null;
|
|
1304
1424
|
return /* @__PURE__ */ jsxs("div", {
|
|
1305
1425
|
className,
|
|
1306
1426
|
"data-status": status,
|
|
@@ -1324,7 +1444,7 @@ function ImageStage(props) {
|
|
|
1324
1444
|
}
|
|
1325
1445
|
})
|
|
1326
1446
|
}) : null,
|
|
1327
|
-
|
|
1447
|
+
empty ? /* @__PURE__ */ jsxs(FileDropZone, {
|
|
1328
1448
|
className: "hm-image-stage-drop",
|
|
1329
1449
|
accept: "image/*",
|
|
1330
1450
|
onFiles: (files) => {
|
|
@@ -1333,10 +1453,10 @@ function ImageStage(props) {
|
|
|
1333
1453
|
},
|
|
1334
1454
|
buttonLabel: messages.t("editor.choose"),
|
|
1335
1455
|
hint: messages.t("editor.dropHint"),
|
|
1336
|
-
children: /* @__PURE__ */ jsx("p", {
|
|
1456
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
1337
1457
|
className: "hm-image-stage-empty",
|
|
1338
1458
|
children: messages.t("editor.empty")
|
|
1339
|
-
})
|
|
1459
|
+
}), error]
|
|
1340
1460
|
}) : null,
|
|
1341
1461
|
snapshot.opening ? /* @__PURE__ */ jsxs("div", {
|
|
1342
1462
|
className: "hm-image-stage-opening",
|
|
@@ -1346,11 +1466,10 @@ function ImageStage(props) {
|
|
|
1346
1466
|
children: messages.t("editor.cancel")
|
|
1347
1467
|
})]
|
|
1348
1468
|
}) : null,
|
|
1349
|
-
|
|
1350
|
-
className: "hm-image-stage-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
}) : null
|
|
1469
|
+
empty ? null : /* @__PURE__ */ jsxs("div", {
|
|
1470
|
+
className: "hm-image-stage-foot",
|
|
1471
|
+
children: [/* @__PURE__ */ jsx(StageNotices, {}), error]
|
|
1472
|
+
})
|
|
1354
1473
|
]
|
|
1355
1474
|
});
|
|
1356
1475
|
}
|
|
@@ -1413,10 +1532,19 @@ function ImageEditorBody(props) {
|
|
|
1413
1532
|
const input = useRef(null);
|
|
1414
1533
|
const latestOnChange = useRef(onChange);
|
|
1415
1534
|
latestOnChange.current = onChange;
|
|
1416
|
-
const
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1535
|
+
const exportOn = props.features?.export !== false;
|
|
1536
|
+
const registry = useMemo(() => {
|
|
1537
|
+
const wanted = (id) => (!props.tools || props.tools.includes(id)) && (exportOn || id !== "image.export");
|
|
1538
|
+
const tools = props.tools ?? imageTools.map((tool) => tool.id);
|
|
1539
|
+
return createToolRegistry(imageTools, {
|
|
1540
|
+
tools: tools.filter(wanted),
|
|
1541
|
+
toolbar: (props.toolbar ?? DEFAULT_TOOLBAR).map((group) => group.filter(wanted)).filter((group) => group.length > 0)
|
|
1542
|
+
});
|
|
1543
|
+
}, [
|
|
1544
|
+
props.tools,
|
|
1545
|
+
props.toolbar,
|
|
1546
|
+
exportOn
|
|
1547
|
+
]);
|
|
1420
1548
|
const platform = usePlatform();
|
|
1421
1549
|
const shortcuts = useMemo(() => createShortcutRegistry({
|
|
1422
1550
|
platform,
|
|
@@ -1550,6 +1678,7 @@ function ImageEditorBody(props) {
|
|
|
1550
1678
|
className: join("hm-image-editor", !unstyled && "hm-image-editor--styled", props.className, classNames.root),
|
|
1551
1679
|
onKeyDown,
|
|
1552
1680
|
"aria-label": messages.t("editor.label"),
|
|
1681
|
+
...props.theme ? { "data-hm-theme": props.theme } : {},
|
|
1553
1682
|
children: [
|
|
1554
1683
|
/* @__PURE__ */ jsx("input", {
|
|
1555
1684
|
ref: input,
|
|
@@ -1576,16 +1705,16 @@ function ImageEditorBody(props) {
|
|
|
1576
1705
|
/* @__PURE__ */ jsx(ImageStage, { className: join("hm-image-editor-stage", classNames.stage) }),
|
|
1577
1706
|
/* @__PURE__ */ jsx("div", {
|
|
1578
1707
|
className: join("hm-image-editor-inspector", classNames.inspector),
|
|
1579
|
-
children: /* @__PURE__ */ jsx(ImageInspector, {})
|
|
1708
|
+
children: /* @__PURE__ */ jsx(ImageInspector, { ...props.features ? { features: props.features } : {} })
|
|
1580
1709
|
})
|
|
1581
1710
|
]
|
|
1582
1711
|
}),
|
|
1583
|
-
/* @__PURE__ */ jsx(ImageExportDialog, { ...props.onExport ? { onExport: props.onExport } : {} })
|
|
1712
|
+
exportOn ? /* @__PURE__ */ jsx(ImageExportDialog, { ...props.onExport ? { onExport: props.onExport } : {} }) : null
|
|
1584
1713
|
]
|
|
1585
1714
|
});
|
|
1586
1715
|
}
|
|
1587
1716
|
var ImageEditor = forwardRef(function ImageEditor(props, ref) {
|
|
1588
|
-
const { initialFile, plan, onChange, tools, toolbar, icons, className, classNames, unstyled, onEvent, onExport, ...provider } = props;
|
|
1717
|
+
const { initialFile, plan, onChange, tools, toolbar, icons, className, classNames, unstyled, onEvent, onExport, features, theme, ...provider } = props;
|
|
1589
1718
|
const events = useRef(void 0);
|
|
1590
1719
|
const latestOnEvent = useRef(onEvent);
|
|
1591
1720
|
latestOnEvent.current = onEvent;
|
|
@@ -1608,10 +1737,12 @@ var ImageEditor = forwardRef(function ImageEditor(props, ref) {
|
|
|
1608
1737
|
...className ? { className } : {},
|
|
1609
1738
|
...classNames ? { classNames } : {},
|
|
1610
1739
|
...unstyled === void 0 ? {} : { unstyled },
|
|
1611
|
-
...onExport ? { onExport } : {}
|
|
1740
|
+
...onExport ? { onExport } : {},
|
|
1741
|
+
...features ? { features } : {},
|
|
1742
|
+
...theme ? { theme } : {}
|
|
1612
1743
|
}) })
|
|
1613
1744
|
});
|
|
1614
1745
|
});
|
|
1615
|
-
export {
|
|
1746
|
+
export { imageTools as _, ImageInfoPanel as a, ImageEditorProvider as c, ImageCropPanel as d, useImageDocument as f, useImageView as g, useImageSession as h, ImageStage as i, ImageExportDialog as l, useImageMessages as m, imageIcons as n, ImageFilterPanel as o, useImageEditorState as p, ImageToolbar as r, ImageAdjustPanel as s, ImageEditor as t, ExportListenerContext as u };
|
|
1616
1747
|
|
|
1617
|
-
//# sourceMappingURL=editor-
|
|
1748
|
+
//# sourceMappingURL=editor-DziYqEP3.js.map
|