@tscircuit/core 0.0.859 → 0.0.861

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.
Files changed (2) hide show
  1. package/dist/index.js +102 -42
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -15770,6 +15770,98 @@ var inflateSourceChip = (sourceElm, inflatorContext) => {
15770
15770
  }
15771
15771
  };
15772
15772
 
15773
+ // lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceCapacitor.ts
15774
+ function inflateSourceCapacitor(sourceElm, inflatorContext) {
15775
+ const { injectionDb, subcircuit, groupsMap } = inflatorContext;
15776
+ const pcbElm = injectionDb.pcb_component.getWhere({
15777
+ source_component_id: sourceElm.source_component_id
15778
+ });
15779
+ const cadElm = injectionDb.cad_component.getWhere({
15780
+ source_component_id: sourceElm.source_component_id
15781
+ });
15782
+ const capacitor = new Capacitor({
15783
+ name: sourceElm.name,
15784
+ capacitance: sourceElm.capacitance
15785
+ });
15786
+ if (pcbElm) {
15787
+ inflatePcbComponent(pcbElm, {
15788
+ ...inflatorContext,
15789
+ normalComponent: capacitor
15790
+ });
15791
+ }
15792
+ if (sourceElm.source_group_id && groupsMap?.has(sourceElm.source_group_id)) {
15793
+ const group = groupsMap.get(sourceElm.source_group_id);
15794
+ group.add(capacitor);
15795
+ } else {
15796
+ subcircuit.add(capacitor);
15797
+ }
15798
+ }
15799
+
15800
+ // lib/components/normal-components/Inductor.ts
15801
+ import { inductorProps } from "@tscircuit/props";
15802
+ import { formatSiUnit as formatSiUnit4 } from "format-si-unit";
15803
+ var Inductor = class extends NormalComponent3 {
15804
+ _adjustSilkscreenTextAutomatically = true;
15805
+ get config() {
15806
+ return {
15807
+ componentName: "Inductor",
15808
+ schematicSymbolName: this.props.symbolName ?? "inductor",
15809
+ zodProps: inductorProps,
15810
+ sourceFtype: FTYPE.simple_inductor
15811
+ };
15812
+ }
15813
+ _getSchematicSymbolDisplayValue() {
15814
+ return `${formatSiUnit4(this._parsedProps.inductance)}H`;
15815
+ }
15816
+ initPorts() {
15817
+ super.initPorts({
15818
+ additionalAliases: {
15819
+ pin1: ["anode", "pos", "left"],
15820
+ pin2: ["cathode", "neg", "right"]
15821
+ }
15822
+ });
15823
+ }
15824
+ doInitialSourceRender() {
15825
+ const { db } = this.root;
15826
+ const { _parsedProps: props } = this;
15827
+ const source_component = db.source_component.insert({
15828
+ name: this.name,
15829
+ ftype: FTYPE.simple_inductor,
15830
+ inductance: props.inductance,
15831
+ supplier_part_numbers: props.supplierPartNumbers,
15832
+ are_pins_interchangeable: true
15833
+ });
15834
+ this.source_component_id = source_component.source_component_id;
15835
+ }
15836
+ };
15837
+
15838
+ // lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceInductor.ts
15839
+ function inflateSourceInductor(sourceElm, inflatorContext) {
15840
+ const { injectionDb, subcircuit, groupsMap } = inflatorContext;
15841
+ const pcbElm = injectionDb.pcb_component.getWhere({
15842
+ source_component_id: sourceElm.source_component_id
15843
+ });
15844
+ const cadElm = injectionDb.cad_component.getWhere({
15845
+ source_component_id: sourceElm.source_component_id
15846
+ });
15847
+ const inductor = new Inductor({
15848
+ name: sourceElm.name,
15849
+ inductance: sourceElm.inductance
15850
+ });
15851
+ if (pcbElm) {
15852
+ inflatePcbComponent(pcbElm, {
15853
+ ...inflatorContext,
15854
+ normalComponent: inductor
15855
+ });
15856
+ }
15857
+ if (sourceElm.source_group_id && groupsMap?.has(sourceElm.source_group_id)) {
15858
+ const group = groupsMap.get(sourceElm.source_group_id);
15859
+ group.add(inductor);
15860
+ } else {
15861
+ subcircuit.add(inductor);
15862
+ }
15863
+ }
15864
+
15773
15865
  // lib/components/primitive-components/Group/Subcircuit/Subcircuit.ts
15774
15866
  var Subcircuit = class extends Group6 {
15775
15867
  constructor(props) {
@@ -15815,6 +15907,12 @@ var Subcircuit = class extends Group6 {
15815
15907
  case "simple_resistor":
15816
15908
  inflateSourceResistor(sourceComponent, inflationCtx);
15817
15909
  break;
15910
+ case "simple_capacitor":
15911
+ inflateSourceCapacitor(sourceComponent, inflationCtx);
15912
+ break;
15913
+ case "simple_inductor":
15914
+ inflateSourceInductor(sourceComponent, inflationCtx);
15915
+ break;
15818
15916
  case "simple_chip":
15819
15917
  inflateSourceChip(sourceComponent, inflationCtx);
15820
15918
  break;
@@ -16613,7 +16711,7 @@ var PinHeader = class extends NormalComponent3 {
16613
16711
 
16614
16712
  // lib/components/normal-components/Resonator.ts
16615
16713
  import { resonatorProps } from "@tscircuit/props";
16616
- import { formatSiUnit as formatSiUnit4 } from "format-si-unit";
16714
+ import { formatSiUnit as formatSiUnit5 } from "format-si-unit";
16617
16715
  function getResonatorSymbolName(variant) {
16618
16716
  switch (variant) {
16619
16717
  case "two_ground_pins":
@@ -16651,52 +16749,14 @@ var Resonator = class extends NormalComponent3 {
16651
16749
  this.source_component_id = source_component.source_component_id;
16652
16750
  }
16653
16751
  _getSchematicSymbolDisplayValue() {
16654
- const freqDisplay = `${formatSiUnit4(this._parsedProps.frequency)}Hz`;
16752
+ const freqDisplay = `${formatSiUnit5(this._parsedProps.frequency)}Hz`;
16655
16753
  if (this._parsedProps.loadCapacitance) {
16656
- return `${freqDisplay} / ${formatSiUnit4(this._parsedProps.loadCapacitance)}F`;
16754
+ return `${freqDisplay} / ${formatSiUnit5(this._parsedProps.loadCapacitance)}F`;
16657
16755
  }
16658
16756
  return freqDisplay;
16659
16757
  }
16660
16758
  };
16661
16759
 
16662
- // lib/components/normal-components/Inductor.ts
16663
- import { inductorProps } from "@tscircuit/props";
16664
- import { formatSiUnit as formatSiUnit5 } from "format-si-unit";
16665
- var Inductor = class extends NormalComponent3 {
16666
- _adjustSilkscreenTextAutomatically = true;
16667
- get config() {
16668
- return {
16669
- componentName: "Inductor",
16670
- schematicSymbolName: this.props.symbolName ?? "inductor",
16671
- zodProps: inductorProps,
16672
- sourceFtype: FTYPE.simple_inductor
16673
- };
16674
- }
16675
- _getSchematicSymbolDisplayValue() {
16676
- return `${formatSiUnit5(this._parsedProps.inductance)}H`;
16677
- }
16678
- initPorts() {
16679
- super.initPorts({
16680
- additionalAliases: {
16681
- pin1: ["anode", "pos", "left"],
16682
- pin2: ["cathode", "neg", "right"]
16683
- }
16684
- });
16685
- }
16686
- doInitialSourceRender() {
16687
- const { db } = this.root;
16688
- const { _parsedProps: props } = this;
16689
- const source_component = db.source_component.insert({
16690
- name: this.name,
16691
- ftype: FTYPE.simple_inductor,
16692
- inductance: props.inductance,
16693
- supplier_part_numbers: props.supplierPartNumbers,
16694
- are_pins_interchangeable: true
16695
- });
16696
- this.source_component_id = source_component.source_component_id;
16697
- }
16698
- };
16699
-
16700
16760
  // lib/components/normal-components/Potentiometer.ts
16701
16761
  import { potentiometerProps } from "@tscircuit/props";
16702
16762
  import { formatSiUnit as formatSiUnit6 } from "format-si-unit";
@@ -17715,7 +17775,7 @@ import { identity as identity6 } from "transformation-matrix";
17715
17775
  var package_default = {
17716
17776
  name: "@tscircuit/core",
17717
17777
  type: "module",
17718
- version: "0.0.858",
17778
+ version: "0.0.860",
17719
17779
  types: "dist/index.d.ts",
17720
17780
  main: "dist/index.js",
17721
17781
  module: "dist/index.js",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.859",
4
+ "version": "0.0.861",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",