@tscircuit/core 0.0.1331 → 0.0.1333

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
- import { PcbTraceError, PcbPlacementError, PcbManualEditConflictWarning, PcbViaClearanceError, LayerRef, AnyCircuitElement, Size, PcbTrace as PcbTrace$1, PcbVia as PcbVia$1, PcbTraceRoutePoint, AnySourceComponent, PcbComponent, SchematicPort, SchematicComponent, RouteHintPoint, CircuitJson } from 'circuit-json';
2
+ import { PcbTraceError, PcbPlacementError, PcbManualEditConflictWarning, PcbViaClearanceError, LayerRef, AnyCircuitElement, Size, PcbTrace as PcbTrace$1, PcbVia as PcbVia$1, PcbTraceRoutePoint, AnySourceComponent, PcbComponent, SchematicPort, SchematicComponent, PcbSilkscreenGraphic, RouteHintPoint, CircuitJson } from 'circuit-json';
3
3
  import * as _tscircuit_props from '@tscircuit/props';
4
- import { PlatformConfig, traceProps, netProps, AutorouterProp, AutoroutingPhaseProps, subcircuitGroupProps, AutorouterConfig, PcbSx, portProps, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, subcircuitProps, subpanelProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, interconnectProps, solderjumperProps, ledProps, powerSourceProps, voltageSourceProps, currentSourceProps, resistorProps, constraintProps, drcCheckProps, autoroutingPhaseProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNoteTextProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, courtyardCircleProps, courtyardOutlineProps, courtyardRectProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, fiducialProps, traceHintProps, viaProps, copperPourProps, copperTextProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, opampProps, OpAmpPinLabels, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicPathProps, schematicBoxProps, schematicSectionProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, voltageProbeProps, spicemodelProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
4
+ import { PlatformConfig, traceProps, netProps, AutorouterProp, AutoroutingPhaseProps, subcircuitGroupProps, AutorouterConfig, PcbSx, portProps, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, subcircuitProps, subpanelProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, interconnectProps, solderjumperProps, ledProps, powerSourceProps, voltageSourceProps, currentSourceProps, resistorProps, constraintProps, drcCheckProps, autoroutingPhaseProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNoteTextProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, courtyardCircleProps, courtyardOutlineProps, courtyardRectProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, silkscreenGraphicProps, smtPadProps, fiducialProps, traceHintProps, viaProps, copperPourProps, copperTextProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, opampProps, OpAmpPinLabels, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicPathProps, schematicBoxProps, schematicSectionProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, voltageProbeProps, spicemodelProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
5
5
  export { kicadFootprintStrings } from '@tscircuit/props';
6
6
  import * as react from 'react';
7
7
  import react__default, { ReactElement } from 'react';
@@ -77936,6 +77936,148 @@ declare class SilkscreenLine extends PrimitiveComponent<typeof silkscreenLinePro
77936
77936
  }): void;
77937
77937
  }
77938
77938
 
77939
+ declare class SilkscreenGraphic extends PrimitiveComponent<typeof silkscreenGraphicProps> {
77940
+ pcb_silkscreen_graphic_id: string | null;
77941
+ pcb_silkscreen_graphic_ids: string[];
77942
+ pcb_silkscreen_path_ids: string[];
77943
+ isPcbPrimitive: boolean;
77944
+ get config(): {
77945
+ componentName: string;
77946
+ zodProps: zod.ZodObject<Omit<{
77947
+ pcbX: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>]>>;
77948
+ pcbY: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>]>>;
77949
+ pcbLeftEdgeX: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>]>>;
77950
+ pcbRightEdgeX: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>]>>;
77951
+ pcbTopEdgeY: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>]>>;
77952
+ pcbBottomEdgeY: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>]>>;
77953
+ pcbOffsetX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
77954
+ pcbOffsetY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
77955
+ pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
77956
+ pcbPositionAnchor: zod.ZodOptional<zod.ZodString>;
77957
+ pcbPositionMode: zod.ZodOptional<zod.ZodEnum<["relative_to_group_anchor", "auto", "relative_to_board_anchor", "relative_to_component_anchor"]>>;
77958
+ shouldBeOnEdgeOfBoard: zod.ZodOptional<zod.ZodBoolean>;
77959
+ layer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
77960
+ name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
77961
+ }, "strip", zod.ZodTypeAny, {
77962
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
77963
+ }, {
77964
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
77965
+ }>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
77966
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
77967
+ }>>;
77968
+ pcbMarginTop: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
77969
+ pcbMarginRight: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
77970
+ pcbMarginBottom: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
77971
+ pcbMarginLeft: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
77972
+ pcbMarginX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
77973
+ pcbMarginY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
77974
+ pcbStyle: zod.ZodOptional<zod.ZodObject<{
77975
+ silkscreenFontSize: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
77976
+ viaPadDiameter: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
77977
+ viaHoleDiameter: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
77978
+ silkscreenTextPosition: zod.ZodOptional<zod.ZodUnion<[zod.ZodEnum<["centered", "outside", "none"]>, zod.ZodObject<{
77979
+ offsetX: zod.ZodNumber;
77980
+ offsetY: zod.ZodNumber;
77981
+ }, "strip", zod.ZodTypeAny, {
77982
+ offsetX: number;
77983
+ offsetY: number;
77984
+ }, {
77985
+ offsetX: number;
77986
+ offsetY: number;
77987
+ }>]>>;
77988
+ silkscreenTextVisibility: zod.ZodOptional<zod.ZodEnum<["hidden", "visible", "inherit"]>>;
77989
+ }, "strip", zod.ZodTypeAny, {
77990
+ silkscreenFontSize?: number | undefined;
77991
+ viaPadDiameter?: number | undefined;
77992
+ viaHoleDiameter?: number | undefined;
77993
+ silkscreenTextPosition?: "centered" | "outside" | "none" | {
77994
+ offsetX: number;
77995
+ offsetY: number;
77996
+ } | undefined;
77997
+ silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
77998
+ }, {
77999
+ silkscreenFontSize?: string | number | undefined;
78000
+ viaPadDiameter?: string | number | undefined;
78001
+ viaHoleDiameter?: string | number | undefined;
78002
+ silkscreenTextPosition?: "centered" | "outside" | "none" | {
78003
+ offsetX: number;
78004
+ offsetY: number;
78005
+ } | undefined;
78006
+ silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
78007
+ }>>;
78008
+ pcbSx: zod.ZodOptional<zod.ZodType<_tscircuit_props.PcbSx, zod.ZodTypeDef, _tscircuit_props.PcbSx>>;
78009
+ pcbRelative: zod.ZodOptional<zod.ZodBoolean>;
78010
+ relative: zod.ZodOptional<zod.ZodBoolean>;
78011
+ }, "layer" | "pcbStyle" | "pcbSx"> & {
78012
+ imageUrl: zod.ZodType<string, zod.ZodTypeDef, string>;
78013
+ width: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
78014
+ height: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
78015
+ layer: zod.ZodOptional<zod.ZodEnum<["top", "bottom"]>>;
78016
+ }, "strip", zod.ZodTypeAny, {
78017
+ width: number;
78018
+ height: number;
78019
+ imageUrl: string;
78020
+ layer?: "top" | "bottom" | undefined;
78021
+ pcbX?: string | number | undefined;
78022
+ pcbY?: string | number | undefined;
78023
+ pcbLeftEdgeX?: string | number | undefined;
78024
+ pcbRightEdgeX?: string | number | undefined;
78025
+ pcbTopEdgeY?: string | number | undefined;
78026
+ pcbBottomEdgeY?: string | number | undefined;
78027
+ pcbOffsetX?: number | undefined;
78028
+ pcbOffsetY?: number | undefined;
78029
+ pcbRotation?: number | undefined;
78030
+ pcbPositionAnchor?: string | undefined;
78031
+ pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
78032
+ shouldBeOnEdgeOfBoard?: boolean | undefined;
78033
+ pcbMarginTop?: number | undefined;
78034
+ pcbMarginRight?: number | undefined;
78035
+ pcbMarginBottom?: number | undefined;
78036
+ pcbMarginLeft?: number | undefined;
78037
+ pcbMarginX?: number | undefined;
78038
+ pcbMarginY?: number | undefined;
78039
+ pcbRelative?: boolean | undefined;
78040
+ relative?: boolean | undefined;
78041
+ }, {
78042
+ width: string | number;
78043
+ height: string | number;
78044
+ imageUrl: string;
78045
+ layer?: "top" | "bottom" | undefined;
78046
+ pcbX?: string | number | undefined;
78047
+ pcbY?: string | number | undefined;
78048
+ pcbLeftEdgeX?: string | number | undefined;
78049
+ pcbRightEdgeX?: string | number | undefined;
78050
+ pcbTopEdgeY?: string | number | undefined;
78051
+ pcbBottomEdgeY?: string | number | undefined;
78052
+ pcbOffsetX?: string | number | undefined;
78053
+ pcbOffsetY?: string | number | undefined;
78054
+ pcbRotation?: string | number | undefined;
78055
+ pcbPositionAnchor?: string | undefined;
78056
+ pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
78057
+ shouldBeOnEdgeOfBoard?: boolean | undefined;
78058
+ pcbMarginTop?: string | number | undefined;
78059
+ pcbMarginRight?: string | number | undefined;
78060
+ pcbMarginBottom?: string | number | undefined;
78061
+ pcbMarginLeft?: string | number | undefined;
78062
+ pcbMarginX?: string | number | undefined;
78063
+ pcbMarginY?: string | number | undefined;
78064
+ pcbRelative?: boolean | undefined;
78065
+ relative?: boolean | undefined;
78066
+ }>;
78067
+ };
78068
+ doInitialPcbPrimitiveRender(): void;
78069
+ insertRenderableSilkscreenPaths(svg: string, layer: "top" | "bottom"): void;
78070
+ getPcbSize(): {
78071
+ width: number;
78072
+ height: number;
78073
+ };
78074
+ getPlacementBoxBRepShape(): PcbSilkscreenGraphic["brep_shape"];
78075
+ _moveCircuitJsonElements({ deltaX, deltaY, }: {
78076
+ deltaX: number;
78077
+ deltaY: number;
78078
+ }): void;
78079
+ }
78080
+
77939
78081
  declare class SmtPad extends PrimitiveComponent<typeof smtPadProps> {
77940
78082
  pcb_smtpad_id: string | null;
77941
78083
  matchedPort: Port | null;
@@ -154196,6 +154338,7 @@ interface TscircuitElements {
154196
154338
  name?: string;
154197
154339
  };
154198
154340
  silkscreentext: _tscircuit_props.SilkscreenTextProps;
154341
+ silkscreengraphic: _tscircuit_props.SilkscreenGraphicProps;
154199
154342
  coppertext: _tscircuit_props.CopperTextProps;
154200
154343
  cutout: _tscircuit_props.CutoutProps;
154201
154344
  silkscreenpath: _tscircuit_props.SilkscreenPathProps;
@@ -154254,4 +154397,4 @@ declare module "react/jsx-runtime" {
154254
154397
  }
154255
154398
  }
154256
154399
 
154257
- export { AnalogSimulation, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, AutoroutingPhase, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Connector, Constraint, CopperPour, CopperText, CourtyardCircle, CourtyardOutline, CourtyardRect, Crystal, CurrentSource, Cutout, type DebugLogOutputEvent, Diode, DrcCheck, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Breakout as Fanout, BreakoutPoint as FanoutPoint, Fiducial, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IIsolatedCircuit, type IRenderable, type IRootCircuit, Inductor, Interconnect, IsolatedCircuit, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, MountedBoard, Net, NetLabel, NormalComponent, type Obstacle, OpAmp, type PackingEndEvent, type PackingErrorEvent, type PackingStartEvent, Panel, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbNoteText, PcbTrace, PcbVia, 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, SOLVERS, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicPath, SchematicRect, SchematicRow, SchematicSection, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, type SolverName, type SolverStartedEvent, SpiceModel, Subcircuit, Subpanel, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, renderPhaseIndexMap, resolveStaticFileImport, sel, unrouteCircuitJson, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
154400
+ export { AnalogSimulation, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, AutoroutingPhase, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Connector, Constraint, CopperPour, CopperText, CourtyardCircle, CourtyardOutline, CourtyardRect, Crystal, CurrentSource, Cutout, type DebugLogOutputEvent, Diode, DrcCheck, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Breakout as Fanout, BreakoutPoint as FanoutPoint, Fiducial, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IIsolatedCircuit, type IRenderable, type IRootCircuit, Inductor, Interconnect, IsolatedCircuit, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, MountedBoard, Net, NetLabel, NormalComponent, type Obstacle, OpAmp, type PackingEndEvent, type PackingErrorEvent, type PackingStartEvent, Panel, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbNoteText, PcbTrace, PcbVia, 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, SOLVERS, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicPath, SchematicRect, SchematicRow, SchematicSection, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenGraphic, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, type SolverName, type SolverStartedEvent, SpiceModel, Subcircuit, Subpanel, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, renderPhaseIndexMap, resolveStaticFileImport, sel, unrouteCircuitJson, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
package/dist/index.js CHANGED
@@ -82,6 +82,7 @@ __export(components_exports, {
82
82
  SchematicTable: () => SchematicTable,
83
83
  SchematicText: () => SchematicText,
84
84
  SilkscreenCircle: () => SilkscreenCircle,
85
+ SilkscreenGraphic: () => SilkscreenGraphic,
85
86
  SilkscreenLine: () => SilkscreenLine,
86
87
  SilkscreenPath: () => SilkscreenPath,
87
88
  SilkscreenRect: () => SilkscreenRect,
@@ -23760,7 +23761,7 @@ import { identity as identity5 } from "transformation-matrix";
23760
23761
  var package_default = {
23761
23762
  name: "@tscircuit/core",
23762
23763
  type: "module",
23763
- version: "0.0.1330",
23764
+ version: "0.0.1332",
23764
23765
  types: "dist/index.d.ts",
23765
23766
  main: "dist/index.js",
23766
23767
  module: "dist/index.js",
@@ -23799,6 +23800,7 @@ var package_default = {
23799
23800
  "@tscircuit/common": "^0.0.20",
23800
23801
  "@tscircuit/copper-pour-solver": "^0.0.29",
23801
23802
  "@tscircuit/footprinter": "^0.0.357",
23803
+ "@tscircuit/image-utils": "^0.0.7",
23802
23804
  "@tscircuit/infer-cable-insertion-point": "^0.0.2",
23803
23805
  "@tscircuit/infgrid-ijump-astar": "^0.0.35",
23804
23806
  "@tscircuit/jlcpcb-manufacturing-specs": "git+https://github.com/tscircuit/jlcpcb-manufacturing-specs#e08af159db01a37db007e33f0a7268d0e4a279a5",
@@ -23810,8 +23812,8 @@ var package_default = {
23810
23812
  "@tscircuit/props": "^0.0.549",
23811
23813
  "@tscircuit/ngspice-spice-engine": "^0.0.16",
23812
23814
  "@tscircuit/schematic-match-adapt": "^0.0.18",
23813
- "@tscircuit/solver-utils": "^0.0.16",
23814
23815
  "@tscircuit/schematic-trace-solver": "^0.0.69",
23816
+ "@tscircuit/solver-utils": "^0.0.16",
23815
23817
  "@tscircuit/soup-util": "^0.0.41",
23816
23818
  "@types/bun": "^1.2.16",
23817
23819
  "@types/debug": "^4.1.12",
@@ -28037,6 +28039,165 @@ var NetLabel = class extends PrimitiveComponent2 {
28037
28039
  }
28038
28040
  };
28039
28041
 
28042
+ // lib/components/primitive-components/SilkscreenGraphic.ts
28043
+ import { silkscreenGraphicProps } from "@tscircuit/props";
28044
+ import {
28045
+ PNG_MIMETYPE,
28046
+ SVG_MIMETYPE,
28047
+ ensureClockwise,
28048
+ getSvgBRepShapes,
28049
+ getTransformedSvgPathRoutes,
28050
+ loadImageSource
28051
+ } from "@tscircuit/image-utils";
28052
+ import { applyToPoint as applyToPoint27 } from "transformation-matrix";
28053
+ var SilkscreenGraphic = class extends PrimitiveComponent2 {
28054
+ pcb_silkscreen_graphic_id = null;
28055
+ pcb_silkscreen_graphic_ids = [];
28056
+ pcb_silkscreen_path_ids = [];
28057
+ isPcbPrimitive = true;
28058
+ get config() {
28059
+ return {
28060
+ componentName: "SilkscreenGraphic",
28061
+ zodProps: silkscreenGraphicProps
28062
+ };
28063
+ }
28064
+ doInitialPcbPrimitiveRender() {
28065
+ if (this.root?.pcbDisabled) return;
28066
+ this._queueAsyncEffect("SilkscreenGraphicRender", async () => {
28067
+ if (this.root?.pcbDisabled) return;
28068
+ const { db } = this.root;
28069
+ const { _parsedProps: props } = this;
28070
+ const { maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
28071
+ const layer = maybeFlipLayer(props.layer ?? "top");
28072
+ if (layer !== "top" && layer !== "bottom") {
28073
+ throw new Error(
28074
+ `Invalid layer "${layer}" for SilkscreenGraphic. Must be "top" or "bottom".`
28075
+ );
28076
+ }
28077
+ const sourceImage = await loadImageSource(props.imageUrl);
28078
+ if (sourceImage.mimetype !== SVG_MIMETYPE && sourceImage.mimetype !== PNG_MIMETYPE) {
28079
+ throw new Error(
28080
+ `Unsupported imageUrl for SilkscreenGraphic: "${props.imageUrl}". Expected an SVG or PNG image.`
28081
+ );
28082
+ }
28083
+ const imageAsset = {
28084
+ project_relative_path: sourceImage.projectRelativePath,
28085
+ url: sourceImage.dataUrl,
28086
+ mimetype: sourceImage.mimetype
28087
+ };
28088
+ const brepShapes = sourceImage.mimetype === SVG_MIMETYPE ? getSvgBRepShapes({
28089
+ svg: sourceImage.text,
28090
+ width: props.width,
28091
+ height: props.height,
28092
+ transform: this._computePcbGlobalTransformBeforeLayout()
28093
+ }) : [this.getPlacementBoxBRepShape()];
28094
+ const pcbComponentId = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id ?? "";
28095
+ for (const brepShape of brepShapes) {
28096
+ const graphic = db.insert({
28097
+ type: "pcb_silkscreen_graphic",
28098
+ pcb_component_id: pcbComponentId,
28099
+ pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0,
28100
+ subcircuit_id: this.getSubcircuit()?.subcircuit_id ?? void 0,
28101
+ layer,
28102
+ shape: "brep",
28103
+ brep_shape: brepShape,
28104
+ image_asset: imageAsset
28105
+ });
28106
+ this.pcb_silkscreen_graphic_ids.push(graphic.pcb_silkscreen_graphic_id);
28107
+ }
28108
+ this.pcb_silkscreen_graphic_id = this.pcb_silkscreen_graphic_ids[0] ?? null;
28109
+ if (sourceImage.mimetype === SVG_MIMETYPE) {
28110
+ this.insertRenderableSilkscreenPaths(sourceImage.text, layer);
28111
+ }
28112
+ });
28113
+ }
28114
+ insertRenderableSilkscreenPaths(svg, layer) {
28115
+ const { db } = this.root;
28116
+ const { _parsedProps: props } = this;
28117
+ const transform = this._computePcbGlobalTransformBeforeLayout();
28118
+ const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id ?? "";
28119
+ for (const route of getTransformedSvgPathRoutes({
28120
+ svg,
28121
+ width: props.width,
28122
+ height: props.height,
28123
+ transform
28124
+ })) {
28125
+ if (route.length < 2) continue;
28126
+ const path = db.pcb_silkscreen_path.insert({
28127
+ pcb_component_id,
28128
+ layer,
28129
+ route,
28130
+ stroke_width: Math.max(Math.min(props.width, props.height) / 60, 0.05),
28131
+ subcircuit_id: this.getSubcircuit()?.subcircuit_id ?? void 0,
28132
+ pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
28133
+ });
28134
+ this.pcb_silkscreen_path_ids.push(path.pcb_silkscreen_path_id);
28135
+ }
28136
+ }
28137
+ getPcbSize() {
28138
+ const { _parsedProps: props } = this;
28139
+ return { width: props.width, height: props.height };
28140
+ }
28141
+ getPlacementBoxBRepShape() {
28142
+ const { _parsedProps: props } = this;
28143
+ const halfWidth = props.width / 2;
28144
+ const halfHeight = props.height / 2;
28145
+ const transform = this._computePcbGlobalTransformBeforeLayout();
28146
+ return {
28147
+ outer_ring: {
28148
+ vertices: ensureClockwise([
28149
+ { x: -halfWidth, y: halfHeight },
28150
+ { x: halfWidth, y: halfHeight },
28151
+ { x: halfWidth, y: -halfHeight },
28152
+ { x: -halfWidth, y: -halfHeight }
28153
+ ]).map(
28154
+ (point6) => applyToPoint27(transform, point6)
28155
+ )
28156
+ },
28157
+ inner_rings: []
28158
+ };
28159
+ }
28160
+ _moveCircuitJsonElements({
28161
+ deltaX,
28162
+ deltaY
28163
+ }) {
28164
+ if (this.root?.pcbDisabled) return;
28165
+ const { db } = this.root;
28166
+ const moveVertex = (vertex) => ({
28167
+ ...vertex,
28168
+ x: vertex.x + deltaX,
28169
+ y: vertex.y + deltaY
28170
+ });
28171
+ for (const graphicId of this.pcb_silkscreen_graphic_ids) {
28172
+ const graphic = db.pcb_silkscreen_graphic.get(
28173
+ graphicId
28174
+ );
28175
+ if (!graphic) continue;
28176
+ db.pcb_silkscreen_graphic.update(graphicId, {
28177
+ brep_shape: {
28178
+ outer_ring: {
28179
+ vertices: graphic.brep_shape.outer_ring.vertices.map(moveVertex)
28180
+ },
28181
+ inner_rings: graphic.brep_shape.inner_rings.map((ring) => ({
28182
+ vertices: ring.vertices.map(moveVertex)
28183
+ }))
28184
+ }
28185
+ });
28186
+ }
28187
+ for (const pathId of this.pcb_silkscreen_path_ids) {
28188
+ const path = db.pcb_silkscreen_path.get(pathId);
28189
+ if (!path) continue;
28190
+ db.pcb_silkscreen_path.update(pathId, {
28191
+ route: path.route.map((point6) => ({
28192
+ ...point6,
28193
+ x: point6.x + deltaX,
28194
+ y: point6.y + deltaY
28195
+ }))
28196
+ });
28197
+ }
28198
+ }
28199
+ };
28200
+
28040
28201
  // lib/components/primitive-components/Fiducial.ts
28041
28202
  import "zod";
28042
28203
  import { distance as distance18 } from "circuit-json";
@@ -30721,6 +30882,7 @@ export {
30721
30882
  SchematicTable,
30722
30883
  SchematicText,
30723
30884
  SilkscreenCircle,
30885
+ SilkscreenGraphic,
30724
30886
  SilkscreenLine,
30725
30887
  SilkscreenPath,
30726
30888
  SilkscreenRect,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1331",
4
+ "version": "0.0.1333",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -40,6 +40,7 @@
40
40
  "@tscircuit/common": "^0.0.20",
41
41
  "@tscircuit/copper-pour-solver": "^0.0.29",
42
42
  "@tscircuit/footprinter": "^0.0.357",
43
+ "@tscircuit/image-utils": "^0.0.7",
43
44
  "@tscircuit/infer-cable-insertion-point": "^0.0.2",
44
45
  "@tscircuit/infgrid-ijump-astar": "^0.0.35",
45
46
  "@tscircuit/jlcpcb-manufacturing-specs": "git+https://github.com/tscircuit/jlcpcb-manufacturing-specs#e08af159db01a37db007e33f0a7268d0e4a279a5",
@@ -51,8 +52,8 @@
51
52
  "@tscircuit/props": "^0.0.549",
52
53
  "@tscircuit/ngspice-spice-engine": "^0.0.16",
53
54
  "@tscircuit/schematic-match-adapt": "^0.0.18",
54
- "@tscircuit/solver-utils": "^0.0.16",
55
55
  "@tscircuit/schematic-trace-solver": "^0.0.69",
56
+ "@tscircuit/solver-utils": "^0.0.16",
56
57
  "@tscircuit/soup-util": "^0.0.41",
57
58
  "@types/bun": "^1.2.16",
58
59
  "@types/debug": "^4.1.12",