@tscircuit/core 0.0.945 → 0.0.947
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 +48 -0
- package/dist/index.js +275 -3
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -151,6 +151,7 @@ type SimplifiedPcbTrace = {
|
|
|
151
151
|
}>;
|
|
152
152
|
};
|
|
153
153
|
type Obstacle = {
|
|
154
|
+
obstacleId?: string;
|
|
154
155
|
type: "rect";
|
|
155
156
|
layers: string[];
|
|
156
157
|
center: {
|
|
@@ -22702,6 +22703,10 @@ declare class PcbNotePath extends PrimitiveComponent<typeof pcbNotePathProps> {
|
|
|
22702
22703
|
width: number;
|
|
22703
22704
|
height: number;
|
|
22704
22705
|
};
|
|
22706
|
+
_moveCircuitJsonElements({ deltaX, deltaY, }: {
|
|
22707
|
+
deltaX: number;
|
|
22708
|
+
deltaY: number;
|
|
22709
|
+
}): void;
|
|
22705
22710
|
}
|
|
22706
22711
|
|
|
22707
22712
|
declare class PcbNoteDimension extends PrimitiveComponent<typeof pcbNoteDimensionProps> {
|
|
@@ -22894,6 +22899,10 @@ declare class PcbNoteDimension extends PrimitiveComponent<typeof pcbNoteDimensio
|
|
|
22894
22899
|
height: number;
|
|
22895
22900
|
};
|
|
22896
22901
|
private _formatDistanceText;
|
|
22902
|
+
_moveCircuitJsonElements({ deltaX, deltaY, }: {
|
|
22903
|
+
deltaX: number;
|
|
22904
|
+
deltaY: number;
|
|
22905
|
+
}): void;
|
|
22897
22906
|
}
|
|
22898
22907
|
|
|
22899
22908
|
declare class Footprint extends PrimitiveComponent<typeof footprintProps> {
|
|
@@ -23109,6 +23118,10 @@ declare class BreakoutPoint extends PrimitiveComponent<typeof breakoutPointProps
|
|
|
23109
23118
|
x: number;
|
|
23110
23119
|
y: number;
|
|
23111
23120
|
}): void;
|
|
23121
|
+
_moveCircuitJsonElements({ deltaX, deltaY, }: {
|
|
23122
|
+
deltaX: number;
|
|
23123
|
+
deltaY: number;
|
|
23124
|
+
}): void;
|
|
23112
23125
|
getPcbSize(): {
|
|
23113
23126
|
width: number;
|
|
23114
23127
|
height: number;
|
|
@@ -23659,6 +23672,10 @@ declare class Hole extends PrimitiveComponent<typeof holeProps> {
|
|
|
23659
23672
|
x: number;
|
|
23660
23673
|
y: number;
|
|
23661
23674
|
}): void;
|
|
23675
|
+
_moveCircuitJsonElements({ deltaX, deltaY, }: {
|
|
23676
|
+
deltaX: number;
|
|
23677
|
+
deltaY: number;
|
|
23678
|
+
}): void;
|
|
23662
23679
|
}
|
|
23663
23680
|
|
|
23664
23681
|
declare class Keepout extends PrimitiveComponent<typeof pcbKeepoutProps> {
|
|
@@ -25659,6 +25676,10 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
|
|
|
25659
25676
|
doInitialPortMatching(): void;
|
|
25660
25677
|
doInitialPcbPrimitiveRender(): void;
|
|
25661
25678
|
doInitialPcbPortAttachment(): void;
|
|
25679
|
+
_moveCircuitJsonElements({ deltaX, deltaY, }: {
|
|
25680
|
+
deltaX: number;
|
|
25681
|
+
deltaY: number;
|
|
25682
|
+
}): void;
|
|
25662
25683
|
}
|
|
25663
25684
|
|
|
25664
25685
|
declare class SilkscreenCircle extends PrimitiveComponent<typeof silkscreenCircleProps> {
|
|
@@ -27296,6 +27317,10 @@ declare class SmtPad extends PrimitiveComponent<typeof smtPadProps> {
|
|
|
27296
27317
|
x: number;
|
|
27297
27318
|
y: number;
|
|
27298
27319
|
}): void;
|
|
27320
|
+
_moveCircuitJsonElements({ deltaX, deltaY, }: {
|
|
27321
|
+
deltaX: number;
|
|
27322
|
+
deltaY: number;
|
|
27323
|
+
}): void;
|
|
27299
27324
|
}
|
|
27300
27325
|
|
|
27301
27326
|
declare class Fiducial extends PrimitiveComponent<typeof fiducialProps> {
|
|
@@ -28435,6 +28460,10 @@ declare class Fiducial extends PrimitiveComponent<typeof fiducialProps> {
|
|
|
28435
28460
|
x: number;
|
|
28436
28461
|
y: number;
|
|
28437
28462
|
}): void;
|
|
28463
|
+
_moveCircuitJsonElements({ deltaX, deltaY, }: {
|
|
28464
|
+
deltaX: number;
|
|
28465
|
+
deltaY: number;
|
|
28466
|
+
}): void;
|
|
28438
28467
|
}
|
|
28439
28468
|
|
|
28440
28469
|
declare const pcbTraceProps: z.ZodObject<{
|
|
@@ -29166,6 +29195,7 @@ declare class CopperPour extends PrimitiveComponent<typeof copperPourProps> {
|
|
|
29166
29195
|
|
|
29167
29196
|
declare class CopperText extends PrimitiveComponent<typeof copperTextProps> {
|
|
29168
29197
|
isPcbPrimitive: boolean;
|
|
29198
|
+
pcb_copper_text_id: string | null;
|
|
29169
29199
|
get config(): {
|
|
29170
29200
|
componentName: string;
|
|
29171
29201
|
zodProps: zod.ZodObject<{
|
|
@@ -29330,6 +29360,14 @@ declare class CopperText extends PrimitiveComponent<typeof copperTextProps> {
|
|
|
29330
29360
|
}>;
|
|
29331
29361
|
};
|
|
29332
29362
|
doInitialPcbPrimitiveRender(): void;
|
|
29363
|
+
getPcbSize(): {
|
|
29364
|
+
width: number;
|
|
29365
|
+
height: number;
|
|
29366
|
+
};
|
|
29367
|
+
_moveCircuitJsonElements({ deltaX, deltaY, }: {
|
|
29368
|
+
deltaX: number;
|
|
29369
|
+
deltaY: number;
|
|
29370
|
+
}): void;
|
|
29333
29371
|
}
|
|
29334
29372
|
|
|
29335
29373
|
declare class Cutout extends PrimitiveComponent<typeof cutoutProps> {
|
|
@@ -29773,6 +29811,10 @@ declare class Cutout extends PrimitiveComponent<typeof cutoutProps> {
|
|
|
29773
29811
|
x: number;
|
|
29774
29812
|
y: number;
|
|
29775
29813
|
}): void;
|
|
29814
|
+
_moveCircuitJsonElements({ deltaX, deltaY, }: {
|
|
29815
|
+
deltaX: number;
|
|
29816
|
+
deltaY: number;
|
|
29817
|
+
}): void;
|
|
29776
29818
|
}
|
|
29777
29819
|
|
|
29778
29820
|
declare class Battery extends NormalComponent<typeof batteryProps, PassivePorts> {
|
|
@@ -45803,6 +45845,12 @@ interface GenericLocalAutorouter {
|
|
|
45803
45845
|
on(event: "error", callback: (ev: AutorouterErrorEvent) => void): void;
|
|
45804
45846
|
on(event: "progress", callback: (ev: AutorouterProgressEvent) => void): void;
|
|
45805
45847
|
solveSync(): SimplifiedPcbTrace[];
|
|
45848
|
+
/**
|
|
45849
|
+
* Get the mapping of obstacle IDs to root connection names that were
|
|
45850
|
+
* connected via off-board paths (e.g., interconnects).
|
|
45851
|
+
* Returns empty object if not supported by the autorouter.
|
|
45852
|
+
*/
|
|
45853
|
+
getConnectedOffboardObstacles?(): Record<string, string>;
|
|
45806
45854
|
}
|
|
45807
45855
|
|
|
45808
45856
|
declare const applyPcbEditEventsToManualEditsFile: ({ circuitJson, editEvents, manualEditsFile, }: {
|
package/dist/index.js
CHANGED
|
@@ -2491,6 +2491,30 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
2491
2491
|
}
|
|
2492
2492
|
this.matchedPort?._setPositionFromLayout(newCenter);
|
|
2493
2493
|
}
|
|
2494
|
+
_moveCircuitJsonElements({
|
|
2495
|
+
deltaX,
|
|
2496
|
+
deltaY
|
|
2497
|
+
}) {
|
|
2498
|
+
if (this.root?.pcbDisabled) return;
|
|
2499
|
+
const { db } = this.root;
|
|
2500
|
+
if (!this.pcb_smtpad_id) return;
|
|
2501
|
+
const pad = db.pcb_smtpad.get(this.pcb_smtpad_id);
|
|
2502
|
+
if (pad.shape === "rect" || pad.shape === "circle" || pad.shape === "rotated_rect" || pad.shape === "pill") {
|
|
2503
|
+
this._setPositionFromLayout({ x: pad.x + deltaX, y: pad.y + deltaY });
|
|
2504
|
+
} else if (pad.shape === "polygon") {
|
|
2505
|
+
db.pcb_smtpad.update(this.pcb_smtpad_id, {
|
|
2506
|
+
points: pad.points.map((p) => ({
|
|
2507
|
+
x: p.x + deltaX,
|
|
2508
|
+
y: p.y + deltaY
|
|
2509
|
+
}))
|
|
2510
|
+
});
|
|
2511
|
+
const newCenter = {
|
|
2512
|
+
x: this._getPcbCircuitJsonBounds().center.x + deltaX / 2,
|
|
2513
|
+
y: this._getPcbCircuitJsonBounds().center.y + deltaY / 2
|
|
2514
|
+
};
|
|
2515
|
+
this.matchedPort?._setPositionFromLayout(newCenter);
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2494
2518
|
};
|
|
2495
2519
|
|
|
2496
2520
|
// lib/components/primitive-components/SilkscreenPath.ts
|
|
@@ -2967,6 +2991,22 @@ var PlatedHole = class extends PrimitiveComponent2 {
|
|
|
2967
2991
|
pcb_port_id: this.matchedPort?.pcb_port_id
|
|
2968
2992
|
});
|
|
2969
2993
|
}
|
|
2994
|
+
_moveCircuitJsonElements({
|
|
2995
|
+
deltaX,
|
|
2996
|
+
deltaY
|
|
2997
|
+
}) {
|
|
2998
|
+
if (this.root?.pcbDisabled) return;
|
|
2999
|
+
const { db } = this.root;
|
|
3000
|
+
if (!this.pcb_plated_hole_id) return;
|
|
3001
|
+
const hole = db.pcb_plated_hole.get(this.pcb_plated_hole_id);
|
|
3002
|
+
if (hole) {
|
|
3003
|
+
const newCenter = {
|
|
3004
|
+
x: hole.x + deltaX,
|
|
3005
|
+
y: hole.y + deltaY
|
|
3006
|
+
};
|
|
3007
|
+
this._setPositionFromLayout(newCenter);
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
2970
3010
|
};
|
|
2971
3011
|
|
|
2972
3012
|
// lib/components/primitive-components/Keepout.ts
|
|
@@ -3154,6 +3194,21 @@ var Hole = class extends PrimitiveComponent2 {
|
|
|
3154
3194
|
y: newCenter.y
|
|
3155
3195
|
});
|
|
3156
3196
|
}
|
|
3197
|
+
_moveCircuitJsonElements({
|
|
3198
|
+
deltaX,
|
|
3199
|
+
deltaY
|
|
3200
|
+
}) {
|
|
3201
|
+
if (this.root?.pcbDisabled) return;
|
|
3202
|
+
const { db } = this.root;
|
|
3203
|
+
if (!this.pcb_hole_id) return;
|
|
3204
|
+
const hole = db.pcb_hole.get(this.pcb_hole_id);
|
|
3205
|
+
if (hole) {
|
|
3206
|
+
db.pcb_hole.update(this.pcb_hole_id, {
|
|
3207
|
+
x: hole.x + deltaX,
|
|
3208
|
+
y: hole.y + deltaY
|
|
3209
|
+
});
|
|
3210
|
+
}
|
|
3211
|
+
}
|
|
3157
3212
|
};
|
|
3158
3213
|
|
|
3159
3214
|
// lib/components/primitive-components/SilkscreenText.ts
|
|
@@ -3400,6 +3455,27 @@ var Cutout = class extends PrimitiveComponent2 {
|
|
|
3400
3455
|
});
|
|
3401
3456
|
}
|
|
3402
3457
|
}
|
|
3458
|
+
_moveCircuitJsonElements({
|
|
3459
|
+
deltaX,
|
|
3460
|
+
deltaY
|
|
3461
|
+
}) {
|
|
3462
|
+
if (!this.pcb_cutout_id) return;
|
|
3463
|
+
const { db } = this.root;
|
|
3464
|
+
const cutout = db.pcb_cutout.get(this.pcb_cutout_id);
|
|
3465
|
+
if (!cutout) return;
|
|
3466
|
+
if (cutout.shape === "rect" || cutout.shape === "circle") {
|
|
3467
|
+
db.pcb_cutout.update(this.pcb_cutout_id, {
|
|
3468
|
+
center: { x: cutout.center.x + deltaX, y: cutout.center.y + deltaY }
|
|
3469
|
+
});
|
|
3470
|
+
} else if (cutout.shape === "polygon") {
|
|
3471
|
+
db.pcb_cutout.update(this.pcb_cutout_id, {
|
|
3472
|
+
points: cutout.points.map((p) => ({
|
|
3473
|
+
x: p.x + deltaX,
|
|
3474
|
+
y: p.y + deltaY
|
|
3475
|
+
}))
|
|
3476
|
+
});
|
|
3477
|
+
}
|
|
3478
|
+
}
|
|
3403
3479
|
};
|
|
3404
3480
|
|
|
3405
3481
|
// lib/utils/createPinrowSilkscreenText.ts
|
|
@@ -9801,6 +9877,17 @@ var TscircuitAutorouter = class {
|
|
|
9801
9877
|
}
|
|
9802
9878
|
return this.solver.getOutputSimpleRouteJson().traces || [];
|
|
9803
9879
|
}
|
|
9880
|
+
/**
|
|
9881
|
+
* Get the mapping of obstacle IDs to root connection names that were
|
|
9882
|
+
* connected via off-board paths (e.g., interconnects).
|
|
9883
|
+
* Only available when using AssignableAutoroutingPipeline2.
|
|
9884
|
+
*/
|
|
9885
|
+
getConnectedOffboardObstacles() {
|
|
9886
|
+
if ("getConnectedOffboardObstacles" in this.solver) {
|
|
9887
|
+
return this.solver.getConnectedOffboardObstacles();
|
|
9888
|
+
}
|
|
9889
|
+
return {};
|
|
9890
|
+
}
|
|
9804
9891
|
};
|
|
9805
9892
|
|
|
9806
9893
|
// lib/components/primitive-components/Group/Group.ts
|
|
@@ -12673,6 +12760,81 @@ var Group_doInitialPcbLayoutFlex = (group) => {
|
|
|
12673
12760
|
// lib/components/primitive-components/Group/Group.ts
|
|
12674
12761
|
import { convertSrjToGraphicsObject } from "@tscircuit/capacity-autorouter";
|
|
12675
12762
|
|
|
12763
|
+
// lib/utils/autorouting/createSourceTracesFromOffboardConnections.ts
|
|
12764
|
+
var createSourceTracesFromOffboardConnections = ({
|
|
12765
|
+
db,
|
|
12766
|
+
connectedOffboardObstacles,
|
|
12767
|
+
simpleRouteJson,
|
|
12768
|
+
subcircuit_id
|
|
12769
|
+
}) => {
|
|
12770
|
+
if (Object.keys(connectedOffboardObstacles).length === 0) return;
|
|
12771
|
+
const pcbElementIdToSourcePortId = /* @__PURE__ */ new Map();
|
|
12772
|
+
for (const pcbPort of db.pcb_port.list()) {
|
|
12773
|
+
if (pcbPort.source_port_id) {
|
|
12774
|
+
const smtpad = db.pcb_smtpad.getWhere({
|
|
12775
|
+
pcb_port_id: pcbPort.pcb_port_id
|
|
12776
|
+
});
|
|
12777
|
+
if (smtpad) {
|
|
12778
|
+
pcbElementIdToSourcePortId.set(
|
|
12779
|
+
smtpad.pcb_smtpad_id,
|
|
12780
|
+
pcbPort.source_port_id
|
|
12781
|
+
);
|
|
12782
|
+
}
|
|
12783
|
+
const platedHole = db.pcb_plated_hole.getWhere({
|
|
12784
|
+
pcb_port_id: pcbPort.pcb_port_id
|
|
12785
|
+
});
|
|
12786
|
+
if (platedHole) {
|
|
12787
|
+
pcbElementIdToSourcePortId.set(
|
|
12788
|
+
platedHole.pcb_plated_hole_id,
|
|
12789
|
+
pcbPort.source_port_id
|
|
12790
|
+
);
|
|
12791
|
+
}
|
|
12792
|
+
}
|
|
12793
|
+
}
|
|
12794
|
+
const obstacleById = /* @__PURE__ */ new Map();
|
|
12795
|
+
for (const obstacle of simpleRouteJson.obstacles) {
|
|
12796
|
+
if (obstacle.obstacleId) {
|
|
12797
|
+
obstacleById.set(obstacle.obstacleId, obstacle);
|
|
12798
|
+
}
|
|
12799
|
+
}
|
|
12800
|
+
const connectionGroups = /* @__PURE__ */ new Map();
|
|
12801
|
+
for (const [obstacleId, rootConnectionName] of Object.entries(
|
|
12802
|
+
connectedOffboardObstacles
|
|
12803
|
+
)) {
|
|
12804
|
+
if (!connectionGroups.has(rootConnectionName)) {
|
|
12805
|
+
connectionGroups.set(rootConnectionName, []);
|
|
12806
|
+
}
|
|
12807
|
+
connectionGroups.get(rootConnectionName).push(obstacleId);
|
|
12808
|
+
}
|
|
12809
|
+
for (const [rootConnectionName, obstacleIds] of connectionGroups) {
|
|
12810
|
+
const sourcePortIds = /* @__PURE__ */ new Set();
|
|
12811
|
+
for (const obstacleId of obstacleIds) {
|
|
12812
|
+
const obstacle = obstacleById.get(obstacleId);
|
|
12813
|
+
if (!obstacle) continue;
|
|
12814
|
+
for (const connectedId of obstacle.connectedTo) {
|
|
12815
|
+
const sourcePortId = pcbElementIdToSourcePortId.get(connectedId);
|
|
12816
|
+
if (sourcePortId) {
|
|
12817
|
+
sourcePortIds.add(sourcePortId);
|
|
12818
|
+
}
|
|
12819
|
+
}
|
|
12820
|
+
}
|
|
12821
|
+
if (sourcePortIds.size < 2) continue;
|
|
12822
|
+
const sourcePortIdArray = Array.from(sourcePortIds);
|
|
12823
|
+
const existingTraces = db.source_trace.list();
|
|
12824
|
+
const alreadyConnected = existingTraces.some((trace) => {
|
|
12825
|
+
const tracePortIds = new Set(trace.connected_source_port_ids);
|
|
12826
|
+
return sourcePortIdArray.every((id) => tracePortIds.has(id));
|
|
12827
|
+
});
|
|
12828
|
+
if (alreadyConnected) continue;
|
|
12829
|
+
db.source_trace.insert({
|
|
12830
|
+
connected_source_port_ids: sourcePortIdArray,
|
|
12831
|
+
connected_source_net_ids: [],
|
|
12832
|
+
subcircuit_id: subcircuit_id ?? void 0,
|
|
12833
|
+
display_name: `offboard_${rootConnectionName}`
|
|
12834
|
+
});
|
|
12835
|
+
}
|
|
12836
|
+
};
|
|
12837
|
+
|
|
12676
12838
|
// lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/Group_doInitialSchematicTraceRender.ts
|
|
12677
12839
|
import { SchematicTracePipelineSolver as SchematicTracePipelineSolver4 } from "@tscircuit/schematic-trace-solver";
|
|
12678
12840
|
import Debug11 from "debug";
|
|
@@ -14200,6 +14362,15 @@ var Group6 = class extends NormalComponent3 {
|
|
|
14200
14362
|
autorouter.start();
|
|
14201
14363
|
try {
|
|
14202
14364
|
const traces = await routingPromise;
|
|
14365
|
+
if (autorouter.getConnectedOffboardObstacles) {
|
|
14366
|
+
const connectedOffboardObstacles = autorouter.getConnectedOffboardObstacles();
|
|
14367
|
+
createSourceTracesFromOffboardConnections({
|
|
14368
|
+
db,
|
|
14369
|
+
connectedOffboardObstacles,
|
|
14370
|
+
simpleRouteJson,
|
|
14371
|
+
subcircuit_id: this.subcircuit_id
|
|
14372
|
+
});
|
|
14373
|
+
}
|
|
14203
14374
|
this._asyncAutoroutingResult = {
|
|
14204
14375
|
output_pcb_traces: traces
|
|
14205
14376
|
};
|
|
@@ -17718,6 +17889,24 @@ var PcbNotePath = class extends PrimitiveComponent2 {
|
|
|
17718
17889
|
const maxY = Math.max(...ys);
|
|
17719
17890
|
return { width: maxX - minX, height: maxY - minY };
|
|
17720
17891
|
}
|
|
17892
|
+
_moveCircuitJsonElements({
|
|
17893
|
+
deltaX,
|
|
17894
|
+
deltaY
|
|
17895
|
+
}) {
|
|
17896
|
+
if (this.root?.pcbDisabled) return;
|
|
17897
|
+
const { db } = this.root;
|
|
17898
|
+
if (!this.pcb_note_path_id) return;
|
|
17899
|
+
const path = db.pcb_note_path.get(this.pcb_note_path_id);
|
|
17900
|
+
if (path) {
|
|
17901
|
+
db.pcb_note_path.update(this.pcb_note_path_id, {
|
|
17902
|
+
route: path.route.map((p) => ({
|
|
17903
|
+
...p,
|
|
17904
|
+
x: p.x + deltaX,
|
|
17905
|
+
y: p.y + deltaY
|
|
17906
|
+
}))
|
|
17907
|
+
});
|
|
17908
|
+
}
|
|
17909
|
+
}
|
|
17721
17910
|
};
|
|
17722
17911
|
|
|
17723
17912
|
// lib/components/primitive-components/PcbNoteDimension.ts
|
|
@@ -17799,6 +17988,27 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
|
17799
17988
|
const valueText = units === "in" ? Number(distanceInUnits.toFixed(decimalPlaces)).toString() : distanceInUnits.toFixed(decimalPlaces);
|
|
17800
17989
|
return `${valueText}${units}`;
|
|
17801
17990
|
}
|
|
17991
|
+
_moveCircuitJsonElements({
|
|
17992
|
+
deltaX,
|
|
17993
|
+
deltaY
|
|
17994
|
+
}) {
|
|
17995
|
+
if (this.root?.pcbDisabled) return;
|
|
17996
|
+
const { db } = this.root;
|
|
17997
|
+
if (!this.pcb_note_dimension_id) return;
|
|
17998
|
+
const dimension = db.pcb_note_dimension.get(this.pcb_note_dimension_id);
|
|
17999
|
+
if (dimension) {
|
|
18000
|
+
db.pcb_note_dimension.update(this.pcb_note_dimension_id, {
|
|
18001
|
+
from: {
|
|
18002
|
+
x: dimension.from.x + deltaX,
|
|
18003
|
+
y: dimension.from.y + deltaY
|
|
18004
|
+
},
|
|
18005
|
+
to: {
|
|
18006
|
+
x: dimension.to.x + deltaX,
|
|
18007
|
+
y: dimension.to.y + deltaY
|
|
18008
|
+
}
|
|
18009
|
+
});
|
|
18010
|
+
}
|
|
18011
|
+
}
|
|
17802
18012
|
};
|
|
17803
18013
|
|
|
17804
18014
|
// lib/components/primitive-components/Group/Subcircuit/Subcircuit.ts
|
|
@@ -17935,6 +18145,21 @@ var BreakoutPoint = class extends PrimitiveComponent2 {
|
|
|
17935
18145
|
y: newCenter.y
|
|
17936
18146
|
});
|
|
17937
18147
|
}
|
|
18148
|
+
_moveCircuitJsonElements({
|
|
18149
|
+
deltaX,
|
|
18150
|
+
deltaY
|
|
18151
|
+
}) {
|
|
18152
|
+
if (this.root?.pcbDisabled) return;
|
|
18153
|
+
const { db } = this.root;
|
|
18154
|
+
if (!this.pcb_breakout_point_id) return;
|
|
18155
|
+
const point2 = db.pcb_breakout_point.get(this.pcb_breakout_point_id);
|
|
18156
|
+
if (point2) {
|
|
18157
|
+
db.pcb_breakout_point.update(this.pcb_breakout_point_id, {
|
|
18158
|
+
x: point2.x + deltaX,
|
|
18159
|
+
y: point2.y + deltaY
|
|
18160
|
+
});
|
|
18161
|
+
}
|
|
18162
|
+
}
|
|
17938
18163
|
getPcbSize() {
|
|
17939
18164
|
return { width: 0, height: 0 };
|
|
17940
18165
|
}
|
|
@@ -18396,6 +18621,26 @@ var Fiducial = class extends PrimitiveComponent2 {
|
|
|
18396
18621
|
y: newCenter.y
|
|
18397
18622
|
});
|
|
18398
18623
|
}
|
|
18624
|
+
_moveCircuitJsonElements({
|
|
18625
|
+
deltaX,
|
|
18626
|
+
deltaY
|
|
18627
|
+
}) {
|
|
18628
|
+
if (this.root?.pcbDisabled) return;
|
|
18629
|
+
const { db } = this.root;
|
|
18630
|
+
if (!this.pcb_smtpad_id) return;
|
|
18631
|
+
const pad = db.pcb_smtpad.get(this.pcb_smtpad_id);
|
|
18632
|
+
if (!pad) return;
|
|
18633
|
+
if (pad.shape === "rect" || pad.shape === "circle" || pad.shape === "rotated_rect" || pad.shape === "pill") {
|
|
18634
|
+
this._setPositionFromLayout({ x: pad.x + deltaX, y: pad.y + deltaY });
|
|
18635
|
+
} else if (pad.shape === "polygon") {
|
|
18636
|
+
db.pcb_smtpad.update(this.pcb_smtpad_id, {
|
|
18637
|
+
points: pad.points.map((p) => ({
|
|
18638
|
+
x: p.x + deltaX,
|
|
18639
|
+
y: p.y + deltaY
|
|
18640
|
+
}))
|
|
18641
|
+
});
|
|
18642
|
+
}
|
|
18643
|
+
}
|
|
18399
18644
|
};
|
|
18400
18645
|
|
|
18401
18646
|
// lib/components/primitive-components/Via.ts
|
|
@@ -18618,6 +18863,7 @@ var CopperPour = class extends PrimitiveComponent2 {
|
|
|
18618
18863
|
import { copperTextProps } from "@tscircuit/props";
|
|
18619
18864
|
var CopperText = class extends PrimitiveComponent2 {
|
|
18620
18865
|
isPcbPrimitive = true;
|
|
18866
|
+
pcb_copper_text_id = null;
|
|
18621
18867
|
get config() {
|
|
18622
18868
|
return {
|
|
18623
18869
|
componentName: "CopperText",
|
|
@@ -18631,7 +18877,7 @@ var CopperText = class extends PrimitiveComponent2 {
|
|
|
18631
18877
|
const container = this.getPrimitiveContainer();
|
|
18632
18878
|
const position = this._getGlobalPcbPositionBeforeLayout();
|
|
18633
18879
|
const subcircuit = this.getSubcircuit();
|
|
18634
|
-
db.pcb_copper_text.insert({
|
|
18880
|
+
const pcb_copper_text = db.pcb_copper_text.insert({
|
|
18635
18881
|
anchor_alignment: props.anchorAlignment,
|
|
18636
18882
|
anchor_position: {
|
|
18637
18883
|
x: position.x,
|
|
@@ -18648,6 +18894,32 @@ var CopperText = class extends PrimitiveComponent2 {
|
|
|
18648
18894
|
subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
|
|
18649
18895
|
pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
|
|
18650
18896
|
});
|
|
18897
|
+
this.pcb_copper_text_id = pcb_copper_text.pcb_copper_text_id;
|
|
18898
|
+
}
|
|
18899
|
+
getPcbSize() {
|
|
18900
|
+
const { _parsedProps: props } = this;
|
|
18901
|
+
const fontSize = props.fontSize ?? 1;
|
|
18902
|
+
const text = props.text ?? "";
|
|
18903
|
+
const textWidth = text.length * fontSize;
|
|
18904
|
+
const textHeight = fontSize;
|
|
18905
|
+
return { width: textWidth * fontSize, height: textHeight * fontSize };
|
|
18906
|
+
}
|
|
18907
|
+
_moveCircuitJsonElements({
|
|
18908
|
+
deltaX,
|
|
18909
|
+
deltaY
|
|
18910
|
+
}) {
|
|
18911
|
+
if (this.root?.pcbDisabled) return;
|
|
18912
|
+
const { db } = this.root;
|
|
18913
|
+
if (!this.pcb_copper_text_id) return;
|
|
18914
|
+
const text = db.pcb_copper_text.get(this.pcb_copper_text_id);
|
|
18915
|
+
if (text) {
|
|
18916
|
+
db.pcb_copper_text.update(this.pcb_copper_text_id, {
|
|
18917
|
+
anchor_position: {
|
|
18918
|
+
x: text.anchor_position.x + deltaX,
|
|
18919
|
+
y: text.anchor_position.y + deltaY
|
|
18920
|
+
}
|
|
18921
|
+
});
|
|
18922
|
+
}
|
|
18651
18923
|
}
|
|
18652
18924
|
};
|
|
18653
18925
|
|
|
@@ -20028,7 +20300,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
20028
20300
|
var package_default = {
|
|
20029
20301
|
name: "@tscircuit/core",
|
|
20030
20302
|
type: "module",
|
|
20031
|
-
version: "0.0.
|
|
20303
|
+
version: "0.0.946",
|
|
20032
20304
|
types: "dist/index.d.ts",
|
|
20033
20305
|
main: "dist/index.js",
|
|
20034
20306
|
module: "dist/index.js",
|
|
@@ -20059,7 +20331,7 @@ var package_default = {
|
|
|
20059
20331
|
devDependencies: {
|
|
20060
20332
|
"@biomejs/biome": "^1.8.3",
|
|
20061
20333
|
"@resvg/resvg-js": "^2.6.2",
|
|
20062
|
-
"@tscircuit/capacity-autorouter": "^0.0.
|
|
20334
|
+
"@tscircuit/capacity-autorouter": "^0.0.204",
|
|
20063
20335
|
"@tscircuit/checks": "^0.0.87",
|
|
20064
20336
|
"@tscircuit/circuit-json-util": "^0.0.73",
|
|
20065
20337
|
"@tscircuit/common": "^0.0.20",
|
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.947",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@biomejs/biome": "^1.8.3",
|
|
34
34
|
"@resvg/resvg-js": "^2.6.2",
|
|
35
|
-
"@tscircuit/capacity-autorouter": "^0.0.
|
|
35
|
+
"@tscircuit/capacity-autorouter": "^0.0.204",
|
|
36
36
|
"@tscircuit/checks": "^0.0.87",
|
|
37
37
|
"@tscircuit/circuit-json-util": "^0.0.73",
|
|
38
38
|
"@tscircuit/common": "^0.0.20",
|