@pixerate/editor-svelte 0.214.0 → 0.215.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.
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
uses?: readonly EffectUse[];
|
|
10
10
|
/** Only effects of these kinds (default: any). */
|
|
11
11
|
kinds?: readonly EffectKind[];
|
|
12
|
+
/** Only effects this also keeps (e.g. `paintEffectOffered` for the paint editor's paint, which honours provider paint hints). */
|
|
13
|
+
filter?: (effect: EffectSummary) => boolean;
|
|
12
14
|
/** Called with the effect the user picks. */
|
|
13
15
|
onpick: (effect: EffectSummary) => void;
|
|
14
16
|
/** Draw previews with the provider's renderer (default true). */
|
|
@@ -18,7 +20,7 @@
|
|
|
18
20
|
class?: string;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
|
-
let { provider, uses, kinds, onpick, thumbnails = true, title = 'Effects', class: className = '' }: Props = $props();
|
|
23
|
+
let { provider, uses, kinds, filter, onpick, thumbnails = true, title = 'Effects', class: className = '' }: Props = $props();
|
|
22
24
|
let all = $state.raw<readonly EffectSummary[]>([]);
|
|
23
25
|
let found = $state.raw<readonly EffectSummary[]>([]);
|
|
24
26
|
let query = $state('');
|
|
@@ -68,7 +70,7 @@
|
|
|
68
70
|
live = false;
|
|
69
71
|
};
|
|
70
72
|
});
|
|
71
|
-
const allowed = (e: EffectSummary) => (!kinds || kinds.includes(e.kind)) && effectOffered(e, uses);
|
|
73
|
+
const allowed = (e: EffectSummary) => (!kinds || kinds.includes(e.kind)) && effectOffered(e, uses) && (!filter || filter(e));
|
|
72
74
|
const categories = $derived([...new Set(all.filter(allowed).map((e) => e.category))]);
|
|
73
75
|
const shown = $derived(found.filter(allowed));
|
|
74
76
|
</script>
|
|
@@ -6,6 +6,8 @@ interface Props {
|
|
|
6
6
|
uses?: readonly EffectUse[];
|
|
7
7
|
/** Only effects of these kinds (default: any). */
|
|
8
8
|
kinds?: readonly EffectKind[];
|
|
9
|
+
/** Only effects this also keeps (e.g. `paintEffectOffered` for the paint editor's paint, which honours provider paint hints). */
|
|
10
|
+
filter?: (effect: EffectSummary) => boolean;
|
|
9
11
|
/** Called with the effect the user picks. */
|
|
10
12
|
onpick: (effect: EffectSummary) => void;
|
|
11
13
|
/** Draw previews with the provider's renderer (default true). */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { untrack } from 'svelte';
|
|
3
|
-
import { PAPER_EFFECT_BLENDS, type PaintEditorController, type PaperEffectBlend } from '@pixerate/editor/paint-editor';
|
|
3
|
+
import { paintEffectOffered, PAPER_EFFECT_BLENDS, type PaintEditorController, type PaperEffectBlend } from '@pixerate/editor/paint-editor';
|
|
4
4
|
import { pathControlsOf, type EffectUse } from '@pixerate/editor/effects';
|
|
5
5
|
import EffectsBrowser from '../effects/EffectsBrowser.svelte';
|
|
6
6
|
import { effectDescriptionOf } from '../effects/effects.svelte.js';
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
const repaint = (patch: { values?: Record<string, unknown>; map?: unknown; live?: boolean }) => {
|
|
35
35
|
const fx = view.effectPaint;
|
|
36
36
|
if (!fx) return;
|
|
37
|
-
run(() => controller.setEffectPaint({ effect: fx.effect, values: fx.values as never, time: fx.time, map: fx.map, live: fx.live, ...(patch as object) }));
|
|
37
|
+
run(() => controller.setEffectPaint({ effect: fx.effect, values: fx.values as never, time: fx.time, map: fx.map ?? { by: 'canvas' }, live: fx.live ?? false, ...(patch as object) }));
|
|
38
38
|
};
|
|
39
39
|
const thumbnail = $derived.by(() => {
|
|
40
40
|
const { effectPaint, rendering } = view;
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
</div>
|
|
100
100
|
{#if !provider}<p class="text-[11px] text-slate-400">No effects provider is registered. Effects in the painting are kept.</p>{/if}
|
|
101
101
|
{#if browse}
|
|
102
|
-
<EffectsBrowser {provider} uses={BROWSERS[browse].uses} title={BROWSERS[browse].title} onpick={(e) => pick(e.id)} />
|
|
102
|
+
<EffectsBrowser {provider} uses={BROWSERS[browse].uses} filter={(e) => paintEffectOffered(e, browse!, provider?.capabilities)} title={BROWSERS[browse].title} onpick={(e) => pick(e.id)} />
|
|
103
103
|
{/if}
|
|
104
104
|
{#if view.paper}
|
|
105
105
|
{@const paper = view.paper}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor-svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.215.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.
|
|
187
|
+
"@pixerate/editor": "0.291.0"
|
|
188
188
|
},
|
|
189
189
|
"peerDependencies": {
|
|
190
190
|
"@dagrejs/dagre": "^1.1.4",
|