@tscircuit/core 0.0.914 → 0.0.916

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 CHANGED
@@ -149,6 +149,7 @@ type Obstacle = {
149
149
  height: number;
150
150
  connectedTo: string[];
151
151
  netIsAssignable?: boolean;
152
+ offBoardConnectsTo?: string[];
152
153
  };
153
154
  interface SimpleRouteConnection {
154
155
  name: string;
@@ -13917,8 +13918,19 @@ declare class Interconnect extends NormalComponent<typeof interconnectProps> {
13917
13918
  shouldRenderAsSchematicBox: boolean;
13918
13919
  sourceFtype: Ftype;
13919
13920
  };
13921
+ /**
13922
+ * For standard footprints (0402, 0603, 0805, 1206), the interconnect acts as
13923
+ * a 0-ohm jumper where both pins are internally connected.
13924
+ */
13925
+ get defaultInternallyConnectedPinNames(): string[][];
13920
13926
  _getImpliedFootprintString(): string | null;
13921
13927
  doInitialSourceRender(): void;
13928
+ /**
13929
+ * After ports have their source_component_id assigned, create the
13930
+ * source_component_internal_connection to indicate which pins are
13931
+ * internally connected (for 0-ohm jumper behavior).
13932
+ */
13933
+ doInitialSourceParentAttachment(): void;
13922
13934
  }
13923
13935
 
13924
13936
  declare class SolderJumper<PinLabels extends string = never> extends NormalComponent<typeof solderjumperProps, PinLabels> {
package/dist/index.js CHANGED
@@ -10020,6 +10020,52 @@ var getSimpleRouteJsonFromCircuitJson = ({
10020
10020
  );
10021
10021
  obstacle.connectedTo.push(...additionalIds);
10022
10022
  }
10023
+ const internalConnections = db.source_component_internal_connection.list();
10024
+ const sourcePortIdToInternalConnectionId = /* @__PURE__ */ new Map();
10025
+ for (const ic of internalConnections) {
10026
+ for (const sourcePortId of ic.source_port_ids) {
10027
+ sourcePortIdToInternalConnectionId.set(
10028
+ sourcePortId,
10029
+ ic.source_component_internal_connection_id
10030
+ );
10031
+ }
10032
+ }
10033
+ const pcbElementIdToSourcePortId = /* @__PURE__ */ new Map();
10034
+ for (const pcbPort of db.pcb_port.list()) {
10035
+ if (pcbPort.source_port_id) {
10036
+ const smtpad = db.pcb_smtpad.getWhere({
10037
+ pcb_port_id: pcbPort.pcb_port_id
10038
+ });
10039
+ if (smtpad) {
10040
+ pcbElementIdToSourcePortId.set(
10041
+ smtpad.pcb_smtpad_id,
10042
+ pcbPort.source_port_id
10043
+ );
10044
+ }
10045
+ const platedHole = db.pcb_plated_hole.getWhere({
10046
+ pcb_port_id: pcbPort.pcb_port_id
10047
+ });
10048
+ if (platedHole) {
10049
+ pcbElementIdToSourcePortId.set(
10050
+ platedHole.pcb_plated_hole_id,
10051
+ pcbPort.source_port_id
10052
+ );
10053
+ }
10054
+ }
10055
+ }
10056
+ for (const obstacle of obstacles) {
10057
+ for (const connectedId of obstacle.connectedTo) {
10058
+ const sourcePortId = pcbElementIdToSourcePortId.get(connectedId);
10059
+ if (sourcePortId) {
10060
+ const internalConnectionId = sourcePortIdToInternalConnectionId.get(sourcePortId);
10061
+ if (internalConnectionId) {
10062
+ obstacle.offBoardConnectsTo = [internalConnectionId];
10063
+ obstacle.netIsAssignable = true;
10064
+ break;
10065
+ }
10066
+ }
10067
+ }
10068
+ }
10023
10069
  const allPoints = obstacles.flatMap((o) => [
10024
10070
  {
10025
10071
  x: o.center.x - o.width / 2,
@@ -16313,6 +16359,7 @@ var Jumper = class extends NormalComponent3 {
16313
16359
  // lib/components/normal-components/Interconnect.ts
16314
16360
  import { interconnectProps } from "@tscircuit/props";
16315
16361
  var INTERCONNECT_STANDARD_FOOTPRINTS = {
16362
+ "0402": "0402",
16316
16363
  "0603": "0603",
16317
16364
  "0805": "0805",
16318
16365
  "1206": "1206"
@@ -16326,6 +16373,17 @@ var Interconnect = class extends NormalComponent3 {
16326
16373
  sourceFtype: "interconnect"
16327
16374
  };
16328
16375
  }
16376
+ /**
16377
+ * For standard footprints (0402, 0603, 0805, 1206), the interconnect acts as
16378
+ * a 0-ohm jumper where both pins are internally connected.
16379
+ */
16380
+ get defaultInternallyConnectedPinNames() {
16381
+ const { standard } = this._parsedProps;
16382
+ if (standard && INTERCONNECT_STANDARD_FOOTPRINTS[standard]) {
16383
+ return [["pin1", "pin2"]];
16384
+ }
16385
+ return [];
16386
+ }
16329
16387
  _getImpliedFootprintString() {
16330
16388
  const { standard } = this._parsedProps;
16331
16389
  if (!standard) return null;
@@ -16340,6 +16398,27 @@ var Interconnect = class extends NormalComponent3 {
16340
16398
  });
16341
16399
  this.source_component_id = source_component.source_component_id;
16342
16400
  }
16401
+ /**
16402
+ * After ports have their source_component_id assigned, create the
16403
+ * source_component_internal_connection to indicate which pins are
16404
+ * internally connected (for 0-ohm jumper behavior).
16405
+ */
16406
+ doInitialSourceParentAttachment() {
16407
+ const { db } = this.root;
16408
+ const internallyConnectedPorts = this._getInternallyConnectedPins();
16409
+ for (const ports of internallyConnectedPorts) {
16410
+ const sourcePortIds = ports.map((port) => port.source_port_id).filter((id) => id !== null);
16411
+ if (sourcePortIds.length >= 2) {
16412
+ db.source_component_internal_connection.insert({
16413
+ source_component_id: this.source_component_id,
16414
+ // @ts-expect-error uncomment when circuit-json includes subcircuit_id
16415
+ // in the source_component_internal_connection schema
16416
+ subcircuit_id: this.getSubcircuit()?.subcircuit_id,
16417
+ source_port_ids: sourcePortIds
16418
+ });
16419
+ }
16420
+ }
16421
+ }
16343
16422
  };
16344
16423
 
16345
16424
  // lib/components/normal-components/SolderJumper.ts
@@ -19169,7 +19248,7 @@ import { identity as identity5 } from "transformation-matrix";
19169
19248
  var package_default = {
19170
19249
  name: "@tscircuit/core",
19171
19250
  type: "module",
19172
- version: "0.0.913",
19251
+ version: "0.0.915",
19173
19252
  types: "dist/index.d.ts",
19174
19253
  main: "dist/index.js",
19175
19254
  module: "dist/index.js",
@@ -19227,9 +19306,9 @@ var package_default = {
19227
19306
  "bun-match-svg": "0.0.12",
19228
19307
  "calculate-elbow": "^0.0.12",
19229
19308
  "chokidar-cli": "^3.0.0",
19230
- "circuit-json": "^0.0.325",
19309
+ "circuit-json": "^0.0.328",
19231
19310
  "circuit-json-to-bpc": "^0.0.13",
19232
- "circuit-json-to-connectivity-map": "^0.0.22",
19311
+ "circuit-json-to-connectivity-map": "^0.0.23",
19233
19312
  "circuit-json-to-gltf": "^0.0.31",
19234
19313
  "circuit-json-to-simple-3d": "^0.0.9",
19235
19314
  "circuit-json-to-spice": "^0.0.30",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.914",
4
+ "version": "0.0.916",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -59,9 +59,9 @@
59
59
  "bun-match-svg": "0.0.12",
60
60
  "calculate-elbow": "^0.0.12",
61
61
  "chokidar-cli": "^3.0.0",
62
- "circuit-json": "^0.0.325",
62
+ "circuit-json": "^0.0.328",
63
63
  "circuit-json-to-bpc": "^0.0.13",
64
- "circuit-json-to-connectivity-map": "^0.0.22",
64
+ "circuit-json-to-connectivity-map": "^0.0.23",
65
65
  "circuit-json-to-gltf": "^0.0.31",
66
66
  "circuit-json-to-simple-3d": "^0.0.9",
67
67
  "circuit-json-to-spice": "^0.0.30",