@react-three/drei 9.105.0 → 9.105.2

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.
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { Object3DNode, Vector3 } from '@react-three/fiber';
2
+ import { Object3DNode, Euler } from '@react-three/fiber';
3
3
  import { Texture, Scene } from 'three';
4
4
  import { GroundProjectedEnv as GroundProjectedEnvImpl } from 'three-stdlib';
5
5
  import { PresetsType } from '../helpers/environment-assets';
@@ -14,9 +14,9 @@ export type EnvironmentProps = {
14
14
  blur?: number;
15
15
  backgroundBlurriness?: number;
16
16
  backgroundIntensity?: number;
17
- backgroundRotation?: Vector3;
17
+ backgroundRotation?: Euler;
18
18
  environmentIntensity?: number;
19
- environmentRotation?: Vector3;
19
+ environmentRotation?: Euler;
20
20
  map?: Texture;
21
21
  preset?: PresetsType;
22
22
  scene?: Scene | React.MutableRefObject<Scene>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three-stdlib"),r=require("suspend-react");let t=null;async function n(r){t||(t=new e.FontLoader);let n="string"==typeof r?await(await fetch(r)).json():r;return t.parse(n)}function s(e){return r.suspend(n,[e])}s.preload=e=>r.preload(n,[e]),s.clear=e=>r.clear([e]),exports.useFont=s;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("three-stdlib"),r=require("suspend-react");let t=null;async function n(r){const n=await async function(e){return"string"==typeof e?await(await fetch(e)).json():e}(r);return a=n,t||(t=new e.FontLoader),t.parse(a);var a}function a(e){return r.suspend(n,[e])}a.preload=e=>r.preload(n,[e]),a.clear=e=>r.clear([e]),exports.useFont=a;
package/core/useFont.d.ts CHANGED
@@ -15,8 +15,10 @@ export type FontData = {
15
15
  resolution: number;
16
16
  underlineThickness: number;
17
17
  };
18
- export declare function useFont(font: string | FontData): import("three-stdlib").Font;
18
+ type FontInput = string | FontData;
19
+ export declare function useFont(font: FontInput): import("three-stdlib").Font;
19
20
  export declare namespace useFont {
20
- var preload: (font: string | FontData) => undefined;
21
- var clear: (font: string | FontData) => void;
21
+ var preload: (font: FontInput) => undefined;
22
+ var clear: (font: FontInput) => void;
22
23
  }
24
+ export {};
package/core/useFont.js CHANGED
@@ -2,10 +2,18 @@ import { FontLoader } from 'three-stdlib';
2
2
  import { suspend, preload, clear } from 'suspend-react';
3
3
 
4
4
  let fontLoader = null;
5
+ async function loadFontData(font) {
6
+ return typeof font === 'string' ? await (await fetch(font)).json() : font;
7
+ }
8
+ function parseFontData(fontData) {
9
+ if (!fontLoader) {
10
+ fontLoader = new FontLoader();
11
+ }
12
+ return fontLoader.parse(fontData);
13
+ }
5
14
  async function loader(font) {
6
- if (!fontLoader) fontLoader = new FontLoader();
7
- let data = typeof font === 'string' ? await (await fetch(font)).json() : font;
8
- return fontLoader.parse(data);
15
+ const data = await loadFontData(font);
16
+ return parseFontData(data);
9
17
  }
10
18
  function useFont(font) {
11
19
  return suspend(loader, [font]);