@tscircuit/props 0.0.169 → 0.0.171

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
@@ -5701,7 +5701,77 @@ declare const boardProps: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.exte
5701
5701
  }>;
5702
5702
 
5703
5703
  type ConnectionTarget = string;
5704
+ /**
5705
+ * Defines a mapping of strings to connection paths e.g.
5706
+ *
5707
+ * const connections: Connections = {
5708
+ * GND: ".U1 > .GND",
5709
+ * VCC: ".U1 > .VCC",
5710
+ * }
5711
+ *
5712
+ * Connections are used as both inputs and outputs. For example, you might
5713
+ * receive connections when using `sel` to select a chip.
5714
+ *
5715
+ * const u1Connections = sel.U1(MyChip)
5716
+ *
5717
+ * You can also define a module with connections like this:
5718
+ *
5719
+ * export const MyModule = (props: { connections: { GND: string, VCC: string } }) => {
5720
+ * return (
5721
+ * <group>
5722
+ * <capacitor name="C1" connections={{
5723
+ * anode: props.connections.GND,
5724
+ * cathode: props.connections.VCC,
5725
+ * }} />
5726
+ * </group>
5727
+ * )
5728
+ * }
5729
+ */
5704
5730
  type Connections<PinLabel extends string = string> = Partial<Record<PinLabel, ConnectionTarget | ConnectionTarget[] | readonly ConnectionTarget[]>>;
5731
+ /**
5732
+ * Defines a mapping of strings (usually chip names) to connections e.g.
5733
+ *
5734
+ * const selectors: Selectors = {
5735
+ * U1: { GND: ".U1 > .GND", VCC: ".U1 > .VCC" },
5736
+ * U2: {
5737
+ * GND: ".U2 > .pin1",
5738
+ * VCC: ".U2 > .pin2",
5739
+ * CUSTOM_DATA_1: ".U2 > .pin3",
5740
+ * CUSTOM_DATA_2: ".U2 > .pin4",
5741
+ * },
5742
+ * }
5743
+ *
5744
+ * A user can also use selectors to define the connections, this is helpful when
5745
+ * there's multiple chips in the group.
5746
+ *
5747
+ * ```tsx
5748
+ * const MyModule = (props: {
5749
+ * selectors: {
5750
+ * U1: { GND: string, VCC: string },
5751
+ * R1: { GND: string, VCC: string }
5752
+ * }
5753
+ * }) => {
5754
+ * return (
5755
+ * <group>
5756
+ * <resistor name="R1" connections={{
5757
+ * pin1: props.selectors.R1.GND,
5758
+ * pin2: props.selectors.R1.VCC,
5759
+ * }} />
5760
+ * <capacitor name="C1" connections={{
5761
+ * anode: props.selectors.U1.GND,
5762
+ * cathode: props.selectors.U1.VCC,
5763
+ * }} />
5764
+ * </group>
5765
+ * )
5766
+ * }
5767
+ * ```
5768
+ *
5769
+ * These selectors can also be used with "sel":
5770
+ *
5771
+ * sel.M1(MyModule).U1.GND // ".M1 > .C1 > .anode"
5772
+ */
5773
+ type Selectors = Record<string, Connections>;
5774
+
5705
5775
  type PinLabelsProp<PinNumber extends string = string, PinLabel extends string = string> = Record<PinNumber, PinLabel | readonly PinLabel[] | PinLabel[]>;
5706
5776
  type PinLabelFromPinLabelMap<PinLabelMap extends PinLabelsProp> = PinLabelMap extends PinLabelsProp<infer PinNumber, infer PinLabel> ? PinLabel : never;
5707
5777
  interface ChipPropsSU<PinLabel extends string = string> extends CommonComponentProps {
@@ -8251,12 +8321,15 @@ declare const platedHoleProps: z.ZodEffects<z.ZodUnion<[z.ZodObject<z.objectUtil
8251
8321
  padShape?: "rect" | undefined;
8252
8322
  }>;
8253
8323
 
8324
+ declare const resistorPinLabels: readonly ["pin1", "pin2", "pos", "neg"];
8325
+ type ResistorPinLabels = (typeof resistorPinLabels)[number];
8254
8326
  interface ResistorProps extends CommonComponentProps {
8255
8327
  resistance: number | string;
8256
8328
  pullupFor?: string;
8257
8329
  pullupTo?: string;
8258
8330
  pulldownFor?: string;
8259
8331
  pulldownTo?: string;
8332
+ connections?: Connections<ResistorPinLabels>;
8260
8333
  }
8261
8334
  declare const resistorProps: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<{
8262
8335
  pcbX: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
@@ -8520,6 +8593,7 @@ declare const resistorProps: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.e
8520
8593
  pullupTo: z.ZodOptional<z.ZodString>;
8521
8594
  pulldownFor: z.ZodOptional<z.ZodString>;
8522
8595
  pulldownTo: z.ZodOptional<z.ZodString>;
8596
+ connections: z.ZodOptional<z.ZodRecord<z.ZodEnum<["pin1", "pin2", "pos", "neg"]>, z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodReadonly<z.ZodArray<z.ZodString, "many">>]>, z.ZodArray<z.ZodString, "many">]>>>;
8523
8597
  }>, "strip", z.ZodTypeAny, {
8524
8598
  name: string;
8525
8599
  resistance: number;
@@ -8588,6 +8662,7 @@ declare const resistorProps: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.e
8588
8662
  } | undefined;
8589
8663
  children?: any;
8590
8664
  symbolName?: string | undefined;
8665
+ connections?: Partial<Record<"pin1" | "pin2" | "pos" | "neg", string | readonly string[] | string[]>> | undefined;
8591
8666
  pullupFor?: string | undefined;
8592
8667
  pullupTo?: string | undefined;
8593
8668
  pulldownFor?: string | undefined;
@@ -8662,6 +8737,7 @@ declare const resistorProps: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.e
8662
8737
  } | undefined;
8663
8738
  children?: any;
8664
8739
  symbolName?: string | undefined;
8740
+ connections?: Partial<Record<"pin1" | "pin2" | "pos" | "neg", string | readonly string[] | string[]>> | undefined;
8665
8741
  pullupFor?: string | undefined;
8666
8742
  pullupTo?: string | undefined;
8667
8743
  pulldownFor?: string | undefined;
@@ -10552,6 +10628,8 @@ declare const stampboardProps: z.ZodObject<z.objectUtil.extendShape<z.objectUtil
10552
10628
  innerHoles?: boolean | undefined;
10553
10629
  }>;
10554
10630
 
10631
+ declare const capacitorPinLabels: readonly ["pin1", "pin2", "pos", "neg", "anode", "cathode"];
10632
+ type CapacitorPinLabels = (typeof capacitorPinLabels)[number];
10555
10633
  interface CapacitorProps extends CommonComponentProps {
10556
10634
  capacitance: number | string;
10557
10635
  maxVoltageRating?: number | string;
@@ -10562,6 +10640,7 @@ interface CapacitorProps extends CommonComponentProps {
10562
10640
  bypassFor?: string;
10563
10641
  bypassTo?: string;
10564
10642
  maxDecouplingTraceLength?: number;
10643
+ connections?: Connections<CapacitorPinLabels>;
10565
10644
  }
10566
10645
  declare const capacitorProps: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<{
10567
10646
  pcbX: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
@@ -10829,6 +10908,7 @@ declare const capacitorProps: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.
10829
10908
  bypassFor: z.ZodOptional<z.ZodString>;
10830
10909
  bypassTo: z.ZodOptional<z.ZodString>;
10831
10910
  maxDecouplingTraceLength: z.ZodOptional<z.ZodNumber>;
10911
+ connections: z.ZodOptional<z.ZodRecord<z.ZodEnum<["pin1", "pin2", "pos", "neg", "anode", "cathode"]>, z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodReadonly<z.ZodArray<z.ZodString, "many">>]>, z.ZodArray<z.ZodString, "many">]>>>;
10832
10912
  }>, "strip", z.ZodTypeAny, {
10833
10913
  name: string;
10834
10914
  capacitance: number;
@@ -10899,6 +10979,7 @@ declare const capacitorProps: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.
10899
10979
  } | undefined;
10900
10980
  children?: any;
10901
10981
  symbolName?: string | undefined;
10982
+ connections?: Partial<Record<"pin1" | "pin2" | "anode" | "pos" | "cathode" | "neg", string | readonly string[] | string[]>> | undefined;
10902
10983
  maxVoltageRating?: number | undefined;
10903
10984
  decouplingFor?: string | undefined;
10904
10985
  decouplingTo?: string | undefined;
@@ -10975,6 +11056,7 @@ declare const capacitorProps: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.
10975
11056
  } | undefined;
10976
11057
  children?: any;
10977
11058
  symbolName?: string | undefined;
11059
+ connections?: Partial<Record<"pin1" | "pin2" | "anode" | "pos" | "cathode" | "neg", string | readonly string[] | string[]>> | undefined;
10978
11060
  maxVoltageRating?: string | number | undefined;
10979
11061
  schShowRatings?: boolean | undefined;
10980
11062
  polarized?: boolean | undefined;
@@ -18092,4 +18174,4 @@ declare const platformConfig: z.ZodObject<{
18092
18174
  cloudAutorouterUrl?: string | undefined;
18093
18175
  }>;
18094
18176
 
18095
- export { type AutorouterConfig, type AutorouterProp, type BaseGroupProps, type BaseManualEditEvent, type BaseManualEditEventInput, type BatteryProps, type BoardProps, type CadModelBase, type CadModelJscad, type CadModelObj, type CadModelProp, type CadModelStl, type CapacitorProps, type ChipConnections, type ChipPinLabels, type ChipProps, type ChipPropsSU, type CirclePlatedHoleProps, type CircleSmtPadProps, type CircleSolderPasteProps, type CircularHoleWithRectPlatedProps, type CommonComponentProps, type CommonLayoutProps, type ComponentProps, type ConnectionTarget, type Connections, type ConstrainedLayoutProps, type ConstraintProps, type CrystalProps, type DiodeProps, type Direction, type DirectionAlongEdge, type EditPcbComponentLocationEvent, type EditPcbComponentLocationEventInput, type EditSchematicComponentLocationEvent, type EditSchematicComponentLocationEventInput, type EditTraceHintEvent, type EditTraceHintEventInput, type FabricationNotePathProps, type FabricationNoteTextProps, type Footprint, type FootprintProps, type FootprintPropsInput, type FootprintSoupElements, type GroupProps, type HoleProps, type InductorProps, type InferredChipProps, type InferredConstrainedLayoutProps, type InferredDiodeProps, type InferredHoleProps, type InferredSmtPadProps, type InferredSolderPasteProps, type InferredSwitchProps, type JumperProps, type LayoutConfig, type LedProps, type ManualEditEvent, type ManualEditEventInput, type ManualEditsFile, type ManualEditsFileInput, type ManualPcbPlacement, type ManualPcbPlacementInput, type ManualSchematicPlacement, type ManualSchematicPlacementInput, type ManualTraceHint, type ManualTraceHintInput, type MosfetProps, type NetAliasProps, type NetProps, type NonSubcircuitGroupProps, type OvalPlatedHoleProps, type PartsEngine, type PcbKeepoutProps, type PcbLayoutProps, type PcbRouteCache, type PcbSameXConstraint, type PcbSameYConstraint, type PcbTraceProps, type PcbXDistConstraint, type PcbYDistConstraint, type PillPlatedHoleProps, type PillSmtPadProps, type PinHeaderProps, type PinLabelFromPinLabelMap, type PinLabelsProp, type PinSideDefinition, type PinVariant, type PlatedHoleProps, type PlatformConfig, type PortHints, type PortProps, type PotentiometerPinVariant, type PotentiometerProps, type PowerSourceProps, type PushButtonProps, type RectSmtPadProps, type RectSolderPasteProps, type ResistorProps, type ResonatorPinVariant, type ResonatorProps, type RotatedRectSmtPadProps, type SchematicBoxProps, type SchematicLineProps, type SchematicPathProps, type SchematicPinArrangement, type SchematicPinArrangementWithPinCounts, type SchematicPinArrangementWithSides, type SchematicPinArrangementWithSizes, type SchematicPinStyle, type SchematicPortArrangement, type SchematicPortArrangementWithPinCounts, type SchematicPortArrangementWithSides, type SchematicPortArrangementWithSizes, type SchematicTextProps, type SilkscreenCircleProps, type SilkscreenLineProps, type SilkscreenPathProps, type SilkscreenRectProps, type SilkscreenTextProps, type SmtPadProps, type SolderPasteProps, type StampboardProps, type SubcircuitGroupProps, type SubcircuitGroupPropsWithBool, type SubcircuitProps, type SupplierName, type SupplierPartNumbers, type SupplierProps, type SwitchProps, type TraceHintProps, type TraceProps, type TransistorProps, type ViaProps, autorouterConfig, autorouterProp, baseGroupProps, base_manual_edit_event, batteryPins, batteryProps, boardProps, bugProps, cadModelBase, cadModelJscad, cadModelObj, cadModelProp, cadModelStl, capacitorPins, capacitorProps, chipProps, circleSmtPadProps, circleSolderPasteProps, commonComponentProps, commonLayoutProps, componentProps, constrainedLayoutProps, constraintProps, crystalPins, crystalProps, diodePins, diodeProps, direction, directionAlongEdge, distanceOrMultiplier, edit_component_location_event, edit_pcb_component_location_event, edit_schematic_component_location_event, edit_trace_hint_event, explicitPinSideDefinition, fabricationNotePathProps, fabricationNoteTextProps, footprintProp, footprintProps, groupProps, holeProps, inductorPins, inductorProps, jumperProps, layoutConfig, ledPins, ledProps, lrPins, lrPolarPins, manual_edit_event, manual_edits_file, manual_pcb_placement, manual_schematic_placement, manual_trace_hint, mosfetPins, mosfetProps, netAliasProps, netProps, partsEngine, pcbKeepoutProps, pcbLayoutProps, pcbSameXConstraintProps, pcbSameYConstraintProps, pcbTraceProps, pcbXDistConstraintProps, pcbYDistConstraintProps, pillSmtPadProps, pinHeaderProps, pinLabelsProp, platedHoleProps, platformConfig, point3, portHints, portProps, portRef, potentiometerProps, powerSourceProps, pushButtonProps, rectSmtPadProps, rectSolderPasteProps, resistorPins, resistorProps, resonatorProps, rotatedRectSmtPadProps, rotationPoint3, routeHintPointProps, schematicBoxProps, schematicLineProps, schematicPathProps, schematicPinArrangement, schematicPinStyle, schematicPortArrangement, schematicTextProps, silkscreenCircleProps, silkscreenLineProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, smtPadProps, solderPasteProps, stampboardProps, subcircuitGroupProps, subcircuitGroupPropsWithBool, subcircuitProps, supplierProps, switchProps, traceHintProps, traceProps, transistorPins, transistorProps, viaProps };
18177
+ export { type AutorouterConfig, type AutorouterProp, type BaseGroupProps, type BaseManualEditEvent, type BaseManualEditEventInput, type BatteryProps, type BoardProps, type CadModelBase, type CadModelJscad, type CadModelObj, type CadModelProp, type CadModelStl, type CapacitorPinLabels, type CapacitorProps, type ChipConnections, type ChipPinLabels, type ChipProps, type ChipPropsSU, type CirclePlatedHoleProps, type CircleSmtPadProps, type CircleSolderPasteProps, type CircularHoleWithRectPlatedProps, type CommonComponentProps, type CommonLayoutProps, type ComponentProps, type ConnectionTarget, type Connections, type ConstrainedLayoutProps, type ConstraintProps, type CrystalProps, type DiodeProps, type Direction, type DirectionAlongEdge, type EditPcbComponentLocationEvent, type EditPcbComponentLocationEventInput, type EditSchematicComponentLocationEvent, type EditSchematicComponentLocationEventInput, type EditTraceHintEvent, type EditTraceHintEventInput, type FabricationNotePathProps, type FabricationNoteTextProps, type Footprint, type FootprintProps, type FootprintPropsInput, type FootprintSoupElements, type GroupProps, type HoleProps, type InductorProps, type InferredChipProps, type InferredConstrainedLayoutProps, type InferredDiodeProps, type InferredHoleProps, type InferredSmtPadProps, type InferredSolderPasteProps, type InferredSwitchProps, type JumperProps, type LayoutConfig, type LedProps, type ManualEditEvent, type ManualEditEventInput, type ManualEditsFile, type ManualEditsFileInput, type ManualPcbPlacement, type ManualPcbPlacementInput, type ManualSchematicPlacement, type ManualSchematicPlacementInput, type ManualTraceHint, type ManualTraceHintInput, type MosfetProps, type NetAliasProps, type NetProps, type NonSubcircuitGroupProps, type OvalPlatedHoleProps, type PartsEngine, type PcbKeepoutProps, type PcbLayoutProps, type PcbRouteCache, type PcbSameXConstraint, type PcbSameYConstraint, type PcbTraceProps, type PcbXDistConstraint, type PcbYDistConstraint, type PillPlatedHoleProps, type PillSmtPadProps, type PinHeaderProps, type PinLabelFromPinLabelMap, type PinLabelsProp, type PinSideDefinition, type PinVariant, type PlatedHoleProps, type PlatformConfig, type PortHints, type PortProps, type PotentiometerPinVariant, type PotentiometerProps, type PowerSourceProps, type PushButtonProps, type RectSmtPadProps, type RectSolderPasteProps, type ResistorPinLabels, type ResistorProps, type ResonatorPinVariant, type ResonatorProps, type RotatedRectSmtPadProps, type SchematicBoxProps, type SchematicLineProps, type SchematicPathProps, type SchematicPinArrangement, type SchematicPinArrangementWithPinCounts, type SchematicPinArrangementWithSides, type SchematicPinArrangementWithSizes, type SchematicPinStyle, type SchematicPortArrangement, type SchematicPortArrangementWithPinCounts, type SchematicPortArrangementWithSides, type SchematicPortArrangementWithSizes, type SchematicTextProps, type Selectors, type SilkscreenCircleProps, type SilkscreenLineProps, type SilkscreenPathProps, type SilkscreenRectProps, type SilkscreenTextProps, type SmtPadProps, type SolderPasteProps, type StampboardProps, type SubcircuitGroupProps, type SubcircuitGroupPropsWithBool, type SubcircuitProps, type SupplierName, type SupplierPartNumbers, type SupplierProps, type SwitchProps, type TraceHintProps, type TraceProps, type TransistorProps, type ViaProps, autorouterConfig, autorouterProp, baseGroupProps, base_manual_edit_event, batteryPins, batteryProps, boardProps, bugProps, cadModelBase, cadModelJscad, cadModelObj, cadModelProp, cadModelStl, capacitorPinLabels, capacitorPins, capacitorProps, chipProps, circleSmtPadProps, circleSolderPasteProps, commonComponentProps, commonLayoutProps, componentProps, constrainedLayoutProps, constraintProps, crystalPins, crystalProps, diodePins, diodeProps, direction, directionAlongEdge, distanceOrMultiplier, edit_component_location_event, edit_pcb_component_location_event, edit_schematic_component_location_event, edit_trace_hint_event, explicitPinSideDefinition, fabricationNotePathProps, fabricationNoteTextProps, footprintProp, footprintProps, groupProps, holeProps, inductorPins, inductorProps, jumperProps, layoutConfig, ledPins, ledProps, lrPins, lrPolarPins, manual_edit_event, manual_edits_file, manual_pcb_placement, manual_schematic_placement, manual_trace_hint, mosfetPins, mosfetProps, netAliasProps, netProps, partsEngine, pcbKeepoutProps, pcbLayoutProps, pcbSameXConstraintProps, pcbSameYConstraintProps, pcbTraceProps, pcbXDistConstraintProps, pcbYDistConstraintProps, pillSmtPadProps, pinHeaderProps, pinLabelsProp, platedHoleProps, platformConfig, point3, portHints, portProps, portRef, potentiometerProps, powerSourceProps, pushButtonProps, rectSmtPadProps, rectSolderPasteProps, resistorPinLabels, resistorPins, resistorProps, resonatorProps, rotatedRectSmtPadProps, rotationPoint3, routeHintPointProps, schematicBoxProps, schematicLineProps, schematicPathProps, schematicPinArrangement, schematicPinStyle, schematicPortArrangement, schematicTextProps, silkscreenCircleProps, silkscreenLineProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, smtPadProps, solderPasteProps, stampboardProps, subcircuitGroupProps, subcircuitGroupPropsWithBool, subcircuitProps, supplierProps, switchProps, traceHintProps, traceProps, transistorPins, transistorProps, viaProps };