@tscircuit/3d-viewer 0.0.582 → 0.0.583
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 +645 -513
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14432,12 +14432,12 @@ var require_browser = __commonJS({
|
|
|
14432
14432
|
});
|
|
14433
14433
|
|
|
14434
14434
|
// src/CadViewer.tsx
|
|
14435
|
-
import { useCallback as useCallback24, useEffect as
|
|
14436
|
-
import * as
|
|
14435
|
+
import { useCallback as useCallback24, useEffect as useEffect48, useRef as useRef29, useState as useState39 } from "react";
|
|
14436
|
+
import * as THREE46 from "three";
|
|
14437
14437
|
|
|
14438
14438
|
// src/CadViewerJscad.tsx
|
|
14439
14439
|
import { su as su11 } from "@tscircuit/circuit-json-util";
|
|
14440
|
-
import { forwardRef as forwardRef3, useMemo as
|
|
14440
|
+
import { forwardRef as forwardRef3, useMemo as useMemo21 } from "react";
|
|
14441
14441
|
|
|
14442
14442
|
// src/AnyCadComponent.tsx
|
|
14443
14443
|
import { su as su2 } from "@tscircuit/circuit-json-util";
|
|
@@ -32704,13 +32704,13 @@ var AnyCadComponent = ({
|
|
|
32704
32704
|
};
|
|
32705
32705
|
|
|
32706
32706
|
// src/CadViewerContainer.tsx
|
|
32707
|
-
import { forwardRef as forwardRef2, useEffect as
|
|
32708
|
-
import * as
|
|
32707
|
+
import { forwardRef as forwardRef2, useEffect as useEffect19, useMemo as useMemo15, useState as useState11 } from "react";
|
|
32708
|
+
import * as THREE21 from "three";
|
|
32709
32709
|
|
|
32710
32710
|
// package.json
|
|
32711
32711
|
var package_default = {
|
|
32712
32712
|
name: "@tscircuit/3d-viewer",
|
|
32713
|
-
version: "0.0.
|
|
32713
|
+
version: "0.0.582",
|
|
32714
32714
|
main: "./dist/index.js",
|
|
32715
32715
|
module: "./dist/index.js",
|
|
32716
32716
|
type: "module",
|
|
@@ -32801,6 +32801,7 @@ var AppearanceProvider = ({
|
|
|
32801
32801
|
children
|
|
32802
32802
|
}) => {
|
|
32803
32803
|
const [darkBackgroundEnabled, setDarkBackgroundEnabled] = useState8(false);
|
|
32804
|
+
const [gridEnabled, setGridEnabled] = useState8(false);
|
|
32804
32805
|
const [lightingEnabled, setLightingEnabled] = useState8(
|
|
32805
32806
|
readStoredLightingEnabled
|
|
32806
32807
|
);
|
|
@@ -32814,10 +32815,12 @@ var AppearanceProvider = ({
|
|
|
32814
32815
|
() => ({
|
|
32815
32816
|
darkBackgroundEnabled,
|
|
32816
32817
|
setDarkBackgroundEnabled,
|
|
32818
|
+
gridEnabled,
|
|
32819
|
+
setGridEnabled,
|
|
32817
32820
|
lightingEnabled,
|
|
32818
32821
|
setLightingEnabled
|
|
32819
32822
|
}),
|
|
32820
|
-
[darkBackgroundEnabled, lightingEnabled]
|
|
32823
|
+
[darkBackgroundEnabled, gridEnabled, lightingEnabled]
|
|
32821
32824
|
);
|
|
32822
32825
|
return /* @__PURE__ */ jsx11(AppearanceContext.Provider, { value, children });
|
|
32823
32826
|
};
|
|
@@ -33385,9 +33388,101 @@ var Canvas = forwardRef(
|
|
|
33385
33388
|
}
|
|
33386
33389
|
);
|
|
33387
33390
|
|
|
33388
|
-
// src/react-three/
|
|
33391
|
+
// src/react-three/Grid.tsx
|
|
33389
33392
|
import { useEffect as useEffect15, useMemo as useMemo12 } from "react";
|
|
33390
33393
|
import * as THREE17 from "three";
|
|
33394
|
+
var vertexShader = `
|
|
33395
|
+
varying vec3 worldPosition;
|
|
33396
|
+
void main() {
|
|
33397
|
+
worldPosition = (modelMatrix * vec4(position, 1.0)).xyz;
|
|
33398
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
33399
|
+
}
|
|
33400
|
+
`;
|
|
33401
|
+
var fragmentShader = `
|
|
33402
|
+
varying vec3 worldPosition;
|
|
33403
|
+
uniform float cellSize;
|
|
33404
|
+
uniform float sectionSize;
|
|
33405
|
+
uniform vec3 gridColor;
|
|
33406
|
+
uniform vec3 sectionColor;
|
|
33407
|
+
uniform float fadeDistance;
|
|
33408
|
+
uniform float fadeStrength;
|
|
33409
|
+
|
|
33410
|
+
float getGrid(float size) {
|
|
33411
|
+
vec2 r = worldPosition.xy / size;
|
|
33412
|
+
vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r);
|
|
33413
|
+
float line = min(grid.x, grid.y);
|
|
33414
|
+
return 1.0 - min(line * 1.5, 1.0);
|
|
33415
|
+
}
|
|
33416
|
+
|
|
33417
|
+
void main() {
|
|
33418
|
+
float g1 = getGrid(cellSize);
|
|
33419
|
+
float g2 = getGrid(sectionSize);
|
|
33420
|
+
|
|
33421
|
+
float d = distance(worldPosition.xy, cameraPosition.xy);
|
|
33422
|
+
float a = 1.0 - smoothstep(fadeDistance, fadeDistance * fadeStrength, d);
|
|
33423
|
+
|
|
33424
|
+
vec3 color = mix(gridColor, sectionColor, g2);
|
|
33425
|
+
|
|
33426
|
+
gl_FragColor = vec4(color, max(g1, g2) * a);
|
|
33427
|
+
if (gl_FragColor.a <= 0.0) discard;
|
|
33428
|
+
}
|
|
33429
|
+
`;
|
|
33430
|
+
var Grid = ({
|
|
33431
|
+
rotation,
|
|
33432
|
+
infiniteGrid,
|
|
33433
|
+
cellSize = 1,
|
|
33434
|
+
sectionSize = 10
|
|
33435
|
+
}) => {
|
|
33436
|
+
const { scene, camera } = useThree();
|
|
33437
|
+
const size4 = 1e3;
|
|
33438
|
+
const gridMesh = useMemo12(() => {
|
|
33439
|
+
const geometry = new THREE17.PlaneGeometry(size4, size4);
|
|
33440
|
+
geometry.rotateX(-Math.PI / 2);
|
|
33441
|
+
const material = new THREE17.ShaderMaterial({
|
|
33442
|
+
vertexShader,
|
|
33443
|
+
fragmentShader,
|
|
33444
|
+
uniforms: {
|
|
33445
|
+
cellSize: { value: cellSize },
|
|
33446
|
+
sectionSize: { value: sectionSize },
|
|
33447
|
+
gridColor: { value: new THREE17.Color(15658734) },
|
|
33448
|
+
sectionColor: { value: new THREE17.Color(13421823) },
|
|
33449
|
+
fadeDistance: { value: 100 },
|
|
33450
|
+
// Fade out based on sectionSize
|
|
33451
|
+
fadeStrength: { value: 1.5 }
|
|
33452
|
+
},
|
|
33453
|
+
transparent: true,
|
|
33454
|
+
side: THREE17.DoubleSide
|
|
33455
|
+
});
|
|
33456
|
+
const mesh = new THREE17.Mesh(geometry, material);
|
|
33457
|
+
if (rotation) {
|
|
33458
|
+
mesh.rotation.fromArray(rotation);
|
|
33459
|
+
}
|
|
33460
|
+
return mesh;
|
|
33461
|
+
}, [size4, cellSize, sectionSize, rotation]);
|
|
33462
|
+
useFrame(() => {
|
|
33463
|
+
if (infiniteGrid) {
|
|
33464
|
+
gridMesh.position.set(camera.position.x, camera.position.y, 0);
|
|
33465
|
+
}
|
|
33466
|
+
});
|
|
33467
|
+
useEffect15(() => {
|
|
33468
|
+
if (!scene || !gridMesh) return;
|
|
33469
|
+
scene.add(gridMesh);
|
|
33470
|
+
return () => {
|
|
33471
|
+
scene.remove(gridMesh);
|
|
33472
|
+
gridMesh.geometry.dispose();
|
|
33473
|
+
if (Array.isArray(gridMesh.material)) {
|
|
33474
|
+
gridMesh.material.forEach((m) => m.dispose());
|
|
33475
|
+
} else {
|
|
33476
|
+
gridMesh.material.dispose();
|
|
33477
|
+
}
|
|
33478
|
+
};
|
|
33479
|
+
}, [scene, gridMesh]);
|
|
33480
|
+
return null;
|
|
33481
|
+
};
|
|
33482
|
+
|
|
33483
|
+
// src/react-three/Lights.tsx
|
|
33484
|
+
import { useEffect as useEffect16, useMemo as useMemo13 } from "react";
|
|
33485
|
+
import * as THREE18 from "three";
|
|
33391
33486
|
var UNDERSIDE_LIGHT_FACTOR = 0.75;
|
|
33392
33487
|
var Lights = ({
|
|
33393
33488
|
boardDimensions,
|
|
@@ -33396,8 +33491,8 @@ var Lights = ({
|
|
|
33396
33491
|
shadowsEnabled = false
|
|
33397
33492
|
}) => {
|
|
33398
33493
|
const { scene } = useThree();
|
|
33399
|
-
const lightRig =
|
|
33400
|
-
const rig = new
|
|
33494
|
+
const lightRig = useMemo13(() => {
|
|
33495
|
+
const rig = new THREE18.Group();
|
|
33401
33496
|
rig.name = "cad-viewer-light-rig";
|
|
33402
33497
|
const centerX = boardCenter?.x ?? 0;
|
|
33403
33498
|
const centerY = boardCenter?.y ?? 0;
|
|
@@ -33409,14 +33504,14 @@ var Lights = ({
|
|
|
33409
33504
|
const shadowHalfSize = largestBoardDimension * 0.8;
|
|
33410
33505
|
const lightDistance = largestBoardDimension;
|
|
33411
33506
|
const keyLightDistance = largestBoardDimension * 1.7;
|
|
33412
|
-
const ambientLight = new
|
|
33507
|
+
const ambientLight = new THREE18.AmbientLight(16186360, 0.22);
|
|
33413
33508
|
ambientLight.name = "cad-viewer-soft-ambient";
|
|
33414
33509
|
rig.add(ambientLight);
|
|
33415
|
-
const hemisphereLight = new
|
|
33510
|
+
const hemisphereLight = new THREE18.HemisphereLight(15004141, 1581597, 0.2);
|
|
33416
33511
|
hemisphereLight.name = "cad-viewer-hemisphere";
|
|
33417
33512
|
rig.add(hemisphereLight);
|
|
33418
33513
|
const addDirectionalLight = (name, color, intensity, position, castShadow = false) => {
|
|
33419
|
-
const light = new
|
|
33514
|
+
const light = new THREE18.DirectionalLight(color, intensity);
|
|
33420
33515
|
light.name = name;
|
|
33421
33516
|
light.position.set(
|
|
33422
33517
|
centerX + position[0],
|
|
@@ -33490,17 +33585,17 @@ var Lights = ({
|
|
|
33490
33585
|
);
|
|
33491
33586
|
return rig;
|
|
33492
33587
|
}, [boardCenter, boardDimensions, shadowsEnabled]);
|
|
33493
|
-
|
|
33588
|
+
useEffect16(() => {
|
|
33494
33589
|
const previousBackground = scene.background;
|
|
33495
33590
|
const previousEnvironment = scene.environment;
|
|
33496
|
-
scene.background = darkBackgroundEnabled ? new
|
|
33591
|
+
scene.background = darkBackgroundEnabled ? new THREE18.Color(1053456) : null;
|
|
33497
33592
|
scene.environment = null;
|
|
33498
33593
|
return () => {
|
|
33499
33594
|
scene.background = previousBackground;
|
|
33500
33595
|
scene.environment = previousEnvironment;
|
|
33501
33596
|
};
|
|
33502
33597
|
}, [darkBackgroundEnabled, scene]);
|
|
33503
|
-
|
|
33598
|
+
useEffect16(() => {
|
|
33504
33599
|
if (!scene) return;
|
|
33505
33600
|
scene.add(lightRig);
|
|
33506
33601
|
return () => {
|
|
@@ -33511,8 +33606,8 @@ var Lights = ({
|
|
|
33511
33606
|
};
|
|
33512
33607
|
|
|
33513
33608
|
// src/react-three/OrbitControls.tsx
|
|
33514
|
-
import { useEffect as
|
|
33515
|
-
import * as
|
|
33609
|
+
import { useEffect as useEffect17, useMemo as useMemo14 } from "react";
|
|
33610
|
+
import * as THREE19 from "three";
|
|
33516
33611
|
import { OrbitControls as ThreeOrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
|
|
33517
33612
|
var OrbitControls = ({
|
|
33518
33613
|
autoRotate,
|
|
@@ -33527,15 +33622,15 @@ var OrbitControls = ({
|
|
|
33527
33622
|
onControlsChange
|
|
33528
33623
|
}) => {
|
|
33529
33624
|
const { camera, renderer } = useThree();
|
|
33530
|
-
const controls =
|
|
33625
|
+
const controls = useMemo14(() => {
|
|
33531
33626
|
if (!camera || !renderer) return null;
|
|
33532
33627
|
return new ThreeOrbitControls(camera, renderer.domElement);
|
|
33533
33628
|
}, [camera, renderer]);
|
|
33534
|
-
|
|
33629
|
+
useEffect17(() => {
|
|
33535
33630
|
onControlsChange?.(controls ?? null);
|
|
33536
33631
|
return () => onControlsChange?.(null);
|
|
33537
33632
|
}, [controls, onControlsChange]);
|
|
33538
|
-
|
|
33633
|
+
useEffect17(() => {
|
|
33539
33634
|
if (!controls) return;
|
|
33540
33635
|
const handleChange = () => {
|
|
33541
33636
|
onControlsChange?.(controls);
|
|
@@ -33545,7 +33640,7 @@ var OrbitControls = ({
|
|
|
33545
33640
|
controls.removeEventListener("change", handleChange);
|
|
33546
33641
|
};
|
|
33547
33642
|
}, [controls, onControlsChange]);
|
|
33548
|
-
|
|
33643
|
+
useEffect17(() => {
|
|
33549
33644
|
if (!controls) return;
|
|
33550
33645
|
controls.autoRotate = autoRotate || false;
|
|
33551
33646
|
controls.autoRotateSpeed = autoRotateSpeed || 1;
|
|
@@ -33556,9 +33651,9 @@ var OrbitControls = ({
|
|
|
33556
33651
|
if (dampingFactor !== void 0) controls.dampingFactor = dampingFactor;
|
|
33557
33652
|
controls.zoomToCursor = true;
|
|
33558
33653
|
controls.mouseButtons = {
|
|
33559
|
-
LEFT:
|
|
33654
|
+
LEFT: THREE19.MOUSE.ROTATE,
|
|
33560
33655
|
// Left click to rotate
|
|
33561
|
-
MIDDLE:
|
|
33656
|
+
MIDDLE: THREE19.MOUSE.PAN,
|
|
33562
33657
|
// Middle click to pan
|
|
33563
33658
|
RIGHT: null
|
|
33564
33659
|
// Right-click always disabled - only context menu
|
|
@@ -33578,14 +33673,14 @@ var OrbitControls = ({
|
|
|
33578
33673
|
dampingFactor,
|
|
33579
33674
|
target
|
|
33580
33675
|
]);
|
|
33581
|
-
|
|
33676
|
+
useEffect17(() => {
|
|
33582
33677
|
if (!controls || !onStart) return;
|
|
33583
33678
|
controls.addEventListener("start", onStart);
|
|
33584
33679
|
return () => {
|
|
33585
33680
|
controls.removeEventListener("start", onStart);
|
|
33586
33681
|
};
|
|
33587
33682
|
}, [controls, onStart]);
|
|
33588
|
-
|
|
33683
|
+
useEffect17(() => {
|
|
33589
33684
|
if (!controls) return;
|
|
33590
33685
|
return () => {
|
|
33591
33686
|
controls.dispose();
|
|
@@ -33598,15 +33693,15 @@ var OrbitControls = ({
|
|
|
33598
33693
|
};
|
|
33599
33694
|
|
|
33600
33695
|
// src/three-components/OrientationCubeCanvas.tsx
|
|
33601
|
-
import { useEffect as
|
|
33602
|
-
import * as
|
|
33696
|
+
import { useEffect as useEffect18, useRef as useRef7 } from "react";
|
|
33697
|
+
import * as THREE20 from "three";
|
|
33603
33698
|
import { Text as TroikaText } from "troika-three-text";
|
|
33604
33699
|
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
33605
33700
|
function computePointInFront(rotationVector, distance5) {
|
|
33606
|
-
const quaternion = new
|
|
33607
|
-
new
|
|
33701
|
+
const quaternion = new THREE20.Quaternion().setFromEuler(
|
|
33702
|
+
new THREE20.Euler(rotationVector.x, rotationVector.y, rotationVector.z)
|
|
33608
33703
|
);
|
|
33609
|
-
const forwardVector = new
|
|
33704
|
+
const forwardVector = new THREE20.Vector3(0, 0, 1);
|
|
33610
33705
|
forwardVector.applyQuaternion(quaternion);
|
|
33611
33706
|
const result = forwardVector.multiplyScalar(distance5);
|
|
33612
33707
|
return result;
|
|
@@ -33614,36 +33709,36 @@ function computePointInFront(rotationVector, distance5) {
|
|
|
33614
33709
|
var OrientationCubeCanvas = () => {
|
|
33615
33710
|
const { mainCameraRef } = useCameraController();
|
|
33616
33711
|
const containerRef = useRef7(null);
|
|
33617
|
-
|
|
33712
|
+
useEffect18(() => {
|
|
33618
33713
|
if (!containerRef.current) return;
|
|
33619
33714
|
const container = containerRef.current;
|
|
33620
33715
|
const canvas = document.createElement("canvas");
|
|
33621
33716
|
container.appendChild(canvas);
|
|
33622
|
-
const renderer = new
|
|
33717
|
+
const renderer = new THREE20.WebGLRenderer({
|
|
33623
33718
|
canvas,
|
|
33624
33719
|
antialias: true,
|
|
33625
33720
|
alpha: true
|
|
33626
33721
|
});
|
|
33627
33722
|
renderer.setSize(120, 120);
|
|
33628
33723
|
renderer.setPixelRatio(window.devicePixelRatio);
|
|
33629
|
-
const scene = new
|
|
33630
|
-
const camera = new
|
|
33724
|
+
const scene = new THREE20.Scene();
|
|
33725
|
+
const camera = new THREE20.PerspectiveCamera(75, 1, 0.1, 1e3);
|
|
33631
33726
|
camera.up.set(0, 0, 1);
|
|
33632
|
-
const ambientLight = new
|
|
33727
|
+
const ambientLight = new THREE20.AmbientLight(16777215, Math.PI / 2);
|
|
33633
33728
|
scene.add(ambientLight);
|
|
33634
|
-
const group = new
|
|
33729
|
+
const group = new THREE20.Group();
|
|
33635
33730
|
group.rotation.fromArray([Math.PI / 2, 0, 0]);
|
|
33636
33731
|
const cubeSize = 1;
|
|
33637
|
-
const box = new
|
|
33638
|
-
new
|
|
33639
|
-
new
|
|
33732
|
+
const box = new THREE20.Mesh(
|
|
33733
|
+
new THREE20.BoxGeometry(cubeSize, cubeSize, cubeSize),
|
|
33734
|
+
new THREE20.MeshStandardMaterial({ color: "white" })
|
|
33640
33735
|
);
|
|
33641
33736
|
group.add(box);
|
|
33642
|
-
const edges = new
|
|
33643
|
-
new
|
|
33644
|
-
new
|
|
33737
|
+
const edges = new THREE20.LineSegments(
|
|
33738
|
+
new THREE20.EdgesGeometry(
|
|
33739
|
+
new THREE20.BoxGeometry(cubeSize, cubeSize, cubeSize)
|
|
33645
33740
|
),
|
|
33646
|
-
new
|
|
33741
|
+
new THREE20.LineBasicMaterial({ color: 0, linewidth: 2 })
|
|
33647
33742
|
);
|
|
33648
33743
|
group.add(edges);
|
|
33649
33744
|
scene.add(group);
|
|
@@ -33698,7 +33793,7 @@ var OrientationCubeCanvas = () => {
|
|
|
33698
33793
|
const animate = () => {
|
|
33699
33794
|
if (mainCameraRef.current) {
|
|
33700
33795
|
const cameraPosition = computePointInFront(
|
|
33701
|
-
mainCameraRef.current.rotation ?? new
|
|
33796
|
+
mainCameraRef.current.rotation ?? new THREE20.Euler(0, 0, 0),
|
|
33702
33797
|
2
|
|
33703
33798
|
);
|
|
33704
33799
|
if (!cameraPosition.equals(camera.position)) {
|
|
@@ -33773,17 +33868,23 @@ var CadViewerContainer = forwardRef2(
|
|
|
33773
33868
|
!clickToInteractEnabled
|
|
33774
33869
|
);
|
|
33775
33870
|
const { mainCameraRef, handleControlsChange, controller } = useCameraController();
|
|
33776
|
-
const { darkBackgroundEnabled, lightingEnabled } = useAppearance();
|
|
33871
|
+
const { darkBackgroundEnabled, gridEnabled, lightingEnabled } = useAppearance();
|
|
33777
33872
|
const {
|
|
33778
33873
|
handleCameraCreated,
|
|
33779
33874
|
handleControlsChange: handleSessionControlsChange
|
|
33780
33875
|
} = useCameraSession();
|
|
33781
|
-
|
|
33876
|
+
useEffect19(() => {
|
|
33782
33877
|
if (onCameraControllerReady) {
|
|
33783
33878
|
onCameraControllerReady(controller);
|
|
33784
33879
|
}
|
|
33785
33880
|
}, [controller, onCameraControllerReady]);
|
|
33786
|
-
const
|
|
33881
|
+
const gridSectionSize = useMemo15(() => {
|
|
33882
|
+
if (!boardDimensions) return 10;
|
|
33883
|
+
const width10 = boardDimensions.width ?? 0;
|
|
33884
|
+
const height10 = boardDimensions.height ?? 0;
|
|
33885
|
+
return Math.max(Math.max(width10, height10) * 1.5, 10);
|
|
33886
|
+
}, [boardDimensions]);
|
|
33887
|
+
const orbitTarget = useMemo15(() => {
|
|
33787
33888
|
if (!boardCenter) return void 0;
|
|
33788
33889
|
return [boardCenter.x, boardCenter.y, 0];
|
|
33789
33890
|
}, [boardCenter]);
|
|
@@ -33793,7 +33894,7 @@ var CadViewerContainer = forwardRef2(
|
|
|
33793
33894
|
Canvas,
|
|
33794
33895
|
{
|
|
33795
33896
|
ref,
|
|
33796
|
-
scene: { up: new
|
|
33897
|
+
scene: { up: new THREE21.Vector3(0, 0, 1) },
|
|
33797
33898
|
camera: { up: [0, 0, 1], position: initialCameraPosition },
|
|
33798
33899
|
onCreated: ({ camera }) => {
|
|
33799
33900
|
mainCameraRef.current = camera;
|
|
@@ -33829,6 +33930,15 @@ var CadViewerContainer = forwardRef2(
|
|
|
33829
33930
|
shadowsEnabled: lightingEnabled
|
|
33830
33931
|
}
|
|
33831
33932
|
),
|
|
33933
|
+
gridEnabled && /* @__PURE__ */ jsx15(
|
|
33934
|
+
Grid,
|
|
33935
|
+
{
|
|
33936
|
+
rotation: [Math.PI / 2, 0, 0],
|
|
33937
|
+
infiniteGrid: true,
|
|
33938
|
+
cellSize: 3,
|
|
33939
|
+
sectionSize: gridSectionSize
|
|
33940
|
+
}
|
|
33941
|
+
),
|
|
33832
33942
|
children
|
|
33833
33943
|
]
|
|
33834
33944
|
}
|
|
@@ -33893,9 +34003,9 @@ var CadViewerContainer = forwardRef2(
|
|
|
33893
34003
|
|
|
33894
34004
|
// src/hooks/use-convert-children-to-soup.ts
|
|
33895
34005
|
import { Circuit } from "@tscircuit/core";
|
|
33896
|
-
import { useMemo as
|
|
34006
|
+
import { useMemo as useMemo16 } from "react";
|
|
33897
34007
|
var useConvertChildrenToCircuitJson = (children) => {
|
|
33898
|
-
return
|
|
34008
|
+
return useMemo16(() => {
|
|
33899
34009
|
if (!children) return [];
|
|
33900
34010
|
const circuit = new Circuit();
|
|
33901
34011
|
circuit.add(children);
|
|
@@ -33905,12 +34015,12 @@ var useConvertChildrenToCircuitJson = (children) => {
|
|
|
33905
34015
|
};
|
|
33906
34016
|
|
|
33907
34017
|
// src/hooks/use-stls-from-geom.ts
|
|
33908
|
-
import { useState as useState12, useEffect as
|
|
34018
|
+
import { useState as useState12, useEffect as useEffect20 } from "react";
|
|
33909
34019
|
import stlSerializer from "@jscad/stl-serializer";
|
|
33910
34020
|
var useStlsFromGeom = (geom) => {
|
|
33911
34021
|
const [stls, setStls] = useState12([]);
|
|
33912
34022
|
const [loading, setLoading] = useState12(true);
|
|
33913
|
-
|
|
34023
|
+
useEffect20(() => {
|
|
33914
34024
|
if (!geom) return;
|
|
33915
34025
|
const generateStls = async () => {
|
|
33916
34026
|
setLoading(true);
|
|
@@ -33939,7 +34049,7 @@ var useStlsFromGeom = (geom) => {
|
|
|
33939
34049
|
};
|
|
33940
34050
|
|
|
33941
34051
|
// src/hooks/useBoardGeomBuilder.ts
|
|
33942
|
-
import { useState as useState13, useEffect as
|
|
34052
|
+
import { useState as useState13, useEffect as useEffect21, useRef as useRef8 } from "react";
|
|
33943
34053
|
|
|
33944
34054
|
// src/soup-to-3d/index.ts
|
|
33945
34055
|
var import_primitives2 = __toESM(require_primitives(), 1);
|
|
@@ -35253,7 +35363,7 @@ var BoardGeomBuilder = class {
|
|
|
35253
35363
|
var useBoardGeomBuilder = (circuitJson) => {
|
|
35254
35364
|
const [boardGeom, setBoardGeom] = useState13(null);
|
|
35255
35365
|
const isProcessingRef = useRef8(false);
|
|
35256
|
-
|
|
35366
|
+
useEffect21(() => {
|
|
35257
35367
|
let isCancelled = false;
|
|
35258
35368
|
if (!circuitJson) {
|
|
35259
35369
|
setBoardGeom(null);
|
|
@@ -35299,10 +35409,10 @@ var useBoardGeomBuilder = (circuitJson) => {
|
|
|
35299
35409
|
};
|
|
35300
35410
|
|
|
35301
35411
|
// src/three-components/Error3d.tsx
|
|
35302
|
-
import { useState as useState14, useCallback as useCallback8, useEffect as
|
|
35412
|
+
import { useState as useState14, useCallback as useCallback8, useEffect as useEffect23, useMemo as useMemo18 } from "react";
|
|
35303
35413
|
|
|
35304
35414
|
// src/react-three/Text.tsx
|
|
35305
|
-
import { useEffect as
|
|
35415
|
+
import { useEffect as useEffect22, useMemo as useMemo17 } from "react";
|
|
35306
35416
|
import { Text as TroikaText2 } from "troika-three-text";
|
|
35307
35417
|
var Text = ({
|
|
35308
35418
|
children,
|
|
@@ -35317,7 +35427,7 @@ var Text = ({
|
|
|
35317
35427
|
depthOffset
|
|
35318
35428
|
}) => {
|
|
35319
35429
|
const { rootObject } = useThree();
|
|
35320
|
-
const mesh =
|
|
35430
|
+
const mesh = useMemo17(() => {
|
|
35321
35431
|
const textMesh = new TroikaText2();
|
|
35322
35432
|
textMesh.text = children;
|
|
35323
35433
|
if (position) textMesh.position.fromArray(position);
|
|
@@ -35342,7 +35452,7 @@ var Text = ({
|
|
|
35342
35452
|
anchorY,
|
|
35343
35453
|
depthOffset
|
|
35344
35454
|
]);
|
|
35345
|
-
|
|
35455
|
+
useEffect22(() => {
|
|
35346
35456
|
const parentObject = parent || rootObject;
|
|
35347
35457
|
if (!parentObject || !mesh) return;
|
|
35348
35458
|
parentObject.add(mesh);
|
|
@@ -35355,7 +35465,7 @@ var Text = ({
|
|
|
35355
35465
|
};
|
|
35356
35466
|
|
|
35357
35467
|
// src/three-components/Error3d.tsx
|
|
35358
|
-
import * as
|
|
35468
|
+
import * as THREE22 from "three";
|
|
35359
35469
|
import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
35360
35470
|
var Error3d = ({
|
|
35361
35471
|
error,
|
|
@@ -35377,7 +35487,7 @@ var Error3d = ({
|
|
|
35377
35487
|
setIsHovered(false);
|
|
35378
35488
|
setHoverPosition(null);
|
|
35379
35489
|
}, []);
|
|
35380
|
-
const position =
|
|
35490
|
+
const position = useMemo18(() => {
|
|
35381
35491
|
if (cad_component?.position) {
|
|
35382
35492
|
const p = [
|
|
35383
35493
|
cad_component.position.x,
|
|
@@ -35388,12 +35498,12 @@ var Error3d = ({
|
|
|
35388
35498
|
}
|
|
35389
35499
|
return [0, 0, 0];
|
|
35390
35500
|
}, [cad_component]);
|
|
35391
|
-
const group =
|
|
35392
|
-
const g = new
|
|
35501
|
+
const group = useMemo18(() => {
|
|
35502
|
+
const g = new THREE22.Group();
|
|
35393
35503
|
g.position.fromArray(position);
|
|
35394
35504
|
return g;
|
|
35395
35505
|
}, [position]);
|
|
35396
|
-
|
|
35506
|
+
useEffect23(() => {
|
|
35397
35507
|
if (!rootObject) return;
|
|
35398
35508
|
rootObject.add(group);
|
|
35399
35509
|
return () => {
|
|
@@ -35448,10 +35558,10 @@ var Error3d = ({
|
|
|
35448
35558
|
] });
|
|
35449
35559
|
};
|
|
35450
35560
|
var ErrorBox = ({ parent }) => {
|
|
35451
|
-
const mesh =
|
|
35452
|
-
const m = new
|
|
35453
|
-
new
|
|
35454
|
-
new
|
|
35561
|
+
const mesh = useMemo18(() => {
|
|
35562
|
+
const m = new THREE22.Mesh(
|
|
35563
|
+
new THREE22.BoxGeometry(0.5, 0.5, 0.5),
|
|
35564
|
+
new THREE22.MeshStandardMaterial({
|
|
35455
35565
|
depthTest: false,
|
|
35456
35566
|
transparent: true,
|
|
35457
35567
|
color: "red",
|
|
@@ -35462,7 +35572,7 @@ var ErrorBox = ({ parent }) => {
|
|
|
35462
35572
|
m.rotation.fromArray([Math.PI / 4, Math.PI / 4, 0]);
|
|
35463
35573
|
return m;
|
|
35464
35574
|
}, []);
|
|
35465
|
-
|
|
35575
|
+
useEffect23(() => {
|
|
35466
35576
|
parent.add(mesh);
|
|
35467
35577
|
return () => {
|
|
35468
35578
|
parent.remove(mesh);
|
|
@@ -35472,8 +35582,8 @@ var ErrorBox = ({ parent }) => {
|
|
|
35472
35582
|
};
|
|
35473
35583
|
|
|
35474
35584
|
// src/three-components/STLModel.tsx
|
|
35475
|
-
import { useState as useState15, useEffect as
|
|
35476
|
-
import * as
|
|
35585
|
+
import { useState as useState15, useEffect as useEffect24, useMemo as useMemo19 } from "react";
|
|
35586
|
+
import * as THREE23 from "three";
|
|
35477
35587
|
import { STLLoader } from "three-stdlib";
|
|
35478
35588
|
function STLModel({
|
|
35479
35589
|
stlUrl,
|
|
@@ -35485,7 +35595,7 @@ function STLModel({
|
|
|
35485
35595
|
}) {
|
|
35486
35596
|
const { rootObject } = useThree();
|
|
35487
35597
|
const [geom, setGeom] = useState15(null);
|
|
35488
|
-
|
|
35598
|
+
useEffect24(() => {
|
|
35489
35599
|
const loader = new STLLoader();
|
|
35490
35600
|
if (stlData) {
|
|
35491
35601
|
try {
|
|
@@ -35503,18 +35613,18 @@ function STLModel({
|
|
|
35503
35613
|
});
|
|
35504
35614
|
}
|
|
35505
35615
|
}, [stlUrl, stlData]);
|
|
35506
|
-
const mesh =
|
|
35616
|
+
const mesh = useMemo19(() => {
|
|
35507
35617
|
if (!geom) return null;
|
|
35508
35618
|
const isBoardLayer = layerType === "board";
|
|
35509
|
-
const material = new
|
|
35510
|
-
color: Array.isArray(color) ? new
|
|
35619
|
+
const material = new THREE23.MeshStandardMaterial({
|
|
35620
|
+
color: Array.isArray(color) ? new THREE23.Color(color[0], color[1], color[2]) : color,
|
|
35511
35621
|
transparent: opacity !== 1,
|
|
35512
35622
|
opacity,
|
|
35513
35623
|
polygonOffset: isBoardLayer,
|
|
35514
35624
|
polygonOffsetFactor: isBoardLayer ? 6 : 0,
|
|
35515
35625
|
polygonOffsetUnits: isBoardLayer ? 6 : 0
|
|
35516
35626
|
});
|
|
35517
|
-
const createdMesh = new
|
|
35627
|
+
const createdMesh = new THREE23.Mesh(geom, material);
|
|
35518
35628
|
createdMesh.renderOrder = isBoardLayer ? -1 : 1;
|
|
35519
35629
|
configureObjectShadows(createdMesh, {
|
|
35520
35630
|
castShadow: !isBoardLayer && opacity === 1,
|
|
@@ -35522,7 +35632,7 @@ function STLModel({
|
|
|
35522
35632
|
});
|
|
35523
35633
|
return createdMesh;
|
|
35524
35634
|
}, [geom, color, opacity, layerType]);
|
|
35525
|
-
|
|
35635
|
+
useEffect24(() => {
|
|
35526
35636
|
if (!rootObject || !mesh) return;
|
|
35527
35637
|
rootObject.add(mesh);
|
|
35528
35638
|
return () => {
|
|
@@ -35575,10 +35685,10 @@ function VisibleSTLModel({
|
|
|
35575
35685
|
|
|
35576
35686
|
// src/three-components/JscadBoardTextures.tsx
|
|
35577
35687
|
import { su as su8 } from "@tscircuit/circuit-json-util";
|
|
35578
|
-
import { useEffect as
|
|
35688
|
+
import { useEffect as useEffect25, useMemo as useMemo20 } from "react";
|
|
35579
35689
|
|
|
35580
35690
|
// src/textures/create-combined-board-textures.ts
|
|
35581
|
-
import * as
|
|
35691
|
+
import * as THREE35 from "three";
|
|
35582
35692
|
|
|
35583
35693
|
// node_modules/@tscircuit/math-utils/dist/chunk-5N7UJNVK.js
|
|
35584
35694
|
var getBoundsFromPoints = (points) => {
|
|
@@ -35633,7 +35743,7 @@ function calculateOutlineBounds(boardData) {
|
|
|
35633
35743
|
// src/utils/pad-texture.ts
|
|
35634
35744
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
35635
35745
|
import { CircuitToCanvasDrawer } from "circuit-to-canvas";
|
|
35636
|
-
import * as
|
|
35746
|
+
import * as THREE24 from "three";
|
|
35637
35747
|
function createPadTextureForLayer({
|
|
35638
35748
|
layer,
|
|
35639
35749
|
circuitJson,
|
|
@@ -35711,10 +35821,10 @@ function createPadTextureForLayer({
|
|
|
35711
35821
|
drawSoldermaskTop: false,
|
|
35712
35822
|
drawSoldermaskBottom: false
|
|
35713
35823
|
});
|
|
35714
|
-
const texture = new
|
|
35824
|
+
const texture = new THREE24.CanvasTexture(canvas);
|
|
35715
35825
|
texture.generateMipmaps = true;
|
|
35716
|
-
texture.minFilter =
|
|
35717
|
-
texture.magFilter =
|
|
35826
|
+
texture.minFilter = THREE24.LinearMipmapLinearFilter;
|
|
35827
|
+
texture.magFilter = THREE24.LinearFilter;
|
|
35718
35828
|
texture.anisotropy = 16;
|
|
35719
35829
|
texture.needsUpdate = true;
|
|
35720
35830
|
return texture;
|
|
@@ -35722,7 +35832,7 @@ function createPadTextureForLayer({
|
|
|
35722
35832
|
|
|
35723
35833
|
// src/utils/panel-outline-texture.ts
|
|
35724
35834
|
import { su as su6 } from "@tscircuit/circuit-json-util";
|
|
35725
|
-
import * as
|
|
35835
|
+
import * as THREE25 from "three";
|
|
35726
35836
|
var resolvePanelIdForTexture = (circuitJson) => {
|
|
35727
35837
|
const panels = circuitJson.filter(
|
|
35728
35838
|
(e) => e.type === "pcb_panel"
|
|
@@ -35790,17 +35900,17 @@ function createPanelOutlineTextureForLayer({
|
|
|
35790
35900
|
);
|
|
35791
35901
|
}
|
|
35792
35902
|
});
|
|
35793
|
-
const texture = new
|
|
35903
|
+
const texture = new THREE25.CanvasTexture(canvas);
|
|
35794
35904
|
texture.generateMipmaps = true;
|
|
35795
|
-
texture.minFilter =
|
|
35796
|
-
texture.magFilter =
|
|
35905
|
+
texture.minFilter = THREE25.LinearMipmapLinearFilter;
|
|
35906
|
+
texture.magFilter = THREE25.LinearFilter;
|
|
35797
35907
|
texture.anisotropy = 16;
|
|
35798
35908
|
texture.needsUpdate = true;
|
|
35799
35909
|
return texture;
|
|
35800
35910
|
}
|
|
35801
35911
|
|
|
35802
35912
|
// src/utils/trace-texture.ts
|
|
35803
|
-
import * as
|
|
35913
|
+
import * as THREE26 from "three";
|
|
35804
35914
|
import { CircuitToCanvasDrawer as CircuitToCanvasDrawer2 } from "circuit-to-canvas";
|
|
35805
35915
|
import { getElementRenderLayers, su as su7 } from "@tscircuit/circuit-json-util";
|
|
35806
35916
|
|
|
@@ -35918,10 +36028,10 @@ function createTraceTextureForLayer({
|
|
|
35918
36028
|
drawSoldermaskTop: false,
|
|
35919
36029
|
drawSoldermaskBottom: false
|
|
35920
36030
|
});
|
|
35921
|
-
const texture = new
|
|
36031
|
+
const texture = new THREE26.CanvasTexture(canvas);
|
|
35922
36032
|
texture.generateMipmaps = true;
|
|
35923
|
-
texture.minFilter =
|
|
35924
|
-
texture.magFilter =
|
|
36033
|
+
texture.minFilter = THREE26.LinearMipmapLinearFilter;
|
|
36034
|
+
texture.magFilter = THREE26.LinearFilter;
|
|
35925
36035
|
texture.anisotropy = 16;
|
|
35926
36036
|
texture.needsUpdate = true;
|
|
35927
36037
|
return texture;
|
|
@@ -35929,7 +36039,7 @@ function createTraceTextureForLayer({
|
|
|
35929
36039
|
|
|
35930
36040
|
// src/textures/create-copper-pour-texture-for-layer.ts
|
|
35931
36041
|
import { CircuitToCanvasDrawer as CircuitToCanvasDrawer3 } from "circuit-to-canvas";
|
|
35932
|
-
import * as
|
|
36042
|
+
import * as THREE27 from "three";
|
|
35933
36043
|
var toRgb = (colorArr) => {
|
|
35934
36044
|
const [r = 0, g = 0, b = 0] = colorArr;
|
|
35935
36045
|
return `rgb(${Math.round(r * 255)}, ${Math.round(g * 255)}, ${Math.round(
|
|
@@ -36051,17 +36161,17 @@ function createCopperPourTextureForLayer({
|
|
|
36051
36161
|
if (!onlyCoveredBySoldermask) {
|
|
36052
36162
|
setColorAndDraw(uncoveredPours, uncoveredColor);
|
|
36053
36163
|
}
|
|
36054
|
-
const texture = new
|
|
36164
|
+
const texture = new THREE27.CanvasTexture(canvas);
|
|
36055
36165
|
texture.generateMipmaps = true;
|
|
36056
|
-
texture.minFilter =
|
|
36057
|
-
texture.magFilter =
|
|
36166
|
+
texture.minFilter = THREE27.LinearMipmapLinearFilter;
|
|
36167
|
+
texture.magFilter = THREE27.LinearFilter;
|
|
36058
36168
|
texture.anisotropy = 16;
|
|
36059
36169
|
texture.needsUpdate = true;
|
|
36060
36170
|
return texture;
|
|
36061
36171
|
}
|
|
36062
36172
|
|
|
36063
36173
|
// src/textures/create-copper-text-texture-for-layer.ts
|
|
36064
|
-
import * as
|
|
36174
|
+
import * as THREE28 from "three";
|
|
36065
36175
|
|
|
36066
36176
|
// src/textures/copper-text/copper-text-drawing.ts
|
|
36067
36177
|
import { CircuitToCanvasDrawer as CircuitToCanvasDrawer4 } from "circuit-to-canvas";
|
|
@@ -36172,17 +36282,17 @@ function createCopperTextTextureForLayer({
|
|
|
36172
36282
|
elements,
|
|
36173
36283
|
copperColor
|
|
36174
36284
|
});
|
|
36175
|
-
const texture = new
|
|
36285
|
+
const texture = new THREE28.CanvasTexture(canvas);
|
|
36176
36286
|
texture.generateMipmaps = true;
|
|
36177
|
-
texture.minFilter =
|
|
36178
|
-
texture.magFilter =
|
|
36287
|
+
texture.minFilter = THREE28.LinearMipmapLinearFilter;
|
|
36288
|
+
texture.magFilter = THREE28.LinearFilter;
|
|
36179
36289
|
texture.anisotropy = 16;
|
|
36180
36290
|
texture.needsUpdate = true;
|
|
36181
36291
|
return texture;
|
|
36182
36292
|
}
|
|
36183
36293
|
|
|
36184
36294
|
// src/textures/create-fabrication-note-texture-for-layer.ts
|
|
36185
|
-
import * as
|
|
36295
|
+
import * as THREE29 from "three";
|
|
36186
36296
|
|
|
36187
36297
|
// src/textures/fabrication-note/fabrication-note-drawing.ts
|
|
36188
36298
|
import { CircuitToCanvasDrawer as CircuitToCanvasDrawer5 } from "circuit-to-canvas";
|
|
@@ -36410,17 +36520,17 @@ function createFabricationNoteTextureForLayer({
|
|
|
36410
36520
|
bounds,
|
|
36411
36521
|
elements
|
|
36412
36522
|
});
|
|
36413
|
-
const texture = new
|
|
36523
|
+
const texture = new THREE29.CanvasTexture(canvas);
|
|
36414
36524
|
texture.generateMipmaps = true;
|
|
36415
|
-
texture.minFilter =
|
|
36416
|
-
texture.magFilter =
|
|
36525
|
+
texture.minFilter = THREE29.LinearMipmapLinearFilter;
|
|
36526
|
+
texture.magFilter = THREE29.LinearFilter;
|
|
36417
36527
|
texture.anisotropy = 16;
|
|
36418
36528
|
texture.needsUpdate = true;
|
|
36419
36529
|
return texture;
|
|
36420
36530
|
}
|
|
36421
36531
|
|
|
36422
36532
|
// src/textures/create-keepout-texture-for-layer.ts
|
|
36423
|
-
import * as
|
|
36533
|
+
import * as THREE30 from "three";
|
|
36424
36534
|
|
|
36425
36535
|
// src/textures/keepout/keepout-drawing.ts
|
|
36426
36536
|
import { CircuitToCanvasDrawer as CircuitToCanvasDrawer6 } from "circuit-to-canvas";
|
|
@@ -36495,17 +36605,17 @@ function createKeepoutTextureForLayer({
|
|
|
36495
36605
|
elements,
|
|
36496
36606
|
keepoutColor
|
|
36497
36607
|
});
|
|
36498
|
-
const texture = new
|
|
36608
|
+
const texture = new THREE30.CanvasTexture(canvas);
|
|
36499
36609
|
texture.generateMipmaps = true;
|
|
36500
|
-
texture.minFilter =
|
|
36501
|
-
texture.magFilter =
|
|
36610
|
+
texture.minFilter = THREE30.LinearMipmapLinearFilter;
|
|
36611
|
+
texture.magFilter = THREE30.LinearFilter;
|
|
36502
36612
|
texture.anisotropy = 16;
|
|
36503
36613
|
texture.needsUpdate = true;
|
|
36504
36614
|
return texture;
|
|
36505
36615
|
}
|
|
36506
36616
|
|
|
36507
36617
|
// src/textures/create-pcb-note-texture-for-layer.ts
|
|
36508
|
-
import * as
|
|
36618
|
+
import * as THREE31 from "three";
|
|
36509
36619
|
|
|
36510
36620
|
// src/textures/pcb-note/pcb-note-drawing.ts
|
|
36511
36621
|
import { CircuitToCanvasDrawer as CircuitToCanvasDrawer7 } from "circuit-to-canvas";
|
|
@@ -36656,17 +36766,17 @@ function createPcbNoteTextureForLayer({
|
|
|
36656
36766
|
bounds,
|
|
36657
36767
|
elements
|
|
36658
36768
|
});
|
|
36659
|
-
const texture = new
|
|
36769
|
+
const texture = new THREE31.CanvasTexture(canvas);
|
|
36660
36770
|
texture.generateMipmaps = true;
|
|
36661
|
-
texture.minFilter =
|
|
36662
|
-
texture.magFilter =
|
|
36771
|
+
texture.minFilter = THREE31.LinearMipmapLinearFilter;
|
|
36772
|
+
texture.magFilter = THREE31.LinearFilter;
|
|
36663
36773
|
texture.anisotropy = 16;
|
|
36664
36774
|
texture.needsUpdate = true;
|
|
36665
36775
|
return texture;
|
|
36666
36776
|
}
|
|
36667
36777
|
|
|
36668
36778
|
// src/textures/create-silkscreen-texture-for-layer.ts
|
|
36669
|
-
import * as
|
|
36779
|
+
import * as THREE32 from "three";
|
|
36670
36780
|
|
|
36671
36781
|
// src/textures/silkscreen/silkscreen-drawing.ts
|
|
36672
36782
|
import { CircuitToCanvasDrawer as CircuitToCanvasDrawer8 } from "circuit-to-canvas";
|
|
@@ -36775,17 +36885,17 @@ function createSilkscreenTextureForLayer({
|
|
|
36775
36885
|
elements,
|
|
36776
36886
|
silkscreenColor
|
|
36777
36887
|
});
|
|
36778
|
-
const texture = new
|
|
36888
|
+
const texture = new THREE32.CanvasTexture(canvas);
|
|
36779
36889
|
texture.generateMipmaps = true;
|
|
36780
|
-
texture.minFilter =
|
|
36781
|
-
texture.magFilter =
|
|
36890
|
+
texture.minFilter = THREE32.LinearMipmapLinearFilter;
|
|
36891
|
+
texture.magFilter = THREE32.LinearFilter;
|
|
36782
36892
|
texture.anisotropy = 16;
|
|
36783
36893
|
texture.needsUpdate = true;
|
|
36784
36894
|
return texture;
|
|
36785
36895
|
}
|
|
36786
36896
|
|
|
36787
36897
|
// src/textures/create-soldermask-texture-for-layer.ts
|
|
36788
|
-
import * as
|
|
36898
|
+
import * as THREE33 from "three";
|
|
36789
36899
|
|
|
36790
36900
|
// src/textures/soldermask/soldermask-drawing.ts
|
|
36791
36901
|
import { CircuitToCanvasDrawer as CircuitToCanvasDrawer9 } from "circuit-to-canvas";
|
|
@@ -36920,17 +37030,17 @@ function createSoldermaskTextureForLayer({
|
|
|
36920
37030
|
elements,
|
|
36921
37031
|
boardMaterial: boardData.material
|
|
36922
37032
|
});
|
|
36923
|
-
const texture = new
|
|
37033
|
+
const texture = new THREE33.CanvasTexture(canvas);
|
|
36924
37034
|
texture.generateMipmaps = true;
|
|
36925
|
-
texture.minFilter =
|
|
36926
|
-
texture.magFilter =
|
|
37035
|
+
texture.minFilter = THREE33.LinearMipmapLinearFilter;
|
|
37036
|
+
texture.magFilter = THREE33.LinearFilter;
|
|
36927
37037
|
texture.anisotropy = 16;
|
|
36928
37038
|
texture.needsUpdate = true;
|
|
36929
37039
|
return texture;
|
|
36930
37040
|
}
|
|
36931
37041
|
|
|
36932
37042
|
// src/textures/create-through-hole-texture-for-layer.ts
|
|
36933
|
-
import * as
|
|
37043
|
+
import * as THREE34 from "three";
|
|
36934
37044
|
|
|
36935
37045
|
// src/textures/through-hole/through-hole-drawing.ts
|
|
36936
37046
|
import { CircuitToCanvasDrawer as CircuitToCanvasDrawer10 } from "circuit-to-canvas";
|
|
@@ -37023,10 +37133,10 @@ function createThroughHoleTextureForLayer({
|
|
|
37023
37133
|
elements,
|
|
37024
37134
|
copperColor
|
|
37025
37135
|
});
|
|
37026
|
-
const texture = new
|
|
37136
|
+
const texture = new THREE34.CanvasTexture(canvas);
|
|
37027
37137
|
texture.generateMipmaps = true;
|
|
37028
|
-
texture.minFilter =
|
|
37029
|
-
texture.magFilter =
|
|
37138
|
+
texture.minFilter = THREE34.LinearMipmapLinearFilter;
|
|
37139
|
+
texture.magFilter = THREE34.LinearFilter;
|
|
37030
37140
|
texture.anisotropy = 16;
|
|
37031
37141
|
texture.needsUpdate = true;
|
|
37032
37142
|
return texture;
|
|
@@ -37114,10 +37224,10 @@ var createCombinedTexture = ({
|
|
|
37114
37224
|
applySoldermaskSurfaceFilter(ctx, canvasWidth, canvasHeight, {
|
|
37115
37225
|
includeReflection: layer === "top"
|
|
37116
37226
|
});
|
|
37117
|
-
const combinedTexture = new
|
|
37227
|
+
const combinedTexture = new THREE35.CanvasTexture(canvas);
|
|
37118
37228
|
combinedTexture.generateMipmaps = false;
|
|
37119
|
-
combinedTexture.minFilter =
|
|
37120
|
-
combinedTexture.magFilter =
|
|
37229
|
+
combinedTexture.minFilter = THREE35.LinearFilter;
|
|
37230
|
+
combinedTexture.magFilter = THREE35.LinearFilter;
|
|
37121
37231
|
combinedTexture.premultiplyAlpha = true;
|
|
37122
37232
|
combinedTexture.anisotropy = 16;
|
|
37123
37233
|
combinedTexture.needsUpdate = true;
|
|
@@ -37142,11 +37252,11 @@ var createMaskedCopperMask = ({
|
|
|
37142
37252
|
if (!texture?.image) continue;
|
|
37143
37253
|
ctx.drawImage(texture.image, 0, 0, width10, height10);
|
|
37144
37254
|
}
|
|
37145
|
-
const maskTexture = new
|
|
37146
|
-
maskTexture.colorSpace =
|
|
37255
|
+
const maskTexture = new THREE35.CanvasTexture(canvas);
|
|
37256
|
+
maskTexture.colorSpace = THREE35.NoColorSpace;
|
|
37147
37257
|
maskTexture.generateMipmaps = false;
|
|
37148
|
-
maskTexture.minFilter =
|
|
37149
|
-
maskTexture.magFilter =
|
|
37258
|
+
maskTexture.minFilter = THREE35.LinearFilter;
|
|
37259
|
+
maskTexture.magFilter = THREE35.LinearFilter;
|
|
37150
37260
|
maskTexture.premultiplyAlpha = false;
|
|
37151
37261
|
maskTexture.needsUpdate = true;
|
|
37152
37262
|
return maskTexture;
|
|
@@ -37284,7 +37394,7 @@ function createCombinedBoardTextures({
|
|
|
37284
37394
|
}
|
|
37285
37395
|
|
|
37286
37396
|
// src/textures/create-three-texture-meshes.ts
|
|
37287
|
-
import * as
|
|
37397
|
+
import * as THREE37 from "three";
|
|
37288
37398
|
|
|
37289
37399
|
// src/board-surface-textures.ts
|
|
37290
37400
|
var REALISTIC_BOARD_SURFACE_MATERIAL = {
|
|
@@ -37307,7 +37417,7 @@ var PAD_COPPER_TEXTURE_MATERIAL = {
|
|
|
37307
37417
|
};
|
|
37308
37418
|
|
|
37309
37419
|
// src/utils/create-board-relief-textures.ts
|
|
37310
|
-
import * as
|
|
37420
|
+
import * as THREE36 from "three";
|
|
37311
37421
|
var PLAIN_SOLDERMASK_HEIGHT = 0.22;
|
|
37312
37422
|
var MASKED_COPPER_HEIGHT = 0.7;
|
|
37313
37423
|
var EXPOSED_COPPER_HEIGHT = 0.86;
|
|
@@ -37396,13 +37506,13 @@ var getBoardSurfaceProfile = (r, g, b, hasMaskedCopper) => {
|
|
|
37396
37506
|
};
|
|
37397
37507
|
};
|
|
37398
37508
|
var createDataTexture = (canvas) => {
|
|
37399
|
-
const texture = new
|
|
37400
|
-
texture.colorSpace =
|
|
37509
|
+
const texture = new THREE36.CanvasTexture(canvas);
|
|
37510
|
+
texture.colorSpace = THREE36.NoColorSpace;
|
|
37401
37511
|
texture.generateMipmaps = false;
|
|
37402
|
-
texture.minFilter =
|
|
37403
|
-
texture.magFilter =
|
|
37404
|
-
texture.wrapS =
|
|
37405
|
-
texture.wrapT =
|
|
37512
|
+
texture.minFilter = THREE36.LinearFilter;
|
|
37513
|
+
texture.magFilter = THREE36.LinearFilter;
|
|
37514
|
+
texture.wrapS = THREE36.ClampToEdgeWrapping;
|
|
37515
|
+
texture.wrapT = THREE36.ClampToEdgeWrapping;
|
|
37406
37516
|
texture.needsUpdate = true;
|
|
37407
37517
|
return texture;
|
|
37408
37518
|
};
|
|
@@ -37509,7 +37619,7 @@ var createBoardReliefTextures = (texture, maskedCopperMask) => {
|
|
|
37509
37619
|
for (let x = 0; x < sourceCanvas.width; x++) {
|
|
37510
37620
|
const dx = (getHeight4(x + 1, y) - getHeight4(x - 1, y)) * 4;
|
|
37511
37621
|
const dy = (getHeight4(x, y + 1) - getHeight4(x, y - 1)) * 4;
|
|
37512
|
-
const normal = new
|
|
37622
|
+
const normal = new THREE36.Vector3(-dx, -dy, 1).normalize();
|
|
37513
37623
|
const i = (y * sourceCanvas.width + x) * 4;
|
|
37514
37624
|
normalData[i] = (normal.x * 0.5 + 0.5) * 255;
|
|
37515
37625
|
normalData[i + 1] = (normal.y * 0.5 + 0.5) * 255;
|
|
@@ -37539,16 +37649,16 @@ function createTexturePlane(config, boardData) {
|
|
|
37539
37649
|
} = config;
|
|
37540
37650
|
if (!texture) return null;
|
|
37541
37651
|
const boardOutlineBounds = calculateOutlineBounds(boardData);
|
|
37542
|
-
const planeGeom = new
|
|
37652
|
+
const planeGeom = new THREE37.PlaneGeometry(
|
|
37543
37653
|
boardOutlineBounds.width,
|
|
37544
37654
|
boardOutlineBounds.height
|
|
37545
37655
|
);
|
|
37546
|
-
texture.colorSpace =
|
|
37656
|
+
texture.colorSpace = THREE37.SRGBColorSpace;
|
|
37547
37657
|
const sharedMaterialOptions = {
|
|
37548
37658
|
map: texture,
|
|
37549
37659
|
transparent: true,
|
|
37550
37660
|
alphaTest: 0.08,
|
|
37551
|
-
side:
|
|
37661
|
+
side: THREE37.FrontSide,
|
|
37552
37662
|
depthWrite: true,
|
|
37553
37663
|
polygonOffset: usePolygonOffset,
|
|
37554
37664
|
polygonOffsetFactor: usePolygonOffset ? -4 : 0,
|
|
@@ -37557,12 +37667,12 @@ function createTexturePlane(config, boardData) {
|
|
|
37557
37667
|
opacity: isFaux ? FAUX_BOARD_OPACITY : 1
|
|
37558
37668
|
};
|
|
37559
37669
|
const reliefTextures = createBoardReliefTextures(texture, maskedCopperMask);
|
|
37560
|
-
const material = new
|
|
37670
|
+
const material = new THREE37.MeshPhysicalMaterial({
|
|
37561
37671
|
...sharedMaterialOptions,
|
|
37562
37672
|
bumpMap: reliefTextures?.bumpMap ?? null,
|
|
37563
37673
|
bumpScale: REALISTIC_BOARD_SURFACE_MATERIAL.bumpScale,
|
|
37564
37674
|
normalMap: reliefTextures?.normalMap ?? null,
|
|
37565
|
-
normalScale: new
|
|
37675
|
+
normalScale: new THREE37.Vector2(
|
|
37566
37676
|
REALISTIC_BOARD_SURFACE_MATERIAL.normalScale,
|
|
37567
37677
|
REALISTIC_BOARD_SURFACE_MATERIAL.normalScale
|
|
37568
37678
|
),
|
|
@@ -37576,7 +37686,7 @@ function createTexturePlane(config, boardData) {
|
|
|
37576
37686
|
clearcoatRoughness: REALISTIC_BOARD_SURFACE_MATERIAL.clearcoatRoughness,
|
|
37577
37687
|
envMapIntensity: 0.18
|
|
37578
37688
|
});
|
|
37579
|
-
const mesh = new
|
|
37689
|
+
const mesh = new THREE37.Mesh(planeGeom, material);
|
|
37580
37690
|
mesh.position.set(
|
|
37581
37691
|
boardOutlineBounds.centerX,
|
|
37582
37692
|
boardOutlineBounds.centerY,
|
|
@@ -37624,7 +37734,7 @@ function createTextureMeshes(textures, boardData, pcbThickness, isFaux = false)
|
|
|
37624
37734
|
}
|
|
37625
37735
|
|
|
37626
37736
|
// src/three-components/JscadBoardTextures.tsx
|
|
37627
|
-
import * as
|
|
37737
|
+
import * as THREE38 from "three";
|
|
37628
37738
|
|
|
37629
37739
|
// src/utils/layer-texture-resolution.ts
|
|
37630
37740
|
var DEFAULT_MAX_TEXTURE_PIXELS = 4e6;
|
|
@@ -37661,7 +37771,7 @@ function JscadBoardTextures({
|
|
|
37661
37771
|
}) {
|
|
37662
37772
|
const { rootObject } = useThree();
|
|
37663
37773
|
const { visibility } = useLayerVisibility();
|
|
37664
|
-
const boardData =
|
|
37774
|
+
const boardData = useMemo20(() => {
|
|
37665
37775
|
const panels = circuitJson.filter(
|
|
37666
37776
|
(e) => e.type === "pcb_panel"
|
|
37667
37777
|
);
|
|
@@ -37687,11 +37797,11 @@ function JscadBoardTextures({
|
|
|
37687
37797
|
);
|
|
37688
37798
|
return boardsNotInPanel.length > 0 ? boardsNotInPanel[0] : null;
|
|
37689
37799
|
}, [circuitJson]);
|
|
37690
|
-
const traceTextureResolution =
|
|
37800
|
+
const traceTextureResolution = useMemo20(() => {
|
|
37691
37801
|
if (!boardData) return TRACE_TEXTURE_RESOLUTION;
|
|
37692
37802
|
return getLayerTextureResolution(boardData, TRACE_TEXTURE_RESOLUTION);
|
|
37693
37803
|
}, [boardData]);
|
|
37694
|
-
const textures =
|
|
37804
|
+
const textures = useMemo20(() => {
|
|
37695
37805
|
if (!boardData?.width || !boardData.height) return null;
|
|
37696
37806
|
return createCombinedBoardTextures({
|
|
37697
37807
|
circuitJson,
|
|
@@ -37700,7 +37810,7 @@ function JscadBoardTextures({
|
|
|
37700
37810
|
visibility
|
|
37701
37811
|
});
|
|
37702
37812
|
}, [circuitJson, boardData, traceTextureResolution, visibility]);
|
|
37703
|
-
|
|
37813
|
+
useEffect25(() => {
|
|
37704
37814
|
if (!rootObject || !boardData || !textures) return;
|
|
37705
37815
|
const meshes = [];
|
|
37706
37816
|
const disposeTextureMaterial = (material) => {
|
|
@@ -37720,7 +37830,7 @@ function JscadBoardTextures({
|
|
|
37720
37830
|
const typedMaterial = material;
|
|
37721
37831
|
for (const prop of textureProps) {
|
|
37722
37832
|
const texture = typedMaterial[prop];
|
|
37723
|
-
if (texture && texture instanceof
|
|
37833
|
+
if (texture && texture instanceof THREE38.Texture) {
|
|
37724
37834
|
texture.dispose();
|
|
37725
37835
|
typedMaterial[prop] = null;
|
|
37726
37836
|
}
|
|
@@ -37739,16 +37849,16 @@ function JscadBoardTextures({
|
|
|
37739
37849
|
}) => {
|
|
37740
37850
|
if (!texture) return null;
|
|
37741
37851
|
const boardOutlineBounds = calculateOutlineBounds(boardData);
|
|
37742
|
-
const planeGeom = new
|
|
37852
|
+
const planeGeom = new THREE38.PlaneGeometry(
|
|
37743
37853
|
boardOutlineBounds.width,
|
|
37744
37854
|
boardOutlineBounds.height
|
|
37745
37855
|
);
|
|
37746
|
-
texture.colorSpace =
|
|
37856
|
+
texture.colorSpace = THREE38.SRGBColorSpace;
|
|
37747
37857
|
const sharedMaterialOptions = {
|
|
37748
37858
|
map: texture,
|
|
37749
37859
|
transparent: true,
|
|
37750
37860
|
alphaTest: 0.08,
|
|
37751
|
-
side:
|
|
37861
|
+
side: THREE38.FrontSide,
|
|
37752
37862
|
depthWrite,
|
|
37753
37863
|
polygonOffset: usePolygonOffset,
|
|
37754
37864
|
polygonOffsetFactor: usePolygonOffset ? -4 : 0,
|
|
@@ -37759,12 +37869,12 @@ function JscadBoardTextures({
|
|
|
37759
37869
|
texture,
|
|
37760
37870
|
maskedCopperMask
|
|
37761
37871
|
);
|
|
37762
|
-
const material = new
|
|
37872
|
+
const material = new THREE38.MeshPhysicalMaterial({
|
|
37763
37873
|
...sharedMaterialOptions,
|
|
37764
37874
|
bumpMap: reliefTextures?.bumpMap ?? null,
|
|
37765
37875
|
bumpScale: REALISTIC_BOARD_SURFACE_MATERIAL.bumpScale,
|
|
37766
37876
|
normalMap: reliefTextures?.normalMap ?? null,
|
|
37767
|
-
normalScale: new
|
|
37877
|
+
normalScale: new THREE38.Vector2(
|
|
37768
37878
|
REALISTIC_BOARD_SURFACE_MATERIAL.normalScale,
|
|
37769
37879
|
REALISTIC_BOARD_SURFACE_MATERIAL.normalScale
|
|
37770
37880
|
),
|
|
@@ -37776,7 +37886,7 @@ function JscadBoardTextures({
|
|
|
37776
37886
|
clearcoatRoughness: REALISTIC_BOARD_SURFACE_MATERIAL.clearcoatRoughness,
|
|
37777
37887
|
envMapIntensity: 0.18
|
|
37778
37888
|
});
|
|
37779
|
-
const mesh = new
|
|
37889
|
+
const mesh = new THREE38.Mesh(planeGeom, material);
|
|
37780
37890
|
mesh.position.set(
|
|
37781
37891
|
boardOutlineBounds.centerX,
|
|
37782
37892
|
boardOutlineBounds.centerY,
|
|
@@ -37826,7 +37936,7 @@ function JscadBoardTextures({
|
|
|
37826
37936
|
for (const material of mesh.material) {
|
|
37827
37937
|
disposeTextureMaterial(material);
|
|
37828
37938
|
}
|
|
37829
|
-
} else if (mesh.material instanceof
|
|
37939
|
+
} else if (mesh.material instanceof THREE38.Material) {
|
|
37830
37940
|
disposeTextureMaterial(mesh.material);
|
|
37831
37941
|
}
|
|
37832
37942
|
}
|
|
@@ -37938,13 +38048,13 @@ var CadViewerJscad = forwardRef3(
|
|
|
37938
38048
|
resolveStaticAsset
|
|
37939
38049
|
}, ref) => {
|
|
37940
38050
|
const childrenSoup = useConvertChildrenToCircuitJson(children);
|
|
37941
|
-
const internalCircuitJson =
|
|
38051
|
+
const internalCircuitJson = useMemo21(() => {
|
|
37942
38052
|
return addFauxBoardIfNeeded(
|
|
37943
38053
|
circuitJson ?? childrenSoup
|
|
37944
38054
|
);
|
|
37945
38055
|
}, [circuitJson, childrenSoup]);
|
|
37946
38056
|
const boardGeom = useBoardGeomBuilder(internalCircuitJson);
|
|
37947
|
-
const initialCameraPosition =
|
|
38057
|
+
const initialCameraPosition = useMemo21(() => {
|
|
37948
38058
|
if (!internalCircuitJson) return [5, -5, 5];
|
|
37949
38059
|
try {
|
|
37950
38060
|
const board = su11(internalCircuitJson).pcb_board.list()[0];
|
|
@@ -37970,7 +38080,7 @@ var CadViewerJscad = forwardRef3(
|
|
|
37970
38080
|
return [5, -5, 5];
|
|
37971
38081
|
}
|
|
37972
38082
|
}, [internalCircuitJson]);
|
|
37973
|
-
const isFauxBoard =
|
|
38083
|
+
const isFauxBoard = useMemo21(() => {
|
|
37974
38084
|
if (!internalCircuitJson) return false;
|
|
37975
38085
|
try {
|
|
37976
38086
|
const board = su11(internalCircuitJson).pcb_board.list()[0];
|
|
@@ -37979,7 +38089,7 @@ var CadViewerJscad = forwardRef3(
|
|
|
37979
38089
|
return false;
|
|
37980
38090
|
}
|
|
37981
38091
|
}, [internalCircuitJson]);
|
|
37982
|
-
const boardDimensions =
|
|
38092
|
+
const boardDimensions = useMemo21(() => {
|
|
37983
38093
|
if (!internalCircuitJson) return void 0;
|
|
37984
38094
|
try {
|
|
37985
38095
|
const board = su11(internalCircuitJson).pcb_board.list()[0];
|
|
@@ -37990,7 +38100,7 @@ var CadViewerJscad = forwardRef3(
|
|
|
37990
38100
|
return void 0;
|
|
37991
38101
|
}
|
|
37992
38102
|
}, [internalCircuitJson]);
|
|
37993
|
-
const boardCenter =
|
|
38103
|
+
const boardCenter = useMemo21(() => {
|
|
37994
38104
|
if (!internalCircuitJson) return void 0;
|
|
37995
38105
|
try {
|
|
37996
38106
|
const board = su11(internalCircuitJson).pcb_board.list()[0];
|
|
@@ -38058,13 +38168,13 @@ var CadViewerJscad = forwardRef3(
|
|
|
38058
38168
|
|
|
38059
38169
|
// src/CadViewerManifold.tsx
|
|
38060
38170
|
import { su as su17 } from "@tscircuit/circuit-json-util";
|
|
38061
|
-
import { useEffect as
|
|
38062
|
-
import * as
|
|
38171
|
+
import { useEffect as useEffect27, useMemo as useMemo23, useState as useState17 } from "react";
|
|
38172
|
+
import * as THREE45 from "three";
|
|
38063
38173
|
|
|
38064
38174
|
// src/hooks/useManifoldBoardBuilder.ts
|
|
38065
38175
|
import { su as su16 } from "@tscircuit/circuit-json-util";
|
|
38066
|
-
import { useEffect as
|
|
38067
|
-
import * as
|
|
38176
|
+
import { useEffect as useEffect26, useMemo as useMemo22, useRef as useRef9, useState as useState16 } from "react";
|
|
38177
|
+
import * as THREE42 from "three";
|
|
38068
38178
|
|
|
38069
38179
|
// src/utils/manifold/create-manifold-board.ts
|
|
38070
38180
|
var arePointsClockwise2 = (points) => {
|
|
@@ -38413,17 +38523,17 @@ function processNonPlatedHolesForManifold(Manifold, CrossSection, circuitJson, p
|
|
|
38413
38523
|
|
|
38414
38524
|
// src/utils/manifold/process-plated-holes.ts
|
|
38415
38525
|
import { su as su14 } from "@tscircuit/circuit-json-util";
|
|
38416
|
-
import * as
|
|
38526
|
+
import * as THREE40 from "three";
|
|
38417
38527
|
|
|
38418
38528
|
// src/utils/manifold-mesh-to-three-geometry.ts
|
|
38419
|
-
import * as
|
|
38529
|
+
import * as THREE39 from "three";
|
|
38420
38530
|
function manifoldMeshToThreeGeometry(manifoldMesh) {
|
|
38421
|
-
const geometry = new
|
|
38531
|
+
const geometry = new THREE39.BufferGeometry();
|
|
38422
38532
|
geometry.setAttribute(
|
|
38423
38533
|
"position",
|
|
38424
|
-
new
|
|
38534
|
+
new THREE39.Float32BufferAttribute(manifoldMesh.vertProperties, 3)
|
|
38425
38535
|
);
|
|
38426
|
-
geometry.setIndex(new
|
|
38536
|
+
geometry.setIndex(new THREE39.Uint32BufferAttribute(manifoldMesh.triVerts, 1));
|
|
38427
38537
|
if (manifoldMesh.runIndex && manifoldMesh.runIndex.length > 1 && manifoldMesh.runOriginalID) {
|
|
38428
38538
|
for (let i = 0; i < manifoldMesh.runIndex.length - 1; i++) {
|
|
38429
38539
|
const start = manifoldMesh.runIndex[i];
|
|
@@ -38457,7 +38567,7 @@ var createEllipsePoints = (width10, height10, segments) => {
|
|
|
38457
38567
|
}
|
|
38458
38568
|
return points;
|
|
38459
38569
|
};
|
|
38460
|
-
var COPPER_COLOR = new
|
|
38570
|
+
var COPPER_COLOR = new THREE40.Color(...colors.copper);
|
|
38461
38571
|
var PLATED_HOLE_LIP_HEIGHT = 0.05;
|
|
38462
38572
|
var PLATED_HOLE_PAD_THICKNESS = 3e-3;
|
|
38463
38573
|
var PLATED_HOLE_SURFACE_CLEARANCE = 5e-4;
|
|
@@ -39088,7 +39198,7 @@ function processPlatedHolesForManifold(Manifold, CrossSection, circuitJson, pcbT
|
|
|
39088
39198
|
|
|
39089
39199
|
// src/utils/manifold/process-vias.ts
|
|
39090
39200
|
import { su as su15 } from "@tscircuit/circuit-json-util";
|
|
39091
|
-
import * as
|
|
39201
|
+
import * as THREE41 from "three";
|
|
39092
39202
|
|
|
39093
39203
|
// src/utils/via-geoms.ts
|
|
39094
39204
|
function createViaCopper2({
|
|
@@ -39126,7 +39236,7 @@ function createViaCopper2({
|
|
|
39126
39236
|
}
|
|
39127
39237
|
|
|
39128
39238
|
// src/utils/manifold/process-vias.ts
|
|
39129
|
-
var COPPER_COLOR2 = new
|
|
39239
|
+
var COPPER_COLOR2 = new THREE41.Color(...colors.copper);
|
|
39130
39240
|
function processViasForManifold(Manifold, circuitJson, pcbThickness, manifoldInstancesForCleanup, boardClipVolume) {
|
|
39131
39241
|
const viaBoardDrills = [];
|
|
39132
39242
|
const pcbVias = su15(circuitJson).pcb_via.list();
|
|
@@ -39184,7 +39294,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
|
|
|
39184
39294
|
const [error, setError] = useState16(null);
|
|
39185
39295
|
const [isLoading, setIsLoading] = useState16(true);
|
|
39186
39296
|
const manifoldInstancesForCleanup = useRef9([]);
|
|
39187
|
-
const boardData =
|
|
39297
|
+
const boardData = useMemo22(() => {
|
|
39188
39298
|
const panels = circuitJson.filter(
|
|
39189
39299
|
(e) => e.type === "pcb_panel"
|
|
39190
39300
|
);
|
|
@@ -39208,15 +39318,15 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
|
|
|
39208
39318
|
const boardsNotInPanel = boards.filter((b) => !b.pcb_panel_id);
|
|
39209
39319
|
return boardsNotInPanel.length > 0 ? boardsNotInPanel[0] : null;
|
|
39210
39320
|
}, [circuitJson]);
|
|
39211
|
-
const isFauxBoard =
|
|
39321
|
+
const isFauxBoard = useMemo22(() => {
|
|
39212
39322
|
const boards = su16(circuitJson).pcb_board.list();
|
|
39213
39323
|
return boards.length > 0 && boards[0].pcb_board_id === "faux-board";
|
|
39214
39324
|
}, [circuitJson]);
|
|
39215
|
-
const traceTextureResolution =
|
|
39325
|
+
const traceTextureResolution = useMemo22(() => {
|
|
39216
39326
|
if (!boardData) return TRACE_TEXTURE_RESOLUTION;
|
|
39217
39327
|
return getLayerTextureResolution(boardData, TRACE_TEXTURE_RESOLUTION);
|
|
39218
39328
|
}, [boardData]);
|
|
39219
|
-
|
|
39329
|
+
useEffect26(() => {
|
|
39220
39330
|
if (!manifoldJSModule || !boardData) {
|
|
39221
39331
|
setGeoms(null);
|
|
39222
39332
|
setPcbThickness(null);
|
|
@@ -39346,7 +39456,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
|
|
|
39346
39456
|
{
|
|
39347
39457
|
key: "plated-holes-union",
|
|
39348
39458
|
geometry: cutPlatedGeom,
|
|
39349
|
-
color: new
|
|
39459
|
+
color: new THREE42.Color(
|
|
39350
39460
|
colors.copper[0],
|
|
39351
39461
|
colors.copper[1],
|
|
39352
39462
|
colors.copper[2]
|
|
@@ -39376,7 +39486,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
|
|
|
39376
39486
|
const matColorArray = boardMaterialColors[boardData.material] ?? colors.fr4Tan;
|
|
39377
39487
|
currentGeoms.board = {
|
|
39378
39488
|
geometry: finalBoardGeom,
|
|
39379
|
-
color: new
|
|
39489
|
+
color: new THREE42.Color(
|
|
39380
39490
|
matColorArray[0],
|
|
39381
39491
|
matColorArray[1],
|
|
39382
39492
|
matColorArray[2]
|
|
@@ -39400,7 +39510,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
|
|
|
39400
39510
|
manifoldInstancesForCleanup.current = [];
|
|
39401
39511
|
};
|
|
39402
39512
|
}, [manifoldJSModule, circuitJson, boardData]);
|
|
39403
|
-
const textures =
|
|
39513
|
+
const textures = useMemo22(() => {
|
|
39404
39514
|
if (!boardData || !traceTextureResolution) return null;
|
|
39405
39515
|
return createCombinedBoardTextures({
|
|
39406
39516
|
circuitJson,
|
|
@@ -39421,11 +39531,11 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
|
|
|
39421
39531
|
};
|
|
39422
39532
|
|
|
39423
39533
|
// src/utils/manifold/create-three-geometry-meshes.ts
|
|
39424
|
-
import * as
|
|
39534
|
+
import * as THREE44 from "three";
|
|
39425
39535
|
|
|
39426
39536
|
// src/utils/create-board-material.ts
|
|
39427
|
-
import * as
|
|
39428
|
-
var DEFAULT_SIDE =
|
|
39537
|
+
import * as THREE43 from "three";
|
|
39538
|
+
var DEFAULT_SIDE = THREE43.DoubleSide;
|
|
39429
39539
|
var createBoardMaterial = ({
|
|
39430
39540
|
material,
|
|
39431
39541
|
color,
|
|
@@ -39433,7 +39543,7 @@ var createBoardMaterial = ({
|
|
|
39433
39543
|
isFaux = false
|
|
39434
39544
|
}) => {
|
|
39435
39545
|
if (material === "fr4") {
|
|
39436
|
-
return new
|
|
39546
|
+
return new THREE43.MeshPhysicalMaterial({
|
|
39437
39547
|
// A dark edge lets the green solder mask read as a finished PCB rather
|
|
39438
39548
|
// than a tan substrate with a decal placed on top.
|
|
39439
39549
|
color: 1063462,
|
|
@@ -39453,7 +39563,7 @@ var createBoardMaterial = ({
|
|
|
39453
39563
|
polygonOffsetUnits: 1
|
|
39454
39564
|
});
|
|
39455
39565
|
}
|
|
39456
|
-
return new
|
|
39566
|
+
return new THREE43.MeshStandardMaterial({
|
|
39457
39567
|
color,
|
|
39458
39568
|
side,
|
|
39459
39569
|
flatShading: true,
|
|
@@ -39472,12 +39582,12 @@ function createGeometryMeshes(geoms) {
|
|
|
39472
39582
|
const meshes = [];
|
|
39473
39583
|
if (!geoms) return meshes;
|
|
39474
39584
|
if (geoms.board?.geometry) {
|
|
39475
|
-
const mesh = new
|
|
39585
|
+
const mesh = new THREE44.Mesh(
|
|
39476
39586
|
geoms.board.geometry,
|
|
39477
39587
|
createBoardMaterial({
|
|
39478
39588
|
material: geoms.board.material,
|
|
39479
39589
|
color: geoms.board.color,
|
|
39480
|
-
side:
|
|
39590
|
+
side: THREE44.DoubleSide,
|
|
39481
39591
|
isFaux: geoms.board.isFaux
|
|
39482
39592
|
})
|
|
39483
39593
|
);
|
|
@@ -39488,11 +39598,11 @@ function createGeometryMeshes(geoms) {
|
|
|
39488
39598
|
const createMeshesFromArray = (geomArray) => {
|
|
39489
39599
|
if (geomArray) {
|
|
39490
39600
|
for (const comp of geomArray) {
|
|
39491
|
-
const mesh = new
|
|
39601
|
+
const mesh = new THREE44.Mesh(
|
|
39492
39602
|
comp.geometry,
|
|
39493
|
-
new
|
|
39603
|
+
new THREE44.MeshStandardMaterial({
|
|
39494
39604
|
color: comp.color,
|
|
39495
|
-
side:
|
|
39605
|
+
side: THREE44.DoubleSide,
|
|
39496
39606
|
flatShading: true
|
|
39497
39607
|
// Consistent with board
|
|
39498
39608
|
})
|
|
@@ -39537,14 +39647,14 @@ var BoardMeshes = ({
|
|
|
39537
39647
|
const typedMaterial = material;
|
|
39538
39648
|
for (const prop of textureProps) {
|
|
39539
39649
|
const texture = typedMaterial[prop];
|
|
39540
|
-
if (texture && texture instanceof
|
|
39650
|
+
if (texture && texture instanceof THREE45.Texture) {
|
|
39541
39651
|
texture.dispose();
|
|
39542
39652
|
}
|
|
39543
39653
|
}
|
|
39544
39654
|
material.dispose();
|
|
39545
39655
|
}
|
|
39546
39656
|
};
|
|
39547
|
-
|
|
39657
|
+
useEffect27(() => {
|
|
39548
39658
|
if (!rootObject) return;
|
|
39549
39659
|
for (const mesh of geometryMeshes) {
|
|
39550
39660
|
let shouldShow = true;
|
|
@@ -39566,7 +39676,7 @@ var BoardMeshes = ({
|
|
|
39566
39676
|
}
|
|
39567
39677
|
};
|
|
39568
39678
|
}, [rootObject, geometryMeshes, visibility]);
|
|
39569
|
-
|
|
39679
|
+
useEffect27(() => {
|
|
39570
39680
|
if (!rootObject) return;
|
|
39571
39681
|
for (const mesh of textureMeshes) {
|
|
39572
39682
|
rootObject.add(mesh);
|
|
@@ -39593,14 +39703,14 @@ var CadViewerManifold = ({
|
|
|
39593
39703
|
resolveStaticAsset
|
|
39594
39704
|
}) => {
|
|
39595
39705
|
const childrenCircuitJson = useConvertChildrenToCircuitJson(children);
|
|
39596
|
-
const circuitJson =
|
|
39706
|
+
const circuitJson = useMemo23(() => {
|
|
39597
39707
|
const rawCircuitJson = circuitJsonProp ?? childrenCircuitJson;
|
|
39598
39708
|
return addFauxBoardIfNeeded(rawCircuitJson);
|
|
39599
39709
|
}, [circuitJsonProp, childrenCircuitJson]);
|
|
39600
39710
|
const [manifoldJSModule, setManifoldJSModule] = useState17(null);
|
|
39601
39711
|
const [manifoldLoadingError, setManifoldLoadingError] = useState17(null);
|
|
39602
39712
|
const { visibility } = useLayerVisibility();
|
|
39603
|
-
|
|
39713
|
+
useEffect27(() => {
|
|
39604
39714
|
if (window.ManifoldModule && typeof window.ManifoldModule === "object" && window.ManifoldModule.setup) {
|
|
39605
39715
|
setManifoldJSModule(window.ManifoldModule);
|
|
39606
39716
|
return;
|
|
@@ -39671,27 +39781,27 @@ try {
|
|
|
39671
39781
|
boardData,
|
|
39672
39782
|
isFauxBoard
|
|
39673
39783
|
} = useManifoldBoardBuilder(manifoldJSModule, circuitJson, visibility);
|
|
39674
|
-
const geometryMeshes =
|
|
39675
|
-
const textureMeshes =
|
|
39784
|
+
const geometryMeshes = useMemo23(() => createGeometryMeshes(geoms), [geoms]);
|
|
39785
|
+
const textureMeshes = useMemo23(
|
|
39676
39786
|
() => createTextureMeshes(textures, boardData, pcbThickness, isFauxBoard),
|
|
39677
39787
|
[textures, boardData, pcbThickness, isFauxBoard]
|
|
39678
39788
|
);
|
|
39679
|
-
const cadComponents =
|
|
39789
|
+
const cadComponents = useMemo23(
|
|
39680
39790
|
() => su17(circuitJson).cad_component.list(),
|
|
39681
39791
|
[circuitJson]
|
|
39682
39792
|
);
|
|
39683
|
-
const boardDimensions =
|
|
39793
|
+
const boardDimensions = useMemo23(() => {
|
|
39684
39794
|
if (!boardData) return void 0;
|
|
39685
39795
|
const { width: width10 = 0, height: height10 = 0 } = boardData;
|
|
39686
39796
|
return { width: width10, height: height10 };
|
|
39687
39797
|
}, [boardData]);
|
|
39688
|
-
const boardCenter =
|
|
39798
|
+
const boardCenter = useMemo23(() => {
|
|
39689
39799
|
if (!boardData) return void 0;
|
|
39690
39800
|
const { center } = boardData;
|
|
39691
39801
|
if (!center) return void 0;
|
|
39692
39802
|
return { x: center.x, y: center.y };
|
|
39693
39803
|
}, [boardData]);
|
|
39694
|
-
const initialCameraPosition =
|
|
39804
|
+
const initialCameraPosition = useMemo23(() => {
|
|
39695
39805
|
if (!boardData) return [5, -5, 5];
|
|
39696
39806
|
const { width: width10 = 0, height: height10 = 0 } = boardData;
|
|
39697
39807
|
const safeWidth = Math.max(width10, 1);
|
|
@@ -39789,7 +39899,7 @@ var CadViewerManifold_default = CadViewerManifold;
|
|
|
39789
39899
|
import { useState as useState35 } from "react";
|
|
39790
39900
|
|
|
39791
39901
|
// node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs
|
|
39792
|
-
import * as
|
|
39902
|
+
import * as React42 from "react";
|
|
39793
39903
|
|
|
39794
39904
|
// node_modules/@radix-ui/primitive/dist/index.mjs
|
|
39795
39905
|
var __defProp3 = Object.defineProperty;
|
|
@@ -39844,7 +39954,7 @@ function isFrame(element) {
|
|
|
39844
39954
|
__name(isFrame, "isFrame");
|
|
39845
39955
|
|
|
39846
39956
|
// node_modules/@radix-ui/react-compose-refs/dist/index.mjs
|
|
39847
|
-
import * as
|
|
39957
|
+
import * as React11 from "react";
|
|
39848
39958
|
var __defProp4 = Object.defineProperty;
|
|
39849
39959
|
var __name2 = (target, value) => __defProp4(target, "name", { value, configurable: true });
|
|
39850
39960
|
function setRef(ref, value) {
|
|
@@ -39881,28 +39991,28 @@ function composeRefs(...refs) {
|
|
|
39881
39991
|
}
|
|
39882
39992
|
__name2(composeRefs, "composeRefs");
|
|
39883
39993
|
function useComposedRefs(...refs) {
|
|
39884
|
-
return
|
|
39994
|
+
return React11.useCallback(composeRefs(...refs), refs);
|
|
39885
39995
|
}
|
|
39886
39996
|
__name2(useComposedRefs, "useComposedRefs");
|
|
39887
39997
|
|
|
39888
39998
|
// node_modules/@radix-ui/react-context/dist/index.mjs
|
|
39889
|
-
import * as
|
|
39999
|
+
import * as React12 from "react";
|
|
39890
40000
|
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
39891
40001
|
var __defProp5 = Object.defineProperty;
|
|
39892
40002
|
var __name3 = (target, value) => __defProp5(target, "name", { value, configurable: true });
|
|
39893
40003
|
// @__NO_SIDE_EFFECTS__
|
|
39894
40004
|
function createContext22(rootComponentName, defaultContext) {
|
|
39895
|
-
const Context =
|
|
40005
|
+
const Context = React12.createContext(defaultContext);
|
|
39896
40006
|
Context.displayName = rootComponentName + "Context";
|
|
39897
40007
|
const Provider = /* @__PURE__ */ __name3((props) => {
|
|
39898
40008
|
const { children, ...context } = props;
|
|
39899
|
-
const value =
|
|
40009
|
+
const value = React12.useMemo(() => context, Object.values(context));
|
|
39900
40010
|
return /* @__PURE__ */ jsx20(Context.Provider, { value, children });
|
|
39901
40011
|
}, "Provider");
|
|
39902
40012
|
Provider.displayName = rootComponentName + "Provider";
|
|
39903
40013
|
function useContext22(consumerName, options = {}) {
|
|
39904
40014
|
const { optional = false } = options;
|
|
39905
|
-
const context =
|
|
40015
|
+
const context = React12.useContext(Context);
|
|
39906
40016
|
if (context) return context;
|
|
39907
40017
|
if (defaultContext !== void 0) return defaultContext;
|
|
39908
40018
|
if (optional) return void 0;
|
|
@@ -39916,21 +40026,21 @@ __name3(createContext22, "createContext");
|
|
|
39916
40026
|
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
39917
40027
|
let defaultContexts = [];
|
|
39918
40028
|
function createContext32(rootComponentName, defaultContext) {
|
|
39919
|
-
const BaseContext =
|
|
40029
|
+
const BaseContext = React12.createContext(defaultContext);
|
|
39920
40030
|
BaseContext.displayName = rootComponentName + "Context";
|
|
39921
40031
|
const index2 = defaultContexts.length;
|
|
39922
40032
|
defaultContexts = [...defaultContexts, defaultContext];
|
|
39923
40033
|
const Provider = /* @__PURE__ */ __name3((props) => {
|
|
39924
40034
|
const { scope, children, ...context } = props;
|
|
39925
40035
|
const Context = scope?.[scopeName]?.[index2] || BaseContext;
|
|
39926
|
-
const value =
|
|
40036
|
+
const value = React12.useMemo(() => context, Object.values(context));
|
|
39927
40037
|
return /* @__PURE__ */ jsx20(Context.Provider, { value, children });
|
|
39928
40038
|
}, "Provider");
|
|
39929
40039
|
Provider.displayName = rootComponentName + "Provider";
|
|
39930
40040
|
function useContext22(consumerName, scope, options = {}) {
|
|
39931
40041
|
const { optional = false } = options;
|
|
39932
40042
|
const Context = scope?.[scopeName]?.[index2] || BaseContext;
|
|
39933
|
-
const context =
|
|
40043
|
+
const context = React12.useContext(Context);
|
|
39934
40044
|
if (context) return context;
|
|
39935
40045
|
if (defaultContext !== void 0) return defaultContext;
|
|
39936
40046
|
if (optional) return void 0;
|
|
@@ -39942,11 +40052,11 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
|
39942
40052
|
__name3(createContext32, "createContext");
|
|
39943
40053
|
const createScope = /* @__PURE__ */ __name3(() => {
|
|
39944
40054
|
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
39945
|
-
return
|
|
40055
|
+
return React12.createContext(defaultContext);
|
|
39946
40056
|
});
|
|
39947
40057
|
return /* @__PURE__ */ __name3(function useScope(scope) {
|
|
39948
40058
|
const contexts = scope?.[scopeName] || scopeContexts;
|
|
39949
|
-
return
|
|
40059
|
+
return React12.useMemo(
|
|
39950
40060
|
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
39951
40061
|
[scope, contexts]
|
|
39952
40062
|
);
|
|
@@ -39970,7 +40080,7 @@ function composeContextScopes(...scopes) {
|
|
|
39970
40080
|
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
39971
40081
|
return { ...nextScopes2, ...currentScope };
|
|
39972
40082
|
}, {});
|
|
39973
|
-
return
|
|
40083
|
+
return React12.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
39974
40084
|
}, "useComposedScopes");
|
|
39975
40085
|
}, "createScope");
|
|
39976
40086
|
createScope.scopeName = baseScope.scopeName;
|
|
@@ -39979,30 +40089,30 @@ function composeContextScopes(...scopes) {
|
|
|
39979
40089
|
__name3(composeContextScopes, "composeContextScopes");
|
|
39980
40090
|
|
|
39981
40091
|
// node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
39982
|
-
import * as
|
|
40092
|
+
import * as React15 from "react";
|
|
39983
40093
|
|
|
39984
40094
|
// node_modules/@radix-ui/primitive/dist/internal/is-development.false.mjs
|
|
39985
40095
|
var IS_DEVELOPMENT = false;
|
|
39986
40096
|
|
|
39987
40097
|
// node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
|
|
39988
|
-
import * as
|
|
39989
|
-
var useLayoutEffect2 = globalThis?.document ?
|
|
40098
|
+
import * as React13 from "react";
|
|
40099
|
+
var useLayoutEffect2 = globalThis?.document ? React13.useLayoutEffect : () => {
|
|
39990
40100
|
};
|
|
39991
40101
|
|
|
39992
40102
|
// node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
39993
40103
|
import * as React22 from "react";
|
|
39994
40104
|
|
|
39995
40105
|
// node_modules/@radix-ui/react-use-effect-event/dist/index.mjs
|
|
39996
|
-
import * as
|
|
40106
|
+
import * as React14 from "react";
|
|
39997
40107
|
var __defProp6 = Object.defineProperty;
|
|
39998
40108
|
var __name4 = (target, value) => __defProp6(target, "name", { value, configurable: true });
|
|
39999
|
-
var useReactEffectEvent =
|
|
40000
|
-
var useReactInsertionEffect =
|
|
40109
|
+
var useReactEffectEvent = React14[" useEffectEvent ".trim().toString()];
|
|
40110
|
+
var useReactInsertionEffect = React14[" useInsertionEffect ".trim().toString()];
|
|
40001
40111
|
function useEffectEvent(callback) {
|
|
40002
40112
|
if (typeof useReactEffectEvent === "function") {
|
|
40003
40113
|
return useReactEffectEvent(callback);
|
|
40004
40114
|
}
|
|
40005
|
-
const ref =
|
|
40115
|
+
const ref = React14.useRef(() => {
|
|
40006
40116
|
throw new Error("Cannot call an event handler while rendering.");
|
|
40007
40117
|
});
|
|
40008
40118
|
if (typeof useReactInsertionEffect === "function") {
|
|
@@ -40014,14 +40124,14 @@ function useEffectEvent(callback) {
|
|
|
40014
40124
|
ref.current = callback;
|
|
40015
40125
|
});
|
|
40016
40126
|
}
|
|
40017
|
-
return
|
|
40127
|
+
return React14.useMemo(() => ((...args) => ref.current?.(...args)), []);
|
|
40018
40128
|
}
|
|
40019
40129
|
__name4(useEffectEvent, "useEffectEvent");
|
|
40020
40130
|
|
|
40021
40131
|
// node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
40022
40132
|
var __defProp7 = Object.defineProperty;
|
|
40023
40133
|
var __name5 = (target, value) => __defProp7(target, "name", { value, configurable: true });
|
|
40024
|
-
var useInsertionEffect =
|
|
40134
|
+
var useInsertionEffect = React15[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
|
|
40025
40135
|
function useControllableState({
|
|
40026
40136
|
prop,
|
|
40027
40137
|
defaultProp,
|
|
@@ -40036,8 +40146,8 @@ function useControllableState({
|
|
|
40036
40146
|
const isControlled = prop !== void 0;
|
|
40037
40147
|
const value = isControlled ? prop : uncontrolledProp;
|
|
40038
40148
|
if (IS_DEVELOPMENT) {
|
|
40039
|
-
const isControlledRef =
|
|
40040
|
-
|
|
40149
|
+
const isControlledRef = React15.useRef(prop !== void 0);
|
|
40150
|
+
React15.useEffect(() => {
|
|
40041
40151
|
const wasControlled = isControlledRef.current;
|
|
40042
40152
|
if (wasControlled !== isControlled) {
|
|
40043
40153
|
const from = wasControlled ? "controlled" : "uncontrolled";
|
|
@@ -40049,7 +40159,7 @@ function useControllableState({
|
|
|
40049
40159
|
isControlledRef.current = isControlled;
|
|
40050
40160
|
}, [isControlled, caller]);
|
|
40051
40161
|
}
|
|
40052
|
-
const setValue =
|
|
40162
|
+
const setValue = React15.useCallback(
|
|
40053
40163
|
(nextValue) => {
|
|
40054
40164
|
if (isControlled) {
|
|
40055
40165
|
const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
|
|
@@ -40069,13 +40179,13 @@ function useUncontrolledState({
|
|
|
40069
40179
|
defaultProp,
|
|
40070
40180
|
onChange
|
|
40071
40181
|
}) {
|
|
40072
|
-
const [value, setValue] =
|
|
40073
|
-
const prevValueRef =
|
|
40074
|
-
const onChangeRef =
|
|
40182
|
+
const [value, setValue] = React15.useState(defaultProp);
|
|
40183
|
+
const prevValueRef = React15.useRef(value);
|
|
40184
|
+
const onChangeRef = React15.useRef(onChange);
|
|
40075
40185
|
useInsertionEffect(() => {
|
|
40076
40186
|
onChangeRef.current = onChange;
|
|
40077
40187
|
}, [onChange]);
|
|
40078
|
-
|
|
40188
|
+
React15.useEffect(() => {
|
|
40079
40189
|
if (prevValueRef.current !== value) {
|
|
40080
40190
|
onChangeRef.current?.(value);
|
|
40081
40191
|
prevValueRef.current = value;
|
|
@@ -40151,16 +40261,16 @@ function useControllableStateReducer(reducer, userArgs, initialArg, init) {
|
|
|
40151
40261
|
__name5(useControllableStateReducer, "useControllableStateReducer");
|
|
40152
40262
|
|
|
40153
40263
|
// node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
40154
|
-
import * as
|
|
40264
|
+
import * as React17 from "react";
|
|
40155
40265
|
import * as ReactDOM2 from "react-dom";
|
|
40156
40266
|
|
|
40157
40267
|
// node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
40158
|
-
import * as
|
|
40268
|
+
import * as React16 from "react";
|
|
40159
40269
|
var __defProp8 = Object.defineProperty;
|
|
40160
40270
|
var __name6 = (target, value) => __defProp8(target, "name", { value, configurable: true });
|
|
40161
40271
|
// @__NO_SIDE_EFFECTS__
|
|
40162
40272
|
function createSlot(ownerName) {
|
|
40163
|
-
const Slot2 =
|
|
40273
|
+
const Slot2 = React16.forwardRef((props, forwardedRef) => {
|
|
40164
40274
|
let { children, ...slotProps } = props;
|
|
40165
40275
|
let slottableElement = null;
|
|
40166
40276
|
let hasSlottable = false;
|
|
@@ -40168,7 +40278,7 @@ function createSlot(ownerName) {
|
|
|
40168
40278
|
if (isLazyComponent(children) && typeof use === "function") {
|
|
40169
40279
|
children = use(children._payload);
|
|
40170
40280
|
}
|
|
40171
|
-
|
|
40281
|
+
React16.Children.forEach(children, (maybeSlottable) => {
|
|
40172
40282
|
if (isSlottable(maybeSlottable)) {
|
|
40173
40283
|
hasSlottable = true;
|
|
40174
40284
|
const slottable = maybeSlottable;
|
|
@@ -40183,13 +40293,13 @@ function createSlot(ownerName) {
|
|
|
40183
40293
|
}
|
|
40184
40294
|
});
|
|
40185
40295
|
if (slottableElement) {
|
|
40186
|
-
slottableElement =
|
|
40296
|
+
slottableElement = React16.cloneElement(slottableElement, void 0, newChildren);
|
|
40187
40297
|
} else if (
|
|
40188
40298
|
// A `Slottable` was found but it didn't resolve to a single element (e.g.
|
|
40189
40299
|
// it wrapped multiple elements, text, or a render-prop `child` that
|
|
40190
40300
|
// wasn't an element). Don't fall back to treating the `Slottable` wrapper
|
|
40191
40301
|
// itself as the slot target — throw a descriptive error below instead.
|
|
40192
|
-
!hasSlottable &&
|
|
40302
|
+
!hasSlottable && React16.Children.count(children) === 1 && React16.isValidElement(children)
|
|
40193
40303
|
) {
|
|
40194
40304
|
slottableElement = children;
|
|
40195
40305
|
}
|
|
@@ -40204,10 +40314,10 @@ function createSlot(ownerName) {
|
|
|
40204
40314
|
return children;
|
|
40205
40315
|
}
|
|
40206
40316
|
const mergedProps = mergeProps(slotProps, slottableElement.props ?? {});
|
|
40207
|
-
if (slottableElement.type !==
|
|
40317
|
+
if (slottableElement.type !== React16.Fragment) {
|
|
40208
40318
|
mergedProps.ref = forwardedRef ? composedRef : slottableElementRef;
|
|
40209
40319
|
}
|
|
40210
|
-
return
|
|
40320
|
+
return React16.cloneElement(slottableElement, mergedProps);
|
|
40211
40321
|
});
|
|
40212
40322
|
Slot2.displayName = `${ownerName}.Slot`;
|
|
40213
40323
|
return Slot2;
|
|
@@ -40225,10 +40335,10 @@ __name6(createSlottable, "createSlottable");
|
|
|
40225
40335
|
var getSlottableElementFromSlottable = /* @__PURE__ */ __name6((slottable, child) => {
|
|
40226
40336
|
if ("child" in slottable.props) {
|
|
40227
40337
|
const child2 = slottable.props.child;
|
|
40228
|
-
if (!
|
|
40229
|
-
return
|
|
40338
|
+
if (!React16.isValidElement(child2)) return null;
|
|
40339
|
+
return React16.cloneElement(child2, void 0, slottable.props.children(child2.props.children));
|
|
40230
40340
|
}
|
|
40231
|
-
return
|
|
40341
|
+
return React16.isValidElement(child) ? child : null;
|
|
40232
40342
|
}, "getSlottableElementFromSlottable");
|
|
40233
40343
|
function mergeProps(slotProps, childProps) {
|
|
40234
40344
|
const overrideProps = { ...childProps };
|
|
@@ -40270,7 +40380,7 @@ function getElementRef(element) {
|
|
|
40270
40380
|
}
|
|
40271
40381
|
__name6(getElementRef, "getElementRef");
|
|
40272
40382
|
function isSlottable(child) {
|
|
40273
|
-
return
|
|
40383
|
+
return React16.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
40274
40384
|
}
|
|
40275
40385
|
__name6(isSlottable, "isSlottable");
|
|
40276
40386
|
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
@@ -40288,7 +40398,7 @@ var createSlotError = /* @__PURE__ */ __name6((ownerName) => {
|
|
|
40288
40398
|
var createSlottableError = /* @__PURE__ */ __name6((ownerName) => {
|
|
40289
40399
|
return `${ownerName} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`;
|
|
40290
40400
|
}, "createSlottableError");
|
|
40291
|
-
var use =
|
|
40401
|
+
var use = React16[" use ".trim().toString()];
|
|
40292
40402
|
|
|
40293
40403
|
// node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
40294
40404
|
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
@@ -40315,7 +40425,7 @@ var NODES = [
|
|
|
40315
40425
|
];
|
|
40316
40426
|
var Primitive = NODES.reduce((primitive, node) => {
|
|
40317
40427
|
const Slot2 = createSlot(`Primitive.${node}`);
|
|
40318
|
-
const Node2 =
|
|
40428
|
+
const Node2 = React17.forwardRef((props, forwardedRef) => {
|
|
40319
40429
|
const { asChild, ...primitiveProps } = props;
|
|
40320
40430
|
const Comp = asChild ? Slot2 : node;
|
|
40321
40431
|
if (typeof window !== "undefined") {
|
|
@@ -40332,10 +40442,10 @@ function dispatchDiscreteCustomEvent(target, event) {
|
|
|
40332
40442
|
__name7(dispatchDiscreteCustomEvent, "dispatchDiscreteCustomEvent");
|
|
40333
40443
|
|
|
40334
40444
|
// node_modules/@radix-ui/react-menu/dist/index.mjs
|
|
40335
|
-
import * as
|
|
40445
|
+
import * as React41 from "react";
|
|
40336
40446
|
|
|
40337
40447
|
// node_modules/@radix-ui/react-collection/dist/index.mjs
|
|
40338
|
-
import * as
|
|
40448
|
+
import * as React18 from "react";
|
|
40339
40449
|
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
40340
40450
|
import * as React23 from "react";
|
|
40341
40451
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
@@ -40351,14 +40461,14 @@ function createCollection(name) {
|
|
|
40351
40461
|
);
|
|
40352
40462
|
const CollectionProvider = /* @__PURE__ */ __name8((props) => {
|
|
40353
40463
|
const { scope, children } = props;
|
|
40354
|
-
const ref =
|
|
40355
|
-
const itemMap =
|
|
40464
|
+
const ref = React18.useRef(null);
|
|
40465
|
+
const itemMap = React18.useRef(/* @__PURE__ */ new Map()).current;
|
|
40356
40466
|
return /* @__PURE__ */ jsx22(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
40357
40467
|
}, "CollectionProvider");
|
|
40358
40468
|
CollectionProvider.displayName = PROVIDER_NAME;
|
|
40359
40469
|
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
40360
40470
|
const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
|
|
40361
|
-
const CollectionSlot =
|
|
40471
|
+
const CollectionSlot = React18.forwardRef(
|
|
40362
40472
|
(props, forwardedRef) => {
|
|
40363
40473
|
const { scope, children } = props;
|
|
40364
40474
|
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
@@ -40370,13 +40480,13 @@ function createCollection(name) {
|
|
|
40370
40480
|
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
40371
40481
|
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
40372
40482
|
const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);
|
|
40373
|
-
const CollectionItemSlot =
|
|
40483
|
+
const CollectionItemSlot = React18.forwardRef(
|
|
40374
40484
|
(props, forwardedRef) => {
|
|
40375
40485
|
const { scope, children, ...itemData } = props;
|
|
40376
|
-
const ref =
|
|
40486
|
+
const ref = React18.useRef(null);
|
|
40377
40487
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
40378
40488
|
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
40379
|
-
|
|
40489
|
+
React18.useEffect(() => {
|
|
40380
40490
|
context.itemMap.set(ref, { ref, ...itemData });
|
|
40381
40491
|
return () => void context.itemMap.delete(ref);
|
|
40382
40492
|
});
|
|
@@ -40386,7 +40496,7 @@ function createCollection(name) {
|
|
|
40386
40496
|
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
40387
40497
|
function useCollection3(scope) {
|
|
40388
40498
|
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
40389
|
-
const getItems =
|
|
40499
|
+
const getItems = React18.useCallback(() => {
|
|
40390
40500
|
const collectionNode = context.collectionRef.current;
|
|
40391
40501
|
if (!collectionNode) return [];
|
|
40392
40502
|
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
@@ -40881,30 +40991,30 @@ function getChildListObserver(callback) {
|
|
|
40881
40991
|
__name8(getChildListObserver, "getChildListObserver");
|
|
40882
40992
|
|
|
40883
40993
|
// node_modules/@radix-ui/react-direction/dist/index.mjs
|
|
40884
|
-
import * as
|
|
40994
|
+
import * as React19 from "react";
|
|
40885
40995
|
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
40886
40996
|
var __defProp11 = Object.defineProperty;
|
|
40887
40997
|
var __name9 = (target, value) => __defProp11(target, "name", { value, configurable: true });
|
|
40888
|
-
var DirectionContext =
|
|
40998
|
+
var DirectionContext = React19.createContext(void 0);
|
|
40889
40999
|
function useDirection(localDir) {
|
|
40890
|
-
const globalDir =
|
|
41000
|
+
const globalDir = React19.useContext(DirectionContext);
|
|
40891
41001
|
return localDir || globalDir || "ltr";
|
|
40892
41002
|
}
|
|
40893
41003
|
__name9(useDirection, "useDirection");
|
|
40894
41004
|
|
|
40895
41005
|
// node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
|
|
40896
|
-
import * as
|
|
41006
|
+
import * as React21 from "react";
|
|
40897
41007
|
|
|
40898
41008
|
// node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
|
|
40899
|
-
import * as
|
|
41009
|
+
import * as React20 from "react";
|
|
40900
41010
|
var __defProp12 = Object.defineProperty;
|
|
40901
41011
|
var __name10 = (target, value) => __defProp12(target, "name", { value, configurable: true });
|
|
40902
41012
|
function useCallbackRef(callback) {
|
|
40903
|
-
const callbackRef =
|
|
40904
|
-
|
|
41013
|
+
const callbackRef = React20.useRef(callback);
|
|
41014
|
+
React20.useEffect(() => {
|
|
40905
41015
|
callbackRef.current = callback;
|
|
40906
41016
|
});
|
|
40907
|
-
return
|
|
41017
|
+
return React20.useMemo(() => ((...args) => callbackRef.current?.(...args)), []);
|
|
40908
41018
|
}
|
|
40909
41019
|
__name10(useCallbackRef, "useCallbackRef");
|
|
40910
41020
|
|
|
@@ -40916,7 +41026,7 @@ var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
|
40916
41026
|
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
40917
41027
|
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
40918
41028
|
var originalBodyPointerEvents;
|
|
40919
|
-
var DismissableLayerContext =
|
|
41029
|
+
var DismissableLayerContext = React21.createContext({
|
|
40920
41030
|
layers: /* @__PURE__ */ new Set(),
|
|
40921
41031
|
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
40922
41032
|
branches: /* @__PURE__ */ new Set(),
|
|
@@ -40927,7 +41037,7 @@ var DismissableLayerContext = React20.createContext({
|
|
|
40927
41037
|
// See https://github.com/radix-ui/primitives/issues/3346
|
|
40928
41038
|
dismissableSurfaces: /* @__PURE__ */ new Set()
|
|
40929
41039
|
});
|
|
40930
|
-
var DismissableLayer = /* @__PURE__ */
|
|
41040
|
+
var DismissableLayer = /* @__PURE__ */ React21.forwardRef(
|
|
40931
41041
|
// blank line to reduce diff noise
|
|
40932
41042
|
/* @__PURE__ */ __name11(function DismissableLayer2(props, forwardedRef) {
|
|
40933
41043
|
const {
|
|
@@ -40940,10 +41050,10 @@ var DismissableLayer = /* @__PURE__ */ React20.forwardRef(
|
|
|
40940
41050
|
onDismiss,
|
|
40941
41051
|
...layerProps
|
|
40942
41052
|
} = props;
|
|
40943
|
-
const context =
|
|
40944
|
-
const [node, setNode] =
|
|
41053
|
+
const context = React21.useContext(DismissableLayerContext);
|
|
41054
|
+
const [node, setNode] = React21.useState(null);
|
|
40945
41055
|
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
|
40946
|
-
const [, force] =
|
|
41056
|
+
const [, force] = React21.useState({});
|
|
40947
41057
|
const composedRefs = useComposedRefs(forwardedRef, setNode);
|
|
40948
41058
|
const layers = Array.from(context.layers);
|
|
40949
41059
|
const [highestLayerWithOutsidePointerEventsDisabled] = [
|
|
@@ -40953,7 +41063,7 @@ var DismissableLayer = /* @__PURE__ */ React20.forwardRef(
|
|
|
40953
41063
|
const index2 = node ? layers.indexOf(node) : -1;
|
|
40954
41064
|
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
40955
41065
|
const isPointerEventsEnabled = index2 >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
40956
|
-
const isDeferredPointerDownOutsideRef =
|
|
41066
|
+
const isDeferredPointerDownOutsideRef = React21.useRef(false);
|
|
40957
41067
|
const pointerDownOutside = usePointerDownOutside(
|
|
40958
41068
|
(event) => {
|
|
40959
41069
|
onPointerDownOutside?.(event);
|
|
@@ -40965,7 +41075,7 @@ var DismissableLayer = /* @__PURE__ */ React20.forwardRef(
|
|
|
40965
41075
|
deferPointerDownOutside,
|
|
40966
41076
|
isDeferredPointerDownOutsideRef,
|
|
40967
41077
|
dismissableSurfaces: context.dismissableSurfaces,
|
|
40968
|
-
shouldHandlePointerDownOutside:
|
|
41078
|
+
shouldHandlePointerDownOutside: React21.useCallback(
|
|
40969
41079
|
(target) => {
|
|
40970
41080
|
if (!(target instanceof Node)) {
|
|
40971
41081
|
return false;
|
|
@@ -41001,14 +41111,14 @@ var DismissableLayer = /* @__PURE__ */ React20.forwardRef(
|
|
|
41001
41111
|
onDismiss();
|
|
41002
41112
|
}
|
|
41003
41113
|
});
|
|
41004
|
-
|
|
41114
|
+
React21.useEffect(() => {
|
|
41005
41115
|
if (!isHighestLayer) {
|
|
41006
41116
|
return;
|
|
41007
41117
|
}
|
|
41008
41118
|
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
41009
41119
|
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
41010
41120
|
}, [ownerDocument, isHighestLayer, handleKeyDown]);
|
|
41011
|
-
|
|
41121
|
+
React21.useEffect(() => {
|
|
41012
41122
|
if (!node) return;
|
|
41013
41123
|
if (disableOutsidePointerEvents) {
|
|
41014
41124
|
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
@@ -41028,7 +41138,7 @@ var DismissableLayer = /* @__PURE__ */ React20.forwardRef(
|
|
|
41028
41138
|
}
|
|
41029
41139
|
};
|
|
41030
41140
|
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
41031
|
-
|
|
41141
|
+
React21.useEffect(() => {
|
|
41032
41142
|
return () => {
|
|
41033
41143
|
if (!node) return;
|
|
41034
41144
|
context.layers.delete(node);
|
|
@@ -41036,7 +41146,7 @@ var DismissableLayer = /* @__PURE__ */ React20.forwardRef(
|
|
|
41036
41146
|
dispatchUpdate();
|
|
41037
41147
|
};
|
|
41038
41148
|
}, [node, context]);
|
|
41039
|
-
|
|
41149
|
+
React21.useEffect(() => {
|
|
41040
41150
|
const handleUpdate = /* @__PURE__ */ __name11(() => force({}), "handleUpdate");
|
|
41041
41151
|
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
41042
41152
|
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
@@ -41061,9 +41171,9 @@ var DismissableLayer = /* @__PURE__ */ React20.forwardRef(
|
|
|
41061
41171
|
}, "DismissableLayer")
|
|
41062
41172
|
);
|
|
41063
41173
|
function useDismissableLayerSurface() {
|
|
41064
|
-
const context =
|
|
41065
|
-
const [node, setNode] =
|
|
41066
|
-
|
|
41174
|
+
const context = React21.useContext(DismissableLayerContext);
|
|
41175
|
+
const [node, setNode] = React21.useState(null);
|
|
41176
|
+
React21.useEffect(() => {
|
|
41067
41177
|
if (!node) {
|
|
41068
41178
|
return;
|
|
41069
41179
|
}
|
|
@@ -41085,12 +41195,12 @@ function usePointerDownOutside(onPointerDownOutside, args) {
|
|
|
41085
41195
|
shouldHandlePointerDownOutside = IS_TRUE
|
|
41086
41196
|
} = args;
|
|
41087
41197
|
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
41088
|
-
const isPointerInsideReactTreeRef =
|
|
41089
|
-
const isPointerDownOutsideRef =
|
|
41090
|
-
const interceptedOutsideInteractionEventsRef =
|
|
41091
|
-
const handleClickRef =
|
|
41198
|
+
const isPointerInsideReactTreeRef = React21.useRef(false);
|
|
41199
|
+
const isPointerDownOutsideRef = React21.useRef(false);
|
|
41200
|
+
const interceptedOutsideInteractionEventsRef = React21.useRef(/* @__PURE__ */ new Map());
|
|
41201
|
+
const handleClickRef = React21.useRef(() => {
|
|
41092
41202
|
});
|
|
41093
|
-
|
|
41203
|
+
React21.useEffect(() => {
|
|
41094
41204
|
function resetOutsideInteraction() {
|
|
41095
41205
|
isPointerDownOutsideRef.current = false;
|
|
41096
41206
|
isDeferredPointerDownOutsideRef.current = false;
|
|
@@ -41205,8 +41315,8 @@ function usePointerDownOutside(onPointerDownOutside, args) {
|
|
|
41205
41315
|
__name11(usePointerDownOutside, "usePointerDownOutside");
|
|
41206
41316
|
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
41207
41317
|
const handleFocusOutside = useCallbackRef(onFocusOutside);
|
|
41208
|
-
const isFocusInsideReactTreeRef =
|
|
41209
|
-
|
|
41318
|
+
const isFocusInsideReactTreeRef = React21.useRef(false);
|
|
41319
|
+
React21.useEffect(() => {
|
|
41210
41320
|
const handleFocus = /* @__PURE__ */ __name11((event) => {
|
|
41211
41321
|
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
41212
41322
|
const eventDetail = { originalEvent: event };
|
|
@@ -41242,7 +41352,7 @@ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
|
41242
41352
|
__name11(handleAndDispatchCustomEvent, "handleAndDispatchCustomEvent");
|
|
41243
41353
|
|
|
41244
41354
|
// node_modules/@radix-ui/react-focus-guards/dist/index.mjs
|
|
41245
|
-
import * as
|
|
41355
|
+
import * as React24 from "react";
|
|
41246
41356
|
var __defProp14 = Object.defineProperty;
|
|
41247
41357
|
var __name12 = (target, value) => __defProp14(target, "name", { value, configurable: true });
|
|
41248
41358
|
var count = 0;
|
|
@@ -41253,7 +41363,7 @@ function FocusGuards(props) {
|
|
|
41253
41363
|
}
|
|
41254
41364
|
__name12(FocusGuards, "FocusGuards");
|
|
41255
41365
|
function useFocusGuards() {
|
|
41256
|
-
|
|
41366
|
+
React24.useEffect(() => {
|
|
41257
41367
|
if (!guards) {
|
|
41258
41368
|
guards = { start: createFocusGuard(), end: createFocusGuard() };
|
|
41259
41369
|
}
|
|
@@ -41289,14 +41399,14 @@ function createFocusGuard() {
|
|
|
41289
41399
|
__name12(createFocusGuard, "createFocusGuard");
|
|
41290
41400
|
|
|
41291
41401
|
// node_modules/@radix-ui/react-focus-scope/dist/index.mjs
|
|
41292
|
-
import * as
|
|
41402
|
+
import * as React25 from "react";
|
|
41293
41403
|
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
41294
41404
|
var __defProp15 = Object.defineProperty;
|
|
41295
41405
|
var __name13 = (target, value) => __defProp15(target, "name", { value, configurable: true });
|
|
41296
41406
|
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
41297
41407
|
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
41298
41408
|
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
41299
|
-
var FocusScope = /* @__PURE__ */
|
|
41409
|
+
var FocusScope = /* @__PURE__ */ React25.forwardRef(
|
|
41300
41410
|
/* @__PURE__ */ __name13(function FocusScope2(props, forwardedRef) {
|
|
41301
41411
|
const {
|
|
41302
41412
|
loop = false,
|
|
@@ -41305,12 +41415,12 @@ var FocusScope = /* @__PURE__ */ React24.forwardRef(
|
|
|
41305
41415
|
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
41306
41416
|
...scopeProps
|
|
41307
41417
|
} = props;
|
|
41308
|
-
const [container, setContainer] =
|
|
41418
|
+
const [container, setContainer] = React25.useState(null);
|
|
41309
41419
|
const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);
|
|
41310
41420
|
const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);
|
|
41311
|
-
const lastFocusedElementRef =
|
|
41421
|
+
const lastFocusedElementRef = React25.useRef(null);
|
|
41312
41422
|
const composedRefs = useComposedRefs(forwardedRef, setContainer);
|
|
41313
|
-
const focusScope =
|
|
41423
|
+
const focusScope = React25.useRef({
|
|
41314
41424
|
paused: false,
|
|
41315
41425
|
pause() {
|
|
41316
41426
|
this.paused = true;
|
|
@@ -41319,7 +41429,7 @@ var FocusScope = /* @__PURE__ */ React24.forwardRef(
|
|
|
41319
41429
|
this.paused = false;
|
|
41320
41430
|
}
|
|
41321
41431
|
}).current;
|
|
41322
|
-
|
|
41432
|
+
React25.useEffect(() => {
|
|
41323
41433
|
if (trapped) {
|
|
41324
41434
|
let handleFocusIn2 = function(event) {
|
|
41325
41435
|
if (focusScope.paused || !container) return;
|
|
@@ -41358,7 +41468,7 @@ var FocusScope = /* @__PURE__ */ React24.forwardRef(
|
|
|
41358
41468
|
};
|
|
41359
41469
|
}
|
|
41360
41470
|
}, [trapped, container, focusScope.paused]);
|
|
41361
|
-
|
|
41471
|
+
React25.useEffect(() => {
|
|
41362
41472
|
if (container) {
|
|
41363
41473
|
focusScopesStack.add(focusScope);
|
|
41364
41474
|
const previouslyFocusedElement = document.activeElement;
|
|
@@ -41389,7 +41499,7 @@ var FocusScope = /* @__PURE__ */ React24.forwardRef(
|
|
|
41389
41499
|
};
|
|
41390
41500
|
}
|
|
41391
41501
|
}, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
|
|
41392
|
-
const handleKeyDown =
|
|
41502
|
+
const handleKeyDown = React25.useCallback(
|
|
41393
41503
|
(event) => {
|
|
41394
41504
|
if (!loop && !trapped) return;
|
|
41395
41505
|
if (focusScope.paused) return;
|
|
@@ -41512,13 +41622,13 @@ function removeLinks(items) {
|
|
|
41512
41622
|
__name13(removeLinks, "removeLinks");
|
|
41513
41623
|
|
|
41514
41624
|
// node_modules/@radix-ui/react-id/dist/index.mjs
|
|
41515
|
-
import * as
|
|
41625
|
+
import * as React26 from "react";
|
|
41516
41626
|
var __defProp16 = Object.defineProperty;
|
|
41517
41627
|
var __name14 = (target, value) => __defProp16(target, "name", { value, configurable: true });
|
|
41518
|
-
var useReactId =
|
|
41628
|
+
var useReactId = React26[" useId ".trim().toString()] || (() => void 0);
|
|
41519
41629
|
var count2 = 0;
|
|
41520
41630
|
function useId(deterministicId) {
|
|
41521
|
-
const [id, setId] =
|
|
41631
|
+
const [id, setId] = React26.useState(useReactId());
|
|
41522
41632
|
useLayoutEffect2(() => {
|
|
41523
41633
|
if (!deterministicId) setId((reactId) => reactId ?? String(count2++));
|
|
41524
41634
|
}, [deterministicId]);
|
|
@@ -41527,7 +41637,7 @@ function useId(deterministicId) {
|
|
|
41527
41637
|
__name14(useId, "useId");
|
|
41528
41638
|
|
|
41529
41639
|
// node_modules/@radix-ui/react-popper/dist/index.mjs
|
|
41530
|
-
import * as
|
|
41640
|
+
import * as React29 from "react";
|
|
41531
41641
|
|
|
41532
41642
|
// node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
|
41533
41643
|
var sides = ["top", "right", "bottom", "left"];
|
|
@@ -43122,7 +43232,7 @@ var computePosition2 = (reference, floating, options) => {
|
|
|
43122
43232
|
};
|
|
43123
43233
|
|
|
43124
43234
|
// node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
|
|
43125
|
-
import * as
|
|
43235
|
+
import * as React27 from "react";
|
|
43126
43236
|
import { useLayoutEffect as useLayoutEffect3 } from "react";
|
|
43127
43237
|
import * as ReactDOM3 from "react-dom";
|
|
43128
43238
|
var isClient = typeof document !== "undefined";
|
|
@@ -43188,7 +43298,7 @@ function roundByDPR(element, value) {
|
|
|
43188
43298
|
return Math.round(value * dpr) / dpr;
|
|
43189
43299
|
}
|
|
43190
43300
|
function useLatestRef(value) {
|
|
43191
|
-
const ref =
|
|
43301
|
+
const ref = React27.useRef(value);
|
|
43192
43302
|
index(() => {
|
|
43193
43303
|
ref.current = value;
|
|
43194
43304
|
});
|
|
@@ -43211,7 +43321,7 @@ function useFloating(options) {
|
|
|
43211
43321
|
whileElementsMounted,
|
|
43212
43322
|
open
|
|
43213
43323
|
} = options;
|
|
43214
|
-
const [data, setData] =
|
|
43324
|
+
const [data, setData] = React27.useState({
|
|
43215
43325
|
x: 0,
|
|
43216
43326
|
y: 0,
|
|
43217
43327
|
strategy,
|
|
@@ -43219,19 +43329,19 @@ function useFloating(options) {
|
|
|
43219
43329
|
middlewareData: {},
|
|
43220
43330
|
isPositioned: false
|
|
43221
43331
|
});
|
|
43222
|
-
const [latestMiddleware, setLatestMiddleware] =
|
|
43332
|
+
const [latestMiddleware, setLatestMiddleware] = React27.useState(middleware);
|
|
43223
43333
|
if (!deepEqual(latestMiddleware, middleware)) {
|
|
43224
43334
|
setLatestMiddleware(middleware);
|
|
43225
43335
|
}
|
|
43226
|
-
const [_reference, _setReference] =
|
|
43227
|
-
const [_floating, _setFloating] =
|
|
43228
|
-
const setReference =
|
|
43336
|
+
const [_reference, _setReference] = React27.useState(null);
|
|
43337
|
+
const [_floating, _setFloating] = React27.useState(null);
|
|
43338
|
+
const setReference = React27.useCallback((node) => {
|
|
43229
43339
|
if (node !== referenceRef.current) {
|
|
43230
43340
|
referenceRef.current = node;
|
|
43231
43341
|
_setReference(node);
|
|
43232
43342
|
}
|
|
43233
43343
|
}, []);
|
|
43234
|
-
const setFloating =
|
|
43344
|
+
const setFloating = React27.useCallback((node) => {
|
|
43235
43345
|
if (node !== floatingRef.current) {
|
|
43236
43346
|
floatingRef.current = node;
|
|
43237
43347
|
_setFloating(node);
|
|
@@ -43239,14 +43349,14 @@ function useFloating(options) {
|
|
|
43239
43349
|
}, []);
|
|
43240
43350
|
const referenceEl = externalReference || _reference;
|
|
43241
43351
|
const floatingEl = externalFloating || _floating;
|
|
43242
|
-
const referenceRef =
|
|
43243
|
-
const floatingRef =
|
|
43244
|
-
const dataRef =
|
|
43352
|
+
const referenceRef = React27.useRef(null);
|
|
43353
|
+
const floatingRef = React27.useRef(null);
|
|
43354
|
+
const dataRef = React27.useRef(data);
|
|
43245
43355
|
const hasWhileElementsMounted = whileElementsMounted != null;
|
|
43246
43356
|
const whileElementsMountedRef = useLatestRef(whileElementsMounted);
|
|
43247
43357
|
const platformRef = useLatestRef(platform2);
|
|
43248
43358
|
const openRef = useLatestRef(open);
|
|
43249
|
-
const update =
|
|
43359
|
+
const update = React27.useCallback(() => {
|
|
43250
43360
|
if (!referenceRef.current || !floatingRef.current) {
|
|
43251
43361
|
return;
|
|
43252
43362
|
}
|
|
@@ -43284,7 +43394,7 @@ function useFloating(options) {
|
|
|
43284
43394
|
}));
|
|
43285
43395
|
}
|
|
43286
43396
|
}, [open]);
|
|
43287
|
-
const isMountedRef =
|
|
43397
|
+
const isMountedRef = React27.useRef(false);
|
|
43288
43398
|
index(() => {
|
|
43289
43399
|
isMountedRef.current = true;
|
|
43290
43400
|
return () => {
|
|
@@ -43301,17 +43411,17 @@ function useFloating(options) {
|
|
|
43301
43411
|
update();
|
|
43302
43412
|
}
|
|
43303
43413
|
}, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
|
|
43304
|
-
const refs =
|
|
43414
|
+
const refs = React27.useMemo(() => ({
|
|
43305
43415
|
reference: referenceRef,
|
|
43306
43416
|
floating: floatingRef,
|
|
43307
43417
|
setReference,
|
|
43308
43418
|
setFloating
|
|
43309
43419
|
}), [setReference, setFloating]);
|
|
43310
|
-
const elements =
|
|
43420
|
+
const elements = React27.useMemo(() => ({
|
|
43311
43421
|
reference: referenceEl,
|
|
43312
43422
|
floating: floatingEl
|
|
43313
43423
|
}), [referenceEl, floatingEl]);
|
|
43314
|
-
const floatingStyles =
|
|
43424
|
+
const floatingStyles = React27.useMemo(() => {
|
|
43315
43425
|
const initialStyles = {
|
|
43316
43426
|
position: strategy,
|
|
43317
43427
|
left: 0,
|
|
@@ -43337,7 +43447,7 @@ function useFloating(options) {
|
|
|
43337
43447
|
top: y
|
|
43338
43448
|
};
|
|
43339
43449
|
}, [strategy, transform, elements.floating, data.x, data.y]);
|
|
43340
|
-
return
|
|
43450
|
+
return React27.useMemo(() => ({
|
|
43341
43451
|
...data,
|
|
43342
43452
|
update,
|
|
43343
43453
|
refs,
|
|
@@ -43433,11 +43543,11 @@ var arrow3 = (options, deps) => {
|
|
|
43433
43543
|
};
|
|
43434
43544
|
|
|
43435
43545
|
// node_modules/@radix-ui/react-use-size/dist/index.mjs
|
|
43436
|
-
import * as
|
|
43546
|
+
import * as React28 from "react";
|
|
43437
43547
|
var __defProp17 = Object.defineProperty;
|
|
43438
43548
|
var __name15 = (target, value) => __defProp17(target, "name", { value, configurable: true });
|
|
43439
43549
|
function useSize(element) {
|
|
43440
|
-
const [size4, setSize] =
|
|
43550
|
+
const [size4, setSize] = React28.useState(void 0);
|
|
43441
43551
|
useLayoutEffect2(() => {
|
|
43442
43552
|
if (element) {
|
|
43443
43553
|
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
@@ -43481,8 +43591,8 @@ var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
|
43481
43591
|
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
43482
43592
|
var Popper = /* @__PURE__ */ __name16((props) => {
|
|
43483
43593
|
const { __scopePopper, children } = props;
|
|
43484
|
-
const [anchor, setAnchor] =
|
|
43485
|
-
const [placementState, setPlacementState] =
|
|
43594
|
+
const [anchor, setAnchor] = React29.useState(null);
|
|
43595
|
+
const [placementState, setPlacementState] = React29.useState(void 0);
|
|
43486
43596
|
return /* @__PURE__ */ jsx27(
|
|
43487
43597
|
PopperProvider,
|
|
43488
43598
|
{
|
|
@@ -43496,13 +43606,13 @@ var Popper = /* @__PURE__ */ __name16((props) => {
|
|
|
43496
43606
|
);
|
|
43497
43607
|
}, "Popper");
|
|
43498
43608
|
var ANCHOR_NAME = "PopperAnchor";
|
|
43499
|
-
var PopperAnchor = /* @__PURE__ */
|
|
43609
|
+
var PopperAnchor = /* @__PURE__ */ React29.forwardRef(
|
|
43500
43610
|
/* @__PURE__ */ __name16(function PopperAnchor2(props, forwardedRef) {
|
|
43501
43611
|
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
43502
43612
|
const context = usePopperContext(ANCHOR_NAME, __scopePopper);
|
|
43503
|
-
const ref =
|
|
43613
|
+
const ref = React29.useRef(null);
|
|
43504
43614
|
const onAnchorChange = context.onAnchorChange;
|
|
43505
|
-
const callbackRef =
|
|
43615
|
+
const callbackRef = React29.useCallback(
|
|
43506
43616
|
(node) => {
|
|
43507
43617
|
ref.current = node;
|
|
43508
43618
|
if (node) {
|
|
@@ -43512,8 +43622,8 @@ var PopperAnchor = /* @__PURE__ */ React28.forwardRef(
|
|
|
43512
43622
|
[onAnchorChange]
|
|
43513
43623
|
);
|
|
43514
43624
|
const composedRefs = useComposedRefs(forwardedRef, callbackRef);
|
|
43515
|
-
const anchorRef =
|
|
43516
|
-
|
|
43625
|
+
const anchorRef = React29.useRef(null);
|
|
43626
|
+
React29.useEffect(() => {
|
|
43517
43627
|
if (!virtualRef) {
|
|
43518
43628
|
return;
|
|
43519
43629
|
}
|
|
@@ -43539,7 +43649,7 @@ var PopperAnchor = /* @__PURE__ */ React28.forwardRef(
|
|
|
43539
43649
|
);
|
|
43540
43650
|
var CONTENT_NAME = "PopperContent";
|
|
43541
43651
|
var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME);
|
|
43542
|
-
var PopperContent = /* @__PURE__ */
|
|
43652
|
+
var PopperContent = /* @__PURE__ */ React29.forwardRef(
|
|
43543
43653
|
/* @__PURE__ */ __name16(function PopperContent2(props, forwardedRef) {
|
|
43544
43654
|
const {
|
|
43545
43655
|
__scopePopper,
|
|
@@ -43558,9 +43668,9 @@ var PopperContent = /* @__PURE__ */ React28.forwardRef(
|
|
|
43558
43668
|
...contentProps
|
|
43559
43669
|
} = props;
|
|
43560
43670
|
const context = usePopperContext(CONTENT_NAME, __scopePopper);
|
|
43561
|
-
const [content, setContent] =
|
|
43671
|
+
const [content, setContent] = React29.useState(null);
|
|
43562
43672
|
const composedRefs = useComposedRefs(forwardedRef, setContent);
|
|
43563
|
-
const [arrow4, setArrow] =
|
|
43673
|
+
const [arrow4, setArrow] = React29.useState(null);
|
|
43564
43674
|
const arrowSize = useSize(arrow4);
|
|
43565
43675
|
const arrowWidth = arrowSize?.width ?? 0;
|
|
43566
43676
|
const arrowHeight = arrowSize?.height ?? 0;
|
|
@@ -43640,7 +43750,7 @@ var PopperContent = /* @__PURE__ */ React28.forwardRef(
|
|
|
43640
43750
|
const arrowX = middlewareData.arrow?.x;
|
|
43641
43751
|
const arrowY = middlewareData.arrow?.y;
|
|
43642
43752
|
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
43643
|
-
const [contentZIndex, setContentZIndex] =
|
|
43753
|
+
const [contentZIndex, setContentZIndex] = React29.useState();
|
|
43644
43754
|
useLayoutEffect2(() => {
|
|
43645
43755
|
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
43646
43756
|
}, [content]);
|
|
@@ -43745,15 +43855,15 @@ var Anchor = PopperAnchor;
|
|
|
43745
43855
|
var Content = PopperContent;
|
|
43746
43856
|
|
|
43747
43857
|
// node_modules/@radix-ui/react-portal/dist/index.mjs
|
|
43748
|
-
import * as
|
|
43858
|
+
import * as React30 from "react";
|
|
43749
43859
|
import * as ReactDOM4 from "react-dom";
|
|
43750
43860
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
43751
43861
|
var __defProp19 = Object.defineProperty;
|
|
43752
43862
|
var __name17 = (target, value) => __defProp19(target, "name", { value, configurable: true });
|
|
43753
|
-
var Portal = /* @__PURE__ */
|
|
43863
|
+
var Portal = /* @__PURE__ */ React30.forwardRef(
|
|
43754
43864
|
/* @__PURE__ */ __name17(function Portal2(props, forwardedRef) {
|
|
43755
43865
|
const { container: containerProp, ...portalProps } = props;
|
|
43756
|
-
const [mounted, setMounted] =
|
|
43866
|
+
const [mounted, setMounted] = React30.useState(false);
|
|
43757
43867
|
useLayoutEffect2(() => setMounted(true), []);
|
|
43758
43868
|
const container = containerProp || mounted && globalThis?.document?.body;
|
|
43759
43869
|
return container ? ReactDOM4.createPortal(/* @__PURE__ */ jsx28(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
@@ -43762,11 +43872,11 @@ var Portal = /* @__PURE__ */ React29.forwardRef(
|
|
|
43762
43872
|
|
|
43763
43873
|
// node_modules/@radix-ui/react-presence/dist/index.mjs
|
|
43764
43874
|
import * as React210 from "react";
|
|
43765
|
-
import * as
|
|
43875
|
+
import * as React31 from "react";
|
|
43766
43876
|
var __defProp20 = Object.defineProperty;
|
|
43767
43877
|
var __name18 = (target, value) => __defProp20(target, "name", { value, configurable: true });
|
|
43768
43878
|
function useStateMachine(initialState, machine) {
|
|
43769
|
-
return
|
|
43879
|
+
return React31.useReducer((state, event) => {
|
|
43770
43880
|
const nextState = machine[state][event];
|
|
43771
43881
|
return nextState ?? state;
|
|
43772
43882
|
}, initialState);
|
|
@@ -43940,17 +44050,17 @@ function getElementRef2(element) {
|
|
|
43940
44050
|
__name18(getElementRef2, "getElementRef");
|
|
43941
44051
|
|
|
43942
44052
|
// node_modules/@radix-ui/react-roving-focus/dist/index.mjs
|
|
43943
|
-
import * as
|
|
44053
|
+
import * as React33 from "react";
|
|
43944
44054
|
|
|
43945
44055
|
// node_modules/@radix-ui/react-use-is-hydrated/dist/index.mjs
|
|
43946
44056
|
import * as React211 from "react";
|
|
43947
|
-
import * as
|
|
44057
|
+
import * as React32 from "react";
|
|
43948
44058
|
var __defProp21 = Object.defineProperty;
|
|
43949
44059
|
var __name19 = (target, value) => __defProp21(target, "name", { value, configurable: true });
|
|
43950
44060
|
var _isHydrated = false;
|
|
43951
44061
|
function useIsHydrated() {
|
|
43952
|
-
const [isHydrated, setIsHydrated] =
|
|
43953
|
-
|
|
44062
|
+
const [isHydrated, setIsHydrated] = React32.useState(_isHydrated);
|
|
44063
|
+
React32.useEffect(() => {
|
|
43954
44064
|
if (!_isHydrated) {
|
|
43955
44065
|
_isHydrated = true;
|
|
43956
44066
|
setIsHydrated(true);
|
|
@@ -43988,13 +44098,13 @@ var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContext
|
|
|
43988
44098
|
[createCollectionScope]
|
|
43989
44099
|
);
|
|
43990
44100
|
var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);
|
|
43991
|
-
var RovingFocusGroup = /* @__PURE__ */
|
|
44101
|
+
var RovingFocusGroup = /* @__PURE__ */ React33.forwardRef(
|
|
43992
44102
|
// blank line to reduce diff noise
|
|
43993
44103
|
/* @__PURE__ */ __name20(function RovingFocusGroup2(props, forwardedRef) {
|
|
43994
44104
|
return /* @__PURE__ */ jsx29(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx29(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx29(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });
|
|
43995
44105
|
}, "RovingFocusGroup")
|
|
43996
44106
|
);
|
|
43997
|
-
var RovingFocusGroupImpl = /* @__PURE__ */
|
|
44107
|
+
var RovingFocusGroupImpl = /* @__PURE__ */ React33.forwardRef(/* @__PURE__ */ __name20(function RovingFocusGroupImpl2(props, forwardedRef) {
|
|
43998
44108
|
const {
|
|
43999
44109
|
__scopeRovingFocusGroup,
|
|
44000
44110
|
orientation: orientation2,
|
|
@@ -44007,7 +44117,7 @@ var RovingFocusGroupImpl = /* @__PURE__ */ React32.forwardRef(/* @__PURE__ */ __
|
|
|
44007
44117
|
preventScrollOnEntryFocus = false,
|
|
44008
44118
|
...groupProps
|
|
44009
44119
|
} = props;
|
|
44010
|
-
const ref =
|
|
44120
|
+
const ref = React33.useRef(null);
|
|
44011
44121
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
44012
44122
|
const direction = useDirection(dir);
|
|
44013
44123
|
const [currentTabStopId, setCurrentTabStopId] = useControllableState({
|
|
@@ -44016,12 +44126,12 @@ var RovingFocusGroupImpl = /* @__PURE__ */ React32.forwardRef(/* @__PURE__ */ __
|
|
|
44016
44126
|
onChange: onCurrentTabStopIdChange,
|
|
44017
44127
|
caller: GROUP_NAME
|
|
44018
44128
|
});
|
|
44019
|
-
const [isTabbingBackOut, setIsTabbingBackOut] =
|
|
44129
|
+
const [isTabbingBackOut, setIsTabbingBackOut] = React33.useState(false);
|
|
44020
44130
|
const handleEntryFocus = useCallbackRef(onEntryFocus);
|
|
44021
44131
|
const getItems = useCollection(__scopeRovingFocusGroup);
|
|
44022
|
-
const isClickFocusRef =
|
|
44023
|
-
const [focusableItemsCount, setFocusableItemsCount] =
|
|
44024
|
-
|
|
44132
|
+
const isClickFocusRef = React33.useRef(false);
|
|
44133
|
+
const [focusableItemsCount, setFocusableItemsCount] = React33.useState(0);
|
|
44134
|
+
React33.useEffect(() => {
|
|
44025
44135
|
const node = ref.current;
|
|
44026
44136
|
if (node) {
|
|
44027
44137
|
node.addEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
@@ -44036,16 +44146,16 @@ var RovingFocusGroupImpl = /* @__PURE__ */ React32.forwardRef(/* @__PURE__ */ __
|
|
|
44036
44146
|
dir: direction,
|
|
44037
44147
|
loop,
|
|
44038
44148
|
currentTabStopId,
|
|
44039
|
-
onItemFocus:
|
|
44149
|
+
onItemFocus: React33.useCallback(
|
|
44040
44150
|
(tabStopId) => setCurrentTabStopId(tabStopId),
|
|
44041
44151
|
[setCurrentTabStopId]
|
|
44042
44152
|
),
|
|
44043
|
-
onItemShiftTab:
|
|
44044
|
-
onFocusableItemAdd:
|
|
44153
|
+
onItemShiftTab: React33.useCallback(() => setIsTabbingBackOut(true), []),
|
|
44154
|
+
onFocusableItemAdd: React33.useCallback(
|
|
44045
44155
|
() => setFocusableItemsCount((prevCount) => prevCount + 1),
|
|
44046
44156
|
[]
|
|
44047
44157
|
),
|
|
44048
|
-
onFocusableItemRemove:
|
|
44158
|
+
onFocusableItemRemove: React33.useCallback(
|
|
44049
44159
|
() => setFocusableItemsCount((prevCount) => prevCount - 1),
|
|
44050
44160
|
[]
|
|
44051
44161
|
),
|
|
@@ -44085,7 +44195,7 @@ var RovingFocusGroupImpl = /* @__PURE__ */ React32.forwardRef(/* @__PURE__ */ __
|
|
|
44085
44195
|
);
|
|
44086
44196
|
}, "RovingFocusGroupImpl"));
|
|
44087
44197
|
var ITEM_NAME = "RovingFocusGroupItem";
|
|
44088
|
-
var RovingFocusGroupItem = /* @__PURE__ */
|
|
44198
|
+
var RovingFocusGroupItem = /* @__PURE__ */ React33.forwardRef(
|
|
44089
44199
|
// blank line to reduce diff noise
|
|
44090
44200
|
/* @__PURE__ */ __name20(function RovingFocusGroupItem2(props, forwardedRef) {
|
|
44091
44201
|
const {
|
|
@@ -44110,7 +44220,7 @@ var RovingFocusGroupItem = /* @__PURE__ */ React32.forwardRef(
|
|
|
44110
44220
|
onFocusableItemAdd();
|
|
44111
44221
|
return () => onFocusableItemRemove();
|
|
44112
44222
|
}, [isHydrated, focusable, onFocusableItemAdd, onFocusableItemRemove]);
|
|
44113
|
-
|
|
44223
|
+
React33.useEffect(() => {
|
|
44114
44224
|
if (isHydrated || !focusable) {
|
|
44115
44225
|
return;
|
|
44116
44226
|
}
|
|
@@ -44356,10 +44466,10 @@ function __spreadArray(to, from, pack) {
|
|
|
44356
44466
|
}
|
|
44357
44467
|
|
|
44358
44468
|
// node_modules/react-remove-scroll/dist/es2015/Combination.js
|
|
44359
|
-
import * as
|
|
44469
|
+
import * as React40 from "react";
|
|
44360
44470
|
|
|
44361
44471
|
// node_modules/react-remove-scroll/dist/es2015/UI.js
|
|
44362
|
-
import * as
|
|
44472
|
+
import * as React36 from "react";
|
|
44363
44473
|
|
|
44364
44474
|
// node_modules/react-remove-scroll-bar/dist/es2015/constants.js
|
|
44365
44475
|
var zeroRightClassName = "right-scroll-bar-position";
|
|
@@ -44406,8 +44516,8 @@ function useCallbackRef2(initialValue, callback) {
|
|
|
44406
44516
|
}
|
|
44407
44517
|
|
|
44408
44518
|
// node_modules/use-callback-ref/dist/es2015/useMergeRef.js
|
|
44409
|
-
import * as
|
|
44410
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ?
|
|
44519
|
+
import * as React34 from "react";
|
|
44520
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React34.useLayoutEffect : React34.useEffect;
|
|
44411
44521
|
var currentValues = /* @__PURE__ */ new WeakMap();
|
|
44412
44522
|
function useMergeRefs(refs, defaultValue) {
|
|
44413
44523
|
var callbackRef = useCallbackRef2(defaultValue || null, function(newValue) {
|
|
@@ -44524,7 +44634,7 @@ function createSidecarMedium(options) {
|
|
|
44524
44634
|
}
|
|
44525
44635
|
|
|
44526
44636
|
// node_modules/use-sidecar/dist/es2015/exports.js
|
|
44527
|
-
import * as
|
|
44637
|
+
import * as React35 from "react";
|
|
44528
44638
|
var SideCar = function(_a) {
|
|
44529
44639
|
var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
|
|
44530
44640
|
if (!sideCar) {
|
|
@@ -44534,7 +44644,7 @@ var SideCar = function(_a) {
|
|
|
44534
44644
|
if (!Target) {
|
|
44535
44645
|
throw new Error("Sidecar medium not found");
|
|
44536
44646
|
}
|
|
44537
|
-
return
|
|
44647
|
+
return React35.createElement(Target, __assign({}, rest));
|
|
44538
44648
|
};
|
|
44539
44649
|
SideCar.isSideCarExport = true;
|
|
44540
44650
|
function exportSidecar(medium, exported) {
|
|
@@ -44549,9 +44659,9 @@ var effectCar = createSidecarMedium();
|
|
|
44549
44659
|
var nothing = function() {
|
|
44550
44660
|
return;
|
|
44551
44661
|
};
|
|
44552
|
-
var RemoveScroll =
|
|
44553
|
-
var ref =
|
|
44554
|
-
var _a =
|
|
44662
|
+
var RemoveScroll = React36.forwardRef(function(props, parentRef) {
|
|
44663
|
+
var ref = React36.useRef(null);
|
|
44664
|
+
var _a = React36.useState({
|
|
44555
44665
|
onScrollCapture: nothing,
|
|
44556
44666
|
onWheelCapture: nothing,
|
|
44557
44667
|
onTouchMoveCapture: nothing
|
|
@@ -44560,11 +44670,11 @@ var RemoveScroll = React35.forwardRef(function(props, parentRef) {
|
|
|
44560
44670
|
var SideCar2 = sideCar;
|
|
44561
44671
|
var containerRef = useMergeRefs([ref, parentRef]);
|
|
44562
44672
|
var containerProps = __assign(__assign({}, rest), callbacks);
|
|
44563
|
-
return
|
|
44564
|
-
|
|
44673
|
+
return React36.createElement(
|
|
44674
|
+
React36.Fragment,
|
|
44565
44675
|
null,
|
|
44566
|
-
enabled &&
|
|
44567
|
-
forwardProps ?
|
|
44676
|
+
enabled && React36.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noRelative, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
|
|
44677
|
+
forwardProps ? React36.cloneElement(React36.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React36.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
|
|
44568
44678
|
);
|
|
44569
44679
|
});
|
|
44570
44680
|
RemoveScroll.defaultProps = {
|
|
@@ -44578,13 +44688,13 @@ RemoveScroll.classNames = {
|
|
|
44578
44688
|
};
|
|
44579
44689
|
|
|
44580
44690
|
// node_modules/react-remove-scroll/dist/es2015/SideEffect.js
|
|
44581
|
-
import * as
|
|
44691
|
+
import * as React39 from "react";
|
|
44582
44692
|
|
|
44583
44693
|
// node_modules/react-remove-scroll-bar/dist/es2015/component.js
|
|
44584
|
-
import * as
|
|
44694
|
+
import * as React38 from "react";
|
|
44585
44695
|
|
|
44586
44696
|
// node_modules/react-style-singleton/dist/es2015/hook.js
|
|
44587
|
-
import * as
|
|
44697
|
+
import * as React37 from "react";
|
|
44588
44698
|
|
|
44589
44699
|
// node_modules/get-nonce/dist/es2015/index.js
|
|
44590
44700
|
var currentNonce;
|
|
@@ -44648,7 +44758,7 @@ var stylesheetSingleton = function() {
|
|
|
44648
44758
|
var styleHookSingleton = function() {
|
|
44649
44759
|
var sheet = stylesheetSingleton();
|
|
44650
44760
|
return function(styles, isDynamic) {
|
|
44651
|
-
|
|
44761
|
+
React37.useEffect(function() {
|
|
44652
44762
|
sheet.add(styles);
|
|
44653
44763
|
return function() {
|
|
44654
44764
|
sheet.remove();
|
|
@@ -44722,7 +44832,7 @@ var getCurrentUseCounter = function() {
|
|
|
44722
44832
|
return isFinite(counter) ? counter : 0;
|
|
44723
44833
|
};
|
|
44724
44834
|
var useLockAttribute = function() {
|
|
44725
|
-
|
|
44835
|
+
React38.useEffect(function() {
|
|
44726
44836
|
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
44727
44837
|
return function() {
|
|
44728
44838
|
var newCounter = getCurrentUseCounter() - 1;
|
|
@@ -44737,10 +44847,10 @@ var useLockAttribute = function() {
|
|
|
44737
44847
|
var RemoveScrollBar = function(_a) {
|
|
44738
44848
|
var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
|
|
44739
44849
|
useLockAttribute();
|
|
44740
|
-
var gap =
|
|
44850
|
+
var gap = React38.useMemo(function() {
|
|
44741
44851
|
return getGapWidth(gapMode);
|
|
44742
44852
|
}, [gapMode]);
|
|
44743
|
-
return
|
|
44853
|
+
return React38.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
|
|
44744
44854
|
};
|
|
44745
44855
|
|
|
44746
44856
|
// node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js
|
|
@@ -44881,16 +44991,16 @@ var generateStyle = function(id) {
|
|
|
44881
44991
|
var idCounter = 0;
|
|
44882
44992
|
var lockStack = [];
|
|
44883
44993
|
function RemoveScrollSideCar(props) {
|
|
44884
|
-
var shouldPreventQueue =
|
|
44885
|
-
var touchStartRef =
|
|
44886
|
-
var activeAxis =
|
|
44887
|
-
var id =
|
|
44888
|
-
var Style2 =
|
|
44889
|
-
var lastProps =
|
|
44890
|
-
|
|
44994
|
+
var shouldPreventQueue = React39.useRef([]);
|
|
44995
|
+
var touchStartRef = React39.useRef([0, 0]);
|
|
44996
|
+
var activeAxis = React39.useRef();
|
|
44997
|
+
var id = React39.useState(idCounter++)[0];
|
|
44998
|
+
var Style2 = React39.useState(styleSingleton)[0];
|
|
44999
|
+
var lastProps = React39.useRef(props);
|
|
45000
|
+
React39.useEffect(function() {
|
|
44891
45001
|
lastProps.current = props;
|
|
44892
45002
|
}, [props]);
|
|
44893
|
-
|
|
45003
|
+
React39.useEffect(function() {
|
|
44894
45004
|
if (props.inert) {
|
|
44895
45005
|
document.body.classList.add("block-interactivity-".concat(id));
|
|
44896
45006
|
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
|
|
@@ -44906,7 +45016,7 @@ function RemoveScrollSideCar(props) {
|
|
|
44906
45016
|
}
|
|
44907
45017
|
return;
|
|
44908
45018
|
}, [props.inert, props.lockRef.current, props.shards]);
|
|
44909
|
-
var shouldCancelEvent =
|
|
45019
|
+
var shouldCancelEvent = React39.useCallback(function(event, parent) {
|
|
44910
45020
|
if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
|
|
44911
45021
|
return !lastProps.current.allowPinchZoom;
|
|
44912
45022
|
}
|
|
@@ -44948,7 +45058,7 @@ function RemoveScrollSideCar(props) {
|
|
|
44948
45058
|
var cancelingAxis = activeAxis.current || currentAxis;
|
|
44949
45059
|
return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY, true);
|
|
44950
45060
|
}, []);
|
|
44951
|
-
var shouldPrevent =
|
|
45061
|
+
var shouldPrevent = React39.useCallback(function(_event) {
|
|
44952
45062
|
var event = _event;
|
|
44953
45063
|
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
|
|
44954
45064
|
return;
|
|
@@ -44975,7 +45085,7 @@ function RemoveScrollSideCar(props) {
|
|
|
44975
45085
|
}
|
|
44976
45086
|
}
|
|
44977
45087
|
}, []);
|
|
44978
|
-
var shouldCancel =
|
|
45088
|
+
var shouldCancel = React39.useCallback(function(name, delta, target, should) {
|
|
44979
45089
|
var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
|
|
44980
45090
|
shouldPreventQueue.current.push(event);
|
|
44981
45091
|
setTimeout(function() {
|
|
@@ -44984,17 +45094,17 @@ function RemoveScrollSideCar(props) {
|
|
|
44984
45094
|
});
|
|
44985
45095
|
}, 1);
|
|
44986
45096
|
}, []);
|
|
44987
|
-
var scrollTouchStart =
|
|
45097
|
+
var scrollTouchStart = React39.useCallback(function(event) {
|
|
44988
45098
|
touchStartRef.current = getTouchXY(event);
|
|
44989
45099
|
activeAxis.current = void 0;
|
|
44990
45100
|
}, []);
|
|
44991
|
-
var scrollWheel =
|
|
45101
|
+
var scrollWheel = React39.useCallback(function(event) {
|
|
44992
45102
|
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
44993
45103
|
}, []);
|
|
44994
|
-
var scrollTouchMove =
|
|
45104
|
+
var scrollTouchMove = React39.useCallback(function(event) {
|
|
44995
45105
|
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
44996
45106
|
}, []);
|
|
44997
|
-
|
|
45107
|
+
React39.useEffect(function() {
|
|
44998
45108
|
lockStack.push(Style2);
|
|
44999
45109
|
props.setCallbacks({
|
|
45000
45110
|
onScrollCapture: scrollWheel,
|
|
@@ -45014,11 +45124,11 @@ function RemoveScrollSideCar(props) {
|
|
|
45014
45124
|
};
|
|
45015
45125
|
}, []);
|
|
45016
45126
|
var removeScrollBar = props.removeScrollBar, inert = props.inert;
|
|
45017
|
-
return
|
|
45018
|
-
|
|
45127
|
+
return React39.createElement(
|
|
45128
|
+
React39.Fragment,
|
|
45019
45129
|
null,
|
|
45020
|
-
inert ?
|
|
45021
|
-
removeScrollBar ?
|
|
45130
|
+
inert ? React39.createElement(Style2, { styles: generateStyle(id) }) : null,
|
|
45131
|
+
removeScrollBar ? React39.createElement(RemoveScrollBar, { noRelative: props.noRelative, gapMode: props.gapMode }) : null
|
|
45022
45132
|
);
|
|
45023
45133
|
}
|
|
45024
45134
|
function getOutermostShadowParent(node) {
|
|
@@ -45037,8 +45147,8 @@ function getOutermostShadowParent(node) {
|
|
|
45037
45147
|
var sidecar_default = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
45038
45148
|
|
|
45039
45149
|
// node_modules/react-remove-scroll/dist/es2015/Combination.js
|
|
45040
|
-
var ReactRemoveScroll =
|
|
45041
|
-
return
|
|
45150
|
+
var ReactRemoveScroll = React40.forwardRef(function(props, ref) {
|
|
45151
|
+
return React40.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: sidecar_default }));
|
|
45042
45152
|
});
|
|
45043
45153
|
ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
45044
45154
|
var Combination_default = ReactRemoveScroll;
|
|
@@ -45073,11 +45183,11 @@ var [MenuRootProvider, useMenuRootContext] = createMenuContext(MENU_NAME);
|
|
|
45073
45183
|
var Menu = /* @__PURE__ */ __name21((props) => {
|
|
45074
45184
|
const { __scopeMenu, open = false, children, dir, onOpenChange, modal = true } = props;
|
|
45075
45185
|
const popperScope = usePopperScope(__scopeMenu);
|
|
45076
|
-
const [content, setContent] =
|
|
45077
|
-
const isUsingKeyboardRef =
|
|
45186
|
+
const [content, setContent] = React41.useState(null);
|
|
45187
|
+
const isUsingKeyboardRef = React41.useRef(false);
|
|
45078
45188
|
const handleOpenChange = useCallbackRef(onOpenChange);
|
|
45079
45189
|
const direction = useDirection(dir);
|
|
45080
|
-
|
|
45190
|
+
React41.useEffect(() => {
|
|
45081
45191
|
const handleKeyDown = /* @__PURE__ */ __name21(() => {
|
|
45082
45192
|
isUsingKeyboardRef.current = true;
|
|
45083
45193
|
document.addEventListener("pointerdown", handlePointer, { capture: true, once: true });
|
|
@@ -45091,7 +45201,7 @@ var Menu = /* @__PURE__ */ __name21((props) => {
|
|
|
45091
45201
|
document.removeEventListener("pointermove", handlePointer, { capture: true });
|
|
45092
45202
|
};
|
|
45093
45203
|
}, []);
|
|
45094
|
-
|
|
45204
|
+
React41.useEffect(() => {
|
|
45095
45205
|
if (!open) {
|
|
45096
45206
|
return;
|
|
45097
45207
|
}
|
|
@@ -45111,7 +45221,7 @@ var Menu = /* @__PURE__ */ __name21((props) => {
|
|
|
45111
45221
|
MenuRootProvider,
|
|
45112
45222
|
{
|
|
45113
45223
|
scope: __scopeMenu,
|
|
45114
|
-
onClose:
|
|
45224
|
+
onClose: React41.useCallback(() => handleOpenChange(false), [handleOpenChange]),
|
|
45115
45225
|
isUsingKeyboardRef,
|
|
45116
45226
|
dir: direction,
|
|
45117
45227
|
modal,
|
|
@@ -45121,7 +45231,7 @@ var Menu = /* @__PURE__ */ __name21((props) => {
|
|
|
45121
45231
|
}
|
|
45122
45232
|
) });
|
|
45123
45233
|
}, "Menu");
|
|
45124
|
-
var MenuAnchor = /* @__PURE__ */
|
|
45234
|
+
var MenuAnchor = /* @__PURE__ */ React41.forwardRef(
|
|
45125
45235
|
/* @__PURE__ */ __name21(function MenuAnchor2(props, forwardedRef) {
|
|
45126
45236
|
const { __scopeMenu, ...anchorProps } = props;
|
|
45127
45237
|
const popperScope = usePopperScope(__scopeMenu);
|
|
@@ -45139,7 +45249,7 @@ var MenuPortal = /* @__PURE__ */ __name21((props) => {
|
|
|
45139
45249
|
}, "MenuPortal");
|
|
45140
45250
|
var CONTENT_NAME2 = "MenuContent";
|
|
45141
45251
|
var [MenuContentProvider, useMenuContentContext] = createMenuContext(CONTENT_NAME2);
|
|
45142
|
-
var MenuContent = /* @__PURE__ */
|
|
45252
|
+
var MenuContent = /* @__PURE__ */ React41.forwardRef(
|
|
45143
45253
|
/* @__PURE__ */ __name21(function MenuContent2(props, forwardedRef) {
|
|
45144
45254
|
const portalContext = usePortalContext(CONTENT_NAME2, props.__scopeMenu);
|
|
45145
45255
|
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
@@ -45148,13 +45258,13 @@ var MenuContent = /* @__PURE__ */ React40.forwardRef(
|
|
|
45148
45258
|
return /* @__PURE__ */ jsx30(Collection2.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx30(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx30(Collection2.Slot, { scope: props.__scopeMenu, children: rootContext.modal ? /* @__PURE__ */ jsx30(MenuRootContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx30(MenuRootContentNonModal, { ...contentProps, ref: forwardedRef }) }) }) });
|
|
45149
45259
|
}, "MenuContent")
|
|
45150
45260
|
);
|
|
45151
|
-
var MenuRootContentModal = /* @__PURE__ */
|
|
45261
|
+
var MenuRootContentModal = /* @__PURE__ */ React41.forwardRef(
|
|
45152
45262
|
// blank line to reduce diff noise
|
|
45153
45263
|
/* @__PURE__ */ __name21(function MenuRootContentModal2(props, forwardedRef) {
|
|
45154
45264
|
const context = useMenuContext(CONTENT_NAME2, props.__scopeMenu);
|
|
45155
|
-
const ref =
|
|
45265
|
+
const ref = React41.useRef(null);
|
|
45156
45266
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
45157
|
-
|
|
45267
|
+
React41.useEffect(() => {
|
|
45158
45268
|
const content = ref.current;
|
|
45159
45269
|
if (content) return hideOthers(content);
|
|
45160
45270
|
}, []);
|
|
@@ -45176,7 +45286,7 @@ var MenuRootContentModal = /* @__PURE__ */ React40.forwardRef(
|
|
|
45176
45286
|
);
|
|
45177
45287
|
}, "MenuRootContentModal")
|
|
45178
45288
|
);
|
|
45179
|
-
var MenuRootContentNonModal = /* @__PURE__ */
|
|
45289
|
+
var MenuRootContentNonModal = /* @__PURE__ */ React41.forwardRef(/* @__PURE__ */ __name21(function MenuRootContentNonModal2(props, forwardedRef) {
|
|
45180
45290
|
const context = useMenuContext(CONTENT_NAME2, props.__scopeMenu);
|
|
45181
45291
|
return /* @__PURE__ */ jsx30(
|
|
45182
45292
|
MenuContentImpl,
|
|
@@ -45191,7 +45301,7 @@ var MenuRootContentNonModal = /* @__PURE__ */ React40.forwardRef(/* @__PURE__ */
|
|
|
45191
45301
|
);
|
|
45192
45302
|
}, "MenuRootContentNonModal"));
|
|
45193
45303
|
var Slot = createSlot("MenuContent.ScrollLock");
|
|
45194
|
-
var MenuContentImpl = /* @__PURE__ */
|
|
45304
|
+
var MenuContentImpl = /* @__PURE__ */ React41.forwardRef(
|
|
45195
45305
|
// blank line to reduce diff noise
|
|
45196
45306
|
/* @__PURE__ */ __name21(function MenuContentImpl2(props, forwardedRef) {
|
|
45197
45307
|
const {
|
|
@@ -45215,16 +45325,16 @@ var MenuContentImpl = /* @__PURE__ */ React40.forwardRef(
|
|
|
45215
45325
|
const popperScope = usePopperScope(__scopeMenu);
|
|
45216
45326
|
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);
|
|
45217
45327
|
const getItems = useCollection2(__scopeMenu);
|
|
45218
|
-
const [currentItemId, setCurrentItemId] =
|
|
45219
|
-
const contentRef =
|
|
45328
|
+
const [currentItemId, setCurrentItemId] = React41.useState(null);
|
|
45329
|
+
const contentRef = React41.useRef(null);
|
|
45220
45330
|
const composedRefs = useComposedRefs(forwardedRef, contentRef, context.onContentChange);
|
|
45221
|
-
const timerRef =
|
|
45222
|
-
const searchRef =
|
|
45223
|
-
const pointerGraceTimerRef =
|
|
45224
|
-
const pointerGraceIntentRef =
|
|
45225
|
-
const pointerDirRef =
|
|
45226
|
-
const lastPointerXRef =
|
|
45227
|
-
const ScrollLockWrapper = disableOutsideScroll ? Combination_default :
|
|
45331
|
+
const timerRef = React41.useRef(0);
|
|
45332
|
+
const searchRef = React41.useRef("");
|
|
45333
|
+
const pointerGraceTimerRef = React41.useRef(0);
|
|
45334
|
+
const pointerGraceIntentRef = React41.useRef(null);
|
|
45335
|
+
const pointerDirRef = React41.useRef("right");
|
|
45336
|
+
const lastPointerXRef = React41.useRef(0);
|
|
45337
|
+
const ScrollLockWrapper = disableOutsideScroll ? Combination_default : React41.Fragment;
|
|
45228
45338
|
const scrollLockWrapperProps = disableOutsideScroll ? { as: Slot, allowPinchZoom: true } : void 0;
|
|
45229
45339
|
const handleTypeaheadSearch = /* @__PURE__ */ __name21((key) => {
|
|
45230
45340
|
const search = searchRef.current + key;
|
|
@@ -45243,11 +45353,11 @@ var MenuContentImpl = /* @__PURE__ */ React40.forwardRef(
|
|
|
45243
45353
|
setTimeout(() => newItem.focus());
|
|
45244
45354
|
}
|
|
45245
45355
|
}, "handleTypeaheadSearch");
|
|
45246
|
-
|
|
45356
|
+
React41.useEffect(() => {
|
|
45247
45357
|
return () => window.clearTimeout(timerRef.current);
|
|
45248
45358
|
}, []);
|
|
45249
45359
|
useFocusGuards();
|
|
45250
|
-
const isPointerMovingToSubmenu =
|
|
45360
|
+
const isPointerMovingToSubmenu = React41.useCallback((event) => {
|
|
45251
45361
|
const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side;
|
|
45252
45362
|
return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area);
|
|
45253
45363
|
}, []);
|
|
@@ -45256,13 +45366,13 @@ var MenuContentImpl = /* @__PURE__ */ React40.forwardRef(
|
|
|
45256
45366
|
{
|
|
45257
45367
|
scope: __scopeMenu,
|
|
45258
45368
|
searchRef,
|
|
45259
|
-
onItemEnter:
|
|
45369
|
+
onItemEnter: React41.useCallback(
|
|
45260
45370
|
(event) => {
|
|
45261
45371
|
if (isPointerMovingToSubmenu(event)) event.preventDefault();
|
|
45262
45372
|
},
|
|
45263
45373
|
[isPointerMovingToSubmenu]
|
|
45264
45374
|
),
|
|
45265
|
-
onItemLeave:
|
|
45375
|
+
onItemLeave: React41.useCallback(
|
|
45266
45376
|
(event) => {
|
|
45267
45377
|
if (isPointerMovingToSubmenu(event)) return;
|
|
45268
45378
|
contentRef.current?.focus();
|
|
@@ -45270,14 +45380,14 @@ var MenuContentImpl = /* @__PURE__ */ React40.forwardRef(
|
|
|
45270
45380
|
},
|
|
45271
45381
|
[isPointerMovingToSubmenu]
|
|
45272
45382
|
),
|
|
45273
|
-
onTriggerLeave:
|
|
45383
|
+
onTriggerLeave: React41.useCallback(
|
|
45274
45384
|
(event) => {
|
|
45275
45385
|
if (isPointerMovingToSubmenu(event)) event.preventDefault();
|
|
45276
45386
|
},
|
|
45277
45387
|
[isPointerMovingToSubmenu]
|
|
45278
45388
|
),
|
|
45279
45389
|
pointerGraceTimerRef,
|
|
45280
|
-
onPointerGraceIntentChange:
|
|
45390
|
+
onPointerGraceIntentChange: React41.useCallback((intent) => {
|
|
45281
45391
|
pointerGraceIntentRef.current = intent;
|
|
45282
45392
|
}, []),
|
|
45283
45393
|
children: /* @__PURE__ */ jsx30(ScrollLockWrapper, { ...scrollLockWrapperProps, children: /* @__PURE__ */ jsx30(
|
|
@@ -45376,15 +45486,15 @@ var MenuContentImpl = /* @__PURE__ */ React40.forwardRef(
|
|
|
45376
45486
|
);
|
|
45377
45487
|
var ITEM_NAME2 = "MenuItem";
|
|
45378
45488
|
var ITEM_SELECT = "menu.itemSelect";
|
|
45379
|
-
var MenuItem = /* @__PURE__ */
|
|
45489
|
+
var MenuItem = /* @__PURE__ */ React41.forwardRef(
|
|
45380
45490
|
// blank line to reduce diff noise
|
|
45381
45491
|
/* @__PURE__ */ __name21(function MenuItem2(props, forwardedRef) {
|
|
45382
45492
|
const { disabled = false, onSelect, ...itemProps } = props;
|
|
45383
|
-
const ref =
|
|
45493
|
+
const ref = React41.useRef(null);
|
|
45384
45494
|
const rootContext = useMenuRootContext(ITEM_NAME2, props.__scopeMenu);
|
|
45385
45495
|
const contentContext = useMenuContentContext(ITEM_NAME2, props.__scopeMenu);
|
|
45386
45496
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
45387
|
-
const isPointerDownRef =
|
|
45497
|
+
const isPointerDownRef = React41.useRef(false);
|
|
45388
45498
|
const handleSelect = /* @__PURE__ */ __name21(() => {
|
|
45389
45499
|
const menuItem = ref.current;
|
|
45390
45500
|
if (!disabled && menuItem) {
|
|
@@ -45429,16 +45539,16 @@ var MenuItem = /* @__PURE__ */ React40.forwardRef(
|
|
|
45429
45539
|
);
|
|
45430
45540
|
}, "MenuItem")
|
|
45431
45541
|
);
|
|
45432
|
-
var MenuItemImpl = /* @__PURE__ */
|
|
45542
|
+
var MenuItemImpl = /* @__PURE__ */ React41.forwardRef(
|
|
45433
45543
|
/* @__PURE__ */ __name21(function MenuItemImpl2(props, forwardedRef) {
|
|
45434
45544
|
const { __scopeMenu, disabled = false, textValue, ...itemProps } = props;
|
|
45435
45545
|
const contentContext = useMenuContentContext(ITEM_NAME2, __scopeMenu);
|
|
45436
45546
|
const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);
|
|
45437
|
-
const ref =
|
|
45547
|
+
const ref = React41.useRef(null);
|
|
45438
45548
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
45439
|
-
const [isFocused, setIsFocused] =
|
|
45440
|
-
const [textContent, setTextContent] =
|
|
45441
|
-
|
|
45549
|
+
const [isFocused, setIsFocused] = React41.useState(false);
|
|
45550
|
+
const [textContent, setTextContent] = React41.useState("");
|
|
45551
|
+
React41.useEffect(() => {
|
|
45442
45552
|
const menuItem = ref.current;
|
|
45443
45553
|
if (menuItem) {
|
|
45444
45554
|
setTextContent((menuItem.textContent ?? "").trim());
|
|
@@ -45496,7 +45606,7 @@ var [ItemIndicatorProvider, useItemIndicatorContext] = createMenuContext(
|
|
|
45496
45606
|
ITEM_INDICATOR_NAME,
|
|
45497
45607
|
{ checked: false }
|
|
45498
45608
|
);
|
|
45499
|
-
var MenuSeparator = /* @__PURE__ */
|
|
45609
|
+
var MenuSeparator = /* @__PURE__ */ React41.forwardRef(
|
|
45500
45610
|
/* @__PURE__ */ __name21(function MenuSeparator2(props, forwardedRef) {
|
|
45501
45611
|
const { __scopeMenu, ...separatorProps } = props;
|
|
45502
45612
|
return /* @__PURE__ */ jsx30(
|
|
@@ -45516,10 +45626,10 @@ var MenuSub = /* @__PURE__ */ __name21((props) => {
|
|
|
45516
45626
|
const { __scopeMenu, children, open = false, onOpenChange } = props;
|
|
45517
45627
|
const parentMenuContext = useMenuContext(SUB_NAME, __scopeMenu);
|
|
45518
45628
|
const popperScope = usePopperScope(__scopeMenu);
|
|
45519
|
-
const [trigger, setTrigger] =
|
|
45520
|
-
const [content, setContent] =
|
|
45629
|
+
const [trigger, setTrigger] = React41.useState(null);
|
|
45630
|
+
const [content, setContent] = React41.useState(null);
|
|
45521
45631
|
const handleOpenChange = useCallbackRef(onOpenChange);
|
|
45522
|
-
|
|
45632
|
+
React41.useEffect(() => {
|
|
45523
45633
|
if (parentMenuContext.open === false) handleOpenChange(false);
|
|
45524
45634
|
return () => handleOpenChange(false);
|
|
45525
45635
|
}, [parentMenuContext.open, handleOpenChange]);
|
|
@@ -45546,21 +45656,21 @@ var MenuSub = /* @__PURE__ */ __name21((props) => {
|
|
|
45546
45656
|
) });
|
|
45547
45657
|
}, "MenuSub");
|
|
45548
45658
|
var SUB_TRIGGER_NAME = "MenuSubTrigger";
|
|
45549
|
-
var MenuSubTrigger = /* @__PURE__ */
|
|
45659
|
+
var MenuSubTrigger = /* @__PURE__ */ React41.forwardRef(
|
|
45550
45660
|
/* @__PURE__ */ __name21(function MenuSubTrigger2(props, forwardedRef) {
|
|
45551
45661
|
const context = useMenuContext(SUB_TRIGGER_NAME, props.__scopeMenu);
|
|
45552
45662
|
const rootContext = useMenuRootContext(SUB_TRIGGER_NAME, props.__scopeMenu);
|
|
45553
45663
|
const subContext = useMenuSubContext(SUB_TRIGGER_NAME, props.__scopeMenu);
|
|
45554
45664
|
const contentContext = useMenuContentContext(SUB_TRIGGER_NAME, props.__scopeMenu);
|
|
45555
|
-
const openTimerRef =
|
|
45665
|
+
const openTimerRef = React41.useRef(null);
|
|
45556
45666
|
const { pointerGraceTimerRef, onPointerGraceIntentChange } = contentContext;
|
|
45557
45667
|
const scope = { __scopeMenu: props.__scopeMenu };
|
|
45558
|
-
const clearOpenTimer =
|
|
45668
|
+
const clearOpenTimer = React41.useCallback(() => {
|
|
45559
45669
|
if (openTimerRef.current) window.clearTimeout(openTimerRef.current);
|
|
45560
45670
|
openTimerRef.current = null;
|
|
45561
45671
|
}, []);
|
|
45562
|
-
|
|
45563
|
-
|
|
45672
|
+
React41.useEffect(() => clearOpenTimer, [clearOpenTimer]);
|
|
45673
|
+
React41.useEffect(() => {
|
|
45564
45674
|
const pointerGraceTimer = pointerGraceTimerRef.current;
|
|
45565
45675
|
return () => {
|
|
45566
45676
|
window.clearTimeout(pointerGraceTimer);
|
|
@@ -45652,14 +45762,14 @@ var MenuSubTrigger = /* @__PURE__ */ React40.forwardRef(
|
|
|
45652
45762
|
}, "MenuSubTrigger")
|
|
45653
45763
|
);
|
|
45654
45764
|
var SUB_CONTENT_NAME = "MenuSubContent";
|
|
45655
|
-
var MenuSubContent = /* @__PURE__ */
|
|
45765
|
+
var MenuSubContent = /* @__PURE__ */ React41.forwardRef(
|
|
45656
45766
|
/* @__PURE__ */ __name21(function MenuSubContent2(props, forwardedRef) {
|
|
45657
45767
|
const portalContext = usePortalContext(CONTENT_NAME2, props.__scopeMenu);
|
|
45658
45768
|
const { forceMount = portalContext.forceMount, align = "start", ...subContentProps } = props;
|
|
45659
45769
|
const context = useMenuContext(CONTENT_NAME2, props.__scopeMenu);
|
|
45660
45770
|
const rootContext = useMenuRootContext(CONTENT_NAME2, props.__scopeMenu);
|
|
45661
45771
|
const subContext = useMenuSubContext(SUB_CONTENT_NAME, props.__scopeMenu);
|
|
45662
|
-
const ref =
|
|
45772
|
+
const ref = React41.useRef(null);
|
|
45663
45773
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
45664
45774
|
return /* @__PURE__ */ jsx30(Collection2.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx30(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx30(Collection2.Slot, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx30(
|
|
45665
45775
|
MenuContentImpl,
|
|
@@ -45794,7 +45904,7 @@ var DropdownMenu = /* @__PURE__ */ __name22((props) => {
|
|
|
45794
45904
|
modal = true
|
|
45795
45905
|
} = props;
|
|
45796
45906
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
45797
|
-
const triggerRef =
|
|
45907
|
+
const triggerRef = React42.useRef(null);
|
|
45798
45908
|
const [open, setOpen] = useControllableState({
|
|
45799
45909
|
prop: openProp,
|
|
45800
45910
|
defaultProp: defaultOpen ?? false,
|
|
@@ -45810,14 +45920,14 @@ var DropdownMenu = /* @__PURE__ */ __name22((props) => {
|
|
|
45810
45920
|
contentId: useId(),
|
|
45811
45921
|
open,
|
|
45812
45922
|
onOpenChange: setOpen,
|
|
45813
|
-
onOpenToggle:
|
|
45923
|
+
onOpenToggle: React42.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
45814
45924
|
modal,
|
|
45815
45925
|
children: /* @__PURE__ */ jsx31(Root3, { ...menuScope, open, onOpenChange: setOpen, dir, modal, children })
|
|
45816
45926
|
}
|
|
45817
45927
|
);
|
|
45818
45928
|
}, "DropdownMenu");
|
|
45819
45929
|
var TRIGGER_NAME = "DropdownMenuTrigger";
|
|
45820
|
-
var DropdownMenuTrigger = /* @__PURE__ */
|
|
45930
|
+
var DropdownMenuTrigger = /* @__PURE__ */ React42.forwardRef(
|
|
45821
45931
|
// blank line to reduce diff noise
|
|
45822
45932
|
/* @__PURE__ */ __name22(function DropdownMenuTrigger2(props, forwardedRef) {
|
|
45823
45933
|
const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
|
|
@@ -45859,13 +45969,13 @@ var DropdownMenuPortal = /* @__PURE__ */ __name22((props) => {
|
|
|
45859
45969
|
return /* @__PURE__ */ jsx31(Portal3, { ...menuScope, ...portalProps });
|
|
45860
45970
|
}, "DropdownMenuPortal");
|
|
45861
45971
|
var CONTENT_NAME3 = "DropdownMenuContent";
|
|
45862
|
-
var DropdownMenuContent = /* @__PURE__ */
|
|
45972
|
+
var DropdownMenuContent = /* @__PURE__ */ React42.forwardRef(
|
|
45863
45973
|
// blank line to reduce diff noise
|
|
45864
45974
|
/* @__PURE__ */ __name22(function DropdownMenuContent2(props, forwardedRef) {
|
|
45865
45975
|
const { __scopeDropdownMenu, ...contentProps } = props;
|
|
45866
45976
|
const context = useDropdownMenuContext(CONTENT_NAME3, __scopeDropdownMenu);
|
|
45867
45977
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
45868
|
-
const hasInteractedOutsideRef =
|
|
45978
|
+
const hasInteractedOutsideRef = React42.useRef(false);
|
|
45869
45979
|
return /* @__PURE__ */ jsx31(
|
|
45870
45980
|
Content2,
|
|
45871
45981
|
{
|
|
@@ -45900,7 +46010,7 @@ var DropdownMenuContent = /* @__PURE__ */ React41.forwardRef(
|
|
|
45900
46010
|
);
|
|
45901
46011
|
}, "DropdownMenuContent")
|
|
45902
46012
|
);
|
|
45903
|
-
var DropdownMenuItem = /* @__PURE__ */
|
|
46013
|
+
var DropdownMenuItem = /* @__PURE__ */ React42.forwardRef(
|
|
45904
46014
|
// blank line to reduce diff noise
|
|
45905
46015
|
/* @__PURE__ */ __name22(function DropdownMenuItem2(props, forwardedRef) {
|
|
45906
46016
|
const { __scopeDropdownMenu, ...itemProps } = props;
|
|
@@ -45908,7 +46018,7 @@ var DropdownMenuItem = /* @__PURE__ */ React41.forwardRef(
|
|
|
45908
46018
|
return /* @__PURE__ */ jsx31(Item2, { ...menuScope, ...itemProps, ref: forwardedRef });
|
|
45909
46019
|
}, "DropdownMenuItem")
|
|
45910
46020
|
);
|
|
45911
|
-
var DropdownMenuSeparator = /* @__PURE__ */
|
|
46021
|
+
var DropdownMenuSeparator = /* @__PURE__ */ React42.forwardRef(/* @__PURE__ */ __name22(function DropdownMenuSeparator2(props, forwardedRef) {
|
|
45912
46022
|
const { __scopeDropdownMenu, ...separatorProps } = props;
|
|
45913
46023
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
45914
46024
|
return /* @__PURE__ */ jsx31(Separator, { ...menuScope, ...separatorProps, ref: forwardedRef });
|
|
@@ -45924,12 +46034,12 @@ var DropdownMenuSub = /* @__PURE__ */ __name22((props) => {
|
|
|
45924
46034
|
});
|
|
45925
46035
|
return /* @__PURE__ */ jsx31(Sub, { ...menuScope, open, onOpenChange: setOpen, children });
|
|
45926
46036
|
}, "DropdownMenuSub");
|
|
45927
|
-
var DropdownMenuSubTrigger = /* @__PURE__ */
|
|
46037
|
+
var DropdownMenuSubTrigger = /* @__PURE__ */ React42.forwardRef(/* @__PURE__ */ __name22(function DropdownMenuSubTrigger2(props, forwardedRef) {
|
|
45928
46038
|
const { __scopeDropdownMenu, ...subTriggerProps } = props;
|
|
45929
46039
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
45930
46040
|
return /* @__PURE__ */ jsx31(SubTrigger, { ...menuScope, ...subTriggerProps, ref: forwardedRef });
|
|
45931
46041
|
}, "DropdownMenuSubTrigger"));
|
|
45932
|
-
var DropdownMenuSubContent = /* @__PURE__ */
|
|
46042
|
+
var DropdownMenuSubContent = /* @__PURE__ */ React42.forwardRef(/* @__PURE__ */ __name22(function DropdownMenuSubContent2(props, forwardedRef) {
|
|
45933
46043
|
const { __scopeDropdownMenu, ...subContentProps } = props;
|
|
45934
46044
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
45935
46045
|
return /* @__PURE__ */ jsx31(
|
|
@@ -46485,6 +46595,7 @@ var ContextMenu = ({
|
|
|
46485
46595
|
onOpenKeyboardShortcuts
|
|
46486
46596
|
}) => {
|
|
46487
46597
|
const { cameraType, setCameraType } = useCameraController();
|
|
46598
|
+
const { gridEnabled, setGridEnabled } = useAppearance();
|
|
46488
46599
|
const [cameraSubOpen, setCameraSubOpen] = useState35(false);
|
|
46489
46600
|
const [hoveredItem, setHoveredItem] = useState35(null);
|
|
46490
46601
|
return /* @__PURE__ */ jsx34(
|
|
@@ -46622,6 +46733,27 @@ var ContextMenu = ({
|
|
|
46622
46733
|
]
|
|
46623
46734
|
}
|
|
46624
46735
|
),
|
|
46736
|
+
/* @__PURE__ */ jsxs8(
|
|
46737
|
+
Item22,
|
|
46738
|
+
{
|
|
46739
|
+
style: {
|
|
46740
|
+
...itemStyles2,
|
|
46741
|
+
backgroundColor: hoveredItem === "grid" ? "#404040" : "transparent"
|
|
46742
|
+
},
|
|
46743
|
+
onSelect: (e) => e.preventDefault(),
|
|
46744
|
+
onPointerDown: (e) => {
|
|
46745
|
+
e.preventDefault();
|
|
46746
|
+
setGridEnabled(!gridEnabled);
|
|
46747
|
+
},
|
|
46748
|
+
onMouseEnter: () => setHoveredItem("grid"),
|
|
46749
|
+
onMouseLeave: () => setHoveredItem(null),
|
|
46750
|
+
onTouchStart: () => setHoveredItem("grid"),
|
|
46751
|
+
children: [
|
|
46752
|
+
/* @__PURE__ */ jsx34("span", { style: iconContainerStyles2, children: gridEnabled && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
|
|
46753
|
+
/* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Show Grid" })
|
|
46754
|
+
]
|
|
46755
|
+
}
|
|
46756
|
+
),
|
|
46625
46757
|
/* @__PURE__ */ jsx34(AppearanceMenu, {}),
|
|
46626
46758
|
/* @__PURE__ */ jsx34(Separator2, { style: separatorStyles2 }),
|
|
46627
46759
|
/* @__PURE__ */ jsx34(
|
|
@@ -46744,10 +46876,10 @@ var ContextMenu = ({
|
|
|
46744
46876
|
};
|
|
46745
46877
|
|
|
46746
46878
|
// src/components/KeyboardShortcutsDialog.tsx
|
|
46747
|
-
import { useEffect as
|
|
46879
|
+
import { useEffect as useEffect46, useMemo as useMemo31, useRef as useRef27, useState as useState37 } from "react";
|
|
46748
46880
|
|
|
46749
46881
|
// src/hooks/useRegisteredHotkey.ts
|
|
46750
|
-
import { useEffect as
|
|
46882
|
+
import { useEffect as useEffect45, useMemo as useMemo30, useRef as useRef26, useState as useState36 } from "react";
|
|
46751
46883
|
var hotkeyRegistry = /* @__PURE__ */ new Map();
|
|
46752
46884
|
var subscribers = /* @__PURE__ */ new Set();
|
|
46753
46885
|
var isListenerAttached = false;
|
|
@@ -46871,14 +47003,14 @@ var subscribeToRegistry = (subscriber) => {
|
|
|
46871
47003
|
var useRegisteredHotkey = (id, handler, metadata) => {
|
|
46872
47004
|
const handlerRef = useRef26(handler);
|
|
46873
47005
|
handlerRef.current = handler;
|
|
46874
|
-
const normalizedMetadata =
|
|
47006
|
+
const normalizedMetadata = useMemo30(
|
|
46875
47007
|
() => ({
|
|
46876
47008
|
shortcut: metadata.shortcut,
|
|
46877
47009
|
description: metadata.description
|
|
46878
47010
|
}),
|
|
46879
47011
|
[metadata.shortcut, metadata.description]
|
|
46880
47012
|
);
|
|
46881
|
-
|
|
47013
|
+
useEffect45(() => {
|
|
46882
47014
|
const registration = {
|
|
46883
47015
|
id,
|
|
46884
47016
|
...normalizedMetadata,
|
|
@@ -46894,7 +47026,7 @@ var useHotkeyRegistry = () => {
|
|
|
46894
47026
|
const [entries, setEntries] = useState36(
|
|
46895
47027
|
() => Array.from(hotkeyRegistry.values())
|
|
46896
47028
|
);
|
|
46897
|
-
|
|
47029
|
+
useEffect45(() => subscribeToRegistry(setEntries), []);
|
|
46898
47030
|
return entries;
|
|
46899
47031
|
};
|
|
46900
47032
|
var registerHotkeyViewer = (element) => {
|
|
@@ -46911,7 +47043,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
46911
47043
|
const [query, setQuery] = useState37("");
|
|
46912
47044
|
const inputRef = useRef27(null);
|
|
46913
47045
|
const hotkeys = useHotkeyRegistry();
|
|
46914
|
-
|
|
47046
|
+
useEffect46(() => {
|
|
46915
47047
|
if (!open) return void 0;
|
|
46916
47048
|
const handleKeyDown = (event) => {
|
|
46917
47049
|
if (event.key === "Escape") {
|
|
@@ -46922,14 +47054,14 @@ var KeyboardShortcutsDialog = ({
|
|
|
46922
47054
|
window.addEventListener("keydown", handleKeyDown);
|
|
46923
47055
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
46924
47056
|
}, [open, onClose]);
|
|
46925
|
-
|
|
47057
|
+
useEffect46(() => {
|
|
46926
47058
|
if (open) {
|
|
46927
47059
|
setTimeout(() => {
|
|
46928
47060
|
inputRef.current?.focus();
|
|
46929
47061
|
}, 0);
|
|
46930
47062
|
}
|
|
46931
47063
|
}, [open]);
|
|
46932
|
-
const filteredHotkeys =
|
|
47064
|
+
const filteredHotkeys = useMemo31(() => {
|
|
46933
47065
|
const normalizedQuery = query.trim().toLowerCase();
|
|
46934
47066
|
if (!normalizedQuery) {
|
|
46935
47067
|
return hotkeys;
|
|
@@ -47151,7 +47283,7 @@ function useCameraPreset({
|
|
|
47151
47283
|
}
|
|
47152
47284
|
|
|
47153
47285
|
// src/hooks/useContextMenu.ts
|
|
47154
|
-
import { useState as useState38, useCallback as useCallback22, useRef as useRef28, useEffect as
|
|
47286
|
+
import { useState as useState38, useCallback as useCallback22, useRef as useRef28, useEffect as useEffect47 } from "react";
|
|
47155
47287
|
var useContextMenu = ({ containerRef }) => {
|
|
47156
47288
|
const [menuVisible, setMenuVisible] = useState38(false);
|
|
47157
47289
|
const [menuPos, setMenuPos] = useState38({
|
|
@@ -47266,7 +47398,7 @@ var useContextMenu = ({ containerRef }) => {
|
|
|
47266
47398
|
}
|
|
47267
47399
|
setMenuVisible(false);
|
|
47268
47400
|
}, []);
|
|
47269
|
-
|
|
47401
|
+
useEffect47(() => {
|
|
47270
47402
|
if (menuVisible) {
|
|
47271
47403
|
document.addEventListener("mousedown", handleClickAway);
|
|
47272
47404
|
document.addEventListener("touchstart", handleClickAway);
|
|
@@ -47330,7 +47462,7 @@ var useGlobalDownloadGltf = () => {
|
|
|
47330
47462
|
|
|
47331
47463
|
// src/CadViewer.tsx
|
|
47332
47464
|
import { jsx as jsx37, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
47333
|
-
var DEFAULT_TARGET = new
|
|
47465
|
+
var DEFAULT_TARGET = new THREE46.Vector3(0, 0, 0);
|
|
47334
47466
|
var INITIAL_CAMERA_POSITION = [5, -5, 5];
|
|
47335
47467
|
var readStoredCameraType = () => {
|
|
47336
47468
|
if (typeof window === "undefined") return void 0;
|
|
@@ -47463,24 +47595,24 @@ var CadViewerInner = (props) => {
|
|
|
47463
47595
|
description: "Toggle translucent components"
|
|
47464
47596
|
}
|
|
47465
47597
|
);
|
|
47466
|
-
|
|
47598
|
+
useEffect48(() => {
|
|
47467
47599
|
if (containerRef.current) {
|
|
47468
47600
|
registerHotkeyViewer(containerRef.current);
|
|
47469
47601
|
}
|
|
47470
47602
|
}, []);
|
|
47471
|
-
|
|
47603
|
+
useEffect48(() => {
|
|
47472
47604
|
window.localStorage.setItem("cadViewerEngine", engine);
|
|
47473
47605
|
}, [engine]);
|
|
47474
|
-
|
|
47606
|
+
useEffect48(() => {
|
|
47475
47607
|
window.localStorage.setItem("cadViewerAutoRotate", String(autoRotate));
|
|
47476
47608
|
}, [autoRotate]);
|
|
47477
|
-
|
|
47609
|
+
useEffect48(() => {
|
|
47478
47610
|
window.localStorage.setItem(
|
|
47479
47611
|
"cadViewerAutoRotateUserToggled",
|
|
47480
47612
|
String(autoRotateUserToggled)
|
|
47481
47613
|
);
|
|
47482
47614
|
}, [autoRotateUserToggled]);
|
|
47483
|
-
|
|
47615
|
+
useEffect48(() => {
|
|
47484
47616
|
window.localStorage.setItem("cadViewerCameraType", cameraType);
|
|
47485
47617
|
}, [cameraType]);
|
|
47486
47618
|
const viewerKey = props.circuitJson ? JSON.stringify(props.circuitJson) : void 0;
|
|
@@ -47594,11 +47726,11 @@ var CadViewer = (props) => {
|
|
|
47594
47726
|
// src/convert-circuit-json-to-3d-svg.ts
|
|
47595
47727
|
var import_debug = __toESM(require_browser(), 1);
|
|
47596
47728
|
import { su as su18 } from "@tscircuit/circuit-json-util";
|
|
47597
|
-
import * as
|
|
47729
|
+
import * as THREE50 from "three";
|
|
47598
47730
|
import { SVGRenderer } from "three/examples/jsm/renderers/SVGRenderer.js";
|
|
47599
47731
|
|
|
47600
47732
|
// src/utils/create-geometry-from-polygons.ts
|
|
47601
|
-
import * as
|
|
47733
|
+
import * as THREE47 from "three";
|
|
47602
47734
|
import { BufferGeometry as BufferGeometry4, Float32BufferAttribute as Float32BufferAttribute3 } from "three";
|
|
47603
47735
|
function createGeometryFromPolygons(polygons) {
|
|
47604
47736
|
const geometry = new BufferGeometry4();
|
|
@@ -47612,12 +47744,12 @@ function createGeometryFromPolygons(polygons) {
|
|
|
47612
47744
|
...polygon2.vertices[i + 1]
|
|
47613
47745
|
// Third vertex
|
|
47614
47746
|
);
|
|
47615
|
-
const v1 = new
|
|
47616
|
-
const v2 = new
|
|
47617
|
-
const v3 = new
|
|
47618
|
-
const normal = new
|
|
47619
|
-
new
|
|
47620
|
-
new
|
|
47747
|
+
const v1 = new THREE47.Vector3(...polygon2.vertices[0]);
|
|
47748
|
+
const v2 = new THREE47.Vector3(...polygon2.vertices[i]);
|
|
47749
|
+
const v3 = new THREE47.Vector3(...polygon2.vertices[i + 1]);
|
|
47750
|
+
const normal = new THREE47.Vector3().crossVectors(
|
|
47751
|
+
new THREE47.Vector3().subVectors(v2, v1),
|
|
47752
|
+
new THREE47.Vector3().subVectors(v3, v1)
|
|
47621
47753
|
).normalize();
|
|
47622
47754
|
normals.push(
|
|
47623
47755
|
normal.x,
|
|
@@ -47641,10 +47773,10 @@ function createGeometryFromPolygons(polygons) {
|
|
|
47641
47773
|
var import_modeling2 = __toESM(require_src(), 1);
|
|
47642
47774
|
var import_jscad_planner2 = __toESM(require_dist(), 1);
|
|
47643
47775
|
var jscadModeling2 = __toESM(require_src(), 1);
|
|
47644
|
-
import * as
|
|
47776
|
+
import * as THREE49 from "three";
|
|
47645
47777
|
|
|
47646
47778
|
// src/utils/load-model.ts
|
|
47647
|
-
import * as
|
|
47779
|
+
import * as THREE48 from "three";
|
|
47648
47780
|
import { GLTFLoader as GLTFLoader2 } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
47649
47781
|
import { OBJLoader as OBJLoader2 } from "three/examples/jsm/loaders/OBJLoader.js";
|
|
47650
47782
|
import { STLLoader as STLLoader2 } from "three/examples/jsm/loaders/STLLoader.js";
|
|
@@ -47652,12 +47784,12 @@ async function load3DModel(url) {
|
|
|
47652
47784
|
if (url.endsWith(".stl")) {
|
|
47653
47785
|
const loader = new STLLoader2();
|
|
47654
47786
|
const geometry = await loader.loadAsync(url);
|
|
47655
|
-
const material = new
|
|
47787
|
+
const material = new THREE48.MeshStandardMaterial({
|
|
47656
47788
|
color: 8947848,
|
|
47657
47789
|
metalness: 0.5,
|
|
47658
47790
|
roughness: 0.5
|
|
47659
47791
|
});
|
|
47660
|
-
return new
|
|
47792
|
+
return new THREE48.Mesh(geometry, material);
|
|
47661
47793
|
}
|
|
47662
47794
|
if (url.endsWith(".obj")) {
|
|
47663
47795
|
const loader = new OBJLoader2();
|
|
@@ -47690,9 +47822,9 @@ async function renderComponent(component, scene) {
|
|
|
47690
47822
|
}
|
|
47691
47823
|
if (component.rotation) {
|
|
47692
47824
|
model.rotation.set(
|
|
47693
|
-
|
|
47694
|
-
|
|
47695
|
-
|
|
47825
|
+
THREE49.MathUtils.degToRad(component.rotation.x ?? 0),
|
|
47826
|
+
THREE49.MathUtils.degToRad(component.rotation.y ?? 0),
|
|
47827
|
+
THREE49.MathUtils.degToRad(component.rotation.z ?? 0)
|
|
47696
47828
|
);
|
|
47697
47829
|
}
|
|
47698
47830
|
scene.add(model);
|
|
@@ -47706,13 +47838,13 @@ async function renderComponent(component, scene) {
|
|
|
47706
47838
|
);
|
|
47707
47839
|
if (jscadObject && (jscadObject.polygons || jscadObject.sides)) {
|
|
47708
47840
|
const threeGeom = convertCSGToThreeGeom(jscadObject);
|
|
47709
|
-
const material2 = new
|
|
47841
|
+
const material2 = new THREE49.MeshStandardMaterial({
|
|
47710
47842
|
color: 8947848,
|
|
47711
47843
|
metalness: 0.5,
|
|
47712
47844
|
roughness: 0.5,
|
|
47713
|
-
side:
|
|
47845
|
+
side: THREE49.DoubleSide
|
|
47714
47846
|
});
|
|
47715
|
-
const mesh2 = new
|
|
47847
|
+
const mesh2 = new THREE49.Mesh(threeGeom, material2);
|
|
47716
47848
|
if (component.position) {
|
|
47717
47849
|
mesh2.position.set(
|
|
47718
47850
|
component.position.x ?? 0,
|
|
@@ -47722,9 +47854,9 @@ async function renderComponent(component, scene) {
|
|
|
47722
47854
|
}
|
|
47723
47855
|
if (component.rotation) {
|
|
47724
47856
|
mesh2.rotation.set(
|
|
47725
|
-
|
|
47726
|
-
|
|
47727
|
-
|
|
47857
|
+
THREE49.MathUtils.degToRad(component.rotation.x ?? 0),
|
|
47858
|
+
THREE49.MathUtils.degToRad(component.rotation.y ?? 0),
|
|
47859
|
+
THREE49.MathUtils.degToRad(component.rotation.z ?? 0)
|
|
47728
47860
|
);
|
|
47729
47861
|
}
|
|
47730
47862
|
scene.add(mesh2);
|
|
@@ -47741,17 +47873,17 @@ async function renderComponent(component, scene) {
|
|
|
47741
47873
|
if (!geom || !geom.polygons && !geom.sides) {
|
|
47742
47874
|
continue;
|
|
47743
47875
|
}
|
|
47744
|
-
const color = new
|
|
47876
|
+
const color = new THREE49.Color(geomInfo.color);
|
|
47745
47877
|
color.convertLinearToSRGB();
|
|
47746
47878
|
const geomWithColor = { ...geom, color: [color.r, color.g, color.b] };
|
|
47747
47879
|
const threeGeom = convertCSGToThreeGeom(geomWithColor);
|
|
47748
|
-
const material2 = new
|
|
47880
|
+
const material2 = new THREE49.MeshStandardMaterial({
|
|
47749
47881
|
vertexColors: true,
|
|
47750
47882
|
metalness: 0.2,
|
|
47751
47883
|
roughness: 0.8,
|
|
47752
|
-
side:
|
|
47884
|
+
side: THREE49.DoubleSide
|
|
47753
47885
|
});
|
|
47754
|
-
const mesh2 = new
|
|
47886
|
+
const mesh2 = new THREE49.Mesh(threeGeom, material2);
|
|
47755
47887
|
if (component.position) {
|
|
47756
47888
|
mesh2.position.set(
|
|
47757
47889
|
component.position.x ?? 0,
|
|
@@ -47761,22 +47893,22 @@ async function renderComponent(component, scene) {
|
|
|
47761
47893
|
}
|
|
47762
47894
|
if (component.rotation) {
|
|
47763
47895
|
mesh2.rotation.set(
|
|
47764
|
-
|
|
47765
|
-
|
|
47766
|
-
|
|
47896
|
+
THREE49.MathUtils.degToRad(component.rotation.x ?? 0),
|
|
47897
|
+
THREE49.MathUtils.degToRad(component.rotation.y ?? 0),
|
|
47898
|
+
THREE49.MathUtils.degToRad(component.rotation.z ?? 0)
|
|
47767
47899
|
);
|
|
47768
47900
|
}
|
|
47769
47901
|
scene.add(mesh2);
|
|
47770
47902
|
}
|
|
47771
47903
|
return;
|
|
47772
47904
|
}
|
|
47773
|
-
const geometry = new
|
|
47774
|
-
const material = new
|
|
47905
|
+
const geometry = new THREE49.BoxGeometry(0.5, 0.5, 0.5);
|
|
47906
|
+
const material = new THREE49.MeshStandardMaterial({
|
|
47775
47907
|
color: 16711680,
|
|
47776
47908
|
transparent: true,
|
|
47777
47909
|
opacity: 0.25
|
|
47778
47910
|
});
|
|
47779
|
-
const mesh = new
|
|
47911
|
+
const mesh = new THREE49.Mesh(geometry, material);
|
|
47780
47912
|
if (component.position) {
|
|
47781
47913
|
mesh.position.set(
|
|
47782
47914
|
component.position.x ?? 0,
|
|
@@ -47797,11 +47929,11 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
|
|
|
47797
47929
|
padding = 20,
|
|
47798
47930
|
zoom = 1.5
|
|
47799
47931
|
} = options;
|
|
47800
|
-
const scene = new
|
|
47932
|
+
const scene = new THREE50.Scene();
|
|
47801
47933
|
const renderer = new SVGRenderer();
|
|
47802
47934
|
renderer.setSize(width10, height10);
|
|
47803
|
-
renderer.setClearColor(new
|
|
47804
|
-
const camera = new
|
|
47935
|
+
renderer.setClearColor(new THREE50.Color(backgroundColor), 1);
|
|
47936
|
+
const camera = new THREE50.OrthographicCamera();
|
|
47805
47937
|
const aspect = width10 / height10;
|
|
47806
47938
|
const frustumSize = 100;
|
|
47807
47939
|
const halfFrustumSize = frustumSize / 2 / zoom;
|
|
@@ -47815,11 +47947,11 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
|
|
|
47815
47947
|
camera.position.set(position.x, position.y, position.z);
|
|
47816
47948
|
camera.up.set(0, 1, 0);
|
|
47817
47949
|
const lookAt = options.camera?.lookAt ?? { x: 0, y: 0, z: 0 };
|
|
47818
|
-
camera.lookAt(new
|
|
47950
|
+
camera.lookAt(new THREE50.Vector3(lookAt.x, lookAt.y, lookAt.z));
|
|
47819
47951
|
camera.updateProjectionMatrix();
|
|
47820
|
-
const ambientLight = new
|
|
47952
|
+
const ambientLight = new THREE50.AmbientLight(16777215, Math.PI / 2);
|
|
47821
47953
|
scene.add(ambientLight);
|
|
47822
|
-
const pointLight = new
|
|
47954
|
+
const pointLight = new THREE50.PointLight(16777215, Math.PI / 4);
|
|
47823
47955
|
pointLight.position.set(-10, -10, 10);
|
|
47824
47956
|
scene.add(pointLight);
|
|
47825
47957
|
const components = su18(circuitJson).cad_component.list();
|
|
@@ -47830,7 +47962,7 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
|
|
|
47830
47962
|
const boardGeom = createSimplifiedBoardGeom(circuitJson);
|
|
47831
47963
|
if (boardGeom) {
|
|
47832
47964
|
const solderMaskColor = colors.fr4SolderMaskGreen;
|
|
47833
|
-
const baseColor = new
|
|
47965
|
+
const baseColor = new THREE50.Color(
|
|
47834
47966
|
solderMaskColor[0],
|
|
47835
47967
|
solderMaskColor[1],
|
|
47836
47968
|
solderMaskColor[2]
|
|
@@ -47842,28 +47974,28 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
|
|
|
47842
47974
|
const material = createBoardMaterial({
|
|
47843
47975
|
material: boardData?.material,
|
|
47844
47976
|
color: baseColor,
|
|
47845
|
-
side:
|
|
47977
|
+
side: THREE50.DoubleSide
|
|
47846
47978
|
});
|
|
47847
|
-
const mesh = new
|
|
47979
|
+
const mesh = new THREE50.Mesh(geometry, material);
|
|
47848
47980
|
scene.add(mesh);
|
|
47849
47981
|
}
|
|
47850
47982
|
}
|
|
47851
|
-
const gridColor = new
|
|
47852
|
-
const gridHelper = new
|
|
47983
|
+
const gridColor = new THREE50.Color(8947848);
|
|
47984
|
+
const gridHelper = new THREE50.GridHelper(100, 100, gridColor, gridColor);
|
|
47853
47985
|
gridHelper.rotation.x = Math.PI / 2;
|
|
47854
47986
|
const materials = Array.isArray(gridHelper.material) ? gridHelper.material : [gridHelper.material];
|
|
47855
47987
|
for (const mat of materials) {
|
|
47856
47988
|
mat.transparent = true;
|
|
47857
47989
|
mat.opacity = 0.3;
|
|
47858
|
-
if (mat instanceof
|
|
47990
|
+
if (mat instanceof THREE50.LineBasicMaterial) {
|
|
47859
47991
|
mat.color = gridColor;
|
|
47860
47992
|
mat.vertexColors = false;
|
|
47861
47993
|
}
|
|
47862
47994
|
}
|
|
47863
47995
|
scene.add(gridHelper);
|
|
47864
|
-
const box = new
|
|
47865
|
-
const center = box.getCenter(new
|
|
47866
|
-
const size4 = box.getSize(new
|
|
47996
|
+
const box = new THREE50.Box3().setFromObject(scene);
|
|
47997
|
+
const center = box.getCenter(new THREE50.Vector3());
|
|
47998
|
+
const size4 = box.getSize(new THREE50.Vector3());
|
|
47867
47999
|
scene.position.sub(center);
|
|
47868
48000
|
const maxDim = Math.max(size4.x, size4.y, size4.z);
|
|
47869
48001
|
if (maxDim > 0) {
|
|
@@ -47881,10 +48013,10 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
|
|
|
47881
48013
|
|
|
47882
48014
|
// src/hooks/exporter/gltf.ts
|
|
47883
48015
|
import { GLTFExporter as GLTFExporter3 } from "three-stdlib";
|
|
47884
|
-
import { useEffect as
|
|
48016
|
+
import { useEffect as useEffect49, useState as useState40, useMemo as useMemo32, useCallback as useCallback25 } from "react";
|
|
47885
48017
|
function useSaveGltfAs(options = {}) {
|
|
47886
48018
|
const parse2 = useParser(options);
|
|
47887
|
-
const link =
|
|
48019
|
+
const link = useMemo32(() => document.createElement("a"), []);
|
|
47888
48020
|
const saveAs = async (filename) => {
|
|
47889
48021
|
const name = filename ?? options.filename ?? "";
|
|
47890
48022
|
if (options.binary == null) options.binary = name.endsWith(".glb");
|
|
@@ -47894,7 +48026,7 @@ function useSaveGltfAs(options = {}) {
|
|
|
47894
48026
|
link.dispatchEvent(new MouseEvent("click"));
|
|
47895
48027
|
URL.revokeObjectURL(url);
|
|
47896
48028
|
};
|
|
47897
|
-
|
|
48029
|
+
useEffect49(
|
|
47898
48030
|
() => () => {
|
|
47899
48031
|
link.remove();
|
|
47900
48032
|
instance = null;
|
|
@@ -47915,11 +48047,11 @@ function useExportGltfUrl(options = {}) {
|
|
|
47915
48047
|
(instance) => parse2(instance).then(setUrl).catch(setError),
|
|
47916
48048
|
[]
|
|
47917
48049
|
);
|
|
47918
|
-
|
|
48050
|
+
useEffect49(() => () => URL.revokeObjectURL(url), [url]);
|
|
47919
48051
|
return [ref, url, error];
|
|
47920
48052
|
}
|
|
47921
48053
|
function useParser(options = {}) {
|
|
47922
|
-
const exporter =
|
|
48054
|
+
const exporter = useMemo32(() => new GLTFExporter3(), []);
|
|
47923
48055
|
return (instance) => {
|
|
47924
48056
|
const { promise, resolve, reject } = Promise.withResolvers();
|
|
47925
48057
|
exporter.parse(
|