shaders 2.4.78 → 2.5.81

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.
Files changed (64) hide show
  1. package/dist/core/Liquify-Cr-1qPxN.js +228 -0
  2. package/dist/core/index.d.ts +1 -1
  3. package/dist/core/index.d.ts.map +1 -1
  4. package/dist/core/index.js +59 -53
  5. package/dist/core/presetRenderer.d.ts.map +1 -1
  6. package/dist/core/registry.js +2 -2
  7. package/dist/core/renderer.d.ts +5 -1
  8. package/dist/core/renderer.d.ts.map +1 -1
  9. package/dist/core/{shaderRegistry-9huRXSRI.js → shaderRegistry-DnmRD6xy.js} +1 -1
  10. package/dist/core/shaders/Liquify/index.d.ts +13 -7
  11. package/dist/core/shaders/Liquify/index.d.ts.map +1 -1
  12. package/dist/core/shaders/Liquify/index.js +1 -1
  13. package/dist/js/codegen.d.ts +1 -0
  14. package/dist/js/codegen.js +1 -0
  15. package/dist/js/createPreview.d.ts +19 -0
  16. package/dist/js/createPreview.d.ts.map +1 -0
  17. package/dist/js/createPreview.js +64 -0
  18. package/dist/js/createShader.d.ts +24 -0
  19. package/dist/js/createShader.d.ts.map +1 -0
  20. package/dist/js/createShader.js +132 -0
  21. package/dist/js/decode.d.ts +7 -0
  22. package/dist/js/decode.d.ts.map +1 -0
  23. package/dist/js/decode.js +22 -0
  24. package/dist/js/index.d.ts +6 -0
  25. package/dist/js/index.d.ts.map +1 -0
  26. package/dist/js/index.js +4 -0
  27. package/dist/js/types.d.ts +23 -0
  28. package/dist/js/types.d.ts.map +1 -0
  29. package/dist/js/utils/generatePresetCode.d.ts +13 -0
  30. package/dist/js/utils/generatePresetCode.d.ts.map +1 -0
  31. package/dist/js/utils/generatePresetCode.js +1249 -0
  32. package/dist/js/utils/generatePresetCode.template.d.ts +13 -0
  33. package/dist/js/utils/generatePresetCode.template.d.ts.map +1 -0
  34. package/dist/react/Shader.js +1 -1
  35. package/dist/react/components/Liquify.d.ts +4 -2
  36. package/dist/react/components/Liquify.d.ts.map +1 -1
  37. package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
  38. package/dist/react/utils/generatePresetCode.js +45 -8
  39. package/dist/react/utils/generatePresetCode.template.d.ts.map +1 -1
  40. package/dist/registry.js +50 -20
  41. package/dist/solid/components/Liquify.d.ts +4 -2
  42. package/dist/solid/components/Liquify.d.ts.map +1 -1
  43. package/dist/solid/engine/Shader.js +1 -1
  44. package/dist/solid/utils/generatePresetCode.d.ts.map +1 -1
  45. package/dist/solid/utils/generatePresetCode.js +51 -6
  46. package/dist/solid/utils/generatePresetCode.template.d.ts.map +1 -1
  47. package/dist/svelte/components/Liquify.svelte.d.ts +2 -1
  48. package/dist/svelte/engine/Preview.svelte.d.ts +11 -25
  49. package/dist/svelte/engine/PreviewRenderComponent.svelte.d.ts +5 -19
  50. package/dist/svelte/{generatePresetCode-Bpe8YcaW.js → generatePresetCode-6ecNqXs9.js} +34 -6
  51. package/dist/svelte/index.js +41 -67
  52. package/dist/svelte/source/components/Liquify.svelte +1 -0
  53. package/dist/svelte/source/engine/Preview.svelte +49 -35
  54. package/dist/svelte/source/engine/PreviewRenderComponent.svelte +9 -5
  55. package/dist/svelte/utils/generatePresetCode.js +1 -1
  56. package/dist/vue/Liquify.vue_vue_type_script_setup_true_lang.js +3 -2
  57. package/dist/vue/Shader.vue_vue_type_script_setup_true_lang.js +1 -1
  58. package/dist/vue/components/Liquify.vue.d.ts +2 -1
  59. package/dist/vue/components/Liquify.vue.d.ts.map +1 -1
  60. package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
  61. package/dist/vue/utils/generatePresetCode.js +48 -10
  62. package/dist/vue/utils/generatePresetCode.template.d.ts.map +1 -1
  63. package/package.json +15 -1
  64. package/dist/core/Liquify-Cy6ck3_k.js +0 -157
@@ -1,4 +1,4 @@
1
- import { n as generatePresetCode } from "./generatePresetCode-Bpe8YcaW.js";
1
+ import { n as generatePresetCode } from "./generatePresetCode-6ecNqXs9.js";
2
2
  import "svelte/internal/disclose-version";
3
3
  import * as $ from "svelte/internal/client";
4
4
  import { getContext, onDestroy, onMount, setContext } from "svelte";
@@ -96,7 +96,6 @@ import { componentDefinition as componentDefinition$88 } from "../core/shaders/W
96
96
  import { componentDefinition as componentDefinition$89 } from "../core/shaders/ZoomBlur/index.js";
97
97
  import { vec4 } from "three/tsl";
98
98
  import { isExternalUser, shouldCollectTelemetry, startTelemetry } from "../core/telemetry/index.js";
99
- import "svelte/internal/flags/legacy";
100
99
  var root$90 = $.from_html(`<span style="display:contents"><!></span>`);
101
100
  function AngularBlur($$anchor, $$props) {
102
101
  $.push($$props, true);
@@ -13189,7 +13188,7 @@ function Shader($$anchor, $$props) {
13189
13188
  const checkRendering = () => {
13190
13189
  if (!rendererInstance) return;
13191
13190
  if (rendererInstance.getPerformanceStats().fps > 0) {
13192
- telemetryCollector = startTelemetry(rendererInstance, "2.4.78", disableTelemetry(), isPreview());
13191
+ telemetryCollector = startTelemetry(rendererInstance, "2.5.81", disableTelemetry(), isPreview());
13193
13192
  if (telemetryCollector) telemetryCollector.start();
13194
13193
  telemetryStartTimeout = null;
13195
13194
  } else telemetryStartTimeout = window.setTimeout(checkRendering, 500);
@@ -13301,20 +13300,10 @@ function Shader($$anchor, $$props) {
13301
13300
  $.pop();
13302
13301
  }
13303
13302
  function PreviewRenderComponent($$anchor, $$props) {
13304
- $.push($$props, false);
13305
- const Component = $.mutable_source();
13306
- const componentProps = $.mutable_source();
13307
- let config = $.prop($$props, "config", 8);
13308
- let componentMap = $.prop($$props, "componentMap", 8);
13309
- let structureVersion = $.prop($$props, "structureVersion", 8, void 0);
13310
- $.legacy_pre_effect(() => ($.deep_read_state(componentMap()), $.deep_read_state(config())), () => {
13311
- $.set(Component, componentMap()[config().type]);
13312
- });
13313
- $.legacy_pre_effect(() => $.deep_read_state(config()), () => {
13314
- $.set(componentProps, config().props ? { ...config().props } : {});
13315
- });
13316
- $.legacy_pre_effect_reset();
13317
- $.init();
13303
+ $.push($$props, true);
13304
+ const structureVersion = $.prop($$props, "structureVersion", 3, void 0);
13305
+ const Component = $.derived(() => $$props.componentMap[$$props.config.type]);
13306
+ const componentProps = $.derived(() => $$props.config.props ? { ...$$props.config.props } : {});
13318
13307
  var fragment = $.comment();
13319
13308
  var node = $.first_child(fragment);
13320
13309
  var consequent_1 = ($$anchor$1) => {
@@ -13323,10 +13312,10 @@ function PreviewRenderComponent($$anchor, $$props) {
13323
13312
  $.component(node_1, () => $.get(Component), ($$anchor$2, $$component) => {
13324
13313
  $$component($$anchor$2, $.spread_props({
13325
13314
  get id() {
13326
- return $.deep_read_state(config()), $.untrack(() => config().id);
13315
+ return $$props.config.id;
13327
13316
  },
13328
13317
  get renderOrder() {
13329
- return $.deep_read_state(config()), $.untrack(() => config().renderOrder);
13318
+ return $$props.config.renderOrder;
13330
13319
  }
13331
13320
  }, () => $.get(componentProps), {
13332
13321
  children: ($$anchor$3, $$slotProps) => {
@@ -13335,20 +13324,20 @@ function PreviewRenderComponent($$anchor, $$props) {
13335
13324
  var consequent = ($$anchor$4) => {
13336
13325
  var fragment_3 = $.comment();
13337
13326
  var node_3 = $.first_child(fragment_3);
13338
- $.each(node_3, 3, () => ($.deep_read_state(config()), $.untrack(() => config().children)), (child, index) => child.id || `child_${index}_v${structureVersion() || 0}`, ($$anchor$5, child, index) => {
13327
+ $.each(node_3, 19, () => $$props.config.children, (child, index) => child.id || `child_${index}_v${structureVersion() || 0}`, ($$anchor$5, child, index) => {
13339
13328
  var fragment_4 = $.comment();
13340
13329
  var node_4 = $.first_child(fragment_4);
13341
13330
  {
13342
- let $0 = $.derived_safe_equal(() => ($.get(child), $.deep_read_state($.get(index)), $.untrack(() => ({
13331
+ let $0 = $.derived(() => ({
13343
13332
  ...$.get(child),
13344
13333
  renderOrder: $.get(child).renderOrder ?? $.get(index)
13345
- }))));
13334
+ }));
13346
13335
  PreviewRenderComponent(node_4, {
13347
13336
  get config() {
13348
13337
  return $.get($0);
13349
13338
  },
13350
13339
  get componentMap() {
13351
- return componentMap();
13340
+ return $$props.componentMap;
13352
13341
  },
13353
13342
  get structureVersion() {
13354
13343
  return structureVersion();
@@ -13360,7 +13349,7 @@ function PreviewRenderComponent($$anchor, $$props) {
13360
13349
  $.append($$anchor$4, fragment_3);
13361
13350
  };
13362
13351
  $.if(node_2, ($$render) => {
13363
- if ($.deep_read_state(config()), $.untrack(() => config().children)) $$render(consequent);
13352
+ if ($$props.config.children) $$render(consequent);
13364
13353
  });
13365
13354
  $.append($$anchor$3, fragment_2);
13366
13355
  },
@@ -13378,22 +13367,7 @@ function PreviewRenderComponent($$anchor, $$props) {
13378
13367
  var root_4 = $.from_html(`<a target="_blank" rel="noopener noreferrer"> </a>`);
13379
13368
  var root_1 = $.from_html(`<div><!> <!></div>`);
13380
13369
  function Preview($$anchor, $$props) {
13381
- const $$sanitized_props = $.legacy_rest_props($$props, [
13382
- "children",
13383
- "$$slots",
13384
- "$$events",
13385
- "$$legacy"
13386
- ]);
13387
- const $$restProps = $.legacy_rest_props($$sanitized_props, [
13388
- "shader",
13389
- "presetId",
13390
- "apiBaseUrl",
13391
- "obfuscationKey",
13392
- "watermarkText",
13393
- "watermarkLink",
13394
- "style"
13395
- ]);
13396
- $.push($$props, false);
13370
+ $.push($$props, true);
13397
13371
  const componentMap = {
13398
13372
  AngularBlur,
13399
13373
  Ascii,
@@ -13517,40 +13491,40 @@ function Preview($$anchor, $$props) {
13517
13491
  return null;
13518
13492
  });
13519
13493
  }
13520
- let shader = $.prop($$props, "shader", 8, void 0);
13521
- let presetId = $.prop($$props, "presetId", 8, void 0);
13522
- let apiBaseUrl = $.prop($$props, "apiBaseUrl", 8, "https://shaders.com");
13523
- let obfuscationKey = $.prop($$props, "obfuscationKey", 8, "shaders-preview-key");
13524
- let watermarkText = $.prop($$props, "watermarkText", 8, "Unlock your Shaders Pro license");
13525
- let watermarkLink = $.prop($$props, "watermarkLink", 8, "https://shaders.com/dashboard?pricing=true");
13526
- let style = $.prop($$props, "style", 8, void 0);
13527
- let resolvedDefinition = $.mutable_source(null);
13528
- let fetchedDefinition = $.mutable_source(null);
13529
- let watermarkHovered = $.mutable_source(false);
13530
- onMount(() => {
13531
- console.warn("[Shaders] Preview component is intended for use with a Shaders license. Visit https://shaders.com for more information.");
13532
- });
13533
- $.legacy_pre_effect(() => ($.deep_read_state(shader()), $.deep_read_state(apiBaseUrl()), $.deep_read_state(obfuscationKey()), $.deep_read_state(presetId())), () => {
13494
+ const shader = $.prop($$props, "shader", 3, void 0), presetId = $.prop($$props, "presetId", 3, void 0), apiBaseUrl = $.prop($$props, "apiBaseUrl", 3, "https://shaders.com"), obfuscationKey = $.prop($$props, "obfuscationKey", 3, "shaders-preview-key"), watermarkText = $.prop($$props, "watermarkText", 3, "Unlock your Shaders Pro license"), watermarkLink = $.prop($$props, "watermarkLink", 3, "https://shaders.com/dashboard?pricing=true"), style = $.prop($$props, "style", 3, void 0), restProps = $.rest_props($$props, [
13495
+ "$$slots",
13496
+ "$$events",
13497
+ "$$legacy",
13498
+ "shader",
13499
+ "presetId",
13500
+ "apiBaseUrl",
13501
+ "obfuscationKey",
13502
+ "watermarkText",
13503
+ "watermarkLink",
13504
+ "style"
13505
+ ]);
13506
+ let fetchedDefinition = $.state(null);
13507
+ let watermarkHovered = $.state(false);
13508
+ let resolvedDefinition = $.derived(() => $.get(fetchedDefinition) ?? null);
13509
+ $.user_effect(() => {
13534
13510
  if (shader()) {
13535
13511
  $.set(fetchedDefinition, null);
13536
13512
  fetchAndDecode(`${apiBaseUrl()}/api/preview/shader/${shader()}`, obfuscationKey()).then((def) => {
13537
- $.set(fetchedDefinition, def);
13513
+ $.set(fetchedDefinition, def, true);
13538
13514
  });
13539
13515
  } else if (!presetId()) $.set(fetchedDefinition, null);
13540
13516
  });
13541
- $.legacy_pre_effect(() => ($.deep_read_state(presetId()), $.deep_read_state(apiBaseUrl()), $.deep_read_state(obfuscationKey()), $.deep_read_state(shader())), () => {
13517
+ $.user_effect(() => {
13542
13518
  if (presetId()) {
13543
13519
  $.set(fetchedDefinition, null);
13544
13520
  fetchAndDecode(`${apiBaseUrl()}/api/preview/preset/${presetId()}`, obfuscationKey()).then((def) => {
13545
- $.set(fetchedDefinition, def);
13521
+ $.set(fetchedDefinition, def, true);
13546
13522
  });
13547
13523
  } else if (!shader()) $.set(fetchedDefinition, null);
13548
13524
  });
13549
- $.legacy_pre_effect(() => $.get(fetchedDefinition), () => {
13550
- $.set(resolvedDefinition, $.get(fetchedDefinition) ?? null);
13525
+ onMount(() => {
13526
+ console.warn("[Shaders] Preview component is intended for use with a Shaders license. Visit https://shaders.com for more information.");
13551
13527
  });
13552
- $.legacy_pre_effect_reset();
13553
- $.init();
13554
13528
  var fragment = $.comment();
13555
13529
  var node = $.first_child(fragment);
13556
13530
  var consequent_1 = ($$anchor$1) => {
@@ -13558,11 +13532,11 @@ function Preview($$anchor, $$props) {
13558
13532
  $.attribute_effect(div, () => ({
13559
13533
  class: "shaders-preview",
13560
13534
  style: `position: relative; width: 100%; height: 100%;${style() ? " " + style() : ""}`,
13561
- ...$$restProps
13535
+ ...restProps
13562
13536
  }));
13563
13537
  var node_1 = $.child(div);
13564
13538
  {
13565
- let $0 = $.derived_safe_equal(() => ($.get(resolvedDefinition), $.untrack(() => $.get(resolvedDefinition).colorSpace || "p3-linear")));
13539
+ let $0 = $.derived(() => $.get(resolvedDefinition).colorSpace || "p3-linear");
13566
13540
  Shader(node_1, {
13567
13541
  get colorSpace() {
13568
13542
  return $.get($0);
@@ -13573,12 +13547,12 @@ function Preview($$anchor, $$props) {
13573
13547
  children: ($$anchor$2, $$slotProps) => {
13574
13548
  var fragment_1 = $.comment();
13575
13549
  var node_2 = $.first_child(fragment_1);
13576
- $.each(node_2, 3, () => ($.get(resolvedDefinition), $.untrack(() => $.get(resolvedDefinition).components)), (config, index) => config.id || `root_${index}_v${$.get(resolvedDefinition).structureVersion || 0}`, ($$anchor$3, config, index) => {
13550
+ $.each(node_2, 19, () => $.get(resolvedDefinition).components, (config, index) => config.id || `root_${index}_v${$.get(resolvedDefinition).structureVersion || 0}`, ($$anchor$3, config, index) => {
13577
13551
  {
13578
- let $0$1 = $.derived_safe_equal(() => ($.get(config), $.deep_read_state($.get(index)), $.untrack(() => ({
13552
+ let $0$1 = $.derived(() => ({
13579
13553
  ...$.get(config),
13580
13554
  renderOrder: $.get(config).renderOrder ?? $.get(index)
13581
- }))));
13555
+ }));
13582
13556
  PreviewRenderComponent($$anchor$3, {
13583
13557
  get config() {
13584
13558
  return $.get($0$1);
@@ -13587,7 +13561,7 @@ function Preview($$anchor, $$props) {
13587
13561
  return componentMap;
13588
13562
  },
13589
13563
  get structureVersion() {
13590
- return $.get(resolvedDefinition), $.untrack(() => $.get(resolvedDefinition).structureVersion);
13564
+ return $.get(resolvedDefinition).structureVersion;
13591
13565
  }
13592
13566
  });
13593
13567
  }
@@ -19,6 +19,7 @@
19
19
  * Define component props including blend mode, opacity, visibility, masking, and transformation
20
20
  */
21
21
  interface ExtendedComponentProps extends Partial<ComponentProps> {
22
+ intensity?: ComponentProps['intensity'] | PropDriver;
22
23
  blendMode?: BlendMode;
23
24
  opacity?: number;
24
25
  visible?: boolean;
@@ -1,7 +1,9 @@
1
1
  <script lang="ts">
2
2
  import { onMount } from 'svelte'
3
+ import type { Snippet } from 'svelte'
3
4
 
4
5
  import Shader from './Shader.svelte'
6
+ import RenderComponent from './PreviewRenderComponent.svelte'
5
7
  // <<< SHADERS_PREVIEW_MAP:START >>>
6
8
  import AngularBlur from '../components/AngularBlur.svelte'
7
9
  import Ascii from '../components/Ascii.svelte'
@@ -258,39 +260,56 @@ function fetchAndDecode(url: string, key: string): Promise<ShaderDefinition | nu
258
260
 
259
261
  // --- Props ---
260
262
 
261
- export let shader: string | undefined = undefined
262
- export let presetId: string | undefined = undefined
263
- export let apiBaseUrl: string = 'https://shaders.com'
264
- export let obfuscationKey: string = 'shaders-preview-key'
265
- export let watermarkText: string = 'Unlock your Shaders Pro license'
266
- export let watermarkLink: string = 'https://shaders.com/dashboard?pricing=true'
267
- export let style: string | undefined = undefined
263
+ interface Props {
264
+ shader?: string
265
+ presetId?: string
266
+ apiBaseUrl?: string
267
+ obfuscationKey?: string
268
+ watermarkText?: string
269
+ watermarkLink?: string
270
+ style?: string
271
+ [key: string]: any
272
+ }
273
+
274
+ const {
275
+ shader = undefined,
276
+ presetId = undefined,
277
+ apiBaseUrl = 'https://shaders.com',
278
+ obfuscationKey = 'shaders-preview-key',
279
+ watermarkText = 'Unlock your Shaders Pro license',
280
+ watermarkLink = 'https://shaders.com/dashboard?pricing=true',
281
+ style = undefined,
282
+ ...restProps
283
+ }: Props = $props()
268
284
 
269
285
  // --- Decode & Resolve ---
270
286
 
271
- let resolvedDefinition: ShaderDefinition | null = null
272
- let fetchedDefinition: ShaderDefinition | null = null
273
- let watermarkHovered = false
287
+ let fetchedDefinition: ShaderDefinition | null = $state(null)
288
+ let watermarkHovered = $state(false)
289
+
290
+ let resolvedDefinition: ShaderDefinition | null = $derived(fetchedDefinition ?? null)
274
291
 
275
292
  // Fetch shader by token
276
- $: if (shader) {
277
- fetchedDefinition = null
278
- fetchAndDecode(`${apiBaseUrl}/api/preview/shader/${shader}`, obfuscationKey)
279
- .then(def => { fetchedDefinition = def })
280
- } else if (!presetId) {
281
- fetchedDefinition = null
282
- }
293
+ $effect(() => {
294
+ if (shader) {
295
+ fetchedDefinition = null
296
+ fetchAndDecode(`${apiBaseUrl}/api/preview/shader/${shader}`, obfuscationKey)
297
+ .then(def => { fetchedDefinition = def })
298
+ } else if (!presetId) {
299
+ fetchedDefinition = null
300
+ }
301
+ })
283
302
 
284
303
  // Fetch preset by ID
285
- $: if (presetId) {
286
- fetchedDefinition = null
287
- fetchAndDecode(`${apiBaseUrl}/api/preview/preset/${presetId}`, obfuscationKey)
288
- .then(def => { fetchedDefinition = def })
289
- } else if (!shader) {
290
- fetchedDefinition = null
291
- }
292
-
293
- $: resolvedDefinition = fetchedDefinition ?? null
304
+ $effect(() => {
305
+ if (presetId) {
306
+ fetchedDefinition = null
307
+ fetchAndDecode(`${apiBaseUrl}/api/preview/preset/${presetId}`, obfuscationKey)
308
+ .then(def => { fetchedDefinition = def })
309
+ } else if (!shader) {
310
+ fetchedDefinition = null
311
+ }
312
+ })
294
313
 
295
314
  // --- Licensing Warning ---
296
315
 
@@ -303,15 +322,10 @@ onMount(() => {
303
322
 
304
323
  </script>
305
324
 
306
- <script lang="ts" context="module">
307
- // Recursive component for rendering nested shader components
308
- import { default as RenderComponent } from './PreviewRenderComponent.svelte'
309
- </script>
310
-
311
325
  {#if resolvedDefinition}
312
- <div class="shaders-preview" style="position: relative; width: 100%; height: 100%;{style ? ' ' + style : ''}" {...$$restProps}>
326
+ <div class="shaders-preview" style="position: relative; width: 100%; height: 100%;{style ? ' ' + style : ''}" {...restProps}>
313
327
  <Shader
314
- colorSpace={resolvedDefinition.colorSpace || 'p3-linear'}
328
+ colorSpace={resolvedDefinition.colorSpace || 'p3-linear'}
315
329
  isPreview={true}
316
330
  enablePerformanceTracking={true}
317
331
  style="width: 100%; height: 100%;"
@@ -342,8 +356,8 @@ colorSpace={resolvedDefinition.colorSpace || 'p3-linear'}
342
356
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
343
357
  transition: color 0.2s ease;
344
358
  "
345
- on:mouseenter={() => watermarkHovered = true}
346
- on:mouseleave={() => watermarkHovered = false}
359
+ onmouseenter={() => watermarkHovered = true}
360
+ onmouseleave={() => watermarkHovered = false}
347
361
  >
348
362
  {watermarkText}
349
363
  </a>
@@ -1,10 +1,14 @@
1
1
  <script lang="ts">
2
- export let config: any
3
- export let componentMap: Record<string, any>
4
- export let structureVersion: number | undefined = undefined
2
+ interface Props {
3
+ config: any
4
+ componentMap: Record<string, any>
5
+ structureVersion?: number
6
+ }
5
7
 
6
- $: Component = componentMap[config.type]
7
- $: componentProps = config.props ? { ...config.props } : {}
8
+ const { config, componentMap, structureVersion = undefined }: Props = $props()
9
+
10
+ const Component = $derived(componentMap[config.type])
11
+ const componentProps = $derived(config.props ? { ...config.props } : {})
8
12
  </script>
9
13
 
10
14
  {#if Component}
@@ -1,2 +1,2 @@
1
- import { n as generatePresetCode, t as availableComponents } from "../generatePresetCode-Bpe8YcaW.js";
1
+ import { n as generatePresetCode, t as availableComponents } from "../generatePresetCode-6ecNqXs9.js";
2
2
  export { availableComponents, generatePresetCode };
@@ -6,6 +6,7 @@ var _hoisted_1 = ["data-shader-id"];
6
6
  var Liquify_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
7
7
  __name: "Liquify",
8
8
  props: /* @__PURE__ */ mergeDefaults({
9
+ intensity: {},
9
10
  blendMode: {},
10
11
  opacity: {},
11
12
  visible: { type: Boolean },
@@ -14,8 +15,8 @@ var Liquify_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
14
15
  maskType: {},
15
16
  renderOrder: {},
16
17
  transform: {},
17
- intensity: {},
18
- decay: {},
18
+ stiffness: {},
19
+ damping: {},
19
20
  radius: {},
20
21
  edges: {}
21
22
  }, {
@@ -57,7 +57,7 @@ var Shader_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
57
57
  const startTelemetryWhenReady = () => {
58
58
  const checkRendering = () => {
59
59
  if (rendererInstance.value.getPerformanceStats().fps > 0) {
60
- telemetryCollector = startTelemetry(rendererInstance.value, "2.4.78", props.disableTelemetry, props.isPreview);
60
+ telemetryCollector = startTelemetry(rendererInstance.value, "2.5.81", props.disableTelemetry, props.isPreview);
61
61
  if (telemetryCollector) telemetryCollector.start();
62
62
  telemetryStartTimeout = null;
63
63
  } else telemetryStartTimeout = setTimeout(checkRendering, 500);
@@ -1,10 +1,11 @@
1
- import { BlendMode, TransformConfig } from '../../core';
1
+ import { BlendMode, PropDriver, TransformConfig } from '../../core';
2
2
  import { ComponentProps } from '../../core/shaders/Liquify';
3
3
 
4
4
  /**
5
5
  * Define component props including blend mode, opacity, visibility, masking, and transformation
6
6
  */
7
7
  interface ExtendedComponentProps extends Partial<ComponentProps> {
8
+ intensity?: ComponentProps['intensity'] | PropDriver;
8
9
  blendMode?: BlendMode;
9
10
  opacity?: number;
10
11
  visible?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"Liquify.vue.d.ts","sourceRoot":"","sources":["../../src/components/Liquify.vue"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,SAAS,EAKd,KAAK,eAAe,EACrB,MAAM,cAAc,CAAA;AAIrB,OAAO,EAAsB,KAAK,cAAc,EAAC,MAAM,sBAAsB,CAAA;AAI7E;;GAEG;AACH,UAAU,sBAAuB,SAAQ,OAAO,CAAC,cAAc,CAAC;IAC9D,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CACtC;AA0RD,iBAAS,cAAc;qBAsCM,GAAG;EAK/B;AAUD,QAAA,MAAM,eAAe;;;;;;;eAvVP,SAAS;aAEX,OAAO;4EA2VjB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAAvG,wBAAwG;AACxG,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,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xD,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,QAAO;QAClD,MAAM,EAAE,CAAC,CAAC;KACT,CAAA;CAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"generatePresetCode.d.ts","sourceRoot":"","sources":["../../src/utils/generatePresetCode.ts"],"names":[],"mappings":"AAAA,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAA;CAC7B;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,eAAe,EAAE,CAAA;CAC9B;AA2rCD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,EAAE,UAAU,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,CA4ClG;AAGD,eAAO,MAAM,mBAAmB,UA4F/B,CAAA"}
1
+ {"version":3,"file":"generatePresetCode.d.ts","sourceRoot":"","sources":["../../src/utils/generatePresetCode.ts"],"names":[],"mappings":"AAAA,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAA;CAC7B;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,eAAe,EAAE,CAAA;CAC9B;AAqtCD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,EAAE,UAAU,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,CAiFlG;AAGD,eAAO,MAAM,mBAAmB,UA4F/B,CAAA"}
@@ -575,8 +575,9 @@ var shaderMetadata = {
575
575
  "Liquify": {
576
576
  "opacity": 1,
577
577
  "blendMode": "normal",
578
- "intensity": 1,
579
- "decay": 3,
578
+ "intensity": 10,
579
+ "stiffness": 3,
580
+ "damping": 3,
580
581
  "radius": 1,
581
582
  "edges": "stretch"
582
583
  },
@@ -1082,7 +1083,7 @@ function isPropMapValue(value) {
1082
1083
  function generatePropString(props, componentType, indent = " ") {
1083
1084
  return Object.entries(props).sort(([a], [b]) => a.localeCompare(b)).filter(([key, value]) => {
1084
1085
  if (key === "maskType" && value === "alpha") return false;
1085
- if (componentType === "Glass" && key === "shape" && props.shapeType === "svg") return false;
1086
+ if (key === "shape" && props.shapeSdfUrl) return false;
1086
1087
  if (key === "transform" && typeof value === "object") {
1087
1088
  if (Object.keys(DEFAULT_TRANSFORM).every((k) => value[k] === DEFAULT_TRANSFORM[k])) return false;
1088
1089
  }
@@ -1101,23 +1102,38 @@ function generatePropString(props, componentType, indent = " ") {
1101
1102
  const nonDefaultKeys = {};
1102
1103
  for (const k in value) if (value[k] !== DEFAULT_TRANSFORM[k]) nonDefaultKeys[k] = value[k];
1103
1104
  const keys = Object.keys(nonDefaultKeys).sort();
1104
- if (keys.length > 1) return `:${kebabKey}="{\n${indent} ${keys.map((k) => `'${k}':${typeof nonDefaultKeys[k] === "string" ? `'${nonDefaultKeys[k]}'` : nonDefaultKeys[k]}`).join(`,\n${indent} `)}\n${indent} }"`;
1105
+ if (keys.length > 1) return `:${kebabKey}="{\n${indent} ${keys.map((k) => `${k}: ${typeof nonDefaultKeys[k] === "string" ? `'${nonDefaultKeys[k]}'` : nonDefaultKeys[k]}`).join(`,\n${indent} `)}\n${indent} }"`;
1105
1106
  else if (keys.length === 1) {
1106
1107
  const k = keys[0];
1107
1108
  const v = nonDefaultKeys[k];
1108
- return `:${kebabKey}="{'${k}':${typeof v === "string" ? `'${v}'` : v}}"`;
1109
+ return `:${kebabKey}="{ ${k}: ${typeof v === "string" ? `'${v}'` : v} }"`;
1109
1110
  }
1110
1111
  }
1111
1112
  if (isPropMapValue(value)) return `:${kebabKey}="{\n${indent} ${Object.keys(value).map((k) => {
1112
1113
  const v = value[k];
1113
1114
  return `${k}: ${typeof v === "string" ? `'${v}'` : v}`;
1114
1115
  }).join(`,\n${indent} `)}\n${indent} }"`;
1115
- if (typeof value === "string") return `${kebabKey}="${value}"`;
1116
- else if (value !== null && typeof value === "object") {
1116
+ if (typeof value === "string") {
1117
+ if (value.startsWith("{") && value.endsWith("}")) try {
1118
+ const parsed = JSON.parse(value);
1119
+ if (typeof parsed === "object" && parsed !== null) {
1120
+ const keys = Object.keys(parsed);
1121
+ if (keys.length === 0) return `:${kebabKey}="{}"`;
1122
+ if (keys.length > 1) return `:${kebabKey}="{\n${indent} ${keys.map((k) => `${k}: ${typeof parsed[k] === "string" ? `'${parsed[k]}'` : parsed[k]}`).join(`,\n${indent} `)}\n${indent} }"`;
1123
+ const [pk] = keys;
1124
+ return `:${kebabKey}="{ ${pk}: ${typeof parsed[pk] === "string" ? `'${parsed[pk]}'` : parsed[pk]} }"`;
1125
+ }
1126
+ } catch {}
1127
+ return `${kebabKey}="${value}"`;
1128
+ } else if (value !== null && typeof value === "object") {
1117
1129
  const roundedValue = { ...value };
1118
1130
  if ("x" in roundedValue && typeof roundedValue.x === "number") roundedValue.x = Math.round(roundedValue.x * 100) / 100;
1119
1131
  if ("y" in roundedValue && typeof roundedValue.y === "number") roundedValue.y = Math.round(roundedValue.y * 100) / 100;
1120
- return `:${kebabKey}="${JSON.stringify(roundedValue).replace(/"/g, "'")}"`;
1132
+ const keys = Object.keys(roundedValue);
1133
+ if (keys.length === 0) return `:${kebabKey}="{}"`;
1134
+ if (keys.length > 1) return `:${kebabKey}="{\n${indent} ${keys.map((k) => `${k}: ${typeof roundedValue[k] === "string" ? `'${roundedValue[k]}'` : roundedValue[k]}`).join(`,\n${indent} `)}\n${indent} }"`;
1135
+ const [rk] = keys;
1136
+ return `:${kebabKey}="{ ${rk}: ${typeof roundedValue[rk] === "string" ? `'${roundedValue[rk]}'` : roundedValue[rk]} }"`;
1121
1137
  } else return `:${kebabKey}="${value}"`;
1122
1138
  }).join("\n" + indent + " ");
1123
1139
  }
@@ -1139,7 +1155,15 @@ function isIdReferenced(id, allComponents) {
1139
1155
  });
1140
1156
  }
1141
1157
  function generatePresetCode(preset, colorSpace) {
1142
- const generateComponentString = (config, indent = " ") => {
1158
+ const componentTypes = /* @__PURE__ */ new Set();
1159
+ function collectTypes(components) {
1160
+ for (const config of components) {
1161
+ componentTypes.add(config.type);
1162
+ if (config.children) collectTypes(config.children);
1163
+ }
1164
+ }
1165
+ collectTypes(preset.components);
1166
+ const generateComponentString = (config, indent = " ") => {
1143
1167
  const propString = config.props ? generatePropString(config.props, config.type, indent) : "";
1144
1168
  let idString = "";
1145
1169
  if (config.id) {
@@ -1154,7 +1178,21 @@ function generatePresetCode(preset, colorSpace) {
1154
1178
  else return `${indent}<${config.type}/>`;
1155
1179
  };
1156
1180
  const componentStrings = preset.components.map((config) => generateComponentString(config)).join("\n");
1157
- return `<Shader${colorSpace && colorSpace !== "p3-linear" ? ` color-space="${colorSpace}"` : ""}>\n${componentStrings}\n</Shader>`;
1181
+ const shaderProps = colorSpace && colorSpace !== "p3-linear" ? ` color-space="${colorSpace}"` : "";
1182
+ const allImports = ["Shader", ...Array.from(componentTypes).sort()];
1183
+ const uniqueImports = [...new Set(allImports)];
1184
+ const imports = uniqueImports.length > 3 ? uniqueImports.join(",\n ") : uniqueImports.join(", ");
1185
+ return [
1186
+ "<script setup lang=\"ts\">",
1187
+ uniqueImports.length > 3 ? `import {\n ${imports}\n} from 'shaders/vue'` : `import { ${imports} } from 'shaders/vue'`,
1188
+ "<\/script>",
1189
+ "",
1190
+ "<template>",
1191
+ ` <Shader${shaderProps}>`,
1192
+ componentStrings,
1193
+ " </Shader>",
1194
+ "</template>"
1195
+ ].join("\n");
1158
1196
  }
1159
1197
  const availableComponents = [
1160
1198
  "AngularBlur",
@@ -1 +1 @@
1
- {"version":3,"file":"generatePresetCode.template.d.ts","sourceRoot":"","sources":["../../src/utils/generatePresetCode.template.ts"],"names":[],"mappings":"AAAA,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAA;CAC7B;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,eAAe,EAAE,CAAA;CAC9B;AAkJD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,EAAE,UAAU,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,CA4ClG;AAGD,eAAO,MAAM,mBAAmB,OAG/B,CAAA"}
1
+ {"version":3,"file":"generatePresetCode.template.d.ts","sourceRoot":"","sources":["../../src/utils/generatePresetCode.template.ts"],"names":[],"mappings":"AAAA,UAAU,eAAe;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAA;CAC7B;AAED,UAAU,YAAY;IACpB,UAAU,EAAE,eAAe,EAAE,CAAA;CAC9B;AA2KD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,EAAE,UAAU,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,CAiFlG;AAGD,eAAO,MAAM,mBAAmB,OAG/B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shaders",
3
- "version": "2.4.78",
3
+ "version": "2.5.81",
4
4
  "description": "Shader magic for modern frontends",
5
5
  "author": "Shader Effects Inc.",
6
6
  "homepage": "https://shaders.com/",
@@ -55,6 +55,14 @@
55
55
  "types": "./dist/pixi/index.d.ts",
56
56
  "import": "./dist/pixi/index.js"
57
57
  },
58
+ "./js": {
59
+ "types": "./dist/js/index.d.ts",
60
+ "import": "./dist/js/index.js"
61
+ },
62
+ "./js/codegen": {
63
+ "types": "./dist/js/codegen.d.ts",
64
+ "import": "./dist/js/codegen.js"
65
+ },
58
66
  "./core": {
59
67
  "types": "./dist/core/index.d.ts",
60
68
  "import": "./dist/core/index.js",
@@ -570,6 +578,12 @@
570
578
  "pixi": [
571
579
  "./dist/pixi/index.d.ts"
572
580
  ],
581
+ "js": [
582
+ "./dist/js/index.d.ts"
583
+ ],
584
+ "js/codegen": [
585
+ "./dist/js/codegen.d.ts"
586
+ ],
573
587
  "core": [
574
588
  "./dist/core/index.d.ts"
575
589
  ],