@tscircuit/core 0.0.790 → 0.0.792

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,
@@ -10742,7 +10743,9 @@ import {
10742
10743
  convertPackOutputToPackInput,
10743
10744
  getGraphicsFromPackOutput
10744
10745
  } from "calculate-packing";
10745
- import { length as length4 } from "circuit-json";
10746
+ import {
10747
+ length as length4
10748
+ } from "circuit-json";
10746
10749
  import Debug7 from "debug";
10747
10750
 
10748
10751
  // lib/components/primitive-components/Group/Group_doInitialPcbLayoutPack/applyComponentConstraintClusters.ts
@@ -11077,6 +11080,69 @@ var applyPackOutput = (group, packOutput, clusterMap) => {
11077
11080
  }
11078
11081
  };
11079
11082
 
11083
+ // lib/utils/packing/getObstacleDimensionsFromElement.ts
11084
+ function getObstacleDimensionsFromSmtPad(pad) {
11085
+ switch (pad.shape) {
11086
+ case "rect":
11087
+ case "rotated_rect":
11088
+ case "pill":
11089
+ case "rotated_pill":
11090
+ return {
11091
+ width: pad.width,
11092
+ height: pad.height
11093
+ };
11094
+ case "circle":
11095
+ return {
11096
+ width: pad.radius * 2,
11097
+ height: pad.radius * 2
11098
+ };
11099
+ case "polygon":
11100
+ if (!pad.points || pad.points.length === 0) {
11101
+ return null;
11102
+ }
11103
+ const xs = pad.points.map((p) => p.x);
11104
+ const ys = pad.points.map((p) => p.y);
11105
+ const minX = Math.min(...xs);
11106
+ const maxX = Math.max(...xs);
11107
+ const minY = Math.min(...ys);
11108
+ const maxY = Math.max(...ys);
11109
+ return {
11110
+ width: maxX - minX,
11111
+ height: maxY - minY
11112
+ };
11113
+ default:
11114
+ return null;
11115
+ }
11116
+ }
11117
+ function getObstacleDimensionsFromPlatedHole(hole) {
11118
+ switch (hole.shape) {
11119
+ case "circular_hole_with_rect_pad":
11120
+ case "pill_hole_with_rect_pad":
11121
+ case "rotated_pill_hole_with_rect_pad":
11122
+ return {
11123
+ width: hole.rect_pad_width,
11124
+ height: hole.rect_pad_height
11125
+ };
11126
+ case "circle":
11127
+ return {
11128
+ width: hole.outer_diameter,
11129
+ height: hole.outer_diameter
11130
+ };
11131
+ case "oval":
11132
+ return {
11133
+ width: hole.outer_width,
11134
+ height: hole.outer_height
11135
+ };
11136
+ case "pill":
11137
+ return {
11138
+ width: hole.outer_width,
11139
+ height: hole.outer_height
11140
+ };
11141
+ default:
11142
+ return null;
11143
+ }
11144
+ }
11145
+
11080
11146
  // lib/components/primitive-components/Group/Group_doInitialPcbLayoutPack/Group_doInitialPcbLayoutPack.ts
11081
11147
  var DEFAULT_MIN_GAP = "1mm";
11082
11148
  var debug6 = Debug7("Group_doInitialPcbLayoutPack");
@@ -11135,6 +11201,58 @@ var Group_doInitialPcbLayoutPack = (group) => {
11135
11201
  }
11136
11202
  return true;
11137
11203
  });
11204
+ const obstaclesFromRelativelyPositionedComponents = [];
11205
+ for (const pcb_component_id of excludedPcbComponentIds) {
11206
+ const component = db.toArray().find(
11207
+ (el) => el.type === "pcb_component" && el.pcb_component_id === pcb_component_id
11208
+ );
11209
+ if (!component) continue;
11210
+ const componentX = component.center.x;
11211
+ const componentY = component.center.y;
11212
+ const smtpads = db.toArray().filter(
11213
+ (el) => el.type === "pcb_smtpad" && el.pcb_component_id === pcb_component_id
11214
+ );
11215
+ for (const pad of smtpads) {
11216
+ const dimensions = getObstacleDimensionsFromSmtPad(pad);
11217
+ if (!dimensions || dimensions.width === 0 || dimensions.height === 0) {
11218
+ continue;
11219
+ }
11220
+ let centerX;
11221
+ let centerY;
11222
+ if (pad.shape === "polygon") {
11223
+ const xs = pad.points.map((p) => p.x);
11224
+ const ys = pad.points.map((p) => p.y);
11225
+ centerX = componentX + (Math.min(...xs) + Math.max(...xs)) / 2;
11226
+ centerY = componentY + (Math.min(...ys) + Math.max(...ys)) / 2;
11227
+ } else {
11228
+ centerX = componentX + pad.x;
11229
+ centerY = componentY + pad.y;
11230
+ }
11231
+ obstaclesFromRelativelyPositionedComponents.push({
11232
+ obstacleId: pad.pcb_smtpad_id,
11233
+ absoluteCenter: { x: centerX, y: centerY },
11234
+ width: dimensions.width,
11235
+ height: dimensions.height
11236
+ });
11237
+ }
11238
+ const platedHoles = db.toArray().filter(
11239
+ (el) => el.type === "pcb_plated_hole" && el.pcb_component_id === pcb_component_id
11240
+ );
11241
+ for (const hole of platedHoles) {
11242
+ const dimensions = getObstacleDimensionsFromPlatedHole(hole);
11243
+ if (!dimensions || dimensions.width === 0 || dimensions.height === 0) {
11244
+ continue;
11245
+ }
11246
+ const centerX = componentX + hole.x;
11247
+ const centerY = componentY + hole.y;
11248
+ obstaclesFromRelativelyPositionedComponents.push({
11249
+ obstacleId: hole.pcb_plated_hole_id,
11250
+ absoluteCenter: { x: centerX, y: centerY },
11251
+ width: dimensions.width,
11252
+ height: dimensions.height
11253
+ });
11254
+ }
11255
+ }
11138
11256
  const packInput = {
11139
11257
  ...convertPackOutputToPackInput(
11140
11258
  convertCircuitJsonToPackOutput(filteredCircuitJson, {
@@ -11146,7 +11264,8 @@ var Group_doInitialPcbLayoutPack = (group) => {
11146
11264
  // @ts-expect-error we're missing some pack order strategies
11147
11265
  orderStrategy: packOrderStrategy ?? "largest_to_smallest",
11148
11266
  placementStrategy: packPlacementStrategy ?? "minimum_sum_squared_distance_to_network",
11149
- minGap: gapMm
11267
+ minGap: gapMm,
11268
+ obstacles: obstaclesFromRelativelyPositionedComponents
11150
11269
  };
11151
11270
  const clusterMap = applyComponentConstraintClusters(group, packInput);
11152
11271
  if (debug6.enabled) {
@@ -14556,9 +14675,53 @@ var PcbNoteRect = class extends PrimitiveComponent2 {
14556
14675
  }
14557
14676
  };
14558
14677
 
14678
+ // lib/components/primitive-components/PcbNoteText.ts
14679
+ import { pcbNoteTextProps } from "@tscircuit/props";
14680
+ import { applyToPoint as applyToPoint13 } from "transformation-matrix";
14681
+ var PcbNoteText = class extends PrimitiveComponent2 {
14682
+ pcb_note_text_id = null;
14683
+ isPcbPrimitive = true;
14684
+ get config() {
14685
+ return {
14686
+ componentName: "PcbNoteText",
14687
+ zodProps: pcbNoteTextProps
14688
+ };
14689
+ }
14690
+ doInitialPcbPrimitiveRender() {
14691
+ if (this.root?.pcbDisabled) return;
14692
+ const { db } = this.root;
14693
+ const { _parsedProps: props } = this;
14694
+ const transform = this._computePcbGlobalTransformBeforeLayout();
14695
+ const anchorPosition = applyToPoint13(transform, { x: 0, y: 0 });
14696
+ const subcircuit = this.getSubcircuit();
14697
+ const group = this.getGroup();
14698
+ const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id ?? void 0;
14699
+ const pcb_note_text = db.pcb_note_text.insert({
14700
+ pcb_component_id,
14701
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
14702
+ pcb_group_id: group?.pcb_group_id ?? void 0,
14703
+ font: props.font ?? "tscircuit2024",
14704
+ font_size: props.fontSize ?? 1,
14705
+ text: props.text,
14706
+ anchor_position: anchorPosition,
14707
+ anchor_alignment: props.anchorAlignment ?? "center",
14708
+ color: props.color
14709
+ });
14710
+ this.pcb_note_text_id = pcb_note_text.pcb_note_text_id;
14711
+ }
14712
+ getPcbSize() {
14713
+ const { _parsedProps: props } = this;
14714
+ const fontSize = typeof props.fontSize === "string" ? parseFloat(props.fontSize) : props.fontSize ?? 1;
14715
+ const charWidth = fontSize * 0.6;
14716
+ const width = props.text.length * charWidth;
14717
+ const height = fontSize;
14718
+ return { width, height };
14719
+ }
14720
+ };
14721
+
14559
14722
  // lib/components/primitive-components/PcbNotePath.ts
14560
14723
  import { pcbNotePathProps } from "@tscircuit/props";
14561
- import { applyToPoint as applyToPoint13 } from "transformation-matrix";
14724
+ import { applyToPoint as applyToPoint14 } from "transformation-matrix";
14562
14725
  var PcbNotePath = class extends PrimitiveComponent2 {
14563
14726
  pcb_note_path_id = null;
14564
14727
  isPcbPrimitive = true;
@@ -14580,7 +14743,7 @@ var PcbNotePath = class extends PrimitiveComponent2 {
14580
14743
  const { x, y, ...rest } = point;
14581
14744
  const numericX = typeof x === "string" ? parseFloat(x) : x;
14582
14745
  const numericY = typeof y === "string" ? parseFloat(y) : y;
14583
- const transformed = applyToPoint13(transform, { x: numericX, y: numericY });
14746
+ const transformed = applyToPoint14(transform, { x: numericX, y: numericY });
14584
14747
  return { ...rest, x: transformed.x, y: transformed.y };
14585
14748
  });
14586
14749
  const pcb_note_path = db.pcb_note_path.insert({
@@ -14612,7 +14775,7 @@ var PcbNotePath = class extends PrimitiveComponent2 {
14612
14775
 
14613
14776
  // lib/components/primitive-components/PcbNoteDimension.ts
14614
14777
  import { pcbNoteDimensionProps } from "@tscircuit/props";
14615
- import { applyToPoint as applyToPoint14 } from "transformation-matrix";
14778
+ import { applyToPoint as applyToPoint15 } from "transformation-matrix";
14616
14779
  var PcbNoteDimension = class extends PrimitiveComponent2 {
14617
14780
  pcb_note_dimension_id = null;
14618
14781
  isPcbPrimitive = true;
@@ -14629,13 +14792,13 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
14629
14792
  );
14630
14793
  if (!target) {
14631
14794
  this.renderError(`PcbNoteDimension could not find selector "${input}"`);
14632
- return applyToPoint14(transform, { x: 0, y: 0 });
14795
+ return applyToPoint15(transform, { x: 0, y: 0 });
14633
14796
  }
14634
14797
  return target._getGlobalPcbPositionBeforeLayout();
14635
14798
  }
14636
14799
  const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
14637
14800
  const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
14638
- return applyToPoint14(transform, { x: numericX, y: numericY });
14801
+ return applyToPoint15(transform, { x: numericX, y: numericY });
14639
14802
  }
14640
14803
  doInitialPcbPrimitiveRender() {
14641
14804
  if (this.root?.pcbDisabled) return;
@@ -14796,7 +14959,7 @@ var BreakoutPoint = class extends PrimitiveComponent2 {
14796
14959
  // lib/components/primitive-components/NetLabel.ts
14797
14960
  import { netLabelProps } from "@tscircuit/props";
14798
14961
  import {
14799
- applyToPoint as applyToPoint15,
14962
+ applyToPoint as applyToPoint16,
14800
14963
  identity as identity5,
14801
14964
  translate as translate6
14802
14965
  } from "transformation-matrix";
@@ -14847,7 +15010,7 @@ var NetLabel = class extends PrimitiveComponent2 {
14847
15010
  const connectedPorts = this._getConnectedPorts();
14848
15011
  if (connectedPorts.length > 0) {
14849
15012
  const portPos = connectedPorts[0]._getGlobalSchematicPositionBeforeLayout();
14850
- const parentCenter = applyToPoint15(
15013
+ const parentCenter = applyToPoint16(
14851
15014
  this.parent?.computeSchematicGlobalTransform?.() ?? identity5(),
14852
15015
  { x: 0, y: 0 }
14853
15016
  );
@@ -16705,7 +16868,7 @@ import { identity as identity6 } from "transformation-matrix";
16705
16868
  var package_default = {
16706
16869
  name: "@tscircuit/core",
16707
16870
  type: "module",
16708
- version: "0.0.789",
16871
+ version: "0.0.791",
16709
16872
  types: "dist/index.d.ts",
16710
16873
  main: "dist/index.js",
16711
16874
  module: "dist/index.js",
@@ -17247,6 +17410,7 @@ export {
17247
17410
  PcbNoteLine,
17248
17411
  PcbNotePath,
17249
17412
  PcbNoteRect,
17413
+ PcbNoteText,
17250
17414
  PcbTrace,
17251
17415
  PinHeader,
17252
17416
  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.792",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",