@tscircuit/core 0.0.311 → 0.0.313

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
@@ -1376,6 +1376,7 @@ type Ftype = AnySourceComponent["ftype"];
1376
1376
  type TwoPinPorts = "pin1" | "pin2";
1377
1377
  type PassivePorts = TwoPinPorts;
1378
1378
  type PolarizedPassivePorts = PassivePorts | "anode" | "cathode" | "pos" | "neg";
1379
+ type TransistorPorts = "pin1" | "pin2" | "pin3" | "emitter" | "collector" | "base";
1379
1380
 
1380
1381
  declare class Capacitor extends NormalComponent<typeof capacitorProps, PassivePorts> {
1381
1382
  get config(): {
@@ -8917,7 +8918,7 @@ declare class Crystal extends NormalComponent<typeof crystalProps, PolarizedPass
8917
8918
  }>, {
8918
8919
  frequency: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
8919
8920
  loadCapacitance: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
8920
- pinVariant: zod.ZodOptional<zod.ZodEnum<["2pin", "4pin"]>>;
8921
+ pinVariant: zod.ZodOptional<zod.ZodEnum<["two_pin", "four_pin"]>>;
8921
8922
  }>, "strip", zod.ZodTypeAny, {
8922
8923
  name: string;
8923
8924
  frequency: number;
@@ -8987,7 +8988,7 @@ declare class Crystal extends NormalComponent<typeof crystalProps, PolarizedPass
8987
8988
  } | undefined;
8988
8989
  children?: any;
8989
8990
  symbolName?: string | undefined;
8990
- pinVariant?: "2pin" | "4pin" | undefined;
8991
+ pinVariant?: "two_pin" | "four_pin" | undefined;
8991
8992
  }, {
8992
8993
  name: string;
8993
8994
  frequency: string | number;
@@ -9059,7 +9060,7 @@ declare class Crystal extends NormalComponent<typeof crystalProps, PolarizedPass
9059
9060
  } | undefined;
9060
9061
  children?: any;
9061
9062
  symbolName?: string | undefined;
9062
- pinVariant?: "2pin" | "4pin" | undefined;
9063
+ pinVariant?: "two_pin" | "four_pin" | undefined;
9063
9064
  }>;
9064
9065
  sourceFtype: Ftype;
9065
9066
  };
@@ -9068,7 +9069,7 @@ declare class Crystal extends NormalComponent<typeof crystalProps, PolarizedPass
9068
9069
  doInitialSourceRender(): void;
9069
9070
  }
9070
9071
 
9071
- declare class Transistor extends NormalComponent<typeof transistorProps> {
9072
+ declare class Transistor extends NormalComponent<typeof transistorProps, TransistorPorts> {
9072
9073
  get config(): {
9073
9074
  componentName: string;
9074
9075
  schematicSymbolName: "npn_bipolar_transistor" | "pnp_bipolar_transistor";
@@ -9469,8 +9470,13 @@ declare class Transistor extends NormalComponent<typeof transistorProps> {
9469
9470
  children?: any;
9470
9471
  symbolName?: string | undefined;
9471
9472
  }>;
9473
+ sourceFtype: Ftype;
9472
9474
  shouldRenderAsSchematicBox: boolean;
9473
9475
  };
9476
+ initPorts(): void;
9477
+ emitter: Port;
9478
+ collector: Port;
9479
+ base: Port;
9474
9480
  doInitialSourceRender(): void;
9475
9481
  }
9476
9482
 
@@ -10280,6 +10286,7 @@ interface TscircuitElements {
10280
10286
  trace: _tscircuit_props.TraceProps;
10281
10287
  custom: any;
10282
10288
  component: _tscircuit_props.ComponentProps;
10289
+ crystal: _tscircuit_props.CrystalProps;
10283
10290
  footprint: any;
10284
10291
  silkscreentext: _tscircuit_props.SilkscreenTextProps;
10285
10292
  silkscreenpath: _tscircuit_props.SilkscreenPathProps;
package/dist/index.js CHANGED
@@ -6492,19 +6492,26 @@ import { formatSiUnit as formatSiUnit3 } from "format-si-unit";
6492
6492
  var Crystal = class extends NormalComponent {
6493
6493
  // @ts-ignore
6494
6494
  get config() {
6495
+ const symbolName = this.props.symbolName ?? (this.props.pinVariant === "four_pin" ? "crystal_4pin" : "crystal");
6495
6496
  return {
6496
- schematicSymbolName: this.props.symbolName ?? "crystal",
6497
+ schematicSymbolName: symbolName,
6497
6498
  componentName: "Crystal",
6498
6499
  zodProps: crystalProps,
6499
6500
  sourceFtype: "simple_crystal"
6500
6501
  };
6501
6502
  }
6502
6503
  initPorts() {
6504
+ const additionalAliases = this.props.pinVariant === "four_pin" ? {
6505
+ pin1: ["left1", "1"],
6506
+ pin2: ["top1", "2", "gnd1"],
6507
+ pin3: ["right1", "3"],
6508
+ pin4: ["bottom1", "4", "gnd2"]
6509
+ } : {
6510
+ pin1: ["pos", "left"],
6511
+ pin2: ["neg", "right"]
6512
+ };
6503
6513
  super.initPorts({
6504
- additionalAliases: {
6505
- pin1: ["pos", "left"],
6506
- pin2: ["neg", "right"]
6507
- }
6514
+ additionalAliases
6508
6515
  });
6509
6516
  }
6510
6517
  _getSchematicSymbolDisplayValue() {
@@ -6517,7 +6524,8 @@ var Crystal = class extends NormalComponent {
6517
6524
  name: props.name,
6518
6525
  ftype: "simple_crystal",
6519
6526
  frequency: props.frequency,
6520
- load_capacitance: props.loadCapacitance
6527
+ load_capacitance: props.loadCapacitance,
6528
+ pin_variant: props.pinVariant || "two_pin"
6521
6529
  });
6522
6530
  this.source_component_id = source_component.source_component_id;
6523
6531
  }
@@ -6532,9 +6540,23 @@ var Transistor = class extends NormalComponent {
6532
6540
  componentName: "Transistor",
6533
6541
  schematicSymbolName: baseSymbolName,
6534
6542
  zodProps: transistorProps,
6543
+ sourceFtype: "simple_transistor",
6535
6544
  shouldRenderAsSchematicBox: false
6536
6545
  };
6537
6546
  }
6547
+ initPorts() {
6548
+ super.initPorts({
6549
+ pinCount: 3,
6550
+ additionalAliases: {
6551
+ pin1: ["emitter", "e"],
6552
+ pin2: ["collector", "c"],
6553
+ pin3: ["base", "b"]
6554
+ }
6555
+ });
6556
+ }
6557
+ emitter = this.portMap.pin1;
6558
+ collector = this.portMap.pin2;
6559
+ base = this.portMap.pin3;
6538
6560
  doInitialSourceRender() {
6539
6561
  const { db } = this.root;
6540
6562
  const { _parsedProps: props } = this;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.311",
4
+ "version": "0.0.313",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -54,7 +54,7 @@
54
54
  "@tscircuit/footprinter": "^0.0.97",
55
55
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
56
56
  "@tscircuit/math-utils": "^0.0.9",
57
- "@tscircuit/props": "^0.0.145",
57
+ "@tscircuit/props": "^0.0.147",
58
58
  "@tscircuit/schematic-autolayout": "^0.0.6",
59
59
  "@tscircuit/soup-util": "^0.0.41",
60
60
  "circuit-json": "^0.0.136",