@tscircuit/pcb-viewer 1.11.5 → 1.11.6

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 CHANGED
@@ -8209,7 +8209,7 @@ import { css } from "@emotion/css";
8209
8209
  // package.json
8210
8210
  var package_default = {
8211
8211
  name: "@tscircuit/pcb-viewer",
8212
- version: "1.11.4",
8212
+ version: "1.11.5",
8213
8213
  main: "dist/index.js",
8214
8214
  type: "module",
8215
8215
  repository: "tscircuit/pcb-viewer",
@@ -8244,6 +8244,7 @@ var package_default = {
8244
8244
  "@types/react": "^18.3.3",
8245
8245
  "circuit-json": "^0.0.128",
8246
8246
  next: "^14.1.4",
8247
+ "pixi.js": "^8.6.6",
8247
8248
  react: "^18.2.0",
8248
8249
  "react-dom": "^18.2.0",
8249
8250
  "react-use": "^17.4.0",
@@ -9556,12 +9557,13 @@ var PCBViewer = ({
9556
9557
  editEvents: editEventsProp,
9557
9558
  onEditEventsChanged
9558
9559
  }) => {
9559
- soup ??= circuitJson;
9560
+ circuitJson ??= soup;
9560
9561
  const {
9561
9562
  circuitJson: circuitJsonFromChildren,
9562
9563
  error: errorFromChildren,
9563
9564
  isLoading
9564
9565
  } = useRenderedCircuit(children);
9566
+ circuitJson ??= circuitJsonFromChildren ?? [];
9565
9567
  const [ref, refDimensions] = useMeasure_default();
9566
9568
  const [transform, setTransformInternal] = useState9(defaultTransform);
9567
9569
  const {
@@ -9574,7 +9576,6 @@ var PCBViewer = ({
9574
9576
  });
9575
9577
  let [editEvents, setEditEvents] = useState9([]);
9576
9578
  editEvents = editEventsProp ?? editEvents;
9577
- const stateElements = circuitJsonFromChildren ?? soup ?? [];
9578
9579
  const resetTransform = () => {
9579
9580
  const elmBounds = refDimensions?.width > 0 ? refDimensions : { width: 500, height: 500 };
9580
9581
  const { center, width, height: height2 } = elements.some(
@@ -9600,8 +9601,11 @@ var PCBViewer = ({
9600
9601
  resetTransform();
9601
9602
  }
9602
9603
  }, [children, refDimensions]);
9603
- const pcbElmsPreEdit = (circuitJson ?? soup ?? stateElements).filter(
9604
- (e) => e.type.startsWith("pcb_") || e.type.startsWith("source_")
9604
+ const pcbElmsPreEdit = useMemo6(
9605
+ () => circuitJson.filter(
9606
+ (e) => e.type.startsWith("pcb_") || e.type.startsWith("source_")
9607
+ ),
9608
+ [circuitJson]
9605
9609
  );
9606
9610
  const elements = useMemo6(() => {
9607
9611
  return applyEditEvents(pcbElmsPreEdit, editEvents);