@tscircuit/core 0.0.867 → 0.0.868
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 +76 -46
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16082,6 +16082,78 @@ function inflateSourceTrace(sourceTrace, inflatorContext) {
|
|
|
16082
16082
|
subcircuit.add(trace);
|
|
16083
16083
|
}
|
|
16084
16084
|
|
|
16085
|
+
// lib/components/normal-components/Transistor.ts
|
|
16086
|
+
import { transistorProps } from "@tscircuit/props";
|
|
16087
|
+
var Transistor = class extends NormalComponent3 {
|
|
16088
|
+
get config() {
|
|
16089
|
+
const baseSymbolName = this.props.type === "npn" ? "npn_bipolar_transistor" : "pnp_bipolar_transistor";
|
|
16090
|
+
return {
|
|
16091
|
+
componentName: "Transistor",
|
|
16092
|
+
schematicSymbolName: this.props.symbolName ?? baseSymbolName,
|
|
16093
|
+
zodProps: transistorProps,
|
|
16094
|
+
sourceFtype: "simple_transistor",
|
|
16095
|
+
shouldRenderAsSchematicBox: false
|
|
16096
|
+
};
|
|
16097
|
+
}
|
|
16098
|
+
initPorts() {
|
|
16099
|
+
const pinAliases = {
|
|
16100
|
+
pin1: ["collector", "c"],
|
|
16101
|
+
pin2: ["emitter", "e"],
|
|
16102
|
+
pin3: ["base", "b"]
|
|
16103
|
+
};
|
|
16104
|
+
super.initPorts({
|
|
16105
|
+
pinCount: 3,
|
|
16106
|
+
additionalAliases: pinAliases
|
|
16107
|
+
});
|
|
16108
|
+
}
|
|
16109
|
+
emitter = this.portMap.pin1;
|
|
16110
|
+
collector = this.portMap.pin2;
|
|
16111
|
+
base = this.portMap.pin3;
|
|
16112
|
+
doInitialCreateNetsFromProps() {
|
|
16113
|
+
this._createNetsFromProps([...this._getNetsFromConnectionsProp()]);
|
|
16114
|
+
}
|
|
16115
|
+
doInitialCreateTracesFromProps() {
|
|
16116
|
+
this._createTracesFromConnectionsProp();
|
|
16117
|
+
}
|
|
16118
|
+
doInitialSourceRender() {
|
|
16119
|
+
const { db } = this.root;
|
|
16120
|
+
const { _parsedProps: props } = this;
|
|
16121
|
+
const source_component = db.source_component.insert({
|
|
16122
|
+
ftype: "simple_transistor",
|
|
16123
|
+
name: this.name,
|
|
16124
|
+
transistor_type: props.type
|
|
16125
|
+
});
|
|
16126
|
+
this.source_component_id = source_component.source_component_id;
|
|
16127
|
+
}
|
|
16128
|
+
};
|
|
16129
|
+
|
|
16130
|
+
// lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceTransistor.ts
|
|
16131
|
+
function inflateSourceTransistor(sourceElm, inflatorContext) {
|
|
16132
|
+
const { injectionDb, subcircuit, groupsMap } = inflatorContext;
|
|
16133
|
+
const pcbElm = injectionDb.pcb_component.getWhere({
|
|
16134
|
+
source_component_id: sourceElm.source_component_id
|
|
16135
|
+
});
|
|
16136
|
+
const cadElm = injectionDb.cad_component.getWhere({
|
|
16137
|
+
source_component_id: sourceElm.source_component_id
|
|
16138
|
+
});
|
|
16139
|
+
const transistor = new Transistor({
|
|
16140
|
+
name: sourceElm.name,
|
|
16141
|
+
type: sourceElm.transistor_type
|
|
16142
|
+
});
|
|
16143
|
+
if (pcbElm) {
|
|
16144
|
+
inflatePcbComponent(pcbElm, {
|
|
16145
|
+
...inflatorContext,
|
|
16146
|
+
normalComponent: transistor
|
|
16147
|
+
});
|
|
16148
|
+
}
|
|
16149
|
+
if (sourceElm.source_group_id && groupsMap?.has(sourceElm.source_group_id)) {
|
|
16150
|
+
const group = groupsMap.get(sourceElm.source_group_id);
|
|
16151
|
+
group.add(transistor);
|
|
16152
|
+
} else {
|
|
16153
|
+
subcircuit.add(transistor);
|
|
16154
|
+
}
|
|
16155
|
+
}
|
|
16156
|
+
|
|
16085
16157
|
// lib/components/primitive-components/Group/Subcircuit/Subcircuit.ts
|
|
16086
16158
|
var Subcircuit = class extends Group6 {
|
|
16087
16159
|
constructor(props) {
|
|
@@ -16139,6 +16211,9 @@ var Subcircuit = class extends Group6 {
|
|
|
16139
16211
|
case "simple_chip":
|
|
16140
16212
|
inflateSourceChip(sourceComponent, inflationCtx);
|
|
16141
16213
|
break;
|
|
16214
|
+
case "simple_transistor":
|
|
16215
|
+
inflateSourceTransistor(sourceComponent, inflationCtx);
|
|
16216
|
+
break;
|
|
16142
16217
|
default:
|
|
16143
16218
|
throw new Error(
|
|
16144
16219
|
`No inflator implemented for source component ftype: "${sourceComponent.ftype}"`
|
|
@@ -17141,51 +17216,6 @@ var Crystal = class extends NormalComponent3 {
|
|
|
17141
17216
|
}
|
|
17142
17217
|
};
|
|
17143
17218
|
|
|
17144
|
-
// lib/components/normal-components/Transistor.ts
|
|
17145
|
-
import { transistorProps } from "@tscircuit/props";
|
|
17146
|
-
var Transistor = class extends NormalComponent3 {
|
|
17147
|
-
get config() {
|
|
17148
|
-
const baseSymbolName = this.props.type === "npn" ? "npn_bipolar_transistor" : "pnp_bipolar_transistor";
|
|
17149
|
-
return {
|
|
17150
|
-
componentName: "Transistor",
|
|
17151
|
-
schematicSymbolName: this.props.symbolName ?? baseSymbolName,
|
|
17152
|
-
zodProps: transistorProps,
|
|
17153
|
-
sourceFtype: "simple_transistor",
|
|
17154
|
-
shouldRenderAsSchematicBox: false
|
|
17155
|
-
};
|
|
17156
|
-
}
|
|
17157
|
-
initPorts() {
|
|
17158
|
-
const pinAliases = {
|
|
17159
|
-
pin1: ["collector", "c"],
|
|
17160
|
-
pin2: ["emitter", "e"],
|
|
17161
|
-
pin3: ["base", "b"]
|
|
17162
|
-
};
|
|
17163
|
-
super.initPorts({
|
|
17164
|
-
pinCount: 3,
|
|
17165
|
-
additionalAliases: pinAliases
|
|
17166
|
-
});
|
|
17167
|
-
}
|
|
17168
|
-
emitter = this.portMap.pin1;
|
|
17169
|
-
collector = this.portMap.pin2;
|
|
17170
|
-
base = this.portMap.pin3;
|
|
17171
|
-
doInitialCreateNetsFromProps() {
|
|
17172
|
-
this._createNetsFromProps([...this._getNetsFromConnectionsProp()]);
|
|
17173
|
-
}
|
|
17174
|
-
doInitialCreateTracesFromProps() {
|
|
17175
|
-
this._createTracesFromConnectionsProp();
|
|
17176
|
-
}
|
|
17177
|
-
doInitialSourceRender() {
|
|
17178
|
-
const { db } = this.root;
|
|
17179
|
-
const { _parsedProps: props } = this;
|
|
17180
|
-
const source_component = db.source_component.insert({
|
|
17181
|
-
ftype: "simple_transistor",
|
|
17182
|
-
name: this.name,
|
|
17183
|
-
transistor_type: props.type
|
|
17184
|
-
});
|
|
17185
|
-
this.source_component_id = source_component.source_component_id;
|
|
17186
|
-
}
|
|
17187
|
-
};
|
|
17188
|
-
|
|
17189
17219
|
// lib/components/normal-components/Mosfet.ts
|
|
17190
17220
|
import { mosfetProps } from "@tscircuit/props";
|
|
17191
17221
|
var Mosfet = class extends NormalComponent3 {
|
|
@@ -18002,7 +18032,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
18002
18032
|
var package_default = {
|
|
18003
18033
|
name: "@tscircuit/core",
|
|
18004
18034
|
type: "module",
|
|
18005
|
-
version: "0.0.
|
|
18035
|
+
version: "0.0.867",
|
|
18006
18036
|
types: "dist/index.d.ts",
|
|
18007
18037
|
main: "dist/index.js",
|
|
18008
18038
|
module: "dist/index.js",
|