@tscircuit/core 0.0.830 → 0.0.832
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 +839 -0
- package/dist/index.js +81 -6
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2792,6 +2792,7 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
2792
2792
|
const uniqueLayers = new Set(props.layers);
|
|
2793
2793
|
if (props.layer) uniqueLayers.add(props.layer);
|
|
2794
2794
|
const targetLayers = uniqueLayers.size > 0 ? Array.from(uniqueLayers) : ["top"];
|
|
2795
|
+
const fontSize = props.fontSize ?? this.getInheritedProperty("pcbStyle")?.silkscreenFontSize ?? 1;
|
|
2795
2796
|
for (const layer of targetLayers) {
|
|
2796
2797
|
db.pcb_silkscreen_text.insert({
|
|
2797
2798
|
anchor_alignment: props.anchorAlignment,
|
|
@@ -2800,7 +2801,7 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
2800
2801
|
y: position.y
|
|
2801
2802
|
},
|
|
2802
2803
|
font: props.font ?? "tscircuit2024",
|
|
2803
|
-
font_size:
|
|
2804
|
+
font_size: fontSize,
|
|
2804
2805
|
layer: maybeFlipLayer(layer),
|
|
2805
2806
|
text: props.text ?? "",
|
|
2806
2807
|
ccw_rotation: rotation5,
|
|
@@ -2812,7 +2813,7 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
2812
2813
|
}
|
|
2813
2814
|
getPcbSize() {
|
|
2814
2815
|
const { _parsedProps: props } = this;
|
|
2815
|
-
const fontSize = props.fontSize ?? 1;
|
|
2816
|
+
const fontSize = props.fontSize ?? this.getInheritedProperty("pcbStyle")?.silkscreenFontSize ?? 1;
|
|
2816
2817
|
const text = props.text ?? "";
|
|
2817
2818
|
const textWidth = text.length * fontSize;
|
|
2818
2819
|
const textHeight = fontSize;
|
|
@@ -3481,7 +3482,8 @@ var portProps = z6.object({
|
|
|
3481
3482
|
layers: z6.array(z6.string()).optional(),
|
|
3482
3483
|
schX: z6.number().optional(),
|
|
3483
3484
|
schY: z6.number().optional(),
|
|
3484
|
-
direction: z6.enum(["up", "down", "left", "right"]).optional()
|
|
3485
|
+
direction: z6.enum(["up", "down", "left", "right"]).optional(),
|
|
3486
|
+
connectsTo: z6.union([z6.string(), z6.array(z6.string())]).optional()
|
|
3485
3487
|
});
|
|
3486
3488
|
var Port = class extends PrimitiveComponent2 {
|
|
3487
3489
|
source_port_id = null;
|
|
@@ -3509,6 +3511,28 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
3509
3511
|
}
|
|
3510
3512
|
this.matchedComponents = [];
|
|
3511
3513
|
}
|
|
3514
|
+
isGroupPort() {
|
|
3515
|
+
return this.parent?.componentName === "Group";
|
|
3516
|
+
}
|
|
3517
|
+
isComponentPort() {
|
|
3518
|
+
return !this.isGroupPort();
|
|
3519
|
+
}
|
|
3520
|
+
_getConnectedPortsFromConnectsTo() {
|
|
3521
|
+
const { _parsedProps: props } = this;
|
|
3522
|
+
const connectsTo = props.connectsTo;
|
|
3523
|
+
if (!connectsTo) return [];
|
|
3524
|
+
const connectedPorts = [];
|
|
3525
|
+
const connectsToArray = Array.isArray(connectsTo) ? connectsTo : [connectsTo];
|
|
3526
|
+
for (const connection of connectsToArray) {
|
|
3527
|
+
const port = this.getSubcircuit().selectOne(connection, {
|
|
3528
|
+
type: "port"
|
|
3529
|
+
});
|
|
3530
|
+
if (port) {
|
|
3531
|
+
connectedPorts.push(port);
|
|
3532
|
+
}
|
|
3533
|
+
}
|
|
3534
|
+
return connectedPorts;
|
|
3535
|
+
}
|
|
3512
3536
|
_isBoardPinoutFromAttributes() {
|
|
3513
3537
|
const parent = this.parent;
|
|
3514
3538
|
if (parent?._parsedProps?.pinAttributes) {
|
|
@@ -3737,6 +3761,13 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
3737
3761
|
const { db } = this.root;
|
|
3738
3762
|
const parentNormalComponent = this.getParentNormalComponent();
|
|
3739
3763
|
const parentWithSourceId = this.parent?.source_component_id ? this.parent : parentNormalComponent;
|
|
3764
|
+
if (this.isGroupPort()) {
|
|
3765
|
+
db.source_port.update(this.source_port_id, {
|
|
3766
|
+
source_component_id: null,
|
|
3767
|
+
subcircuit_id: this.getSubcircuit()?.subcircuit_id
|
|
3768
|
+
});
|
|
3769
|
+
return;
|
|
3770
|
+
}
|
|
3740
3771
|
if (!parentWithSourceId?.source_component_id) {
|
|
3741
3772
|
throw new Error(
|
|
3742
3773
|
`${this.getString()} has no parent source component (parent: ${this.parent?.getString()})`
|
|
@@ -3752,6 +3783,30 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
3752
3783
|
if (this.root?.pcbDisabled) return;
|
|
3753
3784
|
const { db } = this.root;
|
|
3754
3785
|
const { matchedComponents } = this;
|
|
3786
|
+
if (this.isGroupPort()) {
|
|
3787
|
+
const connectedPorts = this._getConnectedPortsFromConnectsTo();
|
|
3788
|
+
if (connectedPorts.length === 0) {
|
|
3789
|
+
return;
|
|
3790
|
+
}
|
|
3791
|
+
const connectedPort = connectedPorts[0];
|
|
3792
|
+
if (!connectedPort.pcb_port_id) {
|
|
3793
|
+
return;
|
|
3794
|
+
}
|
|
3795
|
+
const connectedPcbPort = db.pcb_port.get(connectedPort.pcb_port_id);
|
|
3796
|
+
const matchCenter2 = { x: connectedPcbPort.x, y: connectedPcbPort.y };
|
|
3797
|
+
const subcircuit = this.getSubcircuit();
|
|
3798
|
+
const pcb_port = db.pcb_port.insert({
|
|
3799
|
+
pcb_component_id: void 0,
|
|
3800
|
+
layers: connectedPort.getAvailablePcbLayers(),
|
|
3801
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
3802
|
+
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0,
|
|
3803
|
+
...matchCenter2,
|
|
3804
|
+
source_port_id: this.source_port_id,
|
|
3805
|
+
is_board_pinout: false
|
|
3806
|
+
});
|
|
3807
|
+
this.pcb_port_id = pcb_port.pcb_port_id;
|
|
3808
|
+
return;
|
|
3809
|
+
}
|
|
3755
3810
|
const parentNormalComponent = this.getParentNormalComponent();
|
|
3756
3811
|
const parentWithPcbComponentId = this.parent?.pcb_component_id ? this.parent : parentNormalComponent;
|
|
3757
3812
|
if (!parentWithPcbComponentId?.pcb_component_id) {
|
|
@@ -3798,6 +3853,26 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
3798
3853
|
if (this.root?.pcbDisabled) return;
|
|
3799
3854
|
const { db } = this.root;
|
|
3800
3855
|
if (this.pcb_port_id) return;
|
|
3856
|
+
if (this.isGroupPort()) {
|
|
3857
|
+
const connectedPorts = this._getConnectedPortsFromConnectsTo();
|
|
3858
|
+
if (connectedPorts.length === 0) return;
|
|
3859
|
+
const connectedPort = connectedPorts[0];
|
|
3860
|
+
if (!connectedPort.pcb_port_id) return;
|
|
3861
|
+
const connectedPcbPort = db.pcb_port.get(connectedPort.pcb_port_id);
|
|
3862
|
+
const matchCenter2 = { x: connectedPcbPort.x, y: connectedPcbPort.y };
|
|
3863
|
+
const subcircuit2 = this.getSubcircuit();
|
|
3864
|
+
const pcb_port2 = db.pcb_port.insert({
|
|
3865
|
+
pcb_component_id: void 0,
|
|
3866
|
+
layers: connectedPort.getAvailablePcbLayers(),
|
|
3867
|
+
subcircuit_id: subcircuit2?.subcircuit_id ?? void 0,
|
|
3868
|
+
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0,
|
|
3869
|
+
...matchCenter2,
|
|
3870
|
+
source_port_id: this.source_port_id,
|
|
3871
|
+
is_board_pinout: false
|
|
3872
|
+
});
|
|
3873
|
+
this.pcb_port_id = pcb_port2.pcb_port_id;
|
|
3874
|
+
return;
|
|
3875
|
+
}
|
|
3801
3876
|
const pcbMatches = this.matchedComponents.filter((c) => c.isPcbPrimitive);
|
|
3802
3877
|
if (pcbMatches.length === 0) return;
|
|
3803
3878
|
let matchCenter = null;
|
|
@@ -17409,7 +17484,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
17409
17484
|
var package_default = {
|
|
17410
17485
|
name: "@tscircuit/core",
|
|
17411
17486
|
type: "module",
|
|
17412
|
-
version: "0.0.
|
|
17487
|
+
version: "0.0.831",
|
|
17413
17488
|
types: "dist/index.d.ts",
|
|
17414
17489
|
main: "dist/index.js",
|
|
17415
17490
|
module: "dist/index.js",
|
|
@@ -17451,7 +17526,7 @@ var package_default = {
|
|
|
17451
17526
|
"@tscircuit/math-utils": "^0.0.29",
|
|
17452
17527
|
"@tscircuit/miniflex": "^0.0.4",
|
|
17453
17528
|
"@tscircuit/ngspice-spice-engine": "^0.0.2",
|
|
17454
|
-
"@tscircuit/props": "0.0.
|
|
17529
|
+
"@tscircuit/props": "^0.0.384",
|
|
17455
17530
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
17456
17531
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
17457
17532
|
"@tscircuit/schematic-trace-solver": "^0.0.41",
|
|
@@ -17464,7 +17539,7 @@ var package_default = {
|
|
|
17464
17539
|
"bun-match-svg": "0.0.12",
|
|
17465
17540
|
"calculate-elbow": "^0.0.12",
|
|
17466
17541
|
"chokidar-cli": "^3.0.0",
|
|
17467
|
-
"circuit-json": "^0.0.
|
|
17542
|
+
"circuit-json": "^0.0.295",
|
|
17468
17543
|
"circuit-json-to-bpc": "^0.0.13",
|
|
17469
17544
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
17470
17545
|
"circuit-json-to-gltf": "^0.0.31",
|
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.832",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@tscircuit/math-utils": "^0.0.29",
|
|
44
44
|
"@tscircuit/miniflex": "^0.0.4",
|
|
45
45
|
"@tscircuit/ngspice-spice-engine": "^0.0.2",
|
|
46
|
-
"@tscircuit/props": "0.0.
|
|
46
|
+
"@tscircuit/props": "^0.0.384",
|
|
47
47
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
48
48
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
49
49
|
"@tscircuit/schematic-trace-solver": "^0.0.41",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"bun-match-svg": "0.0.12",
|
|
57
57
|
"calculate-elbow": "^0.0.12",
|
|
58
58
|
"chokidar-cli": "^3.0.0",
|
|
59
|
-
"circuit-json": "^0.0.
|
|
59
|
+
"circuit-json": "^0.0.295",
|
|
60
60
|
"circuit-json-to-bpc": "^0.0.13",
|
|
61
61
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
62
62
|
"circuit-json-to-gltf": "^0.0.31",
|