@hussmartinez/image-sdk 0.9.0 → 0.10.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 +1 -1
- package/dist/assets/image/job.worker.js +1 -1
- package/dist/assets/image/render.worker.js +1 -1
- package/dist/element.js +2 -2
- package/dist/index.d.ts +10 -1
- package/dist/index.js +1 -1
- package/dist/lazy/{inline-job-worker-BFybekkp.js → inline-job-worker-CIW_4y1q.js} +2 -2
- package/dist/lazy/{inline-job-worker-BFybekkp.js.map → inline-job-worker-CIW_4y1q.js.map} +1 -1
- package/dist/lazy/{inline-worker-CMzixw3b.js → inline-worker-B7Zgl5CJ.js} +2 -2
- package/dist/lazy/{inline-worker-CMzixw3b.js.map → inline-worker-B7Zgl5CJ.js.map} +1 -1
- package/dist/react.d.ts +10 -1
- package/dist/react.js +1 -1
- package/dist/shared/{core-CCE45OTe.js → core-VTHSqv-f.js} +4 -4
- package/dist/shared/{core-CCE45OTe.js.map → core-VTHSqv-f.js.map} +1 -1
- package/dist/shared/{editor-CJEZNOqH.js → editor-CXmyuWHq.js} +26 -7
- package/dist/shared/editor-CXmyuWHq.js.map +1 -0
- package/package.json +1 -1
- package/dist/shared/editor-CJEZNOqH.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
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-VTHSqv-f.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
|
-
import { createContext, forwardRef, useContext, useEffect, useId, useImperativeHandle, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
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
|
|
@@ -2967,7 +2967,8 @@ var formatOf = (draft) => draft.format === "jpeg" || draft.format === "webp" ? {
|
|
|
2967
2967
|
} : { type: draft.format };
|
|
2968
2968
|
function ImageExportDialog(props) {
|
|
2969
2969
|
const { onExport, fileName = "image" } = props;
|
|
2970
|
-
const
|
|
2970
|
+
const { engine, emit } = useImageInternals();
|
|
2971
|
+
const lifecycle = engineInternals(engine);
|
|
2971
2972
|
const session = useImageSession();
|
|
2972
2973
|
const { plan, source } = useImageDocument();
|
|
2973
2974
|
const [editor, editorStore] = useImageEditorState();
|
|
@@ -3087,6 +3088,11 @@ function ImageExportDialog(props) {
|
|
|
3087
3088
|
link.href = objectUrl.current;
|
|
3088
3089
|
link.download = `${fileName}.${EXTENSIONS[phase.format]}`;
|
|
3089
3090
|
link.click();
|
|
3091
|
+
emit({
|
|
3092
|
+
type: "download",
|
|
3093
|
+
outcome: "done",
|
|
3094
|
+
commands: []
|
|
3095
|
+
});
|
|
3090
3096
|
};
|
|
3091
3097
|
const composition = compositionSize(plan, source);
|
|
3092
3098
|
const size = outputSize(current.output, composition);
|
|
@@ -3657,6 +3663,15 @@ function ImageProvider(props) {
|
|
|
3657
3663
|
const [editor] = useState(createEditorStore);
|
|
3658
3664
|
const [opener] = useState(() => createOpener(owned.session));
|
|
3659
3665
|
const [inserter] = useState(() => createInserter(owned.session, editor));
|
|
3666
|
+
const onEvent = useRef(props.onEvent);
|
|
3667
|
+
useInsertionEffect(() => {
|
|
3668
|
+
onEvent.current = props.onEvent;
|
|
3669
|
+
}, [props.onEvent]);
|
|
3670
|
+
const [emit] = useState(() => (event) => {
|
|
3671
|
+
try {
|
|
3672
|
+
onEvent.current?.(event);
|
|
3673
|
+
} catch {}
|
|
3674
|
+
});
|
|
3660
3675
|
useEffect(() => {
|
|
3661
3676
|
if (owned.pending !== void 0) clearTimeout(owned.pending);
|
|
3662
3677
|
return () => {
|
|
@@ -3674,14 +3689,16 @@ function ImageProvider(props) {
|
|
|
3674
3689
|
view,
|
|
3675
3690
|
editor,
|
|
3676
3691
|
opener,
|
|
3677
|
-
inserter
|
|
3692
|
+
inserter,
|
|
3693
|
+
emit
|
|
3678
3694
|
}), [
|
|
3679
3695
|
owned,
|
|
3680
3696
|
messages,
|
|
3681
3697
|
view,
|
|
3682
3698
|
editor,
|
|
3683
3699
|
opener,
|
|
3684
|
-
inserter
|
|
3700
|
+
inserter,
|
|
3701
|
+
emit
|
|
3685
3702
|
]);
|
|
3686
3703
|
return /* @__PURE__ */ jsx(ImageContext.Provider, {
|
|
3687
3704
|
value,
|
|
@@ -5154,7 +5171,9 @@ var ImageEditor = forwardRef(function ImageEditor(props, ref) {
|
|
|
5154
5171
|
const { initialFile, plan, onChange, tools, toolbar, icons, className, classNames, unstyled, onEvent, onExport, features, theme, ...provider } = props;
|
|
5155
5172
|
const events = useRef(void 0);
|
|
5156
5173
|
const latestOnEvent = useRef(onEvent);
|
|
5157
|
-
|
|
5174
|
+
useInsertionEffect(() => {
|
|
5175
|
+
latestOnEvent.current = onEvent;
|
|
5176
|
+
}, [onEvent]);
|
|
5158
5177
|
const [onSessionEvent] = useMemo(() => [(event) => {
|
|
5159
5178
|
events.current?.(event);
|
|
5160
5179
|
latestOnEvent.current?.(event);
|
|
@@ -5183,4 +5202,4 @@ var ImageEditor = forwardRef(function ImageEditor(props, ref) {
|
|
|
5183
5202
|
});
|
|
5184
5203
|
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 };
|
|
5185
5204
|
|
|
5186
|
-
//# sourceMappingURL=editor-
|
|
5205
|
+
//# sourceMappingURL=editor-CXmyuWHq.js.map
|