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