@@ -21,38 +21,38 @@ export type EffectProps<T extends EffectConstructor> = ReactThreeFiber.Node<
21
21
let i = 0
22
22
const components = new WeakMap < EffectConstructor , React . ExoticComponent < any > | string > ( )
23
23
24
- export const wrapEffect = < T extends EffectConstructor , P extends EffectProps < T > = EffectProps < T > > (
24
+ export const wrapEffect = < T extends EffectConstructor > (
25
25
effect : T ,
26
- defaults ?: P
27
- ) =>
28
- /* @__PURE__ */ React . forwardRef < T , P > ( function Effect (
29
- { blendFunction = defaults ?. blendFunction , opacity = defaults ?. opacity , ...props } ,
30
- ref
26
+ defaults ?: EffectProps < T >
27
+ ) =>
28
+ /* @__PURE__ */ React . forwardRef < T , EffectProps < T > > ( function Effect (
29
+ { blendFunction = defaults ?. blendFunction , opacity = defaults ?. opacity , ...props } ,
30
+ ref
31
31
) {
32
- let Component = components . get ( effect )
33
- if ( ! Component ) {
34
- const key = `@react-three/postprocessing/${ effect . name } -${ i ++ } `
35
- extend ( { [ key ] : effect } )
36
- components . set ( effect , ( Component = key ) )
37
- }
38
-
39
- const camera = useThree ( ( state ) => state . camera )
40
- const args = React . useMemo (
41
- ( ) => [ ...( ( defaults ?. args ?? [ ] ) as any [ ] ) , ...( ( props . args ?? [ { ...defaults , ...props } ] ) as any [ ] ) ] ,
42
- // eslint-disable-next-line react-hooks/exhaustive-deps
43
- [ JSON . stringify ( props ) ]
44
- )
45
-
46
- return (
47
- < Component
48
- camera = { camera }
49
- blendMode-blendFunction = { blendFunction }
50
- blendMode-opacity = { opacity }
51
- { ...props }
52
- ref = { ref }
53
- args = { args }
54
- />
55
- )
32
+ let Component = components . get ( effect )
33
+ if ( ! Component ) {
34
+ const key = `@react-three/postprocessing/${ effect . name } -${ i ++ } `
35
+ extend ( { [ key ] : effect } )
36
+ components . set ( effect , ( Component = key ) )
37
+ }
38
+
39
+ const camera = useThree ( ( state ) => state . camera )
40
+ const args = React . useMemo (
41
+ ( ) => [ ...( ( defaults ?. args ?? [ ] ) as any [ ] ) , ...( ( props . args ?? [ { ...defaults , ...props } ] ) as any [ ] ) ] ,
42
+ // eslint-disable-next-line react-hooks/exhaustive-deps
43
+ [ JSON . stringify ( props ) ]
44
+ )
45
+
46
+ return (
47
+ < Component
48
+ camera = { camera }
49
+ blendMode-blendFunction = { blendFunction }
50
+ blendMode-opacity = { opacity }
51
+ { ...props }
52
+ ref = { ref }
53
+ args = { args }
54
+ />
55
+ )
56
56
} )
57
57
58
58
export const useVector2 = ( props : Record < string , unknown > , key : string ) : THREE . Vector2 => {
0 commit comments