@tscircuit/core 0.0.604 → 0.0.606

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
@@ -11,7 +11,7 @@ import { CircuitJsonUtilObjects } from '@tscircuit/circuit-json-util';
11
11
  import { ConnectivityMap } from 'circuit-json-to-connectivity-map';
12
12
  import { GraphicsObject } from 'graphics-debug';
13
13
 
14
- declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "PcbFootprintStringRender", "InitializePortsFromChildren", "CreateNetsFromProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SchematicComponentRender", "SchematicPortRender", "SchematicPrimitiveRender", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbLayout", "PcbComponentSizeCalculation", "PcbBoardAutoSize", "PcbTraceHintRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbDesignRuleChecks", "CadModelRender", "PartsEngineRender"];
14
+ declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "PcbFootprintStringRender", "InitializePortsFromChildren", "CreateNetsFromProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SchematicComponentRender", "SchematicPortRender", "SchematicPrimitiveRender", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbLayout", "PcbBoardAutoSize", "PcbTraceHintRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbDesignRuleChecks", "CadModelRender", "PartsEngineRender"];
15
15
  type RenderPhase = (typeof orderedRenderPhases)[number];
16
16
  type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
17
17
  type RenderPhaseStates = Record<RenderPhase, {
@@ -1154,12 +1154,14 @@ declare class Board extends Group<typeof boardProps> {
1154
1154
  pcbGridRowGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
1155
1155
  pcbGridColumnGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
1156
1156
  pcbFlex: zod.ZodOptional<zod.ZodUnion<[zod.ZodBoolean, zod.ZodString]>>;
1157
+ pcbFlexGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
1157
1158
  pcbFlexDirection: zod.ZodOptional<zod.ZodEnum<["row", "column"]>>;
1158
1159
  pcbAlignItems: zod.ZodOptional<zod.ZodEnum<["start", "center", "end", "stretch"]>>;
1159
1160
  pcbJustifyContent: zod.ZodOptional<zod.ZodEnum<["start", "center", "end", "stretch", "space-between", "space-around", "space-evenly"]>>;
1160
1161
  pcbFlexRow: zod.ZodOptional<zod.ZodBoolean>;
1161
1162
  pcbFlexColumn: zod.ZodOptional<zod.ZodBoolean>;
1162
1163
  pcbGap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
1164
+ pcbPack: zod.ZodOptional<zod.ZodBoolean>;
1163
1165
  pcbWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
1164
1166
  pcbHeight: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
1165
1167
  schWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
@@ -1802,12 +1804,14 @@ declare class Board extends Group<typeof boardProps> {
1802
1804
  pcbGridRowGap?: string | number | undefined;
1803
1805
  pcbGridColumnGap?: string | number | undefined;
1804
1806
  pcbFlex?: string | boolean | undefined;
1807
+ pcbFlexGap?: string | number | undefined;
1805
1808
  pcbFlexDirection?: "row" | "column" | undefined;
1806
1809
  pcbAlignItems?: "center" | "start" | "end" | "stretch" | undefined;
1807
1810
  pcbJustifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
1808
1811
  pcbFlexRow?: boolean | undefined;
1809
1812
  pcbFlexColumn?: boolean | undefined;
1810
1813
  pcbGap?: string | number | undefined;
1814
+ pcbPack?: boolean | undefined;
1811
1815
  manualEdits?: {
1812
1816
  pcb_placements?: {
1813
1817
  selector: string;
@@ -2011,12 +2015,14 @@ declare class Board extends Group<typeof boardProps> {
2011
2015
  pcbGridRowGap?: string | number | undefined;
2012
2016
  pcbGridColumnGap?: string | number | undefined;
2013
2017
  pcbFlex?: string | boolean | undefined;
2018
+ pcbFlexGap?: string | number | undefined;
2014
2019
  pcbFlexDirection?: "row" | "column" | undefined;
2015
2020
  pcbAlignItems?: "center" | "start" | "end" | "stretch" | undefined;
2016
2021
  pcbJustifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
2017
2022
  pcbFlexRow?: boolean | undefined;
2018
2023
  pcbFlexColumn?: boolean | undefined;
2019
2024
  pcbGap?: string | number | undefined;
2025
+ pcbPack?: boolean | undefined;
2020
2026
  manualEdits?: {
2021
2027
  pcb_placements?: {
2022
2028
  selector: string;
package/dist/index.js CHANGED
@@ -109,8 +109,8 @@ var orderedRenderPhases = [
109
109
  "PcbFootprintLayout",
110
110
  "PcbPortRender",
111
111
  "PcbPortAttachment",
112
- "PcbLayout",
113
112
  "PcbComponentSizeCalculation",
113
+ "PcbLayout",
114
114
  "PcbBoardAutoSize",
115
115
  "PcbTraceHintRender",
116
116
  "PcbTraceRender",
@@ -7921,10 +7921,14 @@ function Group_doInitialSchematicLayoutGrid(group) {
7921
7921
  let gridColsOption = props.gridCols;
7922
7922
  let gridRowsOption = void 0;
7923
7923
  let gridGapOption = props.gridGap;
7924
+ let gridRowGapOption = props.gridRowGap;
7925
+ let gridColumnGapOption = props.gridColumnGap;
7924
7926
  if (props.schLayout?.grid) {
7925
7927
  gridColsOption = props.schLayout.grid.cols ?? gridColsOption;
7926
7928
  gridRowsOption = props.schLayout.grid.rows;
7927
7929
  gridGapOption = props.schLayout.gridGap ?? gridGapOption;
7930
+ gridRowGapOption = props.schLayout.gridRowGap ?? gridRowGapOption;
7931
+ gridColumnGapOption = props.schLayout.gridColumnGap ?? gridColumnGapOption;
7928
7932
  }
7929
7933
  let numCols;
7930
7934
  let numRows;
@@ -7946,7 +7950,16 @@ function Group_doInitialSchematicLayoutGrid(group) {
7946
7950
  numRows = schematicChildren.length;
7947
7951
  let gridGapX;
7948
7952
  let gridGapY;
7949
- if (typeof gridGapOption === "number") {
7953
+ const parseGap = (val) => {
7954
+ if (val === void 0) return void 0;
7955
+ return typeof val === "number" ? val : length.parse(val);
7956
+ };
7957
+ if (gridRowGapOption !== void 0 || gridColumnGapOption !== void 0) {
7958
+ const fallbackX = typeof gridGapOption === "object" && gridGapOption !== null ? gridGapOption.x : gridGapOption;
7959
+ const fallbackY = typeof gridGapOption === "object" && gridGapOption !== null ? gridGapOption.y : gridGapOption;
7960
+ gridGapX = parseGap(gridColumnGapOption ?? fallbackX) ?? 1;
7961
+ gridGapY = parseGap(gridRowGapOption ?? fallbackY) ?? 1;
7962
+ } else if (typeof gridGapOption === "number") {
7950
7963
  gridGapX = gridGapOption;
7951
7964
  gridGapY = gridGapOption;
7952
7965
  } else if (typeof gridGapOption === "string") {
@@ -8052,10 +8065,14 @@ function Group_doInitialPcbLayoutGrid(group) {
8052
8065
  let gridColsOption = props.pcbGridCols ?? props.gridCols;
8053
8066
  let gridRowsOption = props.pcbGridRows;
8054
8067
  let gridGapOption = props.pcbGridGap ?? props.gridGap;
8068
+ let gridRowGapOption = props.pcbGridRowGap ?? props.gridRowGap;
8069
+ let gridColumnGapOption = props.pcbGridColumnGap ?? props.gridColumnGap;
8055
8070
  if (props.pcbLayout?.grid) {
8056
8071
  gridColsOption = props.pcbLayout.grid.cols ?? gridColsOption;
8057
8072
  gridRowsOption = props.pcbLayout.grid.rows;
8058
8073
  gridGapOption = props.pcbLayout.gridGap ?? gridGapOption;
8074
+ gridRowGapOption = props.pcbLayout.gridRowGap ?? gridRowGapOption;
8075
+ gridColumnGapOption = props.pcbLayout.gridColumnGap ?? gridColumnGapOption;
8059
8076
  }
8060
8077
  let numCols;
8061
8078
  let numRows;
@@ -8076,7 +8093,16 @@ function Group_doInitialPcbLayoutGrid(group) {
8076
8093
  if (numRows === 0 && pcbChildren.length > 0) numRows = pcbChildren.length;
8077
8094
  let gridGapX;
8078
8095
  let gridGapY;
8079
- if (typeof gridGapOption === "number") {
8096
+ const parseGap = (val) => {
8097
+ if (val === void 0) return void 0;
8098
+ return typeof val === "number" ? val : length2.parse(val);
8099
+ };
8100
+ if (gridRowGapOption !== void 0 || gridColumnGapOption !== void 0) {
8101
+ const fallbackX = typeof gridGapOption === "object" && gridGapOption !== null ? gridGapOption.x : gridGapOption;
8102
+ const fallbackY = typeof gridGapOption === "object" && gridGapOption !== null ? gridGapOption.y : gridGapOption;
8103
+ gridGapX = parseGap(gridColumnGapOption ?? fallbackX) ?? 1;
8104
+ gridGapY = parseGap(gridRowGapOption ?? fallbackY) ?? 1;
8105
+ } else if (typeof gridGapOption === "number") {
8080
8106
  gridGapX = gridGapOption;
8081
8107
  gridGapY = gridGapOption;
8082
8108
  } else if (typeof gridGapOption === "string") {
@@ -8268,9 +8294,14 @@ var Group_doInitialPcbLayoutFlex = (group) => {
8268
8294
  });
8269
8295
  const justify = props.pcbJustifyContent ?? props.justifyContent;
8270
8296
  const align = props.pcbAlignItems ?? props.alignItems;
8297
+ const gap = props.pcbFlexGap ?? props.pcbGap ?? props.gap;
8298
+ const direction = props.pcbFlexDirection ?? "row";
8271
8299
  const modifiedCircuitJson = layoutCircuitJsonWithFlex(circuitJson, {
8272
8300
  justifyContent: justify === "start" ? "flex-start" : justify === "end" ? "flex-end" : justify === "stretch" ? "space-between" : justify ?? "space-between",
8273
- alignItems: align === "start" ? "flex-start" : align === "end" ? "flex-end" : align ?? "center"
8301
+ alignItems: align === "start" ? "flex-start" : align === "end" ? "flex-end" : align ?? "center",
8302
+ direction,
8303
+ columnGap: typeof gap === "number" ? gap : 0,
8304
+ rowGap: typeof gap === "number" ? gap : 0
8274
8305
  });
8275
8306
  const pcbSmtPads = db.pcb_smtpad.list();
8276
8307
  for (const smtpad of pcbSmtPads) {
@@ -8848,6 +8879,7 @@ var Group = class extends NormalComponent {
8848
8879
  if (props.pcbLayout?.pack) return "pack";
8849
8880
  if (props.pcbFlex) return "flex";
8850
8881
  if (props.pcbGrid) return "grid";
8882
+ if (props.pcbPack) return "pack";
8851
8883
  if (props.pack) return "pack";
8852
8884
  if (props.matchAdapt) return "match-adapt";
8853
8885
  if (props.flex) return "flex";
@@ -11343,7 +11375,7 @@ import { identity as identity5 } from "transformation-matrix";
11343
11375
  var package_default = {
11344
11376
  name: "@tscircuit/core",
11345
11377
  type: "module",
11346
- version: "0.0.603",
11378
+ version: "0.0.605",
11347
11379
  types: "dist/index.d.ts",
11348
11380
  main: "dist/index.js",
11349
11381
  module: "dist/index.js",
@@ -11374,7 +11406,7 @@ var package_default = {
11374
11406
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
11375
11407
  "@tscircuit/log-soup": "^1.0.2",
11376
11408
  "@tscircuit/math-utils": "^0.0.18",
11377
- "@tscircuit/props": "^0.0.274",
11409
+ "@tscircuit/props": "^0.0.276",
11378
11410
  "@tscircuit/schematic-autolayout": "^0.0.6",
11379
11411
  "@tscircuit/schematic-corpus": "^0.0.110",
11380
11412
  "@tscircuit/schematic-match-adapt": "^0.0.16",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.604",
4
+ "version": "0.0.606",
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
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
33
33
  "@tscircuit/log-soup": "^1.0.2",
34
34
  "@tscircuit/math-utils": "^0.0.18",
35
- "@tscircuit/props": "^0.0.274",
35
+ "@tscircuit/props": "^0.0.276",
36
36
  "@tscircuit/schematic-autolayout": "^0.0.6",
37
37
  "@tscircuit/schematic-corpus": "^0.0.110",
38
38
  "@tscircuit/schematic-match-adapt": "^0.0.16",