@tscircuit/core 0.0.868 → 0.0.870
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 +66 -60
- package/dist/index.js +434 -9
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -2720,6 +2720,7 @@ declare class Board extends Group<typeof boardProps> {
|
|
|
2720
2720
|
|
|
2721
2721
|
declare class Panel extends Group<typeof panelProps> {
|
|
2722
2722
|
pcb_panel_id: string | null;
|
|
2723
|
+
_tabsAndMouseBitesGenerated: boolean;
|
|
2723
2724
|
get config(): {
|
|
2724
2725
|
componentName: string;
|
|
2725
2726
|
zodProps: zod.ZodObject<Omit<{
|
|
@@ -3734,6 +3735,7 @@ declare class Panel extends Group<typeof panelProps> {
|
|
|
3734
3735
|
get isGroup(): boolean;
|
|
3735
3736
|
get isSubcircuit(): boolean;
|
|
3736
3737
|
add(component: PrimitiveComponent): void;
|
|
3738
|
+
doInitialPcbComponentAnchorAlignment(): void;
|
|
3737
3739
|
runRenderCycle(): void;
|
|
3738
3740
|
doInitialPcbComponentRender(): void;
|
|
3739
3741
|
updatePcbComponentRender(): void;
|
|
@@ -16649,19 +16651,9 @@ declare const voltageSourceProps: z.ZodObject<{
|
|
|
16649
16651
|
schY?: number | undefined;
|
|
16650
16652
|
pcbX?: number | undefined;
|
|
16651
16653
|
pcbY?: number | undefined;
|
|
16652
|
-
voltage?: number | undefined;
|
|
16653
|
-
frequency?: number | undefined;
|
|
16654
|
-
pcbStyle?: {
|
|
16655
|
-
silkscreenFontSize?: number | undefined;
|
|
16656
|
-
silkscreenTextPosition?: "centered" | "outside" | "none" | {
|
|
16657
|
-
offsetX: number;
|
|
16658
|
-
offsetY: number;
|
|
16659
|
-
} | undefined;
|
|
16660
|
-
silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
|
|
16661
|
-
} | undefined;
|
|
16662
|
-
pcbPositionAnchor?: string | undefined;
|
|
16663
16654
|
pcbOffsetX?: number | undefined;
|
|
16664
16655
|
pcbOffsetY?: number | undefined;
|
|
16656
|
+
pcbPositionAnchor?: string | undefined;
|
|
16665
16657
|
pcbPositionMode?: "auto" | "relative_to_group_anchor" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
|
|
16666
16658
|
pcbMarginTop?: number | undefined;
|
|
16667
16659
|
pcbMarginRight?: number | undefined;
|
|
@@ -16669,6 +16661,14 @@ declare const voltageSourceProps: z.ZodObject<{
|
|
|
16669
16661
|
pcbMarginLeft?: number | undefined;
|
|
16670
16662
|
pcbMarginX?: number | undefined;
|
|
16671
16663
|
pcbMarginY?: number | undefined;
|
|
16664
|
+
pcbStyle?: {
|
|
16665
|
+
silkscreenFontSize?: number | undefined;
|
|
16666
|
+
silkscreenTextPosition?: "centered" | "outside" | "none" | {
|
|
16667
|
+
offsetX: number;
|
|
16668
|
+
offsetY: number;
|
|
16669
|
+
} | undefined;
|
|
16670
|
+
silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
|
|
16671
|
+
} | undefined;
|
|
16672
16672
|
schMarginTop?: number | undefined;
|
|
16673
16673
|
schMarginRight?: number | undefined;
|
|
16674
16674
|
schMarginBottom?: number | undefined;
|
|
@@ -16678,6 +16678,7 @@ declare const voltageSourceProps: z.ZodObject<{
|
|
|
16678
16678
|
schRotation?: number | undefined;
|
|
16679
16679
|
schRelative?: boolean | undefined;
|
|
16680
16680
|
pcbRelative?: boolean | undefined;
|
|
16681
|
+
supplierPartNumbers?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
|
|
16681
16682
|
cadModel?: string | react.ReactElement<any, string | react.JSXElementConstructor<any>> | {
|
|
16682
16683
|
stlUrl: string;
|
|
16683
16684
|
rotationOffset?: number | {
|
|
@@ -16813,6 +16814,9 @@ declare const voltageSourceProps: z.ZodObject<{
|
|
|
16813
16814
|
modelUnitToMmScale?: number | undefined;
|
|
16814
16815
|
zOffsetFromSurface?: number | undefined;
|
|
16815
16816
|
} | null | undefined;
|
|
16817
|
+
symbolName?: string | undefined;
|
|
16818
|
+
doNotPlace?: boolean | undefined;
|
|
16819
|
+
obstructsWithinBounds?: boolean | undefined;
|
|
16816
16820
|
pinAttributes?: Record<string, {
|
|
16817
16821
|
providesPower?: boolean | undefined;
|
|
16818
16822
|
requiresPower?: boolean | undefined;
|
|
@@ -16824,13 +16828,11 @@ declare const voltageSourceProps: z.ZodObject<{
|
|
|
16824
16828
|
includeInBoardPinout?: boolean | undefined;
|
|
16825
16829
|
highlightColor?: string | undefined;
|
|
16826
16830
|
}> | undefined;
|
|
16831
|
+
voltage?: number | undefined;
|
|
16832
|
+
frequency?: number | undefined;
|
|
16827
16833
|
peakToPeakVoltage?: number | undefined;
|
|
16828
16834
|
waveShape?: "square" | "sinewave" | "triangle" | "sawtooth" | undefined;
|
|
16829
16835
|
dutyCycle?: number | undefined;
|
|
16830
|
-
supplierPartNumbers?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
|
|
16831
|
-
symbolName?: string | undefined;
|
|
16832
|
-
doNotPlace?: boolean | undefined;
|
|
16833
|
-
obstructsWithinBounds?: boolean | undefined;
|
|
16834
16836
|
}, {
|
|
16835
16837
|
name: string;
|
|
16836
16838
|
symbol?: _tscircuit_props.SymbolProp | undefined;
|
|
@@ -16847,19 +16849,9 @@ declare const voltageSourceProps: z.ZodObject<{
|
|
|
16847
16849
|
schY?: string | number | undefined;
|
|
16848
16850
|
pcbX?: string | number | undefined;
|
|
16849
16851
|
pcbY?: string | number | undefined;
|
|
16850
|
-
voltage?: string | number | undefined;
|
|
16851
|
-
frequency?: string | number | undefined;
|
|
16852
|
-
pcbStyle?: {
|
|
16853
|
-
silkscreenFontSize?: string | number | undefined;
|
|
16854
|
-
silkscreenTextPosition?: "centered" | "outside" | "none" | {
|
|
16855
|
-
offsetX: number;
|
|
16856
|
-
offsetY: number;
|
|
16857
|
-
} | undefined;
|
|
16858
|
-
silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
|
|
16859
|
-
} | undefined;
|
|
16860
|
-
pcbPositionAnchor?: string | undefined;
|
|
16861
16852
|
pcbOffsetX?: string | number | undefined;
|
|
16862
16853
|
pcbOffsetY?: string | number | undefined;
|
|
16854
|
+
pcbPositionAnchor?: string | undefined;
|
|
16863
16855
|
pcbPositionMode?: "auto" | "relative_to_group_anchor" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
|
|
16864
16856
|
pcbMarginTop?: string | number | undefined;
|
|
16865
16857
|
pcbMarginRight?: string | number | undefined;
|
|
@@ -16867,6 +16859,14 @@ declare const voltageSourceProps: z.ZodObject<{
|
|
|
16867
16859
|
pcbMarginLeft?: string | number | undefined;
|
|
16868
16860
|
pcbMarginX?: string | number | undefined;
|
|
16869
16861
|
pcbMarginY?: string | number | undefined;
|
|
16862
|
+
pcbStyle?: {
|
|
16863
|
+
silkscreenFontSize?: string | number | undefined;
|
|
16864
|
+
silkscreenTextPosition?: "centered" | "outside" | "none" | {
|
|
16865
|
+
offsetX: number;
|
|
16866
|
+
offsetY: number;
|
|
16867
|
+
} | undefined;
|
|
16868
|
+
silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
|
|
16869
|
+
} | undefined;
|
|
16870
16870
|
schMarginTop?: string | number | undefined;
|
|
16871
16871
|
schMarginRight?: string | number | undefined;
|
|
16872
16872
|
schMarginBottom?: string | number | undefined;
|
|
@@ -16876,6 +16876,7 @@ declare const voltageSourceProps: z.ZodObject<{
|
|
|
16876
16876
|
schRotation?: string | number | undefined;
|
|
16877
16877
|
schRelative?: boolean | undefined;
|
|
16878
16878
|
pcbRelative?: boolean | undefined;
|
|
16879
|
+
supplierPartNumbers?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
|
|
16879
16880
|
cadModel?: string | react.ReactElement<any, string | react.JSXElementConstructor<any>> | {
|
|
16880
16881
|
stlUrl: string;
|
|
16881
16882
|
rotationOffset?: number | {
|
|
@@ -17011,6 +17012,9 @@ declare const voltageSourceProps: z.ZodObject<{
|
|
|
17011
17012
|
modelUnitToMmScale?: string | number | undefined;
|
|
17012
17013
|
zOffsetFromSurface?: string | number | undefined;
|
|
17013
17014
|
} | null | undefined;
|
|
17015
|
+
symbolName?: string | undefined;
|
|
17016
|
+
doNotPlace?: boolean | undefined;
|
|
17017
|
+
obstructsWithinBounds?: boolean | undefined;
|
|
17014
17018
|
pinAttributes?: Record<string, {
|
|
17015
17019
|
providesPower?: boolean | undefined;
|
|
17016
17020
|
requiresPower?: boolean | undefined;
|
|
@@ -17022,13 +17026,11 @@ declare const voltageSourceProps: z.ZodObject<{
|
|
|
17022
17026
|
includeInBoardPinout?: boolean | undefined;
|
|
17023
17027
|
highlightColor?: string | undefined;
|
|
17024
17028
|
}> | undefined;
|
|
17029
|
+
voltage?: string | number | undefined;
|
|
17030
|
+
frequency?: string | number | undefined;
|
|
17025
17031
|
peakToPeakVoltage?: string | number | undefined;
|
|
17026
17032
|
waveShape?: "square" | "sinewave" | "triangle" | "sawtooth" | undefined;
|
|
17027
17033
|
dutyCycle?: number | undefined;
|
|
17028
|
-
supplierPartNumbers?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
|
|
17029
|
-
symbolName?: string | undefined;
|
|
17030
|
-
doNotPlace?: boolean | undefined;
|
|
17031
|
-
obstructsWithinBounds?: boolean | undefined;
|
|
17032
17034
|
}>;
|
|
17033
17035
|
declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "terminal1" | "terminal2"> {
|
|
17034
17036
|
get config(): {
|
|
@@ -17738,19 +17740,9 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
|
|
|
17738
17740
|
schY?: number | undefined;
|
|
17739
17741
|
pcbX?: number | undefined;
|
|
17740
17742
|
pcbY?: number | undefined;
|
|
17741
|
-
voltage?: number | undefined;
|
|
17742
|
-
frequency?: number | undefined;
|
|
17743
|
-
pcbStyle?: {
|
|
17744
|
-
silkscreenFontSize?: number | undefined;
|
|
17745
|
-
silkscreenTextPosition?: "centered" | "outside" | "none" | {
|
|
17746
|
-
offsetX: number;
|
|
17747
|
-
offsetY: number;
|
|
17748
|
-
} | undefined;
|
|
17749
|
-
silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
|
|
17750
|
-
} | undefined;
|
|
17751
|
-
pcbPositionAnchor?: string | undefined;
|
|
17752
17743
|
pcbOffsetX?: number | undefined;
|
|
17753
17744
|
pcbOffsetY?: number | undefined;
|
|
17745
|
+
pcbPositionAnchor?: string | undefined;
|
|
17754
17746
|
pcbPositionMode?: "auto" | "relative_to_group_anchor" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
|
|
17755
17747
|
pcbMarginTop?: number | undefined;
|
|
17756
17748
|
pcbMarginRight?: number | undefined;
|
|
@@ -17758,6 +17750,14 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
|
|
|
17758
17750
|
pcbMarginLeft?: number | undefined;
|
|
17759
17751
|
pcbMarginX?: number | undefined;
|
|
17760
17752
|
pcbMarginY?: number | undefined;
|
|
17753
|
+
pcbStyle?: {
|
|
17754
|
+
silkscreenFontSize?: number | undefined;
|
|
17755
|
+
silkscreenTextPosition?: "centered" | "outside" | "none" | {
|
|
17756
|
+
offsetX: number;
|
|
17757
|
+
offsetY: number;
|
|
17758
|
+
} | undefined;
|
|
17759
|
+
silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
|
|
17760
|
+
} | undefined;
|
|
17761
17761
|
schMarginTop?: number | undefined;
|
|
17762
17762
|
schMarginRight?: number | undefined;
|
|
17763
17763
|
schMarginBottom?: number | undefined;
|
|
@@ -17767,6 +17767,7 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
|
|
|
17767
17767
|
schRotation?: number | undefined;
|
|
17768
17768
|
schRelative?: boolean | undefined;
|
|
17769
17769
|
pcbRelative?: boolean | undefined;
|
|
17770
|
+
supplierPartNumbers?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
|
|
17770
17771
|
cadModel?: string | react.ReactElement<any, string | react.JSXElementConstructor<any>> | {
|
|
17771
17772
|
stlUrl: string;
|
|
17772
17773
|
rotationOffset?: number | {
|
|
@@ -17902,6 +17903,9 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
|
|
|
17902
17903
|
modelUnitToMmScale?: number | undefined;
|
|
17903
17904
|
zOffsetFromSurface?: number | undefined;
|
|
17904
17905
|
} | null | undefined;
|
|
17906
|
+
symbolName?: string | undefined;
|
|
17907
|
+
doNotPlace?: boolean | undefined;
|
|
17908
|
+
obstructsWithinBounds?: boolean | undefined;
|
|
17905
17909
|
pinAttributes?: Record<string, {
|
|
17906
17910
|
providesPower?: boolean | undefined;
|
|
17907
17911
|
requiresPower?: boolean | undefined;
|
|
@@ -17913,13 +17917,11 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
|
|
|
17913
17917
|
includeInBoardPinout?: boolean | undefined;
|
|
17914
17918
|
highlightColor?: string | undefined;
|
|
17915
17919
|
}> | undefined;
|
|
17920
|
+
voltage?: number | undefined;
|
|
17921
|
+
frequency?: number | undefined;
|
|
17916
17922
|
peakToPeakVoltage?: number | undefined;
|
|
17917
17923
|
waveShape?: "square" | "sinewave" | "triangle" | "sawtooth" | undefined;
|
|
17918
17924
|
dutyCycle?: number | undefined;
|
|
17919
|
-
supplierPartNumbers?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
|
|
17920
|
-
symbolName?: string | undefined;
|
|
17921
|
-
doNotPlace?: boolean | undefined;
|
|
17922
|
-
obstructsWithinBounds?: boolean | undefined;
|
|
17923
17925
|
}, {
|
|
17924
17926
|
name: string;
|
|
17925
17927
|
symbol?: _tscircuit_props.SymbolProp | undefined;
|
|
@@ -17936,19 +17938,9 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
|
|
|
17936
17938
|
schY?: string | number | undefined;
|
|
17937
17939
|
pcbX?: string | number | undefined;
|
|
17938
17940
|
pcbY?: string | number | undefined;
|
|
17939
|
-
voltage?: string | number | undefined;
|
|
17940
|
-
frequency?: string | number | undefined;
|
|
17941
|
-
pcbStyle?: {
|
|
17942
|
-
silkscreenFontSize?: string | number | undefined;
|
|
17943
|
-
silkscreenTextPosition?: "centered" | "outside" | "none" | {
|
|
17944
|
-
offsetX: number;
|
|
17945
|
-
offsetY: number;
|
|
17946
|
-
} | undefined;
|
|
17947
|
-
silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
|
|
17948
|
-
} | undefined;
|
|
17949
|
-
pcbPositionAnchor?: string | undefined;
|
|
17950
17941
|
pcbOffsetX?: string | number | undefined;
|
|
17951
17942
|
pcbOffsetY?: string | number | undefined;
|
|
17943
|
+
pcbPositionAnchor?: string | undefined;
|
|
17952
17944
|
pcbPositionMode?: "auto" | "relative_to_group_anchor" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
|
|
17953
17945
|
pcbMarginTop?: string | number | undefined;
|
|
17954
17946
|
pcbMarginRight?: string | number | undefined;
|
|
@@ -17956,6 +17948,14 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
|
|
|
17956
17948
|
pcbMarginLeft?: string | number | undefined;
|
|
17957
17949
|
pcbMarginX?: string | number | undefined;
|
|
17958
17950
|
pcbMarginY?: string | number | undefined;
|
|
17951
|
+
pcbStyle?: {
|
|
17952
|
+
silkscreenFontSize?: string | number | undefined;
|
|
17953
|
+
silkscreenTextPosition?: "centered" | "outside" | "none" | {
|
|
17954
|
+
offsetX: number;
|
|
17955
|
+
offsetY: number;
|
|
17956
|
+
} | undefined;
|
|
17957
|
+
silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
|
|
17958
|
+
} | undefined;
|
|
17959
17959
|
schMarginTop?: string | number | undefined;
|
|
17960
17960
|
schMarginRight?: string | number | undefined;
|
|
17961
17961
|
schMarginBottom?: string | number | undefined;
|
|
@@ -17965,6 +17965,7 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
|
|
|
17965
17965
|
schRotation?: string | number | undefined;
|
|
17966
17966
|
schRelative?: boolean | undefined;
|
|
17967
17967
|
pcbRelative?: boolean | undefined;
|
|
17968
|
+
supplierPartNumbers?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
|
|
17968
17969
|
cadModel?: string | react.ReactElement<any, string | react.JSXElementConstructor<any>> | {
|
|
17969
17970
|
stlUrl: string;
|
|
17970
17971
|
rotationOffset?: number | {
|
|
@@ -18100,6 +18101,9 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
|
|
|
18100
18101
|
modelUnitToMmScale?: string | number | undefined;
|
|
18101
18102
|
zOffsetFromSurface?: string | number | undefined;
|
|
18102
18103
|
} | null | undefined;
|
|
18104
|
+
symbolName?: string | undefined;
|
|
18105
|
+
doNotPlace?: boolean | undefined;
|
|
18106
|
+
obstructsWithinBounds?: boolean | undefined;
|
|
18103
18107
|
pinAttributes?: Record<string, {
|
|
18104
18108
|
providesPower?: boolean | undefined;
|
|
18105
18109
|
requiresPower?: boolean | undefined;
|
|
@@ -18111,13 +18115,11 @@ declare class VoltageSource extends NormalComponent<typeof voltageSourceProps, "
|
|
|
18111
18115
|
includeInBoardPinout?: boolean | undefined;
|
|
18112
18116
|
highlightColor?: string | undefined;
|
|
18113
18117
|
}> | undefined;
|
|
18118
|
+
voltage?: string | number | undefined;
|
|
18119
|
+
frequency?: string | number | undefined;
|
|
18114
18120
|
peakToPeakVoltage?: string | number | undefined;
|
|
18115
18121
|
waveShape?: "square" | "sinewave" | "triangle" | "sawtooth" | undefined;
|
|
18116
18122
|
dutyCycle?: number | undefined;
|
|
18117
|
-
supplierPartNumbers?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
|
|
18118
|
-
symbolName?: string | undefined;
|
|
18119
|
-
doNotPlace?: boolean | undefined;
|
|
18120
|
-
obstructsWithinBounds?: boolean | undefined;
|
|
18121
18123
|
}>;
|
|
18122
18124
|
sourceFtype: Ftype;
|
|
18123
18125
|
};
|
|
@@ -39158,6 +39160,9 @@ declare class AnalogSimulation extends PrimitiveComponent<typeof analogSimulatio
|
|
|
39158
39160
|
|
|
39159
39161
|
declare class VoltageProbe extends PrimitiveComponent<typeof voltageProbeProps> {
|
|
39160
39162
|
simulation_voltage_probe_id: string | null;
|
|
39163
|
+
schematic_voltage_probe_id: string | null;
|
|
39164
|
+
finalProbeName: string | null;
|
|
39165
|
+
color: string | null;
|
|
39161
39166
|
get config(): {
|
|
39162
39167
|
componentName: string;
|
|
39163
39168
|
zodProps: z.ZodObject<Omit<{
|
|
@@ -40233,6 +40238,7 @@ declare class VoltageProbe extends PrimitiveComponent<typeof voltageProbeProps>
|
|
|
40233
40238
|
}>;
|
|
40234
40239
|
};
|
|
40235
40240
|
doInitialSimulationRender(): void;
|
|
40241
|
+
doInitialSchematicReplaceNetLabelsWithSymbols(): void;
|
|
40236
40242
|
}
|
|
40237
40243
|
|
|
40238
40244
|
declare const useRenderedCircuit: (reactElements: react__default.ReactElement) => {
|
package/dist/index.js
CHANGED
|
@@ -12918,6 +12918,42 @@ var getSpiceyEngine = () => {
|
|
|
12918
12918
|
};
|
|
12919
12919
|
};
|
|
12920
12920
|
|
|
12921
|
+
// lib/utils/simulation/getSimulationColorForId.ts
|
|
12922
|
+
var SIMULATION_COLOR_PALETTE = [
|
|
12923
|
+
"rgb(132, 0, 0)",
|
|
12924
|
+
"rgb(194, 194, 0)",
|
|
12925
|
+
"rgb(194, 0, 194)",
|
|
12926
|
+
"rgb(194, 0, 0)",
|
|
12927
|
+
"rgb(0, 132, 132)",
|
|
12928
|
+
"rgb(0, 132, 0)",
|
|
12929
|
+
"rgb(0, 0, 132)",
|
|
12930
|
+
"rgb(132, 132, 132)",
|
|
12931
|
+
"rgb(132, 0, 132)",
|
|
12932
|
+
"rgb(194, 194, 194)",
|
|
12933
|
+
"rgb(132, 0, 132)",
|
|
12934
|
+
"rgb(132, 0, 0)",
|
|
12935
|
+
"rgb(132, 132, 0)",
|
|
12936
|
+
"rgb(194, 194, 194)",
|
|
12937
|
+
"rgb(0, 0, 132)",
|
|
12938
|
+
"rgb(0, 132, 0)"
|
|
12939
|
+
];
|
|
12940
|
+
var idToColorMap = /* @__PURE__ */ new Map();
|
|
12941
|
+
var colorIndex = 0;
|
|
12942
|
+
function getSimulationColorForId(id) {
|
|
12943
|
+
if (idToColorMap.has(id)) {
|
|
12944
|
+
const color2 = idToColorMap.get(id);
|
|
12945
|
+
return color2;
|
|
12946
|
+
}
|
|
12947
|
+
const color = SIMULATION_COLOR_PALETTE[colorIndex];
|
|
12948
|
+
colorIndex = (colorIndex + 1) % SIMULATION_COLOR_PALETTE.length;
|
|
12949
|
+
idToColorMap.set(id, color);
|
|
12950
|
+
return color;
|
|
12951
|
+
}
|
|
12952
|
+
function resetSimulationColorState() {
|
|
12953
|
+
idToColorMap.clear();
|
|
12954
|
+
colorIndex = 0;
|
|
12955
|
+
}
|
|
12956
|
+
|
|
12921
12957
|
// lib/components/primitive-components/Group/Group_doInitialSimulationSpiceEngineRender.ts
|
|
12922
12958
|
var debug10 = Debug12("tscircuit:core:Group_doInitialSimulationSpiceEngineRender");
|
|
12923
12959
|
function Group_doInitialSimulationSpiceEngineRender(group) {
|
|
@@ -12926,14 +12962,17 @@ function Group_doInitialSimulationSpiceEngineRender(group) {
|
|
|
12926
12962
|
if (!root) return;
|
|
12927
12963
|
const analogSims = group.selectAll("analogsimulation");
|
|
12928
12964
|
if (analogSims.length === 0) return;
|
|
12965
|
+
const voltageProbes = group.selectAll("voltageprobe");
|
|
12966
|
+
resetSimulationColorState();
|
|
12929
12967
|
const spiceEngineMap = { ...root.platform?.spiceEngineMap };
|
|
12930
12968
|
if (!spiceEngineMap.spicey) {
|
|
12931
12969
|
spiceEngineMap.spicey = getSpiceyEngine();
|
|
12932
12970
|
}
|
|
12933
12971
|
const circuitJson = root.db.toArray();
|
|
12934
12972
|
let spiceString;
|
|
12973
|
+
let spiceNetlist;
|
|
12935
12974
|
try {
|
|
12936
|
-
|
|
12975
|
+
spiceNetlist = circuitJsonToSpice(circuitJson);
|
|
12937
12976
|
spiceString = spiceNetlist.toSpiceString();
|
|
12938
12977
|
debug10(`Generated SPICE string:
|
|
12939
12978
|
${spiceString}`);
|
|
@@ -12970,6 +13009,10 @@ ${spiceString}`);
|
|
|
12970
13009
|
for (const element of result.simulationResultCircuitJson) {
|
|
12971
13010
|
if (element.type === "simulation_transient_voltage_graph") {
|
|
12972
13011
|
element.simulation_experiment_id = simulationExperiment.simulation_experiment_id;
|
|
13012
|
+
const probeMatch = voltageProbes.find(
|
|
13013
|
+
(p) => p.finalProbeName === element.name
|
|
13014
|
+
);
|
|
13015
|
+
if (probeMatch) element.color = probeMatch.color;
|
|
12973
13016
|
}
|
|
12974
13017
|
const elementType = element.type;
|
|
12975
13018
|
if (elementType && root.db[elementType]) {
|
|
@@ -14255,8 +14298,243 @@ var Board = class extends Group6 {
|
|
|
14255
14298
|
// lib/components/normal-components/Panel.ts
|
|
14256
14299
|
import { panelProps } from "@tscircuit/props";
|
|
14257
14300
|
import { distance as distance7 } from "circuit-json";
|
|
14301
|
+
|
|
14302
|
+
// lib/utils/panels/generate-panel-tabs-and-mouse-bites.ts
|
|
14303
|
+
var TAB_CONFIG = {
|
|
14304
|
+
TAB_WIDTH: 4,
|
|
14305
|
+
TAB_DEPTH: 0.5,
|
|
14306
|
+
TAB_TO_SPACE_RATIO: 5,
|
|
14307
|
+
MOUSE_BITE_DIAMETER: 0.2,
|
|
14308
|
+
MOUSE_BITE_SPACING: 0.1,
|
|
14309
|
+
MOUSE_BITES_PER_GAP: 5
|
|
14310
|
+
};
|
|
14311
|
+
function rectanglesOverlap(rect1, rect2) {
|
|
14312
|
+
const r1Left = rect1.center.x - rect1.width / 2;
|
|
14313
|
+
const r1Right = rect1.center.x + rect1.width / 2;
|
|
14314
|
+
const r1Bottom = rect1.center.y - rect1.height / 2;
|
|
14315
|
+
const r1Top = rect1.center.y + rect1.height / 2;
|
|
14316
|
+
const r2Left = rect2.center.x - rect2.width / 2;
|
|
14317
|
+
const r2Right = rect2.center.x + rect2.width / 2;
|
|
14318
|
+
const r2Bottom = rect2.center.y - rect2.height / 2;
|
|
14319
|
+
const r2Top = rect2.center.y + rect2.height / 2;
|
|
14320
|
+
return !(r1Right <= r2Left || r1Left >= r2Right || r1Top <= r2Bottom || r1Bottom >= r2Top);
|
|
14321
|
+
}
|
|
14322
|
+
function pointOverlapsRectangle(point, radius, rect) {
|
|
14323
|
+
const rectLeft = rect.center.x - rect.width / 2;
|
|
14324
|
+
const rectRight = rect.center.x + rect.width / 2;
|
|
14325
|
+
const rectBottom = rect.center.y - rect.height / 2;
|
|
14326
|
+
const rectTop = rect.center.y + rect.height / 2;
|
|
14327
|
+
const closestX = Math.max(rectLeft, Math.min(point.x, rectRight));
|
|
14328
|
+
const closestY = Math.max(rectBottom, Math.min(point.y, rectTop));
|
|
14329
|
+
const distanceX = point.x - closestX;
|
|
14330
|
+
const distanceY = point.y - closestY;
|
|
14331
|
+
return distanceX * distanceX + distanceY * distanceY <= radius * radius;
|
|
14332
|
+
}
|
|
14333
|
+
function generateTabsForEdge(board, edge, existingTabs, otherBoards) {
|
|
14334
|
+
const tabs = [];
|
|
14335
|
+
if (!board.width || !board.height) return tabs;
|
|
14336
|
+
const boardLeft = board.center.x - board.width / 2;
|
|
14337
|
+
const boardRight = board.center.x + board.width / 2;
|
|
14338
|
+
const boardBottom = board.center.y - board.height / 2;
|
|
14339
|
+
const boardTop = board.center.y + board.height / 2;
|
|
14340
|
+
let edgeLength;
|
|
14341
|
+
let isHorizontal;
|
|
14342
|
+
let edgeCenter;
|
|
14343
|
+
if (edge === "top" || edge === "bottom") {
|
|
14344
|
+
edgeLength = board.width;
|
|
14345
|
+
isHorizontal = true;
|
|
14346
|
+
edgeCenter = edge === "top" ? boardTop : boardBottom;
|
|
14347
|
+
} else {
|
|
14348
|
+
edgeLength = board.height;
|
|
14349
|
+
isHorizontal = false;
|
|
14350
|
+
edgeCenter = edge === "right" ? boardRight : boardLeft;
|
|
14351
|
+
}
|
|
14352
|
+
const totalTabWidth = TAB_CONFIG.TAB_WIDTH;
|
|
14353
|
+
const minSpacingForMouseBites = TAB_CONFIG.MOUSE_BITES_PER_GAP * TAB_CONFIG.MOUSE_BITE_DIAMETER + (TAB_CONFIG.MOUSE_BITES_PER_GAP - 1) * TAB_CONFIG.MOUSE_BITE_SPACING;
|
|
14354
|
+
const fixedSpacing = minSpacingForMouseBites * 1.1;
|
|
14355
|
+
let numTabs = Math.floor(
|
|
14356
|
+
(edgeLength - fixedSpacing) / (totalTabWidth + fixedSpacing)
|
|
14357
|
+
);
|
|
14358
|
+
if (numTabs < 1 && edgeLength >= totalTabWidth) {
|
|
14359
|
+
numTabs = 1;
|
|
14360
|
+
}
|
|
14361
|
+
if (numTabs === 0) return tabs;
|
|
14362
|
+
const actualSpacing = fixedSpacing;
|
|
14363
|
+
const boardStart = -edgeLength / 2;
|
|
14364
|
+
const boardEnd = edgeLength / 2;
|
|
14365
|
+
for (let i = 0; i < numTabs; i++) {
|
|
14366
|
+
const offsetAlongEdge = boardStart + actualSpacing + i * (totalTabWidth + actualSpacing) + totalTabWidth / 2;
|
|
14367
|
+
const isFirstTab = i === 0;
|
|
14368
|
+
const isLastTab = i === numTabs - 1;
|
|
14369
|
+
const isCornerTab = isFirstTab || isLastTab;
|
|
14370
|
+
let axisStart = offsetAlongEdge - totalTabWidth / 2;
|
|
14371
|
+
let axisEnd = offsetAlongEdge + totalTabWidth / 2;
|
|
14372
|
+
if (isCornerTab) {
|
|
14373
|
+
if (isFirstTab) axisStart = boardStart;
|
|
14374
|
+
if (isLastTab) axisEnd = boardEnd;
|
|
14375
|
+
}
|
|
14376
|
+
axisStart = Math.max(axisStart, boardStart);
|
|
14377
|
+
axisEnd = Math.min(axisEnd, boardEnd);
|
|
14378
|
+
if (isCornerTab) {
|
|
14379
|
+
if (isFirstTab) axisStart -= TAB_CONFIG.TAB_DEPTH;
|
|
14380
|
+
if (isLastTab) axisEnd += TAB_CONFIG.TAB_DEPTH;
|
|
14381
|
+
}
|
|
14382
|
+
if (axisEnd <= axisStart) continue;
|
|
14383
|
+
const axisCenterOffset = (axisStart + axisEnd) / 2;
|
|
14384
|
+
const axisLength = axisEnd - axisStart;
|
|
14385
|
+
const crossAxisOffset = edge === "top" || edge === "right" ? TAB_CONFIG.TAB_DEPTH / 2 : -TAB_CONFIG.TAB_DEPTH / 2;
|
|
14386
|
+
const tabCenter = isHorizontal ? {
|
|
14387
|
+
x: board.center.x + axisCenterOffset,
|
|
14388
|
+
y: edgeCenter + crossAxisOffset
|
|
14389
|
+
} : {
|
|
14390
|
+
x: edgeCenter + crossAxisOffset,
|
|
14391
|
+
y: board.center.y + axisCenterOffset
|
|
14392
|
+
};
|
|
14393
|
+
const tabWidth = isHorizontal ? axisLength : TAB_CONFIG.TAB_DEPTH;
|
|
14394
|
+
const tabHeight = isHorizontal ? TAB_CONFIG.TAB_DEPTH : axisLength;
|
|
14395
|
+
const newTab = {
|
|
14396
|
+
center: tabCenter,
|
|
14397
|
+
width: tabWidth,
|
|
14398
|
+
height: tabHeight,
|
|
14399
|
+
boardId: `${board.center.x}_${board.center.y}`
|
|
14400
|
+
};
|
|
14401
|
+
let overlapsBoard = false;
|
|
14402
|
+
for (const otherBoard of otherBoards) {
|
|
14403
|
+
if (!otherBoard.width || !otherBoard.height) continue;
|
|
14404
|
+
const boardRect = {
|
|
14405
|
+
center: otherBoard.center,
|
|
14406
|
+
width: otherBoard.width,
|
|
14407
|
+
height: otherBoard.height
|
|
14408
|
+
};
|
|
14409
|
+
if (rectanglesOverlap(newTab, boardRect)) {
|
|
14410
|
+
overlapsBoard = true;
|
|
14411
|
+
break;
|
|
14412
|
+
}
|
|
14413
|
+
}
|
|
14414
|
+
if (overlapsBoard && !isCornerTab) continue;
|
|
14415
|
+
tabs.push(newTab);
|
|
14416
|
+
}
|
|
14417
|
+
return tabs;
|
|
14418
|
+
}
|
|
14419
|
+
function generateMouseBitesForEdge(board, edge, edgeTabs, allTabs, allBoards, existingMouseBites) {
|
|
14420
|
+
const mouseBites = [];
|
|
14421
|
+
if (edgeTabs.length === 0) return mouseBites;
|
|
14422
|
+
if (!board.width || !board.height) return mouseBites;
|
|
14423
|
+
const boardLeft = board.center.x - board.width / 2;
|
|
14424
|
+
const boardRight = board.center.x + board.width / 2;
|
|
14425
|
+
const boardBottom = board.center.y - board.height / 2;
|
|
14426
|
+
const boardTop = board.center.y + board.height / 2;
|
|
14427
|
+
const isHorizontal = edge === "top" || edge === "bottom";
|
|
14428
|
+
let mouseBitePosition;
|
|
14429
|
+
const radius = TAB_CONFIG.MOUSE_BITE_DIAMETER / 2;
|
|
14430
|
+
if (edge === "top") {
|
|
14431
|
+
mouseBitePosition = boardTop;
|
|
14432
|
+
} else if (edge === "bottom") {
|
|
14433
|
+
mouseBitePosition = boardBottom;
|
|
14434
|
+
} else if (edge === "right") {
|
|
14435
|
+
mouseBitePosition = boardRight;
|
|
14436
|
+
} else {
|
|
14437
|
+
mouseBitePosition = boardLeft;
|
|
14438
|
+
}
|
|
14439
|
+
const sortedTabs = [...edgeTabs].sort((a, b) => {
|
|
14440
|
+
if (isHorizontal) {
|
|
14441
|
+
return a.center.x - b.center.x;
|
|
14442
|
+
} else {
|
|
14443
|
+
return a.center.y - b.center.y;
|
|
14444
|
+
}
|
|
14445
|
+
});
|
|
14446
|
+
for (let i = 0; i < sortedTabs.length - 1; i++) {
|
|
14447
|
+
const tab1 = sortedTabs[i];
|
|
14448
|
+
const tab2 = sortedTabs[i + 1];
|
|
14449
|
+
let gapStart;
|
|
14450
|
+
let gapEnd;
|
|
14451
|
+
if (isHorizontal) {
|
|
14452
|
+
gapStart = tab1.center.x + tab1.width / 2;
|
|
14453
|
+
gapEnd = tab2.center.x - tab2.width / 2;
|
|
14454
|
+
} else {
|
|
14455
|
+
gapStart = tab1.center.y + tab1.height / 2;
|
|
14456
|
+
gapEnd = tab2.center.y - tab2.height / 2;
|
|
14457
|
+
}
|
|
14458
|
+
const gapLength = gapEnd - gapStart;
|
|
14459
|
+
const totalMouseBiteWidth = TAB_CONFIG.MOUSE_BITES_PER_GAP * TAB_CONFIG.MOUSE_BITE_DIAMETER;
|
|
14460
|
+
const totalSpacing = (TAB_CONFIG.MOUSE_BITES_PER_GAP - 1) * TAB_CONFIG.MOUSE_BITE_SPACING;
|
|
14461
|
+
if (gapLength < totalMouseBiteWidth + totalSpacing) continue;
|
|
14462
|
+
const gapCenter = (gapStart + gapEnd) / 2;
|
|
14463
|
+
for (let j = 0; j < TAB_CONFIG.MOUSE_BITES_PER_GAP; j++) {
|
|
14464
|
+
const posOffset = (j - (TAB_CONFIG.MOUSE_BITES_PER_GAP - 1) / 2) * (TAB_CONFIG.MOUSE_BITE_DIAMETER + TAB_CONFIG.MOUSE_BITE_SPACING);
|
|
14465
|
+
const newMouseBite = isHorizontal ? { x: gapCenter + posOffset, y: mouseBitePosition } : { x: mouseBitePosition, y: gapCenter + posOffset };
|
|
14466
|
+
const radius2 = TAB_CONFIG.MOUSE_BITE_DIAMETER / 2;
|
|
14467
|
+
let overlapsBoard = false;
|
|
14468
|
+
for (const otherBoard of allBoards) {
|
|
14469
|
+
if (!otherBoard.width || !otherBoard.height) continue;
|
|
14470
|
+
const boardRect = {
|
|
14471
|
+
center: otherBoard.center,
|
|
14472
|
+
width: otherBoard.width,
|
|
14473
|
+
height: otherBoard.height
|
|
14474
|
+
};
|
|
14475
|
+
if (pointOverlapsRectangle(newMouseBite, radius2, boardRect)) {
|
|
14476
|
+
overlapsBoard = true;
|
|
14477
|
+
break;
|
|
14478
|
+
}
|
|
14479
|
+
}
|
|
14480
|
+
if (overlapsBoard) continue;
|
|
14481
|
+
mouseBites.push(newMouseBite);
|
|
14482
|
+
}
|
|
14483
|
+
}
|
|
14484
|
+
return mouseBites;
|
|
14485
|
+
}
|
|
14486
|
+
function generatePanelTabsAndMouseBites(boards) {
|
|
14487
|
+
const allTabCutouts = [];
|
|
14488
|
+
const allMouseBites = [];
|
|
14489
|
+
for (let boardIndex = 0; boardIndex < boards.length; boardIndex++) {
|
|
14490
|
+
const board = boards[boardIndex];
|
|
14491
|
+
const otherBoards = boards.filter((_, i) => i !== boardIndex);
|
|
14492
|
+
for (const edge of ["top", "bottom", "left", "right"]) {
|
|
14493
|
+
const edgeTabs = generateTabsForEdge(
|
|
14494
|
+
board,
|
|
14495
|
+
edge,
|
|
14496
|
+
allTabCutouts,
|
|
14497
|
+
otherBoards
|
|
14498
|
+
);
|
|
14499
|
+
allTabCutouts.push(...edgeTabs);
|
|
14500
|
+
const edgeMouseBites = generateMouseBitesForEdge(
|
|
14501
|
+
board,
|
|
14502
|
+
edge,
|
|
14503
|
+
edgeTabs,
|
|
14504
|
+
allTabCutouts,
|
|
14505
|
+
otherBoards,
|
|
14506
|
+
allMouseBites
|
|
14507
|
+
);
|
|
14508
|
+
allMouseBites.push(...edgeMouseBites);
|
|
14509
|
+
}
|
|
14510
|
+
}
|
|
14511
|
+
const tabCutouts = allTabCutouts.map((tab, index) => ({
|
|
14512
|
+
type: "pcb_cutout",
|
|
14513
|
+
pcb_cutout_id: `panel_tab_${index}`,
|
|
14514
|
+
shape: "rect",
|
|
14515
|
+
center: tab.center,
|
|
14516
|
+
width: tab.width,
|
|
14517
|
+
height: tab.height,
|
|
14518
|
+
corner_radius: 0.25
|
|
14519
|
+
}));
|
|
14520
|
+
const mouseBiteHoles = allMouseBites.map((bite, index) => ({
|
|
14521
|
+
type: "pcb_hole",
|
|
14522
|
+
pcb_hole_id: `panel_mouse_bite_${index}`,
|
|
14523
|
+
hole_shape: "circle",
|
|
14524
|
+
hole_diameter: TAB_CONFIG.MOUSE_BITE_DIAMETER,
|
|
14525
|
+
x: bite.x,
|
|
14526
|
+
y: bite.y
|
|
14527
|
+
}));
|
|
14528
|
+
return {
|
|
14529
|
+
tabCutouts,
|
|
14530
|
+
mouseBiteHoles
|
|
14531
|
+
};
|
|
14532
|
+
}
|
|
14533
|
+
|
|
14534
|
+
// lib/components/normal-components/Panel.ts
|
|
14258
14535
|
var Panel = class extends Group6 {
|
|
14259
14536
|
pcb_panel_id = null;
|
|
14537
|
+
_tabsAndMouseBitesGenerated = false;
|
|
14260
14538
|
get config() {
|
|
14261
14539
|
return {
|
|
14262
14540
|
componentName: "Panel",
|
|
@@ -14275,6 +14553,96 @@ var Panel = class extends Group6 {
|
|
|
14275
14553
|
}
|
|
14276
14554
|
super.add(component);
|
|
14277
14555
|
}
|
|
14556
|
+
doInitialPcbComponentAnchorAlignment() {
|
|
14557
|
+
if (this.root?.pcbDisabled) return;
|
|
14558
|
+
super.doInitialPcbComponentAnchorAlignment();
|
|
14559
|
+
const { db } = this.root;
|
|
14560
|
+
const childBoardInstances = this.children.filter(
|
|
14561
|
+
(c) => c instanceof Board
|
|
14562
|
+
);
|
|
14563
|
+
const unpositionedBoards = childBoardInstances.filter(
|
|
14564
|
+
(b) => b.props.pcbX === void 0 && b.props.pcbY === void 0
|
|
14565
|
+
);
|
|
14566
|
+
if (unpositionedBoards.length > 0) {
|
|
14567
|
+
const gridCols = Math.ceil(Math.sqrt(unpositionedBoards.length));
|
|
14568
|
+
const gridRows = Math.ceil(unpositionedBoards.length / gridCols);
|
|
14569
|
+
const colWidths = Array(gridCols).fill(0);
|
|
14570
|
+
const rowHeights = Array(gridRows).fill(0);
|
|
14571
|
+
unpositionedBoards.forEach((board, i) => {
|
|
14572
|
+
const col = i % gridCols;
|
|
14573
|
+
const row = Math.floor(i / gridCols);
|
|
14574
|
+
const pcbBoard = db.pcb_board.get(board.pcb_board_id);
|
|
14575
|
+
if (!pcbBoard || pcbBoard.width === void 0 || pcbBoard.height === void 0)
|
|
14576
|
+
return;
|
|
14577
|
+
colWidths[col] = Math.max(colWidths[col], pcbBoard.width);
|
|
14578
|
+
rowHeights[row] = Math.max(rowHeights[row], pcbBoard.height);
|
|
14579
|
+
});
|
|
14580
|
+
const totalGridWidth = colWidths.reduce((a, b) => a + b, 0) + (gridCols > 1 ? (gridCols - 1) * TAB_CONFIG.TAB_DEPTH : 0);
|
|
14581
|
+
const totalGridHeight = rowHeights.reduce((a, b) => a + b, 0) + (gridRows > 1 ? (gridRows - 1) * TAB_CONFIG.TAB_DEPTH : 0);
|
|
14582
|
+
const startX = -totalGridWidth / 2;
|
|
14583
|
+
const startY = -totalGridHeight / 2;
|
|
14584
|
+
const rowYOffsets = [startY];
|
|
14585
|
+
for (let i = 0; i < gridRows - 1; i++) {
|
|
14586
|
+
rowYOffsets.push(rowYOffsets[i] + rowHeights[i] + TAB_CONFIG.TAB_DEPTH);
|
|
14587
|
+
}
|
|
14588
|
+
const colXOffsets = [startX];
|
|
14589
|
+
for (let i = 0; i < gridCols - 1; i++) {
|
|
14590
|
+
colXOffsets.push(colXOffsets[i] + colWidths[i] + TAB_CONFIG.TAB_DEPTH);
|
|
14591
|
+
}
|
|
14592
|
+
unpositionedBoards.forEach((board, i) => {
|
|
14593
|
+
const col = i % gridCols;
|
|
14594
|
+
const row = Math.floor(i / gridCols);
|
|
14595
|
+
const pcbBoard = db.pcb_board.get(board.pcb_board_id);
|
|
14596
|
+
if (!pcbBoard || !pcbBoard.width || !pcbBoard.height) return;
|
|
14597
|
+
const xPos = colXOffsets[col] + colWidths[col] / 2;
|
|
14598
|
+
const yPos = rowYOffsets[row] + rowHeights[row] / 2;
|
|
14599
|
+
db.pcb_board.update(board.pcb_board_id, {
|
|
14600
|
+
center: { x: xPos, y: yPos }
|
|
14601
|
+
});
|
|
14602
|
+
});
|
|
14603
|
+
const allBoardPcbIds = childBoardInstances.map((b) => b.pcb_board_id).filter((id) => !!id);
|
|
14604
|
+
const allBoardsInPanel = db.pcb_board.list().filter((b) => allBoardPcbIds.includes(b.pcb_board_id));
|
|
14605
|
+
let minX = Infinity;
|
|
14606
|
+
let minY = Infinity;
|
|
14607
|
+
let maxX = -Infinity;
|
|
14608
|
+
let maxY = -Infinity;
|
|
14609
|
+
for (const board of allBoardsInPanel) {
|
|
14610
|
+
if (board.width === void 0 || board.height === void 0 || !isFinite(board.width) || !isFinite(board.height))
|
|
14611
|
+
continue;
|
|
14612
|
+
const left = board.center.x - board.width / 2;
|
|
14613
|
+
const right = board.center.x + board.width / 2;
|
|
14614
|
+
const bottom = board.center.y - board.height / 2;
|
|
14615
|
+
const top = board.center.y + board.height / 2;
|
|
14616
|
+
minX = Math.min(minX, left);
|
|
14617
|
+
maxX = Math.max(maxX, right);
|
|
14618
|
+
minY = Math.min(minY, bottom);
|
|
14619
|
+
maxY = Math.max(maxY, top);
|
|
14620
|
+
}
|
|
14621
|
+
if (isFinite(minX)) {
|
|
14622
|
+
const boundsWidth = maxX - minX;
|
|
14623
|
+
const boundsHeight = maxY - minY;
|
|
14624
|
+
const margin = TAB_CONFIG.TAB_DEPTH * 3;
|
|
14625
|
+
const newPanelWidth = boundsWidth + 2 * margin;
|
|
14626
|
+
const newPanelHeight = boundsHeight + 2 * margin;
|
|
14627
|
+
db.pcb_panel.update(this.pcb_panel_id, {
|
|
14628
|
+
width: newPanelWidth,
|
|
14629
|
+
height: newPanelHeight
|
|
14630
|
+
});
|
|
14631
|
+
}
|
|
14632
|
+
}
|
|
14633
|
+
if (this._tabsAndMouseBitesGenerated) return;
|
|
14634
|
+
const childBoardIds = childBoardInstances.map((c) => c.pcb_board_id).filter((id) => !!id);
|
|
14635
|
+
const boardsInPanel = db.pcb_board.list().filter((b) => childBoardIds.includes(b.pcb_board_id));
|
|
14636
|
+
if (boardsInPanel.length === 0) return;
|
|
14637
|
+
const { tabCutouts, mouseBiteHoles } = generatePanelTabsAndMouseBites(boardsInPanel);
|
|
14638
|
+
for (const tabCutout of tabCutouts) {
|
|
14639
|
+
db.pcb_cutout.insert(tabCutout);
|
|
14640
|
+
}
|
|
14641
|
+
for (const mouseBiteHole of mouseBiteHoles) {
|
|
14642
|
+
db.pcb_hole.insert(mouseBiteHole);
|
|
14643
|
+
}
|
|
14644
|
+
this._tabsAndMouseBitesGenerated = true;
|
|
14645
|
+
}
|
|
14278
14646
|
runRenderCycle() {
|
|
14279
14647
|
if (!this.children.some((child) => child.componentName === "Board")) {
|
|
14280
14648
|
throw new Error("<panel> must contain at least one <board>");
|
|
@@ -17977,6 +18345,9 @@ import { voltageProbeProps } from "@tscircuit/props";
|
|
|
17977
18345
|
import "zod";
|
|
17978
18346
|
var VoltageProbe = class extends PrimitiveComponent2 {
|
|
17979
18347
|
simulation_voltage_probe_id = null;
|
|
18348
|
+
schematic_voltage_probe_id = null;
|
|
18349
|
+
finalProbeName = null;
|
|
18350
|
+
color = null;
|
|
17980
18351
|
get config() {
|
|
17981
18352
|
return {
|
|
17982
18353
|
componentName: "VoltageProbe",
|
|
@@ -18013,14 +18384,68 @@ var VoltageProbe = class extends PrimitiveComponent2 {
|
|
|
18013
18384
|
);
|
|
18014
18385
|
return;
|
|
18015
18386
|
}
|
|
18387
|
+
const connectedId = port?.source_port_id ?? net?.source_net_id;
|
|
18388
|
+
if (!connectedId) {
|
|
18389
|
+
this.renderError(`Could not identify connected source for VoltageProbe`);
|
|
18390
|
+
return;
|
|
18391
|
+
}
|
|
18392
|
+
this.color = getSimulationColorForId(connectedId);
|
|
18393
|
+
let finalName = name;
|
|
18394
|
+
if (!finalName) {
|
|
18395
|
+
finalName = targets[0].split(" > ").map((s) => s.replace(/^\./, "")).join(".");
|
|
18396
|
+
}
|
|
18397
|
+
this.finalProbeName = finalName;
|
|
18016
18398
|
const { simulation_voltage_probe_id } = db.simulation_voltage_probe.insert({
|
|
18017
|
-
name:
|
|
18399
|
+
name: finalName,
|
|
18018
18400
|
source_port_id: port?.source_port_id ?? void 0,
|
|
18019
18401
|
source_net_id: net?.source_net_id ?? void 0,
|
|
18020
|
-
subcircuit_id: subcircuit.subcircuit_id || void 0
|
|
18402
|
+
subcircuit_id: subcircuit.subcircuit_id || void 0,
|
|
18403
|
+
color: this.color
|
|
18021
18404
|
});
|
|
18022
18405
|
this.simulation_voltage_probe_id = simulation_voltage_probe_id;
|
|
18023
18406
|
}
|
|
18407
|
+
doInitialSchematicReplaceNetLabelsWithSymbols() {
|
|
18408
|
+
if (this.root?.schematicDisabled) return;
|
|
18409
|
+
const { db } = this.root;
|
|
18410
|
+
const { connectsTo, name } = this._parsedProps;
|
|
18411
|
+
const subcircuit = this.getSubcircuit();
|
|
18412
|
+
if (!subcircuit) {
|
|
18413
|
+
return;
|
|
18414
|
+
}
|
|
18415
|
+
const targets = Array.isArray(connectsTo) ? connectsTo : [connectsTo];
|
|
18416
|
+
if (targets.length !== 1) {
|
|
18417
|
+
return;
|
|
18418
|
+
}
|
|
18419
|
+
const targetSelector = targets[0];
|
|
18420
|
+
const port = subcircuit.selectOne(targetSelector, {
|
|
18421
|
+
type: "port"
|
|
18422
|
+
});
|
|
18423
|
+
if (!port) return;
|
|
18424
|
+
if (!port.schematic_port_id) return;
|
|
18425
|
+
const position = port._getGlobalSchematicPositionAfterLayout();
|
|
18426
|
+
let targetTraceId = null;
|
|
18427
|
+
for (const trace of db.schematic_trace.list()) {
|
|
18428
|
+
for (const edge of trace.edges) {
|
|
18429
|
+
if (Math.abs(edge.from.x - position.x) < 1e-6 && Math.abs(edge.from.y - position.y) < 1e-6 || Math.abs(edge.to.x - position.x) < 1e-6 && Math.abs(edge.to.y - position.y) < 1e-6) {
|
|
18430
|
+
targetTraceId = trace.schematic_trace_id;
|
|
18431
|
+
break;
|
|
18432
|
+
}
|
|
18433
|
+
}
|
|
18434
|
+
if (targetTraceId) break;
|
|
18435
|
+
}
|
|
18436
|
+
if (!targetTraceId) {
|
|
18437
|
+
return;
|
|
18438
|
+
}
|
|
18439
|
+
const probeName = this.finalProbeName;
|
|
18440
|
+
const schematic_voltage_probe = db.schematic_voltage_probe.insert({
|
|
18441
|
+
name: probeName,
|
|
18442
|
+
position,
|
|
18443
|
+
schematic_trace_id: targetTraceId,
|
|
18444
|
+
subcircuit_id: subcircuit.subcircuit_id || void 0,
|
|
18445
|
+
color: this.color ?? void 0
|
|
18446
|
+
});
|
|
18447
|
+
this.schematic_voltage_probe_id = schematic_voltage_probe.schematic_voltage_probe_id;
|
|
18448
|
+
}
|
|
18024
18449
|
};
|
|
18025
18450
|
|
|
18026
18451
|
// lib/RootCircuit.ts
|
|
@@ -18032,7 +18457,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
18032
18457
|
var package_default = {
|
|
18033
18458
|
name: "@tscircuit/core",
|
|
18034
18459
|
type: "module",
|
|
18035
|
-
version: "0.0.
|
|
18460
|
+
version: "0.0.869",
|
|
18036
18461
|
types: "dist/index.d.ts",
|
|
18037
18462
|
main: "dist/index.js",
|
|
18038
18463
|
module: "dist/index.js",
|
|
@@ -18075,7 +18500,7 @@ var package_default = {
|
|
|
18075
18500
|
"@tscircuit/matchpack": "^0.0.16",
|
|
18076
18501
|
"@tscircuit/math-utils": "^0.0.29",
|
|
18077
18502
|
"@tscircuit/miniflex": "^0.0.4",
|
|
18078
|
-
"@tscircuit/ngspice-spice-engine": "^0.0.
|
|
18503
|
+
"@tscircuit/ngspice-spice-engine": "^0.0.3",
|
|
18079
18504
|
"@tscircuit/props": "^0.0.403",
|
|
18080
18505
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
18081
18506
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
@@ -18090,13 +18515,13 @@ var package_default = {
|
|
|
18090
18515
|
"bun-match-svg": "0.0.12",
|
|
18091
18516
|
"calculate-elbow": "^0.0.12",
|
|
18092
18517
|
"chokidar-cli": "^3.0.0",
|
|
18093
|
-
"circuit-json": "^0.0.
|
|
18518
|
+
"circuit-json": "^0.0.317",
|
|
18094
18519
|
"circuit-json-to-bpc": "^0.0.13",
|
|
18095
18520
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
18096
18521
|
"circuit-json-to-gltf": "^0.0.31",
|
|
18097
18522
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
18098
|
-
"circuit-json-to-spice": "^0.0.
|
|
18099
|
-
"circuit-to-svg": "^0.0.
|
|
18523
|
+
"circuit-json-to-spice": "^0.0.24",
|
|
18524
|
+
"circuit-to-svg": "^0.0.274",
|
|
18100
18525
|
concurrently: "^9.1.2",
|
|
18101
18526
|
"connectivity-map": "^1.0.0",
|
|
18102
18527
|
debug: "^4.3.6",
|
|
@@ -18112,7 +18537,7 @@ var package_default = {
|
|
|
18112
18537
|
react: "^19.1.0",
|
|
18113
18538
|
"react-dom": "^19.1.0",
|
|
18114
18539
|
"schematic-symbols": "^0.0.202",
|
|
18115
|
-
spicey: "^0.0.
|
|
18540
|
+
spicey: "^0.0.14",
|
|
18116
18541
|
"ts-expect": "^1.3.0",
|
|
18117
18542
|
tsup: "^8.2.4"
|
|
18118
18543
|
},
|
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.870",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@tscircuit/matchpack": "^0.0.16",
|
|
45
45
|
"@tscircuit/math-utils": "^0.0.29",
|
|
46
46
|
"@tscircuit/miniflex": "^0.0.4",
|
|
47
|
-
"@tscircuit/ngspice-spice-engine": "^0.0.
|
|
47
|
+
"@tscircuit/ngspice-spice-engine": "^0.0.3",
|
|
48
48
|
"@tscircuit/props": "^0.0.403",
|
|
49
49
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
50
50
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"bun-match-svg": "0.0.12",
|
|
60
60
|
"calculate-elbow": "^0.0.12",
|
|
61
61
|
"chokidar-cli": "^3.0.0",
|
|
62
|
-
"circuit-json": "^0.0.
|
|
62
|
+
"circuit-json": "^0.0.317",
|
|
63
63
|
"circuit-json-to-bpc": "^0.0.13",
|
|
64
64
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
65
65
|
"circuit-json-to-gltf": "^0.0.31",
|
|
66
66
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
67
|
-
"circuit-json-to-spice": "^0.0.
|
|
68
|
-
"circuit-to-svg": "^0.0.
|
|
67
|
+
"circuit-json-to-spice": "^0.0.24",
|
|
68
|
+
"circuit-to-svg": "^0.0.274",
|
|
69
69
|
"concurrently": "^9.1.2",
|
|
70
70
|
"connectivity-map": "^1.0.0",
|
|
71
71
|
"debug": "^4.3.6",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"react": "^19.1.0",
|
|
82
82
|
"react-dom": "^19.1.0",
|
|
83
83
|
"schematic-symbols": "^0.0.202",
|
|
84
|
-
"spicey": "^0.0.
|
|
84
|
+
"spicey": "^0.0.14",
|
|
85
85
|
"ts-expect": "^1.3.0",
|
|
86
86
|
"tsup": "^8.2.4"
|
|
87
87
|
},
|