@pixerate/editor-svelte 0.175.0 → 0.176.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.
@@ -176,8 +176,8 @@
176
176
  y1={l.from.y}
177
177
  x2={l.to.x}
178
178
  y2={l.to.y}
179
- stroke={l.kind === 'symmetry' ? '#22d3ee' : l.kind === 'stencil' ? '#fbbf24' : '#f472b6'}
180
- stroke-opacity={l.kind === 'symmetry' || l.kind === 'stencil' ? 0.8 : 0.35}
179
+ stroke={l.kind === 'symmetry' ? '#22d3ee' : l.kind === 'stencil' ? '#fbbf24' : l.kind === 'sticker' ? '#818cf8' : '#f472b6'}
180
+ stroke-opacity={l.kind === 'symmetry' || l.kind === 'stencil' || l.kind === 'sticker' ? 0.8 : 0.35}
181
181
  stroke-width={1 / snap.view.zoom}
182
182
  stroke-dasharray={l.kind === 'symmetry' ? `${6 / snap.view.zoom} ${4 / snap.view.zoom}` : undefined}
183
183
  />
@@ -11,19 +11,19 @@
11
11
  const editor = paintEditorState(() => controller);
12
12
  const layerId = $derived(editor.current.document.activeLayerId);
13
13
  const stickers = $derived(layerId ? (editor.current.document.stickers?.[layerId] ?? []) : []);
14
- let picked = $state<string | null>(null);
14
+ const picked = $derived(editor.current.selectedSticker);
15
15
  const sel = $derived(stickers.find((s) => s.id === picked) ?? null);
16
16
  let error = $state<string | null>(null);
17
17
  const run = (fn: () => unknown) => attempt(fn, (m) => (error = m));
18
18
  </script>
19
19
 
20
- <!-- The active layer's stickers: pick one to change, reorder or delete it (each change one undo step). -->
20
+ <!-- The active layer's stickers: pick one (here, or with the Stickers tool on the canvas) to move, change, reorder or delete it (each change one undo step). -->
21
21
  {#if stickers.length && layerId}
22
22
  <div class={`${panel} ${className}`} data-testid="sticker-panel">
23
23
  <span class="font-medium text-slate-300">Stickers ({stickers.length})</span>
24
24
  <div class="flex max-h-24 flex-wrap gap-1 overflow-y-auto" role="listbox" aria-label="Stickers">
25
25
  {#each stickers as s (s.id)}
26
- <button type="button" role="option" aria-selected={s.id === picked} title={`${STAMP_LABELS[s.stamp]} ${s.id}`} class={`h-5 w-5 rounded ring-1 ${s.id === picked ? 'ring-indigo-400' : 'ring-slate-700'}`} style={`background: ${s.color}`} onclick={() => (picked = s.id)}></button>
26
+ <button type="button" role="option" aria-selected={s.id === picked} title={`${STAMP_LABELS[s.stamp]} ${s.id}`} class={`h-5 w-5 rounded ring-1 ${s.id === picked ? 'ring-indigo-400' : 'ring-slate-700'}`} style={`background: ${s.color}`} onclick={() => controller.selectSticker(s.id)}></button>
27
27
  {/each}
28
28
  </div>
29
29
  {#if sel}
@@ -34,6 +34,16 @@
34
34
  {#each STAMP_KINDS as k (k)}<option value={k}>{STAMP_LABELS[k]}</option>{/each}
35
35
  </select>
36
36
  </label>
37
+ <div class="flex items-center justify-between gap-2">
38
+ <span class="text-slate-400">Position</span>
39
+ <span class="flex gap-1">
40
+ {#each ['x', 'y'] as const as k (k)}
41
+ {#key `${sel.id}-${sel[k]}`}
42
+ <input type="number" aria-label={`Sticker ${k}`} value={sel[k]} step="1" onchange={(e) => { const v = Number(e.currentTarget.value); if (v !== sel[k]) run(() => controller.updateSticker(layerId, sel.id, { [k]: v })); }} class="w-16 rounded bg-slate-800 px-1 py-0.5" />
43
+ {/key}
44
+ {/each}
45
+ </span>
46
+ </div>
37
47
  {#each STICKER_SLIDERS as c (c.path)}
38
48
  <PaintSlider control={c} value={readPath(sel, c.path)} oncommit={(v) => run(() => controller.updateSticker(layerId, sel.id, { [c.path]: v }))} />
39
49
  {/each}
@@ -44,7 +54,7 @@
44
54
  <div class="flex flex-wrap gap-1">
45
55
  <button type="button" class={button} onclick={() => run(() => controller.arrangeStickers(layerId, [sel.id], 'front'))}>To front</button>
46
56
  <button type="button" class={button} onclick={() => run(() => controller.arrangeStickers(layerId, [sel.id], 'back'))}>To back</button>
47
- <button type="button" class={button} onclick={() => run(() => { controller.removeStickers(layerId, [sel.id]); picked = null; })}>Delete</button>
57
+ <button type="button" class={button} onclick={() => run(() => { controller.removeStickers(layerId, [sel.id]); controller.selectSticker(null); })}>Delete</button>
48
58
  </div>
49
59
  </div>
50
60
  {/if}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-svelte",
3
- "version": "0.175.0",
3
+ "version": "0.176.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.237.0"
168
+ "@pixerate/editor": "0.238.0"
169
169
  },
170
170
  "peerDependencies": {
171
171
  "@dagrejs/dagre": "^1.1.4",