@tscircuit/core 0.0.877 → 0.0.879
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 +25 -37
- package/package.json +3 -3
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;
|
|
@@ -15019,7 +15019,7 @@ var Chip = class extends NormalComponent3 {
|
|
|
15019
15019
|
if (!pinAttributes) return;
|
|
15020
15020
|
let powerPort = null;
|
|
15021
15021
|
let groundPort = null;
|
|
15022
|
-
let
|
|
15022
|
+
let voltage;
|
|
15023
15023
|
const ports = this.selectAll("port");
|
|
15024
15024
|
for (const port of ports) {
|
|
15025
15025
|
for (const alias of port.getNameAndAliases()) {
|
|
@@ -15027,7 +15027,7 @@ var Chip = class extends NormalComponent3 {
|
|
|
15027
15027
|
const attributes = pinAttributes[alias];
|
|
15028
15028
|
if (attributes.providesPower) {
|
|
15029
15029
|
powerPort = port;
|
|
15030
|
-
|
|
15030
|
+
voltage = attributes.providesVoltage;
|
|
15031
15031
|
}
|
|
15032
15032
|
if (attributes.providesGround) {
|
|
15033
15033
|
groundPort = port;
|
|
@@ -15035,7 +15035,7 @@ var Chip = class extends NormalComponent3 {
|
|
|
15035
15035
|
}
|
|
15036
15036
|
}
|
|
15037
15037
|
}
|
|
15038
|
-
if (!powerPort || !groundPort ||
|
|
15038
|
+
if (!powerPort || !groundPort || voltage === void 0) {
|
|
15039
15039
|
return;
|
|
15040
15040
|
}
|
|
15041
15041
|
const powerSourcePort = db.source_port.get(powerPort.source_port_id);
|
|
@@ -15058,7 +15058,7 @@ var Chip = class extends NormalComponent3 {
|
|
|
15058
15058
|
positive_source_net_id: powerNet.source_net_id,
|
|
15059
15059
|
negative_source_port_id: groundPort.source_port_id,
|
|
15060
15060
|
negative_source_net_id: groundNet.source_net_id,
|
|
15061
|
-
voltage
|
|
15061
|
+
voltage
|
|
15062
15062
|
});
|
|
15063
15063
|
}
|
|
15064
15064
|
};
|
|
@@ -15151,8 +15151,8 @@ var Fuse = class extends NormalComponent3 {
|
|
|
15151
15151
|
const rawCurrent = this._parsedProps.currentRating;
|
|
15152
15152
|
const rawVoltage = this._parsedProps.voltageRating;
|
|
15153
15153
|
const current = typeof rawCurrent === "string" ? parseFloat(rawCurrent) : rawCurrent;
|
|
15154
|
-
const
|
|
15155
|
-
return `${formatSiUnit2(current)}A / ${formatSiUnit2(
|
|
15154
|
+
const voltage = typeof rawVoltage === "string" ? parseFloat(rawVoltage) : rawVoltage;
|
|
15155
|
+
return `${formatSiUnit2(current)}A / ${formatSiUnit2(voltage)}V`;
|
|
15156
15156
|
}
|
|
15157
15157
|
doInitialSourceRender() {
|
|
15158
15158
|
const { db } = this.root;
|
|
@@ -15523,19 +15523,7 @@ var PowerSource = class extends NormalComponent3 {
|
|
|
15523
15523
|
};
|
|
15524
15524
|
|
|
15525
15525
|
// 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
|
-
});
|
|
15526
|
+
import { voltageSourceProps } from "@tscircuit/props";
|
|
15539
15527
|
var VoltageSource = class extends NormalComponent3 {
|
|
15540
15528
|
get config() {
|
|
15541
15529
|
const isSquare = this.props.waveShape === "square";
|
|
@@ -16385,7 +16373,7 @@ var inflateSourceChip = (sourceElm, inflatorContext) => {
|
|
|
16385
16373
|
obstructsWithinBounds: pcbElm?.obstructs_within_bounds,
|
|
16386
16374
|
internallyConnectedPins
|
|
16387
16375
|
});
|
|
16388
|
-
const footprint = cadElm?.footprinter_string ??
|
|
16376
|
+
const footprint = cadElm?.footprinter_string ?? null;
|
|
16389
16377
|
if (footprint) {
|
|
16390
16378
|
Object.assign(chip.props, { footprint });
|
|
16391
16379
|
Object.assign(chip._parsedProps, { footprint });
|
|
@@ -17744,7 +17732,7 @@ var Mosfet = class extends NormalComponent3 {
|
|
|
17744
17732
|
|
|
17745
17733
|
// lib/components/normal-components/Switch.ts
|
|
17746
17734
|
import { switchProps } from "@tscircuit/props";
|
|
17747
|
-
import { frequency
|
|
17735
|
+
import { frequency, ms } from "circuit-json";
|
|
17748
17736
|
function hasSimProps(props) {
|
|
17749
17737
|
return props.simSwitchFrequency !== void 0 || props.simCloseAt !== void 0 || props.simOpenAt !== void 0 || props.simStartClosed !== void 0 || props.simStartOpen !== void 0;
|
|
17750
17738
|
}
|
|
@@ -17795,7 +17783,7 @@ var Switch = class extends NormalComponent3 {
|
|
|
17795
17783
|
source_component_id: this.source_component_id || ""
|
|
17796
17784
|
};
|
|
17797
17785
|
if (props.simSwitchFrequency !== void 0) {
|
|
17798
|
-
simulationSwitch.switching_frequency =
|
|
17786
|
+
simulationSwitch.switching_frequency = frequency.parse(
|
|
17799
17787
|
props.simSwitchFrequency
|
|
17800
17788
|
);
|
|
17801
17789
|
}
|
|
@@ -18588,7 +18576,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
18588
18576
|
var package_default = {
|
|
18589
18577
|
name: "@tscircuit/core",
|
|
18590
18578
|
type: "module",
|
|
18591
|
-
version: "0.0.
|
|
18579
|
+
version: "0.0.878",
|
|
18592
18580
|
types: "dist/index.d.ts",
|
|
18593
18581
|
main: "dist/index.js",
|
|
18594
18582
|
module: "dist/index.js",
|
|
@@ -18652,7 +18640,7 @@ var package_default = {
|
|
|
18652
18640
|
"circuit-json-to-gltf": "^0.0.31",
|
|
18653
18641
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
18654
18642
|
"circuit-json-to-spice": "^0.0.25",
|
|
18655
|
-
"circuit-to-svg": "^0.0.
|
|
18643
|
+
"circuit-to-svg": "^0.0.279",
|
|
18656
18644
|
concurrently: "^9.1.2",
|
|
18657
18645
|
"connectivity-map": "^1.0.0",
|
|
18658
18646
|
debug: "^4.3.6",
|
|
@@ -18693,7 +18681,7 @@ var package_default = {
|
|
|
18693
18681
|
dependencies: {
|
|
18694
18682
|
"@flatten-js/core": "^1.6.2",
|
|
18695
18683
|
"@lume/kiwi": "^0.4.3",
|
|
18696
|
-
"calculate-packing": "0.0.
|
|
18684
|
+
"calculate-packing": "0.0.58",
|
|
18697
18685
|
"css-select": "5.1.0",
|
|
18698
18686
|
"format-si-unit": "^0.0.3",
|
|
18699
18687
|
nanoid: "^5.0.7",
|
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.879",
|
|
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.279",
|
|
69
69
|
"concurrently": "^9.1.2",
|
|
70
70
|
"connectivity-map": "^1.0.0",
|
|
71
71
|
"debug": "^4.3.6",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"dependencies": {
|
|
107
107
|
"@flatten-js/core": "^1.6.2",
|
|
108
108
|
"@lume/kiwi": "^0.4.3",
|
|
109
|
-
"calculate-packing": "0.0.
|
|
109
|
+
"calculate-packing": "0.0.58",
|
|
110
110
|
"css-select": "5.1.0",
|
|
111
111
|
"format-si-unit": "^0.0.3",
|
|
112
112
|
"nanoid": "^5.0.7",
|