@tscircuit/3d-viewer 0.0.575 → 0.0.576
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/index.js +265 -209
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14432,7 +14432,7 @@ var require_browser = __commonJS({
|
|
|
14432
14432
|
});
|
|
14433
14433
|
|
|
14434
14434
|
// src/CadViewer.tsx
|
|
14435
|
-
import { useState as
|
|
14435
|
+
import { useState as useState39, useCallback as useCallback25, useRef as useRef28, useEffect as useEffect48 } from "react";
|
|
14436
14436
|
import * as THREE46 from "three";
|
|
14437
14437
|
|
|
14438
14438
|
// src/CadViewerJscad.tsx
|
|
@@ -32429,7 +32429,7 @@ import * as THREE21 from "three";
|
|
|
32429
32429
|
// package.json
|
|
32430
32430
|
var package_default = {
|
|
32431
32431
|
name: "@tscircuit/3d-viewer",
|
|
32432
|
-
version: "0.0.
|
|
32432
|
+
version: "0.0.575",
|
|
32433
32433
|
main: "./dist/index.js",
|
|
32434
32434
|
module: "./dist/index.js",
|
|
32435
32435
|
type: "module",
|
|
@@ -39092,7 +39092,6 @@ var BoardMeshes = ({
|
|
|
39092
39092
|
const texture = typedMaterial[prop];
|
|
39093
39093
|
if (texture && texture instanceof THREE45.Texture) {
|
|
39094
39094
|
texture.dispose();
|
|
39095
|
-
typedMaterial[prop] = null;
|
|
39096
39095
|
}
|
|
39097
39096
|
}
|
|
39098
39097
|
material.dispose();
|
|
@@ -39736,7 +39735,7 @@ var ToastProvider = ({
|
|
|
39736
39735
|
};
|
|
39737
39736
|
|
|
39738
39737
|
// src/components/ContextMenu.tsx
|
|
39739
|
-
import { useState as
|
|
39738
|
+
import { useState as useState37 } from "react";
|
|
39740
39739
|
|
|
39741
39740
|
// node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs
|
|
39742
39741
|
import * as React44 from "react";
|
|
@@ -39746,7 +39745,7 @@ var canUseDOM = !!(typeof window !== "undefined" && window.document && window.do
|
|
|
39746
39745
|
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
39747
39746
|
return function handleEvent(event) {
|
|
39748
39747
|
originalEventHandler?.(event);
|
|
39749
|
-
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
39748
|
+
if (checkForDefaultPrevented === false || !event || !event.defaultPrevented) {
|
|
39750
39749
|
return ourEventHandler?.(event);
|
|
39751
39750
|
}
|
|
39752
39751
|
};
|
|
@@ -39806,11 +39805,13 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
|
39806
39805
|
return /* @__PURE__ */ jsx21(Context.Provider, { value, children });
|
|
39807
39806
|
};
|
|
39808
39807
|
Provider.displayName = rootComponentName + "Provider";
|
|
39809
|
-
function useContext22(consumerName, scope) {
|
|
39808
|
+
function useContext22(consumerName, scope, options = {}) {
|
|
39809
|
+
const { optional = false } = options;
|
|
39810
39810
|
const Context = scope?.[scopeName]?.[index2] || BaseContext;
|
|
39811
39811
|
const context = React14.useContext(Context);
|
|
39812
39812
|
if (context) return context;
|
|
39813
39813
|
if (defaultContext !== void 0) return defaultContext;
|
|
39814
|
+
if (optional) return void 0;
|
|
39814
39815
|
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
39815
39816
|
}
|
|
39816
39817
|
return [Provider, useContext22];
|
|
@@ -39852,7 +39853,7 @@ function composeContextScopes(...scopes) {
|
|
|
39852
39853
|
}
|
|
39853
39854
|
|
|
39854
39855
|
// node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
39855
|
-
import * as
|
|
39856
|
+
import * as React16 from "react";
|
|
39856
39857
|
|
|
39857
39858
|
// node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
|
|
39858
39859
|
import * as React15 from "react";
|
|
@@ -39861,32 +39862,7 @@ var useLayoutEffect2 = globalThis?.document ? React15.useLayoutEffect : () => {
|
|
|
39861
39862
|
|
|
39862
39863
|
// node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
39863
39864
|
import * as React22 from "react";
|
|
39864
|
-
|
|
39865
|
-
// node_modules/@radix-ui/react-use-effect-event/dist/index.mjs
|
|
39866
|
-
import * as React16 from "react";
|
|
39867
|
-
var useReactEffectEvent = React16[" useEffectEvent ".trim().toString()];
|
|
39868
|
-
var useReactInsertionEffect = React16[" useInsertionEffect ".trim().toString()];
|
|
39869
|
-
function useEffectEvent(callback) {
|
|
39870
|
-
if (typeof useReactEffectEvent === "function") {
|
|
39871
|
-
return useReactEffectEvent(callback);
|
|
39872
|
-
}
|
|
39873
|
-
const ref = React16.useRef(() => {
|
|
39874
|
-
throw new Error("Cannot call an event handler while rendering.");
|
|
39875
|
-
});
|
|
39876
|
-
if (typeof useReactInsertionEffect === "function") {
|
|
39877
|
-
useReactInsertionEffect(() => {
|
|
39878
|
-
ref.current = callback;
|
|
39879
|
-
});
|
|
39880
|
-
} else {
|
|
39881
|
-
useLayoutEffect2(() => {
|
|
39882
|
-
ref.current = callback;
|
|
39883
|
-
});
|
|
39884
|
-
}
|
|
39885
|
-
return React16.useMemo(() => ((...args) => ref.current?.(...args)), []);
|
|
39886
|
-
}
|
|
39887
|
-
|
|
39888
|
-
// node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
39889
|
-
var useInsertionEffect = React17[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
|
|
39865
|
+
var useInsertionEffect = React16[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
|
|
39890
39866
|
function useControllableState({
|
|
39891
39867
|
prop,
|
|
39892
39868
|
defaultProp,
|
|
@@ -39901,8 +39877,8 @@ function useControllableState({
|
|
|
39901
39877
|
const isControlled = prop !== void 0;
|
|
39902
39878
|
const value = isControlled ? prop : uncontrolledProp;
|
|
39903
39879
|
if (true) {
|
|
39904
|
-
const isControlledRef =
|
|
39905
|
-
|
|
39880
|
+
const isControlledRef = React16.useRef(prop !== void 0);
|
|
39881
|
+
React16.useEffect(() => {
|
|
39906
39882
|
const wasControlled = isControlledRef.current;
|
|
39907
39883
|
if (wasControlled !== isControlled) {
|
|
39908
39884
|
const from = wasControlled ? "controlled" : "uncontrolled";
|
|
@@ -39914,7 +39890,7 @@ function useControllableState({
|
|
|
39914
39890
|
isControlledRef.current = isControlled;
|
|
39915
39891
|
}, [isControlled, caller]);
|
|
39916
39892
|
}
|
|
39917
|
-
const setValue =
|
|
39893
|
+
const setValue = React16.useCallback(
|
|
39918
39894
|
(nextValue) => {
|
|
39919
39895
|
if (isControlled) {
|
|
39920
39896
|
const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
|
|
@@ -39933,13 +39909,13 @@ function useUncontrolledState({
|
|
|
39933
39909
|
defaultProp,
|
|
39934
39910
|
onChange
|
|
39935
39911
|
}) {
|
|
39936
|
-
const [value, setValue] =
|
|
39937
|
-
const prevValueRef =
|
|
39938
|
-
const onChangeRef =
|
|
39912
|
+
const [value, setValue] = React16.useState(defaultProp);
|
|
39913
|
+
const prevValueRef = React16.useRef(value);
|
|
39914
|
+
const onChangeRef = React16.useRef(onChange);
|
|
39939
39915
|
useInsertionEffect(() => {
|
|
39940
39916
|
onChangeRef.current = onChange;
|
|
39941
39917
|
}, [onChange]);
|
|
39942
|
-
|
|
39918
|
+
React16.useEffect(() => {
|
|
39943
39919
|
if (prevValueRef.current !== value) {
|
|
39944
39920
|
onChangeRef.current?.(value);
|
|
39945
39921
|
prevValueRef.current = value;
|
|
@@ -39952,14 +39928,14 @@ function isFunction(value) {
|
|
|
39952
39928
|
}
|
|
39953
39929
|
|
|
39954
39930
|
// node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
39955
|
-
import * as
|
|
39931
|
+
import * as React18 from "react";
|
|
39956
39932
|
import * as ReactDOM2 from "react-dom";
|
|
39957
39933
|
|
|
39958
39934
|
// node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
39959
|
-
import * as
|
|
39935
|
+
import * as React17 from "react";
|
|
39960
39936
|
// @__NO_SIDE_EFFECTS__
|
|
39961
39937
|
function createSlot(ownerName) {
|
|
39962
|
-
const Slot2 =
|
|
39938
|
+
const Slot2 = React17.forwardRef((props, forwardedRef) => {
|
|
39963
39939
|
let { children, ...slotProps } = props;
|
|
39964
39940
|
let slottableElement = null;
|
|
39965
39941
|
let hasSlottable = false;
|
|
@@ -39967,7 +39943,7 @@ function createSlot(ownerName) {
|
|
|
39967
39943
|
if (isLazyComponent(children) && typeof use === "function") {
|
|
39968
39944
|
children = use(children._payload);
|
|
39969
39945
|
}
|
|
39970
|
-
|
|
39946
|
+
React17.Children.forEach(children, (maybeSlottable) => {
|
|
39971
39947
|
if (isSlottable(maybeSlottable)) {
|
|
39972
39948
|
hasSlottable = true;
|
|
39973
39949
|
const slottable = maybeSlottable;
|
|
@@ -39982,13 +39958,13 @@ function createSlot(ownerName) {
|
|
|
39982
39958
|
}
|
|
39983
39959
|
});
|
|
39984
39960
|
if (slottableElement) {
|
|
39985
|
-
slottableElement =
|
|
39961
|
+
slottableElement = React17.cloneElement(slottableElement, void 0, newChildren);
|
|
39986
39962
|
} else if (
|
|
39987
39963
|
// A `Slottable` was found but it didn't resolve to a single element (e.g.
|
|
39988
39964
|
// it wrapped multiple elements, text, or a render-prop `child` that
|
|
39989
39965
|
// wasn't an element). Don't fall back to treating the `Slottable` wrapper
|
|
39990
39966
|
// itself as the slot target — throw a descriptive error below instead.
|
|
39991
|
-
!hasSlottable &&
|
|
39967
|
+
!hasSlottable && React17.Children.count(children) === 1 && React17.isValidElement(children)
|
|
39992
39968
|
) {
|
|
39993
39969
|
slottableElement = children;
|
|
39994
39970
|
}
|
|
@@ -40003,10 +39979,10 @@ function createSlot(ownerName) {
|
|
|
40003
39979
|
return children;
|
|
40004
39980
|
}
|
|
40005
39981
|
const mergedProps = mergeProps(slotProps, slottableElement.props ?? {});
|
|
40006
|
-
if (slottableElement.type !==
|
|
39982
|
+
if (slottableElement.type !== React17.Fragment) {
|
|
40007
39983
|
mergedProps.ref = forwardedRef ? composedRef : slottableElementRef;
|
|
40008
39984
|
}
|
|
40009
|
-
return
|
|
39985
|
+
return React17.cloneElement(slottableElement, mergedProps);
|
|
40010
39986
|
});
|
|
40011
39987
|
Slot2.displayName = `${ownerName}.Slot`;
|
|
40012
39988
|
return Slot2;
|
|
@@ -40015,10 +39991,10 @@ var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol.for("radix.slottable");
|
|
|
40015
39991
|
var getSlottableElementFromSlottable = (slottable, child) => {
|
|
40016
39992
|
if ("child" in slottable.props) {
|
|
40017
39993
|
const child2 = slottable.props.child;
|
|
40018
|
-
if (!
|
|
40019
|
-
return
|
|
39994
|
+
if (!React17.isValidElement(child2)) return null;
|
|
39995
|
+
return React17.cloneElement(child2, void 0, slottable.props.children(child2.props.children));
|
|
40020
39996
|
}
|
|
40021
|
-
return
|
|
39997
|
+
return React17.isValidElement(child) ? child : null;
|
|
40022
39998
|
};
|
|
40023
39999
|
function mergeProps(slotProps, childProps) {
|
|
40024
40000
|
const overrideProps = { ...childProps };
|
|
@@ -40058,7 +40034,7 @@ function getElementRef(element) {
|
|
|
40058
40034
|
return element.props.ref || element.ref;
|
|
40059
40035
|
}
|
|
40060
40036
|
function isSlottable(child) {
|
|
40061
|
-
return
|
|
40037
|
+
return React17.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
40062
40038
|
}
|
|
40063
40039
|
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
40064
40040
|
function isLazyComponent(element) {
|
|
@@ -40073,7 +40049,7 @@ var createSlotError = (ownerName) => {
|
|
|
40073
40049
|
var createSlottableError = (ownerName) => {
|
|
40074
40050
|
return `${ownerName} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`;
|
|
40075
40051
|
};
|
|
40076
|
-
var use =
|
|
40052
|
+
var use = React17[" use ".trim().toString()];
|
|
40077
40053
|
|
|
40078
40054
|
// node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
40079
40055
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
@@ -40098,7 +40074,7 @@ var NODES = [
|
|
|
40098
40074
|
];
|
|
40099
40075
|
var Primitive = NODES.reduce((primitive, node) => {
|
|
40100
40076
|
const Slot2 = createSlot(`Primitive.${node}`);
|
|
40101
|
-
const Node2 =
|
|
40077
|
+
const Node2 = React18.forwardRef((props, forwardedRef) => {
|
|
40102
40078
|
const { asChild, ...primitiveProps } = props;
|
|
40103
40079
|
const Comp = asChild ? Slot2 : node;
|
|
40104
40080
|
if (typeof window !== "undefined") {
|
|
@@ -40117,7 +40093,7 @@ function dispatchDiscreteCustomEvent(target, event) {
|
|
|
40117
40093
|
import * as React43 from "react";
|
|
40118
40094
|
|
|
40119
40095
|
// node_modules/@radix-ui/react-collection/dist/index.mjs
|
|
40120
|
-
import * as
|
|
40096
|
+
import * as React19 from "react";
|
|
40121
40097
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
40122
40098
|
import * as React23 from "react";
|
|
40123
40099
|
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
@@ -40130,14 +40106,14 @@ function createCollection(name) {
|
|
|
40130
40106
|
);
|
|
40131
40107
|
const CollectionProvider = (props) => {
|
|
40132
40108
|
const { scope, children } = props;
|
|
40133
|
-
const ref =
|
|
40134
|
-
const itemMap =
|
|
40109
|
+
const ref = React19.useRef(null);
|
|
40110
|
+
const itemMap = React19.useRef(/* @__PURE__ */ new Map()).current;
|
|
40135
40111
|
return /* @__PURE__ */ jsx23(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
40136
40112
|
};
|
|
40137
40113
|
CollectionProvider.displayName = PROVIDER_NAME;
|
|
40138
40114
|
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
40139
40115
|
const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
|
|
40140
|
-
const CollectionSlot =
|
|
40116
|
+
const CollectionSlot = React19.forwardRef(
|
|
40141
40117
|
(props, forwardedRef) => {
|
|
40142
40118
|
const { scope, children } = props;
|
|
40143
40119
|
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
@@ -40149,13 +40125,13 @@ function createCollection(name) {
|
|
|
40149
40125
|
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
40150
40126
|
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
40151
40127
|
const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);
|
|
40152
|
-
const CollectionItemSlot =
|
|
40128
|
+
const CollectionItemSlot = React19.forwardRef(
|
|
40153
40129
|
(props, forwardedRef) => {
|
|
40154
40130
|
const { scope, children, ...itemData } = props;
|
|
40155
|
-
const ref =
|
|
40131
|
+
const ref = React19.useRef(null);
|
|
40156
40132
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
40157
40133
|
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
40158
|
-
|
|
40134
|
+
React19.useEffect(() => {
|
|
40159
40135
|
context.itemMap.set(ref, { ref, ...itemData });
|
|
40160
40136
|
return () => void context.itemMap.delete(ref);
|
|
40161
40137
|
});
|
|
@@ -40165,7 +40141,7 @@ function createCollection(name) {
|
|
|
40165
40141
|
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
40166
40142
|
function useCollection3(scope) {
|
|
40167
40143
|
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
40168
|
-
const getItems =
|
|
40144
|
+
const getItems = React19.useCallback(() => {
|
|
40169
40145
|
const collectionNode = context.collectionRef.current;
|
|
40170
40146
|
if (!collectionNode) return [];
|
|
40171
40147
|
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
@@ -40185,25 +40161,25 @@ function createCollection(name) {
|
|
|
40185
40161
|
}
|
|
40186
40162
|
|
|
40187
40163
|
// node_modules/@radix-ui/react-direction/dist/index.mjs
|
|
40188
|
-
import * as
|
|
40164
|
+
import * as React20 from "react";
|
|
40189
40165
|
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
40190
|
-
var DirectionContext =
|
|
40166
|
+
var DirectionContext = React20.createContext(void 0);
|
|
40191
40167
|
function useDirection(localDir) {
|
|
40192
|
-
const globalDir =
|
|
40168
|
+
const globalDir = React20.useContext(DirectionContext);
|
|
40193
40169
|
return localDir || globalDir || "ltr";
|
|
40194
40170
|
}
|
|
40195
40171
|
|
|
40196
40172
|
// node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
|
|
40197
|
-
import * as
|
|
40173
|
+
import * as React24 from "react";
|
|
40198
40174
|
|
|
40199
40175
|
// node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
|
|
40200
|
-
import * as
|
|
40176
|
+
import * as React21 from "react";
|
|
40201
40177
|
function useCallbackRef(callback) {
|
|
40202
|
-
const callbackRef =
|
|
40203
|
-
|
|
40178
|
+
const callbackRef = React21.useRef(callback);
|
|
40179
|
+
React21.useEffect(() => {
|
|
40204
40180
|
callbackRef.current = callback;
|
|
40205
40181
|
});
|
|
40206
|
-
return
|
|
40182
|
+
return React21.useMemo(() => ((...args) => callbackRef.current?.(...args)), []);
|
|
40207
40183
|
}
|
|
40208
40184
|
|
|
40209
40185
|
// node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
|
|
@@ -40213,7 +40189,7 @@ var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
|
40213
40189
|
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
40214
40190
|
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
40215
40191
|
var originalBodyPointerEvents;
|
|
40216
|
-
var DismissableLayerContext =
|
|
40192
|
+
var DismissableLayerContext = React24.createContext({
|
|
40217
40193
|
layers: /* @__PURE__ */ new Set(),
|
|
40218
40194
|
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
40219
40195
|
branches: /* @__PURE__ */ new Set(),
|
|
@@ -40224,7 +40200,7 @@ var DismissableLayerContext = React25.createContext({
|
|
|
40224
40200
|
// See https://github.com/radix-ui/primitives/issues/3346
|
|
40225
40201
|
dismissableSurfaces: /* @__PURE__ */ new Set()
|
|
40226
40202
|
});
|
|
40227
|
-
var DismissableLayer =
|
|
40203
|
+
var DismissableLayer = React24.forwardRef(
|
|
40228
40204
|
(props, forwardedRef) => {
|
|
40229
40205
|
const {
|
|
40230
40206
|
disableOutsidePointerEvents = false,
|
|
@@ -40236,28 +40212,22 @@ var DismissableLayer = React25.forwardRef(
|
|
|
40236
40212
|
onDismiss,
|
|
40237
40213
|
...layerProps
|
|
40238
40214
|
} = props;
|
|
40239
|
-
const context =
|
|
40240
|
-
const [node, setNode] =
|
|
40215
|
+
const context = React24.useContext(DismissableLayerContext);
|
|
40216
|
+
const [node, setNode] = React24.useState(null);
|
|
40241
40217
|
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
|
40242
|
-
const [, force] =
|
|
40218
|
+
const [, force] = React24.useState({});
|
|
40243
40219
|
const composedRefs = useComposedRefs(forwardedRef, setNode);
|
|
40244
40220
|
const layers = Array.from(context.layers);
|
|
40245
|
-
const [highestLayerWithOutsidePointerEventsDisabled] = [
|
|
40246
|
-
|
|
40221
|
+
const [highestLayerWithOutsidePointerEventsDisabled] = [
|
|
40222
|
+
...context.layersWithOutsidePointerEventsDisabled
|
|
40223
|
+
].slice(-1);
|
|
40224
|
+
const highestLayerWithOutsidePointerEventsDisabledIndex = highestLayerWithOutsidePointerEventsDisabled ? layers.indexOf(highestLayerWithOutsidePointerEventsDisabled) : -1;
|
|
40247
40225
|
const index2 = node ? layers.indexOf(node) : -1;
|
|
40248
40226
|
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
40249
40227
|
const isPointerEventsEnabled = index2 >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
40250
|
-
const isDeferredPointerDownOutsideRef =
|
|
40228
|
+
const isDeferredPointerDownOutsideRef = React24.useRef(false);
|
|
40251
40229
|
const pointerDownOutside = usePointerDownOutside(
|
|
40252
40230
|
(event) => {
|
|
40253
|
-
const target = event.target;
|
|
40254
|
-
if (!(target instanceof Node)) {
|
|
40255
|
-
return;
|
|
40256
|
-
}
|
|
40257
|
-
const isPointerDownOnBranch = [...context.branches].some(
|
|
40258
|
-
(branch) => branch.contains(target)
|
|
40259
|
-
);
|
|
40260
|
-
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
40261
40231
|
onPointerDownOutside?.(event);
|
|
40262
40232
|
onInteractOutside?.(event);
|
|
40263
40233
|
if (!event.defaultPrevented) onDismiss?.();
|
|
@@ -40266,7 +40236,19 @@ var DismissableLayer = React25.forwardRef(
|
|
|
40266
40236
|
ownerDocument,
|
|
40267
40237
|
deferPointerDownOutside,
|
|
40268
40238
|
isDeferredPointerDownOutsideRef,
|
|
40269
|
-
dismissableSurfaces: context.dismissableSurfaces
|
|
40239
|
+
dismissableSurfaces: context.dismissableSurfaces,
|
|
40240
|
+
shouldHandlePointerDownOutside: React24.useCallback(
|
|
40241
|
+
(target) => {
|
|
40242
|
+
if (!(target instanceof Node)) {
|
|
40243
|
+
return false;
|
|
40244
|
+
}
|
|
40245
|
+
const isPointerDownOnBranch = [...context.branches].some(
|
|
40246
|
+
(branch) => branch.contains(target)
|
|
40247
|
+
);
|
|
40248
|
+
return isPointerEventsEnabled && !isPointerDownOnBranch;
|
|
40249
|
+
},
|
|
40250
|
+
[context.branches, isPointerEventsEnabled]
|
|
40251
|
+
)
|
|
40270
40252
|
}
|
|
40271
40253
|
);
|
|
40272
40254
|
const focusOutside = useFocusOutside((event) => {
|
|
@@ -40281,7 +40263,7 @@ var DismissableLayer = React25.forwardRef(
|
|
|
40281
40263
|
if (!event.defaultPrevented) onDismiss?.();
|
|
40282
40264
|
}, ownerDocument);
|
|
40283
40265
|
const isHighestLayer = node ? index2 === layers.length - 1 : false;
|
|
40284
|
-
const handleKeyDown =
|
|
40266
|
+
const handleKeyDown = useCallbackRef((event) => {
|
|
40285
40267
|
if (event.key !== "Escape") {
|
|
40286
40268
|
return;
|
|
40287
40269
|
}
|
|
@@ -40291,14 +40273,14 @@ var DismissableLayer = React25.forwardRef(
|
|
|
40291
40273
|
onDismiss();
|
|
40292
40274
|
}
|
|
40293
40275
|
});
|
|
40294
|
-
|
|
40276
|
+
React24.useEffect(() => {
|
|
40295
40277
|
if (!isHighestLayer) {
|
|
40296
40278
|
return;
|
|
40297
40279
|
}
|
|
40298
40280
|
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
40299
40281
|
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
40300
|
-
}, [ownerDocument, isHighestLayer]);
|
|
40301
|
-
|
|
40282
|
+
}, [ownerDocument, isHighestLayer, handleKeyDown]);
|
|
40283
|
+
React24.useEffect(() => {
|
|
40302
40284
|
if (!node) return;
|
|
40303
40285
|
if (disableOutsidePointerEvents) {
|
|
40304
40286
|
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
@@ -40318,7 +40300,7 @@ var DismissableLayer = React25.forwardRef(
|
|
|
40318
40300
|
}
|
|
40319
40301
|
};
|
|
40320
40302
|
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
40321
|
-
|
|
40303
|
+
React24.useEffect(() => {
|
|
40322
40304
|
return () => {
|
|
40323
40305
|
if (!node) return;
|
|
40324
40306
|
context.layers.delete(node);
|
|
@@ -40326,7 +40308,7 @@ var DismissableLayer = React25.forwardRef(
|
|
|
40326
40308
|
dispatchUpdate();
|
|
40327
40309
|
};
|
|
40328
40310
|
}, [node, context]);
|
|
40329
|
-
|
|
40311
|
+
React24.useEffect(() => {
|
|
40330
40312
|
const handleUpdate = () => force({});
|
|
40331
40313
|
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
40332
40314
|
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
@@ -40352,11 +40334,11 @@ var DismissableLayer = React25.forwardRef(
|
|
|
40352
40334
|
);
|
|
40353
40335
|
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
40354
40336
|
var BRANCH_NAME = "DismissableLayerBranch";
|
|
40355
|
-
var DismissableLayerBranch =
|
|
40356
|
-
const context =
|
|
40357
|
-
const ref =
|
|
40337
|
+
var DismissableLayerBranch = React24.forwardRef((props, forwardedRef) => {
|
|
40338
|
+
const context = React24.useContext(DismissableLayerContext);
|
|
40339
|
+
const ref = React24.useRef(null);
|
|
40358
40340
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
40359
|
-
|
|
40341
|
+
React24.useEffect(() => {
|
|
40360
40342
|
const node = ref.current;
|
|
40361
40343
|
if (node) {
|
|
40362
40344
|
context.branches.add(node);
|
|
@@ -40368,20 +40350,22 @@ var DismissableLayerBranch = React25.forwardRef((props, forwardedRef) => {
|
|
|
40368
40350
|
return /* @__PURE__ */ jsx26(Primitive.div, { ...props, ref: composedRefs });
|
|
40369
40351
|
});
|
|
40370
40352
|
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
40353
|
+
var IS_TRUE = () => true;
|
|
40371
40354
|
function usePointerDownOutside(onPointerDownOutside, args) {
|
|
40372
40355
|
const {
|
|
40373
40356
|
ownerDocument = globalThis?.document,
|
|
40374
40357
|
deferPointerDownOutside = false,
|
|
40375
40358
|
isDeferredPointerDownOutsideRef,
|
|
40376
|
-
dismissableSurfaces
|
|
40359
|
+
dismissableSurfaces,
|
|
40360
|
+
shouldHandlePointerDownOutside = IS_TRUE
|
|
40377
40361
|
} = args;
|
|
40378
40362
|
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
40379
|
-
const isPointerInsideReactTreeRef =
|
|
40380
|
-
const isPointerDownOutsideRef =
|
|
40381
|
-
const interceptedOutsideInteractionEventsRef =
|
|
40382
|
-
const handleClickRef =
|
|
40363
|
+
const isPointerInsideReactTreeRef = React24.useRef(false);
|
|
40364
|
+
const isPointerDownOutsideRef = React24.useRef(false);
|
|
40365
|
+
const interceptedOutsideInteractionEventsRef = React24.useRef(/* @__PURE__ */ new Map());
|
|
40366
|
+
const handleClickRef = React24.useRef(() => {
|
|
40383
40367
|
});
|
|
40384
|
-
|
|
40368
|
+
React24.useEffect(() => {
|
|
40385
40369
|
function resetOutsideInteraction() {
|
|
40386
40370
|
isPointerDownOutsideRef.current = false;
|
|
40387
40371
|
isDeferredPointerDownOutsideRef.current = false;
|
|
@@ -40428,6 +40412,12 @@ function usePointerDownOutside(onPointerDownOutside, args) {
|
|
|
40428
40412
|
}
|
|
40429
40413
|
};
|
|
40430
40414
|
var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;
|
|
40415
|
+
if (!shouldHandlePointerDownOutside(event.target)) {
|
|
40416
|
+
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
40417
|
+
resetOutsideInteraction();
|
|
40418
|
+
isPointerInsideReactTreeRef.current = false;
|
|
40419
|
+
return;
|
|
40420
|
+
}
|
|
40431
40421
|
const eventDetail = { originalEvent: event };
|
|
40432
40422
|
isPointerDownOutsideRef.current = true;
|
|
40433
40423
|
isDeferredPointerDownOutsideRef.current = deferPointerDownOutside && event.button === 0;
|
|
@@ -40474,7 +40464,8 @@ function usePointerDownOutside(onPointerDownOutside, args) {
|
|
|
40474
40464
|
handlePointerDownOutside,
|
|
40475
40465
|
deferPointerDownOutside,
|
|
40476
40466
|
isDeferredPointerDownOutsideRef,
|
|
40477
|
-
dismissableSurfaces
|
|
40467
|
+
dismissableSurfaces,
|
|
40468
|
+
shouldHandlePointerDownOutside
|
|
40478
40469
|
]);
|
|
40479
40470
|
return {
|
|
40480
40471
|
// ensures we check React component tree (not just DOM tree)
|
|
@@ -40483,8 +40474,8 @@ function usePointerDownOutside(onPointerDownOutside, args) {
|
|
|
40483
40474
|
}
|
|
40484
40475
|
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
40485
40476
|
const handleFocusOutside = useCallbackRef(onFocusOutside);
|
|
40486
|
-
const isFocusInsideReactTreeRef =
|
|
40487
|
-
|
|
40477
|
+
const isFocusInsideReactTreeRef = React24.useRef(false);
|
|
40478
|
+
React24.useEffect(() => {
|
|
40488
40479
|
const handleFocus = (event) => {
|
|
40489
40480
|
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
40490
40481
|
const eventDetail = { originalEvent: event };
|
|
@@ -40517,11 +40508,11 @@ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
|
40517
40508
|
}
|
|
40518
40509
|
|
|
40519
40510
|
// node_modules/@radix-ui/react-focus-guards/dist/index.mjs
|
|
40520
|
-
import * as
|
|
40511
|
+
import * as React25 from "react";
|
|
40521
40512
|
var count = 0;
|
|
40522
40513
|
var guards = null;
|
|
40523
40514
|
function useFocusGuards() {
|
|
40524
|
-
|
|
40515
|
+
React25.useEffect(() => {
|
|
40525
40516
|
if (!guards) {
|
|
40526
40517
|
guards = { start: createFocusGuard(), end: createFocusGuard() };
|
|
40527
40518
|
}
|
|
@@ -40555,13 +40546,13 @@ function createFocusGuard() {
|
|
|
40555
40546
|
}
|
|
40556
40547
|
|
|
40557
40548
|
// node_modules/@radix-ui/react-focus-scope/dist/index.mjs
|
|
40558
|
-
import * as
|
|
40549
|
+
import * as React26 from "react";
|
|
40559
40550
|
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
40560
40551
|
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
40561
40552
|
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
40562
40553
|
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
40563
40554
|
var FOCUS_SCOPE_NAME = "FocusScope";
|
|
40564
|
-
var FocusScope =
|
|
40555
|
+
var FocusScope = React26.forwardRef((props, forwardedRef) => {
|
|
40565
40556
|
const {
|
|
40566
40557
|
loop = false,
|
|
40567
40558
|
trapped = false,
|
|
@@ -40569,12 +40560,12 @@ var FocusScope = React27.forwardRef((props, forwardedRef) => {
|
|
|
40569
40560
|
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
40570
40561
|
...scopeProps
|
|
40571
40562
|
} = props;
|
|
40572
|
-
const [container, setContainer] =
|
|
40563
|
+
const [container, setContainer] = React26.useState(null);
|
|
40573
40564
|
const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);
|
|
40574
40565
|
const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);
|
|
40575
|
-
const lastFocusedElementRef =
|
|
40566
|
+
const lastFocusedElementRef = React26.useRef(null);
|
|
40576
40567
|
const composedRefs = useComposedRefs(forwardedRef, setContainer);
|
|
40577
|
-
const focusScope =
|
|
40568
|
+
const focusScope = React26.useRef({
|
|
40578
40569
|
paused: false,
|
|
40579
40570
|
pause() {
|
|
40580
40571
|
this.paused = true;
|
|
@@ -40583,7 +40574,7 @@ var FocusScope = React27.forwardRef((props, forwardedRef) => {
|
|
|
40583
40574
|
this.paused = false;
|
|
40584
40575
|
}
|
|
40585
40576
|
}).current;
|
|
40586
|
-
|
|
40577
|
+
React26.useEffect(() => {
|
|
40587
40578
|
if (trapped) {
|
|
40588
40579
|
let handleFocusIn2 = function(event) {
|
|
40589
40580
|
if (focusScope.paused || !container) return;
|
|
@@ -40619,7 +40610,7 @@ var FocusScope = React27.forwardRef((props, forwardedRef) => {
|
|
|
40619
40610
|
};
|
|
40620
40611
|
}
|
|
40621
40612
|
}, [trapped, container, focusScope.paused]);
|
|
40622
|
-
|
|
40613
|
+
React26.useEffect(() => {
|
|
40623
40614
|
if (container) {
|
|
40624
40615
|
focusScopesStack.add(focusScope);
|
|
40625
40616
|
const previouslyFocusedElement = document.activeElement;
|
|
@@ -40650,7 +40641,7 @@ var FocusScope = React27.forwardRef((props, forwardedRef) => {
|
|
|
40650
40641
|
};
|
|
40651
40642
|
}
|
|
40652
40643
|
}, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
|
|
40653
|
-
const handleKeyDown =
|
|
40644
|
+
const handleKeyDown = React26.useCallback(
|
|
40654
40645
|
(event) => {
|
|
40655
40646
|
if (!loop && !trapped) return;
|
|
40656
40647
|
if (focusScope.paused) return;
|
|
@@ -40704,8 +40695,12 @@ function getTabbableCandidates(container) {
|
|
|
40704
40695
|
return nodes;
|
|
40705
40696
|
}
|
|
40706
40697
|
function findVisible(elements, container) {
|
|
40698
|
+
const canUseCheckVisibility = typeof container.checkVisibility === "function" && container.checkVisibility({ checkVisibilityCSS: true });
|
|
40707
40699
|
for (const element of elements) {
|
|
40708
|
-
|
|
40700
|
+
const hidden = canUseCheckVisibility ? !element.checkVisibility({ checkVisibilityCSS: true }) : isHidden(element, { upTo: container });
|
|
40701
|
+
if (!hidden) {
|
|
40702
|
+
return element;
|
|
40703
|
+
}
|
|
40709
40704
|
}
|
|
40710
40705
|
}
|
|
40711
40706
|
function isHidden(node, { upTo }) {
|
|
@@ -40759,11 +40754,11 @@ function removeLinks(items) {
|
|
|
40759
40754
|
}
|
|
40760
40755
|
|
|
40761
40756
|
// node_modules/@radix-ui/react-id/dist/index.mjs
|
|
40762
|
-
import * as
|
|
40763
|
-
var useReactId =
|
|
40757
|
+
import * as React27 from "react";
|
|
40758
|
+
var useReactId = React27[" useId ".trim().toString()] || (() => void 0);
|
|
40764
40759
|
var count2 = 0;
|
|
40765
40760
|
function useId(deterministicId) {
|
|
40766
|
-
const [id, setId] =
|
|
40761
|
+
const [id, setId] = React27.useState(useReactId());
|
|
40767
40762
|
useLayoutEffect2(() => {
|
|
40768
40763
|
if (!deterministicId) setId((reactId) => reactId ?? String(count2++));
|
|
40769
40764
|
}, [deterministicId]);
|
|
@@ -40771,7 +40766,7 @@ function useId(deterministicId) {
|
|
|
40771
40766
|
}
|
|
40772
40767
|
|
|
40773
40768
|
// node_modules/@radix-ui/react-popper/dist/index.mjs
|
|
40774
|
-
import * as
|
|
40769
|
+
import * as React31 from "react";
|
|
40775
40770
|
|
|
40776
40771
|
// node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
|
40777
40772
|
var sides = ["top", "right", "bottom", "left"];
|
|
@@ -42391,7 +42386,7 @@ var computePosition2 = (reference, floating, options) => {
|
|
|
42391
42386
|
};
|
|
42392
42387
|
|
|
42393
42388
|
// node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
|
|
42394
|
-
import * as
|
|
42389
|
+
import * as React28 from "react";
|
|
42395
42390
|
import { useLayoutEffect as useLayoutEffect3 } from "react";
|
|
42396
42391
|
import * as ReactDOM3 from "react-dom";
|
|
42397
42392
|
var isClient = typeof document !== "undefined";
|
|
@@ -42457,7 +42452,7 @@ function roundByDPR(element, value) {
|
|
|
42457
42452
|
return Math.round(value * dpr) / dpr;
|
|
42458
42453
|
}
|
|
42459
42454
|
function useLatestRef(value) {
|
|
42460
|
-
const ref =
|
|
42455
|
+
const ref = React28.useRef(value);
|
|
42461
42456
|
index(() => {
|
|
42462
42457
|
ref.current = value;
|
|
42463
42458
|
});
|
|
@@ -42480,7 +42475,7 @@ function useFloating(options) {
|
|
|
42480
42475
|
whileElementsMounted,
|
|
42481
42476
|
open
|
|
42482
42477
|
} = options;
|
|
42483
|
-
const [data, setData] =
|
|
42478
|
+
const [data, setData] = React28.useState({
|
|
42484
42479
|
x: 0,
|
|
42485
42480
|
y: 0,
|
|
42486
42481
|
strategy,
|
|
@@ -42488,19 +42483,19 @@ function useFloating(options) {
|
|
|
42488
42483
|
middlewareData: {},
|
|
42489
42484
|
isPositioned: false
|
|
42490
42485
|
});
|
|
42491
|
-
const [latestMiddleware, setLatestMiddleware] =
|
|
42486
|
+
const [latestMiddleware, setLatestMiddleware] = React28.useState(middleware);
|
|
42492
42487
|
if (!deepEqual(latestMiddleware, middleware)) {
|
|
42493
42488
|
setLatestMiddleware(middleware);
|
|
42494
42489
|
}
|
|
42495
|
-
const [_reference, _setReference] =
|
|
42496
|
-
const [_floating, _setFloating] =
|
|
42497
|
-
const setReference =
|
|
42490
|
+
const [_reference, _setReference] = React28.useState(null);
|
|
42491
|
+
const [_floating, _setFloating] = React28.useState(null);
|
|
42492
|
+
const setReference = React28.useCallback((node) => {
|
|
42498
42493
|
if (node !== referenceRef.current) {
|
|
42499
42494
|
referenceRef.current = node;
|
|
42500
42495
|
_setReference(node);
|
|
42501
42496
|
}
|
|
42502
42497
|
}, []);
|
|
42503
|
-
const setFloating =
|
|
42498
|
+
const setFloating = React28.useCallback((node) => {
|
|
42504
42499
|
if (node !== floatingRef.current) {
|
|
42505
42500
|
floatingRef.current = node;
|
|
42506
42501
|
_setFloating(node);
|
|
@@ -42508,14 +42503,14 @@ function useFloating(options) {
|
|
|
42508
42503
|
}, []);
|
|
42509
42504
|
const referenceEl = externalReference || _reference;
|
|
42510
42505
|
const floatingEl = externalFloating || _floating;
|
|
42511
|
-
const referenceRef =
|
|
42512
|
-
const floatingRef =
|
|
42513
|
-
const dataRef =
|
|
42506
|
+
const referenceRef = React28.useRef(null);
|
|
42507
|
+
const floatingRef = React28.useRef(null);
|
|
42508
|
+
const dataRef = React28.useRef(data);
|
|
42514
42509
|
const hasWhileElementsMounted = whileElementsMounted != null;
|
|
42515
42510
|
const whileElementsMountedRef = useLatestRef(whileElementsMounted);
|
|
42516
42511
|
const platformRef = useLatestRef(platform2);
|
|
42517
42512
|
const openRef = useLatestRef(open);
|
|
42518
|
-
const update =
|
|
42513
|
+
const update = React28.useCallback(() => {
|
|
42519
42514
|
if (!referenceRef.current || !floatingRef.current) {
|
|
42520
42515
|
return;
|
|
42521
42516
|
}
|
|
@@ -42553,7 +42548,7 @@ function useFloating(options) {
|
|
|
42553
42548
|
}));
|
|
42554
42549
|
}
|
|
42555
42550
|
}, [open]);
|
|
42556
|
-
const isMountedRef =
|
|
42551
|
+
const isMountedRef = React28.useRef(false);
|
|
42557
42552
|
index(() => {
|
|
42558
42553
|
isMountedRef.current = true;
|
|
42559
42554
|
return () => {
|
|
@@ -42570,17 +42565,17 @@ function useFloating(options) {
|
|
|
42570
42565
|
update();
|
|
42571
42566
|
}
|
|
42572
42567
|
}, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
|
|
42573
|
-
const refs =
|
|
42568
|
+
const refs = React28.useMemo(() => ({
|
|
42574
42569
|
reference: referenceRef,
|
|
42575
42570
|
floating: floatingRef,
|
|
42576
42571
|
setReference,
|
|
42577
42572
|
setFloating
|
|
42578
42573
|
}), [setReference, setFloating]);
|
|
42579
|
-
const elements =
|
|
42574
|
+
const elements = React28.useMemo(() => ({
|
|
42580
42575
|
reference: referenceEl,
|
|
42581
42576
|
floating: floatingEl
|
|
42582
42577
|
}), [referenceEl, floatingEl]);
|
|
42583
|
-
const floatingStyles =
|
|
42578
|
+
const floatingStyles = React28.useMemo(() => {
|
|
42584
42579
|
const initialStyles = {
|
|
42585
42580
|
position: strategy,
|
|
42586
42581
|
left: 0,
|
|
@@ -42606,7 +42601,7 @@ function useFloating(options) {
|
|
|
42606
42601
|
top: y
|
|
42607
42602
|
};
|
|
42608
42603
|
}, [strategy, transform, elements.floating, data.x, data.y]);
|
|
42609
|
-
return
|
|
42604
|
+
return React28.useMemo(() => ({
|
|
42610
42605
|
...data,
|
|
42611
42606
|
update,
|
|
42612
42607
|
refs,
|
|
@@ -42702,10 +42697,10 @@ var arrow3 = (options, deps) => {
|
|
|
42702
42697
|
};
|
|
42703
42698
|
|
|
42704
42699
|
// node_modules/@radix-ui/react-arrow/dist/index.mjs
|
|
42705
|
-
import * as
|
|
42700
|
+
import * as React29 from "react";
|
|
42706
42701
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
42707
42702
|
var NAME = "Arrow";
|
|
42708
|
-
var Arrow =
|
|
42703
|
+
var Arrow = React29.forwardRef((props, forwardedRef) => {
|
|
42709
42704
|
const { children, width: width10 = 10, height: height10 = 5, ...arrowProps } = props;
|
|
42710
42705
|
return /* @__PURE__ */ jsx28(
|
|
42711
42706
|
Primitive.svg,
|
|
@@ -42724,9 +42719,9 @@ Arrow.displayName = NAME;
|
|
|
42724
42719
|
var Root = Arrow;
|
|
42725
42720
|
|
|
42726
42721
|
// node_modules/@radix-ui/react-use-size/dist/index.mjs
|
|
42727
|
-
import * as
|
|
42722
|
+
import * as React30 from "react";
|
|
42728
42723
|
function useSize(element) {
|
|
42729
|
-
const [size4, setSize] =
|
|
42724
|
+
const [size4, setSize] = React30.useState(void 0);
|
|
42730
42725
|
useLayoutEffect2(() => {
|
|
42731
42726
|
if (element) {
|
|
42732
42727
|
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
@@ -42767,8 +42762,8 @@ var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
|
42767
42762
|
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
42768
42763
|
var Popper = (props) => {
|
|
42769
42764
|
const { __scopePopper, children } = props;
|
|
42770
|
-
const [anchor, setAnchor] =
|
|
42771
|
-
const [placementState, setPlacementState] =
|
|
42765
|
+
const [anchor, setAnchor] = React31.useState(null);
|
|
42766
|
+
const [placementState, setPlacementState] = React31.useState(void 0);
|
|
42772
42767
|
return /* @__PURE__ */ jsx29(
|
|
42773
42768
|
PopperProvider,
|
|
42774
42769
|
{
|
|
@@ -42783,13 +42778,13 @@ var Popper = (props) => {
|
|
|
42783
42778
|
};
|
|
42784
42779
|
Popper.displayName = POPPER_NAME;
|
|
42785
42780
|
var ANCHOR_NAME = "PopperAnchor";
|
|
42786
|
-
var PopperAnchor =
|
|
42781
|
+
var PopperAnchor = React31.forwardRef(
|
|
42787
42782
|
(props, forwardedRef) => {
|
|
42788
42783
|
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
42789
42784
|
const context = usePopperContext(ANCHOR_NAME, __scopePopper);
|
|
42790
|
-
const ref =
|
|
42785
|
+
const ref = React31.useRef(null);
|
|
42791
42786
|
const onAnchorChange = context.onAnchorChange;
|
|
42792
|
-
const callbackRef =
|
|
42787
|
+
const callbackRef = React31.useCallback(
|
|
42793
42788
|
(node) => {
|
|
42794
42789
|
ref.current = node;
|
|
42795
42790
|
if (node) {
|
|
@@ -42799,8 +42794,8 @@ var PopperAnchor = React32.forwardRef(
|
|
|
42799
42794
|
[onAnchorChange]
|
|
42800
42795
|
);
|
|
42801
42796
|
const composedRefs = useComposedRefs(forwardedRef, callbackRef);
|
|
42802
|
-
const anchorRef =
|
|
42803
|
-
|
|
42797
|
+
const anchorRef = React31.useRef(null);
|
|
42798
|
+
React31.useEffect(() => {
|
|
42804
42799
|
if (!virtualRef) {
|
|
42805
42800
|
return;
|
|
42806
42801
|
}
|
|
@@ -42827,7 +42822,7 @@ var PopperAnchor = React32.forwardRef(
|
|
|
42827
42822
|
PopperAnchor.displayName = ANCHOR_NAME;
|
|
42828
42823
|
var CONTENT_NAME = "PopperContent";
|
|
42829
42824
|
var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME);
|
|
42830
|
-
var PopperContent =
|
|
42825
|
+
var PopperContent = React31.forwardRef(
|
|
42831
42826
|
(props, forwardedRef) => {
|
|
42832
42827
|
const {
|
|
42833
42828
|
__scopePopper,
|
|
@@ -42846,9 +42841,9 @@ var PopperContent = React32.forwardRef(
|
|
|
42846
42841
|
...contentProps
|
|
42847
42842
|
} = props;
|
|
42848
42843
|
const context = usePopperContext(CONTENT_NAME, __scopePopper);
|
|
42849
|
-
const [content, setContent] =
|
|
42844
|
+
const [content, setContent] = React31.useState(null);
|
|
42850
42845
|
const composedRefs = useComposedRefs(forwardedRef, setContent);
|
|
42851
|
-
const [arrow4, setArrow] =
|
|
42846
|
+
const [arrow4, setArrow] = React31.useState(null);
|
|
42852
42847
|
const arrowSize = useSize(arrow4);
|
|
42853
42848
|
const arrowWidth = arrowSize?.width ?? 0;
|
|
42854
42849
|
const arrowHeight = arrowSize?.height ?? 0;
|
|
@@ -42928,7 +42923,7 @@ var PopperContent = React32.forwardRef(
|
|
|
42928
42923
|
const arrowX = middlewareData.arrow?.x;
|
|
42929
42924
|
const arrowY = middlewareData.arrow?.y;
|
|
42930
42925
|
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
42931
|
-
const [contentZIndex, setContentZIndex] =
|
|
42926
|
+
const [contentZIndex, setContentZIndex] = React31.useState();
|
|
42932
42927
|
useLayoutEffect2(() => {
|
|
42933
42928
|
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
42934
42929
|
}, [content]);
|
|
@@ -42995,7 +42990,7 @@ var OPPOSITE_SIDE = {
|
|
|
42995
42990
|
bottom: "top",
|
|
42996
42991
|
left: "right"
|
|
42997
42992
|
};
|
|
42998
|
-
var PopperArrow =
|
|
42993
|
+
var PopperArrow = React31.forwardRef(function PopperArrow2(props, forwardedRef) {
|
|
42999
42994
|
const { __scopePopper, ...arrowProps } = props;
|
|
43000
42995
|
const contentContext = useContentContext(ARROW_NAME, __scopePopper);
|
|
43001
42996
|
const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
|
|
@@ -43087,13 +43082,13 @@ var Content = PopperContent;
|
|
|
43087
43082
|
var Arrow2 = PopperArrow;
|
|
43088
43083
|
|
|
43089
43084
|
// node_modules/@radix-ui/react-portal/dist/index.mjs
|
|
43090
|
-
import * as
|
|
43085
|
+
import * as React32 from "react";
|
|
43091
43086
|
import * as ReactDOM4 from "react-dom";
|
|
43092
43087
|
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
43093
43088
|
var PORTAL_NAME = "Portal";
|
|
43094
|
-
var Portal =
|
|
43089
|
+
var Portal = React32.forwardRef((props, forwardedRef) => {
|
|
43095
43090
|
const { container: containerProp, ...portalProps } = props;
|
|
43096
|
-
const [mounted, setMounted] =
|
|
43091
|
+
const [mounted, setMounted] = React32.useState(false);
|
|
43097
43092
|
useLayoutEffect2(() => setMounted(true), []);
|
|
43098
43093
|
const container = containerProp || mounted && globalThis?.document?.body;
|
|
43099
43094
|
return container ? ReactDOM4.createPortal(/* @__PURE__ */ jsx30(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
@@ -43102,9 +43097,9 @@ Portal.displayName = PORTAL_NAME;
|
|
|
43102
43097
|
|
|
43103
43098
|
// node_modules/@radix-ui/react-presence/dist/index.mjs
|
|
43104
43099
|
import * as React210 from "react";
|
|
43105
|
-
import * as
|
|
43100
|
+
import * as React33 from "react";
|
|
43106
43101
|
function useStateMachine(initialState, machine) {
|
|
43107
|
-
return
|
|
43102
|
+
return React33.useReducer((state, event) => {
|
|
43108
43103
|
const nextState = machine[state][event];
|
|
43109
43104
|
return nextState ?? state;
|
|
43110
43105
|
}, initialState);
|
|
@@ -43123,6 +43118,7 @@ function usePresence(present) {
|
|
|
43123
43118
|
const stylesRef = React210.useRef(null);
|
|
43124
43119
|
const prevPresentRef = React210.useRef(present);
|
|
43125
43120
|
const prevAnimationNameRef = React210.useRef("none");
|
|
43121
|
+
const mountAnimationNameRef = React210.useRef(void 0);
|
|
43126
43122
|
const initialState = present ? "mounted" : "unmounted";
|
|
43127
43123
|
const [state, send] = useStateMachine(initialState, {
|
|
43128
43124
|
mounted: {
|
|
@@ -43138,8 +43134,12 @@ function usePresence(present) {
|
|
|
43138
43134
|
}
|
|
43139
43135
|
});
|
|
43140
43136
|
React210.useEffect(() => {
|
|
43141
|
-
|
|
43142
|
-
|
|
43137
|
+
if (state === "mounted") {
|
|
43138
|
+
prevAnimationNameRef.current = mountAnimationNameRef.current ?? getAnimationName(stylesRef.current);
|
|
43139
|
+
mountAnimationNameRef.current = void 0;
|
|
43140
|
+
} else {
|
|
43141
|
+
prevAnimationNameRef.current = "none";
|
|
43142
|
+
}
|
|
43143
43143
|
}, [state]);
|
|
43144
43144
|
useLayoutEffect2(() => {
|
|
43145
43145
|
const styles = stylesRef.current;
|
|
@@ -43149,6 +43149,7 @@ function usePresence(present) {
|
|
|
43149
43149
|
const prevAnimationName = prevAnimationNameRef.current;
|
|
43150
43150
|
const currentAnimationName = getAnimationName(styles);
|
|
43151
43151
|
if (present) {
|
|
43152
|
+
mountAnimationNameRef.current = currentAnimationName;
|
|
43152
43153
|
send("MOUNT");
|
|
43153
43154
|
} else if (currentAnimationName === "none" || styles?.display === "none") {
|
|
43154
43155
|
send("UNMOUNT");
|
|
@@ -43204,7 +43205,13 @@ function usePresence(present) {
|
|
|
43204
43205
|
return {
|
|
43205
43206
|
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
43206
43207
|
ref: React210.useCallback((node2) => {
|
|
43207
|
-
|
|
43208
|
+
if (node2) {
|
|
43209
|
+
const styles = getComputedStyle(node2);
|
|
43210
|
+
stylesRef.current = styles;
|
|
43211
|
+
mountAnimationNameRef.current = getAnimationName(styles);
|
|
43212
|
+
} else {
|
|
43213
|
+
stylesRef.current = null;
|
|
43214
|
+
}
|
|
43208
43215
|
setNode(node2);
|
|
43209
43216
|
}, [])
|
|
43210
43217
|
};
|
|
@@ -43262,6 +43269,36 @@ function getElementRef2(element) {
|
|
|
43262
43269
|
|
|
43263
43270
|
// node_modules/@radix-ui/react-roving-focus/dist/index.mjs
|
|
43264
43271
|
import * as React35 from "react";
|
|
43272
|
+
|
|
43273
|
+
// node_modules/@radix-ui/react-use-is-hydrated/dist/index.mjs
|
|
43274
|
+
import * as React211 from "react";
|
|
43275
|
+
import * as React34 from "react";
|
|
43276
|
+
var _isHydrated = false;
|
|
43277
|
+
function useIsHydrated() {
|
|
43278
|
+
const [isHydrated, setIsHydrated] = React34.useState(_isHydrated);
|
|
43279
|
+
React34.useEffect(() => {
|
|
43280
|
+
if (!_isHydrated) {
|
|
43281
|
+
_isHydrated = true;
|
|
43282
|
+
setIsHydrated(true);
|
|
43283
|
+
}
|
|
43284
|
+
}, []);
|
|
43285
|
+
return isHydrated;
|
|
43286
|
+
}
|
|
43287
|
+
var useReactSyncExternalStore = React211[" useSyncExternalStore ".trim().toString()];
|
|
43288
|
+
function subscribe() {
|
|
43289
|
+
return () => {
|
|
43290
|
+
};
|
|
43291
|
+
}
|
|
43292
|
+
function useIsHydratedModern() {
|
|
43293
|
+
return useReactSyncExternalStore(
|
|
43294
|
+
subscribe,
|
|
43295
|
+
() => true,
|
|
43296
|
+
() => false
|
|
43297
|
+
);
|
|
43298
|
+
}
|
|
43299
|
+
var useIsHydrated2 = typeof useReactSyncExternalStore === "function" ? useIsHydratedModern : useIsHydrated;
|
|
43300
|
+
|
|
43301
|
+
// node_modules/@radix-ui/react-roving-focus/dist/index.mjs
|
|
43265
43302
|
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
43266
43303
|
var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
43267
43304
|
var EVENT_OPTIONS2 = { bubbles: false, cancelable: true };
|
|
@@ -43385,12 +43422,21 @@ var RovingFocusGroupItem = React35.forwardRef(
|
|
|
43385
43422
|
const isCurrentTabStop = context.currentTabStopId === id;
|
|
43386
43423
|
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
43387
43424
|
const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context;
|
|
43425
|
+
const isHydrated = useIsHydrated2();
|
|
43426
|
+
useLayoutEffect2(() => {
|
|
43427
|
+
if (!isHydrated || !focusable) {
|
|
43428
|
+
return;
|
|
43429
|
+
}
|
|
43430
|
+
onFocusableItemAdd();
|
|
43431
|
+
return () => onFocusableItemRemove();
|
|
43432
|
+
}, [isHydrated, focusable, onFocusableItemAdd, onFocusableItemRemove]);
|
|
43388
43433
|
React35.useEffect(() => {
|
|
43389
|
-
if (focusable) {
|
|
43390
|
-
|
|
43391
|
-
return () => onFocusableItemRemove();
|
|
43434
|
+
if (isHydrated || !focusable) {
|
|
43435
|
+
return;
|
|
43392
43436
|
}
|
|
43393
|
-
|
|
43437
|
+
onFocusableItemAdd();
|
|
43438
|
+
return () => onFocusableItemRemove();
|
|
43439
|
+
}, [isHydrated, focusable, onFocusableItemAdd, onFocusableItemRemove]);
|
|
43394
43440
|
return /* @__PURE__ */ jsx31(
|
|
43395
43441
|
Collection.ItemSlot,
|
|
43396
43442
|
{
|
|
@@ -43649,9 +43695,9 @@ function assignRef(ref, value) {
|
|
|
43649
43695
|
}
|
|
43650
43696
|
|
|
43651
43697
|
// node_modules/use-callback-ref/dist/es2015/useRef.js
|
|
43652
|
-
import { useState as
|
|
43698
|
+
import { useState as useState32 } from "react";
|
|
43653
43699
|
function useCallbackRef2(initialValue, callback) {
|
|
43654
|
-
var ref =
|
|
43700
|
+
var ref = useState32(function() {
|
|
43655
43701
|
return {
|
|
43656
43702
|
// value
|
|
43657
43703
|
value: initialValue,
|
|
@@ -44700,8 +44746,13 @@ var MenuItem = React43.forwardRef(
|
|
|
44700
44746
|
if (!isPointerDownRef.current) event.currentTarget?.click();
|
|
44701
44747
|
}),
|
|
44702
44748
|
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
44749
|
+
if (disabled || event.target !== event.currentTarget) {
|
|
44750
|
+
return;
|
|
44751
|
+
}
|
|
44703
44752
|
const isTypingAhead = contentContext.searchRef.current !== "";
|
|
44704
|
-
if (
|
|
44753
|
+
if (isTypingAhead && event.key === " ") {
|
|
44754
|
+
return;
|
|
44755
|
+
}
|
|
44705
44756
|
if (SELECTION_KEYS.includes(event.key)) {
|
|
44706
44757
|
event.currentTarget.click();
|
|
44707
44758
|
event.preventDefault();
|
|
@@ -45004,8 +45055,13 @@ var MenuSubTrigger = React43.forwardRef(
|
|
|
45004
45055
|
})
|
|
45005
45056
|
),
|
|
45006
45057
|
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
45058
|
+
if (props.disabled || event.target !== event.currentTarget) {
|
|
45059
|
+
return;
|
|
45060
|
+
}
|
|
45007
45061
|
const isTypingAhead = contentContext.searchRef.current !== "";
|
|
45008
|
-
if (
|
|
45062
|
+
if (isTypingAhead && event.key === " ") {
|
|
45063
|
+
return;
|
|
45064
|
+
}
|
|
45009
45065
|
if (SUB_OPEN_KEYS[rootContext.dir].includes(event.key)) {
|
|
45010
45066
|
context.onOpenChange(true);
|
|
45011
45067
|
context.content?.focus();
|
|
@@ -45391,7 +45447,7 @@ var SubTrigger2 = DropdownMenuSubTrigger;
|
|
|
45391
45447
|
var SubContent2 = DropdownMenuSubContent;
|
|
45392
45448
|
|
|
45393
45449
|
// src/components/AppearanceMenu.tsx
|
|
45394
|
-
import { useState as
|
|
45450
|
+
import { useState as useState36 } from "react";
|
|
45395
45451
|
|
|
45396
45452
|
// src/components/Icons.tsx
|
|
45397
45453
|
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
@@ -45498,8 +45554,8 @@ var iconContainerStyles = {
|
|
|
45498
45554
|
var AppearanceMenu = () => {
|
|
45499
45555
|
const { visibility, setLayerVisibility } = useLayerVisibility();
|
|
45500
45556
|
const { lightingEnabled, setLightingEnabled } = useRenderingMode();
|
|
45501
|
-
const [appearanceSubOpen, setAppearanceSubOpen] =
|
|
45502
|
-
const [hoveredItem, setHoveredItem] =
|
|
45557
|
+
const [appearanceSubOpen, setAppearanceSubOpen] = useState36(false);
|
|
45558
|
+
const [hoveredItem, setHoveredItem] = useState36(null);
|
|
45503
45559
|
return /* @__PURE__ */ jsxs8(Fragment11, { children: [
|
|
45504
45560
|
/* @__PURE__ */ jsx35(Separator2, { style: separatorStyles }),
|
|
45505
45561
|
/* @__PURE__ */ jsxs8(Sub2, { onOpenChange: setAppearanceSubOpen, children: [
|
|
@@ -45887,8 +45943,8 @@ var ContextMenu = ({
|
|
|
45887
45943
|
onOpenKeyboardShortcuts
|
|
45888
45944
|
}) => {
|
|
45889
45945
|
const { cameraType, setCameraType } = useCameraController();
|
|
45890
|
-
const [cameraSubOpen, setCameraSubOpen] =
|
|
45891
|
-
const [hoveredItem, setHoveredItem] =
|
|
45946
|
+
const [cameraSubOpen, setCameraSubOpen] = useState37(false);
|
|
45947
|
+
const [hoveredItem, setHoveredItem] = useState37(null);
|
|
45892
45948
|
return /* @__PURE__ */ jsx36(
|
|
45893
45949
|
"div",
|
|
45894
45950
|
{
|
|
@@ -46146,16 +46202,16 @@ var ContextMenu = ({
|
|
|
46146
46202
|
};
|
|
46147
46203
|
|
|
46148
46204
|
// src/components/KeyboardShortcutsDialog.tsx
|
|
46149
|
-
import { useEffect as
|
|
46205
|
+
import { useEffect as useEffect47, useMemo as useMemo30, useRef as useRef27, useState as useState38 } from "react";
|
|
46150
46206
|
import { jsx as jsx37, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
46151
46207
|
var KeyboardShortcutsDialog = ({
|
|
46152
46208
|
open,
|
|
46153
46209
|
onClose
|
|
46154
46210
|
}) => {
|
|
46155
|
-
const [query, setQuery] =
|
|
46156
|
-
const inputRef =
|
|
46211
|
+
const [query, setQuery] = useState38("");
|
|
46212
|
+
const inputRef = useRef27(null);
|
|
46157
46213
|
const hotkeys = useHotkeyRegistry();
|
|
46158
|
-
|
|
46214
|
+
useEffect47(() => {
|
|
46159
46215
|
if (!open) return void 0;
|
|
46160
46216
|
const handleKeyDown = (event) => {
|
|
46161
46217
|
if (event.key === "Escape") {
|
|
@@ -46166,14 +46222,14 @@ var KeyboardShortcutsDialog = ({
|
|
|
46166
46222
|
window.addEventListener("keydown", handleKeyDown);
|
|
46167
46223
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
46168
46224
|
}, [open, onClose]);
|
|
46169
|
-
|
|
46225
|
+
useEffect47(() => {
|
|
46170
46226
|
if (open) {
|
|
46171
46227
|
setTimeout(() => {
|
|
46172
46228
|
inputRef.current?.focus();
|
|
46173
46229
|
}, 0);
|
|
46174
46230
|
}
|
|
46175
46231
|
}, [open]);
|
|
46176
|
-
const filteredHotkeys =
|
|
46232
|
+
const filteredHotkeys = useMemo30(() => {
|
|
46177
46233
|
const normalizedQuery = query.trim().toLowerCase();
|
|
46178
46234
|
if (!normalizedQuery) {
|
|
46179
46235
|
return hotkeys;
|
|
@@ -46345,25 +46401,25 @@ var readStoredCameraType = () => {
|
|
|
46345
46401
|
return stored === "orthographic" || stored === "perspective" ? stored : void 0;
|
|
46346
46402
|
};
|
|
46347
46403
|
var CadViewerInner = (props) => {
|
|
46348
|
-
const [engine, setEngine] =
|
|
46404
|
+
const [engine, setEngine] = useState39(() => {
|
|
46349
46405
|
const stored = window.localStorage.getItem("cadViewerEngine");
|
|
46350
46406
|
return stored === "jscad" || stored === "manifold" ? stored : "manifold";
|
|
46351
46407
|
});
|
|
46352
|
-
const containerRef =
|
|
46353
|
-
const [isKeyboardShortcutsDialogOpen, setIsKeyboardShortcutsDialogOpen] =
|
|
46354
|
-
const [autoRotate, setAutoRotate] =
|
|
46408
|
+
const containerRef = useRef28(null);
|
|
46409
|
+
const [isKeyboardShortcutsDialogOpen, setIsKeyboardShortcutsDialogOpen] = useState39(false);
|
|
46410
|
+
const [autoRotate, setAutoRotate] = useState39(() => {
|
|
46355
46411
|
const stored = window.localStorage.getItem("cadViewerAutoRotate");
|
|
46356
46412
|
return stored === "false" ? false : true;
|
|
46357
46413
|
});
|
|
46358
|
-
const [autoRotateUserToggled, setAutoRotateUserToggled] =
|
|
46414
|
+
const [autoRotateUserToggled, setAutoRotateUserToggled] = useState39(() => {
|
|
46359
46415
|
const stored = window.localStorage.getItem("cadViewerAutoRotateUserToggled");
|
|
46360
46416
|
return stored === "true";
|
|
46361
46417
|
});
|
|
46362
|
-
const [cameraPreset, setCameraPreset] =
|
|
46418
|
+
const [cameraPreset, setCameraPreset] = useState39("Custom");
|
|
46363
46419
|
const { cameraType, setCameraType } = useCameraController();
|
|
46364
46420
|
const { visibility, setLayerVisibility } = useLayerVisibility();
|
|
46365
46421
|
const { showToast } = useToast();
|
|
46366
|
-
const cameraControllerRef =
|
|
46422
|
+
const cameraControllerRef = useRef28(null);
|
|
46367
46423
|
const externalCameraControllerReady = props.onCameraControllerReady;
|
|
46368
46424
|
const {
|
|
46369
46425
|
menuVisible,
|
|
@@ -46372,12 +46428,12 @@ var CadViewerInner = (props) => {
|
|
|
46372
46428
|
contextMenuEventHandlers,
|
|
46373
46429
|
setMenuVisible
|
|
46374
46430
|
} = useContextMenu({ containerRef });
|
|
46375
|
-
const autoRotateUserToggledRef =
|
|
46431
|
+
const autoRotateUserToggledRef = useRef28(autoRotateUserToggled);
|
|
46376
46432
|
autoRotateUserToggledRef.current = autoRotateUserToggled;
|
|
46377
|
-
const isAnimatingRef =
|
|
46378
|
-
const lastPresetSelectTime =
|
|
46433
|
+
const isAnimatingRef = useRef28(false);
|
|
46434
|
+
const lastPresetSelectTime = useRef28(0);
|
|
46379
46435
|
const PRESET_COOLDOWN = 1e3;
|
|
46380
|
-
const handleUserInteraction =
|
|
46436
|
+
const handleUserInteraction = useCallback25(() => {
|
|
46381
46437
|
if (isAnimatingRef.current || Date.now() - lastPresetSelectTime.current < PRESET_COOLDOWN) {
|
|
46382
46438
|
return;
|
|
46383
46439
|
}
|
|
@@ -46388,15 +46444,15 @@ var CadViewerInner = (props) => {
|
|
|
46388
46444
|
setCameraPreset("Custom");
|
|
46389
46445
|
}
|
|
46390
46446
|
}, [menuVisible]);
|
|
46391
|
-
const toggleAutoRotate =
|
|
46447
|
+
const toggleAutoRotate = useCallback25(() => {
|
|
46392
46448
|
setAutoRotate((prev) => !prev);
|
|
46393
46449
|
setAutoRotateUserToggled(true);
|
|
46394
46450
|
}, []);
|
|
46395
46451
|
const downloadGltf = useGlobalDownloadGltf();
|
|
46396
|
-
const closeMenu =
|
|
46452
|
+
const closeMenu = useCallback25(() => {
|
|
46397
46453
|
setMenuVisible(false);
|
|
46398
46454
|
}, [setMenuVisible]);
|
|
46399
|
-
const handleCameraControllerReady =
|
|
46455
|
+
const handleCameraControllerReady = useCallback25(
|
|
46400
46456
|
(controller) => {
|
|
46401
46457
|
cameraControllerRef.current = controller;
|
|
46402
46458
|
externalCameraControllerReady?.(controller);
|
|
@@ -46470,24 +46526,24 @@ var CadViewerInner = (props) => {
|
|
|
46470
46526
|
description: "Toggle translucent components"
|
|
46471
46527
|
}
|
|
46472
46528
|
);
|
|
46473
|
-
|
|
46529
|
+
useEffect48(() => {
|
|
46474
46530
|
if (containerRef.current) {
|
|
46475
46531
|
registerHotkeyViewer(containerRef.current);
|
|
46476
46532
|
}
|
|
46477
46533
|
}, []);
|
|
46478
|
-
|
|
46534
|
+
useEffect48(() => {
|
|
46479
46535
|
window.localStorage.setItem("cadViewerEngine", engine);
|
|
46480
46536
|
}, [engine]);
|
|
46481
|
-
|
|
46537
|
+
useEffect48(() => {
|
|
46482
46538
|
window.localStorage.setItem("cadViewerAutoRotate", String(autoRotate));
|
|
46483
46539
|
}, [autoRotate]);
|
|
46484
|
-
|
|
46540
|
+
useEffect48(() => {
|
|
46485
46541
|
window.localStorage.setItem(
|
|
46486
46542
|
"cadViewerAutoRotateUserToggled",
|
|
46487
46543
|
String(autoRotateUserToggled)
|
|
46488
46544
|
);
|
|
46489
46545
|
}, [autoRotateUserToggled]);
|
|
46490
|
-
|
|
46546
|
+
useEffect48(() => {
|
|
46491
46547
|
window.localStorage.setItem("cadViewerCameraType", cameraType);
|
|
46492
46548
|
}, [cameraType]);
|
|
46493
46549
|
const viewerKey = props.circuitJson ? JSON.stringify(props.circuitJson) : void 0;
|
|
@@ -46888,10 +46944,10 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
|
|
|
46888
46944
|
|
|
46889
46945
|
// src/hooks/exporter/gltf.ts
|
|
46890
46946
|
import { GLTFExporter as GLTFExporter3 } from "three-stdlib";
|
|
46891
|
-
import { useEffect as
|
|
46947
|
+
import { useEffect as useEffect49, useState as useState40, useMemo as useMemo31, useCallback as useCallback26 } from "react";
|
|
46892
46948
|
function useSaveGltfAs(options = {}) {
|
|
46893
46949
|
const parse2 = useParser(options);
|
|
46894
|
-
const link =
|
|
46950
|
+
const link = useMemo31(() => document.createElement("a"), []);
|
|
46895
46951
|
const saveAs = async (filename) => {
|
|
46896
46952
|
const name = filename ?? options.filename ?? "";
|
|
46897
46953
|
if (options.binary == null) options.binary = name.endsWith(".glb");
|
|
@@ -46901,7 +46957,7 @@ function useSaveGltfAs(options = {}) {
|
|
|
46901
46957
|
link.dispatchEvent(new MouseEvent("click"));
|
|
46902
46958
|
URL.revokeObjectURL(url);
|
|
46903
46959
|
};
|
|
46904
|
-
|
|
46960
|
+
useEffect49(
|
|
46905
46961
|
() => () => {
|
|
46906
46962
|
link.remove();
|
|
46907
46963
|
instance = null;
|
|
@@ -46909,24 +46965,24 @@ function useSaveGltfAs(options = {}) {
|
|
|
46909
46965
|
[]
|
|
46910
46966
|
);
|
|
46911
46967
|
let instance;
|
|
46912
|
-
const ref =
|
|
46968
|
+
const ref = useCallback26((obj3D) => {
|
|
46913
46969
|
instance = obj3D;
|
|
46914
46970
|
}, []);
|
|
46915
46971
|
return [ref, saveAs];
|
|
46916
46972
|
}
|
|
46917
46973
|
function useExportGltfUrl(options = {}) {
|
|
46918
46974
|
const parse2 = useParser(options);
|
|
46919
|
-
const [url, setUrl] =
|
|
46920
|
-
const [error, setError] =
|
|
46921
|
-
const ref =
|
|
46975
|
+
const [url, setUrl] = useState40();
|
|
46976
|
+
const [error, setError] = useState40();
|
|
46977
|
+
const ref = useCallback26(
|
|
46922
46978
|
(instance) => parse2(instance).then(setUrl).catch(setError),
|
|
46923
46979
|
[]
|
|
46924
46980
|
);
|
|
46925
|
-
|
|
46981
|
+
useEffect49(() => () => URL.revokeObjectURL(url), [url]);
|
|
46926
46982
|
return [ref, url, error];
|
|
46927
46983
|
}
|
|
46928
46984
|
function useParser(options = {}) {
|
|
46929
|
-
const exporter =
|
|
46985
|
+
const exporter = useMemo31(() => new GLTFExporter3(), []);
|
|
46930
46986
|
return (instance) => {
|
|
46931
46987
|
const { promise, resolve, reject } = Promise.withResolvers();
|
|
46932
46988
|
exporter.parse(
|