@tscircuit/core 0.0.37 → 0.0.39

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 } from '@tscircuit/props';
9
+ import { traceProps, groupProps, boardProps, footprintProps, smtPadProps, resistorProps, ledProps, diodeProps, capacitorProps, traceHintProps, chipProps, jumperProps, silkscreenPathProps, platedHoleProps, constraintProps, holeProps, silkscreenTextProps } from '@tscircuit/props';
10
10
 
11
11
  declare class Circuit {
12
12
  firstChild: PrimitiveComponent | null;
@@ -4005,6 +4005,10 @@ declare class Hole extends PrimitiveComponent<typeof holeProps> {
4005
4005
  }): void;
4006
4006
  }
4007
4007
 
4008
+ declare class SilkscreenText extends PrimitiveComponent<typeof silkscreenTextProps> {
4009
+ doInitialPcbPrimitiveRender(): void;
4010
+ }
4011
+
4008
4012
  declare global {
4009
4013
  namespace JSX {
4010
4014
  interface IntrinsicElements {
@@ -4050,4 +4054,4 @@ declare global {
4050
4054
  }
4051
4055
  }
4052
4056
 
4053
- export { Board, Capacitor, Chip, Circuit, Constraint, Diode, Footprint, Group, Hole, type IRenderable, Jumper, Led, Net, NormalComponent, PlatedHole, Port, PrimitiveComponent, Project, Renderable, Resistor, SilkscreenPath, SmtPad, Trace, TraceHint };
4057
+ export { Board, Capacitor, Chip, Circuit, Constraint, Diode, Footprint, Group, Hole, type IRenderable, Jumper, Led, Net, NormalComponent, PlatedHole, Port, PrimitiveComponent, Project, Renderable, Resistor, SilkscreenPath, SilkscreenText, SmtPad, Trace, TraceHint };
package/dist/index.js CHANGED
@@ -25,6 +25,7 @@ __export(components_exports, {
25
25
  Renderable: () => Renderable,
26
26
  Resistor: () => Resistor,
27
27
  SilkscreenPath: () => SilkscreenPath,
28
+ SilkscreenText: () => SilkscreenText,
28
29
  SmtPad: () => SmtPad,
29
30
  Trace: () => Trace,
30
31
  TraceHint: () => TraceHint
@@ -922,7 +923,7 @@ var hostConfig = {
922
923
  );
923
924
  }
924
925
  throw new Error(
925
- `Unsupported component type (not registered in @tscircuit/core catalogue): ${type}`
926
+ `Unsupported component type (not registered in @tscircuit/core catalogue): "${type}" See CREATING_NEW_COMPONENTS.md`
926
927
  );
927
928
  }
928
929
  const instance = prepare(new target(props), {});
@@ -3111,6 +3112,28 @@ var Hole = class extends PrimitiveComponent {
3111
3112
  }
3112
3113
  };
3113
3114
 
3115
+ // lib/components/primitive-components/SilkscreenText.ts
3116
+ import "@tscircuit/props";
3117
+ var SilkscreenText = class extends PrimitiveComponent {
3118
+ doInitialPcbPrimitiveRender() {
3119
+ const { db } = this.root;
3120
+ const { _parsedProps: props } = this;
3121
+ const container = this.getPrimitiveContainer();
3122
+ db.pcb_silkscreen_text.insert({
3123
+ anchor_alignment: props.anchorAlignment,
3124
+ anchor_position: {
3125
+ x: props.pcbX ?? 0,
3126
+ y: props.pcbY ?? 0
3127
+ },
3128
+ font: props.font ?? "tscircuit2024",
3129
+ font_size: props.fontSize ?? 1,
3130
+ layer: "top",
3131
+ text: props.text ?? "",
3132
+ pcb_component_id: container.pcb_component_id
3133
+ });
3134
+ }
3135
+ };
3136
+
3114
3137
  // lib/Project.ts
3115
3138
  import { su } from "@tscircuit/soup-util";
3116
3139
  import { isValidElement as isValidElement2 } from "react";
@@ -3230,6 +3253,7 @@ export {
3230
3253
  Renderable,
3231
3254
  Resistor,
3232
3255
  SilkscreenPath,
3256
+ SilkscreenText,
3233
3257
  SmtPad,
3234
3258
  Trace,
3235
3259
  TraceHint
@@ -19,3 +19,4 @@ export { SilkscreenPath } from "./primitive-components/SilkscreenPath"
19
19
  export { PlatedHole } from "./primitive-components/PlatedHole"
20
20
  export { Constraint } from "./primitive-components/Constraint"
21
21
  export { Hole } from "./primitive-components/Hole"
22
+ export { SilkscreenText } from "./primitive-components/SilkscreenText"
@@ -0,0 +1,25 @@
1
+ import { PrimitiveComponent } from "../base-components/PrimitiveComponent"
2
+ import { silkscreenTextProps } from "@tscircuit/props"
3
+
4
+ export class SilkscreenText extends PrimitiveComponent<
5
+ typeof silkscreenTextProps
6
+ > {
7
+ doInitialPcbPrimitiveRender(): void {
8
+ const { db } = this.root!
9
+ const { _parsedProps: props } = this
10
+ const container = this.getPrimitiveContainer()!
11
+
12
+ db.pcb_silkscreen_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
+ }
@@ -53,7 +53,7 @@ const hostConfig: HostConfig<
53
53
  )
54
54
  }
55
55
  throw new Error(
56
- `Unsupported component type (not registered in @tscircuit/core catalogue): ${type}`,
56
+ `Unsupported component type (not registered in @tscircuit/core catalogue): "${type}" See CREATING_NEW_COMPONENTS.md`,
57
57
  )
58
58
  }
59
59
 
@@ -1,8 +1,12 @@
1
1
  import * as Components from "./components"
2
2
  import { extendCatalogue } from "./fiber/catalogue"
3
+
4
+ // Register all components, generally you don't need to manually
5
+ // register a component, as long as it's exported from lib/components
6
+ // it'll automatically be registered!
3
7
  extendCatalogue(Components)
4
8
 
5
- // Aliases
9
+ // Aliases (only when class name is different than the name of the component)
6
10
  extendCatalogue({
7
11
  Bug: Components.Chip,
8
12
  })
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.37",
5
+ "version": "0.0.39",
6
6
  "types": "dist/index.d.ts",
7
7
  "main": "dist/index.js",
8
8
  "files": [