@react-three/drei 9.112.1 → 9.113.0
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/core/GradientTexture.d.ts +1 -1
- package/core/GradientTexture.js +0 -1
- package/core/StatsGl.cjs.js +1 -1
- package/core/StatsGl.d.ts +5 -1
- package/core/StatsGl.js +15 -5
- package/index.cjs.js +1 -1
- package/materials/MeshRefractionMaterial.d.ts +0 -3
- package/package.json +2 -2
|
@@ -13,6 +13,6 @@ type Props = {
|
|
|
13
13
|
type?: GradientType;
|
|
14
14
|
innerCircleRadius?: number;
|
|
15
15
|
outerCircleRadius?: string | number;
|
|
16
|
-
} & JSX.IntrinsicElements['texture']
|
|
16
|
+
} & Omit<JSX.IntrinsicElements['texture'], 'type'>;
|
|
17
17
|
export declare function GradientTexture({ stops, colors, size, width, type, innerCircleRadius, outerCircleRadius, ...props }: Props): React.JSX.Element;
|
|
18
18
|
export {};
|
package/core/GradientTexture.js
CHANGED
package/core/StatsGl.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@react-three/fiber"),t=require("react"),r=require("stats-gl");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function l(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=l(t),u=o(r);const s=n.forwardRef((({className:t,parent:r,id:o,clearStatsGlStyle:l,...s},a)=>{const c=e.useThree((e=>e.gl)),d=n.useMemo((()=>{const e=new u.default({...s});return e.init(c),e}),[c]);return n.useImperativeHandle(a,(()=>d.dom)),n.useEffect((()=>{if(d){const n=r&&r.current||document.body;null==n||n.appendChild(d.dom),d.dom.querySelectorAll("canvas").forEach((e=>{e.style.removeProperty("position")})),o&&(d.dom.id=o),l&&d.dom.removeAttribute("style"),d.dom.removeAttribute("style");const u=(null!=t?t:"").split(" ").filter((e=>e));u.length&&d.dom.classList.add(...u);const s=e.addAfterEffect((()=>d.update()));return()=>{u.length&&d.dom.classList.remove(...u),null==n||n.removeChild(d.dom),s()}}}),[r,d,t,o,l]),null}));s.displayName="StatsGl",exports.StatsGl=s;
|
package/core/StatsGl.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { ForwardRefComponent } from '../helpers/ts-utils';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import Stats from 'stats-gl';
|
|
3
4
|
type Props = Partial<Stats> & {
|
|
5
|
+
id?: string;
|
|
6
|
+
clearStatsGlStyle?: boolean;
|
|
4
7
|
showPanel?: number;
|
|
5
8
|
className?: string;
|
|
6
9
|
parent?: React.RefObject<HTMLElement>;
|
|
10
|
+
ref?: React.RefObject<HTMLElement>;
|
|
7
11
|
};
|
|
8
|
-
export declare
|
|
12
|
+
export declare const StatsGl: ForwardRefComponent<Props, HTMLDivElement>;
|
|
9
13
|
export {};
|
package/core/StatsGl.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { useThree, addAfterEffect } from '@react-three/fiber';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import Stats from 'stats-gl';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
const StatsGl = /* @__PURE__ */React.forwardRef(({
|
|
6
6
|
className,
|
|
7
7
|
parent,
|
|
8
|
+
id,
|
|
9
|
+
clearStatsGlStyle,
|
|
8
10
|
...props
|
|
9
|
-
}) {
|
|
11
|
+
}, fref) => {
|
|
10
12
|
const gl = useThree(state => state.gl);
|
|
11
13
|
const stats = React.useMemo(() => {
|
|
12
14
|
const stats = new Stats({
|
|
@@ -15,10 +17,17 @@ function StatsGl({
|
|
|
15
17
|
stats.init(gl);
|
|
16
18
|
return stats;
|
|
17
19
|
}, [gl]);
|
|
20
|
+
React.useImperativeHandle(fref, () => stats.dom);
|
|
18
21
|
React.useEffect(() => {
|
|
19
22
|
if (stats) {
|
|
20
23
|
const node = parent && parent.current || document.body;
|
|
21
24
|
node == null || node.appendChild(stats.dom);
|
|
25
|
+
stats.dom.querySelectorAll('canvas').forEach(canvas => {
|
|
26
|
+
canvas.style.removeProperty('position');
|
|
27
|
+
});
|
|
28
|
+
if (id) stats.dom.id = id;
|
|
29
|
+
if (clearStatsGlStyle) stats.dom.removeAttribute('style');
|
|
30
|
+
stats.dom.removeAttribute('style');
|
|
22
31
|
const classNames = (className !== null && className !== void 0 ? className : '').split(' ').filter(cls => cls);
|
|
23
32
|
if (classNames.length) stats.dom.classList.add(...classNames);
|
|
24
33
|
const end = addAfterEffect(() => stats.update());
|
|
@@ -28,8 +37,9 @@ function StatsGl({
|
|
|
28
37
|
end();
|
|
29
38
|
};
|
|
30
39
|
}
|
|
31
|
-
}, [parent, stats, className]);
|
|
40
|
+
}, [parent, stats, className, id, clearStatsGlStyle]);
|
|
32
41
|
return null;
|
|
33
|
-
}
|
|
42
|
+
});
|
|
43
|
+
StatsGl.displayName = 'StatsGl';
|
|
34
44
|
|
|
35
45
|
export { StatsGl };
|