@tscircuit/core 0.0.54 → 0.0.55

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, diodeProps, capacitorProps, traceHintProps, chipProps, jumperProps, silkscreenPathProps, platedHoleProps, constraintProps, holeProps, silkscreenTextProps, pcbKeepoutProps } from '@tscircuit/props';
9
+ import { traceProps, groupProps, boardProps, footprintProps, smtPadProps, resistorProps, ledProps, diodeProps, capacitorProps, traceHintProps, chipProps, jumperProps, silkscreenPathProps, platedHoleProps, constraintProps, holeProps, silkscreenTextProps, pcbKeepoutProps, fabricationNoteTextProps, fabricationNotePathProps } from '@tscircuit/props';
10
10
 
11
11
  declare class Circuit {
12
12
  firstChild: PrimitiveComponent | null;
@@ -4106,6 +4106,86 @@ declare class Keepout extends PrimitiveComponent<typeof pcbKeepoutProps> {
4106
4106
  doInitialPcbPrimitiveRender(): void;
4107
4107
  }
4108
4108
 
4109
+ declare class FabricationNoteText extends PrimitiveComponent<typeof fabricationNoteTextProps> {
4110
+ doInitialPcbPrimitiveRender(): void;
4111
+ }
4112
+
4113
+ declare class FabricationNotePath extends PrimitiveComponent<typeof fabricationNotePathProps> {
4114
+ fabrication_note_path_id: string | null;
4115
+ get config(): {
4116
+ zodProps: zod.ZodObject<zod.objectUtil.extendShape<Omit<{
4117
+ pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
4118
+ pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
4119
+ pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
4120
+ layer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
4121
+ name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
4122
+ }, "strip", zod.ZodTypeAny, {
4123
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
4124
+ }, {
4125
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
4126
+ }>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
4127
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
4128
+ }>>;
4129
+ }, "pcbRotation" | "pcbX" | "pcbY">, {
4130
+ route: zod.ZodArray<zod.ZodObject<{
4131
+ x: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
4132
+ y: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
4133
+ via: zod.ZodOptional<zod.ZodBoolean>;
4134
+ to_layer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
4135
+ name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
4136
+ }, "strip", zod.ZodTypeAny, {
4137
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
4138
+ }, {
4139
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
4140
+ }>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
4141
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
4142
+ }>>;
4143
+ trace_width: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
4144
+ }, "strip", zod.ZodTypeAny, {
4145
+ x: number;
4146
+ y: number;
4147
+ trace_width?: number | undefined;
4148
+ via?: boolean | undefined;
4149
+ to_layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
4150
+ }, {
4151
+ x: string | number;
4152
+ y: string | number;
4153
+ trace_width?: string | number | undefined;
4154
+ via?: boolean | undefined;
4155
+ to_layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
4156
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
4157
+ } | undefined;
4158
+ }>, "many">;
4159
+ strokeWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
4160
+ }>, "strip", zod.ZodTypeAny, {
4161
+ route: {
4162
+ x: number;
4163
+ y: number;
4164
+ trace_width?: number | undefined;
4165
+ via?: boolean | undefined;
4166
+ to_layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
4167
+ }[];
4168
+ layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
4169
+ strokeWidth?: number | undefined;
4170
+ }, {
4171
+ route: {
4172
+ x: string | number;
4173
+ y: string | number;
4174
+ trace_width?: string | number | undefined;
4175
+ via?: boolean | undefined;
4176
+ to_layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
4177
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
4178
+ } | undefined;
4179
+ }[];
4180
+ layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
4181
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
4182
+ } | undefined;
4183
+ strokeWidth?: string | number | undefined;
4184
+ }>;
4185
+ };
4186
+ doInitialPcbPrimitiveRender(): void;
4187
+ }
4188
+
4109
4189
  declare global {
4110
4190
  namespace JSX {
4111
4191
  interface IntrinsicElements {
@@ -4152,4 +4232,4 @@ declare global {
4152
4232
  }
4153
4233
  }
4154
4234
 
4155
- export { Board, Capacitor, Chip, Circuit, Constraint, Diode, Footprint, Group, Hole, type IRenderable, Jumper, Keepout, Led, Net, NormalComponent, PlatedHole, Port, PrimitiveComponent, Project, Renderable, Resistor, SilkscreenPath, SilkscreenText, SmtPad, Trace, TraceHint };
4235
+ export { Board, Capacitor, Chip, Circuit, Constraint, Diode, FabricationNotePath, FabricationNoteText, Footprint, Group, Hole, type IRenderable, Jumper, Keepout, Led, Net, NormalComponent, PlatedHole, Port, PrimitiveComponent, Project, Renderable, Resistor, SilkscreenPath, SilkscreenText, SmtPad, Trace, TraceHint };
package/dist/index.js CHANGED
@@ -12,6 +12,8 @@ __export(components_exports, {
12
12
  Chip: () => Chip,
13
13
  Constraint: () => Constraint2,
14
14
  Diode: () => Diode,
15
+ FabricationNotePath: () => FabricationNotePath,
16
+ FabricationNoteText: () => FabricationNoteText,
15
17
  Footprint: () => Footprint,
16
18
  Group: () => Group,
17
19
  Hole: () => Hole,
@@ -3366,6 +3368,69 @@ var SilkscreenText = class extends PrimitiveComponent {
3366
3368
  }
3367
3369
  };
3368
3370
 
3371
+ // lib/components/primitive-components/FabricationNoteText.ts
3372
+ import "@tscircuit/props";
3373
+ var FabricationNoteText = class extends PrimitiveComponent {
3374
+ doInitialPcbPrimitiveRender() {
3375
+ const { db } = this.root;
3376
+ const { _parsedProps: props } = this;
3377
+ const container = this.getPrimitiveContainer();
3378
+ db.pcb_fabrication_note_text.insert({
3379
+ anchor_alignment: props.anchorAlignment,
3380
+ anchor_position: {
3381
+ x: props.pcbX ?? 0,
3382
+ y: props.pcbY ?? 0
3383
+ },
3384
+ font: props.font ?? "tscircuit2024",
3385
+ font_size: props.fontSize ?? 1,
3386
+ layer: "top",
3387
+ text: props.text ?? "",
3388
+ pcb_component_id: container.pcb_component_id
3389
+ });
3390
+ }
3391
+ };
3392
+
3393
+ // lib/components/primitive-components/FabricationNotePath.ts
3394
+ import { fabricationNotePathProps } from "@tscircuit/props";
3395
+ import { applyToPoint as applyToPoint5 } from "transformation-matrix";
3396
+ var FabricationNotePath = class extends PrimitiveComponent {
3397
+ fabrication_note_path_id = null;
3398
+ get config() {
3399
+ return {
3400
+ zodProps: fabricationNotePathProps
3401
+ };
3402
+ }
3403
+ doInitialPcbPrimitiveRender() {
3404
+ const { db } = this.root;
3405
+ const { _parsedProps: props } = this;
3406
+ const layer = props.layer ?? "top";
3407
+ if (layer !== "top" && layer !== "bottom") {
3408
+ throw new Error(
3409
+ `Invalid layer "${layer}" for SilkscreenPath. Must be "top" or "bottom".`
3410
+ );
3411
+ }
3412
+ const transform = this._computePcbGlobalTransformBeforeLayout();
3413
+ const fabrication_note_path = db.pcb_fabrication_note_path.insert({
3414
+ pcb_component_id: this.parent?.pcb_component_id,
3415
+ layer,
3416
+ route: props.route.map((p) => {
3417
+ const transformedPosition = applyToPoint5(transform, {
3418
+ x: p.x,
3419
+ y: p.y
3420
+ });
3421
+ return {
3422
+ ...p,
3423
+ x: transformedPosition.x,
3424
+ y: transformedPosition.y
3425
+ };
3426
+ }),
3427
+ stroke_width: props.strokeWidth ?? 0.1,
3428
+ fabrication_note_path_id: `fabrication_note_${Math.random().toString()}`
3429
+ });
3430
+ this.fabrication_note_path_id = fabrication_note_path.fabrication_note_path_id;
3431
+ }
3432
+ };
3433
+
3369
3434
  // lib/Project.ts
3370
3435
  import { su } from "@tscircuit/soup-util";
3371
3436
  import { isValidElement as isValidElement2 } from "react";
@@ -3471,6 +3536,8 @@ export {
3471
3536
  Circuit,
3472
3537
  Constraint2 as Constraint,
3473
3538
  Diode,
3539
+ FabricationNotePath,
3540
+ FabricationNoteText,
3474
3541
  Footprint,
3475
3542
  Group,
3476
3543
  Hole,
@@ -21,3 +21,5 @@ export { Constraint } from "./primitive-components/Constraint"
21
21
  export { Hole } from "./primitive-components/Hole"
22
22
  export { SilkscreenText } from "./primitive-components/SilkscreenText"
23
23
  export { Keepout } from "./primitive-components/Keepout"
24
+ export { FabricationNoteText } from "./primitive-components/FabricationNoteText"
25
+ export { FabricationNotePath } from "./primitive-components/FabricationNotePath"
@@ -0,0 +1,50 @@
1
+ import { fabricationNotePathProps } from "@tscircuit/props"
2
+ import { PrimitiveComponent } from "../base-components/PrimitiveComponent"
3
+ import { applyToPoint } from "transformation-matrix"
4
+
5
+ export class FabricationNotePath extends PrimitiveComponent<
6
+ typeof fabricationNotePathProps
7
+ > {
8
+ fabrication_note_path_id: string | null = null
9
+
10
+ get config() {
11
+ return {
12
+ zodProps: fabricationNotePathProps,
13
+ }
14
+ }
15
+
16
+ doInitialPcbPrimitiveRender(): void {
17
+ const { db } = this.root!
18
+ const { _parsedProps: props } = this
19
+
20
+ const layer = props.layer ?? "top"
21
+ if (layer !== "top" && layer !== "bottom") {
22
+ throw new Error(
23
+ `Invalid layer "${layer}" for SilkscreenPath. Must be "top" or "bottom".`,
24
+ )
25
+ }
26
+
27
+ const transform = this._computePcbGlobalTransformBeforeLayout()
28
+
29
+ const fabrication_note_path = db.pcb_fabrication_note_path.insert({
30
+ pcb_component_id: this.parent?.pcb_component_id!,
31
+ layer,
32
+ route: props.route.map((p) => {
33
+ const transformedPosition = applyToPoint(transform, {
34
+ x: p.x,
35
+ y: p.y,
36
+ })
37
+ return {
38
+ ...p,
39
+ x: transformedPosition.x,
40
+ y: transformedPosition.y,
41
+ }
42
+ }),
43
+ stroke_width: props.strokeWidth ?? 0.1,
44
+ fabrication_note_path_id: `fabrication_note_${Math.random().toString()}`,
45
+ })
46
+
47
+ this.fabrication_note_path_id =
48
+ fabrication_note_path.fabrication_note_path_id
49
+ }
50
+ }
@@ -0,0 +1,25 @@
1
+ import { PrimitiveComponent } from "../base-components/PrimitiveComponent"
2
+ import { fabricationNoteTextProps } from "@tscircuit/props"
3
+
4
+ export class FabricationNoteText extends PrimitiveComponent<
5
+ typeof fabricationNoteTextProps
6
+ > {
7
+ doInitialPcbPrimitiveRender(): void {
8
+ const { db } = this.root!
9
+ const { _parsedProps: props } = this
10
+ const container = this.getPrimitiveContainer()!
11
+
12
+ db.pcb_fabrication_note_text.insert({
13
+ anchor_alignment: props.anchorAlignment,
14
+ anchor_position: {
15
+ x: props.pcbX ?? 0,
16
+ y: props.pcbY ?? 0,
17
+ },
18
+ font: props.font ?? "tscircuit2024",
19
+ font_size: props.fontSize ?? 1,
20
+ layer: "top",
21
+ text: props.text ?? "",
22
+ pcb_component_id: container.pcb_component_id!,
23
+ })
24
+ }
25
+ }
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.54",
5
+ "version": "0.0.55",
6
6
  "types": "dist/index.d.ts",
7
7
  "main": "dist/index.js",
8
8
  "files": [