@tscircuit/core 0.0.1468 → 0.0.1470

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as circuit_json from 'circuit-json';
2
2
  import { PcbTraceError, PcbPlacementError, PcbManualEditConflictWarning, PcbViaClearanceError, LayerRef, AnyCircuitElement, Size, PcbTrace as PcbTrace$1, PcbVia as PcbVia$1, PcbTraceRoutePoint, AnySourceComponent, PcbComponent, SchematicPort, SchematicComponent, PcbSilkscreenGraphic, RouteHintPoint, CircuitJson } from 'circuit-json';
3
3
  import * as _tscircuit_props from '@tscircuit/props';
4
- import { PlatformConfig, traceProps, netProps, AutorouterProp, AutoroutingPhaseProps, subcircuitGroupProps, AutorouterConfig, PcbSx, portProps, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, subcircuitProps, subpanelProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, interconnectProps, solderjumperProps, ledProps, powerSourceProps, voltageSourceProps, currentSourceProps, ammeterProps, resistorProps, constraintProps, drcCheckProps, autoroutingPhaseProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNoteTextProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, courtyardCircleProps, courtyardOutlineProps, courtyardRectProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, silkscreenGraphicProps, smtPadProps, fiducialProps, differentialPairProps, traceHintProps, viaProps, copperPourProps, copperTextProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, CrystalPinLabels, transistorProps, mosfetProps, opampProps, OpAmpPinLabels, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicPathProps, schematicBoxProps, schematicSectionProps, schematicSheetProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, voltageProbeProps, spicemodelProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
4
+ import { PlatformConfig, traceProps, netProps, AutorouterProp, AutoroutingPhaseProps, subcircuitGroupProps, AutorouterConfig, PcbSx, portProps, SupplierPartNumbers, CadModelProp, SchematicPortArrangement, groupProps, boardProps, subcircuitProps, subpanelProps, capacitorProps, chipProps, pinoutProps, diodeProps, fuseProps, jumperProps, interconnectProps, solderjumperProps, ledProps, powerSourceProps, voltageSourceProps, currentSourceProps, ammeterProps, resistorProps, constraintProps, internalCircuitProps, drcCheckProps, autoroutingPhaseProps, fabricationNoteRectProps, fabricationNotePathProps, fabricationNoteTextProps, fabricationNoteDimensionProps, pcbNoteLineProps, pcbNoteRectProps, pcbNoteTextProps, pcbNotePathProps, pcbNoteDimensionProps, footprintProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, cadmodelProps, cadassemblyProps, platedHoleProps, courtyardCircleProps, courtyardOutlineProps, courtyardRectProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, silkscreenGraphicProps, smtPadProps, fiducialProps, differentialPairProps, traceHintProps, viaProps, copperPourProps, copperTextProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, CrystalPinLabels, transistorProps, mosfetProps, opampProps, OpAmpPinLabels, switchProps, SwitchProps, testpointProps, schematicTextProps, schematicLineProps, schematicRectProps, schematicArcProps, schematicCircleProps, schematicPathProps, schematicBoxProps, schematicSectionProps, schematicSheetProps, schematicTableProps, schematicRowProps, schematicCellProps, symbolProps, analogSimulationProps, voltageProbeProps, spicemodelProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
5
5
  export { kicadFootprintStrings } from '@tscircuit/props';
6
6
  import * as react from 'react';
7
7
  import react__default, { ReactElement } from 'react';
@@ -35,11 +35,11 @@ declare const SOLVERS: {
35
35
  };
36
36
  type SolverName = keyof typeof SOLVERS;
37
37
 
38
- type SimplifiedPcbTrace = Omit<SimplifiedPcbTrace$1, "connection_name" | "connectedTo" | "route"> & {
38
+ type SimplifiedPcbTrace = Omit<SimplifiedPcbTrace$1, "connection_name" | "route"> & {
39
39
  type: "pcb_trace";
40
40
  pcb_trace_id: string;
41
41
  connection_name?: string;
42
- connectedTo?: string[];
42
+ connectsTo?: string[];
43
43
  route: Array<{
44
44
  route_type: "wire";
45
45
  x: number;
@@ -16340,12 +16340,14 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
16340
16340
  schWidth: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
16341
16341
  schHeight: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
16342
16342
  noSchematicRepresentation: z.ZodOptional<z.ZodBoolean>;
16343
+ schShowInternalCircuit: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
16343
16344
  noConnect: z.ZodOptional<z.ZodUnion<[z.ZodReadonly<z.ZodArray<z.ZodString, "many">>, z.ZodArray<z.ZodString, "many">]>>;
16344
16345
  connections: z.ZodOptional<z.ZodPipeline<z.ZodType<Partial<Record<string, string | string[] | readonly string[]>>, z.ZodTypeDef, Partial<Record<string, string | string[] | readonly string[]>>>, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodReadonly<z.ZodArray<z.ZodString, "many">>]>, z.ZodArray<z.ZodString, "many">]>>>>;
16345
16346
  spiceModel: z.ZodOptional<z.ZodType<_tscircuit_props.SpiceModelElement, z.ZodTypeDef, _tscircuit_props.SpiceModelElement>>;
16346
16347
  internalCircuit: z.ZodOptional<z.ZodType<_tscircuit_props.InternalCircuitElement, z.ZodTypeDef, _tscircuit_props.InternalCircuitElement>>;
16347
16348
  }, "strip", z.ZodTypeAny, {
16348
16349
  name: string;
16350
+ schShowInternalCircuit: boolean;
16349
16351
  symbol?: _tscircuit_props.SymbolProp | undefined;
16350
16352
  showAsTranslucentModel?: boolean | undefined;
16351
16353
  key?: any;
@@ -17657,6 +17659,7 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
17657
17659
  supplierPartNumber?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
17658
17660
  }[] | undefined;
17659
17661
  noSchematicRepresentation?: boolean | undefined;
17662
+ schShowInternalCircuit?: boolean | undefined;
17660
17663
  noConnect?: readonly string[] | string[] | undefined;
17661
17664
  spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
17662
17665
  internalCircuit?: _tscircuit_props.InternalCircuitElement | undefined;
@@ -17665,6 +17668,8 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
17665
17668
  };
17666
17669
  initPorts(opts?: {}): void;
17667
17670
  doInitialSchematicComponentRender(): void;
17671
+ _getSchematicBoxDimensions(): SchematicBoxDimensions | null;
17672
+ doInitialReactSubtreesRender(): void;
17668
17673
  doInitialSourceRender(): void;
17669
17674
  doInitialPcbComponentRender(): void;
17670
17675
  doInitialCreateTracesFromProps(): void;
@@ -21328,12 +21333,14 @@ declare class Pinout<PinLabels extends string = never> extends Chip<PinLabels> {
21328
21333
  schWidth: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
21329
21334
  schHeight: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
21330
21335
  noSchematicRepresentation: z.ZodOptional<z.ZodBoolean>;
21336
+ schShowInternalCircuit: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
21331
21337
  noConnect: z.ZodOptional<z.ZodUnion<[z.ZodReadonly<z.ZodArray<z.ZodString, "many">>, z.ZodArray<z.ZodString, "many">]>>;
21332
21338
  connections: z.ZodOptional<z.ZodPipeline<z.ZodType<Partial<Record<string, string | string[] | readonly string[]>>, z.ZodTypeDef, Partial<Record<string, string | string[] | readonly string[]>>>, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodReadonly<z.ZodArray<z.ZodString, "many">>]>, z.ZodArray<z.ZodString, "many">]>>>>;
21333
21339
  spiceModel: z.ZodOptional<z.ZodType<_tscircuit_props.SpiceModelElement, z.ZodTypeDef, _tscircuit_props.SpiceModelElement>>;
21334
21340
  internalCircuit: z.ZodOptional<z.ZodType<_tscircuit_props.InternalCircuitElement, z.ZodTypeDef, _tscircuit_props.InternalCircuitElement>>;
21335
21341
  }, "strip", z.ZodTypeAny, {
21336
21342
  name: string;
21343
+ schShowInternalCircuit: boolean;
21337
21344
  symbol?: _tscircuit_props.SymbolProp | undefined;
21338
21345
  showAsTranslucentModel?: boolean | undefined;
21339
21346
  key?: any;
@@ -22645,6 +22652,7 @@ declare class Pinout<PinLabels extends string = never> extends Chip<PinLabels> {
22645
22652
  supplierPartNumber?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
22646
22653
  }[] | undefined;
22647
22654
  noSchematicRepresentation?: boolean | undefined;
22655
+ schShowInternalCircuit?: boolean | undefined;
22648
22656
  noConnect?: readonly string[] | string[] | undefined;
22649
22657
  spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
22650
22658
  internalCircuit?: _tscircuit_props.InternalCircuitElement | undefined;
@@ -76006,6 +76014,19 @@ declare class Constraint extends PrimitiveComponent<typeof constraintProps> {
76006
76014
  };
76007
76015
  }
76008
76016
 
76017
+ declare class InternalCircuit extends PrimitiveComponent<typeof internalCircuitProps> {
76018
+ get config(): {
76019
+ componentName: string;
76020
+ zodProps: zod.ZodObject<{
76021
+ children: zod.ZodOptional<zod.ZodType<react.ReactNode, zod.ZodTypeDef, react.ReactNode>>;
76022
+ }, "strip", zod.ZodTypeAny, {
76023
+ children?: react.ReactNode;
76024
+ }, {
76025
+ children?: react.ReactNode;
76026
+ }>;
76027
+ };
76028
+ }
76029
+
76009
76030
  declare class DrcCheck extends PrimitiveComponent<typeof drcCheckProps> {
76010
76031
  get config(): {
76011
76032
  componentName: string;
@@ -98679,6 +98700,7 @@ declare class Connector<PinLabels extends string = never> extends Chip<PinLabels
98679
98700
  schWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
98680
98701
  schHeight: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
98681
98702
  noSchematicRepresentation: zod.ZodOptional<zod.ZodBoolean>;
98703
+ schShowInternalCircuit: zod.ZodDefault<zod.ZodOptional<zod.ZodBoolean>>;
98682
98704
  noConnect: zod.ZodOptional<zod.ZodUnion<[zod.ZodReadonly<zod.ZodArray<zod.ZodString, "many">>, zod.ZodArray<zod.ZodString, "many">]>>;
98683
98705
  connections: zod.ZodOptional<zod.ZodPipeline<zod.ZodType<Partial<Record<string, string | string[] | readonly string[]>>, zod.ZodTypeDef, Partial<Record<string, string | string[] | readonly string[]>>>, zod.ZodRecord<zod.ZodString, zod.ZodUnion<[zod.ZodUnion<[zod.ZodString, zod.ZodReadonly<zod.ZodArray<zod.ZodString, "many">>]>, zod.ZodArray<zod.ZodString, "many">]>>>>;
98684
98706
  spiceModel: zod.ZodOptional<zod.ZodType<_tscircuit_props.SpiceModelElement, zod.ZodTypeDef, _tscircuit_props.SpiceModelElement>>;
@@ -98687,6 +98709,7 @@ declare class Connector<PinLabels extends string = never> extends Chip<PinLabels
98687
98709
  standard: zod.ZodOptional<zod.ZodEnum<["usb_c", "m2"]>>;
98688
98710
  }, "strip", zod.ZodTypeAny, {
98689
98711
  name: string;
98712
+ schShowInternalCircuit: boolean;
98690
98713
  symbol?: _tscircuit_props.SymbolProp | undefined;
98691
98714
  showAsTranslucentModel?: boolean | undefined;
98692
98715
  key?: any;
@@ -99999,6 +100022,7 @@ declare class Connector<PinLabels extends string = never> extends Chip<PinLabels
99999
100022
  supplierPartNumber?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
100000
100023
  }[] | undefined;
100001
100024
  noSchematicRepresentation?: boolean | undefined;
100025
+ schShowInternalCircuit?: boolean | undefined;
100002
100026
  noConnect?: readonly string[] | string[] | undefined;
100003
100027
  spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
100004
100028
  internalCircuit?: _tscircuit_props.InternalCircuitElement | undefined;
@@ -122097,12 +122121,14 @@ declare class PushButton extends NormalComponent<typeof pushButtonProps, Passive
122097
122121
  schWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
122098
122122
  schHeight: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
122099
122123
  noSchematicRepresentation: zod.ZodOptional<zod.ZodBoolean>;
122124
+ schShowInternalCircuit: zod.ZodDefault<zod.ZodOptional<zod.ZodBoolean>>;
122100
122125
  noConnect: zod.ZodOptional<zod.ZodUnion<[zod.ZodReadonly<zod.ZodArray<zod.ZodString, "many">>, zod.ZodArray<zod.ZodString, "many">]>>;
122101
122126
  connections: zod.ZodOptional<zod.ZodPipeline<zod.ZodType<Partial<Record<string, string | string[] | readonly string[]>>, zod.ZodTypeDef, Partial<Record<string, string | string[] | readonly string[]>>>, zod.ZodRecord<zod.ZodString, zod.ZodUnion<[zod.ZodUnion<[zod.ZodString, zod.ZodReadonly<zod.ZodArray<zod.ZodString, "many">>]>, zod.ZodArray<zod.ZodString, "many">]>>>>;
122102
122127
  spiceModel: zod.ZodOptional<zod.ZodType<_tscircuit_props.SpiceModelElement, zod.ZodTypeDef, _tscircuit_props.SpiceModelElement>>;
122103
122128
  internalCircuit: zod.ZodOptional<zod.ZodType<_tscircuit_props.InternalCircuitElement, zod.ZodTypeDef, _tscircuit_props.InternalCircuitElement>>;
122104
122129
  }, "strip", zod.ZodTypeAny, {
122105
122130
  name: string;
122131
+ schShowInternalCircuit: boolean;
122106
122132
  symbol?: _tscircuit_props.SymbolProp | undefined;
122107
122133
  showAsTranslucentModel?: boolean | undefined;
122108
122134
  key?: any;
@@ -123414,6 +123440,7 @@ declare class PushButton extends NormalComponent<typeof pushButtonProps, Passive
123414
123440
  supplierPartNumber?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
123415
123441
  }[] | undefined;
123416
123442
  noSchematicRepresentation?: boolean | undefined;
123443
+ schShowInternalCircuit?: boolean | undefined;
123417
123444
  noConnect?: readonly string[] | string[] | undefined;
123418
123445
  spiceModel?: _tscircuit_props.SpiceModelElement | undefined;
123419
123446
  internalCircuit?: _tscircuit_props.InternalCircuitElement | undefined;
@@ -137062,6 +137089,12 @@ declare class Mosfet extends NormalComponent<typeof mosfetProps> {
137062
137089
  doInitialSourceRender(): void;
137063
137090
  }
137064
137091
 
137092
+ declare class InternalCircuitMosfet extends Mosfet {
137093
+ resolveFootprint(): undefined;
137094
+ doInitialPcbComponentRender(): void;
137095
+ doInitialReactSubtreesRender(): void;
137096
+ }
137097
+
137065
137098
  declare class OpAmp extends NormalComponent<typeof opampProps, OpAmpPinLabels> {
137066
137099
  getSchematicSymbolName(): BaseSymbolName;
137067
137100
  get config(): {
@@ -159210,6 +159243,7 @@ interface TscircuitElements {
159210
159243
  transistor: _tscircuit_props.TransistorProps;
159211
159244
  switch: _tscircuit_props.SwitchProps;
159212
159245
  mosfet: _tscircuit_props.MosfetProps;
159246
+ internalcircuit: _tscircuit_props.InternalCircuitProps;
159213
159247
  testpoint: _tscircuit_props.TestpointProps;
159214
159248
  voltagesource: _tscircuit_props.VoltageSourceProps;
159215
159249
  currentsource: _tscircuit_props.CurrentSourceProps;
@@ -159239,4 +159273,4 @@ declare module "react/jsx-runtime" {
159239
159273
  }
159240
159274
  }
159241
159275
 
159242
- export { Ammeter, 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, DifferentialPair, 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, SchematicSheet, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenGraphic, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteDifferentialPair, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, type SolverName, type SolverStartedEvent, SpiceModel, type SrjConnectionName, 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 };
159276
+ export { Ammeter, 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, DifferentialPair, 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, InternalCircuit, InternalCircuitMosfet, 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, SchematicSheet, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenGraphic, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteDifferentialPair, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, type SolverName, type SolverStartedEvent, SpiceModel, type SrjConnectionName, 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
@@ -44,6 +44,8 @@ __export(components_exports, {
44
44
  Hole: () => Hole,
45
45
  Inductor: () => Inductor,
46
46
  Interconnect: () => Interconnect,
47
+ InternalCircuit: () => InternalCircuit,
48
+ InternalCircuitMosfet: () => InternalCircuitMosfet,
47
49
  Jumper: () => Jumper,
48
50
  Keepout: () => Keepout,
49
51
  Led: () => Led,
@@ -4261,6 +4263,13 @@ function Trace_doInitialPcbTraceRender(trace) {
4261
4263
  }
4262
4264
  const portsConnectedOnPcbViaNet = [];
4263
4265
  if (!allPortsFound) return;
4266
+ const hasEndpointWithoutPcbRepresentation = ports.some((port) => {
4267
+ const parentComponent = port.getParentNormalComponent();
4268
+ return Boolean(
4269
+ parentComponent?.source_component_id && !parentComponent.pcb_component_id
4270
+ );
4271
+ });
4272
+ if (hasEndpointWithoutPcbRepresentation) return;
4264
4273
  const pcbSelectorError = portsWithSelectors.map(
4265
4274
  ({ selector, port }) => getPcbSelectorErrorForTracePort(selector, port)
4266
4275
  ).find(Boolean);
@@ -5730,6 +5739,7 @@ import { DefaultEventPriority } from "react-reconciler/constants.js";
5730
5739
 
5731
5740
  // lib/fiber/catalogue.ts
5732
5741
  var catalogue = {};
5742
+ var internalCircuitCatalogue = {};
5733
5743
  var extendCatalogue = (objects) => {
5734
5744
  const altKeys = Object.fromEntries(
5735
5745
  Object.entries(objects).map(([key, v]) => [key.toLowerCase(), v])
@@ -5737,6 +5747,13 @@ var extendCatalogue = (objects) => {
5737
5747
  Object.assign(catalogue, objects);
5738
5748
  Object.assign(catalogue, altKeys);
5739
5749
  };
5750
+ var extendInternalCircuitCatalogue = (objects) => {
5751
+ const altKeys = Object.fromEntries(
5752
+ Object.entries(objects).map(([key, value]) => [key.toLowerCase(), value])
5753
+ );
5754
+ Object.assign(internalCircuitCatalogue, objects);
5755
+ Object.assign(internalCircuitCatalogue, altKeys);
5756
+ };
5740
5757
 
5741
5758
  // lib/fiber/create-instance-from-react-element.ts
5742
5759
  import { identity as identity3 } from "transformation-matrix";
@@ -5851,14 +5868,19 @@ function prepare(object, state) {
5851
5868
  }
5852
5869
  var hostConfig = {
5853
5870
  supportsMutation: true,
5854
- createInstance(type, props) {
5855
- const target = catalogue[type];
5871
+ createInstance(type, props, _rootContainer, hostContext) {
5872
+ const target = hostContext.isInsideInternalCircuit ? internalCircuitCatalogue[type] : catalogue[type];
5856
5873
  if (!target) {
5857
5874
  if (Object.keys(catalogue).length === 0) {
5858
5875
  throw new Error(
5859
5876
  "No components registered in catalogue, did you forget to import lib/register-catalogue in your test file?"
5860
5877
  );
5861
5878
  }
5879
+ if (hostContext.isInsideInternalCircuit) {
5880
+ throw new Error(
5881
+ `Unsupported component type "${type}" inside <internalcircuit>. No schematic-only implementation is registered for this element.`
5882
+ );
5883
+ }
5862
5884
  throw new Error(
5863
5885
  `Unsupported component type "${type}". No element with this name is registered in the @tscircuit/core catalogue. Check for typos or see https://docs.tscircuit.com/category/built-in-elements for a list of valid components. To add your own component, see docs/CREATING_NEW_COMPONENTS.md`
5864
5886
  );
@@ -5895,10 +5917,14 @@ var hostConfig = {
5895
5917
  return false;
5896
5918
  },
5897
5919
  getRootHostContext() {
5898
- return {};
5920
+ return { isInsideInternalCircuit: false };
5899
5921
  },
5900
- getChildHostContext() {
5901
- return {};
5922
+ getChildHostContext(parentHostContext, type) {
5923
+ if (parentHostContext.isInsideInternalCircuit) return parentHostContext;
5924
+ if (type === "internalcircuit") {
5925
+ return { isInsideInternalCircuit: true };
5926
+ }
5927
+ return parentHostContext;
5902
5928
  },
5903
5929
  prepareForCommit() {
5904
5930
  return null;
@@ -9978,6 +10004,8 @@ var Port = class extends PrimitiveComponent2 {
9978
10004
  Port_tryRenderGroupPcbPort(this);
9979
10005
  return;
9980
10006
  }
10007
+ const pcbMatches = matchedComponents.filter((c) => c.isPcbPrimitive);
10008
+ if (pcbMatches.length === 0) return;
9981
10009
  const parentNormalComponent = this.getParentNormalComponent();
9982
10010
  const parentWithPcbComponentId = this.parent?.pcb_component_id ? this.parent : parentNormalComponent;
9983
10011
  if (!parentWithPcbComponentId?.pcb_component_id) {
@@ -9985,8 +10013,6 @@ var Port = class extends PrimitiveComponent2 {
9985
10013
  `${this.getString()} has no parent pcb component, cannot render pcb_port (parent: ${this.parent?.getString()}, parentNormalComponent: ${parentNormalComponent?.getString()})`
9986
10014
  );
9987
10015
  }
9988
- const pcbMatches = matchedComponents.filter((c) => c.isPcbPrimitive);
9989
- if (pcbMatches.length === 0) return;
9990
10016
  let matchCenter = null;
9991
10017
  if (pcbMatches.length === 1) {
9992
10018
  matchCenter = pcbMatches[0]._getPcbCircuitJsonBounds().center;
@@ -15282,6 +15308,19 @@ var Chip = class extends NormalComponent3 {
15282
15308
  if (props?.noSchematicRepresentation === true) return;
15283
15309
  super.doInitialSchematicComponentRender();
15284
15310
  }
15311
+ _getSchematicBoxDimensions() {
15312
+ if (this._parsedProps.schShowInternalCircuit && this._parsedProps.internalCircuit) {
15313
+ return null;
15314
+ }
15315
+ return super._getSchematicBoxDimensions();
15316
+ }
15317
+ doInitialReactSubtreesRender() {
15318
+ super.doInitialReactSubtreesRender();
15319
+ const internalCircuit = this._parsedProps.internalCircuit;
15320
+ if (this._parsedProps.schShowInternalCircuit && internalCircuit && !this.children.some((child) => child.componentName === "InternalCircuit")) {
15321
+ this.add(internalCircuit);
15322
+ }
15323
+ }
15285
15324
  doInitialSourceRender() {
15286
15325
  const { db } = this.root;
15287
15326
  const { _parsedProps: props } = this;
@@ -16438,54 +16477,23 @@ var getDifferentialPairsForSimpleRouteJson = ({
16438
16477
 
16439
16478
  // lib/utils/autorouting/getPreservedRoutedSubcircuitTraces.ts
16440
16479
  var getPreservedTraceConnectionName = (trace) => trace.source_trace_id ?? trace.connection_name ?? trace.pcb_trace_id;
16441
- var getConnectedToIdsForPreservedTrace = ({
16442
- trace,
16443
- connectionName,
16444
- scopedDb,
16445
- sharedConnMap
16446
- }) => {
16447
- const connectedToIds = /* @__PURE__ */ new Set();
16448
- const addConnectedId = (id) => {
16449
- if (!id) return;
16450
- connectedToIds.add(id);
16451
- const connectivityNetId = sharedConnMap.getNetConnectedToId(id);
16452
- if (!connectivityNetId) return;
16453
- connectedToIds.add(connectivityNetId);
16454
- for (const connectedId of sharedConnMap.getIdsConnectedToNet(
16455
- connectivityNetId
16456
- )) {
16457
- connectedToIds.add(connectedId);
16458
- }
16459
- };
16460
- addConnectedId(connectionName);
16461
- addConnectedId(trace.source_trace_id);
16462
- const sourceTrace = trace.source_trace_id ? scopedDb.source_trace.get(trace.source_trace_id) : null;
16463
- if (sourceTrace) {
16464
- for (const id of sourceTrace.connected_source_net_ids ?? []) {
16465
- addConnectedId(id);
16466
- }
16467
- for (const id of sourceTrace.connected_source_port_ids ?? []) {
16468
- addConnectedId(id);
16469
- }
16470
- }
16480
+ var getPhysicalConnectionIdsForPreservedTrace = (trace) => {
16481
+ const physicallyConnectedIds = new Set(trace.connectsTo ?? []);
16471
16482
  for (const routePoint of trace.route ?? []) {
16472
16483
  if (routePoint.route_type !== "wire") continue;
16473
16484
  for (const pcbPortId of [
16474
16485
  routePoint.start_pcb_port_id,
16475
16486
  routePoint.end_pcb_port_id
16476
16487
  ]) {
16477
- addConnectedId(pcbPortId);
16478
- const pcbPort = pcbPortId ? scopedDb.pcb_port.get(pcbPortId) : null;
16479
- addConnectedId(pcbPort?.source_port_id);
16488
+ if (pcbPortId) physicallyConnectedIds.add(pcbPortId);
16480
16489
  }
16481
16490
  }
16482
- return Array.from(connectedToIds);
16491
+ return Array.from(physicallyConnectedIds);
16483
16492
  };
16484
16493
  var getPreservedRoutedSubcircuitTraces = ({
16485
16494
  scopedDb,
16486
16495
  currentSubcircuitId,
16487
- relevantSubcircuitIds,
16488
- sharedConnMap
16496
+ relevantSubcircuitIds
16489
16497
  }) => scopedDb.pcb_trace.list().filter((trace) => {
16490
16498
  if (!trace.subcircuit_id) return false;
16491
16499
  if (!currentSubcircuitId) return true;
@@ -16498,12 +16506,7 @@ var getPreservedRoutedSubcircuitTraces = ({
16498
16506
  pcb_trace_id: trace.pcb_trace_id,
16499
16507
  source_trace_id: trace.source_trace_id,
16500
16508
  connection_name: connectionName,
16501
- connectedTo: getConnectedToIdsForPreservedTrace({
16502
- trace: preservedTrace,
16503
- connectionName,
16504
- scopedDb,
16505
- sharedConnMap
16506
- }),
16509
+ connectsTo: getPhysicalConnectionIdsForPreservedTrace(preservedTrace),
16507
16510
  route: trace.route
16508
16511
  };
16509
16512
  }).filter((trace) => trace.route.length >= 2);
@@ -16709,8 +16712,7 @@ var getSimpleRouteJsonFromCircuitJson = ({
16709
16712
  const preservedRoutedSubcircuitTraces = getPreservedRoutedSubcircuitTraces({
16710
16713
  scopedDb: db,
16711
16714
  currentSubcircuitId: subcircuit_id,
16712
- relevantSubcircuitIds,
16713
- sharedConnMap
16715
+ relevantSubcircuitIds
16714
16716
  });
16715
16717
  for (const obstacle of obstacles) {
16716
16718
  const additionalIds = obstacle.connectedTo.flatMap(
@@ -22899,7 +22901,7 @@ function Group_getRoutingPhasePlans(group) {
22899
22901
  var package_default = {
22900
22902
  name: "@tscircuit/core",
22901
22903
  type: "module",
22902
- version: "0.0.1467",
22904
+ version: "0.0.1469",
22903
22905
  types: "dist/index.d.ts",
22904
22906
  main: "dist/index.js",
22905
22907
  module: "dist/index.js",
@@ -22948,7 +22950,7 @@ var package_default = {
22948
22950
  "@tscircuit/math-utils": "^0.0.36",
22949
22951
  "@tscircuit/miniflex": "^0.0.4",
22950
22952
  "@tscircuit/ngspice-spice-engine": "^0.0.19",
22951
- "@tscircuit/props": "^0.0.585",
22953
+ "@tscircuit/props": "^0.0.586",
22952
22954
  "@tscircuit/schematic-match-adapt": "^0.0.18",
22953
22955
  "@tscircuit/schematic-trace-solver": "^0.0.104",
22954
22956
  "@tscircuit/solver-utils": "^0.0.16",
@@ -29520,6 +29522,17 @@ var Constraint3 = class extends PrimitiveComponent2 {
29520
29522
  }
29521
29523
  };
29522
29524
 
29525
+ // lib/components/primitive-components/InternalCircuit.ts
29526
+ import { internalCircuitProps } from "@tscircuit/props";
29527
+ var InternalCircuit = class extends PrimitiveComponent2 {
29528
+ get config() {
29529
+ return {
29530
+ componentName: "InternalCircuit",
29531
+ zodProps: internalCircuitProps
29532
+ };
29533
+ }
29534
+ };
29535
+
29523
29536
  // lib/components/primitive-components/AutoroutingPhase.ts
29524
29537
  import { autoroutingPhaseProps } from "@tscircuit/props";
29525
29538
  var AutoroutingPhase = class extends PrimitiveComponent2 {
@@ -32540,6 +32553,22 @@ var Mosfet = class extends NormalComponent3 {
32540
32553
  }
32541
32554
  };
32542
32555
 
32556
+ // lib/components/normal-components/InternalCircuitMosfet.ts
32557
+ import { isValidElement as isValidElement3 } from "react";
32558
+ var InternalCircuitMosfet = class extends Mosfet {
32559
+ resolveFootprint() {
32560
+ return void 0;
32561
+ }
32562
+ doInitialPcbComponentRender() {
32563
+ }
32564
+ doInitialReactSubtreesRender() {
32565
+ const symbol = this.props.symbol;
32566
+ if (isValidElement3(symbol) && !this.children.some((child) => child.componentName === "Symbol")) {
32567
+ this.add(symbol);
32568
+ }
32569
+ }
32570
+ };
32571
+
32543
32572
  // lib/components/normal-components/OpAmp.ts
32544
32573
  import { opampProps } from "@tscircuit/props";
32545
32574
  var OpAmp = class extends NormalComponent3 {
@@ -33895,6 +33924,9 @@ extendCatalogue({
33895
33924
  Fanout: Breakout,
33896
33925
  FanoutPoint: BreakoutPoint
33897
33926
  });
33927
+ extendInternalCircuitCatalogue({
33928
+ Mosfet: InternalCircuitMosfet
33929
+ });
33898
33930
  export {
33899
33931
  Ammeter,
33900
33932
  AnalogSimulation,
@@ -33934,6 +33966,8 @@ export {
33934
33966
  Hole,
33935
33967
  Inductor,
33936
33968
  Interconnect,
33969
+ InternalCircuit,
33970
+ InternalCircuitMosfet,
33937
33971
  IsolatedCircuit,
33938
33972
  Jumper,
33939
33973
  Keepout,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1468",
4
+ "version": "0.0.1470",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -50,7 +50,7 @@
50
50
  "@tscircuit/math-utils": "^0.0.36",
51
51
  "@tscircuit/miniflex": "^0.0.4",
52
52
  "@tscircuit/ngspice-spice-engine": "^0.0.19",
53
- "@tscircuit/props": "^0.0.585",
53
+ "@tscircuit/props": "^0.0.586",
54
54
  "@tscircuit/schematic-match-adapt": "^0.0.18",
55
55
  "@tscircuit/schematic-trace-solver": "^0.0.104",
56
56
  "@tscircuit/solver-utils": "^0.0.16",