@tscircuit/3d-viewer 0.0.483 → 0.0.485
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 +534 -313
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14225,7 +14225,7 @@ var require_browser = __commonJS({
|
|
|
14225
14225
|
});
|
|
14226
14226
|
|
|
14227
14227
|
// src/CadViewer.tsx
|
|
14228
|
-
import { useState as
|
|
14228
|
+
import { useState as useState36, useCallback as useCallback21, useRef as useRef26, useEffect as useEffect44 } from "react";
|
|
14229
14229
|
import * as THREE34 from "three";
|
|
14230
14230
|
|
|
14231
14231
|
// src/CadViewerJscad.tsx
|
|
@@ -14234,7 +14234,7 @@ import { forwardRef as forwardRef3, useMemo as useMemo20 } from "react";
|
|
|
14234
14234
|
|
|
14235
14235
|
// src/AnyCadComponent.tsx
|
|
14236
14236
|
import { su } from "@tscircuit/circuit-json-util";
|
|
14237
|
-
import { useMemo as useMemo7, useState as
|
|
14237
|
+
import { useMemo as useMemo7, useState as useState7, useCallback as useCallback3 } from "react";
|
|
14238
14238
|
|
|
14239
14239
|
// src/ContainerWithTooltip.tsx
|
|
14240
14240
|
import { useEffect as useEffect2 } from "react";
|
|
@@ -30449,15 +30449,217 @@ var useLayerVisibility = () => {
|
|
|
30449
30449
|
return context;
|
|
30450
30450
|
};
|
|
30451
30451
|
|
|
30452
|
+
// src/three-components/StepModel.tsx
|
|
30453
|
+
import { useEffect as useEffect10, useState as useState6 } from "react";
|
|
30454
|
+
import {
|
|
30455
|
+
BufferGeometry as BufferGeometry2,
|
|
30456
|
+
Color as Color3,
|
|
30457
|
+
Float32BufferAttribute,
|
|
30458
|
+
Group as Group2,
|
|
30459
|
+
Mesh as Mesh5,
|
|
30460
|
+
MeshStandardMaterial as MeshStandardMaterial5
|
|
30461
|
+
} from "three";
|
|
30462
|
+
import { GLTFExporter } from "three-stdlib";
|
|
30463
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
30464
|
+
var occtImportPromise;
|
|
30465
|
+
var OCCT_CDN_BASE_URL = "https://cdn.jsdelivr.net/npm/occt-import-js@0.0.23/dist";
|
|
30466
|
+
function resolveOcctFactory(candidate) {
|
|
30467
|
+
if (typeof candidate === "function") {
|
|
30468
|
+
return candidate;
|
|
30469
|
+
}
|
|
30470
|
+
if (candidate && typeof candidate === "object" && "default" in candidate && typeof candidate.default === "function") {
|
|
30471
|
+
return candidate.default;
|
|
30472
|
+
}
|
|
30473
|
+
throw new Error("Unable to resolve occt-import-js factory export");
|
|
30474
|
+
}
|
|
30475
|
+
async function loadOcctImport() {
|
|
30476
|
+
if (!occtImportPromise) {
|
|
30477
|
+
const imported = await import(
|
|
30478
|
+
/* @vite-ignore */
|
|
30479
|
+
"https://cdn.jsdelivr.net/npm/occt-import-js@0.0.23/+esm"
|
|
30480
|
+
);
|
|
30481
|
+
const factory = resolveOcctFactory(imported);
|
|
30482
|
+
occtImportPromise = factory({
|
|
30483
|
+
locateFile: (path) => `${OCCT_CDN_BASE_URL}/${path}`
|
|
30484
|
+
});
|
|
30485
|
+
}
|
|
30486
|
+
return occtImportPromise;
|
|
30487
|
+
}
|
|
30488
|
+
function occtMeshesToGroup(meshes) {
|
|
30489
|
+
const group = new Group2();
|
|
30490
|
+
for (const mesh of meshes) {
|
|
30491
|
+
const positions = mesh.attributes.position?.array ?? [];
|
|
30492
|
+
const indices = mesh.index?.array ?? [];
|
|
30493
|
+
if (!positions.length || !indices.length) {
|
|
30494
|
+
continue;
|
|
30495
|
+
}
|
|
30496
|
+
const geometry = new BufferGeometry2();
|
|
30497
|
+
geometry.setAttribute("position", new Float32BufferAttribute(positions, 3));
|
|
30498
|
+
const normals = mesh.attributes.normal?.array ?? [];
|
|
30499
|
+
if (normals.length) {
|
|
30500
|
+
geometry.setAttribute("normal", new Float32BufferAttribute(normals, 3));
|
|
30501
|
+
} else {
|
|
30502
|
+
geometry.computeVertexNormals();
|
|
30503
|
+
}
|
|
30504
|
+
geometry.setIndex(indices);
|
|
30505
|
+
const material = new MeshStandardMaterial5({
|
|
30506
|
+
color: mesh.color ? new Color3(mesh.color[0], mesh.color[1], mesh.color[2]) : new Color3(0.82, 0.82, 0.82)
|
|
30507
|
+
});
|
|
30508
|
+
const threeMesh = new Mesh5(geometry, material);
|
|
30509
|
+
threeMesh.name = mesh.name;
|
|
30510
|
+
group.add(threeMesh);
|
|
30511
|
+
}
|
|
30512
|
+
return group;
|
|
30513
|
+
}
|
|
30514
|
+
async function convertStepUrlToGlbUrl(stepUrl) {
|
|
30515
|
+
const response = await fetch(stepUrl);
|
|
30516
|
+
if (!response.ok) {
|
|
30517
|
+
throw new Error(`Failed to fetch STEP file: ${response.statusText}`);
|
|
30518
|
+
}
|
|
30519
|
+
const buffer = await response.arrayBuffer();
|
|
30520
|
+
const occt = await loadOcctImport();
|
|
30521
|
+
const result = occt.ReadStepFile(new Uint8Array(buffer), null);
|
|
30522
|
+
if (!result.success || !result.meshes.length) {
|
|
30523
|
+
throw new Error("occt-import-js failed to convert STEP file");
|
|
30524
|
+
}
|
|
30525
|
+
const group = occtMeshesToGroup(result.meshes);
|
|
30526
|
+
const exporter = new GLTFExporter();
|
|
30527
|
+
const glb = await new Promise((resolve, reject) => {
|
|
30528
|
+
exporter.parse(
|
|
30529
|
+
group,
|
|
30530
|
+
(output) => {
|
|
30531
|
+
if (output instanceof ArrayBuffer) {
|
|
30532
|
+
resolve(output);
|
|
30533
|
+
} else {
|
|
30534
|
+
reject(new Error("GLTFExporter did not return binary output"));
|
|
30535
|
+
}
|
|
30536
|
+
},
|
|
30537
|
+
(error) => {
|
|
30538
|
+
reject(error);
|
|
30539
|
+
},
|
|
30540
|
+
{ binary: true }
|
|
30541
|
+
);
|
|
30542
|
+
});
|
|
30543
|
+
return URL.createObjectURL(new Blob([glb], { type: "model/gltf-binary" }));
|
|
30544
|
+
}
|
|
30545
|
+
var CACHE_PREFIX = "step-glb-cache:";
|
|
30546
|
+
function arrayBufferToBase64(buffer) {
|
|
30547
|
+
const bytes = new Uint8Array(buffer);
|
|
30548
|
+
const chunkSize = 32768;
|
|
30549
|
+
let binary = "";
|
|
30550
|
+
for (let i = 0; i < bytes.length; i += chunkSize) {
|
|
30551
|
+
const chunk = bytes.subarray(i, i + chunkSize);
|
|
30552
|
+
binary += String.fromCharCode(...chunk);
|
|
30553
|
+
}
|
|
30554
|
+
return btoa(binary);
|
|
30555
|
+
}
|
|
30556
|
+
function base64ToArrayBuffer(base64) {
|
|
30557
|
+
const binary = atob(base64);
|
|
30558
|
+
const bytes = new Uint8Array(binary.length);
|
|
30559
|
+
for (let i = 0; i < binary.length; i += 1) {
|
|
30560
|
+
bytes[i] = binary.charCodeAt(i);
|
|
30561
|
+
}
|
|
30562
|
+
return bytes.buffer;
|
|
30563
|
+
}
|
|
30564
|
+
function getCachedGlb(stepUrl) {
|
|
30565
|
+
try {
|
|
30566
|
+
const cached = localStorage.getItem(`${CACHE_PREFIX}${stepUrl}`);
|
|
30567
|
+
if (!cached) {
|
|
30568
|
+
return null;
|
|
30569
|
+
}
|
|
30570
|
+
return base64ToArrayBuffer(cached);
|
|
30571
|
+
} catch (error) {
|
|
30572
|
+
console.warn("Failed to read STEP GLB cache", error);
|
|
30573
|
+
return null;
|
|
30574
|
+
}
|
|
30575
|
+
}
|
|
30576
|
+
function setCachedGlb(stepUrl, glb) {
|
|
30577
|
+
try {
|
|
30578
|
+
const encoded = arrayBufferToBase64(glb);
|
|
30579
|
+
localStorage.setItem(`${CACHE_PREFIX}${stepUrl}`, encoded);
|
|
30580
|
+
} catch (error) {
|
|
30581
|
+
console.warn("Failed to write STEP GLB cache", error);
|
|
30582
|
+
}
|
|
30583
|
+
}
|
|
30584
|
+
var StepModel = ({
|
|
30585
|
+
stepUrl,
|
|
30586
|
+
position,
|
|
30587
|
+
rotation: rotation2,
|
|
30588
|
+
scale: scale3,
|
|
30589
|
+
onHover,
|
|
30590
|
+
onUnhover,
|
|
30591
|
+
isHovered,
|
|
30592
|
+
isTranslucent
|
|
30593
|
+
}) => {
|
|
30594
|
+
const [stepGltfUrl, setStepGltfUrl] = useState6(null);
|
|
30595
|
+
useEffect10(() => {
|
|
30596
|
+
let isActive = true;
|
|
30597
|
+
let objectUrl = null;
|
|
30598
|
+
const cachedGlb = getCachedGlb(stepUrl);
|
|
30599
|
+
if (cachedGlb) {
|
|
30600
|
+
objectUrl = URL.createObjectURL(
|
|
30601
|
+
new Blob([cachedGlb], { type: "model/gltf-binary" })
|
|
30602
|
+
);
|
|
30603
|
+
setStepGltfUrl(objectUrl);
|
|
30604
|
+
return () => {
|
|
30605
|
+
isActive = false;
|
|
30606
|
+
if (objectUrl) {
|
|
30607
|
+
URL.revokeObjectURL(objectUrl);
|
|
30608
|
+
}
|
|
30609
|
+
};
|
|
30610
|
+
}
|
|
30611
|
+
void convertStepUrlToGlbUrl(stepUrl).then((generatedUrl) => {
|
|
30612
|
+
if (!isActive) {
|
|
30613
|
+
URL.revokeObjectURL(generatedUrl);
|
|
30614
|
+
return;
|
|
30615
|
+
}
|
|
30616
|
+
objectUrl = generatedUrl;
|
|
30617
|
+
setStepGltfUrl(generatedUrl);
|
|
30618
|
+
fetch(generatedUrl).then((response) => response.arrayBuffer()).then((glbBuffer) => {
|
|
30619
|
+
setCachedGlb(stepUrl, glbBuffer);
|
|
30620
|
+
}).catch((error) => {
|
|
30621
|
+
console.warn("Failed to cache STEP GLB", error);
|
|
30622
|
+
});
|
|
30623
|
+
}).catch((error) => {
|
|
30624
|
+
console.error("Failed to convert STEP file to GLB", error);
|
|
30625
|
+
if (isActive) {
|
|
30626
|
+
setStepGltfUrl(null);
|
|
30627
|
+
}
|
|
30628
|
+
});
|
|
30629
|
+
return () => {
|
|
30630
|
+
isActive = false;
|
|
30631
|
+
if (objectUrl) {
|
|
30632
|
+
URL.revokeObjectURL(objectUrl);
|
|
30633
|
+
}
|
|
30634
|
+
};
|
|
30635
|
+
}, [stepUrl]);
|
|
30636
|
+
if (!stepGltfUrl) {
|
|
30637
|
+
return null;
|
|
30638
|
+
}
|
|
30639
|
+
return /* @__PURE__ */ jsx9(
|
|
30640
|
+
GltfModel,
|
|
30641
|
+
{
|
|
30642
|
+
gltfUrl: stepGltfUrl,
|
|
30643
|
+
position,
|
|
30644
|
+
rotation: rotation2,
|
|
30645
|
+
scale: scale3,
|
|
30646
|
+
onHover,
|
|
30647
|
+
onUnhover,
|
|
30648
|
+
isHovered,
|
|
30649
|
+
isTranslucent
|
|
30650
|
+
}
|
|
30651
|
+
);
|
|
30652
|
+
};
|
|
30653
|
+
|
|
30452
30654
|
// src/AnyCadComponent.tsx
|
|
30453
|
-
import { Fragment as Fragment3, jsx as
|
|
30655
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
30454
30656
|
var AnyCadComponent = ({
|
|
30455
30657
|
cad_component: cad_component2,
|
|
30456
30658
|
circuitJson
|
|
30457
30659
|
}) => {
|
|
30458
|
-
const [isHovered, setIsHovered] =
|
|
30660
|
+
const [isHovered, setIsHovered] = useState7(false);
|
|
30459
30661
|
const { visibility } = useLayerVisibility();
|
|
30460
|
-
const [hoverPosition, setHoverPosition] =
|
|
30662
|
+
const [hoverPosition, setHoverPosition] = useState7(null);
|
|
30461
30663
|
const handleHover = useCallback3((e) => {
|
|
30462
30664
|
if (e?.mousePosition) {
|
|
30463
30665
|
setIsHovered(true);
|
|
@@ -30484,6 +30686,7 @@ var AnyCadComponent = ({
|
|
|
30484
30686
|
}, [circuitJson, cad_component2.pcb_component_id]);
|
|
30485
30687
|
const url = cad_component2.model_obj_url ?? cad_component2.model_wrl_url ?? cad_component2.model_stl_url;
|
|
30486
30688
|
const gltfUrl = cad_component2.model_glb_url ?? cad_component2.model_gltf_url;
|
|
30689
|
+
const stepUrl = cad_component2.model_step_url;
|
|
30487
30690
|
const rotationOffset = cad_component2.rotation ? tuple(
|
|
30488
30691
|
cad_component2.rotation.x * Math.PI / 180,
|
|
30489
30692
|
cad_component2.rotation.y * Math.PI / 180,
|
|
@@ -30491,7 +30694,7 @@ var AnyCadComponent = ({
|
|
|
30491
30694
|
) : void 0;
|
|
30492
30695
|
let modelComponent = null;
|
|
30493
30696
|
if (url) {
|
|
30494
|
-
modelComponent = /* @__PURE__ */
|
|
30697
|
+
modelComponent = /* @__PURE__ */ jsx10(
|
|
30495
30698
|
MixedStlModel,
|
|
30496
30699
|
{
|
|
30497
30700
|
url,
|
|
@@ -30510,7 +30713,7 @@ var AnyCadComponent = ({
|
|
|
30510
30713
|
cad_component2.cad_component_id
|
|
30511
30714
|
);
|
|
30512
30715
|
} else if (gltfUrl) {
|
|
30513
|
-
modelComponent = /* @__PURE__ */
|
|
30716
|
+
modelComponent = /* @__PURE__ */ jsx10(
|
|
30514
30717
|
GltfModel,
|
|
30515
30718
|
{
|
|
30516
30719
|
gltfUrl,
|
|
@@ -30528,8 +30731,26 @@ var AnyCadComponent = ({
|
|
|
30528
30731
|
},
|
|
30529
30732
|
cad_component2.cad_component_id
|
|
30530
30733
|
);
|
|
30734
|
+
} else if (stepUrl && !cad_component2.model_jscad && !cad_component2.footprinter_string) {
|
|
30735
|
+
modelComponent = /* @__PURE__ */ jsx10(
|
|
30736
|
+
StepModel,
|
|
30737
|
+
{
|
|
30738
|
+
stepUrl,
|
|
30739
|
+
position: cad_component2.position ? [
|
|
30740
|
+
cad_component2.position.x,
|
|
30741
|
+
cad_component2.position.y,
|
|
30742
|
+
cad_component2.position.z
|
|
30743
|
+
] : void 0,
|
|
30744
|
+
rotation: rotationOffset,
|
|
30745
|
+
scale: cad_component2.model_unit_to_mm_scale_factor,
|
|
30746
|
+
onHover: handleHover,
|
|
30747
|
+
onUnhover: handleUnhover,
|
|
30748
|
+
isHovered,
|
|
30749
|
+
isTranslucent: cad_component2.show_as_translucent_model
|
|
30750
|
+
}
|
|
30751
|
+
);
|
|
30531
30752
|
} else if (cad_component2.model_jscad) {
|
|
30532
|
-
modelComponent = /* @__PURE__ */
|
|
30753
|
+
modelComponent = /* @__PURE__ */ jsx10(
|
|
30533
30754
|
JscadModel,
|
|
30534
30755
|
{
|
|
30535
30756
|
jscadPlan: cad_component2.model_jscad,
|
|
@@ -30543,7 +30764,7 @@ var AnyCadComponent = ({
|
|
|
30543
30764
|
cad_component2.cad_component_id
|
|
30544
30765
|
);
|
|
30545
30766
|
} else if (cad_component2.footprinter_string) {
|
|
30546
|
-
modelComponent = /* @__PURE__ */
|
|
30767
|
+
modelComponent = /* @__PURE__ */ jsx10(
|
|
30547
30768
|
FootprinterModel,
|
|
30548
30769
|
{
|
|
30549
30770
|
positionOffset: cad_component2.position ? [
|
|
@@ -30575,7 +30796,7 @@ var AnyCadComponent = ({
|
|
|
30575
30796
|
}
|
|
30576
30797
|
return /* @__PURE__ */ jsxs2(Fragment3, { children: [
|
|
30577
30798
|
modelComponent,
|
|
30578
|
-
isHovered && hoverPosition ? /* @__PURE__ */
|
|
30799
|
+
isHovered && hoverPosition ? /* @__PURE__ */ jsx10(
|
|
30579
30800
|
Html,
|
|
30580
30801
|
{
|
|
30581
30802
|
position: hoverPosition,
|
|
@@ -30598,13 +30819,13 @@ var AnyCadComponent = ({
|
|
|
30598
30819
|
};
|
|
30599
30820
|
|
|
30600
30821
|
// src/CadViewerContainer.tsx
|
|
30601
|
-
import { forwardRef as forwardRef2, useEffect as
|
|
30822
|
+
import { forwardRef as forwardRef2, useEffect as useEffect17, useMemo as useMemo13, useState as useState10 } from "react";
|
|
30602
30823
|
import * as THREE16 from "three";
|
|
30603
30824
|
|
|
30604
30825
|
// package.json
|
|
30605
30826
|
var package_default = {
|
|
30606
30827
|
name: "@tscircuit/3d-viewer",
|
|
30607
|
-
version: "0.0.
|
|
30828
|
+
version: "0.0.484",
|
|
30608
30829
|
main: "./dist/index.js",
|
|
30609
30830
|
module: "./dist/index.js",
|
|
30610
30831
|
type: "module",
|
|
@@ -30681,8 +30902,8 @@ var package_default = {
|
|
|
30681
30902
|
// src/react-three/Canvas.tsx
|
|
30682
30903
|
import {
|
|
30683
30904
|
useRef as useRef4,
|
|
30684
|
-
useEffect as
|
|
30685
|
-
useState as
|
|
30905
|
+
useEffect as useEffect11,
|
|
30906
|
+
useState as useState9,
|
|
30686
30907
|
useCallback as useCallback5,
|
|
30687
30908
|
forwardRef,
|
|
30688
30909
|
useImperativeHandle,
|
|
@@ -30710,10 +30931,10 @@ import {
|
|
|
30710
30931
|
useContext as useContext4,
|
|
30711
30932
|
useMemo as useMemo8,
|
|
30712
30933
|
useRef as useRef3,
|
|
30713
|
-
useState as
|
|
30934
|
+
useState as useState8
|
|
30714
30935
|
} from "react";
|
|
30715
30936
|
import * as THREE9 from "three";
|
|
30716
|
-
import { jsx as
|
|
30937
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
30717
30938
|
var CAMERA_KEY = "cadViewerCameraStateSession";
|
|
30718
30939
|
var saveCameraToSession = (camera, controls) => {
|
|
30719
30940
|
try {
|
|
@@ -30755,12 +30976,12 @@ var CameraControllerContext = createContext4(void 0);
|
|
|
30755
30976
|
var CameraControllerProvider = ({ children, defaultTarget, initialCameraPosition }) => {
|
|
30756
30977
|
const controlsRef = useRef3(null);
|
|
30757
30978
|
const mainCameraRef = useRef3(null);
|
|
30758
|
-
const [controller, setController] =
|
|
30759
|
-
const [cameraType, setCameraType] =
|
|
30979
|
+
const [controller, setController] = useState8(null);
|
|
30980
|
+
const [cameraType, setCameraType] = useState8(
|
|
30760
30981
|
"perspective"
|
|
30761
30982
|
);
|
|
30762
|
-
const [cameraPosition, setCameraPosition] =
|
|
30763
|
-
const [cameraRotation, setCameraRotation] =
|
|
30983
|
+
const [cameraPosition, setCameraPosition] = useState8(initialCameraPosition ?? null);
|
|
30984
|
+
const [cameraRotation, setCameraRotation] = useState8(
|
|
30764
30985
|
new THREE9.Euler(0, 0, 0)
|
|
30765
30986
|
);
|
|
30766
30987
|
const baseDistance = useMemo8(() => {
|
|
@@ -30901,7 +31122,7 @@ var CameraControllerProvider = ({ children, defaultTarget, initialCameraPosition
|
|
|
30901
31122
|
cameraRotation
|
|
30902
31123
|
]
|
|
30903
31124
|
);
|
|
30904
|
-
return /* @__PURE__ */
|
|
31125
|
+
return /* @__PURE__ */ jsx11(CameraControllerContext.Provider, { value: cameraControllerContextValue, children });
|
|
30905
31126
|
};
|
|
30906
31127
|
var useCameraController = () => {
|
|
30907
31128
|
const context = useContext4(CameraControllerContext);
|
|
@@ -30914,12 +31135,12 @@ var useCameraController = () => {
|
|
|
30914
31135
|
};
|
|
30915
31136
|
|
|
30916
31137
|
// src/react-three/Canvas.tsx
|
|
30917
|
-
import { jsx as
|
|
31138
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
30918
31139
|
var Canvas = forwardRef(
|
|
30919
31140
|
({ children, scene: sceneProps, camera: cameraProps, style, onCreated }, ref) => {
|
|
30920
31141
|
const { cameraType } = useCameraController();
|
|
30921
31142
|
const mountRef = useRef4(null);
|
|
30922
|
-
const [contextState, setContextState] =
|
|
31143
|
+
const [contextState, setContextState] = useState9(
|
|
30923
31144
|
null
|
|
30924
31145
|
);
|
|
30925
31146
|
const frameListeners = useRef4(
|
|
@@ -30948,7 +31169,7 @@ var Canvas = forwardRef(
|
|
|
30948
31169
|
}
|
|
30949
31170
|
const rootObject = useRef4(new THREE10.Object3D());
|
|
30950
31171
|
useImperativeHandle(ref, () => rootObject.current);
|
|
30951
|
-
|
|
31172
|
+
useEffect11(() => {
|
|
30952
31173
|
if (!mountRef.current) return;
|
|
30953
31174
|
removeExistingCanvases(mountRef.current);
|
|
30954
31175
|
const renderer = new THREE10.WebGLRenderer({ antialias: true, alpha: true });
|
|
@@ -31043,12 +31264,12 @@ var Canvas = forwardRef(
|
|
|
31043
31264
|
}
|
|
31044
31265
|
};
|
|
31045
31266
|
}, [scene, addFrameListener, removeFrameListener, cameraType]);
|
|
31046
|
-
return /* @__PURE__ */
|
|
31267
|
+
return /* @__PURE__ */ jsx12("div", { ref: mountRef, style: { width: "100%", height: "100%", ...style }, children: contextState && /* @__PURE__ */ jsx12(ThreeContext.Provider, { value: contextState, children: /* @__PURE__ */ jsx12(HoverProvider, { children }) }) });
|
|
31047
31268
|
}
|
|
31048
31269
|
);
|
|
31049
31270
|
|
|
31050
31271
|
// src/react-three/OrbitControls.tsx
|
|
31051
|
-
import { useEffect as
|
|
31272
|
+
import { useEffect as useEffect12, useMemo as useMemo10 } from "react";
|
|
31052
31273
|
import * as THREE11 from "three";
|
|
31053
31274
|
import { OrbitControls as ThreeOrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
|
|
31054
31275
|
var OrbitControls = ({
|
|
@@ -31068,11 +31289,11 @@ var OrbitControls = ({
|
|
|
31068
31289
|
if (!camera || !renderer) return null;
|
|
31069
31290
|
return new ThreeOrbitControls(camera, renderer.domElement);
|
|
31070
31291
|
}, [camera, renderer]);
|
|
31071
|
-
|
|
31292
|
+
useEffect12(() => {
|
|
31072
31293
|
onControlsChange?.(controls ?? null);
|
|
31073
31294
|
return () => onControlsChange?.(null);
|
|
31074
31295
|
}, [controls, onControlsChange]);
|
|
31075
|
-
|
|
31296
|
+
useEffect12(() => {
|
|
31076
31297
|
if (!controls) return;
|
|
31077
31298
|
const handleChange = () => {
|
|
31078
31299
|
onControlsChange?.(controls);
|
|
@@ -31082,7 +31303,7 @@ var OrbitControls = ({
|
|
|
31082
31303
|
controls.removeEventListener("change", handleChange);
|
|
31083
31304
|
};
|
|
31084
31305
|
}, [controls, onControlsChange]);
|
|
31085
|
-
|
|
31306
|
+
useEffect12(() => {
|
|
31086
31307
|
if (!controls) return;
|
|
31087
31308
|
controls.autoRotate = autoRotate || false;
|
|
31088
31309
|
controls.autoRotateSpeed = autoRotateSpeed || 1;
|
|
@@ -31115,14 +31336,14 @@ var OrbitControls = ({
|
|
|
31115
31336
|
dampingFactor,
|
|
31116
31337
|
target
|
|
31117
31338
|
]);
|
|
31118
|
-
|
|
31339
|
+
useEffect12(() => {
|
|
31119
31340
|
if (!controls || !onStart) return;
|
|
31120
31341
|
controls.addEventListener("start", onStart);
|
|
31121
31342
|
return () => {
|
|
31122
31343
|
controls.removeEventListener("start", onStart);
|
|
31123
31344
|
};
|
|
31124
31345
|
}, [controls, onStart]);
|
|
31125
|
-
|
|
31346
|
+
useEffect12(() => {
|
|
31126
31347
|
if (!controls) return;
|
|
31127
31348
|
return () => {
|
|
31128
31349
|
controls.dispose();
|
|
@@ -31135,7 +31356,7 @@ var OrbitControls = ({
|
|
|
31135
31356
|
};
|
|
31136
31357
|
|
|
31137
31358
|
// src/react-three/Grid.tsx
|
|
31138
|
-
import { useEffect as
|
|
31359
|
+
import { useEffect as useEffect13, useMemo as useMemo11 } from "react";
|
|
31139
31360
|
import * as THREE12 from "three";
|
|
31140
31361
|
var vertexShader = `
|
|
31141
31362
|
varying vec3 worldPosition;
|
|
@@ -31210,7 +31431,7 @@ var Grid = ({
|
|
|
31210
31431
|
gridMesh.position.set(camera.position.x, camera.position.y, 0);
|
|
31211
31432
|
}
|
|
31212
31433
|
});
|
|
31213
|
-
|
|
31434
|
+
useEffect13(() => {
|
|
31214
31435
|
if (!scene || !gridMesh) return;
|
|
31215
31436
|
scene.add(gridMesh);
|
|
31216
31437
|
return () => {
|
|
@@ -31227,7 +31448,7 @@ var Grid = ({
|
|
|
31227
31448
|
};
|
|
31228
31449
|
|
|
31229
31450
|
// src/react-three/Lights.tsx
|
|
31230
|
-
import { useEffect as
|
|
31451
|
+
import { useEffect as useEffect14, useMemo as useMemo12 } from "react";
|
|
31231
31452
|
import * as THREE13 from "three";
|
|
31232
31453
|
var Lights = () => {
|
|
31233
31454
|
const { scene } = useThree();
|
|
@@ -31241,7 +31462,7 @@ var Lights = () => {
|
|
|
31241
31462
|
light.decay = 0;
|
|
31242
31463
|
return light;
|
|
31243
31464
|
}, []);
|
|
31244
|
-
|
|
31465
|
+
useEffect14(() => {
|
|
31245
31466
|
if (!scene) return;
|
|
31246
31467
|
scene.add(ambientLight);
|
|
31247
31468
|
scene.add(pointLight);
|
|
@@ -31254,7 +31475,7 @@ var Lights = () => {
|
|
|
31254
31475
|
};
|
|
31255
31476
|
|
|
31256
31477
|
// src/hooks/cameraAnimation.ts
|
|
31257
|
-
import { useCallback as useCallback6, useEffect as
|
|
31478
|
+
import { useCallback as useCallback6, useEffect as useEffect15, useRef as useRef5 } from "react";
|
|
31258
31479
|
import * as THREE14 from "three";
|
|
31259
31480
|
var easeInOutCubic = (t) => t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
|
|
31260
31481
|
var CameraAnimatorWithContext = () => {
|
|
@@ -31326,7 +31547,7 @@ var CameraAnimatorWithContext = () => {
|
|
|
31326
31547
|
},
|
|
31327
31548
|
[animateTo, getPresetConfig]
|
|
31328
31549
|
);
|
|
31329
|
-
|
|
31550
|
+
useEffect15(() => {
|
|
31330
31551
|
if (!mainCameraRef.current) return;
|
|
31331
31552
|
const controller = {
|
|
31332
31553
|
animateTo,
|
|
@@ -31439,10 +31660,10 @@ var useCameraSession = () => {
|
|
|
31439
31660
|
};
|
|
31440
31661
|
|
|
31441
31662
|
// src/three-components/OrientationCubeCanvas.tsx
|
|
31442
|
-
import { useEffect as
|
|
31663
|
+
import { useEffect as useEffect16, useRef as useRef7 } from "react";
|
|
31443
31664
|
import * as THREE15 from "three";
|
|
31444
31665
|
import { Text as TroikaText } from "troika-three-text";
|
|
31445
|
-
import { jsx as
|
|
31666
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
31446
31667
|
function computePointInFront(rotationVector, distance3) {
|
|
31447
31668
|
const quaternion = new THREE15.Quaternion().setFromEuler(
|
|
31448
31669
|
new THREE15.Euler(rotationVector.x, rotationVector.y, rotationVector.z)
|
|
@@ -31460,7 +31681,7 @@ var OrientationCubeCanvas = () => {
|
|
|
31460
31681
|
const sceneRef = useRef7(null);
|
|
31461
31682
|
const cameraRef = useRef7(null);
|
|
31462
31683
|
const animationFrameRef = useRef7(null);
|
|
31463
|
-
|
|
31684
|
+
useEffect16(() => {
|
|
31464
31685
|
if (!containerRef.current) return;
|
|
31465
31686
|
const canvas = document.createElement("canvas");
|
|
31466
31687
|
canvasRef.current = canvas;
|
|
@@ -31579,7 +31800,7 @@ var OrientationCubeCanvas = () => {
|
|
|
31579
31800
|
}
|
|
31580
31801
|
};
|
|
31581
31802
|
}, [mainCameraRef]);
|
|
31582
|
-
return /* @__PURE__ */
|
|
31803
|
+
return /* @__PURE__ */ jsx13(
|
|
31583
31804
|
"div",
|
|
31584
31805
|
{
|
|
31585
31806
|
ref: containerRef,
|
|
@@ -31596,7 +31817,7 @@ var OrientationCubeCanvas = () => {
|
|
|
31596
31817
|
};
|
|
31597
31818
|
|
|
31598
31819
|
// src/CadViewerContainer.tsx
|
|
31599
|
-
import { jsx as
|
|
31820
|
+
import { jsx as jsx14, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
31600
31821
|
var RotationTracker = () => {
|
|
31601
31822
|
const { camera } = useThree();
|
|
31602
31823
|
const { setCameraRotation } = useCameraController();
|
|
@@ -31618,7 +31839,7 @@ var CadViewerContainer = forwardRef2(
|
|
|
31618
31839
|
onUserInteraction,
|
|
31619
31840
|
onCameraControllerReady
|
|
31620
31841
|
}, ref) => {
|
|
31621
|
-
const [isInteractionEnabled, setIsInteractionEnabled] =
|
|
31842
|
+
const [isInteractionEnabled, setIsInteractionEnabled] = useState10(
|
|
31622
31843
|
!clickToInteractEnabled
|
|
31623
31844
|
);
|
|
31624
31845
|
const { mainCameraRef, handleControlsChange, controller } = useCameraController();
|
|
@@ -31626,7 +31847,7 @@ var CadViewerContainer = forwardRef2(
|
|
|
31626
31847
|
handleCameraCreated,
|
|
31627
31848
|
handleControlsChange: handleSessionControlsChange
|
|
31628
31849
|
} = useCameraSession();
|
|
31629
|
-
|
|
31850
|
+
useEffect17(() => {
|
|
31630
31851
|
if (onCameraControllerReady) {
|
|
31631
31852
|
onCameraControllerReady(controller);
|
|
31632
31853
|
}
|
|
@@ -31644,7 +31865,7 @@ var CadViewerContainer = forwardRef2(
|
|
|
31644
31865
|
return [boardCenter.x, boardCenter.y, 0];
|
|
31645
31866
|
}, [boardCenter]);
|
|
31646
31867
|
return /* @__PURE__ */ jsxs3("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
|
|
31647
|
-
/* @__PURE__ */
|
|
31868
|
+
/* @__PURE__ */ jsx14(OrientationCubeCanvas, {}),
|
|
31648
31869
|
/* @__PURE__ */ jsxs3(
|
|
31649
31870
|
Canvas,
|
|
31650
31871
|
{
|
|
@@ -31656,9 +31877,9 @@ var CadViewerContainer = forwardRef2(
|
|
|
31656
31877
|
handleCameraCreated(camera);
|
|
31657
31878
|
},
|
|
31658
31879
|
children: [
|
|
31659
|
-
/* @__PURE__ */
|
|
31660
|
-
/* @__PURE__ */
|
|
31661
|
-
isInteractionEnabled && /* @__PURE__ */
|
|
31880
|
+
/* @__PURE__ */ jsx14(CameraAnimatorWithContext, {}),
|
|
31881
|
+
/* @__PURE__ */ jsx14(RotationTracker, {}),
|
|
31882
|
+
isInteractionEnabled && /* @__PURE__ */ jsx14(
|
|
31662
31883
|
OrbitControls,
|
|
31663
31884
|
{
|
|
31664
31885
|
autoRotate: !autoRotateDisabled,
|
|
@@ -31676,8 +31897,8 @@ var CadViewerContainer = forwardRef2(
|
|
|
31676
31897
|
}
|
|
31677
31898
|
}
|
|
31678
31899
|
),
|
|
31679
|
-
/* @__PURE__ */
|
|
31680
|
-
/* @__PURE__ */
|
|
31900
|
+
/* @__PURE__ */ jsx14(Lights, {}),
|
|
31901
|
+
/* @__PURE__ */ jsx14(
|
|
31681
31902
|
Grid,
|
|
31682
31903
|
{
|
|
31683
31904
|
rotation: [Math.PI / 2, 0, 0],
|
|
@@ -31709,7 +31930,7 @@ var CadViewerContainer = forwardRef2(
|
|
|
31709
31930
|
]
|
|
31710
31931
|
}
|
|
31711
31932
|
),
|
|
31712
|
-
clickToInteractEnabled && !isInteractionEnabled && /* @__PURE__ */
|
|
31933
|
+
clickToInteractEnabled && !isInteractionEnabled && /* @__PURE__ */ jsx14(
|
|
31713
31934
|
"button",
|
|
31714
31935
|
{
|
|
31715
31936
|
type: "button",
|
|
@@ -31728,7 +31949,7 @@ var CadViewerContainer = forwardRef2(
|
|
|
31728
31949
|
alignItems: "center",
|
|
31729
31950
|
justifyContent: "center"
|
|
31730
31951
|
},
|
|
31731
|
-
children: /* @__PURE__ */
|
|
31952
|
+
children: /* @__PURE__ */ jsx14(
|
|
31732
31953
|
"div",
|
|
31733
31954
|
{
|
|
31734
31955
|
style: {
|
|
@@ -31763,12 +31984,12 @@ var useConvertChildrenToCircuitJson = (children) => {
|
|
|
31763
31984
|
};
|
|
31764
31985
|
|
|
31765
31986
|
// src/hooks/use-stls-from-geom.ts
|
|
31766
|
-
import { useState as
|
|
31987
|
+
import { useState as useState11, useEffect as useEffect18 } from "react";
|
|
31767
31988
|
import stlSerializer from "@jscad/stl-serializer";
|
|
31768
31989
|
var useStlsFromGeom = (geom) => {
|
|
31769
|
-
const [stls, setStls] =
|
|
31770
|
-
const [loading, setLoading] =
|
|
31771
|
-
|
|
31990
|
+
const [stls, setStls] = useState11([]);
|
|
31991
|
+
const [loading, setLoading] = useState11(true);
|
|
31992
|
+
useEffect18(() => {
|
|
31772
31993
|
if (!geom) return;
|
|
31773
31994
|
const generateStls = async () => {
|
|
31774
31995
|
setLoading(true);
|
|
@@ -31797,7 +32018,7 @@ var useStlsFromGeom = (geom) => {
|
|
|
31797
32018
|
};
|
|
31798
32019
|
|
|
31799
32020
|
// src/hooks/useBoardGeomBuilder.ts
|
|
31800
|
-
import { useState as
|
|
32021
|
+
import { useState as useState12, useEffect as useEffect19, useRef as useRef8 } from "react";
|
|
31801
32022
|
|
|
31802
32023
|
// src/soup-to-3d/index.ts
|
|
31803
32024
|
var import_primitives2 = __toESM(require_primitives(), 1);
|
|
@@ -33114,7 +33335,7 @@ var BoardGeomBuilder = class {
|
|
|
33114
33335
|
if (!this.boardGeom) return;
|
|
33115
33336
|
const holeDepth = this.ctx.pcbThickness * 1.5;
|
|
33116
33337
|
const copperInset = 0.02;
|
|
33117
|
-
if (hole.hole_shape === "
|
|
33338
|
+
if (hole.hole_shape === "circle") {
|
|
33118
33339
|
const cyGeom = (0, import_primitives7.cylinder)({
|
|
33119
33340
|
center: [hole.x, hole.y, 0],
|
|
33120
33341
|
radius: hole.hole_diameter / 2 + M,
|
|
@@ -33287,9 +33508,9 @@ var BoardGeomBuilder = class {
|
|
|
33287
33508
|
|
|
33288
33509
|
// src/hooks/useBoardGeomBuilder.ts
|
|
33289
33510
|
var useBoardGeomBuilder = (circuitJson) => {
|
|
33290
|
-
const [boardGeom, setBoardGeom] =
|
|
33511
|
+
const [boardGeom, setBoardGeom] = useState12(null);
|
|
33291
33512
|
const isProcessingRef = useRef8(false);
|
|
33292
|
-
|
|
33513
|
+
useEffect19(() => {
|
|
33293
33514
|
let isCancelled = false;
|
|
33294
33515
|
if (!circuitJson) {
|
|
33295
33516
|
setBoardGeom(null);
|
|
@@ -33351,10 +33572,10 @@ function usePcbThickness(circuitJson) {
|
|
|
33351
33572
|
}
|
|
33352
33573
|
|
|
33353
33574
|
// src/three-components/Error3d.tsx
|
|
33354
|
-
import { useState as
|
|
33575
|
+
import { useState as useState13, useCallback as useCallback8, useEffect as useEffect21, useMemo as useMemo17 } from "react";
|
|
33355
33576
|
|
|
33356
33577
|
// src/react-three/Text.tsx
|
|
33357
|
-
import { useEffect as
|
|
33578
|
+
import { useEffect as useEffect20, useMemo as useMemo16 } from "react";
|
|
33358
33579
|
import { Text as TroikaText2 } from "troika-three-text";
|
|
33359
33580
|
var Text = ({
|
|
33360
33581
|
children,
|
|
@@ -33394,7 +33615,7 @@ var Text = ({
|
|
|
33394
33615
|
anchorY,
|
|
33395
33616
|
depthOffset
|
|
33396
33617
|
]);
|
|
33397
|
-
|
|
33618
|
+
useEffect20(() => {
|
|
33398
33619
|
const parentObject = parent || rootObject;
|
|
33399
33620
|
if (!parentObject || !mesh) return;
|
|
33400
33621
|
parentObject.add(mesh);
|
|
@@ -33408,14 +33629,14 @@ var Text = ({
|
|
|
33408
33629
|
|
|
33409
33630
|
// src/three-components/Error3d.tsx
|
|
33410
33631
|
import * as THREE17 from "three";
|
|
33411
|
-
import { Fragment as Fragment4, jsx as
|
|
33632
|
+
import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
33412
33633
|
var Error3d = ({
|
|
33413
33634
|
error,
|
|
33414
33635
|
cad_component: cad_component2
|
|
33415
33636
|
}) => {
|
|
33416
33637
|
const { rootObject } = useThree();
|
|
33417
|
-
const [isHovered, setIsHovered] =
|
|
33418
|
-
const [hoverPosition, setHoverPosition] =
|
|
33638
|
+
const [isHovered, setIsHovered] = useState13(false);
|
|
33639
|
+
const [hoverPosition, setHoverPosition] = useState13(null);
|
|
33419
33640
|
const handleHover = useCallback8((e) => {
|
|
33420
33641
|
if (e?.mousePosition) {
|
|
33421
33642
|
setIsHovered(true);
|
|
@@ -33445,7 +33666,7 @@ var Error3d = ({
|
|
|
33445
33666
|
g.position.fromArray(position);
|
|
33446
33667
|
return g;
|
|
33447
33668
|
}, [position]);
|
|
33448
|
-
|
|
33669
|
+
useEffect21(() => {
|
|
33449
33670
|
if (!rootObject) return;
|
|
33450
33671
|
rootObject.add(group);
|
|
33451
33672
|
return () => {
|
|
@@ -33461,8 +33682,8 @@ var Error3d = ({
|
|
|
33461
33682
|
onUnhover: handleUnhover,
|
|
33462
33683
|
object: group,
|
|
33463
33684
|
children: [
|
|
33464
|
-
/* @__PURE__ */
|
|
33465
|
-
/* @__PURE__ */
|
|
33685
|
+
/* @__PURE__ */ jsx15(ErrorBox, { parent: group }),
|
|
33686
|
+
/* @__PURE__ */ jsx15(
|
|
33466
33687
|
Text,
|
|
33467
33688
|
{
|
|
33468
33689
|
parent: group,
|
|
@@ -33477,7 +33698,7 @@ var Error3d = ({
|
|
|
33477
33698
|
]
|
|
33478
33699
|
}
|
|
33479
33700
|
),
|
|
33480
|
-
isHovered && hoverPosition ? /* @__PURE__ */
|
|
33701
|
+
isHovered && hoverPosition ? /* @__PURE__ */ jsx15(
|
|
33481
33702
|
Html,
|
|
33482
33703
|
{
|
|
33483
33704
|
position: hoverPosition,
|
|
@@ -33514,7 +33735,7 @@ var ErrorBox = ({ parent }) => {
|
|
|
33514
33735
|
m.rotation.fromArray([Math.PI / 4, Math.PI / 4, 0]);
|
|
33515
33736
|
return m;
|
|
33516
33737
|
}, []);
|
|
33517
|
-
|
|
33738
|
+
useEffect21(() => {
|
|
33518
33739
|
parent.add(mesh);
|
|
33519
33740
|
return () => {
|
|
33520
33741
|
parent.remove(mesh);
|
|
@@ -33524,7 +33745,7 @@ var ErrorBox = ({ parent }) => {
|
|
|
33524
33745
|
};
|
|
33525
33746
|
|
|
33526
33747
|
// src/three-components/STLModel.tsx
|
|
33527
|
-
import { useState as
|
|
33748
|
+
import { useState as useState14, useEffect as useEffect22, useMemo as useMemo18 } from "react";
|
|
33528
33749
|
import * as THREE18 from "three";
|
|
33529
33750
|
import { STLLoader } from "three-stdlib";
|
|
33530
33751
|
function STLModel({
|
|
@@ -33535,8 +33756,8 @@ function STLModel({
|
|
|
33535
33756
|
opacity = 1
|
|
33536
33757
|
}) {
|
|
33537
33758
|
const { rootObject } = useThree();
|
|
33538
|
-
const [geom, setGeom] =
|
|
33539
|
-
|
|
33759
|
+
const [geom, setGeom] = useState14(null);
|
|
33760
|
+
useEffect22(() => {
|
|
33540
33761
|
const loader = new STLLoader();
|
|
33541
33762
|
if (stlData) {
|
|
33542
33763
|
try {
|
|
@@ -33563,7 +33784,7 @@ function STLModel({
|
|
|
33563
33784
|
});
|
|
33564
33785
|
return new THREE18.Mesh(geom, material);
|
|
33565
33786
|
}, [geom, color, opacity]);
|
|
33566
|
-
|
|
33787
|
+
useEffect22(() => {
|
|
33567
33788
|
if (!rootObject || !mesh) return;
|
|
33568
33789
|
rootObject.add(mesh);
|
|
33569
33790
|
return () => {
|
|
@@ -33580,7 +33801,7 @@ function STLModel({
|
|
|
33580
33801
|
}
|
|
33581
33802
|
|
|
33582
33803
|
// src/three-components/VisibleSTLModel.tsx
|
|
33583
|
-
import { jsx as
|
|
33804
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
33584
33805
|
function VisibleSTLModel({
|
|
33585
33806
|
stlData,
|
|
33586
33807
|
color,
|
|
@@ -33603,7 +33824,7 @@ function VisibleSTLModel({
|
|
|
33603
33824
|
if (!shouldShow) {
|
|
33604
33825
|
return null;
|
|
33605
33826
|
}
|
|
33606
|
-
return /* @__PURE__ */
|
|
33827
|
+
return /* @__PURE__ */ jsx16(STLModel, { stlData, color, opacity });
|
|
33607
33828
|
}
|
|
33608
33829
|
|
|
33609
33830
|
// src/three-components/ThreeErrorBoundary.tsx
|
|
@@ -33625,7 +33846,7 @@ var ThreeErrorBoundary = class extends React11.Component {
|
|
|
33625
33846
|
};
|
|
33626
33847
|
|
|
33627
33848
|
// src/three-components/JscadBoardTextures.tsx
|
|
33628
|
-
import { useEffect as
|
|
33849
|
+
import { useEffect as useEffect23, useMemo as useMemo19 } from "react";
|
|
33629
33850
|
import * as THREE24 from "three";
|
|
33630
33851
|
import { su as su9 } from "@tscircuit/circuit-json-util";
|
|
33631
33852
|
|
|
@@ -35380,7 +35601,7 @@ function JscadBoardTextures({
|
|
|
35380
35601
|
})
|
|
35381
35602
|
};
|
|
35382
35603
|
}, [circuitJson, boardData]);
|
|
35383
|
-
|
|
35604
|
+
useEffect23(() => {
|
|
35384
35605
|
if (!rootObject || !boardData || !textures) return;
|
|
35385
35606
|
const meshes = [];
|
|
35386
35607
|
const createTexturePlane2 = (texture, zOffset, isBottomLayer, name, usePolygonOffset = false, depthWrite = false) => {
|
|
@@ -35643,7 +35864,7 @@ function addFauxBoardIfNeeded(circuitJson) {
|
|
|
35643
35864
|
}
|
|
35644
35865
|
|
|
35645
35866
|
// src/CadViewerJscad.tsx
|
|
35646
|
-
import { jsx as
|
|
35867
|
+
import { jsx as jsx17, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
35647
35868
|
var CadViewerJscad = forwardRef3(
|
|
35648
35869
|
({
|
|
35649
35870
|
soup,
|
|
@@ -35732,7 +35953,7 @@ var CadViewerJscad = forwardRef3(
|
|
|
35732
35953
|
onUserInteraction,
|
|
35733
35954
|
onCameraControllerReady,
|
|
35734
35955
|
children: [
|
|
35735
|
-
boardStls.map(({ stlData, color, layerType }, index2) => /* @__PURE__ */
|
|
35956
|
+
boardStls.map(({ stlData, color, layerType }, index2) => /* @__PURE__ */ jsx17(
|
|
35736
35957
|
VisibleSTLModel,
|
|
35737
35958
|
{
|
|
35738
35959
|
stlData,
|
|
@@ -35742,7 +35963,7 @@ var CadViewerJscad = forwardRef3(
|
|
|
35742
35963
|
},
|
|
35743
35964
|
`board-${index2}`
|
|
35744
35965
|
)),
|
|
35745
|
-
/* @__PURE__ */
|
|
35966
|
+
/* @__PURE__ */ jsx17(
|
|
35746
35967
|
JscadBoardTextures,
|
|
35747
35968
|
{
|
|
35748
35969
|
circuitJson: internalCircuitJson,
|
|
@@ -35750,11 +35971,11 @@ var CadViewerJscad = forwardRef3(
|
|
|
35750
35971
|
isFaux: isFauxBoard
|
|
35751
35972
|
}
|
|
35752
35973
|
),
|
|
35753
|
-
cad_components.map((cad_component2) => /* @__PURE__ */
|
|
35974
|
+
cad_components.map((cad_component2) => /* @__PURE__ */ jsx17(
|
|
35754
35975
|
ThreeErrorBoundary,
|
|
35755
35976
|
{
|
|
35756
|
-
fallback: ({ error }) => /* @__PURE__ */
|
|
35757
|
-
children: /* @__PURE__ */
|
|
35977
|
+
fallback: ({ error }) => /* @__PURE__ */ jsx17(Error3d, { cad_component: cad_component2, error }),
|
|
35978
|
+
children: /* @__PURE__ */ jsx17(
|
|
35758
35979
|
AnyCadComponent,
|
|
35759
35980
|
{
|
|
35760
35981
|
cad_component: cad_component2,
|
|
@@ -35773,10 +35994,10 @@ var CadViewerJscad = forwardRef3(
|
|
|
35773
35994
|
|
|
35774
35995
|
// src/CadViewerManifold.tsx
|
|
35775
35996
|
import { su as su19 } from "@tscircuit/circuit-json-util";
|
|
35776
|
-
import { useEffect as
|
|
35997
|
+
import { useEffect as useEffect25, useMemo as useMemo22, useState as useState16 } from "react";
|
|
35777
35998
|
|
|
35778
35999
|
// src/hooks/useManifoldBoardBuilder.ts
|
|
35779
|
-
import { useState as
|
|
36000
|
+
import { useState as useState15, useEffect as useEffect24, useMemo as useMemo21, useRef as useRef9 } from "react";
|
|
35780
36001
|
import { su as su18 } from "@tscircuit/circuit-json-util";
|
|
35781
36002
|
import * as THREE31 from "three";
|
|
35782
36003
|
|
|
@@ -36068,7 +36289,7 @@ function createPlatedHoleDrill({
|
|
|
36068
36289
|
|
|
36069
36290
|
// src/utils/manifold/process-non-plated-holes.ts
|
|
36070
36291
|
function isCircleHole(hole) {
|
|
36071
|
-
return
|
|
36292
|
+
return hole.hole_shape === "circle" && typeof hole.hole_diameter === "number";
|
|
36072
36293
|
}
|
|
36073
36294
|
function isPillHole(hole) {
|
|
36074
36295
|
return (hole.shape === "pill" || hole.hole_shape === "pill") && typeof hole.hole_width === "number" && typeof hole.hole_height === "number";
|
|
@@ -37299,11 +37520,11 @@ function createTextureMeshes(textures, boardData, pcbThickness, isFaux = false)
|
|
|
37299
37520
|
|
|
37300
37521
|
// src/hooks/useManifoldBoardBuilder.ts
|
|
37301
37522
|
var useManifoldBoardBuilder = (manifoldJSModule, circuitJson) => {
|
|
37302
|
-
const [geoms, setGeoms] =
|
|
37303
|
-
const [textures, setTextures] =
|
|
37304
|
-
const [pcbThickness, setPcbThickness] =
|
|
37305
|
-
const [error, setError] =
|
|
37306
|
-
const [isLoading, setIsLoading] =
|
|
37523
|
+
const [geoms, setGeoms] = useState15(null);
|
|
37524
|
+
const [textures, setTextures] = useState15(null);
|
|
37525
|
+
const [pcbThickness, setPcbThickness] = useState15(null);
|
|
37526
|
+
const [error, setError] = useState15(null);
|
|
37527
|
+
const [isLoading, setIsLoading] = useState15(true);
|
|
37307
37528
|
const manifoldInstancesForCleanup = useRef9([]);
|
|
37308
37529
|
const boardData = useMemo21(() => {
|
|
37309
37530
|
const panels = circuitJson.filter(
|
|
@@ -37333,7 +37554,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson) => {
|
|
|
37333
37554
|
const boards = su18(circuitJson).pcb_board.list();
|
|
37334
37555
|
return boards.length > 0 && boards[0].pcb_board_id === "faux-board";
|
|
37335
37556
|
}, [circuitJson]);
|
|
37336
|
-
|
|
37557
|
+
useEffect24(() => {
|
|
37337
37558
|
if (!manifoldJSModule || !boardData) {
|
|
37338
37559
|
setGeoms(null);
|
|
37339
37560
|
setTextures(null);
|
|
@@ -37726,14 +37947,14 @@ function createGeometryMeshes(geoms) {
|
|
|
37726
37947
|
}
|
|
37727
37948
|
|
|
37728
37949
|
// src/CadViewerManifold.tsx
|
|
37729
|
-
import { jsx as
|
|
37950
|
+
import { jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
37730
37951
|
var BoardMeshes = ({
|
|
37731
37952
|
geometryMeshes,
|
|
37732
37953
|
textureMeshes
|
|
37733
37954
|
}) => {
|
|
37734
37955
|
const { rootObject } = useThree();
|
|
37735
37956
|
const { visibility } = useLayerVisibility();
|
|
37736
|
-
|
|
37957
|
+
useEffect25(() => {
|
|
37737
37958
|
if (!rootObject) return;
|
|
37738
37959
|
geometryMeshes.forEach((mesh) => {
|
|
37739
37960
|
let shouldShow = true;
|
|
@@ -37816,9 +38037,9 @@ var CadViewerManifold = ({
|
|
|
37816
38037
|
const rawCircuitJson = circuitJsonProp ?? childrenCircuitJson;
|
|
37817
38038
|
return addFauxBoardIfNeeded(rawCircuitJson);
|
|
37818
38039
|
}, [circuitJsonProp, childrenCircuitJson]);
|
|
37819
|
-
const [manifoldJSModule, setManifoldJSModule] =
|
|
37820
|
-
const [manifoldLoadingError, setManifoldLoadingError] =
|
|
37821
|
-
|
|
38040
|
+
const [manifoldJSModule, setManifoldJSModule] = useState16(null);
|
|
38041
|
+
const [manifoldLoadingError, setManifoldLoadingError] = useState16(null);
|
|
38042
|
+
useEffect25(() => {
|
|
37822
38043
|
if (window.ManifoldModule && typeof window.ManifoldModule === "object" && window.ManifoldModule.setup) {
|
|
37823
38044
|
setManifoldJSModule(window.ManifoldModule);
|
|
37824
38045
|
return;
|
|
@@ -37942,7 +38163,7 @@ try {
|
|
|
37942
38163
|
);
|
|
37943
38164
|
}
|
|
37944
38165
|
if (!manifoldJSModule) {
|
|
37945
|
-
return /* @__PURE__ */
|
|
38166
|
+
return /* @__PURE__ */ jsx18("div", { style: { padding: "1em" }, children: "Loading Manifold module..." });
|
|
37946
38167
|
}
|
|
37947
38168
|
if (builderError) {
|
|
37948
38169
|
return /* @__PURE__ */ jsxs6(
|
|
@@ -37962,7 +38183,7 @@ try {
|
|
|
37962
38183
|
);
|
|
37963
38184
|
}
|
|
37964
38185
|
if (builderIsLoading) {
|
|
37965
|
-
return /* @__PURE__ */
|
|
38186
|
+
return /* @__PURE__ */ jsx18("div", { style: { padding: "1em" }, children: "Processing board geometry..." });
|
|
37966
38187
|
}
|
|
37967
38188
|
return /* @__PURE__ */ jsxs6(
|
|
37968
38189
|
CadViewerContainer,
|
|
@@ -37975,18 +38196,18 @@ try {
|
|
|
37975
38196
|
onUserInteraction,
|
|
37976
38197
|
onCameraControllerReady,
|
|
37977
38198
|
children: [
|
|
37978
|
-
/* @__PURE__ */
|
|
38199
|
+
/* @__PURE__ */ jsx18(
|
|
37979
38200
|
BoardMeshes,
|
|
37980
38201
|
{
|
|
37981
38202
|
geometryMeshes,
|
|
37982
38203
|
textureMeshes
|
|
37983
38204
|
}
|
|
37984
38205
|
),
|
|
37985
|
-
cadComponents.map((cad_component2) => /* @__PURE__ */
|
|
38206
|
+
cadComponents.map((cad_component2) => /* @__PURE__ */ jsx18(
|
|
37986
38207
|
ThreeErrorBoundary,
|
|
37987
38208
|
{
|
|
37988
|
-
fallback: ({ error }) => /* @__PURE__ */
|
|
37989
|
-
children: /* @__PURE__ */
|
|
38209
|
+
fallback: ({ error }) => /* @__PURE__ */ jsx18(Error3d, { cad_component: cad_component2, error }),
|
|
38210
|
+
children: /* @__PURE__ */ jsx18(
|
|
37990
38211
|
AnyCadComponent,
|
|
37991
38212
|
{
|
|
37992
38213
|
cad_component: cad_component2,
|
|
@@ -38003,10 +38224,10 @@ try {
|
|
|
38003
38224
|
var CadViewerManifold_default = CadViewerManifold;
|
|
38004
38225
|
|
|
38005
38226
|
// src/hooks/useContextMenu.ts
|
|
38006
|
-
import { useState as
|
|
38227
|
+
import { useState as useState17, useCallback as useCallback9, useRef as useRef10, useEffect as useEffect26 } from "react";
|
|
38007
38228
|
var useContextMenu = ({ containerRef }) => {
|
|
38008
|
-
const [menuVisible, setMenuVisible] =
|
|
38009
|
-
const [menuPos, setMenuPos] =
|
|
38229
|
+
const [menuVisible, setMenuVisible] = useState17(false);
|
|
38230
|
+
const [menuPos, setMenuPos] = useState17({
|
|
38010
38231
|
x: 0,
|
|
38011
38232
|
y: 0
|
|
38012
38233
|
});
|
|
@@ -38118,7 +38339,7 @@ var useContextMenu = ({ containerRef }) => {
|
|
|
38118
38339
|
}
|
|
38119
38340
|
setMenuVisible(false);
|
|
38120
38341
|
}, []);
|
|
38121
|
-
|
|
38342
|
+
useEffect26(() => {
|
|
38122
38343
|
if (menuVisible) {
|
|
38123
38344
|
document.addEventListener("mousedown", handleClickAway);
|
|
38124
38345
|
document.addEventListener("touchstart", handleClickAway);
|
|
@@ -38193,12 +38414,12 @@ function useCameraPreset({
|
|
|
38193
38414
|
|
|
38194
38415
|
// src/hooks/useGlobalDownloadGltf.ts
|
|
38195
38416
|
import { useCallback as useCallback11 } from "react";
|
|
38196
|
-
import { GLTFExporter } from "three-stdlib";
|
|
38417
|
+
import { GLTFExporter as GLTFExporter2 } from "three-stdlib";
|
|
38197
38418
|
var useGlobalDownloadGltf = () => {
|
|
38198
38419
|
return useCallback11(() => {
|
|
38199
38420
|
const root = window.__TSCIRCUIT_THREE_OBJECT;
|
|
38200
38421
|
if (!root) return;
|
|
38201
|
-
const exporter = new
|
|
38422
|
+
const exporter = new GLTFExporter2();
|
|
38202
38423
|
exporter.parse(
|
|
38203
38424
|
root,
|
|
38204
38425
|
(gltf) => {
|
|
@@ -38221,7 +38442,7 @@ var useGlobalDownloadGltf = () => {
|
|
|
38221
38442
|
};
|
|
38222
38443
|
|
|
38223
38444
|
// src/hooks/useRegisteredHotkey.ts
|
|
38224
|
-
import { useEffect as
|
|
38445
|
+
import { useEffect as useEffect27, useMemo as useMemo23, useRef as useRef11, useState as useState18 } from "react";
|
|
38225
38446
|
var hotkeyRegistry = /* @__PURE__ */ new Map();
|
|
38226
38447
|
var subscribers = /* @__PURE__ */ new Set();
|
|
38227
38448
|
var isListenerAttached = false;
|
|
@@ -38352,7 +38573,7 @@ var useRegisteredHotkey = (id, handler, metadata) => {
|
|
|
38352
38573
|
}),
|
|
38353
38574
|
[metadata.shortcut, metadata.description]
|
|
38354
38575
|
);
|
|
38355
|
-
|
|
38576
|
+
useEffect27(() => {
|
|
38356
38577
|
const registration = {
|
|
38357
38578
|
id,
|
|
38358
38579
|
...normalizedMetadata,
|
|
@@ -38365,10 +38586,10 @@ var useRegisteredHotkey = (id, handler, metadata) => {
|
|
|
38365
38586
|
}, [id, normalizedMetadata]);
|
|
38366
38587
|
};
|
|
38367
38588
|
var useHotkeyRegistry = () => {
|
|
38368
|
-
const [entries, setEntries] =
|
|
38589
|
+
const [entries, setEntries] = useState18(
|
|
38369
38590
|
() => Array.from(hotkeyRegistry.values())
|
|
38370
38591
|
);
|
|
38371
|
-
|
|
38592
|
+
useEffect27(() => subscribeToRegistry(setEntries), []);
|
|
38372
38593
|
return entries;
|
|
38373
38594
|
};
|
|
38374
38595
|
var registerHotkeyViewer = (element) => {
|
|
@@ -38378,7 +38599,7 @@ var registerHotkeyViewer = (element) => {
|
|
|
38378
38599
|
|
|
38379
38600
|
// src/contexts/ToastContext.tsx
|
|
38380
38601
|
import { Toaster, toast as hotToast } from "react-hot-toast";
|
|
38381
|
-
import { Fragment as Fragment5, jsx as
|
|
38602
|
+
import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
38382
38603
|
var useToast = () => {
|
|
38383
38604
|
return {
|
|
38384
38605
|
showToast: (message, duration = 2e3) => {
|
|
@@ -38391,12 +38612,12 @@ var ToastProvider = ({
|
|
|
38391
38612
|
}) => {
|
|
38392
38613
|
return /* @__PURE__ */ jsxs7(Fragment5, { children: [
|
|
38393
38614
|
children,
|
|
38394
|
-
/* @__PURE__ */
|
|
38615
|
+
/* @__PURE__ */ jsx19(Toaster, { position: "bottom-right" })
|
|
38395
38616
|
] });
|
|
38396
38617
|
};
|
|
38397
38618
|
|
|
38398
38619
|
// src/components/ContextMenu.tsx
|
|
38399
|
-
import { useState as
|
|
38620
|
+
import { useState as useState34 } from "react";
|
|
38400
38621
|
|
|
38401
38622
|
// node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs
|
|
38402
38623
|
import * as React43 from "react";
|
|
@@ -38451,7 +38672,7 @@ function useComposedRefs(...refs) {
|
|
|
38451
38672
|
|
|
38452
38673
|
// node_modules/@radix-ui/react-context/dist/index.mjs
|
|
38453
38674
|
import * as React13 from "react";
|
|
38454
|
-
import { jsx as
|
|
38675
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
38455
38676
|
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
38456
38677
|
let defaultContexts = [];
|
|
38457
38678
|
function createContext32(rootComponentName, defaultContext) {
|
|
@@ -38462,7 +38683,7 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
|
38462
38683
|
const { scope, children, ...context } = props;
|
|
38463
38684
|
const Context = scope?.[scopeName]?.[index2] || BaseContext;
|
|
38464
38685
|
const value = React13.useMemo(() => context, Object.values(context));
|
|
38465
|
-
return /* @__PURE__ */
|
|
38686
|
+
return /* @__PURE__ */ jsx20(Context.Provider, { value, children });
|
|
38466
38687
|
};
|
|
38467
38688
|
Provider.displayName = rootComponentName + "Provider";
|
|
38468
38689
|
function useContext22(consumerName, scope) {
|
|
@@ -38591,7 +38812,7 @@ import * as ReactDOM2 from "react-dom";
|
|
|
38591
38812
|
|
|
38592
38813
|
// node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
38593
38814
|
import * as React16 from "react";
|
|
38594
|
-
import { Fragment as Fragment23, jsx as
|
|
38815
|
+
import { Fragment as Fragment23, jsx as jsx21 } from "react/jsx-runtime";
|
|
38595
38816
|
// @__NO_SIDE_EFFECTS__
|
|
38596
38817
|
function createSlot(ownerName) {
|
|
38597
38818
|
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
@@ -38609,9 +38830,9 @@ function createSlot(ownerName) {
|
|
|
38609
38830
|
return child;
|
|
38610
38831
|
}
|
|
38611
38832
|
});
|
|
38612
|
-
return /* @__PURE__ */
|
|
38833
|
+
return /* @__PURE__ */ jsx21(SlotClone, { ...slotProps, ref: forwardedRef, children: React16.isValidElement(newElement) ? React16.cloneElement(newElement, void 0, newChildren) : null });
|
|
38613
38834
|
}
|
|
38614
|
-
return /* @__PURE__ */
|
|
38835
|
+
return /* @__PURE__ */ jsx21(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
38615
38836
|
});
|
|
38616
38837
|
Slot2.displayName = `${ownerName}.Slot`;
|
|
38617
38838
|
return Slot2;
|
|
@@ -38676,7 +38897,7 @@ function getElementRef(element) {
|
|
|
38676
38897
|
}
|
|
38677
38898
|
|
|
38678
38899
|
// node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
38679
|
-
import { jsx as
|
|
38900
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
38680
38901
|
var NODES = [
|
|
38681
38902
|
"a",
|
|
38682
38903
|
"button",
|
|
@@ -38704,7 +38925,7 @@ var Primitive = NODES.reduce((primitive, node) => {
|
|
|
38704
38925
|
if (typeof window !== "undefined") {
|
|
38705
38926
|
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
38706
38927
|
}
|
|
38707
|
-
return /* @__PURE__ */
|
|
38928
|
+
return /* @__PURE__ */ jsx22(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
38708
38929
|
});
|
|
38709
38930
|
Node2.displayName = `Primitive.${node}`;
|
|
38710
38931
|
return { ...primitive, [node]: Node2 };
|
|
@@ -38718,9 +38939,9 @@ import * as React42 from "react";
|
|
|
38718
38939
|
|
|
38719
38940
|
// node_modules/@radix-ui/react-collection/dist/index.mjs
|
|
38720
38941
|
import React18 from "react";
|
|
38721
|
-
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
38722
|
-
import React23 from "react";
|
|
38723
38942
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
38943
|
+
import React23 from "react";
|
|
38944
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
38724
38945
|
function createCollection(name) {
|
|
38725
38946
|
const PROVIDER_NAME = name + "CollectionProvider";
|
|
38726
38947
|
const [createCollectionContext, createCollectionScope3] = createContextScope(PROVIDER_NAME);
|
|
@@ -38732,7 +38953,7 @@ function createCollection(name) {
|
|
|
38732
38953
|
const { scope, children } = props;
|
|
38733
38954
|
const ref = React18.useRef(null);
|
|
38734
38955
|
const itemMap = React18.useRef(/* @__PURE__ */ new Map()).current;
|
|
38735
|
-
return /* @__PURE__ */
|
|
38956
|
+
return /* @__PURE__ */ jsx23(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
38736
38957
|
};
|
|
38737
38958
|
CollectionProvider.displayName = PROVIDER_NAME;
|
|
38738
38959
|
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
@@ -38742,7 +38963,7 @@ function createCollection(name) {
|
|
|
38742
38963
|
const { scope, children } = props;
|
|
38743
38964
|
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
38744
38965
|
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
38745
|
-
return /* @__PURE__ */
|
|
38966
|
+
return /* @__PURE__ */ jsx23(CollectionSlotImpl, { ref: composedRefs, children });
|
|
38746
38967
|
}
|
|
38747
38968
|
);
|
|
38748
38969
|
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
@@ -38759,7 +38980,7 @@ function createCollection(name) {
|
|
|
38759
38980
|
context.itemMap.set(ref, { ref, ...itemData });
|
|
38760
38981
|
return () => void context.itemMap.delete(ref);
|
|
38761
38982
|
});
|
|
38762
|
-
return /* @__PURE__ */
|
|
38983
|
+
return /* @__PURE__ */ jsx23(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
|
|
38763
38984
|
}
|
|
38764
38985
|
);
|
|
38765
38986
|
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
@@ -38786,7 +39007,7 @@ function createCollection(name) {
|
|
|
38786
39007
|
|
|
38787
39008
|
// node_modules/@radix-ui/react-direction/dist/index.mjs
|
|
38788
39009
|
import * as React19 from "react";
|
|
38789
|
-
import { jsx as
|
|
39010
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
38790
39011
|
var DirectionContext = React19.createContext(void 0);
|
|
38791
39012
|
function useDirection(localDir) {
|
|
38792
39013
|
const globalDir = React19.useContext(DirectionContext);
|
|
@@ -38822,7 +39043,7 @@ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.docum
|
|
|
38822
39043
|
}
|
|
38823
39044
|
|
|
38824
39045
|
// node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
|
|
38825
|
-
import { jsx as
|
|
39046
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
38826
39047
|
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
38827
39048
|
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
38828
39049
|
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
@@ -38910,7 +39131,7 @@ var DismissableLayer = React24.forwardRef(
|
|
|
38910
39131
|
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
38911
39132
|
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
38912
39133
|
}, []);
|
|
38913
|
-
return /* @__PURE__ */
|
|
39134
|
+
return /* @__PURE__ */ jsx26(
|
|
38914
39135
|
Primitive.div,
|
|
38915
39136
|
{
|
|
38916
39137
|
...layerProps,
|
|
@@ -38944,7 +39165,7 @@ var DismissableLayerBranch = React24.forwardRef((props, forwardedRef) => {
|
|
|
38944
39165
|
};
|
|
38945
39166
|
}
|
|
38946
39167
|
}, [context.branches]);
|
|
38947
|
-
return /* @__PURE__ */
|
|
39168
|
+
return /* @__PURE__ */ jsx26(Primitive.div, { ...props, ref: composedRefs });
|
|
38948
39169
|
});
|
|
38949
39170
|
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
38950
39171
|
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
@@ -39056,7 +39277,7 @@ function createFocusGuard() {
|
|
|
39056
39277
|
|
|
39057
39278
|
// node_modules/@radix-ui/react-focus-scope/dist/index.mjs
|
|
39058
39279
|
import * as React26 from "react";
|
|
39059
|
-
import { jsx as
|
|
39280
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
39060
39281
|
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
39061
39282
|
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
39062
39283
|
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
@@ -39175,7 +39396,7 @@ var FocusScope = React26.forwardRef((props, forwardedRef) => {
|
|
|
39175
39396
|
},
|
|
39176
39397
|
[loop, trapped, focusScope.paused]
|
|
39177
39398
|
);
|
|
39178
|
-
return /* @__PURE__ */
|
|
39399
|
+
return /* @__PURE__ */ jsx27(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
39179
39400
|
});
|
|
39180
39401
|
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
39181
39402
|
function focusFirst(candidates, { select = false } = {}) {
|
|
@@ -41165,11 +41386,11 @@ var arrow3 = (options, deps) => ({
|
|
|
41165
41386
|
|
|
41166
41387
|
// node_modules/@radix-ui/react-arrow/dist/index.mjs
|
|
41167
41388
|
import * as React29 from "react";
|
|
41168
|
-
import { jsx as
|
|
41389
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
41169
41390
|
var NAME = "Arrow";
|
|
41170
41391
|
var Arrow = React29.forwardRef((props, forwardedRef) => {
|
|
41171
41392
|
const { children, width: width10 = 10, height: height10 = 5, ...arrowProps } = props;
|
|
41172
|
-
return /* @__PURE__ */
|
|
41393
|
+
return /* @__PURE__ */ jsx28(
|
|
41173
41394
|
Primitive.svg,
|
|
41174
41395
|
{
|
|
41175
41396
|
...arrowProps,
|
|
@@ -41178,7 +41399,7 @@ var Arrow = React29.forwardRef((props, forwardedRef) => {
|
|
|
41178
41399
|
height: height10,
|
|
41179
41400
|
viewBox: "0 0 30 10",
|
|
41180
41401
|
preserveAspectRatio: "none",
|
|
41181
|
-
children: props.asChild ? children : /* @__PURE__ */
|
|
41402
|
+
children: props.asChild ? children : /* @__PURE__ */ jsx28("polygon", { points: "0,0 30,0 15,10" })
|
|
41182
41403
|
}
|
|
41183
41404
|
);
|
|
41184
41405
|
});
|
|
@@ -41223,14 +41444,14 @@ function useSize(element) {
|
|
|
41223
41444
|
}
|
|
41224
41445
|
|
|
41225
41446
|
// node_modules/@radix-ui/react-popper/dist/index.mjs
|
|
41226
|
-
import { jsx as
|
|
41447
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
41227
41448
|
var POPPER_NAME = "Popper";
|
|
41228
41449
|
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
41229
41450
|
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
41230
41451
|
var Popper = (props) => {
|
|
41231
41452
|
const { __scopePopper, children } = props;
|
|
41232
41453
|
const [anchor, setAnchor] = React31.useState(null);
|
|
41233
|
-
return /* @__PURE__ */
|
|
41454
|
+
return /* @__PURE__ */ jsx29(PopperProvider, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });
|
|
41234
41455
|
};
|
|
41235
41456
|
Popper.displayName = POPPER_NAME;
|
|
41236
41457
|
var ANCHOR_NAME = "PopperAnchor";
|
|
@@ -41248,7 +41469,7 @@ var PopperAnchor = React31.forwardRef(
|
|
|
41248
41469
|
context.onAnchorChange(anchorRef.current);
|
|
41249
41470
|
}
|
|
41250
41471
|
});
|
|
41251
|
-
return virtualRef ? null : /* @__PURE__ */
|
|
41472
|
+
return virtualRef ? null : /* @__PURE__ */ jsx29(Primitive.div, { ...anchorProps, ref: composedRefs });
|
|
41252
41473
|
}
|
|
41253
41474
|
);
|
|
41254
41475
|
PopperAnchor.displayName = ANCHOR_NAME;
|
|
@@ -41341,7 +41562,7 @@ var PopperContent = React31.forwardRef(
|
|
|
41341
41562
|
useLayoutEffect2(() => {
|
|
41342
41563
|
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
41343
41564
|
}, [content]);
|
|
41344
|
-
return /* @__PURE__ */
|
|
41565
|
+
return /* @__PURE__ */ jsx29(
|
|
41345
41566
|
"div",
|
|
41346
41567
|
{
|
|
41347
41568
|
ref: refs.setFloating,
|
|
@@ -41365,7 +41586,7 @@ var PopperContent = React31.forwardRef(
|
|
|
41365
41586
|
}
|
|
41366
41587
|
},
|
|
41367
41588
|
dir: props.dir,
|
|
41368
|
-
children: /* @__PURE__ */
|
|
41589
|
+
children: /* @__PURE__ */ jsx29(
|
|
41369
41590
|
PopperContentProvider,
|
|
41370
41591
|
{
|
|
41371
41592
|
scope: __scopePopper,
|
|
@@ -41374,7 +41595,7 @@ var PopperContent = React31.forwardRef(
|
|
|
41374
41595
|
arrowX,
|
|
41375
41596
|
arrowY,
|
|
41376
41597
|
shouldHideArrow: cannotCenterArrow,
|
|
41377
|
-
children: /* @__PURE__ */
|
|
41598
|
+
children: /* @__PURE__ */ jsx29(
|
|
41378
41599
|
Primitive.div,
|
|
41379
41600
|
{
|
|
41380
41601
|
"data-side": placedSide,
|
|
@@ -41411,7 +41632,7 @@ var PopperArrow = React31.forwardRef(function PopperArrow2(props, forwardedRef)
|
|
|
41411
41632
|
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
41412
41633
|
// doesn't report size as we'd expect on SVG elements.
|
|
41413
41634
|
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
41414
|
-
/* @__PURE__ */
|
|
41635
|
+
/* @__PURE__ */ jsx29(
|
|
41415
41636
|
"span",
|
|
41416
41637
|
{
|
|
41417
41638
|
ref: contentContext.onArrowChange,
|
|
@@ -41434,7 +41655,7 @@ var PopperArrow = React31.forwardRef(function PopperArrow2(props, forwardedRef)
|
|
|
41434
41655
|
}[contentContext.placedSide],
|
|
41435
41656
|
visibility: contentContext.shouldHideArrow ? "hidden" : void 0
|
|
41436
41657
|
},
|
|
41437
|
-
children: /* @__PURE__ */
|
|
41658
|
+
children: /* @__PURE__ */ jsx29(
|
|
41438
41659
|
Root,
|
|
41439
41660
|
{
|
|
41440
41661
|
...arrowProps,
|
|
@@ -41497,14 +41718,14 @@ var Arrow2 = PopperArrow;
|
|
|
41497
41718
|
// node_modules/@radix-ui/react-portal/dist/index.mjs
|
|
41498
41719
|
import * as React32 from "react";
|
|
41499
41720
|
import ReactDOM4 from "react-dom";
|
|
41500
|
-
import { jsx as
|
|
41721
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
41501
41722
|
var PORTAL_NAME = "Portal";
|
|
41502
41723
|
var Portal = React32.forwardRef((props, forwardedRef) => {
|
|
41503
41724
|
const { container: containerProp, ...portalProps } = props;
|
|
41504
41725
|
const [mounted, setMounted] = React32.useState(false);
|
|
41505
41726
|
useLayoutEffect2(() => setMounted(true), []);
|
|
41506
41727
|
const container = containerProp || mounted && globalThis?.document?.body;
|
|
41507
|
-
return container ? ReactDOM4.createPortal(/* @__PURE__ */
|
|
41728
|
+
return container ? ReactDOM4.createPortal(/* @__PURE__ */ jsx30(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
41508
41729
|
});
|
|
41509
41730
|
Portal.displayName = PORTAL_NAME;
|
|
41510
41731
|
|
|
@@ -41636,7 +41857,7 @@ function getElementRef2(element) {
|
|
|
41636
41857
|
|
|
41637
41858
|
// node_modules/@radix-ui/react-roving-focus/dist/index.mjs
|
|
41638
41859
|
import * as React34 from "react";
|
|
41639
|
-
import { jsx as
|
|
41860
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
41640
41861
|
var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
41641
41862
|
var EVENT_OPTIONS2 = { bubbles: false, cancelable: true };
|
|
41642
41863
|
var GROUP_NAME = "RovingFocusGroup";
|
|
@@ -41648,7 +41869,7 @@ var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContext
|
|
|
41648
41869
|
var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);
|
|
41649
41870
|
var RovingFocusGroup = React34.forwardRef(
|
|
41650
41871
|
(props, forwardedRef) => {
|
|
41651
|
-
return /* @__PURE__ */
|
|
41872
|
+
return /* @__PURE__ */ jsx31(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx31(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx31(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });
|
|
41652
41873
|
}
|
|
41653
41874
|
);
|
|
41654
41875
|
RovingFocusGroup.displayName = GROUP_NAME;
|
|
@@ -41686,7 +41907,7 @@ var RovingFocusGroupImpl = React34.forwardRef((props, forwardedRef) => {
|
|
|
41686
41907
|
return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
|
|
41687
41908
|
}
|
|
41688
41909
|
}, [handleEntryFocus]);
|
|
41689
|
-
return /* @__PURE__ */
|
|
41910
|
+
return /* @__PURE__ */ jsx31(
|
|
41690
41911
|
RovingFocusProvider,
|
|
41691
41912
|
{
|
|
41692
41913
|
scope: __scopeRovingFocusGroup,
|
|
@@ -41707,7 +41928,7 @@ var RovingFocusGroupImpl = React34.forwardRef((props, forwardedRef) => {
|
|
|
41707
41928
|
() => setFocusableItemsCount((prevCount) => prevCount - 1),
|
|
41708
41929
|
[]
|
|
41709
41930
|
),
|
|
41710
|
-
children: /* @__PURE__ */
|
|
41931
|
+
children: /* @__PURE__ */ jsx31(
|
|
41711
41932
|
Primitive.div,
|
|
41712
41933
|
{
|
|
41713
41934
|
tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
|
|
@@ -41765,14 +41986,14 @@ var RovingFocusGroupItem = React34.forwardRef(
|
|
|
41765
41986
|
return () => onFocusableItemRemove();
|
|
41766
41987
|
}
|
|
41767
41988
|
}, [focusable, onFocusableItemAdd, onFocusableItemRemove]);
|
|
41768
|
-
return /* @__PURE__ */
|
|
41989
|
+
return /* @__PURE__ */ jsx31(
|
|
41769
41990
|
Collection.ItemSlot,
|
|
41770
41991
|
{
|
|
41771
41992
|
scope: __scopeRovingFocusGroup,
|
|
41772
41993
|
id,
|
|
41773
41994
|
focusable,
|
|
41774
41995
|
active,
|
|
41775
|
-
children: /* @__PURE__ */
|
|
41996
|
+
children: /* @__PURE__ */ jsx31(
|
|
41776
41997
|
Primitive.span,
|
|
41777
41998
|
{
|
|
41778
41999
|
tabIndex: isCurrentTabStop ? 0 : -1,
|
|
@@ -42023,9 +42244,9 @@ function assignRef(ref, value) {
|
|
|
42023
42244
|
}
|
|
42024
42245
|
|
|
42025
42246
|
// node_modules/use-callback-ref/dist/es2015/useRef.js
|
|
42026
|
-
import { useState as
|
|
42247
|
+
import { useState as useState29 } from "react";
|
|
42027
42248
|
function useCallbackRef2(initialValue, callback) {
|
|
42028
|
-
var ref =
|
|
42249
|
+
var ref = useState29(function() {
|
|
42029
42250
|
return {
|
|
42030
42251
|
// value
|
|
42031
42252
|
value: initialValue,
|
|
@@ -42689,7 +42910,7 @@ ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
|
42689
42910
|
var Combination_default = ReactRemoveScroll;
|
|
42690
42911
|
|
|
42691
42912
|
// node_modules/@radix-ui/react-menu/dist/index.mjs
|
|
42692
|
-
import { jsx as
|
|
42913
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
42693
42914
|
var SELECTION_KEYS = ["Enter", " "];
|
|
42694
42915
|
var FIRST_KEYS = ["ArrowDown", "PageUp", "Home"];
|
|
42695
42916
|
var LAST_KEYS = ["ArrowUp", "PageDown", "End"];
|
|
@@ -42734,7 +42955,7 @@ var Menu = (props) => {
|
|
|
42734
42955
|
document.removeEventListener("pointermove", handlePointer, { capture: true });
|
|
42735
42956
|
};
|
|
42736
42957
|
}, []);
|
|
42737
|
-
return /* @__PURE__ */
|
|
42958
|
+
return /* @__PURE__ */ jsx32(Root2, { ...popperScope, children: /* @__PURE__ */ jsx32(
|
|
42738
42959
|
MenuProvider,
|
|
42739
42960
|
{
|
|
42740
42961
|
scope: __scopeMenu,
|
|
@@ -42742,7 +42963,7 @@ var Menu = (props) => {
|
|
|
42742
42963
|
onOpenChange: handleOpenChange,
|
|
42743
42964
|
content,
|
|
42744
42965
|
onContentChange: setContent,
|
|
42745
|
-
children: /* @__PURE__ */
|
|
42966
|
+
children: /* @__PURE__ */ jsx32(
|
|
42746
42967
|
MenuRootProvider,
|
|
42747
42968
|
{
|
|
42748
42969
|
scope: __scopeMenu,
|
|
@@ -42762,7 +42983,7 @@ var MenuAnchor = React42.forwardRef(
|
|
|
42762
42983
|
(props, forwardedRef) => {
|
|
42763
42984
|
const { __scopeMenu, ...anchorProps } = props;
|
|
42764
42985
|
const popperScope = usePopperScope(__scopeMenu);
|
|
42765
|
-
return /* @__PURE__ */
|
|
42986
|
+
return /* @__PURE__ */ jsx32(Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef });
|
|
42766
42987
|
}
|
|
42767
42988
|
);
|
|
42768
42989
|
MenuAnchor.displayName = ANCHOR_NAME2;
|
|
@@ -42773,7 +42994,7 @@ var [PortalProvider, usePortalContext] = createMenuContext(PORTAL_NAME2, {
|
|
|
42773
42994
|
var MenuPortal = (props) => {
|
|
42774
42995
|
const { __scopeMenu, forceMount, children, container } = props;
|
|
42775
42996
|
const context = useMenuContext(PORTAL_NAME2, __scopeMenu);
|
|
42776
|
-
return /* @__PURE__ */
|
|
42997
|
+
return /* @__PURE__ */ jsx32(PortalProvider, { scope: __scopeMenu, forceMount, children: /* @__PURE__ */ jsx32(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx32(Portal, { asChild: true, container, children }) }) });
|
|
42777
42998
|
};
|
|
42778
42999
|
MenuPortal.displayName = PORTAL_NAME2;
|
|
42779
43000
|
var CONTENT_NAME2 = "MenuContent";
|
|
@@ -42784,7 +43005,7 @@ var MenuContent = React42.forwardRef(
|
|
|
42784
43005
|
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
42785
43006
|
const context = useMenuContext(CONTENT_NAME2, props.__scopeMenu);
|
|
42786
43007
|
const rootContext = useMenuRootContext(CONTENT_NAME2, props.__scopeMenu);
|
|
42787
|
-
return /* @__PURE__ */
|
|
43008
|
+
return /* @__PURE__ */ jsx32(Collection2.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx32(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx32(Collection2.Slot, { scope: props.__scopeMenu, children: rootContext.modal ? /* @__PURE__ */ jsx32(MenuRootContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx32(MenuRootContentNonModal, { ...contentProps, ref: forwardedRef }) }) }) });
|
|
42788
43009
|
}
|
|
42789
43010
|
);
|
|
42790
43011
|
var MenuRootContentModal = React42.forwardRef(
|
|
@@ -42796,7 +43017,7 @@ var MenuRootContentModal = React42.forwardRef(
|
|
|
42796
43017
|
const content = ref.current;
|
|
42797
43018
|
if (content) return hideOthers(content);
|
|
42798
43019
|
}, []);
|
|
42799
|
-
return /* @__PURE__ */
|
|
43020
|
+
return /* @__PURE__ */ jsx32(
|
|
42800
43021
|
MenuContentImpl,
|
|
42801
43022
|
{
|
|
42802
43023
|
...props,
|
|
@@ -42816,7 +43037,7 @@ var MenuRootContentModal = React42.forwardRef(
|
|
|
42816
43037
|
);
|
|
42817
43038
|
var MenuRootContentNonModal = React42.forwardRef((props, forwardedRef) => {
|
|
42818
43039
|
const context = useMenuContext(CONTENT_NAME2, props.__scopeMenu);
|
|
42819
|
-
return /* @__PURE__ */
|
|
43040
|
+
return /* @__PURE__ */ jsx32(
|
|
42820
43041
|
MenuContentImpl,
|
|
42821
43042
|
{
|
|
42822
43043
|
...props,
|
|
@@ -42888,7 +43109,7 @@ var MenuContentImpl = React42.forwardRef(
|
|
|
42888
43109
|
const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side;
|
|
42889
43110
|
return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area);
|
|
42890
43111
|
}, []);
|
|
42891
|
-
return /* @__PURE__ */
|
|
43112
|
+
return /* @__PURE__ */ jsx32(
|
|
42892
43113
|
MenuContentProvider,
|
|
42893
43114
|
{
|
|
42894
43115
|
scope: __scopeMenu,
|
|
@@ -42917,7 +43138,7 @@ var MenuContentImpl = React42.forwardRef(
|
|
|
42917
43138
|
onPointerGraceIntentChange: React42.useCallback((intent) => {
|
|
42918
43139
|
pointerGraceIntentRef.current = intent;
|
|
42919
43140
|
}, []),
|
|
42920
|
-
children: /* @__PURE__ */
|
|
43141
|
+
children: /* @__PURE__ */ jsx32(ScrollLockWrapper, { ...scrollLockWrapperProps, children: /* @__PURE__ */ jsx32(
|
|
42921
43142
|
FocusScope,
|
|
42922
43143
|
{
|
|
42923
43144
|
asChild: true,
|
|
@@ -42927,7 +43148,7 @@ var MenuContentImpl = React42.forwardRef(
|
|
|
42927
43148
|
contentRef.current?.focus({ preventScroll: true });
|
|
42928
43149
|
}),
|
|
42929
43150
|
onUnmountAutoFocus: onCloseAutoFocus,
|
|
42930
|
-
children: /* @__PURE__ */
|
|
43151
|
+
children: /* @__PURE__ */ jsx32(
|
|
42931
43152
|
DismissableLayer,
|
|
42932
43153
|
{
|
|
42933
43154
|
asChild: true,
|
|
@@ -42937,7 +43158,7 @@ var MenuContentImpl = React42.forwardRef(
|
|
|
42937
43158
|
onFocusOutside,
|
|
42938
43159
|
onInteractOutside,
|
|
42939
43160
|
onDismiss,
|
|
42940
|
-
children: /* @__PURE__ */
|
|
43161
|
+
children: /* @__PURE__ */ jsx32(
|
|
42941
43162
|
Root3,
|
|
42942
43163
|
{
|
|
42943
43164
|
asChild: true,
|
|
@@ -42951,7 +43172,7 @@ var MenuContentImpl = React42.forwardRef(
|
|
|
42951
43172
|
if (!rootContext.isUsingKeyboardRef.current) event.preventDefault();
|
|
42952
43173
|
}),
|
|
42953
43174
|
preventScrollOnEntryFocus: true,
|
|
42954
|
-
children: /* @__PURE__ */
|
|
43175
|
+
children: /* @__PURE__ */ jsx32(
|
|
42955
43176
|
Content,
|
|
42956
43177
|
{
|
|
42957
43178
|
role: "menu",
|
|
@@ -43016,7 +43237,7 @@ var GROUP_NAME2 = "MenuGroup";
|
|
|
43016
43237
|
var MenuGroup = React42.forwardRef(
|
|
43017
43238
|
(props, forwardedRef) => {
|
|
43018
43239
|
const { __scopeMenu, ...groupProps } = props;
|
|
43019
|
-
return /* @__PURE__ */
|
|
43240
|
+
return /* @__PURE__ */ jsx32(Primitive.div, { role: "group", ...groupProps, ref: forwardedRef });
|
|
43020
43241
|
}
|
|
43021
43242
|
);
|
|
43022
43243
|
MenuGroup.displayName = GROUP_NAME2;
|
|
@@ -43024,7 +43245,7 @@ var LABEL_NAME = "MenuLabel";
|
|
|
43024
43245
|
var MenuLabel = React42.forwardRef(
|
|
43025
43246
|
(props, forwardedRef) => {
|
|
43026
43247
|
const { __scopeMenu, ...labelProps } = props;
|
|
43027
|
-
return /* @__PURE__ */
|
|
43248
|
+
return /* @__PURE__ */ jsx32(Primitive.div, { ...labelProps, ref: forwardedRef });
|
|
43028
43249
|
}
|
|
43029
43250
|
);
|
|
43030
43251
|
MenuLabel.displayName = LABEL_NAME;
|
|
@@ -43051,7 +43272,7 @@ var MenuItem = React42.forwardRef(
|
|
|
43051
43272
|
}
|
|
43052
43273
|
}
|
|
43053
43274
|
};
|
|
43054
|
-
return /* @__PURE__ */
|
|
43275
|
+
return /* @__PURE__ */ jsx32(
|
|
43055
43276
|
MenuItemImpl,
|
|
43056
43277
|
{
|
|
43057
43278
|
...itemProps,
|
|
@@ -43093,13 +43314,13 @@ var MenuItemImpl = React42.forwardRef(
|
|
|
43093
43314
|
setTextContent((menuItem.textContent ?? "").trim());
|
|
43094
43315
|
}
|
|
43095
43316
|
}, [itemProps.children]);
|
|
43096
|
-
return /* @__PURE__ */
|
|
43317
|
+
return /* @__PURE__ */ jsx32(
|
|
43097
43318
|
Collection2.ItemSlot,
|
|
43098
43319
|
{
|
|
43099
43320
|
scope: __scopeMenu,
|
|
43100
43321
|
disabled,
|
|
43101
43322
|
textValue: textValue ?? textContent,
|
|
43102
|
-
children: /* @__PURE__ */
|
|
43323
|
+
children: /* @__PURE__ */ jsx32(Item, { asChild: true, ...rovingFocusGroupScope, focusable: !disabled, children: /* @__PURE__ */ jsx32(
|
|
43103
43324
|
Primitive.div,
|
|
43104
43325
|
{
|
|
43105
43326
|
role: "menuitem",
|
|
@@ -43138,7 +43359,7 @@ var CHECKBOX_ITEM_NAME = "MenuCheckboxItem";
|
|
|
43138
43359
|
var MenuCheckboxItem = React42.forwardRef(
|
|
43139
43360
|
(props, forwardedRef) => {
|
|
43140
43361
|
const { checked = false, onCheckedChange, ...checkboxItemProps } = props;
|
|
43141
|
-
return /* @__PURE__ */
|
|
43362
|
+
return /* @__PURE__ */ jsx32(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ jsx32(
|
|
43142
43363
|
MenuItem,
|
|
43143
43364
|
{
|
|
43144
43365
|
role: "menuitemcheckbox",
|
|
@@ -43166,7 +43387,7 @@ var MenuRadioGroup = React42.forwardRef(
|
|
|
43166
43387
|
(props, forwardedRef) => {
|
|
43167
43388
|
const { value, onValueChange, ...groupProps } = props;
|
|
43168
43389
|
const handleValueChange = useCallbackRef(onValueChange);
|
|
43169
|
-
return /* @__PURE__ */
|
|
43390
|
+
return /* @__PURE__ */ jsx32(RadioGroupProvider, { scope: props.__scopeMenu, value, onValueChange: handleValueChange, children: /* @__PURE__ */ jsx32(MenuGroup, { ...groupProps, ref: forwardedRef }) });
|
|
43170
43391
|
}
|
|
43171
43392
|
);
|
|
43172
43393
|
MenuRadioGroup.displayName = RADIO_GROUP_NAME;
|
|
@@ -43176,7 +43397,7 @@ var MenuRadioItem = React42.forwardRef(
|
|
|
43176
43397
|
const { value, ...radioItemProps } = props;
|
|
43177
43398
|
const context = useRadioGroupContext(RADIO_ITEM_NAME, props.__scopeMenu);
|
|
43178
43399
|
const checked = value === context.value;
|
|
43179
|
-
return /* @__PURE__ */
|
|
43400
|
+
return /* @__PURE__ */ jsx32(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ jsx32(
|
|
43180
43401
|
MenuItem,
|
|
43181
43402
|
{
|
|
43182
43403
|
role: "menuitemradio",
|
|
@@ -43203,11 +43424,11 @@ var MenuItemIndicator = React42.forwardRef(
|
|
|
43203
43424
|
(props, forwardedRef) => {
|
|
43204
43425
|
const { __scopeMenu, forceMount, ...itemIndicatorProps } = props;
|
|
43205
43426
|
const indicatorContext = useItemIndicatorContext(ITEM_INDICATOR_NAME, __scopeMenu);
|
|
43206
|
-
return /* @__PURE__ */
|
|
43427
|
+
return /* @__PURE__ */ jsx32(
|
|
43207
43428
|
Presence,
|
|
43208
43429
|
{
|
|
43209
43430
|
present: forceMount || isIndeterminate(indicatorContext.checked) || indicatorContext.checked === true,
|
|
43210
|
-
children: /* @__PURE__ */
|
|
43431
|
+
children: /* @__PURE__ */ jsx32(
|
|
43211
43432
|
Primitive.span,
|
|
43212
43433
|
{
|
|
43213
43434
|
...itemIndicatorProps,
|
|
@@ -43224,7 +43445,7 @@ var SEPARATOR_NAME = "MenuSeparator";
|
|
|
43224
43445
|
var MenuSeparator = React42.forwardRef(
|
|
43225
43446
|
(props, forwardedRef) => {
|
|
43226
43447
|
const { __scopeMenu, ...separatorProps } = props;
|
|
43227
|
-
return /* @__PURE__ */
|
|
43448
|
+
return /* @__PURE__ */ jsx32(
|
|
43228
43449
|
Primitive.div,
|
|
43229
43450
|
{
|
|
43230
43451
|
role: "separator",
|
|
@@ -43241,7 +43462,7 @@ var MenuArrow = React42.forwardRef(
|
|
|
43241
43462
|
(props, forwardedRef) => {
|
|
43242
43463
|
const { __scopeMenu, ...arrowProps } = props;
|
|
43243
43464
|
const popperScope = usePopperScope(__scopeMenu);
|
|
43244
|
-
return /* @__PURE__ */
|
|
43465
|
+
return /* @__PURE__ */ jsx32(Arrow2, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
43245
43466
|
}
|
|
43246
43467
|
);
|
|
43247
43468
|
MenuArrow.displayName = ARROW_NAME2;
|
|
@@ -43258,7 +43479,7 @@ var MenuSub = (props) => {
|
|
|
43258
43479
|
if (parentMenuContext.open === false) handleOpenChange(false);
|
|
43259
43480
|
return () => handleOpenChange(false);
|
|
43260
43481
|
}, [parentMenuContext.open, handleOpenChange]);
|
|
43261
|
-
return /* @__PURE__ */
|
|
43482
|
+
return /* @__PURE__ */ jsx32(Root2, { ...popperScope, children: /* @__PURE__ */ jsx32(
|
|
43262
43483
|
MenuProvider,
|
|
43263
43484
|
{
|
|
43264
43485
|
scope: __scopeMenu,
|
|
@@ -43266,7 +43487,7 @@ var MenuSub = (props) => {
|
|
|
43266
43487
|
onOpenChange: handleOpenChange,
|
|
43267
43488
|
content,
|
|
43268
43489
|
onContentChange: setContent,
|
|
43269
|
-
children: /* @__PURE__ */
|
|
43490
|
+
children: /* @__PURE__ */ jsx32(
|
|
43270
43491
|
MenuSubProvider,
|
|
43271
43492
|
{
|
|
43272
43493
|
scope: __scopeMenu,
|
|
@@ -43303,7 +43524,7 @@ var MenuSubTrigger = React42.forwardRef(
|
|
|
43303
43524
|
onPointerGraceIntentChange(null);
|
|
43304
43525
|
};
|
|
43305
43526
|
}, [pointerGraceTimerRef, onPointerGraceIntentChange]);
|
|
43306
|
-
return /* @__PURE__ */
|
|
43527
|
+
return /* @__PURE__ */ jsx32(MenuAnchor, { asChild: true, ...scope, children: /* @__PURE__ */ jsx32(
|
|
43307
43528
|
MenuItemImpl,
|
|
43308
43529
|
{
|
|
43309
43530
|
id: subContext.triggerId,
|
|
@@ -43392,7 +43613,7 @@ var MenuSubContent = React42.forwardRef(
|
|
|
43392
43613
|
const subContext = useMenuSubContext(SUB_CONTENT_NAME, props.__scopeMenu);
|
|
43393
43614
|
const ref = React42.useRef(null);
|
|
43394
43615
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
43395
|
-
return /* @__PURE__ */
|
|
43616
|
+
return /* @__PURE__ */ jsx32(Collection2.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx32(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx32(Collection2.Slot, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx32(
|
|
43396
43617
|
MenuContentImpl,
|
|
43397
43618
|
{
|
|
43398
43619
|
id: subContext.contentId,
|
|
@@ -43489,7 +43710,7 @@ var Root32 = Menu;
|
|
|
43489
43710
|
var Anchor2 = MenuAnchor;
|
|
43490
43711
|
var Portal2 = MenuPortal;
|
|
43491
43712
|
var Content2 = MenuContent;
|
|
43492
|
-
var
|
|
43713
|
+
var Group5 = MenuGroup;
|
|
43493
43714
|
var Label = MenuLabel;
|
|
43494
43715
|
var Item2 = MenuItem;
|
|
43495
43716
|
var CheckboxItem = MenuCheckboxItem;
|
|
@@ -43503,7 +43724,7 @@ var SubTrigger = MenuSubTrigger;
|
|
|
43503
43724
|
var SubContent = MenuSubContent;
|
|
43504
43725
|
|
|
43505
43726
|
// node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs
|
|
43506
|
-
import { jsx as
|
|
43727
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
43507
43728
|
var DROPDOWN_MENU_NAME = "DropdownMenu";
|
|
43508
43729
|
var [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(
|
|
43509
43730
|
DROPDOWN_MENU_NAME,
|
|
@@ -43529,7 +43750,7 @@ var DropdownMenu = (props) => {
|
|
|
43529
43750
|
onChange: onOpenChange,
|
|
43530
43751
|
caller: DROPDOWN_MENU_NAME
|
|
43531
43752
|
});
|
|
43532
|
-
return /* @__PURE__ */
|
|
43753
|
+
return /* @__PURE__ */ jsx33(
|
|
43533
43754
|
DropdownMenuProvider,
|
|
43534
43755
|
{
|
|
43535
43756
|
scope: __scopeDropdownMenu,
|
|
@@ -43540,7 +43761,7 @@ var DropdownMenu = (props) => {
|
|
|
43540
43761
|
onOpenChange: setOpen,
|
|
43541
43762
|
onOpenToggle: React43.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
43542
43763
|
modal,
|
|
43543
|
-
children: /* @__PURE__ */
|
|
43764
|
+
children: /* @__PURE__ */ jsx33(Root32, { ...menuScope, open, onOpenChange: setOpen, dir, modal, children })
|
|
43544
43765
|
}
|
|
43545
43766
|
);
|
|
43546
43767
|
};
|
|
@@ -43551,7 +43772,7 @@ var DropdownMenuTrigger = React43.forwardRef(
|
|
|
43551
43772
|
const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
|
|
43552
43773
|
const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);
|
|
43553
43774
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
43554
|
-
return /* @__PURE__ */
|
|
43775
|
+
return /* @__PURE__ */ jsx33(Anchor2, { asChild: true, ...menuScope, children: /* @__PURE__ */ jsx33(
|
|
43555
43776
|
Primitive.button,
|
|
43556
43777
|
{
|
|
43557
43778
|
type: "button",
|
|
@@ -43585,7 +43806,7 @@ var PORTAL_NAME3 = "DropdownMenuPortal";
|
|
|
43585
43806
|
var DropdownMenuPortal = (props) => {
|
|
43586
43807
|
const { __scopeDropdownMenu, ...portalProps } = props;
|
|
43587
43808
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
43588
|
-
return /* @__PURE__ */
|
|
43809
|
+
return /* @__PURE__ */ jsx33(Portal2, { ...menuScope, ...portalProps });
|
|
43589
43810
|
};
|
|
43590
43811
|
DropdownMenuPortal.displayName = PORTAL_NAME3;
|
|
43591
43812
|
var CONTENT_NAME3 = "DropdownMenuContent";
|
|
@@ -43595,7 +43816,7 @@ var DropdownMenuContent = React43.forwardRef(
|
|
|
43595
43816
|
const context = useDropdownMenuContext(CONTENT_NAME3, __scopeDropdownMenu);
|
|
43596
43817
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
43597
43818
|
const hasInteractedOutsideRef = React43.useRef(false);
|
|
43598
|
-
return /* @__PURE__ */
|
|
43819
|
+
return /* @__PURE__ */ jsx33(
|
|
43599
43820
|
Content2,
|
|
43600
43821
|
{
|
|
43601
43822
|
id: context.contentId,
|
|
@@ -43635,7 +43856,7 @@ var DropdownMenuGroup = React43.forwardRef(
|
|
|
43635
43856
|
(props, forwardedRef) => {
|
|
43636
43857
|
const { __scopeDropdownMenu, ...groupProps } = props;
|
|
43637
43858
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
43638
|
-
return /* @__PURE__ */
|
|
43859
|
+
return /* @__PURE__ */ jsx33(Group5, { ...menuScope, ...groupProps, ref: forwardedRef });
|
|
43639
43860
|
}
|
|
43640
43861
|
);
|
|
43641
43862
|
DropdownMenuGroup.displayName = GROUP_NAME3;
|
|
@@ -43644,7 +43865,7 @@ var DropdownMenuLabel = React43.forwardRef(
|
|
|
43644
43865
|
(props, forwardedRef) => {
|
|
43645
43866
|
const { __scopeDropdownMenu, ...labelProps } = props;
|
|
43646
43867
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
43647
|
-
return /* @__PURE__ */
|
|
43868
|
+
return /* @__PURE__ */ jsx33(Label, { ...menuScope, ...labelProps, ref: forwardedRef });
|
|
43648
43869
|
}
|
|
43649
43870
|
);
|
|
43650
43871
|
DropdownMenuLabel.displayName = LABEL_NAME2;
|
|
@@ -43653,7 +43874,7 @@ var DropdownMenuItem = React43.forwardRef(
|
|
|
43653
43874
|
(props, forwardedRef) => {
|
|
43654
43875
|
const { __scopeDropdownMenu, ...itemProps } = props;
|
|
43655
43876
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
43656
|
-
return /* @__PURE__ */
|
|
43877
|
+
return /* @__PURE__ */ jsx33(Item2, { ...menuScope, ...itemProps, ref: forwardedRef });
|
|
43657
43878
|
}
|
|
43658
43879
|
);
|
|
43659
43880
|
DropdownMenuItem.displayName = ITEM_NAME3;
|
|
@@ -43661,35 +43882,35 @@ var CHECKBOX_ITEM_NAME2 = "DropdownMenuCheckboxItem";
|
|
|
43661
43882
|
var DropdownMenuCheckboxItem = React43.forwardRef((props, forwardedRef) => {
|
|
43662
43883
|
const { __scopeDropdownMenu, ...checkboxItemProps } = props;
|
|
43663
43884
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
43664
|
-
return /* @__PURE__ */
|
|
43885
|
+
return /* @__PURE__ */ jsx33(CheckboxItem, { ...menuScope, ...checkboxItemProps, ref: forwardedRef });
|
|
43665
43886
|
});
|
|
43666
43887
|
DropdownMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME2;
|
|
43667
43888
|
var RADIO_GROUP_NAME2 = "DropdownMenuRadioGroup";
|
|
43668
43889
|
var DropdownMenuRadioGroup = React43.forwardRef((props, forwardedRef) => {
|
|
43669
43890
|
const { __scopeDropdownMenu, ...radioGroupProps } = props;
|
|
43670
43891
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
43671
|
-
return /* @__PURE__ */
|
|
43892
|
+
return /* @__PURE__ */ jsx33(RadioGroup, { ...menuScope, ...radioGroupProps, ref: forwardedRef });
|
|
43672
43893
|
});
|
|
43673
43894
|
DropdownMenuRadioGroup.displayName = RADIO_GROUP_NAME2;
|
|
43674
43895
|
var RADIO_ITEM_NAME2 = "DropdownMenuRadioItem";
|
|
43675
43896
|
var DropdownMenuRadioItem = React43.forwardRef((props, forwardedRef) => {
|
|
43676
43897
|
const { __scopeDropdownMenu, ...radioItemProps } = props;
|
|
43677
43898
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
43678
|
-
return /* @__PURE__ */
|
|
43899
|
+
return /* @__PURE__ */ jsx33(RadioItem, { ...menuScope, ...radioItemProps, ref: forwardedRef });
|
|
43679
43900
|
});
|
|
43680
43901
|
DropdownMenuRadioItem.displayName = RADIO_ITEM_NAME2;
|
|
43681
43902
|
var INDICATOR_NAME = "DropdownMenuItemIndicator";
|
|
43682
43903
|
var DropdownMenuItemIndicator = React43.forwardRef((props, forwardedRef) => {
|
|
43683
43904
|
const { __scopeDropdownMenu, ...itemIndicatorProps } = props;
|
|
43684
43905
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
43685
|
-
return /* @__PURE__ */
|
|
43906
|
+
return /* @__PURE__ */ jsx33(ItemIndicator, { ...menuScope, ...itemIndicatorProps, ref: forwardedRef });
|
|
43686
43907
|
});
|
|
43687
43908
|
DropdownMenuItemIndicator.displayName = INDICATOR_NAME;
|
|
43688
43909
|
var SEPARATOR_NAME2 = "DropdownMenuSeparator";
|
|
43689
43910
|
var DropdownMenuSeparator = React43.forwardRef((props, forwardedRef) => {
|
|
43690
43911
|
const { __scopeDropdownMenu, ...separatorProps } = props;
|
|
43691
43912
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
43692
|
-
return /* @__PURE__ */
|
|
43913
|
+
return /* @__PURE__ */ jsx33(Separator, { ...menuScope, ...separatorProps, ref: forwardedRef });
|
|
43693
43914
|
});
|
|
43694
43915
|
DropdownMenuSeparator.displayName = SEPARATOR_NAME2;
|
|
43695
43916
|
var ARROW_NAME3 = "DropdownMenuArrow";
|
|
@@ -43697,7 +43918,7 @@ var DropdownMenuArrow = React43.forwardRef(
|
|
|
43697
43918
|
(props, forwardedRef) => {
|
|
43698
43919
|
const { __scopeDropdownMenu, ...arrowProps } = props;
|
|
43699
43920
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
43700
|
-
return /* @__PURE__ */
|
|
43921
|
+
return /* @__PURE__ */ jsx33(Arrow22, { ...menuScope, ...arrowProps, ref: forwardedRef });
|
|
43701
43922
|
}
|
|
43702
43923
|
);
|
|
43703
43924
|
DropdownMenuArrow.displayName = ARROW_NAME3;
|
|
@@ -43710,20 +43931,20 @@ var DropdownMenuSub = (props) => {
|
|
|
43710
43931
|
onChange: onOpenChange,
|
|
43711
43932
|
caller: "DropdownMenuSub"
|
|
43712
43933
|
});
|
|
43713
|
-
return /* @__PURE__ */
|
|
43934
|
+
return /* @__PURE__ */ jsx33(Sub, { ...menuScope, open, onOpenChange: setOpen, children });
|
|
43714
43935
|
};
|
|
43715
43936
|
var SUB_TRIGGER_NAME2 = "DropdownMenuSubTrigger";
|
|
43716
43937
|
var DropdownMenuSubTrigger = React43.forwardRef((props, forwardedRef) => {
|
|
43717
43938
|
const { __scopeDropdownMenu, ...subTriggerProps } = props;
|
|
43718
43939
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
43719
|
-
return /* @__PURE__ */
|
|
43940
|
+
return /* @__PURE__ */ jsx33(SubTrigger, { ...menuScope, ...subTriggerProps, ref: forwardedRef });
|
|
43720
43941
|
});
|
|
43721
43942
|
DropdownMenuSubTrigger.displayName = SUB_TRIGGER_NAME2;
|
|
43722
43943
|
var SUB_CONTENT_NAME2 = "DropdownMenuSubContent";
|
|
43723
43944
|
var DropdownMenuSubContent = React43.forwardRef((props, forwardedRef) => {
|
|
43724
43945
|
const { __scopeDropdownMenu, ...subContentProps } = props;
|
|
43725
43946
|
const menuScope = useMenuScope(__scopeDropdownMenu);
|
|
43726
|
-
return /* @__PURE__ */
|
|
43947
|
+
return /* @__PURE__ */ jsx33(
|
|
43727
43948
|
SubContent,
|
|
43728
43949
|
{
|
|
43729
43950
|
...menuScope,
|
|
@@ -43755,11 +43976,11 @@ var SubTrigger2 = DropdownMenuSubTrigger;
|
|
|
43755
43976
|
var SubContent2 = DropdownMenuSubContent;
|
|
43756
43977
|
|
|
43757
43978
|
// src/components/AppearanceMenu.tsx
|
|
43758
|
-
import { useState as
|
|
43979
|
+
import { useState as useState33 } from "react";
|
|
43759
43980
|
|
|
43760
43981
|
// src/components/Icons.tsx
|
|
43761
|
-
import { jsx as
|
|
43762
|
-
var CheckIcon = () => /* @__PURE__ */
|
|
43982
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
43983
|
+
var CheckIcon = () => /* @__PURE__ */ jsx34(
|
|
43763
43984
|
"svg",
|
|
43764
43985
|
{
|
|
43765
43986
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -43771,10 +43992,10 @@ var CheckIcon = () => /* @__PURE__ */ jsx33(
|
|
|
43771
43992
|
strokeWidth: "2",
|
|
43772
43993
|
strokeLinecap: "round",
|
|
43773
43994
|
strokeLinejoin: "round",
|
|
43774
|
-
children: /* @__PURE__ */
|
|
43995
|
+
children: /* @__PURE__ */ jsx34("path", { d: "M20 6 9 17l-5-5" })
|
|
43775
43996
|
}
|
|
43776
43997
|
);
|
|
43777
|
-
var ChevronRightIcon = ({ isOpen }) => /* @__PURE__ */
|
|
43998
|
+
var ChevronRightIcon = ({ isOpen }) => /* @__PURE__ */ jsx34(
|
|
43778
43999
|
"svg",
|
|
43779
44000
|
{
|
|
43780
44001
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -43791,10 +44012,10 @@ var ChevronRightIcon = ({ isOpen }) => /* @__PURE__ */ jsx33(
|
|
|
43791
44012
|
transform: isOpen ? "rotate(90deg)" : "rotate(0deg)",
|
|
43792
44013
|
opacity: 0.6
|
|
43793
44014
|
},
|
|
43794
|
-
children: /* @__PURE__ */
|
|
44015
|
+
children: /* @__PURE__ */ jsx34("path", { d: "m9 18 6-6-6-6" })
|
|
43795
44016
|
}
|
|
43796
44017
|
);
|
|
43797
|
-
var DotIcon = () => /* @__PURE__ */
|
|
44018
|
+
var DotIcon = () => /* @__PURE__ */ jsx34(
|
|
43798
44019
|
"svg",
|
|
43799
44020
|
{
|
|
43800
44021
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -43807,12 +44028,12 @@ var DotIcon = () => /* @__PURE__ */ jsx33(
|
|
|
43807
44028
|
strokeLinecap: "round",
|
|
43808
44029
|
strokeLinejoin: "round",
|
|
43809
44030
|
className: "lucide lucide-dot-icon lucide-dot",
|
|
43810
|
-
children: /* @__PURE__ */
|
|
44031
|
+
children: /* @__PURE__ */ jsx34("circle", { cx: "12.1", cy: "12.1", r: "4.5", fill: "white" })
|
|
43811
44032
|
}
|
|
43812
44033
|
);
|
|
43813
44034
|
|
|
43814
44035
|
// src/components/AppearanceMenu.tsx
|
|
43815
|
-
import { Fragment as Fragment10, jsx as
|
|
44036
|
+
import { Fragment as Fragment10, jsx as jsx35, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
43816
44037
|
var itemStyles = {
|
|
43817
44038
|
padding: "6px 8px",
|
|
43818
44039
|
borderRadius: 6,
|
|
@@ -43861,10 +44082,10 @@ var iconContainerStyles = {
|
|
|
43861
44082
|
};
|
|
43862
44083
|
var AppearanceMenu = () => {
|
|
43863
44084
|
const { visibility, setLayerVisibility } = useLayerVisibility();
|
|
43864
|
-
const [appearanceSubOpen, setAppearanceSubOpen] =
|
|
43865
|
-
const [hoveredItem, setHoveredItem] =
|
|
44085
|
+
const [appearanceSubOpen, setAppearanceSubOpen] = useState33(false);
|
|
44086
|
+
const [hoveredItem, setHoveredItem] = useState33(null);
|
|
43866
44087
|
return /* @__PURE__ */ jsxs8(Fragment10, { children: [
|
|
43867
|
-
/* @__PURE__ */
|
|
44088
|
+
/* @__PURE__ */ jsx35(Separator2, { style: separatorStyles }),
|
|
43868
44089
|
/* @__PURE__ */ jsxs8(Sub2, { onOpenChange: setAppearanceSubOpen, children: [
|
|
43869
44090
|
/* @__PURE__ */ jsxs8(
|
|
43870
44091
|
SubTrigger2,
|
|
@@ -43878,8 +44099,8 @@ var AppearanceMenu = () => {
|
|
|
43878
44099
|
onMouseLeave: () => setHoveredItem(null),
|
|
43879
44100
|
onTouchStart: () => setHoveredItem("appearance"),
|
|
43880
44101
|
children: [
|
|
43881
|
-
/* @__PURE__ */
|
|
43882
|
-
/* @__PURE__ */
|
|
44102
|
+
/* @__PURE__ */ jsx35("span", { style: { flex: 1, display: "flex", alignItems: "center" }, children: "Appearance" }),
|
|
44103
|
+
/* @__PURE__ */ jsx35(
|
|
43883
44104
|
"div",
|
|
43884
44105
|
{
|
|
43885
44106
|
style: {
|
|
@@ -43888,13 +44109,13 @@ var AppearanceMenu = () => {
|
|
|
43888
44109
|
alignItems: "flex-end",
|
|
43889
44110
|
marginBottom: "-5px"
|
|
43890
44111
|
},
|
|
43891
|
-
children: /* @__PURE__ */
|
|
44112
|
+
children: /* @__PURE__ */ jsx35(ChevronRightIcon, { isOpen: appearanceSubOpen })
|
|
43892
44113
|
}
|
|
43893
44114
|
)
|
|
43894
44115
|
]
|
|
43895
44116
|
}
|
|
43896
44117
|
),
|
|
43897
|
-
/* @__PURE__ */
|
|
44118
|
+
/* @__PURE__ */ jsx35(Portal22, { children: /* @__PURE__ */ jsxs8(
|
|
43898
44119
|
SubContent2,
|
|
43899
44120
|
{
|
|
43900
44121
|
style: { ...contentStyles, marginLeft: -2 },
|
|
@@ -43917,8 +44138,8 @@ var AppearanceMenu = () => {
|
|
|
43917
44138
|
onMouseLeave: () => setHoveredItem(null),
|
|
43918
44139
|
onTouchStart: () => setHoveredItem("boardBody"),
|
|
43919
44140
|
children: [
|
|
43920
|
-
/* @__PURE__ */
|
|
43921
|
-
/* @__PURE__ */
|
|
44141
|
+
/* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: visibility.boardBody && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
|
|
44142
|
+
/* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Board Body" })
|
|
43922
44143
|
]
|
|
43923
44144
|
}
|
|
43924
44145
|
),
|
|
@@ -43938,8 +44159,8 @@ var AppearanceMenu = () => {
|
|
|
43938
44159
|
onMouseLeave: () => setHoveredItem(null),
|
|
43939
44160
|
onTouchStart: () => setHoveredItem("topCopper"),
|
|
43940
44161
|
children: [
|
|
43941
|
-
/* @__PURE__ */
|
|
43942
|
-
/* @__PURE__ */
|
|
44162
|
+
/* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: visibility.topCopper && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
|
|
44163
|
+
/* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Top Copper" })
|
|
43943
44164
|
]
|
|
43944
44165
|
}
|
|
43945
44166
|
),
|
|
@@ -43959,8 +44180,8 @@ var AppearanceMenu = () => {
|
|
|
43959
44180
|
onMouseLeave: () => setHoveredItem(null),
|
|
43960
44181
|
onTouchStart: () => setHoveredItem("bottomCopper"),
|
|
43961
44182
|
children: [
|
|
43962
|
-
/* @__PURE__ */
|
|
43963
|
-
/* @__PURE__ */
|
|
44183
|
+
/* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: visibility.bottomCopper && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
|
|
44184
|
+
/* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Copper" })
|
|
43964
44185
|
]
|
|
43965
44186
|
}
|
|
43966
44187
|
),
|
|
@@ -43980,8 +44201,8 @@ var AppearanceMenu = () => {
|
|
|
43980
44201
|
onMouseLeave: () => setHoveredItem(null),
|
|
43981
44202
|
onTouchStart: () => setHoveredItem("topSilkscreen"),
|
|
43982
44203
|
children: [
|
|
43983
|
-
/* @__PURE__ */
|
|
43984
|
-
/* @__PURE__ */
|
|
44204
|
+
/* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: visibility.topSilkscreen && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
|
|
44205
|
+
/* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Top Silkscreen" })
|
|
43985
44206
|
]
|
|
43986
44207
|
}
|
|
43987
44208
|
),
|
|
@@ -44004,8 +44225,8 @@ var AppearanceMenu = () => {
|
|
|
44004
44225
|
onMouseLeave: () => setHoveredItem(null),
|
|
44005
44226
|
onTouchStart: () => setHoveredItem("bottomSilkscreen"),
|
|
44006
44227
|
children: [
|
|
44007
|
-
/* @__PURE__ */
|
|
44008
|
-
/* @__PURE__ */
|
|
44228
|
+
/* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: visibility.bottomSilkscreen && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
|
|
44229
|
+
/* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Silkscreen" })
|
|
44009
44230
|
]
|
|
44010
44231
|
}
|
|
44011
44232
|
),
|
|
@@ -44025,8 +44246,8 @@ var AppearanceMenu = () => {
|
|
|
44025
44246
|
onMouseLeave: () => setHoveredItem(null),
|
|
44026
44247
|
onTouchStart: () => setHoveredItem("topMask"),
|
|
44027
44248
|
children: [
|
|
44028
|
-
/* @__PURE__ */
|
|
44029
|
-
/* @__PURE__ */
|
|
44249
|
+
/* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: visibility.topMask && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
|
|
44250
|
+
/* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Top Soldermask" })
|
|
44030
44251
|
]
|
|
44031
44252
|
}
|
|
44032
44253
|
),
|
|
@@ -44046,8 +44267,8 @@ var AppearanceMenu = () => {
|
|
|
44046
44267
|
onMouseLeave: () => setHoveredItem(null),
|
|
44047
44268
|
onTouchStart: () => setHoveredItem("bottomMask"),
|
|
44048
44269
|
children: [
|
|
44049
|
-
/* @__PURE__ */
|
|
44050
|
-
/* @__PURE__ */
|
|
44270
|
+
/* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: visibility.bottomMask && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
|
|
44271
|
+
/* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Soldermask" })
|
|
44051
44272
|
]
|
|
44052
44273
|
}
|
|
44053
44274
|
),
|
|
@@ -44067,8 +44288,8 @@ var AppearanceMenu = () => {
|
|
|
44067
44288
|
onMouseLeave: () => setHoveredItem(null),
|
|
44068
44289
|
onTouchStart: () => setHoveredItem("smtModels"),
|
|
44069
44290
|
children: [
|
|
44070
|
-
/* @__PURE__ */
|
|
44071
|
-
/* @__PURE__ */
|
|
44291
|
+
/* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: visibility.smtModels && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
|
|
44292
|
+
/* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Surface Mount Components" })
|
|
44072
44293
|
]
|
|
44073
44294
|
}
|
|
44074
44295
|
),
|
|
@@ -44091,8 +44312,8 @@ var AppearanceMenu = () => {
|
|
|
44091
44312
|
onMouseLeave: () => setHoveredItem(null),
|
|
44092
44313
|
onTouchStart: () => setHoveredItem("throughHoleModels"),
|
|
44093
44314
|
children: [
|
|
44094
|
-
/* @__PURE__ */
|
|
44095
|
-
/* @__PURE__ */
|
|
44315
|
+
/* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: visibility.throughHoleModels && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
|
|
44316
|
+
/* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Through-Hole Components" })
|
|
44096
44317
|
]
|
|
44097
44318
|
}
|
|
44098
44319
|
)
|
|
@@ -44104,7 +44325,7 @@ var AppearanceMenu = () => {
|
|
|
44104
44325
|
};
|
|
44105
44326
|
|
|
44106
44327
|
// src/components/ContextMenu.tsx
|
|
44107
|
-
import { jsx as
|
|
44328
|
+
import { jsx as jsx36, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
44108
44329
|
var cameraOptions = [
|
|
44109
44330
|
"Custom",
|
|
44110
44331
|
"Top Center Angled",
|
|
@@ -44186,9 +44407,9 @@ var ContextMenu = ({
|
|
|
44186
44407
|
onOpenKeyboardShortcuts
|
|
44187
44408
|
}) => {
|
|
44188
44409
|
const { cameraType, setCameraType } = useCameraController();
|
|
44189
|
-
const [cameraSubOpen, setCameraSubOpen] =
|
|
44190
|
-
const [hoveredItem, setHoveredItem] =
|
|
44191
|
-
return /* @__PURE__ */
|
|
44410
|
+
const [cameraSubOpen, setCameraSubOpen] = useState34(false);
|
|
44411
|
+
const [hoveredItem, setHoveredItem] = useState34(null);
|
|
44412
|
+
return /* @__PURE__ */ jsx36(
|
|
44192
44413
|
"div",
|
|
44193
44414
|
{
|
|
44194
44415
|
ref: menuRef,
|
|
@@ -44200,8 +44421,8 @@ var ContextMenu = ({
|
|
|
44200
44421
|
height: 0
|
|
44201
44422
|
},
|
|
44202
44423
|
children: /* @__PURE__ */ jsxs9(Root22, { open: true, modal: false, children: [
|
|
44203
|
-
/* @__PURE__ */
|
|
44204
|
-
/* @__PURE__ */
|
|
44424
|
+
/* @__PURE__ */ jsx36(Trigger, { asChild: true, children: /* @__PURE__ */ jsx36("div", { style: { position: "absolute", width: 1, height: 1 } }) }),
|
|
44425
|
+
/* @__PURE__ */ jsx36(Portal22, { children: /* @__PURE__ */ jsxs9(
|
|
44205
44426
|
Content22,
|
|
44206
44427
|
{
|
|
44207
44428
|
style: contentStyles2,
|
|
@@ -44223,7 +44444,7 @@ var ContextMenu = ({
|
|
|
44223
44444
|
onMouseLeave: () => setHoveredItem(null),
|
|
44224
44445
|
onTouchStart: () => setHoveredItem("camera"),
|
|
44225
44446
|
children: [
|
|
44226
|
-
/* @__PURE__ */
|
|
44447
|
+
/* @__PURE__ */ jsx36(
|
|
44227
44448
|
"span",
|
|
44228
44449
|
{
|
|
44229
44450
|
style: { flex: 1, display: "flex", alignItems: "center" },
|
|
@@ -44240,15 +44461,15 @@ var ContextMenu = ({
|
|
|
44240
44461
|
marginLeft: "auto"
|
|
44241
44462
|
},
|
|
44242
44463
|
children: [
|
|
44243
|
-
/* @__PURE__ */
|
|
44244
|
-
/* @__PURE__ */
|
|
44464
|
+
/* @__PURE__ */ jsx36("span", { style: { opacity: 0.55, fontSize: 13 }, children: cameraPreset }),
|
|
44465
|
+
/* @__PURE__ */ jsx36(ChevronRightIcon, { isOpen: cameraSubOpen })
|
|
44245
44466
|
]
|
|
44246
44467
|
}
|
|
44247
44468
|
)
|
|
44248
44469
|
]
|
|
44249
44470
|
}
|
|
44250
44471
|
),
|
|
44251
|
-
/* @__PURE__ */
|
|
44472
|
+
/* @__PURE__ */ jsx36(Portal22, { children: /* @__PURE__ */ jsx36(
|
|
44252
44473
|
SubContent2,
|
|
44253
44474
|
{
|
|
44254
44475
|
style: { ...contentStyles2, marginLeft: -2 },
|
|
@@ -44270,8 +44491,8 @@ var ContextMenu = ({
|
|
|
44270
44491
|
onMouseLeave: () => setHoveredItem(null),
|
|
44271
44492
|
onTouchStart: () => setHoveredItem(option),
|
|
44272
44493
|
children: [
|
|
44273
|
-
/* @__PURE__ */
|
|
44274
|
-
/* @__PURE__ */
|
|
44494
|
+
/* @__PURE__ */ jsx36("span", { style: iconContainerStyles2, children: cameraPreset === option && /* @__PURE__ */ jsx36(DotIcon, {}) }),
|
|
44495
|
+
/* @__PURE__ */ jsx36("span", { style: { display: "flex", alignItems: "center" }, children: option })
|
|
44275
44496
|
]
|
|
44276
44497
|
},
|
|
44277
44498
|
option
|
|
@@ -44295,8 +44516,8 @@ var ContextMenu = ({
|
|
|
44295
44516
|
onMouseLeave: () => setHoveredItem(null),
|
|
44296
44517
|
onTouchStart: () => setHoveredItem("autorotate"),
|
|
44297
44518
|
children: [
|
|
44298
|
-
/* @__PURE__ */
|
|
44299
|
-
/* @__PURE__ */
|
|
44519
|
+
/* @__PURE__ */ jsx36("span", { style: iconContainerStyles2, children: autoRotate && /* @__PURE__ */ jsx36(CheckIcon, {}) }),
|
|
44520
|
+
/* @__PURE__ */ jsx36("span", { style: { display: "flex", alignItems: "center" }, children: "Auto rotate" })
|
|
44300
44521
|
]
|
|
44301
44522
|
}
|
|
44302
44523
|
),
|
|
@@ -44318,14 +44539,14 @@ var ContextMenu = ({
|
|
|
44318
44539
|
onMouseLeave: () => setHoveredItem(null),
|
|
44319
44540
|
onTouchStart: () => setHoveredItem("cameratype"),
|
|
44320
44541
|
children: [
|
|
44321
|
-
/* @__PURE__ */
|
|
44322
|
-
/* @__PURE__ */
|
|
44542
|
+
/* @__PURE__ */ jsx36("span", { style: iconContainerStyles2, children: cameraType === "orthographic" && /* @__PURE__ */ jsx36(CheckIcon, {}) }),
|
|
44543
|
+
/* @__PURE__ */ jsx36("span", { style: { display: "flex", alignItems: "center" }, children: "Orthographic Camera" })
|
|
44323
44544
|
]
|
|
44324
44545
|
}
|
|
44325
44546
|
),
|
|
44326
|
-
/* @__PURE__ */
|
|
44327
|
-
/* @__PURE__ */
|
|
44328
|
-
/* @__PURE__ */
|
|
44547
|
+
/* @__PURE__ */ jsx36(AppearanceMenu, {}),
|
|
44548
|
+
/* @__PURE__ */ jsx36(Separator2, { style: separatorStyles2 }),
|
|
44549
|
+
/* @__PURE__ */ jsx36(
|
|
44329
44550
|
Item22,
|
|
44330
44551
|
{
|
|
44331
44552
|
style: {
|
|
@@ -44337,10 +44558,10 @@ var ContextMenu = ({
|
|
|
44337
44558
|
onMouseEnter: () => setHoveredItem("download"),
|
|
44338
44559
|
onMouseLeave: () => setHoveredItem(null),
|
|
44339
44560
|
onTouchStart: () => setHoveredItem("download"),
|
|
44340
|
-
children: /* @__PURE__ */
|
|
44561
|
+
children: /* @__PURE__ */ jsx36("span", { style: { display: "flex", alignItems: "center" }, children: "Download GLTF" })
|
|
44341
44562
|
}
|
|
44342
44563
|
),
|
|
44343
|
-
/* @__PURE__ */
|
|
44564
|
+
/* @__PURE__ */ jsx36(Separator2, { style: separatorStyles2 }),
|
|
44344
44565
|
/* @__PURE__ */ jsxs9(
|
|
44345
44566
|
Item22,
|
|
44346
44567
|
{
|
|
@@ -44363,7 +44584,7 @@ var ContextMenu = ({
|
|
|
44363
44584
|
engine === "jscad" ? "Manifold" : "JSCAD",
|
|
44364
44585
|
" Engine"
|
|
44365
44586
|
] }),
|
|
44366
|
-
/* @__PURE__ */
|
|
44587
|
+
/* @__PURE__ */ jsx36(
|
|
44367
44588
|
"div",
|
|
44368
44589
|
{
|
|
44369
44590
|
style: {
|
|
@@ -44377,7 +44598,7 @@ var ContextMenu = ({
|
|
|
44377
44598
|
]
|
|
44378
44599
|
}
|
|
44379
44600
|
),
|
|
44380
|
-
/* @__PURE__ */
|
|
44601
|
+
/* @__PURE__ */ jsx36(Separator2, { style: separatorStyles2 }),
|
|
44381
44602
|
/* @__PURE__ */ jsxs9(
|
|
44382
44603
|
Item22,
|
|
44383
44604
|
{
|
|
@@ -44391,8 +44612,8 @@ var ContextMenu = ({
|
|
|
44391
44612
|
onMouseLeave: () => setHoveredItem(null),
|
|
44392
44613
|
onTouchStart: () => setHoveredItem("shortcuts"),
|
|
44393
44614
|
children: [
|
|
44394
|
-
/* @__PURE__ */
|
|
44395
|
-
/* @__PURE__ */
|
|
44615
|
+
/* @__PURE__ */ jsx36("span", { style: { flex: 1, display: "flex", alignItems: "center" }, children: "Keyboard Shortcuts" }),
|
|
44616
|
+
/* @__PURE__ */ jsx36(
|
|
44396
44617
|
"div",
|
|
44397
44618
|
{
|
|
44398
44619
|
style: {
|
|
@@ -44406,8 +44627,8 @@ var ContextMenu = ({
|
|
|
44406
44627
|
]
|
|
44407
44628
|
}
|
|
44408
44629
|
),
|
|
44409
|
-
/* @__PURE__ */
|
|
44410
|
-
/* @__PURE__ */
|
|
44630
|
+
/* @__PURE__ */ jsx36(Separator2, { style: separatorStyles2 }),
|
|
44631
|
+
/* @__PURE__ */ jsx36(
|
|
44411
44632
|
"div",
|
|
44412
44633
|
{
|
|
44413
44634
|
style: {
|
|
@@ -44445,16 +44666,16 @@ var ContextMenu = ({
|
|
|
44445
44666
|
};
|
|
44446
44667
|
|
|
44447
44668
|
// src/components/KeyboardShortcutsDialog.tsx
|
|
44448
|
-
import { useEffect as
|
|
44449
|
-
import { jsx as
|
|
44669
|
+
import { useEffect as useEffect43, useMemo as useMemo29, useRef as useRef25, useState as useState35 } from "react";
|
|
44670
|
+
import { jsx as jsx37, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
44450
44671
|
var KeyboardShortcutsDialog = ({
|
|
44451
44672
|
open,
|
|
44452
44673
|
onClose
|
|
44453
44674
|
}) => {
|
|
44454
|
-
const [query, setQuery] =
|
|
44675
|
+
const [query, setQuery] = useState35("");
|
|
44455
44676
|
const inputRef = useRef25(null);
|
|
44456
44677
|
const hotkeys = useHotkeyRegistry();
|
|
44457
|
-
|
|
44678
|
+
useEffect43(() => {
|
|
44458
44679
|
if (!open) return void 0;
|
|
44459
44680
|
const handleKeyDown = (event) => {
|
|
44460
44681
|
if (event.key === "Escape") {
|
|
@@ -44465,7 +44686,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
44465
44686
|
window.addEventListener("keydown", handleKeyDown);
|
|
44466
44687
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
44467
44688
|
}, [open, onClose]);
|
|
44468
|
-
|
|
44689
|
+
useEffect43(() => {
|
|
44469
44690
|
if (open) {
|
|
44470
44691
|
setTimeout(() => {
|
|
44471
44692
|
inputRef.current?.focus();
|
|
@@ -44485,7 +44706,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
44485
44706
|
if (!open) {
|
|
44486
44707
|
return null;
|
|
44487
44708
|
}
|
|
44488
|
-
return /* @__PURE__ */
|
|
44709
|
+
return /* @__PURE__ */ jsx37(
|
|
44489
44710
|
"div",
|
|
44490
44711
|
{
|
|
44491
44712
|
role: "dialog",
|
|
@@ -44525,7 +44746,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
44525
44746
|
},
|
|
44526
44747
|
children: [
|
|
44527
44748
|
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", justifyContent: "space-between" }, children: [
|
|
44528
|
-
/* @__PURE__ */
|
|
44749
|
+
/* @__PURE__ */ jsx37(
|
|
44529
44750
|
"h2",
|
|
44530
44751
|
{
|
|
44531
44752
|
style: {
|
|
@@ -44537,7 +44758,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
44537
44758
|
children: "Keyboard Shortcuts"
|
|
44538
44759
|
}
|
|
44539
44760
|
),
|
|
44540
|
-
/* @__PURE__ */
|
|
44761
|
+
/* @__PURE__ */ jsx37(
|
|
44541
44762
|
"button",
|
|
44542
44763
|
{
|
|
44543
44764
|
type: "button",
|
|
@@ -44553,7 +44774,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
44553
44774
|
}
|
|
44554
44775
|
)
|
|
44555
44776
|
] }),
|
|
44556
|
-
/* @__PURE__ */
|
|
44777
|
+
/* @__PURE__ */ jsx37(
|
|
44557
44778
|
"input",
|
|
44558
44779
|
{
|
|
44559
44780
|
ref: inputRef,
|
|
@@ -44576,7 +44797,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
44576
44797
|
]
|
|
44577
44798
|
}
|
|
44578
44799
|
),
|
|
44579
|
-
/* @__PURE__ */
|
|
44800
|
+
/* @__PURE__ */ jsx37("div", { style: { overflowY: "auto" }, children: /* @__PURE__ */ jsxs10(
|
|
44580
44801
|
"table",
|
|
44581
44802
|
{
|
|
44582
44803
|
style: {
|
|
@@ -44585,11 +44806,11 @@ var KeyboardShortcutsDialog = ({
|
|
|
44585
44806
|
fontSize: "0.95rem"
|
|
44586
44807
|
},
|
|
44587
44808
|
children: [
|
|
44588
|
-
/* @__PURE__ */
|
|
44589
|
-
/* @__PURE__ */
|
|
44590
|
-
/* @__PURE__ */
|
|
44809
|
+
/* @__PURE__ */ jsx37("thead", { children: /* @__PURE__ */ jsxs10("tr", { style: { textAlign: "left", color: "#a1a1b5" }, children: [
|
|
44810
|
+
/* @__PURE__ */ jsx37("th", { style: { padding: "12px 24px", width: "25%" }, children: "Key" }),
|
|
44811
|
+
/* @__PURE__ */ jsx37("th", { style: { padding: "12px 24px" }, children: "Description" })
|
|
44591
44812
|
] }) }),
|
|
44592
|
-
/* @__PURE__ */
|
|
44813
|
+
/* @__PURE__ */ jsx37("tbody", { children: filteredHotkeys.length === 0 ? /* @__PURE__ */ jsx37("tr", { children: /* @__PURE__ */ jsx37(
|
|
44593
44814
|
"td",
|
|
44594
44815
|
{
|
|
44595
44816
|
colSpan: 2,
|
|
@@ -44601,7 +44822,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
44601
44822
|
{
|
|
44602
44823
|
style: { borderTop: "1px solid rgba(255, 255, 255, 0.05)" },
|
|
44603
44824
|
children: [
|
|
44604
|
-
/* @__PURE__ */
|
|
44825
|
+
/* @__PURE__ */ jsx37("td", { style: { padding: "12px 24px" }, children: /* @__PURE__ */ jsx37(
|
|
44605
44826
|
"span",
|
|
44606
44827
|
{
|
|
44607
44828
|
style: {
|
|
@@ -44619,7 +44840,7 @@ var KeyboardShortcutsDialog = ({
|
|
|
44619
44840
|
children: hotkey.shortcut
|
|
44620
44841
|
}
|
|
44621
44842
|
) }),
|
|
44622
|
-
/* @__PURE__ */
|
|
44843
|
+
/* @__PURE__ */ jsx37("td", { style: { padding: "12px 24px" }, children: hotkey.description })
|
|
44623
44844
|
]
|
|
44624
44845
|
},
|
|
44625
44846
|
hotkey.id
|
|
@@ -44635,22 +44856,22 @@ var KeyboardShortcutsDialog = ({
|
|
|
44635
44856
|
};
|
|
44636
44857
|
|
|
44637
44858
|
// src/CadViewer.tsx
|
|
44638
|
-
import { jsx as
|
|
44859
|
+
import { jsx as jsx38, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
44639
44860
|
var DEFAULT_TARGET = new THREE34.Vector3(0, 0, 0);
|
|
44640
44861
|
var INITIAL_CAMERA_POSITION = [5, -5, 5];
|
|
44641
44862
|
var CadViewerInner = (props) => {
|
|
44642
|
-
const [engine, setEngine] =
|
|
44863
|
+
const [engine, setEngine] = useState36("manifold");
|
|
44643
44864
|
const containerRef = useRef26(null);
|
|
44644
|
-
const [isKeyboardShortcutsDialogOpen, setIsKeyboardShortcutsDialogOpen] =
|
|
44645
|
-
const [autoRotate, setAutoRotate] =
|
|
44865
|
+
const [isKeyboardShortcutsDialogOpen, setIsKeyboardShortcutsDialogOpen] = useState36(false);
|
|
44866
|
+
const [autoRotate, setAutoRotate] = useState36(() => {
|
|
44646
44867
|
const stored = window.localStorage.getItem("cadViewerAutoRotate");
|
|
44647
44868
|
return stored === "false" ? false : true;
|
|
44648
44869
|
});
|
|
44649
|
-
const [autoRotateUserToggled, setAutoRotateUserToggled] =
|
|
44870
|
+
const [autoRotateUserToggled, setAutoRotateUserToggled] = useState36(() => {
|
|
44650
44871
|
const stored = window.localStorage.getItem("cadViewerAutoRotateUserToggled");
|
|
44651
44872
|
return stored === "true";
|
|
44652
44873
|
});
|
|
44653
|
-
const [cameraPreset, setCameraPreset] =
|
|
44874
|
+
const [cameraPreset, setCameraPreset] = useState36("Custom");
|
|
44654
44875
|
const { cameraType, setCameraType } = useCameraController();
|
|
44655
44876
|
const { visibility, setLayerVisibility } = useLayerVisibility();
|
|
44656
44877
|
const { showToast } = useToast();
|
|
@@ -44761,36 +44982,36 @@ var CadViewerInner = (props) => {
|
|
|
44761
44982
|
description: "Toggle translucent components"
|
|
44762
44983
|
}
|
|
44763
44984
|
);
|
|
44764
|
-
|
|
44985
|
+
useEffect44(() => {
|
|
44765
44986
|
if (containerRef.current) {
|
|
44766
44987
|
registerHotkeyViewer(containerRef.current);
|
|
44767
44988
|
}
|
|
44768
44989
|
}, []);
|
|
44769
|
-
|
|
44990
|
+
useEffect44(() => {
|
|
44770
44991
|
const stored = window.localStorage.getItem("cadViewerEngine");
|
|
44771
44992
|
if (stored === "jscad" || stored === "manifold") {
|
|
44772
44993
|
setEngine(stored);
|
|
44773
44994
|
}
|
|
44774
44995
|
}, []);
|
|
44775
|
-
|
|
44996
|
+
useEffect44(() => {
|
|
44776
44997
|
window.localStorage.setItem("cadViewerEngine", engine);
|
|
44777
44998
|
}, [engine]);
|
|
44778
|
-
|
|
44999
|
+
useEffect44(() => {
|
|
44779
45000
|
window.localStorage.setItem("cadViewerAutoRotate", String(autoRotate));
|
|
44780
45001
|
}, [autoRotate]);
|
|
44781
|
-
|
|
45002
|
+
useEffect44(() => {
|
|
44782
45003
|
window.localStorage.setItem(
|
|
44783
45004
|
"cadViewerAutoRotateUserToggled",
|
|
44784
45005
|
String(autoRotateUserToggled)
|
|
44785
45006
|
);
|
|
44786
45007
|
}, [autoRotateUserToggled]);
|
|
44787
|
-
|
|
45008
|
+
useEffect44(() => {
|
|
44788
45009
|
const stored = window.localStorage.getItem("cadViewerCameraType");
|
|
44789
45010
|
if (stored === "orthographic" || stored === "perspective") {
|
|
44790
45011
|
setCameraType(stored);
|
|
44791
45012
|
}
|
|
44792
45013
|
}, [setCameraType]);
|
|
44793
|
-
|
|
45014
|
+
useEffect44(() => {
|
|
44794
45015
|
window.localStorage.setItem("cadViewerCameraType", cameraType);
|
|
44795
45016
|
}, [cameraType]);
|
|
44796
45017
|
const viewerKey = props.circuitJson ? JSON.stringify(props.circuitJson) : void 0;
|
|
@@ -44810,7 +45031,7 @@ var CadViewerInner = (props) => {
|
|
|
44810
45031
|
},
|
|
44811
45032
|
...contextMenuEventHandlers,
|
|
44812
45033
|
children: [
|
|
44813
|
-
engine === "jscad" ? /* @__PURE__ */
|
|
45034
|
+
engine === "jscad" ? /* @__PURE__ */ jsx38(
|
|
44814
45035
|
CadViewerJscad,
|
|
44815
45036
|
{
|
|
44816
45037
|
...props,
|
|
@@ -44819,7 +45040,7 @@ var CadViewerInner = (props) => {
|
|
|
44819
45040
|
onUserInteraction: handleUserInteraction,
|
|
44820
45041
|
onCameraControllerReady: handleCameraControllerReady
|
|
44821
45042
|
}
|
|
44822
|
-
) : /* @__PURE__ */
|
|
45043
|
+
) : /* @__PURE__ */ jsx38(
|
|
44823
45044
|
CadViewerManifold_default,
|
|
44824
45045
|
{
|
|
44825
45046
|
...props,
|
|
@@ -44846,11 +45067,11 @@ var CadViewerInner = (props) => {
|
|
|
44846
45067
|
},
|
|
44847
45068
|
children: [
|
|
44848
45069
|
"Engine: ",
|
|
44849
|
-
/* @__PURE__ */
|
|
45070
|
+
/* @__PURE__ */ jsx38("b", { children: engine === "jscad" ? "JSCAD" : "Manifold" })
|
|
44850
45071
|
]
|
|
44851
45072
|
}
|
|
44852
45073
|
),
|
|
44853
|
-
menuVisible && /* @__PURE__ */
|
|
45074
|
+
menuVisible && /* @__PURE__ */ jsx38(
|
|
44854
45075
|
ContextMenu,
|
|
44855
45076
|
{
|
|
44856
45077
|
menuRef,
|
|
@@ -44877,7 +45098,7 @@ var CadViewerInner = (props) => {
|
|
|
44877
45098
|
}
|
|
44878
45099
|
}
|
|
44879
45100
|
),
|
|
44880
|
-
/* @__PURE__ */
|
|
45101
|
+
/* @__PURE__ */ jsx38(
|
|
44881
45102
|
KeyboardShortcutsDialog,
|
|
44882
45103
|
{
|
|
44883
45104
|
open: isKeyboardShortcutsDialogOpen,
|
|
@@ -44890,12 +45111,12 @@ var CadViewerInner = (props) => {
|
|
|
44890
45111
|
);
|
|
44891
45112
|
};
|
|
44892
45113
|
var CadViewer = (props) => {
|
|
44893
|
-
return /* @__PURE__ */
|
|
45114
|
+
return /* @__PURE__ */ jsx38(
|
|
44894
45115
|
CameraControllerProvider,
|
|
44895
45116
|
{
|
|
44896
45117
|
defaultTarget: DEFAULT_TARGET,
|
|
44897
45118
|
initialCameraPosition: INITIAL_CAMERA_POSITION,
|
|
44898
|
-
children: /* @__PURE__ */
|
|
45119
|
+
children: /* @__PURE__ */ jsx38(LayerVisibilityProvider, { children: /* @__PURE__ */ jsx38(ToastProvider, { children: /* @__PURE__ */ jsx38(CadViewerInner, { ...props }) }) })
|
|
44899
45120
|
}
|
|
44900
45121
|
);
|
|
44901
45122
|
};
|
|
@@ -44908,9 +45129,9 @@ import { SVGRenderer } from "three/examples/jsm/renderers/SVGRenderer.js";
|
|
|
44908
45129
|
|
|
44909
45130
|
// src/utils/create-geometry-from-polygons.ts
|
|
44910
45131
|
import * as THREE35 from "three";
|
|
44911
|
-
import { BufferGeometry as
|
|
45132
|
+
import { BufferGeometry as BufferGeometry4, Float32BufferAttribute as Float32BufferAttribute3 } from "three";
|
|
44912
45133
|
function createGeometryFromPolygons(polygons) {
|
|
44913
|
-
const geometry = new
|
|
45134
|
+
const geometry = new BufferGeometry4();
|
|
44914
45135
|
const vertices = [];
|
|
44915
45136
|
const normals = [];
|
|
44916
45137
|
for (const polygon3 of polygons) {
|
|
@@ -44941,8 +45162,8 @@ function createGeometryFromPolygons(polygons) {
|
|
|
44941
45162
|
);
|
|
44942
45163
|
}
|
|
44943
45164
|
}
|
|
44944
|
-
geometry.setAttribute("position", new
|
|
44945
|
-
geometry.setAttribute("normal", new
|
|
45165
|
+
geometry.setAttribute("position", new Float32BufferAttribute3(vertices, 3));
|
|
45166
|
+
geometry.setAttribute("normal", new Float32BufferAttribute3(normals, 3));
|
|
44946
45167
|
return geometry;
|
|
44947
45168
|
}
|
|
44948
45169
|
|
|
@@ -45189,8 +45410,8 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
|
|
|
45189
45410
|
}
|
|
45190
45411
|
|
|
45191
45412
|
// src/hooks/exporter/gltf.ts
|
|
45192
|
-
import { GLTFExporter as
|
|
45193
|
-
import { useEffect as
|
|
45413
|
+
import { GLTFExporter as GLTFExporter3 } from "three-stdlib";
|
|
45414
|
+
import { useEffect as useEffect45, useState as useState37, useMemo as useMemo30, useCallback as useCallback22 } from "react";
|
|
45194
45415
|
function useSaveGltfAs(options = {}) {
|
|
45195
45416
|
const parse2 = useParser(options);
|
|
45196
45417
|
const link = useMemo30(() => document.createElement("a"), []);
|
|
@@ -45203,7 +45424,7 @@ function useSaveGltfAs(options = {}) {
|
|
|
45203
45424
|
link.dispatchEvent(new MouseEvent("click"));
|
|
45204
45425
|
URL.revokeObjectURL(url);
|
|
45205
45426
|
};
|
|
45206
|
-
|
|
45427
|
+
useEffect45(
|
|
45207
45428
|
() => () => {
|
|
45208
45429
|
link.remove();
|
|
45209
45430
|
instance = null;
|
|
@@ -45218,17 +45439,17 @@ function useSaveGltfAs(options = {}) {
|
|
|
45218
45439
|
}
|
|
45219
45440
|
function useExportGltfUrl(options = {}) {
|
|
45220
45441
|
const parse2 = useParser(options);
|
|
45221
|
-
const [url, setUrl] =
|
|
45222
|
-
const [error, setError] =
|
|
45442
|
+
const [url, setUrl] = useState37();
|
|
45443
|
+
const [error, setError] = useState37();
|
|
45223
45444
|
const ref = useCallback22(
|
|
45224
45445
|
(instance) => parse2(instance).then(setUrl).catch(setError),
|
|
45225
45446
|
[]
|
|
45226
45447
|
);
|
|
45227
|
-
|
|
45448
|
+
useEffect45(() => () => URL.revokeObjectURL(url), [url]);
|
|
45228
45449
|
return [ref, url, error];
|
|
45229
45450
|
}
|
|
45230
45451
|
function useParser(options = {}) {
|
|
45231
|
-
const exporter = useMemo30(() => new
|
|
45452
|
+
const exporter = useMemo30(() => new GLTFExporter3(), []);
|
|
45232
45453
|
return (instance) => {
|
|
45233
45454
|
const { promise, resolve, reject } = Promise.withResolvers();
|
|
45234
45455
|
exporter.parse(
|