@pixerate/editor-react 0.134.0 → 0.136.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.
|
@@ -3174,6 +3174,7 @@ import { useState as useState12 } from "react";
|
|
|
3174
3174
|
import {
|
|
3175
3175
|
ADJUSTMENT_KINDS as ADJUSTMENT_KINDS2,
|
|
3176
3176
|
REFINE_EDGE_CONTROLS,
|
|
3177
|
+
REFINE_OUTPUTS,
|
|
3177
3178
|
adjustmentKindLabel as adjustmentKindLabel2,
|
|
3178
3179
|
layerMaskFromSelection
|
|
3179
3180
|
} from "@pixerate/editor/image-editor";
|
|
@@ -3186,6 +3187,11 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3186
3187
|
const [error, setError] = useState12(null);
|
|
3187
3188
|
const [layerId, setLayerId] = useState12("");
|
|
3188
3189
|
const [newKind, setNewKind] = useState12("hueSaturation");
|
|
3190
|
+
const [output, setOutput] = useState12("selection");
|
|
3191
|
+
const [decontaminate, setDecontaminate] = useState12(0);
|
|
3192
|
+
const [objectAware, setObjectAware] = useState12(false);
|
|
3193
|
+
const canObject = Boolean(controller.segmentationProvider);
|
|
3194
|
+
const toLayer = output === "new-layer" || output === "new-layer-with-mask";
|
|
3189
3195
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
3190
3196
|
const list = layers ?? controller.getAdjustmentLayers();
|
|
3191
3197
|
const target = list.find((l) => l.id === layerId) ?? list[list.length - 1];
|
|
@@ -3193,7 +3199,10 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3193
3199
|
setBusy(true);
|
|
3194
3200
|
setError(null);
|
|
3195
3201
|
try {
|
|
3196
|
-
await controller.
|
|
3202
|
+
await controller.refineSelectionTo(params, output, {
|
|
3203
|
+
decontaminate: toLayer ? decontaminate : 0,
|
|
3204
|
+
refineMode: canObject && objectAware ? "object" : "color"
|
|
3205
|
+
});
|
|
3197
3206
|
} catch (err) {
|
|
3198
3207
|
setError(err instanceof Error ? err.message : String(err));
|
|
3199
3208
|
} finally {
|
|
@@ -3228,6 +3237,49 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
3228
3237
|
/* @__PURE__ */ jsx16("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
3229
3238
|
"Smart Radius"
|
|
3230
3239
|
] }),
|
|
3240
|
+
canObject && /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
3241
|
+
/* @__PURE__ */ jsx16("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
|
|
3242
|
+
"Object aware (segmentation model)"
|
|
3243
|
+
] }),
|
|
3244
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
3245
|
+
"Output to",
|
|
3246
|
+
/* @__PURE__ */ jsx16(
|
|
3247
|
+
"select",
|
|
3248
|
+
{
|
|
3249
|
+
"aria-label": "Refine output",
|
|
3250
|
+
value: output,
|
|
3251
|
+
onChange: (e) => setOutput(e.target.value),
|
|
3252
|
+
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
3253
|
+
children: REFINE_OUTPUTS.map((o) => /* @__PURE__ */ jsx16("option", { value: o.id, children: o.label }, o.id))
|
|
3254
|
+
}
|
|
3255
|
+
)
|
|
3256
|
+
] }),
|
|
3257
|
+
/* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
|
|
3258
|
+
/* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
3259
|
+
/* @__PURE__ */ jsxs14("span", { children: [
|
|
3260
|
+
"Decontaminate colors",
|
|
3261
|
+
toLayer ? "" : " (new layer outputs)"
|
|
3262
|
+
] }),
|
|
3263
|
+
/* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
|
|
3264
|
+
decontaminate,
|
|
3265
|
+
"%"
|
|
3266
|
+
] })
|
|
3267
|
+
] }),
|
|
3268
|
+
/* @__PURE__ */ jsx16(
|
|
3269
|
+
"input",
|
|
3270
|
+
{
|
|
3271
|
+
type: "range",
|
|
3272
|
+
min: 0,
|
|
3273
|
+
max: 100,
|
|
3274
|
+
step: 1,
|
|
3275
|
+
"aria-label": "Decontaminate amount",
|
|
3276
|
+
disabled: !toLayer,
|
|
3277
|
+
value: decontaminate,
|
|
3278
|
+
onChange: (e) => setDecontaminate(Number(e.target.value)),
|
|
3279
|
+
className: imageRangeClass
|
|
3280
|
+
}
|
|
3281
|
+
)
|
|
3282
|
+
] }),
|
|
3231
3283
|
/* @__PURE__ */ jsxs14("div", { className: "flex gap-1", children: [
|
|
3232
3284
|
/* @__PURE__ */ jsx16("button", { type: "button", className: button, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
3233
3285
|
/* @__PURE__ */ jsx16("button", { type: "button", className: button, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
|
@@ -5112,6 +5112,11 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5112
5112
|
const [error, setError] = (0, import_react26.useState)(null);
|
|
5113
5113
|
const [layerId, setLayerId] = (0, import_react26.useState)("");
|
|
5114
5114
|
const [newKind, setNewKind] = (0, import_react26.useState)("hueSaturation");
|
|
5115
|
+
const [output, setOutput] = (0, import_react26.useState)("selection");
|
|
5116
|
+
const [decontaminate, setDecontaminate] = (0, import_react26.useState)(0);
|
|
5117
|
+
const [objectAware, setObjectAware] = (0, import_react26.useState)(false);
|
|
5118
|
+
const canObject = Boolean(controller.segmentationProvider);
|
|
5119
|
+
const toLayer = output === "new-layer" || output === "new-layer-with-mask";
|
|
5115
5120
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
5116
5121
|
const list = layers ?? controller.getAdjustmentLayers();
|
|
5117
5122
|
const target = list.find((l) => l.id === layerId) ?? list[list.length - 1];
|
|
@@ -5119,7 +5124,10 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5119
5124
|
setBusy(true);
|
|
5120
5125
|
setError(null);
|
|
5121
5126
|
try {
|
|
5122
|
-
await controller.
|
|
5127
|
+
await controller.refineSelectionTo(params, output, {
|
|
5128
|
+
decontaminate: toLayer ? decontaminate : 0,
|
|
5129
|
+
refineMode: canObject && objectAware ? "object" : "color"
|
|
5130
|
+
});
|
|
5123
5131
|
} catch (err) {
|
|
5124
5132
|
setError(err instanceof Error ? err.message : String(err));
|
|
5125
5133
|
} finally {
|
|
@@ -5154,6 +5162,49 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
5154
5162
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
5155
5163
|
"Smart Radius"
|
|
5156
5164
|
] }),
|
|
5165
|
+
canObject && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
5166
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
|
|
5167
|
+
"Object aware (segmentation model)"
|
|
5168
|
+
] }),
|
|
5169
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
5170
|
+
"Output to",
|
|
5171
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5172
|
+
"select",
|
|
5173
|
+
{
|
|
5174
|
+
"aria-label": "Refine output",
|
|
5175
|
+
value: output,
|
|
5176
|
+
onChange: (e) => setOutput(e.target.value),
|
|
5177
|
+
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
5178
|
+
children: import_image_editor15.REFINE_OUTPUTS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: o.id, children: o.label }, o.id))
|
|
5179
|
+
}
|
|
5180
|
+
)
|
|
5181
|
+
] }),
|
|
5182
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
5183
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
5184
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { children: [
|
|
5185
|
+
"Decontaminate colors",
|
|
5186
|
+
toLayer ? "" : " (new layer outputs)"
|
|
5187
|
+
] }),
|
|
5188
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
|
|
5189
|
+
decontaminate,
|
|
5190
|
+
"%"
|
|
5191
|
+
] })
|
|
5192
|
+
] }),
|
|
5193
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5194
|
+
"input",
|
|
5195
|
+
{
|
|
5196
|
+
type: "range",
|
|
5197
|
+
min: 0,
|
|
5198
|
+
max: 100,
|
|
5199
|
+
step: 1,
|
|
5200
|
+
"aria-label": "Decontaminate amount",
|
|
5201
|
+
disabled: !toLayer,
|
|
5202
|
+
value: decontaminate,
|
|
5203
|
+
onChange: (e) => setDecontaminate(Number(e.target.value)),
|
|
5204
|
+
className: imageRangeClass
|
|
5205
|
+
}
|
|
5206
|
+
)
|
|
5207
|
+
] }),
|
|
5157
5208
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-1", children: [
|
|
5158
5209
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button2, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
5159
5210
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button2, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
package/dist/index.cjs
CHANGED
|
@@ -8826,6 +8826,11 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8826
8826
|
const [error, setError] = (0, import_react62.useState)(null);
|
|
8827
8827
|
const [layerId, setLayerId] = (0, import_react62.useState)("");
|
|
8828
8828
|
const [newKind, setNewKind] = (0, import_react62.useState)("hueSaturation");
|
|
8829
|
+
const [output, setOutput] = (0, import_react62.useState)("selection");
|
|
8830
|
+
const [decontaminate, setDecontaminate] = (0, import_react62.useState)(0);
|
|
8831
|
+
const [objectAware, setObjectAware] = (0, import_react62.useState)(false);
|
|
8832
|
+
const canObject = Boolean(controller.segmentationProvider);
|
|
8833
|
+
const toLayer = output === "new-layer" || output === "new-layer-with-mask";
|
|
8829
8834
|
const sel = selection === void 0 ? controller.getSelection() : selection;
|
|
8830
8835
|
const list = layers ?? controller.getAdjustmentLayers();
|
|
8831
8836
|
const target = list.find((l) => l.id === layerId) ?? list[list.length - 1];
|
|
@@ -8833,7 +8838,10 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8833
8838
|
setBusy(true);
|
|
8834
8839
|
setError(null);
|
|
8835
8840
|
try {
|
|
8836
|
-
await controller.
|
|
8841
|
+
await controller.refineSelectionTo(params, output, {
|
|
8842
|
+
decontaminate: toLayer ? decontaminate : 0,
|
|
8843
|
+
refineMode: canObject && objectAware ? "object" : "color"
|
|
8844
|
+
});
|
|
8837
8845
|
} catch (err) {
|
|
8838
8846
|
setError(err instanceof Error ? err.message : String(err));
|
|
8839
8847
|
} finally {
|
|
@@ -8868,6 +8876,49 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
|
|
|
8868
8876
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
|
|
8869
8877
|
"Smart Radius"
|
|
8870
8878
|
] }),
|
|
8879
|
+
canObject && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
8880
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
|
|
8881
|
+
"Object aware (segmentation model)"
|
|
8882
|
+
] }),
|
|
8883
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
8884
|
+
"Output to",
|
|
8885
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
8886
|
+
"select",
|
|
8887
|
+
{
|
|
8888
|
+
"aria-label": "Refine output",
|
|
8889
|
+
value: output,
|
|
8890
|
+
onChange: (e) => setOutput(e.target.value),
|
|
8891
|
+
className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
|
|
8892
|
+
children: import_image_editor15.REFINE_OUTPUTS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("option", { value: o.id, children: o.label }, o.id))
|
|
8893
|
+
}
|
|
8894
|
+
)
|
|
8895
|
+
] }),
|
|
8896
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
8897
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
|
|
8898
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { children: [
|
|
8899
|
+
"Decontaminate colors",
|
|
8900
|
+
toLayer ? "" : " (new layer outputs)"
|
|
8901
|
+
] }),
|
|
8902
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "font-mono", children: [
|
|
8903
|
+
decontaminate,
|
|
8904
|
+
"%"
|
|
8905
|
+
] })
|
|
8906
|
+
] }),
|
|
8907
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
8908
|
+
"input",
|
|
8909
|
+
{
|
|
8910
|
+
type: "range",
|
|
8911
|
+
min: 0,
|
|
8912
|
+
max: 100,
|
|
8913
|
+
step: 1,
|
|
8914
|
+
"aria-label": "Decontaminate amount",
|
|
8915
|
+
disabled: !toLayer,
|
|
8916
|
+
value: decontaminate,
|
|
8917
|
+
onChange: (e) => setDecontaminate(Number(e.target.value)),
|
|
8918
|
+
className: imageRangeClass
|
|
8919
|
+
}
|
|
8920
|
+
)
|
|
8921
|
+
] }),
|
|
8871
8922
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex gap-1", children: [
|
|
8872
8923
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", className: button2, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
|
|
8873
8924
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", className: button2, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
|
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.136.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.206.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.206.0"
|
|
309
309
|
},
|
|
310
310
|
"scripts": {
|
|
311
311
|
"build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",
|