@pixerate/editor-react 0.133.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.
@@ -2755,6 +2755,21 @@ var SelectionOptionsBar = ({
2755
2755
  setSegmenting(false);
2756
2756
  }
2757
2757
  };
2758
+ const [skying, setSkying] = useState11(false);
2759
+ const [skyStatus, setSkyStatus] = useState11(null);
2760
+ const selectSky = async () => {
2761
+ if (skying) return;
2762
+ setSkying(true);
2763
+ setSkyStatus(null);
2764
+ try {
2765
+ const { note } = await controller.selectSky({ mode: options.mode });
2766
+ setSkyStatus(note ?? null);
2767
+ } catch (err) {
2768
+ setSkyStatus(err instanceof Error ? err.message : String(err));
2769
+ } finally {
2770
+ setSkying(false);
2771
+ }
2772
+ };
2758
2773
  const [focusing, setFocusing] = useState11(false);
2759
2774
  const [focusStatus, setFocusStatus] = useState11(null);
2760
2775
  const selectFocusArea = async () => {
@@ -3035,6 +3050,10 @@ var SelectionOptionsBar = ({
3035
3050
  ]
3036
3051
  }
3037
3052
  ),
3053
+ /* @__PURE__ */ jsxs13("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
3054
+ /* @__PURE__ */ jsx15("button", { type: "button", className: btn(false), disabled: skying, "aria-busy": skying, onClick: () => void selectSky(), children: skying ? "Selecting\u2026" : "Select Sky" }),
3055
+ skyStatus && /* @__PURE__ */ jsx15("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
3056
+ ] }),
3038
3057
  /* @__PURE__ */ jsxs13("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
3039
3058
  /* @__PURE__ */ jsx15("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
3040
3059
  /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-2 pt-2", children: [
@@ -3155,6 +3174,7 @@ import { useState as useState12 } from "react";
3155
3174
  import {
3156
3175
  ADJUSTMENT_KINDS as ADJUSTMENT_KINDS2,
3157
3176
  REFINE_EDGE_CONTROLS,
3177
+ REFINE_OUTPUTS,
3158
3178
  adjustmentKindLabel as adjustmentKindLabel2,
3159
3179
  layerMaskFromSelection
3160
3180
  } from "@pixerate/editor/image-editor";
@@ -3167,6 +3187,9 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3167
3187
  const [error, setError] = useState12(null);
3168
3188
  const [layerId, setLayerId] = useState12("");
3169
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";
3170
3193
  const sel = selection === void 0 ? controller.getSelection() : selection;
3171
3194
  const list = layers ?? controller.getAdjustmentLayers();
3172
3195
  const target = list.find((l) => l.id === layerId) ?? list[list.length - 1];
@@ -3174,7 +3197,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3174
3197
  setBusy(true);
3175
3198
  setError(null);
3176
3199
  try {
3177
- await controller.refineSelection(params);
3200
+ await controller.refineSelectionTo(params, output, { decontaminate: toLayer ? decontaminate : 0 });
3178
3201
  } catch (err) {
3179
3202
  setError(err instanceof Error ? err.message : String(err));
3180
3203
  } finally {
@@ -3209,6 +3232,45 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
3209
3232
  /* @__PURE__ */ jsx16("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
3210
3233
  "Smart Radius"
3211
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
+ ] }),
3212
3274
  /* @__PURE__ */ jsxs14("div", { className: "flex gap-1", children: [
3213
3275
  /* @__PURE__ */ jsx16("button", { type: "button", className: button, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
3214
3276
  /* @__PURE__ */ jsx16("button", { type: "button", className: button, onClick: () => setParams(DEFAULT_PARAMS), children: "Reset" })
@@ -4686,6 +4686,21 @@ var SelectionOptionsBar = ({
4686
4686
  setSegmenting(false);
4687
4687
  }
4688
4688
  };
4689
+ const [skying, setSkying] = (0, import_react25.useState)(false);
4690
+ const [skyStatus, setSkyStatus] = (0, import_react25.useState)(null);
4691
+ const selectSky = async () => {
4692
+ if (skying) return;
4693
+ setSkying(true);
4694
+ setSkyStatus(null);
4695
+ try {
4696
+ const { note } = await controller.selectSky({ mode: options.mode });
4697
+ setSkyStatus(note ?? null);
4698
+ } catch (err) {
4699
+ setSkyStatus(err instanceof Error ? err.message : String(err));
4700
+ } finally {
4701
+ setSkying(false);
4702
+ }
4703
+ };
4689
4704
  const [focusing, setFocusing] = (0, import_react25.useState)(false);
4690
4705
  const [focusStatus, setFocusStatus] = (0, import_react25.useState)(null);
4691
4706
  const selectFocusArea = async () => {
@@ -4966,6 +4981,10 @@ var SelectionOptionsBar = ({
4966
4981
  ]
4967
4982
  }
4968
4983
  ),
4984
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
4985
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", className: btn(false), disabled: skying, "aria-busy": skying, onClick: () => void selectSky(), children: skying ? "Selecting\u2026" : "Select Sky" }),
4986
+ skyStatus && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
4987
+ ] }),
4969
4988
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
4970
4989
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
4971
4990
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-2 pt-2", children: [
@@ -5093,6 +5112,9 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5093
5112
  const [error, setError] = (0, import_react26.useState)(null);
5094
5113
  const [layerId, setLayerId] = (0, import_react26.useState)("");
5095
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";
5096
5118
  const sel = selection === void 0 ? controller.getSelection() : selection;
5097
5119
  const list = layers ?? controller.getAdjustmentLayers();
5098
5120
  const target = list.find((l) => l.id === layerId) ?? list[list.length - 1];
@@ -5100,7 +5122,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5100
5122
  setBusy(true);
5101
5123
  setError(null);
5102
5124
  try {
5103
- await controller.refineSelection(params);
5125
+ await controller.refineSelectionTo(params, output, { decontaminate: toLayer ? decontaminate : 0 });
5104
5126
  } catch (err) {
5105
5127
  setError(err instanceof Error ? err.message : String(err));
5106
5128
  } finally {
@@ -5135,6 +5157,45 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
5135
5157
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
5136
5158
  "Smart Radius"
5137
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
+ ] }),
5138
5199
  /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-1", children: [
5139
5200
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { type: "button", className: button2, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
5140
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-PJKBVUYL.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
@@ -8400,6 +8400,21 @@ var SelectionOptionsBar = ({
8400
8400
  setSegmenting(false);
8401
8401
  }
8402
8402
  };
8403
+ const [skying, setSkying] = (0, import_react61.useState)(false);
8404
+ const [skyStatus, setSkyStatus] = (0, import_react61.useState)(null);
8405
+ const selectSky = async () => {
8406
+ if (skying) return;
8407
+ setSkying(true);
8408
+ setSkyStatus(null);
8409
+ try {
8410
+ const { note } = await controller.selectSky({ mode: options.mode });
8411
+ setSkyStatus(note ?? null);
8412
+ } catch (err) {
8413
+ setSkyStatus(err instanceof Error ? err.message : String(err));
8414
+ } finally {
8415
+ setSkying(false);
8416
+ }
8417
+ };
8403
8418
  const [focusing, setFocusing] = (0, import_react61.useState)(false);
8404
8419
  const [focusStatus, setFocusStatus] = (0, import_react61.useState)(null);
8405
8420
  const selectFocusArea = async () => {
@@ -8680,6 +8695,10 @@ var SelectionOptionsBar = ({
8680
8695
  ]
8681
8696
  }
8682
8697
  ),
8698
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { "data-testid": "select-sky", className: "flex flex-col gap-1", children: [
8699
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("button", { type: "button", className: btn(false), disabled: skying, "aria-busy": skying, onClick: () => void selectSky(), children: skying ? "Selecting\u2026" : "Select Sky" }),
8700
+ skyStatus && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { role: "status", className: "text-muted-foreground", children: skyStatus })
8701
+ ] }),
8683
8702
  /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("details", { "data-testid": "focus-area", className: "flex flex-col gap-2", children: [
8684
8703
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("summary", { className: "cursor-pointer text-foreground", children: "Focus Area" }),
8685
8704
  /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col gap-2 pt-2", children: [
@@ -8807,6 +8826,9 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
8807
8826
  const [error, setError] = (0, import_react62.useState)(null);
8808
8827
  const [layerId, setLayerId] = (0, import_react62.useState)("");
8809
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";
8810
8832
  const sel = selection === void 0 ? controller.getSelection() : selection;
8811
8833
  const list = layers ?? controller.getAdjustmentLayers();
8812
8834
  const target = list.find((l) => l.id === layerId) ?? list[list.length - 1];
@@ -8814,7 +8836,7 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
8814
8836
  setBusy(true);
8815
8837
  setError(null);
8816
8838
  try {
8817
- await controller.refineSelection(params);
8839
+ await controller.refineSelectionTo(params, output, { decontaminate: toLayer ? decontaminate : 0 });
8818
8840
  } catch (err) {
8819
8841
  setError(err instanceof Error ? err.message : String(err));
8820
8842
  } finally {
@@ -8849,6 +8871,45 @@ var RefineEdgePanel = ({ controller, selection, layers, className = "" }) => {
8849
8871
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("input", { type: "checkbox", checked: params.smartRadius, onChange: (e) => setParams({ ...params, smartRadius: e.target.checked }) }),
8850
8872
  "Smart Radius"
8851
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
+ ] }),
8852
8913
  /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex gap-1", children: [
8853
8914
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("button", { type: "button", className: button2, disabled: !sel || busy, onClick: refine, children: "Refine Edge" }),
8854
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-PJKBVUYL.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.133.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.200.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.200.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",