@tscircuit/core 0.0.724 → 0.0.726

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, 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, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, subcircuitProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, switchProps, testpointProps, schematicTextProps, schematicBoxProps, schematicTableProps, schematicRowProps, schematicCellProps, 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, fabricationNotePathProps, fabricationNoteTextProps, 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, testpointProps, schematicTextProps, schematicBoxProps, schematicTableProps, schematicRowProps, schematicCellProps, 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';
@@ -13,7 +13,7 @@ import { CircuitJsonUtilObjects } from '@tscircuit/circuit-json-util';
13
13
  import { ConnectivityMap } from 'circuit-json-to-connectivity-map';
14
14
  import { GraphicsObject } from 'graphics-debug';
15
15
 
16
- declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SchematicPrimitiveRender", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbLayout", "PcbBoardAutoSize", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender"];
16
+ declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SchematicPrimitiveRender", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbLayout", "PcbBoardAutoSize", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender"];
17
17
  type RenderPhase = (typeof orderedRenderPhases)[number];
18
18
  type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
19
19
  type RenderPhaseStates = Record<RenderPhase, {
@@ -1781,9 +1781,9 @@ declare class Board extends Group<typeof boardProps> {
1781
1781
  serverCacheEnabled: zod.ZodOptional<zod.ZodBoolean>;
1782
1782
  cache: zod.ZodOptional<zod.ZodType<_tscircuit_props.PcbRouteCache, zod.ZodTypeDef, _tscircuit_props.PcbRouteCache>>;
1783
1783
  traceClearance: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
1784
- groupMode: zod.ZodOptional<zod.ZodEnum<["sequential-trace", "subcircuit"]>>;
1784
+ groupMode: zod.ZodOptional<zod.ZodEnum<["sequential_trace", "subcircuit", "sequential-trace"]>>;
1785
1785
  algorithmFn: zod.ZodOptional<zod.ZodType<(simpleRouteJson: any) => Promise<any>, zod.ZodTypeDef, (simpleRouteJson: any) => Promise<any>>>;
1786
- preset: zod.ZodOptional<zod.ZodEnum<["sequential-trace", "subcircuit", "auto", "auto-local", "auto-cloud"]>>;
1786
+ preset: zod.ZodOptional<zod.ZodEnum<["sequential_trace", "subcircuit", "auto", "auto_local", "auto_cloud", "freerouting", "sequential-trace", "auto-local", "auto-cloud"]>>;
1787
1787
  local: zod.ZodOptional<zod.ZodBoolean>;
1788
1788
  }, "strip", zod.ZodTypeAny, {
1789
1789
  serverUrl?: string | undefined;
@@ -1792,9 +1792,9 @@ declare class Board extends Group<typeof boardProps> {
1792
1792
  serverCacheEnabled?: boolean | undefined;
1793
1793
  cache?: _tscircuit_props.PcbRouteCache | undefined;
1794
1794
  traceClearance?: number | undefined;
1795
- groupMode?: "sequential-trace" | "subcircuit" | undefined;
1795
+ groupMode?: "sequential_trace" | "subcircuit" | "sequential-trace" | undefined;
1796
1796
  algorithmFn?: ((simpleRouteJson: any) => Promise<any>) | undefined;
1797
- preset?: "sequential-trace" | "subcircuit" | "auto" | "auto-local" | "auto-cloud" | undefined;
1797
+ preset?: "sequential_trace" | "subcircuit" | "sequential-trace" | "auto" | "auto_local" | "auto_cloud" | "freerouting" | "auto-local" | "auto-cloud" | undefined;
1798
1798
  local?: boolean | undefined;
1799
1799
  }, {
1800
1800
  serverUrl?: string | undefined;
@@ -1803,11 +1803,11 @@ declare class Board extends Group<typeof boardProps> {
1803
1803
  serverCacheEnabled?: boolean | undefined;
1804
1804
  cache?: _tscircuit_props.PcbRouteCache | undefined;
1805
1805
  traceClearance?: string | number | undefined;
1806
- groupMode?: "sequential-trace" | "subcircuit" | undefined;
1806
+ groupMode?: "sequential_trace" | "subcircuit" | "sequential-trace" | undefined;
1807
1807
  algorithmFn?: ((simpleRouteJson: any) => Promise<any>) | undefined;
1808
- preset?: "sequential-trace" | "subcircuit" | "auto" | "auto-local" | "auto-cloud" | undefined;
1808
+ preset?: "sequential_trace" | "subcircuit" | "sequential-trace" | "auto" | "auto_local" | "auto_cloud" | "freerouting" | "auto-local" | "auto-cloud" | undefined;
1809
1809
  local?: boolean | undefined;
1810
- }>, zod.ZodLiteral<"sequential-trace">, zod.ZodLiteral<"subcircuit">, zod.ZodLiteral<"auto">, zod.ZodLiteral<"auto-local">, zod.ZodLiteral<"auto-cloud">]>>;
1810
+ }>, zod.ZodLiteral<"sequential_trace">, zod.ZodLiteral<"subcircuit">, zod.ZodLiteral<"auto">, zod.ZodLiteral<"auto_local">, zod.ZodLiteral<"auto_cloud">, zod.ZodLiteral<"freerouting">, zod.ZodLiteral<"sequential-trace">, zod.ZodLiteral<"auto-local">, zod.ZodLiteral<"auto-cloud">]>>;
1811
1811
  square: zod.ZodOptional<zod.ZodBoolean>;
1812
1812
  emptyArea: zod.ZodOptional<zod.ZodString>;
1813
1813
  filledArea: zod.ZodOptional<zod.ZodString>;
@@ -2054,16 +2054,16 @@ declare class Board extends Group<typeof boardProps> {
2054
2054
  defaultTraceWidth?: number | undefined;
2055
2055
  minTraceWidth?: number | undefined;
2056
2056
  pcbRouteCache?: _tscircuit_props.PcbRouteCache | undefined;
2057
- autorouter?: "sequential-trace" | "subcircuit" | "auto" | "auto-local" | "auto-cloud" | {
2057
+ autorouter?: "sequential_trace" | "subcircuit" | "sequential-trace" | "auto" | "auto_local" | "auto_cloud" | "freerouting" | "auto-local" | "auto-cloud" | {
2058
2058
  serverUrl?: string | undefined;
2059
2059
  inputFormat?: "simplified" | "circuit-json" | undefined;
2060
2060
  serverMode?: "job" | "solve-endpoint" | undefined;
2061
2061
  serverCacheEnabled?: boolean | undefined;
2062
2062
  cache?: _tscircuit_props.PcbRouteCache | undefined;
2063
2063
  traceClearance?: number | undefined;
2064
- groupMode?: "sequential-trace" | "subcircuit" | undefined;
2064
+ groupMode?: "sequential_trace" | "subcircuit" | "sequential-trace" | undefined;
2065
2065
  algorithmFn?: ((simpleRouteJson: any) => Promise<any>) | undefined;
2066
- preset?: "sequential-trace" | "subcircuit" | "auto" | "auto-local" | "auto-cloud" | undefined;
2066
+ preset?: "sequential_trace" | "subcircuit" | "sequential-trace" | "auto" | "auto_local" | "auto_cloud" | "freerouting" | "auto-local" | "auto-cloud" | undefined;
2067
2067
  local?: boolean | undefined;
2068
2068
  } | undefined;
2069
2069
  schAutoLayoutEnabled?: boolean | undefined;
@@ -2307,16 +2307,16 @@ declare class Board extends Group<typeof boardProps> {
2307
2307
  defaultTraceWidth?: string | number | undefined;
2308
2308
  minTraceWidth?: string | number | undefined;
2309
2309
  pcbRouteCache?: _tscircuit_props.PcbRouteCache | undefined;
2310
- autorouter?: "sequential-trace" | "subcircuit" | "auto" | "auto-local" | "auto-cloud" | {
2310
+ autorouter?: "sequential_trace" | "subcircuit" | "sequential-trace" | "auto" | "auto_local" | "auto_cloud" | "freerouting" | "auto-local" | "auto-cloud" | {
2311
2311
  serverUrl?: string | undefined;
2312
2312
  inputFormat?: "simplified" | "circuit-json" | undefined;
2313
2313
  serverMode?: "job" | "solve-endpoint" | undefined;
2314
2314
  serverCacheEnabled?: boolean | undefined;
2315
2315
  cache?: _tscircuit_props.PcbRouteCache | undefined;
2316
2316
  traceClearance?: string | number | undefined;
2317
- groupMode?: "sequential-trace" | "subcircuit" | undefined;
2317
+ groupMode?: "sequential_trace" | "subcircuit" | "sequential-trace" | undefined;
2318
2318
  algorithmFn?: ((simpleRouteJson: any) => Promise<any>) | undefined;
2319
- preset?: "sequential-trace" | "subcircuit" | "auto" | "auto-local" | "auto-cloud" | undefined;
2319
+ preset?: "sequential_trace" | "subcircuit" | "sequential-trace" | "auto" | "auto_local" | "auto_cloud" | "freerouting" | "auto-local" | "auto-cloud" | undefined;
2320
2320
  local?: boolean | undefined;
2321
2321
  } | undefined;
2322
2322
  schAutoLayoutEnabled?: boolean | undefined;
@@ -19407,6 +19407,47 @@ declare class Via extends PrimitiveComponent<typeof viaProps> {
19407
19407
  doInitialPcbPrimitiveRender(): void;
19408
19408
  }
19409
19409
 
19410
+ declare class CopperPour extends PrimitiveComponent<typeof copperPourProps> {
19411
+ isPcbPrimitive: boolean;
19412
+ get config(): {
19413
+ componentName: string;
19414
+ zodProps: z.ZodObject<{
19415
+ name: z.ZodOptional<z.ZodString>;
19416
+ layer: z.ZodEffects<z.ZodUnion<[z.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, z.ZodObject<{
19417
+ name: z.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
19418
+ }, "strip", z.ZodTypeAny, {
19419
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
19420
+ }, {
19421
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
19422
+ }>]>, "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6", "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
19423
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
19424
+ }>;
19425
+ connectsTo: z.ZodString;
19426
+ padMargin: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
19427
+ traceMargin: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
19428
+ }, "strip", z.ZodTypeAny, {
19429
+ layer: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
19430
+ connectsTo: string;
19431
+ name?: string | undefined;
19432
+ padMargin?: number | undefined;
19433
+ traceMargin?: number | undefined;
19434
+ }, {
19435
+ layer: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
19436
+ name: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6";
19437
+ };
19438
+ connectsTo: string;
19439
+ name?: string | undefined;
19440
+ padMargin?: string | number | undefined;
19441
+ traceMargin?: string | number | undefined;
19442
+ }>;
19443
+ };
19444
+ getPcbSize(): {
19445
+ width: number;
19446
+ height: number;
19447
+ };
19448
+ doInitialPcbCopperPourRender(): void;
19449
+ }
19450
+
19410
19451
  declare class Cutout extends PrimitiveComponent<typeof cutoutProps> {
19411
19452
  pcb_cutout_id: string | null;
19412
19453
  isPcbPrimitive: boolean;
@@ -32526,6 +32567,7 @@ interface TscircuitElements {
32526
32567
  mosfet: _tscircuit_props.MosfetProps;
32527
32568
  testpoint: _tscircuit_props.TestpointProps;
32528
32569
  voltagesource: VoltageSourceProps;
32570
+ copperpour: _tscircuit_props.CopperPourProps;
32529
32571
  jscad: any;
32530
32572
  }
32531
32573
  declare module "react" {
@@ -32542,4 +32584,4 @@ declare module "react/jsx-runtime" {
32542
32584
  }
32543
32585
  }
32544
32586
 
32545
- export { 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, Crystal, Cutout, type DebugLogOutputEvent, Diode, FabricationNotePath, FabricationNoteText, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, Net, NetLabel, NormalComponent, type Obstacle, 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, SchematicBox, SchematicCell, SchematicRow, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, Subcircuit, Switch, TestPoint, Trace, TraceHint, Transistor, Via, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
32587
+ export { 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, FabricationNotePath, FabricationNoteText, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, Net, NetLabel, NormalComponent, type Obstacle, 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, SchematicBox, SchematicCell, SchematicRow, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, Subcircuit, Switch, TestPoint, Trace, TraceHint, Transistor, Via, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ __export(components_exports, {
16
16
  Capacitor: () => Capacitor,
17
17
  Chip: () => Chip,
18
18
  Constraint: () => Constraint3,
19
+ CopperPour: () => CopperPour,
19
20
  Crystal: () => Crystal,
20
21
  Cutout: () => Cutout,
21
22
  Diode: () => Diode,
@@ -124,6 +125,7 @@ var orderedRenderPhases = [
124
125
  "PcbManualTraceRender",
125
126
  "PcbTraceRender",
126
127
  "PcbRouteNetIslands",
128
+ "PcbCopperPourRender",
127
129
  "PcbDesignRuleChecks",
128
130
  "SilkscreenOverlapAdjustment",
129
131
  "CadModelRender",
@@ -136,6 +138,11 @@ var asyncPhaseDependencies = {
136
138
  PcbBoardAutoSize: ["PcbFootprintStringRender"],
137
139
  PcbTraceHintRender: ["PcbFootprintStringRender"],
138
140
  PcbManualTraceRender: ["PcbFootprintStringRender"],
141
+ PcbCopperPourRender: [
142
+ "PcbFootprintStringRender",
143
+ "PcbTraceRender",
144
+ "PcbRouteNetIslands"
145
+ ],
139
146
  PcbTraceRender: ["PcbFootprintStringRender"],
140
147
  PcbRouteNetIslands: ["PcbFootprintStringRender"],
141
148
  PcbDesignRuleChecks: ["PcbFootprintStringRender"],
@@ -14047,6 +14054,215 @@ var Via = class extends PrimitiveComponent2 {
14047
14054
  }
14048
14055
  };
14049
14056
 
14057
+ // lib/components/primitive-components/CopperPour.ts
14058
+ import { copperPourProps } from "@tscircuit/props";
14059
+ import "zod";
14060
+ import Flatten from "@flatten-js/core";
14061
+ import { getFullConnectivityMapFromCircuitJson as getFullConnectivityMapFromCircuitJson4 } from "circuit-json-to-connectivity-map";
14062
+ var CopperPour = class extends PrimitiveComponent2 {
14063
+ isPcbPrimitive = true;
14064
+ get config() {
14065
+ return {
14066
+ componentName: "CopperPour",
14067
+ zodProps: copperPourProps
14068
+ };
14069
+ }
14070
+ getPcbSize() {
14071
+ return { width: 0, height: 0 };
14072
+ }
14073
+ doInitialPcbCopperPourRender() {
14074
+ if (this.root?.pcbDisabled) return;
14075
+ this._queueAsyncEffect("PcbCopperPourRender", async () => {
14076
+ const { db } = this.root;
14077
+ const { _parsedProps: props } = this;
14078
+ const net = this.getSubcircuit().selectOne(props.connectsTo);
14079
+ if (!net || !net.source_net_id) {
14080
+ this.renderError(`Net "${props.connectsTo}" not found for copper pour`);
14081
+ return;
14082
+ }
14083
+ const board = db.pcb_board.list()[0];
14084
+ if (!board) {
14085
+ this.renderError("No board found for copper pour");
14086
+ return;
14087
+ }
14088
+ let boardPolygon;
14089
+ if (board.outline && board.outline.length > 0) {
14090
+ boardPolygon = new Flatten.Polygon(
14091
+ board.outline.map((p) => Flatten.point(p.x, p.y))
14092
+ );
14093
+ } else {
14094
+ boardPolygon = new Flatten.Polygon(
14095
+ new Flatten.Box(
14096
+ board.center.x - board.width / 2,
14097
+ board.center.y - board.height / 2,
14098
+ board.center.x + board.width / 2,
14099
+ board.center.y + board.height / 2
14100
+ ).toPoints()
14101
+ );
14102
+ }
14103
+ const connMap = getFullConnectivityMapFromCircuitJson4(db.toArray());
14104
+ const obstaclesRaw = getObstaclesFromCircuitJson(
14105
+ db.toArray(),
14106
+ connMap
14107
+ ).filter((o) => o.layers.includes(props.layer));
14108
+ for (const pcb_trace of db.pcb_trace.list()) {
14109
+ if (!pcb_trace.route) continue;
14110
+ for (let i = 0; i < pcb_trace.route.length - 1; i++) {
14111
+ const p1 = pcb_trace.route[i];
14112
+ const p2 = pcb_trace.route[i + 1];
14113
+ if (p1.route_type !== "wire" || p2.route_type !== "wire") continue;
14114
+ if (p1.layer !== props.layer) continue;
14115
+ const segmentWidth = p1.width;
14116
+ if (segmentWidth === 0) continue;
14117
+ const segmentLength = Math.hypot(p1.x - p2.x, p1.y - p2.y);
14118
+ if (segmentLength === 0) continue;
14119
+ const centerX = (p1.x + p2.x) / 2;
14120
+ const centerY = (p1.y + p2.y) / 2;
14121
+ const rotationDeg = Math.atan2(p2.y - p1.y, p2.x - p1.x) * 180 / Math.PI;
14122
+ const rotatedRect = {
14123
+ center: { x: centerX, y: centerY },
14124
+ width: segmentLength,
14125
+ height: segmentWidth,
14126
+ rotation: rotationDeg
14127
+ };
14128
+ const approximatingRects = generateApproximatingRects(rotatedRect);
14129
+ for (const rect of approximatingRects) {
14130
+ obstaclesRaw.push({
14131
+ type: "rect",
14132
+ layers: [p1.layer],
14133
+ center: rect.center,
14134
+ width: rect.width,
14135
+ height: rect.height,
14136
+ connectedTo: pcb_trace.source_trace_id ? [pcb_trace.source_trace_id] : [],
14137
+ obstacle_type: "trace"
14138
+ });
14139
+ }
14140
+ }
14141
+ }
14142
+ const rectObstaclesToSubtract = [];
14143
+ const circularObstacles = [];
14144
+ const traceMargin = props.traceMargin ?? 0.2;
14145
+ const padMargin = props.padMargin ?? 0.2;
14146
+ for (const obs of obstaclesRaw) {
14147
+ const isOnNet = obs.connectedTo.some(
14148
+ (id) => connMap.areIdsConnected(id, net.source_net_id)
14149
+ );
14150
+ if (isOnNet) {
14151
+ continue;
14152
+ }
14153
+ if (obs.type === "oval" && obs.width === obs.height) {
14154
+ const radius = obs.width / 2 + padMargin;
14155
+ circularObstacles.push({
14156
+ center: obs.center,
14157
+ radius
14158
+ });
14159
+ continue;
14160
+ }
14161
+ if (obs.type === "rect" && obs.width === obs.height && obs.connectedTo.length === 0) {
14162
+ const radius = obs.width / 2;
14163
+ circularObstacles.push({
14164
+ center: obs.center,
14165
+ radius
14166
+ });
14167
+ continue;
14168
+ }
14169
+ const margin = traceMargin;
14170
+ const b = new Flatten.Box(
14171
+ obs.center.x - obs.width / 2 - margin,
14172
+ obs.center.y - obs.height / 2 - margin,
14173
+ obs.center.x + obs.width / 2 + margin,
14174
+ obs.center.y + obs.height / 2 + margin
14175
+ );
14176
+ rectObstaclesToSubtract.push(new Flatten.Polygon(b.toPoints()));
14177
+ }
14178
+ let pourPolygons = boardPolygon;
14179
+ if (rectObstaclesToSubtract.length > 0) {
14180
+ const obstacleUnion = rectObstaclesToSubtract.reduce(
14181
+ (acc, p) => Flatten.BooleanOperations.unify(acc, p)
14182
+ );
14183
+ if (obstacleUnion && !obstacleUnion.isEmpty()) {
14184
+ pourPolygons = Flatten.BooleanOperations.subtract(
14185
+ boardPolygon,
14186
+ obstacleUnion
14187
+ );
14188
+ }
14189
+ }
14190
+ if (!Array.isArray(pourPolygons)) {
14191
+ pourPolygons = [pourPolygons];
14192
+ }
14193
+ for (const p of pourPolygons) {
14194
+ const islands = p.splitToIslands();
14195
+ for (const island of islands) {
14196
+ if (island.isEmpty()) continue;
14197
+ const faces = [...island.faces];
14198
+ const outer_face_ccw = faces.find(
14199
+ (f) => f.orientation() === Flatten.ORIENTATION.CCW
14200
+ );
14201
+ const inner_faces_cw = faces.filter(
14202
+ (f) => f.orientation() === Flatten.ORIENTATION.CW
14203
+ );
14204
+ if (!outer_face_ccw) continue;
14205
+ if (!db.pcb_copper_pour) {
14206
+ this.renderError(
14207
+ "db.pcb_copper_pour not found. The database schema may be outdated."
14208
+ );
14209
+ return;
14210
+ }
14211
+ const faceToVertices = (face) => face.edges.map((e) => {
14212
+ const pt = {
14213
+ x: e.start.x,
14214
+ y: e.start.y
14215
+ };
14216
+ if (e.isArc) {
14217
+ const bulge = Math.tan(e.shape.sweep / 4);
14218
+ if (Math.abs(bulge) > 1e-9) {
14219
+ pt.bulge = bulge;
14220
+ }
14221
+ }
14222
+ return pt;
14223
+ });
14224
+ outer_face_ccw.reverse();
14225
+ const outer_ring_vertices = faceToVertices(outer_face_ccw);
14226
+ const inner_rings = inner_faces_cw.map((f) => {
14227
+ f.reverse();
14228
+ return { vertices: faceToVertices(f) };
14229
+ });
14230
+ for (const circle of circularObstacles) {
14231
+ const centerPoint = Flatten.point(circle.center.x, circle.center.y);
14232
+ const isContained = island.contains(centerPoint);
14233
+ if (isContained) {
14234
+ inner_rings.push({
14235
+ vertices: [
14236
+ {
14237
+ x: circle.center.x,
14238
+ y: circle.center.y - circle.radius,
14239
+ bulge: 1
14240
+ },
14241
+ {
14242
+ x: circle.center.x,
14243
+ y: circle.center.y + circle.radius,
14244
+ bulge: 1
14245
+ }
14246
+ ]
14247
+ });
14248
+ }
14249
+ }
14250
+ db.pcb_copper_pour.insert({
14251
+ shape: "brep",
14252
+ layer: props.layer,
14253
+ brep_shape: {
14254
+ outer_ring: { vertices: outer_ring_vertices },
14255
+ inner_rings
14256
+ },
14257
+ source_net_id: net.source_net_id,
14258
+ subcircuit_id: this.getSubcircuit()?.subcircuit_id ?? void 0
14259
+ });
14260
+ }
14261
+ }
14262
+ });
14263
+ }
14264
+ };
14265
+
14050
14266
  // lib/components/normal-components/Battery.ts
14051
14267
  import { batteryProps } from "@tscircuit/props";
14052
14268
  var Battery = class extends NormalComponent3 {
@@ -15026,7 +15242,7 @@ import { identity as identity6 } from "transformation-matrix";
15026
15242
  var package_default = {
15027
15243
  name: "@tscircuit/core",
15028
15244
  type: "module",
15029
- version: "0.0.723",
15245
+ version: "0.0.725",
15030
15246
  types: "dist/index.d.ts",
15031
15247
  main: "dist/index.js",
15032
15248
  module: "dist/index.js",
@@ -15065,7 +15281,7 @@ var package_default = {
15065
15281
  "@tscircuit/matchpack": "^0.0.16",
15066
15282
  "@tscircuit/math-utils": "^0.0.21",
15067
15283
  "@tscircuit/miniflex": "^0.0.4",
15068
- "@tscircuit/props": "0.0.319",
15284
+ "@tscircuit/props": "0.0.321",
15069
15285
  "@tscircuit/schematic-autolayout": "^0.0.6",
15070
15286
  "@tscircuit/schematic-match-adapt": "^0.0.16",
15071
15287
  "@tscircuit/schematic-trace-solver": "^0.0.36",
@@ -15096,7 +15312,7 @@ var package_default = {
15096
15312
  "pkg-pr-new": "^0.0.37",
15097
15313
  react: "^19.1.0",
15098
15314
  "react-dom": "^19.1.0",
15099
- "schematic-symbols": "^0.0.198",
15315
+ "schematic-symbols": "^0.0.201",
15100
15316
  "ts-expect": "^1.3.0",
15101
15317
  tsup: "^8.2.4"
15102
15318
  },
@@ -15539,6 +15755,7 @@ export {
15539
15755
  Chip,
15540
15756
  Circuit,
15541
15757
  Constraint3 as Constraint,
15758
+ CopperPour,
15542
15759
  Crystal,
15543
15760
  Cutout,
15544
15761
  Diode,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.724",
4
+ "version": "0.0.726",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -40,7 +40,7 @@
40
40
  "@tscircuit/matchpack": "^0.0.16",
41
41
  "@tscircuit/math-utils": "^0.0.21",
42
42
  "@tscircuit/miniflex": "^0.0.4",
43
- "@tscircuit/props": "0.0.319",
43
+ "@tscircuit/props": "0.0.321",
44
44
  "@tscircuit/schematic-autolayout": "^0.0.6",
45
45
  "@tscircuit/schematic-match-adapt": "^0.0.16",
46
46
  "@tscircuit/schematic-trace-solver": "^0.0.36",
@@ -71,7 +71,7 @@
71
71
  "pkg-pr-new": "^0.0.37",
72
72
  "react": "^19.1.0",
73
73
  "react-dom": "^19.1.0",
74
- "schematic-symbols": "^0.0.198",
74
+ "schematic-symbols": "^0.0.201",
75
75
  "ts-expect": "^1.3.0",
76
76
  "tsup": "^8.2.4"
77
77
  },