@tscircuit/core 0.0.613 → 0.0.615
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 +102 -1
- package/dist/index.js +138 -14
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { CircuitJsonUtilObjects } from '@tscircuit/circuit-json-util';
|
|
|
11
11
|
import { ConnectivityMap } from 'circuit-json-to-connectivity-map';
|
|
12
12
|
import { GraphicsObject } from 'graphics-debug';
|
|
13
13
|
|
|
14
|
-
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "PcbFootprintStringRender", "InitializePortsFromChildren", "CreateNetsFromProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SchematicPrimitiveRender", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbLayout", "PcbBoardAutoSize", "PcbTraceHintRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbDesignRuleChecks", "CadModelRender", "PartsEngineRender"];
|
|
14
|
+
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "PcbFootprintStringRender", "InitializePortsFromChildren", "CreateNetsFromProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SchematicPrimitiveRender", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbLayout", "PcbBoardAutoSize", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbDesignRuleChecks", "CadModelRender", "PartsEngineRender"];
|
|
15
15
|
type RenderPhase = (typeof orderedRenderPhases)[number];
|
|
16
16
|
type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
|
|
17
17
|
type RenderPhaseStates = Record<RenderPhase, {
|
|
@@ -602,6 +602,17 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
|
|
|
602
602
|
} | undefined;
|
|
603
603
|
trace_width?: string | number | undefined;
|
|
604
604
|
}>, "many">>;
|
|
605
|
+
pcbPathRelativeTo: z.ZodOptional<z.ZodString>;
|
|
606
|
+
pcbPath: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
607
|
+
x: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
|
|
608
|
+
y: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
|
|
609
|
+
}, "strip", z.ZodTypeAny, {
|
|
610
|
+
x: number;
|
|
611
|
+
y: number;
|
|
612
|
+
}, {
|
|
613
|
+
x: string | number;
|
|
614
|
+
y: string | number;
|
|
615
|
+
}>, "many">>;
|
|
605
616
|
schDisplayLabel: z.ZodOptional<z.ZodString>;
|
|
606
617
|
maxLength: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
607
618
|
} & {
|
|
@@ -628,6 +639,11 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
|
|
|
628
639
|
to_layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
|
|
629
640
|
trace_width?: number | undefined;
|
|
630
641
|
}[] | undefined;
|
|
642
|
+
pcbPathRelativeTo?: string | undefined;
|
|
643
|
+
pcbPath?: {
|
|
644
|
+
x: number;
|
|
645
|
+
y: number;
|
|
646
|
+
}[] | undefined;
|
|
631
647
|
schDisplayLabel?: string | undefined;
|
|
632
648
|
}, {
|
|
633
649
|
path: (string | {
|
|
@@ -649,6 +665,11 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
|
|
|
649
665
|
} | undefined;
|
|
650
666
|
trace_width?: string | number | undefined;
|
|
651
667
|
}[] | undefined;
|
|
668
|
+
pcbPathRelativeTo?: string | undefined;
|
|
669
|
+
pcbPath?: {
|
|
670
|
+
x: string | number;
|
|
671
|
+
y: string | number;
|
|
672
|
+
}[] | undefined;
|
|
652
673
|
schDisplayLabel?: string | undefined;
|
|
653
674
|
}>, z.ZodObject<{
|
|
654
675
|
key: z.ZodOptional<z.ZodString>;
|
|
@@ -692,6 +713,17 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
|
|
|
692
713
|
} | undefined;
|
|
693
714
|
trace_width?: string | number | undefined;
|
|
694
715
|
}>, "many">>;
|
|
716
|
+
pcbPathRelativeTo: z.ZodOptional<z.ZodString>;
|
|
717
|
+
pcbPath: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
718
|
+
x: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
|
|
719
|
+
y: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>;
|
|
720
|
+
}, "strip", z.ZodTypeAny, {
|
|
721
|
+
x: number;
|
|
722
|
+
y: number;
|
|
723
|
+
}, {
|
|
724
|
+
x: string | number;
|
|
725
|
+
y: string | number;
|
|
726
|
+
}>, "many">>;
|
|
695
727
|
schDisplayLabel: z.ZodOptional<z.ZodString>;
|
|
696
728
|
maxLength: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
|
|
697
729
|
} & {
|
|
@@ -726,6 +758,11 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
|
|
|
726
758
|
to_layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
|
|
727
759
|
trace_width?: number | undefined;
|
|
728
760
|
}[] | undefined;
|
|
761
|
+
pcbPathRelativeTo?: string | undefined;
|
|
762
|
+
pcbPath?: {
|
|
763
|
+
x: number;
|
|
764
|
+
y: number;
|
|
765
|
+
}[] | undefined;
|
|
729
766
|
schDisplayLabel?: string | undefined;
|
|
730
767
|
}, {
|
|
731
768
|
from: string | {
|
|
@@ -750,6 +787,11 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
|
|
|
750
787
|
} | undefined;
|
|
751
788
|
trace_width?: string | number | undefined;
|
|
752
789
|
}[] | undefined;
|
|
790
|
+
pcbPathRelativeTo?: string | undefined;
|
|
791
|
+
pcbPath?: {
|
|
792
|
+
x: string | number;
|
|
793
|
+
y: string | number;
|
|
794
|
+
}[] | undefined;
|
|
753
795
|
schDisplayLabel?: string | undefined;
|
|
754
796
|
}>]>;
|
|
755
797
|
componentName: string;
|
|
@@ -795,6 +837,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
|
|
|
795
837
|
_computeTraceConnectionHash(): string | null;
|
|
796
838
|
doInitialSourceTraceRender(): void;
|
|
797
839
|
_insertErrorIfTraceIsOutsideBoard(mergedRoute: PcbTraceRoutePoint[], ports: Port[]): void;
|
|
840
|
+
doInitialPcbManualTraceRender(): void;
|
|
798
841
|
doInitialPcbTraceRender(): void;
|
|
799
842
|
_doInitialSchematicTraceRenderWithDisplayLabel(): void;
|
|
800
843
|
_isSymbolToChipConnection(): boolean | undefined;
|
|
@@ -967,6 +1010,7 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
|
|
|
967
1010
|
initPorts(opts?: {
|
|
968
1011
|
additionalAliases?: Record<`pin${number}`, string[]>;
|
|
969
1012
|
pinCount?: number;
|
|
1013
|
+
ignoreSymbolPorts?: boolean;
|
|
970
1014
|
}): void;
|
|
971
1015
|
_getImpliedFootprintString(): string | null;
|
|
972
1016
|
_isFootprintUrl(s: string): boolean;
|
|
@@ -1162,6 +1206,25 @@ declare class Board extends Group<typeof boardProps> {
|
|
|
1162
1206
|
pcbFlexColumn: zod.ZodOptional<zod.ZodBoolean>;
|
|
1163
1207
|
pcbGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
|
|
1164
1208
|
pcbPack: zod.ZodOptional<zod.ZodBoolean>;
|
|
1209
|
+
schGrid: zod.ZodOptional<zod.ZodBoolean>;
|
|
1210
|
+
schGridCols: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
|
|
1211
|
+
schGridRows: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
|
|
1212
|
+
schGridTemplateRows: zod.ZodOptional<zod.ZodString>;
|
|
1213
|
+
schGridTemplateColumns: zod.ZodOptional<zod.ZodString>;
|
|
1214
|
+
schGridTemplate: zod.ZodOptional<zod.ZodString>;
|
|
1215
|
+
schGridGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
|
|
1216
|
+
schGridRowGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
|
|
1217
|
+
schGridColumnGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
|
|
1218
|
+
schFlex: zod.ZodOptional<zod.ZodUnion<[zod.ZodBoolean, zod.ZodString]>>;
|
|
1219
|
+
schFlexGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
|
|
1220
|
+
schFlexDirection: zod.ZodOptional<zod.ZodEnum<["row", "column"]>>;
|
|
1221
|
+
schAlignItems: zod.ZodOptional<zod.ZodEnum<["start", "center", "end", "stretch"]>>;
|
|
1222
|
+
schJustifyContent: zod.ZodOptional<zod.ZodEnum<["start", "center", "end", "stretch", "space-between", "space-around", "space-evenly"]>>;
|
|
1223
|
+
schFlexRow: zod.ZodOptional<zod.ZodBoolean>;
|
|
1224
|
+
schFlexColumn: zod.ZodOptional<zod.ZodBoolean>;
|
|
1225
|
+
schGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
|
|
1226
|
+
schPack: zod.ZodOptional<zod.ZodBoolean>;
|
|
1227
|
+
schMatchAdapt: zod.ZodOptional<zod.ZodBoolean>;
|
|
1165
1228
|
pcbWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
1166
1229
|
pcbHeight: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
1167
1230
|
schWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
@@ -1822,6 +1885,25 @@ declare class Board extends Group<typeof boardProps> {
|
|
|
1822
1885
|
pcbFlexColumn?: boolean | undefined;
|
|
1823
1886
|
pcbGap?: string | number | undefined;
|
|
1824
1887
|
pcbPack?: boolean | undefined;
|
|
1888
|
+
schGrid?: boolean | undefined;
|
|
1889
|
+
schGridCols?: string | number | undefined;
|
|
1890
|
+
schGridRows?: string | number | undefined;
|
|
1891
|
+
schGridTemplateRows?: string | undefined;
|
|
1892
|
+
schGridTemplateColumns?: string | undefined;
|
|
1893
|
+
schGridTemplate?: string | undefined;
|
|
1894
|
+
schGridGap?: string | number | undefined;
|
|
1895
|
+
schGridRowGap?: string | number | undefined;
|
|
1896
|
+
schGridColumnGap?: string | number | undefined;
|
|
1897
|
+
schFlex?: string | boolean | undefined;
|
|
1898
|
+
schFlexGap?: string | number | undefined;
|
|
1899
|
+
schFlexDirection?: "row" | "column" | undefined;
|
|
1900
|
+
schAlignItems?: "center" | "start" | "end" | "stretch" | undefined;
|
|
1901
|
+
schJustifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
|
|
1902
|
+
schFlexRow?: boolean | undefined;
|
|
1903
|
+
schFlexColumn?: boolean | undefined;
|
|
1904
|
+
schGap?: string | number | undefined;
|
|
1905
|
+
schPack?: boolean | undefined;
|
|
1906
|
+
schMatchAdapt?: boolean | undefined;
|
|
1825
1907
|
manualEdits?: {
|
|
1826
1908
|
pcb_placements?: {
|
|
1827
1909
|
selector: string;
|
|
@@ -2038,6 +2120,25 @@ declare class Board extends Group<typeof boardProps> {
|
|
|
2038
2120
|
pcbFlexColumn?: boolean | undefined;
|
|
2039
2121
|
pcbGap?: string | number | undefined;
|
|
2040
2122
|
pcbPack?: boolean | undefined;
|
|
2123
|
+
schGrid?: boolean | undefined;
|
|
2124
|
+
schGridCols?: string | number | undefined;
|
|
2125
|
+
schGridRows?: string | number | undefined;
|
|
2126
|
+
schGridTemplateRows?: string | undefined;
|
|
2127
|
+
schGridTemplateColumns?: string | undefined;
|
|
2128
|
+
schGridTemplate?: string | undefined;
|
|
2129
|
+
schGridGap?: string | number | undefined;
|
|
2130
|
+
schGridRowGap?: string | number | undefined;
|
|
2131
|
+
schGridColumnGap?: string | number | undefined;
|
|
2132
|
+
schFlex?: string | boolean | undefined;
|
|
2133
|
+
schFlexGap?: string | number | undefined;
|
|
2134
|
+
schFlexDirection?: "row" | "column" | undefined;
|
|
2135
|
+
schAlignItems?: "center" | "start" | "end" | "stretch" | undefined;
|
|
2136
|
+
schJustifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
|
|
2137
|
+
schFlexRow?: boolean | undefined;
|
|
2138
|
+
schFlexColumn?: boolean | undefined;
|
|
2139
|
+
schGap?: string | number | undefined;
|
|
2140
|
+
schPack?: boolean | undefined;
|
|
2141
|
+
schMatchAdapt?: boolean | undefined;
|
|
2041
2142
|
manualEdits?: {
|
|
2042
2143
|
pcb_placements?: {
|
|
2043
2144
|
selector: string;
|
package/dist/index.js
CHANGED
|
@@ -114,6 +114,7 @@ var orderedRenderPhases = [
|
|
|
114
114
|
"PcbLayout",
|
|
115
115
|
"PcbBoardAutoSize",
|
|
116
116
|
"PcbTraceHintRender",
|
|
117
|
+
"PcbManualTraceRender",
|
|
117
118
|
"PcbTraceRender",
|
|
118
119
|
"PcbRouteNetIslands",
|
|
119
120
|
"PcbDesignRuleChecks",
|
|
@@ -5440,6 +5441,9 @@ function Trace_doInitialPcbTraceRender(trace) {
|
|
|
5440
5441
|
trace.pcb_trace_id = pcb_trace2.pcb_trace_id;
|
|
5441
5442
|
return;
|
|
5442
5443
|
}
|
|
5444
|
+
if (props.pcbPath && props.pcbPath.length > 0) {
|
|
5445
|
+
return;
|
|
5446
|
+
}
|
|
5443
5447
|
if (!subcircuit._shouldUseTraceByTraceRouting()) {
|
|
5444
5448
|
return;
|
|
5445
5449
|
}
|
|
@@ -5694,6 +5698,88 @@ function Trace_doInitialPcbTraceRender(trace) {
|
|
|
5694
5698
|
trace._insertErrorIfTraceIsOutsideBoard(mergedRoute, ports);
|
|
5695
5699
|
}
|
|
5696
5700
|
|
|
5701
|
+
// lib/components/primitive-components/Trace/Trace_doInitialPcbManualTraceRender.ts
|
|
5702
|
+
function Trace_doInitialPcbManualTraceRender(trace) {
|
|
5703
|
+
if (trace.root?.pcbDisabled) return;
|
|
5704
|
+
const { db } = trace.root;
|
|
5705
|
+
const { _parsedProps: props } = trace;
|
|
5706
|
+
const subcircuit = trace.getSubcircuit();
|
|
5707
|
+
if (!props.pcbPath || props.pcbPath.length === 0) return;
|
|
5708
|
+
const { allPortsFound, ports, portsWithSelectors } = trace._findConnectedPorts();
|
|
5709
|
+
if (!allPortsFound) return;
|
|
5710
|
+
const portsWithoutMatchedPcbPrimitive = [];
|
|
5711
|
+
for (const port of ports) {
|
|
5712
|
+
if (!port._hasMatchedPcbPrimitive()) {
|
|
5713
|
+
portsWithoutMatchedPcbPrimitive.push(port);
|
|
5714
|
+
}
|
|
5715
|
+
}
|
|
5716
|
+
if (portsWithoutMatchedPcbPrimitive.length > 0) {
|
|
5717
|
+
db.pcb_trace_error.insert({
|
|
5718
|
+
error_type: "pcb_trace_error",
|
|
5719
|
+
source_trace_id: trace.source_trace_id,
|
|
5720
|
+
message: `Some ports did not have a matching PCB primitive (e.g. a pad or plated hole), this can happen if a footprint is missing. As a result, ${trace} wasn't routed. Missing ports: ${portsWithoutMatchedPcbPrimitive.map((p) => p.getString()).join(", ")}`,
|
|
5721
|
+
pcb_trace_id: trace.pcb_trace_id,
|
|
5722
|
+
pcb_component_ids: [],
|
|
5723
|
+
pcb_port_ids: portsWithoutMatchedPcbPrimitive.map((p) => p.pcb_port_id).filter(Boolean)
|
|
5724
|
+
});
|
|
5725
|
+
return;
|
|
5726
|
+
}
|
|
5727
|
+
let anchorPort;
|
|
5728
|
+
if (props.pcbPathRelativeTo) {
|
|
5729
|
+
anchorPort = portsWithSelectors.find(
|
|
5730
|
+
(p) => p.selector === props.pcbPathRelativeTo
|
|
5731
|
+
)?.port;
|
|
5732
|
+
if (!anchorPort) {
|
|
5733
|
+
anchorPort = trace.getSubcircuit().selectOne(props.pcbPathRelativeTo);
|
|
5734
|
+
}
|
|
5735
|
+
}
|
|
5736
|
+
if (!anchorPort) {
|
|
5737
|
+
anchorPort = ports[0];
|
|
5738
|
+
}
|
|
5739
|
+
const otherPort = ports.find((p) => p !== anchorPort) ?? ports[1];
|
|
5740
|
+
const layer = anchorPort.getAvailablePcbLayers()[0] || "top";
|
|
5741
|
+
const width = props.thickness ?? trace.getSubcircuit()._parsedProps.minTraceWidth ?? 0.16;
|
|
5742
|
+
const anchorPos = anchorPort._getGlobalPcbPositionAfterLayout();
|
|
5743
|
+
const otherPos = otherPort._getGlobalPcbPositionAfterLayout();
|
|
5744
|
+
const route = [];
|
|
5745
|
+
route.push({
|
|
5746
|
+
route_type: "wire",
|
|
5747
|
+
x: anchorPos.x,
|
|
5748
|
+
y: anchorPos.y,
|
|
5749
|
+
width,
|
|
5750
|
+
layer,
|
|
5751
|
+
start_pcb_port_id: anchorPort.pcb_port_id
|
|
5752
|
+
});
|
|
5753
|
+
for (const pt of props.pcbPath) {
|
|
5754
|
+
route.push({
|
|
5755
|
+
route_type: "wire",
|
|
5756
|
+
x: anchorPos.x + pt.x,
|
|
5757
|
+
y: anchorPos.y + pt.y,
|
|
5758
|
+
width,
|
|
5759
|
+
layer
|
|
5760
|
+
});
|
|
5761
|
+
}
|
|
5762
|
+
route.push({
|
|
5763
|
+
route_type: "wire",
|
|
5764
|
+
x: otherPos.x,
|
|
5765
|
+
y: otherPos.y,
|
|
5766
|
+
width,
|
|
5767
|
+
layer,
|
|
5768
|
+
end_pcb_port_id: otherPort.pcb_port_id
|
|
5769
|
+
});
|
|
5770
|
+
const traceLength = getTraceLength(route);
|
|
5771
|
+
const pcb_trace = db.pcb_trace.insert({
|
|
5772
|
+
route,
|
|
5773
|
+
source_trace_id: trace.source_trace_id,
|
|
5774
|
+
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
5775
|
+
pcb_group_id: trace.getGroup()?.pcb_group_id ?? void 0,
|
|
5776
|
+
trace_length: traceLength
|
|
5777
|
+
});
|
|
5778
|
+
trace._portsRoutedOnPcb = ports;
|
|
5779
|
+
trace.pcb_trace_id = pcb_trace.pcb_trace_id;
|
|
5780
|
+
trace._insertErrorIfTraceIsOutsideBoard(route, ports);
|
|
5781
|
+
}
|
|
5782
|
+
|
|
5697
5783
|
// lib/components/primitive-components/Trace/Trace__doInitialSchematicTraceRenderWithDisplayLabel.ts
|
|
5698
5784
|
function Trace__doInitialSchematicTraceRenderWithDisplayLabel(trace) {
|
|
5699
5785
|
if (trace.root?.schematicDisabled) return;
|
|
@@ -6035,6 +6121,9 @@ var Trace3 = class extends PrimitiveComponent2 {
|
|
|
6035
6121
|
});
|
|
6036
6122
|
}
|
|
6037
6123
|
}
|
|
6124
|
+
doInitialPcbManualTraceRender() {
|
|
6125
|
+
Trace_doInitialPcbManualTraceRender(this);
|
|
6126
|
+
}
|
|
6038
6127
|
doInitialPcbTraceRender() {
|
|
6039
6128
|
Trace_doInitialPcbTraceRender(this);
|
|
6040
6129
|
}
|
|
@@ -6192,7 +6281,7 @@ var NormalComponent = class extends PrimitiveComponent2 {
|
|
|
6192
6281
|
}
|
|
6193
6282
|
}
|
|
6194
6283
|
}
|
|
6195
|
-
if (config.schematicSymbolName) {
|
|
6284
|
+
if (config.schematicSymbolName && !opts.ignoreSymbolPorts) {
|
|
6196
6285
|
const sym = symbols2[this._getSchematicSymbolNameOrThrow()];
|
|
6197
6286
|
if (!sym) return;
|
|
6198
6287
|
for (const symPort of sym.ports) {
|
|
@@ -6228,9 +6317,18 @@ var NormalComponent = class extends PrimitiveComponent2 {
|
|
|
6228
6317
|
}
|
|
6229
6318
|
}
|
|
6230
6319
|
}
|
|
6231
|
-
|
|
6232
|
-
|
|
6320
|
+
const requiredPinCount = opts.pinCount ?? this._getPinCount() ?? 0;
|
|
6321
|
+
for (let pn = 1; pn <= requiredPinCount; pn++) {
|
|
6233
6322
|
if (portsToCreate.find((p) => p._parsedProps.pinNumber === pn)) continue;
|
|
6323
|
+
if (!schPortArrangement) {
|
|
6324
|
+
portsToCreate.push(
|
|
6325
|
+
new Port({
|
|
6326
|
+
pinNumber: pn,
|
|
6327
|
+
aliases: opts.additionalAliases?.[`pin${pn}`] ?? []
|
|
6328
|
+
})
|
|
6329
|
+
);
|
|
6330
|
+
continue;
|
|
6331
|
+
}
|
|
6234
6332
|
let explicitlyListedPinNumbersInSchPortArrangement = [
|
|
6235
6333
|
...schPortArrangement.leftSide?.pins ?? [],
|
|
6236
6334
|
...schPortArrangement.rightSide?.pins ?? [],
|
|
@@ -10917,6 +11015,7 @@ var Potentiometer = class extends NormalComponent {
|
|
|
10917
11015
|
|
|
10918
11016
|
// lib/components/normal-components/PushButton.ts
|
|
10919
11017
|
import { pushButtonProps } from "@tscircuit/props";
|
|
11018
|
+
import { symbols as symbols3 } from "schematic-symbols";
|
|
10920
11019
|
var PushButton = class extends NormalComponent {
|
|
10921
11020
|
get config() {
|
|
10922
11021
|
return {
|
|
@@ -10927,19 +11026,44 @@ var PushButton = class extends NormalComponent {
|
|
|
10927
11026
|
};
|
|
10928
11027
|
}
|
|
10929
11028
|
get defaultInternallyConnectedPinNames() {
|
|
10930
|
-
return [
|
|
10931
|
-
["pin1", "pin4"],
|
|
10932
|
-
["pin2", "pin3"]
|
|
10933
|
-
];
|
|
11029
|
+
return [];
|
|
10934
11030
|
}
|
|
10935
11031
|
initPorts() {
|
|
10936
11032
|
super.initPorts({
|
|
10937
|
-
pinCount:
|
|
10938
|
-
|
|
10939
|
-
pin1: ["side1"],
|
|
10940
|
-
pin3: ["side2"]
|
|
10941
|
-
}
|
|
11033
|
+
pinCount: 2,
|
|
11034
|
+
ignoreSymbolPorts: true
|
|
10942
11035
|
});
|
|
11036
|
+
const symbol = symbols3[this._getSchematicSymbolNameOrThrow()];
|
|
11037
|
+
const symPort1 = symbol.ports.find((p) => p.labels.includes("1"));
|
|
11038
|
+
const symPort2 = symbol.ports.find((p) => p.labels.includes("2"));
|
|
11039
|
+
const ports = this.selectAll("port");
|
|
11040
|
+
const pin1Port = ports.find((p) => p.props.pinNumber === 1);
|
|
11041
|
+
const pin2Port = ports.find((p) => p.props.pinNumber === 2);
|
|
11042
|
+
const pin3Port = ports.find((p) => p.props.pinNumber === 3);
|
|
11043
|
+
const pin4Port = ports.find((p) => p.props.pinNumber === 4);
|
|
11044
|
+
const { internallyConnectedPins } = this._parsedProps;
|
|
11045
|
+
pin1Port.schematicSymbolPortDef = symPort1;
|
|
11046
|
+
if (!internallyConnectedPins || internallyConnectedPins.length === 0) {
|
|
11047
|
+
pin2Port.schematicSymbolPortDef = symPort2;
|
|
11048
|
+
}
|
|
11049
|
+
for (const [pn, port] of [
|
|
11050
|
+
[2, pin2Port],
|
|
11051
|
+
[3, pin3Port],
|
|
11052
|
+
[4, pin4Port]
|
|
11053
|
+
]) {
|
|
11054
|
+
const internallyConnectedRow = internallyConnectedPins?.find(
|
|
11055
|
+
([pin1, pin2]) => pin1 === `pin${pn}` || pin2 === `pin${pn}`
|
|
11056
|
+
);
|
|
11057
|
+
if (!internallyConnectedRow) {
|
|
11058
|
+
port.schematicSymbolPortDef = symPort2;
|
|
11059
|
+
break;
|
|
11060
|
+
}
|
|
11061
|
+
const internallyConnectedTo = internallyConnectedRow?.[0] === `pin${pn}` ? internallyConnectedRow[1] : internallyConnectedRow?.[0];
|
|
11062
|
+
if (internallyConnectedTo === "pin1") {
|
|
11063
|
+
continue;
|
|
11064
|
+
}
|
|
11065
|
+
port.schematicSymbolPortDef = symPort2;
|
|
11066
|
+
}
|
|
10943
11067
|
}
|
|
10944
11068
|
doInitialSourceRender() {
|
|
10945
11069
|
const { db } = this.root;
|
|
@@ -11612,7 +11736,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
11612
11736
|
var package_default = {
|
|
11613
11737
|
name: "@tscircuit/core",
|
|
11614
11738
|
type: "module",
|
|
11615
|
-
version: "0.0.
|
|
11739
|
+
version: "0.0.614",
|
|
11616
11740
|
types: "dist/index.d.ts",
|
|
11617
11741
|
main: "dist/index.js",
|
|
11618
11742
|
module: "dist/index.js",
|
|
@@ -11644,7 +11768,7 @@ var package_default = {
|
|
|
11644
11768
|
"@tscircuit/log-soup": "^1.0.2",
|
|
11645
11769
|
"@tscircuit/math-utils": "^0.0.18",
|
|
11646
11770
|
"@tscircuit/miniflex": "^0.0.4",
|
|
11647
|
-
"@tscircuit/props": "^0.0.
|
|
11771
|
+
"@tscircuit/props": "^0.0.281",
|
|
11648
11772
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
11649
11773
|
"@tscircuit/schematic-corpus": "^0.0.110",
|
|
11650
11774
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
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.615",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@tscircuit/log-soup": "^1.0.2",
|
|
34
34
|
"@tscircuit/math-utils": "^0.0.18",
|
|
35
35
|
"@tscircuit/miniflex": "^0.0.4",
|
|
36
|
-
"@tscircuit/props": "^0.0.
|
|
36
|
+
"@tscircuit/props": "^0.0.281",
|
|
37
37
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
38
38
|
"@tscircuit/schematic-corpus": "^0.0.110",
|
|
39
39
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|