@tscircuit/core 0.0.349 → 0.0.351
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 -0
- package/dist/index.js +58 -18
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -5805,6 +5805,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
|
|
|
5805
5805
|
|
|
5806
5806
|
declare class SilkscreenCircle extends PrimitiveComponent<typeof silkscreenCircleProps> {
|
|
5807
5807
|
pcb_silkscreen_circle_id: string | null;
|
|
5808
|
+
isPcbPrimitive: boolean;
|
|
5808
5809
|
get config(): {
|
|
5809
5810
|
componentName: string;
|
|
5810
5811
|
zodProps: zod.ZodObject<zod.objectUtil.extendShape<Omit<{
|
|
@@ -5846,10 +5847,15 @@ declare class SilkscreenCircle extends PrimitiveComponent<typeof silkscreenCircl
|
|
|
5846
5847
|
}>;
|
|
5847
5848
|
};
|
|
5848
5849
|
doInitialPcbPrimitiveRender(): void;
|
|
5850
|
+
getPcbSize(): {
|
|
5851
|
+
width: number;
|
|
5852
|
+
height: number;
|
|
5853
|
+
};
|
|
5849
5854
|
}
|
|
5850
5855
|
|
|
5851
5856
|
declare class SilkscreenPath extends PrimitiveComponent<typeof silkscreenPathProps> {
|
|
5852
5857
|
pcb_silkscreen_path_id: string | null;
|
|
5858
|
+
isPcbPrimitive: boolean;
|
|
5853
5859
|
get config(): {
|
|
5854
5860
|
componentName: string;
|
|
5855
5861
|
zodProps: zod.ZodObject<zod.objectUtil.extendShape<Omit<{
|
|
@@ -5923,10 +5929,15 @@ declare class SilkscreenPath extends PrimitiveComponent<typeof silkscreenPathPro
|
|
|
5923
5929
|
}>;
|
|
5924
5930
|
};
|
|
5925
5931
|
doInitialPcbPrimitiveRender(): void;
|
|
5932
|
+
getPcbSize(): {
|
|
5933
|
+
width: number;
|
|
5934
|
+
height: number;
|
|
5935
|
+
};
|
|
5926
5936
|
}
|
|
5927
5937
|
|
|
5928
5938
|
declare class SilkscreenRect extends PrimitiveComponent<typeof silkscreenRectProps> {
|
|
5929
5939
|
pcb_silkscreen_rect_id: string | null;
|
|
5940
|
+
isPcbPrimitive: boolean;
|
|
5930
5941
|
get config(): {
|
|
5931
5942
|
componentName: string;
|
|
5932
5943
|
zodProps: zod.ZodObject<zod.objectUtil.extendShape<Omit<{
|
|
@@ -5971,6 +5982,10 @@ declare class SilkscreenRect extends PrimitiveComponent<typeof silkscreenRectPro
|
|
|
5971
5982
|
}>;
|
|
5972
5983
|
};
|
|
5973
5984
|
doInitialPcbPrimitiveRender(): void;
|
|
5985
|
+
getPcbSize(): {
|
|
5986
|
+
width: number;
|
|
5987
|
+
height: number;
|
|
5988
|
+
};
|
|
5974
5989
|
}
|
|
5975
5990
|
|
|
5976
5991
|
declare class SilkscreenText extends PrimitiveComponent<typeof silkscreenTextProps> {
|
|
@@ -6026,6 +6041,7 @@ declare class SilkscreenText extends PrimitiveComponent<typeof silkscreenTextPro
|
|
|
6026
6041
|
|
|
6027
6042
|
declare class SilkscreenLine extends PrimitiveComponent<typeof silkscreenLineProps> {
|
|
6028
6043
|
pcb_silkscreen_line_id: string | null;
|
|
6044
|
+
isPcbPrimitive: boolean;
|
|
6029
6045
|
get config(): {
|
|
6030
6046
|
componentName: string;
|
|
6031
6047
|
zodProps: zod.ZodObject<zod.objectUtil.extendShape<Omit<{
|
|
@@ -6066,6 +6082,10 @@ declare class SilkscreenLine extends PrimitiveComponent<typeof silkscreenLinePro
|
|
|
6066
6082
|
}>;
|
|
6067
6083
|
};
|
|
6068
6084
|
doInitialPcbPrimitiveRender(): void;
|
|
6085
|
+
getPcbSize(): {
|
|
6086
|
+
width: number;
|
|
6087
|
+
height: number;
|
|
6088
|
+
};
|
|
6069
6089
|
}
|
|
6070
6090
|
|
|
6071
6091
|
declare class SmtPad extends PrimitiveComponent<typeof smtPadProps> {
|
package/dist/index.js
CHANGED
|
@@ -1568,6 +1568,7 @@ import { silkscreenPathProps } from "@tscircuit/props";
|
|
|
1568
1568
|
import { applyToPoint as applyToPoint2 } from "transformation-matrix";
|
|
1569
1569
|
var SilkscreenPath = class extends PrimitiveComponent {
|
|
1570
1570
|
pcb_silkscreen_path_id = null;
|
|
1571
|
+
isPcbPrimitive = true;
|
|
1571
1572
|
get config() {
|
|
1572
1573
|
return {
|
|
1573
1574
|
componentName: "SilkscreenPath",
|
|
@@ -1578,7 +1579,8 @@ var SilkscreenPath = class extends PrimitiveComponent {
|
|
|
1578
1579
|
if (this.root?.pcbDisabled) return;
|
|
1579
1580
|
const { db } = this.root;
|
|
1580
1581
|
const { _parsedProps: props } = this;
|
|
1581
|
-
const
|
|
1582
|
+
const { maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
|
|
1583
|
+
const layer = maybeFlipLayer(props.layer ?? "top");
|
|
1582
1584
|
if (layer !== "top" && layer !== "bottom") {
|
|
1583
1585
|
throw new Error(
|
|
1584
1586
|
`Invalid layer "${layer}" for SilkscreenPath. Must be "top" or "bottom".`
|
|
@@ -1606,6 +1608,23 @@ var SilkscreenPath = class extends PrimitiveComponent {
|
|
|
1606
1608
|
});
|
|
1607
1609
|
this.pcb_silkscreen_path_id = pcb_silkscreen_path.pcb_silkscreen_path_id;
|
|
1608
1610
|
}
|
|
1611
|
+
getPcbSize() {
|
|
1612
|
+
const { _parsedProps: props } = this;
|
|
1613
|
+
if (!props.route || props.route.length === 0) {
|
|
1614
|
+
return { width: 0, height: 0 };
|
|
1615
|
+
}
|
|
1616
|
+
let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
|
|
1617
|
+
for (const point of props.route) {
|
|
1618
|
+
minX = Math.min(minX, point.x);
|
|
1619
|
+
maxX = Math.max(maxX, point.x);
|
|
1620
|
+
minY = Math.min(minY, point.y);
|
|
1621
|
+
maxY = Math.max(maxY, point.y);
|
|
1622
|
+
}
|
|
1623
|
+
return {
|
|
1624
|
+
width: maxX - minX,
|
|
1625
|
+
height: maxY - minY
|
|
1626
|
+
};
|
|
1627
|
+
}
|
|
1609
1628
|
};
|
|
1610
1629
|
|
|
1611
1630
|
// lib/components/primitive-components/PlatedHole.ts
|
|
@@ -1988,7 +2007,7 @@ function getBoundsOfPcbComponents(components) {
|
|
|
1988
2007
|
let maxX = -Infinity;
|
|
1989
2008
|
let maxY = -Infinity;
|
|
1990
2009
|
for (const child of components) {
|
|
1991
|
-
if (child.isPcbPrimitive && child.componentName
|
|
2010
|
+
if (child.isPcbPrimitive && !child.componentName.startsWith("Silkscreen")) {
|
|
1992
2011
|
const { x, y } = child._getGlobalPcbPositionBeforeLayout();
|
|
1993
2012
|
const { width: width2, height: height2 } = child.getPcbSize();
|
|
1994
2013
|
minX = Math.min(minX, x - width2 / 2);
|
|
@@ -6128,23 +6147,23 @@ var Board = class extends Group {
|
|
|
6128
6147
|
let minY = Infinity;
|
|
6129
6148
|
let maxX = -Infinity;
|
|
6130
6149
|
let maxY = -Infinity;
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
const { width, height, center: center2 } = pcb_component;
|
|
6150
|
+
const allPcbComponents = db.pcb_component.list();
|
|
6151
|
+
let hasComponents = false;
|
|
6152
|
+
for (const pcbComponent of allPcbComponents) {
|
|
6153
|
+
const { width, height, center: center2 } = pcbComponent;
|
|
6136
6154
|
if (width === 0 || height === 0) continue;
|
|
6155
|
+
hasComponents = true;
|
|
6137
6156
|
minX = Math.min(minX, center2.x - width / 2);
|
|
6138
6157
|
minY = Math.min(minY, center2.y - height / 2);
|
|
6139
6158
|
maxX = Math.max(maxX, center2.x + width / 2);
|
|
6140
6159
|
maxY = Math.max(maxY, center2.y + height / 2);
|
|
6141
6160
|
}
|
|
6142
6161
|
const padding = 2;
|
|
6143
|
-
const computedWidth = maxX - minX + padding * 2;
|
|
6144
|
-
const computedHeight = maxY - minY + padding * 2;
|
|
6162
|
+
const computedWidth = hasComponents ? maxX - minX + padding * 2 : 0;
|
|
6163
|
+
const computedHeight = hasComponents ? maxY - minY + padding * 2 : 0;
|
|
6145
6164
|
const center = {
|
|
6146
|
-
x: (minX + maxX) / 2 + (props.outlineOffsetX ?? 0),
|
|
6147
|
-
y: (minY + maxY) / 2 + (props.outlineOffsetY ?? 0)
|
|
6165
|
+
x: hasComponents ? (minX + maxX) / 2 + (props.outlineOffsetX ?? 0) : props.outlineOffsetX ?? 0,
|
|
6166
|
+
y: hasComponents ? (minY + maxY) / 2 + (props.outlineOffsetY ?? 0) : props.outlineOffsetY ?? 0
|
|
6148
6167
|
};
|
|
6149
6168
|
db.pcb_board.update(this.pcb_board_id, {
|
|
6150
6169
|
width: computedWidth,
|
|
@@ -6701,6 +6720,7 @@ var NetAlias = class extends PrimitiveComponent {
|
|
|
6701
6720
|
import { silkscreenCircleProps } from "@tscircuit/props";
|
|
6702
6721
|
var SilkscreenCircle = class extends PrimitiveComponent {
|
|
6703
6722
|
pcb_silkscreen_circle_id = null;
|
|
6723
|
+
isPcbPrimitive = true;
|
|
6704
6724
|
get config() {
|
|
6705
6725
|
return {
|
|
6706
6726
|
componentName: "SilkscreenCircle",
|
|
@@ -6711,7 +6731,8 @@ var SilkscreenCircle = class extends PrimitiveComponent {
|
|
|
6711
6731
|
if (this.root?.pcbDisabled) return;
|
|
6712
6732
|
const { db } = this.root;
|
|
6713
6733
|
const { _parsedProps: props } = this;
|
|
6714
|
-
const
|
|
6734
|
+
const { maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
|
|
6735
|
+
const layer = maybeFlipLayer(props.layer ?? "top");
|
|
6715
6736
|
if (layer !== "top" && layer !== "bottom") {
|
|
6716
6737
|
throw new Error(
|
|
6717
6738
|
`Invalid layer "${layer}" for SilkscreenCircle. Must be "top" or "bottom".`
|
|
@@ -6733,12 +6754,18 @@ var SilkscreenCircle = class extends PrimitiveComponent {
|
|
|
6733
6754
|
});
|
|
6734
6755
|
this.pcb_silkscreen_circle_id = pcb_silkscreen_circle.pcb_silkscreen_circle_id;
|
|
6735
6756
|
}
|
|
6757
|
+
getPcbSize() {
|
|
6758
|
+
const { _parsedProps: props } = this;
|
|
6759
|
+
const diameter = props.radius * 2;
|
|
6760
|
+
return { width: diameter, height: diameter };
|
|
6761
|
+
}
|
|
6736
6762
|
};
|
|
6737
6763
|
|
|
6738
6764
|
// lib/components/primitive-components/SilkscreenRect.ts
|
|
6739
6765
|
import { silkscreenRectProps } from "@tscircuit/props";
|
|
6740
6766
|
var SilkscreenRect = class extends PrimitiveComponent {
|
|
6741
6767
|
pcb_silkscreen_rect_id = null;
|
|
6768
|
+
isPcbPrimitive = true;
|
|
6742
6769
|
get config() {
|
|
6743
6770
|
return {
|
|
6744
6771
|
componentName: "SilkscreenRect",
|
|
@@ -6749,7 +6776,8 @@ var SilkscreenRect = class extends PrimitiveComponent {
|
|
|
6749
6776
|
if (this.root?.pcbDisabled) return;
|
|
6750
6777
|
const { db } = this.root;
|
|
6751
6778
|
const { _parsedProps: props } = this;
|
|
6752
|
-
const
|
|
6779
|
+
const { maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
|
|
6780
|
+
const layer = maybeFlipLayer(props.layer ?? "top");
|
|
6753
6781
|
if (layer !== "top" && layer !== "bottom") {
|
|
6754
6782
|
throw new Error(
|
|
6755
6783
|
`Invalid layer "${layer}" for SilkscreenRect. Must be "top" or "bottom".`
|
|
@@ -6771,12 +6799,17 @@ var SilkscreenRect = class extends PrimitiveComponent {
|
|
|
6771
6799
|
});
|
|
6772
6800
|
this.pcb_silkscreen_rect_id = pcb_silkscreen_rect.pcb_silkscreen_rect_id;
|
|
6773
6801
|
}
|
|
6802
|
+
getPcbSize() {
|
|
6803
|
+
const { _parsedProps: props } = this;
|
|
6804
|
+
return { width: props.width, height: props.height };
|
|
6805
|
+
}
|
|
6774
6806
|
};
|
|
6775
6807
|
|
|
6776
6808
|
// lib/components/primitive-components/SilkscreenLine.ts
|
|
6777
6809
|
import { silkscreenLineProps } from "@tscircuit/props";
|
|
6778
6810
|
var SilkscreenLine = class extends PrimitiveComponent {
|
|
6779
6811
|
pcb_silkscreen_line_id = null;
|
|
6812
|
+
isPcbPrimitive = true;
|
|
6780
6813
|
get config() {
|
|
6781
6814
|
return {
|
|
6782
6815
|
componentName: "SilkscreenLine",
|
|
@@ -6787,7 +6820,8 @@ var SilkscreenLine = class extends PrimitiveComponent {
|
|
|
6787
6820
|
if (this.root?.pcbDisabled) return;
|
|
6788
6821
|
const { db } = this.root;
|
|
6789
6822
|
const { _parsedProps: props } = this;
|
|
6790
|
-
const
|
|
6823
|
+
const { maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
|
|
6824
|
+
const layer = maybeFlipLayer(props.layer ?? "top");
|
|
6791
6825
|
if (layer !== "top" && layer !== "bottom") {
|
|
6792
6826
|
throw new Error(
|
|
6793
6827
|
`Invalid layer "${layer}" for SilkscreenLine. Must be "top" or "bottom".`
|
|
@@ -6807,6 +6841,12 @@ var SilkscreenLine = class extends PrimitiveComponent {
|
|
|
6807
6841
|
});
|
|
6808
6842
|
this.pcb_silkscreen_line_id = pcb_silkscreen_line.pcb_silkscreen_line_id;
|
|
6809
6843
|
}
|
|
6844
|
+
getPcbSize() {
|
|
6845
|
+
const { _parsedProps: props } = this;
|
|
6846
|
+
const width = Math.abs(props.x2 - props.x1);
|
|
6847
|
+
const height = Math.abs(props.y2 - props.y1);
|
|
6848
|
+
return { width, height };
|
|
6849
|
+
}
|
|
6810
6850
|
};
|
|
6811
6851
|
|
|
6812
6852
|
// lib/components/primitive-components/Via.ts
|
|
@@ -7265,7 +7305,7 @@ import { identity as identity4 } from "transformation-matrix";
|
|
|
7265
7305
|
var package_default = {
|
|
7266
7306
|
name: "@tscircuit/core",
|
|
7267
7307
|
type: "module",
|
|
7268
|
-
version: "0.0.
|
|
7308
|
+
version: "0.0.350",
|
|
7269
7309
|
types: "dist/index.d.ts",
|
|
7270
7310
|
main: "dist/index.js",
|
|
7271
7311
|
module: "dist/index.js",
|
|
@@ -7298,7 +7338,7 @@ var package_default = {
|
|
|
7298
7338
|
"@types/react-reconciler": "^0.28.9",
|
|
7299
7339
|
"bun-match-svg": "0.0.8",
|
|
7300
7340
|
"chokidar-cli": "^3.0.0",
|
|
7301
|
-
"circuit-to-svg": "^0.0.
|
|
7341
|
+
"circuit-to-svg": "^0.0.113",
|
|
7302
7342
|
concurrently: "^9.1.2",
|
|
7303
7343
|
debug: "^4.3.6",
|
|
7304
7344
|
"graphics-debug": "^0.0.4",
|
|
@@ -7312,8 +7352,8 @@ var package_default = {
|
|
|
7312
7352
|
tsup: "^8.2.4"
|
|
7313
7353
|
},
|
|
7314
7354
|
peerDependencies: {
|
|
7315
|
-
|
|
7316
|
-
|
|
7355
|
+
"@tscircuit/footprinter": "*",
|
|
7356
|
+
typescript: "^5.0.0"
|
|
7317
7357
|
},
|
|
7318
7358
|
dependencies: {
|
|
7319
7359
|
"@lume/kiwi": "^0.4.3",
|
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.351",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@types/react-reconciler": "^0.28.9",
|
|
35
35
|
"bun-match-svg": "0.0.8",
|
|
36
36
|
"chokidar-cli": "^3.0.0",
|
|
37
|
-
"circuit-to-svg": "^0.0.
|
|
37
|
+
"circuit-to-svg": "^0.0.113",
|
|
38
38
|
"concurrently": "^9.1.2",
|
|
39
39
|
"debug": "^4.3.6",
|
|
40
40
|
"graphics-debug": "^0.0.4",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"tsup": "^8.2.4"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"
|
|
52
|
-
"
|
|
51
|
+
"@tscircuit/footprinter": "*",
|
|
52
|
+
"typescript": "^5.0.0"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@lume/kiwi": "^0.4.3",
|