@pixerate/editor-react 0.134.0 → 0.135.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,9 @@ 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 toLayer = output === "new-layer" || output === "new-layer-with-mask";
3189
3193
  const sel = selection === void 0 ? controller.getSelection() : selection;
3190
3194
  const list = layers ?? controller.getAdjustmentLayers();
3191
3195
  const target = list.find((l) => l.id === layerId) ?? list[list.length - 1];
@@ -3193,7 +3197,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3193
3197
  setBusy(true);
3194
3198
  setError(null);
3195
3199
  try {
3196
- await controller.refineSelection(params);
3200
+ await controller.refineSelectionTo(params, output, { decontaminate: toLayer ? decontaminate : 0 });
3197
3201
  } catch (err) {
3198
3202
  setError(err instanceof Error ? err.message : String(err));
3199
3203
  } finally {
@@ -3228,6 +3232,45 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3228
3232
  /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
3229
3233
  "Smart Radius"
3230
3234
  ] }),
3235
+ /* @__PURE__ */ jsxs14("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
3236
+ "Output to",
3237
+ /* @__PURE__ */ jsx16(
3238
+ "select",
3239
+ {
3240
+ "aria-label": "Refine output",
3241
+ value: output,
3242
+ onChange: (e) => setOutput(e.target.value),
3243
+ className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
3244
+ children: REFINE_OUTPUTS.map((o) => /* @__PURE__ */ jsx16("option", { value: o.id, children: o.label }, o.id))
3245
+ }
3246
+ )
3247
+ ] }),
3248
+ /* @__PURE__ */ jsxs14("label", { className: "flex flex-col gap-1", children: [
3249
+ /* @__PURE__ */ jsxs14("span", { className: "flex justify-between text-muted-foreground", children: [
3250
+ /* @__PURE__ */ jsxs14("span", { children: [
3251
+ "Decontaminate colors",
3252
+ toLayer ? "" : " (new layer outputs)"
3253
+ ] }),
3254
+ /* @__PURE__ */ jsxs14("span", { className: "font-mono", children: [
3255
+ decontaminate,
3256
+ "%"
3257
+ ] })
3258
+ ] }),
3259
+ /* @__PURE__ */ jsx16(
3260
+ "input",
3261
+ {
3262
+ type: "range",
3263
+ min: 0,
3264
+ max: 100,
3265
+ step: 1,
3266
+ "aria-label": "Decontaminate amount",
3267
+ disabled: !toLayer,
3268
+ value: decontaminate,
3269
+ onChange: (e) => setDecontaminate(Number(e.target.value)),
3270
+ className: imageRangeClass
3271
+ }
3272
+ )
3273
+ ] }),
3231
3274
  /* @__PURE__ */ jsxs14("div", { className: "flex gap-1", children: [
3232
3275
  /* @__PURE__ */ jsx16("button", { type: "button", className: button, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
3233
3276
  /* @__PURE__ */ jsx16("button", { type: "button", className: button, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
@@ -5112,6 +5112,9 @@ 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 toLayer = output === "new-layer" || output === "new-layer-with-mask";
5115
5118
  const sel = selection === void 0 ? controller.getSelection() : selection;
5116
5119
  const list = layers ?? controller.getAdjustmentLayers();
5117
5120
  const target = list.find((l) => l.id === layerId) ?? list[list.length - 1];
@@ -5119,7 +5122,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5119
5122
  setBusy(true);
5120
5123
  setError(null);
5121
5124
  try {
5122
- await controller.refineSelection(params);
5125
+ await controller.refineSelectionTo(params, output, { decontaminate: toLayer ? decontaminate : 0 });
5123
5126
  } catch (err) {
5124
5127
  setError(err instanceof Error ? err.message : String(err));
5125
5128
  } finally {
@@ -5154,6 +5157,45 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5154
5157
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
5155
5158
  "Smart Radius"
5156
5159
  ] }),
5160
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
5161
+ "Output to",
5162
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5163
+ "select",
5164
+ {
5165
+ "aria-label": "Refine output",
5166
+ value: output,
5167
+ onChange: (e) => setOutput(e.target.value),
5168
+ className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
5169
+ children: import_image_editor15.REFINE_OUTPUTS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("option", { value: o.id, children: o.label }, o.id))
5170
+ }
5171
+ )
5172
+ ] }),
5173
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "flex flex-col gap-1", children: [
5174
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
5175
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { children: [
5176
+ "Decontaminate colors",
5177
+ toLayer ? "" : " (new layer outputs)"
5178
+ ] }),
5179
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "font-mono", children: [
5180
+ decontaminate,
5181
+ "%"
5182
+ ] })
5183
+ ] }),
5184
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5185
+ "input",
5186
+ {
5187
+ type: "range",
5188
+ min: 0,
5189
+ max: 100,
5190
+ step: 1,
5191
+ "aria-label": "Decontaminate amount",
5192
+ disabled: !toLayer,
5193
+ value: decontaminate,
5194
+ onChange: (e) => setDecontaminate(Number(e.target.value)),
5195
+ className: imageRangeClass
5196
+ }
5197
+ )
5198
+ ] }),
5157
5199
  /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-1", children: [
5158
5200
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button2, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
5159
5201
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button2, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
@@ -27,7 +27,7 @@ import {
27
27
  useImageEditorControls,
28
28
  useImageEffectsTools,
29
29
  useImageHistogram
30
- } from "../chunk-KSNNMR22.js";
30
+ } from "../chunk-HHEBQE7D.js";
31
31
  import "../chunk-AJCWF6SN.js";
32
32
  import "../chunk-6BWTJ3EE.js";
33
33
  import "../chunk-5RPB4WGT.js";
package/dist/index.cjs CHANGED
@@ -8826,6 +8826,9 @@ 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 toLayer = output === "new-layer" || output === "new-layer-with-mask";
8829
8832
  const sel = selection === void 0 ? controller.getSelection() : selection;
8830
8833
  const list = layers ?? controller.getAdjustmentLayers();
8831
8834
  const target = list.find((l) => l.id === layerId) ?? list[list.length - 1];
@@ -8833,7 +8836,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
8833
8836
  setBusy(true);
8834
8837
  setError(null);
8835
8838
  try {
8836
- await controller.refineSelection(params);
8839
+ await controller.refineSelectionTo(params, output, { decontaminate: toLayer ? decontaminate : 0 });
8837
8840
  } catch (err) {
8838
8841
  setError(err instanceof Error ? err.message : String(err));
8839
8842
  } finally {
@@ -8868,6 +8871,45 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
8868
8871
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
8869
8872
  "Smart Radius"
8870
8873
  ] }),
8874
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
8875
+ "Output to",
8876
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
8877
+ "select",
8878
+ {
8879
+ "aria-label": "Refine output",
8880
+ value: output,
8881
+ onChange: (e) => setOutput(e.target.value),
8882
+ className: "flex-1 bg-background border border-border rounded px-1 py-1 text-foreground",
8883
+ children: import_image_editor15.REFINE_OUTPUTS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("option", { value: o.id, children: o.label }, o.id))
8884
+ }
8885
+ )
8886
+ ] }),
8887
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("label", { className: "flex flex-col gap-1", children: [
8888
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "flex justify-between text-muted-foreground", children: [
8889
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { children: [
8890
+ "Decontaminate colors",
8891
+ toLayer ? "" : " (new layer outputs)"
8892
+ ] }),
8893
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "font-mono", children: [
8894
+ decontaminate,
8895
+ "%"
8896
+ ] })
8897
+ ] }),
8898
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
8899
+ "input",
8900
+ {
8901
+ type: "range",
8902
+ min: 0,
8903
+ max: 100,
8904
+ step: 1,
8905
+ "aria-label": "Decontaminate amount",
8906
+ disabled: !toLayer,
8907
+ value: decontaminate,
8908
+ onChange: (e) => setDecontaminate(Number(e.target.value)),
8909
+ className: imageRangeClass
8910
+ }
8911
+ )
8912
+ ] }),
8871
8913
  /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex gap-1", children: [
8872
8914
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", className: button2, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
8873
8915
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", className: button2, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
package/dist/index.js CHANGED
@@ -51,7 +51,7 @@ import {
51
51
  useImageEditorControls,
52
52
  useImageEffectsTools,
53
53
  useImageHistogram
54
- } from "./chunk-KSNNMR22.js";
54
+ } from "./chunk-HHEBQE7D.js";
55
55
  import "./chunk-AJCWF6SN.js";
56
56
  import "./chunk-6BWTJ3EE.js";
57
57
  import "./chunk-5RPB4WGT.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-react",
3
- "version": "0.134.0",
3
+ "version": "0.135.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.201.0 <1.0.0-0",
257
+ "@pixerate/editor": ">=0.205.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.201.0"
308
+ "@pixerate/editor": "0.205.0"
309
309
  },
310
310
  "scripts": {
311
311
  "build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",