shaders 2.0.655 → 2.0.657
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/react/components/Ascii.d.ts +9 -3
- package/dist/react/components/Ascii.d.ts.map +1 -1
- package/dist/react/components/Checkerboard.d.ts +9 -3
- package/dist/react/components/Checkerboard.d.ts.map +1 -1
- package/dist/react/components/Circle.d.ts +9 -3
- package/dist/react/components/Circle.d.ts.map +1 -1
- package/dist/react/components/DotGrid.d.ts +9 -3
- package/dist/react/components/DotGrid.d.ts.map +1 -1
- package/dist/react/components/FilmGrain.d.ts +9 -3
- package/dist/react/components/FilmGrain.d.ts.map +1 -1
- package/dist/react/components/GlassTiles.d.ts +9 -3
- package/dist/react/components/GlassTiles.d.ts.map +1 -1
- package/dist/react/components/Grayscale.d.ts +9 -3
- package/dist/react/components/Grayscale.d.ts.map +1 -1
- package/dist/react/components/Grid.d.ts +9 -3
- package/dist/react/components/Grid.d.ts.map +1 -1
- package/dist/react/components/GridDistortion.d.ts +9 -3
- package/dist/react/components/GridDistortion.d.ts.map +1 -1
- package/dist/react/components/HueShift.d.ts +9 -3
- package/dist/react/components/HueShift.d.ts.map +1 -1
- package/dist/react/components/ImageTexture.d.ts +9 -3
- package/dist/react/components/ImageTexture.d.ts.map +1 -1
- package/dist/react/components/Invert.d.ts +9 -3
- package/dist/react/components/Invert.d.ts.map +1 -1
- package/dist/react/components/LinearGradient.d.ts +9 -3
- package/dist/react/components/LinearGradient.d.ts.map +1 -1
- package/dist/react/components/Liquify.d.ts +9 -3
- package/dist/react/components/Liquify.d.ts.map +1 -1
- package/dist/react/components/Pixelate.d.ts +9 -3
- package/dist/react/components/Pixelate.d.ts.map +1 -1
- package/dist/react/components/Posterize.d.ts +9 -3
- package/dist/react/components/Posterize.d.ts.map +1 -1
- package/dist/react/components/RadialGradient.d.ts +9 -3
- package/dist/react/components/RadialGradient.d.ts.map +1 -1
- package/dist/react/components/Ripple.d.ts +9 -3
- package/dist/react/components/Ripple.d.ts.map +1 -1
- package/dist/react/components/Saturation.d.ts +9 -3
- package/dist/react/components/Saturation.d.ts.map +1 -1
- package/dist/react/components/SolidColor.d.ts +9 -3
- package/dist/react/components/SolidColor.d.ts.map +1 -1
- package/dist/react/components/Spiral.d.ts +9 -3
- package/dist/react/components/Spiral.d.ts.map +1 -1
- package/dist/react/components/Swirl.d.ts +9 -3
- package/dist/react/components/Swirl.d.ts.map +1 -1
- package/dist/react/components/Twirl.d.ts +9 -3
- package/dist/react/components/Twirl.d.ts.map +1 -1
- package/dist/react/components/Vibrance.d.ts +9 -3
- package/dist/react/components/Vibrance.d.ts.map +1 -1
- package/dist/react/engine/component.template.d.ts +9 -3
- package/dist/react/engine/component.template.d.ts.map +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/react/utils/generatePresetCode.template.d.ts.map +1 -1
- package/dist/svelte/components/Ascii.svelte +16 -12
- package/dist/svelte/components/Ascii.svelte.d.ts +3 -26
- package/dist/svelte/components/Checkerboard.svelte +16 -12
- package/dist/svelte/components/Checkerboard.svelte.d.ts +3 -26
- package/dist/svelte/components/Circle.svelte +16 -12
- package/dist/svelte/components/Circle.svelte.d.ts +3 -26
- package/dist/svelte/components/DotGrid.svelte +16 -12
- package/dist/svelte/components/DotGrid.svelte.d.ts +3 -26
- package/dist/svelte/components/FilmGrain.svelte +16 -12
- package/dist/svelte/components/FilmGrain.svelte.d.ts +3 -26
- package/dist/svelte/components/GlassTiles.svelte +16 -12
- package/dist/svelte/components/GlassTiles.svelte.d.ts +3 -26
- package/dist/svelte/components/Grayscale.svelte +16 -12
- package/dist/svelte/components/Grayscale.svelte.d.ts +3 -26
- package/dist/svelte/components/Grid.svelte +16 -12
- package/dist/svelte/components/Grid.svelte.d.ts +3 -26
- package/dist/svelte/components/GridDistortion.svelte +16 -12
- package/dist/svelte/components/GridDistortion.svelte.d.ts +3 -26
- package/dist/svelte/components/HueShift.svelte +16 -12
- package/dist/svelte/components/HueShift.svelte.d.ts +3 -26
- package/dist/svelte/components/ImageTexture.svelte +16 -12
- package/dist/svelte/components/ImageTexture.svelte.d.ts +3 -26
- package/dist/svelte/components/Invert.svelte +16 -12
- package/dist/svelte/components/Invert.svelte.d.ts +3 -26
- package/dist/svelte/components/LinearGradient.svelte +16 -12
- package/dist/svelte/components/LinearGradient.svelte.d.ts +3 -26
- package/dist/svelte/components/Liquify.svelte +16 -12
- package/dist/svelte/components/Liquify.svelte.d.ts +3 -26
- package/dist/svelte/components/Pixelate.svelte +16 -12
- package/dist/svelte/components/Pixelate.svelte.d.ts +3 -26
- package/dist/svelte/components/Posterize.svelte +16 -12
- package/dist/svelte/components/Posterize.svelte.d.ts +3 -26
- package/dist/svelte/components/RadialGradient.svelte +16 -12
- package/dist/svelte/components/RadialGradient.svelte.d.ts +3 -26
- package/dist/svelte/components/Ripple.svelte +16 -12
- package/dist/svelte/components/Ripple.svelte.d.ts +3 -26
- package/dist/svelte/components/Saturation.svelte +16 -12
- package/dist/svelte/components/Saturation.svelte.d.ts +3 -26
- package/dist/svelte/components/SolidColor.svelte +16 -12
- package/dist/svelte/components/SolidColor.svelte.d.ts +3 -26
- package/dist/svelte/components/Spiral.svelte +16 -12
- package/dist/svelte/components/Spiral.svelte.d.ts +3 -26
- package/dist/svelte/components/Swirl.svelte +16 -12
- package/dist/svelte/components/Swirl.svelte.d.ts +3 -26
- package/dist/svelte/components/Twirl.svelte +16 -12
- package/dist/svelte/components/Twirl.svelte.d.ts +3 -26
- package/dist/svelte/components/Vibrance.svelte +16 -12
- package/dist/svelte/components/Vibrance.svelte.d.ts +3 -26
- package/dist/svelte/engine/Shader.svelte +9 -8
- package/dist/svelte/engine/Shader.svelte.d.ts +3 -26
- package/dist/svelte/engine/component.template.svelte +16 -12
- package/dist/svelte/engine/component.template.svelte.d.ts +3 -26
- package/dist/svelte/utils/generatePresetCode.js +1 -0
- package/dist/svelte/utils/generatePresetCode.template.js +1 -0
- package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/vue/utils/generatePresetCode.template.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -9,31 +9,8 @@ interface ExtendedComponentProps extends Partial<ComponentProps> {
|
|
|
9
9
|
id?: string;
|
|
10
10
|
maskSource?: string;
|
|
11
11
|
maskType?: string;
|
|
12
|
+
children?: import('svelte').Snippet;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
$$bindings?: Bindings;
|
|
16
|
-
} & Exports;
|
|
17
|
-
(internal: unknown, props: Props & {
|
|
18
|
-
$$events?: Events;
|
|
19
|
-
$$slots?: Slots;
|
|
20
|
-
}): Exports & {
|
|
21
|
-
$set?: any;
|
|
22
|
-
$on?: any;
|
|
23
|
-
};
|
|
24
|
-
z_$$bindings?: Bindings;
|
|
25
|
-
}
|
|
26
|
-
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
27
|
-
default: any;
|
|
28
|
-
} ? Props extends Record<string, never> ? any : {
|
|
29
|
-
children?: any;
|
|
30
|
-
} : {});
|
|
31
|
-
declare const FilmGrain: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<ExtendedComponentProps, {
|
|
32
|
-
default: {};
|
|
33
|
-
}>, {
|
|
34
|
-
[evt: string]: CustomEvent<any>;
|
|
35
|
-
}, {
|
|
36
|
-
default: {};
|
|
37
|
-
}, {}, "">;
|
|
38
|
-
type FilmGrain = InstanceType<typeof FilmGrain>;
|
|
14
|
+
declare const FilmGrain: import("svelte").Component<ExtendedComponentProps, {}, "">;
|
|
15
|
+
type FilmGrain = ReturnType<typeof FilmGrain>;
|
|
39
16
|
export default FilmGrain;
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
id?: string;
|
|
22
22
|
maskSource?: string;
|
|
23
23
|
maskType?: string;
|
|
24
|
+
children?: import('svelte').Snippet;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
// Define the component props and their default values from the shader definition
|
|
@@ -36,8 +37,8 @@
|
|
|
36
37
|
)
|
|
37
38
|
};
|
|
38
39
|
|
|
39
|
-
// Declare props using Svelte 5's syntax
|
|
40
|
-
const props = $props
|
|
40
|
+
// Declare props using Svelte 5's syntax
|
|
41
|
+
const props: ExtendedComponentProps = $props();
|
|
41
42
|
|
|
42
43
|
// Apply defaults manually since Svelte 5 doesn't have withDefaults equivalent
|
|
43
44
|
const blendMode = props.blendMode ?? componentDefaults.blendMode;
|
|
@@ -45,11 +46,12 @@
|
|
|
45
46
|
const id = props.id;
|
|
46
47
|
const maskSource = props.maskSource;
|
|
47
48
|
const maskType = props.maskType;
|
|
49
|
+
const { children } = props;
|
|
48
50
|
|
|
49
51
|
/**
|
|
50
52
|
* FIRST: Get the parent ID from context BEFORE setting our own context
|
|
51
53
|
*/
|
|
52
|
-
const parentId = getContext<string>('
|
|
54
|
+
const parentId = getContext<string>('shaderParentId');
|
|
53
55
|
if (parentId === undefined) {
|
|
54
56
|
throw new Error('Shader components must be used inside an <Shader> component or another shader component');
|
|
55
57
|
}
|
|
@@ -62,7 +64,7 @@
|
|
|
62
64
|
/**
|
|
63
65
|
* THEN: Provide our unique identifier to child components
|
|
64
66
|
*/
|
|
65
|
-
setContext('
|
|
67
|
+
setContext('shaderParentId', instanceId);
|
|
66
68
|
|
|
67
69
|
/**
|
|
68
70
|
* Creates a non-reactive object containing only props that differ from defaults
|
|
@@ -87,13 +89,15 @@
|
|
|
87
89
|
|
|
88
90
|
/**
|
|
89
91
|
* Creates the GPU uniform values map using only the changed props
|
|
92
|
+
* Note: Intentionally captures initial value - props are immutable after initialization
|
|
90
93
|
*/
|
|
94
|
+
// svelte-ignore state_referenced_locally
|
|
91
95
|
const uniforms: UniformsMap = createUniformsMap(componentDefinition, shaderReadyProps, instanceId);
|
|
92
96
|
|
|
93
97
|
/**
|
|
94
98
|
* Get the node registration function from parent context
|
|
95
99
|
*/
|
|
96
|
-
const parentRegister = getContext<(id: string, fragmentNodeFunc: any, parentId: string | null, metadata: NodeMetadata | null, uniforms: UniformsMap | null) => void>('
|
|
100
|
+
const parentRegister = getContext<(id: string, fragmentNodeFunc: any, parentId: string | null, metadata: NodeMetadata | null, uniforms: UniformsMap | null) => void>('shaderNodeRegister');
|
|
97
101
|
if (parentRegister === undefined) {
|
|
98
102
|
throw new Error('Shader components must be used inside an <Shader> component or another shader component');
|
|
99
103
|
}
|
|
@@ -101,17 +105,17 @@
|
|
|
101
105
|
/**
|
|
102
106
|
* Get the uniform update function from parent context
|
|
103
107
|
*/
|
|
104
|
-
const parentUniformUpdate = getContext<(nodeId: string, uniformName: string, value: any) => void>('
|
|
108
|
+
const parentUniformUpdate = getContext<(nodeId: string, uniformName: string, value: any) => void>('shaderUniformUpdate');
|
|
105
109
|
if (parentUniformUpdate === undefined) {
|
|
106
|
-
throw new Error('Shader components require
|
|
110
|
+
throw new Error('Shader components require shaderUniformUpdate from parent');
|
|
107
111
|
}
|
|
108
112
|
|
|
109
113
|
/**
|
|
110
114
|
* Get the metadata update function from parent context
|
|
111
115
|
*/
|
|
112
|
-
const parentMetadataUpdate = getContext<(nodeId: string, metadata: NodeMetadata) => void>('
|
|
116
|
+
const parentMetadataUpdate = getContext<(nodeId: string, metadata: NodeMetadata) => void>('shaderMetadataUpdate');
|
|
113
117
|
if (parentMetadataUpdate === undefined) {
|
|
114
|
-
throw new Error('Shader components require
|
|
118
|
+
throw new Error('Shader components require shaderMetadataUpdate from parent');
|
|
115
119
|
}
|
|
116
120
|
|
|
117
121
|
// Flag to track when component is registered
|
|
@@ -144,7 +148,7 @@
|
|
|
144
148
|
id,
|
|
145
149
|
mask: maskSource ? {
|
|
146
150
|
source: maskSource,
|
|
147
|
-
type: maskType || 'alpha'
|
|
151
|
+
type: (maskType || 'alpha') as MaskConfig['type']
|
|
148
152
|
} : undefined,
|
|
149
153
|
renderOrder: 0
|
|
150
154
|
};
|
|
@@ -172,7 +176,7 @@
|
|
|
172
176
|
id,
|
|
173
177
|
mask: maskSource ? {
|
|
174
178
|
source: maskSource,
|
|
175
|
-
type: maskType || 'alpha'
|
|
179
|
+
type: (maskType || 'alpha') as MaskConfig['type']
|
|
176
180
|
} as MaskConfig : undefined,
|
|
177
181
|
renderOrder: 0
|
|
178
182
|
},
|
|
@@ -199,4 +203,4 @@
|
|
|
199
203
|
});
|
|
200
204
|
</script>
|
|
201
205
|
|
|
202
|
-
|
|
206
|
+
{@render children?.()}
|
|
@@ -9,31 +9,8 @@ interface ExtendedComponentProps extends Partial<ComponentProps> {
|
|
|
9
9
|
id?: string;
|
|
10
10
|
maskSource?: string;
|
|
11
11
|
maskType?: string;
|
|
12
|
+
children?: import('svelte').Snippet;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
$$bindings?: Bindings;
|
|
16
|
-
} & Exports;
|
|
17
|
-
(internal: unknown, props: Props & {
|
|
18
|
-
$$events?: Events;
|
|
19
|
-
$$slots?: Slots;
|
|
20
|
-
}): Exports & {
|
|
21
|
-
$set?: any;
|
|
22
|
-
$on?: any;
|
|
23
|
-
};
|
|
24
|
-
z_$$bindings?: Bindings;
|
|
25
|
-
}
|
|
26
|
-
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
27
|
-
default: any;
|
|
28
|
-
} ? Props extends Record<string, never> ? any : {
|
|
29
|
-
children?: any;
|
|
30
|
-
} : {});
|
|
31
|
-
declare const GlassTiles: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<ExtendedComponentProps, {
|
|
32
|
-
default: {};
|
|
33
|
-
}>, {
|
|
34
|
-
[evt: string]: CustomEvent<any>;
|
|
35
|
-
}, {
|
|
36
|
-
default: {};
|
|
37
|
-
}, {}, "">;
|
|
38
|
-
type GlassTiles = InstanceType<typeof GlassTiles>;
|
|
14
|
+
declare const GlassTiles: import("svelte").Component<ExtendedComponentProps, {}, "">;
|
|
15
|
+
type GlassTiles = ReturnType<typeof GlassTiles>;
|
|
39
16
|
export default GlassTiles;
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
id?: string;
|
|
22
22
|
maskSource?: string;
|
|
23
23
|
maskType?: string;
|
|
24
|
+
children?: import('svelte').Snippet;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
// Define the component props and their default values from the shader definition
|
|
@@ -36,8 +37,8 @@
|
|
|
36
37
|
)
|
|
37
38
|
};
|
|
38
39
|
|
|
39
|
-
// Declare props using Svelte 5's syntax
|
|
40
|
-
const props = $props
|
|
40
|
+
// Declare props using Svelte 5's syntax
|
|
41
|
+
const props: ExtendedComponentProps = $props();
|
|
41
42
|
|
|
42
43
|
// Apply defaults manually since Svelte 5 doesn't have withDefaults equivalent
|
|
43
44
|
const blendMode = props.blendMode ?? componentDefaults.blendMode;
|
|
@@ -45,11 +46,12 @@
|
|
|
45
46
|
const id = props.id;
|
|
46
47
|
const maskSource = props.maskSource;
|
|
47
48
|
const maskType = props.maskType;
|
|
49
|
+
const { children } = props;
|
|
48
50
|
|
|
49
51
|
/**
|
|
50
52
|
* FIRST: Get the parent ID from context BEFORE setting our own context
|
|
51
53
|
*/
|
|
52
|
-
const parentId = getContext<string>('
|
|
54
|
+
const parentId = getContext<string>('shaderParentId');
|
|
53
55
|
if (parentId === undefined) {
|
|
54
56
|
throw new Error('Shader components must be used inside an <Shader> component or another shader component');
|
|
55
57
|
}
|
|
@@ -62,7 +64,7 @@
|
|
|
62
64
|
/**
|
|
63
65
|
* THEN: Provide our unique identifier to child components
|
|
64
66
|
*/
|
|
65
|
-
setContext('
|
|
67
|
+
setContext('shaderParentId', instanceId);
|
|
66
68
|
|
|
67
69
|
/**
|
|
68
70
|
* Creates a non-reactive object containing only props that differ from defaults
|
|
@@ -87,13 +89,15 @@
|
|
|
87
89
|
|
|
88
90
|
/**
|
|
89
91
|
* Creates the GPU uniform values map using only the changed props
|
|
92
|
+
* Note: Intentionally captures initial value - props are immutable after initialization
|
|
90
93
|
*/
|
|
94
|
+
// svelte-ignore state_referenced_locally
|
|
91
95
|
const uniforms: UniformsMap = createUniformsMap(componentDefinition, shaderReadyProps, instanceId);
|
|
92
96
|
|
|
93
97
|
/**
|
|
94
98
|
* Get the node registration function from parent context
|
|
95
99
|
*/
|
|
96
|
-
const parentRegister = getContext<(id: string, fragmentNodeFunc: any, parentId: string | null, metadata: NodeMetadata | null, uniforms: UniformsMap | null) => void>('
|
|
100
|
+
const parentRegister = getContext<(id: string, fragmentNodeFunc: any, parentId: string | null, metadata: NodeMetadata | null, uniforms: UniformsMap | null) => void>('shaderNodeRegister');
|
|
97
101
|
if (parentRegister === undefined) {
|
|
98
102
|
throw new Error('Shader components must be used inside an <Shader> component or another shader component');
|
|
99
103
|
}
|
|
@@ -101,17 +105,17 @@
|
|
|
101
105
|
/**
|
|
102
106
|
* Get the uniform update function from parent context
|
|
103
107
|
*/
|
|
104
|
-
const parentUniformUpdate = getContext<(nodeId: string, uniformName: string, value: any) => void>('
|
|
108
|
+
const parentUniformUpdate = getContext<(nodeId: string, uniformName: string, value: any) => void>('shaderUniformUpdate');
|
|
105
109
|
if (parentUniformUpdate === undefined) {
|
|
106
|
-
throw new Error('Shader components require
|
|
110
|
+
throw new Error('Shader components require shaderUniformUpdate from parent');
|
|
107
111
|
}
|
|
108
112
|
|
|
109
113
|
/**
|
|
110
114
|
* Get the metadata update function from parent context
|
|
111
115
|
*/
|
|
112
|
-
const parentMetadataUpdate = getContext<(nodeId: string, metadata: NodeMetadata) => void>('
|
|
116
|
+
const parentMetadataUpdate = getContext<(nodeId: string, metadata: NodeMetadata) => void>('shaderMetadataUpdate');
|
|
113
117
|
if (parentMetadataUpdate === undefined) {
|
|
114
|
-
throw new Error('Shader components require
|
|
118
|
+
throw new Error('Shader components require shaderMetadataUpdate from parent');
|
|
115
119
|
}
|
|
116
120
|
|
|
117
121
|
// Flag to track when component is registered
|
|
@@ -144,7 +148,7 @@
|
|
|
144
148
|
id,
|
|
145
149
|
mask: maskSource ? {
|
|
146
150
|
source: maskSource,
|
|
147
|
-
type: maskType || 'alpha'
|
|
151
|
+
type: (maskType || 'alpha') as MaskConfig['type']
|
|
148
152
|
} : undefined,
|
|
149
153
|
renderOrder: 0
|
|
150
154
|
};
|
|
@@ -172,7 +176,7 @@
|
|
|
172
176
|
id,
|
|
173
177
|
mask: maskSource ? {
|
|
174
178
|
source: maskSource,
|
|
175
|
-
type: maskType || 'alpha'
|
|
179
|
+
type: (maskType || 'alpha') as MaskConfig['type']
|
|
176
180
|
} as MaskConfig : undefined,
|
|
177
181
|
renderOrder: 0
|
|
178
182
|
},
|
|
@@ -199,4 +203,4 @@
|
|
|
199
203
|
});
|
|
200
204
|
</script>
|
|
201
205
|
|
|
202
|
-
|
|
206
|
+
{@render children?.()}
|
|
@@ -9,31 +9,8 @@ interface ExtendedComponentProps extends Partial<ComponentProps> {
|
|
|
9
9
|
id?: string;
|
|
10
10
|
maskSource?: string;
|
|
11
11
|
maskType?: string;
|
|
12
|
+
children?: import('svelte').Snippet;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
$$bindings?: Bindings;
|
|
16
|
-
} & Exports;
|
|
17
|
-
(internal: unknown, props: Props & {
|
|
18
|
-
$$events?: Events;
|
|
19
|
-
$$slots?: Slots;
|
|
20
|
-
}): Exports & {
|
|
21
|
-
$set?: any;
|
|
22
|
-
$on?: any;
|
|
23
|
-
};
|
|
24
|
-
z_$$bindings?: Bindings;
|
|
25
|
-
}
|
|
26
|
-
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
27
|
-
default: any;
|
|
28
|
-
} ? Props extends Record<string, never> ? any : {
|
|
29
|
-
children?: any;
|
|
30
|
-
} : {});
|
|
31
|
-
declare const Grayscale: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<ExtendedComponentProps, {
|
|
32
|
-
default: {};
|
|
33
|
-
}>, {
|
|
34
|
-
[evt: string]: CustomEvent<any>;
|
|
35
|
-
}, {
|
|
36
|
-
default: {};
|
|
37
|
-
}, {}, "">;
|
|
38
|
-
type Grayscale = InstanceType<typeof Grayscale>;
|
|
14
|
+
declare const Grayscale: import("svelte").Component<ExtendedComponentProps, {}, "">;
|
|
15
|
+
type Grayscale = ReturnType<typeof Grayscale>;
|
|
39
16
|
export default Grayscale;
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
id?: string;
|
|
22
22
|
maskSource?: string;
|
|
23
23
|
maskType?: string;
|
|
24
|
+
children?: import('svelte').Snippet;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
// Define the component props and their default values from the shader definition
|
|
@@ -36,8 +37,8 @@
|
|
|
36
37
|
)
|
|
37
38
|
};
|
|
38
39
|
|
|
39
|
-
// Declare props using Svelte 5's syntax
|
|
40
|
-
const props = $props
|
|
40
|
+
// Declare props using Svelte 5's syntax
|
|
41
|
+
const props: ExtendedComponentProps = $props();
|
|
41
42
|
|
|
42
43
|
// Apply defaults manually since Svelte 5 doesn't have withDefaults equivalent
|
|
43
44
|
const blendMode = props.blendMode ?? componentDefaults.blendMode;
|
|
@@ -45,11 +46,12 @@
|
|
|
45
46
|
const id = props.id;
|
|
46
47
|
const maskSource = props.maskSource;
|
|
47
48
|
const maskType = props.maskType;
|
|
49
|
+
const { children } = props;
|
|
48
50
|
|
|
49
51
|
/**
|
|
50
52
|
* FIRST: Get the parent ID from context BEFORE setting our own context
|
|
51
53
|
*/
|
|
52
|
-
const parentId = getContext<string>('
|
|
54
|
+
const parentId = getContext<string>('shaderParentId');
|
|
53
55
|
if (parentId === undefined) {
|
|
54
56
|
throw new Error('Shader components must be used inside an <Shader> component or another shader component');
|
|
55
57
|
}
|
|
@@ -62,7 +64,7 @@
|
|
|
62
64
|
/**
|
|
63
65
|
* THEN: Provide our unique identifier to child components
|
|
64
66
|
*/
|
|
65
|
-
setContext('
|
|
67
|
+
setContext('shaderParentId', instanceId);
|
|
66
68
|
|
|
67
69
|
/**
|
|
68
70
|
* Creates a non-reactive object containing only props that differ from defaults
|
|
@@ -87,13 +89,15 @@
|
|
|
87
89
|
|
|
88
90
|
/**
|
|
89
91
|
* Creates the GPU uniform values map using only the changed props
|
|
92
|
+
* Note: Intentionally captures initial value - props are immutable after initialization
|
|
90
93
|
*/
|
|
94
|
+
// svelte-ignore state_referenced_locally
|
|
91
95
|
const uniforms: UniformsMap = createUniformsMap(componentDefinition, shaderReadyProps, instanceId);
|
|
92
96
|
|
|
93
97
|
/**
|
|
94
98
|
* Get the node registration function from parent context
|
|
95
99
|
*/
|
|
96
|
-
const parentRegister = getContext<(id: string, fragmentNodeFunc: any, parentId: string | null, metadata: NodeMetadata | null, uniforms: UniformsMap | null) => void>('
|
|
100
|
+
const parentRegister = getContext<(id: string, fragmentNodeFunc: any, parentId: string | null, metadata: NodeMetadata | null, uniforms: UniformsMap | null) => void>('shaderNodeRegister');
|
|
97
101
|
if (parentRegister === undefined) {
|
|
98
102
|
throw new Error('Shader components must be used inside an <Shader> component or another shader component');
|
|
99
103
|
}
|
|
@@ -101,17 +105,17 @@
|
|
|
101
105
|
/**
|
|
102
106
|
* Get the uniform update function from parent context
|
|
103
107
|
*/
|
|
104
|
-
const parentUniformUpdate = getContext<(nodeId: string, uniformName: string, value: any) => void>('
|
|
108
|
+
const parentUniformUpdate = getContext<(nodeId: string, uniformName: string, value: any) => void>('shaderUniformUpdate');
|
|
105
109
|
if (parentUniformUpdate === undefined) {
|
|
106
|
-
throw new Error('Shader components require
|
|
110
|
+
throw new Error('Shader components require shaderUniformUpdate from parent');
|
|
107
111
|
}
|
|
108
112
|
|
|
109
113
|
/**
|
|
110
114
|
* Get the metadata update function from parent context
|
|
111
115
|
*/
|
|
112
|
-
const parentMetadataUpdate = getContext<(nodeId: string, metadata: NodeMetadata) => void>('
|
|
116
|
+
const parentMetadataUpdate = getContext<(nodeId: string, metadata: NodeMetadata) => void>('shaderMetadataUpdate');
|
|
113
117
|
if (parentMetadataUpdate === undefined) {
|
|
114
|
-
throw new Error('Shader components require
|
|
118
|
+
throw new Error('Shader components require shaderMetadataUpdate from parent');
|
|
115
119
|
}
|
|
116
120
|
|
|
117
121
|
// Flag to track when component is registered
|
|
@@ -144,7 +148,7 @@
|
|
|
144
148
|
id,
|
|
145
149
|
mask: maskSource ? {
|
|
146
150
|
source: maskSource,
|
|
147
|
-
type: maskType || 'alpha'
|
|
151
|
+
type: (maskType || 'alpha') as MaskConfig['type']
|
|
148
152
|
} : undefined,
|
|
149
153
|
renderOrder: 0
|
|
150
154
|
};
|
|
@@ -172,7 +176,7 @@
|
|
|
172
176
|
id,
|
|
173
177
|
mask: maskSource ? {
|
|
174
178
|
source: maskSource,
|
|
175
|
-
type: maskType || 'alpha'
|
|
179
|
+
type: (maskType || 'alpha') as MaskConfig['type']
|
|
176
180
|
} as MaskConfig : undefined,
|
|
177
181
|
renderOrder: 0
|
|
178
182
|
},
|
|
@@ -199,4 +203,4 @@
|
|
|
199
203
|
});
|
|
200
204
|
</script>
|
|
201
205
|
|
|
202
|
-
|
|
206
|
+
{@render children?.()}
|
|
@@ -9,31 +9,8 @@ interface ExtendedComponentProps extends Partial<ComponentProps> {
|
|
|
9
9
|
id?: string;
|
|
10
10
|
maskSource?: string;
|
|
11
11
|
maskType?: string;
|
|
12
|
+
children?: import('svelte').Snippet;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
$$bindings?: Bindings;
|
|
16
|
-
} & Exports;
|
|
17
|
-
(internal: unknown, props: Props & {
|
|
18
|
-
$$events?: Events;
|
|
19
|
-
$$slots?: Slots;
|
|
20
|
-
}): Exports & {
|
|
21
|
-
$set?: any;
|
|
22
|
-
$on?: any;
|
|
23
|
-
};
|
|
24
|
-
z_$$bindings?: Bindings;
|
|
25
|
-
}
|
|
26
|
-
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
27
|
-
default: any;
|
|
28
|
-
} ? Props extends Record<string, never> ? any : {
|
|
29
|
-
children?: any;
|
|
30
|
-
} : {});
|
|
31
|
-
declare const Grid: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<ExtendedComponentProps, {
|
|
32
|
-
default: {};
|
|
33
|
-
}>, {
|
|
34
|
-
[evt: string]: CustomEvent<any>;
|
|
35
|
-
}, {
|
|
36
|
-
default: {};
|
|
37
|
-
}, {}, "">;
|
|
38
|
-
type Grid = InstanceType<typeof Grid>;
|
|
14
|
+
declare const Grid: import("svelte").Component<ExtendedComponentProps, {}, "">;
|
|
15
|
+
type Grid = ReturnType<typeof Grid>;
|
|
39
16
|
export default Grid;
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
id?: string;
|
|
22
22
|
maskSource?: string;
|
|
23
23
|
maskType?: string;
|
|
24
|
+
children?: import('svelte').Snippet;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
// Define the component props and their default values from the shader definition
|
|
@@ -36,8 +37,8 @@
|
|
|
36
37
|
)
|
|
37
38
|
};
|
|
38
39
|
|
|
39
|
-
// Declare props using Svelte 5's syntax
|
|
40
|
-
const props = $props
|
|
40
|
+
// Declare props using Svelte 5's syntax
|
|
41
|
+
const props: ExtendedComponentProps = $props();
|
|
41
42
|
|
|
42
43
|
// Apply defaults manually since Svelte 5 doesn't have withDefaults equivalent
|
|
43
44
|
const blendMode = props.blendMode ?? componentDefaults.blendMode;
|
|
@@ -45,11 +46,12 @@
|
|
|
45
46
|
const id = props.id;
|
|
46
47
|
const maskSource = props.maskSource;
|
|
47
48
|
const maskType = props.maskType;
|
|
49
|
+
const { children } = props;
|
|
48
50
|
|
|
49
51
|
/**
|
|
50
52
|
* FIRST: Get the parent ID from context BEFORE setting our own context
|
|
51
53
|
*/
|
|
52
|
-
const parentId = getContext<string>('
|
|
54
|
+
const parentId = getContext<string>('shaderParentId');
|
|
53
55
|
if (parentId === undefined) {
|
|
54
56
|
throw new Error('Shader components must be used inside an <Shader> component or another shader component');
|
|
55
57
|
}
|
|
@@ -62,7 +64,7 @@
|
|
|
62
64
|
/**
|
|
63
65
|
* THEN: Provide our unique identifier to child components
|
|
64
66
|
*/
|
|
65
|
-
setContext('
|
|
67
|
+
setContext('shaderParentId', instanceId);
|
|
66
68
|
|
|
67
69
|
/**
|
|
68
70
|
* Creates a non-reactive object containing only props that differ from defaults
|
|
@@ -87,13 +89,15 @@
|
|
|
87
89
|
|
|
88
90
|
/**
|
|
89
91
|
* Creates the GPU uniform values map using only the changed props
|
|
92
|
+
* Note: Intentionally captures initial value - props are immutable after initialization
|
|
90
93
|
*/
|
|
94
|
+
// svelte-ignore state_referenced_locally
|
|
91
95
|
const uniforms: UniformsMap = createUniformsMap(componentDefinition, shaderReadyProps, instanceId);
|
|
92
96
|
|
|
93
97
|
/**
|
|
94
98
|
* Get the node registration function from parent context
|
|
95
99
|
*/
|
|
96
|
-
const parentRegister = getContext<(id: string, fragmentNodeFunc: any, parentId: string | null, metadata: NodeMetadata | null, uniforms: UniformsMap | null) => void>('
|
|
100
|
+
const parentRegister = getContext<(id: string, fragmentNodeFunc: any, parentId: string | null, metadata: NodeMetadata | null, uniforms: UniformsMap | null) => void>('shaderNodeRegister');
|
|
97
101
|
if (parentRegister === undefined) {
|
|
98
102
|
throw new Error('Shader components must be used inside an <Shader> component or another shader component');
|
|
99
103
|
}
|
|
@@ -101,17 +105,17 @@
|
|
|
101
105
|
/**
|
|
102
106
|
* Get the uniform update function from parent context
|
|
103
107
|
*/
|
|
104
|
-
const parentUniformUpdate = getContext<(nodeId: string, uniformName: string, value: any) => void>('
|
|
108
|
+
const parentUniformUpdate = getContext<(nodeId: string, uniformName: string, value: any) => void>('shaderUniformUpdate');
|
|
105
109
|
if (parentUniformUpdate === undefined) {
|
|
106
|
-
throw new Error('Shader components require
|
|
110
|
+
throw new Error('Shader components require shaderUniformUpdate from parent');
|
|
107
111
|
}
|
|
108
112
|
|
|
109
113
|
/**
|
|
110
114
|
* Get the metadata update function from parent context
|
|
111
115
|
*/
|
|
112
|
-
const parentMetadataUpdate = getContext<(nodeId: string, metadata: NodeMetadata) => void>('
|
|
116
|
+
const parentMetadataUpdate = getContext<(nodeId: string, metadata: NodeMetadata) => void>('shaderMetadataUpdate');
|
|
113
117
|
if (parentMetadataUpdate === undefined) {
|
|
114
|
-
throw new Error('Shader components require
|
|
118
|
+
throw new Error('Shader components require shaderMetadataUpdate from parent');
|
|
115
119
|
}
|
|
116
120
|
|
|
117
121
|
// Flag to track when component is registered
|
|
@@ -144,7 +148,7 @@
|
|
|
144
148
|
id,
|
|
145
149
|
mask: maskSource ? {
|
|
146
150
|
source: maskSource,
|
|
147
|
-
type: maskType || 'alpha'
|
|
151
|
+
type: (maskType || 'alpha') as MaskConfig['type']
|
|
148
152
|
} : undefined,
|
|
149
153
|
renderOrder: 0
|
|
150
154
|
};
|
|
@@ -172,7 +176,7 @@
|
|
|
172
176
|
id,
|
|
173
177
|
mask: maskSource ? {
|
|
174
178
|
source: maskSource,
|
|
175
|
-
type: maskType || 'alpha'
|
|
179
|
+
type: (maskType || 'alpha') as MaskConfig['type']
|
|
176
180
|
} as MaskConfig : undefined,
|
|
177
181
|
renderOrder: 0
|
|
178
182
|
},
|
|
@@ -199,4 +203,4 @@
|
|
|
199
203
|
});
|
|
200
204
|
</script>
|
|
201
205
|
|
|
202
|
-
|
|
206
|
+
{@render children?.()}
|
|
@@ -9,31 +9,8 @@ interface ExtendedComponentProps extends Partial<ComponentProps> {
|
|
|
9
9
|
id?: string;
|
|
10
10
|
maskSource?: string;
|
|
11
11
|
maskType?: string;
|
|
12
|
+
children?: import('svelte').Snippet;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
$$bindings?: Bindings;
|
|
16
|
-
} & Exports;
|
|
17
|
-
(internal: unknown, props: Props & {
|
|
18
|
-
$$events?: Events;
|
|
19
|
-
$$slots?: Slots;
|
|
20
|
-
}): Exports & {
|
|
21
|
-
$set?: any;
|
|
22
|
-
$on?: any;
|
|
23
|
-
};
|
|
24
|
-
z_$$bindings?: Bindings;
|
|
25
|
-
}
|
|
26
|
-
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
27
|
-
default: any;
|
|
28
|
-
} ? Props extends Record<string, never> ? any : {
|
|
29
|
-
children?: any;
|
|
30
|
-
} : {});
|
|
31
|
-
declare const GridDistortion: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<ExtendedComponentProps, {
|
|
32
|
-
default: {};
|
|
33
|
-
}>, {
|
|
34
|
-
[evt: string]: CustomEvent<any>;
|
|
35
|
-
}, {
|
|
36
|
-
default: {};
|
|
37
|
-
}, {}, "">;
|
|
38
|
-
type GridDistortion = InstanceType<typeof GridDistortion>;
|
|
14
|
+
declare const GridDistortion: import("svelte").Component<ExtendedComponentProps, {}, "">;
|
|
15
|
+
type GridDistortion = ReturnType<typeof GridDistortion>;
|
|
39
16
|
export default GridDistortion;
|