@pixerate/editor-svelte 0.200.0 → 0.201.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.
@@ -1,8 +1,9 @@
1
1
  <script lang="ts">
2
2
  import { untrack } from 'svelte';
3
3
  import { PAPER_EFFECT_BLENDS, type PaintEditorController, type PaperEffectBlend } from '@pixerate/editor/paint-editor';
4
- import type { EffectUse } from '@pixerate/editor/effects';
4
+ import { pathControlsOf, type EffectUse } from '@pixerate/editor/effects';
5
5
  import EffectsBrowser from '../effects/EffectsBrowser.svelte';
6
+ import { effectDescriptionOf } from '../effects/effects.svelte.js';
6
7
  import ImageEffectControls from '../image-editor/ImageEffectControls.svelte';
7
8
  import { attempt, button, paintEditorState, paintEffectsProvider, panel } from './paintEditorRune.svelte.js';
8
9
 
@@ -39,6 +40,8 @@
39
40
  const { effectPaint, rendering } = view;
40
41
  return effectPaint && !rendering ? untrack(() => controller.effectPaintThumbnail(48)) : null;
41
42
  });
43
+ const paintLoaded = effectDescriptionOf(() => provider, () => view.effectPaint?.effect ?? null);
44
+ const hasPathControl = $derived(Boolean(paintLoaded.description && pathControlsOf(paintLoaded.description).length > 0));
42
45
  type Browse = null | 'paper' | 'layer' | 'fill' | 'light' | 'paint';
43
46
  const BROWSERS: Record<Exclude<Browse, null>, { uses: EffectUse[]; title: string }> = {
44
47
  paper: { uses: ['generator'], title: 'Effect paper' },
@@ -142,15 +145,21 @@
142
145
  />
143
146
  <div class="flex flex-wrap items-center gap-2" data-testid="effect-paint-placement">
144
147
  <label class="flex items-center gap-1" title="Lay the effect along each stroke instead of fixing it to the canvas">
145
- <input type="checkbox" checked={Boolean(fx.map)} onchange={(e) => repaint({ map: e.currentTarget.checked ? { by: 'stroke', length: 300, repeat: 'repeat' } : { by: 'canvas' } })} />
148
+ <input type="checkbox" checked={fx.map?.by === 'stroke'} onchange={(e) => repaint({ map: e.currentTarget.checked ? { by: 'stroke', length: 300, repeat: 'repeat' } : { by: 'canvas' } })} />
146
149
  Along the stroke
147
150
  </label>
151
+ {#if hasPathControl}
152
+ <label class="flex items-center gap-1" title="Pass each stroke's centreline to the effect's own path control">
153
+ <input type="checkbox" checked={fx.map?.by === 'path'} onchange={(e) => repaint({ map: e.currentTarget.checked ? { by: 'path' } : { by: 'canvas' } })} />
154
+ Along the stroke (native)
155
+ </label>
156
+ {/if}
148
157
  <label class="flex items-center gap-1" title="Strokes on a stroke layer keep playing the effect">
149
158
  <input type="checkbox" checked={Boolean(fx.live)} onchange={(e) => repaint({ live: e.currentTarget.checked })} />
150
159
  Live
151
160
  </label>
152
161
  </div>
153
- {#if fx.map}
162
+ {#if fx.map?.by === 'stroke'}
154
163
  {@const map = fx.map}
155
164
  <div class="flex flex-wrap items-center gap-2">
156
165
  <label class="flex items-center gap-1">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-svelte",
3
- "version": "0.200.0",
3
+ "version": "0.201.0",
4
4
  "description": "Svelte bindings and prompt/rich-text components for @pixerate/editor",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -184,7 +184,7 @@
184
184
  "**/*.css"
185
185
  ],
186
186
  "dependencies": {
187
- "@pixerate/editor": "0.270.0"
187
+ "@pixerate/editor": "0.271.0"
188
188
  },
189
189
  "peerDependencies": {
190
190
  "@dagrejs/dagre": "^1.1.4",