@tscircuit/pcb-viewer 1.11.203 → 1.11.204

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
@@ -11290,6 +11290,30 @@ import {
11290
11290
  useStore as useZustandStore
11291
11291
  } from "zustand";
11292
11292
  import { useContext } from "react";
11293
+
11294
+ // src/hooks/useLocalStorage.ts
11295
+ import { useCallback } from "react";
11296
+ var STORAGE_KEYS = {
11297
+ IS_SHOWING_PCB_GROUPS: "pcb_viewer_is_showing_pcb_groups"
11298
+ };
11299
+ var getStoredBoolean = (key, defaultValue) => {
11300
+ if (typeof window === "undefined") return defaultValue;
11301
+ try {
11302
+ const stored = localStorage.getItem(key);
11303
+ return stored !== null ? JSON.parse(stored) : defaultValue;
11304
+ } catch {
11305
+ return defaultValue;
11306
+ }
11307
+ };
11308
+ var setStoredBoolean = (key, value) => {
11309
+ if (typeof window === "undefined") return;
11310
+ try {
11311
+ localStorage.setItem(key, JSON.stringify(value));
11312
+ } catch {
11313
+ }
11314
+ };
11315
+
11316
+ // src/global-store.ts
11293
11317
  var createStore = (initialState = {}) => createZustandStore(
11294
11318
  (set) => ({
11295
11319
  selected_layer: "top",
@@ -11304,7 +11328,10 @@ var createStore = (initialState = {}) => createZustandStore(
11304
11328
  is_showing_rats_nest: false,
11305
11329
  is_showing_autorouting: true,
11306
11330
  is_showing_drc_errors: true,
11307
- is_showing_pcb_groups: true,
11331
+ is_showing_pcb_groups: getStoredBoolean(
11332
+ STORAGE_KEYS.IS_SHOWING_PCB_GROUPS,
11333
+ true
11334
+ ),
11308
11335
  ...initialState,
11309
11336
  selectLayer: (layer) => set({ selected_layer: layer }),
11310
11337
  setEditMode: (mode) => set({
@@ -11321,7 +11348,10 @@ var createStore = (initialState = {}) => createZustandStore(
11321
11348
  setIsShowingMultipleTracesLength: (is_showing) => set({ is_showing_multiple_traces_length: is_showing }),
11322
11349
  setIsShowingAutorouting: (is_showing) => set({ is_showing_autorouting: is_showing }),
11323
11350
  setIsShowingDrcErrors: (is_showing) => set({ is_showing_drc_errors: is_showing }),
11324
- setIsShowingPcbGroups: (is_showing) => set({ is_showing_pcb_groups: is_showing })
11351
+ setIsShowingPcbGroups: (is_showing) => {
11352
+ setStoredBoolean(STORAGE_KEYS.IS_SHOWING_PCB_GROUPS, is_showing);
11353
+ set({ is_showing_pcb_groups: is_showing });
11354
+ }
11325
11355
  })
11326
11356
  );
11327
11357
  var useGlobalStore = (s) => {
@@ -11471,7 +11501,7 @@ import {
11471
11501
  applyToPoint as applyToPoint2,
11472
11502
  scale as scale2
11473
11503
  } from "transformation-matrix";
11474
- import { useCallback, useEffect as useEffect3, useReducer, useRef, useState as useState2 } from "react";
11504
+ import { useCallback as useCallback2, useEffect as useEffect3, useReducer, useRef, useState as useState2 } from "react";
11475
11505
  var useMouseMatrixTransform = (props = {}) => {
11476
11506
  const extRef = useRef(null);
11477
11507
  const [lastDragCancelTime, setLastDragCancelTime] = useState2(0);
@@ -11481,7 +11511,7 @@ var useMouseMatrixTransform = (props = {}) => {
11481
11511
  );
11482
11512
  const [waitCounter, setWaitCounter] = useState2(0);
11483
11513
  const [extChangeCounter, incExtChangeCounter] = useReducer((s) => s + 1, 0);
11484
- const setTransform = useCallback(
11514
+ const setTransform = useCallback2(
11485
11515
  (newTransform) => {
11486
11516
  if (props.onSetTransform) {
11487
11517
  props.onSetTransform(newTransform);
@@ -11492,7 +11522,7 @@ var useMouseMatrixTransform = (props = {}) => {
11492
11522
  },
11493
11523
  [props.onSetTransform, setInternalTransform]
11494
11524
  );
11495
- const setTransformExt = useCallback(
11525
+ const setTransformExt = useCallback2(
11496
11526
  (newTransform) => {
11497
11527
  setTransform(newTransform);
11498
11528
  incExtChangeCounter();
@@ -11500,7 +11530,7 @@ var useMouseMatrixTransform = (props = {}) => {
11500
11530
  [setTransform]
11501
11531
  );
11502
11532
  const transform = props.transform ?? internalTransform;
11503
- const cancelDrag = useCallback(() => {
11533
+ const cancelDrag = useCallback2(() => {
11504
11534
  setLastDragCancelTime(Date.now());
11505
11535
  }, []);
11506
11536
  const gestureModeRef = useRef("none");
@@ -11700,7 +11730,7 @@ var useMouseMatrixTransform = (props = {}) => {
11700
11730
  props.enabled,
11701
11731
  props.shouldDrag
11702
11732
  ]);
11703
- const applyTransformToPoint = useCallback(
11733
+ const applyTransformToPoint = useCallback2(
11704
11734
  (obj) => applyToPoint2(transform, obj),
11705
11735
  [transform]
11706
11736
  );
@@ -11921,7 +11951,7 @@ function addInteractionMetadataToPrimitives({
11921
11951
  }
11922
11952
 
11923
11953
  // src/components/CanvasElementsRenderer.tsx
11924
- import { useCallback as useCallback2, useMemo as useMemo5, useState as useState10 } from "react";
11954
+ import { useCallback as useCallback3, useMemo as useMemo5, useState as useState10 } from "react";
11925
11955
 
11926
11956
  // src/lib/util/expand-stroke.ts
11927
11957
  function getExpandedStroke(strokeInput, defaultWidth) {
@@ -15984,7 +16014,7 @@ import { css as css3 } from "@emotion/css";
15984
16014
  // package.json
15985
16015
  var package_default = {
15986
16016
  name: "@tscircuit/pcb-viewer",
15987
- version: "1.11.202",
16017
+ version: "1.11.203",
15988
16018
  main: "dist/index.js",
15989
16019
  type: "module",
15990
16020
  repository: "tscircuit/pcb-viewer",
@@ -16550,7 +16580,7 @@ var CanvasElementsRenderer = (props) => {
16550
16580
  primitiveIdsInMousedOverNet: hoverState.primitiveIdsInMousedOverNet
16551
16581
  });
16552
16582
  }, [primitivesWithoutInteractionMetadata, hoverState]);
16553
- const onMouseOverPrimitives = useCallback2(
16583
+ const onMouseOverPrimitives = useCallback3(
16554
16584
  (primitivesHoveredOver) => {
16555
16585
  const primitiveIdsInMousedOverNet = [];
16556
16586
  for (const primitive of primitivesHoveredOver) {