@tscircuit/core 0.0.943 → 0.0.944
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 +1158 -2
- package/dist/index.js +111 -11
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ __export(components_exports, {
|
|
|
20
20
|
CopperPour: () => CopperPour,
|
|
21
21
|
CopperText: () => CopperText,
|
|
22
22
|
Crystal: () => Crystal,
|
|
23
|
+
CurrentSource: () => CurrentSource,
|
|
23
24
|
Cutout: () => Cutout,
|
|
24
25
|
Diode: () => Diode,
|
|
25
26
|
FabricationNoteDimension: () => FabricationNoteDimension,
|
|
@@ -17035,6 +17036,104 @@ var VoltageSource = class extends NormalComponent3 {
|
|
|
17035
17036
|
terminal2 = this.portMap.terminal2;
|
|
17036
17037
|
};
|
|
17037
17038
|
|
|
17039
|
+
// lib/components/normal-components/CurrentSource.ts
|
|
17040
|
+
import { currentSourceProps } from "@tscircuit/props";
|
|
17041
|
+
import { formatSiUnit as formatSiUnit6 } from "format-si-unit";
|
|
17042
|
+
var CurrentSource = class extends NormalComponent3 {
|
|
17043
|
+
get config() {
|
|
17044
|
+
const symbolName = "current_source";
|
|
17045
|
+
return {
|
|
17046
|
+
componentName: "CurrentSource",
|
|
17047
|
+
schematicSymbolName: symbolName,
|
|
17048
|
+
zodProps: currentSourceProps,
|
|
17049
|
+
sourceFtype: "simple_current_source"
|
|
17050
|
+
};
|
|
17051
|
+
}
|
|
17052
|
+
runRenderPhaseForChildren(phase) {
|
|
17053
|
+
if (phase.startsWith("Pcb")) {
|
|
17054
|
+
return;
|
|
17055
|
+
}
|
|
17056
|
+
for (const child of this.children) {
|
|
17057
|
+
child.runRenderPhaseForChildren(phase);
|
|
17058
|
+
child.runRenderPhase(phase);
|
|
17059
|
+
}
|
|
17060
|
+
}
|
|
17061
|
+
doInitialPcbComponentRender() {
|
|
17062
|
+
}
|
|
17063
|
+
initPorts() {
|
|
17064
|
+
super.initPorts({
|
|
17065
|
+
additionalAliases: {
|
|
17066
|
+
pin1: ["pos"],
|
|
17067
|
+
pin2: ["neg"]
|
|
17068
|
+
}
|
|
17069
|
+
});
|
|
17070
|
+
}
|
|
17071
|
+
_getSchematicSymbolDisplayValue() {
|
|
17072
|
+
const { current, frequency: frequency2, peakToPeakCurrent } = this._parsedProps;
|
|
17073
|
+
const parts = [];
|
|
17074
|
+
if (current !== void 0) {
|
|
17075
|
+
parts.push(`${formatSiUnit6(current)}A`);
|
|
17076
|
+
}
|
|
17077
|
+
if (peakToPeakCurrent !== void 0) {
|
|
17078
|
+
parts.push(`${formatSiUnit6(peakToPeakCurrent)}A p-p`);
|
|
17079
|
+
}
|
|
17080
|
+
if (frequency2 !== void 0) {
|
|
17081
|
+
parts.push(`${formatSiUnit6(frequency2)}Hz`);
|
|
17082
|
+
}
|
|
17083
|
+
return parts.length > 0 ? parts.join(" ") : void 0;
|
|
17084
|
+
}
|
|
17085
|
+
doInitialSourceRender() {
|
|
17086
|
+
const { db } = this.root;
|
|
17087
|
+
const { _parsedProps: props } = this;
|
|
17088
|
+
const source_component = db.source_component.insert({
|
|
17089
|
+
ftype: "simple_current_source",
|
|
17090
|
+
name: this.name,
|
|
17091
|
+
current: props.current,
|
|
17092
|
+
frequency: props.frequency,
|
|
17093
|
+
peak_to_peak_current: props.peakToPeakCurrent,
|
|
17094
|
+
wave_shape: props.waveShape,
|
|
17095
|
+
phase: props.phase,
|
|
17096
|
+
duty_cycle: props.dutyCycle,
|
|
17097
|
+
supplier_part_numbers: props.supplierPartNumbers,
|
|
17098
|
+
are_pins_interchangeable: true
|
|
17099
|
+
});
|
|
17100
|
+
this.source_component_id = source_component.source_component_id;
|
|
17101
|
+
}
|
|
17102
|
+
doInitialSimulationRender() {
|
|
17103
|
+
const { db } = this.root;
|
|
17104
|
+
const { _parsedProps: props } = this;
|
|
17105
|
+
const isAc = props.frequency !== void 0 || props.peakToPeakCurrent !== void 0 || props.waveShape !== void 0;
|
|
17106
|
+
const posPort = this.portMap.pos;
|
|
17107
|
+
const negPort = this.portMap.neg;
|
|
17108
|
+
if (isAc) {
|
|
17109
|
+
db.simulation_current_source.insert({
|
|
17110
|
+
type: "simulation_current_source",
|
|
17111
|
+
is_dc_source: false,
|
|
17112
|
+
terminal1_source_port_id: posPort.source_port_id,
|
|
17113
|
+
terminal2_source_port_id: negPort.source_port_id,
|
|
17114
|
+
current: props.current,
|
|
17115
|
+
// DC offset
|
|
17116
|
+
frequency: props.frequency,
|
|
17117
|
+
peak_to_peak_current: props.peakToPeakCurrent,
|
|
17118
|
+
wave_shape: props.waveShape,
|
|
17119
|
+
phase: props.phase,
|
|
17120
|
+
duty_cycle: props.dutyCycle
|
|
17121
|
+
});
|
|
17122
|
+
} else {
|
|
17123
|
+
if (props.current === void 0) return;
|
|
17124
|
+
db.simulation_current_source.insert({
|
|
17125
|
+
type: "simulation_current_source",
|
|
17126
|
+
is_dc_source: true,
|
|
17127
|
+
positive_source_port_id: posPort.source_port_id,
|
|
17128
|
+
negative_source_port_id: negPort.source_port_id,
|
|
17129
|
+
current: props.current
|
|
17130
|
+
});
|
|
17131
|
+
}
|
|
17132
|
+
}
|
|
17133
|
+
pos = this.portMap.pos;
|
|
17134
|
+
neg = this.portMap.neg;
|
|
17135
|
+
};
|
|
17136
|
+
|
|
17038
17137
|
// lib/components/primitive-components/Constraint.ts
|
|
17039
17138
|
import { constraintProps } from "@tscircuit/props";
|
|
17040
17139
|
import "zod";
|
|
@@ -18672,7 +18771,7 @@ var PinHeader = class extends NormalComponent3 {
|
|
|
18672
18771
|
|
|
18673
18772
|
// lib/components/normal-components/Resonator.ts
|
|
18674
18773
|
import { resonatorProps } from "@tscircuit/props";
|
|
18675
|
-
import { formatSiUnit as
|
|
18774
|
+
import { formatSiUnit as formatSiUnit7 } from "format-si-unit";
|
|
18676
18775
|
function getResonatorSymbolName(variant) {
|
|
18677
18776
|
switch (variant) {
|
|
18678
18777
|
case "two_ground_pins":
|
|
@@ -18710,9 +18809,9 @@ var Resonator = class extends NormalComponent3 {
|
|
|
18710
18809
|
this.source_component_id = source_component.source_component_id;
|
|
18711
18810
|
}
|
|
18712
18811
|
_getSchematicSymbolDisplayValue() {
|
|
18713
|
-
const freqDisplay = `${
|
|
18812
|
+
const freqDisplay = `${formatSiUnit7(this._parsedProps.frequency)}Hz`;
|
|
18714
18813
|
if (this._parsedProps.loadCapacitance) {
|
|
18715
|
-
return `${freqDisplay} / ${
|
|
18814
|
+
return `${freqDisplay} / ${formatSiUnit7(this._parsedProps.loadCapacitance)}F`;
|
|
18716
18815
|
}
|
|
18717
18816
|
return freqDisplay;
|
|
18718
18817
|
}
|
|
@@ -18720,7 +18819,7 @@ var Resonator = class extends NormalComponent3 {
|
|
|
18720
18819
|
|
|
18721
18820
|
// lib/components/normal-components/Potentiometer.ts
|
|
18722
18821
|
import { potentiometerProps } from "@tscircuit/props";
|
|
18723
|
-
import { formatSiUnit as
|
|
18822
|
+
import { formatSiUnit as formatSiUnit8 } from "format-si-unit";
|
|
18724
18823
|
function getPotentiometerSymbolName(variant) {
|
|
18725
18824
|
switch (variant) {
|
|
18726
18825
|
case "three_pin":
|
|
@@ -18741,7 +18840,7 @@ var Potentiometer = class extends NormalComponent3 {
|
|
|
18741
18840
|
};
|
|
18742
18841
|
}
|
|
18743
18842
|
_getSchematicSymbolDisplayValue() {
|
|
18744
|
-
return `${
|
|
18843
|
+
return `${formatSiUnit8(this._parsedProps.maxResistance)}\u03A9`;
|
|
18745
18844
|
}
|
|
18746
18845
|
doInitialSourceRender() {
|
|
18747
18846
|
const { db } = this.root;
|
|
@@ -18825,7 +18924,7 @@ var PushButton = class extends NormalComponent3 {
|
|
|
18825
18924
|
|
|
18826
18925
|
// lib/components/normal-components/Crystal.ts
|
|
18827
18926
|
import { crystalProps } from "@tscircuit/props";
|
|
18828
|
-
import { formatSiUnit as
|
|
18927
|
+
import { formatSiUnit as formatSiUnit9 } from "format-si-unit";
|
|
18829
18928
|
var Crystal = class extends NormalComponent3 {
|
|
18830
18929
|
// @ts-ignore
|
|
18831
18930
|
get config() {
|
|
@@ -18852,9 +18951,9 @@ var Crystal = class extends NormalComponent3 {
|
|
|
18852
18951
|
});
|
|
18853
18952
|
}
|
|
18854
18953
|
_getSchematicSymbolDisplayValue() {
|
|
18855
|
-
const freqDisplay = `${
|
|
18954
|
+
const freqDisplay = `${formatSiUnit9(this._parsedProps.frequency)}Hz`;
|
|
18856
18955
|
if (this._parsedProps.loadCapacitance) {
|
|
18857
|
-
return `${freqDisplay} / ${
|
|
18956
|
+
return `${freqDisplay} / ${formatSiUnit9(
|
|
18858
18957
|
this._parsedProps.loadCapacitance
|
|
18859
18958
|
)}F`;
|
|
18860
18959
|
}
|
|
@@ -19909,7 +20008,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
19909
20008
|
var package_default = {
|
|
19910
20009
|
name: "@tscircuit/core",
|
|
19911
20010
|
type: "module",
|
|
19912
|
-
version: "0.0.
|
|
20011
|
+
version: "0.0.943",
|
|
19913
20012
|
types: "dist/index.d.ts",
|
|
19914
20013
|
main: "dist/index.js",
|
|
19915
20014
|
module: "dist/index.js",
|
|
@@ -19952,7 +20051,7 @@ var package_default = {
|
|
|
19952
20051
|
"@tscircuit/math-utils": "^0.0.29",
|
|
19953
20052
|
"@tscircuit/miniflex": "^0.0.4",
|
|
19954
20053
|
"@tscircuit/ngspice-spice-engine": "^0.0.8",
|
|
19955
|
-
"@tscircuit/props": "^0.0.
|
|
20054
|
+
"@tscircuit/props": "^0.0.438",
|
|
19956
20055
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
19957
20056
|
"@tscircuit/schematic-trace-solver": "^v0.0.45",
|
|
19958
20057
|
"@tscircuit/solver-utils": "^0.0.3",
|
|
@@ -19986,7 +20085,7 @@ var package_default = {
|
|
|
19986
20085
|
poppygl: "^0.0.16",
|
|
19987
20086
|
react: "^19.1.0",
|
|
19988
20087
|
"react-dom": "^19.1.0",
|
|
19989
|
-
"schematic-symbols": "^0.0.
|
|
20088
|
+
"schematic-symbols": "^0.0.203",
|
|
19990
20089
|
spicey: "^0.0.14",
|
|
19991
20090
|
"ts-expect": "^1.3.0",
|
|
19992
20091
|
tsup: "^8.2.4",
|
|
@@ -20460,6 +20559,7 @@ export {
|
|
|
20460
20559
|
CopperPour,
|
|
20461
20560
|
CopperText,
|
|
20462
20561
|
Crystal,
|
|
20562
|
+
CurrentSource,
|
|
20463
20563
|
Cutout,
|
|
20464
20564
|
Diode,
|
|
20465
20565
|
FabricationNoteDimension,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.944",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@tscircuit/math-utils": "^0.0.29",
|
|
45
45
|
"@tscircuit/miniflex": "^0.0.4",
|
|
46
46
|
"@tscircuit/ngspice-spice-engine": "^0.0.8",
|
|
47
|
-
"@tscircuit/props": "^0.0.
|
|
47
|
+
"@tscircuit/props": "^0.0.438",
|
|
48
48
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
49
49
|
"@tscircuit/schematic-trace-solver": "^v0.0.45",
|
|
50
50
|
"@tscircuit/solver-utils": "^0.0.3",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"poppygl": "^0.0.16",
|
|
79
79
|
"react": "^19.1.0",
|
|
80
80
|
"react-dom": "^19.1.0",
|
|
81
|
-
"schematic-symbols": "^0.0.
|
|
81
|
+
"schematic-symbols": "^0.0.203",
|
|
82
82
|
"spicey": "^0.0.14",
|
|
83
83
|
"ts-expect": "^1.3.0",
|
|
84
84
|
"tsup": "^8.2.4",
|