@tscircuit/core 0.0.800 → 0.0.802
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 +38 -48
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1907,8 +1907,11 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
1907
1907
|
const rotationTolerance = 0.01;
|
|
1908
1908
|
const isAxisAligned = Math.abs(normalizedRotationDegrees) < rotationTolerance || Math.abs(normalizedRotationDegrees - 180) < rotationTolerance || Math.abs(normalizedRotationDegrees - 360) < rotationTolerance;
|
|
1909
1909
|
const isRotated90Degrees = Math.abs(normalizedRotationDegrees - 90) < rotationTolerance || Math.abs(normalizedRotationDegrees - 270) < rotationTolerance;
|
|
1910
|
-
|
|
1911
|
-
const { maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
|
|
1910
|
+
let finalRotationDegrees = Math.abs(normalizedRotationDegrees - 360) < rotationTolerance ? 0 : normalizedRotationDegrees;
|
|
1911
|
+
const { maybeFlipLayer, isFlipped } = this._getPcbPrimitiveFlippedHelpers();
|
|
1912
|
+
if (isFlipped) {
|
|
1913
|
+
finalRotationDegrees = (360 - finalRotationDegrees + 360) % 360;
|
|
1914
|
+
}
|
|
1912
1915
|
let pcb_smtpad = null;
|
|
1913
1916
|
const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id;
|
|
1914
1917
|
if (props.shape === "circle") {
|
|
@@ -6841,8 +6844,8 @@ var NormalComponent__getMinimumFlexContainerSize = (component) => {
|
|
|
6841
6844
|
);
|
|
6842
6845
|
if (!pcbGroup) return null;
|
|
6843
6846
|
return {
|
|
6844
|
-
width: pcbGroup.width,
|
|
6845
|
-
height: pcbGroup.height
|
|
6847
|
+
width: pcbGroup.width ?? 0,
|
|
6848
|
+
height: pcbGroup.height ?? 0
|
|
6846
6849
|
};
|
|
6847
6850
|
}
|
|
6848
6851
|
return null;
|
|
@@ -9054,7 +9057,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
|
|
|
9054
9057
|
}
|
|
9055
9058
|
if (subcircuit_id) {
|
|
9056
9059
|
const group = db.pcb_group.getWhere({ subcircuit_id });
|
|
9057
|
-
if (group) {
|
|
9060
|
+
if (group?.width && group.height) {
|
|
9058
9061
|
const groupBounds = {
|
|
9059
9062
|
minX: group.center.x - group.width / 2,
|
|
9060
9063
|
maxX: group.center.x + group.width / 2,
|
|
@@ -12466,7 +12469,7 @@ function Group_doInitialPcbComponentAnchorAlignment(group) {
|
|
|
12466
12469
|
const pcbGroup = db.pcb_group.get(group.pcb_group_id);
|
|
12467
12470
|
if (!pcbGroup) return;
|
|
12468
12471
|
const { width, height, center } = pcbGroup;
|
|
12469
|
-
if (width
|
|
12472
|
+
if (!width || !height) return;
|
|
12470
12473
|
const bounds = {
|
|
12471
12474
|
left: center.x - width / 2,
|
|
12472
12475
|
right: center.x + width / 2,
|
|
@@ -13442,7 +13445,7 @@ var Board = class extends Group6 {
|
|
|
13442
13445
|
updateBounds(pcbComponent.center, pcbComponent.width, pcbComponent.height);
|
|
13443
13446
|
}
|
|
13444
13447
|
for (const pcbGroup of allPcbGroups) {
|
|
13445
|
-
updateBounds(pcbGroup.center, pcbGroup.width, pcbGroup.height);
|
|
13448
|
+
updateBounds(pcbGroup.center, pcbGroup.width ?? 0, pcbGroup.height ?? 0);
|
|
13446
13449
|
}
|
|
13447
13450
|
if (props.boardAnchorPosition) {
|
|
13448
13451
|
const { x, y } = props.boardAnchorPosition;
|
|
@@ -15066,8 +15069,8 @@ var Breakout = class extends Group6 {
|
|
|
15066
15069
|
const padTop = props.paddingTop ?? props.padding ?? 0;
|
|
15067
15070
|
const padBottom = props.paddingBottom ?? props.padding ?? 0;
|
|
15068
15071
|
db.pcb_group.update(this.pcb_group_id, {
|
|
15069
|
-
width: pcb_group.width + padLeft + padRight,
|
|
15070
|
-
height: pcb_group.height + padTop + padBottom,
|
|
15072
|
+
width: (pcb_group.width ?? 0) + padLeft + padRight,
|
|
15073
|
+
height: (pcb_group.height ?? 0) + padTop + padBottom,
|
|
15071
15074
|
center: {
|
|
15072
15075
|
x: pcb_group.center.x + (padRight - padLeft) / 2,
|
|
15073
15076
|
y: pcb_group.center.y + (padTop - padBottom) / 2
|
|
@@ -16265,26 +16268,11 @@ var Mosfet = class extends NormalComponent3 {
|
|
|
16265
16268
|
};
|
|
16266
16269
|
|
|
16267
16270
|
// lib/components/normal-components/Switch.ts
|
|
16268
|
-
import {
|
|
16269
|
-
|
|
16270
|
-
|
|
16271
|
-
|
|
16272
|
-
|
|
16273
|
-
return values.closesAt !== void 0 || values.opensAt !== void 0 || values.startsClosed !== void 0 || values.switchingFrequency !== void 0;
|
|
16274
|
-
};
|
|
16275
|
-
var isSpiceContainer = (simulation) => {
|
|
16276
|
-
if (!simulation || typeof simulation !== "object") {
|
|
16277
|
-
return false;
|
|
16278
|
-
}
|
|
16279
|
-
return Object.prototype.hasOwnProperty.call(simulation, "spice");
|
|
16280
|
-
};
|
|
16281
|
-
var getSimulationValues = (simulation) => {
|
|
16282
|
-
if (!simulation || typeof simulation !== "object") {
|
|
16283
|
-
return null;
|
|
16284
|
-
}
|
|
16285
|
-
const maybeValues = isSpiceContainer(simulation) ? simulation.spice ?? null : simulation;
|
|
16286
|
-
return hasSimulationValues(maybeValues) ? { ...maybeValues } : null;
|
|
16287
|
-
};
|
|
16271
|
+
import { switchProps } from "@tscircuit/props";
|
|
16272
|
+
import { frequency as frequency2, ms } from "circuit-json";
|
|
16273
|
+
function hasSimProps(props) {
|
|
16274
|
+
return props.simSwitchFrequency !== void 0 || props.simCloseAt !== void 0 || props.simOpenAt !== void 0 || props.simStartClosed !== void 0 || props.simStartOpen !== void 0;
|
|
16275
|
+
}
|
|
16288
16276
|
var Switch = class extends NormalComponent3 {
|
|
16289
16277
|
_getSwitchType() {
|
|
16290
16278
|
const props = this._parsedProps;
|
|
@@ -16317,35 +16305,37 @@ var Switch = class extends NormalComponent3 {
|
|
|
16317
16305
|
const source_component = db.source_component.insert({
|
|
16318
16306
|
ftype: "simple_switch",
|
|
16319
16307
|
name: this.name,
|
|
16320
|
-
switch_type: props.type,
|
|
16321
|
-
is_normally_closed: props.isNormallyClosed ?? false,
|
|
16322
16308
|
are_pins_interchangeable: this._getSwitchType() === "spst"
|
|
16323
16309
|
});
|
|
16324
16310
|
this.source_component_id = source_component.source_component_id;
|
|
16325
16311
|
}
|
|
16326
16312
|
doInitialSimulationRender() {
|
|
16327
|
-
const props = this
|
|
16328
|
-
|
|
16329
|
-
if (!simulationValues) {
|
|
16313
|
+
const { _parsedProps: props } = this;
|
|
16314
|
+
if (!hasSimProps(props)) {
|
|
16330
16315
|
return;
|
|
16331
16316
|
}
|
|
16332
16317
|
const { db } = this.root;
|
|
16333
16318
|
const simulationSwitch = {
|
|
16334
|
-
type: "simulation_switch"
|
|
16319
|
+
type: "simulation_switch",
|
|
16320
|
+
source_component_id: this.source_component_id || ""
|
|
16335
16321
|
};
|
|
16336
|
-
if (
|
|
16337
|
-
simulationSwitch.
|
|
16322
|
+
if (props.simSwitchFrequency !== void 0) {
|
|
16323
|
+
simulationSwitch.switching_frequency = frequency2.parse(
|
|
16324
|
+
props.simSwitchFrequency
|
|
16325
|
+
);
|
|
16338
16326
|
}
|
|
16339
|
-
if (
|
|
16340
|
-
simulationSwitch.
|
|
16327
|
+
if (props.simCloseAt !== void 0) {
|
|
16328
|
+
simulationSwitch.closes_at = ms.parse(props.simCloseAt);
|
|
16341
16329
|
}
|
|
16342
|
-
if (
|
|
16343
|
-
simulationSwitch.
|
|
16330
|
+
if (props.simOpenAt !== void 0) {
|
|
16331
|
+
simulationSwitch.opens_at = ms.parse(props.simOpenAt);
|
|
16344
16332
|
}
|
|
16345
|
-
if (
|
|
16346
|
-
simulationSwitch.
|
|
16333
|
+
if (props.simStartOpen !== void 0) {
|
|
16334
|
+
simulationSwitch.starts_closed = !props.simStartOpen;
|
|
16335
|
+
}
|
|
16336
|
+
if (props.simStartClosed !== void 0) {
|
|
16337
|
+
simulationSwitch.starts_closed = props.simStartClosed;
|
|
16347
16338
|
}
|
|
16348
|
-
;
|
|
16349
16339
|
db.simulation_switch.insert(simulationSwitch);
|
|
16350
16340
|
}
|
|
16351
16341
|
};
|
|
@@ -17066,7 +17056,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
17066
17056
|
var package_default = {
|
|
17067
17057
|
name: "@tscircuit/core",
|
|
17068
17058
|
type: "module",
|
|
17069
|
-
version: "0.0.
|
|
17059
|
+
version: "0.0.801",
|
|
17070
17060
|
types: "dist/index.d.ts",
|
|
17071
17061
|
main: "dist/index.js",
|
|
17072
17062
|
module: "dist/index.js",
|
|
@@ -17119,13 +17109,13 @@ var package_default = {
|
|
|
17119
17109
|
"bun-match-svg": "0.0.12",
|
|
17120
17110
|
"calculate-elbow": "^0.0.12",
|
|
17121
17111
|
"chokidar-cli": "^3.0.0",
|
|
17122
|
-
"circuit-json": "^0.0.
|
|
17112
|
+
"circuit-json": "^0.0.288",
|
|
17123
17113
|
"circuit-json-to-bpc": "^0.0.13",
|
|
17124
17114
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
17125
17115
|
"circuit-json-to-gltf": "^0.0.26",
|
|
17126
17116
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
17127
17117
|
"circuit-to-svg": "^0.0.245",
|
|
17128
|
-
"circuit-json-to-spice": "^0.0.
|
|
17118
|
+
"circuit-json-to-spice": "^0.0.15",
|
|
17129
17119
|
concurrently: "^9.1.2",
|
|
17130
17120
|
"connectivity-map": "^1.0.0",
|
|
17131
17121
|
debug: "^4.3.6",
|
|
@@ -17140,7 +17130,7 @@ var package_default = {
|
|
|
17140
17130
|
react: "^19.1.0",
|
|
17141
17131
|
"react-dom": "^19.1.0",
|
|
17142
17132
|
"schematic-symbols": "^0.0.202",
|
|
17143
|
-
spicey: "^0.0.
|
|
17133
|
+
spicey: "^0.0.10",
|
|
17144
17134
|
"ts-expect": "^1.3.0",
|
|
17145
17135
|
tsup: "^8.2.4"
|
|
17146
17136
|
},
|
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.802",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
"bun-match-svg": "0.0.12",
|
|
55
55
|
"calculate-elbow": "^0.0.12",
|
|
56
56
|
"chokidar-cli": "^3.0.0",
|
|
57
|
-
"circuit-json": "^0.0.
|
|
57
|
+
"circuit-json": "^0.0.288",
|
|
58
58
|
"circuit-json-to-bpc": "^0.0.13",
|
|
59
59
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
60
60
|
"circuit-json-to-gltf": "^0.0.26",
|
|
61
61
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
62
62
|
"circuit-to-svg": "^0.0.245",
|
|
63
|
-
"circuit-json-to-spice": "^0.0.
|
|
63
|
+
"circuit-json-to-spice": "^0.0.15",
|
|
64
64
|
"concurrently": "^9.1.2",
|
|
65
65
|
"connectivity-map": "^1.0.0",
|
|
66
66
|
"debug": "^4.3.6",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"react": "^19.1.0",
|
|
76
76
|
"react-dom": "^19.1.0",
|
|
77
77
|
"schematic-symbols": "^0.0.202",
|
|
78
|
-
"spicey": "^0.0.
|
|
78
|
+
"spicey": "^0.0.10",
|
|
79
79
|
"ts-expect": "^1.3.0",
|
|
80
80
|
"tsup": "^8.2.4"
|
|
81
81
|
},
|