@tscircuit/core 0.0.705 → 0.0.707

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 (3) hide show
  1. package/dist/index.d.ts +16167 -7945
  2. package/dist/index.js +18 -11
  3. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -685,15 +685,23 @@ var PrimitiveComponent2 = class extends Renderable {
685
685
  });
686
686
  this.parent?.onChildChanged?.(this);
687
687
  }
688
+ _getPcbRotationBeforeLayout() {
689
+ const { pcbRotation } = this.props;
690
+ if (typeof pcbRotation === "string") {
691
+ return parseFloat(pcbRotation);
692
+ }
693
+ return pcbRotation ?? null;
694
+ }
688
695
  /**
689
696
  * Computes a transformation matrix from the props of this component for PCB
690
697
  * components
691
698
  */
692
699
  computePcbPropsTransform() {
693
700
  const { _parsedProps: props } = this;
701
+ const rotation4 = this._getPcbRotationBeforeLayout() ?? 0;
694
702
  const matrix = compose(
695
703
  translate(props.pcbX ?? 0, props.pcbY ?? 0),
696
- rotate((props.pcbRotation ?? 0) * Math.PI / 180)
704
+ rotate(rotation4 * Math.PI / 180)
697
705
  );
698
706
  return matrix;
699
707
  }
@@ -705,14 +713,14 @@ var PrimitiveComponent2 = class extends Renderable {
705
713
  * components positions before layout is applied
706
714
  */
707
715
  _computePcbGlobalTransformBeforeLayout() {
708
- const { _parsedProps: props } = this;
709
716
  const manualPlacement = this.getSubcircuit()._getPcbManualPlacementForComponent(this);
710
717
  if (manualPlacement && this.props.pcbX === void 0 && this.props.pcbY === void 0) {
718
+ const rotation4 = this._getPcbRotationBeforeLayout() ?? 0;
711
719
  return compose(
712
720
  this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity(),
713
721
  compose(
714
722
  translate(manualPlacement.x, manualPlacement.y),
715
- rotate((props.pcbRotation ?? 0) * Math.PI / 180)
723
+ rotate(rotation4 * Math.PI / 180)
716
724
  )
717
725
  );
718
726
  }
@@ -720,13 +728,7 @@ var PrimitiveComponent2 = class extends Renderable {
720
728
  const primitiveContainer = this.getPrimitiveContainer();
721
729
  if (primitiveContainer) {
722
730
  const isFlipped = primitiveContainer._parsedProps.layer === "bottom";
723
- const containerCenter = primitiveContainer._getGlobalPcbPositionBeforeLayout();
724
731
  if (isFlipped) {
725
- const flipOperation = compose(
726
- translate(containerCenter.x, containerCenter.y),
727
- flipY(),
728
- translate(-containerCenter.x, -containerCenter.y)
729
- );
730
732
  return compose(
731
733
  this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity(),
732
734
  flipY(),
@@ -13434,6 +13436,11 @@ var Battery = class extends NormalComponent2 {
13434
13436
  // lib/components/normal-components/PinHeader.ts
13435
13437
  import { pinHeaderProps } from "@tscircuit/props";
13436
13438
  var PinHeader = class extends NormalComponent2 {
13439
+ _getPcbRotationBeforeLayout() {
13440
+ const orientationRotation = this.props.pcbOrientation === "vertical" ? -90 : 0;
13441
+ const baseRotation = super._getPcbRotationBeforeLayout() ?? 0;
13442
+ return baseRotation + orientationRotation;
13443
+ }
13437
13444
  get config() {
13438
13445
  return {
13439
13446
  componentName: "PinHeader",
@@ -14372,7 +14379,7 @@ import { identity as identity6 } from "transformation-matrix";
14372
14379
  var package_default = {
14373
14380
  name: "@tscircuit/core",
14374
14381
  type: "module",
14375
- version: "0.0.704",
14382
+ version: "0.0.706",
14376
14383
  types: "dist/index.d.ts",
14377
14384
  main: "dist/index.js",
14378
14385
  module: "dist/index.js",
@@ -14411,7 +14418,7 @@ var package_default = {
14411
14418
  "@tscircuit/matchpack": "^0.0.16",
14412
14419
  "@tscircuit/math-utils": "^0.0.21",
14413
14420
  "@tscircuit/miniflex": "^0.0.4",
14414
- "@tscircuit/props": "0.0.300",
14421
+ "@tscircuit/props": "0.0.307",
14415
14422
  "@tscircuit/schematic-autolayout": "^0.0.6",
14416
14423
  "@tscircuit/schematic-match-adapt": "^0.0.16",
14417
14424
  "@tscircuit/schematic-trace-solver": "^0.0.35",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.705",
4
+ "version": "0.0.707",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -40,7 +40,7 @@
40
40
  "@tscircuit/matchpack": "^0.0.16",
41
41
  "@tscircuit/math-utils": "^0.0.21",
42
42
  "@tscircuit/miniflex": "^0.0.4",
43
- "@tscircuit/props": "0.0.300",
43
+ "@tscircuit/props": "0.0.307",
44
44
  "@tscircuit/schematic-autolayout": "^0.0.6",
45
45
  "@tscircuit/schematic-match-adapt": "^0.0.16",
46
46
  "@tscircuit/schematic-trace-solver": "^0.0.35",