@tscircuit/core 0.0.393 → 0.0.395
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 +220 -3
- package/dist/index.js +92 -16
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { createElement } from 'react';
|
|
|
5
5
|
import * as zod from 'zod';
|
|
6
6
|
import { z, ZodType } from 'zod';
|
|
7
7
|
import { symbols, SchSymbol, BaseSymbolName } from 'schematic-symbols';
|
|
8
|
-
import { PcbTraceError, PcbPlacementError, PcbManualEditConflictWarning, LayerRef, AnyCircuitElement, AnySourceComponent, PcbTraceRoutePoint, PcbTrace, PcbVia, RouteHintPoint, CircuitJson } from 'circuit-json';
|
|
8
|
+
import { PcbTraceError, PcbPlacementError, PcbManualEditConflictWarning, LayerRef, AnyCircuitElement, AnySourceComponent, PcbTraceRoutePoint, PcbTrace as PcbTrace$1, PcbVia, RouteHintPoint, CircuitJson } from 'circuit-json';
|
|
9
9
|
import { Matrix } from 'transformation-matrix';
|
|
10
10
|
import { CircuitJsonUtilObjects } from '@tscircuit/circuit-json-util';
|
|
11
11
|
import * as _tscircuit_layout from '@tscircuit/layout';
|
|
@@ -1014,7 +1014,7 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
|
|
|
1014
1014
|
_hasStartedAsyncAutorouting: boolean;
|
|
1015
1015
|
_asyncAutoroutingResult: {
|
|
1016
1016
|
output_simple_route_json?: SimpleRouteJson;
|
|
1017
|
-
output_pcb_traces?: (PcbTrace | PcbVia)[];
|
|
1017
|
+
output_pcb_traces?: (PcbTrace$1 | PcbVia)[];
|
|
1018
1018
|
} | null;
|
|
1019
1019
|
get config(): {
|
|
1020
1020
|
zodProps: Props;
|
|
@@ -6727,6 +6727,223 @@ declare class SmtPad extends PrimitiveComponent<typeof smtPadProps> {
|
|
|
6727
6727
|
}): void;
|
|
6728
6728
|
}
|
|
6729
6729
|
|
|
6730
|
+
declare const pcbTraceProps: z.ZodObject<{
|
|
6731
|
+
route: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
6732
|
+
route_type: z.ZodLiteral<"wire">;
|
|
6733
|
+
x: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
|
|
6734
|
+
y: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
|
|
6735
|
+
width: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
|
|
6736
|
+
start_pcb_port_id: z.ZodOptional<z.ZodString>;
|
|
6737
|
+
end_pcb_port_id: z.ZodOptional<z.ZodString>;
|
|
6738
|
+
layer: z.ZodEffects<z.ZodUnion<[z.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, z.ZodObject<{
|
|
6739
|
+
name: z.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
|
|
6740
|
+
}, "strip", z.ZodTypeAny, {
|
|
6741
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
6742
|
+
}, {
|
|
6743
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
6744
|
+
}>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
6745
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
6746
|
+
}>;
|
|
6747
|
+
}, "strip", z.ZodTypeAny, {
|
|
6748
|
+
x: number;
|
|
6749
|
+
y: number;
|
|
6750
|
+
width: number;
|
|
6751
|
+
layer: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
6752
|
+
route_type: "wire";
|
|
6753
|
+
start_pcb_port_id?: string | undefined;
|
|
6754
|
+
end_pcb_port_id?: string | undefined;
|
|
6755
|
+
}, {
|
|
6756
|
+
x: string | number;
|
|
6757
|
+
y: string | number;
|
|
6758
|
+
width: string | number;
|
|
6759
|
+
layer: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
6760
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
6761
|
+
};
|
|
6762
|
+
route_type: "wire";
|
|
6763
|
+
start_pcb_port_id?: string | undefined;
|
|
6764
|
+
end_pcb_port_id?: string | undefined;
|
|
6765
|
+
}>, z.ZodObject<{
|
|
6766
|
+
route_type: z.ZodLiteral<"via">;
|
|
6767
|
+
x: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
|
|
6768
|
+
y: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
|
|
6769
|
+
hole_diameter: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
6770
|
+
outer_diameter: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
6771
|
+
from_layer: z.ZodString;
|
|
6772
|
+
to_layer: z.ZodString;
|
|
6773
|
+
}, "strip", z.ZodTypeAny, {
|
|
6774
|
+
x: number;
|
|
6775
|
+
y: number;
|
|
6776
|
+
to_layer: string;
|
|
6777
|
+
route_type: "via";
|
|
6778
|
+
from_layer: string;
|
|
6779
|
+
hole_diameter?: number | undefined;
|
|
6780
|
+
outer_diameter?: number | undefined;
|
|
6781
|
+
}, {
|
|
6782
|
+
x: string | number;
|
|
6783
|
+
y: string | number;
|
|
6784
|
+
to_layer: string;
|
|
6785
|
+
route_type: "via";
|
|
6786
|
+
from_layer: string;
|
|
6787
|
+
hole_diameter?: string | number | undefined;
|
|
6788
|
+
outer_diameter?: string | number | undefined;
|
|
6789
|
+
}>]>, "many">;
|
|
6790
|
+
source_trace_id: z.ZodOptional<z.ZodString>;
|
|
6791
|
+
}, "strip", z.ZodTypeAny, {
|
|
6792
|
+
route: ({
|
|
6793
|
+
x: number;
|
|
6794
|
+
y: number;
|
|
6795
|
+
width: number;
|
|
6796
|
+
layer: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
6797
|
+
route_type: "wire";
|
|
6798
|
+
start_pcb_port_id?: string | undefined;
|
|
6799
|
+
end_pcb_port_id?: string | undefined;
|
|
6800
|
+
} | {
|
|
6801
|
+
x: number;
|
|
6802
|
+
y: number;
|
|
6803
|
+
to_layer: string;
|
|
6804
|
+
route_type: "via";
|
|
6805
|
+
from_layer: string;
|
|
6806
|
+
hole_diameter?: number | undefined;
|
|
6807
|
+
outer_diameter?: number | undefined;
|
|
6808
|
+
})[];
|
|
6809
|
+
source_trace_id?: string | undefined;
|
|
6810
|
+
}, {
|
|
6811
|
+
route: ({
|
|
6812
|
+
x: string | number;
|
|
6813
|
+
y: string | number;
|
|
6814
|
+
width: string | number;
|
|
6815
|
+
layer: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
6816
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
6817
|
+
};
|
|
6818
|
+
route_type: "wire";
|
|
6819
|
+
start_pcb_port_id?: string | undefined;
|
|
6820
|
+
end_pcb_port_id?: string | undefined;
|
|
6821
|
+
} | {
|
|
6822
|
+
x: string | number;
|
|
6823
|
+
y: string | number;
|
|
6824
|
+
to_layer: string;
|
|
6825
|
+
route_type: "via";
|
|
6826
|
+
from_layer: string;
|
|
6827
|
+
hole_diameter?: string | number | undefined;
|
|
6828
|
+
outer_diameter?: string | number | undefined;
|
|
6829
|
+
})[];
|
|
6830
|
+
source_trace_id?: string | undefined;
|
|
6831
|
+
}>;
|
|
6832
|
+
declare class PcbTrace extends PrimitiveComponent<typeof pcbTraceProps> {
|
|
6833
|
+
pcb_trace_id: string | null;
|
|
6834
|
+
isPcbPrimitive: boolean;
|
|
6835
|
+
get config(): {
|
|
6836
|
+
componentName: string;
|
|
6837
|
+
zodProps: z.ZodObject<{
|
|
6838
|
+
route: z.ZodArray<z.ZodUnion<[z.ZodObject<{
|
|
6839
|
+
route_type: z.ZodLiteral<"wire">;
|
|
6840
|
+
x: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
|
|
6841
|
+
y: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
|
|
6842
|
+
width: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
|
|
6843
|
+
start_pcb_port_id: z.ZodOptional<z.ZodString>;
|
|
6844
|
+
end_pcb_port_id: z.ZodOptional<z.ZodString>;
|
|
6845
|
+
layer: z.ZodEffects<z.ZodUnion<[z.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, z.ZodObject<{
|
|
6846
|
+
name: z.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
|
|
6847
|
+
}, "strip", z.ZodTypeAny, {
|
|
6848
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
6849
|
+
}, {
|
|
6850
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
6851
|
+
}>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
6852
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
6853
|
+
}>;
|
|
6854
|
+
}, "strip", z.ZodTypeAny, {
|
|
6855
|
+
x: number;
|
|
6856
|
+
y: number;
|
|
6857
|
+
width: number;
|
|
6858
|
+
layer: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
6859
|
+
route_type: "wire";
|
|
6860
|
+
start_pcb_port_id?: string | undefined;
|
|
6861
|
+
end_pcb_port_id?: string | undefined;
|
|
6862
|
+
}, {
|
|
6863
|
+
x: string | number;
|
|
6864
|
+
y: string | number;
|
|
6865
|
+
width: string | number;
|
|
6866
|
+
layer: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
6867
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
6868
|
+
};
|
|
6869
|
+
route_type: "wire";
|
|
6870
|
+
start_pcb_port_id?: string | undefined;
|
|
6871
|
+
end_pcb_port_id?: string | undefined;
|
|
6872
|
+
}>, z.ZodObject<{
|
|
6873
|
+
route_type: z.ZodLiteral<"via">;
|
|
6874
|
+
x: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
|
|
6875
|
+
y: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
|
|
6876
|
+
hole_diameter: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
6877
|
+
outer_diameter: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
6878
|
+
from_layer: z.ZodString;
|
|
6879
|
+
to_layer: z.ZodString;
|
|
6880
|
+
}, "strip", z.ZodTypeAny, {
|
|
6881
|
+
x: number;
|
|
6882
|
+
y: number;
|
|
6883
|
+
to_layer: string;
|
|
6884
|
+
route_type: "via";
|
|
6885
|
+
from_layer: string;
|
|
6886
|
+
hole_diameter?: number | undefined;
|
|
6887
|
+
outer_diameter?: number | undefined;
|
|
6888
|
+
}, {
|
|
6889
|
+
x: string | number;
|
|
6890
|
+
y: string | number;
|
|
6891
|
+
to_layer: string;
|
|
6892
|
+
route_type: "via";
|
|
6893
|
+
from_layer: string;
|
|
6894
|
+
hole_diameter?: string | number | undefined;
|
|
6895
|
+
outer_diameter?: string | number | undefined;
|
|
6896
|
+
}>]>, "many">;
|
|
6897
|
+
source_trace_id: z.ZodOptional<z.ZodString>;
|
|
6898
|
+
}, "strip", z.ZodTypeAny, {
|
|
6899
|
+
route: ({
|
|
6900
|
+
x: number;
|
|
6901
|
+
y: number;
|
|
6902
|
+
width: number;
|
|
6903
|
+
layer: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
6904
|
+
route_type: "wire";
|
|
6905
|
+
start_pcb_port_id?: string | undefined;
|
|
6906
|
+
end_pcb_port_id?: string | undefined;
|
|
6907
|
+
} | {
|
|
6908
|
+
x: number;
|
|
6909
|
+
y: number;
|
|
6910
|
+
to_layer: string;
|
|
6911
|
+
route_type: "via";
|
|
6912
|
+
from_layer: string;
|
|
6913
|
+
hole_diameter?: number | undefined;
|
|
6914
|
+
outer_diameter?: number | undefined;
|
|
6915
|
+
})[];
|
|
6916
|
+
source_trace_id?: string | undefined;
|
|
6917
|
+
}, {
|
|
6918
|
+
route: ({
|
|
6919
|
+
x: string | number;
|
|
6920
|
+
y: string | number;
|
|
6921
|
+
width: string | number;
|
|
6922
|
+
layer: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
6923
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
6924
|
+
};
|
|
6925
|
+
route_type: "wire";
|
|
6926
|
+
start_pcb_port_id?: string | undefined;
|
|
6927
|
+
end_pcb_port_id?: string | undefined;
|
|
6928
|
+
} | {
|
|
6929
|
+
x: string | number;
|
|
6930
|
+
y: string | number;
|
|
6931
|
+
to_layer: string;
|
|
6932
|
+
route_type: "via";
|
|
6933
|
+
from_layer: string;
|
|
6934
|
+
hole_diameter?: string | number | undefined;
|
|
6935
|
+
outer_diameter?: string | number | undefined;
|
|
6936
|
+
})[];
|
|
6937
|
+
source_trace_id?: string | undefined;
|
|
6938
|
+
}>;
|
|
6939
|
+
};
|
|
6940
|
+
doInitialPcbPrimitiveRender(): void;
|
|
6941
|
+
getPcbSize(): {
|
|
6942
|
+
width: number;
|
|
6943
|
+
height: number;
|
|
6944
|
+
};
|
|
6945
|
+
}
|
|
6946
|
+
|
|
6730
6947
|
declare class TraceHint extends PrimitiveComponent<typeof traceHintProps> {
|
|
6731
6948
|
matchedPort: Port | null;
|
|
6732
6949
|
get config(): {
|
|
@@ -11966,4 +12183,4 @@ declare module "react/jsx-runtime" {
|
|
|
11966
12183
|
}
|
|
11967
12184
|
}
|
|
11968
12185
|
|
|
11969
|
-
export { type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Crystal, Diode, FabricationNotePath, FabricationNoteText, Footprint, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Mosfet, Net, NetAlias, NormalComponent, type Obstacle, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, Subcircuit, Switch, Trace, TraceHint, Transistor, Via, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
|
12186
|
+
export { type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Crystal, Diode, FabricationNotePath, FabricationNoteText, Footprint, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Mosfet, Net, NetAlias, NormalComponent, type Obstacle, PcbTrace, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, Subcircuit, Switch, Trace, TraceHint, Transistor, Via, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,7 @@ __export(components_exports, {
|
|
|
27
27
|
Net: () => Net,
|
|
28
28
|
NetAlias: () => NetAlias,
|
|
29
29
|
NormalComponent: () => NormalComponent,
|
|
30
|
+
PcbTrace: () => PcbTrace,
|
|
30
31
|
PinHeader: () => PinHeader,
|
|
31
32
|
PlatedHole: () => PlatedHole,
|
|
32
33
|
Port: () => Port,
|
|
@@ -1822,6 +1823,74 @@ var SilkscreenPath = class extends PrimitiveComponent2 {
|
|
|
1822
1823
|
}
|
|
1823
1824
|
};
|
|
1824
1825
|
|
|
1826
|
+
// lib/components/primitive-components/PcbTrace.ts
|
|
1827
|
+
import { z as z4 } from "zod";
|
|
1828
|
+
import { pcb_trace_route_point } from "circuit-json";
|
|
1829
|
+
import { applyToPoint as applyToPoint3 } from "transformation-matrix";
|
|
1830
|
+
var pcbTraceProps = z4.object({
|
|
1831
|
+
route: z4.array(pcb_trace_route_point),
|
|
1832
|
+
// If this primitive PcbTrace needs to be associated with a source_trace_id
|
|
1833
|
+
// it can be added as a prop here. For footprints, it's often not needed.
|
|
1834
|
+
source_trace_id: z4.string().optional()
|
|
1835
|
+
});
|
|
1836
|
+
var PcbTrace = class extends PrimitiveComponent2 {
|
|
1837
|
+
pcb_trace_id = null;
|
|
1838
|
+
isPcbPrimitive = true;
|
|
1839
|
+
get config() {
|
|
1840
|
+
return {
|
|
1841
|
+
componentName: "PcbTrace",
|
|
1842
|
+
zodProps: pcbTraceProps
|
|
1843
|
+
};
|
|
1844
|
+
}
|
|
1845
|
+
doInitialPcbPrimitiveRender() {
|
|
1846
|
+
if (this.root?.pcbDisabled) return;
|
|
1847
|
+
const { db } = this.root;
|
|
1848
|
+
const { _parsedProps: props } = this;
|
|
1849
|
+
const container = this.getPrimitiveContainer();
|
|
1850
|
+
const subcircuit = this.getSubcircuit();
|
|
1851
|
+
const parentTransform = container._computePcbGlobalTransformBeforeLayout();
|
|
1852
|
+
const transformedRoute = props.route.map((point) => {
|
|
1853
|
+
const { x, y, ...restOfPoint } = point;
|
|
1854
|
+
const transformedPoint = applyToPoint3(parentTransform, { x, y });
|
|
1855
|
+
return { ...transformedPoint, ...restOfPoint };
|
|
1856
|
+
});
|
|
1857
|
+
const pcb_trace = db.pcb_trace.insert({
|
|
1858
|
+
pcb_component_id: container.pcb_component_id,
|
|
1859
|
+
source_trace_id: props.source_trace_id,
|
|
1860
|
+
route: transformedRoute,
|
|
1861
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
1862
|
+
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
1863
|
+
});
|
|
1864
|
+
this.pcb_trace_id = pcb_trace.pcb_trace_id;
|
|
1865
|
+
}
|
|
1866
|
+
getPcbSize() {
|
|
1867
|
+
const { _parsedProps: props } = this;
|
|
1868
|
+
if (!props.route || props.route.length === 0) {
|
|
1869
|
+
return { width: 0, height: 0 };
|
|
1870
|
+
}
|
|
1871
|
+
let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
|
|
1872
|
+
for (const point of props.route) {
|
|
1873
|
+
minX = Math.min(minX, point.x);
|
|
1874
|
+
maxX = Math.max(maxX, point.x);
|
|
1875
|
+
minY = Math.min(minY, point.y);
|
|
1876
|
+
maxY = Math.max(maxY, point.y);
|
|
1877
|
+
if (point.route_type === "wire") {
|
|
1878
|
+
minX = Math.min(minX, point.x - point.width / 2);
|
|
1879
|
+
maxX = Math.max(maxX, point.x + point.width / 2);
|
|
1880
|
+
minY = Math.min(minY, point.y - point.width / 2);
|
|
1881
|
+
maxY = Math.max(maxY, point.y + point.width / 2);
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
if (minX === Infinity || maxX === -Infinity || minY === Infinity || maxY === -Infinity) {
|
|
1885
|
+
return { width: 0, height: 0 };
|
|
1886
|
+
}
|
|
1887
|
+
return {
|
|
1888
|
+
width: maxX - minX,
|
|
1889
|
+
height: maxY - minY
|
|
1890
|
+
};
|
|
1891
|
+
}
|
|
1892
|
+
};
|
|
1893
|
+
|
|
1825
1894
|
// lib/components/primitive-components/PlatedHole.ts
|
|
1826
1895
|
import { platedHoleProps } from "@tscircuit/props";
|
|
1827
1896
|
var PlatedHole = class extends PrimitiveComponent2 {
|
|
@@ -2264,6 +2333,12 @@ var createComponentsFromCircuitJson = ({
|
|
|
2264
2333
|
})
|
|
2265
2334
|
);
|
|
2266
2335
|
}
|
|
2336
|
+
} else if (elm.type === "pcb_trace") {
|
|
2337
|
+
components.push(
|
|
2338
|
+
new PcbTrace({
|
|
2339
|
+
route: elm.route
|
|
2340
|
+
})
|
|
2341
|
+
);
|
|
2267
2342
|
}
|
|
2268
2343
|
}
|
|
2269
2344
|
return components;
|
|
@@ -2317,8 +2392,8 @@ function getRelativeDirection(pointA, pointB) {
|
|
|
2317
2392
|
|
|
2318
2393
|
// lib/components/primitive-components/Port/Port.ts
|
|
2319
2394
|
import "schematic-symbols";
|
|
2320
|
-
import { applyToPoint as
|
|
2321
|
-
import { z as
|
|
2395
|
+
import { applyToPoint as applyToPoint4, compose as compose2, translate as translate2 } from "transformation-matrix";
|
|
2396
|
+
import { z as z5 } from "zod";
|
|
2322
2397
|
|
|
2323
2398
|
// lib/components/primitive-components/Port/areAllPcbPrimitivesOverlapping.ts
|
|
2324
2399
|
var areAllPcbPrimitivesOverlapping = (pcbPrimitives) => {
|
|
@@ -2368,10 +2443,10 @@ var getCenterOfPcbPrimitives = (pcbPrimitives) => {
|
|
|
2368
2443
|
};
|
|
2369
2444
|
|
|
2370
2445
|
// lib/components/primitive-components/Port/Port.ts
|
|
2371
|
-
var portProps =
|
|
2372
|
-
name:
|
|
2373
|
-
pinNumber:
|
|
2374
|
-
aliases:
|
|
2446
|
+
var portProps = z5.object({
|
|
2447
|
+
name: z5.string().optional(),
|
|
2448
|
+
pinNumber: z5.number().optional(),
|
|
2449
|
+
aliases: z5.array(z5.string()).optional()
|
|
2375
2450
|
});
|
|
2376
2451
|
var Port = class extends PrimitiveComponent2 {
|
|
2377
2452
|
source_port_id = null;
|
|
@@ -2490,7 +2565,7 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
2490
2565
|
this.parent.computeSchematicGlobalTransform(),
|
|
2491
2566
|
translate2(-symbol.center.x, -symbol.center.y)
|
|
2492
2567
|
);
|
|
2493
|
-
return
|
|
2568
|
+
return applyToPoint4(transform, schematicSymbolPortDef);
|
|
2494
2569
|
}
|
|
2495
2570
|
const parentBoxDim = this?.parent?._getSchematicBoxDimensions();
|
|
2496
2571
|
if (parentBoxDim && this.props.pinNumber !== void 0) {
|
|
@@ -2502,7 +2577,7 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
2502
2577
|
`Couldn't find position for schematic_port for port ${this.getString()} inside of the schematic box`
|
|
2503
2578
|
);
|
|
2504
2579
|
}
|
|
2505
|
-
return
|
|
2580
|
+
return applyToPoint4(
|
|
2506
2581
|
this.parent.computeSchematicGlobalTransform(),
|
|
2507
2582
|
localPortPosition
|
|
2508
2583
|
);
|
|
@@ -3019,7 +3094,7 @@ import {
|
|
|
3019
3094
|
isValidElement
|
|
3020
3095
|
} from "react";
|
|
3021
3096
|
import { symbols as symbols2 } from "schematic-symbols";
|
|
3022
|
-
import { z as
|
|
3097
|
+
import { z as z7 } from "zod";
|
|
3023
3098
|
|
|
3024
3099
|
// lib/components/primitive-components/Footprint.ts
|
|
3025
3100
|
import { footprintProps } from "@tscircuit/props";
|
|
@@ -4842,7 +4917,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
4842
4917
|
|
|
4843
4918
|
// lib/components/base-components/NormalComponent/NormalComponent.ts
|
|
4844
4919
|
var debug3 = Debug4("tscircuit:core");
|
|
4845
|
-
var rotation3 =
|
|
4920
|
+
var rotation3 = z7.object({
|
|
4846
4921
|
x: rotation,
|
|
4847
4922
|
y: rotation,
|
|
4848
4923
|
z: rotation
|
|
@@ -5759,7 +5834,7 @@ import "zod";
|
|
|
5759
5834
|
|
|
5760
5835
|
// lib/components/primitive-components/TraceHint.ts
|
|
5761
5836
|
import { traceHintProps } from "@tscircuit/props";
|
|
5762
|
-
import { applyToPoint as
|
|
5837
|
+
import { applyToPoint as applyToPoint5 } from "transformation-matrix";
|
|
5763
5838
|
var TraceHint = class extends PrimitiveComponent2 {
|
|
5764
5839
|
matchedPort = null;
|
|
5765
5840
|
get config() {
|
|
@@ -5799,7 +5874,7 @@ var TraceHint = class extends PrimitiveComponent2 {
|
|
|
5799
5874
|
const globalTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
5800
5875
|
return offsets.map(
|
|
5801
5876
|
(offset) => ({
|
|
5802
|
-
...
|
|
5877
|
+
...applyToPoint5(globalTransform, offset),
|
|
5803
5878
|
via: offset.via,
|
|
5804
5879
|
to_layer: offset.to_layer,
|
|
5805
5880
|
trace_width: offset.trace_width
|
|
@@ -7302,7 +7377,7 @@ var Constraint2 = class extends PrimitiveComponent2 {
|
|
|
7302
7377
|
|
|
7303
7378
|
// lib/components/primitive-components/FabricationNotePath.ts
|
|
7304
7379
|
import { fabricationNotePathProps } from "@tscircuit/props";
|
|
7305
|
-
import { applyToPoint as
|
|
7380
|
+
import { applyToPoint as applyToPoint6 } from "transformation-matrix";
|
|
7306
7381
|
var FabricationNotePath = class extends PrimitiveComponent2 {
|
|
7307
7382
|
fabrication_note_path_id = null;
|
|
7308
7383
|
get config() {
|
|
@@ -7328,7 +7403,7 @@ var FabricationNotePath = class extends PrimitiveComponent2 {
|
|
|
7328
7403
|
layer,
|
|
7329
7404
|
color: props.color,
|
|
7330
7405
|
route: props.route.map((p) => {
|
|
7331
|
-
const transformedPosition =
|
|
7406
|
+
const transformedPosition = applyToPoint6(transform, {
|
|
7332
7407
|
x: p.x,
|
|
7333
7408
|
y: p.y
|
|
7334
7409
|
});
|
|
@@ -8020,7 +8095,7 @@ import { identity as identity4 } from "transformation-matrix";
|
|
|
8020
8095
|
var package_default = {
|
|
8021
8096
|
name: "@tscircuit/core",
|
|
8022
8097
|
type: "module",
|
|
8023
|
-
version: "0.0.
|
|
8098
|
+
version: "0.0.394",
|
|
8024
8099
|
types: "dist/index.d.ts",
|
|
8025
8100
|
main: "dist/index.js",
|
|
8026
8101
|
module: "dist/index.js",
|
|
@@ -8043,7 +8118,7 @@ var package_default = {
|
|
|
8043
8118
|
},
|
|
8044
8119
|
devDependencies: {
|
|
8045
8120
|
"@biomejs/biome": "^1.8.3",
|
|
8046
|
-
"@tscircuit/footprinter": "^0.0.
|
|
8121
|
+
"@tscircuit/footprinter": "^0.0.155",
|
|
8047
8122
|
"@tscircuit/import-snippet": "^0.0.4",
|
|
8048
8123
|
"@tscircuit/layout": "^0.0.28",
|
|
8049
8124
|
"@tscircuit/log-soup": "^1.0.2",
|
|
@@ -8473,6 +8548,7 @@ export {
|
|
|
8473
8548
|
Net,
|
|
8474
8549
|
NetAlias,
|
|
8475
8550
|
NormalComponent,
|
|
8551
|
+
PcbTrace,
|
|
8476
8552
|
PinHeader,
|
|
8477
8553
|
PlatedHole,
|
|
8478
8554
|
Port,
|
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.395",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@biomejs/biome": "^1.8.3",
|
|
27
|
-
"@tscircuit/footprinter": "^0.0.
|
|
27
|
+
"@tscircuit/footprinter": "^0.0.155",
|
|
28
28
|
"@tscircuit/import-snippet": "^0.0.4",
|
|
29
29
|
"@tscircuit/layout": "^0.0.28",
|
|
30
30
|
"@tscircuit/log-soup": "^1.0.2",
|