@tscircuit/core 0.0.188 → 0.0.190
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 +53 -6
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2785,8 +2785,14 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
2785
2785
|
const { _parsedProps: props } = this;
|
|
2786
2786
|
const dimensions = this._getSchematicBoxDimensions();
|
|
2787
2787
|
const primaryPortLabels = {};
|
|
2788
|
-
|
|
2789
|
-
|
|
2788
|
+
if (Array.isArray(props.pinLabels)) {
|
|
2789
|
+
props.pinLabels.forEach((label, index) => {
|
|
2790
|
+
primaryPortLabels[String(index + 1)] = label;
|
|
2791
|
+
});
|
|
2792
|
+
} else {
|
|
2793
|
+
for (const [port, label] of Object.entries(props.pinLabels ?? {})) {
|
|
2794
|
+
primaryPortLabels[port] = Array.isArray(label) ? label[0] : label;
|
|
2795
|
+
}
|
|
2790
2796
|
}
|
|
2791
2797
|
const schematic_component2 = db.schematic_component.insert({
|
|
2792
2798
|
center: { x: props.schX ?? 0, y: props.schY ?? 0 },
|
|
@@ -4536,6 +4542,7 @@ var Chip = class extends NormalComponent {
|
|
|
4536
4542
|
supplier_part_numbers: props.supplierPartNumbers
|
|
4537
4543
|
});
|
|
4538
4544
|
const dimensions = this._getSchematicBoxDimensions();
|
|
4545
|
+
const hasOnlyLeftAndRightPins = props.schPortArrangement?.topSide !== void 0 && props.schPortArrangement?.bottomSide !== void 0;
|
|
4539
4546
|
const schematic_box_width = dimensions?.getSize().width;
|
|
4540
4547
|
const schematic_box_height = dimensions?.getSize().height;
|
|
4541
4548
|
const manufacturer_part_number_text = db.schematic_text.insert({
|
|
@@ -4544,8 +4551,8 @@ var Chip = class extends NormalComponent {
|
|
|
4544
4551
|
anchor: "left",
|
|
4545
4552
|
rotation: 0,
|
|
4546
4553
|
position: {
|
|
4547
|
-
x: (props.schX ?? 0) + (schematic_box_width ?? 0) / 2,
|
|
4548
|
-
y: (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.55
|
|
4554
|
+
x: hasOnlyLeftAndRightPins ? (props.schX ?? 0) + (schematic_box_width ?? 0) / 2 : (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
|
|
4555
|
+
y: hasOnlyLeftAndRightPins ? (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.55 : (props.schY ?? 0) - (schematic_box_height ?? 0) / 2 - 0.13
|
|
4549
4556
|
},
|
|
4550
4557
|
color: "#006464"
|
|
4551
4558
|
});
|
|
@@ -4555,8 +4562,8 @@ var Chip = class extends NormalComponent {
|
|
|
4555
4562
|
anchor: "left",
|
|
4556
4563
|
rotation: 0,
|
|
4557
4564
|
position: {
|
|
4558
|
-
x: (props.schX ?? 0) + (schematic_box_width ?? 0) / 2,
|
|
4559
|
-
y: (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.35
|
|
4565
|
+
x: hasOnlyLeftAndRightPins ? (props.schX ?? 0) + (schematic_box_width ?? 0) / 2 : (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
|
|
4566
|
+
y: hasOnlyLeftAndRightPins ? (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.35 : (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.13
|
|
4560
4567
|
},
|
|
4561
4568
|
color: "#006464"
|
|
4562
4569
|
});
|
|
@@ -4626,6 +4633,32 @@ var Jumper = class extends NormalComponent {
|
|
|
4626
4633
|
manufacturer_part_number: props.manufacturerPartNumber,
|
|
4627
4634
|
supplier_part_numbers: props.supplierPartNumbers
|
|
4628
4635
|
});
|
|
4636
|
+
const dimensions = this._getSchematicBoxDimensions();
|
|
4637
|
+
const hasOnlyLeftAndRightPins = props.schPortArrangement?.topSide !== void 0 && props.schPortArrangement?.bottomSide !== void 0;
|
|
4638
|
+
const schematic_box_width = dimensions?.getSize().width;
|
|
4639
|
+
const schematic_box_height = dimensions?.getSize().height;
|
|
4640
|
+
const manufacturer_part_number_text = db.schematic_text.insert({
|
|
4641
|
+
text: props.manufacturerPartNumber ?? "",
|
|
4642
|
+
schematic_component_id: source_component.source_component_id,
|
|
4643
|
+
anchor: "left",
|
|
4644
|
+
rotation: 0,
|
|
4645
|
+
position: {
|
|
4646
|
+
x: hasOnlyLeftAndRightPins ? (props.schX ?? 0) + (schematic_box_width ?? 0) / 2 : (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
|
|
4647
|
+
y: hasOnlyLeftAndRightPins ? (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.55 : (props.schY ?? 0) - (schematic_box_height ?? 0) / 2 - 0.13
|
|
4648
|
+
},
|
|
4649
|
+
color: "#006464"
|
|
4650
|
+
});
|
|
4651
|
+
const component_name_text = db.schematic_text.insert({
|
|
4652
|
+
text: props.name ?? "",
|
|
4653
|
+
schematic_component_id: source_component.source_component_id,
|
|
4654
|
+
anchor: "left",
|
|
4655
|
+
rotation: 0,
|
|
4656
|
+
position: {
|
|
4657
|
+
x: hasOnlyLeftAndRightPins ? (props.schX ?? 0) + (schematic_box_width ?? 0) / 2 : (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
|
|
4658
|
+
y: hasOnlyLeftAndRightPins ? (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.35 : (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.13
|
|
4659
|
+
},
|
|
4660
|
+
color: "#006464"
|
|
4661
|
+
});
|
|
4629
4662
|
this.source_component_id = source_component.source_component_id;
|
|
4630
4663
|
}
|
|
4631
4664
|
doInitialPcbComponentRender() {
|
|
@@ -5176,6 +5209,20 @@ var PinHeader = class extends NormalComponent {
|
|
|
5176
5209
|
// gender: props.gender,
|
|
5177
5210
|
// pitch: props.pitch,
|
|
5178
5211
|
});
|
|
5212
|
+
const dimensions = this._getSchematicBoxDimensions();
|
|
5213
|
+
const schematic_box_width = dimensions?.getSize().width;
|
|
5214
|
+
const schematic_box_height = dimensions?.getSize().height;
|
|
5215
|
+
const component_name_text = db.schematic_text.insert({
|
|
5216
|
+
text: props.name ?? "",
|
|
5217
|
+
schematic_component_id: source_component.source_component_id,
|
|
5218
|
+
anchor: "left",
|
|
5219
|
+
rotation: 0,
|
|
5220
|
+
position: {
|
|
5221
|
+
x: (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
|
|
5222
|
+
y: (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.13
|
|
5223
|
+
},
|
|
5224
|
+
color: "#006464"
|
|
5225
|
+
});
|
|
5179
5226
|
this.source_component_id = source_component.source_component_id;
|
|
5180
5227
|
}
|
|
5181
5228
|
};
|
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.190",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@tscircuit/soup-util": "^0.0.40",
|
|
46
46
|
"circuit-json": "^0.0.104",
|
|
47
47
|
"circuit-json-to-connectivity-map": "^0.0.17",
|
|
48
|
-
"circuit-to-svg": "^0.0.
|
|
48
|
+
"circuit-to-svg": "^0.0.82",
|
|
49
49
|
"format-si-unit": "^0.0.2",
|
|
50
50
|
"nanoid": "^5.0.7",
|
|
51
51
|
"performance-now": "^2.1.0",
|