shaders 2.2.42 → 2.2.44
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.
- package/dist/core/WebcamTexture-D4Uv7Plz.js +168 -0
- package/dist/core/index.d.ts +0 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +8 -168
- package/dist/core/registry.d.ts +10 -0
- package/dist/core/registry.d.ts.map +1 -0
- package/dist/core/registry.js +166 -0
- package/dist/core/shaderRegistry.d.ts.map +1 -1
- package/dist/core/shaders/WebcamTexture/index.d.ts +21 -0
- package/dist/core/shaders/WebcamTexture/index.d.ts.map +1 -0
- package/dist/core/shaders/WebcamTexture/index.js +2 -0
- package/dist/core/shaders/ZoomBlur/index.js +1 -1
- package/dist/react/AngularBlur.js +144 -0
- package/dist/react/Ascii.js +144 -0
- package/dist/react/Beam.js +144 -0
- package/dist/react/Blob.js +144 -0
- package/dist/react/Blur.js +144 -0
- package/dist/react/BrightnessContrast.js +144 -0
- package/dist/react/Bulge.js +144 -0
- package/dist/react/CRTScreen.js +144 -0
- package/dist/react/ChannelBlur.js +144 -0
- package/dist/react/Checkerboard.js +144 -0
- package/dist/react/ChromaFlow.js +144 -0
- package/dist/react/ChromaticAberration.js +144 -0
- package/dist/react/Circle.js +144 -0
- package/dist/react/CursorTrail.js +144 -0
- package/dist/react/DiffuseBlur.js +144 -0
- package/dist/react/Dither.js +144 -0
- package/dist/react/DotGrid.js +144 -0
- package/dist/react/Duotone.js +144 -0
- package/dist/react/FilmGrain.js +144 -0
- package/dist/react/FloatingParticles.js +144 -0
- package/dist/react/GlassTiles.js +144 -0
- package/dist/react/Glow.js +144 -0
- package/dist/react/Godrays.js +144 -0
- package/dist/react/Grayscale.js +144 -0
- package/dist/react/Grid.js +144 -0
- package/dist/react/GridDistortion.js +144 -0
- package/dist/react/Group.js +144 -0
- package/dist/react/Halftone.js +144 -0
- package/dist/react/HueShift.js +144 -0
- package/dist/react/ImageTexture.js +144 -0
- package/dist/react/Invert.js +144 -0
- package/dist/react/LinearBlur.js +144 -0
- package/dist/react/LinearGradient.js +144 -0
- package/dist/react/Liquify.js +144 -0
- package/dist/react/Perspective.js +144 -0
- package/dist/react/Pixelate.js +144 -0
- package/dist/react/PolarCoordinates.js +144 -0
- package/dist/react/Posterize.js +144 -0
- package/dist/react/ProgressiveBlur.js +144 -0
- package/dist/react/RadialGradient.js +144 -0
- package/dist/react/RectangularCoordinates.js +144 -0
- package/dist/react/Ripples.js +144 -0
- package/dist/react/Saturation.js +144 -0
- package/dist/react/Shader.js +166 -0
- package/dist/react/Sharpness.js +144 -0
- package/dist/react/Shatter.js +144 -0
- package/dist/react/SimplexNoise.js +144 -0
- package/dist/react/SineWave.js +144 -0
- package/dist/react/SolidColor.js +144 -0
- package/dist/react/Spherize.js +144 -0
- package/dist/react/Spiral.js +144 -0
- package/dist/react/Strands.js +144 -0
- package/dist/react/Stretch.js +144 -0
- package/dist/react/Stripes.js +144 -0
- package/dist/react/Swirl.js +144 -0
- package/dist/react/TiltShift.js +144 -0
- package/dist/react/Tint.js +144 -0
- package/dist/react/Tritone.js +144 -0
- package/dist/react/Twirl.js +144 -0
- package/dist/react/Vibrance.js +144 -0
- package/dist/react/WaveDistortion.js +144 -0
- package/dist/react/WebcamTexture.js +144 -0
- package/dist/react/ZoomBlur.js +144 -0
- package/dist/react/components/WebcamTexture.d.ts +31 -0
- package/dist/react/components/WebcamTexture.d.ts.map +1 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +65 -8646
- package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/react/utils/generatePresetCode.js +392 -1
- package/dist/registry.js +91 -0
- package/dist/solid/components/AngularBlur.js +148 -0
- package/dist/solid/components/Ascii.js +148 -0
- package/dist/solid/components/Beam.js +148 -0
- package/dist/solid/components/Blob.js +148 -0
- package/dist/solid/components/Blur.js +148 -0
- package/dist/solid/components/BrightnessContrast.js +148 -0
- package/dist/solid/components/Bulge.js +148 -0
- package/dist/solid/components/CRTScreen.js +148 -0
- package/dist/solid/components/ChannelBlur.js +148 -0
- package/dist/solid/components/Checkerboard.js +148 -0
- package/dist/solid/components/ChromaFlow.js +148 -0
- package/dist/solid/components/ChromaticAberration.js +148 -0
- package/dist/solid/components/Circle.js +148 -0
- package/dist/solid/components/CursorTrail.js +148 -0
- package/dist/solid/components/DiffuseBlur.js +148 -0
- package/dist/solid/components/Dither.js +148 -0
- package/dist/solid/components/DotGrid.js +148 -0
- package/dist/solid/components/Duotone.js +148 -0
- package/dist/solid/components/FilmGrain.js +148 -0
- package/dist/solid/components/FloatingParticles.js +148 -0
- package/dist/solid/components/GlassTiles.js +148 -0
- package/dist/solid/components/Glow.js +148 -0
- package/dist/solid/components/Godrays.js +148 -0
- package/dist/solid/components/Grayscale.js +148 -0
- package/dist/solid/components/Grid.js +148 -0
- package/dist/solid/components/GridDistortion.js +148 -0
- package/dist/solid/components/Group.js +148 -0
- package/dist/solid/components/Halftone.js +148 -0
- package/dist/solid/components/HueShift.js +148 -0
- package/dist/solid/components/ImageTexture.js +148 -0
- package/dist/solid/components/Invert.js +148 -0
- package/dist/solid/components/LinearBlur.js +148 -0
- package/dist/solid/components/LinearGradient.js +148 -0
- package/dist/solid/components/Liquify.js +148 -0
- package/dist/solid/components/Perspective.js +148 -0
- package/dist/solid/components/Pixelate.js +148 -0
- package/dist/solid/components/PolarCoordinates.js +148 -0
- package/dist/solid/components/Posterize.js +148 -0
- package/dist/solid/components/ProgressiveBlur.js +148 -0
- package/dist/solid/components/RadialGradient.js +148 -0
- package/dist/solid/components/RectangularCoordinates.js +148 -0
- package/dist/solid/components/Ripples.js +148 -0
- package/dist/solid/components/Saturation.js +148 -0
- package/dist/solid/components/Sharpness.js +148 -0
- package/dist/solid/components/Shatter.js +148 -0
- package/dist/solid/components/SimplexNoise.js +148 -0
- package/dist/solid/components/SineWave.js +148 -0
- package/dist/solid/components/SolidColor.js +148 -0
- package/dist/solid/components/Spherize.js +148 -0
- package/dist/solid/components/Spiral.js +148 -0
- package/dist/solid/components/Strands.js +148 -0
- package/dist/solid/components/Stretch.js +148 -0
- package/dist/solid/components/Stripes.js +148 -0
- package/dist/solid/components/Swirl.js +148 -0
- package/dist/solid/components/TiltShift.js +148 -0
- package/dist/solid/components/Tint.js +148 -0
- package/dist/solid/components/Tritone.js +148 -0
- package/dist/solid/components/Twirl.js +148 -0
- package/dist/solid/components/Vibrance.js +148 -0
- package/dist/solid/components/WaveDistortion.js +148 -0
- package/dist/solid/components/WebcamTexture.d.ts +28 -0
- package/dist/solid/components/WebcamTexture.d.ts.map +1 -0
- package/dist/solid/components/WebcamTexture.js +148 -0
- package/dist/solid/components/ZoomBlur.js +148 -0
- package/dist/solid/engine/Shader.js +189 -0
- package/dist/solid/index.d.ts +1 -0
- package/dist/solid/index.d.ts.map +1 -1
- package/dist/solid/index.js +126 -8847
- package/dist/solid/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/solid/utils/generatePresetCode.js +66 -414
- package/dist/svelte/components/WebcamTexture.svelte.d.ts +19 -0
- package/dist/svelte/generatePresetCode-CtXcoyI0.js +393 -0
- package/dist/svelte/index.d.ts +1 -0
- package/dist/svelte/index.js +115 -4
- package/dist/svelte/utils/generatePresetCode.js +1 -1
- package/dist/vue/AngularBlur.js +3 -0
- package/dist/vue/AngularBlur.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/vue/Ascii.js +3 -0
- package/dist/vue/Ascii.vue_vue_type_script_setup_true_lang.js +127 -0
- package/dist/vue/Beam.js +3 -0
- package/dist/vue/Beam.vue_vue_type_script_setup_true_lang.js +132 -0
- package/dist/vue/Blob.js +3 -0
- package/dist/vue/Blob.vue_vue_type_script_setup_true_lang.js +137 -0
- package/dist/vue/Blur.js +3 -0
- package/dist/vue/Blur.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/vue/BrightnessContrast.js +3 -0
- package/dist/vue/BrightnessContrast.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/vue/Bulge.js +3 -0
- package/dist/vue/Bulge.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/vue/CRTScreen.js +3 -0
- package/dist/vue/CRTScreen.vue_vue_type_script_setup_true_lang.js +129 -0
- package/dist/vue/ChannelBlur.js +3 -0
- package/dist/vue/ChannelBlur.vue_vue_type_script_setup_true_lang.js +126 -0
- package/dist/vue/Checkerboard.js +3 -0
- package/dist/vue/Checkerboard.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/vue/ChromaFlow.js +3 -0
- package/dist/vue/ChromaFlow.vue_vue_type_script_setup_true_lang.js +131 -0
- package/dist/vue/ChromaticAberration.js +3 -0
- package/dist/vue/ChromaticAberration.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/vue/Circle.js +3 -0
- package/dist/vue/Circle.vue_vue_type_script_setup_true_lang.js +127 -0
- package/dist/vue/CursorTrail.js +3 -0
- package/dist/vue/CursorTrail.vue_vue_type_script_setup_true_lang.js +129 -0
- package/dist/vue/DiffuseBlur.js +3 -0
- package/dist/vue/DiffuseBlur.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/vue/Dither.js +3 -0
- package/dist/vue/Dither.vue_vue_type_script_setup_true_lang.js +127 -0
- package/dist/vue/DotGrid.js +3 -0
- package/dist/vue/DotGrid.vue_vue_type_script_setup_true_lang.js +127 -0
- package/dist/vue/Duotone.js +3 -0
- package/dist/vue/Duotone.vue_vue_type_script_setup_true_lang.js +127 -0
- package/dist/vue/FilmGrain.js +3 -0
- package/dist/vue/FilmGrain.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/vue/FloatingParticles.js +3 -0
- package/dist/vue/FloatingParticles.vue_vue_type_script_setup_true_lang.js +134 -0
- package/dist/vue/GlassTiles.js +3 -0
- package/dist/vue/GlassTiles.vue_vue_type_script_setup_true_lang.js +127 -0
- package/dist/vue/Glow.js +3 -0
- package/dist/vue/Glow.vue_vue_type_script_setup_true_lang.js +126 -0
- package/dist/vue/Godrays.js +3 -0
- package/dist/vue/Godrays.vue_vue_type_script_setup_true_lang.js +130 -0
- package/dist/vue/Grayscale.js +3 -0
- package/dist/vue/Grayscale.vue_vue_type_script_setup_true_lang.js +123 -0
- package/dist/vue/Grid.js +3 -0
- package/dist/vue/Grid.vue_vue_type_script_setup_true_lang.js +126 -0
- package/dist/vue/GridDistortion.js +3 -0
- package/dist/vue/GridDistortion.vue_vue_type_script_setup_true_lang.js +129 -0
- package/dist/vue/Group.js +3 -0
- package/dist/vue/Group.vue_vue_type_script_setup_true_lang.js +123 -0
- package/dist/vue/Halftone.js +3 -0
- package/dist/vue/Halftone.vue_vue_type_script_setup_true_lang.js +126 -0
- package/dist/vue/HueShift.js +3 -0
- package/dist/vue/HueShift.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/vue/ImageTexture.js +3 -0
- package/dist/vue/ImageTexture.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/vue/Invert.js +3 -0
- package/dist/vue/Invert.vue_vue_type_script_setup_true_lang.js +123 -0
- package/dist/vue/LinearBlur.js +3 -0
- package/dist/vue/LinearBlur.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/vue/LinearGradient.js +3 -0
- package/dist/vue/LinearGradient.vue_vue_type_script_setup_true_lang.js +130 -0
- package/dist/vue/Liquify.js +3 -0
- package/dist/vue/Liquify.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/vue/Perspective.js +3 -0
- package/dist/vue/Perspective.vue_vue_type_script_setup_true_lang.js +130 -0
- package/dist/vue/Pixelate.js +3 -0
- package/dist/vue/Pixelate.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/vue/PolarCoordinates.js +3 -0
- package/dist/vue/PolarCoordinates.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/vue/Posterize.js +3 -0
- package/dist/vue/Posterize.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/vue/ProgressiveBlur.js +3 -0
- package/dist/vue/ProgressiveBlur.vue_vue_type_script_setup_true_lang.js +127 -0
- package/dist/vue/RadialGradient.js +3 -0
- package/dist/vue/RadialGradient.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/vue/RectangularCoordinates.js +3 -0
- package/dist/vue/RectangularCoordinates.vue_vue_type_script_setup_true_lang.js +127 -0
- package/dist/vue/Ripples.js +3 -0
- package/dist/vue/Ripples.vue_vue_type_script_setup_true_lang.js +131 -0
- package/dist/vue/Saturation.js +3 -0
- package/dist/vue/Saturation.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/vue/Shader.js +3 -0
- package/dist/vue/Shader.vue_vue_type_script_setup_true_lang.js +153 -0
- package/dist/vue/Sharpness.js +3 -0
- package/dist/vue/Sharpness.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/vue/Shatter.js +3 -0
- package/dist/vue/Shatter.vue_vue_type_script_setup_true_lang.js +132 -0
- package/dist/vue/SimplexNoise.js +3 -0
- package/dist/vue/SimplexNoise.vue_vue_type_script_setup_true_lang.js +130 -0
- package/dist/vue/SineWave.js +3 -0
- package/dist/vue/SineWave.vue_vue_type_script_setup_true_lang.js +131 -0
- package/dist/vue/SolidColor.js +3 -0
- package/dist/vue/SolidColor.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/vue/Spherize.js +3 -0
- package/dist/vue/Spherize.vue_vue_type_script_setup_true_lang.js +130 -0
- package/dist/vue/Spiral.js +3 -0
- package/dist/vue/Spiral.vue_vue_type_script_setup_true_lang.js +132 -0
- package/dist/vue/Strands.js +3 -0
- package/dist/vue/Strands.vue_vue_type_script_setup_true_lang.js +132 -0
- package/dist/vue/Stretch.js +3 -0
- package/dist/vue/Stretch.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/vue/Stripes.js +3 -0
- package/dist/vue/Stripes.vue_vue_type_script_setup_true_lang.js +132 -0
- package/dist/vue/Swirl.js +3 -0
- package/dist/vue/Swirl.vue_vue_type_script_setup_true_lang.js +129 -0
- package/dist/vue/TiltShift.js +3 -0
- package/dist/vue/TiltShift.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/vue/Tint.js +3 -0
- package/dist/vue/Tint.vue_vue_type_script_setup_true_lang.js +126 -0
- package/dist/vue/Tritone.js +3 -0
- package/dist/vue/Tritone.vue_vue_type_script_setup_true_lang.js +128 -0
- package/dist/vue/Twirl.js +3 -0
- package/dist/vue/Twirl.vue_vue_type_script_setup_true_lang.js +126 -0
- package/dist/vue/Vibrance.js +3 -0
- package/dist/vue/Vibrance.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/vue/WaveDistortion.js +3 -0
- package/dist/vue/WaveDistortion.vue_vue_type_script_setup_true_lang.js +129 -0
- package/dist/vue/WebcamTexture.js +3 -0
- package/dist/vue/WebcamTexture.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/vue/ZoomBlur.js +3 -0
- package/dist/vue/ZoomBlur.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/vue/components/WebcamTexture.vue.d.ts +57 -0
- package/dist/vue/components/WebcamTexture.vue.d.ts.map +1 -0
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +65 -7749
- package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/vue/utils/generatePresetCode.js +391 -1
- package/package.json +9 -1
- package/dist/react/generatePresetCode-BrkW1bEe.js +0 -741
- package/dist/svelte/generatePresetCode-bx7z5wvC.js +0 -741
- package/dist/vue/generatePresetCode-_7ZzqQPH.js +0 -740
- /package/dist/core/{ZoomBlur-CTrw7HxX.js → ZoomBlur-CIkkDBIo.js} +0 -0
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
var DEFAULT_TRANSFORM = {
|
|
2
|
+
offsetX: 0,
|
|
3
|
+
offsetY: 0,
|
|
4
|
+
rotation: 0,
|
|
5
|
+
scale: 1,
|
|
6
|
+
anchorX: .5,
|
|
7
|
+
anchorY: .5,
|
|
8
|
+
edges: "transparent"
|
|
9
|
+
};
|
|
10
|
+
function toObjectLiteral(obj) {
|
|
11
|
+
return `{ ${Object.entries(obj).map(([key, value]) => {
|
|
12
|
+
return `${key}: ${typeof value === "string" ? `"${value}"` : value}`;
|
|
13
|
+
}).join(", ")} }`;
|
|
14
|
+
}
|
|
15
|
+
var shaderMetadata = {
|
|
16
|
+
"AngularBlur": {
|
|
17
|
+
"opacity": 1,
|
|
18
|
+
"blendMode": "normal"
|
|
19
|
+
},
|
|
20
|
+
"Ascii": {
|
|
21
|
+
"opacity": 1,
|
|
22
|
+
"blendMode": "normal"
|
|
23
|
+
},
|
|
24
|
+
"Beam": {
|
|
25
|
+
"opacity": 1,
|
|
26
|
+
"blendMode": "normal"
|
|
27
|
+
},
|
|
28
|
+
"Blob": {
|
|
29
|
+
"opacity": 1,
|
|
30
|
+
"blendMode": "normal"
|
|
31
|
+
},
|
|
32
|
+
"Blur": {
|
|
33
|
+
"opacity": 1,
|
|
34
|
+
"blendMode": "normal"
|
|
35
|
+
},
|
|
36
|
+
"BrightnessContrast": {
|
|
37
|
+
"opacity": 1,
|
|
38
|
+
"blendMode": "normal"
|
|
39
|
+
},
|
|
40
|
+
"Bulge": {
|
|
41
|
+
"opacity": 1,
|
|
42
|
+
"blendMode": "normal"
|
|
43
|
+
},
|
|
44
|
+
"CRTScreen": {
|
|
45
|
+
"opacity": 1,
|
|
46
|
+
"blendMode": "normal"
|
|
47
|
+
},
|
|
48
|
+
"ChannelBlur": {
|
|
49
|
+
"opacity": 1,
|
|
50
|
+
"blendMode": "normal"
|
|
51
|
+
},
|
|
52
|
+
"Checkerboard": {
|
|
53
|
+
"opacity": 1,
|
|
54
|
+
"blendMode": "normal"
|
|
55
|
+
},
|
|
56
|
+
"ChromaFlow": {
|
|
57
|
+
"opacity": 1,
|
|
58
|
+
"blendMode": "normal"
|
|
59
|
+
},
|
|
60
|
+
"ChromaticAberration": {
|
|
61
|
+
"opacity": 1,
|
|
62
|
+
"blendMode": "normal"
|
|
63
|
+
},
|
|
64
|
+
"Circle": {
|
|
65
|
+
"opacity": 1,
|
|
66
|
+
"blendMode": "normal"
|
|
67
|
+
},
|
|
68
|
+
"CursorTrail": {
|
|
69
|
+
"opacity": 1,
|
|
70
|
+
"blendMode": "normal"
|
|
71
|
+
},
|
|
72
|
+
"DiffuseBlur": {
|
|
73
|
+
"opacity": 1,
|
|
74
|
+
"blendMode": "normal"
|
|
75
|
+
},
|
|
76
|
+
"Dither": {
|
|
77
|
+
"opacity": 1,
|
|
78
|
+
"blendMode": "normal"
|
|
79
|
+
},
|
|
80
|
+
"DotGrid": {
|
|
81
|
+
"opacity": 1,
|
|
82
|
+
"blendMode": "normal"
|
|
83
|
+
},
|
|
84
|
+
"Duotone": {
|
|
85
|
+
"opacity": 1,
|
|
86
|
+
"blendMode": "normal"
|
|
87
|
+
},
|
|
88
|
+
"FilmGrain": {
|
|
89
|
+
"opacity": 1,
|
|
90
|
+
"blendMode": "normal"
|
|
91
|
+
},
|
|
92
|
+
"FloatingParticles": {
|
|
93
|
+
"opacity": 1,
|
|
94
|
+
"blendMode": "normal"
|
|
95
|
+
},
|
|
96
|
+
"GlassTiles": {
|
|
97
|
+
"opacity": 1,
|
|
98
|
+
"blendMode": "normal"
|
|
99
|
+
},
|
|
100
|
+
"Glow": {
|
|
101
|
+
"opacity": 1,
|
|
102
|
+
"blendMode": "normal"
|
|
103
|
+
},
|
|
104
|
+
"Godrays": {
|
|
105
|
+
"opacity": 1,
|
|
106
|
+
"blendMode": "normal"
|
|
107
|
+
},
|
|
108
|
+
"Grayscale": {
|
|
109
|
+
"opacity": 1,
|
|
110
|
+
"blendMode": "normal"
|
|
111
|
+
},
|
|
112
|
+
"Grid": {
|
|
113
|
+
"opacity": 1,
|
|
114
|
+
"blendMode": "normal"
|
|
115
|
+
},
|
|
116
|
+
"GridDistortion": {
|
|
117
|
+
"opacity": 1,
|
|
118
|
+
"blendMode": "normal"
|
|
119
|
+
},
|
|
120
|
+
"Group": {
|
|
121
|
+
"opacity": 1,
|
|
122
|
+
"blendMode": "normal"
|
|
123
|
+
},
|
|
124
|
+
"Halftone": {
|
|
125
|
+
"opacity": 1,
|
|
126
|
+
"blendMode": "normal"
|
|
127
|
+
},
|
|
128
|
+
"HueShift": {
|
|
129
|
+
"opacity": 1,
|
|
130
|
+
"blendMode": "normal"
|
|
131
|
+
},
|
|
132
|
+
"ImageTexture": {
|
|
133
|
+
"opacity": 1,
|
|
134
|
+
"blendMode": "normal"
|
|
135
|
+
},
|
|
136
|
+
"Invert": {
|
|
137
|
+
"opacity": 1,
|
|
138
|
+
"blendMode": "normal"
|
|
139
|
+
},
|
|
140
|
+
"LinearBlur": {
|
|
141
|
+
"opacity": 1,
|
|
142
|
+
"blendMode": "normal"
|
|
143
|
+
},
|
|
144
|
+
"LinearGradient": {
|
|
145
|
+
"opacity": 1,
|
|
146
|
+
"blendMode": "normal"
|
|
147
|
+
},
|
|
148
|
+
"Liquify": {
|
|
149
|
+
"opacity": 1,
|
|
150
|
+
"blendMode": "normal"
|
|
151
|
+
},
|
|
152
|
+
"Perspective": {
|
|
153
|
+
"opacity": 1,
|
|
154
|
+
"blendMode": "normal"
|
|
155
|
+
},
|
|
156
|
+
"Pixelate": {
|
|
157
|
+
"opacity": 1,
|
|
158
|
+
"blendMode": "normal"
|
|
159
|
+
},
|
|
160
|
+
"PolarCoordinates": {
|
|
161
|
+
"opacity": 1,
|
|
162
|
+
"blendMode": "normal"
|
|
163
|
+
},
|
|
164
|
+
"Posterize": {
|
|
165
|
+
"opacity": 1,
|
|
166
|
+
"blendMode": "normal"
|
|
167
|
+
},
|
|
168
|
+
"ProgressiveBlur": {
|
|
169
|
+
"opacity": 1,
|
|
170
|
+
"blendMode": "normal"
|
|
171
|
+
},
|
|
172
|
+
"RadialGradient": {
|
|
173
|
+
"opacity": 1,
|
|
174
|
+
"blendMode": "normal"
|
|
175
|
+
},
|
|
176
|
+
"RectangularCoordinates": {
|
|
177
|
+
"opacity": 1,
|
|
178
|
+
"blendMode": "normal"
|
|
179
|
+
},
|
|
180
|
+
"Ripples": {
|
|
181
|
+
"opacity": 1,
|
|
182
|
+
"blendMode": "normal"
|
|
183
|
+
},
|
|
184
|
+
"Saturation": {
|
|
185
|
+
"opacity": 1,
|
|
186
|
+
"blendMode": "normal"
|
|
187
|
+
},
|
|
188
|
+
"Sharpness": {
|
|
189
|
+
"opacity": 1,
|
|
190
|
+
"blendMode": "normal"
|
|
191
|
+
},
|
|
192
|
+
"Shatter": {
|
|
193
|
+
"opacity": 1,
|
|
194
|
+
"blendMode": "normal"
|
|
195
|
+
},
|
|
196
|
+
"SimplexNoise": {
|
|
197
|
+
"opacity": 1,
|
|
198
|
+
"blendMode": "normal"
|
|
199
|
+
},
|
|
200
|
+
"SineWave": {
|
|
201
|
+
"opacity": 1,
|
|
202
|
+
"blendMode": "normal"
|
|
203
|
+
},
|
|
204
|
+
"SolidColor": {
|
|
205
|
+
"opacity": 1,
|
|
206
|
+
"blendMode": "normal"
|
|
207
|
+
},
|
|
208
|
+
"Spherize": {
|
|
209
|
+
"opacity": 1,
|
|
210
|
+
"blendMode": "normal"
|
|
211
|
+
},
|
|
212
|
+
"Spiral": {
|
|
213
|
+
"opacity": 1,
|
|
214
|
+
"blendMode": "normal"
|
|
215
|
+
},
|
|
216
|
+
"Strands": {
|
|
217
|
+
"opacity": 1,
|
|
218
|
+
"blendMode": "normal"
|
|
219
|
+
},
|
|
220
|
+
"Stretch": {
|
|
221
|
+
"opacity": 1,
|
|
222
|
+
"blendMode": "normal"
|
|
223
|
+
},
|
|
224
|
+
"Stripes": {
|
|
225
|
+
"opacity": 1,
|
|
226
|
+
"blendMode": "normal"
|
|
227
|
+
},
|
|
228
|
+
"Swirl": {
|
|
229
|
+
"opacity": 1,
|
|
230
|
+
"blendMode": "normal"
|
|
231
|
+
},
|
|
232
|
+
"TiltShift": {
|
|
233
|
+
"opacity": 1,
|
|
234
|
+
"blendMode": "normal"
|
|
235
|
+
},
|
|
236
|
+
"Tint": {
|
|
237
|
+
"opacity": 1,
|
|
238
|
+
"blendMode": "normal"
|
|
239
|
+
},
|
|
240
|
+
"Tritone": {
|
|
241
|
+
"opacity": 1,
|
|
242
|
+
"blendMode": "normal"
|
|
243
|
+
},
|
|
244
|
+
"Twirl": {
|
|
245
|
+
"opacity": 1,
|
|
246
|
+
"blendMode": "normal"
|
|
247
|
+
},
|
|
248
|
+
"Vibrance": {
|
|
249
|
+
"opacity": 1,
|
|
250
|
+
"blendMode": "normal"
|
|
251
|
+
},
|
|
252
|
+
"WaveDistortion": {
|
|
253
|
+
"opacity": 1,
|
|
254
|
+
"blendMode": "normal"
|
|
255
|
+
},
|
|
256
|
+
"WebcamTexture": {
|
|
257
|
+
"opacity": 1,
|
|
258
|
+
"blendMode": "normal"
|
|
259
|
+
},
|
|
260
|
+
"ZoomBlur": {
|
|
261
|
+
"opacity": 1,
|
|
262
|
+
"blendMode": "normal"
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
function generatePropString(props, componentType, indent = " ") {
|
|
266
|
+
return Object.entries(props).sort(([a], [b]) => a.localeCompare(b)).filter(([key, value]) => {
|
|
267
|
+
if (key === "maskType" && value === "alpha") return false;
|
|
268
|
+
if (key === "transform" && typeof value === "object") {
|
|
269
|
+
if (Object.keys(DEFAULT_TRANSFORM).every((k) => value[k] === DEFAULT_TRANSFORM[k])) return false;
|
|
270
|
+
}
|
|
271
|
+
const componentDefaults = shaderMetadata[componentType] || {};
|
|
272
|
+
if (componentDefaults.hasOwnProperty(key)) {
|
|
273
|
+
const defaultValue = componentDefaults[key];
|
|
274
|
+
if (value != null && defaultValue != null && typeof value === "object" && typeof defaultValue === "object") return JSON.stringify(value) !== JSON.stringify(defaultValue);
|
|
275
|
+
return value !== defaultValue;
|
|
276
|
+
}
|
|
277
|
+
if (key === "opacity" && value === 1) return false;
|
|
278
|
+
if (key === "blendMode" && value === "normal") return false;
|
|
279
|
+
return true;
|
|
280
|
+
}).map(([key, value]) => {
|
|
281
|
+
if (key === "transform" && typeof value === "object") {
|
|
282
|
+
const nonDefaultKeys = {};
|
|
283
|
+
for (const k in value) if (value[k] !== DEFAULT_TRANSFORM[k]) nonDefaultKeys[k] = value[k];
|
|
284
|
+
const keys = Object.keys(nonDefaultKeys).sort();
|
|
285
|
+
if (keys.length > 1) return `${key}={{\n${indent} ${keys.map((k) => `${k}: ${typeof nonDefaultKeys[k] === "string" ? `"${nonDefaultKeys[k]}"` : nonDefaultKeys[k]}`).join(`,\n${indent} `)}\n${indent} }}`;
|
|
286
|
+
else if (keys.length === 1) {
|
|
287
|
+
const k = keys[0];
|
|
288
|
+
const v = nonDefaultKeys[k];
|
|
289
|
+
return `${key}={{ ${k}: ${typeof v === "string" ? `"${v}"` : v} }}`;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (typeof value === "string") return `${key}="${value}"`;
|
|
293
|
+
else if (value !== null && typeof value === "object") {
|
|
294
|
+
const roundedValue = { ...value };
|
|
295
|
+
if ("x" in roundedValue && typeof roundedValue.x === "number") roundedValue.x = Math.round(roundedValue.x * 100) / 100;
|
|
296
|
+
if ("y" in roundedValue && typeof roundedValue.y === "number") roundedValue.y = Math.round(roundedValue.y * 100) / 100;
|
|
297
|
+
return `${key}={${toObjectLiteral(roundedValue)}}`;
|
|
298
|
+
} else return `${key}={${value}}`;
|
|
299
|
+
}).join("\n" + indent + " ");
|
|
300
|
+
}
|
|
301
|
+
function isIdUsedAsMaskSource(id, allComponents) {
|
|
302
|
+
const flatComponents = [];
|
|
303
|
+
function flattenComponents(components) {
|
|
304
|
+
for (const component of components) {
|
|
305
|
+
flatComponents.push(component);
|
|
306
|
+
if (component.children) flattenComponents(component.children);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
flattenComponents(allComponents);
|
|
310
|
+
return flatComponents.some((component) => component.props?.maskSource === id);
|
|
311
|
+
}
|
|
312
|
+
function generatePresetCode(preset) {
|
|
313
|
+
const generateComponentString = (config, indent = " ") => {
|
|
314
|
+
const propString = config.props ? generatePropString(config.props, config.type, indent) : "";
|
|
315
|
+
let idString = "";
|
|
316
|
+
if (config.id) {
|
|
317
|
+
if (isIdUsedAsMaskSource(config.id, preset.components)) idString = `id="${config.id}"`;
|
|
318
|
+
}
|
|
319
|
+
const attributes = [idString, propString].filter(Boolean).join("\n" + indent + " ");
|
|
320
|
+
if (config.children && config.children.length > 0) {
|
|
321
|
+
const childrenString = config.children.map((child) => generateComponentString(child, indent + " ")).join("\n");
|
|
322
|
+
if (attributes) return `${indent}<${config.type}\n${indent} ${attributes}>\n${childrenString}\n${indent}</${config.type}>`;
|
|
323
|
+
else return `${indent}<${config.type}>\n${childrenString}\n${indent}</${config.type}>`;
|
|
324
|
+
} else if (attributes) return `${indent}<${config.type}\n${indent} ${attributes} />`;
|
|
325
|
+
else return `${indent}<${config.type} />`;
|
|
326
|
+
};
|
|
327
|
+
return `<Shader>\n${preset.components.map((config) => generateComponentString(config)).join("\n")}\n</Shader>`;
|
|
328
|
+
}
|
|
329
|
+
const availableComponents = [
|
|
330
|
+
"AngularBlur",
|
|
331
|
+
"Ascii",
|
|
332
|
+
"Beam",
|
|
333
|
+
"Blob",
|
|
334
|
+
"Blur",
|
|
335
|
+
"BrightnessContrast",
|
|
336
|
+
"Bulge",
|
|
337
|
+
"CRTScreen",
|
|
338
|
+
"ChannelBlur",
|
|
339
|
+
"Checkerboard",
|
|
340
|
+
"ChromaFlow",
|
|
341
|
+
"ChromaticAberration",
|
|
342
|
+
"Circle",
|
|
343
|
+
"CursorTrail",
|
|
344
|
+
"DiffuseBlur",
|
|
345
|
+
"Dither",
|
|
346
|
+
"DotGrid",
|
|
347
|
+
"Duotone",
|
|
348
|
+
"FilmGrain",
|
|
349
|
+
"FloatingParticles",
|
|
350
|
+
"GlassTiles",
|
|
351
|
+
"Glow",
|
|
352
|
+
"Godrays",
|
|
353
|
+
"Grayscale",
|
|
354
|
+
"Grid",
|
|
355
|
+
"GridDistortion",
|
|
356
|
+
"Group",
|
|
357
|
+
"Halftone",
|
|
358
|
+
"HueShift",
|
|
359
|
+
"ImageTexture",
|
|
360
|
+
"Invert",
|
|
361
|
+
"LinearBlur",
|
|
362
|
+
"LinearGradient",
|
|
363
|
+
"Liquify",
|
|
364
|
+
"Perspective",
|
|
365
|
+
"Pixelate",
|
|
366
|
+
"PolarCoordinates",
|
|
367
|
+
"Posterize",
|
|
368
|
+
"ProgressiveBlur",
|
|
369
|
+
"RadialGradient",
|
|
370
|
+
"RectangularCoordinates",
|
|
371
|
+
"Ripples",
|
|
372
|
+
"Saturation",
|
|
373
|
+
"Sharpness",
|
|
374
|
+
"Shatter",
|
|
375
|
+
"SimplexNoise",
|
|
376
|
+
"SineWave",
|
|
377
|
+
"SolidColor",
|
|
378
|
+
"Spherize",
|
|
379
|
+
"Spiral",
|
|
380
|
+
"Strands",
|
|
381
|
+
"Stretch",
|
|
382
|
+
"Stripes",
|
|
383
|
+
"Swirl",
|
|
384
|
+
"TiltShift",
|
|
385
|
+
"Tint",
|
|
386
|
+
"Tritone",
|
|
387
|
+
"Twirl",
|
|
388
|
+
"Vibrance",
|
|
389
|
+
"WaveDistortion",
|
|
390
|
+
"WebcamTexture",
|
|
391
|
+
"ZoomBlur"
|
|
392
|
+
];
|
|
393
|
+
export { generatePresetCode as n, availableComponents as t };
|
package/dist/svelte/index.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ export { default as Tritone } from './components/Tritone.svelte';
|
|
|
58
58
|
export { default as Twirl } from './components/Twirl.svelte';
|
|
59
59
|
export { default as Vibrance } from './components/Vibrance.svelte';
|
|
60
60
|
export { default as WaveDistortion } from './components/WaveDistortion.svelte';
|
|
61
|
+
export { default as WebcamTexture } from './components/WebcamTexture.svelte';
|
|
61
62
|
export { default as ZoomBlur } from './components/ZoomBlur.svelte';
|
|
62
63
|
export { default as Shader } from './engine/Shader.svelte';
|
|
63
64
|
export { generatePresetCode } from './utils/generatePresetCode';
|
package/dist/svelte/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as generatePresetCode } from "./generatePresetCode-
|
|
1
|
+
import { n as generatePresetCode } from "./generatePresetCode-CtXcoyI0.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";
|
|
@@ -63,7 +63,8 @@ import { componentDefinition as componentDefinition$56 } from "../core/shaders/T
|
|
|
63
63
|
import { componentDefinition as componentDefinition$57 } from "../core/shaders/Twirl/index.js";
|
|
64
64
|
import { componentDefinition as componentDefinition$58 } from "../core/shaders/Vibrance/index.js";
|
|
65
65
|
import { componentDefinition as componentDefinition$59 } from "../core/shaders/WaveDistortion/index.js";
|
|
66
|
-
import { componentDefinition as componentDefinition$60 } from "../core/shaders/
|
|
66
|
+
import { componentDefinition as componentDefinition$60 } from "../core/shaders/WebcamTexture/index.js";
|
|
67
|
+
import { componentDefinition as componentDefinition$61 } from "../core/shaders/ZoomBlur/index.js";
|
|
67
68
|
import { vec4 } from "three/tsl";
|
|
68
69
|
import { TelemetryCollector, isExternalUser, shouldCollectTelemetry } from "../core/telemetry/index.js";
|
|
69
70
|
function AngularBlur($$anchor, $$props) {
|
|
@@ -6666,7 +6667,7 @@ function WaveDistortion($$anchor, $$props) {
|
|
|
6666
6667
|
children?.($$anchor);
|
|
6667
6668
|
$.pop();
|
|
6668
6669
|
}
|
|
6669
|
-
function
|
|
6670
|
+
function WebcamTexture($$anchor, $$props) {
|
|
6670
6671
|
$.push($$props, true);
|
|
6671
6672
|
const DEFAULT_TRANSFORM = {
|
|
6672
6673
|
offsetX: 0,
|
|
@@ -6776,6 +6777,116 @@ function ZoomBlur($$anchor, $$props) {
|
|
|
6776
6777
|
children?.($$anchor);
|
|
6777
6778
|
$.pop();
|
|
6778
6779
|
}
|
|
6780
|
+
function ZoomBlur($$anchor, $$props) {
|
|
6781
|
+
$.push($$props, true);
|
|
6782
|
+
const DEFAULT_TRANSFORM = {
|
|
6783
|
+
offsetX: 0,
|
|
6784
|
+
offsetY: 0,
|
|
6785
|
+
rotation: 0,
|
|
6786
|
+
scale: 1,
|
|
6787
|
+
anchorX: .5,
|
|
6788
|
+
anchorY: .5,
|
|
6789
|
+
edges: "transparent"
|
|
6790
|
+
};
|
|
6791
|
+
const componentDefaults = {
|
|
6792
|
+
blendMode: "normal",
|
|
6793
|
+
renderOrder: 0,
|
|
6794
|
+
visible: true,
|
|
6795
|
+
...Object.entries(componentDefinition$61.props).reduce((acc, [key, config]) => {
|
|
6796
|
+
acc[key] = config.default;
|
|
6797
|
+
return acc;
|
|
6798
|
+
}, {})
|
|
6799
|
+
};
|
|
6800
|
+
const props = $.rest_props($$props, [
|
|
6801
|
+
"$$slots",
|
|
6802
|
+
"$$events",
|
|
6803
|
+
"$$legacy"
|
|
6804
|
+
]);
|
|
6805
|
+
const blendMode = $$props.blendMode ?? componentDefaults.blendMode;
|
|
6806
|
+
const opacity = $$props.opacity;
|
|
6807
|
+
const visible = $$props.visible ?? componentDefaults.visible;
|
|
6808
|
+
const id = $$props.id;
|
|
6809
|
+
const maskSource = $$props.maskSource;
|
|
6810
|
+
const maskType = $$props.maskType;
|
|
6811
|
+
const renderOrder = $$props.renderOrder ?? componentDefaults.renderOrder;
|
|
6812
|
+
const { children } = props;
|
|
6813
|
+
const effectiveTransform = $.derived(() => ({
|
|
6814
|
+
...DEFAULT_TRANSFORM,
|
|
6815
|
+
...$$props.transform
|
|
6816
|
+
}));
|
|
6817
|
+
const parentId = getContext("shaderParentId");
|
|
6818
|
+
if (parentId === void 0) throw new Error("Shader components must be used inside an <Shader> component or another shader component");
|
|
6819
|
+
const instanceId = id || `${componentDefinition$61.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;
|
|
6820
|
+
setContext("shaderParentId", instanceId);
|
|
6821
|
+
const shaderReadyProps = $.derived(() => {
|
|
6822
|
+
let baseProps = { ...componentDefaults };
|
|
6823
|
+
for (const key in props) if (key !== "blendMode" && key !== "opacity" && key !== "visible" && key !== "id" && key !== "maskSource" && key !== "maskType" && key !== "renderOrder" && key !== "transform" && key !== "children") {
|
|
6824
|
+
const propValue = props[key];
|
|
6825
|
+
const defaultValue = componentDefaults[key];
|
|
6826
|
+
if (propValue !== void 0 && propValue !== defaultValue) baseProps[key] = propValue;
|
|
6827
|
+
}
|
|
6828
|
+
return baseProps;
|
|
6829
|
+
});
|
|
6830
|
+
const uniforms = createUniformsMap(componentDefinition$61, $.get(shaderReadyProps), instanceId);
|
|
6831
|
+
const parentRegister = getContext("shaderNodeRegister");
|
|
6832
|
+
if (parentRegister === void 0) throw new Error("Shader components must be used inside an <Shader> component or another shader component");
|
|
6833
|
+
const parentUniformUpdate = getContext("shaderUniformUpdate");
|
|
6834
|
+
if (parentUniformUpdate === void 0) throw new Error("Shader components require shaderUniformUpdate from parent");
|
|
6835
|
+
const parentMetadataUpdate = getContext("shaderMetadataUpdate");
|
|
6836
|
+
if (parentMetadataUpdate === void 0) throw new Error("Shader components require shaderMetadataUpdate from parent");
|
|
6837
|
+
let isRegistered = $.state(false);
|
|
6838
|
+
Object.entries(uniforms).forEach(([propName, { uniform, transform }]) => {
|
|
6839
|
+
$.user_effect(() => {
|
|
6840
|
+
if (!$.get(isRegistered)) return;
|
|
6841
|
+
if (uniform && uniform.value !== void 0) {
|
|
6842
|
+
const newValue = props[propName];
|
|
6843
|
+
if (newValue !== void 0) parentUniformUpdate(instanceId, propName, newValue);
|
|
6844
|
+
}
|
|
6845
|
+
});
|
|
6846
|
+
});
|
|
6847
|
+
$.user_effect(() => {
|
|
6848
|
+
if (!$.get(isRegistered)) return;
|
|
6849
|
+
parentMetadataUpdate(instanceId, {
|
|
6850
|
+
blendMode,
|
|
6851
|
+
opacity,
|
|
6852
|
+
visible: visible === false ? false : true,
|
|
6853
|
+
id,
|
|
6854
|
+
mask: maskSource ? {
|
|
6855
|
+
source: maskSource,
|
|
6856
|
+
type: maskType || "alpha"
|
|
6857
|
+
} : void 0,
|
|
6858
|
+
renderOrder,
|
|
6859
|
+
transform: $.get(effectiveTransform)
|
|
6860
|
+
});
|
|
6861
|
+
});
|
|
6862
|
+
onMount(() => {
|
|
6863
|
+
if (componentDefinition$61 && typeof componentDefinition$61.fragmentNode === "function") {
|
|
6864
|
+
parentRegister(instanceId, componentDefinition$61.fragmentNode, parentId, {
|
|
6865
|
+
blendMode,
|
|
6866
|
+
opacity,
|
|
6867
|
+
visible: visible !== false ? true : false,
|
|
6868
|
+
id,
|
|
6869
|
+
mask: maskSource ? {
|
|
6870
|
+
source: maskSource,
|
|
6871
|
+
type: maskType || "alpha"
|
|
6872
|
+
} : void 0,
|
|
6873
|
+
renderOrder,
|
|
6874
|
+
transform: $.get(effectiveTransform)
|
|
6875
|
+
}, uniforms);
|
|
6876
|
+
$.set(isRegistered, true);
|
|
6877
|
+
} else console.error("componentDefinition.fragmentNode is not a function:", {
|
|
6878
|
+
componentDefinition: componentDefinition$61,
|
|
6879
|
+
fragmentNode: componentDefinition$61?.fragmentNode,
|
|
6880
|
+
type: typeof componentDefinition$61?.fragmentNode
|
|
6881
|
+
});
|
|
6882
|
+
});
|
|
6883
|
+
onDestroy(() => {
|
|
6884
|
+
$.set(isRegistered, false);
|
|
6885
|
+
parentRegister(instanceId, null, null, null, null);
|
|
6886
|
+
});
|
|
6887
|
+
children?.($$anchor);
|
|
6888
|
+
$.pop();
|
|
6889
|
+
}
|
|
6779
6890
|
var root = $.from_html(`<div><canvas data-renderer="shaders" style="width: 100%; height: 100%; display: block;"></canvas> <!></div>`);
|
|
6780
6891
|
function Shader($$anchor, $$props) {
|
|
6781
6892
|
$.push($$props, true);
|
|
@@ -6878,4 +6989,4 @@ function Shader($$anchor, $$props) {
|
|
|
6878
6989
|
$.append($$anchor, div);
|
|
6879
6990
|
$.pop();
|
|
6880
6991
|
}
|
|
6881
|
-
export { AngularBlur, Ascii, Beam, Blob, Blur, BrightnessContrast, Bulge, CRTScreen, ChannelBlur, Checkerboard, ChromaFlow, ChromaticAberration, Circle, CursorTrail, DiffuseBlur, Dither, DotGrid, Duotone, FilmGrain, FloatingParticles, GlassTiles, Glow, Godrays, Grayscale, Grid, GridDistortion, Group, Halftone, HueShift, ImageTexture, Invert, LinearBlur, LinearGradient, Liquify, Perspective, Pixelate, PolarCoordinates, Posterize, ProgressiveBlur, RadialGradient, RectangularCoordinates, Ripples, Saturation, Shader, Sharpness, Shatter, SimplexNoise, SineWave, SolidColor, Spherize, Spiral, Strands, Stretch, Stripes, Swirl, TiltShift, Tint, Tritone, Twirl, Vibrance, WaveDistortion, ZoomBlur, generatePresetCode };
|
|
6992
|
+
export { AngularBlur, Ascii, Beam, Blob, Blur, BrightnessContrast, Bulge, CRTScreen, ChannelBlur, Checkerboard, ChromaFlow, ChromaticAberration, Circle, CursorTrail, DiffuseBlur, Dither, DotGrid, Duotone, FilmGrain, FloatingParticles, GlassTiles, Glow, Godrays, Grayscale, Grid, GridDistortion, Group, Halftone, HueShift, ImageTexture, Invert, LinearBlur, LinearGradient, Liquify, Perspective, Pixelate, PolarCoordinates, Posterize, ProgressiveBlur, RadialGradient, RectangularCoordinates, Ripples, Saturation, Shader, Sharpness, Shatter, SimplexNoise, SineWave, SolidColor, Spherize, Spiral, Strands, Stretch, Stripes, Swirl, TiltShift, Tint, Tritone, Twirl, Vibrance, WaveDistortion, WebcamTexture, ZoomBlur, generatePresetCode };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as generatePresetCode, t as availableComponents } from "../generatePresetCode-
|
|
1
|
+
import { n as generatePresetCode, t as availableComponents } from "../generatePresetCode-CtXcoyI0.js";
|
|
2
2
|
export { availableComponents, generatePresetCode };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { computed, defineComponent, effectScope, inject, mergeDefaults, onBeforeUnmount, provide, renderSlot, toValue, watch } from "vue";
|
|
2
|
+
import { createUniformsMap } from "../core/index.js";
|
|
3
|
+
import { componentDefinition } from "../core/shaders/AngularBlur/index.js";
|
|
4
|
+
var AngularBlur_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "AngularBlur",
|
|
6
|
+
props: /* @__PURE__ */ mergeDefaults({
|
|
7
|
+
blendMode: {},
|
|
8
|
+
opacity: {},
|
|
9
|
+
visible: { type: Boolean },
|
|
10
|
+
id: {},
|
|
11
|
+
maskSource: {},
|
|
12
|
+
maskType: {},
|
|
13
|
+
renderOrder: {},
|
|
14
|
+
transform: {},
|
|
15
|
+
intensity: {},
|
|
16
|
+
center: {}
|
|
17
|
+
}, {
|
|
18
|
+
blendMode: "normal",
|
|
19
|
+
renderOrder: 0,
|
|
20
|
+
visible: true,
|
|
21
|
+
...Object.entries(componentDefinition.props).reduce((acc, [key, config]) => {
|
|
22
|
+
acc[key] = config.default;
|
|
23
|
+
return acc;
|
|
24
|
+
}, {})
|
|
25
|
+
}),
|
|
26
|
+
setup(__props) {
|
|
27
|
+
const props = __props;
|
|
28
|
+
const instanceId = props.id || `${componentDefinition.name.toLowerCase()}_${Math.random().toString(36).substring(7)}`;
|
|
29
|
+
provide("ombreParentId", instanceId);
|
|
30
|
+
const DEFAULT_TRANSFORM = {
|
|
31
|
+
offsetX: 0,
|
|
32
|
+
offsetY: 0,
|
|
33
|
+
rotation: 0,
|
|
34
|
+
scale: 1,
|
|
35
|
+
anchorX: .5,
|
|
36
|
+
anchorY: .5,
|
|
37
|
+
edges: "transparent"
|
|
38
|
+
};
|
|
39
|
+
const effectiveTransform = computed(() => ({
|
|
40
|
+
...DEFAULT_TRANSFORM,
|
|
41
|
+
...props.transform
|
|
42
|
+
}));
|
|
43
|
+
const uniforms = createUniformsMap(componentDefinition, computed(() => {
|
|
44
|
+
let baseProps = { ...Object.entries(componentDefinition.props).reduce((acc, [key, config]) => {
|
|
45
|
+
acc[key] = config.default;
|
|
46
|
+
return acc;
|
|
47
|
+
}, {}) };
|
|
48
|
+
for (const key in props) if (key !== "blendMode" && key !== "opacity" && key !== "visible" && key !== "id" && key !== "maskSource" && key !== "maskType" && key !== "renderOrder" && key !== "transform" && props[key] !== Object.entries(componentDefinition.props).reduce((acc, [key$1, config]) => {
|
|
49
|
+
acc[key$1] = config.default;
|
|
50
|
+
return acc;
|
|
51
|
+
}, {})[key]) baseProps[key] = toValue(props[key]);
|
|
52
|
+
return baseProps;
|
|
53
|
+
}).value, instanceId);
|
|
54
|
+
const parentId = inject("ombreParentId");
|
|
55
|
+
if (parentId === void 0) throw new Error("Shader components must be used inside an <Shader> component or another shader component");
|
|
56
|
+
const parentRegister = inject("ombreNodeRegister");
|
|
57
|
+
if (parentRegister === void 0) throw new Error("Shader components must be used inside an <Shader> component or another shader component");
|
|
58
|
+
const parentUniformUpdate = inject("ombreUniformUpdate");
|
|
59
|
+
if (parentUniformUpdate === void 0) throw new Error("Shader components require ombreUniformUpdate from parent");
|
|
60
|
+
const parentMetadataUpdate = inject("ombreMetadataUpdate");
|
|
61
|
+
if (parentMetadataUpdate === void 0) throw new Error("Shader components require ombreMetadataUpdate from parent");
|
|
62
|
+
const rendererResetSignal = inject("ombreRendererResetSignal");
|
|
63
|
+
const registerWithRenderer = () => {
|
|
64
|
+
parentRegister(instanceId, componentDefinition.fragmentNode, parentId, {
|
|
65
|
+
blendMode: props.blendMode,
|
|
66
|
+
opacity: props.opacity,
|
|
67
|
+
visible: props.visible === false ? false : true,
|
|
68
|
+
id: props.id,
|
|
69
|
+
mask: props.maskSource ? {
|
|
70
|
+
source: props.maskSource,
|
|
71
|
+
type: props.maskType || "alpha"
|
|
72
|
+
} : void 0,
|
|
73
|
+
renderOrder: props.renderOrder,
|
|
74
|
+
transform: effectiveTransform.value
|
|
75
|
+
}, uniforms, componentDefinition);
|
|
76
|
+
};
|
|
77
|
+
const setupUniformWatchers = () => {
|
|
78
|
+
const scope = effectScope();
|
|
79
|
+
scope.run(() => {
|
|
80
|
+
Object.entries(uniforms).forEach(([propName, { uniform, transform }]) => {
|
|
81
|
+
watch(() => props[propName], (newValue) => {
|
|
82
|
+
if (uniform && uniform.value !== void 0) parentUniformUpdate(instanceId, propName, newValue);
|
|
83
|
+
}, { deep: true });
|
|
84
|
+
});
|
|
85
|
+
watch(() => [
|
|
86
|
+
props.blendMode,
|
|
87
|
+
props.opacity,
|
|
88
|
+
props.visible,
|
|
89
|
+
props.id,
|
|
90
|
+
props.maskSource,
|
|
91
|
+
props.maskType,
|
|
92
|
+
props.renderOrder,
|
|
93
|
+
props.transform
|
|
94
|
+
], ([blendMode, opacity, visible]) => {
|
|
95
|
+
parentMetadataUpdate(instanceId, {
|
|
96
|
+
blendMode,
|
|
97
|
+
opacity,
|
|
98
|
+
visible: visible === false ? false : true,
|
|
99
|
+
id: props.id,
|
|
100
|
+
mask: props.maskSource ? {
|
|
101
|
+
source: props.maskSource,
|
|
102
|
+
type: props.maskType || "alpha"
|
|
103
|
+
} : void 0,
|
|
104
|
+
renderOrder: props.renderOrder,
|
|
105
|
+
transform: effectiveTransform.value
|
|
106
|
+
});
|
|
107
|
+
}, { deep: true });
|
|
108
|
+
if (rendererResetSignal) watch(() => rendererResetSignal.value, (newValue) => {
|
|
109
|
+
if (newValue > 0) registerWithRenderer();
|
|
110
|
+
}, { immediate: true });
|
|
111
|
+
});
|
|
112
|
+
onBeforeUnmount(() => {
|
|
113
|
+
scope.stop();
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
setupUniformWatchers();
|
|
117
|
+
onBeforeUnmount(() => {
|
|
118
|
+
parentRegister(instanceId, null, null, null, null, null);
|
|
119
|
+
});
|
|
120
|
+
return (_ctx, _cache) => {
|
|
121
|
+
return renderSlot(_ctx.$slots, "default");
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
export { AngularBlur_vue_vue_type_script_setup_true_lang_default as default };
|