@tscircuit/core 0.0.395 → 0.0.397

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,5 +1,5 @@
1
1
  import * as _tscircuit_props from '@tscircuit/props';
2
- import { PlatformConfig, subcircuitGroupProps, AutorouterConfig, traceProps, SupplierPartNumbers, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, diodeProps, jumperProps, ledProps, powerSourceProps, resistorProps, constraintProps, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, subcircuitProps, holeProps, pcbKeepoutProps, netAliasProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, switchProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
2
+ import { PlatformConfig, subcircuitGroupProps, AutorouterConfig, traceProps, SupplierPartNumbers, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, diodeProps, jumperProps, ledProps, powerSourceProps, resistorProps, constraintProps, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, subcircuitProps, holeProps, pcbKeepoutProps, netAliasProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, switchProps, schematicTextProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
3
3
  import React, { ReactElement, DetailedHTMLProps, SVGProps } from 'react';
4
4
  export { createElement } from 'react';
5
5
  import * as zod from 'zod';
@@ -12,7 +12,7 @@ import * as _tscircuit_layout from '@tscircuit/layout';
12
12
  import { ConnectivityMap } from 'circuit-json-to-connectivity-map';
13
13
  import { GraphicsObject } from 'graphics-debug';
14
14
 
15
- declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "InitializePortsFromChildren", "CreateNetsFromProps", "CreateTracesFromProps", "CreateTraceHintsFromProps", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SchematicComponentRender", "SchematicPortRender", "SchematicLayout", "SchematicTraceRender", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbLayout", "PcbComponentSizeCalculation", "PcbBoardAutoSize", "PcbTraceHintRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbDesignRuleChecks", "CadModelRender", "PartsEngineRender"];
15
+ declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "InitializePortsFromChildren", "CreateNetsFromProps", "CreateTracesFromProps", "CreateTraceHintsFromProps", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SchematicComponentRender", "SchematicPrimitiveRender", "SchematicPortRender", "SchematicLayout", "SchematicTraceRender", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbLayout", "PcbComponentSizeCalculation", "PcbBoardAutoSize", "PcbTraceHintRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbDesignRuleChecks", "CadModelRender", "PartsEngineRender"];
16
16
  type RenderPhase = (typeof orderedRenderPhases)[number];
17
17
  type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
18
18
  type RenderPhaseStates = Record<RenderPhase, {
@@ -11820,6 +11820,39 @@ declare class Switch extends NormalComponent<typeof switchProps> {
11820
11820
  doInitialSourceRender(): void;
11821
11821
  }
11822
11822
 
11823
+ declare class SchematicText extends PrimitiveComponent<typeof schematicTextProps> {
11824
+ isPcbPrimitive: boolean;
11825
+ get config(): {
11826
+ componentName: string;
11827
+ zodProps: zod.ZodObject<{
11828
+ schX: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
11829
+ schY: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
11830
+ text: zod.ZodString;
11831
+ fontSize: zod.ZodDefault<zod.ZodNumber>;
11832
+ anchor: zod.ZodDefault<zod.ZodUnion<[zod.ZodEnum<["center", "left", "right", "top", "bottom"]>, zod.ZodEnum<["top_left", "top_center", "top_right", "center_left", "center", "center_right", "bottom_left", "bottom_center", "bottom_right"]>]>>;
11833
+ color: zod.ZodDefault<zod.ZodString>;
11834
+ schRotation: zod.ZodDefault<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
11835
+ }, "strip", zod.ZodTypeAny, {
11836
+ anchor: "left" | "right" | "top" | "bottom" | "center" | "top_left" | "top_right" | "bottom_left" | "bottom_right" | "top_center" | "center_left" | "center_right" | "bottom_center";
11837
+ schX: number;
11838
+ schY: number;
11839
+ schRotation: number;
11840
+ color: string;
11841
+ text: string;
11842
+ fontSize: number;
11843
+ }, {
11844
+ schX: string | number;
11845
+ schY: string | number;
11846
+ text: string;
11847
+ anchor?: "left" | "right" | "top" | "bottom" | "center" | "top_left" | "top_right" | "bottom_left" | "bottom_right" | "top_center" | "center_left" | "center_right" | "bottom_center" | undefined;
11848
+ schRotation?: string | number | undefined;
11849
+ color?: string | undefined;
11850
+ fontSize?: number | undefined;
11851
+ }>;
11852
+ };
11853
+ doInitialSchematicPrimitiveRender(): void;
11854
+ }
11855
+
11823
11856
  declare const useRenderedCircuit: (reactElements: React.ReactElement) => {
11824
11857
  isLoading: boolean;
11825
11858
  error?: Error | null;
@@ -12183,4 +12216,4 @@ declare module "react/jsx-runtime" {
12183
12216
  }
12184
12217
  }
12185
12218
 
12186
- export { type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Crystal, Diode, FabricationNotePath, FabricationNoteText, Footprint, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Mosfet, Net, NetAlias, NormalComponent, type Obstacle, PcbTrace, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, Subcircuit, Switch, Trace, TraceHint, Transistor, Via, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
12219
+ export { type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Crystal, Diode, FabricationNotePath, FabricationNoteText, Footprint, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Mosfet, Net, NetAlias, NormalComponent, type Obstacle, PcbTrace, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, Subcircuit, Switch, Trace, TraceHint, Transistor, Via, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
package/dist/index.js CHANGED
@@ -38,6 +38,7 @@ __export(components_exports, {
38
38
  Renderable: () => Renderable,
39
39
  Resistor: () => Resistor,
40
40
  Resonator: () => Resonator,
41
+ SchematicText: () => SchematicText,
41
42
  SilkscreenCircle: () => SilkscreenCircle,
42
43
  SilkscreenLine: () => SilkscreenLine,
43
44
  SilkscreenPath: () => SilkscreenPath,
@@ -84,6 +85,7 @@ var orderedRenderPhases = [
84
85
  "SourceTraceRender",
85
86
  "SourceAddConnectivityMapKey",
86
87
  "SchematicComponentRender",
88
+ "SchematicPrimitiveRender",
87
89
  "SchematicPortRender",
88
90
  "SchematicLayout",
89
91
  "SchematicTraceRender",
@@ -5284,7 +5286,8 @@ var NormalComponent = class extends PrimitiveComponent2 {
5284
5286
  x: hasTopOrBottomPins ? center.x + (schematic_box_width ?? 0) / 2 + 0.1 : center.x - (schematic_box_width ?? 0) / 2,
5285
5287
  y: hasTopOrBottomPins ? center.y + (schematic_box_height ?? 0) / 2 + 0.35 : center.y - (schematic_box_height ?? 0) / 2 - 0.13
5286
5288
  },
5287
- color: "#006464"
5289
+ color: "#006464",
5290
+ font_size: 0.05
5288
5291
  });
5289
5292
  const component_name_text = db.schematic_text.insert({
5290
5293
  text: props.name ?? "",
@@ -5295,7 +5298,8 @@ var NormalComponent = class extends PrimitiveComponent2 {
5295
5298
  x: hasTopOrBottomPins ? center.x + (schematic_box_width ?? 0) / 2 + 0.1 : center.x - (schematic_box_width ?? 0) / 2,
5296
5299
  y: hasTopOrBottomPins ? center.y + (schematic_box_height ?? 0) / 2 + 0.55 : center.y + (schematic_box_height ?? 0) / 2 + 0.13
5297
5300
  },
5298
- color: "#006464"
5301
+ color: "#006464",
5302
+ font_size: 0.05
5299
5303
  });
5300
5304
  this.schematic_component_id = schematic_component2.schematic_component_id;
5301
5305
  }
@@ -8086,6 +8090,34 @@ var Switch = class extends NormalComponent {
8086
8090
  }
8087
8091
  };
8088
8092
 
8093
+ // lib/components/primitive-components/SchematicText.ts
8094
+ import { schematicTextProps } from "@tscircuit/props";
8095
+ var SchematicText = class extends PrimitiveComponent2 {
8096
+ isPcbPrimitive = true;
8097
+ get config() {
8098
+ return {
8099
+ componentName: "SchematicText",
8100
+ zodProps: schematicTextProps
8101
+ };
8102
+ }
8103
+ doInitialSchematicPrimitiveRender() {
8104
+ if (this.root?.schematicDisabled) return;
8105
+ const { db } = this.root;
8106
+ const { _parsedProps: props } = this;
8107
+ db.schematic_text.insert({
8108
+ anchor: props.anchor ?? "center",
8109
+ text: props.text,
8110
+ font_size: props.fontSize,
8111
+ color: props.color || "#000000",
8112
+ position: {
8113
+ x: props.schX,
8114
+ y: props.schY
8115
+ },
8116
+ rotation: props.schRotation ?? 0
8117
+ });
8118
+ }
8119
+ };
8120
+
8089
8121
  // lib/RootCircuit.ts
8090
8122
  import { su as su5 } from "@tscircuit/circuit-json-util";
8091
8123
  import { isValidElement as isValidElement2 } from "react";
@@ -8095,7 +8127,7 @@ import { identity as identity4 } from "transformation-matrix";
8095
8127
  var package_default = {
8096
8128
  name: "@tscircuit/core",
8097
8129
  type: "module",
8098
- version: "0.0.394",
8130
+ version: "0.0.396",
8099
8131
  types: "dist/index.d.ts",
8100
8132
  main: "dist/index.js",
8101
8133
  module: "dist/index.js",
@@ -8153,9 +8185,9 @@ var package_default = {
8153
8185
  "@tscircuit/circuit-json-util": "^0.0.47",
8154
8186
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
8155
8187
  "@tscircuit/math-utils": "^0.0.14",
8156
- "@tscircuit/props": "^0.0.174",
8188
+ "@tscircuit/props": "^0.0.178",
8157
8189
  "@tscircuit/schematic-autolayout": "^0.0.6",
8158
- "circuit-json": "0.0.164",
8190
+ "circuit-json": "0.0.170",
8159
8191
  "circuit-json-to-connectivity-map": "^0.0.20",
8160
8192
  "css-select": "^5.1.0",
8161
8193
  "format-si-unit": "^0.0.3",
@@ -8561,6 +8593,7 @@ export {
8561
8593
  Resistor,
8562
8594
  Resonator,
8563
8595
  RootCircuit,
8596
+ SchematicText,
8564
8597
  SilkscreenCircle,
8565
8598
  SilkscreenLine,
8566
8599
  SilkscreenPath,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.395",
4
+ "version": "0.0.397",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -59,9 +59,9 @@
59
59
  "@tscircuit/circuit-json-util": "^0.0.47",
60
60
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
61
61
  "@tscircuit/math-utils": "^0.0.14",
62
- "@tscircuit/props": "^0.0.174",
62
+ "@tscircuit/props": "^0.0.178",
63
63
  "@tscircuit/schematic-autolayout": "^0.0.6",
64
- "circuit-json": "0.0.164",
64
+ "circuit-json": "0.0.170",
65
65
  "circuit-json-to-connectivity-map": "^0.0.20",
66
66
  "css-select": "^5.1.0",
67
67
  "format-si-unit": "^0.0.3",