@tscircuit/core 0.0.741 → 0.0.743
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 +20 -8
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -81,6 +81,7 @@ import {
|
|
|
81
81
|
rotation as rotation2,
|
|
82
82
|
schematic_manual_edit_conflict_warning
|
|
83
83
|
} from "circuit-json";
|
|
84
|
+
import { decomposeTSR as decomposeTSR4 } from "transformation-matrix";
|
|
84
85
|
import Debug4 from "debug";
|
|
85
86
|
|
|
86
87
|
// lib/fiber/create-instance-from-react-element.ts
|
|
@@ -4231,6 +4232,7 @@ var Footprint = class extends PrimitiveComponent2 {
|
|
|
4231
4232
|
// lib/components/primitive-components/CadModel.ts
|
|
4232
4233
|
import { cadmodelProps, point3 } from "@tscircuit/props";
|
|
4233
4234
|
import { z as z7 } from "zod";
|
|
4235
|
+
import { decomposeTSR as decomposeTSR3 } from "transformation-matrix";
|
|
4234
4236
|
var rotation = z7.union([z7.number(), z7.string()]);
|
|
4235
4237
|
var rotation3 = z7.object({ x: rotation, y: rotation, z: rotation });
|
|
4236
4238
|
var CadModel = class extends PrimitiveComponent2 {
|
|
@@ -4250,6 +4252,9 @@ var CadModel = class extends PrimitiveComponent2 {
|
|
|
4250
4252
|
const pcb_component = db.pcb_component.get(parent.pcb_component_id);
|
|
4251
4253
|
const props = this._parsedProps;
|
|
4252
4254
|
if (!props || typeof props.modelUrl !== "string") return;
|
|
4255
|
+
const parentTransform = parent._computePcbGlobalTransformBeforeLayout();
|
|
4256
|
+
const decomposedTransform = decomposeTSR3(parentTransform);
|
|
4257
|
+
const accumulatedRotation = decomposedTransform.rotation.angle * 180 / Math.PI;
|
|
4253
4258
|
const rotationOffset = rotation3.parse({ x: 0, y: 0, z: 0 });
|
|
4254
4259
|
if (typeof props.rotationOffset === "number") {
|
|
4255
4260
|
rotationOffset.z = Number(props.rotationOffset);
|
|
@@ -4290,7 +4295,7 @@ var CadModel = class extends PrimitiveComponent2 {
|
|
|
4290
4295
|
rotation: {
|
|
4291
4296
|
x: Number(rotationOffset.x),
|
|
4292
4297
|
y: (layer === "top" ? 0 : 180) + Number(rotationOffset.y),
|
|
4293
|
-
z: layer === "bottom" ? -(
|
|
4298
|
+
z: layer === "bottom" ? -(accumulatedRotation + Number(rotationOffset.z)) + 180 : accumulatedRotation + Number(rotationOffset.z)
|
|
4294
4299
|
},
|
|
4295
4300
|
pcb_component_id: parent.pcb_component_id,
|
|
4296
4301
|
source_component_id: parent.source_component_id,
|
|
@@ -7643,7 +7648,8 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
7643
7648
|
layer: props.layer ?? "top",
|
|
7644
7649
|
rotation: props.pcbRotation ?? 0,
|
|
7645
7650
|
source_component_id: this.source_component_id,
|
|
7646
|
-
subcircuit_id: subcircuit.subcircuit_id ?? void 0
|
|
7651
|
+
subcircuit_id: subcircuit.subcircuit_id ?? void 0,
|
|
7652
|
+
do_not_place: props.doNotPlace ?? false
|
|
7647
7653
|
});
|
|
7648
7654
|
const footprint = props.footprint ?? this._getImpliedFootprintString();
|
|
7649
7655
|
if (!footprint && !this.isGroup) {
|
|
@@ -8026,6 +8032,9 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
8026
8032
|
...typeof cadModel?.positionOffset === "object" ? cadModel.positionOffset : {}
|
|
8027
8033
|
});
|
|
8028
8034
|
const computedLayer = this.props.layer === "bottom" ? "bottom" : "top";
|
|
8035
|
+
const globalTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
8036
|
+
const decomposedTransform = decomposeTSR4(globalTransform);
|
|
8037
|
+
const accumulatedRotation = decomposedTransform.rotation.angle * 180 / Math.PI;
|
|
8029
8038
|
const cad_model = db.cad_component.insert({
|
|
8030
8039
|
// TODO z maybe depends on layer
|
|
8031
8040
|
position: {
|
|
@@ -8036,7 +8045,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
8036
8045
|
rotation: {
|
|
8037
8046
|
x: rotationOffset.x,
|
|
8038
8047
|
y: (computedLayer === "top" ? 0 : 180) + rotationOffset.y,
|
|
8039
|
-
z: computedLayer === "bottom" ? -(
|
|
8048
|
+
z: computedLayer === "bottom" ? -(accumulatedRotation + rotationOffset.z) + 180 : accumulatedRotation + rotationOffset.z
|
|
8040
8049
|
},
|
|
8041
8050
|
pcb_component_id: this.pcb_component_id,
|
|
8042
8051
|
source_component_id: this.source_component_id,
|
|
@@ -12959,7 +12968,8 @@ var Chip = class extends NormalComponent3 {
|
|
|
12959
12968
|
layer: props.layer ?? "top",
|
|
12960
12969
|
rotation: props.pcbRotation ?? 0,
|
|
12961
12970
|
source_component_id: this.source_component_id,
|
|
12962
|
-
subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0
|
|
12971
|
+
subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0,
|
|
12972
|
+
do_not_place: props.doNotPlace ?? false
|
|
12963
12973
|
});
|
|
12964
12974
|
this.pcb_component_id = pcb_component.pcb_component_id;
|
|
12965
12975
|
}
|
|
@@ -13183,7 +13193,8 @@ var Jumper = class extends NormalComponent3 {
|
|
|
13183
13193
|
layer: props.layer ?? "top",
|
|
13184
13194
|
rotation: props.pcbRotation ?? 0,
|
|
13185
13195
|
source_component_id: this.source_component_id,
|
|
13186
|
-
subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0
|
|
13196
|
+
subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0,
|
|
13197
|
+
do_not_place: props.doNotPlace ?? false
|
|
13187
13198
|
});
|
|
13188
13199
|
this.pcb_component_id = pcb_component.pcb_component_id;
|
|
13189
13200
|
}
|
|
@@ -13337,7 +13348,8 @@ var SolderJumper = class extends NormalComponent3 {
|
|
|
13337
13348
|
layer: props.layer ?? "top",
|
|
13338
13349
|
rotation: props.pcbRotation ?? 0,
|
|
13339
13350
|
source_component_id: this.source_component_id,
|
|
13340
|
-
subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0
|
|
13351
|
+
subcircuit_id: this.getSubcircuit().subcircuit_id ?? void 0,
|
|
13352
|
+
do_not_place: props.doNotPlace ?? false
|
|
13341
13353
|
});
|
|
13342
13354
|
this.pcb_component_id = pcb_component.pcb_component_id;
|
|
13343
13355
|
}
|
|
@@ -15691,7 +15703,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
15691
15703
|
var package_default = {
|
|
15692
15704
|
name: "@tscircuit/core",
|
|
15693
15705
|
type: "module",
|
|
15694
|
-
version: "0.0.
|
|
15706
|
+
version: "0.0.742",
|
|
15695
15707
|
types: "dist/index.d.ts",
|
|
15696
15708
|
main: "dist/index.js",
|
|
15697
15709
|
module: "dist/index.js",
|
|
@@ -15744,7 +15756,7 @@ var package_default = {
|
|
|
15744
15756
|
"bun-match-svg": "0.0.12",
|
|
15745
15757
|
"calculate-elbow": "^0.0.12",
|
|
15746
15758
|
"chokidar-cli": "^3.0.0",
|
|
15747
|
-
"circuit-json": "^0.0.
|
|
15759
|
+
"circuit-json": "^0.0.265",
|
|
15748
15760
|
"circuit-json-to-bpc": "^0.0.13",
|
|
15749
15761
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
15750
15762
|
"circuit-json-to-simple-3d": "^0.0.9",
|
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.743",
|
|
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.265",
|
|
58
58
|
"circuit-json-to-bpc": "^0.0.13",
|
|
59
59
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
60
60
|
"circuit-json-to-simple-3d": "^0.0.9",
|