@pixerate/editor-svelte 0.144.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.
|
@@ -111,12 +111,13 @@
|
|
|
111
111
|
let subjectStatus = $state<string | null>(null);
|
|
112
112
|
async function selectSubject() {
|
|
113
113
|
const target = subject.trim();
|
|
114
|
-
if (!target || segmenting) return;
|
|
114
|
+
if ((canSegment && !target) || segmenting) return;
|
|
115
115
|
segmenting = true;
|
|
116
116
|
subjectStatus = null;
|
|
117
117
|
try {
|
|
118
|
-
const { segments } = await controller.selectSubject(target, { mode: options.mode });
|
|
119
|
-
|
|
118
|
+
const { segments, method, note } = await controller.selectSubject(canSegment ? target : '', { mode: options.mode });
|
|
119
|
+
// Without a model, say only when nothing stood out.
|
|
120
|
+
subjectStatus = segments.length ? null : method === 'saliency' ? (note ?? 'Nothing stands out from the background.') : `Nothing matching “${target}” was found.`;
|
|
120
121
|
} catch (err) {
|
|
121
122
|
subjectStatus = err instanceof Error ? err.message : String(err);
|
|
122
123
|
} finally {
|
|
@@ -249,6 +250,19 @@
|
|
|
249
250
|
</label>
|
|
250
251
|
</div>
|
|
251
252
|
{/if}
|
|
253
|
+
{#if options.tool === 'object'}
|
|
254
|
+
<div data-testid="object-selection-options" class="flex flex-col gap-2">
|
|
255
|
+
<p class="text-muted-foreground">Drag a box loosely around an object, or click on it. Shift adds, Alt subtracts.</p>
|
|
256
|
+
<label class="flex items-center gap-2 text-foreground">
|
|
257
|
+
<ImageCheckbox label="Object sample all layers" checked={options.objectSampleAll ?? true} onchange={(on) => set({ objectSampleAll: on })} />
|
|
258
|
+
Sample all layers
|
|
259
|
+
</label>
|
|
260
|
+
<label class="flex items-center gap-2 text-foreground">
|
|
261
|
+
<ImageCheckbox label="Object auto-enhance edges" checked={options.objectEnhance ?? false} onchange={(on) => set({ objectEnhance: on })} />
|
|
262
|
+
Auto-enhance edges
|
|
263
|
+
</label>
|
|
264
|
+
</div>
|
|
265
|
+
{/if}
|
|
252
266
|
{#if options.tool === 'type' || options.tool === 'type-vertical'}
|
|
253
267
|
<div data-testid="type-mask-options" class="flex flex-col gap-2">
|
|
254
268
|
<p class="text-muted-foreground">
|
|
@@ -344,16 +358,16 @@
|
|
|
344
358
|
/>
|
|
345
359
|
px
|
|
346
360
|
</label>
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
>
|
|
356
|
-
|
|
361
|
+
<form
|
|
362
|
+
data-testid="select-subject"
|
|
363
|
+
class="flex flex-col gap-1"
|
|
364
|
+
onsubmit={(e) => {
|
|
365
|
+
e.preventDefault();
|
|
366
|
+
void selectSubject();
|
|
367
|
+
}}
|
|
368
|
+
>
|
|
369
|
+
<div class="flex gap-1">
|
|
370
|
+
{#if canSegment}
|
|
357
371
|
<input
|
|
358
372
|
type="text"
|
|
359
373
|
aria-label="Subject to select"
|
|
@@ -362,15 +376,21 @@
|
|
|
362
376
|
disabled={segmenting}
|
|
363
377
|
class="min-w-0 flex-1 bg-background border border-border rounded px-2 py-1 text-foreground"
|
|
364
378
|
/>
|
|
365
|
-
<button type="submit" class={btn(false)} disabled={segmenting || !subject.trim()} aria-busy={segmenting}>
|
|
366
|
-
{segmenting ? 'Selecting…' : 'Select Subject'}
|
|
367
|
-
</button>
|
|
368
|
-
</div>
|
|
369
|
-
{#if subjectStatus}
|
|
370
|
-
<p role="status" class="text-muted-foreground">{subjectStatus}</p>
|
|
371
379
|
{/if}
|
|
372
|
-
|
|
373
|
-
|
|
380
|
+
<button
|
|
381
|
+
type="submit"
|
|
382
|
+
class={btn(false)}
|
|
383
|
+
disabled={segmenting || (canSegment && !subject.trim())}
|
|
384
|
+
aria-busy={segmenting}
|
|
385
|
+
title={canSegment ? undefined : 'Selects the subject that stands out most (no segmentation model is set)'}
|
|
386
|
+
>
|
|
387
|
+
{segmenting ? 'Selecting…' : 'Select Subject'}
|
|
388
|
+
</button>
|
|
389
|
+
</div>
|
|
390
|
+
{#if subjectStatus}
|
|
391
|
+
<p role="status" class="text-muted-foreground">{subjectStatus}</p>
|
|
392
|
+
{/if}
|
|
393
|
+
</form>
|
|
374
394
|
<label class="flex items-center gap-2 text-foreground">
|
|
375
395
|
<ImageCheckbox label="Anti-alias" checked={options.antiAlias} onchange={(on) => set({ antiAlias: on })} />
|
|
376
396
|
Anti-alias
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor-svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.146.0",
|
|
4
4
|
"description": "Svelte bindings and prompt/rich-text components for @pixerate/editor",
|
|
5
5
|
"author": "Pixerate",
|
|
6
6
|
"license": "MIT",
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
"**/*.css"
|
|
166
166
|
],
|
|
167
167
|
"dependencies": {
|
|
168
|
-
"@pixerate/editor": "0.
|
|
168
|
+
"@pixerate/editor": "0.199.0"
|
|
169
169
|
},
|
|
170
170
|
"peerDependencies": {
|
|
171
171
|
"@dagrejs/dagre": "^1.1.4",
|