@pixerate/editor-react 0.132.0 → 0.133.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.
|
@@ -2755,6 +2755,26 @@ var SelectionOptionsBar = ({
|
|
|
2755
2755
|
setSegmenting(false);
|
|
2756
2756
|
}
|
|
2757
2757
|
};
|
|
2758
|
+
const [focusing, setFocusing] = useState11(false);
|
|
2759
|
+
const [focusStatus, setFocusStatus] = useState11(null);
|
|
2760
|
+
const selectFocusArea = async () => {
|
|
2761
|
+
if (focusing) return;
|
|
2762
|
+
setFocusing(true);
|
|
2763
|
+
setFocusStatus(null);
|
|
2764
|
+
try {
|
|
2765
|
+
const { selection: selection2 } = await controller.selectFocusArea({
|
|
2766
|
+
range: options.focusRange ?? 50,
|
|
2767
|
+
noise: options.focusNoise ?? 0,
|
|
2768
|
+
softness: options.focusSoftness ?? 4,
|
|
2769
|
+
mode: options.mode
|
|
2770
|
+
});
|
|
2771
|
+
setFocusStatus(selection2 ? null : "No part of the image stands out as in focus.");
|
|
2772
|
+
} catch (err) {
|
|
2773
|
+
setFocusStatus(err instanceof Error ? err.message : String(err));
|
|
2774
|
+
} finally {
|
|
2775
|
+
setFocusing(false);
|
|
2776
|
+
}
|
|
2777
|
+
};
|
|
2758
2778
|
return /* @__PURE__ */ jsxs13("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
2759
2779
|
/* @__PURE__ */ jsx15("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: SELECTION_TOOLS.map((t) => /* @__PURE__ */ jsx15("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
|
|
2760
2780
|
/* @__PURE__ */ jsx15("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: SELECTION_MODES.map((m) => /* @__PURE__ */ jsx15("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: SELECTION_MODE_LABELS[m] }, m)) }),
|
|
@@ -3015,6 +3035,37 @@ var SelectionOptionsBar = ({
|
|
|
3015
3035
|
]
|
|
3016
3036
|
}
|
|
3017
3037
|
),
|
|
3038
|
+
/* @__PURE__ */ jsxs13("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
|
|
3039
|
+
/* @__PURE__ */ jsx15("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
|
|
3040
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-2 pt-2", children: [
|
|
3041
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
|
|
3042
|
+
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3043
|
+
/* @__PURE__ */ jsx15("span", { children: "In-focus range" }),
|
|
3044
|
+
/* @__PURE__ */ jsx15("span", { className: "font-mono", children: options.focusRange ?? 50 })
|
|
3045
|
+
] }),
|
|
3046
|
+
/* @__PURE__ */ jsx15(ImageRange, { label: "In-focus range", min: 0, max: 100, step: 1, value: options.focusRange ?? 50, onChange: (v) => set({ focusRange: v }) })
|
|
3047
|
+
] }),
|
|
3048
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
|
|
3049
|
+
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3050
|
+
/* @__PURE__ */ jsx15("span", { children: "Image noise level" }),
|
|
3051
|
+
/* @__PURE__ */ jsx15("span", { className: "font-mono", children: options.focusNoise ?? 0 })
|
|
3052
|
+
] }),
|
|
3053
|
+
/* @__PURE__ */ jsx15(ImageRange, { label: "Image noise level", min: 0, max: 100, step: 1, value: options.focusNoise ?? 0, onChange: (v) => set({ focusNoise: v }) })
|
|
3054
|
+
] }),
|
|
3055
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
|
|
3056
|
+
/* @__PURE__ */ jsxs13("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3057
|
+
/* @__PURE__ */ jsx15("span", { children: "Soften edge" }),
|
|
3058
|
+
/* @__PURE__ */ jsxs13("span", { className: "font-mono", children: [
|
|
3059
|
+
options.focusSoftness ?? 4,
|
|
3060
|
+
" px"
|
|
3061
|
+
] })
|
|
3062
|
+
] }),
|
|
3063
|
+
/* @__PURE__ */ jsx15(ImageRange, { label: "Focus soften edge", min: 0, max: 50, step: 1, value: options.focusSoftness ?? 4, onChange: (v) => set({ focusSoftness: v }) })
|
|
3064
|
+
] }),
|
|
3065
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), disabled: focusing, "aria-busy": focusing, onClick: () => void selectFocusArea(), children: focusing ? "Selecting\u2026" : "Select Focus Area" }),
|
|
3066
|
+
focusStatus && /* @__PURE__ */ jsx15("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
|
|
3067
|
+
] })
|
|
3068
|
+
] }),
|
|
3018
3069
|
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3019
3070
|
/* @__PURE__ */ jsx15(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
|
|
3020
3071
|
"Anti-alias"
|
|
@@ -4686,6 +4686,26 @@ var SelectionOptionsBar = ({
|
|
|
4686
4686
|
setSegmenting(false);
|
|
4687
4687
|
}
|
|
4688
4688
|
};
|
|
4689
|
+
const [focusing, setFocusing] = (0, import_react25.useState)(false);
|
|
4690
|
+
const [focusStatus, setFocusStatus] = (0, import_react25.useState)(null);
|
|
4691
|
+
const selectFocusArea = async () => {
|
|
4692
|
+
if (focusing) return;
|
|
4693
|
+
setFocusing(true);
|
|
4694
|
+
setFocusStatus(null);
|
|
4695
|
+
try {
|
|
4696
|
+
const { selection: selection2 } = await controller.selectFocusArea({
|
|
4697
|
+
range: options.focusRange ?? 50,
|
|
4698
|
+
noise: options.focusNoise ?? 0,
|
|
4699
|
+
softness: options.focusSoftness ?? 4,
|
|
4700
|
+
mode: options.mode
|
|
4701
|
+
});
|
|
4702
|
+
setFocusStatus(selection2 ? null : "No part of the image stands out as in focus.");
|
|
4703
|
+
} catch (err) {
|
|
4704
|
+
setFocusStatus(err instanceof Error ? err.message : String(err));
|
|
4705
|
+
} finally {
|
|
4706
|
+
setFocusing(false);
|
|
4707
|
+
}
|
|
4708
|
+
};
|
|
4689
4709
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
4690
4710
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
|
|
4691
4711
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor14.SELECTION_MODE_LABELS[m] }, m)) }),
|
|
@@ -4946,6 +4966,37 @@ var SelectionOptionsBar = ({
|
|
|
4946
4966
|
]
|
|
4947
4967
|
}
|
|
4948
4968
|
),
|
|
4969
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
|
|
4970
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
|
|
4971
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-2 pt-2", children: [
|
|
4972
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4973
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4974
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "In-focus range" }),
|
|
4975
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-mono", children: options.focusRange ?? 50 })
|
|
4976
|
+
] }),
|
|
4977
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageRange, { label: "In-focus range", min: 0, max: 100, step: 1, value: options.focusRange ?? 50, onChange: (v) => set({ focusRange: v }) })
|
|
4978
|
+
] }),
|
|
4979
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4980
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4981
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Image noise level" }),
|
|
4982
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "font-mono", children: options.focusNoise ?? 0 })
|
|
4983
|
+
] }),
|
|
4984
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageRange, { label: "Image noise level", min: 0, max: 100, step: 1, value: options.focusNoise ?? 0, onChange: (v) => set({ focusNoise: v }) })
|
|
4985
|
+
] }),
|
|
4986
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
4987
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
4988
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: "Soften edge" }),
|
|
4989
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "font-mono", children: [
|
|
4990
|
+
options.focusSoftness ?? 4,
|
|
4991
|
+
" px"
|
|
4992
|
+
] })
|
|
4993
|
+
] }),
|
|
4994
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageRange, { label: "Focus soften edge", min: 0, max: 50, step: 1, value: options.focusSoftness ?? 4, onChange: (v) => set({ focusSoftness: v }) })
|
|
4995
|
+
] }),
|
|
4996
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), disabled: focusing, "aria-busy": focusing, onClick: () => void selectFocusArea(), children: focusing ? "Selecting\u2026" : "Select Focus Area" }),
|
|
4997
|
+
focusStatus && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
|
|
4998
|
+
] })
|
|
4999
|
+
] }),
|
|
4949
5000
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4950
5001
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
|
|
4951
5002
|
"Anti-alias"
|
package/dist/index.cjs
CHANGED
|
@@ -8400,6 +8400,26 @@ var SelectionOptionsBar = ({
|
|
|
8400
8400
|
setSegmenting(false);
|
|
8401
8401
|
}
|
|
8402
8402
|
};
|
|
8403
|
+
const [focusing, setFocusing] = (0, import_react61.useState)(false);
|
|
8404
|
+
const [focusStatus, setFocusStatus] = (0, import_react61.useState)(null);
|
|
8405
|
+
const selectFocusArea = async () => {
|
|
8406
|
+
if (focusing) return;
|
|
8407
|
+
setFocusing(true);
|
|
8408
|
+
setFocusStatus(null);
|
|
8409
|
+
try {
|
|
8410
|
+
const { selection: selection2 } = await controller.selectFocusArea({
|
|
8411
|
+
range: options.focusRange ?? 50,
|
|
8412
|
+
noise: options.focusNoise ?? 0,
|
|
8413
|
+
softness: options.focusSoftness ?? 4,
|
|
8414
|
+
mode: options.mode
|
|
8415
|
+
});
|
|
8416
|
+
setFocusStatus(selection2 ? null : "No part of the image stands out as in focus.");
|
|
8417
|
+
} catch (err) {
|
|
8418
|
+
setFocusStatus(err instanceof Error ? err.message : String(err));
|
|
8419
|
+
} finally {
|
|
8420
|
+
setFocusing(false);
|
|
8421
|
+
}
|
|
8422
|
+
};
|
|
8403
8423
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { "data-testid": "selection-options-bar", className: `flex flex-col gap-3 text-xs ${className}`, children: [
|
|
8404
8424
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { role: "group", "aria-label": "Selection tool", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_TOOLS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("button", { type: "button", "aria-pressed": options.tool === t.id, className: btn(options.tool === t.id), onClick: () => set({ tool: t.id }), children: t.label }, t.id)) }),
|
|
8405
8425
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { role: "group", "aria-label": "Selection mode", className: "flex flex-wrap gap-1", children: import_image_editor14.SELECTION_MODES.map((m) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("button", { type: "button", "aria-pressed": options.mode === m, className: btn(options.mode === m), onClick: () => set({ mode: m }), children: import_image_editor14.SELECTION_MODE_LABELS[m] }, m)) }),
|
|
@@ -8660,6 +8680,37 @@ var SelectionOptionsBar = ({
|
|
|
8660
8680
|
]
|
|
8661
8681
|
}
|
|
8662
8682
|
),
|
|
8683
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
|
|
8684
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
|
|
8685
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col gap-2 pt-2", children: [
|
|
8686
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
8687
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
8688
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: "In-focus range" }),
|
|
8689
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "font-mono", children: options.focusRange ?? 50 })
|
|
8690
|
+
] }),
|
|
8691
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ImageRange, { label: "In-focus range", min: 0, max: 100, step: 1, value: options.focusRange ?? 50, onChange: (v) => set({ focusRange: v }) })
|
|
8692
|
+
] }),
|
|
8693
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
8694
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
8695
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: "Image noise level" }),
|
|
8696
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "font-mono", children: options.focusNoise ?? 0 })
|
|
8697
|
+
] }),
|
|
8698
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ImageRange, { label: "Image noise level", min: 0, max: 100, step: 1, value: options.focusNoise ?? 0, onChange: (v) => set({ focusNoise: v }) })
|
|
8699
|
+
] }),
|
|
8700
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
8701
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
8702
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: "Soften edge" }),
|
|
8703
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("span", { className: "font-mono", children: [
|
|
8704
|
+
options.focusSoftness ?? 4,
|
|
8705
|
+
" px"
|
|
8706
|
+
] })
|
|
8707
|
+
] }),
|
|
8708
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ImageRange, { label: "Focus soften edge", min: 0, max: 50, step: 1, value: options.focusSoftness ?? 4, onChange: (v) => set({ focusSoftness: v }) })
|
|
8709
|
+
] }),
|
|
8710
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("button", { type: "button", className: btn(false), disabled: focusing, "aria-busy": focusing, onClick: () => void selectFocusArea(), children: focusing ? "Selecting\u2026" : "Select Focus Area" }),
|
|
8711
|
+
focusStatus && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { role: "status", className: "text-muted-foreground", children: focusStatus })
|
|
8712
|
+
] })
|
|
8713
|
+
] }),
|
|
8663
8714
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
8664
8715
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ImageCheckbox, { label: "Anti-alias", checked: options.antiAlias, onChange: (on) => set({ antiAlias: on }) }),
|
|
8665
8716
|
"Anti-alias"
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.133.0",
|
|
4
4
|
"description": "React bindings and prompt/rich-text components for @pixerate/editor",
|
|
5
5
|
"author": "Pixerate",
|
|
6
6
|
"license": "MIT",
|
|
@@ -254,7 +254,7 @@
|
|
|
254
254
|
"dependencies": {},
|
|
255
255
|
"peerDependencies": {
|
|
256
256
|
"@dagrejs/dagre": "^1.1.8",
|
|
257
|
-
"@pixerate/editor": ">=0.
|
|
257
|
+
"@pixerate/editor": ">=0.200.0 <1.0.0-0",
|
|
258
258
|
"@tiptap/core": "^2.27.3",
|
|
259
259
|
"@tiptap/extension-bubble-menu": "^2.27.3",
|
|
260
260
|
"@tiptap/extension-placeholder": "^2.27.3",
|
|
@@ -305,7 +305,7 @@
|
|
|
305
305
|
"tsup": "^9.0.0",
|
|
306
306
|
"typescript": "^5.7.3",
|
|
307
307
|
"vitest": "^5.0.5",
|
|
308
|
-
"@pixerate/editor": "0.
|
|
308
|
+
"@pixerate/editor": "0.200.0"
|
|
309
309
|
},
|
|
310
310
|
"scripts": {
|
|
311
311
|
"build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",
|