@tscircuit/core 0.0.31 → 0.0.32

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
@@ -6,7 +6,7 @@ import { ReactElement } from 'react';
6
6
  import { Matrix } from 'transformation-matrix';
7
7
  import { SchSymbol, BaseSymbolName } from 'schematic-symbols';
8
8
  import * as Props from '@tscircuit/props';
9
- import { traceProps, groupProps, boardProps, footprintProps, smtPadProps, resistorProps, ledProps, capacitorProps, traceHintProps, chipProps, jumperProps, silkscreenPathProps, platedHoleProps, constraintProps } from '@tscircuit/props';
9
+ import { traceProps, groupProps, boardProps, footprintProps, smtPadProps, resistorProps, ledProps, capacitorProps, traceHintProps, chipProps, jumperProps, silkscreenPathProps, platedHoleProps, constraintProps, holeProps } from '@tscircuit/props';
10
10
 
11
11
  declare class Circuit {
12
12
  firstChild: PrimitiveComponent | null;
@@ -3499,6 +3499,46 @@ declare class Constraint extends PrimitiveComponent<typeof constraintProps> {
3499
3499
  };
3500
3500
  }
3501
3501
 
3502
+ declare class Hole extends PrimitiveComponent<typeof holeProps> {
3503
+ pcb_hole_id: string | null;
3504
+ isPcbPrimitive: boolean;
3505
+ get config(): {
3506
+ zodProps: zod.ZodObject<zod.objectUtil.extendShape<Omit<{
3507
+ pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
3508
+ pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
3509
+ pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
3510
+ layer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
3511
+ name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
3512
+ }, "strip", zod.ZodTypeAny, {
3513
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
3514
+ }, {
3515
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
3516
+ }>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
3517
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
3518
+ }>>;
3519
+ }, "pcbRotation">, {
3520
+ holeDiameter: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
3521
+ }>, "strip", zod.ZodTypeAny, {
3522
+ holeDiameter: number;
3523
+ pcbX?: number | undefined;
3524
+ pcbY?: number | undefined;
3525
+ layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
3526
+ }, {
3527
+ holeDiameter: string | number;
3528
+ pcbX?: string | number | undefined;
3529
+ pcbY?: string | number | undefined;
3530
+ layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
3531
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
3532
+ } | undefined;
3533
+ }>;
3534
+ };
3535
+ getPcbSize(): {
3536
+ width: number;
3537
+ height: number;
3538
+ };
3539
+ doInitialPcbPrimitiveRender(): void;
3540
+ }
3541
+
3502
3542
  declare global {
3503
3543
  namespace JSX {
3504
3544
  interface IntrinsicElements {
@@ -3544,4 +3584,4 @@ declare global {
3544
3584
  }
3545
3585
  }
3546
3586
 
3547
- export { Board, Capacitor, Chip, Circuit, Constraint, Footprint, Group, type IRenderable, Jumper, Led, Net, NormalComponent, PlatedHole, Port, PrimitiveComponent, Project, Renderable, Resistor, SilkscreenPath, SmtPad, Trace, TraceHint };
3587
+ export { Board, Capacitor, Chip, Circuit, Constraint, Footprint, Group, Hole, type IRenderable, Jumper, Led, Net, NormalComponent, PlatedHole, Port, PrimitiveComponent, Project, Renderable, Resistor, SilkscreenPath, SmtPad, Trace, TraceHint };
package/dist/index.js CHANGED
@@ -13,6 +13,7 @@ __export(components_exports, {
13
13
  Constraint: () => Constraint2,
14
14
  Footprint: () => Footprint,
15
15
  Group: () => Group,
16
+ Hole: () => Hole,
16
17
  Jumper: () => Jumper,
17
18
  Led: () => Led,
18
19
  Net: () => Net,
@@ -2921,6 +2922,35 @@ var Constraint2 = class extends PrimitiveComponent {
2921
2922
  }
2922
2923
  };
2923
2924
 
2925
+ // lib/components/primitive-components/Hole.ts
2926
+ import { holeProps } from "@tscircuit/props";
2927
+ var Hole = class extends PrimitiveComponent {
2928
+ pcb_hole_id = null;
2929
+ isPcbPrimitive = true;
2930
+ get config() {
2931
+ return {
2932
+ zodProps: holeProps
2933
+ };
2934
+ }
2935
+ getPcbSize() {
2936
+ const { _parsedProps: props } = this;
2937
+ return { width: props.holeDiameter, height: props.holeDiameter };
2938
+ }
2939
+ doInitialPcbPrimitiveRender() {
2940
+ const { db } = this.root;
2941
+ const { _parsedProps: props } = this;
2942
+ const position = this._getGlobalPcbPositionBeforeLayout();
2943
+ const pcb_hole = {
2944
+ type: "pcb_hole",
2945
+ hole_shape: "round",
2946
+ hole_diameter: props.holeDiameter,
2947
+ x: position.x,
2948
+ y: position.y
2949
+ };
2950
+ const inserted_hole = db.pcb_hole.insert(pcb_hole);
2951
+ }
2952
+ };
2953
+
2924
2954
  // lib/Project.ts
2925
2955
  import { su } from "@tscircuit/soup-util";
2926
2956
  import { isValidElement as isValidElement2 } from "react";
@@ -3027,6 +3057,7 @@ export {
3027
3057
  Constraint2 as Constraint,
3028
3058
  Footprint,
3029
3059
  Group,
3060
+ Hole,
3030
3061
  Jumper,
3031
3062
  Led,
3032
3063
  Net,
@@ -17,3 +17,4 @@ export { Jumper } from "./normal-components/Jumper"
17
17
  export { SilkscreenPath } from "./primitive-components/SilkscreenPath"
18
18
  export { PlatedHole } from "./primitive-components/PlatedHole"
19
19
  export { Constraint } from "./primitive-components/Constraint"
20
+ export { Hole } from "./primitive-components/Hole"
@@ -0,0 +1,36 @@
1
+ import { PrimitiveComponent } from "../base-components/PrimitiveComponent"
2
+ import { holeProps } from "@tscircuit/props"
3
+ import type { PCBHole } from "@tscircuit/soup"
4
+
5
+ export class Hole extends PrimitiveComponent<typeof holeProps> {
6
+ pcb_hole_id: string | null = null
7
+ isPcbPrimitive = true
8
+
9
+ get config() {
10
+ return {
11
+ zodProps: holeProps,
12
+ }
13
+ }
14
+
15
+ getPcbSize(): { width: number; height: number } {
16
+ const { _parsedProps: props } = this
17
+ return { width: props.holeDiameter, height: props.holeDiameter }
18
+ }
19
+
20
+ doInitialPcbPrimitiveRender(): void {
21
+ const { db } = this.root!
22
+ const { _parsedProps: props } = this
23
+ const position = this._getGlobalPcbPositionBeforeLayout()
24
+
25
+ const pcb_hole: PCBHole = {
26
+ type: "pcb_hole",
27
+ hole_shape: "round",
28
+ hole_diameter: props.holeDiameter,
29
+ x: position.x,
30
+ y: position.y,
31
+ }
32
+
33
+ const inserted_hole = db.pcb_hole.insert(pcb_hole)
34
+ // this.pcb_hole_id = inserted_hole.pcb_hole_id!
35
+ }
36
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tscircuit/core",
3
3
  "module": "index.ts",
4
4
  "type": "module",
5
- "version": "0.0.31",
5
+ "version": "0.0.32",
6
6
  "types": "dist/index.d.ts",
7
7
  "main": "dist/index.js",
8
8
  "files": [