@pixerate/editor-react 0.130.0 → 0.132.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.
|
@@ -2742,12 +2742,13 @@ var SelectionOptionsBar = ({
|
|
|
2742
2742
|
const [subjectStatus, setSubjectStatus] = useState11(null);
|
|
2743
2743
|
const selectSubject = async () => {
|
|
2744
2744
|
const target = subject.trim();
|
|
2745
|
-
|
|
2745
|
+
const canSegment = Boolean(controller.segmentationProvider);
|
|
2746
|
+
if (canSegment && !target || segmenting) return;
|
|
2746
2747
|
setSegmenting(true);
|
|
2747
2748
|
setSubjectStatus(null);
|
|
2748
2749
|
try {
|
|
2749
|
-
const { segments } = await controller.selectSubject(target, { mode: options.mode });
|
|
2750
|
-
setSubjectStatus(segments.length ? null : `Nothing matching \u201C${target}\u201D was found.`);
|
|
2750
|
+
const { segments, method, note } = await controller.selectSubject(canSegment ? target : "", { mode: options.mode });
|
|
2751
|
+
setSubjectStatus(segments.length ? null : method === "saliency" ? note ?? "Nothing stands out from the background." : `Nothing matching \u201C${target}\u201D was found.`);
|
|
2751
2752
|
} catch (err) {
|
|
2752
2753
|
setSubjectStatus(err instanceof Error ? err.message : String(err));
|
|
2753
2754
|
} finally {
|
|
@@ -2856,6 +2857,17 @@ var SelectionOptionsBar = ({
|
|
|
2856
2857
|
"Auto-enhance edges"
|
|
2857
2858
|
] })
|
|
2858
2859
|
] }),
|
|
2860
|
+
options.tool === "object" && /* @__PURE__ */ jsxs13("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
|
|
2861
|
+
/* @__PURE__ */ jsx15("p", { className: "text-muted-foreground", children: "Drag a box loosely around an object, or click on it. Shift adds, Alt subtracts." }),
|
|
2862
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2863
|
+
/* @__PURE__ */ jsx15(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
|
|
2864
|
+
"Sample all layers"
|
|
2865
|
+
] }),
|
|
2866
|
+
/* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
2867
|
+
/* @__PURE__ */ jsx15(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
|
|
2868
|
+
"Auto-enhance edges"
|
|
2869
|
+
] })
|
|
2870
|
+
] }),
|
|
2859
2871
|
(options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ jsxs13("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
|
|
2860
2872
|
/* @__PURE__ */ jsxs13("p", { className: "text-muted-foreground", children: [
|
|
2861
2873
|
options.tool === "type-vertical" ? "Click where the column starts: the letters are stacked down from there, centred on the click." : "Click where the text starts (its baseline).",
|
|
@@ -2964,7 +2976,7 @@ var SelectionOptionsBar = ({
|
|
|
2964
2976
|
),
|
|
2965
2977
|
"px"
|
|
2966
2978
|
] }),
|
|
2967
|
-
|
|
2979
|
+
/* @__PURE__ */ jsxs13(
|
|
2968
2980
|
"form",
|
|
2969
2981
|
{
|
|
2970
2982
|
"data-testid": "select-subject",
|
|
@@ -2975,7 +2987,7 @@ var SelectionOptionsBar = ({
|
|
|
2975
2987
|
},
|
|
2976
2988
|
children: [
|
|
2977
2989
|
/* @__PURE__ */ jsxs13("div", { className: "flex gap-1", children: [
|
|
2978
|
-
/* @__PURE__ */ jsx15(
|
|
2990
|
+
controller.segmentationProvider && /* @__PURE__ */ jsx15(
|
|
2979
2991
|
"input",
|
|
2980
2992
|
{
|
|
2981
2993
|
type: "text",
|
|
@@ -2987,7 +2999,17 @@ var SelectionOptionsBar = ({
|
|
|
2987
2999
|
className: "min-w-0 flex-1 bg-background border border-border rounded px-2 py-1 text-foreground"
|
|
2988
3000
|
}
|
|
2989
3001
|
),
|
|
2990
|
-
/* @__PURE__ */ jsx15(
|
|
3002
|
+
/* @__PURE__ */ jsx15(
|
|
3003
|
+
"button",
|
|
3004
|
+
{
|
|
3005
|
+
type: "submit",
|
|
3006
|
+
className: btn(false),
|
|
3007
|
+
disabled: segmenting || Boolean(controller.segmentationProvider) && !subject.trim(),
|
|
3008
|
+
"aria-busy": segmenting,
|
|
3009
|
+
title: controller.segmentationProvider ? void 0 : "Selects the subject that stands out most (no segmentation model is set)",
|
|
3010
|
+
children: segmenting ? "Selecting\u2026" : "Select Subject"
|
|
3011
|
+
}
|
|
3012
|
+
)
|
|
2991
3013
|
] }),
|
|
2992
3014
|
subjectStatus && /* @__PURE__ */ jsx15("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
|
|
2993
3015
|
]
|
|
@@ -4673,12 +4673,13 @@ var SelectionOptionsBar = ({
|
|
|
4673
4673
|
const [subjectStatus, setSubjectStatus] = (0, import_react25.useState)(null);
|
|
4674
4674
|
const selectSubject = async () => {
|
|
4675
4675
|
const target = subject.trim();
|
|
4676
|
-
|
|
4676
|
+
const canSegment = Boolean(controller.segmentationProvider);
|
|
4677
|
+
if (canSegment && !target || segmenting) return;
|
|
4677
4678
|
setSegmenting(true);
|
|
4678
4679
|
setSubjectStatus(null);
|
|
4679
4680
|
try {
|
|
4680
|
-
const { segments } = await controller.selectSubject(target, { mode: options.mode });
|
|
4681
|
-
setSubjectStatus(segments.length ? null : `Nothing matching \u201C${target}\u201D was found.`);
|
|
4681
|
+
const { segments, method, note } = await controller.selectSubject(canSegment ? target : "", { mode: options.mode });
|
|
4682
|
+
setSubjectStatus(segments.length ? null : method === "saliency" ? note ?? "Nothing stands out from the background." : `Nothing matching \u201C${target}\u201D was found.`);
|
|
4682
4683
|
} catch (err) {
|
|
4683
4684
|
setSubjectStatus(err instanceof Error ? err.message : String(err));
|
|
4684
4685
|
} finally {
|
|
@@ -4787,6 +4788,17 @@ var SelectionOptionsBar = ({
|
|
|
4787
4788
|
"Auto-enhance edges"
|
|
4788
4789
|
] })
|
|
4789
4790
|
] }),
|
|
4791
|
+
options.tool === "object" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
|
|
4792
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-muted-foreground", children: "Drag a box loosely around an object, or click on it. Shift adds, Alt subtracts." }),
|
|
4793
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4794
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
|
|
4795
|
+
"Sample all layers"
|
|
4796
|
+
] }),
|
|
4797
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
4798
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
|
|
4799
|
+
"Auto-enhance edges"
|
|
4800
|
+
] })
|
|
4801
|
+
] }),
|
|
4790
4802
|
(options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
|
|
4791
4803
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("p", { className: "text-muted-foreground", children: [
|
|
4792
4804
|
options.tool === "type-vertical" ? "Click where the column starts: the letters are stacked down from there, centred on the click." : "Click where the text starts (its baseline).",
|
|
@@ -4895,7 +4907,7 @@ var SelectionOptionsBar = ({
|
|
|
4895
4907
|
),
|
|
4896
4908
|
"px"
|
|
4897
4909
|
] }),
|
|
4898
|
-
|
|
4910
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
4899
4911
|
"form",
|
|
4900
4912
|
{
|
|
4901
4913
|
"data-testid": "select-subject",
|
|
@@ -4906,7 +4918,7 @@ var SelectionOptionsBar = ({
|
|
|
4906
4918
|
},
|
|
4907
4919
|
children: [
|
|
4908
4920
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex gap-1", children: [
|
|
4909
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4921
|
+
controller.segmentationProvider && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4910
4922
|
"input",
|
|
4911
4923
|
{
|
|
4912
4924
|
type: "text",
|
|
@@ -4918,7 +4930,17 @@ var SelectionOptionsBar = ({
|
|
|
4918
4930
|
className: "min-w-0 flex-1 bg-background border border-border rounded px-2 py-1 text-foreground"
|
|
4919
4931
|
}
|
|
4920
4932
|
),
|
|
4921
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4933
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4934
|
+
"button",
|
|
4935
|
+
{
|
|
4936
|
+
type: "submit",
|
|
4937
|
+
className: btn(false),
|
|
4938
|
+
disabled: segmenting || Boolean(controller.segmentationProvider) && !subject.trim(),
|
|
4939
|
+
"aria-busy": segmenting,
|
|
4940
|
+
title: controller.segmentationProvider ? void 0 : "Selects the subject that stands out most (no segmentation model is set)",
|
|
4941
|
+
children: segmenting ? "Selecting\u2026" : "Select Subject"
|
|
4942
|
+
}
|
|
4943
|
+
)
|
|
4922
4944
|
] }),
|
|
4923
4945
|
subjectStatus && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
|
|
4924
4946
|
]
|
package/dist/index.cjs
CHANGED
|
@@ -8387,12 +8387,13 @@ var SelectionOptionsBar = ({
|
|
|
8387
8387
|
const [subjectStatus, setSubjectStatus] = (0, import_react61.useState)(null);
|
|
8388
8388
|
const selectSubject = async () => {
|
|
8389
8389
|
const target = subject.trim();
|
|
8390
|
-
|
|
8390
|
+
const canSegment = Boolean(controller.segmentationProvider);
|
|
8391
|
+
if (canSegment && !target || segmenting) return;
|
|
8391
8392
|
setSegmenting(true);
|
|
8392
8393
|
setSubjectStatus(null);
|
|
8393
8394
|
try {
|
|
8394
|
-
const { segments } = await controller.selectSubject(target, { mode: options.mode });
|
|
8395
|
-
setSubjectStatus(segments.length ? null : `Nothing matching \u201C${target}\u201D was found.`);
|
|
8395
|
+
const { segments, method, note } = await controller.selectSubject(canSegment ? target : "", { mode: options.mode });
|
|
8396
|
+
setSubjectStatus(segments.length ? null : method === "saliency" ? note ?? "Nothing stands out from the background." : `Nothing matching \u201C${target}\u201D was found.`);
|
|
8396
8397
|
} catch (err) {
|
|
8397
8398
|
setSubjectStatus(err instanceof Error ? err.message : String(err));
|
|
8398
8399
|
} finally {
|
|
@@ -8501,6 +8502,17 @@ var SelectionOptionsBar = ({
|
|
|
8501
8502
|
"Auto-enhance edges"
|
|
8502
8503
|
] })
|
|
8503
8504
|
] }),
|
|
8505
|
+
options.tool === "object" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { "data-testid": "object-selection-options", className: "flex flex-col gap-2", children: [
|
|
8506
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-muted-foreground", children: "Drag a box loosely around an object, or click on it. Shift adds, Alt subtracts." }),
|
|
8507
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
8508
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ImageCheckbox, { label: "Object sample all layers", checked: options.objectSampleAll ?? true, onChange: (on) => set({ objectSampleAll: on }) }),
|
|
8509
|
+
"Sample all layers"
|
|
8510
|
+
] }),
|
|
8511
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-2 text-foreground", children: [
|
|
8512
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ImageCheckbox, { label: "Object auto-enhance edges", checked: options.objectEnhance ?? false, onChange: (on) => set({ objectEnhance: on }) }),
|
|
8513
|
+
"Auto-enhance edges"
|
|
8514
|
+
] })
|
|
8515
|
+
] }),
|
|
8504
8516
|
(options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
|
|
8505
8517
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("p", { className: "text-muted-foreground", children: [
|
|
8506
8518
|
options.tool === "type-vertical" ? "Click where the column starts: the letters are stacked down from there, centred on the click." : "Click where the text starts (its baseline).",
|
|
@@ -8609,7 +8621,7 @@ var SelectionOptionsBar = ({
|
|
|
8609
8621
|
),
|
|
8610
8622
|
"px"
|
|
8611
8623
|
] }),
|
|
8612
|
-
|
|
8624
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
8613
8625
|
"form",
|
|
8614
8626
|
{
|
|
8615
8627
|
"data-testid": "select-subject",
|
|
@@ -8620,7 +8632,7 @@ var SelectionOptionsBar = ({
|
|
|
8620
8632
|
},
|
|
8621
8633
|
children: [
|
|
8622
8634
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex gap-1", children: [
|
|
8623
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8635
|
+
controller.segmentationProvider && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8624
8636
|
"input",
|
|
8625
8637
|
{
|
|
8626
8638
|
type: "text",
|
|
@@ -8632,7 +8644,17 @@ var SelectionOptionsBar = ({
|
|
|
8632
8644
|
className: "min-w-0 flex-1 bg-background border border-border rounded px-2 py-1 text-foreground"
|
|
8633
8645
|
}
|
|
8634
8646
|
),
|
|
8635
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8647
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
8648
|
+
"button",
|
|
8649
|
+
{
|
|
8650
|
+
type: "submit",
|
|
8651
|
+
className: btn(false),
|
|
8652
|
+
disabled: segmenting || Boolean(controller.segmentationProvider) && !subject.trim(),
|
|
8653
|
+
"aria-busy": segmenting,
|
|
8654
|
+
title: controller.segmentationProvider ? void 0 : "Selects the subject that stands out most (no segmentation model is set)",
|
|
8655
|
+
children: segmenting ? "Selecting\u2026" : "Select Subject"
|
|
8656
|
+
}
|
|
8657
|
+
)
|
|
8636
8658
|
] }),
|
|
8637
8659
|
subjectStatus && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { role: "status", className: "text-muted-foreground", children: subjectStatus })
|
|
8638
8660
|
]
|
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.132.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.199.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.199.0"
|
|
309
309
|
},
|
|
310
310
|
"scripts": {
|
|
311
311
|
"build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",
|