@tscircuit/core 0.0.1271 → 0.0.1273
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 +32 -4
- package/dist/index.js +265 -3
- package/package.json +3 -3
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, PcbTrace as PcbTrace$1, PcbVia as PcbVia$1, PcbTraceRoutePoint, AnySourceComponent, PcbComponent, SchematicPort, SchematicComponent, RouteHintPoint, CircuitJson } from 'circuit-json';
|
|
3
3
|
import * as _tscircuit_props from '@tscircuit/props';
|
|
4
|
-
import { PlatformConfig, traceProps, netProps, AutorouterProp, AutoroutingPhaseProps, subcircuitGroupProps, AutorouterConfig, PcbSx, portProps, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, subcircuitProps, subpanelProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, interconnectProps, solderjumperProps, ledProps, powerSourceProps, voltageSourceProps, currentSourceProps, resistorProps, constraintProps, autoroutingPhaseProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNoteTextProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, courtyardCircleProps, courtyardOutlineProps, courtyardRectProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, fiducialProps, traceHintProps, viaProps, copperPourProps, copperTextProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, opampProps, OpAmpPinLabels, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicPathProps, schematicBoxProps, schematicSectionProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, voltageProbeProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
|
|
4
|
+
import { PlatformConfig, traceProps, netProps, AutorouterProp, AutoroutingPhaseProps, subcircuitGroupProps, AutorouterConfig, PcbSx, portProps, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, subcircuitProps, subpanelProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, interconnectProps, solderjumperProps, ledProps, powerSourceProps, voltageSourceProps, currentSourceProps, resistorProps, constraintProps, drcCheckProps, autoroutingPhaseProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNoteTextProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, courtyardCircleProps, courtyardOutlineProps, courtyardRectProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, fiducialProps, traceHintProps, viaProps, copperPourProps, copperTextProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, opampProps, OpAmpPinLabels, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicPathProps, schematicBoxProps, schematicSectionProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, voltageProbeProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
|
|
5
5
|
export { kicadFootprintStrings } from '@tscircuit/props';
|
|
6
6
|
import * as react from 'react';
|
|
7
7
|
import react__default, { ReactElement, DetailedHTMLProps, SVGProps } from 'react';
|
|
@@ -236,9 +236,9 @@ interface IIsolatedCircuit {
|
|
|
236
236
|
interface IRootCircuit extends IIsolatedCircuit {
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "RenderIsolatedSubcircuits", "InflateSubcircuitCircuitJson", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "FetchPartFootprint", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceComponentPropertyValidation", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SymbolContainerRender", "SchematicPrimitiveRender", "SchematicSymbolResize", "SchematicComponentSizeCalculation", "SchematicLayout", "SchematicSectionRender", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PanelBoardLayout", "ValidatePcbCoordinates", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbCalcPlacementResolution", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "SupplierFootprintMismatchWarning", "SimulationSpiceEngineRender"];
|
|
239
|
+
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "RenderIsolatedSubcircuits", "InflateSubcircuitCircuitJson", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "FetchPartFootprint", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "CreateAutoplacedBreakoutPoints", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceComponentPropertyValidation", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SymbolContainerRender", "SchematicPrimitiveRender", "SchematicSymbolResize", "SchematicComponentSizeCalculation", "SchematicLayout", "SchematicSectionRender", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PanelBoardLayout", "ValidatePcbCoordinates", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbCalcPlacementResolution", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "SupplierFootprintMismatchWarning", "SimulationSpiceEngineRender"];
|
|
240
240
|
type RenderPhase = (typeof orderedRenderPhases)[number];
|
|
241
|
-
declare const renderPhaseIndexMap: Map<"ReactSubtreesRender" | "RenderIsolatedSubcircuits" | "InflateSubcircuitCircuitJson" | "SourceNameDuplicateComponentRemoval" | "PcbFootprintStringRender" | "FetchPartFootprint" | "InitializePortsFromChildren" | "CreateNetsFromProps" | "AssignFallbackProps" | "CreateTracesFromProps" | "CreateTracesFromNetLabels" | "CreateTraceHintsFromProps" | "SourceGroupRender" | "AssignNameToUnnamedComponents" | "SourceRender" | "SourceComponentPropertyValidation" | "SourceParentAttachment" | "PortMatching" | "OptimizeSelectorCache" | "SourceTraceRender" | "SourceAddConnectivityMapKey" | "SourceDesignRuleChecks" | "SimulationRender" | "SchematicComponentRender" | "SchematicPortRender" | "SymbolContainerRender" | "SchematicPrimitiveRender" | "SchematicSymbolResize" | "SchematicComponentSizeCalculation" | "SchematicLayout" | "SchematicSectionRender" | "SchematicTraceRender" | "SchematicReplaceNetLabelsWithSymbols" | "PanelBoardLayout" | "ValidatePcbCoordinates" | "PcbComponentRender" | "PcbPrimitiveRender" | "PcbFootprintLayout" | "PcbPortRender" | "PcbPortAttachment" | "PcbComponentSizeCalculation" | "PcbComponentAnchorAlignment" | "PcbCalcPlacementResolution" | "PcbLayout" | "PcbBoardAutoSize" | "PanelLayout" | "PcbTraceHintRender" | "PcbManualTraceRender" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbCopperPourRender" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "SupplierFootprintMismatchWarning" | "SimulationSpiceEngineRender", number>;
|
|
241
|
+
declare const renderPhaseIndexMap: Map<"ReactSubtreesRender" | "RenderIsolatedSubcircuits" | "InflateSubcircuitCircuitJson" | "SourceNameDuplicateComponentRemoval" | "PcbFootprintStringRender" | "FetchPartFootprint" | "InitializePortsFromChildren" | "CreateNetsFromProps" | "AssignFallbackProps" | "CreateTracesFromProps" | "CreateTracesFromNetLabels" | "CreateTraceHintsFromProps" | "CreateAutoplacedBreakoutPoints" | "SourceGroupRender" | "AssignNameToUnnamedComponents" | "SourceRender" | "SourceComponentPropertyValidation" | "SourceParentAttachment" | "PortMatching" | "OptimizeSelectorCache" | "SourceTraceRender" | "SourceAddConnectivityMapKey" | "SourceDesignRuleChecks" | "SimulationRender" | "SchematicComponentRender" | "SchematicPortRender" | "SymbolContainerRender" | "SchematicPrimitiveRender" | "SchematicSymbolResize" | "SchematicComponentSizeCalculation" | "SchematicLayout" | "SchematicSectionRender" | "SchematicTraceRender" | "SchematicReplaceNetLabelsWithSymbols" | "PanelBoardLayout" | "ValidatePcbCoordinates" | "PcbComponentRender" | "PcbPrimitiveRender" | "PcbFootprintLayout" | "PcbPortRender" | "PcbPortAttachment" | "PcbComponentSizeCalculation" | "PcbComponentAnchorAlignment" | "PcbCalcPlacementResolution" | "PcbLayout" | "PcbBoardAutoSize" | "PanelLayout" | "PcbTraceHintRender" | "PcbManualTraceRender" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbCopperPourRender" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "SupplierFootprintMismatchWarning" | "SimulationSpiceEngineRender", number>;
|
|
242
242
|
type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
|
|
243
243
|
type RenderPhaseStates = Record<RenderPhase, {
|
|
244
244
|
initialized: boolean;
|
|
@@ -71239,6 +71239,33 @@ declare class Constraint extends PrimitiveComponent<typeof constraintProps> {
|
|
|
71239
71239
|
};
|
|
71240
71240
|
}
|
|
71241
71241
|
|
|
71242
|
+
declare class DrcCheck extends PrimitiveComponent<typeof drcCheckProps> {
|
|
71243
|
+
get config(): {
|
|
71244
|
+
componentName: string;
|
|
71245
|
+
zodProps: z.ZodObject<{
|
|
71246
|
+
name: z.ZodOptional<z.ZodString>;
|
|
71247
|
+
checkFn: z.ZodType<_tscircuit_props.CustomDrcCheckFn, z.ZodTypeDef, _tscircuit_props.CustomDrcCheckFn>;
|
|
71248
|
+
}, "strip", z.ZodTypeAny, {
|
|
71249
|
+
checkFn: _tscircuit_props.CustomDrcCheckFn;
|
|
71250
|
+
name?: string | undefined;
|
|
71251
|
+
}, {
|
|
71252
|
+
checkFn: _tscircuit_props.CustomDrcCheckFn;
|
|
71253
|
+
name?: string | undefined;
|
|
71254
|
+
}>;
|
|
71255
|
+
};
|
|
71256
|
+
constructor(props: z.input<typeof drcCheckProps>);
|
|
71257
|
+
runCustomDrcCheck(circuitJson: AnyCircuitElement[]): Promise<AnyCircuitElement[]>;
|
|
71258
|
+
private createCustomDrcCheckContext;
|
|
71259
|
+
private selectCustomDrcElement;
|
|
71260
|
+
private selectAllCustomDrcElements;
|
|
71261
|
+
private wrapSelectionResult;
|
|
71262
|
+
private createCircuitJsonDiagnostic;
|
|
71263
|
+
private isConnected;
|
|
71264
|
+
private getResistanceBetween;
|
|
71265
|
+
private getConnectivityKeys;
|
|
71266
|
+
private getCircuitJsonElementConnectivityKeys;
|
|
71267
|
+
}
|
|
71268
|
+
|
|
71242
71269
|
declare class AutoroutingPhase extends PrimitiveComponent<typeof autoroutingPhaseProps> {
|
|
71243
71270
|
get config(): {
|
|
71244
71271
|
componentName: string;
|
|
@@ -153679,6 +153706,7 @@ interface TscircuitElements {
|
|
|
153679
153706
|
fuse: _tscircuit_props.FuseProps;
|
|
153680
153707
|
led: _tscircuit_props.LedProps;
|
|
153681
153708
|
board: _tscircuit_props.BoardProps;
|
|
153709
|
+
drccheck: _tscircuit_props.DrcCheckProps;
|
|
153682
153710
|
mountedboard: _tscircuit_props.MountedBoardProps;
|
|
153683
153711
|
panel: _tscircuit_props.PanelProps;
|
|
153684
153712
|
subpanel: _tscircuit_props.SubpanelProps;
|
|
@@ -153779,4 +153807,4 @@ declare module "react/jsx-runtime" {
|
|
|
153779
153807
|
}
|
|
153780
153808
|
}
|
|
153781
153809
|
|
|
153782
|
-
export { AnalogSimulation, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, AutoroutingPhase, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Connector, Constraint, CopperPour, CopperText, CourtyardCircle, CourtyardOutline, CourtyardRect, Crystal, CurrentSource, Cutout, type DebugLogOutputEvent, Diode, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Breakout as Fanout, BreakoutPoint as FanoutPoint, Fiducial, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IIsolatedCircuit, type IRenderable, type IRootCircuit, Inductor, Interconnect, IsolatedCircuit, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, MountedBoard, Net, NetLabel, NormalComponent, type Obstacle, OpAmp, type PackingEndEvent, type PackingErrorEvent, type PackingStartEvent, Panel, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbNoteText, PcbTrace, PcbVia, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SOLVERS, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicPath, SchematicRect, SchematicRow, SchematicSection, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, type SolverName, type SolverStartedEvent, Subcircuit, Subpanel, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, renderPhaseIndexMap, resolveStaticFileImport, sel, unrouteCircuitJson, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
|
153810
|
+
export { AnalogSimulation, type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, AutoroutingPhase, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, CadAssembly, CadModel, Capacitor, Chip, Circuit, type ComponentWithPins, Connector, Constraint, CopperPour, CopperText, CourtyardCircle, CourtyardOutline, CourtyardRect, Crystal, CurrentSource, Cutout, type DebugLogOutputEvent, Diode, DrcCheck, FabricationNoteDimension, FabricationNotePath, FabricationNoteRect, FabricationNoteText, Breakout as Fanout, BreakoutPoint as FanoutPoint, Fiducial, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IIsolatedCircuit, type IRenderable, type IRootCircuit, Inductor, Interconnect, IsolatedCircuit, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, MountedBoard, Net, NetLabel, NormalComponent, type Obstacle, OpAmp, type PackingEndEvent, type PackingErrorEvent, type PackingStartEvent, Panel, PcbNoteDimension, PcbNoteLine, PcbNotePath, PcbNoteRect, PcbNoteText, PcbTrace, PcbVia, PinHeader, type PinLabelSpec, Pinout, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SOLVERS, SchematicArc, SchematicBox, SchematicCell, SchematicCircle, SchematicLine, SchematicPath, SchematicRect, SchematicRow, SchematicSection, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, type SolverName, type SolverStartedEvent, Subcircuit, Subpanel, Switch, SymbolComponent as Symbol, TestPoint, Trace, TraceHint, Transistor, Via, VoltageProbe, VoltageSource, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, renderPhaseIndexMap, resolveStaticFileImport, sel, unrouteCircuitJson, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
package/dist/index.js
CHANGED
|
@@ -28,6 +28,7 @@ __export(components_exports, {
|
|
|
28
28
|
CurrentSource: () => CurrentSource,
|
|
29
29
|
Cutout: () => Cutout,
|
|
30
30
|
Diode: () => Diode,
|
|
31
|
+
DrcCheck: () => DrcCheck,
|
|
31
32
|
FabricationNoteDimension: () => FabricationNoteDimension,
|
|
32
33
|
FabricationNotePath: () => FabricationNotePath,
|
|
33
34
|
FabricationNoteRect: () => FabricationNoteRect,
|
|
@@ -328,6 +329,7 @@ var orderedRenderPhases = [
|
|
|
328
329
|
"CreateTracesFromProps",
|
|
329
330
|
"CreateTracesFromNetLabels",
|
|
330
331
|
"CreateTraceHintsFromProps",
|
|
332
|
+
"CreateAutoplacedBreakoutPoints",
|
|
331
333
|
"SourceGroupRender",
|
|
332
334
|
"AssignNameToUnnamedComponents",
|
|
333
335
|
"SourceRender",
|
|
@@ -1076,6 +1078,13 @@ var cssSelectPrimitiveComponentAdapter = {
|
|
|
1076
1078
|
const value = node._parsedProps[name];
|
|
1077
1079
|
return typeof value === "string" ? value : value !== null && value !== void 0 ? String(value) : null;
|
|
1078
1080
|
}
|
|
1081
|
+
const matchingParsedPropName = Object.keys(node._parsedProps ?? {}).find(
|
|
1082
|
+
(propName) => propName.toLowerCase() === name
|
|
1083
|
+
);
|
|
1084
|
+
if (matchingParsedPropName) {
|
|
1085
|
+
const value = node._parsedProps[matchingParsedPropName];
|
|
1086
|
+
return typeof value === "string" ? value : value !== null && value !== void 0 ? String(value) : null;
|
|
1087
|
+
}
|
|
1079
1088
|
if (name in node) {
|
|
1080
1089
|
const value = node[name];
|
|
1081
1090
|
return typeof value === "string" ? value : value !== null && value !== void 0 ? String(value) : null;
|
|
@@ -1098,6 +1107,11 @@ var cssSelectPrimitiveComponentAdapter = {
|
|
|
1098
1107
|
if (node._parsedProps && name in node._parsedProps) {
|
|
1099
1108
|
return true;
|
|
1100
1109
|
}
|
|
1110
|
+
if (Object.keys(node._parsedProps ?? {}).some(
|
|
1111
|
+
(propName) => propName.toLowerCase() === name
|
|
1112
|
+
)) {
|
|
1113
|
+
return true;
|
|
1114
|
+
}
|
|
1101
1115
|
if (name in node) {
|
|
1102
1116
|
return true;
|
|
1103
1117
|
}
|
|
@@ -21540,6 +21554,248 @@ var inflateCircuitJson = (target, circuitJson, children) => {
|
|
|
21540
21554
|
inflateStandalonePcbPrimitives(inflationCtx);
|
|
21541
21555
|
};
|
|
21542
21556
|
|
|
21557
|
+
// lib/components/primitive-components/DrcCheck.ts
|
|
21558
|
+
import {
|
|
21559
|
+
drcCheckProps
|
|
21560
|
+
} from "@tscircuit/props";
|
|
21561
|
+
import { any_circuit_element } from "circuit-json";
|
|
21562
|
+
var isSelectionResultPort = (connectable) => {
|
|
21563
|
+
if (!connectable || typeof connectable !== "object") return false;
|
|
21564
|
+
const maybePort = connectable;
|
|
21565
|
+
return typeof maybePort.getSourcePort === "function";
|
|
21566
|
+
};
|
|
21567
|
+
var isSelectionResultNet = (connectable) => {
|
|
21568
|
+
if (!connectable || typeof connectable !== "object") return false;
|
|
21569
|
+
const maybeNet = connectable;
|
|
21570
|
+
return typeof maybeNet.getSourceNet === "function";
|
|
21571
|
+
};
|
|
21572
|
+
var isSelectionResultComponent = (connectable) => {
|
|
21573
|
+
if (!connectable || typeof connectable !== "object") return false;
|
|
21574
|
+
const maybeComponent = connectable;
|
|
21575
|
+
return typeof maybeComponent.getPorts === "function";
|
|
21576
|
+
};
|
|
21577
|
+
var isCircuitJsonElement = (connectable) => {
|
|
21578
|
+
if (!connectable || typeof connectable !== "object") return false;
|
|
21579
|
+
const maybeCircuitJsonElement = connectable;
|
|
21580
|
+
return typeof maybeCircuitJsonElement.type === "string";
|
|
21581
|
+
};
|
|
21582
|
+
var isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
|
|
21583
|
+
var SelectionResultPortImpl = class {
|
|
21584
|
+
constructor(port) {
|
|
21585
|
+
this.port = port;
|
|
21586
|
+
}
|
|
21587
|
+
port;
|
|
21588
|
+
getPcbPort() {
|
|
21589
|
+
const pcbPortId = this.port.pcb_port_id;
|
|
21590
|
+
if (!pcbPortId) return null;
|
|
21591
|
+
return this.port.root?.db.pcb_port.get(pcbPortId) ?? null;
|
|
21592
|
+
}
|
|
21593
|
+
getSourcePort() {
|
|
21594
|
+
const sourcePortId = this.port.source_port_id;
|
|
21595
|
+
if (!sourcePortId) return null;
|
|
21596
|
+
return this.port.root?.db.source_port.get(sourcePortId) ?? null;
|
|
21597
|
+
}
|
|
21598
|
+
};
|
|
21599
|
+
var SelectionResultNetImpl = class {
|
|
21600
|
+
constructor(net) {
|
|
21601
|
+
this.net = net;
|
|
21602
|
+
}
|
|
21603
|
+
net;
|
|
21604
|
+
getSourceNet() {
|
|
21605
|
+
const sourceNetId = this.net.source_net_id;
|
|
21606
|
+
if (!sourceNetId) return null;
|
|
21607
|
+
return this.net.root?.db.source_net.get(sourceNetId) ?? null;
|
|
21608
|
+
}
|
|
21609
|
+
};
|
|
21610
|
+
var SelectionResultComponentImpl = class {
|
|
21611
|
+
constructor(component) {
|
|
21612
|
+
this.component = component;
|
|
21613
|
+
}
|
|
21614
|
+
component;
|
|
21615
|
+
getPort(name) {
|
|
21616
|
+
const port = this.component.selectOne(`port.${name}`, { type: "port" }) ?? this.component.selectOne(`.${name}`, { type: "port" });
|
|
21617
|
+
if (!port) return null;
|
|
21618
|
+
return new SelectionResultPortImpl(port);
|
|
21619
|
+
}
|
|
21620
|
+
getPorts() {
|
|
21621
|
+
return this.component.selectAll("port").map((port) => new SelectionResultPortImpl(port));
|
|
21622
|
+
}
|
|
21623
|
+
getPcbComponent() {
|
|
21624
|
+
const pcbComponentId = this.component.pcb_component_id;
|
|
21625
|
+
if (!pcbComponentId) return null;
|
|
21626
|
+
return this.component.root?.db.pcb_component.get(pcbComponentId) ?? null;
|
|
21627
|
+
}
|
|
21628
|
+
getSourceComponent() {
|
|
21629
|
+
const sourceComponentId = this.component.source_component_id;
|
|
21630
|
+
if (!sourceComponentId) return null;
|
|
21631
|
+
return this.component.root?.db.source_component.get(sourceComponentId) ?? null;
|
|
21632
|
+
}
|
|
21633
|
+
};
|
|
21634
|
+
var DrcCheck = class extends PrimitiveComponent2 {
|
|
21635
|
+
get config() {
|
|
21636
|
+
return {
|
|
21637
|
+
componentName: "DrcCheck",
|
|
21638
|
+
zodProps: drcCheckProps
|
|
21639
|
+
};
|
|
21640
|
+
}
|
|
21641
|
+
constructor(props) {
|
|
21642
|
+
super(props);
|
|
21643
|
+
}
|
|
21644
|
+
async runCustomDrcCheck(circuitJson) {
|
|
21645
|
+
const result = await this._parsedProps.checkFn(
|
|
21646
|
+
this.createCustomDrcCheckContext(circuitJson)
|
|
21647
|
+
);
|
|
21648
|
+
let diagnostics = [];
|
|
21649
|
+
if (Array.isArray(result)) {
|
|
21650
|
+
diagnostics = result;
|
|
21651
|
+
} else if (result) {
|
|
21652
|
+
diagnostics = [result];
|
|
21653
|
+
}
|
|
21654
|
+
return diagnostics.map(
|
|
21655
|
+
(diagnostic, index) => this.createCircuitJsonDiagnostic(diagnostic, index)
|
|
21656
|
+
).filter((diagnostic) => !!diagnostic);
|
|
21657
|
+
}
|
|
21658
|
+
createCustomDrcCheckContext(circuitJson) {
|
|
21659
|
+
return {
|
|
21660
|
+
select: this.selectCustomDrcElement.bind(
|
|
21661
|
+
this
|
|
21662
|
+
),
|
|
21663
|
+
selectAll: this.selectAllCustomDrcElements.bind(
|
|
21664
|
+
this
|
|
21665
|
+
),
|
|
21666
|
+
isConnected: (a, b) => this.isConnected(a, b, circuitJson),
|
|
21667
|
+
isPulledUp: (a) => this.isConnected(a, "net.VCC", circuitJson) || this.isConnected(a, "net.VDD", circuitJson) || this.getResistanceBetween(a, "net.VCC", circuitJson) !== null || this.getResistanceBetween(a, "net.VDD", circuitJson) !== null,
|
|
21668
|
+
isPulledDown: (a) => this.isConnected(a, "net.GND", circuitJson) || this.getResistanceBetween(a, "net.GND", circuitJson) !== null,
|
|
21669
|
+
getResistanceBetween: (a, b) => this.getResistanceBetween(a, b, circuitJson)
|
|
21670
|
+
};
|
|
21671
|
+
}
|
|
21672
|
+
selectCustomDrcElement(selector) {
|
|
21673
|
+
return this.wrapSelectionResult(this.getSubcircuit().selectOne(selector));
|
|
21674
|
+
}
|
|
21675
|
+
selectAllCustomDrcElements(selector) {
|
|
21676
|
+
const selectionResults = [];
|
|
21677
|
+
for (const component of this.getSubcircuit().selectAll(selector)) {
|
|
21678
|
+
const selectionResult = this.wrapSelectionResult(component);
|
|
21679
|
+
if (selectionResult) selectionResults.push(selectionResult);
|
|
21680
|
+
}
|
|
21681
|
+
return selectionResults;
|
|
21682
|
+
}
|
|
21683
|
+
wrapSelectionResult(component) {
|
|
21684
|
+
if (!component) return null;
|
|
21685
|
+
if (component instanceof Port) return new SelectionResultPortImpl(component);
|
|
21686
|
+
if (component instanceof Net) return new SelectionResultNetImpl(component);
|
|
21687
|
+
return new SelectionResultComponentImpl(component);
|
|
21688
|
+
}
|
|
21689
|
+
createCircuitJsonDiagnostic(diagnostic, index) {
|
|
21690
|
+
const diagnosticRecord = diagnostic;
|
|
21691
|
+
let diagnosticType = "source_component_misconfigured_error";
|
|
21692
|
+
if (typeof diagnosticRecord.error_type === "string") {
|
|
21693
|
+
diagnosticType = diagnosticRecord.error_type;
|
|
21694
|
+
} else if (typeof diagnosticRecord.warning_type === "string") {
|
|
21695
|
+
diagnosticType = diagnosticRecord.warning_type;
|
|
21696
|
+
}
|
|
21697
|
+
const diagnosticWithCircuitJsonDefaults = {
|
|
21698
|
+
...diagnostic
|
|
21699
|
+
};
|
|
21700
|
+
if (typeof diagnosticRecord.type === "string") {
|
|
21701
|
+
diagnosticWithCircuitJsonDefaults.type = diagnosticRecord.type;
|
|
21702
|
+
} else {
|
|
21703
|
+
diagnosticWithCircuitJsonDefaults.type = diagnosticType;
|
|
21704
|
+
}
|
|
21705
|
+
if (typeof diagnosticRecord.warning_type !== "string") {
|
|
21706
|
+
if (typeof diagnosticRecord.error_type === "string") {
|
|
21707
|
+
diagnosticWithCircuitJsonDefaults.error_type = diagnosticRecord.error_type;
|
|
21708
|
+
} else {
|
|
21709
|
+
diagnosticWithCircuitJsonDefaults.error_type = diagnosticType;
|
|
21710
|
+
}
|
|
21711
|
+
}
|
|
21712
|
+
const diagnosticIdField = `${diagnosticType}_id`;
|
|
21713
|
+
if (diagnosticRecord[diagnosticIdField]) {
|
|
21714
|
+
diagnosticWithCircuitJsonDefaults[diagnosticIdField] = diagnosticRecord[diagnosticIdField];
|
|
21715
|
+
} else {
|
|
21716
|
+
diagnosticWithCircuitJsonDefaults[diagnosticIdField] = `${diagnosticType}_${this._renderId}_${index}`;
|
|
21717
|
+
}
|
|
21718
|
+
return any_circuit_element.parse(diagnosticWithCircuitJsonDefaults);
|
|
21719
|
+
}
|
|
21720
|
+
isConnected(a, b, circuitJson) {
|
|
21721
|
+
const aKeys = this.getConnectivityKeys(a, circuitJson);
|
|
21722
|
+
const bKeys = this.getConnectivityKeys(b, circuitJson);
|
|
21723
|
+
return aKeys.some((key) => bKeys.includes(key));
|
|
21724
|
+
}
|
|
21725
|
+
getResistanceBetween(a, b, circuitJson) {
|
|
21726
|
+
if (this.isConnected(a, b, circuitJson)) return 0;
|
|
21727
|
+
const aKeys = this.getConnectivityKeys(a, circuitJson);
|
|
21728
|
+
const bKeys = this.getConnectivityKeys(b, circuitJson);
|
|
21729
|
+
if (aKeys.length === 0 || bKeys.length === 0) return null;
|
|
21730
|
+
const sourceResistors = circuitJson.filter(
|
|
21731
|
+
(elm) => elm.type === "source_component" && elm.ftype === "simple_resistor"
|
|
21732
|
+
);
|
|
21733
|
+
const root = this.root;
|
|
21734
|
+
if (!root) return null;
|
|
21735
|
+
for (const resistor of sourceResistors) {
|
|
21736
|
+
const resistorPorts = root.db.source_port.list({
|
|
21737
|
+
source_component_id: resistor.source_component_id
|
|
21738
|
+
});
|
|
21739
|
+
if (resistorPorts.length !== 2) continue;
|
|
21740
|
+
const resistorKeys = resistorPorts.map(
|
|
21741
|
+
(port) => port.subcircuit_connectivity_map_key
|
|
21742
|
+
);
|
|
21743
|
+
const connectsA = resistorKeys.some((key) => key && aKeys.includes(key));
|
|
21744
|
+
const connectsB = resistorKeys.some((key) => key && bKeys.includes(key));
|
|
21745
|
+
if (connectsA && connectsB) return resistor.resistance;
|
|
21746
|
+
}
|
|
21747
|
+
return null;
|
|
21748
|
+
}
|
|
21749
|
+
getConnectivityKeys(connectable, circuitJson) {
|
|
21750
|
+
if (!connectable) return [];
|
|
21751
|
+
if (typeof connectable === "string") {
|
|
21752
|
+
const selected = this.selectCustomDrcElement(connectable);
|
|
21753
|
+
if (selected) return this.getConnectivityKeys(selected, circuitJson);
|
|
21754
|
+
return [];
|
|
21755
|
+
}
|
|
21756
|
+
if (isSelectionResultPort(connectable)) {
|
|
21757
|
+
return [
|
|
21758
|
+
connectable.getSourcePort()?.subcircuit_connectivity_map_key
|
|
21759
|
+
].filter(isNonEmptyString);
|
|
21760
|
+
}
|
|
21761
|
+
if (isSelectionResultNet(connectable)) {
|
|
21762
|
+
return [
|
|
21763
|
+
connectable.getSourceNet()?.subcircuit_connectivity_map_key
|
|
21764
|
+
].filter(isNonEmptyString);
|
|
21765
|
+
}
|
|
21766
|
+
if (isSelectionResultComponent(connectable)) {
|
|
21767
|
+
return connectable.getPorts().flatMap((port) => this.getConnectivityKeys(port, circuitJson));
|
|
21768
|
+
}
|
|
21769
|
+
if (isCircuitJsonElement(connectable)) {
|
|
21770
|
+
return this.getCircuitJsonElementConnectivityKeys(
|
|
21771
|
+
connectable,
|
|
21772
|
+
circuitJson
|
|
21773
|
+
);
|
|
21774
|
+
}
|
|
21775
|
+
return [];
|
|
21776
|
+
}
|
|
21777
|
+
getCircuitJsonElementConnectivityKeys(element, circuitJson) {
|
|
21778
|
+
if (!element) return [];
|
|
21779
|
+
if (element.type === "source_port") {
|
|
21780
|
+
return [element.subcircuit_connectivity_map_key].filter(isNonEmptyString);
|
|
21781
|
+
}
|
|
21782
|
+
if (element.type === "source_net") {
|
|
21783
|
+
return [element.subcircuit_connectivity_map_key].filter(isNonEmptyString);
|
|
21784
|
+
}
|
|
21785
|
+
if (element.type === "pcb_port") {
|
|
21786
|
+
return this.getConnectivityKeys(element.source_port_id, circuitJson);
|
|
21787
|
+
}
|
|
21788
|
+
if (element.type === "source_component") {
|
|
21789
|
+
const root = this.root;
|
|
21790
|
+
if (!root) return [];
|
|
21791
|
+
return root.db.source_port.list({
|
|
21792
|
+
source_component_id: element.source_component_id
|
|
21793
|
+
}).map((port) => port.subcircuit_connectivity_map_key).filter(isNonEmptyString);
|
|
21794
|
+
}
|
|
21795
|
+
return [];
|
|
21796
|
+
}
|
|
21797
|
+
};
|
|
21798
|
+
|
|
21543
21799
|
// lib/IsolatedCircuit.ts
|
|
21544
21800
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
21545
21801
|
import Debug14 from "debug";
|
|
@@ -21550,7 +21806,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
21550
21806
|
var package_default = {
|
|
21551
21807
|
name: "@tscircuit/core",
|
|
21552
21808
|
type: "module",
|
|
21553
|
-
version: "0.0.
|
|
21809
|
+
version: "0.0.1272",
|
|
21554
21810
|
types: "dist/index.d.ts",
|
|
21555
21811
|
main: "dist/index.js",
|
|
21556
21812
|
module: "dist/index.js",
|
|
@@ -21597,7 +21853,7 @@ var package_default = {
|
|
|
21597
21853
|
"@tscircuit/math-utils": "^0.0.36",
|
|
21598
21854
|
"@tscircuit/miniflex": "^0.0.4",
|
|
21599
21855
|
"@tscircuit/ngspice-spice-engine": "^0.0.8",
|
|
21600
|
-
"@tscircuit/props": "^0.0.
|
|
21856
|
+
"@tscircuit/props": "^0.0.538",
|
|
21601
21857
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
21602
21858
|
"@tscircuit/schematic-trace-solver": "^0.0.60",
|
|
21603
21859
|
"@tscircuit/solver-utils": "^0.0.3",
|
|
@@ -21611,7 +21867,7 @@ var package_default = {
|
|
|
21611
21867
|
"bun-match-svg": "0.0.12",
|
|
21612
21868
|
"calculate-elbow": "^0.0.12",
|
|
21613
21869
|
"chokidar-cli": "^3.0.0",
|
|
21614
|
-
"circuit-json": "^0.0.
|
|
21870
|
+
"circuit-json": "^0.0.429",
|
|
21615
21871
|
"circuit-json-to-bpc": "^0.0.13",
|
|
21616
21872
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
21617
21873
|
"circuit-json-to-gltf": "^0.0.102",
|
|
@@ -22537,6 +22793,11 @@ var Board = class extends Group5 {
|
|
|
22537
22793
|
runAllPinSpecificationChecks(circuitJson)
|
|
22538
22794
|
);
|
|
22539
22795
|
}
|
|
22796
|
+
if (!drcChecksDisabled) {
|
|
22797
|
+
for (const drcCheck of this.selectAll("drccheck")) {
|
|
22798
|
+
checksToRun.push(drcCheck.runCustomDrcCheck(circuitJson));
|
|
22799
|
+
}
|
|
22800
|
+
}
|
|
22540
22801
|
const checkResults = await Promise.all(checksToRun);
|
|
22541
22802
|
db.insertAll(checkResults.flat());
|
|
22542
22803
|
};
|
|
@@ -28076,6 +28337,7 @@ export {
|
|
|
28076
28337
|
CurrentSource,
|
|
28077
28338
|
Cutout,
|
|
28078
28339
|
Diode,
|
|
28340
|
+
DrcCheck,
|
|
28079
28341
|
FabricationNoteDimension,
|
|
28080
28342
|
FabricationNotePath,
|
|
28081
28343
|
FabricationNoteRect,
|
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.1273",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@tscircuit/math-utils": "^0.0.36",
|
|
49
49
|
"@tscircuit/miniflex": "^0.0.4",
|
|
50
50
|
"@tscircuit/ngspice-spice-engine": "^0.0.8",
|
|
51
|
-
"@tscircuit/props": "^0.0.
|
|
51
|
+
"@tscircuit/props": "^0.0.538",
|
|
52
52
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
53
53
|
"@tscircuit/schematic-trace-solver": "^0.0.60",
|
|
54
54
|
"@tscircuit/solver-utils": "^0.0.3",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"bun-match-svg": "0.0.12",
|
|
63
63
|
"calculate-elbow": "^0.0.12",
|
|
64
64
|
"chokidar-cli": "^3.0.0",
|
|
65
|
-
"circuit-json": "^0.0.
|
|
65
|
+
"circuit-json": "^0.0.429",
|
|
66
66
|
"circuit-json-to-bpc": "^0.0.13",
|
|
67
67
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
68
68
|
"circuit-json-to-gltf": "^0.0.102",
|