@tscircuit/core 0.0.1273 → 0.0.1274
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 +177 -29
- package/dist/index.js +124 -55
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -73055,14 +73055,190 @@ declare class Footprint extends PrimitiveComponent<typeof footprintProps> {
|
|
|
73055
73055
|
|
|
73056
73056
|
declare class Breakout extends Group<typeof breakoutProps> {
|
|
73057
73057
|
constructor(props: z.input<typeof breakoutProps>);
|
|
73058
|
+
/**
|
|
73059
|
+
* Find ports inside this breakout group that are connected to traces
|
|
73060
|
+
* crossing the breakout boundary, and create auto-placed BreakoutPoint
|
|
73061
|
+
* children for them. Positions are not set here — they will be determined
|
|
73062
|
+
* after PcbLayout.
|
|
73063
|
+
*/
|
|
73064
|
+
doInitialCreateAutoplacedBreakoutPoints(): void;
|
|
73058
73065
|
doInitialPcbPrimitiveRender(): void;
|
|
73059
73066
|
}
|
|
73060
73067
|
|
|
73061
|
-
|
|
73068
|
+
/**
|
|
73069
|
+
* Shared base props for breakout points — layout props without rotation/layer.
|
|
73070
|
+
* Subclasses extend this schema with additional fields (e.g. `connection`).
|
|
73071
|
+
*/
|
|
73072
|
+
declare const baseBreakoutPointProps: zod.ZodObject<Omit<{
|
|
73073
|
+
pcbX: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>]>>;
|
|
73074
|
+
pcbY: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>]>>;
|
|
73075
|
+
pcbLeftEdgeX: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>]>>;
|
|
73076
|
+
pcbRightEdgeX: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>]>>;
|
|
73077
|
+
pcbTopEdgeY: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>]>>;
|
|
73078
|
+
pcbBottomEdgeY: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>]>>;
|
|
73079
|
+
pcbOffsetX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
73080
|
+
pcbOffsetY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
73081
|
+
pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
73082
|
+
pcbPositionAnchor: zod.ZodOptional<zod.ZodString>;
|
|
73083
|
+
pcbPositionMode: zod.ZodOptional<zod.ZodEnum<["relative_to_group_anchor", "auto", "relative_to_board_anchor", "relative_to_component_anchor"]>>;
|
|
73084
|
+
shouldBeOnEdgeOfBoard: zod.ZodOptional<zod.ZodBoolean>;
|
|
73085
|
+
layer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
|
|
73086
|
+
name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
|
|
73087
|
+
}, "strip", zod.ZodTypeAny, {
|
|
73088
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
73089
|
+
}, {
|
|
73090
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
73091
|
+
}>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
73092
|
+
name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
|
|
73093
|
+
}>>;
|
|
73094
|
+
pcbMarginTop: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
73095
|
+
pcbMarginRight: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
73096
|
+
pcbMarginBottom: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
73097
|
+
pcbMarginLeft: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
73098
|
+
pcbMarginX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
73099
|
+
pcbMarginY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
73100
|
+
pcbStyle: zod.ZodOptional<zod.ZodObject<{
|
|
73101
|
+
silkscreenFontSize: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
73102
|
+
viaPadDiameter: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
73103
|
+
viaHoleDiameter: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
73104
|
+
silkscreenTextPosition: zod.ZodOptional<zod.ZodUnion<[zod.ZodEnum<["centered", "outside", "none"]>, zod.ZodObject<{
|
|
73105
|
+
offsetX: zod.ZodNumber;
|
|
73106
|
+
offsetY: zod.ZodNumber;
|
|
73107
|
+
}, "strip", zod.ZodTypeAny, {
|
|
73108
|
+
offsetX: number;
|
|
73109
|
+
offsetY: number;
|
|
73110
|
+
}, {
|
|
73111
|
+
offsetX: number;
|
|
73112
|
+
offsetY: number;
|
|
73113
|
+
}>]>>;
|
|
73114
|
+
silkscreenTextVisibility: zod.ZodOptional<zod.ZodEnum<["hidden", "visible", "inherit"]>>;
|
|
73115
|
+
}, "strip", zod.ZodTypeAny, {
|
|
73116
|
+
silkscreenFontSize?: number | undefined;
|
|
73117
|
+
viaPadDiameter?: number | undefined;
|
|
73118
|
+
viaHoleDiameter?: number | undefined;
|
|
73119
|
+
silkscreenTextPosition?: "centered" | "outside" | "none" | {
|
|
73120
|
+
offsetX: number;
|
|
73121
|
+
offsetY: number;
|
|
73122
|
+
} | undefined;
|
|
73123
|
+
silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
|
|
73124
|
+
}, {
|
|
73125
|
+
silkscreenFontSize?: string | number | undefined;
|
|
73126
|
+
viaPadDiameter?: string | number | undefined;
|
|
73127
|
+
viaHoleDiameter?: string | number | undefined;
|
|
73128
|
+
silkscreenTextPosition?: "centered" | "outside" | "none" | {
|
|
73129
|
+
offsetX: number;
|
|
73130
|
+
offsetY: number;
|
|
73131
|
+
} | undefined;
|
|
73132
|
+
silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
|
|
73133
|
+
}>>;
|
|
73134
|
+
pcbSx: zod.ZodOptional<ZodType<_tscircuit_props.PcbSx, zod.ZodTypeDef, _tscircuit_props.PcbSx>>;
|
|
73135
|
+
pcbRelative: zod.ZodOptional<zod.ZodBoolean>;
|
|
73136
|
+
relative: zod.ZodOptional<zod.ZodBoolean>;
|
|
73137
|
+
}, "layer" | "pcbRotation">, "strip", zod.ZodTypeAny, {
|
|
73138
|
+
pcbX?: string | number | undefined;
|
|
73139
|
+
pcbY?: string | number | undefined;
|
|
73140
|
+
pcbLeftEdgeX?: string | number | undefined;
|
|
73141
|
+
pcbRightEdgeX?: string | number | undefined;
|
|
73142
|
+
pcbTopEdgeY?: string | number | undefined;
|
|
73143
|
+
pcbBottomEdgeY?: string | number | undefined;
|
|
73144
|
+
relative?: boolean | undefined;
|
|
73145
|
+
pcbOffsetX?: number | undefined;
|
|
73146
|
+
pcbOffsetY?: number | undefined;
|
|
73147
|
+
pcbPositionAnchor?: string | undefined;
|
|
73148
|
+
pcbPositionMode?: "auto" | "relative_to_group_anchor" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
|
|
73149
|
+
shouldBeOnEdgeOfBoard?: boolean | undefined;
|
|
73150
|
+
pcbMarginTop?: number | undefined;
|
|
73151
|
+
pcbMarginRight?: number | undefined;
|
|
73152
|
+
pcbMarginBottom?: number | undefined;
|
|
73153
|
+
pcbMarginLeft?: number | undefined;
|
|
73154
|
+
pcbMarginX?: number | undefined;
|
|
73155
|
+
pcbMarginY?: number | undefined;
|
|
73156
|
+
pcbStyle?: {
|
|
73157
|
+
silkscreenFontSize?: number | undefined;
|
|
73158
|
+
viaPadDiameter?: number | undefined;
|
|
73159
|
+
viaHoleDiameter?: number | undefined;
|
|
73160
|
+
silkscreenTextPosition?: "centered" | "outside" | "none" | {
|
|
73161
|
+
offsetX: number;
|
|
73162
|
+
offsetY: number;
|
|
73163
|
+
} | undefined;
|
|
73164
|
+
silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
|
|
73165
|
+
} | undefined;
|
|
73166
|
+
pcbSx?: _tscircuit_props.PcbSx | undefined;
|
|
73167
|
+
pcbRelative?: boolean | undefined;
|
|
73168
|
+
}, {
|
|
73169
|
+
pcbX?: string | number | undefined;
|
|
73170
|
+
pcbY?: string | number | undefined;
|
|
73171
|
+
pcbLeftEdgeX?: string | number | undefined;
|
|
73172
|
+
pcbRightEdgeX?: string | number | undefined;
|
|
73173
|
+
pcbTopEdgeY?: string | number | undefined;
|
|
73174
|
+
pcbBottomEdgeY?: string | number | undefined;
|
|
73175
|
+
relative?: boolean | undefined;
|
|
73176
|
+
pcbOffsetX?: string | number | undefined;
|
|
73177
|
+
pcbOffsetY?: string | number | undefined;
|
|
73178
|
+
pcbPositionAnchor?: string | undefined;
|
|
73179
|
+
pcbPositionMode?: "auto" | "relative_to_group_anchor" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
|
|
73180
|
+
shouldBeOnEdgeOfBoard?: boolean | undefined;
|
|
73181
|
+
pcbMarginTop?: string | number | undefined;
|
|
73182
|
+
pcbMarginRight?: string | number | undefined;
|
|
73183
|
+
pcbMarginBottom?: string | number | undefined;
|
|
73184
|
+
pcbMarginLeft?: string | number | undefined;
|
|
73185
|
+
pcbMarginX?: string | number | undefined;
|
|
73186
|
+
pcbMarginY?: string | number | undefined;
|
|
73187
|
+
pcbStyle?: {
|
|
73188
|
+
silkscreenFontSize?: string | number | undefined;
|
|
73189
|
+
viaPadDiameter?: string | number | undefined;
|
|
73190
|
+
viaHoleDiameter?: string | number | undefined;
|
|
73191
|
+
silkscreenTextPosition?: "centered" | "outside" | "none" | {
|
|
73192
|
+
offsetX: number;
|
|
73193
|
+
offsetY: number;
|
|
73194
|
+
} | undefined;
|
|
73195
|
+
silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
|
|
73196
|
+
} | undefined;
|
|
73197
|
+
pcbSx?: _tscircuit_props.PcbSx | undefined;
|
|
73198
|
+
pcbRelative?: boolean | undefined;
|
|
73199
|
+
}>;
|
|
73200
|
+
/**
|
|
73201
|
+
* Base class for both user-facing `BreakoutPoint` (which requires a
|
|
73202
|
+
* `connection` prop) and the internal `AutoplacedBreakoutPoint` (which
|
|
73203
|
+
* receives its `matchedPort` programmatically).
|
|
73204
|
+
*/
|
|
73205
|
+
declare class BaseBreakoutPoint<TProps extends ZodType = typeof baseBreakoutPointProps> extends PrimitiveComponent<TProps> {
|
|
73062
73206
|
pcb_breakout_point_id: string | null;
|
|
73063
73207
|
matchedPort: Port | null;
|
|
73064
73208
|
matchedNet: Net | null;
|
|
73065
73209
|
isPcbPrimitive: boolean;
|
|
73210
|
+
_getSourceTraceIdForPort(port: Port): string | undefined;
|
|
73211
|
+
_getSourceNetIdForPort(port: Port): string | undefined;
|
|
73212
|
+
_renderPcbBreakoutPoint(): void;
|
|
73213
|
+
_getPcbCircuitJsonBounds(): {
|
|
73214
|
+
center: {
|
|
73215
|
+
x: number;
|
|
73216
|
+
y: number;
|
|
73217
|
+
};
|
|
73218
|
+
bounds: {
|
|
73219
|
+
left: number;
|
|
73220
|
+
top: number;
|
|
73221
|
+
right: number;
|
|
73222
|
+
bottom: number;
|
|
73223
|
+
};
|
|
73224
|
+
width: number;
|
|
73225
|
+
height: number;
|
|
73226
|
+
};
|
|
73227
|
+
_setPositionFromLayout(newCenter: {
|
|
73228
|
+
x: number;
|
|
73229
|
+
y: number;
|
|
73230
|
+
}): void;
|
|
73231
|
+
_moveCircuitJsonElements({ deltaX, deltaY, }: {
|
|
73232
|
+
deltaX: number;
|
|
73233
|
+
deltaY: number;
|
|
73234
|
+
}): void;
|
|
73235
|
+
getPcbSize(): {
|
|
73236
|
+
width: number;
|
|
73237
|
+
height: number;
|
|
73238
|
+
};
|
|
73239
|
+
}
|
|
73240
|
+
|
|
73241
|
+
declare class BreakoutPoint extends BaseBreakoutPoint<typeof breakoutPointProps> {
|
|
73066
73242
|
get config(): {
|
|
73067
73243
|
componentName: string;
|
|
73068
73244
|
zodProps: zod.ZodObject<Omit<{
|
|
@@ -73199,35 +73375,7 @@ declare class BreakoutPoint extends PrimitiveComponent<typeof breakoutPointProps
|
|
|
73199
73375
|
}>;
|
|
73200
73376
|
};
|
|
73201
73377
|
_matchConnection(): void;
|
|
73202
|
-
_getSourceTraceIdForPort(port: Port): string | undefined;
|
|
73203
|
-
_getSourceNetIdForPort(port: Port): string | undefined;
|
|
73204
73378
|
doInitialPcbPrimitiveRender(): void;
|
|
73205
|
-
_getPcbCircuitJsonBounds(): {
|
|
73206
|
-
center: {
|
|
73207
|
-
x: number;
|
|
73208
|
-
y: number;
|
|
73209
|
-
};
|
|
73210
|
-
bounds: {
|
|
73211
|
-
left: number;
|
|
73212
|
-
top: number;
|
|
73213
|
-
right: number;
|
|
73214
|
-
bottom: number;
|
|
73215
|
-
};
|
|
73216
|
-
width: number;
|
|
73217
|
-
height: number;
|
|
73218
|
-
};
|
|
73219
|
-
_setPositionFromLayout(newCenter: {
|
|
73220
|
-
x: number;
|
|
73221
|
-
y: number;
|
|
73222
|
-
}): void;
|
|
73223
|
-
_moveCircuitJsonElements({ deltaX, deltaY, }: {
|
|
73224
|
-
deltaX: number;
|
|
73225
|
-
deltaY: number;
|
|
73226
|
-
}): void;
|
|
73227
|
-
getPcbSize(): {
|
|
73228
|
-
width: number;
|
|
73229
|
-
height: number;
|
|
73230
|
-
};
|
|
73231
73379
|
}
|
|
73232
73380
|
|
|
73233
73381
|
declare class Hole extends PrimitiveComponent<typeof holeProps> {
|
package/dist/index.js
CHANGED
|
@@ -21806,7 +21806,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
21806
21806
|
var package_default = {
|
|
21807
21807
|
name: "@tscircuit/core",
|
|
21808
21808
|
type: "module",
|
|
21809
|
-
version: "0.0.
|
|
21809
|
+
version: "0.0.1273",
|
|
21810
21810
|
types: "dist/index.d.ts",
|
|
21811
21811
|
main: "dist/index.js",
|
|
21812
21812
|
module: "dist/index.js",
|
|
@@ -24803,63 +24803,18 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
|
24803
24803
|
|
|
24804
24804
|
// lib/components/primitive-components/Breakout/Breakout.ts
|
|
24805
24805
|
import "@tscircuit/props";
|
|
24806
|
-
var Breakout = class extends Group5 {
|
|
24807
|
-
constructor(props) {
|
|
24808
|
-
super({
|
|
24809
|
-
...props,
|
|
24810
|
-
// @ts-ignore
|
|
24811
|
-
subcircuit: true
|
|
24812
|
-
});
|
|
24813
|
-
}
|
|
24814
|
-
doInitialPcbPrimitiveRender() {
|
|
24815
|
-
super.doInitialPcbPrimitiveRender();
|
|
24816
|
-
if (this.root?.pcbDisabled) return;
|
|
24817
|
-
const { db } = this.root;
|
|
24818
|
-
const props = this._parsedProps;
|
|
24819
|
-
if (!this.pcb_group_id) return;
|
|
24820
|
-
const pcb_group = db.pcb_group.get(this.pcb_group_id);
|
|
24821
|
-
const padLeft = props.paddingLeft ?? props.padding ?? 0;
|
|
24822
|
-
const padRight = props.paddingRight ?? props.padding ?? 0;
|
|
24823
|
-
const padTop = props.paddingTop ?? props.padding ?? 0;
|
|
24824
|
-
const padBottom = props.paddingBottom ?? props.padding ?? 0;
|
|
24825
|
-
db.pcb_group.update(this.pcb_group_id, {
|
|
24826
|
-
width: (pcb_group.width ?? 0) + padLeft + padRight,
|
|
24827
|
-
height: (pcb_group.height ?? 0) + padTop + padBottom,
|
|
24828
|
-
center: {
|
|
24829
|
-
x: pcb_group.center.x + (padRight - padLeft) / 2,
|
|
24830
|
-
y: pcb_group.center.y + (padTop - padBottom) / 2
|
|
24831
|
-
}
|
|
24832
|
-
});
|
|
24833
|
-
}
|
|
24834
|
-
};
|
|
24835
24806
|
|
|
24836
|
-
// lib/components/primitive-components/
|
|
24837
|
-
import {
|
|
24838
|
-
var
|
|
24807
|
+
// lib/components/primitive-components/BaseBreakoutPoint.ts
|
|
24808
|
+
import { pcbLayoutProps } from "@tscircuit/props";
|
|
24809
|
+
var baseBreakoutPointProps = pcbLayoutProps.omit({
|
|
24810
|
+
pcbRotation: true,
|
|
24811
|
+
layer: true
|
|
24812
|
+
});
|
|
24813
|
+
var BaseBreakoutPoint = class extends PrimitiveComponent2 {
|
|
24839
24814
|
pcb_breakout_point_id = null;
|
|
24840
24815
|
matchedPort = null;
|
|
24841
24816
|
matchedNet = null;
|
|
24842
24817
|
isPcbPrimitive = true;
|
|
24843
|
-
get config() {
|
|
24844
|
-
return {
|
|
24845
|
-
componentName: "BreakoutPoint",
|
|
24846
|
-
zodProps: breakoutPointProps
|
|
24847
|
-
};
|
|
24848
|
-
}
|
|
24849
|
-
_matchConnection() {
|
|
24850
|
-
const { connection } = this._parsedProps;
|
|
24851
|
-
const subcircuit = this.getSubcircuit();
|
|
24852
|
-
if (!subcircuit) return;
|
|
24853
|
-
this.matchedPort = subcircuit.selectOne(connection, {
|
|
24854
|
-
type: "port"
|
|
24855
|
-
});
|
|
24856
|
-
if (!this.matchedPort) {
|
|
24857
|
-
this.matchedNet = subcircuit.selectOne(connection, { type: "net" });
|
|
24858
|
-
}
|
|
24859
|
-
if (!this.matchedPort && !this.matchedNet) {
|
|
24860
|
-
this.renderError(`Could not find connection target "${connection}"`);
|
|
24861
|
-
}
|
|
24862
|
-
}
|
|
24863
24818
|
_getSourceTraceIdForPort(port) {
|
|
24864
24819
|
const { db } = this.root;
|
|
24865
24820
|
const trace = db.source_trace.list().find((st) => st.connected_source_port_ids.includes(port.source_port_id));
|
|
@@ -24870,10 +24825,10 @@ var BreakoutPoint = class extends PrimitiveComponent2 {
|
|
|
24870
24825
|
const trace = db.source_trace.list().find((st) => st.connected_source_port_ids.includes(port.source_port_id));
|
|
24871
24826
|
return trace?.connected_source_net_ids[0];
|
|
24872
24827
|
}
|
|
24873
|
-
|
|
24828
|
+
_renderPcbBreakoutPoint() {
|
|
24829
|
+
if (this.pcb_breakout_point_id) return;
|
|
24874
24830
|
if (this.root?.pcbDisabled) return;
|
|
24875
24831
|
const { db } = this.root;
|
|
24876
|
-
this._matchConnection();
|
|
24877
24832
|
const position = this._getGlobalPcbPositionBeforeLayout();
|
|
24878
24833
|
const group = this.parent?.getGroup();
|
|
24879
24834
|
const subcircuit = this.getSubcircuit();
|
|
@@ -24931,6 +24886,120 @@ var BreakoutPoint = class extends PrimitiveComponent2 {
|
|
|
24931
24886
|
}
|
|
24932
24887
|
};
|
|
24933
24888
|
|
|
24889
|
+
// lib/components/primitive-components/AutoplacedBreakoutPoint.ts
|
|
24890
|
+
var AutoplacedBreakoutPoint = class extends BaseBreakoutPoint {
|
|
24891
|
+
get config() {
|
|
24892
|
+
return {
|
|
24893
|
+
componentName: "AutoplacedBreakoutPoint",
|
|
24894
|
+
zodProps: baseBreakoutPointProps
|
|
24895
|
+
};
|
|
24896
|
+
}
|
|
24897
|
+
doInitialPcbPrimitiveRender() {
|
|
24898
|
+
this._renderPcbBreakoutPoint();
|
|
24899
|
+
}
|
|
24900
|
+
};
|
|
24901
|
+
|
|
24902
|
+
// lib/components/primitive-components/BreakoutPoint.ts
|
|
24903
|
+
import { breakoutPointProps } from "@tscircuit/props";
|
|
24904
|
+
var BreakoutPoint = class extends BaseBreakoutPoint {
|
|
24905
|
+
get config() {
|
|
24906
|
+
return {
|
|
24907
|
+
componentName: "BreakoutPoint",
|
|
24908
|
+
zodProps: breakoutPointProps
|
|
24909
|
+
};
|
|
24910
|
+
}
|
|
24911
|
+
_matchConnection() {
|
|
24912
|
+
if (this.matchedPort) return;
|
|
24913
|
+
const { connection } = this._parsedProps;
|
|
24914
|
+
const subcircuit = this.getSubcircuit();
|
|
24915
|
+
if (!subcircuit) return;
|
|
24916
|
+
this.matchedPort = subcircuit.selectOne(connection, {
|
|
24917
|
+
type: "port"
|
|
24918
|
+
});
|
|
24919
|
+
if (!this.matchedPort) {
|
|
24920
|
+
this.matchedNet = subcircuit.selectOne(connection, { type: "net" });
|
|
24921
|
+
}
|
|
24922
|
+
if (!this.matchedPort && !this.matchedNet) {
|
|
24923
|
+
this.renderError(`Could not find connection target "${connection}"`);
|
|
24924
|
+
}
|
|
24925
|
+
}
|
|
24926
|
+
doInitialPcbPrimitiveRender() {
|
|
24927
|
+
this._matchConnection();
|
|
24928
|
+
this._renderPcbBreakoutPoint();
|
|
24929
|
+
}
|
|
24930
|
+
};
|
|
24931
|
+
|
|
24932
|
+
// lib/components/primitive-components/Breakout/Breakout.ts
|
|
24933
|
+
var Breakout = class extends Group5 {
|
|
24934
|
+
constructor(props) {
|
|
24935
|
+
super({
|
|
24936
|
+
...props,
|
|
24937
|
+
// @ts-ignore
|
|
24938
|
+
subcircuit: true
|
|
24939
|
+
});
|
|
24940
|
+
}
|
|
24941
|
+
/**
|
|
24942
|
+
* Find ports inside this breakout group that are connected to traces
|
|
24943
|
+
* crossing the breakout boundary, and create auto-placed BreakoutPoint
|
|
24944
|
+
* children for them. Positions are not set here — they will be determined
|
|
24945
|
+
* after PcbLayout.
|
|
24946
|
+
*/
|
|
24947
|
+
doInitialCreateAutoplacedBreakoutPoints() {
|
|
24948
|
+
const portsInBreakout = this.selectAll("port");
|
|
24949
|
+
const breakoutPortSet = new Set(portsInBreakout);
|
|
24950
|
+
const manualBreakoutPoints = this.children.filter(
|
|
24951
|
+
(c) => c instanceof BreakoutPoint
|
|
24952
|
+
);
|
|
24953
|
+
const manuallyMappedPorts = new Set(
|
|
24954
|
+
manualBreakoutPoints.map((bp) => {
|
|
24955
|
+
bp._matchConnection();
|
|
24956
|
+
return bp.matchedPort;
|
|
24957
|
+
}).filter(Boolean)
|
|
24958
|
+
);
|
|
24959
|
+
const board = this.parent;
|
|
24960
|
+
if (!board) return;
|
|
24961
|
+
const allTraces = board.children.filter(
|
|
24962
|
+
(c) => c instanceof Trace3
|
|
24963
|
+
);
|
|
24964
|
+
const autoPlacedPorts = /* @__PURE__ */ new Set();
|
|
24965
|
+
for (const trace of allTraces) {
|
|
24966
|
+
const result = trace._findConnectedPorts();
|
|
24967
|
+
if (!result.allPortsFound || !result.ports) continue;
|
|
24968
|
+
for (const port of result.ports) {
|
|
24969
|
+
const isInside = breakoutPortSet.has(port);
|
|
24970
|
+
const hasOutsidePort = result.ports.some((p) => !breakoutPortSet.has(p));
|
|
24971
|
+
if (!isInside || !hasOutsidePort) continue;
|
|
24972
|
+
if (manuallyMappedPorts.has(port)) continue;
|
|
24973
|
+
if (autoPlacedPorts.has(port)) continue;
|
|
24974
|
+
autoPlacedPorts.add(port);
|
|
24975
|
+
const breakoutPoint = new AutoplacedBreakoutPoint({});
|
|
24976
|
+
breakoutPoint.matchedPort = port;
|
|
24977
|
+
this.add(breakoutPoint);
|
|
24978
|
+
}
|
|
24979
|
+
}
|
|
24980
|
+
}
|
|
24981
|
+
doInitialPcbPrimitiveRender() {
|
|
24982
|
+
super.doInitialPcbPrimitiveRender();
|
|
24983
|
+
if (this.root?.pcbDisabled) return;
|
|
24984
|
+
const { db } = this.root;
|
|
24985
|
+
const props = this._parsedProps;
|
|
24986
|
+
if (!this.pcb_group_id) return;
|
|
24987
|
+
const pcb_group = db.pcb_group.get(this.pcb_group_id);
|
|
24988
|
+
const padLeft = props.paddingLeft ?? props.padding ?? 0;
|
|
24989
|
+
const padRight = props.paddingRight ?? props.padding ?? 0;
|
|
24990
|
+
const padTop = props.paddingTop ?? props.padding ?? 0;
|
|
24991
|
+
const padBottom = props.paddingBottom ?? props.padding ?? 0;
|
|
24992
|
+
db.pcb_group.update(this.pcb_group_id, {
|
|
24993
|
+
width: (pcb_group.width ?? 0) + padLeft + padRight,
|
|
24994
|
+
height: (pcb_group.height ?? 0) + padTop + padBottom,
|
|
24995
|
+
center: {
|
|
24996
|
+
x: pcb_group.center.x + (padRight - padLeft) / 2,
|
|
24997
|
+
y: pcb_group.center.y + (padTop - padBottom) / 2
|
|
24998
|
+
}
|
|
24999
|
+
});
|
|
25000
|
+
}
|
|
25001
|
+
};
|
|
25002
|
+
|
|
24934
25003
|
// lib/components/primitive-components/NetLabel.ts
|
|
24935
25004
|
import { netLabelProps } from "@tscircuit/props";
|
|
24936
25005
|
import {
|