@tscircuit/core 0.0.706 → 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.
- package/dist/index.d.ts +20 -15
- package/dist/index.js +18 -11
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -360,6 +360,7 @@ declare abstract class PrimitiveComponent<ZodProps extends ZodType = any> extend
|
|
|
360
360
|
fallbackUnassignedName?: string;
|
|
361
361
|
constructor(props: z.input<ZodProps>);
|
|
362
362
|
setProps(props: Partial<z.input<ZodProps>>): void;
|
|
363
|
+
_getPcbRotationBeforeLayout(): number | null;
|
|
363
364
|
/**
|
|
364
365
|
* Computes a transformation matrix from the props of this component for PCB
|
|
365
366
|
* components
|
|
@@ -13381,13 +13382,13 @@ declare const voltageSourceProps: z.ZodObject<{
|
|
|
13381
13382
|
key?: any;
|
|
13382
13383
|
footprint?: _tscircuit_props.FootprintProp | undefined;
|
|
13383
13384
|
relative?: boolean | undefined;
|
|
13385
|
+
pcbRotation?: number | undefined;
|
|
13384
13386
|
layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
|
|
13385
13387
|
phase?: number | undefined;
|
|
13386
13388
|
pcbX?: number | undefined;
|
|
13387
13389
|
voltage?: number | undefined;
|
|
13388
13390
|
frequency?: number | undefined;
|
|
13389
13391
|
pcbY?: number | undefined;
|
|
13390
|
-
pcbRotation?: number | undefined;
|
|
13391
13392
|
pcbPositionAnchor?: string | undefined;
|
|
13392
13393
|
schX?: number | undefined;
|
|
13393
13394
|
schY?: number | undefined;
|
|
@@ -13536,6 +13537,7 @@ declare const voltageSourceProps: z.ZodObject<{
|
|
|
13536
13537
|
key?: any;
|
|
13537
13538
|
footprint?: _tscircuit_props.FootprintProp | undefined;
|
|
13538
13539
|
relative?: boolean | undefined;
|
|
13540
|
+
pcbRotation?: string | number | undefined;
|
|
13539
13541
|
layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
13540
13542
|
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
13541
13543
|
} | undefined;
|
|
@@ -13544,7 +13546,6 @@ declare const voltageSourceProps: z.ZodObject<{
|
|
|
13544
13546
|
voltage?: string | number | undefined;
|
|
13545
13547
|
frequency?: string | number | undefined;
|
|
13546
13548
|
pcbY?: string | number | undefined;
|
|
13547
|
-
pcbRotation?: string | number | undefined;
|
|
13548
13549
|
pcbPositionAnchor?: string | undefined;
|
|
13549
13550
|
schX?: string | number | undefined;
|
|
13550
13551
|
schY?: string | number | undefined;
|
|
@@ -14295,13 +14296,13 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
|
|
|
14295
14296
|
key?: any;
|
|
14296
14297
|
footprint?: _tscircuit_props.FootprintProp | undefined;
|
|
14297
14298
|
relative?: boolean | undefined;
|
|
14299
|
+
pcbRotation?: number | undefined;
|
|
14298
14300
|
layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
|
|
14299
14301
|
phase?: number | undefined;
|
|
14300
14302
|
pcbX?: number | undefined;
|
|
14301
14303
|
voltage?: number | undefined;
|
|
14302
14304
|
frequency?: number | undefined;
|
|
14303
14305
|
pcbY?: number | undefined;
|
|
14304
|
-
pcbRotation?: number | undefined;
|
|
14305
14306
|
pcbPositionAnchor?: string | undefined;
|
|
14306
14307
|
schX?: number | undefined;
|
|
14307
14308
|
schY?: number | undefined;
|
|
@@ -14450,6 +14451,7 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
|
|
|
14450
14451
|
key?: any;
|
|
14451
14452
|
footprint?: _tscircuit_props.FootprintProp | undefined;
|
|
14452
14453
|
relative?: boolean | undefined;
|
|
14454
|
+
pcbRotation?: string | number | undefined;
|
|
14453
14455
|
layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
14454
14456
|
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
14455
14457
|
} | undefined;
|
|
@@ -14458,7 +14460,6 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
|
|
|
14458
14460
|
voltage?: string | number | undefined;
|
|
14459
14461
|
frequency?: string | number | undefined;
|
|
14460
14462
|
pcbY?: string | number | undefined;
|
|
14461
|
-
pcbRotation?: string | number | undefined;
|
|
14462
14463
|
pcbPositionAnchor?: string | undefined;
|
|
14463
14464
|
schX?: string | number | undefined;
|
|
14464
14465
|
schY?: string | number | undefined;
|
|
@@ -15644,7 +15645,7 @@ declare class FabricationNotePath extends PrimitiveComponent<typeof fabricationN
|
|
|
15644
15645
|
}>>;
|
|
15645
15646
|
pcbRelative: zod.ZodOptional<zod.ZodBoolean>;
|
|
15646
15647
|
relative: zod.ZodOptional<zod.ZodBoolean>;
|
|
15647
|
-
}, "
|
|
15648
|
+
}, "pcbRotation" | "pcbX" | "pcbY"> & {
|
|
15648
15649
|
route: zod.ZodArray<zod.ZodObject<{
|
|
15649
15650
|
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
15650
15651
|
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
@@ -15831,7 +15832,7 @@ declare class BreakoutPoint extends PrimitiveComponent<typeof breakoutPointProps
|
|
|
15831
15832
|
}>>;
|
|
15832
15833
|
pcbRelative: zod.ZodOptional<zod.ZodBoolean>;
|
|
15833
15834
|
relative: zod.ZodOptional<zod.ZodBoolean>;
|
|
15834
|
-
}, "
|
|
15835
|
+
}, "pcbRotation" | "layer"> & {
|
|
15835
15836
|
connection: zod.ZodString;
|
|
15836
15837
|
}, "strip", zod.ZodTypeAny, {
|
|
15837
15838
|
connection: string;
|
|
@@ -16129,7 +16130,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
|
|
|
16129
16130
|
}>>;
|
|
16130
16131
|
pcbRelative: zod.ZodOptional<zod.ZodBoolean>;
|
|
16131
16132
|
relative: zod.ZodOptional<zod.ZodBoolean>;
|
|
16132
|
-
}, "
|
|
16133
|
+
}, "pcbRotation" | "layer"> & {
|
|
16133
16134
|
name: zod.ZodOptional<zod.ZodString>;
|
|
16134
16135
|
connectsTo: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodArray<zod.ZodString, "many">]>>;
|
|
16135
16136
|
shape: zod.ZodLiteral<"circle">;
|
|
@@ -16176,7 +16177,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
|
|
|
16176
16177
|
}>>;
|
|
16177
16178
|
pcbRelative: zod.ZodOptional<zod.ZodBoolean>;
|
|
16178
16179
|
relative: zod.ZodOptional<zod.ZodBoolean>;
|
|
16179
|
-
}, "
|
|
16180
|
+
}, "pcbRotation" | "layer"> & {
|
|
16180
16181
|
name: zod.ZodOptional<zod.ZodString>;
|
|
16181
16182
|
connectsTo: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodArray<zod.ZodString, "many">]>>;
|
|
16182
16183
|
shape: zod.ZodLiteral<"oval">;
|
|
@@ -16299,7 +16300,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
|
|
|
16299
16300
|
}>>;
|
|
16300
16301
|
pcbRelative: zod.ZodOptional<zod.ZodBoolean>;
|
|
16301
16302
|
relative: zod.ZodOptional<zod.ZodBoolean>;
|
|
16302
|
-
}, "
|
|
16303
|
+
}, "pcbRotation" | "layer"> & {
|
|
16303
16304
|
name: zod.ZodOptional<zod.ZodString>;
|
|
16304
16305
|
connectsTo: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodArray<zod.ZodString, "many">]>>;
|
|
16305
16306
|
shape: zod.ZodLiteral<"circular_hole_with_rect_pad">;
|
|
@@ -16355,7 +16356,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
|
|
|
16355
16356
|
}>>;
|
|
16356
16357
|
pcbRelative: zod.ZodOptional<zod.ZodBoolean>;
|
|
16357
16358
|
relative: zod.ZodOptional<zod.ZodBoolean>;
|
|
16358
|
-
}, "
|
|
16359
|
+
}, "pcbRotation" | "layer"> & {
|
|
16359
16360
|
name: zod.ZodOptional<zod.ZodString>;
|
|
16360
16361
|
connectsTo: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodArray<zod.ZodString, "many">]>>;
|
|
16361
16362
|
shape: zod.ZodLiteral<"pill_hole_with_rect_pad">;
|
|
@@ -16662,7 +16663,7 @@ declare class SilkscreenPath extends PrimitiveComponent<typeof silkscreenPathPro
|
|
|
16662
16663
|
}>>;
|
|
16663
16664
|
pcbRelative: zod.ZodOptional<zod.ZodBoolean>;
|
|
16664
16665
|
relative: zod.ZodOptional<zod.ZodBoolean>;
|
|
16665
|
-
}, "
|
|
16666
|
+
}, "pcbRotation" | "pcbX" | "pcbY"> & {
|
|
16666
16667
|
route: zod.ZodArray<zod.ZodObject<{
|
|
16667
16668
|
x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
16668
16669
|
y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
@@ -16892,7 +16893,7 @@ declare class SilkscreenLine extends PrimitiveComponent<typeof silkscreenLinePro
|
|
|
16892
16893
|
}>>;
|
|
16893
16894
|
pcbRelative: zod.ZodOptional<zod.ZodBoolean>;
|
|
16894
16895
|
relative: zod.ZodOptional<zod.ZodBoolean>;
|
|
16895
|
-
}, "
|
|
16896
|
+
}, "pcbRotation" | "pcbX" | "pcbY"> & {
|
|
16896
16897
|
strokeWidth: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
16897
16898
|
x1: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
16898
16899
|
y1: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
@@ -17772,7 +17773,7 @@ declare class Cutout extends PrimitiveComponent<typeof cutoutProps> {
|
|
|
17772
17773
|
}>>;
|
|
17773
17774
|
pcbRelative: zod.ZodOptional<zod.ZodBoolean>;
|
|
17774
17775
|
relative: zod.ZodOptional<zod.ZodBoolean>;
|
|
17775
|
-
}, "
|
|
17776
|
+
}, "pcbRotation" | "layer"> & {
|
|
17776
17777
|
name: zod.ZodOptional<zod.ZodString>;
|
|
17777
17778
|
shape: zod.ZodLiteral<"rect">;
|
|
17778
17779
|
width: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
@@ -17813,7 +17814,7 @@ declare class Cutout extends PrimitiveComponent<typeof cutoutProps> {
|
|
|
17813
17814
|
}>>;
|
|
17814
17815
|
pcbRelative: zod.ZodOptional<zod.ZodBoolean>;
|
|
17815
17816
|
relative: zod.ZodOptional<zod.ZodBoolean>;
|
|
17816
|
-
}, "
|
|
17817
|
+
}, "pcbRotation" | "layer"> & {
|
|
17817
17818
|
name: zod.ZodOptional<zod.ZodString>;
|
|
17818
17819
|
shape: zod.ZodLiteral<"circle">;
|
|
17819
17820
|
radius: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
|
|
@@ -17851,7 +17852,7 @@ declare class Cutout extends PrimitiveComponent<typeof cutoutProps> {
|
|
|
17851
17852
|
}>>;
|
|
17852
17853
|
pcbRelative: zod.ZodOptional<zod.ZodBoolean>;
|
|
17853
17854
|
relative: zod.ZodOptional<zod.ZodBoolean>;
|
|
17854
|
-
}, "
|
|
17855
|
+
}, "pcbRotation" | "layer"> & {
|
|
17855
17856
|
name: zod.ZodOptional<zod.ZodString>;
|
|
17856
17857
|
shape: zod.ZodLiteral<"polygon">;
|
|
17857
17858
|
points: zod.ZodArray<zod.ZodObject<{
|
|
@@ -18830,6 +18831,7 @@ declare class Battery extends NormalComponent<typeof batteryProps, PassivePorts>
|
|
|
18830
18831
|
}
|
|
18831
18832
|
|
|
18832
18833
|
declare class PinHeader extends NormalComponent<typeof pinHeaderProps> {
|
|
18834
|
+
_getPcbRotationBeforeLayout(): number | null;
|
|
18833
18835
|
get config(): {
|
|
18834
18836
|
componentName: string;
|
|
18835
18837
|
zodProps: zod.ZodObject<{
|
|
@@ -19431,6 +19433,7 @@ declare class PinHeader extends NormalComponent<typeof pinHeaderProps> {
|
|
|
19431
19433
|
pcbPinLabels: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodString>>;
|
|
19432
19434
|
doubleRow: zod.ZodOptional<zod.ZodBoolean>;
|
|
19433
19435
|
rightAngle: zod.ZodOptional<zod.ZodBoolean>;
|
|
19436
|
+
pcbOrientation: zod.ZodOptional<zod.ZodEnum<["vertical", "horizontal"]>>;
|
|
19434
19437
|
holeDiameter: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
19435
19438
|
platedDiameter: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
19436
19439
|
pinLabels: zod.ZodOptional<zod.ZodUnion<[zod.ZodRecord<zod.ZodString, zod.ZodString>, zod.ZodArray<zod.ZodString, "many">]>>;
|
|
@@ -19766,6 +19769,7 @@ declare class PinHeader extends NormalComponent<typeof pinHeaderProps> {
|
|
|
19766
19769
|
showSilkscreenPinLabels?: boolean | undefined;
|
|
19767
19770
|
doubleRow?: boolean | undefined;
|
|
19768
19771
|
rightAngle?: boolean | undefined;
|
|
19772
|
+
pcbOrientation?: "vertical" | "horizontal" | undefined;
|
|
19769
19773
|
platedDiameter?: number | undefined;
|
|
19770
19774
|
facingDirection?: "left" | "right" | undefined;
|
|
19771
19775
|
}, {
|
|
@@ -19969,6 +19973,7 @@ declare class PinHeader extends NormalComponent<typeof pinHeaderProps> {
|
|
|
19969
19973
|
showSilkscreenPinLabels?: boolean | undefined;
|
|
19970
19974
|
doubleRow?: boolean | undefined;
|
|
19971
19975
|
rightAngle?: boolean | undefined;
|
|
19976
|
+
pcbOrientation?: "vertical" | "horizontal" | undefined;
|
|
19972
19977
|
platedDiameter?: string | number | undefined;
|
|
19973
19978
|
facingDirection?: "left" | "right" | undefined;
|
|
19974
19979
|
}>;
|
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(
|
|
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(
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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",
|