@tscircuit/core 0.0.528 → 0.0.530

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 CHANGED
@@ -1932,6 +1932,11 @@ declare class Board extends Group<typeof boardProps> {
1932
1932
  */
1933
1933
  get allLayers(): string[];
1934
1934
  doInitialPcbBoardAutoSize(): void;
1935
+ /**
1936
+ * Update the board information silkscreen text if platform config is set and
1937
+ * the project name, version, or url is set.
1938
+ */
1939
+ private _addBoardInformationToSilkscreen;
1935
1940
  doInitialPcbComponentRender(): void;
1936
1941
  removePcbComponentRender(): void;
1937
1942
  _computePcbGlobalTransformBeforeLayout(): Matrix;
package/dist/index.js CHANGED
@@ -8499,12 +8499,48 @@ var Board = class extends Group {
8499
8499
  center
8500
8500
  });
8501
8501
  }
8502
+ /**
8503
+ * Update the board information silkscreen text if platform config is set and
8504
+ * the project name, version, or url is set.
8505
+ */
8506
+ _addBoardInformationToSilkscreen() {
8507
+ const platform = this.root?.platform;
8508
+ if (!platform?.printBoardInformationToSilkscreen) return;
8509
+ const pcbBoard = this.root.db.pcb_board.get(this.pcb_board_id);
8510
+ if (!pcbBoard) return;
8511
+ const boardInformation = [];
8512
+ if (platform.projectName) boardInformation.push(platform.projectName);
8513
+ if (platform.version) boardInformation.push(`v${platform.version}`);
8514
+ if (platform.url) boardInformation.push(platform.url);
8515
+ if (boardInformation.length === 0) return;
8516
+ const text = boardInformation.join("\n");
8517
+ const marginX = 0.25;
8518
+ const marginY = 1;
8519
+ const position = {
8520
+ x: pcbBoard.center.x + pcbBoard.width / 2 - marginX,
8521
+ y: pcbBoard.center.y - pcbBoard.height / 2 + marginY
8522
+ };
8523
+ this.root.db.pcb_silkscreen_text.insert({
8524
+ pcb_component_id: this.pcb_board_id,
8525
+ layer: "top",
8526
+ font: "tscircuit2024",
8527
+ font_size: 0.45,
8528
+ text,
8529
+ ccw_rotation: 0,
8530
+ anchor_alignment: "bottom_right",
8531
+ anchor_position: position
8532
+ });
8533
+ }
8502
8534
  doInitialPcbComponentRender() {
8503
8535
  if (this.root?.pcbDisabled) return;
8504
8536
  const { db } = this.root;
8505
8537
  const { _parsedProps: props } = this;
8506
8538
  let computedWidth = props.width ?? 0;
8507
8539
  let computedHeight = props.height ?? 0;
8540
+ let center = {
8541
+ x: (props.pcbX ?? 0) + (props.outlineOffsetX ?? 0),
8542
+ y: (props.pcbY ?? 0) + (props.outlineOffsetY ?? 0)
8543
+ };
8508
8544
  if (props.outline) {
8509
8545
  const xValues = props.outline.map((point) => point.x);
8510
8546
  const yValues = props.outline.map((point) => point.y);
@@ -8514,12 +8550,13 @@ var Board = class extends Group {
8514
8550
  const maxY = Math.max(...yValues);
8515
8551
  computedWidth = maxX - minX;
8516
8552
  computedHeight = maxY - minY;
8553
+ center = {
8554
+ x: (minX + maxX) / 2 + (props.outlineOffsetX ?? 0),
8555
+ y: (minY + maxY) / 2 + (props.outlineOffsetY ?? 0)
8556
+ };
8517
8557
  }
8518
8558
  const pcb_board = db.pcb_board.insert({
8519
- center: {
8520
- x: (props.pcbX ?? 0) + (props.outlineOffsetX ?? 0),
8521
- y: (props.pcbY ?? 0) + (props.outlineOffsetY ?? 0)
8522
- },
8559
+ center,
8523
8560
  thickness: this.boardThickness,
8524
8561
  num_layers: this.allLayers.length,
8525
8562
  width: computedWidth,
@@ -8531,6 +8568,7 @@ var Board = class extends Group {
8531
8568
  material: props.material
8532
8569
  });
8533
8570
  this.pcb_board_id = pcb_board.pcb_board_id;
8571
+ this._addBoardInformationToSilkscreen();
8534
8572
  }
8535
8573
  removePcbComponentRender() {
8536
8574
  const { db } = this.root;
@@ -10658,7 +10696,7 @@ import { identity as identity4 } from "transformation-matrix";
10658
10696
  var package_default = {
10659
10697
  name: "@tscircuit/core",
10660
10698
  type: "module",
10661
- version: "0.0.526",
10699
+ version: "0.0.529",
10662
10700
  types: "dist/index.d.ts",
10663
10701
  main: "dist/index.js",
10664
10702
  module: "dist/index.js",
@@ -10690,7 +10728,7 @@ var package_default = {
10690
10728
  "@tscircuit/layout": "^0.0.28",
10691
10729
  "@tscircuit/log-soup": "^1.0.2",
10692
10730
  "@tscircuit/math-utils": "^0.0.18",
10693
- "@tscircuit/props": "^0.0.244",
10731
+ "@tscircuit/props": "^0.0.245",
10694
10732
  "@tscircuit/schematic-autolayout": "^0.0.6",
10695
10733
  "@tscircuit/schematic-match-adapt": "^0.0.16",
10696
10734
  "@tscircuit/simple-3d-svg": "^0.0.6",
@@ -10704,7 +10742,7 @@ var package_default = {
10704
10742
  "circuit-json": "^0.0.212",
10705
10743
  "circuit-json-to-connectivity-map": "^0.0.22",
10706
10744
  "circuit-json-to-simple-3d": "^0.0.2",
10707
- "circuit-to-svg": "^0.0.160",
10745
+ "circuit-to-svg": "^0.0.162",
10708
10746
  concurrently: "^9.1.2",
10709
10747
  debug: "^4.3.6",
10710
10748
  "graphics-debug": "^0.0.4",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.528",
4
+ "version": "0.0.530",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -33,7 +33,7 @@
33
33
  "@tscircuit/layout": "^0.0.28",
34
34
  "@tscircuit/log-soup": "^1.0.2",
35
35
  "@tscircuit/math-utils": "^0.0.18",
36
- "@tscircuit/props": "^0.0.244",
36
+ "@tscircuit/props": "^0.0.245",
37
37
  "@tscircuit/schematic-autolayout": "^0.0.6",
38
38
  "@tscircuit/schematic-match-adapt": "^0.0.16",
39
39
  "@tscircuit/simple-3d-svg": "^0.0.6",
@@ -47,7 +47,7 @@
47
47
  "circuit-json": "^0.0.212",
48
48
  "circuit-json-to-connectivity-map": "^0.0.22",
49
49
  "circuit-json-to-simple-3d": "^0.0.2",
50
- "circuit-to-svg": "^0.0.160",
50
+ "circuit-to-svg": "^0.0.162",
51
51
  "concurrently": "^9.1.2",
52
52
  "debug": "^4.3.6",
53
53
  "graphics-debug": "^0.0.4",