@pixerate/editor-svelte 0.165.9 → 0.165.11

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.
@@ -11,16 +11,18 @@
11
11
  class?: string;
12
12
  }
13
13
 
14
+ const LABELS: Partial<Record<EffectSummary['kind'], string>> = { motion: 'Motion', camera: 'Camera' };
15
+
14
16
  let { provider, effect: item, width = 96, height = 54, class: className = '' }: Props = $props();
15
17
  let canvas = $state<HTMLCanvasElement | null>(null);
16
18
  let failed = $state(false);
17
19
 
18
20
  $effect(() => {
19
21
  // Reads only what picks the picture: setting `failed` below must not run this again.
20
- const motion = item.kind === 'motion';
22
+ const pixelless = item.kind in LABELS;
21
23
  const request = { provider, item, size: { width, height } };
22
- failed = motion;
23
- if (motion) return;
24
+ failed = pixelless;
25
+ if (pixelless) return;
24
26
  let live = true;
25
27
  untrack(() => renderEffectThumbnail(request.provider, request.item, request.size)).then(
26
28
  (pixels) => {
@@ -38,14 +40,14 @@
38
40
  });
39
41
  </script>
40
42
 
41
- <!-- A preview of an effect drawn by the provider's own renderer; motion effects and failures show a label. -->
43
+ <!-- A preview of an effect drawn by the provider's own renderer; motion effects, camera moves and failures show a label. -->
42
44
  <div
43
45
  class="relative overflow-hidden rounded border border-border bg-[repeating-conic-gradient(#8884_0_25%,transparent_0_50%)] bg-[length:12px_12px] {className}"
44
46
  style="aspect-ratio: {width} / {height}"
45
47
  data-effect-thumbnail={item.id}
46
48
  >
47
49
  {#if failed}
48
- <span class="absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground">{item.kind === 'motion' ? 'Motion' : 'No preview'}</span>
50
+ <span class="absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground">{LABELS[item.kind] ?? 'No preview'}</span>
49
51
  {:else}
50
52
  <canvas bind:this={canvas} {width} {height} class="h-full w-full" aria-hidden="true"></canvas>
51
53
  {/if}
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { EFFECT_USE_LABELS, type EffectKind, type EffectProvider, type EffectSummary, type EffectUse } from '@pixerate/editor/effects';
2
+ import { EFFECT_USE_LABELS, effectOffered, type EffectKind, type EffectProvider, type EffectSummary, type EffectUse } from '@pixerate/editor/effects';
3
3
  import EffectThumbnail from './EffectThumbnail.svelte';
4
4
 
5
5
  interface Props {
@@ -68,7 +68,7 @@
68
68
  live = false;
69
69
  };
70
70
  });
71
- const allowed = (e: EffectSummary) => (!kinds || kinds.includes(e.kind)) && (uses ? e.kind !== 'motion' || uses.includes('motion') : e.kind !== 'motion') && (!uses || e.uses.some((u) => uses.includes(u)));
71
+ const allowed = (e: EffectSummary) => (!kinds || kinds.includes(e.kind)) && effectOffered(e, uses);
72
72
  const categories = $derived([...new Set(all.filter(allowed).map((e) => e.category))]);
73
73
  const shown = $derived(found.filter(allowed));
74
74
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-svelte",
3
- "version": "0.165.9",
3
+ "version": "0.165.11",
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.223.9"
168
+ "@pixerate/editor": "0.224.1"
169
169
  },
170
170
  "peerDependencies": {
171
171
  "@dagrejs/dagre": "^1.1.4",