@pixerate/editor-svelte 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.
@@ -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
- subjectStatus = segments.length ? null : `Nothing matching “${target}” was found.`;
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 {
@@ -357,16 +358,16 @@
357
358
  />
358
359
  px
359
360
  </label>
360
- {#if canSegment}
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">
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}
370
371
  <input
371
372
  type="text"
372
373
  aria-label="Subject to select"
@@ -375,15 +376,21 @@
375
376
  disabled={segmenting}
376
377
  class="min-w-0 flex-1 bg-background border border-border rounded px-2 py-1 text-foreground"
377
378
  />
378
- <button type="submit" class={btn(false)} disabled={segmenting || !subject.trim()} aria-busy={segmenting}>
379
- {segmenting ? 'Selecting…' : 'Select Subject'}
380
- </button>
381
- </div>
382
- {#if subjectStatus}
383
- <p role="status" class="text-muted-foreground">{subjectStatus}</p>
384
379
  {/if}
385
- </form>
386
- {/if}
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>
387
394
  <label class="flex items-center gap-2 text-foreground">
388
395
  <ImageCheckbox label="Anti-alias" checked={options.antiAlias} onchange={(on) => set({ antiAlias: on })} />
389
396
  Anti-alias
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-svelte",
3
- "version": "0.145.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.198.0"
168
+ "@pixerate/editor": "0.199.0"
169
169
  },
170
170
  "peerDependencies": {
171
171
  "@dagrejs/dagre": "^1.1.4",