@tscircuit/core 0.0.1022 → 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 -36
  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") {
@@ -17050,6 +17051,87 @@ var Board = class extends Group6 {
17050
17051
  }
17051
17052
  };
17052
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
+
17053
17135
  // lib/components/normal-components/Panel.ts
17054
17136
  import { panelProps } from "@tscircuit/props";
17055
17137
  import { distance as distance12 } from "circuit-json";
@@ -19233,38 +19315,6 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
19233
19315
  }
19234
19316
  };
19235
19317
 
19236
- // lib/components/primitive-components/Group/Subcircuit/Subcircuit.ts
19237
- import "@tscircuit/props";
19238
- var Subcircuit = class extends Group6 {
19239
- constructor(props) {
19240
- super({
19241
- ...props,
19242
- // @ts-ignore
19243
- subcircuit: true
19244
- });
19245
- }
19246
- /**
19247
- * During this phase, we inflate the subcircuit circuit json into class
19248
- * instances
19249
- *
19250
- * When subcircuit's define circuitJson, it's basically the same as having
19251
- * a tree of components. All the data from circuit json has to be converted
19252
- * into props for the tree of components
19253
- *
19254
- * We do this in two phases:
19255
- * - Create the components
19256
- * - Create the groups
19257
- * - Add components to groups in the appropriate hierarchy
19258
- */
19259
- doInitialInflateSubcircuitCircuitJson() {
19260
- const { circuitJson, children } = this._parsedProps;
19261
- if (circuitJson) {
19262
- this._isInflatedFromCircuitJson = true;
19263
- }
19264
- inflateCircuitJson(this, circuitJson, children);
19265
- }
19266
- };
19267
-
19268
19318
  // lib/components/primitive-components/Breakout/Breakout.ts
19269
19319
  import "@tscircuit/props";
19270
19320
  var Breakout = class extends Group6 {
@@ -22266,7 +22316,7 @@ import { identity as identity5 } from "transformation-matrix";
22266
22316
  var package_default = {
22267
22317
  name: "@tscircuit/core",
22268
22318
  type: "module",
22269
- version: "0.0.1021",
22319
+ version: "0.0.1022",
22270
22320
  types: "dist/index.d.ts",
22271
22321
  main: "dist/index.js",
22272
22322
  module: "dist/index.js",
@@ -22310,7 +22360,7 @@ var package_default = {
22310
22360
  "@tscircuit/math-utils": "^0.0.29",
22311
22361
  "@tscircuit/miniflex": "^0.0.4",
22312
22362
  "@tscircuit/ngspice-spice-engine": "^0.0.8",
22313
- "@tscircuit/props": "^0.0.470",
22363
+ "@tscircuit/props": "^0.0.471",
22314
22364
  "@tscircuit/schematic-match-adapt": "^0.0.16",
22315
22365
  "@tscircuit/schematic-trace-solver": "^v0.0.45",
22316
22366
  "@tscircuit/solver-utils": "^0.0.3",
@@ -22324,7 +22374,7 @@ var package_default = {
22324
22374
  "bun-match-svg": "0.0.12",
22325
22375
  "calculate-elbow": "^0.0.12",
22326
22376
  "chokidar-cli": "^3.0.0",
22327
- "circuit-json": "^0.0.376",
22377
+ "circuit-json": "^0.0.378",
22328
22378
  "circuit-json-to-bpc": "^0.0.13",
22329
22379
  "circuit-json-to-connectivity-map": "^0.0.23",
22330
22380
  "circuit-json-to-gltf": "^0.0.62",
@@ -22888,6 +22938,7 @@ export {
22888
22938
  Keepout,
22889
22939
  Led,
22890
22940
  Mosfet,
22941
+ MountedBoard,
22891
22942
  Net,
22892
22943
  NetLabel,
22893
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.1022",
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",