@tscircuit/core 0.0.388 → 0.0.390

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
@@ -3314,6 +3314,7 @@ declare class Diode extends NormalComponent<typeof diodeProps, PolarizedPassiveP
3314
3314
  sourceFtype: Ftype;
3315
3315
  };
3316
3316
  initPorts(): void;
3317
+ doInitialSourceRender(): void;
3317
3318
  pos: Port;
3318
3319
  anode: Port;
3319
3320
  neg: Port;
@@ -4346,6 +4347,7 @@ declare class Led extends NormalComponent<typeof ledProps, PolarizedPassivePorts
4346
4347
  sourceFtype: Ftype;
4347
4348
  };
4348
4349
  initPorts(): void;
4350
+ doInitialSourceRender(): void;
4349
4351
  pos: Port;
4350
4352
  anode: Port;
4351
4353
  neg: Port;
@@ -4756,6 +4758,7 @@ declare class PowerSource extends NormalComponent<typeof powerSourceProps, Polar
4756
4758
  sourceFtype: Ftype;
4757
4759
  };
4758
4760
  initPorts(): void;
4761
+ doInitialSourceRender(): void;
4759
4762
  pos: Port;
4760
4763
  positive: Port;
4761
4764
  neg: Port;
package/dist/index.js CHANGED
@@ -6898,7 +6898,8 @@ var Capacitor = class extends NormalComponent {
6898
6898
  capacitance: props.capacitance,
6899
6899
  max_voltage_rating: props.maxVoltageRating,
6900
6900
  max_decoupling_trace_length: props.maxDecouplingTraceLength,
6901
- display_capacitance: this._getSchematicSymbolDisplayValue()
6901
+ display_capacitance: this._getSchematicSymbolDisplayValue(),
6902
+ are_pins_interchangeable: !props.polarized
6902
6903
  });
6903
6904
  this.source_component_id = source_component.source_component_id;
6904
6905
  }
@@ -6984,6 +6985,19 @@ var Diode = class extends NormalComponent {
6984
6985
  }
6985
6986
  });
6986
6987
  }
6988
+ doInitialSourceRender() {
6989
+ const { db } = this.root;
6990
+ const { _parsedProps: props } = this;
6991
+ const source_component = db.source_component.insert({
6992
+ ftype: "simple_diode",
6993
+ name: props.name,
6994
+ // @ts-ignore
6995
+ manufacturer_part_number: props.manufacturerPartNumber ?? props.mfn,
6996
+ supplier_part_numbers: props.supplierPartNumbers,
6997
+ are_pins_interchangeable: false
6998
+ });
6999
+ this.source_component_id = source_component.source_component_id;
7000
+ }
6987
7001
  pos = this.portMap.pin1;
6988
7002
  anode = this.portMap.pin1;
6989
7003
  neg = this.portMap.pin2;
@@ -7009,7 +7023,8 @@ var Jumper = class extends NormalComponent {
7009
7023
  // TODO unknown or jumper
7010
7024
  name: props.name,
7011
7025
  manufacturer_part_number: props.manufacturerPartNumber,
7012
- supplier_part_numbers: props.supplierPartNumbers
7026
+ supplier_part_numbers: props.supplierPartNumbers,
7027
+ are_pins_interchangeable: true
7013
7028
  });
7014
7029
  this.source_component_id = source_component.source_component_id;
7015
7030
  }
@@ -7052,6 +7067,19 @@ var Led = class extends NormalComponent {
7052
7067
  }
7053
7068
  });
7054
7069
  }
7070
+ doInitialSourceRender() {
7071
+ const { db } = this.root;
7072
+ const { _parsedProps: props } = this;
7073
+ const source_component = db.source_component.insert({
7074
+ ftype: "simple_diode",
7075
+ name: props.name,
7076
+ // @ts-ignore
7077
+ manufacturer_part_number: props.manufacturerPartNumber ?? props.mfn,
7078
+ supplier_part_numbers: props.supplierPartNumbers,
7079
+ are_pins_interchangeable: false
7080
+ });
7081
+ this.source_component_id = source_component.source_component_id;
7082
+ }
7055
7083
  pos = this.portMap.pin1;
7056
7084
  anode = this.portMap.pin1;
7057
7085
  neg = this.portMap.pin2;
@@ -7079,6 +7107,18 @@ var PowerSource = class extends NormalComponent {
7079
7107
  new Port({ name: "pin2", pinNumber: 2, aliases: ["negative", "neg"] })
7080
7108
  );
7081
7109
  }
7110
+ doInitialSourceRender() {
7111
+ const { db } = this.root;
7112
+ const { _parsedProps: props } = this;
7113
+ const source_component = db.source_component.insert({
7114
+ ftype: "simple_power_source",
7115
+ name: props.name,
7116
+ voltage: props.voltage,
7117
+ supplier_part_numbers: props.supplierPartNumbers,
7118
+ are_pins_interchangeable: false
7119
+ });
7120
+ this.source_component_id = source_component.source_component_id;
7121
+ }
7082
7122
  pos = this.portMap.pin1;
7083
7123
  positive = this.portMap.pin1;
7084
7124
  neg = this.portMap.pin2;
@@ -7142,7 +7182,8 @@ var Resistor = class extends NormalComponent {
7142
7182
  manufacturer_part_number: props.manufacturerPartNumber ?? props.mfn,
7143
7183
  supplier_part_numbers: props.supplierPartNumbers,
7144
7184
  resistance: props.resistance,
7145
- display_resistance: this._getSchematicSymbolDisplayValue()
7185
+ display_resistance: this._getSchematicSymbolDisplayValue(),
7186
+ are_pins_interchangeable: true
7146
7187
  });
7147
7188
  this.source_component_id = source_component.source_component_id;
7148
7189
  }
@@ -7549,7 +7590,8 @@ var Battery = class extends NormalComponent {
7549
7590
  name: props.name,
7550
7591
  ftype: "simple_power_source",
7551
7592
  capacity: props.capacity,
7552
- supplier_part_numbers: props.supplierPartNumbers
7593
+ supplier_part_numbers: props.supplierPartNumbers,
7594
+ are_pins_interchangeable: false
7553
7595
  });
7554
7596
  this.source_component_id = source_component.source_component_id;
7555
7597
  }
@@ -7608,7 +7650,8 @@ var PinHeader = class extends NormalComponent {
7608
7650
  name: props.name,
7609
7651
  supplier_part_numbers: props.supplierPartNumbers,
7610
7652
  pin_count: props.pinCount,
7611
- gender: props.gender
7653
+ gender: props.gender,
7654
+ are_pins_interchangeable: true
7612
7655
  });
7613
7656
  this.source_component_id = source_component.source_component_id;
7614
7657
  }
@@ -7640,13 +7683,15 @@ var Resonator = class extends NormalComponent {
7640
7683
  doInitialSourceRender() {
7641
7684
  const { db } = this.root;
7642
7685
  const { _parsedProps: props } = this;
7686
+ const pinVariant = props.pinVariant || "no_ground";
7643
7687
  const source_component = db.source_component.insert({
7644
7688
  ftype: "simple_resonator",
7645
7689
  name: props.name,
7646
7690
  frequency: props.frequency,
7647
7691
  load_capacitance: props.loadCapacitance,
7648
7692
  supplier_part_numbers: props.supplierPartNumbers,
7649
- pin_variant: props.pinVariant || "no_ground"
7693
+ pin_variant: pinVariant,
7694
+ are_pins_interchangeable: pinVariant === "no_ground" || pinVariant === "ground_pin"
7650
7695
  });
7651
7696
  this.source_component_id = source_component.source_component_id;
7652
7697
  }
@@ -7678,7 +7723,8 @@ var Inductor = class extends NormalComponent {
7678
7723
  name: props.name,
7679
7724
  ftype: FTYPE.simple_inductor,
7680
7725
  inductance: props.inductance,
7681
- supplier_part_numbers: props.supplierPartNumbers
7726
+ supplier_part_numbers: props.supplierPartNumbers,
7727
+ are_pins_interchangeable: true
7682
7728
  });
7683
7729
  this.source_component_id = source_component.source_component_id;
7684
7730
  }
@@ -7708,11 +7754,13 @@ var Potentiometer = class extends NormalComponent {
7708
7754
  doInitialSourceRender() {
7709
7755
  const { db } = this.root;
7710
7756
  const { _parsedProps: props } = this;
7757
+ const pinVariant = props.pinVariant || "two_pin";
7711
7758
  const source_component = db.source_component.insert({
7712
7759
  ftype: "simple_potentiometer",
7713
7760
  name: props.name,
7714
7761
  max_resistance: props.maxResistance,
7715
- pin_variant: props.pinVariant || "two_pin"
7762
+ pin_variant: pinVariant,
7763
+ are_pins_interchangeable: pinVariant === "two_pin"
7716
7764
  });
7717
7765
  this.source_component_id = source_component.source_component_id;
7718
7766
  }
@@ -7750,7 +7798,8 @@ var PushButton = class extends NormalComponent {
7750
7798
  const source_component = db.source_component.insert({
7751
7799
  name: props.name,
7752
7800
  ftype: FTYPE.simple_push_button,
7753
- supplier_part_numbers: props.supplierPartNumbers
7801
+ supplier_part_numbers: props.supplierPartNumbers,
7802
+ are_pins_interchangeable: true
7754
7803
  });
7755
7804
  this.source_component_id = source_component.source_component_id;
7756
7805
  }
@@ -7795,7 +7844,8 @@ var Crystal = class extends NormalComponent {
7795
7844
  ftype: "simple_crystal",
7796
7845
  frequency: props.frequency,
7797
7846
  load_capacitance: props.loadCapacitance,
7798
- pin_variant: props.pinVariant || "two_pin"
7847
+ pin_variant: props.pinVariant || "two_pin",
7848
+ are_pins_interchangeable: (props.pinVariant || "two_pin") === "two_pin"
7799
7849
  });
7800
7850
  this.source_component_id = source_component.source_component_id;
7801
7851
  }
@@ -7815,13 +7865,18 @@ var Transistor = class extends NormalComponent {
7815
7865
  };
7816
7866
  }
7817
7867
  initPorts() {
7868
+ const pinAliases = this.props.type === "npn" ? {
7869
+ pin1: ["emitter", "e"],
7870
+ pin2: ["collector", "c"],
7871
+ pin3: ["base", "b"]
7872
+ } : {
7873
+ pin1: ["collector", "c"],
7874
+ pin2: ["emitter", "e"],
7875
+ pin3: ["base", "b"]
7876
+ };
7818
7877
  super.initPorts({
7819
7878
  pinCount: 3,
7820
- additionalAliases: {
7821
- pin1: ["emitter", "e"],
7822
- pin2: ["collector", "c"],
7823
- pin3: ["base", "b"]
7824
- }
7879
+ additionalAliases: pinAliases
7825
7880
  });
7826
7881
  }
7827
7882
  emitter = this.portMap.pin1;
@@ -7901,7 +7956,8 @@ var Switch = class extends NormalComponent {
7901
7956
  ftype: "simple_switch",
7902
7957
  name: props.name,
7903
7958
  switch_type: props.type,
7904
- is_normally_closed: props.isNormallyClosed ?? false
7959
+ is_normally_closed: props.isNormallyClosed ?? false,
7960
+ are_pins_interchangeable: this._getSwitchType() === "spst"
7905
7961
  });
7906
7962
  this.source_component_id = source_component.source_component_id;
7907
7963
  }
@@ -7916,7 +7972,7 @@ import { identity as identity4 } from "transformation-matrix";
7916
7972
  var package_default = {
7917
7973
  name: "@tscircuit/core",
7918
7974
  type: "module",
7919
- version: "0.0.387",
7975
+ version: "0.0.389",
7920
7976
  types: "dist/index.d.ts",
7921
7977
  main: "dist/index.js",
7922
7978
  module: "dist/index.js",
@@ -7976,7 +8032,7 @@ var package_default = {
7976
8032
  "@tscircuit/math-utils": "^0.0.14",
7977
8033
  "@tscircuit/props": "^0.0.172",
7978
8034
  "@tscircuit/schematic-autolayout": "^0.0.6",
7979
- "circuit-json": "0.0.160",
8035
+ "circuit-json": "0.0.164",
7980
8036
  "circuit-json-to-connectivity-map": "^0.0.20",
7981
8037
  "css-select": "^5.1.0",
7982
8038
  "format-si-unit": "^0.0.3",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.388",
4
+ "version": "0.0.390",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -61,7 +61,7 @@
61
61
  "@tscircuit/math-utils": "^0.0.14",
62
62
  "@tscircuit/props": "^0.0.172",
63
63
  "@tscircuit/schematic-autolayout": "^0.0.6",
64
- "circuit-json": "0.0.160",
64
+ "circuit-json": "0.0.164",
65
65
  "circuit-json-to-connectivity-map": "^0.0.20",
66
66
  "css-select": "^5.1.0",
67
67
  "format-si-unit": "^0.0.3",