@tscircuit/core 0.0.211 → 0.0.213
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 +1 -0
- package/dist/index.js +33 -40
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2630,6 +2630,7 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
2630
2630
|
*
|
|
2631
2631
|
*/
|
|
2632
2632
|
initPorts(opts = {}) {
|
|
2633
|
+
if (this.root?.schematicDisabled) return;
|
|
2633
2634
|
const { config } = this;
|
|
2634
2635
|
const portsToCreate = [];
|
|
2635
2636
|
const schPortArrangement = this._parsedProps.schPortArrangement;
|
|
@@ -2838,6 +2839,7 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
2838
2839
|
* You can override this method to do more complicated things.
|
|
2839
2840
|
*/
|
|
2840
2841
|
doInitialSchematicComponentRender() {
|
|
2842
|
+
if (this.root?.schematicDisabled) return;
|
|
2841
2843
|
const { schematicSymbolName } = this.config;
|
|
2842
2844
|
if (schematicSymbolName) {
|
|
2843
2845
|
return this._doInitialSchematicComponentRenderWithSymbol();
|
|
@@ -2851,6 +2853,7 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
2851
2853
|
return void 0;
|
|
2852
2854
|
}
|
|
2853
2855
|
_doInitialSchematicComponentRenderWithSymbol() {
|
|
2856
|
+
if (this.root?.schematicDisabled) return;
|
|
2854
2857
|
const { db } = this.root;
|
|
2855
2858
|
const { _parsedProps: props } = this;
|
|
2856
2859
|
const symbol_name = this._getSchematicSymbolNameOrThrow();
|
|
@@ -2868,6 +2871,7 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
2868
2871
|
}
|
|
2869
2872
|
}
|
|
2870
2873
|
_doInitialSchematicComponentRenderWithSchematicBoxDimensions() {
|
|
2874
|
+
if (this.root?.schematicDisabled) return;
|
|
2871
2875
|
const { db } = this.root;
|
|
2872
2876
|
const { _parsedProps: props } = this;
|
|
2873
2877
|
const dimensions = this._getSchematicBoxDimensions();
|
|
@@ -2894,6 +2898,31 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
2894
2898
|
port_labels: primaryPortLabels,
|
|
2895
2899
|
source_component_id: this.source_component_id
|
|
2896
2900
|
});
|
|
2901
|
+
const hasTopOrBottomPins = props.schPortArrangement?.topSide !== void 0 || props.schPortArrangement?.bottomSide !== void 0;
|
|
2902
|
+
const schematic_box_width = dimensions?.getSize().width;
|
|
2903
|
+
const schematic_box_height = dimensions?.getSize().height;
|
|
2904
|
+
const manufacturer_part_number_schematic_text = db.schematic_text.insert({
|
|
2905
|
+
text: props.manufacturerPartNumber ?? "",
|
|
2906
|
+
schematic_component_id: schematic_component2.schematic_component_id,
|
|
2907
|
+
anchor: "left",
|
|
2908
|
+
rotation: 0,
|
|
2909
|
+
position: {
|
|
2910
|
+
x: hasTopOrBottomPins ? (props.schX ?? 0) + (schematic_box_width ?? 0) / 2 + 0.1 : (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
|
|
2911
|
+
y: hasTopOrBottomPins ? (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.35 : (props.schY ?? 0) - (schematic_box_height ?? 0) / 2 - 0.13
|
|
2912
|
+
},
|
|
2913
|
+
color: "#006464"
|
|
2914
|
+
});
|
|
2915
|
+
const component_name_text = db.schematic_text.insert({
|
|
2916
|
+
text: props.name ?? "",
|
|
2917
|
+
schematic_component_id: schematic_component2.source_component_id,
|
|
2918
|
+
anchor: "left",
|
|
2919
|
+
rotation: 0,
|
|
2920
|
+
position: {
|
|
2921
|
+
x: hasTopOrBottomPins ? (props.schX ?? 0) + (schematic_box_width ?? 0) / 2 + 0.1 : (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
|
|
2922
|
+
y: hasTopOrBottomPins ? (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.55 : (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.13
|
|
2923
|
+
},
|
|
2924
|
+
color: "#006464"
|
|
2925
|
+
});
|
|
2897
2926
|
this.schematic_component_id = schematic_component2.schematic_component_id;
|
|
2898
2927
|
}
|
|
2899
2928
|
doInitialPcbComponentRender() {
|
|
@@ -3042,6 +3071,7 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
3042
3071
|
return newPorts;
|
|
3043
3072
|
}
|
|
3044
3073
|
getPortsFromSchematicSymbol() {
|
|
3074
|
+
if (this.root?.schematicDisabled) return [];
|
|
3045
3075
|
const { config } = this;
|
|
3046
3076
|
if (!config.schematicSymbolName) return [];
|
|
3047
3077
|
const symbol = symbols2[config.schematicSymbolName];
|
|
@@ -4538,6 +4568,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
4538
4568
|
}
|
|
4539
4569
|
}
|
|
4540
4570
|
doInitialSchematicTraceRender() {
|
|
4571
|
+
if (this.root?.schematicDisabled) return;
|
|
4541
4572
|
const { db } = this.root;
|
|
4542
4573
|
const { _parsedProps: props, parent } = this;
|
|
4543
4574
|
if (!parent) throw new Error("Trace has no parent");
|
|
@@ -4759,32 +4790,6 @@ var Chip = class extends NormalComponent {
|
|
|
4759
4790
|
manufacturer_part_number: props.manufacturerPartNumber,
|
|
4760
4791
|
supplier_part_numbers: props.supplierPartNumbers
|
|
4761
4792
|
});
|
|
4762
|
-
const dimensions = this._getSchematicBoxDimensions();
|
|
4763
|
-
const hasTopOrBottomPins = props.schPortArrangement?.topSide !== void 0 || props.schPortArrangement?.bottomSide !== void 0;
|
|
4764
|
-
const schematic_box_width = dimensions?.getSize().width;
|
|
4765
|
-
const schematic_box_height = dimensions?.getSize().height;
|
|
4766
|
-
const manufacturer_part_number_text = db.schematic_text.insert({
|
|
4767
|
-
text: props.manufacturerPartNumber ?? "",
|
|
4768
|
-
schematic_component_id: source_component.source_component_id,
|
|
4769
|
-
anchor: "left",
|
|
4770
|
-
rotation: 0,
|
|
4771
|
-
position: {
|
|
4772
|
-
x: hasTopOrBottomPins ? (props.schX ?? 0) + (schematic_box_width ?? 0) / 2 + 0.1 : (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
|
|
4773
|
-
y: hasTopOrBottomPins ? (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.35 : (props.schY ?? 0) - (schematic_box_height ?? 0) / 2 - 0.13
|
|
4774
|
-
},
|
|
4775
|
-
color: "#006464"
|
|
4776
|
-
});
|
|
4777
|
-
const component_name_text = db.schematic_text.insert({
|
|
4778
|
-
text: props.name ?? "",
|
|
4779
|
-
schematic_component_id: source_component.source_component_id,
|
|
4780
|
-
anchor: "left",
|
|
4781
|
-
rotation: 0,
|
|
4782
|
-
position: {
|
|
4783
|
-
x: hasTopOrBottomPins ? (props.schX ?? 0) + (schematic_box_width ?? 0) / 2 + 0.1 : (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
|
|
4784
|
-
y: hasTopOrBottomPins ? (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.55 : (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.13
|
|
4785
|
-
},
|
|
4786
|
-
color: "#006464"
|
|
4787
|
-
});
|
|
4788
4793
|
this.source_component_id = source_component.source_component_id;
|
|
4789
4794
|
}
|
|
4790
4795
|
doInitialPcbComponentRender() {
|
|
@@ -5162,6 +5167,7 @@ var NetAlias = class extends PrimitiveComponent {
|
|
|
5162
5167
|
};
|
|
5163
5168
|
}
|
|
5164
5169
|
doInitialSchematicComponentRender() {
|
|
5170
|
+
if (this.root?.schematicDisabled) return;
|
|
5165
5171
|
const { db } = this.root;
|
|
5166
5172
|
const { _parsedProps: props } = this;
|
|
5167
5173
|
const anchorPos = { x: props.schX ?? 0, y: props.schY ?? 0 };
|
|
@@ -5426,20 +5432,6 @@ var PinHeader = class extends NormalComponent {
|
|
|
5426
5432
|
pin_count: props.pinCount,
|
|
5427
5433
|
gender: props.gender
|
|
5428
5434
|
});
|
|
5429
|
-
const dimensions = this._getSchematicBoxDimensions();
|
|
5430
|
-
const schematic_box_width = dimensions?.getSize().width;
|
|
5431
|
-
const schematic_box_height = dimensions?.getSize().height;
|
|
5432
|
-
const component_name_text = db.schematic_text.insert({
|
|
5433
|
-
text: props.name ?? "",
|
|
5434
|
-
schematic_component_id: source_component.source_component_id,
|
|
5435
|
-
anchor: "left",
|
|
5436
|
-
rotation: 0,
|
|
5437
|
-
position: {
|
|
5438
|
-
x: (props.schX ?? 0) - (schematic_box_width ?? 0) / 2,
|
|
5439
|
-
y: (props.schY ?? 0) + (schematic_box_height ?? 0) / 2 + 0.13
|
|
5440
|
-
},
|
|
5441
|
-
color: "#006464"
|
|
5442
|
-
});
|
|
5443
5435
|
this.source_component_id = source_component.source_component_id;
|
|
5444
5436
|
}
|
|
5445
5437
|
};
|
|
@@ -5590,6 +5582,7 @@ var Circuit = class {
|
|
|
5590
5582
|
db;
|
|
5591
5583
|
root = null;
|
|
5592
5584
|
isRoot = true;
|
|
5585
|
+
schematicDisabled = false;
|
|
5593
5586
|
_hasRenderedAtleastOnce = false;
|
|
5594
5587
|
constructor() {
|
|
5595
5588
|
this.children = [];
|