@tscircuit/3d-viewer 0.0.608 → 0.0.609

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.
Files changed (2) hide show
  1. package/dist/index.js +252 -199
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -14548,7 +14548,7 @@ function resolveFoldPcbs(circuitJson, foldPcbs) {
14548
14548
  }
14549
14549
 
14550
14550
  // src/CadViewer.tsx
14551
- import { useCallback as useCallback24, useContext as useContext10, useEffect as useEffect50, useRef as useRef29, useState as useState39 } from "react";
14551
+ import { useCallback as useCallback24, useContext as useContext10, useEffect as useEffect50, useRef as useRef29, useState as useState40 } from "react";
14552
14552
  import * as THREE54 from "three";
14553
14553
 
14554
14554
  // src/hooks/use-convert-children-to-soup.ts
@@ -14687,8 +14687,8 @@ var zIndexMap = {
14687
14687
  clickToInteractOverlay: 100,
14688
14688
  htmlElements: 95,
14689
14689
  orientationCube: 95,
14690
- contextMenu: 90,
14691
- appearanceMenu: 91
14690
+ contextMenu: 110,
14691
+ appearanceMenu: 111
14692
14692
  };
14693
14693
 
14694
14694
  // src/react-three/Html.tsx
@@ -39315,7 +39315,7 @@ import * as THREE25 from "three";
39315
39315
  // package.json
39316
39316
  var package_default = {
39317
39317
  name: "@tscircuit/3d-viewer",
39318
- version: "0.0.607",
39318
+ version: "0.0.608",
39319
39319
  repository: {
39320
39320
  type: "git",
39321
39321
  url: "https://github.com/tscircuit/3d-viewer"
@@ -54582,15 +54582,74 @@ var Sub2 = DropdownMenuSub;
54582
54582
  var SubTrigger2 = DropdownMenuSubTrigger;
54583
54583
  var SubContent2 = DropdownMenuSubContent;
54584
54584
 
54585
+ // src/components/ViewportSubContent.tsx
54586
+ import { useLayoutEffect as useLayoutEffect5, useState as useState34 } from "react";
54587
+ import { jsx as jsx33 } from "react/jsx-runtime";
54588
+ var ViewportSubContent = (props) => {
54589
+ const [content, setContent] = useState34(null);
54590
+ const [overlapWidth, setOverlapWidth] = useState34();
54591
+ useLayoutEffect5(() => {
54592
+ if (!content) return;
54593
+ const trigger = document.getElementById(
54594
+ content.getAttribute("aria-labelledby") ?? ""
54595
+ );
54596
+ if (!trigger) return;
54597
+ let naturalWidth = 0;
54598
+ const update = () => {
54599
+ naturalWidth = Math.max(naturalWidth, content.offsetWidth);
54600
+ if (!naturalWidth) return;
54601
+ const bounds = trigger.getBoundingClientRect();
54602
+ const availableWidth = Math.max(
54603
+ bounds.left - 10,
54604
+ document.documentElement.clientWidth - bounds.right - 10
54605
+ );
54606
+ setOverlapWidth(availableWidth < naturalWidth ? bounds.width : void 0);
54607
+ };
54608
+ const observer = new ResizeObserver(update);
54609
+ observer.observe(content);
54610
+ observer.observe(trigger);
54611
+ update();
54612
+ window.addEventListener("resize", update);
54613
+ return () => {
54614
+ observer.disconnect();
54615
+ window.removeEventListener("resize", update);
54616
+ };
54617
+ }, [content]);
54618
+ return /* @__PURE__ */ jsx33(
54619
+ SubContent2,
54620
+ {
54621
+ ...props,
54622
+ ref: setContent,
54623
+ sideOffset: overlapWidth === void 0 ? props.sideOffset : -overlapWidth,
54624
+ style: {
54625
+ ...props.style,
54626
+ ...overlapWidth === void 0 ? {} : { minWidth: Math.min(160, overlapWidth), maxWidth: overlapWidth }
54627
+ }
54628
+ }
54629
+ );
54630
+ };
54631
+
54632
+ // src/components/menu-viewport-styles.ts
54633
+ var menuViewportStyles = {
54634
+ boxSizing: "border-box",
54635
+ minWidth: "min(160px, calc(100vw - 20px))",
54636
+ maxWidth: "calc(100vw - 20px)",
54637
+ maxHeight: "var(--radix-dropdown-menu-content-available-height, calc(100dvh - 20px))",
54638
+ overflowY: "auto",
54639
+ overflowX: "hidden",
54640
+ overscrollBehavior: "contain",
54641
+ overflowWrap: "anywhere"
54642
+ };
54643
+
54585
54644
  // src/components/ContextMenu.tsx
54586
- import { useState as useState35 } from "react";
54645
+ import { useState as useState36 } from "react";
54587
54646
 
54588
54647
  // src/components/AppearanceMenu.tsx
54589
- import { useState as useState34 } from "react";
54648
+ import { useState as useState35 } from "react";
54590
54649
 
54591
54650
  // src/components/Icons.tsx
54592
- import { jsx as jsx33 } from "react/jsx-runtime";
54593
- var CheckIcon = () => /* @__PURE__ */ jsx33(
54651
+ import { jsx as jsx34 } from "react/jsx-runtime";
54652
+ var CheckIcon = () => /* @__PURE__ */ jsx34(
54594
54653
  "svg",
54595
54654
  {
54596
54655
  xmlns: "http://www.w3.org/2000/svg",
@@ -54602,10 +54661,10 @@ var CheckIcon = () => /* @__PURE__ */ jsx33(
54602
54661
  strokeWidth: "2",
54603
54662
  strokeLinecap: "round",
54604
54663
  strokeLinejoin: "round",
54605
- children: /* @__PURE__ */ jsx33("path", { d: "M20 6 9 17l-5-5" })
54664
+ children: /* @__PURE__ */ jsx34("path", { d: "M20 6 9 17l-5-5" })
54606
54665
  }
54607
54666
  );
54608
- var ChevronRightIcon = ({ isOpen }) => /* @__PURE__ */ jsx33(
54667
+ var ChevronRightIcon = ({ isOpen }) => /* @__PURE__ */ jsx34(
54609
54668
  "svg",
54610
54669
  {
54611
54670
  xmlns: "http://www.w3.org/2000/svg",
@@ -54622,10 +54681,10 @@ var ChevronRightIcon = ({ isOpen }) => /* @__PURE__ */ jsx33(
54622
54681
  transform: isOpen ? "rotate(90deg)" : "rotate(0deg)",
54623
54682
  opacity: 0.6
54624
54683
  },
54625
- children: /* @__PURE__ */ jsx33("path", { d: "m9 18 6-6-6-6" })
54684
+ children: /* @__PURE__ */ jsx34("path", { d: "m9 18 6-6-6-6" })
54626
54685
  }
54627
54686
  );
54628
- var CheckMinusIcon = () => /* @__PURE__ */ jsx33(
54687
+ var CheckMinusIcon = () => /* @__PURE__ */ jsx34(
54629
54688
  "svg",
54630
54689
  {
54631
54690
  xmlns: "http://www.w3.org/2000/svg",
@@ -54637,10 +54696,10 @@ var CheckMinusIcon = () => /* @__PURE__ */ jsx33(
54637
54696
  strokeWidth: "2",
54638
54697
  strokeLinecap: "round",
54639
54698
  strokeLinejoin: "round",
54640
- children: /* @__PURE__ */ jsx33("path", { d: "M5 12h14" })
54699
+ children: /* @__PURE__ */ jsx34("path", { d: "M5 12h14" })
54641
54700
  }
54642
54701
  );
54643
- var DotIcon = () => /* @__PURE__ */ jsx33(
54702
+ var DotIcon = () => /* @__PURE__ */ jsx34(
54644
54703
  "svg",
54645
54704
  {
54646
54705
  xmlns: "http://www.w3.org/2000/svg",
@@ -54653,12 +54712,12 @@ var DotIcon = () => /* @__PURE__ */ jsx33(
54653
54712
  strokeLinecap: "round",
54654
54713
  strokeLinejoin: "round",
54655
54714
  className: "lucide lucide-dot-icon lucide-dot",
54656
- children: /* @__PURE__ */ jsx33("circle", { cx: "12.1", cy: "12.1", r: "4.5", fill: "white" })
54715
+ children: /* @__PURE__ */ jsx34("circle", { cx: "12.1", cy: "12.1", r: "4.5", fill: "white" })
54657
54716
  }
54658
54717
  );
54659
54718
 
54660
54719
  // src/components/AppearanceMenu.tsx
54661
- import { Fragment as Fragment10, jsx as jsx34, jsxs as jsxs7 } from "react/jsx-runtime";
54720
+ import { Fragment as Fragment10, jsx as jsx35, jsxs as jsxs7 } from "react/jsx-runtime";
54662
54721
  var itemStyles = {
54663
54722
  padding: "6px 8px",
54664
54723
  borderRadius: 6,
@@ -54686,13 +54745,13 @@ var separatorStyles = {
54686
54745
  margin: "4px 0"
54687
54746
  };
54688
54747
  var contentStyles = {
54748
+ ...menuViewportStyles,
54689
54749
  backgroundColor: "#262626",
54690
54750
  color: "#fafafa",
54691
54751
  borderRadius: 8,
54692
54752
  boxShadow: "0px 12px 48px -12px rgba(0, 0, 0, 0.5), 0px 8px 24px -8px rgba(0, 0, 0, 0.3)",
54693
54753
  border: "1px solid #333333",
54694
54754
  padding: "4px",
54695
- minWidth: 160,
54696
54755
  zIndex: zIndexMap.appearanceMenu,
54697
54756
  fontSize: 14,
54698
54757
  fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'
@@ -54713,10 +54772,10 @@ var AppearanceMenu = () => {
54713
54772
  lightingEnabled,
54714
54773
  setLightingEnabled
54715
54774
  } = useAppearance();
54716
- const [appearanceSubOpen, setAppearanceSubOpen] = useState34(false);
54717
- const [hoveredItem, setHoveredItem] = useState34(null);
54775
+ const [appearanceSubOpen, setAppearanceSubOpen] = useState35(false);
54776
+ const [hoveredItem, setHoveredItem] = useState35(null);
54718
54777
  return /* @__PURE__ */ jsxs7(Fragment10, { children: [
54719
- /* @__PURE__ */ jsx34(Separator2, { style: separatorStyles }),
54778
+ /* @__PURE__ */ jsx35(Separator2, { style: separatorStyles }),
54720
54779
  /* @__PURE__ */ jsxs7(Sub2, { onOpenChange: setAppearanceSubOpen, children: [
54721
54780
  /* @__PURE__ */ jsxs7(
54722
54781
  SubTrigger2,
@@ -54730,8 +54789,8 @@ var AppearanceMenu = () => {
54730
54789
  onMouseLeave: () => setHoveredItem(null),
54731
54790
  onTouchStart: () => setHoveredItem("appearance"),
54732
54791
  children: [
54733
- /* @__PURE__ */ jsx34("span", { style: { flex: 1, display: "flex", alignItems: "center" }, children: "Appearance" }),
54734
- /* @__PURE__ */ jsx34(
54792
+ /* @__PURE__ */ jsx35("span", { style: { flex: 1, display: "flex", alignItems: "center" }, children: "Appearance" }),
54793
+ /* @__PURE__ */ jsx35(
54735
54794
  "div",
54736
54795
  {
54737
54796
  style: {
@@ -54740,14 +54799,14 @@ var AppearanceMenu = () => {
54740
54799
  alignItems: "flex-end",
54741
54800
  marginBottom: "-5px"
54742
54801
  },
54743
- children: /* @__PURE__ */ jsx34(ChevronRightIcon, { isOpen: appearanceSubOpen })
54802
+ children: /* @__PURE__ */ jsx35(ChevronRightIcon, { isOpen: appearanceSubOpen })
54744
54803
  }
54745
54804
  )
54746
54805
  ]
54747
54806
  }
54748
54807
  ),
54749
- /* @__PURE__ */ jsx34(Portal22, { children: /* @__PURE__ */ jsxs7(
54750
- SubContent2,
54808
+ /* @__PURE__ */ jsx35(Portal22, { children: /* @__PURE__ */ jsxs7(
54809
+ ViewportSubContent,
54751
54810
  {
54752
54811
  style: { ...contentStyles, marginLeft: -2 },
54753
54812
  collisionPadding: 10,
@@ -54769,8 +54828,8 @@ var AppearanceMenu = () => {
54769
54828
  onMouseLeave: () => setHoveredItem(null),
54770
54829
  onTouchStart: () => setHoveredItem("darkBackground"),
54771
54830
  children: [
54772
- /* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: darkBackgroundEnabled && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
54773
- /* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Dark Background" })
54831
+ /* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: darkBackgroundEnabled && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
54832
+ /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Dark Background" })
54774
54833
  ]
54775
54834
  }
54776
54835
  ),
@@ -54790,12 +54849,12 @@ var AppearanceMenu = () => {
54790
54849
  onMouseLeave: () => setHoveredItem(null),
54791
54850
  onTouchStart: () => setHoveredItem("lighting"),
54792
54851
  children: [
54793
- /* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: lightingEnabled && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
54794
- /* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Lighting" })
54852
+ /* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: lightingEnabled && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
54853
+ /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Lighting" })
54795
54854
  ]
54796
54855
  }
54797
54856
  ),
54798
- /* @__PURE__ */ jsx34(Separator2, { style: separatorStyles }),
54857
+ /* @__PURE__ */ jsx35(Separator2, { style: separatorStyles }),
54799
54858
  /* @__PURE__ */ jsxs7(
54800
54859
  Item22,
54801
54860
  {
@@ -54812,8 +54871,8 @@ var AppearanceMenu = () => {
54812
54871
  onMouseLeave: () => setHoveredItem(null),
54813
54872
  onTouchStart: () => setHoveredItem("boardBody"),
54814
54873
  children: [
54815
- /* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.boardBody && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
54816
- /* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Board Body" })
54874
+ /* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: visibility.boardBody && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
54875
+ /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Board Body" })
54817
54876
  ]
54818
54877
  }
54819
54878
  ),
@@ -54833,8 +54892,8 @@ var AppearanceMenu = () => {
54833
54892
  onMouseLeave: () => setHoveredItem(null),
54834
54893
  onTouchStart: () => setHoveredItem("topCopper"),
54835
54894
  children: [
54836
- /* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.topCopper && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
54837
- /* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Top Copper" })
54895
+ /* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: visibility.topCopper && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
54896
+ /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Top Copper" })
54838
54897
  ]
54839
54898
  }
54840
54899
  ),
@@ -54854,8 +54913,8 @@ var AppearanceMenu = () => {
54854
54913
  onMouseLeave: () => setHoveredItem(null),
54855
54914
  onTouchStart: () => setHoveredItem("bottomCopper"),
54856
54915
  children: [
54857
- /* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.bottomCopper && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
54858
- /* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Copper" })
54916
+ /* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: visibility.bottomCopper && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
54917
+ /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Copper" })
54859
54918
  ]
54860
54919
  }
54861
54920
  ),
@@ -54875,8 +54934,8 @@ var AppearanceMenu = () => {
54875
54934
  onMouseLeave: () => setHoveredItem(null),
54876
54935
  onTouchStart: () => setHoveredItem("keepout"),
54877
54936
  children: [
54878
- /* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.keepout && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
54879
- /* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Keepout" })
54937
+ /* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: visibility.keepout && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
54938
+ /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Keepout" })
54880
54939
  ]
54881
54940
  }
54882
54941
  ),
@@ -54896,8 +54955,8 @@ var AppearanceMenu = () => {
54896
54955
  onMouseLeave: () => setHoveredItem(null),
54897
54956
  onTouchStart: () => setHoveredItem("topSilkscreen"),
54898
54957
  children: [
54899
- /* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.topSilkscreen && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
54900
- /* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Top Silkscreen" })
54958
+ /* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: visibility.topSilkscreen && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
54959
+ /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Top Silkscreen" })
54901
54960
  ]
54902
54961
  }
54903
54962
  ),
@@ -54920,8 +54979,8 @@ var AppearanceMenu = () => {
54920
54979
  onMouseLeave: () => setHoveredItem(null),
54921
54980
  onTouchStart: () => setHoveredItem("bottomSilkscreen"),
54922
54981
  children: [
54923
- /* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.bottomSilkscreen && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
54924
- /* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Silkscreen" })
54982
+ /* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: visibility.bottomSilkscreen && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
54983
+ /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Silkscreen" })
54925
54984
  ]
54926
54985
  }
54927
54986
  ),
@@ -54941,8 +55000,8 @@ var AppearanceMenu = () => {
54941
55000
  onMouseLeave: () => setHoveredItem(null),
54942
55001
  onTouchStart: () => setHoveredItem("topMask"),
54943
55002
  children: [
54944
- /* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.topMask && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
54945
- /* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Top Soldermask" })
55003
+ /* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: visibility.topMask && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
55004
+ /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Top Soldermask" })
54946
55005
  ]
54947
55006
  }
54948
55007
  ),
@@ -54962,8 +55021,8 @@ var AppearanceMenu = () => {
54962
55021
  onMouseLeave: () => setHoveredItem(null),
54963
55022
  onTouchStart: () => setHoveredItem("bottomMask"),
54964
55023
  children: [
54965
- /* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.bottomMask && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
54966
- /* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Soldermask" })
55024
+ /* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: visibility.bottomMask && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
55025
+ /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Soldermask" })
54967
55026
  ]
54968
55027
  }
54969
55028
  ),
@@ -54983,8 +55042,8 @@ var AppearanceMenu = () => {
54983
55042
  onMouseLeave: () => setHoveredItem(null),
54984
55043
  onTouchStart: () => setHoveredItem("pcbNotes"),
54985
55044
  children: [
54986
- /* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.pcbNotes && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
54987
- /* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "PCB Notes" })
55045
+ /* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: visibility.pcbNotes && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
55046
+ /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "PCB Notes" })
54988
55047
  ]
54989
55048
  }
54990
55049
  ),
@@ -55004,8 +55063,8 @@ var AppearanceMenu = () => {
55004
55063
  onMouseLeave: () => setHoveredItem(null),
55005
55064
  onTouchStart: () => setHoveredItem("smtModels"),
55006
55065
  children: [
55007
- /* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.smtModels && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
55008
- /* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Surface Mount Components" })
55066
+ /* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: visibility.smtModels && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
55067
+ /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Surface Mount Components" })
55009
55068
  ]
55010
55069
  }
55011
55070
  ),
@@ -55028,12 +55087,12 @@ var AppearanceMenu = () => {
55028
55087
  onMouseLeave: () => setHoveredItem(null),
55029
55088
  onTouchStart: () => setHoveredItem("throughHoleModels"),
55030
55089
  children: [
55031
- /* @__PURE__ */ jsx34("span", { style: iconContainerStyles, children: visibility.throughHoleModels && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
55032
- /* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Through-Hole Components" })
55090
+ /* @__PURE__ */ jsx35("span", { style: iconContainerStyles, children: visibility.throughHoleModels && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
55091
+ /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Through-Hole Components" })
55033
55092
  ]
55034
55093
  }
55035
55094
  ),
55036
- /* @__PURE__ */ jsx34(Separator2, { style: separatorStyles }),
55095
+ /* @__PURE__ */ jsx35(Separator2, { style: separatorStyles }),
55037
55096
  /* @__PURE__ */ jsxs7(
55038
55097
  Item22,
55039
55098
  {
@@ -55055,10 +55114,10 @@ var AppearanceMenu = () => {
55055
55114
  title: `Enclosure: ${visibility.enclosure}`,
55056
55115
  children: [
55057
55116
  /* @__PURE__ */ jsxs7("span", { style: iconContainerStyles, children: [
55058
- visibility.enclosure === "opaque" && /* @__PURE__ */ jsx34(CheckIcon, {}),
55059
- visibility.enclosure === "translucent" && /* @__PURE__ */ jsx34(CheckMinusIcon, {})
55117
+ visibility.enclosure === "opaque" && /* @__PURE__ */ jsx35(CheckIcon, {}),
55118
+ visibility.enclosure === "translucent" && /* @__PURE__ */ jsx35(CheckMinusIcon, {})
55060
55119
  ] }),
55061
- /* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Enclosure" })
55120
+ /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Enclosure" })
55062
55121
  ]
55063
55122
  }
55064
55123
  )
@@ -55070,7 +55129,7 @@ var AppearanceMenu = () => {
55070
55129
  };
55071
55130
 
55072
55131
  // src/components/ContextMenu.tsx
55073
- import { Fragment as Fragment11, jsx as jsx35, jsxs as jsxs8 } from "react/jsx-runtime";
55132
+ import { Fragment as Fragment11, jsx as jsx36, jsxs as jsxs8 } from "react/jsx-runtime";
55074
55133
  var cameraOptions = [
55075
55134
  "Custom",
55076
55135
  "Top Center Angled",
@@ -55082,13 +55141,13 @@ var cameraOptions = [
55082
55141
  "Front"
55083
55142
  ];
55084
55143
  var contentStyles2 = {
55144
+ ...menuViewportStyles,
55085
55145
  backgroundColor: "#262626",
55086
55146
  color: "#fafafa",
55087
55147
  borderRadius: 6,
55088
55148
  boxShadow: "0px 12px 48px -12px rgba(0, 0, 0, 0.5), 0px 8px 24px -8px rgba(0, 0, 0, 0.3)",
55089
55149
  border: "1px solid #333333",
55090
55150
  padding: "4px",
55091
- minWidth: 160,
55092
55151
  zIndex: zIndexMap.contextMenu,
55093
55152
  fontSize: 14,
55094
55153
  fontWeight: 400,
@@ -55160,10 +55219,10 @@ var ContextMenu = ({
55160
55219
  }) => {
55161
55220
  const { cameraType, setCameraType } = useCameraController();
55162
55221
  const { gridEnabled, setGridEnabled } = useAppearance();
55163
- const [cameraSubOpen, setCameraSubOpen] = useState35(false);
55164
- const [referenceObjectSubOpen, setReferenceObjectSubOpen] = useState35(false);
55165
- const [hoveredItem, setHoveredItem] = useState35(null);
55166
- return /* @__PURE__ */ jsx35(
55222
+ const [cameraSubOpen, setCameraSubOpen] = useState36(false);
55223
+ const [referenceObjectSubOpen, setReferenceObjectSubOpen] = useState36(false);
55224
+ const [hoveredItem, setHoveredItem] = useState36(null);
55225
+ return /* @__PURE__ */ jsx36(
55167
55226
  "div",
55168
55227
  {
55169
55228
  ref: menuRef,
@@ -55175,8 +55234,8 @@ var ContextMenu = ({
55175
55234
  height: 0
55176
55235
  },
55177
55236
  children: /* @__PURE__ */ jsxs8(Root22, { open: true, modal: false, children: [
55178
- /* @__PURE__ */ jsx35(Trigger, { asChild: true, children: /* @__PURE__ */ jsx35("div", { style: { position: "absolute", width: 1, height: 1 } }) }),
55179
- /* @__PURE__ */ jsx35(Portal22, { children: /* @__PURE__ */ jsxs8(
55237
+ /* @__PURE__ */ jsx36(Trigger, { asChild: true, children: /* @__PURE__ */ jsx36("div", { style: { position: "absolute", width: 1, height: 1 } }) }),
55238
+ /* @__PURE__ */ jsx36(Portal22, { children: /* @__PURE__ */ jsxs8(
55180
55239
  Content22,
55181
55240
  {
55182
55241
  style: contentStyles2,
@@ -55186,7 +55245,7 @@ var ContextMenu = ({
55186
55245
  align: "start",
55187
55246
  children: [
55188
55247
  onViewSchematicComponent && /* @__PURE__ */ jsxs8(Fragment11, { children: [
55189
- /* @__PURE__ */ jsx35(
55248
+ /* @__PURE__ */ jsx36(
55190
55249
  Item22,
55191
55250
  {
55192
55251
  style: {
@@ -55200,7 +55259,7 @@ var ContextMenu = ({
55200
55259
  children: "Show on schematic"
55201
55260
  }
55202
55261
  ),
55203
- /* @__PURE__ */ jsx35(Separator2, { style: separatorStyles2 })
55262
+ /* @__PURE__ */ jsx36(Separator2, { style: separatorStyles2 })
55204
55263
  ] }),
55205
55264
  /* @__PURE__ */ jsxs8(Sub2, { onOpenChange: setCameraSubOpen, children: [
55206
55265
  /* @__PURE__ */ jsxs8(
@@ -55215,11 +55274,11 @@ var ContextMenu = ({
55215
55274
  onMouseLeave: () => setHoveredItem(null),
55216
55275
  onTouchStart: () => setHoveredItem("camera"),
55217
55276
  children: [
55218
- /* @__PURE__ */ jsx35(
55277
+ /* @__PURE__ */ jsx36(
55219
55278
  "span",
55220
55279
  {
55221
55280
  style: { flex: 1, display: "flex", alignItems: "center" },
55222
- children: "Camera Position"
55281
+ children: "Camera"
55223
55282
  }
55224
55283
  ),
55225
55284
  /* @__PURE__ */ jsxs8(
@@ -55232,89 +55291,83 @@ var ContextMenu = ({
55232
55291
  marginLeft: "auto"
55233
55292
  },
55234
55293
  children: [
55235
- /* @__PURE__ */ jsx35("span", { style: { opacity: 0.55, fontSize: 13 }, children: cameraPreset }),
55236
- /* @__PURE__ */ jsx35(ChevronRightIcon, { isOpen: cameraSubOpen })
55294
+ /* @__PURE__ */ jsx36("span", { style: { opacity: 0.55, fontSize: 13 }, children: cameraPreset }),
55295
+ /* @__PURE__ */ jsx36(ChevronRightIcon, { isOpen: cameraSubOpen })
55237
55296
  ]
55238
55297
  }
55239
55298
  )
55240
55299
  ]
55241
55300
  }
55242
55301
  ),
55243
- /* @__PURE__ */ jsx35(Portal22, { children: /* @__PURE__ */ jsx35(
55244
- SubContent2,
55302
+ /* @__PURE__ */ jsx36(Portal22, { children: /* @__PURE__ */ jsxs8(
55303
+ ViewportSubContent,
55245
55304
  {
55246
55305
  style: { ...contentStyles2, marginLeft: -2 },
55247
55306
  collisionPadding: 10,
55248
55307
  avoidCollisions: true,
55249
- children: cameraOptions.map((option) => /* @__PURE__ */ jsxs8(
55250
- Item22,
55251
- {
55252
- style: {
55253
- ...itemStyles2,
55254
- backgroundColor: hoveredItem === option ? "#404040" : "transparent"
55255
- },
55256
- onSelect: (e) => e.preventDefault(),
55257
- onPointerDown: (e) => {
55258
- e.preventDefault();
55259
- onCameraPresetSelect(option);
55308
+ children: [
55309
+ cameraOptions.map((option) => /* @__PURE__ */ jsxs8(
55310
+ Item22,
55311
+ {
55312
+ style: {
55313
+ ...itemStyles2,
55314
+ backgroundColor: hoveredItem === option ? "#404040" : "transparent"
55315
+ },
55316
+ onSelect: () => onCameraPresetSelect(option),
55317
+ onMouseEnter: () => setHoveredItem(option),
55318
+ onMouseLeave: () => setHoveredItem(null),
55319
+ onTouchStart: () => setHoveredItem(option),
55320
+ children: [
55321
+ /* @__PURE__ */ jsx36("span", { style: iconContainerStyles2, children: cameraPreset === option && /* @__PURE__ */ jsx36(DotIcon, {}) }),
55322
+ /* @__PURE__ */ jsx36("span", { style: { display: "flex", alignItems: "center" }, children: option })
55323
+ ]
55260
55324
  },
55261
- onMouseEnter: () => setHoveredItem(option),
55262
- onMouseLeave: () => setHoveredItem(null),
55263
- onTouchStart: () => setHoveredItem(option),
55264
- children: [
55265
- /* @__PURE__ */ jsx35("span", { style: iconContainerStyles2, children: cameraPreset === option && /* @__PURE__ */ jsx35(DotIcon, {}) }),
55266
- /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: option })
55267
- ]
55268
- },
55269
- option
55270
- ))
55325
+ option
55326
+ )),
55327
+ /* @__PURE__ */ jsx36(Separator2, { style: separatorStyles2 }),
55328
+ /* @__PURE__ */ jsxs8(
55329
+ Item22,
55330
+ {
55331
+ style: {
55332
+ ...itemStyles2,
55333
+ backgroundColor: hoveredItem === "autorotate" ? "#404040" : "transparent"
55334
+ },
55335
+ onSelect: onAutoRotateToggle,
55336
+ onMouseEnter: () => setHoveredItem("autorotate"),
55337
+ onMouseLeave: () => setHoveredItem(null),
55338
+ onTouchStart: () => setHoveredItem("autorotate"),
55339
+ children: [
55340
+ /* @__PURE__ */ jsx36("span", { style: iconContainerStyles2, children: autoRotate && /* @__PURE__ */ jsx36(CheckIcon, {}) }),
55341
+ /* @__PURE__ */ jsx36("span", { style: { display: "flex", alignItems: "center" }, children: "Auto rotate" })
55342
+ ]
55343
+ }
55344
+ ),
55345
+ /* @__PURE__ */ jsxs8(
55346
+ Item22,
55347
+ {
55348
+ style: {
55349
+ ...itemStyles2,
55350
+ backgroundColor: hoveredItem === "cameratype" ? "#404040" : "transparent"
55351
+ },
55352
+ onSelect: (e) => {
55353
+ e.preventDefault();
55354
+ setCameraType(
55355
+ cameraType === "perspective" ? "orthographic" : "perspective"
55356
+ );
55357
+ },
55358
+ onMouseEnter: () => setHoveredItem("cameratype"),
55359
+ onMouseLeave: () => setHoveredItem(null),
55360
+ onTouchStart: () => setHoveredItem("cameratype"),
55361
+ children: [
55362
+ /* @__PURE__ */ jsx36("span", { style: iconContainerStyles2, children: cameraType === "orthographic" && /* @__PURE__ */ jsx36(CheckIcon, {}) }),
55363
+ /* @__PURE__ */ jsx36("span", { style: { display: "flex", alignItems: "center" }, children: "Orthographic Camera" })
55364
+ ]
55365
+ }
55366
+ )
55367
+ ]
55271
55368
  }
55272
55369
  ) })
55273
55370
  ] }),
55274
- /* @__PURE__ */ jsxs8(
55275
- Item22,
55276
- {
55277
- style: {
55278
- ...itemStyles2,
55279
- backgroundColor: hoveredItem === "autorotate" ? "#404040" : "transparent"
55280
- },
55281
- onSelect: (e) => e.preventDefault(),
55282
- onPointerDown: (e) => {
55283
- e.preventDefault();
55284
- onAutoRotateToggle();
55285
- },
55286
- onMouseEnter: () => setHoveredItem("autorotate"),
55287
- onMouseLeave: () => setHoveredItem(null),
55288
- onTouchStart: () => setHoveredItem("autorotate"),
55289
- children: [
55290
- /* @__PURE__ */ jsx35("span", { style: iconContainerStyles2, children: autoRotate && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
55291
- /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Auto rotate" })
55292
- ]
55293
- }
55294
- ),
55295
- /* @__PURE__ */ jsxs8(
55296
- Item22,
55297
- {
55298
- style: {
55299
- ...itemStyles2,
55300
- backgroundColor: hoveredItem === "cameratype" ? "#404040" : "transparent"
55301
- },
55302
- onSelect: (e) => e.preventDefault(),
55303
- onPointerDown: (e) => {
55304
- e.preventDefault();
55305
- setCameraType(
55306
- cameraType === "perspective" ? "orthographic" : "perspective"
55307
- );
55308
- },
55309
- onMouseEnter: () => setHoveredItem("cameratype"),
55310
- onMouseLeave: () => setHoveredItem(null),
55311
- onTouchStart: () => setHoveredItem("cameratype"),
55312
- children: [
55313
- /* @__PURE__ */ jsx35("span", { style: iconContainerStyles2, children: cameraType === "orthographic" && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
55314
- /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Orthographic Camera" })
55315
- ]
55316
- }
55317
- ),
55318
55371
  /* @__PURE__ */ jsxs8(Sub2, { onOpenChange: setReferenceObjectSubOpen, children: [
55319
55372
  /* @__PURE__ */ jsxs8(
55320
55373
  SubTrigger2,
@@ -55328,14 +55381,14 @@ var ContextMenu = ({
55328
55381
  onMouseLeave: () => setHoveredItem(null),
55329
55382
  onTouchStart: () => setHoveredItem("reference-object"),
55330
55383
  children: [
55331
- /* @__PURE__ */ jsx35(
55384
+ /* @__PURE__ */ jsx36(
55332
55385
  "span",
55333
55386
  {
55334
55387
  style: { flex: 1, display: "flex", alignItems: "center" },
55335
55388
  children: "Show Reference Object"
55336
55389
  }
55337
55390
  ),
55338
- /* @__PURE__ */ jsx35(
55391
+ /* @__PURE__ */ jsx36(
55339
55392
  "div",
55340
55393
  {
55341
55394
  style: {
@@ -55344,14 +55397,14 @@ var ContextMenu = ({
55344
55397
  gap: 6,
55345
55398
  marginLeft: "auto"
55346
55399
  },
55347
- children: /* @__PURE__ */ jsx35(ChevronRightIcon, { isOpen: referenceObjectSubOpen })
55400
+ children: /* @__PURE__ */ jsx36(ChevronRightIcon, { isOpen: referenceObjectSubOpen })
55348
55401
  }
55349
55402
  )
55350
55403
  ]
55351
55404
  }
55352
55405
  ),
55353
- /* @__PURE__ */ jsx35(Portal22, { children: /* @__PURE__ */ jsx35(
55354
- SubContent2,
55406
+ /* @__PURE__ */ jsx36(Portal22, { children: /* @__PURE__ */ jsx36(
55407
+ ViewportSubContent,
55355
55408
  {
55356
55409
  style: { ...contentStyles2, marginLeft: -2 },
55357
55410
  collisionPadding: 10,
@@ -55374,8 +55427,8 @@ var ContextMenu = ({
55374
55427
  onMouseLeave: () => setHoveredItem(null),
55375
55428
  onTouchStart: () => setHoveredItem(optionKey),
55376
55429
  children: [
55377
- /* @__PURE__ */ jsx35("span", { style: iconContainerStyles2, children: referenceObject === option.type && /* @__PURE__ */ jsx35(DotIcon, {}) }),
55378
- /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: option.label })
55430
+ /* @__PURE__ */ jsx36("span", { style: iconContainerStyles2, children: referenceObject === option.type && /* @__PURE__ */ jsx36(DotIcon, {}) }),
55431
+ /* @__PURE__ */ jsx36("span", { style: { display: "flex", alignItems: "center" }, children: option.label })
55379
55432
  ]
55380
55433
  },
55381
55434
  optionKey
@@ -55396,8 +55449,8 @@ var ContextMenu = ({
55396
55449
  onMouseEnter: () => setHoveredItem("fold"),
55397
55450
  onMouseLeave: () => setHoveredItem(null),
55398
55451
  children: [
55399
- /* @__PURE__ */ jsx35("span", { style: iconContainerStyles2, children: foldPcbs && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
55400
- /* @__PURE__ */ jsx35("span", { children: "Fold PCBs" })
55452
+ /* @__PURE__ */ jsx36("span", { style: iconContainerStyles2, children: foldPcbs && /* @__PURE__ */ jsx36(CheckIcon, {}) }),
55453
+ /* @__PURE__ */ jsx36("span", { children: "Fold PCBs" })
55401
55454
  ]
55402
55455
  }
55403
55456
  ),
@@ -55417,14 +55470,14 @@ var ContextMenu = ({
55417
55470
  onMouseLeave: () => setHoveredItem(null),
55418
55471
  onTouchStart: () => setHoveredItem("grid"),
55419
55472
  children: [
55420
- /* @__PURE__ */ jsx35("span", { style: iconContainerStyles2, children: gridEnabled && /* @__PURE__ */ jsx35(CheckIcon, {}) }),
55421
- /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Show Grid" })
55473
+ /* @__PURE__ */ jsx36("span", { style: iconContainerStyles2, children: gridEnabled && /* @__PURE__ */ jsx36(CheckIcon, {}) }),
55474
+ /* @__PURE__ */ jsx36("span", { style: { display: "flex", alignItems: "center" }, children: "Show Grid" })
55422
55475
  ]
55423
55476
  }
55424
55477
  ),
55425
- /* @__PURE__ */ jsx35(AppearanceMenu, {}),
55426
- /* @__PURE__ */ jsx35(Separator2, { style: separatorStyles2 }),
55427
- /* @__PURE__ */ jsx35(
55478
+ /* @__PURE__ */ jsx36(AppearanceMenu, {}),
55479
+ /* @__PURE__ */ jsx36(Separator2, { style: separatorStyles2 }),
55480
+ /* @__PURE__ */ jsx36(
55428
55481
  Item22,
55429
55482
  {
55430
55483
  style: {
@@ -55436,10 +55489,10 @@ var ContextMenu = ({
55436
55489
  onMouseEnter: () => setHoveredItem("download"),
55437
55490
  onMouseLeave: () => setHoveredItem(null),
55438
55491
  onTouchStart: () => setHoveredItem("download"),
55439
- children: /* @__PURE__ */ jsx35("span", { style: { display: "flex", alignItems: "center" }, children: "Download GLTF" })
55492
+ children: /* @__PURE__ */ jsx36("span", { style: { display: "flex", alignItems: "center" }, children: "Download GLTF" })
55440
55493
  }
55441
55494
  ),
55442
- /* @__PURE__ */ jsx35(Separator2, { style: separatorStyles2 }),
55495
+ /* @__PURE__ */ jsx36(Separator2, { style: separatorStyles2 }),
55443
55496
  !flexScene && /* @__PURE__ */ jsxs8(
55444
55497
  Item22,
55445
55498
  {
@@ -55468,7 +55521,7 @@ var ContextMenu = ({
55468
55521
  ]
55469
55522
  }
55470
55523
  ),
55471
- /* @__PURE__ */ jsx35(
55524
+ /* @__PURE__ */ jsx36(
55472
55525
  "div",
55473
55526
  {
55474
55527
  style: {
@@ -55482,7 +55535,7 @@ var ContextMenu = ({
55482
55535
  ]
55483
55536
  }
55484
55537
  ),
55485
- /* @__PURE__ */ jsx35(Separator2, { style: separatorStyles2 }),
55538
+ /* @__PURE__ */ jsx36(Separator2, { style: separatorStyles2 }),
55486
55539
  /* @__PURE__ */ jsxs8(
55487
55540
  Item22,
55488
55541
  {
@@ -55496,8 +55549,8 @@ var ContextMenu = ({
55496
55549
  onMouseLeave: () => setHoveredItem(null),
55497
55550
  onTouchStart: () => setHoveredItem("shortcuts"),
55498
55551
  children: [
55499
- /* @__PURE__ */ jsx35("span", { style: { flex: 1, display: "flex", alignItems: "center" }, children: "Keyboard Shortcuts" }),
55500
- /* @__PURE__ */ jsx35(
55552
+ /* @__PURE__ */ jsx36("span", { style: { flex: 1, display: "flex", alignItems: "center" }, children: "Keyboard Shortcuts" }),
55553
+ /* @__PURE__ */ jsx36(
55501
55554
  "div",
55502
55555
  {
55503
55556
  style: {
@@ -55511,8 +55564,8 @@ var ContextMenu = ({
55511
55564
  ]
55512
55565
  }
55513
55566
  ),
55514
- /* @__PURE__ */ jsx35(Separator2, { style: separatorStyles2 }),
55515
- /* @__PURE__ */ jsx35(
55567
+ /* @__PURE__ */ jsx36(Separator2, { style: separatorStyles2 }),
55568
+ /* @__PURE__ */ jsx36(
55516
55569
  "div",
55517
55570
  {
55518
55571
  style: {
@@ -55550,10 +55603,10 @@ var ContextMenu = ({
55550
55603
  };
55551
55604
 
55552
55605
  // src/components/KeyboardShortcutsDialog.tsx
55553
- import { useEffect as useEffect48, useMemo as useMemo33, useRef as useRef27, useState as useState37 } from "react";
55606
+ import { useEffect as useEffect48, useMemo as useMemo33, useRef as useRef27, useState as useState38 } from "react";
55554
55607
 
55555
55608
  // src/hooks/useRegisteredHotkey.ts
55556
- import { useEffect as useEffect47, useMemo as useMemo32, useRef as useRef26, useState as useState36 } from "react";
55609
+ import { useEffect as useEffect47, useMemo as useMemo32, useRef as useRef26, useState as useState37 } from "react";
55557
55610
  var hotkeyRegistry = /* @__PURE__ */ new Map();
55558
55611
  var subscribers = /* @__PURE__ */ new Set();
55559
55612
  var isListenerAttached = false;
@@ -55697,7 +55750,7 @@ var useRegisteredHotkey = (id, handler, metadata) => {
55697
55750
  }, [id, normalizedMetadata]);
55698
55751
  };
55699
55752
  var useHotkeyRegistry = () => {
55700
- const [entries, setEntries] = useState36(
55753
+ const [entries, setEntries] = useState37(
55701
55754
  () => Array.from(hotkeyRegistry.values())
55702
55755
  );
55703
55756
  useEffect47(() => subscribeToRegistry(setEntries), []);
@@ -55709,12 +55762,12 @@ var registerHotkeyViewer = (element) => {
55709
55762
  };
55710
55763
 
55711
55764
  // src/components/KeyboardShortcutsDialog.tsx
55712
- import { jsx as jsx36, jsxs as jsxs9 } from "react/jsx-runtime";
55765
+ import { jsx as jsx37, jsxs as jsxs9 } from "react/jsx-runtime";
55713
55766
  var KeyboardShortcutsDialog = ({
55714
55767
  open,
55715
55768
  onClose
55716
55769
  }) => {
55717
- const [query, setQuery] = useState37("");
55770
+ const [query, setQuery] = useState38("");
55718
55771
  const inputRef = useRef27(null);
55719
55772
  const hotkeys = useHotkeyRegistry();
55720
55773
  useEffect48(() => {
@@ -55748,7 +55801,7 @@ var KeyboardShortcutsDialog = ({
55748
55801
  if (!open) {
55749
55802
  return null;
55750
55803
  }
55751
- return /* @__PURE__ */ jsx36(
55804
+ return /* @__PURE__ */ jsx37(
55752
55805
  "div",
55753
55806
  {
55754
55807
  role: "dialog",
@@ -55788,7 +55841,7 @@ var KeyboardShortcutsDialog = ({
55788
55841
  },
55789
55842
  children: [
55790
55843
  /* @__PURE__ */ jsxs9("div", { style: { display: "flex", justifyContent: "space-between" }, children: [
55791
- /* @__PURE__ */ jsx36(
55844
+ /* @__PURE__ */ jsx37(
55792
55845
  "h2",
55793
55846
  {
55794
55847
  style: {
@@ -55800,7 +55853,7 @@ var KeyboardShortcutsDialog = ({
55800
55853
  children: "Keyboard Shortcuts"
55801
55854
  }
55802
55855
  ),
55803
- /* @__PURE__ */ jsx36(
55856
+ /* @__PURE__ */ jsx37(
55804
55857
  "button",
55805
55858
  {
55806
55859
  type: "button",
@@ -55816,7 +55869,7 @@ var KeyboardShortcutsDialog = ({
55816
55869
  }
55817
55870
  )
55818
55871
  ] }),
55819
- /* @__PURE__ */ jsx36(
55872
+ /* @__PURE__ */ jsx37(
55820
55873
  "input",
55821
55874
  {
55822
55875
  ref: inputRef,
@@ -55839,7 +55892,7 @@ var KeyboardShortcutsDialog = ({
55839
55892
  ]
55840
55893
  }
55841
55894
  ),
55842
- /* @__PURE__ */ jsx36("div", { style: { overflowY: "auto" }, children: /* @__PURE__ */ jsxs9(
55895
+ /* @__PURE__ */ jsx37("div", { style: { overflowY: "auto" }, children: /* @__PURE__ */ jsxs9(
55843
55896
  "table",
55844
55897
  {
55845
55898
  style: {
@@ -55848,11 +55901,11 @@ var KeyboardShortcutsDialog = ({
55848
55901
  fontSize: "0.95rem"
55849
55902
  },
55850
55903
  children: [
55851
- /* @__PURE__ */ jsx36("thead", { children: /* @__PURE__ */ jsxs9("tr", { style: { textAlign: "left", color: "#a1a1b5" }, children: [
55852
- /* @__PURE__ */ jsx36("th", { style: { padding: "12px 24px", width: "25%" }, children: "Key" }),
55853
- /* @__PURE__ */ jsx36("th", { style: { padding: "12px 24px" }, children: "Description" })
55904
+ /* @__PURE__ */ jsx37("thead", { children: /* @__PURE__ */ jsxs9("tr", { style: { textAlign: "left", color: "#a1a1b5" }, children: [
55905
+ /* @__PURE__ */ jsx37("th", { style: { padding: "12px 24px", width: "25%" }, children: "Key" }),
55906
+ /* @__PURE__ */ jsx37("th", { style: { padding: "12px 24px" }, children: "Description" })
55854
55907
  ] }) }),
55855
- /* @__PURE__ */ jsx36("tbody", { children: filteredHotkeys.length === 0 ? /* @__PURE__ */ jsx36("tr", { children: /* @__PURE__ */ jsx36(
55908
+ /* @__PURE__ */ jsx37("tbody", { children: filteredHotkeys.length === 0 ? /* @__PURE__ */ jsx37("tr", { children: /* @__PURE__ */ jsx37(
55856
55909
  "td",
55857
55910
  {
55858
55911
  colSpan: 2,
@@ -55864,7 +55917,7 @@ var KeyboardShortcutsDialog = ({
55864
55917
  {
55865
55918
  style: { borderTop: "1px solid rgba(255, 255, 255, 0.05)" },
55866
55919
  children: [
55867
- /* @__PURE__ */ jsx36("td", { style: { padding: "12px 24px" }, children: /* @__PURE__ */ jsx36(
55920
+ /* @__PURE__ */ jsx37("td", { style: { padding: "12px 24px" }, children: /* @__PURE__ */ jsx37(
55868
55921
  "span",
55869
55922
  {
55870
55923
  style: {
@@ -55882,7 +55935,7 @@ var KeyboardShortcutsDialog = ({
55882
55935
  children: hotkey.shortcut
55883
55936
  }
55884
55937
  ) }),
55885
- /* @__PURE__ */ jsx36("td", { style: { padding: "12px 24px" }, children: hotkey.description })
55938
+ /* @__PURE__ */ jsx37("td", { style: { padding: "12px 24px" }, children: hotkey.description })
55886
55939
  ]
55887
55940
  },
55888
55941
  hotkey.id
@@ -55899,7 +55952,7 @@ var KeyboardShortcutsDialog = ({
55899
55952
 
55900
55953
  // src/contexts/ToastContext.tsx
55901
55954
  import { Toaster, toast as hotToast } from "react-hot-toast";
55902
- import { Fragment as Fragment12, jsx as jsx37, jsxs as jsxs10 } from "react/jsx-runtime";
55955
+ import { Fragment as Fragment12, jsx as jsx38, jsxs as jsxs10 } from "react/jsx-runtime";
55903
55956
  var useToast = () => {
55904
55957
  return {
55905
55958
  showToast: (message, duration = 2e3) => {
@@ -55912,7 +55965,7 @@ var ToastProvider = ({
55912
55965
  }) => {
55913
55966
  return /* @__PURE__ */ jsxs10(Fragment12, { children: [
55914
55967
  children,
55915
- /* @__PURE__ */ jsx37(Toaster, { position: "bottom-right" })
55968
+ /* @__PURE__ */ jsx38(Toaster, { position: "bottom-right" })
55916
55969
  ] });
55917
55970
  };
55918
55971
 
@@ -55957,10 +56010,10 @@ function useCameraPreset({
55957
56010
  }
55958
56011
 
55959
56012
  // src/hooks/useContextMenu.ts
55960
- import { useState as useState38, useCallback as useCallback22, useRef as useRef28, useEffect as useEffect49 } from "react";
56013
+ import { useState as useState39, useCallback as useCallback22, useRef as useRef28, useEffect as useEffect49 } from "react";
55961
56014
  var useContextMenu = ({ containerRef, onOpen }) => {
55962
- const [menuVisible, setMenuVisible] = useState38(false);
55963
- const [menuPos, setMenuPos] = useState38({
56015
+ const [menuVisible, setMenuVisible] = useState39(false);
56016
+ const [menuPos, setMenuPos] = useState39({
55964
56017
  x: 0,
55965
56018
  y: 0
55966
56019
  });
@@ -56137,7 +56190,7 @@ var useGlobalDownloadGltf = () => {
56137
56190
  };
56138
56191
 
56139
56192
  // src/CadViewer.tsx
56140
- import { jsx as jsx38, jsxs as jsxs11 } from "react/jsx-runtime";
56193
+ import { jsx as jsx39, jsxs as jsxs11 } from "react/jsx-runtime";
56141
56194
  var DEFAULT_TARGET = new THREE54.Vector3(0, 0, 0);
56142
56195
  var INITIAL_CAMERA_POSITION = [5, -5, 5];
56143
56196
  var readStoredCameraType = () => {
@@ -56152,35 +56205,35 @@ var CadViewerInner = (props) => {
56152
56205
  const circuitJson = props.circuitJson ?? childrenCircuitJson;
56153
56206
  const hasBends = circuitJson.some((element) => element.type === "pcb_bend");
56154
56207
  const hasFlexGeometry = hasBends || circuitJson.some((element) => element.type === "pcb_stiffener");
56155
- const [foldPcbsOverride, setFoldPcbs] = useState39(
56208
+ const [foldPcbsOverride, setFoldPcbs] = useState40(
56156
56209
  void 0
56157
56210
  );
56158
56211
  const foldPcbs = foldPcbsOverride ?? props.foldPcbs;
56159
56212
  const resolvedFoldPcbs = resolveFoldPcbs(circuitJson, foldPcbs);
56160
56213
  const resolvedProps = { ...props, circuitJson, children: void 0 };
56161
- const [engine, setEngine] = useState39(() => {
56214
+ const [engine, setEngine] = useState40(() => {
56162
56215
  const stored = window.localStorage.getItem("cadViewerEngine");
56163
56216
  return stored === "jscad" || stored === "manifold" ? stored : "manifold";
56164
56217
  });
56165
56218
  const containerRef = useRef29(null);
56166
- const [isKeyboardShortcutsDialogOpen, setIsKeyboardShortcutsDialogOpen] = useState39(false);
56167
- const [autoRotate, setAutoRotate] = useState39(() => {
56219
+ const [isKeyboardShortcutsDialogOpen, setIsKeyboardShortcutsDialogOpen] = useState40(false);
56220
+ const [autoRotate, setAutoRotate] = useState40(() => {
56168
56221
  const stored = window.localStorage.getItem("cadViewerAutoRotate");
56169
56222
  return stored !== "false";
56170
56223
  });
56171
- const [autoRotateUserToggled, setAutoRotateUserToggled] = useState39(() => {
56224
+ const [autoRotateUserToggled, setAutoRotateUserToggled] = useState40(() => {
56172
56225
  const stored = window.localStorage.getItem("cadViewerAutoRotateUserToggled");
56173
56226
  return stored === "true";
56174
56227
  });
56175
- const [cameraPreset, setCameraPreset] = useState39("Custom");
56176
- const [referenceObject, setReferenceObject] = useState39(null);
56228
+ const [cameraPreset, setCameraPreset] = useState40("Custom");
56229
+ const [referenceObject, setReferenceObject] = useState40(null);
56177
56230
  const { cameraType } = useCameraController();
56178
56231
  const { visibility, setLayerVisibility } = useLayerVisibility();
56179
56232
  const { showToast } = useToast();
56180
56233
  const cameraControllerRef = useRef29(null);
56181
56234
  const externalCameraControllerReady = props.onCameraControllerReady;
56182
56235
  const sceneRef = useContext10(SchematicNavigationContext);
56183
- const [selectedComponent, setSelectedComponent] = useState39();
56236
+ const [selectedComponent, setSelectedComponent] = useState40();
56184
56237
  const handleMenuOpen = useCallback24(
56185
56238
  (position) => {
56186
56239
  setSelectedComponent(
@@ -56331,7 +56384,7 @@ var CadViewerInner = (props) => {
56331
56384
  },
56332
56385
  ...contextMenuEventHandlers,
56333
56386
  children: [
56334
- hasFlexGeometry ? /* @__PURE__ */ jsx38(
56387
+ hasFlexGeometry ? /* @__PURE__ */ jsx39(
56335
56388
  CadViewerManifold_default,
56336
56389
  {
56337
56390
  ...resolvedProps,
@@ -56341,7 +56394,7 @@ var CadViewerInner = (props) => {
56341
56394
  onCameraControllerReady: handleCameraControllerReady,
56342
56395
  referenceObject
56343
56396
  }
56344
- ) : engine === "jscad" ? /* @__PURE__ */ jsx38(
56397
+ ) : engine === "jscad" ? /* @__PURE__ */ jsx39(
56345
56398
  CadViewerJscad,
56346
56399
  {
56347
56400
  ...resolvedProps,
@@ -56351,7 +56404,7 @@ var CadViewerInner = (props) => {
56351
56404
  onCameraControllerReady: handleCameraControllerReady,
56352
56405
  referenceObject
56353
56406
  }
56354
- ) : /* @__PURE__ */ jsx38(
56407
+ ) : /* @__PURE__ */ jsx39(
56355
56408
  CadViewerManifold_default,
56356
56409
  {
56357
56410
  ...resolvedProps,
@@ -56362,7 +56415,7 @@ var CadViewerInner = (props) => {
56362
56415
  referenceObject
56363
56416
  }
56364
56417
  ),
56365
- menuVisible && /* @__PURE__ */ jsx38(
56418
+ menuVisible && /* @__PURE__ */ jsx39(
56366
56419
  ContextMenu,
56367
56420
  {
56368
56421
  onViewSchematicComponent: selectedComponent && props.onViewSchematicComponent ? () => {
@@ -56413,7 +56466,7 @@ var CadViewerInner = (props) => {
56413
56466
  }
56414
56467
  }
56415
56468
  ),
56416
- /* @__PURE__ */ jsx38(
56469
+ /* @__PURE__ */ jsx39(
56417
56470
  KeyboardShortcutsDialog,
56418
56471
  {
56419
56472
  open: isKeyboardShortcutsDialogOpen,
@@ -56427,13 +56480,13 @@ var CadViewerInner = (props) => {
56427
56480
  };
56428
56481
  var CadViewer = (props) => {
56429
56482
  const sceneRef = useRef29(null);
56430
- return /* @__PURE__ */ jsx38(SchematicNavigationContext.Provider, { value: sceneRef, children: /* @__PURE__ */ jsx38(
56483
+ return /* @__PURE__ */ jsx39(SchematicNavigationContext.Provider, { value: sceneRef, children: /* @__PURE__ */ jsx39(
56431
56484
  CameraControllerProvider,
56432
56485
  {
56433
56486
  defaultTarget: DEFAULT_TARGET,
56434
56487
  initialCameraPosition: INITIAL_CAMERA_POSITION,
56435
56488
  initialCameraType: readStoredCameraType(),
56436
- children: /* @__PURE__ */ jsx38(LayerVisibilityProvider, { children: /* @__PURE__ */ jsx38(AppearanceProvider, { children: /* @__PURE__ */ jsx38(ToastProvider, { children: /* @__PURE__ */ jsx38(CadViewerInner, { ...props }) }) }) })
56489
+ children: /* @__PURE__ */ jsx39(LayerVisibilityProvider, { children: /* @__PURE__ */ jsx39(AppearanceProvider, { children: /* @__PURE__ */ jsx39(ToastProvider, { children: /* @__PURE__ */ jsx39(CadViewerInner, { ...props }) }) }) })
56437
56490
  }
56438
56491
  ) });
56439
56492
  };
@@ -56730,7 +56783,7 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
56730
56783
 
56731
56784
  // src/hooks/exporter/gltf.ts
56732
56785
  import { GLTFExporter as GLTFExporter3 } from "three-stdlib";
56733
- import { useEffect as useEffect51, useState as useState40, useMemo as useMemo34, useCallback as useCallback25 } from "react";
56786
+ import { useEffect as useEffect51, useState as useState41, useMemo as useMemo34, useCallback as useCallback25 } from "react";
56734
56787
  function useSaveGltfAs(options = {}) {
56735
56788
  const parse2 = useParser(options);
56736
56789
  const link = useMemo34(() => document.createElement("a"), []);
@@ -56758,8 +56811,8 @@ function useSaveGltfAs(options = {}) {
56758
56811
  }
56759
56812
  function useExportGltfUrl(options = {}) {
56760
56813
  const parse2 = useParser(options);
56761
- const [url, setUrl] = useState40();
56762
- const [error, setError] = useState40();
56814
+ const [url, setUrl] = useState41();
56815
+ const [error, setError] = useState41();
56763
56816
  const ref = useCallback25(
56764
56817
  (instance) => parse2(instance).then(setUrl).catch(setError),
56765
56818
  []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/3d-viewer",
3
- "version": "0.0.608",
3
+ "version": "0.0.609",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/tscircuit/3d-viewer"