@tscircuit/core 0.0.744 → 0.0.745
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 +30 -11
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
rotation as rotation2,
|
|
82
82
|
schematic_manual_edit_conflict_warning
|
|
83
83
|
} from "circuit-json";
|
|
84
|
-
import { decomposeTSR as
|
|
84
|
+
import { decomposeTSR as decomposeTSR5 } from "transformation-matrix";
|
|
85
85
|
import Debug4 from "debug";
|
|
86
86
|
|
|
87
87
|
// lib/fiber/create-instance-from-react-element.ts
|
|
@@ -2609,6 +2609,7 @@ var Hole = class extends PrimitiveComponent2 {
|
|
|
2609
2609
|
|
|
2610
2610
|
// lib/components/primitive-components/SilkscreenText.ts
|
|
2611
2611
|
import { silkscreenTextProps } from "@tscircuit/props";
|
|
2612
|
+
import { decomposeTSR as decomposeTSR3 } from "transformation-matrix";
|
|
2612
2613
|
var SilkscreenText = class extends PrimitiveComponent2 {
|
|
2613
2614
|
isPcbPrimitive = true;
|
|
2614
2615
|
get config() {
|
|
@@ -2623,8 +2624,19 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
2623
2624
|
const { _parsedProps: props } = this;
|
|
2624
2625
|
const container = this.getPrimitiveContainer();
|
|
2625
2626
|
const position = this._getGlobalPcbPositionBeforeLayout();
|
|
2626
|
-
const { maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
|
|
2627
|
+
const { maybeFlipLayer, isFlipped } = this._getPcbPrimitiveFlippedHelpers();
|
|
2627
2628
|
const subcircuit = this.getSubcircuit();
|
|
2629
|
+
let rotation5 = 0;
|
|
2630
|
+
if (props.pcbRotation !== void 0 && props.pcbRotation !== 0) {
|
|
2631
|
+
rotation5 = props.pcbRotation;
|
|
2632
|
+
} else {
|
|
2633
|
+
const globalTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
2634
|
+
const decomposedTransform = decomposeTSR3(globalTransform);
|
|
2635
|
+
rotation5 = decomposedTransform.rotation.angle * 180 / Math.PI;
|
|
2636
|
+
}
|
|
2637
|
+
if (isFlipped) {
|
|
2638
|
+
rotation5 = (rotation5 + 180) % 360;
|
|
2639
|
+
}
|
|
2628
2640
|
const uniqueLayers = new Set(props.layers);
|
|
2629
2641
|
if (props.layer) uniqueLayers.add(props.layer);
|
|
2630
2642
|
const targetLayers = uniqueLayers.size > 0 ? Array.from(uniqueLayers) : ["top"];
|
|
@@ -2639,7 +2651,7 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
2639
2651
|
font_size: props.fontSize ?? 1,
|
|
2640
2652
|
layer: maybeFlipLayer(layer),
|
|
2641
2653
|
text: props.text ?? "",
|
|
2642
|
-
ccw_rotation:
|
|
2654
|
+
ccw_rotation: rotation5,
|
|
2643
2655
|
pcb_component_id: container.pcb_component_id,
|
|
2644
2656
|
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
2645
2657
|
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
@@ -2841,8 +2853,12 @@ var createPinrowSilkscreenText = ({
|
|
|
2841
2853
|
// lib/utils/createComponentsFromCircuitJson.ts
|
|
2842
2854
|
var calculateCcwRotation = (componentRotationStr, elementCcwRotation) => {
|
|
2843
2855
|
const componentAngle = parseInt(componentRotationStr || "0", 10);
|
|
2844
|
-
|
|
2845
|
-
|
|
2856
|
+
let totalRotation;
|
|
2857
|
+
if (elementCcwRotation !== void 0 && elementCcwRotation !== null) {
|
|
2858
|
+
totalRotation = elementCcwRotation - componentAngle;
|
|
2859
|
+
} else {
|
|
2860
|
+
totalRotation = componentAngle;
|
|
2861
|
+
}
|
|
2846
2862
|
const normalizedRotation = (totalRotation % 360 + 360) % 360;
|
|
2847
2863
|
return normalizedRotation;
|
|
2848
2864
|
};
|
|
@@ -4234,7 +4250,7 @@ var Footprint = class extends PrimitiveComponent2 {
|
|
|
4234
4250
|
// lib/components/primitive-components/CadModel.ts
|
|
4235
4251
|
import { cadmodelProps, point3 } from "@tscircuit/props";
|
|
4236
4252
|
import { z as z7 } from "zod";
|
|
4237
|
-
import { decomposeTSR as
|
|
4253
|
+
import { decomposeTSR as decomposeTSR4 } from "transformation-matrix";
|
|
4238
4254
|
var rotation = z7.union([z7.number(), z7.string()]);
|
|
4239
4255
|
var rotation3 = z7.object({ x: rotation, y: rotation, z: rotation });
|
|
4240
4256
|
var CadModel = class extends PrimitiveComponent2 {
|
|
@@ -4255,7 +4271,7 @@ var CadModel = class extends PrimitiveComponent2 {
|
|
|
4255
4271
|
const props = this._parsedProps;
|
|
4256
4272
|
if (!props || typeof props.modelUrl !== "string") return;
|
|
4257
4273
|
const parentTransform = parent._computePcbGlobalTransformBeforeLayout();
|
|
4258
|
-
const decomposedTransform =
|
|
4274
|
+
const decomposedTransform = decomposeTSR4(parentTransform);
|
|
4259
4275
|
const accumulatedRotation = decomposedTransform.rotation.angle * 180 / Math.PI;
|
|
4260
4276
|
const rotationOffset = rotation3.parse({ x: 0, y: 0, z: 0 });
|
|
4261
4277
|
if (typeof props.rotationOffset === "number") {
|
|
@@ -7642,13 +7658,16 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
7642
7658
|
const { db } = this.root;
|
|
7643
7659
|
const { _parsedProps: props } = this;
|
|
7644
7660
|
const subcircuit = this.getSubcircuit();
|
|
7661
|
+
const globalTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
7662
|
+
const decomposedTransform = decomposeTSR5(globalTransform);
|
|
7663
|
+
const accumulatedRotation = decomposedTransform.rotation.angle * 180 / Math.PI;
|
|
7645
7664
|
const pcb_component = db.pcb_component.insert({
|
|
7646
7665
|
center: this._getGlobalPcbPositionBeforeLayout(),
|
|
7647
7666
|
// width/height are computed in the PcbComponentSizeCalculation phase
|
|
7648
7667
|
width: 0,
|
|
7649
7668
|
height: 0,
|
|
7650
7669
|
layer: props.layer ?? "top",
|
|
7651
|
-
rotation: props.pcbRotation ??
|
|
7670
|
+
rotation: props.pcbRotation ?? accumulatedRotation,
|
|
7652
7671
|
source_component_id: this.source_component_id,
|
|
7653
7672
|
subcircuit_id: subcircuit.subcircuit_id ?? void 0,
|
|
7654
7673
|
do_not_place: props.doNotPlace ?? false
|
|
@@ -8035,7 +8054,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
8035
8054
|
});
|
|
8036
8055
|
const computedLayer = this.props.layer === "bottom" ? "bottom" : "top";
|
|
8037
8056
|
const globalTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
8038
|
-
const decomposedTransform =
|
|
8057
|
+
const decomposedTransform = decomposeTSR5(globalTransform);
|
|
8039
8058
|
const accumulatedRotation = decomposedTransform.rotation.angle * 180 / Math.PI;
|
|
8040
8059
|
const cad_model = db.cad_component.insert({
|
|
8041
8060
|
// TODO z maybe depends on layer
|
|
@@ -15705,7 +15724,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
15705
15724
|
var package_default = {
|
|
15706
15725
|
name: "@tscircuit/core",
|
|
15707
15726
|
type: "module",
|
|
15708
|
-
version: "0.0.
|
|
15727
|
+
version: "0.0.744",
|
|
15709
15728
|
types: "dist/index.d.ts",
|
|
15710
15729
|
main: "dist/index.js",
|
|
15711
15730
|
module: "dist/index.js",
|
|
@@ -15762,7 +15781,7 @@ var package_default = {
|
|
|
15762
15781
|
"circuit-json-to-bpc": "^0.0.13",
|
|
15763
15782
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
15764
15783
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
15765
|
-
"circuit-to-svg": "^0.0.
|
|
15784
|
+
"circuit-to-svg": "^0.0.200",
|
|
15766
15785
|
concurrently: "^9.1.2",
|
|
15767
15786
|
"connectivity-map": "^1.0.0",
|
|
15768
15787
|
debug: "^4.3.6",
|
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.745",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -58,7 +58,7 @@
|
|
|
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",
|
|
61
|
-
"circuit-to-svg": "^0.0.
|
|
61
|
+
"circuit-to-svg": "^0.0.200",
|
|
62
62
|
"concurrently": "^9.1.2",
|
|
63
63
|
"connectivity-map": "^1.0.0",
|
|
64
64
|
"debug": "^4.3.6",
|