@tscircuit/core 0.0.473 → 0.0.475

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
@@ -1067,6 +1067,7 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
1067
1067
  _getPcbLayoutMode(): "grid" | "flex" | "match-adapt" | "none";
1068
1068
  doInitialPcbLayout(): void;
1069
1069
  _doInitialPcbLayoutGrid(): void;
1070
+ _insertSchematicBorder(): void;
1070
1071
  _determineSideFromPosition(port: SchematicPort, component: SchematicComponent): "left" | "right" | "top" | "bottom";
1071
1072
  _calculateSchematicBounds(boxes: Array<{
1072
1073
  centerX: number;
@@ -1248,7 +1249,7 @@ declare class Board extends Group<typeof boardProps> {
1248
1249
  matchAdapt?: boolean | undefined;
1249
1250
  matchAdaptTemplate?: any;
1250
1251
  }>>;
1251
- cellBorder: zod.ZodOptional<zod.ZodObject<{
1252
+ cellBorder: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{
1252
1253
  strokeWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
1253
1254
  dashed: zod.ZodOptional<zod.ZodBoolean>;
1254
1255
  solid: zod.ZodOptional<zod.ZodBoolean>;
@@ -1260,7 +1261,25 @@ declare class Board extends Group<typeof boardProps> {
1260
1261
  strokeWidth?: string | number | undefined;
1261
1262
  dashed?: boolean | undefined;
1262
1263
  solid?: boolean | undefined;
1263
- }>>;
1264
+ }>>>;
1265
+ border: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{
1266
+ strokeWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
1267
+ dashed: zod.ZodOptional<zod.ZodBoolean>;
1268
+ solid: zod.ZodOptional<zod.ZodBoolean>;
1269
+ }, "strip", zod.ZodTypeAny, {
1270
+ strokeWidth?: number | undefined;
1271
+ dashed?: boolean | undefined;
1272
+ solid?: boolean | undefined;
1273
+ }, {
1274
+ strokeWidth?: string | number | undefined;
1275
+ dashed?: boolean | undefined;
1276
+ solid?: boolean | undefined;
1277
+ }>>>;
1278
+ schPadding: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
1279
+ schPaddingLeft: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
1280
+ schPaddingRight: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
1281
+ schPaddingTop: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
1282
+ schPaddingBottom: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
1264
1283
  layoutMode: zod.ZodOptional<zod.ZodEnum<["grid", "flex", "match-adapt", "none"]>>;
1265
1284
  position: zod.ZodOptional<zod.ZodEnum<["absolute", "relative"]>>;
1266
1285
  grid: zod.ZodOptional<zod.ZodBoolean>;
@@ -1585,7 +1604,17 @@ declare class Board extends Group<typeof boardProps> {
1585
1604
  strokeWidth?: number | undefined;
1586
1605
  dashed?: boolean | undefined;
1587
1606
  solid?: boolean | undefined;
1588
- } | undefined;
1607
+ } | null | undefined;
1608
+ border?: {
1609
+ strokeWidth?: number | undefined;
1610
+ dashed?: boolean | undefined;
1611
+ solid?: boolean | undefined;
1612
+ } | null | undefined;
1613
+ schPadding?: number | undefined;
1614
+ schPaddingLeft?: number | undefined;
1615
+ schPaddingRight?: number | undefined;
1616
+ schPaddingTop?: number | undefined;
1617
+ schPaddingBottom?: number | undefined;
1589
1618
  layout?: _tscircuit_layout.LayoutBuilder | undefined;
1590
1619
  manualEdits?: {
1591
1620
  pcb_placements?: {
@@ -1724,7 +1753,17 @@ declare class Board extends Group<typeof boardProps> {
1724
1753
  strokeWidth?: string | number | undefined;
1725
1754
  dashed?: boolean | undefined;
1726
1755
  solid?: boolean | undefined;
1727
- } | undefined;
1756
+ } | null | undefined;
1757
+ border?: {
1758
+ strokeWidth?: string | number | undefined;
1759
+ dashed?: boolean | undefined;
1760
+ solid?: boolean | undefined;
1761
+ } | null | undefined;
1762
+ schPadding?: string | number | undefined;
1763
+ schPaddingLeft?: string | number | undefined;
1764
+ schPaddingRight?: string | number | undefined;
1765
+ schPaddingTop?: string | number | undefined;
1766
+ schPaddingBottom?: string | number | undefined;
1728
1767
  layout?: _tscircuit_layout.LayoutBuilder | undefined;
1729
1768
  manualEdits?: {
1730
1769
  pcb_placements?: {
@@ -7237,7 +7276,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
7237
7276
  isPcbPrimitive: boolean;
7238
7277
  get config(): {
7239
7278
  componentName: string;
7240
- zodProps: zod.ZodEffects<zod.ZodUnion<[zod.ZodObject<Omit<{
7279
+ zodProps: zod.ZodEffects<zod.ZodDiscriminatedUnion<"shape", [zod.ZodObject<Omit<{
7241
7280
  pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
7242
7281
  pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
7243
7282
  pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
@@ -7366,7 +7405,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
7366
7405
  portHints?: (string | number)[] | undefined;
7367
7406
  innerWidth?: string | number | undefined;
7368
7407
  innerHeight?: string | number | undefined;
7369
- }>, zod.ZodEffects<zod.ZodObject<Omit<{
7408
+ }>, zod.ZodObject<Omit<{
7370
7409
  pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
7371
7410
  pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
7372
7411
  pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
@@ -7381,54 +7420,32 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
7381
7420
  }>>;
7382
7421
  }, "pcbRotation" | "layer"> & {
7383
7422
  name: zod.ZodOptional<zod.ZodString>;
7423
+ shape: zod.ZodLiteral<"circular_hole_with_rect_pad">;
7384
7424
  holeDiameter: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
7385
7425
  rectPadWidth: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
7386
7426
  rectPadHeight: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
7387
7427
  holeShape: zod.ZodOptional<zod.ZodLiteral<"circle">>;
7388
7428
  padShape: zod.ZodOptional<zod.ZodLiteral<"rect">>;
7389
- shape: zod.ZodOptional<zod.ZodLiteral<"circular_hole_with_rect_pad">>;
7390
7429
  portHints: zod.ZodOptional<zod.ZodArray<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, "many">>;
7391
7430
  }, "strip", zod.ZodTypeAny, {
7431
+ shape: "circular_hole_with_rect_pad";
7392
7432
  holeDiameter: number;
7393
7433
  rectPadWidth: number;
7394
7434
  rectPadHeight: number;
7395
7435
  pcbX?: number | undefined;
7396
7436
  pcbY?: number | undefined;
7397
7437
  name?: string | undefined;
7398
- shape?: "circular_hole_with_rect_pad" | undefined;
7399
- portHints?: (string | number)[] | undefined;
7400
- holeShape?: "circle" | undefined;
7401
- padShape?: "rect" | undefined;
7402
- }, {
7403
- holeDiameter: string | number;
7404
- rectPadWidth: string | number;
7405
- rectPadHeight: string | number;
7406
- pcbX?: string | number | undefined;
7407
- pcbY?: string | number | undefined;
7408
- name?: string | undefined;
7409
- shape?: "circular_hole_with_rect_pad" | undefined;
7410
- portHints?: (string | number)[] | undefined;
7411
- holeShape?: "circle" | undefined;
7412
- padShape?: "rect" | undefined;
7413
- }>, {
7414
- holeDiameter: number;
7415
- rectPadWidth: number;
7416
- rectPadHeight: number;
7417
- pcbX?: number | undefined;
7418
- pcbY?: number | undefined;
7419
- name?: string | undefined;
7420
- shape?: "circular_hole_with_rect_pad" | undefined;
7421
7438
  portHints?: (string | number)[] | undefined;
7422
7439
  holeShape?: "circle" | undefined;
7423
7440
  padShape?: "rect" | undefined;
7424
7441
  }, {
7442
+ shape: "circular_hole_with_rect_pad";
7425
7443
  holeDiameter: string | number;
7426
7444
  rectPadWidth: string | number;
7427
7445
  rectPadHeight: string | number;
7428
7446
  pcbX?: string | number | undefined;
7429
7447
  pcbY?: string | number | undefined;
7430
7448
  name?: string | undefined;
7431
- shape?: "circular_hole_with_rect_pad" | undefined;
7432
7449
  portHints?: (string | number)[] | undefined;
7433
7450
  holeShape?: "circle" | undefined;
7434
7451
  padShape?: "rect" | undefined;
@@ -7512,13 +7529,13 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
7512
7529
  innerWidth?: number | undefined;
7513
7530
  innerHeight?: number | undefined;
7514
7531
  } | {
7532
+ shape: "circular_hole_with_rect_pad";
7515
7533
  holeDiameter: number;
7516
7534
  rectPadWidth: number;
7517
7535
  rectPadHeight: number;
7518
7536
  pcbX?: number | undefined;
7519
7537
  pcbY?: number | undefined;
7520
7538
  name?: string | undefined;
7521
- shape?: "circular_hole_with_rect_pad" | undefined;
7522
7539
  portHints?: (string | number)[] | undefined;
7523
7540
  holeShape?: "circle" | undefined;
7524
7541
  padShape?: "rect" | undefined;
@@ -7567,13 +7584,13 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
7567
7584
  innerWidth?: string | number | undefined;
7568
7585
  innerHeight?: string | number | undefined;
7569
7586
  } | {
7587
+ shape: "circular_hole_with_rect_pad";
7570
7588
  holeDiameter: string | number;
7571
7589
  rectPadWidth: string | number;
7572
7590
  rectPadHeight: string | number;
7573
7591
  pcbX?: string | number | undefined;
7574
7592
  pcbY?: string | number | undefined;
7575
7593
  name?: string | undefined;
7576
- shape?: "circular_hole_with_rect_pad" | undefined;
7577
7594
  portHints?: (string | number)[] | undefined;
7578
7595
  holeShape?: "circle" | undefined;
7579
7596
  padShape?: "rect" | undefined;
package/dist/index.js CHANGED
@@ -5904,7 +5904,7 @@ import "@tscircuit/schematic-autolayout";
5904
5904
  import { CapacityMeshSolver } from "@tscircuit/capacity-autorouter";
5905
5905
 
5906
5906
  // lib/errors/AutorouterError.ts
5907
- import packageJson from "@tscircuit/capacity-autorouter/package.json";
5907
+ import packageJson from "@tscircuit/capacity-autorouter/package.json" with { type: "json" };
5908
5908
  var autorouterVersion = packageJson.version ?? "unknown";
5909
5909
  var AutorouterError = class extends Error {
5910
5910
  constructor(message) {
@@ -7639,6 +7639,7 @@ var Group = class extends NormalComponent {
7639
7639
  if (schematicLayoutMode === "grid") {
7640
7640
  this._doInitialSchematicLayoutGrid();
7641
7641
  }
7642
+ this._insertSchematicBorder();
7642
7643
  }
7643
7644
  _doInitialSchematicLayoutMatchAdapt() {
7644
7645
  Group_doInitialSchematicLayoutMatchAdapt(this);
@@ -7665,6 +7666,41 @@ var Group = class extends NormalComponent {
7665
7666
  _doInitialPcbLayoutGrid() {
7666
7667
  Group_doInitialPcbLayoutGrid(this);
7667
7668
  }
7669
+ _insertSchematicBorder() {
7670
+ if (this.root?.schematicDisabled) return;
7671
+ const { db } = this.root;
7672
+ const props = this._parsedProps;
7673
+ if (!props.border) return;
7674
+ let width = typeof props.schWidth === "number" ? props.schWidth : void 0;
7675
+ let height = typeof props.schHeight === "number" ? props.schHeight : void 0;
7676
+ const paddingGeneral = typeof props.schPadding === "number" ? props.schPadding : 0;
7677
+ const paddingLeft = typeof props.schPaddingLeft === "number" ? props.schPaddingLeft : paddingGeneral;
7678
+ const paddingRight = typeof props.schPaddingRight === "number" ? props.schPaddingRight : paddingGeneral;
7679
+ const paddingTop = typeof props.schPaddingTop === "number" ? props.schPaddingTop : paddingGeneral;
7680
+ const paddingBottom = typeof props.schPaddingBottom === "number" ? props.schPaddingBottom : paddingGeneral;
7681
+ const schematicGroup = this.schematic_group_id ? db.schematic_group.get(this.schematic_group_id) : null;
7682
+ if (schematicGroup) {
7683
+ if (width === void 0 && typeof schematicGroup.width === "number") {
7684
+ width = schematicGroup.width;
7685
+ }
7686
+ if (height === void 0 && typeof schematicGroup.height === "number") {
7687
+ height = schematicGroup.height;
7688
+ }
7689
+ }
7690
+ if (width === void 0 || height === void 0) return;
7691
+ const center = schematicGroup?.center ?? this._getGlobalSchematicPositionBeforeLayout();
7692
+ const left = center.x - width / 2 - paddingLeft;
7693
+ const bottom = center.y - height / 2 - paddingBottom;
7694
+ const finalWidth = width + paddingLeft + paddingRight;
7695
+ const finalHeight = height + paddingTop + paddingBottom;
7696
+ db.schematic_box.insert({
7697
+ width: finalWidth,
7698
+ height: finalHeight,
7699
+ x: left,
7700
+ y: bottom,
7701
+ is_dashed: props.border?.dashed ?? false
7702
+ });
7703
+ }
7668
7704
  _determineSideFromPosition(port, component) {
7669
7705
  if (!port.center || !component.center) return "left";
7670
7706
  const dx = port.center.x - component.center.x;
@@ -9801,8 +9837,7 @@ var SchematicBox = class extends PrimitiveComponent2 {
9801
9837
  width,
9802
9838
  x,
9803
9839
  y,
9804
- is_dashed: props.strokeStyle === "dashed",
9805
- schematic_component_id: ""
9840
+ is_dashed: props.strokeStyle === "dashed"
9806
9841
  });
9807
9842
  if (props.title) {
9808
9843
  const isInside = props.titleInside ?? false;
@@ -9852,7 +9887,7 @@ import { identity as identity4 } from "transformation-matrix";
9852
9887
  var package_default = {
9853
9888
  name: "@tscircuit/core",
9854
9889
  type: "module",
9855
- version: "0.0.472",
9890
+ version: "0.0.474",
9856
9891
  types: "dist/index.d.ts",
9857
9892
  main: "dist/index.js",
9858
9893
  module: "dist/index.js",
@@ -9884,7 +9919,7 @@ var package_default = {
9884
9919
  "@tscircuit/layout": "^0.0.28",
9885
9920
  "@tscircuit/log-soup": "^1.0.2",
9886
9921
  "@tscircuit/math-utils": "^0.0.18",
9887
- "@tscircuit/props": "^0.0.222",
9922
+ "@tscircuit/props": "^0.0.227",
9888
9923
  "@tscircuit/schematic-autolayout": "^0.0.6",
9889
9924
  "@tscircuit/schematic-match-adapt": "^0.0.16",
9890
9925
  "@tscircuit/simple-3d-svg": "^0.0.6",
@@ -9895,7 +9930,7 @@ var package_default = {
9895
9930
  "@types/react-reconciler": "^0.28.9",
9896
9931
  "bun-match-svg": "0.0.8",
9897
9932
  "chokidar-cli": "^3.0.0",
9898
- "circuit-json": "^0.0.204",
9933
+ "circuit-json": "^0.0.210",
9899
9934
  "circuit-json-to-connectivity-map": "^0.0.22",
9900
9935
  "circuit-json-to-simple-3d": "^0.0.2",
9901
9936
  "circuit-to-svg": "^0.0.151",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.473",
4
+ "version": "0.0.475",
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/layout": "^0.0.28",
34
34
  "@tscircuit/log-soup": "^1.0.2",
35
35
  "@tscircuit/math-utils": "^0.0.18",
36
- "@tscircuit/props": "^0.0.222",
36
+ "@tscircuit/props": "^0.0.227",
37
37
  "@tscircuit/schematic-autolayout": "^0.0.6",
38
38
  "@tscircuit/schematic-match-adapt": "^0.0.16",
39
39
  "@tscircuit/simple-3d-svg": "^0.0.6",
@@ -44,7 +44,7 @@
44
44
  "@types/react-reconciler": "^0.28.9",
45
45
  "bun-match-svg": "0.0.8",
46
46
  "chokidar-cli": "^3.0.0",
47
- "circuit-json": "^0.0.204",
47
+ "circuit-json": "^0.0.210",
48
48
  "circuit-json-to-connectivity-map": "^0.0.22",
49
49
  "circuit-json-to-simple-3d": "^0.0.2",
50
50
  "circuit-to-svg": "^0.0.151",