@tscircuit/core 0.0.723 → 0.0.725
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 +60 -16
- package/dist/index.js +334 -28
- package/package.json +2 -2
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", "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, {
|
|
@@ -1094,6 +1094,8 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
|
|
|
1094
1094
|
*/
|
|
1095
1095
|
doInitialPcbComponentSizeCalculation(): void;
|
|
1096
1096
|
updatePcbComponentSizeCalculation(): void;
|
|
1097
|
+
doInitialPcbComponentAnchorAlignment(): void;
|
|
1098
|
+
updatePcbComponentAnchorAlignment(): void;
|
|
1097
1099
|
_renderReactSubtree(element: ReactElement): ReactSubtree;
|
|
1098
1100
|
doInitialInitializePortsFromChildren(): void;
|
|
1099
1101
|
doInitialReactSubtreesRender(): void;
|
|
@@ -1779,9 +1781,9 @@ declare class Board extends Group<typeof boardProps> {
|
|
|
1779
1781
|
serverCacheEnabled: zod.ZodOptional<zod.ZodBoolean>;
|
|
1780
1782
|
cache: zod.ZodOptional<zod.ZodType<_tscircuit_props.PcbRouteCache, zod.ZodTypeDef, _tscircuit_props.PcbRouteCache>>;
|
|
1781
1783
|
traceClearance: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
1782
|
-
groupMode: zod.ZodOptional<zod.ZodEnum<["
|
|
1784
|
+
groupMode: zod.ZodOptional<zod.ZodEnum<["sequential_trace", "subcircuit", "sequential-trace"]>>;
|
|
1783
1785
|
algorithmFn: zod.ZodOptional<zod.ZodType<(simpleRouteJson: any) => Promise<any>, zod.ZodTypeDef, (simpleRouteJson: any) => Promise<any>>>;
|
|
1784
|
-
preset: zod.ZodOptional<zod.ZodEnum<["
|
|
1786
|
+
preset: zod.ZodOptional<zod.ZodEnum<["sequential_trace", "subcircuit", "auto", "auto_local", "auto_cloud", "freerouting", "sequential-trace", "auto-local", "auto-cloud"]>>;
|
|
1785
1787
|
local: zod.ZodOptional<zod.ZodBoolean>;
|
|
1786
1788
|
}, "strip", zod.ZodTypeAny, {
|
|
1787
1789
|
serverUrl?: string | undefined;
|
|
@@ -1790,9 +1792,9 @@ declare class Board extends Group<typeof boardProps> {
|
|
|
1790
1792
|
serverCacheEnabled?: boolean | undefined;
|
|
1791
1793
|
cache?: _tscircuit_props.PcbRouteCache | undefined;
|
|
1792
1794
|
traceClearance?: number | undefined;
|
|
1793
|
-
groupMode?: "
|
|
1795
|
+
groupMode?: "sequential_trace" | "subcircuit" | "sequential-trace" | undefined;
|
|
1794
1796
|
algorithmFn?: ((simpleRouteJson: any) => Promise<any>) | undefined;
|
|
1795
|
-
preset?: "sequential-trace" | "
|
|
1797
|
+
preset?: "sequential_trace" | "subcircuit" | "sequential-trace" | "auto" | "auto_local" | "auto_cloud" | "freerouting" | "auto-local" | "auto-cloud" | undefined;
|
|
1796
1798
|
local?: boolean | undefined;
|
|
1797
1799
|
}, {
|
|
1798
1800
|
serverUrl?: string | undefined;
|
|
@@ -1801,11 +1803,11 @@ declare class Board extends Group<typeof boardProps> {
|
|
|
1801
1803
|
serverCacheEnabled?: boolean | undefined;
|
|
1802
1804
|
cache?: _tscircuit_props.PcbRouteCache | undefined;
|
|
1803
1805
|
traceClearance?: string | number | undefined;
|
|
1804
|
-
groupMode?: "
|
|
1806
|
+
groupMode?: "sequential_trace" | "subcircuit" | "sequential-trace" | undefined;
|
|
1805
1807
|
algorithmFn?: ((simpleRouteJson: any) => Promise<any>) | undefined;
|
|
1806
|
-
preset?: "sequential-trace" | "
|
|
1808
|
+
preset?: "sequential_trace" | "subcircuit" | "sequential-trace" | "auto" | "auto_local" | "auto_cloud" | "freerouting" | "auto-local" | "auto-cloud" | undefined;
|
|
1807
1809
|
local?: boolean | undefined;
|
|
1808
|
-
}>, zod.ZodLiteral<"
|
|
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">]>>;
|
|
1809
1811
|
square: zod.ZodOptional<zod.ZodBoolean>;
|
|
1810
1812
|
emptyArea: zod.ZodOptional<zod.ZodString>;
|
|
1811
1813
|
filledArea: zod.ZodOptional<zod.ZodString>;
|
|
@@ -2052,16 +2054,16 @@ declare class Board extends Group<typeof boardProps> {
|
|
|
2052
2054
|
defaultTraceWidth?: number | undefined;
|
|
2053
2055
|
minTraceWidth?: number | undefined;
|
|
2054
2056
|
pcbRouteCache?: _tscircuit_props.PcbRouteCache | undefined;
|
|
2055
|
-
autorouter?: "sequential-trace" | "
|
|
2057
|
+
autorouter?: "sequential_trace" | "subcircuit" | "sequential-trace" | "auto" | "auto_local" | "auto_cloud" | "freerouting" | "auto-local" | "auto-cloud" | {
|
|
2056
2058
|
serverUrl?: string | undefined;
|
|
2057
2059
|
inputFormat?: "simplified" | "circuit-json" | undefined;
|
|
2058
2060
|
serverMode?: "job" | "solve-endpoint" | undefined;
|
|
2059
2061
|
serverCacheEnabled?: boolean | undefined;
|
|
2060
2062
|
cache?: _tscircuit_props.PcbRouteCache | undefined;
|
|
2061
2063
|
traceClearance?: number | undefined;
|
|
2062
|
-
groupMode?: "
|
|
2064
|
+
groupMode?: "sequential_trace" | "subcircuit" | "sequential-trace" | undefined;
|
|
2063
2065
|
algorithmFn?: ((simpleRouteJson: any) => Promise<any>) | undefined;
|
|
2064
|
-
preset?: "sequential-trace" | "
|
|
2066
|
+
preset?: "sequential_trace" | "subcircuit" | "sequential-trace" | "auto" | "auto_local" | "auto_cloud" | "freerouting" | "auto-local" | "auto-cloud" | undefined;
|
|
2065
2067
|
local?: boolean | undefined;
|
|
2066
2068
|
} | undefined;
|
|
2067
2069
|
schAutoLayoutEnabled?: boolean | undefined;
|
|
@@ -2305,16 +2307,16 @@ declare class Board extends Group<typeof boardProps> {
|
|
|
2305
2307
|
defaultTraceWidth?: string | number | undefined;
|
|
2306
2308
|
minTraceWidth?: string | number | undefined;
|
|
2307
2309
|
pcbRouteCache?: _tscircuit_props.PcbRouteCache | undefined;
|
|
2308
|
-
autorouter?: "sequential-trace" | "
|
|
2310
|
+
autorouter?: "sequential_trace" | "subcircuit" | "sequential-trace" | "auto" | "auto_local" | "auto_cloud" | "freerouting" | "auto-local" | "auto-cloud" | {
|
|
2309
2311
|
serverUrl?: string | undefined;
|
|
2310
2312
|
inputFormat?: "simplified" | "circuit-json" | undefined;
|
|
2311
2313
|
serverMode?: "job" | "solve-endpoint" | undefined;
|
|
2312
2314
|
serverCacheEnabled?: boolean | undefined;
|
|
2313
2315
|
cache?: _tscircuit_props.PcbRouteCache | undefined;
|
|
2314
2316
|
traceClearance?: string | number | undefined;
|
|
2315
|
-
groupMode?: "
|
|
2317
|
+
groupMode?: "sequential_trace" | "subcircuit" | "sequential-trace" | undefined;
|
|
2316
2318
|
algorithmFn?: ((simpleRouteJson: any) => Promise<any>) | undefined;
|
|
2317
|
-
preset?: "sequential-trace" | "
|
|
2319
|
+
preset?: "sequential_trace" | "subcircuit" | "sequential-trace" | "auto" | "auto_local" | "auto_cloud" | "freerouting" | "auto-local" | "auto-cloud" | undefined;
|
|
2318
2320
|
local?: boolean | undefined;
|
|
2319
2321
|
} | undefined;
|
|
2320
2322
|
schAutoLayoutEnabled?: boolean | undefined;
|
|
@@ -19405,6 +19407,47 @@ declare class Via extends PrimitiveComponent<typeof viaProps> {
|
|
|
19405
19407
|
doInitialPcbPrimitiveRender(): void;
|
|
19406
19408
|
}
|
|
19407
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
|
+
|
|
19408
19451
|
declare class Cutout extends PrimitiveComponent<typeof cutoutProps> {
|
|
19409
19452
|
pcb_cutout_id: string | null;
|
|
19410
19453
|
isPcbPrimitive: boolean;
|
|
@@ -32524,6 +32567,7 @@ interface TscircuitElements {
|
|
|
32524
32567
|
mosfet: _tscircuit_props.MosfetProps;
|
|
32525
32568
|
testpoint: _tscircuit_props.TestpointProps;
|
|
32526
32569
|
voltagesource: VoltageSourceProps;
|
|
32570
|
+
copperpour: _tscircuit_props.CopperPourProps;
|
|
32527
32571
|
jscad: any;
|
|
32528
32572
|
}
|
|
32529
32573
|
declare module "react" {
|
|
@@ -32540,4 +32584,4 @@ declare module "react/jsx-runtime" {
|
|
|
32540
32584
|
}
|
|
32541
32585
|
}
|
|
32542
32586
|
|
|
32543
|
-
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,
|
|
@@ -32,7 +33,7 @@ __export(components_exports, {
|
|
|
32
33
|
Mosfet: () => Mosfet,
|
|
33
34
|
Net: () => Net,
|
|
34
35
|
NetLabel: () => NetLabel,
|
|
35
|
-
NormalComponent: () =>
|
|
36
|
+
NormalComponent: () => NormalComponent3,
|
|
36
37
|
PcbTrace: () => PcbTrace,
|
|
37
38
|
PinHeader: () => PinHeader,
|
|
38
39
|
Pinout: () => Pinout,
|
|
@@ -117,12 +118,14 @@ var orderedRenderPhases = [
|
|
|
117
118
|
"PcbPortRender",
|
|
118
119
|
"PcbPortAttachment",
|
|
119
120
|
"PcbComponentSizeCalculation",
|
|
121
|
+
"PcbComponentAnchorAlignment",
|
|
120
122
|
"PcbLayout",
|
|
121
123
|
"PcbBoardAutoSize",
|
|
122
124
|
"PcbTraceHintRender",
|
|
123
125
|
"PcbManualTraceRender",
|
|
124
126
|
"PcbTraceRender",
|
|
125
127
|
"PcbRouteNetIslands",
|
|
128
|
+
"PcbCopperPourRender",
|
|
126
129
|
"PcbDesignRuleChecks",
|
|
127
130
|
"SilkscreenOverlapAdjustment",
|
|
128
131
|
"CadModelRender",
|
|
@@ -135,12 +138,18 @@ var asyncPhaseDependencies = {
|
|
|
135
138
|
PcbBoardAutoSize: ["PcbFootprintStringRender"],
|
|
136
139
|
PcbTraceHintRender: ["PcbFootprintStringRender"],
|
|
137
140
|
PcbManualTraceRender: ["PcbFootprintStringRender"],
|
|
141
|
+
PcbCopperPourRender: [
|
|
142
|
+
"PcbFootprintStringRender",
|
|
143
|
+
"PcbTraceRender",
|
|
144
|
+
"PcbRouteNetIslands"
|
|
145
|
+
],
|
|
138
146
|
PcbTraceRender: ["PcbFootprintStringRender"],
|
|
139
147
|
PcbRouteNetIslands: ["PcbFootprintStringRender"],
|
|
140
148
|
PcbDesignRuleChecks: ["PcbFootprintStringRender"],
|
|
141
149
|
SilkscreenOverlapAdjustment: ["PcbFootprintStringRender"],
|
|
142
150
|
CadModelRender: ["PcbFootprintStringRender"],
|
|
143
|
-
PartsEngineRender: ["PcbFootprintStringRender"]
|
|
151
|
+
PartsEngineRender: ["PcbFootprintStringRender"],
|
|
152
|
+
PcbComponentAnchorAlignment: ["PcbFootprintStringRender"]
|
|
144
153
|
};
|
|
145
154
|
var globalRenderCounter = 0;
|
|
146
155
|
var Renderable = class {
|
|
@@ -6830,6 +6839,87 @@ function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsync
|
|
|
6830
6839
|
}
|
|
6831
6840
|
}
|
|
6832
6841
|
|
|
6842
|
+
// lib/components/base-components/NormalComponent/NormalComponent_doInitialPcbComponentAnchorAlignment.ts
|
|
6843
|
+
function NormalComponent_doInitialPcbComponentAnchorAlignment(component) {
|
|
6844
|
+
if (component.root?.pcbDisabled) return;
|
|
6845
|
+
if (!component.pcb_component_id) return;
|
|
6846
|
+
const { pcbX, pcbY } = component._parsedProps;
|
|
6847
|
+
const pcbPositionAnchor = component.props?.pcbPositionAnchor;
|
|
6848
|
+
if (!pcbPositionAnchor) return;
|
|
6849
|
+
if (pcbX === void 0 && pcbY === void 0) return;
|
|
6850
|
+
const bounds = getBoundsOfPcbComponents(component.children);
|
|
6851
|
+
if (bounds.width === 0 || bounds.height === 0) return;
|
|
6852
|
+
const center = {
|
|
6853
|
+
x: (bounds.minX + bounds.maxX) / 2,
|
|
6854
|
+
y: (bounds.minY + bounds.maxY) / 2
|
|
6855
|
+
};
|
|
6856
|
+
const currentCenter = { ...center };
|
|
6857
|
+
let anchorPos = null;
|
|
6858
|
+
const ninePointAnchors = /* @__PURE__ */ new Set([
|
|
6859
|
+
"center",
|
|
6860
|
+
"top_left",
|
|
6861
|
+
"top_center",
|
|
6862
|
+
"top_right",
|
|
6863
|
+
"center_left",
|
|
6864
|
+
"center_right",
|
|
6865
|
+
"bottom_left",
|
|
6866
|
+
"bottom_center",
|
|
6867
|
+
"bottom_right"
|
|
6868
|
+
]);
|
|
6869
|
+
if (ninePointAnchors.has(pcbPositionAnchor)) {
|
|
6870
|
+
const b = {
|
|
6871
|
+
left: bounds.minX,
|
|
6872
|
+
right: bounds.maxX,
|
|
6873
|
+
top: bounds.minY,
|
|
6874
|
+
bottom: bounds.maxY
|
|
6875
|
+
};
|
|
6876
|
+
switch (pcbPositionAnchor) {
|
|
6877
|
+
case "center":
|
|
6878
|
+
anchorPos = currentCenter;
|
|
6879
|
+
break;
|
|
6880
|
+
case "top_left":
|
|
6881
|
+
anchorPos = { x: b.left, y: b.top };
|
|
6882
|
+
break;
|
|
6883
|
+
case "top_center":
|
|
6884
|
+
anchorPos = { x: currentCenter.x, y: b.top };
|
|
6885
|
+
break;
|
|
6886
|
+
case "top_right":
|
|
6887
|
+
anchorPos = { x: b.right, y: b.top };
|
|
6888
|
+
break;
|
|
6889
|
+
case "center_left":
|
|
6890
|
+
anchorPos = { x: b.left, y: currentCenter.y };
|
|
6891
|
+
break;
|
|
6892
|
+
case "center_right":
|
|
6893
|
+
anchorPos = { x: b.right, y: currentCenter.y };
|
|
6894
|
+
break;
|
|
6895
|
+
case "bottom_left":
|
|
6896
|
+
anchorPos = { x: b.left, y: b.bottom };
|
|
6897
|
+
break;
|
|
6898
|
+
case "bottom_center":
|
|
6899
|
+
anchorPos = { x: currentCenter.x, y: b.bottom };
|
|
6900
|
+
break;
|
|
6901
|
+
case "bottom_right":
|
|
6902
|
+
anchorPos = { x: b.right, y: b.bottom };
|
|
6903
|
+
break;
|
|
6904
|
+
}
|
|
6905
|
+
} else {
|
|
6906
|
+
try {
|
|
6907
|
+
const port = component.portMap[pcbPositionAnchor];
|
|
6908
|
+
if (port) {
|
|
6909
|
+
anchorPos = port._getGlobalPcbPositionBeforeLayout();
|
|
6910
|
+
}
|
|
6911
|
+
} catch {
|
|
6912
|
+
}
|
|
6913
|
+
}
|
|
6914
|
+
if (!anchorPos) return;
|
|
6915
|
+
const newCenter = { ...currentCenter };
|
|
6916
|
+
if (pcbX !== void 0) newCenter.x += pcbX - anchorPos.x;
|
|
6917
|
+
if (pcbY !== void 0) newCenter.y += pcbY - anchorPos.y;
|
|
6918
|
+
if (Math.abs(newCenter.x - currentCenter.x) > 1e-6 || Math.abs(newCenter.y - currentCenter.y) > 1e-6) {
|
|
6919
|
+
component._repositionOnPcb(newCenter);
|
|
6920
|
+
}
|
|
6921
|
+
}
|
|
6922
|
+
|
|
6833
6923
|
// lib/components/base-components/NormalComponent/NormalComponent.ts
|
|
6834
6924
|
var debug3 = Debug4("tscircuit:core");
|
|
6835
6925
|
var rotation32 = z9.object({
|
|
@@ -6837,7 +6927,7 @@ var rotation32 = z9.object({
|
|
|
6837
6927
|
y: rotation2,
|
|
6838
6928
|
z: rotation2
|
|
6839
6929
|
});
|
|
6840
|
-
var
|
|
6930
|
+
var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
6841
6931
|
reactSubtrees = [];
|
|
6842
6932
|
_impliedFootprint;
|
|
6843
6933
|
isPrimitiveContainer = true;
|
|
@@ -7363,6 +7453,12 @@ var NormalComponent2 = class extends PrimitiveComponent2 {
|
|
|
7363
7453
|
updatePcbComponentSizeCalculation() {
|
|
7364
7454
|
this.doInitialPcbComponentSizeCalculation();
|
|
7365
7455
|
}
|
|
7456
|
+
doInitialPcbComponentAnchorAlignment() {
|
|
7457
|
+
NormalComponent_doInitialPcbComponentAnchorAlignment(this);
|
|
7458
|
+
}
|
|
7459
|
+
updatePcbComponentAnchorAlignment() {
|
|
7460
|
+
this.doInitialPcbComponentAnchorAlignment();
|
|
7461
|
+
}
|
|
7366
7462
|
_renderReactSubtree(element) {
|
|
7367
7463
|
const component = createInstanceFromReactElement(element);
|
|
7368
7464
|
return {
|
|
@@ -11365,7 +11461,7 @@ var Group_doInitialSchematicTraceRender = (group) => {
|
|
|
11365
11461
|
};
|
|
11366
11462
|
|
|
11367
11463
|
// lib/components/primitive-components/Group/Group.ts
|
|
11368
|
-
var Group6 = class extends
|
|
11464
|
+
var Group6 = class extends NormalComponent3 {
|
|
11369
11465
|
pcb_group_id = null;
|
|
11370
11466
|
schematic_group_id = null;
|
|
11371
11467
|
subcircuit_id = null;
|
|
@@ -12413,7 +12509,7 @@ var FTYPE = stringProxy;
|
|
|
12413
12509
|
|
|
12414
12510
|
// lib/components/normal-components/Capacitor.ts
|
|
12415
12511
|
import { formatSiUnit } from "format-si-unit";
|
|
12416
|
-
var Capacitor = class extends
|
|
12512
|
+
var Capacitor = class extends NormalComponent3 {
|
|
12417
12513
|
_adjustSilkscreenTextAutomatically = true;
|
|
12418
12514
|
// @ts-ignore (cause the symbolName is string and not fixed)
|
|
12419
12515
|
get config() {
|
|
@@ -12489,7 +12585,7 @@ var Capacitor = class extends NormalComponent2 {
|
|
|
12489
12585
|
|
|
12490
12586
|
// lib/components/normal-components/Chip.ts
|
|
12491
12587
|
import { chipProps as chipProps2 } from "@tscircuit/props";
|
|
12492
|
-
var Chip = class extends
|
|
12588
|
+
var Chip = class extends NormalComponent3 {
|
|
12493
12589
|
schematicBoxDimensions = null;
|
|
12494
12590
|
constructor(props) {
|
|
12495
12591
|
super(props);
|
|
@@ -12661,7 +12757,7 @@ var Pinout = class extends Chip {
|
|
|
12661
12757
|
|
|
12662
12758
|
// lib/components/normal-components/Diode.ts
|
|
12663
12759
|
import { diodeProps } from "@tscircuit/props";
|
|
12664
|
-
var Diode = class extends
|
|
12760
|
+
var Diode = class extends NormalComponent3 {
|
|
12665
12761
|
// @ts-ignore
|
|
12666
12762
|
get config() {
|
|
12667
12763
|
const symbolMap = {
|
|
@@ -12708,7 +12804,7 @@ var Diode = class extends NormalComponent2 {
|
|
|
12708
12804
|
// lib/components/normal-components/Fuse.ts
|
|
12709
12805
|
import { fuseProps } from "@tscircuit/props";
|
|
12710
12806
|
import { formatSiUnit as formatSiUnit2 } from "format-si-unit";
|
|
12711
|
-
var Fuse = class extends
|
|
12807
|
+
var Fuse = class extends NormalComponent3 {
|
|
12712
12808
|
get config() {
|
|
12713
12809
|
return {
|
|
12714
12810
|
componentName: "fuse",
|
|
@@ -12743,7 +12839,7 @@ var Fuse = class extends NormalComponent2 {
|
|
|
12743
12839
|
|
|
12744
12840
|
// lib/components/normal-components/Jumper.ts
|
|
12745
12841
|
import { jumperProps } from "@tscircuit/props";
|
|
12746
|
-
var Jumper = class extends
|
|
12842
|
+
var Jumper = class extends NormalComponent3 {
|
|
12747
12843
|
schematicDimensions = null;
|
|
12748
12844
|
get config() {
|
|
12749
12845
|
return {
|
|
@@ -12842,7 +12938,7 @@ var Jumper = class extends NormalComponent2 {
|
|
|
12842
12938
|
|
|
12843
12939
|
// lib/components/normal-components/SolderJumper.ts
|
|
12844
12940
|
import { solderjumperProps } from "@tscircuit/props";
|
|
12845
|
-
var SolderJumper = class extends
|
|
12941
|
+
var SolderJumper = class extends NormalComponent3 {
|
|
12846
12942
|
schematicDimensions = null;
|
|
12847
12943
|
_getPinNumberFromBridgedPinName(pinName) {
|
|
12848
12944
|
const port = this.selectOne(`port.${pinName}`, {
|
|
@@ -12996,7 +13092,7 @@ var SolderJumper = class extends NormalComponent2 {
|
|
|
12996
13092
|
|
|
12997
13093
|
// lib/components/normal-components/Led.ts
|
|
12998
13094
|
import { ledProps } from "@tscircuit/props";
|
|
12999
|
-
var Led = class extends
|
|
13095
|
+
var Led = class extends NormalComponent3 {
|
|
13000
13096
|
get config() {
|
|
13001
13097
|
const symbolMap = {
|
|
13002
13098
|
laser: "laser_diode"
|
|
@@ -13044,7 +13140,7 @@ var Led = class extends NormalComponent2 {
|
|
|
13044
13140
|
|
|
13045
13141
|
// lib/components/normal-components/PowerSource.ts
|
|
13046
13142
|
import { powerSourceProps } from "@tscircuit/props";
|
|
13047
|
-
var PowerSource = class extends
|
|
13143
|
+
var PowerSource = class extends NormalComponent3 {
|
|
13048
13144
|
// @ts-ignore
|
|
13049
13145
|
get config() {
|
|
13050
13146
|
return {
|
|
@@ -13095,7 +13191,7 @@ var voltageSourceProps = commonComponentProps.extend({
|
|
|
13095
13191
|
phase: rotation4.optional(),
|
|
13096
13192
|
dutyCycle: z13.number().optional()
|
|
13097
13193
|
});
|
|
13098
|
-
var VoltageSource = class extends
|
|
13194
|
+
var VoltageSource = class extends NormalComponent3 {
|
|
13099
13195
|
get config() {
|
|
13100
13196
|
const isSquare = this.props.waveShape === "square";
|
|
13101
13197
|
return {
|
|
@@ -13166,7 +13262,7 @@ var VoltageSource = class extends NormalComponent2 {
|
|
|
13166
13262
|
// lib/components/normal-components/Resistor.ts
|
|
13167
13263
|
import { resistorProps } from "@tscircuit/props";
|
|
13168
13264
|
import { formatSiUnit as formatSiUnit3 } from "format-si-unit";
|
|
13169
|
-
var Resistor = class extends
|
|
13265
|
+
var Resistor = class extends NormalComponent3 {
|
|
13170
13266
|
_adjustSilkscreenTextAutomatically = true;
|
|
13171
13267
|
get config() {
|
|
13172
13268
|
return {
|
|
@@ -13958,9 +14054,218 @@ var Via = class extends PrimitiveComponent2 {
|
|
|
13958
14054
|
}
|
|
13959
14055
|
};
|
|
13960
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
|
+
|
|
13961
14266
|
// lib/components/normal-components/Battery.ts
|
|
13962
14267
|
import { batteryProps } from "@tscircuit/props";
|
|
13963
|
-
var Battery = class extends
|
|
14268
|
+
var Battery = class extends NormalComponent3 {
|
|
13964
14269
|
get config() {
|
|
13965
14270
|
return {
|
|
13966
14271
|
componentName: "Battery",
|
|
@@ -13993,7 +14298,7 @@ var Battery = class extends NormalComponent2 {
|
|
|
13993
14298
|
|
|
13994
14299
|
// lib/components/normal-components/PinHeader.ts
|
|
13995
14300
|
import { pinHeaderProps } from "@tscircuit/props";
|
|
13996
|
-
var PinHeader = class extends
|
|
14301
|
+
var PinHeader = class extends NormalComponent3 {
|
|
13997
14302
|
_getPcbRotationBeforeLayout() {
|
|
13998
14303
|
const orientationRotation = this.props.pcbOrientation === "vertical" ? -90 : 0;
|
|
13999
14304
|
const baseRotation = super._getPcbRotationBeforeLayout() ?? 0;
|
|
@@ -14107,7 +14412,7 @@ function getResonatorSymbolName(variant) {
|
|
|
14107
14412
|
return "crystal";
|
|
14108
14413
|
}
|
|
14109
14414
|
}
|
|
14110
|
-
var Resonator = class extends
|
|
14415
|
+
var Resonator = class extends NormalComponent3 {
|
|
14111
14416
|
get config() {
|
|
14112
14417
|
return {
|
|
14113
14418
|
componentName: "Resonator",
|
|
@@ -14143,7 +14448,7 @@ var Resonator = class extends NormalComponent2 {
|
|
|
14143
14448
|
// lib/components/normal-components/Inductor.ts
|
|
14144
14449
|
import { inductorProps } from "@tscircuit/props";
|
|
14145
14450
|
import { formatSiUnit as formatSiUnit5 } from "format-si-unit";
|
|
14146
|
-
var Inductor = class extends
|
|
14451
|
+
var Inductor = class extends NormalComponent3 {
|
|
14147
14452
|
_adjustSilkscreenTextAutomatically = true;
|
|
14148
14453
|
get config() {
|
|
14149
14454
|
return {
|
|
@@ -14191,7 +14496,7 @@ function getPotentiometerSymbolName(variant) {
|
|
|
14191
14496
|
return "potentiometer2";
|
|
14192
14497
|
}
|
|
14193
14498
|
}
|
|
14194
|
-
var Potentiometer = class extends
|
|
14499
|
+
var Potentiometer = class extends NormalComponent3 {
|
|
14195
14500
|
get config() {
|
|
14196
14501
|
return {
|
|
14197
14502
|
componentName: "Potentiometer",
|
|
@@ -14221,7 +14526,7 @@ var Potentiometer = class extends NormalComponent2 {
|
|
|
14221
14526
|
// lib/components/normal-components/PushButton.ts
|
|
14222
14527
|
import { pushButtonProps } from "@tscircuit/props";
|
|
14223
14528
|
import { symbols as symbols3 } from "schematic-symbols";
|
|
14224
|
-
var PushButton = class extends
|
|
14529
|
+
var PushButton = class extends NormalComponent3 {
|
|
14225
14530
|
get config() {
|
|
14226
14531
|
return {
|
|
14227
14532
|
componentName: "PushButton",
|
|
@@ -14286,7 +14591,7 @@ var PushButton = class extends NormalComponent2 {
|
|
|
14286
14591
|
// lib/components/normal-components/Crystal.ts
|
|
14287
14592
|
import { crystalProps } from "@tscircuit/props";
|
|
14288
14593
|
import { formatSiUnit as formatSiUnit7 } from "format-si-unit";
|
|
14289
|
-
var Crystal = class extends
|
|
14594
|
+
var Crystal = class extends NormalComponent3 {
|
|
14290
14595
|
// @ts-ignore
|
|
14291
14596
|
get config() {
|
|
14292
14597
|
const symbolName = this.props.symbolName ?? (this.props.pinVariant === "four_pin" ? "crystal_4pin" : "crystal");
|
|
@@ -14337,7 +14642,7 @@ var Crystal = class extends NormalComponent2 {
|
|
|
14337
14642
|
|
|
14338
14643
|
// lib/components/normal-components/Transistor.ts
|
|
14339
14644
|
import { transistorProps } from "@tscircuit/props";
|
|
14340
|
-
var Transistor = class extends
|
|
14645
|
+
var Transistor = class extends NormalComponent3 {
|
|
14341
14646
|
get config() {
|
|
14342
14647
|
const baseSymbolName = this.props.type === "npn" ? "npn_bipolar_transistor" : "pnp_bipolar_transistor";
|
|
14343
14648
|
return {
|
|
@@ -14382,7 +14687,7 @@ var Transistor = class extends NormalComponent2 {
|
|
|
14382
14687
|
|
|
14383
14688
|
// lib/components/normal-components/Mosfet.ts
|
|
14384
14689
|
import { mosfetProps } from "@tscircuit/props";
|
|
14385
|
-
var Mosfet = class extends
|
|
14690
|
+
var Mosfet = class extends NormalComponent3 {
|
|
14386
14691
|
get config() {
|
|
14387
14692
|
const mosfetMode = this.props.mosfetMode === "depletion" ? "d" : "e";
|
|
14388
14693
|
const channelType = this.props.channelType;
|
|
@@ -14409,7 +14714,7 @@ var Mosfet = class extends NormalComponent2 {
|
|
|
14409
14714
|
|
|
14410
14715
|
// lib/components/normal-components/Switch.ts
|
|
14411
14716
|
import { switchProps } from "@tscircuit/props";
|
|
14412
|
-
var Switch = class extends
|
|
14717
|
+
var Switch = class extends NormalComponent3 {
|
|
14413
14718
|
_getSwitchType() {
|
|
14414
14719
|
const { spst, spdt, dpst, dpdt, type } = this._parsedProps ?? {};
|
|
14415
14720
|
if (dpdt) return "dpdt";
|
|
@@ -14456,7 +14761,7 @@ var TESTPOINT_DEFAULTS = {
|
|
|
14456
14761
|
SMT_CIRCLE_DIAMETER: 1.2,
|
|
14457
14762
|
SMT_RECT_SIZE: 2
|
|
14458
14763
|
};
|
|
14459
|
-
var TestPoint = class extends
|
|
14764
|
+
var TestPoint = class extends NormalComponent3 {
|
|
14460
14765
|
get config() {
|
|
14461
14766
|
return {
|
|
14462
14767
|
componentName: "TestPoint",
|
|
@@ -14937,7 +15242,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
14937
15242
|
var package_default = {
|
|
14938
15243
|
name: "@tscircuit/core",
|
|
14939
15244
|
type: "module",
|
|
14940
|
-
version: "0.0.
|
|
15245
|
+
version: "0.0.724",
|
|
14941
15246
|
types: "dist/index.d.ts",
|
|
14942
15247
|
main: "dist/index.js",
|
|
14943
15248
|
module: "dist/index.js",
|
|
@@ -14976,7 +15281,7 @@ var package_default = {
|
|
|
14976
15281
|
"@tscircuit/matchpack": "^0.0.16",
|
|
14977
15282
|
"@tscircuit/math-utils": "^0.0.21",
|
|
14978
15283
|
"@tscircuit/miniflex": "^0.0.4",
|
|
14979
|
-
"@tscircuit/props": "0.0.
|
|
15284
|
+
"@tscircuit/props": "0.0.321",
|
|
14980
15285
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
14981
15286
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
14982
15287
|
"@tscircuit/schematic-trace-solver": "^0.0.36",
|
|
@@ -15450,6 +15755,7 @@ export {
|
|
|
15450
15755
|
Chip,
|
|
15451
15756
|
Circuit,
|
|
15452
15757
|
Constraint3 as Constraint,
|
|
15758
|
+
CopperPour,
|
|
15453
15759
|
Crystal,
|
|
15454
15760
|
Cutout,
|
|
15455
15761
|
Diode,
|
|
@@ -15466,7 +15772,7 @@ export {
|
|
|
15466
15772
|
Mosfet,
|
|
15467
15773
|
Net,
|
|
15468
15774
|
NetLabel,
|
|
15469
|
-
|
|
15775
|
+
NormalComponent3 as NormalComponent,
|
|
15470
15776
|
PcbTrace,
|
|
15471
15777
|
PinHeader,
|
|
15472
15778
|
Pinout,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.725",
|
|
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.
|
|
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",
|