@tscircuit/core 0.0.795 → 0.0.796
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.js +29 -4
- 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:
|
|
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,
|
|
@@ -13573,6 +13585,7 @@ var Capacitor = class extends NormalComponent3 {
|
|
|
13573
13585
|
|
|
13574
13586
|
// lib/components/normal-components/Chip.ts
|
|
13575
13587
|
import { chipProps as chipProps2 } from "@tscircuit/props";
|
|
13588
|
+
import { pcb_component_invalid_layer_error as pcb_component_invalid_layer_error2 } from "circuit-json";
|
|
13576
13589
|
var Chip = class extends NormalComponent3 {
|
|
13577
13590
|
schematicBoxDimensions = null;
|
|
13578
13591
|
constructor(props) {
|
|
@@ -13640,13 +13653,25 @@ var Chip = class extends NormalComponent3 {
|
|
|
13640
13653
|
if (this.root?.pcbDisabled) return;
|
|
13641
13654
|
const { db } = this.root;
|
|
13642
13655
|
const { _parsedProps: props } = this;
|
|
13656
|
+
const componentLayer = props.layer ?? "top";
|
|
13657
|
+
if (componentLayer !== "top" && componentLayer !== "bottom") {
|
|
13658
|
+
const subcircuit = this.getSubcircuit();
|
|
13659
|
+
const error = pcb_component_invalid_layer_error2.parse({
|
|
13660
|
+
type: "pcb_component_invalid_layer_error",
|
|
13661
|
+
message: `Component cannot be placed on layer '${componentLayer}'. Components can only be placed on 'top' or 'bottom' layers.`,
|
|
13662
|
+
source_component_id: this.source_component_id,
|
|
13663
|
+
layer: componentLayer,
|
|
13664
|
+
subcircuit_id: subcircuit.subcircuit_id ?? void 0
|
|
13665
|
+
});
|
|
13666
|
+
db.pcb_component_invalid_layer_error.insert(error);
|
|
13667
|
+
}
|
|
13643
13668
|
const pcb_component = db.pcb_component.insert({
|
|
13644
13669
|
center: { x: props.pcbX ?? 0, y: props.pcbY ?? 0 },
|
|
13645
13670
|
width: 2,
|
|
13646
13671
|
// Default width, adjust as needed
|
|
13647
13672
|
height: 3,
|
|
13648
13673
|
// Default height, adjust as needed
|
|
13649
|
-
layer:
|
|
13674
|
+
layer: componentLayer === "top" || componentLayer === "bottom" ? componentLayer : "top",
|
|
13650
13675
|
rotation: props.pcbRotation ?? 0,
|
|
13651
13676
|
source_component_id: this.source_component_id,
|
|
13652
13677
|
subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0,
|
|
@@ -16889,7 +16914,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
16889
16914
|
var package_default = {
|
|
16890
16915
|
name: "@tscircuit/core",
|
|
16891
16916
|
type: "module",
|
|
16892
|
-
version: "0.0.
|
|
16917
|
+
version: "0.0.795",
|
|
16893
16918
|
types: "dist/index.d.ts",
|
|
16894
16919
|
main: "dist/index.js",
|
|
16895
16920
|
module: "dist/index.js",
|
|
@@ -16942,7 +16967,7 @@ var package_default = {
|
|
|
16942
16967
|
"bun-match-svg": "0.0.12",
|
|
16943
16968
|
"calculate-elbow": "^0.0.12",
|
|
16944
16969
|
"chokidar-cli": "^3.0.0",
|
|
16945
|
-
"circuit-json": "^0.0.
|
|
16970
|
+
"circuit-json": "^0.0.283",
|
|
16946
16971
|
"circuit-json-to-bpc": "^0.0.13",
|
|
16947
16972
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
16948
16973
|
"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.
|
|
4
|
+
"version": "0.0.796",
|
|
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.
|
|
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",
|