@react-three/drei 9.102.4 → 9.102.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-three/drei",
3
- "version": "9.102.4",
3
+ "version": "9.102.6",
4
4
  "private": false,
5
5
  "description": "useful add-ons for react-three-fiber",
6
6
  "keywords": [
package/web/Html.d.ts CHANGED
@@ -24,7 +24,7 @@ export interface HtmlProps extends Omit<Assign<React.HTMLAttributes<HTMLDivEleme
24
24
  wrapperClass?: string;
25
25
  pointerEvents?: PointerEventsProperties;
26
26
  occlude?: React.RefObject<Object3D>[] | boolean | 'raycast' | 'blending';
27
- onOcclude?: (visible: boolean) => void;
27
+ onOcclude?: (hidden: boolean) => void;
28
28
  material?: React.ReactNode;
29
29
  geometry?: React.ReactNode;
30
30
  castShadow?: boolean;
package/web/Loader.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import * as React from 'react';
2
+ import { CSSProperties } from 'react';
2
3
  interface LoaderOptions {
3
- containerStyles: any;
4
- innerStyles: any;
5
- barStyles: any;
6
- dataStyles: any;
4
+ containerStyles: CSSProperties;
5
+ innerStyles: CSSProperties;
6
+ barStyles: CSSProperties;
7
+ dataStyles: CSSProperties;
7
8
  dataInterpolation: (p: number) => string;
8
9
  initialState: (active: boolean) => boolean;
9
10
  }
package/web/Select.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("react"),n=require("three"),r=require("three-stdlib"),o=require("@react-three/fiber"),i=require("zustand/shallow");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var u=l(e),c=s(t),a=s(n),d=l(i);const f=c.createContext([]);exports.Select=function({box:e,multiple:t,children:n,onChange:i,onChangePointerUp:l,border:s="1px solid #55aaff",backgroundColor:p="rgba(75, 160, 255, 0.1)",filter:h=(e=>e),...v}){const[b,y]=c.useState(!1),{setEvents:m,camera:x,raycaster:E,gl:g,controls:w,size:j,get:C}=o.useThree(),[P,O]=c.useState(!1),[M,k]=c.useReducer(((e,{object:t,shift:n})=>void 0===t?[]:Array.isArray(t)?t:n?e.includes(t)?e.filter((e=>e!==t)):[t,...e]:e[0]===t?[]:[t]),[]);c.useEffect((()=>{b?null==i||i(M):null==l||l(M)}),[M,b]);const q=c.useCallback((e=>{e.stopPropagation(),k({object:h([e.object])[0],shift:t&&e.shiftKey})}),[]),L=c.useCallback((e=>!P&&k({})),[P]),S=c.useRef(null);return c.useEffect((()=>{if(!e||!t)return;const n=new r.SelectionBox(x,S.current),o=document.createElement("div");o.style.pointerEvents="none",o.style.border=s,o.style.backgroundColor=p,o.style.position="fixed";const i=new a.Vector2,l=new a.Vector2,u=new a.Vector2,c=C().events.enabled,f=null==w?void 0:w.enabled;let v=!1;function b(e,t){const{offsetX:n,offsetY:r}=e,{width:o,height:i}=j;t.set(n/o*2-1,-r/i*2+1)}function E(e){e.shiftKey&&(!function(e){var t;w&&(w.enabled=!1),m({enabled:!1}),y(v=!0),null==(t=g.domElement.parentElement)||t.appendChild(o),o.style.left=`${e.clientX}px`,o.style.top=`${e.clientY}px`,o.style.width="0px",o.style.height="0px",i.x=e.clientX,i.y=e.clientY}(e),b(e,n.startPoint))}let P=[];function O(e){if(v){!function(e){u.x=Math.max(i.x,e.clientX),u.y=Math.max(i.y,e.clientY),l.x=Math.min(i.x,e.clientX),l.y=Math.min(i.y,e.clientY),o.style.left=`${l.x}px`,o.style.top=`${l.y}px`,o.style.width=u.x-l.x+"px",o.style.height=u.y-l.y+"px"}(e),b(e,n.endPoint);const t=n.select().sort((e=>e.uuid)).filter((e=>e.isMesh));d.default(t,P)||(P=t,k({object:h(t)}))}}function M(e){var t;v&&v&&(w&&(w.enabled=f),m({enabled:c}),y(v=!1),null==(t=o.parentElement)||t.removeChild(o))}return document.addEventListener("pointerdown",E,{passive:!0}),document.addEventListener("pointermove",O,{passive:!0,capture:!0}),document.addEventListener("pointerup",M,{passive:!0}),()=>{document.removeEventListener("pointerdown",E),document.removeEventListener("pointermove",O),document.removeEventListener("pointerup",M)}}),[j.width,j.height,E,x,w,g]),c.createElement("group",u.default({ref:S,onClick:q,onPointerOver:()=>O(!0),onPointerOut:()=>O(!1),onPointerMissed:L},v),c.createElement(f.Provider,{value:M},n))},exports.useSelect=function(){return c.useContext(f)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("react"),n=require("three"),r=require("three-stdlib"),o=require("@react-three/fiber"),i=require("zustand/shallow");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var u=l(e),c=s(t),a=s(n),d=l(i);const f=c.createContext([]);exports.Select=function({box:e,multiple:t,children:n,onChange:i,onChangePointerUp:l,border:s="1px solid #55aaff",backgroundColor:p="rgba(75, 160, 255, 0.1)",filter:h=(e=>e),...v}){const[b,y]=c.useState(!1),{setEvents:m,camera:x,raycaster:E,gl:g,controls:w,size:j,get:C}=o.useThree(),[P,O]=c.useState(!1),[M,k]=c.useReducer(((e,{object:t,shift:n})=>void 0===t?[]:Array.isArray(t)?t:n?e.includes(t)?e.filter((e=>e!==t)):[t,...e]:e[0]===t?[]:[t]),[]);c.useEffect((()=>{b?null==i||i(M):null==l||l(M)}),[M,b]);const q=c.useCallback((e=>{e.stopPropagation(),k({object:h([e.object])[0],shift:t&&e.shiftKey})}),[]),L=c.useCallback((e=>!P&&k({})),[P]),S=c.useRef(null);return c.useEffect((()=>{if(!e||!t)return;const n=new r.SelectionBox(x,S.current),o=document.createElement("div");o.style.pointerEvents="none",o.style.border=s,o.style.backgroundColor=p,o.style.position="fixed";const i=new a.Vector2,l=new a.Vector2,u=new a.Vector2,c=C().events.enabled,f=null==w?void 0:w.enabled;let v=!1;function b(e,t){const{offsetX:n,offsetY:r}=e,{width:o,height:i}=j;t.set(n/o*2-1,-r/i*2+1)}function E(e){e.shiftKey&&(!function(e){var t;w&&(w.enabled=!1),m({enabled:!1}),y(v=!0),null==(t=g.domElement.parentElement)||t.appendChild(o),o.style.left=`${e.clientX}px`,o.style.top=`${e.clientY}px`,o.style.width="0px",o.style.height="0px",i.x=e.clientX,i.y=e.clientY}(e),b(e,n.startPoint))}let P=[];function O(e){if(v){!function(e){u.x=Math.max(i.x,e.clientX),u.y=Math.max(i.y,e.clientY),l.x=Math.min(i.x,e.clientX),l.y=Math.min(i.y,e.clientY),o.style.left=`${l.x}px`,o.style.top=`${l.y}px`,o.style.width=u.x-l.x+"px",o.style.height=u.y-l.y+"px"}(e),b(e,n.endPoint);const t=n.select().sort((e=>e.uuid)).filter((e=>e.isMesh));d.default(t,P)||(P=t,k({object:h(t)}))}}function M(e){var t;v&&v&&(w&&(w.enabled=f),m({enabled:c}),y(v=!1),null==(t=o.parentElement)||t.removeChild(o))}return document.addEventListener("pointerdown",E,{passive:!0}),document.addEventListener("pointermove",O,{passive:!0,capture:!0}),document.addEventListener("pointerup",M,{passive:!0}),()=>{document.removeEventListener("pointerdown",E),document.removeEventListener("pointermove",O,!0),document.removeEventListener("pointerup",M)}}),[j.width,j.height,E,x,w,g]),c.createElement("group",u.default({ref:S,onClick:q,onPointerOver:()=>O(!0),onPointerOut:()=>O(!1),onPointerMissed:L},v),c.createElement(f.Provider,{value:M},n))},exports.useSelect=function(){return c.useContext(f)};
package/web/Select.js CHANGED
@@ -142,7 +142,7 @@ function Select({
142
142
  });
143
143
  return () => {
144
144
  document.removeEventListener('pointerdown', pointerDown);
145
- document.removeEventListener('pointermove', pointerMove);
145
+ document.removeEventListener('pointermove', pointerMove, true);
146
146
  document.removeEventListener('pointerup', pointerUp);
147
147
  };
148
148
  }, [size.width, size.height, raycaster, camera, controls, gl]);