@tscircuit/3d-viewer 0.0.290 → 0.0.291
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.d.ts +1 -1
- package/dist/index.js +12 -9
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ interface UseManifoldBoardBuilderResult {
|
|
|
78
78
|
isLoading: boolean;
|
|
79
79
|
boardData: PcbBoard | null;
|
|
80
80
|
}
|
|
81
|
-
declare const useManifoldBoardBuilder: (manifoldJSModule: ManifoldToplevel | null, circuitJson: AnyCircuitElement[]
|
|
81
|
+
declare const useManifoldBoardBuilder: (manifoldJSModule: ManifoldToplevel | null, circuitJson: AnyCircuitElement[]) => UseManifoldBoardBuilderResult;
|
|
82
82
|
|
|
83
83
|
declare function applyJsdomShim(jsdom: JSDOM): void;
|
|
84
84
|
|
package/dist/index.js
CHANGED
|
@@ -17282,7 +17282,7 @@ import {
|
|
|
17282
17282
|
// package.json
|
|
17283
17283
|
var package_default = {
|
|
17284
17284
|
name: "@tscircuit/3d-viewer",
|
|
17285
|
-
version: "0.0.
|
|
17285
|
+
version: "0.0.290",
|
|
17286
17286
|
main: "./dist/index.js",
|
|
17287
17287
|
module: "./dist/index.js",
|
|
17288
17288
|
type: "module",
|
|
@@ -17610,7 +17610,7 @@ import { Circuit } from "@tscircuit/core";
|
|
|
17610
17610
|
import { useMemo as useMemo5 } from "react";
|
|
17611
17611
|
var useConvertChildrenToSoup = (children) => {
|
|
17612
17612
|
return useMemo5(() => {
|
|
17613
|
-
if (!children) return
|
|
17613
|
+
if (!children) return [];
|
|
17614
17614
|
const circuit = new Circuit();
|
|
17615
17615
|
circuit.add(children);
|
|
17616
17616
|
circuit.render();
|
|
@@ -19014,7 +19014,6 @@ var CadViewerJscad = forwardRef2(
|
|
|
19014
19014
|
}
|
|
19015
19015
|
}, [internalCircuitJson]);
|
|
19016
19016
|
const { stls: boardStls, loading } = useStlsFromGeom(boardGeom);
|
|
19017
|
-
if (!internalCircuitJson) return null;
|
|
19018
19017
|
const cad_components = su4(internalCircuitJson).cad_component.list();
|
|
19019
19018
|
return /* @__PURE__ */ jsxs7(
|
|
19020
19019
|
CadViewerContainer,
|
|
@@ -19822,7 +19821,6 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson) => {
|
|
|
19822
19821
|
const [isLoading, setIsLoading] = useState8(true);
|
|
19823
19822
|
const manifoldInstancesForCleanup = useRef6([]);
|
|
19824
19823
|
const boardData = useMemo7(() => {
|
|
19825
|
-
if (!circuitJson) return null;
|
|
19826
19824
|
const boards = su12(circuitJson).pcb_board.list();
|
|
19827
19825
|
if (boards.length === 0) {
|
|
19828
19826
|
return null;
|
|
@@ -19830,11 +19828,11 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson) => {
|
|
|
19830
19828
|
return boards[0];
|
|
19831
19829
|
}, [circuitJson]);
|
|
19832
19830
|
useEffect5(() => {
|
|
19833
|
-
if (!manifoldJSModule || !
|
|
19831
|
+
if (!manifoldJSModule || !boardData) {
|
|
19834
19832
|
setGeoms(null);
|
|
19835
19833
|
setTextures(null);
|
|
19836
19834
|
setPcbThickness(null);
|
|
19837
|
-
if (
|
|
19835
|
+
if (su12(circuitJson).pcb_board.list().length === 0) {
|
|
19838
19836
|
setError("No pcb_board found in circuitJson.");
|
|
19839
19837
|
}
|
|
19840
19838
|
setIsLoading(false);
|
|
@@ -20090,10 +20088,15 @@ function createTextureMeshes(textures, boardData, pcbThickness) {
|
|
|
20090
20088
|
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
20091
20089
|
var MANIFOLD_CDN_BASE_URL = "https://cdn.jsdelivr.net/npm/manifold-3d@3.1.1";
|
|
20092
20090
|
var CadViewerManifold = ({
|
|
20093
|
-
circuitJson,
|
|
20091
|
+
circuitJson: circuitJsonProp,
|
|
20094
20092
|
autoRotateDisabled,
|
|
20095
|
-
clickToInteractEnabled
|
|
20093
|
+
clickToInteractEnabled,
|
|
20094
|
+
children
|
|
20096
20095
|
}) => {
|
|
20096
|
+
const childrenCircuitJson = useConvertChildrenToSoup(children);
|
|
20097
|
+
const circuitJson = useMemo8(() => {
|
|
20098
|
+
return circuitJsonProp ?? childrenCircuitJson;
|
|
20099
|
+
}, [circuitJsonProp, childrenCircuitJson]);
|
|
20097
20100
|
const [manifoldJSModule, setManifoldJSModule] = useState9(null);
|
|
20098
20101
|
const [manifoldLoadingError, setManifoldLoadingError] = useState9(null);
|
|
20099
20102
|
useEffect6(() => {
|
|
@@ -20136,7 +20139,7 @@ var CadViewerManifold = ({
|
|
|
20136
20139
|
[textures, boardData, pcbThickness]
|
|
20137
20140
|
);
|
|
20138
20141
|
const cadComponents = useMemo8(
|
|
20139
|
-
() =>
|
|
20142
|
+
() => su13(circuitJson).cad_component.list(),
|
|
20140
20143
|
[circuitJson]
|
|
20141
20144
|
);
|
|
20142
20145
|
const boardDimensions = useMemo8(() => {
|