@pixerate/editor-react 0.145.0 → 0.146.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.
@@ -3887,6 +3887,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3887
3887
  const [output, setOutput] = useState16("selection");
3888
3888
  const [decontaminate, setDecontaminate] = useState16(0);
3889
3889
  const [objectAware, setObjectAware] = useState16(false);
3890
+ const [onlyUncertain, setOnlyUncertain] = useState16(false);
3890
3891
  const canObject = Boolean(controller.segmentationProvider);
3891
3892
  const toLayer = output !== "selection" && output !== "layer-mask";
3892
3893
  const sel = selection === void 0 ? controller.getSelection() : selection;
@@ -3896,9 +3897,12 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3896
3897
  setBusy(true);
3897
3898
  setError(null);
3898
3899
  try {
3900
+ const regions = onlyUncertain ? controller.selectionUncertainty().regions.map((r) => r.bounds) : void 0;
3901
+ if (regions && !regions.length) throw new Error("No uncertain areas: the selection's edge already follows edges in the image. Untick Only uncertain areas to refine everywhere.");
3899
3902
  await controller.refineSelectionTo(params, output, {
3900
3903
  decontaminate: toLayer ? decontaminate : 0,
3901
- refineMode: canObject && objectAware ? "object" : "color"
3904
+ refineMode: canObject && objectAware ? "object" : "color",
3905
+ ...regions ? { regions } : {}
3902
3906
  });
3903
3907
  } catch (err) {
3904
3908
  setError(err instanceof Error ? err.message : String(err));
@@ -3934,6 +3938,10 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3934
3938
  /* @__PURE__ */ jsx20("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
3935
3939
  "Smart Radius"
3936
3940
  ] }),
3941
+ /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
3942
+ /* @__PURE__ */ jsx20("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
3943
+ "Only uncertain areas"
3944
+ ] }),
3937
3945
  canObject && /* @__PURE__ */ jsxs18("label", { className: "flex items-center gap-2 text-foreground", children: [
3938
3946
  /* @__PURE__ */ jsx20("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
3939
3947
  "Object aware (segmentation model)"
@@ -5814,6 +5814,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5814
5814
  const [output, setOutput] = (0, import_react30.useState)("selection");
5815
5815
  const [decontaminate, setDecontaminate] = (0, import_react30.useState)(0);
5816
5816
  const [objectAware, setObjectAware] = (0, import_react30.useState)(false);
5817
+ const [onlyUncertain, setOnlyUncertain] = (0, import_react30.useState)(false);
5817
5818
  const canObject = Boolean(controller.segmentationProvider);
5818
5819
  const toLayer = output !== "selection" && output !== "layer-mask";
5819
5820
  const sel = selection === void 0 ? controller.getSelection() : selection;
@@ -5823,9 +5824,12 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5823
5824
  setBusy(true);
5824
5825
  setError(null);
5825
5826
  try {
5827
+ const regions = onlyUncertain ? controller.selectionUncertainty().regions.map((r) => r.bounds) : void 0;
5828
+ if (regions && !regions.length) throw new Error("No uncertain areas: the selection's edge already follows edges in the image. Untick Only uncertain areas to refine everywhere.");
5826
5829
  await controller.refineSelectionTo(params, output, {
5827
5830
  decontaminate: toLayer ? decontaminate : 0,
5828
- refineMode: canObject && objectAware ? "object" : "color"
5831
+ refineMode: canObject && objectAware ? "object" : "color",
5832
+ ...regions ? { regions } : {}
5829
5833
  });
5830
5834
  } catch (err) {
5831
5835
  setError(err instanceof Error ? err.message : String(err));
@@ -5861,6 +5865,10 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5861
5865
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
5862
5866
  "Smart Radius"
5863
5867
  ] }),
5868
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
5869
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
5870
+ "Only uncertain areas"
5871
+ ] }),
5864
5872
  canObject && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
5865
5873
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
5866
5874
  "Object aware (segmentation model)"
@@ -32,7 +32,7 @@ import {
32
32
  useImageEditorControls,
33
33
  useImageEffectsTools,
34
34
  useImageHistogram
35
- } from "../chunk-3VQ34CNX.js";
35
+ } from "../chunk-3E32BAYS.js";
36
36
  import "../chunk-AJCWF6SN.js";
37
37
  import "../chunk-6BWTJ3EE.js";
38
38
  import "../chunk-5RPB4WGT.js";
package/dist/index.cjs CHANGED
@@ -9528,6 +9528,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9528
9528
  const [output, setOutput] = (0, import_react66.useState)("selection");
9529
9529
  const [decontaminate, setDecontaminate] = (0, import_react66.useState)(0);
9530
9530
  const [objectAware, setObjectAware] = (0, import_react66.useState)(false);
9531
+ const [onlyUncertain, setOnlyUncertain] = (0, import_react66.useState)(false);
9531
9532
  const canObject = Boolean(controller.segmentationProvider);
9532
9533
  const toLayer = output !== "selection" && output !== "layer-mask";
9533
9534
  const sel = selection === void 0 ? controller.getSelection() : selection;
@@ -9537,9 +9538,12 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9537
9538
  setBusy(true);
9538
9539
  setError(null);
9539
9540
  try {
9541
+ const regions = onlyUncertain ? controller.selectionUncertainty().regions.map((r) => r.bounds) : void 0;
9542
+ if (regions && !regions.length) throw new Error("No uncertain areas: the selection's edge already follows edges in the image. Untick Only uncertain areas to refine everywhere.");
9540
9543
  await controller.refineSelectionTo(params, output, {
9541
9544
  decontaminate: toLayer ? decontaminate : 0,
9542
- refineMode: canObject && objectAware ? "object" : "color"
9545
+ refineMode: canObject && objectAware ? "object" : "color",
9546
+ ...regions ? { regions } : {}
9543
9547
  });
9544
9548
  } catch (err) {
9545
9549
  setError(err instanceof Error ? err.message : String(err));
@@ -9575,6 +9579,10 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
9575
9579
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
9576
9580
  "Smart Radius"
9577
9581
  ] }),
9582
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "flex items-center gap-2 text-foreground", title: "Refine only where the edge has no image edge under it", children: [
9583
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("input", { type: "checkbox", "aria-label": "Only uncertain areas", checked: onlyUncertain, onChange: (e) => setOnlyUncertain(e.target.checked) }),
9584
+ "Only uncertain areas"
9585
+ ] }),
9578
9586
  canObject && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
9579
9587
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("input", { type: "checkbox", "aria-label": "Object aware", checked: objectAware, onChange: (e) => setObjectAware(e.target.checked) }),
9580
9588
  "Object aware (segmentation model)"
package/dist/index.js CHANGED
@@ -56,7 +56,7 @@ import {
56
56
  useImageEditorControls,
57
57
  useImageEffectsTools,
58
58
  useImageHistogram
59
- } from "./chunk-3VQ34CNX.js";
59
+ } from "./chunk-3E32BAYS.js";
60
60
  import "./chunk-AJCWF6SN.js";
61
61
  import "./chunk-6BWTJ3EE.js";
62
62
  import "./chunk-5RPB4WGT.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-react",
3
- "version": "0.145.0",
3
+ "version": "0.146.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.215.0 <1.0.0-0",
257
+ "@pixerate/editor": ">=0.216.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.215.0"
308
+ "@pixerate/editor": "0.216.0"
309
309
  },
310
310
  "scripts": {
311
311
  "build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",