@tscircuit/core 0.0.795 → 0.0.797

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 +30 -4
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -87,6 +87,7 @@ import { fp } from "@tscircuit/footprinter";
87
87
  import {
88
88
  distance as distance4,
89
89
  pcb_manual_edit_conflict_warning,
90
+ pcb_component_invalid_layer_error,
90
91
  point3 as point32,
91
92
  rotation as rotation2,
92
93
  schematic_manual_edit_conflict_warning
@@ -7890,6 +7891,17 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
7890
7891
  const { db } = this.root;
7891
7892
  const { _parsedProps: props } = this;
7892
7893
  const subcircuit = this.getSubcircuit();
7894
+ const componentLayer = props.layer ?? "top";
7895
+ if (componentLayer !== "top" && componentLayer !== "bottom") {
7896
+ const error = pcb_component_invalid_layer_error.parse({
7897
+ type: "pcb_component_invalid_layer_error",
7898
+ message: `Component cannot be placed on layer '${componentLayer}'. Components can only be placed on 'top' or 'bottom' layers.`,
7899
+ source_component_id: this.source_component_id,
7900
+ layer: componentLayer,
7901
+ subcircuit_id: subcircuit.subcircuit_id ?? void 0
7902
+ });
7903
+ db.pcb_component_invalid_layer_error.insert(error);
7904
+ }
7893
7905
  const globalTransform = this._computePcbGlobalTransformBeforeLayout();
7894
7906
  const decomposedTransform = decomposeTSR5(globalTransform);
7895
7907
  const accumulatedRotation = decomposedTransform.rotation.angle * 180 / Math.PI;
@@ -7898,7 +7910,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
7898
7910
  // width/height are computed in the PcbComponentSizeCalculation phase
7899
7911
  width: 0,
7900
7912
  height: 0,
7901
- layer: props.layer ?? "top",
7913
+ layer: componentLayer === "top" || componentLayer === "bottom" ? componentLayer : "top",
7902
7914
  rotation: props.pcbRotation ?? accumulatedRotation,
7903
7915
  source_component_id: this.source_component_id,
7904
7916
  subcircuit_id: subcircuit.subcircuit_id ?? void 0,
@@ -8281,6 +8293,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
8281
8293
  }
8282
8294
  doInitialCadModelRender() {
8283
8295
  if (this._isCadModelChild) return;
8296
+ if (this.props.doNotPlace) return;
8284
8297
  const { db } = this.root;
8285
8298
  const { boardThickness = 0 } = this.root?._getBoard() ?? {};
8286
8299
  const cadModelProp = this._parsedProps.cadModel;
@@ -13573,6 +13586,7 @@ var Capacitor = class extends NormalComponent3 {
13573
13586
 
13574
13587
  // lib/components/normal-components/Chip.ts
13575
13588
  import { chipProps as chipProps2 } from "@tscircuit/props";
13589
+ import { pcb_component_invalid_layer_error as pcb_component_invalid_layer_error2 } from "circuit-json";
13576
13590
  var Chip = class extends NormalComponent3 {
13577
13591
  schematicBoxDimensions = null;
13578
13592
  constructor(props) {
@@ -13640,13 +13654,25 @@ var Chip = class extends NormalComponent3 {
13640
13654
  if (this.root?.pcbDisabled) return;
13641
13655
  const { db } = this.root;
13642
13656
  const { _parsedProps: props } = this;
13657
+ const componentLayer = props.layer ?? "top";
13658
+ if (componentLayer !== "top" && componentLayer !== "bottom") {
13659
+ const subcircuit = this.getSubcircuit();
13660
+ const error = pcb_component_invalid_layer_error2.parse({
13661
+ type: "pcb_component_invalid_layer_error",
13662
+ message: `Component cannot be placed on layer '${componentLayer}'. Components can only be placed on 'top' or 'bottom' layers.`,
13663
+ source_component_id: this.source_component_id,
13664
+ layer: componentLayer,
13665
+ subcircuit_id: subcircuit.subcircuit_id ?? void 0
13666
+ });
13667
+ db.pcb_component_invalid_layer_error.insert(error);
13668
+ }
13643
13669
  const pcb_component = db.pcb_component.insert({
13644
13670
  center: { x: props.pcbX ?? 0, y: props.pcbY ?? 0 },
13645
13671
  width: 2,
13646
13672
  // Default width, adjust as needed
13647
13673
  height: 3,
13648
13674
  // Default height, adjust as needed
13649
- layer: props.layer ?? "top",
13675
+ layer: componentLayer === "top" || componentLayer === "bottom" ? componentLayer : "top",
13650
13676
  rotation: props.pcbRotation ?? 0,
13651
13677
  source_component_id: this.source_component_id,
13652
13678
  subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0,
@@ -16889,7 +16915,7 @@ import { identity as identity6 } from "transformation-matrix";
16889
16915
  var package_default = {
16890
16916
  name: "@tscircuit/core",
16891
16917
  type: "module",
16892
- version: "0.0.794",
16918
+ version: "0.0.796",
16893
16919
  types: "dist/index.d.ts",
16894
16920
  main: "dist/index.js",
16895
16921
  module: "dist/index.js",
@@ -16942,7 +16968,7 @@ var package_default = {
16942
16968
  "bun-match-svg": "0.0.12",
16943
16969
  "calculate-elbow": "^0.0.12",
16944
16970
  "chokidar-cli": "^3.0.0",
16945
- "circuit-json": "^0.0.278",
16971
+ "circuit-json": "^0.0.283",
16946
16972
  "circuit-json-to-bpc": "^0.0.13",
16947
16973
  "circuit-json-to-connectivity-map": "^0.0.22",
16948
16974
  "circuit-json-to-gltf": "^0.0.7",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.795",
4
+ "version": "0.0.797",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -54,7 +54,7 @@
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.278",
57
+ "circuit-json": "^0.0.283",
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.7",