@pixerate/editor-svelte 0.146.0 → 0.148.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.
|
@@ -109,6 +109,41 @@
|
|
|
109
109
|
let subject = $state('');
|
|
110
110
|
let segmenting = $state(false);
|
|
111
111
|
let subjectStatus = $state<string | null>(null);
|
|
112
|
+
let skying = $state(false);
|
|
113
|
+
let skyStatus = $state<string | null>(null);
|
|
114
|
+
async function selectSky() {
|
|
115
|
+
if (skying) return;
|
|
116
|
+
skying = true;
|
|
117
|
+
skyStatus = null;
|
|
118
|
+
try {
|
|
119
|
+
const { note } = await controller.selectSky({ mode: options.mode });
|
|
120
|
+
skyStatus = note ?? null;
|
|
121
|
+
} catch (err) {
|
|
122
|
+
skyStatus = err instanceof Error ? err.message : String(err);
|
|
123
|
+
} finally {
|
|
124
|
+
skying = false;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
let focusing = $state(false);
|
|
128
|
+
let focusStatus = $state<string | null>(null);
|
|
129
|
+
async function selectFocusArea() {
|
|
130
|
+
if (focusing) return;
|
|
131
|
+
focusing = true;
|
|
132
|
+
focusStatus = null;
|
|
133
|
+
try {
|
|
134
|
+
const { selection } = await controller.selectFocusArea({
|
|
135
|
+
range: options.focusRange ?? 50,
|
|
136
|
+
noise: options.focusNoise ?? 0,
|
|
137
|
+
softness: options.focusSoftness ?? 4,
|
|
138
|
+
mode: options.mode,
|
|
139
|
+
});
|
|
140
|
+
focusStatus = selection ? null : 'No part of the image stands out as in focus.';
|
|
141
|
+
} catch (err) {
|
|
142
|
+
focusStatus = err instanceof Error ? err.message : String(err);
|
|
143
|
+
} finally {
|
|
144
|
+
focusing = false;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
112
147
|
async function selectSubject() {
|
|
113
148
|
const target = subject.trim();
|
|
114
149
|
if ((canSegment && !target) || segmenting) return;
|
|
@@ -391,6 +426,46 @@
|
|
|
391
426
|
<p role="status" class="text-muted-foreground">{subjectStatus}</p>
|
|
392
427
|
{/if}
|
|
393
428
|
</form>
|
|
429
|
+
<div data-testid="select-sky" class="flex flex-col gap-1">
|
|
430
|
+
<button type="button" class={btn(false)} disabled={skying} aria-busy={skying} onclick={() => void selectSky()}>
|
|
431
|
+
{skying ? 'Selecting…' : 'Select Sky'}
|
|
432
|
+
</button>
|
|
433
|
+
{#if skyStatus}
|
|
434
|
+
<p role="status" class="text-muted-foreground">{skyStatus}</p>
|
|
435
|
+
{/if}
|
|
436
|
+
</div>
|
|
437
|
+
<details data-testid="focus-area" class="flex flex-col gap-2">
|
|
438
|
+
<summary class="cursor-pointer text-foreground">Focus Area</summary>
|
|
439
|
+
<div class="flex flex-col gap-2 pt-2">
|
|
440
|
+
<label class="flex flex-col gap-1">
|
|
441
|
+
<span class="flex justify-between text-muted-foreground">
|
|
442
|
+
<span>In-focus range</span>
|
|
443
|
+
<span class="font-mono">{options.focusRange ?? 50}</span>
|
|
444
|
+
</span>
|
|
445
|
+
<ImageRange label="In-focus range" min={0} max={100} step={1} value={options.focusRange ?? 50} oninput={(v) => set({ focusRange: v })} />
|
|
446
|
+
</label>
|
|
447
|
+
<label class="flex flex-col gap-1">
|
|
448
|
+
<span class="flex justify-between text-muted-foreground">
|
|
449
|
+
<span>Image noise level</span>
|
|
450
|
+
<span class="font-mono">{options.focusNoise ?? 0}</span>
|
|
451
|
+
</span>
|
|
452
|
+
<ImageRange label="Image noise level" min={0} max={100} step={1} value={options.focusNoise ?? 0} oninput={(v) => set({ focusNoise: v })} />
|
|
453
|
+
</label>
|
|
454
|
+
<label class="flex flex-col gap-1">
|
|
455
|
+
<span class="flex justify-between text-muted-foreground">
|
|
456
|
+
<span>Soften edge</span>
|
|
457
|
+
<span class="font-mono">{options.focusSoftness ?? 4} px</span>
|
|
458
|
+
</span>
|
|
459
|
+
<ImageRange label="Focus soften edge" min={0} max={50} step={1} value={options.focusSoftness ?? 4} oninput={(v) => set({ focusSoftness: v })} />
|
|
460
|
+
</label>
|
|
461
|
+
<button type="button" class={btn(false)} disabled={focusing} aria-busy={focusing} onclick={() => void selectFocusArea()}>
|
|
462
|
+
{focusing ? 'Selecting…' : 'Select Focus Area'}
|
|
463
|
+
</button>
|
|
464
|
+
{#if focusStatus}
|
|
465
|
+
<p role="status" class="text-muted-foreground">{focusStatus}</p>
|
|
466
|
+
{/if}
|
|
467
|
+
</div>
|
|
468
|
+
</details>
|
|
394
469
|
<label class="flex items-center gap-2 text-foreground">
|
|
395
470
|
<ImageCheckbox label="Anti-alias" checked={options.antiAlias} onchange={(on) => set({ antiAlias: on })} />
|
|
396
471
|
Anti-alias
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor-svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.148.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.201.0"
|
|
169
169
|
},
|
|
170
170
|
"peerDependencies": {
|
|
171
171
|
"@dagrejs/dagre": "^1.1.4",
|