@tscircuit/core 0.0.1491 → 0.0.1493

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, PcbBoard, 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, 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, enclosureCutoutApertureProps, enclosureFdmBoxProps, 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, EnclosureCutoutApertureProps, EnclosureFdmBoxProps, 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, 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, enclosureCutoutApertureProps, enclosureFdmBoxProps, 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, EnclosureCutoutApertureProps, EnclosureFdmBoxProps, 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';
@@ -17670,8 +17670,6 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
17670
17670
  };
17671
17671
  initPorts(opts?: {}): void;
17672
17672
  doInitialSchematicComponentRender(): void;
17673
- _getSchematicBoxDimensions(): SchematicBoxDimensions | null;
17674
- doInitialReactSubtreesRender(): void;
17675
17673
  doInitialSourceRender(): void;
17676
17674
  doInitialPcbComponentRender(): void;
17677
17675
  doInitialCreateTracesFromProps(): void;
@@ -76016,19 +76014,6 @@ declare class Constraint extends PrimitiveComponent<typeof constraintProps> {
76016
76014
  };
76017
76015
  }
76018
76016
 
76019
- declare class InternalCircuit extends PrimitiveComponent<typeof internalCircuitProps> {
76020
- get config(): {
76021
- componentName: string;
76022
- zodProps: zod.ZodObject<{
76023
- children: zod.ZodOptional<zod.ZodType<react.ReactNode, zod.ZodTypeDef, react.ReactNode>>;
76024
- }, "strip", zod.ZodTypeAny, {
76025
- children?: react.ReactNode;
76026
- }, {
76027
- children?: react.ReactNode;
76028
- }>;
76029
- };
76030
- }
76031
-
76032
76017
  declare class DrcCheck extends PrimitiveComponent<typeof drcCheckProps> {
76033
76018
  get config(): {
76034
76019
  componentName: string;
@@ -137184,12 +137169,6 @@ declare class Mosfet extends NormalComponent<typeof mosfetProps> {
137184
137169
  doInitialSourceRender(): void;
137185
137170
  }
137186
137171
 
137187
- declare class InternalCircuitMosfet extends Mosfet {
137188
- resolveFootprint(): undefined;
137189
- doInitialPcbComponentRender(): void;
137190
- doInitialReactSubtreesRender(): void;
137191
- }
137192
-
137193
137172
  declare class OpAmp extends NormalComponent<typeof opampProps, OpAmpPinLabels> {
137194
137173
  getSchematicSymbolName(): BaseSymbolName;
137195
137174
  get config(): {
@@ -159655,7 +159634,6 @@ interface TscircuitElements {
159655
159634
  transistor: _tscircuit_props.TransistorProps;
159656
159635
  switch: _tscircuit_props.SwitchProps;
159657
159636
  mosfet: _tscircuit_props.MosfetProps;
159658
- internalcircuit: _tscircuit_props.InternalCircuitProps;
159659
159637
  testpoint: _tscircuit_props.TestpointProps;
159660
159638
  voltagesource: _tscircuit_props.VoltageSourceProps;
159661
159639
  currentsource: _tscircuit_props.CurrentSourceProps;
@@ -159685,4 +159663,4 @@ declare module "react/jsx-runtime" {
159685
159663
  }
159686
159664
  }
159687
159665
 
159688
- 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, EnclosureCutoutAperture, EnclosureFdmBox, 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, enclosure, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, renderPhaseIndexMap, resolveStaticFileImport, sel, unrouteCircuitJson, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
159666
+ 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, EnclosureCutoutAperture, EnclosureFdmBox, 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, enclosure, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, renderPhaseIndexMap, resolveStaticFileImport, sel, unrouteCircuitJson, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
package/dist/index.js CHANGED
@@ -46,8 +46,6 @@ __export(components_exports, {
46
46
  Hole: () => Hole,
47
47
  Inductor: () => Inductor,
48
48
  Interconnect: () => Interconnect,
49
- InternalCircuit: () => InternalCircuit,
50
- InternalCircuitMosfet: () => InternalCircuitMosfet,
51
49
  Jumper: () => Jumper,
52
50
  Keepout: () => Keepout,
53
51
  Led: () => Led,
@@ -4265,13 +4263,6 @@ function Trace_doInitialPcbTraceRender(trace) {
4265
4263
  }
4266
4264
  const portsConnectedOnPcbViaNet = [];
4267
4265
  if (!allPortsFound) return;
4268
- const hasEndpointWithoutPcbRepresentation = ports.some((port) => {
4269
- const parentComponent = port.getParentNormalComponent();
4270
- return Boolean(
4271
- parentComponent?.source_component_id && !parentComponent.pcb_component_id
4272
- );
4273
- });
4274
- if (hasEndpointWithoutPcbRepresentation) return;
4275
4266
  const pcbSelectorError = portsWithSelectors.map(
4276
4267
  ({ selector, port }) => getPcbSelectorErrorForTracePort(selector, port)
4277
4268
  ).find(Boolean);
@@ -5145,14 +5136,6 @@ var Trace_doInitialSchematicTraceRender = (trace) => {
5145
5136
  const hasSheetLocalSchematicPortRepresentation = portsWithPosition.some(
5146
5137
  ({ port, schematic_port_id }) => port.schematic_port_id !== schematic_port_id
5147
5138
  );
5148
- const connectedSchematicPorts = portsWithPosition.map(({ schematic_port_id }) => db.schematic_port.get(schematic_port_id)).filter((port) => Boolean(port));
5149
- const [firstSchematicPort, secondSchematicPort] = connectedSchematicPorts;
5150
- const firstIsInternalAndSecondOverlaps = firstSchematicPort?.is_internal_circuit_port && secondSchematicPort?.is_overlapping_internal_circuit_port;
5151
- const secondIsInternalAndFirstOverlaps = secondSchematicPort?.is_internal_circuit_port && firstSchematicPort?.is_overlapping_internal_circuit_port;
5152
- const isInternalCircuitPortMapping = connectedSchematicPorts.length === 2 && (firstIsInternalAndSecondOverlaps || secondIsInternalAndFirstOverlaps);
5153
- if (isInternalCircuitPortMapping) {
5154
- return;
5155
- }
5156
5139
  const portPairKey = portIds.join(",");
5157
5140
  const board = trace.root?._getBoard();
5158
5141
  if (board?._connectedSchematicPortPairs) {
@@ -5767,7 +5750,6 @@ import { DefaultEventPriority } from "react-reconciler/constants.js";
5767
5750
 
5768
5751
  // lib/fiber/catalogue.ts
5769
5752
  var catalogue = {};
5770
- var internalCircuitCatalogue = {};
5771
5753
  var extendCatalogue = (objects) => {
5772
5754
  const altKeys = Object.fromEntries(
5773
5755
  Object.entries(objects).map(([key, v]) => [key.toLowerCase(), v])
@@ -5775,13 +5757,6 @@ var extendCatalogue = (objects) => {
5775
5757
  Object.assign(catalogue, objects);
5776
5758
  Object.assign(catalogue, altKeys);
5777
5759
  };
5778
- var extendInternalCircuitCatalogue = (objects) => {
5779
- const altKeys = Object.fromEntries(
5780
- Object.entries(objects).map(([key, value]) => [key.toLowerCase(), value])
5781
- );
5782
- Object.assign(internalCircuitCatalogue, objects);
5783
- Object.assign(internalCircuitCatalogue, altKeys);
5784
- };
5785
5760
 
5786
5761
  // lib/fiber/create-instance-from-react-element.ts
5787
5762
  import { identity as identity3 } from "transformation-matrix";
@@ -5896,19 +5871,14 @@ function prepare(object, state) {
5896
5871
  }
5897
5872
  var hostConfig = {
5898
5873
  supportsMutation: true,
5899
- createInstance(type, props, _rootContainer, hostContext) {
5900
- const target = hostContext.isInsideInternalCircuit ? internalCircuitCatalogue[type] : catalogue[type];
5874
+ createInstance(type, props) {
5875
+ const target = catalogue[type];
5901
5876
  if (!target) {
5902
5877
  if (Object.keys(catalogue).length === 0) {
5903
5878
  throw new Error(
5904
5879
  "No components registered in catalogue, did you forget to import lib/register-catalogue in your test file?"
5905
5880
  );
5906
5881
  }
5907
- if (hostContext.isInsideInternalCircuit) {
5908
- throw new Error(
5909
- `Unsupported component type "${type}" inside <internalcircuit>. No schematic-only implementation is registered for this element.`
5910
- );
5911
- }
5912
5882
  throw new Error(
5913
5883
  `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`
5914
5884
  );
@@ -5945,14 +5915,10 @@ var hostConfig = {
5945
5915
  return false;
5946
5916
  },
5947
5917
  getRootHostContext() {
5948
- return { isInsideInternalCircuit: false };
5918
+ return {};
5949
5919
  },
5950
- getChildHostContext(parentHostContext, type) {
5951
- if (parentHostContext.isInsideInternalCircuit) return parentHostContext;
5952
- if (type === "internalcircuit") {
5953
- return { isInsideInternalCircuit: true };
5954
- }
5955
- return parentHostContext;
5920
+ getChildHostContext() {
5921
+ return {};
5956
5922
  },
5957
5923
  prepareForCommit() {
5958
5924
  return null;
@@ -9768,62 +9734,6 @@ var getNetNameFromSourcePorts = (db, sourcePortIds) => {
9768
9734
  return candidates[0]?.label;
9769
9735
  };
9770
9736
 
9771
- // lib/components/primitive-components/Port/internalCircuitPortMapping.ts
9772
- var getInternalCircuitAncestor = (port) => {
9773
- let ancestor = port.parent;
9774
- while (ancestor) {
9775
- if (ancestor.componentName === "InternalCircuit") return ancestor;
9776
- ancestor = ancestor.parent;
9777
- }
9778
- return null;
9779
- };
9780
- var isInternalCircuitPort = (port) => getInternalCircuitAncestor(port) !== null;
9781
- var getConnectionTargets2 = (target) => {
9782
- if (!target) return [];
9783
- return typeof target === "string" ? [target] : [...target];
9784
- };
9785
- var getChipPortsMappedToInternalCircuitPort = (internalCircuitPort) => {
9786
- const internalCircuit = getInternalCircuitAncestor(internalCircuitPort);
9787
- const containingChip = internalCircuit?.parent;
9788
- if (!internalCircuit || !containingChip) return [];
9789
- const internalComponent = internalCircuitPort.getParentNormalComponent();
9790
- const connections = internalComponent?._parsedProps?.connections;
9791
- if (!connections) return [];
9792
- const mappedChipPorts = [];
9793
- for (const [portName, target] of Object.entries(connections)) {
9794
- if (!internalCircuitPort.isMatchingAnyOf([portName])) continue;
9795
- for (const targetSelector of getConnectionTargets2(target)) {
9796
- const targetPort = internalCircuitPort.getSubcircuit().selectOne(targetSelector, { type: "port" });
9797
- if (!targetPort) continue;
9798
- if (targetPort.getParentNormalComponent() !== containingChip) continue;
9799
- if (!mappedChipPorts.includes(targetPort)) {
9800
- mappedChipPorts.push(targetPort);
9801
- }
9802
- }
9803
- }
9804
- return mappedChipPorts;
9805
- };
9806
- var isInternalCircuitPortMappedToChipPort = (port) => getChipPortsMappedToInternalCircuitPort(port).length > 0;
9807
- var getInternalCircuitPortMappedToChipPort = (chipPort) => {
9808
- const chipComponent = chipPort.getParentNormalComponent();
9809
- if (!chipComponent) return null;
9810
- const internalCircuit = chipComponent.children.find(
9811
- (child) => child.componentName === "InternalCircuit"
9812
- );
9813
- if (!internalCircuit) return null;
9814
- const mappedInternalCircuitPorts = internalCircuit.getDescendants().filter((component) => component.componentName === "Port").map((component) => component).filter(
9815
- (internalCircuitPort) => getChipPortsMappedToInternalCircuitPort(internalCircuitPort).includes(
9816
- chipPort
9817
- )
9818
- );
9819
- if (mappedInternalCircuitPorts.length > 1) {
9820
- throw new Error(
9821
- `${chipPort.getString()} is mapped to multiple internal circuit ports: ${mappedInternalCircuitPorts.map((port) => port.getString()).join(", ")}. A chip port can overlap only one internal circuit port.`
9822
- );
9823
- }
9824
- return mappedInternalCircuitPorts[0] ?? null;
9825
- };
9826
-
9827
9737
  // lib/components/primitive-components/Port/Port.ts
9828
9738
  var Port = class extends PrimitiveComponent2 {
9829
9739
  source_port_id = null;
@@ -9943,10 +9853,6 @@ var Port = class extends PrimitiveComponent2 {
9943
9853
  * are rendered properly.
9944
9854
  */
9945
9855
  _hasSchematicPort() {
9946
- const mappedInternalPort = getInternalCircuitPortMappedToChipPort(this);
9947
- if (mappedInternalPort) {
9948
- return mappedInternalPort._hasSchematicPort();
9949
- }
9950
9856
  const { schX, schY } = this._parsedProps;
9951
9857
  if (schX !== void 0 && schY !== void 0) {
9952
9858
  return true;
@@ -9970,10 +9876,6 @@ var Port = class extends PrimitiveComponent2 {
9970
9876
  return false;
9971
9877
  }
9972
9878
  _getGlobalSchematicPositionBeforeLayout() {
9973
- const mappedInternalPort = getInternalCircuitPortMappedToChipPort(this);
9974
- if (mappedInternalPort) {
9975
- return mappedInternalPort._getGlobalSchematicPositionBeforeLayout();
9976
- }
9977
9879
  const { schX, schY } = this._parsedProps;
9978
9880
  if (schX !== void 0 && schY !== void 0) {
9979
9881
  return { x: schX, y: schY };
@@ -10156,8 +10058,6 @@ var Port = class extends PrimitiveComponent2 {
10156
10058
  Port_tryRenderGroupPcbPort(this);
10157
10059
  return;
10158
10060
  }
10159
- const pcbMatches = matchedComponents.filter((c) => c.isPcbPrimitive);
10160
- if (pcbMatches.length === 0) return;
10161
10061
  const parentNormalComponent = this.getParentNormalComponent();
10162
10062
  const parentWithPcbComponentId = this.parent?.pcb_component_id ? this.parent : parentNormalComponent;
10163
10063
  if (!parentWithPcbComponentId?.pcb_component_id) {
@@ -10165,6 +10065,8 @@ var Port = class extends PrimitiveComponent2 {
10165
10065
  `${this.getString()} has no parent pcb component, cannot render pcb_port (parent: ${this.parent?.getString()}, parentNormalComponent: ${parentNormalComponent?.getString()})`
10166
10066
  );
10167
10067
  }
10068
+ const pcbMatches = matchedComponents.filter((c) => c.isPcbPrimitive);
10069
+ if (pcbMatches.length === 0) return;
10168
10070
  let matchCenter = null;
10169
10071
  if (pcbMatches.length === 1) {
10170
10072
  matchCenter = pcbMatches[0]._getPcbCircuitJsonBounds().center;
@@ -10280,21 +10182,16 @@ var Port = class extends PrimitiveComponent2 {
10280
10182
  if (collapsedAncestor && this.parent !== collapsedAncestor) return;
10281
10183
  const { db } = this.root;
10282
10184
  const { _parsedProps: props } = this;
10283
- const mappedInternalPort = getInternalCircuitPortMappedToChipPort(this);
10284
- const schematicPlacementPort = mappedInternalPort ?? this;
10285
- const schematicPlacementProps = schematicPlacementPort._parsedProps;
10286
- const { schX, schY } = schematicPlacementProps;
10287
- const container = schX !== void 0 && schY !== void 0 ? schematicPlacementPort.getParentNormalComponent() : schematicPlacementPort.getPrimitiveContainer();
10185
+ const { schX, schY } = props;
10186
+ const container = schX !== void 0 && schY !== void 0 ? this.getParentNormalComponent() : this.getPrimitiveContainer();
10288
10187
  if (!container) return;
10289
10188
  if (!this._hasSchematicPort()) return;
10290
10189
  const containerCenter = container._getGlobalSchematicPositionBeforeLayout();
10291
- const portCenter = schematicPlacementPort._getGlobalSchematicPositionBeforeLayout();
10190
+ const portCenter = this._getGlobalSchematicPositionBeforeLayout();
10292
10191
  let localPortInfo = null;
10293
10192
  const containerDims = container._getSchematicBoxDimensions();
10294
- if (containerDims && schematicPlacementProps.pinNumber !== void 0) {
10295
- localPortInfo = containerDims.getPortPositionByPinNumber(
10296
- schematicPlacementProps.pinNumber
10297
- );
10193
+ if (containerDims && props.pinNumber !== void 0) {
10194
+ localPortInfo = containerDims.getPortPositionByPinNumber(props.pinNumber);
10298
10195
  }
10299
10196
  if (this.getSubcircuit().props._schDebugObjectsEnabled) {
10300
10197
  db.schematic_debug_object.insert({
@@ -10307,11 +10204,11 @@ var Port = class extends PrimitiveComponent2 {
10307
10204
  label: "obstacle"
10308
10205
  });
10309
10206
  }
10310
- const isExplicitCustomSymbolPort = schX !== void 0 && schY !== void 0 && !!schematicPlacementPort._getSymbolAncestor();
10207
+ const isExplicitCustomSymbolPort = schX !== void 0 && schY !== void 0 && !!this._getSymbolAncestor();
10311
10208
  if (!localPortInfo?.side) {
10312
10209
  this.facingDirection = getRelativeDirection(containerCenter, portCenter);
10313
- if (isExplicitCustomSymbolPort && schematicPlacementProps.direction) {
10314
- this.facingDirection = schematicPlacementProps.direction;
10210
+ if (isExplicitCustomSymbolPort && props.direction) {
10211
+ this.facingDirection = props.direction;
10315
10212
  }
10316
10213
  } else {
10317
10214
  this.facingDirection = {
@@ -10322,24 +10219,20 @@ var Port = class extends PrimitiveComponent2 {
10322
10219
  }[localPortInfo.side];
10323
10220
  }
10324
10221
  const bestDisplayPinLabel = this._getBestDisplayPinLabel();
10325
- const parentNormalComponent = schematicPlacementPort.getParentNormalComponent();
10326
- const sideOfComponent = localPortInfo?.side ?? (schematicPlacementProps.direction === "up" ? "top" : schematicPlacementProps.direction === "down" ? "bottom" : schematicPlacementProps.direction);
10327
- const isInternalPort = isInternalCircuitPort(this);
10328
- const isMappedInternalPort = isInternalPort && isInternalCircuitPortMappedToChipPort(this);
10222
+ const parentNormalComponent = this.getParentNormalComponent();
10223
+ const sideOfComponent = localPortInfo?.side ?? (props.direction === "up" ? "top" : props.direction === "down" ? "bottom" : props.direction);
10329
10224
  const schematicPortInsertProps = {
10330
10225
  type: "schematic_port",
10331
10226
  schematic_component_id: parentNormalComponent?.schematic_component_id,
10332
10227
  center: portCenter,
10333
10228
  source_port_id: this.source_port_id,
10334
10229
  facing_direction: this.facingDirection,
10335
- distance_from_component_edge: schematicPlacementProps.schStemLength ?? 0.4,
10230
+ distance_from_component_edge: props.schStemLength ?? 0.4,
10336
10231
  side_of_component: sideOfComponent,
10337
10232
  pin_number: props.pinNumber,
10338
10233
  true_ccw_index: localPortInfo?.trueIndex,
10339
10234
  display_pin_label: bestDisplayPinLabel,
10340
- is_connected: mappedInternalPort !== null || isMappedInternalPort,
10341
- is_internal_circuit_port: isInternalPort ? true : void 0,
10342
- is_overlapping_internal_circuit_port: mappedInternalPort !== null ? true : void 0,
10235
+ is_connected: false,
10343
10236
  schematic_sheet_id: this._resolveSchematicSheetId()
10344
10237
  };
10345
10238
  for (const attributes of this._getMatchingPinAttributes()) {
@@ -10352,8 +10245,8 @@ var Port = class extends PrimitiveComponent2 {
10352
10245
  }
10353
10246
  const schematic_port = db.schematic_port.insert(schematicPortInsertProps);
10354
10247
  this.schematic_port_id = schematic_port.schematic_port_id;
10355
- if (!mappedInternalPort && schematicPlacementProps.schStemLength !== void 0 && schematicPlacementProps.schStemLength !== 0) {
10356
- const { schStemLength, direction } = schematicPlacementProps;
10248
+ if (props.schStemLength !== void 0 && props.schStemLength !== 0) {
10249
+ const { schStemLength, direction } = props;
10357
10250
  let x2 = portCenter.x;
10358
10251
  let y2 = portCenter.y;
10359
10252
  if (direction === "right") x2 -= schStemLength;
@@ -10377,9 +10270,7 @@ var Port = class extends PrimitiveComponent2 {
10377
10270
  doInitialSchematicSymbolResize() {
10378
10271
  if (this.root?.schematicDisabled) return;
10379
10272
  if (!this.schematic_port_id) return;
10380
- const mappedInternalPort = getInternalCircuitPortMappedToChipPort(this);
10381
- const schematicPlacementPort = mappedInternalPort ?? this;
10382
- const symbol = schematicPlacementPort._getSymbolAncestor();
10273
+ const symbol = this._getSymbolAncestor();
10383
10274
  const transform = symbol?.getUserCoordinateToResizedSymbolTransform();
10384
10275
  if (!transform) return;
10385
10276
  const { db } = this.root;
@@ -15472,19 +15363,6 @@ var Chip = class extends NormalComponent3 {
15472
15363
  if (props?.noSchematicRepresentation === true) return;
15473
15364
  super.doInitialSchematicComponentRender();
15474
15365
  }
15475
- _getSchematicBoxDimensions() {
15476
- if (this._parsedProps.schShowInternalCircuit && this._parsedProps.internalCircuit) {
15477
- return null;
15478
- }
15479
- return super._getSchematicBoxDimensions();
15480
- }
15481
- doInitialReactSubtreesRender() {
15482
- super.doInitialReactSubtreesRender();
15483
- const internalCircuit = this._parsedProps.internalCircuit;
15484
- if (this._parsedProps.schShowInternalCircuit && internalCircuit && !this.children.some((child) => child.componentName === "InternalCircuit")) {
15485
- this.add(internalCircuit);
15486
- }
15487
- }
15488
15366
  doInitialSourceRender() {
15489
15367
  const { db } = this.root;
15490
15368
  const { _parsedProps: props } = this;
@@ -20268,9 +20146,9 @@ function convertTreeToMatchPackInputProblem(tree, db, group, opts = {}) {
20268
20146
  const component = group.children.find(
20269
20147
  (groupChild) => groupChild.source_component_id === child.sourceComponent?.source_component_id
20270
20148
  );
20271
- const portsDefiningLayout = db.schematic_port.list({
20149
+ const ports = db.schematic_port.list({
20272
20150
  schematic_component_id: schematicComponent.schematic_component_id
20273
- }).filter((port) => !port.is_overlapping_internal_circuit_port);
20151
+ });
20274
20152
  let availableRotations = [
20275
20153
  ...DEFAULT_AVAILABLE_ROTATIONS
20276
20154
  ];
@@ -20290,10 +20168,7 @@ function convertTreeToMatchPackInputProblem(tree, db, group, opts = {}) {
20290
20168
  availableRotations = [0];
20291
20169
  }
20292
20170
  if (availableRotations.length === DEFAULT_AVAILABLE_ROTATIONS.length) {
20293
- const forcedRotation = getPowerGroundForcedRotation(
20294
- db,
20295
- portsDefiningLayout
20296
- );
20171
+ const forcedRotation = getPowerGroundForcedRotation(db, ports);
20297
20172
  if (forcedRotation !== null) availableRotations = [forcedRotation];
20298
20173
  }
20299
20174
  const ccwRotationDegrees = availableRotations.length === 1 ? availableRotations[0] : 0;
@@ -20316,7 +20191,7 @@ function convertTreeToMatchPackInputProblem(tree, db, group, opts = {}) {
20316
20191
  }
20317
20192
  }
20318
20193
  };
20319
- for (const port of portsDefiningLayout) {
20194
+ for (const port of ports) {
20320
20195
  const sourcePort = db.source_port.get(port.source_port_id);
20321
20196
  if (!sourcePort) continue;
20322
20197
  const pinId = `${chipId}.${sourcePort.pin_number || sourcePort.name || port.schematic_port_id}`;
@@ -20365,10 +20240,10 @@ function convertTreeToMatchPackInputProblem(tree, db, group, opts = {}) {
20365
20240
  );
20366
20241
  const groupPins = [];
20367
20242
  for (const comp of groupComponents) {
20368
- const portsDefiningLayout = db.schematic_port.list({
20243
+ const ports = db.schematic_port.list({
20369
20244
  schematic_component_id: comp.schematic_component_id
20370
- }).filter((port) => !port.is_overlapping_internal_circuit_port);
20371
- for (const port of portsDefiningLayout) {
20245
+ });
20246
+ for (const port of ports) {
20372
20247
  const sourcePort = db.source_port.get(port.source_port_id);
20373
20248
  if (!sourcePort) continue;
20374
20249
  const pinId = `${groupId}.${sourcePort.pin_number || sourcePort.name || port.schematic_port_id}`;
@@ -21284,9 +21159,8 @@ function createSchematicTraceSolverInputProblem(group, opts = {}) {
21284
21159
  });
21285
21160
  for (const schematicPort of schematicPorts) {
21286
21161
  const sourcePort = db.source_port.get(schematicPort.source_port_id);
21287
- const portSourceComponent = sourcePort?.source_component_id ? db.source_component.get(sourcePort.source_component_id) : void 0;
21288
21162
  const selector = getSchematicPortSelector({
21289
- componentName: portSourceComponent?.name ?? sourceComponent?.name ?? schematicComponent.schematic_component_id,
21163
+ componentName: sourceComponent?.name ?? schematicComponent.schematic_component_id,
21290
21164
  schematicPort,
21291
21165
  sourcePort
21292
21166
  });
@@ -21367,7 +21241,6 @@ function createSchematicTraceSolverInputProblem(group, opts = {}) {
21367
21241
  }
21368
21242
  const directConnections = [];
21369
21243
  const connectedPairKeys = /* @__PURE__ */ new Set();
21370
- const internalCircuitPortIdsRepresentedByChipPorts = /* @__PURE__ */ new Set();
21371
21244
  const connKeysWithExplicitPortNetTraces = /* @__PURE__ */ new Set();
21372
21245
  for (const sourceTrace of tracesInScope) {
21373
21246
  if (sourceTrace?.subcircuit_connectivity_map_key && (sourceTrace.connected_source_port_ids?.length ?? 0) > 0 && (sourceTrace.connected_source_net_ids?.length ?? 0) > 0) {
@@ -21395,16 +21268,6 @@ function createSchematicTraceSolverInputProblem(group, opts = {}) {
21395
21268
  }
21396
21269
  const portA = db.schematic_port.get(a);
21397
21270
  const portB = db.schematic_port.get(b);
21398
- const portAIsInternalAndPortBOverlaps = portA?.is_internal_circuit_port && portB?.is_overlapping_internal_circuit_port;
21399
- const portBIsInternalAndPortAOverlaps = portB?.is_internal_circuit_port && portA?.is_overlapping_internal_circuit_port;
21400
- const isInternalCircuitPortMapping = portAIsInternalAndPortBOverlaps || portBIsInternalAndPortAOverlaps;
21401
- if (portA && portB && isInternalCircuitPortMapping) {
21402
- const internalCircuitPort = portA.is_internal_circuit_port ? portA : portB;
21403
- internalCircuitPortIdsRepresentedByChipPorts.add(
21404
- internalCircuitPort.schematic_port_id
21405
- );
21406
- continue;
21407
- }
21408
21271
  let portDistance = 0;
21409
21272
  if (portA && portB) {
21410
21273
  portDistance = Math.sqrt(
@@ -21439,7 +21302,6 @@ function createSchematicTraceSolverInputProblem(group, opts = {}) {
21439
21302
  }
21440
21303
  const connKeyToPinIds = /* @__PURE__ */ new Map();
21441
21304
  for (const [schId, srcPortId] of schPortIdToSourcePortId) {
21442
- if (internalCircuitPortIdsRepresentedByChipPorts.has(schId)) continue;
21443
21305
  const sp = db.source_port.get(srcPortId);
21444
21306
  if (!sp?.subcircuit_connectivity_map_key) continue;
21445
21307
  const connKey = sp.subcircuit_connectivity_map_key;
@@ -23532,7 +23394,7 @@ function Group_getRoutingPhasePlans(group) {
23532
23394
  var package_default = {
23533
23395
  name: "@tscircuit/core",
23534
23396
  type: "module",
23535
- version: "0.0.1490",
23397
+ version: "0.0.1492",
23536
23398
  types: "dist/index.d.ts",
23537
23399
  main: "dist/index.js",
23538
23400
  module: "dist/index.js",
@@ -26056,6 +25918,7 @@ var Inductor = class extends NormalComponent3 {
26056
25918
  inductance: this.props.inductance,
26057
25919
  display_inductance: this._getSchematicSymbolDisplayValue(),
26058
25920
  supplier_part_numbers: props.supplierPartNumbers,
25921
+ manufacturer_part_number: props.manufacturerPartNumber ?? props.mfn,
26059
25922
  are_pins_interchangeable: true,
26060
25923
  display_name: props.displayName
26061
25924
  });
@@ -26308,6 +26171,7 @@ var PushButton = class extends NormalComponent3 {
26308
26171
  name: this.name,
26309
26172
  ftype: FTYPE.simple_push_button,
26310
26173
  supplier_part_numbers: props.supplierPartNumbers,
26174
+ manufacturer_part_number: props.manufacturerPartNumber ?? props.mfn,
26311
26175
  are_pins_interchangeable: true,
26312
26176
  display_name: props.displayName
26313
26177
  });
@@ -29631,6 +29495,7 @@ var PowerSource = class extends NormalComponent3 {
29631
29495
  name: this.name,
29632
29496
  voltage: props.voltage,
29633
29497
  supplier_part_numbers: props.supplierPartNumbers,
29498
+ manufacturer_part_number: props.manufacturerPartNumber ?? props.mfn,
29634
29499
  are_pins_interchangeable: false,
29635
29500
  display_name: props.displayName
29636
29501
  });
@@ -29711,6 +29576,7 @@ var VoltageSource = class extends NormalComponent3 {
29711
29576
  pulse_width: props.pulseWidth,
29712
29577
  period: props.period,
29713
29578
  supplier_part_numbers: props.supplierPartNumbers,
29579
+ manufacturer_part_number: props.manufacturerPartNumber ?? props.mfn,
29714
29580
  are_pins_interchangeable: true,
29715
29581
  display_name: props.displayName
29716
29582
  });
@@ -29810,6 +29676,7 @@ var CurrentSource = class extends NormalComponent3 {
29810
29676
  phase: props.phase,
29811
29677
  duty_cycle: props.dutyCycle,
29812
29678
  supplier_part_numbers: props.supplierPartNumbers,
29679
+ manufacturer_part_number: props.manufacturerPartNumber ?? props.mfn,
29813
29680
  are_pins_interchangeable: true,
29814
29681
  display_name: props.displayName
29815
29682
  });
@@ -30052,6 +29919,7 @@ var Ammeter = class extends NormalComponent3 {
30052
29919
  ftype: "simple_ammeter",
30053
29920
  name: this.name,
30054
29921
  supplier_part_numbers: supplierPartNumbers,
29922
+ manufacturer_part_number: this._parsedProps.manufacturerPartNumber ?? this._parsedProps.mfn,
30055
29923
  display_name: displayName
30056
29924
  });
30057
29925
  this.source_component_id = source_component.source_component_id;
@@ -30161,17 +30029,6 @@ var Constraint3 = class extends PrimitiveComponent2 {
30161
30029
  }
30162
30030
  };
30163
30031
 
30164
- // lib/components/primitive-components/InternalCircuit.ts
30165
- import { internalCircuitProps } from "@tscircuit/props";
30166
- var InternalCircuit = class extends PrimitiveComponent2 {
30167
- get config() {
30168
- return {
30169
- componentName: "InternalCircuit",
30170
- zodProps: internalCircuitProps
30171
- };
30172
- }
30173
- };
30174
-
30175
30032
  // lib/components/primitive-components/AutoroutingPhase.ts
30176
30033
  import { autoroutingPhaseProps } from "@tscircuit/props";
30177
30034
  var AutoroutingPhase = class extends PrimitiveComponent2 {
@@ -32531,6 +32388,7 @@ var Battery = class extends NormalComponent3 {
32531
32388
  ftype: "simple_power_source",
32532
32389
  capacity: props.capacity,
32533
32390
  supplier_part_numbers: props.supplierPartNumbers,
32391
+ manufacturer_part_number: props.manufacturerPartNumber ?? props.mfn,
32534
32392
  are_pins_interchangeable: false,
32535
32393
  display_name: props.displayName
32536
32394
  });
@@ -33194,6 +33052,7 @@ var PinHeader = class extends NormalComponent3 {
33194
33052
  ftype: "simple_pin_header",
33195
33053
  name: this.name,
33196
33054
  supplier_part_numbers: props.supplierPartNumbers,
33055
+ manufacturer_part_number: props.manufacturerPartNumber ?? props.mfn,
33197
33056
  pin_count: props.pinCount,
33198
33057
  gender: props.gender,
33199
33058
  are_pins_interchangeable: true,
@@ -33234,6 +33093,7 @@ var Resonator = class extends NormalComponent3 {
33234
33093
  const source_component = db.source_component.insert({
33235
33094
  ftype: "simple_resonator",
33236
33095
  name: this.name,
33096
+ manufacturer_part_number: props.manufacturerPartNumber ?? props.mfn,
33237
33097
  frequency: props.frequency,
33238
33098
  load_capacitance: props.loadCapacitance,
33239
33099
  supplier_part_numbers: props.supplierPartNumbers,
@@ -33434,22 +33294,6 @@ var Mosfet = class extends NormalComponent3 {
33434
33294
  }
33435
33295
  };
33436
33296
 
33437
- // lib/components/normal-components/InternalCircuitMosfet.ts
33438
- import { isValidElement as isValidElement3 } from "react";
33439
- var InternalCircuitMosfet = class extends Mosfet {
33440
- resolveFootprint() {
33441
- return void 0;
33442
- }
33443
- doInitialPcbComponentRender() {
33444
- }
33445
- doInitialReactSubtreesRender() {
33446
- const symbol = this.props.symbol;
33447
- if (isValidElement3(symbol) && !this.children.some((child) => child.componentName === "Symbol")) {
33448
- this.add(symbol);
33449
- }
33450
- }
33451
- };
33452
-
33453
33297
  // lib/components/normal-components/OpAmp.ts
33454
33298
  import { opampProps } from "@tscircuit/props";
33455
33299
  var OpAmp = class extends NormalComponent3 {
@@ -33502,6 +33346,7 @@ var OpAmp = class extends NormalComponent3 {
33502
33346
  ftype: "simple_op_amp",
33503
33347
  name: this.name,
33504
33348
  supplier_part_numbers: props.supplierPartNumbers,
33349
+ manufacturer_part_number: props.manufacturerPartNumber ?? props.mfn,
33505
33350
  display_name: props.displayName
33506
33351
  });
33507
33352
  this.source_component_id = source_component.source_component_id;
@@ -33621,6 +33466,7 @@ var TestPoint = class extends NormalComponent3 {
33621
33466
  ftype: FTYPE.simple_test_point,
33622
33467
  name: this.name,
33623
33468
  supplier_part_numbers: props.supplierPartNumbers,
33469
+ manufacturer_part_number: props.manufacturerPartNumber ?? props.mfn,
33624
33470
  footprint_variant: footprintVariant,
33625
33471
  pad_shape: padShape,
33626
33472
  pad_diameter: padDiameter,
@@ -34693,9 +34539,6 @@ extendCatalogue({
34693
34539
  Fanout: Breakout,
34694
34540
  FanoutPoint: BreakoutPoint
34695
34541
  });
34696
- extendInternalCircuitCatalogue({
34697
- Mosfet: InternalCircuitMosfet
34698
- });
34699
34542
  export {
34700
34543
  Ammeter,
34701
34544
  AnalogSimulation,
@@ -34737,8 +34580,6 @@ export {
34737
34580
  Hole,
34738
34581
  Inductor,
34739
34582
  Interconnect,
34740
- InternalCircuit,
34741
- InternalCircuitMosfet,
34742
34583
  IsolatedCircuit,
34743
34584
  Jumper,
34744
34585
  Keepout,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1491",
4
+ "version": "0.0.1493",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",