@pixerate/editor-svelte 0.210.0 → 0.211.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.
@@ -4,6 +4,7 @@
4
4
  import PaintSlider from './PaintSlider.svelte';
5
5
  import PixelCanvas from './PixelCanvas.svelte';
6
6
  import FerroPanel from './FerroPanel.svelte';
7
+ import TimeMachinePanel from './TimeMachinePanel.svelte';
7
8
  import { attempt, button, chip, paintEditorState, panel } from './paintEditorRune.svelte.js';
8
9
 
9
10
  interface Props {
@@ -104,5 +105,6 @@
104
105
  </div>
105
106
  </div>
106
107
  <FerroPanel {controller} />
108
+ <TimeMachinePanel {controller} />
107
109
  {#if error}<p role="alert" class="text-[11px] text-rose-400">{error}</p>{/if}
108
110
  </div>
@@ -0,0 +1,57 @@
1
+ <script lang="ts">
2
+ import { AGE_SLIDERS, readPath, type PaintEditorController } from '@pixerate/editor/paint-editor';
3
+ import PaintSlider from './PaintSlider.svelte';
4
+ import { attempt, button, chip, paintEditorState, panel } from './paintEditorRune.svelte.js';
5
+
6
+ interface Props {
7
+ controller: PaintEditorController;
8
+ class?: string;
9
+ }
10
+ let { controller, class: className = '' }: Props = $props();
11
+ const editor = paintEditorState(() => controller);
12
+ const age = $derived(editor.current.age);
13
+ let error = $state<string | null>(null);
14
+ const run = (fn: () => unknown) => attempt(fn, (m) => (error = m));
15
+ </script>
16
+
17
+ <!-- Painting time machine panel: non-destructive ageing preview, bakeAge, X-ray view and scraper brush. -->
18
+ <div class={`${panel} ${className}`} data-testid="time-machine-panel">
19
+ <div class="flex items-center justify-between gap-1">
20
+ <span class="font-medium text-slate-300">Time machine (ageing &amp; X-ray)</span>
21
+ <div class="flex flex-wrap gap-1">
22
+ <button type="button" class={chip(age.years === 300)} onclick={() => run(() => controller.setAge({ years: 300 }))}>
23
+ Age 300 yr
24
+ </button>
25
+ {#if age.years > 0}
26
+ <button type="button" class={button} onclick={() => run(() => controller.setAge({ years: 0 }))}>Fresh</button>
27
+ {/if}
28
+ </div>
29
+ </div>
30
+ <label class="flex items-center gap-2">
31
+ <input
32
+ type="checkbox"
33
+ checked={editor.current.xrayView}
34
+ onchange={(e) => run(() => controller.setXrayView(e.currentTarget.checked))}
35
+ />
36
+ X-ray view (pentimento)
37
+ </label>
38
+ {#each AGE_SLIDERS as c (c.path)}
39
+ <PaintSlider control={c} value={readPath(age, c.path)} onchange={(v) => run(() => controller.setAge({ [c.path]: v }))} />
40
+ {/each}
41
+ <div class="flex flex-wrap items-center gap-1.5">
42
+ <button type="button" class={button} disabled={age.years <= 0} onclick={() => run(() => controller.bakeAge())}>
43
+ Bake age
44
+ </button>
45
+ <button type="button" class={button} onclick={() => run(() => controller.setAge({ seed: age.seed + 1 }))}>
46
+ New crack seed
47
+ </button>
48
+ <button
49
+ type="button"
50
+ class={chip(editor.current.brush.id === 'paint-scraper')}
51
+ onclick={() => run(() => controller.setBrush({ id: 'paint-scraper' }))}
52
+ >
53
+ Scraper brush
54
+ </button>
55
+ </div>
56
+ {#if error}<p role="alert" class="text-[11px] text-rose-400">{error}</p>{/if}
57
+ </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 TimeMachinePanel: import("svelte").Component<Props, {}, "">;
7
+ type TimeMachinePanel = ReturnType<typeof TimeMachinePanel>;
8
+ export default TimeMachinePanel;
@@ -7,6 +7,7 @@ import type BrushEditorComponent from '../brushes/BrushEditor.svelte';
7
7
  import type BrushLibraryBrowserComponent from '../brushes/BrushLibraryBrowser.svelte';
8
8
  import type PaperPanelComponent from './PaperPanel.svelte';
9
9
  import type FerroPanelComponent from './FerroPanel.svelte';
10
+ import type TimeMachinePanelComponent from './TimeMachinePanel.svelte';
10
11
  import type ColorPanelComponent from './ColorPanel.svelte';
11
12
  import type PaintLayersPanelComponent from './PaintLayersPanel.svelte';
12
13
  import type WetPanelComponent from './WetPanel.svelte';
@@ -25,6 +26,7 @@ export { default as BrushEditor } from '../brushes/BrushEditor.svelte';
25
26
  export { default as BrushLibraryBrowser } from '../brushes/BrushLibraryBrowser.svelte';
26
27
  export { default as PaperPanel } from './PaperPanel.svelte';
27
28
  export { default as FerroPanel } from './FerroPanel.svelte';
29
+ export { default as TimeMachinePanel } from './TimeMachinePanel.svelte';
28
30
  export { default as ColorPanel } from './ColorPanel.svelte';
29
31
  export { default as PaintLayersPanel } from './PaintLayersPanel.svelte';
30
32
  export { default as WetPanel } from './WetPanel.svelte';
@@ -48,6 +50,7 @@ export type BrushEditorProps = ComponentProps<typeof BrushEditorComponent>;
48
50
  export type BrushLibraryBrowserProps = ComponentProps<typeof BrushLibraryBrowserComponent>;
49
51
  export type PaperPanelProps = ComponentProps<typeof PaperPanelComponent>;
50
52
  export type FerroPanelProps = ComponentProps<typeof FerroPanelComponent>;
53
+ export type TimeMachinePanelProps = ComponentProps<typeof TimeMachinePanelComponent>;
51
54
  export type ColorPanelProps = ComponentProps<typeof ColorPanelComponent>;
52
55
  export type PaintLayersPanelProps = ComponentProps<typeof PaintLayersPanelComponent>;
53
56
  export type WetPanelProps = ComponentProps<typeof WetPanelComponent>;
@@ -8,6 +8,7 @@ export { default as BrushEditor } from '../brushes/BrushEditor.svelte';
8
8
  export { default as BrushLibraryBrowser } from '../brushes/BrushLibraryBrowser.svelte';
9
9
  export { default as PaperPanel } from './PaperPanel.svelte';
10
10
  export { default as FerroPanel } from './FerroPanel.svelte';
11
+ export { default as TimeMachinePanel } from './TimeMachinePanel.svelte';
11
12
  export { default as ColorPanel } from './ColorPanel.svelte';
12
13
  export { default as PaintLayersPanel } from './PaintLayersPanel.svelte';
13
14
  export { default as WetPanel } from './WetPanel.svelte';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-svelte",
3
- "version": "0.210.0",
3
+ "version": "0.211.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.282.0"
187
+ "@pixerate/editor": "0.283.0"
188
188
  },
189
189
  "peerDependencies": {
190
190
  "@dagrejs/dagre": "^1.1.4",