@tscircuit/core 0.0.783 → 0.0.784

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
@@ -1199,6 +1199,11 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
1199
1199
  y: number;
1200
1200
  }): void;
1201
1201
  doInitialSilkscreenOverlapAdjustment(): void;
1202
+ /**
1203
+ * Returns true if this component has explicit PCB positioning (pcbX or pcbY)
1204
+ * and should not be moved by automatic packing/layout algorithms
1205
+ */
1206
+ isRelativelyPositioned(): boolean;
1202
1207
  }
1203
1208
 
1204
1209
  declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps> extends NormalComponent<Props> implements ISubcircuit {
package/dist/index.js CHANGED
@@ -8429,6 +8429,13 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
8429
8429
  doInitialSilkscreenOverlapAdjustment() {
8430
8430
  return NormalComponent_doInitialSilkscreenOverlapAdjustment(this);
8431
8431
  }
8432
+ /**
8433
+ * Returns true if this component has explicit PCB positioning (pcbX or pcbY)
8434
+ * and should not be moved by automatic packing/layout algorithms
8435
+ */
8436
+ isRelativelyPositioned() {
8437
+ return this._parsedProps.pcbX !== void 0 || this._parsedProps.pcbY !== void 0;
8438
+ }
8432
8439
  };
8433
8440
 
8434
8441
  // lib/utils/boards/get-board-center-from-anchor.ts
@@ -11069,6 +11076,7 @@ var Group_doInitialPcbLayoutPack = (group) => {
11069
11076
  const gap = pcbPackGap ?? pcbGap ?? gapProp;
11070
11077
  const gapMm = length4.parse(gap ?? DEFAULT_MIN_GAP);
11071
11078
  const chipMarginsMap = {};
11079
+ const excludedPcbComponentIds = /* @__PURE__ */ new Set();
11072
11080
  const collectMargins = (comp) => {
11073
11081
  if (comp?.pcb_component_id && comp?._parsedProps) {
11074
11082
  const props2 = comp._parsedProps;
@@ -11085,9 +11093,34 @@ var Group_doInitialPcbLayoutPack = (group) => {
11085
11093
  if (comp?.children) comp.children.forEach(collectMargins);
11086
11094
  };
11087
11095
  collectMargins(group);
11096
+ const excludedPcbGroupIds = /* @__PURE__ */ new Set();
11097
+ for (const child of group.children) {
11098
+ const childIsGroupOrNormalComponent = child;
11099
+ if (childIsGroupOrNormalComponent._isNormalComponent && childIsGroupOrNormalComponent.isRelativelyPositioned?.()) {
11100
+ if (childIsGroupOrNormalComponent.pcb_component_id) {
11101
+ excludedPcbComponentIds.add(
11102
+ childIsGroupOrNormalComponent.pcb_component_id
11103
+ );
11104
+ }
11105
+ if (childIsGroupOrNormalComponent.pcb_group_id) {
11106
+ excludedPcbGroupIds.add(
11107
+ childIsGroupOrNormalComponent.pcb_group_id
11108
+ );
11109
+ }
11110
+ }
11111
+ }
11112
+ const filteredCircuitJson = db.toArray().filter((element) => {
11113
+ if (element.type === "pcb_component") {
11114
+ return !excludedPcbComponentIds.has(element.pcb_component_id);
11115
+ }
11116
+ if (element.type === "pcb_group") {
11117
+ return !excludedPcbGroupIds.has(element.pcb_group_id);
11118
+ }
11119
+ return true;
11120
+ });
11088
11121
  const packInput = {
11089
11122
  ...convertPackOutputToPackInput(
11090
- convertCircuitJsonToPackOutput(db.toArray(), {
11123
+ convertCircuitJsonToPackOutput(filteredCircuitJson, {
11091
11124
  source_group_id: group.source_group_id,
11092
11125
  shouldAddInnerObstacles: true,
11093
11126
  chipMarginsMap
@@ -12781,13 +12814,11 @@ var Group6 = class extends NormalComponent3 {
12781
12814
  if (props.grid) return "grid";
12782
12815
  const groupHasCoords = props.pcbX !== void 0 || props.pcbY !== void 0;
12783
12816
  const hasManualEdits = (props.manualEdits?.pcb_placements?.length ?? 0) > 0;
12784
- const anyDirectChildHasPcbCoords = this.children.some((child) => {
12785
- const childProps = child._parsedProps;
12786
- return childProps?.pcbX !== void 0 || childProps?.pcbY !== void 0;
12787
- });
12788
- if (anyDirectChildHasPcbCoords) return "none";
12789
12817
  const unpositionedDirectChildrenCount = this.children.reduce(
12790
12818
  (count, child) => {
12819
+ if (!child.pcb_component_id && !child.pcb_group_id) {
12820
+ return count;
12821
+ }
12791
12822
  const childProps = child._parsedProps;
12792
12823
  const hasCoords = childProps?.pcbX !== void 0 || childProps?.pcbY !== void 0;
12793
12824
  return count + (hasCoords ? 0 : 1);
@@ -16527,7 +16558,7 @@ import { identity as identity6 } from "transformation-matrix";
16527
16558
  var package_default = {
16528
16559
  name: "@tscircuit/core",
16529
16560
  type: "module",
16530
- version: "0.0.782",
16561
+ version: "0.0.783",
16531
16562
  types: "dist/index.d.ts",
16532
16563
  main: "dist/index.js",
16533
16564
  module: "dist/index.js",
@@ -16559,7 +16590,7 @@ var package_default = {
16559
16590
  "@tscircuit/capacity-autorouter": "^0.0.132",
16560
16591
  "@tscircuit/checks": "^0.0.85",
16561
16592
  "@tscircuit/circuit-json-util": "^0.0.72",
16562
- "@tscircuit/common": "^0.0.9",
16593
+ "@tscircuit/common": "^0.0.11",
16563
16594
  "@tscircuit/footprinter": "^0.0.236",
16564
16595
  "@tscircuit/import-snippet": "^0.0.4",
16565
16596
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.783",
4
+ "version": "0.0.784",
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/capacity-autorouter": "^0.0.132",
34
34
  "@tscircuit/checks": "^0.0.85",
35
35
  "@tscircuit/circuit-json-util": "^0.0.72",
36
- "@tscircuit/common": "^0.0.9",
36
+ "@tscircuit/common": "^0.0.11",
37
37
  "@tscircuit/footprinter": "^0.0.236",
38
38
  "@tscircuit/import-snippet": "^0.0.4",
39
39
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",