@tscircuit/core 0.0.790 → 0.0.791

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
@@ -1,7 +1,7 @@
1
1
  import * as circuit_json from 'circuit-json';
2
2
  import { PcbTraceError, PcbPlacementError, PcbManualEditConflictWarning, PcbViaClearanceError, LayerRef, AnyCircuitElement, Size, AnySourceComponent, PcbTraceRoutePoint, PcbTrace as PcbTrace$1, PcbVia, SchematicPort, SchematicComponent, RouteHintPoint, CircuitJson } from 'circuit-json';
3
3
  import * as _tscircuit_props from '@tscircuit/props';
4
- import { PlatformConfig, subcircuitGroupProps, AutorouterConfig, traceProps, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, solderjumperProps, ledProps, powerSourceProps, CommonComponentProps, resistorProps, constraintProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, subcircuitProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, copperPourProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicBoxProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, voltageProbeProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
4
+ import { PlatformConfig, subcircuitGroupProps, AutorouterConfig, traceProps, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, solderjumperProps, ledProps, powerSourceProps, CommonComponentProps, resistorProps, constraintProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNoteTextProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, subcircuitProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, copperPourProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicBoxProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, voltageProbeProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
5
5
  import * as react from 'react';
6
6
  import react__default, { ReactElement, DetailedHTMLProps, SVGProps } from 'react';
7
7
  export { createElement } from 'react';
@@ -18060,6 +18060,88 @@ declare class PcbNoteRect extends PrimitiveComponent<typeof pcbNoteRectProps> {
18060
18060
  };
18061
18061
  }
18062
18062
 
18063
+ declare class PcbNoteText extends PrimitiveComponent<typeof pcbNoteTextProps> {
18064
+ pcb_note_text_id: string | null;
18065
+ isPcbPrimitive: boolean;
18066
+ get config(): {
18067
+ componentName: string;
18068
+ zodProps: zod.ZodObject<{
18069
+ pcbX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
18070
+ pcbY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
18071
+ pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
18072
+ pcbPositionAnchor: zod.ZodOptional<zod.ZodString>;
18073
+ layer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
18074
+ name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
18075
+ }, "strip", zod.ZodTypeAny, {
18076
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
18077
+ }, {
18078
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
18079
+ }>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
18080
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
18081
+ }>>;
18082
+ pcbMarginTop: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
18083
+ pcbMarginRight: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
18084
+ pcbMarginBottom: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
18085
+ pcbMarginLeft: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
18086
+ pcbMarginX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
18087
+ pcbMarginY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
18088
+ pcbRelative: zod.ZodOptional<zod.ZodBoolean>;
18089
+ relative: zod.ZodOptional<zod.ZodBoolean>;
18090
+ } & {
18091
+ text: zod.ZodString;
18092
+ anchorAlignment: zod.ZodDefault<zod.ZodEnum<["center", "top_left", "top_right", "bottom_left", "bottom_right"]>>;
18093
+ font: zod.ZodOptional<zod.ZodEnum<["tscircuit2024"]>>;
18094
+ fontSize: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
18095
+ color: zod.ZodOptional<zod.ZodString>;
18096
+ }, "strip", zod.ZodTypeAny, {
18097
+ text: string;
18098
+ anchorAlignment: "top_left" | "top_right" | "center" | "bottom_left" | "bottom_right";
18099
+ pcbX?: number | undefined;
18100
+ pcbY?: number | undefined;
18101
+ pcbRotation?: number | undefined;
18102
+ pcbPositionAnchor?: string | undefined;
18103
+ layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
18104
+ pcbMarginTop?: number | undefined;
18105
+ pcbMarginRight?: number | undefined;
18106
+ pcbMarginBottom?: number | undefined;
18107
+ pcbMarginLeft?: number | undefined;
18108
+ pcbMarginX?: number | undefined;
18109
+ pcbMarginY?: number | undefined;
18110
+ pcbRelative?: boolean | undefined;
18111
+ relative?: boolean | undefined;
18112
+ color?: string | undefined;
18113
+ font?: "tscircuit2024" | undefined;
18114
+ fontSize?: number | undefined;
18115
+ }, {
18116
+ text: string;
18117
+ pcbX?: string | number | undefined;
18118
+ pcbY?: string | number | undefined;
18119
+ pcbRotation?: string | number | undefined;
18120
+ pcbPositionAnchor?: string | undefined;
18121
+ layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
18122
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
18123
+ } | undefined;
18124
+ pcbMarginTop?: string | number | undefined;
18125
+ pcbMarginRight?: string | number | undefined;
18126
+ pcbMarginBottom?: string | number | undefined;
18127
+ pcbMarginLeft?: string | number | undefined;
18128
+ pcbMarginX?: string | number | undefined;
18129
+ pcbMarginY?: string | number | undefined;
18130
+ pcbRelative?: boolean | undefined;
18131
+ relative?: boolean | undefined;
18132
+ color?: string | undefined;
18133
+ anchorAlignment?: "top_left" | "top_right" | "center" | "bottom_left" | "bottom_right" | undefined;
18134
+ font?: "tscircuit2024" | undefined;
18135
+ fontSize?: string | number | undefined;
18136
+ }>;
18137
+ };
18138
+ doInitialPcbPrimitiveRender(): void;
18139
+ getPcbSize(): {
18140
+ width: number;
18141
+ height: number;
18142
+ };
18143
+ }
18144
+
18063
18145
  declare class PcbNotePath extends PrimitiveComponent<typeof pcbNotePathProps> {
18064
18146
  pcb_note_path_id: string | null;
18065
18147
  isPcbPrimitive: boolean;
@@ -35976,6 +36058,7 @@ interface TscircuitElements {
35976
36058
  fabricationnoterect: _tscircuit_props.FabricationNoteRectProps;
35977
36059
  pcbnoteline: _tscircuit_props.PcbNoteLineProps;
35978
36060
  pcbnoterect: _tscircuit_props.PcbNoteRectProps;
36061
+ pcbnotetext: _tscircuit_props.PcbNoteTextProps;
35979
36062
  pcbnotepath: _tscircuit_props.PcbNotePathProps;
35980
36063
  pcbnotedimension: _tscircuit_props.PcbNoteDimensionProps;
35981
36064
  fabricationnotetext: _tscircuit_props.FabricationNoteTextProps;
@@ -36011,4 +36094,4 @@ declare module "react/jsx-runtime" {
36011
36094
  }
36012
36095
  }
36013
36096
 
36014
- export { AnalogSimulation, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, CopperPour, Crystal, Cutout, type DebugLogOutputEvent, Diode, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, Net, NetLabel, NormalComponent, type Obstacle, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbTrace, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicRect, SchematicRow, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, Subcircuit, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
36097
+ export { AnalogSimulation, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, CopperPour, Crystal, Cutout, type DebugLogOutputEvent, Diode, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, Net, NetLabel, NormalComponent, type Obstacle, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbNoteText, PcbTrace, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicRect, SchematicRow, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, Subcircuit, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
package/dist/index.js CHANGED
@@ -41,6 +41,7 @@ __export(components_exports, {
41
41
  PcbNoteLine: () => PcbNoteLine,
42
42
  PcbNotePath: () => PcbNotePath,
43
43
  PcbNoteRect: () => PcbNoteRect,
44
+ PcbNoteText: () => PcbNoteText,
44
45
  PcbTrace: () => PcbTrace,
45
46
  PinHeader: () => PinHeader,
46
47
  Pinout: () => Pinout,
@@ -14556,9 +14557,53 @@ var PcbNoteRect = class extends PrimitiveComponent2 {
14556
14557
  }
14557
14558
  };
14558
14559
 
14560
+ // lib/components/primitive-components/PcbNoteText.ts
14561
+ import { pcbNoteTextProps } from "@tscircuit/props";
14562
+ import { applyToPoint as applyToPoint13 } from "transformation-matrix";
14563
+ var PcbNoteText = class extends PrimitiveComponent2 {
14564
+ pcb_note_text_id = null;
14565
+ isPcbPrimitive = true;
14566
+ get config() {
14567
+ return {
14568
+ componentName: "PcbNoteText",
14569
+ zodProps: pcbNoteTextProps
14570
+ };
14571
+ }
14572
+ doInitialPcbPrimitiveRender() {
14573
+ if (this.root?.pcbDisabled) return;
14574
+ const { db } = this.root;
14575
+ const { _parsedProps: props } = this;
14576
+ const transform = this._computePcbGlobalTransformBeforeLayout();
14577
+ const anchorPosition = applyToPoint13(transform, { x: 0, y: 0 });
14578
+ const subcircuit = this.getSubcircuit();
14579
+ const group = this.getGroup();
14580
+ const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id ?? void 0;
14581
+ const pcb_note_text = db.pcb_note_text.insert({
14582
+ pcb_component_id,
14583
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
14584
+ pcb_group_id: group?.pcb_group_id ?? void 0,
14585
+ font: props.font ?? "tscircuit2024",
14586
+ font_size: props.fontSize ?? 1,
14587
+ text: props.text,
14588
+ anchor_position: anchorPosition,
14589
+ anchor_alignment: props.anchorAlignment ?? "center",
14590
+ color: props.color
14591
+ });
14592
+ this.pcb_note_text_id = pcb_note_text.pcb_note_text_id;
14593
+ }
14594
+ getPcbSize() {
14595
+ const { _parsedProps: props } = this;
14596
+ const fontSize = typeof props.fontSize === "string" ? parseFloat(props.fontSize) : props.fontSize ?? 1;
14597
+ const charWidth = fontSize * 0.6;
14598
+ const width = props.text.length * charWidth;
14599
+ const height = fontSize;
14600
+ return { width, height };
14601
+ }
14602
+ };
14603
+
14559
14604
  // lib/components/primitive-components/PcbNotePath.ts
14560
14605
  import { pcbNotePathProps } from "@tscircuit/props";
14561
- import { applyToPoint as applyToPoint13 } from "transformation-matrix";
14606
+ import { applyToPoint as applyToPoint14 } from "transformation-matrix";
14562
14607
  var PcbNotePath = class extends PrimitiveComponent2 {
14563
14608
  pcb_note_path_id = null;
14564
14609
  isPcbPrimitive = true;
@@ -14580,7 +14625,7 @@ var PcbNotePath = class extends PrimitiveComponent2 {
14580
14625
  const { x, y, ...rest } = point;
14581
14626
  const numericX = typeof x === "string" ? parseFloat(x) : x;
14582
14627
  const numericY = typeof y === "string" ? parseFloat(y) : y;
14583
- const transformed = applyToPoint13(transform, { x: numericX, y: numericY });
14628
+ const transformed = applyToPoint14(transform, { x: numericX, y: numericY });
14584
14629
  return { ...rest, x: transformed.x, y: transformed.y };
14585
14630
  });
14586
14631
  const pcb_note_path = db.pcb_note_path.insert({
@@ -14612,7 +14657,7 @@ var PcbNotePath = class extends PrimitiveComponent2 {
14612
14657
 
14613
14658
  // lib/components/primitive-components/PcbNoteDimension.ts
14614
14659
  import { pcbNoteDimensionProps } from "@tscircuit/props";
14615
- import { applyToPoint as applyToPoint14 } from "transformation-matrix";
14660
+ import { applyToPoint as applyToPoint15 } from "transformation-matrix";
14616
14661
  var PcbNoteDimension = class extends PrimitiveComponent2 {
14617
14662
  pcb_note_dimension_id = null;
14618
14663
  isPcbPrimitive = true;
@@ -14629,13 +14674,13 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
14629
14674
  );
14630
14675
  if (!target) {
14631
14676
  this.renderError(`PcbNoteDimension could not find selector "${input}"`);
14632
- return applyToPoint14(transform, { x: 0, y: 0 });
14677
+ return applyToPoint15(transform, { x: 0, y: 0 });
14633
14678
  }
14634
14679
  return target._getGlobalPcbPositionBeforeLayout();
14635
14680
  }
14636
14681
  const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
14637
14682
  const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
14638
- return applyToPoint14(transform, { x: numericX, y: numericY });
14683
+ return applyToPoint15(transform, { x: numericX, y: numericY });
14639
14684
  }
14640
14685
  doInitialPcbPrimitiveRender() {
14641
14686
  if (this.root?.pcbDisabled) return;
@@ -14796,7 +14841,7 @@ var BreakoutPoint = class extends PrimitiveComponent2 {
14796
14841
  // lib/components/primitive-components/NetLabel.ts
14797
14842
  import { netLabelProps } from "@tscircuit/props";
14798
14843
  import {
14799
- applyToPoint as applyToPoint15,
14844
+ applyToPoint as applyToPoint16,
14800
14845
  identity as identity5,
14801
14846
  translate as translate6
14802
14847
  } from "transformation-matrix";
@@ -14847,7 +14892,7 @@ var NetLabel = class extends PrimitiveComponent2 {
14847
14892
  const connectedPorts = this._getConnectedPorts();
14848
14893
  if (connectedPorts.length > 0) {
14849
14894
  const portPos = connectedPorts[0]._getGlobalSchematicPositionBeforeLayout();
14850
- const parentCenter = applyToPoint15(
14895
+ const parentCenter = applyToPoint16(
14851
14896
  this.parent?.computeSchematicGlobalTransform?.() ?? identity5(),
14852
14897
  { x: 0, y: 0 }
14853
14898
  );
@@ -16705,7 +16750,7 @@ import { identity as identity6 } from "transformation-matrix";
16705
16750
  var package_default = {
16706
16751
  name: "@tscircuit/core",
16707
16752
  type: "module",
16708
- version: "0.0.789",
16753
+ version: "0.0.790",
16709
16754
  types: "dist/index.d.ts",
16710
16755
  main: "dist/index.js",
16711
16756
  module: "dist/index.js",
@@ -17247,6 +17292,7 @@ export {
17247
17292
  PcbNoteLine,
17248
17293
  PcbNotePath,
17249
17294
  PcbNoteRect,
17295
+ PcbNoteText,
17250
17296
  PcbTrace,
17251
17297
  PinHeader,
17252
17298
  Pinout,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.790",
4
+ "version": "0.0.791",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",