@tscircuit/core 0.0.578 → 0.0.580

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
@@ -1150,7 +1150,7 @@ declare class Board extends Group<typeof boardProps> {
1150
1150
  flex: zod.ZodOptional<zod.ZodUnion<[zod.ZodBoolean, zod.ZodString]>>;
1151
1151
  flexDirection: zod.ZodOptional<zod.ZodEnum<["row", "column"]>>;
1152
1152
  alignItems: zod.ZodOptional<zod.ZodEnum<["start", "center", "end", "stretch"]>>;
1153
- justifyContent: zod.ZodOptional<zod.ZodEnum<["start", "center", "end", "stretch"]>>;
1153
+ justifyContent: zod.ZodOptional<zod.ZodEnum<["start", "center", "end", "stretch", "space-between", "space-around", "space-evenly"]>>;
1154
1154
  flexRow: zod.ZodOptional<zod.ZodBoolean>;
1155
1155
  flexColumn: zod.ZodOptional<zod.ZodBoolean>;
1156
1156
  gap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
@@ -1181,7 +1181,7 @@ declare class Board extends Group<typeof boardProps> {
1181
1181
  gridGap?: string | number | undefined;
1182
1182
  flexDirection?: "row" | "column" | undefined;
1183
1183
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
1184
- justifyContent?: "center" | "start" | "end" | "stretch" | undefined;
1184
+ justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
1185
1185
  flexRow?: boolean | undefined;
1186
1186
  flexColumn?: boolean | undefined;
1187
1187
  gap?: string | number | undefined;
@@ -1212,7 +1212,7 @@ declare class Board extends Group<typeof boardProps> {
1212
1212
  gridGap?: string | number | undefined;
1213
1213
  flexDirection?: "row" | "column" | undefined;
1214
1214
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
1215
- justifyContent?: "center" | "start" | "end" | "stretch" | undefined;
1215
+ justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
1216
1216
  flexRow?: boolean | undefined;
1217
1217
  flexColumn?: boolean | undefined;
1218
1218
  gap?: string | number | undefined;
@@ -1244,7 +1244,7 @@ declare class Board extends Group<typeof boardProps> {
1244
1244
  flex: zod.ZodOptional<zod.ZodUnion<[zod.ZodBoolean, zod.ZodString]>>;
1245
1245
  flexDirection: zod.ZodOptional<zod.ZodEnum<["row", "column"]>>;
1246
1246
  alignItems: zod.ZodOptional<zod.ZodEnum<["start", "center", "end", "stretch"]>>;
1247
- justifyContent: zod.ZodOptional<zod.ZodEnum<["start", "center", "end", "stretch"]>>;
1247
+ justifyContent: zod.ZodOptional<zod.ZodEnum<["start", "center", "end", "stretch", "space-between", "space-around", "space-evenly"]>>;
1248
1248
  flexRow: zod.ZodOptional<zod.ZodBoolean>;
1249
1249
  flexColumn: zod.ZodOptional<zod.ZodBoolean>;
1250
1250
  gap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
@@ -1275,7 +1275,7 @@ declare class Board extends Group<typeof boardProps> {
1275
1275
  gridGap?: string | number | undefined;
1276
1276
  flexDirection?: "row" | "column" | undefined;
1277
1277
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
1278
- justifyContent?: "center" | "start" | "end" | "stretch" | undefined;
1278
+ justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
1279
1279
  flexRow?: boolean | undefined;
1280
1280
  flexColumn?: boolean | undefined;
1281
1281
  gap?: string | number | undefined;
@@ -1306,7 +1306,7 @@ declare class Board extends Group<typeof boardProps> {
1306
1306
  gridGap?: string | number | undefined;
1307
1307
  flexDirection?: "row" | "column" | undefined;
1308
1308
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
1309
- justifyContent?: "center" | "start" | "end" | "stretch" | undefined;
1309
+ justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
1310
1310
  flexRow?: boolean | undefined;
1311
1311
  flexColumn?: boolean | undefined;
1312
1312
  gap?: string | number | undefined;
@@ -1368,7 +1368,7 @@ declare class Board extends Group<typeof boardProps> {
1368
1368
  flex: zod.ZodOptional<zod.ZodUnion<[zod.ZodBoolean, zod.ZodString]>>;
1369
1369
  flexDirection: zod.ZodOptional<zod.ZodEnum<["row", "column"]>>;
1370
1370
  alignItems: zod.ZodOptional<zod.ZodEnum<["start", "center", "end", "stretch"]>>;
1371
- justifyContent: zod.ZodOptional<zod.ZodEnum<["start", "center", "end", "stretch"]>>;
1371
+ justifyContent: zod.ZodOptional<zod.ZodEnum<["start", "center", "end", "stretch", "space-between", "space-around", "space-evenly"]>>;
1372
1372
  flexRow: zod.ZodOptional<zod.ZodBoolean>;
1373
1373
  flexColumn: zod.ZodOptional<zod.ZodBoolean>;
1374
1374
  gap: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
@@ -1640,7 +1640,7 @@ declare class Board extends Group<typeof boardProps> {
1640
1640
  gridGap?: string | number | undefined;
1641
1641
  flexDirection?: "row" | "column" | undefined;
1642
1642
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
1643
- justifyContent?: "center" | "start" | "end" | "stretch" | undefined;
1643
+ justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
1644
1644
  flexRow?: boolean | undefined;
1645
1645
  flexColumn?: boolean | undefined;
1646
1646
  gap?: string | number | undefined;
@@ -1676,7 +1676,7 @@ declare class Board extends Group<typeof boardProps> {
1676
1676
  gridGap?: string | number | undefined;
1677
1677
  flexDirection?: "row" | "column" | undefined;
1678
1678
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
1679
- justifyContent?: "center" | "start" | "end" | "stretch" | undefined;
1679
+ justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
1680
1680
  flexRow?: boolean | undefined;
1681
1681
  flexColumn?: boolean | undefined;
1682
1682
  gap?: string | number | undefined;
@@ -1708,7 +1708,7 @@ declare class Board extends Group<typeof boardProps> {
1708
1708
  gridGap?: string | number | undefined;
1709
1709
  flexDirection?: "row" | "column" | undefined;
1710
1710
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
1711
- justifyContent?: "center" | "start" | "end" | "stretch" | undefined;
1711
+ justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
1712
1712
  flexRow?: boolean | undefined;
1713
1713
  flexColumn?: boolean | undefined;
1714
1714
  gap?: string | number | undefined;
@@ -1824,7 +1824,7 @@ declare class Board extends Group<typeof boardProps> {
1824
1824
  gridGap?: string | number | undefined;
1825
1825
  flexDirection?: "row" | "column" | undefined;
1826
1826
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
1827
- justifyContent?: "center" | "start" | "end" | "stretch" | undefined;
1827
+ justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
1828
1828
  flexRow?: boolean | undefined;
1829
1829
  flexColumn?: boolean | undefined;
1830
1830
  gap?: string | number | undefined;
@@ -1860,7 +1860,7 @@ declare class Board extends Group<typeof boardProps> {
1860
1860
  gridGap?: string | number | undefined;
1861
1861
  flexDirection?: "row" | "column" | undefined;
1862
1862
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
1863
- justifyContent?: "center" | "start" | "end" | "stretch" | undefined;
1863
+ justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
1864
1864
  flexRow?: boolean | undefined;
1865
1865
  flexColumn?: boolean | undefined;
1866
1866
  gap?: string | number | undefined;
@@ -1892,7 +1892,7 @@ declare class Board extends Group<typeof boardProps> {
1892
1892
  gridGap?: string | number | undefined;
1893
1893
  flexDirection?: "row" | "column" | undefined;
1894
1894
  alignItems?: "center" | "start" | "end" | "stretch" | undefined;
1895
- justifyContent?: "center" | "start" | "end" | "stretch" | undefined;
1895
+ justifyContent?: "center" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly" | undefined;
1896
1896
  flexRow?: boolean | undefined;
1897
1897
  flexColumn?: boolean | undefined;
1898
1898
  gap?: string | number | undefined;
package/dist/index.js CHANGED
@@ -4683,45 +4683,56 @@ var createSchematicTraceCrossingSegments = ({
4683
4683
  };
4684
4684
 
4685
4685
  // lib/components/primitive-components/Trace/trace-utils/create-schematic-trace-junctions.ts
4686
+ var TOLERANCE = 1e-3;
4687
+ var isPointWithinEdge = (point, edge) => {
4688
+ const minX = Math.min(edge.from.x, edge.to.x);
4689
+ const maxX = Math.max(edge.from.x, edge.to.x);
4690
+ const minY = Math.min(edge.from.y, edge.to.y);
4691
+ const maxY = Math.max(edge.from.y, edge.to.y);
4692
+ return point.x >= minX && point.x <= maxX && point.y >= minY && point.y <= maxY;
4693
+ };
4694
+ var getEdgeOrientation = (edge) => {
4695
+ const isVertical = Math.abs(edge.from.x - edge.to.x) < TOLERANCE;
4696
+ const isHorizontal = Math.abs(edge.from.y - edge.to.y) < TOLERANCE;
4697
+ if (isVertical) return "vertical";
4698
+ if (isHorizontal) return "horizontal";
4699
+ return "diagonal";
4700
+ };
4686
4701
  var getIntersectionPoint = (edge1, edge2) => {
4687
- if (edge1.from.x === edge1.to.x && edge2.from.x === edge2.to.x) {
4688
- return null;
4689
- }
4690
- if (edge1.from.x === edge1.to.x) {
4691
- const x2 = edge1.from.x;
4692
- const m22 = (edge2.to.y - edge2.from.y) / (edge2.to.x - edge2.from.x);
4693
- const b22 = edge2.from.y - m22 * edge2.from.x;
4694
- const y2 = m22 * x2 + b22;
4695
- if (x2 >= Math.min(edge2.from.x, edge2.to.x) && x2 <= Math.max(edge2.from.x, edge2.to.x) && y2 >= Math.min(edge2.from.y, edge2.to.y) && y2 <= Math.max(edge2.from.y, edge2.to.y)) {
4696
- return { x: x2, y: y2 };
4697
- }
4702
+ const orientation1 = getEdgeOrientation(edge1);
4703
+ const orientation2 = getEdgeOrientation(edge2);
4704
+ if (orientation1 === orientation2) {
4698
4705
  return null;
4699
4706
  }
4700
- if (edge2.from.x === edge2.to.x) {
4701
- const x2 = edge2.from.x;
4702
- const m12 = (edge1.to.y - edge1.from.y) / (edge1.to.x - edge1.from.x);
4703
- const b12 = edge1.from.y - m12 * edge1.from.x;
4704
- const y2 = m12 * x2 + b12;
4705
- if (x2 >= Math.min(edge1.from.x, edge1.to.x) && x2 <= Math.max(edge1.from.x, edge1.to.x) && y2 >= Math.min(edge1.from.y, edge1.to.y) && y2 <= Math.max(edge1.from.y, edge1.to.y)) {
4706
- return { x: x2, y: y2 };
4707
- }
4708
- return null;
4707
+ if (orientation1 === "vertical" && orientation2 === "horizontal" || orientation1 === "horizontal" && orientation2 === "vertical") {
4708
+ const verticalEdge = orientation1 === "vertical" ? edge1 : edge2;
4709
+ const horizontalEdge = orientation1 === "horizontal" ? edge1 : edge2;
4710
+ const x2 = verticalEdge.from.x;
4711
+ const y2 = horizontalEdge.from.y;
4712
+ const intersection2 = { x: x2, y: y2 };
4713
+ return isPointWithinEdge(intersection2, edge1) && isPointWithinEdge(intersection2, edge2) ? intersection2 : null;
4714
+ }
4715
+ if (orientation1 === "vertical" || orientation2 === "vertical") {
4716
+ const verticalEdge = orientation1 === "vertical" ? edge1 : edge2;
4717
+ const diagonalEdge = orientation1 === "vertical" ? edge2 : edge1;
4718
+ const x2 = verticalEdge.from.x;
4719
+ const m = (diagonalEdge.to.y - diagonalEdge.from.y) / (diagonalEdge.to.x - diagonalEdge.from.x);
4720
+ const b = diagonalEdge.from.y - m * diagonalEdge.from.x;
4721
+ const y2 = m * x2 + b;
4722
+ const intersection2 = { x: x2, y: y2 };
4723
+ return isPointWithinEdge(intersection2, edge1) && isPointWithinEdge(intersection2, edge2) ? intersection2 : null;
4709
4724
  }
4710
4725
  const m1 = (edge1.to.y - edge1.from.y) / (edge1.to.x - edge1.from.x);
4711
4726
  const b1 = edge1.from.y - m1 * edge1.from.x;
4712
4727
  const m2 = (edge2.to.y - edge2.from.y) / (edge2.to.x - edge2.from.x);
4713
4728
  const b2 = edge2.from.y - m2 * edge2.from.x;
4714
- if (m1 === m2) {
4729
+ if (Math.abs(m1 - m2) < TOLERANCE) {
4715
4730
  return null;
4716
4731
  }
4717
4732
  const x = (b2 - b1) / (m1 - m2);
4718
4733
  const y = m1 * x + b1;
4719
- const isWithinEdge1 = x >= Math.min(edge1.from.x, edge1.to.x) && x <= Math.max(edge1.from.x, edge1.to.x) && y >= Math.min(edge1.from.y, edge1.to.y) && y <= Math.max(edge1.from.y, edge1.to.y);
4720
- const isWithinEdge2 = x >= Math.min(edge2.from.x, edge2.to.x) && x <= Math.max(edge2.from.x, edge2.to.x) && y >= Math.min(edge2.from.y, edge2.to.y) && y <= Math.max(edge2.from.y, edge2.to.y);
4721
- if (isWithinEdge1 && isWithinEdge2) {
4722
- return { x, y };
4723
- }
4724
- return null;
4734
+ const intersection = { x, y };
4735
+ return isPointWithinEdge(intersection, edge1) && isPointWithinEdge(intersection, edge2) ? intersection : null;
4725
4736
  };
4726
4737
  var createSchematicTraceJunctions = ({
4727
4738
  edges: myEdges,
@@ -4733,17 +4744,19 @@ var createSchematicTraceJunctions = ({
4733
4744
  source_trace_id,
4734
4745
  sameNetOnly: true
4735
4746
  }).flatMap((t) => t.edges);
4736
- const junctions = /* @__PURE__ */ new Set();
4747
+ const junctions = /* @__PURE__ */ new Map();
4737
4748
  for (const myEdge of myEdges) {
4738
4749
  for (const otherEdge of otherEdges) {
4739
4750
  const intersection = getIntersectionPoint(myEdge, otherEdge);
4740
4751
  if (intersection) {
4741
- const pointKey = `${intersection.x},${intersection.y}`;
4742
- return [{ x: intersection.x, y: intersection.y }];
4752
+ const key = `${intersection.x.toFixed(6)},${intersection.y.toFixed(6)}`;
4753
+ if (!junctions.has(key)) {
4754
+ junctions.set(key, intersection);
4755
+ }
4743
4756
  }
4744
4757
  }
4745
4758
  }
4746
- return [];
4759
+ return Array.from(junctions.values());
4747
4760
  };
4748
4761
 
4749
4762
  // lib/components/primitive-components/Trace/trace-utils/get-obstacles-for-trace.ts
@@ -8090,11 +8103,12 @@ import { buildSubtree as buildSubtree3 } from "@tscircuit/circuit-json-util";
8090
8103
  import { layoutCircuitJsonWithFlex } from "@tscircuit/circuit-json-flex";
8091
8104
  var Group_doInitialPcbLayoutFlex = (group) => {
8092
8105
  const { db } = group.root;
8093
- const subtreeCircuitJson = buildSubtree3(db.toArray(), {
8106
+ const { _parsedProps: props } = group;
8107
+ const circuitJson = group.lowercaseComponentName === "board" ? db.toArray() : buildSubtree3(db.toArray(), {
8094
8108
  source_group_id: group.source_group_id
8095
8109
  });
8096
- const modifiedCircuitJson = layoutCircuitJsonWithFlex(subtreeCircuitJson, {
8097
- justifyContent: "space-between"
8110
+ const modifiedCircuitJson = layoutCircuitJsonWithFlex(circuitJson, {
8111
+ justifyContent: props.justifyContent === "start" ? "flex-start" : props.justifyContent === "end" ? "flex-end" : props.justifyContent === "stretch" ? "space-between" : props.justifyContent
8098
8112
  });
8099
8113
  const pcbSmtPads = db.pcb_smtpad.list();
8100
8114
  for (const smtpad of pcbSmtPads) {
@@ -11102,7 +11116,7 @@ import { identity as identity5 } from "transformation-matrix";
11102
11116
  var package_default = {
11103
11117
  name: "@tscircuit/core",
11104
11118
  type: "module",
11105
- version: "0.0.577",
11119
+ version: "0.0.579",
11106
11120
  types: "dist/index.d.ts",
11107
11121
  main: "dist/index.js",
11108
11122
  module: "dist/index.js",
@@ -11134,7 +11148,7 @@ var package_default = {
11134
11148
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
11135
11149
  "@tscircuit/log-soup": "^1.0.2",
11136
11150
  "@tscircuit/math-utils": "^0.0.18",
11137
- "@tscircuit/props": "^0.0.264",
11151
+ "@tscircuit/props": "^0.0.265",
11138
11152
  "@tscircuit/schematic-autolayout": "^0.0.6",
11139
11153
  "@tscircuit/schematic-corpus": "^0.0.52",
11140
11154
  "@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.578",
4
+ "version": "0.0.580",
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/infgrid-ijump-astar": "^0.0.33",
34
34
  "@tscircuit/log-soup": "^1.0.2",
35
35
  "@tscircuit/math-utils": "^0.0.18",
36
- "@tscircuit/props": "^0.0.264",
36
+ "@tscircuit/props": "^0.0.265",
37
37
  "@tscircuit/schematic-autolayout": "^0.0.6",
38
38
  "@tscircuit/schematic-corpus": "^0.0.52",
39
39
  "@tscircuit/schematic-match-adapt": "^0.0.16",