@tscircuit/core 0.0.1021 → 0.0.1023

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 (3) hide show
  1. package/dist/index.d.ts +1409 -20
  2. package/dist/index.js +87 -38
  3. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -41,6 +41,7 @@ __export(components_exports, {
41
41
  Keepout: () => Keepout,
42
42
  Led: () => Led,
43
43
  Mosfet: () => Mosfet,
44
+ MountedBoard: () => MountedBoard,
44
45
  Net: () => Net,
45
46
  NetLabel: () => NetLabel,
46
47
  NormalComponent: () => NormalComponent3,
@@ -15599,7 +15600,7 @@ import { cju } from "@tscircuit/circuit-json-util";
15599
15600
  // lib/components/primitive-components/Group/Subcircuit/inflators/inflatePcbBoard.ts
15600
15601
  function inflatePcbBoard(pcbBoard, inflatorContext) {
15601
15602
  const { subcircuit } = inflatorContext;
15602
- if (subcircuit.lowercaseComponentName === "board") {
15603
+ if (subcircuit.lowercaseComponentName === "board" || subcircuit.lowercaseComponentName === "mountedboard") {
15603
15604
  return;
15604
15605
  }
15605
15606
  if (subcircuit.parent?.lowercaseComponentName === "board") {
@@ -15811,7 +15812,6 @@ var Chip = class extends NormalComponent3 {
15811
15812
  initPorts(opts = {}) {
15812
15813
  super.initPorts(opts);
15813
15814
  const { _parsedProps: props } = this;
15814
- const { pcbX, pcbY } = this.getResolvedPcbPositionProp();
15815
15815
  if (props.externallyConnectedPins) {
15816
15816
  const requiredPorts = /* @__PURE__ */ new Set();
15817
15817
  for (const [pin1, pin2] of props.externallyConnectedPins) {
@@ -15852,7 +15852,6 @@ var Chip = class extends NormalComponent3 {
15852
15852
  doInitialSourceRender() {
15853
15853
  const { db } = this.root;
15854
15854
  const { _parsedProps: props } = this;
15855
- const { pcbX, pcbY } = this.getResolvedPcbPositionProp();
15856
15855
  const source_component = db.source_component.insert({
15857
15856
  ftype: "simple_chip",
15858
15857
  name: this.name,
@@ -17052,6 +17051,87 @@ var Board = class extends Group6 {
17052
17051
  }
17053
17052
  };
17054
17053
 
17054
+ // lib/components/normal-components/MountedBoard.ts
17055
+ import { mountedboardProps } from "@tscircuit/props";
17056
+
17057
+ // lib/components/primitive-components/Group/Subcircuit/Subcircuit.ts
17058
+ import "@tscircuit/props";
17059
+ var Subcircuit = class extends Group6 {
17060
+ constructor(props) {
17061
+ super({
17062
+ ...props,
17063
+ // @ts-ignore
17064
+ subcircuit: true
17065
+ });
17066
+ }
17067
+ /**
17068
+ * During this phase, we inflate the subcircuit circuit json into class
17069
+ * instances
17070
+ *
17071
+ * When subcircuit's define circuitJson, it's basically the same as having
17072
+ * a tree of components. All the data from circuit json has to be converted
17073
+ * into props for the tree of components
17074
+ *
17075
+ * We do this in two phases:
17076
+ * - Create the components
17077
+ * - Create the groups
17078
+ * - Add components to groups in the appropriate hierarchy
17079
+ */
17080
+ doInitialInflateSubcircuitCircuitJson() {
17081
+ const { circuitJson, children } = this._parsedProps;
17082
+ if (circuitJson) {
17083
+ this._isInflatedFromCircuitJson = true;
17084
+ }
17085
+ inflateCircuitJson(this, circuitJson, children);
17086
+ }
17087
+ };
17088
+
17089
+ // lib/components/normal-components/MountedBoard.ts
17090
+ var MountedBoard = class extends Subcircuit {
17091
+ pcb_board_id = null;
17092
+ constructor(props) {
17093
+ super(props);
17094
+ }
17095
+ get config() {
17096
+ return {
17097
+ componentName: "MountedBoard",
17098
+ zodProps: mountedboardProps
17099
+ };
17100
+ }
17101
+ doInitialPcbComponentRender() {
17102
+ if (this.root?.pcbDisabled) return;
17103
+ const { db } = this.root;
17104
+ const { _parsedProps: props } = this;
17105
+ const globalPos = this._getGlobalPcbPositionBeforeLayout();
17106
+ const pcb_board = db.pcb_board.insert({
17107
+ center: { x: globalPos.x, y: globalPos.y },
17108
+ width: props.width ?? 0,
17109
+ height: props.height ?? 0,
17110
+ is_mounted_to_carrier_board: true
17111
+ });
17112
+ this.pcb_board_id = pcb_board.pcb_board_id;
17113
+ }
17114
+ doInitialPcbBoardAutoSize() {
17115
+ if (!this.pcb_board_id || !this.root) return;
17116
+ const carrierBoardId = this._findCarrierBoardId();
17117
+ if (carrierBoardId) {
17118
+ this.root.db.pcb_board.update(this.pcb_board_id, {
17119
+ carrier_pcb_board_id: carrierBoardId
17120
+ });
17121
+ }
17122
+ }
17123
+ _findCarrierBoardId() {
17124
+ let current = this.parent;
17125
+ while (current) {
17126
+ if (current instanceof Board) {
17127
+ return current.pcb_board_id;
17128
+ }
17129
+ current = current.parent;
17130
+ }
17131
+ return null;
17132
+ }
17133
+ };
17134
+
17055
17135
  // lib/components/normal-components/Panel.ts
17056
17136
  import { panelProps } from "@tscircuit/props";
17057
17137
  import { distance as distance12 } from "circuit-json";
@@ -19235,38 +19315,6 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
19235
19315
  }
19236
19316
  };
19237
19317
 
19238
- // lib/components/primitive-components/Group/Subcircuit/Subcircuit.ts
19239
- import "@tscircuit/props";
19240
- var Subcircuit = class extends Group6 {
19241
- constructor(props) {
19242
- super({
19243
- ...props,
19244
- // @ts-ignore
19245
- subcircuit: true
19246
- });
19247
- }
19248
- /**
19249
- * During this phase, we inflate the subcircuit circuit json into class
19250
- * instances
19251
- *
19252
- * When subcircuit's define circuitJson, it's basically the same as having
19253
- * a tree of components. All the data from circuit json has to be converted
19254
- * into props for the tree of components
19255
- *
19256
- * We do this in two phases:
19257
- * - Create the components
19258
- * - Create the groups
19259
- * - Add components to groups in the appropriate hierarchy
19260
- */
19261
- doInitialInflateSubcircuitCircuitJson() {
19262
- const { circuitJson, children } = this._parsedProps;
19263
- if (circuitJson) {
19264
- this._isInflatedFromCircuitJson = true;
19265
- }
19266
- inflateCircuitJson(this, circuitJson, children);
19267
- }
19268
- };
19269
-
19270
19318
  // lib/components/primitive-components/Breakout/Breakout.ts
19271
19319
  import "@tscircuit/props";
19272
19320
  var Breakout = class extends Group6 {
@@ -22268,7 +22316,7 @@ import { identity as identity5 } from "transformation-matrix";
22268
22316
  var package_default = {
22269
22317
  name: "@tscircuit/core",
22270
22318
  type: "module",
22271
- version: "0.0.1020",
22319
+ version: "0.0.1022",
22272
22320
  types: "dist/index.d.ts",
22273
22321
  main: "dist/index.js",
22274
22322
  module: "dist/index.js",
@@ -22312,7 +22360,7 @@ var package_default = {
22312
22360
  "@tscircuit/math-utils": "^0.0.29",
22313
22361
  "@tscircuit/miniflex": "^0.0.4",
22314
22362
  "@tscircuit/ngspice-spice-engine": "^0.0.8",
22315
- "@tscircuit/props": "^0.0.470",
22363
+ "@tscircuit/props": "^0.0.471",
22316
22364
  "@tscircuit/schematic-match-adapt": "^0.0.16",
22317
22365
  "@tscircuit/schematic-trace-solver": "^v0.0.45",
22318
22366
  "@tscircuit/solver-utils": "^0.0.3",
@@ -22326,7 +22374,7 @@ var package_default = {
22326
22374
  "bun-match-svg": "0.0.12",
22327
22375
  "calculate-elbow": "^0.0.12",
22328
22376
  "chokidar-cli": "^3.0.0",
22329
- "circuit-json": "^0.0.376",
22377
+ "circuit-json": "^0.0.378",
22330
22378
  "circuit-json-to-bpc": "^0.0.13",
22331
22379
  "circuit-json-to-connectivity-map": "^0.0.23",
22332
22380
  "circuit-json-to-gltf": "^0.0.62",
@@ -22890,6 +22938,7 @@ export {
22890
22938
  Keepout,
22891
22939
  Led,
22892
22940
  Mosfet,
22941
+ MountedBoard,
22893
22942
  Net,
22894
22943
  NetLabel,
22895
22944
  NormalComponent3 as NormalComponent,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1021",
4
+ "version": "0.0.1023",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -45,7 +45,7 @@
45
45
  "@tscircuit/math-utils": "^0.0.29",
46
46
  "@tscircuit/miniflex": "^0.0.4",
47
47
  "@tscircuit/ngspice-spice-engine": "^0.0.8",
48
- "@tscircuit/props": "^0.0.470",
48
+ "@tscircuit/props": "^0.0.471",
49
49
  "@tscircuit/schematic-match-adapt": "^0.0.16",
50
50
  "@tscircuit/schematic-trace-solver": "^v0.0.45",
51
51
  "@tscircuit/solver-utils": "^0.0.3",
@@ -59,7 +59,7 @@
59
59
  "bun-match-svg": "0.0.12",
60
60
  "calculate-elbow": "^0.0.12",
61
61
  "chokidar-cli": "^3.0.0",
62
- "circuit-json": "^0.0.376",
62
+ "circuit-json": "^0.0.378",
63
63
  "circuit-json-to-bpc": "^0.0.13",
64
64
  "circuit-json-to-connectivity-map": "^0.0.23",
65
65
  "circuit-json-to-gltf": "^0.0.62",