@tscircuit/core 0.0.860 → 0.0.862
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.js +101 -42
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15797,6 +15797,97 @@ function inflateSourceCapacitor(sourceElm, inflatorContext) {
|
|
|
15797
15797
|
}
|
|
15798
15798
|
}
|
|
15799
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
|
+
|
|
15865
|
+
// lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceDiode.ts
|
|
15866
|
+
function inflateSourceDiode(sourceElm, inflatorContext) {
|
|
15867
|
+
const { injectionDb, subcircuit, groupsMap } = inflatorContext;
|
|
15868
|
+
const pcbElm = injectionDb.pcb_component.getWhere({
|
|
15869
|
+
source_component_id: sourceElm.source_component_id
|
|
15870
|
+
});
|
|
15871
|
+
const cadElm = injectionDb.cad_component.getWhere({
|
|
15872
|
+
source_component_id: sourceElm.source_component_id
|
|
15873
|
+
});
|
|
15874
|
+
const diode = new Diode({
|
|
15875
|
+
name: sourceElm.name
|
|
15876
|
+
});
|
|
15877
|
+
if (pcbElm) {
|
|
15878
|
+
inflatePcbComponent(pcbElm, {
|
|
15879
|
+
...inflatorContext,
|
|
15880
|
+
normalComponent: diode
|
|
15881
|
+
});
|
|
15882
|
+
}
|
|
15883
|
+
if (sourceElm.source_group_id && groupsMap?.has(sourceElm.source_group_id)) {
|
|
15884
|
+
const group = groupsMap.get(sourceElm.source_group_id);
|
|
15885
|
+
group.add(diode);
|
|
15886
|
+
} else {
|
|
15887
|
+
subcircuit.add(diode);
|
|
15888
|
+
}
|
|
15889
|
+
}
|
|
15890
|
+
|
|
15800
15891
|
// lib/components/primitive-components/Group/Subcircuit/Subcircuit.ts
|
|
15801
15892
|
var Subcircuit = class extends Group6 {
|
|
15802
15893
|
constructor(props) {
|
|
@@ -15845,6 +15936,12 @@ var Subcircuit = class extends Group6 {
|
|
|
15845
15936
|
case "simple_capacitor":
|
|
15846
15937
|
inflateSourceCapacitor(sourceComponent, inflationCtx);
|
|
15847
15938
|
break;
|
|
15939
|
+
case "simple_inductor":
|
|
15940
|
+
inflateSourceInductor(sourceComponent, inflationCtx);
|
|
15941
|
+
break;
|
|
15942
|
+
case "simple_diode":
|
|
15943
|
+
inflateSourceDiode(sourceComponent, inflationCtx);
|
|
15944
|
+
break;
|
|
15848
15945
|
case "simple_chip":
|
|
15849
15946
|
inflateSourceChip(sourceComponent, inflationCtx);
|
|
15850
15947
|
break;
|
|
@@ -16643,7 +16740,7 @@ var PinHeader = class extends NormalComponent3 {
|
|
|
16643
16740
|
|
|
16644
16741
|
// lib/components/normal-components/Resonator.ts
|
|
16645
16742
|
import { resonatorProps } from "@tscircuit/props";
|
|
16646
|
-
import { formatSiUnit as
|
|
16743
|
+
import { formatSiUnit as formatSiUnit5 } from "format-si-unit";
|
|
16647
16744
|
function getResonatorSymbolName(variant) {
|
|
16648
16745
|
switch (variant) {
|
|
16649
16746
|
case "two_ground_pins":
|
|
@@ -16681,52 +16778,14 @@ var Resonator = class extends NormalComponent3 {
|
|
|
16681
16778
|
this.source_component_id = source_component.source_component_id;
|
|
16682
16779
|
}
|
|
16683
16780
|
_getSchematicSymbolDisplayValue() {
|
|
16684
|
-
const freqDisplay = `${
|
|
16781
|
+
const freqDisplay = `${formatSiUnit5(this._parsedProps.frequency)}Hz`;
|
|
16685
16782
|
if (this._parsedProps.loadCapacitance) {
|
|
16686
|
-
return `${freqDisplay} / ${
|
|
16783
|
+
return `${freqDisplay} / ${formatSiUnit5(this._parsedProps.loadCapacitance)}F`;
|
|
16687
16784
|
}
|
|
16688
16785
|
return freqDisplay;
|
|
16689
16786
|
}
|
|
16690
16787
|
};
|
|
16691
16788
|
|
|
16692
|
-
// lib/components/normal-components/Inductor.ts
|
|
16693
|
-
import { inductorProps } from "@tscircuit/props";
|
|
16694
|
-
import { formatSiUnit as formatSiUnit5 } from "format-si-unit";
|
|
16695
|
-
var Inductor = class extends NormalComponent3 {
|
|
16696
|
-
_adjustSilkscreenTextAutomatically = true;
|
|
16697
|
-
get config() {
|
|
16698
|
-
return {
|
|
16699
|
-
componentName: "Inductor",
|
|
16700
|
-
schematicSymbolName: this.props.symbolName ?? "inductor",
|
|
16701
|
-
zodProps: inductorProps,
|
|
16702
|
-
sourceFtype: FTYPE.simple_inductor
|
|
16703
|
-
};
|
|
16704
|
-
}
|
|
16705
|
-
_getSchematicSymbolDisplayValue() {
|
|
16706
|
-
return `${formatSiUnit5(this._parsedProps.inductance)}H`;
|
|
16707
|
-
}
|
|
16708
|
-
initPorts() {
|
|
16709
|
-
super.initPorts({
|
|
16710
|
-
additionalAliases: {
|
|
16711
|
-
pin1: ["anode", "pos", "left"],
|
|
16712
|
-
pin2: ["cathode", "neg", "right"]
|
|
16713
|
-
}
|
|
16714
|
-
});
|
|
16715
|
-
}
|
|
16716
|
-
doInitialSourceRender() {
|
|
16717
|
-
const { db } = this.root;
|
|
16718
|
-
const { _parsedProps: props } = this;
|
|
16719
|
-
const source_component = db.source_component.insert({
|
|
16720
|
-
name: this.name,
|
|
16721
|
-
ftype: FTYPE.simple_inductor,
|
|
16722
|
-
inductance: props.inductance,
|
|
16723
|
-
supplier_part_numbers: props.supplierPartNumbers,
|
|
16724
|
-
are_pins_interchangeable: true
|
|
16725
|
-
});
|
|
16726
|
-
this.source_component_id = source_component.source_component_id;
|
|
16727
|
-
}
|
|
16728
|
-
};
|
|
16729
|
-
|
|
16730
16789
|
// lib/components/normal-components/Potentiometer.ts
|
|
16731
16790
|
import { potentiometerProps } from "@tscircuit/props";
|
|
16732
16791
|
import { formatSiUnit as formatSiUnit6 } from "format-si-unit";
|
|
@@ -17745,7 +17804,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
17745
17804
|
var package_default = {
|
|
17746
17805
|
name: "@tscircuit/core",
|
|
17747
17806
|
type: "module",
|
|
17748
|
-
version: "0.0.
|
|
17807
|
+
version: "0.0.861",
|
|
17749
17808
|
types: "dist/index.d.ts",
|
|
17750
17809
|
main: "dist/index.js",
|
|
17751
17810
|
module: "dist/index.js",
|