@tscircuit/core 0.0.182 → 0.0.183

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _tscircuit_props from '@tscircuit/props';
2
- import { subcircuitGroupProps, traceProps, SupplierPartNumbers, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, diodeProps, jumperProps, ledProps, powerSourceProps, resistorProps, constraintProps, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, holeProps, pcbKeepoutProps, netAliasProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, smtPadProps, traceHintProps, viaProps, batteryProps, pinHeaderProps, inductorProps, potentiometerProps, CapacitorProps, ChipProps, ResistorProps } from '@tscircuit/props';
2
+ import { subcircuitGroupProps, traceProps, SupplierPartNumbers, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, diodeProps, jumperProps, ledProps, powerSourceProps, resistorProps, constraintProps, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, subcircuitProps, holeProps, pcbKeepoutProps, netAliasProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, smtPadProps, traceHintProps, viaProps, batteryProps, pinHeaderProps, inductorProps, potentiometerProps, CapacitorProps, ChipProps, ResistorProps } from '@tscircuit/props';
3
3
  import React, { ReactElement } from 'react';
4
4
  import * as zod from 'zod';
5
5
  import { z, ZodType } from 'zod';
@@ -291,7 +291,18 @@ declare abstract class PrimitiveComponent<ZodProps extends ZodType = any> extend
291
291
  schematicPrimitive?: boolean;
292
292
  }): T | null;
293
293
  getAvailablePcbLayers(): string[];
294
+ /**
295
+ * Returns all descendants
296
+ *
297
+ * NOTE: This crosses subcircuit boundaries, you may want to use
298
+ * getSelectableDescendants instead
299
+ */
294
300
  getDescendants(): PrimitiveComponent[];
301
+ /**
302
+ * Returns all descendants that are accessible without crossing a subcircuit
303
+ * boundary
304
+ */
305
+ getSelectableDescendants(): PrimitiveComponent[];
295
306
  /**
296
307
  * Return the number of pins in this component, this is important for
297
308
  * NormalComponents
@@ -876,7 +887,7 @@ declare class Board extends Group<typeof boardProps> {
876
887
  get isSubcircuit(): boolean;
877
888
  get config(): {
878
889
  componentName: string;
879
- zodProps: z.ZodObject<z.objectUtil.extendShape<Omit<z.objectUtil.extendShape<z.objectUtil.extendShape<{
890
+ zodProps: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<{
880
891
  pcbX: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
881
892
  pcbY: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
882
893
  pcbRotation: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
@@ -897,7 +908,6 @@ declare class Board extends Group<typeof boardProps> {
897
908
  name: z.ZodOptional<z.ZodString>;
898
909
  children: z.ZodOptional<z.ZodAny>;
899
910
  }>, {
900
- subcircuit: z.ZodLiteral<true>;
901
911
  layout: z.ZodOptional<z.ZodType<_tscircuit_layout.LayoutBuilder, z.ZodTypeDef, _tscircuit_layout.LayoutBuilder>>;
902
912
  manualEdits: z.ZodOptional<z.ZodType<_tscircuit_layout.ManualEditFile, z.ZodTypeDef, _tscircuit_layout.ManualEditFile>>;
903
913
  schAutoLayoutEnabled: z.ZodOptional<z.ZodBoolean>;
@@ -905,7 +915,7 @@ declare class Board extends Group<typeof boardProps> {
905
915
  defaultTraceWidth: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
906
916
  minTraceWidth: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
907
917
  partsEngine: z.ZodOptional<z.ZodType<_tscircuit_props.PartsEngine, z.ZodTypeDef, _tscircuit_props.PartsEngine>>;
908
- }>, "subcircuit">, {
918
+ }>, {
909
919
  width: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
910
920
  height: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
911
921
  outline: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -1683,44 +1693,44 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
1683
1693
  topPinCount: zod.ZodOptional<zod.ZodNumber>;
1684
1694
  bottomPinCount: zod.ZodOptional<zod.ZodNumber>;
1685
1695
  leftSide: zod.ZodOptional<zod.ZodObject<{
1686
- pins: zod.ZodUnion<[zod.ZodArray<zod.ZodNumber, "many">, zod.ZodArray<zod.ZodString, "many">]>;
1696
+ pins: zod.ZodArray<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>, "many">;
1687
1697
  direction: zod.ZodUnion<[zod.ZodLiteral<"top-to-bottom">, zod.ZodLiteral<"left-to-right">, zod.ZodLiteral<"bottom-to-top">, zod.ZodLiteral<"right-to-left">]>;
1688
1698
  }, "strip", zod.ZodTypeAny, {
1689
1699
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1690
- pins: string[] | number[];
1700
+ pins: (string | number)[];
1691
1701
  }, {
1692
1702
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1693
- pins: string[] | number[];
1703
+ pins: (string | number)[];
1694
1704
  }>>;
1695
1705
  rightSide: zod.ZodOptional<zod.ZodObject<{
1696
- pins: zod.ZodUnion<[zod.ZodArray<zod.ZodNumber, "many">, zod.ZodArray<zod.ZodString, "many">]>;
1706
+ pins: zod.ZodArray<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>, "many">;
1697
1707
  direction: zod.ZodUnion<[zod.ZodLiteral<"top-to-bottom">, zod.ZodLiteral<"left-to-right">, zod.ZodLiteral<"bottom-to-top">, zod.ZodLiteral<"right-to-left">]>;
1698
1708
  }, "strip", zod.ZodTypeAny, {
1699
1709
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1700
- pins: string[] | number[];
1710
+ pins: (string | number)[];
1701
1711
  }, {
1702
1712
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1703
- pins: string[] | number[];
1713
+ pins: (string | number)[];
1704
1714
  }>>;
1705
1715
  topSide: zod.ZodOptional<zod.ZodObject<{
1706
- pins: zod.ZodUnion<[zod.ZodArray<zod.ZodNumber, "many">, zod.ZodArray<zod.ZodString, "many">]>;
1716
+ pins: zod.ZodArray<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>, "many">;
1707
1717
  direction: zod.ZodUnion<[zod.ZodLiteral<"top-to-bottom">, zod.ZodLiteral<"left-to-right">, zod.ZodLiteral<"bottom-to-top">, zod.ZodLiteral<"right-to-left">]>;
1708
1718
  }, "strip", zod.ZodTypeAny, {
1709
1719
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1710
- pins: string[] | number[];
1720
+ pins: (string | number)[];
1711
1721
  }, {
1712
1722
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1713
- pins: string[] | number[];
1723
+ pins: (string | number)[];
1714
1724
  }>>;
1715
1725
  bottomSide: zod.ZodOptional<zod.ZodObject<{
1716
- pins: zod.ZodUnion<[zod.ZodArray<zod.ZodNumber, "many">, zod.ZodArray<zod.ZodString, "many">]>;
1726
+ pins: zod.ZodArray<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>, "many">;
1717
1727
  direction: zod.ZodUnion<[zod.ZodLiteral<"top-to-bottom">, zod.ZodLiteral<"left-to-right">, zod.ZodLiteral<"bottom-to-top">, zod.ZodLiteral<"right-to-left">]>;
1718
1728
  }, "strip", zod.ZodTypeAny, {
1719
1729
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1720
- pins: string[] | number[];
1730
+ pins: (string | number)[];
1721
1731
  }, {
1722
1732
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1723
- pins: string[] | number[];
1733
+ pins: (string | number)[];
1724
1734
  }>>;
1725
1735
  }, "strip", zod.ZodTypeAny, {
1726
1736
  leftSize?: number | undefined;
@@ -1729,19 +1739,19 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
1729
1739
  bottomSize?: number | undefined;
1730
1740
  leftSide?: {
1731
1741
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1732
- pins: string[] | number[];
1742
+ pins: (string | number)[];
1733
1743
  } | undefined;
1734
1744
  topSide?: {
1735
1745
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1736
- pins: string[] | number[];
1746
+ pins: (string | number)[];
1737
1747
  } | undefined;
1738
1748
  rightSide?: {
1739
1749
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1740
- pins: string[] | number[];
1750
+ pins: (string | number)[];
1741
1751
  } | undefined;
1742
1752
  bottomSide?: {
1743
1753
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1744
- pins: string[] | number[];
1754
+ pins: (string | number)[];
1745
1755
  } | undefined;
1746
1756
  leftPinCount?: number | undefined;
1747
1757
  rightPinCount?: number | undefined;
@@ -1754,19 +1764,19 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
1754
1764
  bottomSize?: number | undefined;
1755
1765
  leftSide?: {
1756
1766
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1757
- pins: string[] | number[];
1767
+ pins: (string | number)[];
1758
1768
  } | undefined;
1759
1769
  topSide?: {
1760
1770
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1761
- pins: string[] | number[];
1771
+ pins: (string | number)[];
1762
1772
  } | undefined;
1763
1773
  rightSide?: {
1764
1774
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1765
- pins: string[] | number[];
1775
+ pins: (string | number)[];
1766
1776
  } | undefined;
1767
1777
  bottomSide?: {
1768
1778
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1769
- pins: string[] | number[];
1779
+ pins: (string | number)[];
1770
1780
  } | undefined;
1771
1781
  leftPinCount?: number | undefined;
1772
1782
  rightPinCount?: number | undefined;
@@ -1868,19 +1878,19 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
1868
1878
  bottomSize?: number | undefined;
1869
1879
  leftSide?: {
1870
1880
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1871
- pins: string[] | number[];
1881
+ pins: (string | number)[];
1872
1882
  } | undefined;
1873
1883
  topSide?: {
1874
1884
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1875
- pins: string[] | number[];
1885
+ pins: (string | number)[];
1876
1886
  } | undefined;
1877
1887
  rightSide?: {
1878
1888
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1879
- pins: string[] | number[];
1889
+ pins: (string | number)[];
1880
1890
  } | undefined;
1881
1891
  bottomSide?: {
1882
1892
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1883
- pins: string[] | number[];
1893
+ pins: (string | number)[];
1884
1894
  } | undefined;
1885
1895
  leftPinCount?: number | undefined;
1886
1896
  rightPinCount?: number | undefined;
@@ -1974,19 +1984,19 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
1974
1984
  bottomSize?: number | undefined;
1975
1985
  leftSide?: {
1976
1986
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1977
- pins: string[] | number[];
1987
+ pins: (string | number)[];
1978
1988
  } | undefined;
1979
1989
  topSide?: {
1980
1990
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1981
- pins: string[] | number[];
1991
+ pins: (string | number)[];
1982
1992
  } | undefined;
1983
1993
  rightSide?: {
1984
1994
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1985
- pins: string[] | number[];
1995
+ pins: (string | number)[];
1986
1996
  } | undefined;
1987
1997
  bottomSide?: {
1988
1998
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
1989
- pins: string[] | number[];
1999
+ pins: (string | number)[];
1990
2000
  } | undefined;
1991
2001
  leftPinCount?: number | undefined;
1992
2002
  rightPinCount?: number | undefined;
@@ -2677,7 +2687,7 @@ declare class Jumper<PinLabels extends string = never> extends NormalComponent<t
2677
2687
  symbolName: zod.ZodOptional<zod.ZodString>;
2678
2688
  }>, {
2679
2689
  manufacturerPartNumber: zod.ZodOptional<zod.ZodString>;
2680
- pinLabels: zod.ZodOptional<zod.ZodRecord<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>, zod.ZodString>>;
2690
+ pinLabels: zod.ZodOptional<zod.ZodRecord<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>, zod.ZodUnion<[zod.ZodString, zod.ZodArray<zod.ZodString, "many">]>>>;
2681
2691
  schPinStyle: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodObject<{
2682
2692
  leftMargin: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
2683
2693
  rightMargin: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
@@ -2708,44 +2718,44 @@ declare class Jumper<PinLabels extends string = never> extends NormalComponent<t
2708
2718
  topPinCount: zod.ZodOptional<zod.ZodNumber>;
2709
2719
  bottomPinCount: zod.ZodOptional<zod.ZodNumber>;
2710
2720
  leftSide: zod.ZodOptional<zod.ZodObject<{
2711
- pins: zod.ZodUnion<[zod.ZodArray<zod.ZodNumber, "many">, zod.ZodArray<zod.ZodString, "many">]>;
2721
+ pins: zod.ZodArray<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>, "many">;
2712
2722
  direction: zod.ZodUnion<[zod.ZodLiteral<"top-to-bottom">, zod.ZodLiteral<"left-to-right">, zod.ZodLiteral<"bottom-to-top">, zod.ZodLiteral<"right-to-left">]>;
2713
2723
  }, "strip", zod.ZodTypeAny, {
2714
2724
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2715
- pins: string[] | number[];
2725
+ pins: (string | number)[];
2716
2726
  }, {
2717
2727
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2718
- pins: string[] | number[];
2728
+ pins: (string | number)[];
2719
2729
  }>>;
2720
2730
  rightSide: zod.ZodOptional<zod.ZodObject<{
2721
- pins: zod.ZodUnion<[zod.ZodArray<zod.ZodNumber, "many">, zod.ZodArray<zod.ZodString, "many">]>;
2731
+ pins: zod.ZodArray<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>, "many">;
2722
2732
  direction: zod.ZodUnion<[zod.ZodLiteral<"top-to-bottom">, zod.ZodLiteral<"left-to-right">, zod.ZodLiteral<"bottom-to-top">, zod.ZodLiteral<"right-to-left">]>;
2723
2733
  }, "strip", zod.ZodTypeAny, {
2724
2734
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2725
- pins: string[] | number[];
2735
+ pins: (string | number)[];
2726
2736
  }, {
2727
2737
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2728
- pins: string[] | number[];
2738
+ pins: (string | number)[];
2729
2739
  }>>;
2730
2740
  topSide: zod.ZodOptional<zod.ZodObject<{
2731
- pins: zod.ZodUnion<[zod.ZodArray<zod.ZodNumber, "many">, zod.ZodArray<zod.ZodString, "many">]>;
2741
+ pins: zod.ZodArray<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>, "many">;
2732
2742
  direction: zod.ZodUnion<[zod.ZodLiteral<"top-to-bottom">, zod.ZodLiteral<"left-to-right">, zod.ZodLiteral<"bottom-to-top">, zod.ZodLiteral<"right-to-left">]>;
2733
2743
  }, "strip", zod.ZodTypeAny, {
2734
2744
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2735
- pins: string[] | number[];
2745
+ pins: (string | number)[];
2736
2746
  }, {
2737
2747
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2738
- pins: string[] | number[];
2748
+ pins: (string | number)[];
2739
2749
  }>>;
2740
2750
  bottomSide: zod.ZodOptional<zod.ZodObject<{
2741
- pins: zod.ZodUnion<[zod.ZodArray<zod.ZodNumber, "many">, zod.ZodArray<zod.ZodString, "many">]>;
2751
+ pins: zod.ZodArray<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>, "many">;
2742
2752
  direction: zod.ZodUnion<[zod.ZodLiteral<"top-to-bottom">, zod.ZodLiteral<"left-to-right">, zod.ZodLiteral<"bottom-to-top">, zod.ZodLiteral<"right-to-left">]>;
2743
2753
  }, "strip", zod.ZodTypeAny, {
2744
2754
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2745
- pins: string[] | number[];
2755
+ pins: (string | number)[];
2746
2756
  }, {
2747
2757
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2748
- pins: string[] | number[];
2758
+ pins: (string | number)[];
2749
2759
  }>>;
2750
2760
  }, "strip", zod.ZodTypeAny, {
2751
2761
  leftSize?: number | undefined;
@@ -2754,19 +2764,19 @@ declare class Jumper<PinLabels extends string = never> extends NormalComponent<t
2754
2764
  bottomSize?: number | undefined;
2755
2765
  leftSide?: {
2756
2766
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2757
- pins: string[] | number[];
2767
+ pins: (string | number)[];
2758
2768
  } | undefined;
2759
2769
  topSide?: {
2760
2770
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2761
- pins: string[] | number[];
2771
+ pins: (string | number)[];
2762
2772
  } | undefined;
2763
2773
  rightSide?: {
2764
2774
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2765
- pins: string[] | number[];
2775
+ pins: (string | number)[];
2766
2776
  } | undefined;
2767
2777
  bottomSide?: {
2768
2778
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2769
- pins: string[] | number[];
2779
+ pins: (string | number)[];
2770
2780
  } | undefined;
2771
2781
  leftPinCount?: number | undefined;
2772
2782
  rightPinCount?: number | undefined;
@@ -2779,19 +2789,19 @@ declare class Jumper<PinLabels extends string = never> extends NormalComponent<t
2779
2789
  bottomSize?: number | undefined;
2780
2790
  leftSide?: {
2781
2791
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2782
- pins: string[] | number[];
2792
+ pins: (string | number)[];
2783
2793
  } | undefined;
2784
2794
  topSide?: {
2785
2795
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2786
- pins: string[] | number[];
2796
+ pins: (string | number)[];
2787
2797
  } | undefined;
2788
2798
  rightSide?: {
2789
2799
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2790
- pins: string[] | number[];
2800
+ pins: (string | number)[];
2791
2801
  } | undefined;
2792
2802
  bottomSide?: {
2793
2803
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2794
- pins: string[] | number[];
2804
+ pins: (string | number)[];
2795
2805
  } | undefined;
2796
2806
  leftPinCount?: number | undefined;
2797
2807
  rightPinCount?: number | undefined;
@@ -2866,7 +2876,7 @@ declare class Jumper<PinLabels extends string = never> extends NormalComponent<t
2866
2876
  children?: any;
2867
2877
  symbolName?: string | undefined;
2868
2878
  manufacturerPartNumber?: string | undefined;
2869
- pinLabels?: Record<string | number, string> | undefined;
2879
+ pinLabels?: Record<string | number, string | string[]> | undefined;
2870
2880
  schPortArrangement?: {
2871
2881
  leftSize?: number | undefined;
2872
2882
  topSize?: number | undefined;
@@ -2874,19 +2884,19 @@ declare class Jumper<PinLabels extends string = never> extends NormalComponent<t
2874
2884
  bottomSize?: number | undefined;
2875
2885
  leftSide?: {
2876
2886
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2877
- pins: string[] | number[];
2887
+ pins: (string | number)[];
2878
2888
  } | undefined;
2879
2889
  topSide?: {
2880
2890
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2881
- pins: string[] | number[];
2891
+ pins: (string | number)[];
2882
2892
  } | undefined;
2883
2893
  rightSide?: {
2884
2894
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2885
- pins: string[] | number[];
2895
+ pins: (string | number)[];
2886
2896
  } | undefined;
2887
2897
  bottomSide?: {
2888
2898
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2889
- pins: string[] | number[];
2899
+ pins: (string | number)[];
2890
2900
  } | undefined;
2891
2901
  leftPinCount?: number | undefined;
2892
2902
  rightPinCount?: number | undefined;
@@ -2973,7 +2983,7 @@ declare class Jumper<PinLabels extends string = never> extends NormalComponent<t
2973
2983
  children?: any;
2974
2984
  symbolName?: string | undefined;
2975
2985
  manufacturerPartNumber?: string | undefined;
2976
- pinLabels?: Record<string | number, string> | undefined;
2986
+ pinLabels?: Record<string | number, string | string[]> | undefined;
2977
2987
  schPortArrangement?: {
2978
2988
  leftSize?: number | undefined;
2979
2989
  topSize?: number | undefined;
@@ -2981,19 +2991,19 @@ declare class Jumper<PinLabels extends string = never> extends NormalComponent<t
2981
2991
  bottomSize?: number | undefined;
2982
2992
  leftSide?: {
2983
2993
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2984
- pins: string[] | number[];
2994
+ pins: (string | number)[];
2985
2995
  } | undefined;
2986
2996
  topSide?: {
2987
2997
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2988
- pins: string[] | number[];
2998
+ pins: (string | number)[];
2989
2999
  } | undefined;
2990
3000
  rightSide?: {
2991
3001
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2992
- pins: string[] | number[];
3002
+ pins: (string | number)[];
2993
3003
  } | undefined;
2994
3004
  bottomSide?: {
2995
3005
  direction: "top-to-bottom" | "left-to-right" | "bottom-to-top" | "right-to-left";
2996
- pins: string[] | number[];
3006
+ pins: (string | number)[];
2997
3007
  } | undefined;
2998
3008
  leftPinCount?: number | undefined;
2999
3009
  rightPinCount?: number | undefined;
@@ -4500,6 +4510,10 @@ declare class Footprint extends PrimitiveComponent<typeof footprintProps> {
4500
4510
  doInitialPcbFootprintLayout(): void;
4501
4511
  }
4502
4512
 
4513
+ declare class Subcircuit extends Group {
4514
+ constructor(props: z.input<typeof subcircuitProps>);
4515
+ }
4516
+
4503
4517
  declare class Hole extends PrimitiveComponent<typeof holeProps> {
4504
4518
  pcb_hole_id: string | null;
4505
4519
  isPcbPrimitive: boolean;
@@ -7455,9 +7469,10 @@ declare global {
7455
7469
  constrainedlayout: _tscircuit_props.ConstrainedLayoutProps;
7456
7470
  battery: _tscircuit_props.BatteryProps;
7457
7471
  pinheader: _tscircuit_props.PinHeaderProps;
7472
+ subcircuit: _tscircuit_props.SubcircuitGroupProps;
7458
7473
  jscad: any;
7459
7474
  }
7460
7475
  }
7461
7476
  }
7462
7477
 
7463
- export { Battery, Board, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Diode, FabricationNotePath, FabricationNoteText, Footprint, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Net, NetAlias, NormalComponent, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, Renderable, Resistor, SilkscreenCircle, SilkscreenPath, SilkscreenRect, SilkscreenText, SmtPad, Trace, TraceHint, Via, createUseComponent, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
7478
+ export { Battery, Board, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Diode, FabricationNotePath, FabricationNoteText, Footprint, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Net, NetAlias, NormalComponent, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, Renderable, Resistor, SilkscreenCircle, SilkscreenPath, SilkscreenRect, SilkscreenText, SmtPad, Subcircuit, Trace, TraceHint, Via, createUseComponent, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
package/dist/index.js CHANGED
@@ -38,6 +38,7 @@ __export(components_exports, {
38
38
  SilkscreenRect: () => SilkscreenRect,
39
39
  SilkscreenText: () => SilkscreenText,
40
40
  SmtPad: () => SmtPad,
41
+ Subcircuit: () => Subcircuit,
41
42
  Trace: () => Trace,
42
43
  TraceHint: () => TraceHint,
43
44
  Via: () => Via
@@ -46,7 +47,7 @@ __export(components_exports, {
46
47
  // lib/components/base-components/NormalComponent.ts
47
48
  import { fp } from "@tscircuit/footprinter";
48
49
  import { point3, rotation } from "circuit-json";
49
- import Debug2 from "debug";
50
+ import Debug3 from "debug";
50
51
 
51
52
  // lib/fiber/create-instance-from-react-element.ts
52
53
  import ReactReconciler from "react-reconciler";
@@ -472,6 +473,8 @@ import {
472
473
  translate
473
474
  } from "transformation-matrix";
474
475
  import { z as z2 } from "zod";
476
+ import Debug from "debug";
477
+ var debugSelectAll = Debug("tscircuit:primitive-component:selectAll");
475
478
  var PrimitiveComponent = class extends Renderable {
476
479
  parent = null;
477
480
  children;
@@ -826,20 +829,40 @@ var PrimitiveComponent = class extends Renderable {
826
829
  return group;
827
830
  }
828
831
  selectAll(selector) {
832
+ debugSelectAll(`selectAll: "${selector}"`);
829
833
  const parts = selector.trim().split(/\s+/);
830
- let results = [this];
834
+ let currentSearch = parts[0] === ">" ? this.children : this.getSelectableDescendants();
835
+ let currentResults = [];
831
836
  let onlyDirectChildren = false;
837
+ let iteration = -1;
832
838
  for (const part of parts) {
839
+ iteration++;
840
+ debugSelectAll(`
841
+
842
+ iteration: ${iteration}`);
843
+ debugSelectAll(`part: "${parts[iteration]}"`);
844
+ debugSelectAll(
845
+ `currentSearch: [${currentSearch.map((r) => r.getString()).join(",")}]`
846
+ );
847
+ debugSelectAll(
848
+ `currentResults: [${currentResults.map((r) => r.getString()).join(",")}]`
849
+ );
833
850
  if (part === ">") {
834
851
  onlyDirectChildren = true;
835
852
  } else {
836
- results = results.flatMap((component) => {
837
- return (onlyDirectChildren ? component.children : component.getDescendants()).filter((descendant) => isMatchingSelector(descendant, part));
853
+ const newResults = currentSearch.filter(
854
+ (component) => isMatchingSelector(component, part)
855
+ );
856
+ const newSearch = newResults.flatMap((component) => {
857
+ if (onlyDirectChildren) return component.children;
858
+ return component.getSelectableDescendants();
838
859
  });
860
+ currentSearch = newSearch;
861
+ currentResults = newResults;
839
862
  onlyDirectChildren = false;
840
863
  }
841
864
  }
842
- return results.filter((component) => component !== this);
865
+ return currentResults;
843
866
  }
844
867
  selectOne(selector, options) {
845
868
  let type = options?.type?.toLowerCase();
@@ -874,6 +897,12 @@ var PrimitiveComponent = class extends Renderable {
874
897
  }
875
898
  return [];
876
899
  }
900
+ /**
901
+ * Returns all descendants
902
+ *
903
+ * NOTE: This crosses subcircuit boundaries, you may want to use
904
+ * getSelectableDescendants instead
905
+ */
877
906
  getDescendants() {
878
907
  const descendants = [];
879
908
  for (const child of this.children) {
@@ -882,6 +911,22 @@ var PrimitiveComponent = class extends Renderable {
882
911
  }
883
912
  return descendants;
884
913
  }
914
+ /**
915
+ * Returns all descendants that are accessible without crossing a subcircuit
916
+ * boundary
917
+ */
918
+ getSelectableDescendants() {
919
+ const descendants = [];
920
+ for (const child of this.children) {
921
+ if (child.isSubcircuit) {
922
+ descendants.push(child);
923
+ } else {
924
+ descendants.push(child);
925
+ descendants.push(...child.getSelectableDescendants());
926
+ }
927
+ }
928
+ return descendants;
929
+ }
885
930
  /**
886
931
  * Return the number of pins in this component, this is important for
887
932
  * NormalComponents
@@ -2255,8 +2300,8 @@ import { z as z5 } from "zod";
2255
2300
  // lib/components/primitive-components/Footprint.ts
2256
2301
  import { footprintProps } from "@tscircuit/props";
2257
2302
  import * as kiwi from "@lume/kiwi";
2258
- import Debug from "debug";
2259
- var debug = Debug("tscircuit:core:footprint");
2303
+ import Debug2 from "debug";
2304
+ var debug = Debug2("tscircuit:core:footprint");
2260
2305
  var Footprint = class extends PrimitiveComponent {
2261
2306
  get config() {
2262
2307
  return {
@@ -2462,7 +2507,7 @@ var Footprint = class extends PrimitiveComponent {
2462
2507
  };
2463
2508
 
2464
2509
  // lib/components/base-components/NormalComponent.ts
2465
- var debug2 = Debug2("tscircuit:core");
2510
+ var debug2 = Debug3("tscircuit:core");
2466
2511
  var rotation3 = z5.object({
2467
2512
  x: rotation,
2468
2513
  y: rotation,
@@ -4804,6 +4849,17 @@ var FabricationNoteText = class extends PrimitiveComponent {
4804
4849
  }
4805
4850
  };
4806
4851
 
4852
+ // lib/components/primitive-components/Group/Subcircuit.ts
4853
+ import "@tscircuit/props";
4854
+ var Subcircuit = class extends Group {
4855
+ constructor(props) {
4856
+ super({
4857
+ ...props,
4858
+ subcircuit: true
4859
+ });
4860
+ }
4861
+ };
4862
+
4807
4863
  // lib/components/primitive-components/NetAlias.ts
4808
4864
  import { netAliasProps } from "@tscircuit/props";
4809
4865
  var NetAlias = class extends PrimitiveComponent {
@@ -5264,9 +5320,11 @@ var Circuit = class {
5264
5320
  return identity5();
5265
5321
  }
5266
5322
  selectAll(selector) {
5323
+ this._guessRootComponent();
5267
5324
  return this.firstChild?.selectAll(selector) ?? [];
5268
5325
  }
5269
5326
  selectOne(selector, opts) {
5327
+ this._guessRootComponent();
5270
5328
  return this.firstChild?.selectOne(selector, opts) ?? null;
5271
5329
  }
5272
5330
  _eventListeners = { asyncEffectComplete: [] };
@@ -5432,6 +5490,7 @@ export {
5432
5490
  SilkscreenRect,
5433
5491
  SilkscreenText,
5434
5492
  SmtPad,
5493
+ Subcircuit,
5435
5494
  Trace,
5436
5495
  TraceHint,
5437
5496
  Via,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.182",
4
+ "version": "0.0.183",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -40,7 +40,7 @@
40
40
  "@tscircuit/footprinter": "^0.0.77",
41
41
  "@tscircuit/infgrid-ijump-astar": "^0.0.24",
42
42
  "@tscircuit/math-utils": "^0.0.5",
43
- "@tscircuit/props": "^0.0.95",
43
+ "@tscircuit/props": "^0.0.98",
44
44
  "@tscircuit/schematic-autolayout": "^0.0.6",
45
45
  "@tscircuit/soup-util": "^0.0.40",
46
46
  "circuit-json": "^0.0.104",