@pixerate/editor-svelte 0.192.0 → 0.193.2

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.
@@ -12,6 +12,7 @@
12
12
  import WetPanel from './WetPanel.svelte';
13
13
  import StickerPanel from './StickerPanel.svelte';
14
14
  import StrokePanel from './StrokePanel.svelte';
15
+ import PathStrokePanel from './PathStrokePanel.svelte';
15
16
  import PaintEffectsPanel from './PaintEffectsPanel.svelte';
16
17
  import { chip, paintEffectsProvider } from './paintEditorRune.svelte.js';
17
18
 
@@ -133,7 +134,7 @@
133
134
  {#if tab === 'color'}<ColorPanel {controller} />{/if}
134
135
  {#if tab === 'wet'}<WetPanel {controller} />{/if}
135
136
  {#if tab === 'paper'}<PaperPanel {controller} />{/if}
136
- {#if tab === 'layers'}<PaintLayersPanel {controller} /><StrokePanel {controller} /><StickerPanel {controller} />{/if}
137
+ {#if tab === 'layers'}<PaintLayersPanel {controller} /><StrokePanel {controller} /><PathStrokePanel {controller} /><StickerPanel {controller} />{/if}
137
138
  {#if tab === 'effects' && effects.current}<PaintEffectsPanel {controller} />{/if}
138
139
  </div>
139
140
  </div>
@@ -0,0 +1,29 @@
1
+ <script lang="ts">
2
+ import { PATH_STROKE_TAPERS, type PaintEditorController } from '@pixerate/editor/paint-editor';
3
+ import { attempt, button, paintEditorState, panel } from './paintEditorRune.svelte.js';
4
+
5
+ interface Props {
6
+ controller: PaintEditorController;
7
+ class?: string;
8
+ }
9
+ let { controller, class: className = '' }: Props = $props();
10
+ const editor = paintEditorState(() => controller);
11
+ let path = $state('');
12
+ let taper = $state(PATH_STROKE_TAPERS[0].id);
13
+ const pressure = $derived(PATH_STROKE_TAPERS.find((t) => t.id === taper)?.pressure);
14
+ let error = $state<string | null>(null);
15
+ const run = (fn: () => unknown) => attempt(fn, (m) => (error = m));
16
+ </script>
17
+
18
+ <!-- Brush a path: paste SVG path data (document pixels) and brush it on the active layer with the active brush and colour, with an even pressure or a taper. One undo step, as the stroke_path agent tool. -->
19
+ <div class={`${panel} ${className}`} data-testid="path-stroke-panel">
20
+ <span class="font-medium text-slate-300">Brush a path</span>
21
+ <textarea aria-label="SVG path data" placeholder="M 40 200 C 120 40 280 40 360 200" bind:value={path} rows="2" class="w-full resize-y rounded bg-slate-800 px-1 py-0.5 font-mono text-[11px]"></textarea>
22
+ <div class="flex items-center gap-2">
23
+ <select aria-label="Pressure along the path" bind:value={taper} class="rounded bg-slate-800 px-1 py-0.5">
24
+ {#each PATH_STROKE_TAPERS as t (t.id)}<option value={t.id}>{t.label}</option>{/each}
25
+ </select>
26
+ <button type="button" class={button} disabled={!path.trim() || editor.current.stroking} onclick={() => run(() => controller.strokePath({ path, ...(pressure ? { pressure } : {}) }))}>Brush path</button>
27
+ </div>
28
+ {#if error}<p role="alert" class="text-[11px] text-rose-400">{error}</p>{/if}
29
+ </div>
@@ -0,0 +1,8 @@
1
+ import { type PaintEditorController } from '@pixerate/editor/paint-editor';
2
+ interface Props {
3
+ controller: PaintEditorController;
4
+ class?: string;
5
+ }
6
+ declare const PathStrokePanel: import("svelte").Component<Props, {}, "">;
7
+ type PathStrokePanel = ReturnType<typeof PathStrokePanel>;
8
+ export default PathStrokePanel;
@@ -12,6 +12,7 @@ import type WetPanelComponent from './WetPanel.svelte';
12
12
  import type StickerPanelComponent from './StickerPanel.svelte';
13
13
  import type StickerPickerComponent from './StickerPicker.svelte';
14
14
  import type StrokePanelComponent from './StrokePanel.svelte';
15
+ import type PathStrokePanelComponent from './PathStrokePanel.svelte';
15
16
  import type PaintEffectsPanelComponent from './PaintEffectsPanel.svelte';
16
17
  import type PaintGradientEditorComponent from './PaintGradientEditor.svelte';
17
18
  export { default as PaintEditor } from './PaintEditor.svelte';
@@ -27,6 +28,7 @@ export { default as WetPanel } from './WetPanel.svelte';
27
28
  export { default as StickerPanel } from './StickerPanel.svelte';
28
29
  export { default as StickerPicker } from './StickerPicker.svelte';
29
30
  export { default as StrokePanel } from './StrokePanel.svelte';
31
+ export { default as PathStrokePanel } from './PathStrokePanel.svelte';
30
32
  export { default as PaintEffectsPanel } from './PaintEffectsPanel.svelte';
31
33
  export { default as PaintGradientEditor } from './PaintGradientEditor.svelte';
32
34
  export { default as PaintSlider } from './PaintSlider.svelte';
@@ -47,5 +49,6 @@ export type WetPanelProps = ComponentProps<typeof WetPanelComponent>;
47
49
  export type StickerPanelProps = ComponentProps<typeof StickerPanelComponent>;
48
50
  export type StickerPickerProps = ComponentProps<typeof StickerPickerComponent>;
49
51
  export type StrokePanelProps = ComponentProps<typeof StrokePanelComponent>;
52
+ export type PathStrokePanelProps = ComponentProps<typeof PathStrokePanelComponent>;
50
53
  export type PaintEffectsPanelProps = ComponentProps<typeof PaintEffectsPanelComponent>;
51
54
  export type PaintGradientEditorProps = ComponentProps<typeof PaintGradientEditorComponent>;
@@ -12,6 +12,7 @@ export { default as WetPanel } from './WetPanel.svelte';
12
12
  export { default as StickerPanel } from './StickerPanel.svelte';
13
13
  export { default as StickerPicker } from './StickerPicker.svelte';
14
14
  export { default as StrokePanel } from './StrokePanel.svelte';
15
+ export { default as PathStrokePanel } from './PathStrokePanel.svelte';
15
16
  export { default as PaintEffectsPanel } from './PaintEffectsPanel.svelte';
16
17
  export { default as PaintGradientEditor } from './PaintGradientEditor.svelte';
17
18
  export { default as PaintSlider } from './PaintSlider.svelte';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-svelte",
3
- "version": "0.192.0",
3
+ "version": "0.193.2",
4
4
  "description": "Svelte bindings and prompt/rich-text components for @pixerate/editor",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -175,7 +175,7 @@
175
175
  "**/*.css"
176
176
  ],
177
177
  "dependencies": {
178
- "@pixerate/editor": "0.260.0"
178
+ "@pixerate/editor": "0.262.1"
179
179
  },
180
180
  "peerDependencies": {
181
181
  "@dagrejs/dagre": "^1.1.4",