@tscircuit/core 0.0.1811 → 0.0.1813

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
@@ -15486,7 +15486,7 @@ declare class Capacitor extends NormalComponent<typeof capacitorProps, Polarized
15486
15486
  doInitialSourceRender(): void;
15487
15487
  }
15488
15488
 
15489
- declare class Antenna extends NormalComponent<typeof antennaProps, "pin1" | "feed" | "pin2" | "ground" | "gnd" | "feed2"> {
15489
+ declare class Antenna extends NormalComponent<typeof antennaProps, "pin1" | "feed" | "feed1" | "pin2" | "ground" | "gnd" | "feed2"> {
15490
15490
  get config(): {
15491
15491
  componentName: string;
15492
15492
  zodProps: zod.ZodObject<{
package/dist/index.js CHANGED
@@ -35781,12 +35781,12 @@ var applyComponentConstraintClusters = (group, packInput) => {
35781
35781
  };
35782
35782
 
35783
35783
  // lib/components/primitive-components/Group/Group_doInitialPcbLayoutPack/applyPackOutput.ts
35784
- import { translate as translate6, rotate as rotate4, compose as compose7 } from "transformation-matrix";
35785
35784
  import {
35786
35785
  findBoundsAndCenter,
35787
35786
  transformPCBElements as transformPCBElements2
35788
35787
  } from "@tscircuit/circuit-json-util";
35789
35788
  import { normalizeDegrees as normalizeDegrees4 } from "@tscircuit/math-utils";
35789
+ import { compose as compose7, rotate as rotate4, translate as translate6 } from "transformation-matrix";
35790
35790
  var updateCadRotation = ({
35791
35791
  db,
35792
35792
  pcbComponentId,
@@ -35819,6 +35819,7 @@ var isDescendantGroup = (db, groupId, ancestorId) => {
35819
35819
  var applyPackOutput = (group, packOutput, clusterMap, initialPackOutput) => {
35820
35820
  const { db } = group.root;
35821
35821
  for (const packedComponent of packOutput.components) {
35822
+ if (packedComponent.isStatic) continue;
35822
35823
  const { center, componentId, ccwRotationOffset, ccwRotationDegrees } = packedComponent;
35823
35824
  const cluster = clusterMap[componentId];
35824
35825
  if (cluster) {
@@ -36002,6 +36003,40 @@ var getPackInputsByPcbLayer = (packInput, db) => {
36002
36003
  // lib/components/primitive-components/Group/Group_doInitialPcbLayoutPack/Group_doInitialPcbLayoutPack.ts
36003
36004
  var DEFAULT_MIN_GAP = "1mm";
36004
36005
  var debug4 = Debug6("Group_doInitialPcbLayoutPack");
36006
+ var getCollisionObstacleForStaticComponent = (component) => {
36007
+ if (component.courtyard && component.center) {
36008
+ return {
36009
+ obstacleId: component.componentId,
36010
+ absoluteCenter: {
36011
+ x: component.center.x + component.courtyard.offsetFromCenter.x,
36012
+ y: component.center.y + component.courtyard.offsetFromCenter.y
36013
+ },
36014
+ width: component.courtyard.width,
36015
+ height: component.courtyard.height
36016
+ };
36017
+ }
36018
+ if (component.pads.length === 0) return void 0;
36019
+ let minX = Infinity;
36020
+ let minY = Infinity;
36021
+ let maxX = -Infinity;
36022
+ let maxY = -Infinity;
36023
+ for (const pad of component.pads) {
36024
+ const absoluteCenter = pad.absoluteCenter ?? (component.center ? {
36025
+ x: component.center.x + pad.offset.x,
36026
+ y: component.center.y + pad.offset.y
36027
+ } : pad.offset);
36028
+ minX = Math.min(minX, absoluteCenter.x - pad.size.x / 2);
36029
+ minY = Math.min(minY, absoluteCenter.y - pad.size.y / 2);
36030
+ maxX = Math.max(maxX, absoluteCenter.x + pad.size.x / 2);
36031
+ maxY = Math.max(maxY, absoluteCenter.y + pad.size.y / 2);
36032
+ }
36033
+ return {
36034
+ obstacleId: component.componentId,
36035
+ absoluteCenter: { x: (minX + maxX) / 2, y: (minY + maxY) / 2 },
36036
+ width: maxX - minX,
36037
+ height: maxY - minY
36038
+ };
36039
+ };
36005
36040
  var Group_doInitialPcbLayoutPack = (group) => {
36006
36041
  const { db } = group.root;
36007
36042
  const { _parsedProps: props } = group;
@@ -36139,8 +36174,48 @@ var Group_doInitialPcbLayoutPack = (group) => {
36139
36174
  const componentIdsForLayer = new Set(
36140
36175
  layerPackInput.components.map((component) => component.componentId)
36141
36176
  );
36142
- const networkReferenceComponents = packOutput.components.map(
36143
- (component) => ({
36177
+ const staticLayerObstacles = layerPackInput.components.flatMap(
36178
+ (component) => {
36179
+ if (!component.isStatic) return [];
36180
+ const obstacle = getCollisionObstacleForStaticComponent(component);
36181
+ return obstacle ? [obstacle] : [];
36182
+ }
36183
+ );
36184
+ const canUseCrossLayerNetworkReferences = layerPackInput.components.every(
36185
+ (component) => Boolean(db.pcb_component.get(component.componentId)) && !clusterMap[component.componentId]
36186
+ );
36187
+ const crossLayerStaticComponents = packInput.components.filter(
36188
+ (component) => component.isStatic && !componentIdsForLayer.has(component.componentId)
36189
+ );
36190
+ const fallbackCrossLayerObstacles = canUseCrossLayerNetworkReferences ? [] : crossLayerStaticComponents.flatMap((component) => {
36191
+ const obstacle = getCollisionObstacleForStaticComponent(component);
36192
+ return obstacle ? [obstacle] : [];
36193
+ });
36194
+ const collisionOnlyPadIds = new Set(
36195
+ [
36196
+ ...layerPackInput.components.filter(
36197
+ (component) => component.isStatic
36198
+ ),
36199
+ ...canUseCrossLayerNetworkReferences ? [] : crossLayerStaticComponents
36200
+ ].flatMap((component) => component.pads.map((pad) => pad.padId))
36201
+ );
36202
+ const networkReferenceSources = new Map([
36203
+ ...packOutput.components.map(
36204
+ (component) => [
36205
+ component.componentId,
36206
+ { component, courtyardSize: Number.EPSILON }
36207
+ ]
36208
+ ),
36209
+ ...canUseCrossLayerNetworkReferences ? crossLayerStaticComponents.map(
36210
+ (component) => [
36211
+ component.componentId,
36212
+ { component, courtyardSize: 1e-6 }
36213
+ ]
36214
+ ) : []
36215
+ ]);
36216
+ const networkReferenceComponents = Array.from(
36217
+ networkReferenceSources.values(),
36218
+ ({ component, courtyardSize }) => ({
36144
36219
  ...component,
36145
36220
  componentId: `network_reference_${component.componentId}`,
36146
36221
  isStatic: true,
@@ -36148,16 +36223,26 @@ var Group_doInitialPcbLayoutPack = (group) => {
36148
36223
  // reducing their collision geometry to a point at the component center.
36149
36224
  courtyard: {
36150
36225
  offsetFromCenter: { x: 0, y: 0 },
36151
- width: Number.EPSILON,
36152
- height: Number.EPSILON
36226
+ width: courtyardSize,
36227
+ height: courtyardSize
36153
36228
  }
36154
36229
  })
36155
36230
  );
36156
36231
  const solverInput = {
36157
36232
  ...layerPackInput,
36233
+ weightedConnections: layerPackInput.weightedConnections?.filter(
36234
+ (connection) => connection.padIds.every((padId) => !collisionOnlyPadIds.has(padId))
36235
+ ),
36236
+ obstacles: [
36237
+ ...layerPackInput.obstacles ?? [],
36238
+ ...staticLayerObstacles,
36239
+ ...fallbackCrossLayerObstacles
36240
+ ],
36158
36241
  components: [
36159
36242
  ...networkReferenceComponents,
36160
- ...layerPackInput.components
36243
+ ...layerPackInput.components.filter(
36244
+ (component) => !component.isStatic
36245
+ )
36161
36246
  ]
36162
36247
  };
36163
36248
  const solver = new PackSolver22(solverInput);
@@ -42208,7 +42293,7 @@ function Group_getRoutingPhasePlans(group) {
42208
42293
  var package_default = {
42209
42294
  name: "@tscircuit/core",
42210
42295
  type: "module",
42211
- version: "0.0.1810",
42296
+ version: "0.0.1812",
42212
42297
  types: "dist/index.d.ts",
42213
42298
  main: "dist/index.js",
42214
42299
  module: "dist/index.js",
@@ -42327,7 +42412,7 @@ var package_default = {
42327
42412
  "@flatten-js/core": "^1.6.2",
42328
42413
  "@lume/kiwi": "^0.4.3",
42329
42414
  "calculate-cell-boundaries": "^0.0.19",
42330
- "calculate-packing": "^0.0.86",
42415
+ "calculate-packing": "^0.0.89",
42331
42416
  "css-select": "5.1.0",
42332
42417
  "format-si-unit": "^0.0.12",
42333
42418
  nanoid: "^5.0.7",
@@ -49193,7 +49278,7 @@ var Antenna = class extends NormalComponent3 {
49193
49278
  super.initPorts({
49194
49279
  pinCount: secondaryPortRole ? 2 : 1,
49195
49280
  additionalAliases: {
49196
- pin1: ["feed"],
49281
+ pin1: secondaryPortRole === "feed2" ? ["feed", "feed1"] : ["feed"],
49197
49282
  ...secondaryPortRole === "ground" ? { pin2: ["ground", "gnd"] } : secondaryPortRole === "feed2" ? { pin2: ["feed2"] } : {}
49198
49283
  }
49199
49284
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1811",
4
+ "version": "0.0.1813",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -120,7 +120,7 @@
120
120
  "@flatten-js/core": "^1.6.2",
121
121
  "@lume/kiwi": "^0.4.3",
122
122
  "calculate-cell-boundaries": "^0.0.19",
123
- "calculate-packing": "^0.0.86",
123
+ "calculate-packing": "^0.0.89",
124
124
  "css-select": "5.1.0",
125
125
  "format-si-unit": "^0.0.12",
126
126
  "nanoid": "^5.0.7",