@tscircuit/core 0.0.1008 → 0.0.1010

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, subpanelProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, interconnectProps, solderjumperProps, ledProps, powerSourceProps, voltageSourceProps, currentSourceProps, resistorProps, constraintProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNoteTextProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, subcircuitProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, courtyardCircleProps, 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, 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, subpanelProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, interconnectProps, solderjumperProps, ledProps, powerSourceProps, voltageSourceProps, currentSourceProps, resistorProps, constraintProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNoteTextProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, subcircuitProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, courtyardCircleProps, 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, 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';
@@ -67027,6 +67027,171 @@ declare class CourtyardCircle extends PrimitiveComponent<typeof courtyardCircleP
67027
67027
  }): void;
67028
67028
  }
67029
67029
 
67030
+ declare class CourtyardRect extends PrimitiveComponent<typeof courtyardRectProps> {
67031
+ pcb_courtyard_rect_id: string | null;
67032
+ isPcbPrimitive: boolean;
67033
+ get config(): {
67034
+ componentName: string;
67035
+ zodProps: zod.ZodObject<Omit<{
67036
+ pcbX: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>]>>;
67037
+ pcbY: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>]>>;
67038
+ pcbLeftEdgeX: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>]>>;
67039
+ pcbRightEdgeX: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>]>>;
67040
+ pcbTopEdgeY: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>]>>;
67041
+ pcbBottomEdgeY: zod.ZodOptional<zod.ZodUnion<[zod.ZodString, zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>]>>;
67042
+ pcbOffsetX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
67043
+ pcbOffsetY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
67044
+ pcbRotation: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
67045
+ pcbPositionAnchor: zod.ZodOptional<zod.ZodString>;
67046
+ pcbPositionMode: zod.ZodOptional<zod.ZodEnum<["relative_to_group_anchor", "auto", "relative_to_board_anchor", "relative_to_component_anchor"]>>;
67047
+ layer: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
67048
+ name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
67049
+ }, "strip", zod.ZodTypeAny, {
67050
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
67051
+ }, {
67052
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
67053
+ }>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
67054
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
67055
+ }>>;
67056
+ pcbMarginTop: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
67057
+ pcbMarginRight: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
67058
+ pcbMarginBottom: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
67059
+ pcbMarginLeft: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
67060
+ pcbMarginX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
67061
+ pcbMarginY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
67062
+ pcbStyle: zod.ZodOptional<zod.ZodObject<{
67063
+ silkscreenFontSize: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
67064
+ viaPadDiameter: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
67065
+ viaHoleDiameter: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
67066
+ silkscreenTextPosition: zod.ZodOptional<zod.ZodUnion<[zod.ZodEnum<["centered", "outside", "none"]>, zod.ZodObject<{
67067
+ offsetX: zod.ZodNumber;
67068
+ offsetY: zod.ZodNumber;
67069
+ }, "strip", zod.ZodTypeAny, {
67070
+ offsetX: number;
67071
+ offsetY: number;
67072
+ }, {
67073
+ offsetX: number;
67074
+ offsetY: number;
67075
+ }>]>>;
67076
+ silkscreenTextVisibility: zod.ZodOptional<zod.ZodEnum<["hidden", "visible", "inherit"]>>;
67077
+ }, "strip", zod.ZodTypeAny, {
67078
+ silkscreenFontSize?: number | undefined;
67079
+ viaPadDiameter?: number | undefined;
67080
+ viaHoleDiameter?: number | undefined;
67081
+ silkscreenTextPosition?: "centered" | "outside" | "none" | {
67082
+ offsetX: number;
67083
+ offsetY: number;
67084
+ } | undefined;
67085
+ silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
67086
+ }, {
67087
+ silkscreenFontSize?: string | number | undefined;
67088
+ viaPadDiameter?: string | number | undefined;
67089
+ viaHoleDiameter?: string | number | undefined;
67090
+ silkscreenTextPosition?: "centered" | "outside" | "none" | {
67091
+ offsetX: number;
67092
+ offsetY: number;
67093
+ } | undefined;
67094
+ silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
67095
+ }>>;
67096
+ pcbRelative: zod.ZodOptional<zod.ZodBoolean>;
67097
+ relative: zod.ZodOptional<zod.ZodBoolean>;
67098
+ }, "pcbRotation"> & {
67099
+ width: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
67100
+ height: zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>;
67101
+ strokeWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
67102
+ isFilled: zod.ZodOptional<zod.ZodBoolean>;
67103
+ hasStroke: zod.ZodOptional<zod.ZodBoolean>;
67104
+ isStrokeDashed: zod.ZodOptional<zod.ZodBoolean>;
67105
+ color: zod.ZodOptional<zod.ZodString>;
67106
+ }, "strip", zod.ZodTypeAny, {
67107
+ width: number;
67108
+ height: number;
67109
+ layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
67110
+ pcbX?: string | number | undefined;
67111
+ pcbY?: string | number | undefined;
67112
+ pcbLeftEdgeX?: string | number | undefined;
67113
+ pcbRightEdgeX?: string | number | undefined;
67114
+ pcbTopEdgeY?: string | number | undefined;
67115
+ pcbBottomEdgeY?: string | number | undefined;
67116
+ pcbOffsetX?: number | undefined;
67117
+ pcbOffsetY?: number | undefined;
67118
+ pcbPositionAnchor?: string | undefined;
67119
+ pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
67120
+ pcbMarginTop?: number | undefined;
67121
+ pcbMarginRight?: number | undefined;
67122
+ pcbMarginBottom?: number | undefined;
67123
+ pcbMarginLeft?: number | undefined;
67124
+ pcbMarginX?: number | undefined;
67125
+ pcbMarginY?: number | undefined;
67126
+ pcbStyle?: {
67127
+ silkscreenFontSize?: number | undefined;
67128
+ viaPadDiameter?: number | undefined;
67129
+ viaHoleDiameter?: number | undefined;
67130
+ silkscreenTextPosition?: "centered" | "outside" | "none" | {
67131
+ offsetX: number;
67132
+ offsetY: number;
67133
+ } | undefined;
67134
+ silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
67135
+ } | undefined;
67136
+ pcbRelative?: boolean | undefined;
67137
+ relative?: boolean | undefined;
67138
+ strokeWidth?: number | undefined;
67139
+ color?: string | undefined;
67140
+ isFilled?: boolean | undefined;
67141
+ hasStroke?: boolean | undefined;
67142
+ isStrokeDashed?: boolean | undefined;
67143
+ }, {
67144
+ width: string | number;
67145
+ height: string | number;
67146
+ layer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
67147
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
67148
+ } | undefined;
67149
+ pcbX?: string | number | undefined;
67150
+ pcbY?: string | number | undefined;
67151
+ pcbLeftEdgeX?: string | number | undefined;
67152
+ pcbRightEdgeX?: string | number | undefined;
67153
+ pcbTopEdgeY?: string | number | undefined;
67154
+ pcbBottomEdgeY?: string | number | undefined;
67155
+ pcbOffsetX?: string | number | undefined;
67156
+ pcbOffsetY?: string | number | undefined;
67157
+ pcbPositionAnchor?: string | undefined;
67158
+ pcbPositionMode?: "relative_to_group_anchor" | "auto" | "relative_to_board_anchor" | "relative_to_component_anchor" | undefined;
67159
+ pcbMarginTop?: string | number | undefined;
67160
+ pcbMarginRight?: string | number | undefined;
67161
+ pcbMarginBottom?: string | number | undefined;
67162
+ pcbMarginLeft?: string | number | undefined;
67163
+ pcbMarginX?: string | number | undefined;
67164
+ pcbMarginY?: string | number | undefined;
67165
+ pcbStyle?: {
67166
+ silkscreenFontSize?: string | number | undefined;
67167
+ viaPadDiameter?: string | number | undefined;
67168
+ viaHoleDiameter?: string | number | undefined;
67169
+ silkscreenTextPosition?: "centered" | "outside" | "none" | {
67170
+ offsetX: number;
67171
+ offsetY: number;
67172
+ } | undefined;
67173
+ silkscreenTextVisibility?: "hidden" | "visible" | "inherit" | undefined;
67174
+ } | undefined;
67175
+ pcbRelative?: boolean | undefined;
67176
+ relative?: boolean | undefined;
67177
+ strokeWidth?: string | number | undefined;
67178
+ color?: string | undefined;
67179
+ isFilled?: boolean | undefined;
67180
+ hasStroke?: boolean | undefined;
67181
+ isStrokeDashed?: boolean | undefined;
67182
+ }>;
67183
+ };
67184
+ doInitialPcbPrimitiveRender(): void;
67185
+ getPcbSize(): {
67186
+ width: number;
67187
+ height: number;
67188
+ };
67189
+ _moveCircuitJsonElements({ deltaX, deltaY, }: {
67190
+ deltaX: number;
67191
+ deltaY: number;
67192
+ }): void;
67193
+ }
67194
+
67030
67195
  declare class SilkscreenCircle extends PrimitiveComponent<typeof silkscreenCircleProps> {
67031
67196
  pcb_silkscreen_circle_id: string | null;
67032
67197
  isPcbPrimitive: boolean;
@@ -131251,6 +131416,7 @@ interface TscircuitElements {
131251
131416
  silkscreencircle: _tscircuit_props.SilkscreenCircleProps;
131252
131417
  tracehint: _tscircuit_props.TraceHintProps;
131253
131418
  courtyardcircle: _tscircuit_props.CourtyardCircleProps;
131419
+ courtyardrect: _tscircuit_props.CourtyardRectProps;
131254
131420
  pcbtrace: _tscircuit_props.PcbTraceProps;
131255
131421
  fabricationnoterect: _tscircuit_props.FabricationNoteRectProps;
131256
131422
  pcbnoteline: _tscircuit_props.PcbNoteLineProps;
@@ -131293,4 +131459,4 @@ declare module "react/jsx-runtime" {
131293
131459
  }
131294
131460
  }
131295
131461
 
131296
- 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, CopperText, CourtyardCircle, Crystal, CurrentSource, Cutout, type DebugLogOutputEvent, Diode, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Fiducial, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Interconnect, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, Net, NetLabel, NormalComponent, type Obstacle, OpAmp, type PackingEndEvent, type PackingErrorEvent, type PackingStartEvent, Panel, 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, SOLVERS, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicPath, SchematicRect, SchematicRow, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, type SolverName, type SolverStartedEvent, 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, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
131462
+ 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, CopperText, CourtyardCircle, CourtyardRect, Crystal, CurrentSource, Cutout, type DebugLogOutputEvent, Diode, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Fiducial, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Interconnect, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, Net, NetLabel, NormalComponent, type Obstacle, OpAmp, type PackingEndEvent, type PackingErrorEvent, type PackingStartEvent, Panel, 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, SOLVERS, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicPath, SchematicRect, SchematicRow, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, type SolverName, type SolverStartedEvent, 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, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ __export(components_exports, {
20
20
  CopperPour: () => CopperPour,
21
21
  CopperText: () => CopperText,
22
22
  CourtyardCircle: () => CourtyardCircle,
23
+ CourtyardRect: () => CourtyardRect,
23
24
  Crystal: () => Crystal,
24
25
  CurrentSource: () => CurrentSource,
25
26
  Cutout: () => Cutout,
@@ -7528,6 +7529,7 @@ function Trace_doInitialPcbManualTraceRender(trace) {
7528
7529
  }
7529
7530
  const otherPort = ports.find((p) => p !== anchorPort) ?? ports[1];
7530
7531
  const layer = anchorPort.getAvailablePcbLayers()[0] || "top";
7532
+ let currentLayer = layer;
7531
7533
  const anchorPos = anchorPort._getGlobalPcbPositionAfterLayout();
7532
7534
  const otherPos = otherPort._getGlobalPcbPositionAfterLayout();
7533
7535
  const route = [];
@@ -7536,13 +7538,17 @@ function Trace_doInitialPcbManualTraceRender(trace) {
7536
7538
  x: anchorPos.x,
7537
7539
  y: anchorPos.y,
7538
7540
  width,
7539
- layer,
7541
+ layer: currentLayer,
7540
7542
  start_pcb_port_id: anchorPort.pcb_port_id
7541
7543
  });
7542
7544
  const transform = anchorPort?._computePcbGlobalTransformBeforeLayout?.() || identity3();
7543
- for (const pt of props.pcbPath) {
7545
+ const pcbPath = props.pcbPath;
7546
+ for (const pt of pcbPath) {
7544
7547
  let coordinates;
7545
7548
  let isGlobalPosition = false;
7549
+ const isViaPoint = typeof pt !== "string" && pt.via;
7550
+ let viaFromLayer;
7551
+ let viaToLayer;
7546
7552
  if (typeof pt === "string") {
7547
7553
  const resolvedPort = trace.getSubcircuit().selectOne(pt, {
7548
7554
  type: "port"
@@ -7564,22 +7570,37 @@ function Trace_doInitialPcbManualTraceRender(trace) {
7564
7570
  } else {
7565
7571
  coordinates = { x: pt.x, y: pt.y };
7566
7572
  isGlobalPosition = false;
7573
+ if (pt.via) {
7574
+ viaFromLayer = pt.fromLayer ?? currentLayer;
7575
+ viaToLayer = pt.toLayer;
7576
+ }
7567
7577
  }
7568
7578
  const finalCoordinates = isGlobalPosition ? coordinates : applyToPoint7(transform, coordinates);
7569
- route.push({
7570
- route_type: "wire",
7571
- x: finalCoordinates.x,
7572
- y: finalCoordinates.y,
7573
- width,
7574
- layer
7575
- });
7579
+ if (isViaPoint) {
7580
+ route.push({
7581
+ route_type: "via",
7582
+ x: finalCoordinates.x,
7583
+ y: finalCoordinates.y,
7584
+ from_layer: viaFromLayer ?? currentLayer,
7585
+ to_layer: viaToLayer ?? currentLayer
7586
+ });
7587
+ currentLayer = viaToLayer ?? currentLayer;
7588
+ } else {
7589
+ route.push({
7590
+ route_type: "wire",
7591
+ x: finalCoordinates.x,
7592
+ y: finalCoordinates.y,
7593
+ width,
7594
+ layer: currentLayer
7595
+ });
7596
+ }
7576
7597
  }
7577
7598
  route.push({
7578
7599
  route_type: "wire",
7579
7600
  x: otherPos.x,
7580
7601
  y: otherPos.y,
7581
7602
  width,
7582
- layer,
7603
+ layer: currentLayer,
7583
7604
  end_pcb_port_id: otherPort.pcb_port_id
7584
7605
  });
7585
7606
  const traceLength = getTraceLength(route);
@@ -7590,6 +7611,22 @@ function Trace_doInitialPcbManualTraceRender(trace) {
7590
7611
  pcb_group_id: trace.getGroup()?.pcb_group_id ?? void 0,
7591
7612
  trace_length: traceLength
7592
7613
  });
7614
+ const pcbStyle = trace.getInheritedMergedProperty("pcbStyle");
7615
+ const { holeDiameter, padDiameter } = getViaDiameterDefaults(pcbStyle);
7616
+ for (const point6 of route) {
7617
+ if (point6.route_type === "via") {
7618
+ db.pcb_via.insert({
7619
+ pcb_trace_id: pcb_trace.pcb_trace_id,
7620
+ x: point6.x,
7621
+ y: point6.y,
7622
+ hole_diameter: holeDiameter,
7623
+ outer_diameter: padDiameter,
7624
+ layers: [point6.from_layer, point6.to_layer],
7625
+ from_layer: point6.from_layer,
7626
+ to_layer: point6.to_layer
7627
+ });
7628
+ }
7629
+ }
7593
7630
  trace._portsRoutedOnPcb = ports;
7594
7631
  trace.pcb_trace_id = pcb_trace.pcb_trace_id;
7595
7632
  trace._insertErrorIfTraceIsOutsideBoard(route, ports);
@@ -19370,6 +19407,68 @@ var CourtyardCircle = class extends PrimitiveComponent2 {
19370
19407
  }
19371
19408
  };
19372
19409
 
19410
+ // lib/components/primitive-components/CourtyardRect.ts
19411
+ import { courtyardRectProps } from "@tscircuit/props";
19412
+ var CourtyardRect = class extends PrimitiveComponent2 {
19413
+ pcb_courtyard_rect_id = null;
19414
+ isPcbPrimitive = true;
19415
+ get config() {
19416
+ return {
19417
+ componentName: "CourtyardRect",
19418
+ zodProps: courtyardRectProps
19419
+ };
19420
+ }
19421
+ doInitialPcbPrimitiveRender() {
19422
+ if (this.root?.pcbDisabled) return;
19423
+ const { db } = this.root;
19424
+ const { _parsedProps: props } = this;
19425
+ const position = this._getGlobalPcbPositionBeforeLayout();
19426
+ const { maybeFlipLayer } = this._getPcbPrimitiveFlippedHelpers();
19427
+ const layer = maybeFlipLayer(props.layer ?? "top");
19428
+ if (layer !== "top" && layer !== "bottom") {
19429
+ throw new Error(
19430
+ `Invalid layer "${layer}" for CourtyardRect. Must be "top" or "bottom".`
19431
+ );
19432
+ }
19433
+ const subcircuit = this.getSubcircuit();
19434
+ const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id;
19435
+ const pcb_courtyard_rect = db.pcb_courtyard_rect.insert({
19436
+ pcb_component_id,
19437
+ layer,
19438
+ center: {
19439
+ x: position.x,
19440
+ y: position.y
19441
+ },
19442
+ width: props.width,
19443
+ height: props.height,
19444
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
19445
+ pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
19446
+ });
19447
+ this.pcb_courtyard_rect_id = pcb_courtyard_rect.pcb_courtyard_rect_id;
19448
+ }
19449
+ getPcbSize() {
19450
+ const { _parsedProps: props } = this;
19451
+ return { width: props.width, height: props.height };
19452
+ }
19453
+ _moveCircuitJsonElements({
19454
+ deltaX,
19455
+ deltaY
19456
+ }) {
19457
+ if (this.root?.pcbDisabled) return;
19458
+ const { db } = this.root;
19459
+ if (!this.pcb_courtyard_rect_id) return;
19460
+ const rect = db.pcb_courtyard_rect.get(this.pcb_courtyard_rect_id);
19461
+ if (rect) {
19462
+ db.pcb_courtyard_rect.update(this.pcb_courtyard_rect_id, {
19463
+ center: {
19464
+ x: rect.center.x + deltaX,
19465
+ y: rect.center.y + deltaY
19466
+ }
19467
+ });
19468
+ }
19469
+ }
19470
+ };
19471
+
19373
19472
  // lib/components/primitive-components/SilkscreenCircle.ts
19374
19473
  import { silkscreenCircleProps } from "@tscircuit/props";
19375
19474
  var SilkscreenCircle = class extends PrimitiveComponent2 {
@@ -21815,7 +21914,7 @@ import { identity as identity5 } from "transformation-matrix";
21815
21914
  var package_default = {
21816
21915
  name: "@tscircuit/core",
21817
21916
  type: "module",
21818
- version: "0.0.1007",
21917
+ version: "0.0.1009",
21819
21918
  types: "dist/index.d.ts",
21820
21919
  main: "dist/index.js",
21821
21920
  module: "dist/index.js",
@@ -22405,6 +22504,7 @@ export {
22405
22504
  CopperPour,
22406
22505
  CopperText,
22407
22506
  CourtyardCircle,
22507
+ CourtyardRect,
22408
22508
  Crystal,
22409
22509
  CurrentSource,
22410
22510
  Cutout,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1008",
4
+ "version": "0.0.1010",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",