@tscircuit/internal-dynamic-import 0.0.16 → 0.0.17
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/README.md +112 -14
- package/dist/index.d.ts +624 -3
- package/dist/index.js +72 -28
- package/dist/index.js.map +1 -1
- package/lib/create-importer.ts +27 -0
- package/lib/dynamic-import-resolver.ts +58 -0
- package/lib/dynamic-module-registry.ts +37 -0
- package/lib/import-urls.ts +27 -0
- package/lib/index.ts +46 -0
- package/lib/supported-modules.ts +88 -0
- package/lib/type-bundles/@tscircuit/circuit-json-schematic-placement-analysis.d.ts +593 -0
- package/lib/type-bundles/circuit-json-to-3d-png.d.ts +48 -0
- package/lib/type-bundles/circuit-json-to-bom-csv.d.ts +36 -0
- package/lib/type-bundles/circuit-json-to-bpc.d.ts +15 -0
- package/lib/type-bundles/circuit-json-to-connectivity-map.d.ts +44 -0
- package/lib/type-bundles/circuit-json-to-fdm-component-box.d.ts +160 -0
- package/lib/type-bundles/circuit-json-to-gerber.d.ts +672 -0
- package/lib/type-bundles/circuit-json-to-gltf.d.ts +273 -0
- package/lib/type-bundles/circuit-json-to-kicad.d.ts +392 -0
- package/lib/type-bundles/circuit-json-to-lbrn.d.ts +54 -0
- package/lib/type-bundles/circuit-json-to-pnp-csv.d.ts +15 -0
- package/lib/type-bundles/circuit-json-to-readable-netlist.d.ts +5 -0
- package/lib/type-bundles/circuit-json-to-simple-3d.d.ts +41 -0
- package/lib/type-bundles/circuit-json-to-spice.d.ts +242 -0
- package/lib/type-bundles/circuit-json-to-step.d.ts +28 -0
- package/lib/type-bundles/circuit-json-to-tscircuit.d.ts +14 -0
- package/lib/type-bundles/circuit-to-canvas.d.ts +646 -0
- package/lib/type-bundles/circuit-to-svg.d.ts +399 -0
- package/lib/type-bundles/kicad-to-circuit-json.d.ts +375 -0
- package/package.json +10 -3
package/dist/index.d.ts
CHANGED
|
@@ -3798,7 +3798,606 @@ declare namespace KicadToCircuitJsonModule {
|
|
|
3798
3798
|
export { KicadToCircuitJsonModule_CollectFootprintsStage as CollectFootprintsStage, KicadToCircuitJsonModule_CollectGraphicsStage as CollectGraphicsStage, KicadToCircuitJsonModule_CollectLibrarySymbolsStage as CollectLibrarySymbolsStage, KicadToCircuitJsonModule_CollectNetsStage as CollectNetsStage, KicadToCircuitJsonModule_CollectSchematicTracesStage as CollectSchematicTracesStage, KicadToCircuitJsonModule_CollectSourceTracesStage as CollectSourceTracesStage, KicadToCircuitJsonModule_CollectSymbolLibrarySymbolsStage as CollectSymbolLibrarySymbolsStage, KicadToCircuitJsonModule_CollectTracesStage as CollectTracesStage, KicadToCircuitJsonModule_CollectViasStage as CollectViasStage, KicadToCircuitJsonModule_CollectZonesStage as CollectZonesStage, type KicadToCircuitJsonModule_ConverterContext as ConverterContext, KicadToCircuitJsonModule_ConverterStage as ConverterStage, KicadToCircuitJsonModule_InitializePcbContextStage as InitializePcbContextStage, KicadToCircuitJsonModule_InitializeSchematicContextStage as InitializeSchematicContextStage, KicadToCircuitJsonModule_InitializeSymbolLibraryContextStage as InitializeSymbolLibraryContextStage, KicadToCircuitJsonModule_KicadFootprintToCircuitJsonConverter as KicadFootprintToCircuitJsonConverter, KicadToCircuitJsonModule_KicadSymbolToCircuitJsonConverter as KicadSymbolToCircuitJsonConverter, KicadToCircuitJsonModule_KicadToCircuitJsonConverter as KicadToCircuitJsonConverter };
|
|
3799
3799
|
}
|
|
3800
3800
|
|
|
3801
|
-
|
|
3801
|
+
interface SchematicBoxPlacement {
|
|
3802
|
+
positionAnchor: "center";
|
|
3803
|
+
schX: number;
|
|
3804
|
+
schY: number;
|
|
3805
|
+
width: number;
|
|
3806
|
+
height: number;
|
|
3807
|
+
schematicSheetId?: string;
|
|
3808
|
+
schematicSheetName?: string;
|
|
3809
|
+
sourceComponentId?: string;
|
|
3810
|
+
sourceComponentName?: string;
|
|
3811
|
+
schematicComponentId?: string;
|
|
3812
|
+
schematicSymbolId?: string;
|
|
3813
|
+
subcircuitId?: string;
|
|
3814
|
+
}
|
|
3815
|
+
interface SchematicBoxPlacementLineItem extends SchematicBoxPlacement {
|
|
3816
|
+
lineItemType: "SchematicBoxPlacement";
|
|
3817
|
+
}
|
|
3818
|
+
interface ComponentOverlap {
|
|
3819
|
+
lineItemType: "ComponentOverlap";
|
|
3820
|
+
firstComponent: SchematicBoxPlacement;
|
|
3821
|
+
secondComponent: SchematicBoxPlacement;
|
|
3822
|
+
overlapWidth: number;
|
|
3823
|
+
overlapHeight: number;
|
|
3824
|
+
correctionSuggestions: OverlapCorrectionSuggestion[];
|
|
3825
|
+
}
|
|
3826
|
+
interface OverlapCorrectionSuggestion {
|
|
3827
|
+
targetComponentName?: string;
|
|
3828
|
+
deltaSchX: number;
|
|
3829
|
+
deltaSchY: number;
|
|
3830
|
+
newSchX: number;
|
|
3831
|
+
newSchY: number;
|
|
3832
|
+
}
|
|
3833
|
+
interface SchematicBoxHasALotOfSurroundingWhitespace {
|
|
3834
|
+
lineItemType: "SchematicBoxHasALotOfSurroundingWhitespace";
|
|
3835
|
+
schematicBox: SchematicBoxPlacement;
|
|
3836
|
+
whitespaceLeft: number;
|
|
3837
|
+
whitespaceRight: number;
|
|
3838
|
+
whitespaceTop: number;
|
|
3839
|
+
whitespaceBottom: number;
|
|
3840
|
+
}
|
|
3841
|
+
interface CapacitorSymbolHorizontal {
|
|
3842
|
+
lineItemType: "CapacitorSymbolHorizontal";
|
|
3843
|
+
schematicBox: SchematicBoxPlacement;
|
|
3844
|
+
message: string;
|
|
3845
|
+
}
|
|
3846
|
+
/** A power-to-ground capacitor bank is spread out within one schematic block. */
|
|
3847
|
+
interface DecouplingCapacitorsNotCloseTogether {
|
|
3848
|
+
lineItemType: "DecouplingCapacitorsNotCloseTogether";
|
|
3849
|
+
railName: string;
|
|
3850
|
+
groundName: string;
|
|
3851
|
+
/** All capacitors in this bank, sharing supply, return, and schematic scope. */
|
|
3852
|
+
capacitorSchematicBoxes: SchematicBoxPlacement[];
|
|
3853
|
+
/** Largest body gap required to connect the bank through neighboring capacitors. */
|
|
3854
|
+
maxBodyGap: number;
|
|
3855
|
+
maxRecommendedBodyGap: number;
|
|
3856
|
+
message: string;
|
|
3857
|
+
}
|
|
3858
|
+
interface VerboseSchematicNetLabel {
|
|
3859
|
+
lineItemType: "VerboseSchematicNetLabel";
|
|
3860
|
+
schematicNetLabelId?: string;
|
|
3861
|
+
sourceNetId?: string;
|
|
3862
|
+
schematicSheetId?: string;
|
|
3863
|
+
schematicSheetName?: string;
|
|
3864
|
+
text: string;
|
|
3865
|
+
involvedPins: string[];
|
|
3866
|
+
schX: number;
|
|
3867
|
+
schY: number;
|
|
3868
|
+
message: string;
|
|
3869
|
+
}
|
|
3870
|
+
interface BaseSchematicBoxTooWide {
|
|
3871
|
+
schematicBox: SchematicBoxPlacement;
|
|
3872
|
+
measuredInnerLabelHorizontalEmptySpace: number;
|
|
3873
|
+
maxAllowedInnerLabelHorizontalEmptySpace: number;
|
|
3874
|
+
suggestedSchWidth: number;
|
|
3875
|
+
message: string;
|
|
3876
|
+
}
|
|
3877
|
+
interface PinHeaderSchematicBoxTooWide extends BaseSchematicBoxTooWide {
|
|
3878
|
+
lineItemType: "PinHeaderSchematicBoxTooWide";
|
|
3879
|
+
}
|
|
3880
|
+
interface GenericSchematicBoxTooWide extends BaseSchematicBoxTooWide {
|
|
3881
|
+
lineItemType: "GenericSchematicBoxTooWide";
|
|
3882
|
+
}
|
|
3883
|
+
type SchematicBoxTooWideIssue = PinHeaderSchematicBoxTooWide | GenericSchematicBoxTooWide;
|
|
3884
|
+
interface SchematicBoxInnerLabelCollision {
|
|
3885
|
+
lineItemType: "SchematicBoxInnerLabelCollision";
|
|
3886
|
+
schematicBox: SchematicBoxPlacement;
|
|
3887
|
+
overlappingSides: SchematicSide[];
|
|
3888
|
+
message: string;
|
|
3889
|
+
}
|
|
3890
|
+
type SchematicSide = "left" | "right" | "top" | "bottom";
|
|
3891
|
+
type SchematicPortFacingDirection = "left" | "right" | "up" | "down";
|
|
3892
|
+
interface SchematicPinPaddingToEdgeTooLarge {
|
|
3893
|
+
lineItemType: "SchematicPinPaddingToEdgeTooLarge";
|
|
3894
|
+
pinSide: SchematicSide;
|
|
3895
|
+
edgeSide: SchematicSide;
|
|
3896
|
+
pinName?: string;
|
|
3897
|
+
schematicBox: SchematicBoxPlacement;
|
|
3898
|
+
measuredPadding: number;
|
|
3899
|
+
maxAllowedPadding: number;
|
|
3900
|
+
excessPadding: number;
|
|
3901
|
+
/** All excessive gaps for this box; scalar gap fields identify the worst gap. */
|
|
3902
|
+
paddingDetails?: Array<{
|
|
3903
|
+
pinSide: SchematicSide;
|
|
3904
|
+
edgeSide: SchematicSide;
|
|
3905
|
+
pinName?: string;
|
|
3906
|
+
measuredPadding: number;
|
|
3907
|
+
maxAllowedPadding: number;
|
|
3908
|
+
excessPadding: number;
|
|
3909
|
+
}>;
|
|
3910
|
+
suggestedSchWidth?: number;
|
|
3911
|
+
suggestedSchHeight?: number;
|
|
3912
|
+
message: string;
|
|
3913
|
+
}
|
|
3914
|
+
interface DiodeResistorNotAligned {
|
|
3915
|
+
lineItemType: "DiodeResistorNotAligned";
|
|
3916
|
+
diodeSchematicBox: SchematicBoxPlacement;
|
|
3917
|
+
resistorSchematicBox: SchematicBoxPlacement;
|
|
3918
|
+
diodePin?: string;
|
|
3919
|
+
resistorPin?: string;
|
|
3920
|
+
diodePinFacingDirection?: string;
|
|
3921
|
+
resistorPinFacingDirection?: string;
|
|
3922
|
+
message: string;
|
|
3923
|
+
}
|
|
3924
|
+
/** Readability advisory for a local diode/resistor pair across the same two nets. */
|
|
3925
|
+
interface ParallelDiodeResistorNotAligned {
|
|
3926
|
+
lineItemType: "ParallelDiodeResistorNotAligned";
|
|
3927
|
+
diodeSchematicBox: SchematicBoxPlacement;
|
|
3928
|
+
resistorSchematicBox: SchematicBoxPlacement;
|
|
3929
|
+
reason: "different_axes" | "crossed_connections" | "staggered";
|
|
3930
|
+
message: string;
|
|
3931
|
+
}
|
|
3932
|
+
interface ComponentPinsWouldAlignWithVerticalShift {
|
|
3933
|
+
lineItemType: "ComponentPinsWouldAlignWithVerticalShift";
|
|
3934
|
+
firstComponent: SchematicBoxPlacement;
|
|
3935
|
+
secondComponent: SchematicBoxPlacement;
|
|
3936
|
+
targetComponent: SchematicBoxPlacement;
|
|
3937
|
+
deltaSchY: number;
|
|
3938
|
+
newSchY: number;
|
|
3939
|
+
currentlyAlignedPinCount: number;
|
|
3940
|
+
alignedPinCount: number;
|
|
3941
|
+
alignedPinPairs: Array<{
|
|
3942
|
+
firstPin?: string;
|
|
3943
|
+
secondPin?: string;
|
|
3944
|
+
}>;
|
|
3945
|
+
message: string;
|
|
3946
|
+
}
|
|
3947
|
+
interface TraceCanBeSimplifiedByMovingComponent {
|
|
3948
|
+
lineItemType: "TraceCanBeSimplifiedByMovingComponent";
|
|
3949
|
+
schematicTraceId: string;
|
|
3950
|
+
traceName?: string;
|
|
3951
|
+
targetComponent: SchematicBoxPlacement;
|
|
3952
|
+
deltaSchX: number;
|
|
3953
|
+
deltaSchY: number;
|
|
3954
|
+
newSchX: number;
|
|
3955
|
+
newSchY: number;
|
|
3956
|
+
currentTurnCount: number;
|
|
3957
|
+
suggestedTurnCount: number;
|
|
3958
|
+
/** Collision-checked calculate-elbow routes after applying this move. */
|
|
3959
|
+
suggestedTraces?: Array<{
|
|
3960
|
+
schematicTraceId: string;
|
|
3961
|
+
points: Array<{
|
|
3962
|
+
x: number;
|
|
3963
|
+
y: number;
|
|
3964
|
+
}>;
|
|
3965
|
+
}>;
|
|
3966
|
+
message: string;
|
|
3967
|
+
}
|
|
3968
|
+
interface CrystalNotCenteredOverLoadCapacitors {
|
|
3969
|
+
lineItemType: "CrystalNotCenteredOverLoadCapacitors";
|
|
3970
|
+
crystalSchematicBox: SchematicBoxPlacement;
|
|
3971
|
+
firstLoadCapacitorSchematicBox: SchematicBoxPlacement;
|
|
3972
|
+
secondLoadCapacitorSchematicBox: SchematicBoxPlacement;
|
|
3973
|
+
deltaSchX: number;
|
|
3974
|
+
deltaSchY: number;
|
|
3975
|
+
newSchX: number;
|
|
3976
|
+
newSchY: number;
|
|
3977
|
+
message: string;
|
|
3978
|
+
}
|
|
3979
|
+
interface TwoPinComponentCouldBeFlipped {
|
|
3980
|
+
lineItemType: "TwoPinComponentCouldBeFlipped";
|
|
3981
|
+
schematicTraceId: string;
|
|
3982
|
+
traceName?: string;
|
|
3983
|
+
targetComponent: SchematicBoxPlacement;
|
|
3984
|
+
connectedComponent: SchematicBoxPlacement;
|
|
3985
|
+
targetPin?: string;
|
|
3986
|
+
currentFacingDirection: SchematicPortFacingDirection;
|
|
3987
|
+
suggestedFacingDirection: SchematicPortFacingDirection;
|
|
3988
|
+
deltaSchRotation: 180;
|
|
3989
|
+
currentTurnCount: number;
|
|
3990
|
+
suggestedTurnCount: number;
|
|
3991
|
+
message: string;
|
|
3992
|
+
}
|
|
3993
|
+
/** Advisory: a direct negative-feedback R/C network is far from its amplifier. */
|
|
3994
|
+
interface FeedbackNetworkNotCompact {
|
|
3995
|
+
lineItemType: "FeedbackNetworkNotCompact";
|
|
3996
|
+
amplifierSchematicBox: SchematicBoxPlacement;
|
|
3997
|
+
feedbackComponents: SchematicBoxPlacement[];
|
|
3998
|
+
distantComponents: Array<{
|
|
3999
|
+
schematicBox: SchematicBoxPlacement;
|
|
4000
|
+
bodyGap: number;
|
|
4001
|
+
maxRecommendedBodyGap: number;
|
|
4002
|
+
}>;
|
|
4003
|
+
outputSourcePortId: string;
|
|
4004
|
+
invertingInputSourcePortId: string;
|
|
4005
|
+
message: string;
|
|
4006
|
+
}
|
|
4007
|
+
/** Advisory: an explicitly identified pull resistor is far on the unconventional side. */
|
|
4008
|
+
interface PullResistorOnWrongSide {
|
|
4009
|
+
lineItemType: "PullResistorOnWrongSide";
|
|
4010
|
+
resistorSchematicBox: SchematicBoxPlacement;
|
|
4011
|
+
hostSchematicBox: SchematicBoxPlacement;
|
|
4012
|
+
signalSourcePortId: string;
|
|
4013
|
+
signalPinName: string;
|
|
4014
|
+
signalSchY: number;
|
|
4015
|
+
pullDirection: "up" | "down";
|
|
4016
|
+
preferredSide: "above" | "below";
|
|
4017
|
+
wrongSideGap: number;
|
|
4018
|
+
maxRecommendedWrongSideGap: number;
|
|
4019
|
+
message: string;
|
|
4020
|
+
}
|
|
4021
|
+
interface TwoPinComponentRailOrientation {
|
|
4022
|
+
schematicBox: SchematicBoxPlacement;
|
|
4023
|
+
railSourcePortId: string;
|
|
4024
|
+
railPinName: string;
|
|
4025
|
+
railType: "power" | "ground";
|
|
4026
|
+
suggestedRailFacingDirection: "up" | "down";
|
|
4027
|
+
message: string;
|
|
4028
|
+
}
|
|
4029
|
+
interface TwoPinComponentShouldBeVertical extends TwoPinComponentRailOrientation {
|
|
4030
|
+
lineItemType: "TwoPinComponentShouldBeVertical";
|
|
4031
|
+
deltaSchRotation: -90 | 90;
|
|
4032
|
+
}
|
|
4033
|
+
/** A vertical component has a positive supply below its ground pin or a resistor's signal pin. */
|
|
4034
|
+
interface TwoPinComponentHasInvertedRails extends TwoPinComponentRailOrientation {
|
|
4035
|
+
lineItemType: "TwoPinComponentHasInvertedRails";
|
|
4036
|
+
railType: "power";
|
|
4037
|
+
deltaSchRotation: 180;
|
|
4038
|
+
suggestedRailFacingDirection: "up";
|
|
4039
|
+
}
|
|
4040
|
+
interface ComponentNetLabelCollision {
|
|
4041
|
+
lineItemType: "ComponentNetLabelCollision";
|
|
4042
|
+
firstComponent: SchematicBoxPlacement;
|
|
4043
|
+
secondComponent: SchematicBoxPlacement;
|
|
4044
|
+
message: string;
|
|
4045
|
+
overlappingLabel1Bounds: {
|
|
4046
|
+
left: number;
|
|
4047
|
+
right: number;
|
|
4048
|
+
top: number;
|
|
4049
|
+
bottom: number;
|
|
4050
|
+
};
|
|
4051
|
+
overlappingLabel2Bounds: {
|
|
4052
|
+
left: number;
|
|
4053
|
+
right: number;
|
|
4054
|
+
top: number;
|
|
4055
|
+
bottom: number;
|
|
4056
|
+
};
|
|
4057
|
+
suggestion?: {
|
|
4058
|
+
componentName: string;
|
|
4059
|
+
newSchX: number;
|
|
4060
|
+
newSchY: number;
|
|
4061
|
+
};
|
|
4062
|
+
}
|
|
4063
|
+
interface ComponentBoxNetLabelCollision {
|
|
4064
|
+
lineItemType: "ComponentBoxNetLabelCollision";
|
|
4065
|
+
boxComponent: SchematicBoxPlacement;
|
|
4066
|
+
labelComponent: SchematicBoxPlacement;
|
|
4067
|
+
message: string;
|
|
4068
|
+
boxBounds: {
|
|
4069
|
+
left: number;
|
|
4070
|
+
right: number;
|
|
4071
|
+
top: number;
|
|
4072
|
+
bottom: number;
|
|
4073
|
+
};
|
|
4074
|
+
labelBounds: {
|
|
4075
|
+
left: number;
|
|
4076
|
+
right: number;
|
|
4077
|
+
top: number;
|
|
4078
|
+
bottom: number;
|
|
4079
|
+
};
|
|
4080
|
+
suggestion?: {
|
|
4081
|
+
componentName: string;
|
|
4082
|
+
newSchX: number;
|
|
4083
|
+
newSchY: number;
|
|
4084
|
+
};
|
|
4085
|
+
}
|
|
4086
|
+
interface SchematicIssueBounds {
|
|
4087
|
+
left: number;
|
|
4088
|
+
right: number;
|
|
4089
|
+
top: number;
|
|
4090
|
+
bottom: number;
|
|
4091
|
+
}
|
|
4092
|
+
interface NetLabelCollision {
|
|
4093
|
+
lineItemType: "NetLabelCollision";
|
|
4094
|
+
schematicSheetId?: string;
|
|
4095
|
+
schematicSheetName?: string;
|
|
4096
|
+
/** Actual intersection regions in schematic coordinates (Y up).
|
|
4097
|
+
* Optional for compatibility with previously serialized reports. */
|
|
4098
|
+
collisionBounds?: SchematicIssueBounds[];
|
|
4099
|
+
pairs: Array<{
|
|
4100
|
+
comp1Name: string;
|
|
4101
|
+
comp2Name: string;
|
|
4102
|
+
}>;
|
|
4103
|
+
moves: Array<{
|
|
4104
|
+
componentName: string;
|
|
4105
|
+
newSchX: number;
|
|
4106
|
+
newSchY: number;
|
|
4107
|
+
}>;
|
|
4108
|
+
}
|
|
4109
|
+
interface SchematicTextCollisionObject {
|
|
4110
|
+
type: "text" | "trace" | "component";
|
|
4111
|
+
id: string;
|
|
4112
|
+
text?: string;
|
|
4113
|
+
componentName?: string;
|
|
4114
|
+
schematicComponentId?: string;
|
|
4115
|
+
}
|
|
4116
|
+
interface SchematicTextCollision {
|
|
4117
|
+
lineItemType: "SchematicTextCollision";
|
|
4118
|
+
schematicSheetId?: string;
|
|
4119
|
+
schematicSheetName?: string;
|
|
4120
|
+
schematicTextId: string;
|
|
4121
|
+
text: string;
|
|
4122
|
+
collidingObject: SchematicTextCollisionObject;
|
|
4123
|
+
textBounds: {
|
|
4124
|
+
left: number;
|
|
4125
|
+
right: number;
|
|
4126
|
+
top: number;
|
|
4127
|
+
bottom: number;
|
|
4128
|
+
};
|
|
4129
|
+
collidingObjectBounds: {
|
|
4130
|
+
left: number;
|
|
4131
|
+
right: number;
|
|
4132
|
+
top: number;
|
|
4133
|
+
bottom: number;
|
|
4134
|
+
};
|
|
4135
|
+
/** A clear text-anchor position for this issue; reanalyze after applying it. */
|
|
4136
|
+
suggestedMove?: {
|
|
4137
|
+
newSchX: number;
|
|
4138
|
+
newSchY: number;
|
|
4139
|
+
};
|
|
4140
|
+
message: string;
|
|
4141
|
+
}
|
|
4142
|
+
interface ResetNetworkNotGrouped {
|
|
4143
|
+
lineItemType: "ResetNetworkNotGrouped";
|
|
4144
|
+
/** The component whose reset pin is served by this network. */
|
|
4145
|
+
hostSchematicBox: SchematicBoxPlacement;
|
|
4146
|
+
resetSourcePortId: string;
|
|
4147
|
+
resetPinName: string;
|
|
4148
|
+
/** Reset pull-up, capacitor, and any associated test points; excludes the host. */
|
|
4149
|
+
supportNetworkComponents: SchematicBoxPlacement[];
|
|
4150
|
+
maxDistanceFromResetPin: number;
|
|
4151
|
+
maxRecommendedDistance: number;
|
|
4152
|
+
message: string;
|
|
4153
|
+
}
|
|
4154
|
+
interface ConnectorPositionCausesTraceDetours {
|
|
4155
|
+
lineItemType: "ConnectorPositionCausesTraceDetours";
|
|
4156
|
+
connectorSchematicBox: SchematicBoxPlacement;
|
|
4157
|
+
connectedComponents: SchematicBoxPlacement[];
|
|
4158
|
+
/** Existing routed signal connections that demonstrate the detours. */
|
|
4159
|
+
schematicTraceIds: string[];
|
|
4160
|
+
evaluatedSignalCount: number;
|
|
4161
|
+
newSchX: number;
|
|
4162
|
+
newSchY: number;
|
|
4163
|
+
deltaSchX: number;
|
|
4164
|
+
deltaSchY: number;
|
|
4165
|
+
/** Sum of Manhattan distances between the evaluated signal pins. */
|
|
4166
|
+
currentTotalSignalDistance: number;
|
|
4167
|
+
/** Sum of Manhattan pin distances after moving; not a promised routed length. */
|
|
4168
|
+
suggestedTotalSignalDistance: number;
|
|
4169
|
+
message: string;
|
|
4170
|
+
}
|
|
4171
|
+
/** Advisory for a grounded-emitter NPN switch; no automatic move is implied. */
|
|
4172
|
+
interface LowSideTransistorNotAlignedWithLoad {
|
|
4173
|
+
lineItemType: "LowSideTransistorNotAlignedWithLoad";
|
|
4174
|
+
transistorSchematicBox: SchematicBoxPlacement;
|
|
4175
|
+
loadSchematicBox: SchematicBoxPlacement;
|
|
4176
|
+
baseResistorSchematicBox: SchematicBoxPlacement;
|
|
4177
|
+
clampDiodeSchematicBox: SchematicBoxPlacement;
|
|
4178
|
+
collectorSourcePortId: string;
|
|
4179
|
+
emitterSourcePortId: string;
|
|
4180
|
+
collectorFacingDirection: SchematicPortFacingDirection;
|
|
4181
|
+
emitterFacingDirection: SchematicPortFacingDirection;
|
|
4182
|
+
placementProblems: Array<"transistor_not_below_load" | "collector_not_up" | "emitter_not_down">;
|
|
4183
|
+
message: string;
|
|
4184
|
+
}
|
|
4185
|
+
/** Advisory for an electrically identified USB series pair drawn end-to-end. */
|
|
4186
|
+
interface UsbSeriesResistorsNotAligned {
|
|
4187
|
+
lineItemType: "UsbSeriesResistorsNotAligned";
|
|
4188
|
+
positiveResistorSchematicBox: SchematicBoxPlacement;
|
|
4189
|
+
negativeResistorSchematicBox: SchematicBoxPlacement;
|
|
4190
|
+
hostSourceComponentId: string;
|
|
4191
|
+
positiveSourcePortId: string;
|
|
4192
|
+
negativeSourcePortId: string;
|
|
4193
|
+
signalAxis: "horizontal" | "vertical";
|
|
4194
|
+
message: string;
|
|
4195
|
+
}
|
|
4196
|
+
/** Advisory for a regulator's local input/output capacitor pair on reversed sides. */
|
|
4197
|
+
interface RegulatorCapacitorsOnWrongSides {
|
|
4198
|
+
lineItemType: "RegulatorCapacitorsOnWrongSides";
|
|
4199
|
+
regulatorSchematicBox: SchematicBoxPlacement;
|
|
4200
|
+
inputCapacitorSchematicBox: SchematicBoxPlacement;
|
|
4201
|
+
outputCapacitorSchematicBox: SchematicBoxPlacement;
|
|
4202
|
+
inputSourcePortId: string;
|
|
4203
|
+
outputSourcePortId: string;
|
|
4204
|
+
message: string;
|
|
4205
|
+
}
|
|
4206
|
+
/** Advisory: a vertical divider's supply resistor lies clearly below its ground resistor. */
|
|
4207
|
+
interface VoltageDividerSupplyResistorBelowGroundResistor {
|
|
4208
|
+
lineItemType: "VoltageDividerSupplyResistorBelowGroundResistor";
|
|
4209
|
+
supplyResistorSchematicBox: SchematicBoxPlacement;
|
|
4210
|
+
groundResistorSchematicBox: SchematicBoxPlacement;
|
|
4211
|
+
supplyTapSourcePortId: string;
|
|
4212
|
+
groundTapSourcePortId: string;
|
|
4213
|
+
reversedBodyGap: number;
|
|
4214
|
+
message: string;
|
|
4215
|
+
}
|
|
4216
|
+
/** Series gate and gate-source resistors scattered away from their MOSFET. */
|
|
4217
|
+
interface MosfetGateNetworkNotGrouped {
|
|
4218
|
+
lineItemType: "MosfetGateNetworkNotGrouped";
|
|
4219
|
+
mosfetSchematicBox: SchematicBoxPlacement;
|
|
4220
|
+
seriesGateResistorSchematicBox: SchematicBoxPlacement;
|
|
4221
|
+
gateSourceResistorSchematicBox: SchematicBoxPlacement;
|
|
4222
|
+
/** Largest body-to-body gap from either resistor to the MOSFET. */
|
|
4223
|
+
maxBodyGap: number;
|
|
4224
|
+
maxRecommendedBodyGap: number;
|
|
4225
|
+
message: string;
|
|
4226
|
+
}
|
|
4227
|
+
/** A local flyback diode separated from the relay coil it protects. */
|
|
4228
|
+
interface FlybackDiodeSeparatedFromRelayCoil {
|
|
4229
|
+
lineItemType: "FlybackDiodeSeparatedFromRelayCoil";
|
|
4230
|
+
relaySchematicBox: SchematicBoxPlacement;
|
|
4231
|
+
diodeSchematicBox: SchematicBoxPlacement;
|
|
4232
|
+
coilSourcePortIds: [string, string];
|
|
4233
|
+
distanceFromCoilPins: number;
|
|
4234
|
+
message: string;
|
|
4235
|
+
}
|
|
4236
|
+
/** Advisory for a displaced local shunt with one sense branch split by labels. */
|
|
4237
|
+
interface CurrentSenseShuntSeparatedFromInputs {
|
|
4238
|
+
lineItemType: "CurrentSenseShuntSeparatedFromInputs";
|
|
4239
|
+
amplifierSchematicBox: SchematicBoxPlacement;
|
|
4240
|
+
shuntSchematicBox: SchematicBoxPlacement;
|
|
4241
|
+
positiveInputSourcePortId: string;
|
|
4242
|
+
negativeInputSourcePortId: string;
|
|
4243
|
+
/** Gap from the shunt body to the band spanned by the two input pins. */
|
|
4244
|
+
inputBandGap: number;
|
|
4245
|
+
message: string;
|
|
4246
|
+
}
|
|
4247
|
+
/** A capacitor placed far across its host chip from its two connected pins. */
|
|
4248
|
+
interface CapacitorSeparatedFromChipPins {
|
|
4249
|
+
lineItemType: "CapacitorSeparatedFromChipPins";
|
|
4250
|
+
hostSchematicBox: SchematicBoxPlacement;
|
|
4251
|
+
capacitorSchematicBox: SchematicBoxPlacement;
|
|
4252
|
+
/** Connected chip pins, in the order of the capacitor's source ports. */
|
|
4253
|
+
chipSourcePortIds: [string, string];
|
|
4254
|
+
maxPinDistance: number;
|
|
4255
|
+
maxRecommendedPinDistance: number;
|
|
4256
|
+
message: string;
|
|
4257
|
+
}
|
|
4258
|
+
/** The series element and grounded shunt branches of a signal pi filter are separated. */
|
|
4259
|
+
interface PiFilterComponentsNotGrouped {
|
|
4260
|
+
lineItemType: "PiFilterComponentsNotGrouped";
|
|
4261
|
+
inductorSchematicBox: SchematicBoxPlacement;
|
|
4262
|
+
firstCapacitorSchematicBox: SchematicBoxPlacement;
|
|
4263
|
+
secondCapacitorSchematicBox: SchematicBoxPlacement;
|
|
4264
|
+
/** Longest direct distance between electrically connected inductor/capacitor pins. */
|
|
4265
|
+
maxSignalPinDistance: number;
|
|
4266
|
+
maxRecommendedSignalPinDistance: number;
|
|
4267
|
+
message: string;
|
|
4268
|
+
}
|
|
4269
|
+
/** Readability advisory for a physically continuous local path to an explicit rail. */
|
|
4270
|
+
interface RailPathTooSpreadOut {
|
|
4271
|
+
lineItemType: "RailPathTooSpreadOut";
|
|
4272
|
+
hostSchematicBox: SchematicBoxPlacement;
|
|
4273
|
+
sourcePortId: string;
|
|
4274
|
+
/** Display name for user-facing diagnostics; identity remains sourcePortId. */
|
|
4275
|
+
sourcePortName?: string;
|
|
4276
|
+
railType: "power" | "ground";
|
|
4277
|
+
supportSchematicBoxes: SchematicBoxPlacement[];
|
|
4278
|
+
schematicTraceIds: string[];
|
|
4279
|
+
pathPoints: Array<{
|
|
4280
|
+
x: number;
|
|
4281
|
+
y: number;
|
|
4282
|
+
}>;
|
|
4283
|
+
pathBounds: SchematicIssueBounds;
|
|
4284
|
+
pathLength: number;
|
|
4285
|
+
pathSpan: number;
|
|
4286
|
+
maxRecommendedSpan: number;
|
|
4287
|
+
maxRecommendedPathLength: number;
|
|
4288
|
+
message: string;
|
|
4289
|
+
}
|
|
4290
|
+
type SchematicPlacementIssue = RailPathTooSpreadOut | CapacitorSeparatedFromChipPins | PiFilterComponentsNotGrouped | MosfetGateNetworkNotGrouped | FlybackDiodeSeparatedFromRelayCoil | CurrentSenseShuntSeparatedFromInputs | VoltageDividerSupplyResistorBelowGroundResistor | RegulatorCapacitorsOnWrongSides | UsbSeriesResistorsNotAligned | LowSideTransistorNotAlignedWithLoad | ComponentOverlap | SchematicBoxHasALotOfSurroundingWhitespace | CapacitorSymbolHorizontal | DecouplingCapacitorsNotCloseTogether | VerboseSchematicNetLabel | SchematicBoxTooWideIssue | SchematicBoxInnerLabelCollision | SchematicPinPaddingToEdgeTooLarge | DiodeResistorNotAligned | ParallelDiodeResistorNotAligned | ComponentPinsWouldAlignWithVerticalShift | TraceCanBeSimplifiedByMovingComponent | CrystalNotCenteredOverLoadCapacitors | TwoPinComponentCouldBeFlipped | FeedbackNetworkNotCompact | PullResistorOnWrongSide | TwoPinComponentShouldBeVertical | TwoPinComponentHasInvertedRails | ComponentNetLabelCollision | ComponentBoxNetLabelCollision | NetLabelCollision | SchematicTextCollision | ResetNetworkNotGrouped | ConnectorPositionCausesTraceDetours;
|
|
4291
|
+
interface SchematicPlacementIssues {
|
|
4292
|
+
lineItemType: "SchematicPlacementIssues";
|
|
4293
|
+
issues: SchematicPlacementIssue[];
|
|
4294
|
+
}
|
|
4295
|
+
type SchematicPlacementLineItem = SchematicBoxPlacementLineItem | SchematicPlacementIssues;
|
|
4296
|
+
/** Select issue types to execute; omitted runs all checks, [] runs none. */
|
|
4297
|
+
interface SchematicPlacementAnalysisOptions {
|
|
4298
|
+
/** Schematic drawing units, not PCB dimensions. Defaults: span 8, length 16. */
|
|
4299
|
+
railPathVisibility?: {
|
|
4300
|
+
maxSpan?: number;
|
|
4301
|
+
maxPathLength?: number;
|
|
4302
|
+
};
|
|
4303
|
+
issueTypes?: readonly SchematicPlacementIssue["lineItemType"][];
|
|
4304
|
+
}
|
|
4305
|
+
|
|
4306
|
+
declare class SchematicPlacementAnalysis {
|
|
4307
|
+
private readonly lineItems;
|
|
4308
|
+
private readonly groupBySchematicSheet;
|
|
4309
|
+
constructor(lineItems: SchematicPlacementLineItem[], groupBySchematicSheet?: boolean);
|
|
4310
|
+
getLineItems(): SchematicPlacementLineItem[];
|
|
4311
|
+
/** Filter emitted issues without rerunning or changing the solvers. */
|
|
4312
|
+
getIssues(filter?: {
|
|
4313
|
+
issueTypes?: readonly SchematicPlacementIssue["lineItemType"][];
|
|
4314
|
+
schematicSheetId?: string;
|
|
4315
|
+
}): SchematicPlacementIssue[];
|
|
4316
|
+
/** Counts emitted issue objects, including zero counts for known types. */
|
|
4317
|
+
getIssueCounts(filter?: {
|
|
4318
|
+
schematicSheetId?: string;
|
|
4319
|
+
}): {
|
|
4320
|
+
FlybackDiodeSeparatedFromRelayCoil: number;
|
|
4321
|
+
ComponentOverlap: number;
|
|
4322
|
+
SchematicBoxHasALotOfSurroundingWhitespace: number;
|
|
4323
|
+
CapacitorSymbolHorizontal: number;
|
|
4324
|
+
VerboseSchematicNetLabel: number;
|
|
4325
|
+
PinHeaderSchematicBoxTooWide: number;
|
|
4326
|
+
GenericSchematicBoxTooWide: number;
|
|
4327
|
+
SchematicBoxInnerLabelCollision: number;
|
|
4328
|
+
SchematicPinPaddingToEdgeTooLarge: number;
|
|
4329
|
+
DiodeResistorNotAligned: number;
|
|
4330
|
+
ParallelDiodeResistorNotAligned: number;
|
|
4331
|
+
ComponentPinsWouldAlignWithVerticalShift: number;
|
|
4332
|
+
TraceCanBeSimplifiedByMovingComponent: number;
|
|
4333
|
+
CrystalNotCenteredOverLoadCapacitors: number;
|
|
4334
|
+
ComponentNetLabelCollision: number;
|
|
4335
|
+
ComponentBoxNetLabelCollision: number;
|
|
4336
|
+
NetLabelCollision: number;
|
|
4337
|
+
FeedbackNetworkNotCompact: number;
|
|
4338
|
+
PullResistorOnWrongSide: number;
|
|
4339
|
+
SchematicTextCollision: number;
|
|
4340
|
+
ResetNetworkNotGrouped: number;
|
|
4341
|
+
TwoPinComponentCouldBeFlipped: number;
|
|
4342
|
+
TwoPinComponentShouldBeVertical: number;
|
|
4343
|
+
TwoPinComponentHasInvertedRails: number;
|
|
4344
|
+
DecouplingCapacitorsNotCloseTogether: number;
|
|
4345
|
+
ConnectorPositionCausesTraceDetours: number;
|
|
4346
|
+
LowSideTransistorNotAlignedWithLoad: number;
|
|
4347
|
+
UsbSeriesResistorsNotAligned: number;
|
|
4348
|
+
RegulatorCapacitorsOnWrongSides: number;
|
|
4349
|
+
VoltageDividerSupplyResistorBelowGroundResistor: number;
|
|
4350
|
+
CurrentSenseShuntSeparatedFromInputs: number;
|
|
4351
|
+
PiFilterComponentsNotGrouped: number;
|
|
4352
|
+
MosfetGateNetworkNotGrouped: number;
|
|
4353
|
+
CapacitorSeparatedFromChipPins: number;
|
|
4354
|
+
RailPathTooSpreadOut: number;
|
|
4355
|
+
};
|
|
4356
|
+
getString(): string;
|
|
4357
|
+
schematicBoxPlacementsToString(lineItem: SchematicBoxPlacementLineItem): string;
|
|
4358
|
+
schematicIssuesToString(issue: SchematicPlacementIssue): string;
|
|
4359
|
+
toString(): string;
|
|
4360
|
+
private issueContextToLines;
|
|
4361
|
+
}
|
|
4362
|
+
declare const analyzeSchematicPlacement: (circuitJson: CircuitJson, options?: SchematicPlacementAnalysisOptions) => SchematicPlacementAnalysis;
|
|
4363
|
+
|
|
4364
|
+
interface SchematicPlacementIssueArtifact {
|
|
4365
|
+
/** Stable within this analysis, even when filtering the returned artifacts. */
|
|
4366
|
+
issueIndex: number;
|
|
4367
|
+
issue: SchematicPlacementIssue;
|
|
4368
|
+
schematicSheetId?: string;
|
|
4369
|
+
/** Unpadded issue geometry and involved component bounds; schematic units, Y up. */
|
|
4370
|
+
bounds?: SchematicIssueBounds;
|
|
4371
|
+
descriptionXml: string;
|
|
4372
|
+
fileName: string;
|
|
4373
|
+
contentType: "image/svg+xml";
|
|
4374
|
+
/** A cropped schematic with just this issue's overlay and its XML underneath. */
|
|
4375
|
+
content: string;
|
|
4376
|
+
}
|
|
4377
|
+
interface SchematicPlacementIssueArtifactOptions {
|
|
4378
|
+
/** Reuse an analysis of the same circuit to avoid running the solvers again. */
|
|
4379
|
+
analysis?: SchematicPlacementAnalysis;
|
|
4380
|
+
issueTypes?: readonly SchematicPlacementIssue["lineItemType"][];
|
|
4381
|
+
schematicSheetId?: string;
|
|
4382
|
+
/** Width and height of the schematic panel; the XML panel adds to total height. */
|
|
4383
|
+
width?: number;
|
|
4384
|
+
height?: number;
|
|
4385
|
+
}
|
|
4386
|
+
/** Create one self-contained SVG per emitted issue, without filesystem access.
|
|
4387
|
+
* No issues (or no filter matches) returns []. Other issues' overlays, counts,
|
|
4388
|
+
* and XML are excluded; surrounding schematic elements remain as context. */
|
|
4389
|
+
declare function createSchematicPlacementIssueArtifacts(circuitJson: CircuitJson, options?: SchematicPlacementIssueArtifactOptions): SchematicPlacementIssueArtifact[];
|
|
4390
|
+
|
|
4391
|
+
type SchematicPlacementAnalysisModule_SchematicPlacementAnalysis = SchematicPlacementAnalysis;
|
|
4392
|
+
declare const SchematicPlacementAnalysisModule_SchematicPlacementAnalysis: typeof SchematicPlacementAnalysis;
|
|
4393
|
+
type SchematicPlacementAnalysisModule_SchematicPlacementIssueArtifact = SchematicPlacementIssueArtifact;
|
|
4394
|
+
declare const SchematicPlacementAnalysisModule_analyzeSchematicPlacement: typeof analyzeSchematicPlacement;
|
|
4395
|
+
declare const SchematicPlacementAnalysisModule_createSchematicPlacementIssueArtifacts: typeof createSchematicPlacementIssueArtifacts;
|
|
4396
|
+
declare namespace SchematicPlacementAnalysisModule {
|
|
4397
|
+
export { SchematicPlacementAnalysisModule_SchematicPlacementAnalysis as SchematicPlacementAnalysis, type SchematicPlacementAnalysisModule_SchematicPlacementIssueArtifact as SchematicPlacementIssueArtifact, SchematicPlacementAnalysisModule_analyzeSchematicPlacement as analyzeSchematicPlacement, SchematicPlacementAnalysisModule_createSchematicPlacementIssueArtifacts as createSchematicPlacementIssueArtifacts };
|
|
4398
|
+
}
|
|
4399
|
+
|
|
4400
|
+
declare const supportedModules: readonly ["circuit-json-to-3d-png", "circuit-json-to-bom-csv", "circuit-json-to-bpc", "circuit-json-to-connectivity-map", "circuit-json-to-fdm-component-box", "circuit-json-to-gerber", "circuit-json-to-gltf", "circuit-json-to-kicad", "circuit-json-to-lbrn", "circuit-json-to-pnp-csv", "circuit-json-to-readable-netlist", "circuit-json-to-simple-3d", "circuit-json-to-spice", "circuit-json-to-step", "circuit-json-to-tscircuit", "circuit-to-canvas", "circuit-to-svg", "kicad-to-circuit-json", "@tscircuit/circuit-json-schematic-placement-analysis"];
|
|
3802
4401
|
type SupportedModuleName = (typeof supportedModules)[number];
|
|
3803
4402
|
type SupportedModuleSpecifier = SupportedModuleName | `${SupportedModuleName}@${string}`;
|
|
3804
4403
|
interface SupportedModuleMap {
|
|
@@ -3820,8 +4419,11 @@ interface SupportedModuleMap {
|
|
|
3820
4419
|
"circuit-to-canvas": typeof CircuitToCanvasModule;
|
|
3821
4420
|
"circuit-to-svg": typeof CircuitToSvgModule;
|
|
3822
4421
|
"kicad-to-circuit-json": typeof KicadToCircuitJsonModule;
|
|
4422
|
+
"@tscircuit/circuit-json-schematic-placement-analysis": typeof SchematicPlacementAnalysisModule;
|
|
3823
4423
|
}
|
|
3824
|
-
type StripVersion<TSpecifier extends string> = TSpecifier extends
|
|
4424
|
+
type StripVersion<TSpecifier extends string> = TSpecifier extends SupportedModuleName ? TSpecifier : {
|
|
4425
|
+
[TName in SupportedModuleName]: TSpecifier extends `${TName}@${string}` ? TName : never;
|
|
4426
|
+
}[SupportedModuleName];
|
|
3825
4427
|
declare const getModuleName: (specifier: string) => string;
|
|
3826
4428
|
|
|
3827
4429
|
type DynamicModuleRegistry = Partial<SupportedModuleMap> & Record<string, unknown>;
|
|
@@ -3832,9 +4434,28 @@ declare const getDynamicModuleRegistry: () => DynamicModuleRegistry;
|
|
|
3832
4434
|
declare function registerDynamicModule<TSpecifier extends SupportedModuleName>(name: TSpecifier, mod: SupportedModuleMap[TSpecifier]): SupportedModuleMap[TSpecifier];
|
|
3833
4435
|
declare function registerDynamicModule<TModule>(name: string, mod: TModule): TModule;
|
|
3834
4436
|
|
|
4437
|
+
type DynamicModuleResolver = (specifier: string) => unknown | PromiseLike<unknown>;
|
|
4438
|
+
/** A custom resolver can delegate to the default registry/CDN resolver. */
|
|
4439
|
+
type DynamicImportResolver = (specifier: string, defaultResolver: DynamicModuleResolver) => unknown | PromiseLike<unknown>;
|
|
4440
|
+
declare global {
|
|
4441
|
+
var tscircuitDynamicImportResolver: DynamicImportResolver | undefined;
|
|
4442
|
+
}
|
|
4443
|
+
/** Configure before requesting modules, separately in each JavaScript realm. */
|
|
4444
|
+
declare function setDynamicImportResolver(resolver: DynamicImportResolver | undefined): void;
|
|
4445
|
+
/**
|
|
4446
|
+
* Create an importer from exact specifier keys and lazy module loaders.
|
|
4447
|
+
* Missing keys reject unless a fallback is supplied; loader failures retry
|
|
4448
|
+
* through the same loader on the next request.
|
|
4449
|
+
*/
|
|
4450
|
+
declare function createDynamicImporter<TLoaders extends Record<string, () => unknown | PromiseLike<unknown>>>(loaders: TLoaders, fallback?: DynamicModuleResolver): {
|
|
4451
|
+
<TSpecifier extends keyof TLoaders & string>(specifier: TSpecifier): Promise<Awaited<ReturnType<TLoaders[TSpecifier]>>>;
|
|
4452
|
+
(specifier: string): Promise<unknown>;
|
|
4453
|
+
};
|
|
4454
|
+
|
|
3835
4455
|
declare const getImportUrl: (specifier: string) => string;
|
|
3836
4456
|
declare const getImportUrls: (specifier: string) => string[];
|
|
4457
|
+
|
|
3837
4458
|
declare function importer<TSpecifier extends SupportedModuleSpecifier>(specifier: TSpecifier): Promise<SupportedModuleMap[StripVersion<TSpecifier>]>;
|
|
3838
4459
|
declare function importer(specifier: string): Promise<unknown>;
|
|
3839
4460
|
|
|
3840
|
-
export { type DynamicModuleRegistry, type StripVersion, type SupportedModuleMap, type SupportedModuleName, type SupportedModuleSpecifier, importer as default, getDynamicModuleRegistry, getImportUrl, getImportUrls, getModuleName, registerDynamicModule, supportedModules };
|
|
4461
|
+
export { type DynamicImportResolver, type DynamicModuleRegistry, type DynamicModuleResolver, type StripVersion, type SupportedModuleMap, type SupportedModuleName, type SupportedModuleSpecifier, createDynamicImporter, importer as default, getDynamicModuleRegistry, getImportUrl, getImportUrls, getModuleName, registerDynamicModule, setDynamicImportResolver, supportedModules };
|