@hussmartinez/image-sdk 0.10.0 → 0.10.1
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/assets/image/job.worker.js +1 -1
- package/dist/assets/image/render.worker.js +2 -2
- package/dist/element.js +2 -2
- package/dist/index.js +1 -1
- package/dist/lazy/{inline-job-worker-CIW_4y1q.js → inline-job-worker-ok4juPo9.js} +2 -2
- package/dist/lazy/{inline-job-worker-CIW_4y1q.js.map → inline-job-worker-ok4juPo9.js.map} +1 -1
- package/dist/lazy/inline-worker-uUmNP8s2.js +30 -0
- package/dist/lazy/{inline-worker-B7Zgl5CJ.js.map → inline-worker-uUmNP8s2.js.map} +1 -1
- package/dist/react.js +1 -1
- package/dist/shared/{core-VTHSqv-f.js → core-CX0DXHI4.js} +145 -127
- package/dist/shared/core-CX0DXHI4.js.map +1 -0
- package/dist/shared/{editor-CXmyuWHq.js → editor-BWKiEOe7.js} +52 -40
- package/dist/shared/editor-BWKiEOe7.js.map +1 -0
- package/package.json +1 -1
- package/dist/lazy/inline-worker-B7Zgl5CJ.js +0 -30
- package/dist/shared/core-VTHSqv-f.js.map +0 -1
- package/dist/shared/editor-CXmyuWHq.js.map +0 -1
|
@@ -1,33 +1,42 @@
|
|
|
1
|
-
import { A as dragHandle, At as createImageRenderer, B as outputSize, C as drawingBounds, Ct as MAX_SCENE_COORDINATE, D as aspectRatio, E as ASPECT_PRESETS, F as wholeCrop, Ft as createImageProcessor, I as compositionSize, It as createImageEngine, J as FORBIDDEN_IN_TEXT, Jt as isImageError, Kt as asImageError, L as compositionToSource, Lt as engineInternals, M as handleInSource, N as moveCrop, Nt as fittedView, O as compositionDeltaToSource, P as nudgeCropOnScreen, Pt as placement, R as cropRect, Rt as ANIMATION_LIMITS, T as simplifyStroke, Tt as MAX_STROKE_WIDTH, _ as layerToScene, _t as MAX_FRAME_DELAY, a as compositionRectToScene, at as MAX_METADATA_LENGTH, b as createImageKey, bt as MAX_LAYER_TEXT_LENGTH, ct as DEVELOP_ADJUSTMENTS, d as sceneRectToComposition, dt as LAYER_ALIGNMENTS, f as applyMatrix, ft as LAYER_FONTS, g as layerToOutput, i as newLayerBox, j as fitAspect, k as cropInComposition, kt as createPlan, lt as FILTER_PRESETS, m as invertMatrix, n as createImageSession, o as fitRedactionRegion, q as createImageReducer, r as keepsFields, st as longerThan, t as imageMessages, x as arrowBounds, y as sceneToOutput } from "./core-
|
|
1
|
+
import { A as dragHandle, At as createImageRenderer, B as outputSize, C as drawingBounds, Ct as MAX_SCENE_COORDINATE, D as aspectRatio, E as ASPECT_PRESETS, F as wholeCrop, Ft as createImageProcessor, I as compositionSize, It as createImageEngine, J as FORBIDDEN_IN_TEXT, Jt as isImageError, Kt as asImageError, L as compositionToSource, Lt as engineInternals, M as handleInSource, N as moveCrop, Nt as fittedView, O as compositionDeltaToSource, P as nudgeCropOnScreen, Pt as placement, R as cropRect, Rt as ANIMATION_LIMITS, T as simplifyStroke, Tt as MAX_STROKE_WIDTH, _ as layerToScene, _t as MAX_FRAME_DELAY, a as compositionRectToScene, at as MAX_METADATA_LENGTH, b as createImageKey, bt as MAX_LAYER_TEXT_LENGTH, ct as DEVELOP_ADJUSTMENTS, d as sceneRectToComposition, dt as LAYER_ALIGNMENTS, f as applyMatrix, ft as LAYER_FONTS, g as layerToOutput, i as newLayerBox, j as fitAspect, k as cropInComposition, kt as createPlan, lt as FILTER_PRESETS, m as invertMatrix, n as createImageSession, o as fitRedactionRegion, q as createImageReducer, r as keepsFields, st as longerThan, t as imageMessages, x as arrowBounds, y as sceneToOutput } from "./core-CX0DXHI4.js";
|
|
2
2
|
import { applyCommands, createMessages, createShortcutRegistry, createStore, createToolRegistry, defineMessages, defineTool, plural } from "@hussmartinez/sdk-core";
|
|
3
3
|
import { AddIcon, AnnouncerProvider, ArrowIcon, Button, CloseIcon, ColorField, CropIcon, DeleteIcon, Dialog, DownloadIcon, DuplicateIcon, EllipseIcon, Field, FileDropZone, FitIcon, FlipHorizontalIcon, FlipVerticalIcon, HiddenIcon, IconButton, LayersIcon, MoveDownIcon, MoveUpIcon, NumberField, OpenIcon, PageGridIcon, PauseIcon, PenIcon, PlayIcon, ProgressBar, RectangleIcon, RedactIcon, RedoIcon, ReorderableList, ReorderableListItem, RotateLeftIcon, RotateRightIcon, SearchIcon, SegmentedControl, Slider, Spinner, TextArea, TextField, TextIcon, ToggleButton, Toolbar, ToolbarGroup, Tooltip, UiMessagesProvider, UndoIcon, VisibleIcon, ZoomInIcon, ZoomOutIcon, useAnnounce, usePlatform } from "@hussmartinez/ui/react";
|
|
4
4
|
import { createContext, forwardRef, useContext, useEffect, useId, useImperativeHandle, useInsertionEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { uiMessages } from "@hussmartinez/ui";
|
|
7
7
|
// src/features/editor-state.ts
|
|
8
|
-
var PAUSED = Object.freeze({
|
|
8
|
+
var PAUSED = /* @__PURE__ */ Object.freeze({
|
|
9
9
|
frame: 0,
|
|
10
10
|
playing: false
|
|
11
11
|
});
|
|
12
|
-
var NO_TOOL = Object.freeze({
|
|
12
|
+
var NO_TOOL = /* @__PURE__ */ Object.freeze({
|
|
13
13
|
tool: null,
|
|
14
14
|
crop: null,
|
|
15
15
|
redact: null,
|
|
16
16
|
layers: null,
|
|
17
17
|
draw: null
|
|
18
18
|
});
|
|
19
|
-
var IDLE =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
var IDLE = /* @__PURE__ */ idle();
|
|
20
|
+
function idle() {
|
|
21
|
+
return Object.freeze({
|
|
22
|
+
...NO_TOOL,
|
|
23
|
+
error: null,
|
|
24
|
+
preview: null,
|
|
25
|
+
dialog: null,
|
|
26
|
+
playback: PAUSED
|
|
27
|
+
});
|
|
28
|
+
}
|
|
26
29
|
function createEditorStore() {
|
|
27
30
|
return createStore(IDLE);
|
|
28
31
|
}
|
|
29
32
|
// src/features/tool-types.ts
|
|
30
33
|
var hasDocument = ({ snapshot }) => snapshot.plan !== null;
|
|
34
|
+
function withReason(tool, unavailable) {
|
|
35
|
+
return {
|
|
36
|
+
...tool,
|
|
37
|
+
unavailable
|
|
38
|
+
};
|
|
39
|
+
}
|
|
31
40
|
// src/features/crop/crop-tools.ts
|
|
32
41
|
function startCrop({ session, editor }) {
|
|
33
42
|
const { plan, source } = session.getSnapshot();
|
|
@@ -220,25 +229,22 @@ var drawTool = /* @__PURE__ */ defineTool({
|
|
|
220
229
|
shortcuts: ["D"]
|
|
221
230
|
});
|
|
222
231
|
// src/features/export/export-tool.ts
|
|
223
|
-
var exportTool = {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
playback
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}),
|
|
240
|
-
unavailable: ({ snapshot, editor }) => snapshot.plan !== null && editor.tool === "crop" ? "tools.exportWhileCropping" : void 0
|
|
241
|
-
};
|
|
232
|
+
var exportTool = /* @__PURE__ */ withReason(/* @__PURE__ */ defineTool({
|
|
233
|
+
id: "image.export",
|
|
234
|
+
label: "tools.export",
|
|
235
|
+
icon: "export",
|
|
236
|
+
group: "export",
|
|
237
|
+
isEnabled: ({ snapshot, editor }) => snapshot.plan !== null && editor.tool !== "crop",
|
|
238
|
+
run: ({ editor }) => editor.set((state) => state.tool === "crop" ? state : {
|
|
239
|
+
...state,
|
|
240
|
+
...NO_TOOL,
|
|
241
|
+
dialog: "export",
|
|
242
|
+
playback: {
|
|
243
|
+
...state.playback,
|
|
244
|
+
playing: false
|
|
245
|
+
}
|
|
246
|
+
})
|
|
247
|
+
}), ({ snapshot, editor }) => snapshot.plan !== null && editor.tool === "crop" ? "tools.exportWhileCropping" : void 0);
|
|
242
248
|
// src/features/frames/frames-tool.ts
|
|
243
249
|
var animated = ({ snapshot }) => snapshot.plan?.animation != null;
|
|
244
250
|
var framesTool = /* @__PURE__ */ defineTool({
|
|
@@ -1048,7 +1054,10 @@ function useRedactActions() {
|
|
|
1048
1054
|
// src/react/layers/use-layers.ts
|
|
1049
1055
|
var DUPLICATE_OFFSET = 8;
|
|
1050
1056
|
var LABEL_LENGTH = 40;
|
|
1051
|
-
var EVERY_FORBIDDEN =
|
|
1057
|
+
var EVERY_FORBIDDEN = /* @__PURE__ */ everyMatch(FORBIDDEN_IN_TEXT);
|
|
1058
|
+
function everyMatch(pattern) {
|
|
1059
|
+
return new RegExp(pattern.source, `${pattern.flags}g`);
|
|
1060
|
+
}
|
|
1052
1061
|
function layerLabel(layer, messages) {
|
|
1053
1062
|
if (layer.name !== "") return layer.name;
|
|
1054
1063
|
if (layer.kind === "text") {
|
|
@@ -2908,7 +2917,7 @@ function ImageStage(props) {
|
|
|
2908
2917
|
});
|
|
2909
2918
|
}
|
|
2910
2919
|
// src/react/export/export-listener.ts
|
|
2911
|
-
var ExportListenerContext = createContext(null);
|
|
2920
|
+
var ExportListenerContext = /* @__PURE__ */ createContext(null);
|
|
2912
2921
|
// src/react/export/ExportDialog.tsx
|
|
2913
2922
|
var FORMATS = [
|
|
2914
2923
|
"png",
|
|
@@ -3616,15 +3625,18 @@ var imageEditorText = /* @__PURE__ */ defineMessages({
|
|
|
3616
3625
|
"export.close": "Done"
|
|
3617
3626
|
});
|
|
3618
3627
|
// src/react/editor-messages.ts
|
|
3619
|
-
var imageEditorMessages = /* @__PURE__ */
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3628
|
+
var imageEditorMessages = /* @__PURE__ */ editorCatalogue();
|
|
3629
|
+
function editorCatalogue() {
|
|
3630
|
+
return defineMessages({
|
|
3631
|
+
...imageMessages,
|
|
3632
|
+
...uiMessages,
|
|
3633
|
+
...imageEditorText
|
|
3634
|
+
});
|
|
3635
|
+
}
|
|
3624
3636
|
// src/react/view-store.ts
|
|
3625
|
-
var FITTED = Object.freeze({
|
|
3637
|
+
var FITTED = /* @__PURE__ */ Object.freeze({
|
|
3626
3638
|
zoom: 1,
|
|
3627
|
-
pan: Object.freeze({
|
|
3639
|
+
pan: /* @__PURE__ */ Object.freeze({
|
|
3628
3640
|
x: 0,
|
|
3629
3641
|
y: 0
|
|
3630
3642
|
})
|
|
@@ -5167,7 +5179,7 @@ function ImageEditorBody(props) {
|
|
|
5167
5179
|
] })
|
|
5168
5180
|
});
|
|
5169
5181
|
}
|
|
5170
|
-
var ImageEditor = forwardRef(function ImageEditor(props, ref) {
|
|
5182
|
+
var ImageEditor = /* @__PURE__ */ forwardRef(function ImageEditor(props, ref) {
|
|
5171
5183
|
const { initialFile, plan, onChange, tools, toolbar, icons, className, classNames, unstyled, onEvent, onExport, features, theme, ...provider } = props;
|
|
5172
5184
|
const events = useRef(void 0);
|
|
5173
5185
|
const latestOnEvent = useRef(onEvent);
|
|
@@ -5202,4 +5214,4 @@ var ImageEditor = forwardRef(function ImageEditor(props, ref) {
|
|
|
5202
5214
|
});
|
|
5203
5215
|
export { imageTools as S, useImageDocument as _, ImageFilterPanel as a, useImageSession as b, ImageLayersPanel as c, imageEditorMessages as d, ImageExportDialog as f, ImageCropPanel as g, ImageDrawPanel as h, ImageInfoPanel as i, ImageFramesPanel as l, ImageStage as m, imageIcons as n, ImageAdjustPanel as o, ExportListenerContext as p, ImageToolbar as r, ImageRedactPanel as s, ImageEditor as t, ImageEditorProvider as u, useImageEditorState as v, useImageView as x, useImageMessages as y };
|
|
5204
5216
|
|
|
5205
|
-
//# sourceMappingURL=editor-
|
|
5217
|
+
//# sourceMappingURL=editor-BWKiEOe7.js.map
|