@tscircuit/core 0.0.878 → 0.0.880
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 +264 -1360
- package/dist/index.js +35 -35
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -762,10 +762,10 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
762
762
|
*/
|
|
763
763
|
computePcbPropsTransform() {
|
|
764
764
|
const { _parsedProps: props } = this;
|
|
765
|
-
const
|
|
765
|
+
const rotation4 = this._getPcbRotationBeforeLayout() ?? 0;
|
|
766
766
|
const matrix = compose(
|
|
767
767
|
translate(props.pcbX ?? 0, props.pcbY ?? 0),
|
|
768
|
-
rotate(
|
|
768
|
+
rotate(rotation4 * Math.PI / 180)
|
|
769
769
|
);
|
|
770
770
|
return matrix;
|
|
771
771
|
}
|
|
@@ -779,12 +779,12 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
779
779
|
_computePcbGlobalTransformBeforeLayout() {
|
|
780
780
|
const manualPlacement = this.getSubcircuit()._getPcbManualPlacementForComponent(this);
|
|
781
781
|
if (manualPlacement && this.props.pcbX === void 0 && this.props.pcbY === void 0) {
|
|
782
|
-
const
|
|
782
|
+
const rotation4 = this._getPcbRotationBeforeLayout() ?? 0;
|
|
783
783
|
return compose(
|
|
784
784
|
this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity(),
|
|
785
785
|
compose(
|
|
786
786
|
translate(manualPlacement.x, manualPlacement.y),
|
|
787
|
-
rotate(
|
|
787
|
+
rotate(rotation4 * Math.PI / 180)
|
|
788
788
|
)
|
|
789
789
|
);
|
|
790
790
|
}
|
|
@@ -2906,16 +2906,16 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
2906
2906
|
const position = this._getGlobalPcbPositionBeforeLayout();
|
|
2907
2907
|
const { maybeFlipLayer, isFlipped } = this._getPcbPrimitiveFlippedHelpers();
|
|
2908
2908
|
const subcircuit = this.getSubcircuit();
|
|
2909
|
-
let
|
|
2909
|
+
let rotation4 = 0;
|
|
2910
2910
|
if (props.pcbRotation !== void 0 && props.pcbRotation !== 0) {
|
|
2911
|
-
|
|
2911
|
+
rotation4 = props.pcbRotation;
|
|
2912
2912
|
} else {
|
|
2913
2913
|
const globalTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
2914
2914
|
const decomposedTransform = decomposeTSR3(globalTransform);
|
|
2915
|
-
|
|
2915
|
+
rotation4 = decomposedTransform.rotation.angle * 180 / Math.PI;
|
|
2916
2916
|
}
|
|
2917
2917
|
if (isFlipped) {
|
|
2918
|
-
|
|
2918
|
+
rotation4 = (rotation4 + 180) % 360;
|
|
2919
2919
|
}
|
|
2920
2920
|
const uniqueLayers = new Set(props.layers);
|
|
2921
2921
|
if (props.layer) uniqueLayers.add(props.layer);
|
|
@@ -2932,7 +2932,7 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
2932
2932
|
font_size: fontSize,
|
|
2933
2933
|
layer: maybeFlipLayer(layer),
|
|
2934
2934
|
text: props.text ?? "",
|
|
2935
|
-
ccw_rotation:
|
|
2935
|
+
ccw_rotation: rotation4,
|
|
2936
2936
|
pcb_component_id: container.pcb_component_id,
|
|
2937
2937
|
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
2938
2938
|
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
@@ -5279,12 +5279,12 @@ var getObstaclesFromRoute = (route, source_trace_id, { viaDiameter = 0.5 } = {})
|
|
|
5279
5279
|
|
|
5280
5280
|
// lib/utils/obstacles/generateApproximatingRects.ts
|
|
5281
5281
|
function generateApproximatingRects(rotatedRect, numRects = 4) {
|
|
5282
|
-
const { center, width, height, rotation:
|
|
5282
|
+
const { center, width, height, rotation: rotation4 } = rotatedRect;
|
|
5283
5283
|
const rects = [];
|
|
5284
|
-
const angleRad =
|
|
5284
|
+
const angleRad = rotation4 * Math.PI / 180;
|
|
5285
5285
|
const cosAngle = Math.cos(angleRad);
|
|
5286
5286
|
const sinAngle = Math.sin(angleRad);
|
|
5287
|
-
const normalizedRotation = (
|
|
5287
|
+
const normalizedRotation = (rotation4 % 360 + 360) % 360;
|
|
5288
5288
|
const sliceAlongWidth = height <= width ? normalizedRotation >= 45 && normalizedRotation < 135 || normalizedRotation >= 225 && normalizedRotation < 315 : normalizedRotation >= 135 && normalizedRotation < 225 || normalizedRotation >= 315 || normalizedRotation < 45;
|
|
5289
5289
|
if (sliceAlongWidth) {
|
|
5290
5290
|
const sliceWidth = width / numRects;
|
|
@@ -9636,6 +9636,18 @@ var getSimpleRouteJsonFromCircuitJson = ({
|
|
|
9636
9636
|
});
|
|
9637
9637
|
if (connectedPorts.length < 2) return null;
|
|
9638
9638
|
const [portA, portB] = connectedPorts;
|
|
9639
|
+
if (portA.x === void 0 || portA.y === void 0) {
|
|
9640
|
+
console.error(
|
|
9641
|
+
`(source_port_id: ${portA.source_port_id}) for trace ${trace.source_trace_id} does not have x/y coordinates. Skipping this trace.`
|
|
9642
|
+
);
|
|
9643
|
+
return null;
|
|
9644
|
+
}
|
|
9645
|
+
if (portB.x === void 0 || portB.y === void 0) {
|
|
9646
|
+
console.error(
|
|
9647
|
+
`(source_port_id: ${portB.source_port_id}) for trace ${trace.source_trace_id} does not have x/y coordinates. Skipping this trace.`
|
|
9648
|
+
);
|
|
9649
|
+
return null;
|
|
9650
|
+
}
|
|
9639
9651
|
const layerA = portA.layers?.[0] ?? "top";
|
|
9640
9652
|
const layerB = portB.layers?.[0] ?? "top";
|
|
9641
9653
|
const matchingHints = traceHints.filter(
|
|
@@ -15019,7 +15031,7 @@ var Chip = class extends NormalComponent3 {
|
|
|
15019
15031
|
if (!pinAttributes) return;
|
|
15020
15032
|
let powerPort = null;
|
|
15021
15033
|
let groundPort = null;
|
|
15022
|
-
let
|
|
15034
|
+
let voltage;
|
|
15023
15035
|
const ports = this.selectAll("port");
|
|
15024
15036
|
for (const port of ports) {
|
|
15025
15037
|
for (const alias of port.getNameAndAliases()) {
|
|
@@ -15027,7 +15039,7 @@ var Chip = class extends NormalComponent3 {
|
|
|
15027
15039
|
const attributes = pinAttributes[alias];
|
|
15028
15040
|
if (attributes.providesPower) {
|
|
15029
15041
|
powerPort = port;
|
|
15030
|
-
|
|
15042
|
+
voltage = attributes.providesVoltage;
|
|
15031
15043
|
}
|
|
15032
15044
|
if (attributes.providesGround) {
|
|
15033
15045
|
groundPort = port;
|
|
@@ -15035,7 +15047,7 @@ var Chip = class extends NormalComponent3 {
|
|
|
15035
15047
|
}
|
|
15036
15048
|
}
|
|
15037
15049
|
}
|
|
15038
|
-
if (!powerPort || !groundPort ||
|
|
15050
|
+
if (!powerPort || !groundPort || voltage === void 0) {
|
|
15039
15051
|
return;
|
|
15040
15052
|
}
|
|
15041
15053
|
const powerSourcePort = db.source_port.get(powerPort.source_port_id);
|
|
@@ -15058,7 +15070,7 @@ var Chip = class extends NormalComponent3 {
|
|
|
15058
15070
|
positive_source_net_id: powerNet.source_net_id,
|
|
15059
15071
|
negative_source_port_id: groundPort.source_port_id,
|
|
15060
15072
|
negative_source_net_id: groundNet.source_net_id,
|
|
15061
|
-
voltage
|
|
15073
|
+
voltage
|
|
15062
15074
|
});
|
|
15063
15075
|
}
|
|
15064
15076
|
};
|
|
@@ -15151,8 +15163,8 @@ var Fuse = class extends NormalComponent3 {
|
|
|
15151
15163
|
const rawCurrent = this._parsedProps.currentRating;
|
|
15152
15164
|
const rawVoltage = this._parsedProps.voltageRating;
|
|
15153
15165
|
const current = typeof rawCurrent === "string" ? parseFloat(rawCurrent) : rawCurrent;
|
|
15154
|
-
const
|
|
15155
|
-
return `${formatSiUnit2(current)}A / ${formatSiUnit2(
|
|
15166
|
+
const voltage = typeof rawVoltage === "string" ? parseFloat(rawVoltage) : rawVoltage;
|
|
15167
|
+
return `${formatSiUnit2(current)}A / ${formatSiUnit2(voltage)}V`;
|
|
15156
15168
|
}
|
|
15157
15169
|
doInitialSourceRender() {
|
|
15158
15170
|
const { db } = this.root;
|
|
@@ -15523,19 +15535,7 @@ var PowerSource = class extends NormalComponent3 {
|
|
|
15523
15535
|
};
|
|
15524
15536
|
|
|
15525
15537
|
// lib/components/normal-components/VoltageSource.ts
|
|
15526
|
-
import {
|
|
15527
|
-
import {
|
|
15528
|
-
commonComponentProps
|
|
15529
|
-
} from "@tscircuit/props";
|
|
15530
|
-
import { z as z13 } from "zod";
|
|
15531
|
-
var voltageSourceProps = commonComponentProps.extend({
|
|
15532
|
-
voltage: voltage.optional(),
|
|
15533
|
-
frequency: frequency.optional(),
|
|
15534
|
-
peakToPeakVoltage: voltage.optional(),
|
|
15535
|
-
waveShape: z13.enum(["sinewave", "square", "triangle", "sawtooth"]).optional(),
|
|
15536
|
-
phase: rotation4.optional(),
|
|
15537
|
-
dutyCycle: z13.number().optional()
|
|
15538
|
-
});
|
|
15538
|
+
import { voltageSourceProps } from "@tscircuit/props";
|
|
15539
15539
|
var VoltageSource = class extends NormalComponent3 {
|
|
15540
15540
|
get config() {
|
|
15541
15541
|
const isSquare = this.props.waveShape === "square";
|
|
@@ -17744,7 +17744,7 @@ var Mosfet = class extends NormalComponent3 {
|
|
|
17744
17744
|
|
|
17745
17745
|
// lib/components/normal-components/Switch.ts
|
|
17746
17746
|
import { switchProps } from "@tscircuit/props";
|
|
17747
|
-
import { frequency
|
|
17747
|
+
import { frequency, ms } from "circuit-json";
|
|
17748
17748
|
function hasSimProps(props) {
|
|
17749
17749
|
return props.simSwitchFrequency !== void 0 || props.simCloseAt !== void 0 || props.simOpenAt !== void 0 || props.simStartClosed !== void 0 || props.simStartOpen !== void 0;
|
|
17750
17750
|
}
|
|
@@ -17795,7 +17795,7 @@ var Switch = class extends NormalComponent3 {
|
|
|
17795
17795
|
source_component_id: this.source_component_id || ""
|
|
17796
17796
|
};
|
|
17797
17797
|
if (props.simSwitchFrequency !== void 0) {
|
|
17798
|
-
simulationSwitch.switching_frequency =
|
|
17798
|
+
simulationSwitch.switching_frequency = frequency.parse(
|
|
17799
17799
|
props.simSwitchFrequency
|
|
17800
17800
|
);
|
|
17801
17801
|
}
|
|
@@ -18588,7 +18588,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
18588
18588
|
var package_default = {
|
|
18589
18589
|
name: "@tscircuit/core",
|
|
18590
18590
|
type: "module",
|
|
18591
|
-
version: "0.0.
|
|
18591
|
+
version: "0.0.879",
|
|
18592
18592
|
types: "dist/index.d.ts",
|
|
18593
18593
|
main: "dist/index.js",
|
|
18594
18594
|
module: "dist/index.js",
|
|
@@ -18652,7 +18652,7 @@ var package_default = {
|
|
|
18652
18652
|
"circuit-json-to-gltf": "^0.0.31",
|
|
18653
18653
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
18654
18654
|
"circuit-json-to-spice": "^0.0.25",
|
|
18655
|
-
"circuit-to-svg": "^0.0.
|
|
18655
|
+
"circuit-to-svg": "^0.0.280",
|
|
18656
18656
|
concurrently: "^9.1.2",
|
|
18657
18657
|
"connectivity-map": "^1.0.0",
|
|
18658
18658
|
debug: "^4.3.6",
|
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.880",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"circuit-json-to-gltf": "^0.0.31",
|
|
66
66
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
67
67
|
"circuit-json-to-spice": "^0.0.25",
|
|
68
|
-
"circuit-to-svg": "^0.0.
|
|
68
|
+
"circuit-to-svg": "^0.0.280",
|
|
69
69
|
"concurrently": "^9.1.2",
|
|
70
70
|
"connectivity-map": "^1.0.0",
|
|
71
71
|
"debug": "^4.3.6",
|