@tscircuit/core 0.0.800 → 0.0.801

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.
Files changed (2) hide show
  1. package/dist/index.js +33 -46
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -6841,8 +6841,8 @@ var NormalComponent__getMinimumFlexContainerSize = (component) => {
6841
6841
  );
6842
6842
  if (!pcbGroup) return null;
6843
6843
  return {
6844
- width: pcbGroup.width,
6845
- height: pcbGroup.height
6844
+ width: pcbGroup.width ?? 0,
6845
+ height: pcbGroup.height ?? 0
6846
6846
  };
6847
6847
  }
6848
6848
  return null;
@@ -9054,7 +9054,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
9054
9054
  }
9055
9055
  if (subcircuit_id) {
9056
9056
  const group = db.pcb_group.getWhere({ subcircuit_id });
9057
- if (group) {
9057
+ if (group?.width && group.height) {
9058
9058
  const groupBounds = {
9059
9059
  minX: group.center.x - group.width / 2,
9060
9060
  maxX: group.center.x + group.width / 2,
@@ -12466,7 +12466,7 @@ function Group_doInitialPcbComponentAnchorAlignment(group) {
12466
12466
  const pcbGroup = db.pcb_group.get(group.pcb_group_id);
12467
12467
  if (!pcbGroup) return;
12468
12468
  const { width, height, center } = pcbGroup;
12469
- if (width === 0 || height === 0) return;
12469
+ if (!width || !height) return;
12470
12470
  const bounds = {
12471
12471
  left: center.x - width / 2,
12472
12472
  right: center.x + width / 2,
@@ -13442,7 +13442,7 @@ var Board = class extends Group6 {
13442
13442
  updateBounds(pcbComponent.center, pcbComponent.width, pcbComponent.height);
13443
13443
  }
13444
13444
  for (const pcbGroup of allPcbGroups) {
13445
- updateBounds(pcbGroup.center, pcbGroup.width, pcbGroup.height);
13445
+ updateBounds(pcbGroup.center, pcbGroup.width ?? 0, pcbGroup.height ?? 0);
13446
13446
  }
13447
13447
  if (props.boardAnchorPosition) {
13448
13448
  const { x, y } = props.boardAnchorPosition;
@@ -15066,8 +15066,8 @@ var Breakout = class extends Group6 {
15066
15066
  const padTop = props.paddingTop ?? props.padding ?? 0;
15067
15067
  const padBottom = props.paddingBottom ?? props.padding ?? 0;
15068
15068
  db.pcb_group.update(this.pcb_group_id, {
15069
- width: pcb_group.width + padLeft + padRight,
15070
- height: pcb_group.height + padTop + padBottom,
15069
+ width: (pcb_group.width ?? 0) + padLeft + padRight,
15070
+ height: (pcb_group.height ?? 0) + padTop + padBottom,
15071
15071
  center: {
15072
15072
  x: pcb_group.center.x + (padRight - padLeft) / 2,
15073
15073
  y: pcb_group.center.y + (padTop - padBottom) / 2
@@ -16265,26 +16265,11 @@ var Mosfet = class extends NormalComponent3 {
16265
16265
  };
16266
16266
 
16267
16267
  // lib/components/normal-components/Switch.ts
16268
- import {
16269
- switchProps
16270
- } from "@tscircuit/props";
16271
- var hasSimulationValues = (values) => {
16272
- if (!values) return false;
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
- };
16268
+ import { switchProps } from "@tscircuit/props";
16269
+ import { frequency as frequency2, ms } from "circuit-json";
16270
+ function hasSimProps(props) {
16271
+ return props.simSwitchFrequency !== void 0 || props.simCloseAt !== void 0 || props.simOpenAt !== void 0 || props.simStartClosed !== void 0 || props.simStartOpen !== void 0;
16272
+ }
16288
16273
  var Switch = class extends NormalComponent3 {
16289
16274
  _getSwitchType() {
16290
16275
  const props = this._parsedProps;
@@ -16317,35 +16302,37 @@ var Switch = class extends NormalComponent3 {
16317
16302
  const source_component = db.source_component.insert({
16318
16303
  ftype: "simple_switch",
16319
16304
  name: this.name,
16320
- switch_type: props.type,
16321
- is_normally_closed: props.isNormallyClosed ?? false,
16322
16305
  are_pins_interchangeable: this._getSwitchType() === "spst"
16323
16306
  });
16324
16307
  this.source_component_id = source_component.source_component_id;
16325
16308
  }
16326
16309
  doInitialSimulationRender() {
16327
- const props = this.props;
16328
- const simulationValues = getSimulationValues(props.simulation);
16329
- if (!simulationValues) {
16310
+ const { _parsedProps: props } = this;
16311
+ if (!hasSimProps(props)) {
16330
16312
  return;
16331
16313
  }
16332
16314
  const { db } = this.root;
16333
16315
  const simulationSwitch = {
16334
- type: "simulation_switch"
16316
+ type: "simulation_switch",
16317
+ source_component_id: this.source_component_id || ""
16335
16318
  };
16336
- if (simulationValues.closesAt !== void 0) {
16337
- simulationSwitch.closes_at = simulationValues.closesAt;
16319
+ if (props.simSwitchFrequency !== void 0) {
16320
+ simulationSwitch.switching_frequency = frequency2.parse(
16321
+ props.simSwitchFrequency
16322
+ );
16338
16323
  }
16339
- if (simulationValues.opensAt !== void 0) {
16340
- simulationSwitch.opens_at = simulationValues.opensAt;
16324
+ if (props.simCloseAt !== void 0) {
16325
+ simulationSwitch.closes_at = ms.parse(props.simCloseAt);
16341
16326
  }
16342
- if (simulationValues.startsClosed !== void 0) {
16343
- simulationSwitch.starts_closed = simulationValues.startsClosed;
16327
+ if (props.simOpenAt !== void 0) {
16328
+ simulationSwitch.opens_at = ms.parse(props.simOpenAt);
16344
16329
  }
16345
- if (simulationValues.switchingFrequency !== void 0) {
16346
- simulationSwitch.switching_frequency = simulationValues.switchingFrequency;
16330
+ if (props.simStartOpen !== void 0) {
16331
+ simulationSwitch.starts_closed = !props.simStartOpen;
16332
+ }
16333
+ if (props.simStartClosed !== void 0) {
16334
+ simulationSwitch.starts_closed = props.simStartClosed;
16347
16335
  }
16348
- ;
16349
16336
  db.simulation_switch.insert(simulationSwitch);
16350
16337
  }
16351
16338
  };
@@ -17066,7 +17053,7 @@ import { identity as identity6 } from "transformation-matrix";
17066
17053
  var package_default = {
17067
17054
  name: "@tscircuit/core",
17068
17055
  type: "module",
17069
- version: "0.0.799",
17056
+ version: "0.0.800",
17070
17057
  types: "dist/index.d.ts",
17071
17058
  main: "dist/index.js",
17072
17059
  module: "dist/index.js",
@@ -17119,13 +17106,13 @@ var package_default = {
17119
17106
  "bun-match-svg": "0.0.12",
17120
17107
  "calculate-elbow": "^0.0.12",
17121
17108
  "chokidar-cli": "^3.0.0",
17122
- "circuit-json": "^0.0.283",
17109
+ "circuit-json": "^0.0.288",
17123
17110
  "circuit-json-to-bpc": "^0.0.13",
17124
17111
  "circuit-json-to-connectivity-map": "^0.0.22",
17125
17112
  "circuit-json-to-gltf": "^0.0.26",
17126
17113
  "circuit-json-to-simple-3d": "^0.0.9",
17127
17114
  "circuit-to-svg": "^0.0.245",
17128
- "circuit-json-to-spice": "^0.0.14",
17115
+ "circuit-json-to-spice": "^0.0.15",
17129
17116
  concurrently: "^9.1.2",
17130
17117
  "connectivity-map": "^1.0.0",
17131
17118
  debug: "^4.3.6",
@@ -17140,7 +17127,7 @@ var package_default = {
17140
17127
  react: "^19.1.0",
17141
17128
  "react-dom": "^19.1.0",
17142
17129
  "schematic-symbols": "^0.0.202",
17143
- spicey: "^0.0.8",
17130
+ spicey: "^0.0.10",
17144
17131
  "ts-expect": "^1.3.0",
17145
17132
  tsup: "^8.2.4"
17146
17133
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.800",
4
+ "version": "0.0.801",
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.283",
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.14",
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.8",
78
+ "spicey": "^0.0.10",
79
79
  "ts-expect": "^1.3.0",
80
80
  "tsup": "^8.2.4"
81
81
  },