@tscircuit/core 0.0.1128 → 0.0.1130

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
@@ -176,9 +176,9 @@ interface IIsolatedCircuit {
176
176
  interface IRootCircuit extends IIsolatedCircuit {
177
177
  }
178
178
 
179
- declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "RenderIsolatedSubcircuits", "InflateSubcircuitCircuitJson", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SymbolContainerRender", "SchematicPrimitiveRender", "SchematicSymbolResize", "SchematicComponentSizeCalculation", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PanelBoardLayout", "ValidatePcbCoordinates", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbCalcPlacementResolution", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "SimulationSpiceEngineRender"];
179
+ declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "RenderIsolatedSubcircuits", "InflateSubcircuitCircuitJson", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "FetchPartFootprint", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SymbolContainerRender", "SchematicPrimitiveRender", "SchematicSymbolResize", "SchematicComponentSizeCalculation", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PanelBoardLayout", "ValidatePcbCoordinates", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbCalcPlacementResolution", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "SimulationSpiceEngineRender"];
180
180
  type RenderPhase = (typeof orderedRenderPhases)[number];
181
- declare const renderPhaseIndexMap: Map<"ReactSubtreesRender" | "RenderIsolatedSubcircuits" | "InflateSubcircuitCircuitJson" | "SourceNameDuplicateComponentRemoval" | "PcbFootprintStringRender" | "InitializePortsFromChildren" | "CreateNetsFromProps" | "AssignFallbackProps" | "CreateTracesFromProps" | "CreateTracesFromNetLabels" | "CreateTraceHintsFromProps" | "SourceGroupRender" | "AssignNameToUnnamedComponents" | "SourceRender" | "SourceParentAttachment" | "PortMatching" | "OptimizeSelectorCache" | "SourceTraceRender" | "SourceAddConnectivityMapKey" | "SourceDesignRuleChecks" | "SimulationRender" | "SchematicComponentRender" | "SchematicPortRender" | "SymbolContainerRender" | "SchematicPrimitiveRender" | "SchematicSymbolResize" | "SchematicComponentSizeCalculation" | "SchematicLayout" | "SchematicTraceRender" | "SchematicReplaceNetLabelsWithSymbols" | "PanelBoardLayout" | "ValidatePcbCoordinates" | "PcbComponentRender" | "PcbPrimitiveRender" | "PcbFootprintLayout" | "PcbPortRender" | "PcbPortAttachment" | "PcbComponentSizeCalculation" | "PcbComponentAnchorAlignment" | "PcbCalcPlacementResolution" | "PcbLayout" | "PcbBoardAutoSize" | "PanelLayout" | "PcbTraceHintRender" | "PcbManualTraceRender" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbCopperPourRender" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "SimulationSpiceEngineRender", number>;
181
+ declare const renderPhaseIndexMap: Map<"ReactSubtreesRender" | "RenderIsolatedSubcircuits" | "InflateSubcircuitCircuitJson" | "SourceNameDuplicateComponentRemoval" | "PcbFootprintStringRender" | "FetchPartFootprint" | "InitializePortsFromChildren" | "CreateNetsFromProps" | "AssignFallbackProps" | "CreateTracesFromProps" | "CreateTracesFromNetLabels" | "CreateTraceHintsFromProps" | "SourceGroupRender" | "AssignNameToUnnamedComponents" | "SourceRender" | "SourceParentAttachment" | "PortMatching" | "OptimizeSelectorCache" | "SourceTraceRender" | "SourceAddConnectivityMapKey" | "SourceDesignRuleChecks" | "SimulationRender" | "SchematicComponentRender" | "SchematicPortRender" | "SymbolContainerRender" | "SchematicPrimitiveRender" | "SchematicSymbolResize" | "SchematicComponentSizeCalculation" | "SchematicLayout" | "SchematicTraceRender" | "SchematicReplaceNetLabelsWithSymbols" | "PanelBoardLayout" | "ValidatePcbCoordinates" | "PcbComponentRender" | "PcbPrimitiveRender" | "PcbFootprintLayout" | "PcbPortRender" | "PcbPortAttachment" | "PcbComponentSizeCalculation" | "PcbComponentAnchorAlignment" | "PcbCalcPlacementResolution" | "PcbLayout" | "PcbBoardAutoSize" | "PanelLayout" | "PcbTraceHintRender" | "PcbManualTraceRender" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbCopperPourRender" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "SimulationSpiceEngineRender", number>;
182
182
  type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
183
183
  type RenderPhaseStates = Record<RenderPhase, {
184
184
  initialized: boolean;
@@ -1651,6 +1651,7 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
1651
1651
  updatePcbComponentAnchorAlignment(): void;
1652
1652
  _renderReactSubtree(element: ReactElement): ReactSubtree;
1653
1653
  doInitialInitializePortsFromChildren(): void;
1654
+ updateInitializePortsFromChildren(): void;
1654
1655
  doInitialReactSubtreesRender(): void;
1655
1656
  doInitialPcbFootprintStringRender(): void;
1656
1657
  /**
@@ -1704,7 +1705,7 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
1704
1705
  doInitialCadModelRender(): void;
1705
1706
  private _addCachebustToModelUrl;
1706
1707
  private _getPartsEngineCacheKey;
1707
- private _getSupplierPartNumbers;
1708
+ protected _getSupplierPartNumbers(partsEngine: any, source_component: any, footprinterString: string | undefined): Promise<any>;
1708
1709
  doInitialPartsEngineRender(): void;
1709
1710
  updatePartsEngineRender(): void;
1710
1711
  doInitialAssignFallbackProps(): void;
@@ -88086,6 +88087,14 @@ declare class Battery extends NormalComponent<typeof batteryProps, PassivePorts>
88086
88087
  }
88087
88088
 
88088
88089
  declare class Connector<PinLabels extends string = never> extends Chip<PinLabels> {
88090
+ private _getConnectorProps;
88091
+ private _hasExplicitFootprint;
88092
+ private _shouldUseStandardPartsEngineCircuitJsonFlow;
88093
+ private _insertStandardConnectorCircuitJsonError;
88094
+ private _getSupplierPartNumbersToTry;
88095
+ private _tryFetchPartCircuitJson;
88096
+ private _fetchStandardConnectorCircuitJson;
88097
+ private _addConnectorFootprintFromCircuitJson;
88089
88098
  get config(): {
88090
88099
  componentName: string;
88091
88100
  zodProps: zod.ZodObject<{
@@ -91740,6 +91749,8 @@ declare class Connector<PinLabels extends string = never> extends Chip<PinLabels
91740
91749
  schHeight: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
91741
91750
  noSchematicRepresentation: zod.ZodOptional<zod.ZodBoolean>;
91742
91751
  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">]>>>>;
91752
+ } & {
91753
+ standard: zod.ZodOptional<zod.ZodEnum<["usb_c", "m2"]>>;
91743
91754
  }, "strip", zod.ZodTypeAny, {
91744
91755
  name: string;
91745
91756
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -92392,6 +92403,7 @@ declare class Connector<PinLabels extends string = never> extends Chip<PinLabels
92392
92403
  supplierPartNumber?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
92393
92404
  }[] | undefined;
92394
92405
  noSchematicRepresentation?: boolean | undefined;
92406
+ standard?: "usb_c" | "m2" | undefined;
92395
92407
  }, {
92396
92408
  name: string;
92397
92409
  symbol?: _tscircuit_props.SymbolProp | undefined;
@@ -93046,10 +93058,15 @@ declare class Connector<PinLabels extends string = never> extends Chip<PinLabels
93046
93058
  supplierPartNumber?: Partial<Record<"jlcpcb" | "macrofab" | "pcbway" | "digikey" | "mouser" | "lcsc", string[]>> | undefined;
93047
93059
  }[] | undefined;
93048
93060
  noSchematicRepresentation?: boolean | undefined;
93061
+ standard?: "usb_c" | "m2" | undefined;
93049
93062
  }>;
93050
93063
  shouldRenderAsSchematicBox: boolean;
93051
93064
  };
93052
93065
  doInitialSourceRender(): void;
93066
+ private _isUsingStandardPartsEngineCircuitJsonFlow;
93067
+ doInitialFetchPartFootprint(): void;
93068
+ doInitialPartsEngineRender(): void;
93069
+ updatePartsEngineRender(): void;
93053
93070
  doInitialPcbComponentSizeCalculation(): void;
93054
93071
  }
93055
93072
 
@@ -151827,7 +151844,7 @@ type PolarizedSel = Record<`C${Nums40}` | `L${Nums40}` | `LED${Nums40}` | `D${Nu
151827
151844
  pos: string;
151828
151845
  neg: string;
151829
151846
  }>;
151830
- type CommonNetNames = "VCC" | "GND" | "VDD" | "PWR" | "V5" | "V3_3" | "VIN" | "SHLD" | "EN" | "SCL" | "SDA" | "MOSI" | "MISO" | "SCK" | "CS" | "N_CS" | "FLASH_SDO" | "FLASH_SDI" | "FLASH_SCK" | "FLASH_N_CS" | "FLASH_N_WP" | "FLASH_N_HOLD" | "INT" | "N_INT";
151847
+ type CommonNetNames = "VCC" | "GND" | "VDD" | "PWR" | "V5" | "V3_3" | "VIN" | "SHLD" | "EN" | "SCL" | "SDA" | "MOSI" | "MISO" | "SCK" | "CS" | "N_CS" | "FLASH_SDO" | "FLASH_SDI" | "FLASH_SCK" | "FLASH_N_CS" | "FLASH_N_WP" | "FLASH_N_HOLD" | "INT" | "N_INT" | "VBUS" | "SWCLK" | "USB_DM" | "USB_DP" | "QSPI_SS" | "XIN" | "XOUT" | "RUN" | "SWD" | `GPIO${Nums40}`;
151831
151848
  type TransistorSel = Record<`Q${Nums40}`, Record<TransistorPinNames, string>>;
151832
151849
  type JumperSel = Record<`J${Nums40}` | `JP${Nums40}` | `CN${Nums40}`, Record<PinNumbers100 | CommonPinNames, string> & ChipFnSel>;
151833
151850
  type ChipSel = Record<`U${Nums40}` | "USBC", Record<CommonPinNames | PinNumbers100, string> & ChipFnSel>;
@@ -151981,7 +151998,7 @@ interface TscircuitElements {
151981
151998
  constraint: _tscircuit_props.ConstraintProps;
151982
151999
  constrainedlayout: _tscircuit_props.ConstrainedLayoutProps;
151983
152000
  battery: _tscircuit_props.BatteryProps;
151984
- connector: _tscircuit_props.ChipProps;
152001
+ connector: _tscircuit_props.ConnectorProps;
151985
152002
  pinheader: _tscircuit_props.PinHeaderProps;
151986
152003
  resonator: _tscircuit_props.ResonatorProps;
151987
152004
  subcircuit: _tscircuit_props.SubcircuitGroupProps;
package/dist/index.js CHANGED
@@ -301,6 +301,7 @@ var orderedRenderPhases = [
301
301
  "InflateSubcircuitCircuitJson",
302
302
  "SourceNameDuplicateComponentRemoval",
303
303
  "PcbFootprintStringRender",
304
+ "FetchPartFootprint",
304
305
  "InitializePortsFromChildren",
305
306
  "CreateNetsFromProps",
306
307
  "AssignFallbackProps",
@@ -355,27 +356,40 @@ var renderPhaseIndexMap = new Map(
355
356
  );
356
357
  var asyncPhaseDependencies = {
357
358
  InflateSubcircuitCircuitJson: ["RenderIsolatedSubcircuits"],
358
- PcbFootprintLayout: ["PcbFootprintStringRender"],
359
- PcbComponentSizeCalculation: ["PcbFootprintStringRender"],
360
- PcbLayout: ["PcbFootprintStringRender"],
361
- PcbBoardAutoSize: ["PcbFootprintStringRender"],
362
- PcbTraceHintRender: ["PcbFootprintStringRender"],
363
- PcbManualTraceRender: ["PcbFootprintStringRender"],
359
+ PcbFootprintLayout: ["PcbFootprintStringRender", "FetchPartFootprint"],
360
+ PcbComponentSizeCalculation: [
361
+ "PcbFootprintStringRender",
362
+ "FetchPartFootprint"
363
+ ],
364
+ PcbLayout: ["PcbFootprintStringRender", "FetchPartFootprint"],
365
+ PcbBoardAutoSize: ["PcbFootprintStringRender", "FetchPartFootprint"],
366
+ PcbTraceHintRender: ["PcbFootprintStringRender", "FetchPartFootprint"],
367
+ PcbManualTraceRender: ["PcbFootprintStringRender", "FetchPartFootprint"],
364
368
  PcbCopperPourRender: [
365
369
  "PcbFootprintStringRender",
370
+ "FetchPartFootprint",
366
371
  "PcbTraceRender",
367
372
  "PcbRouteNetIslands"
368
373
  ],
369
- PcbTraceRender: ["PcbFootprintStringRender"],
370
- PcbRouteNetIslands: ["PcbFootprintStringRender"],
371
- PcbDesignRuleChecks: ["PcbFootprintStringRender"],
372
- SilkscreenOverlapAdjustment: ["PcbFootprintStringRender"],
373
- CadModelRender: ["PcbFootprintStringRender"],
374
- PartsEngineRender: ["PcbFootprintStringRender"],
375
- PcbComponentAnchorAlignment: ["PcbFootprintStringRender"],
376
- PcbCalcPlacementResolution: ["PcbFootprintStringRender"],
377
- ValidatePcbCoordinates: ["PcbFootprintStringRender"],
378
- SourceTraceRender: ["PcbFootprintStringRender"]
374
+ PcbTraceRender: ["PcbFootprintStringRender", "FetchPartFootprint"],
375
+ PcbRouteNetIslands: ["PcbFootprintStringRender", "FetchPartFootprint"],
376
+ PcbDesignRuleChecks: ["PcbFootprintStringRender", "FetchPartFootprint"],
377
+ SilkscreenOverlapAdjustment: [
378
+ "PcbFootprintStringRender",
379
+ "FetchPartFootprint"
380
+ ],
381
+ CadModelRender: ["PcbFootprintStringRender", "FetchPartFootprint"],
382
+ PartsEngineRender: ["PcbFootprintStringRender", "FetchPartFootprint"],
383
+ PcbComponentAnchorAlignment: [
384
+ "PcbFootprintStringRender",
385
+ "FetchPartFootprint"
386
+ ],
387
+ PcbCalcPlacementResolution: [
388
+ "PcbFootprintStringRender",
389
+ "FetchPartFootprint"
390
+ ],
391
+ ValidatePcbCoordinates: ["PcbFootprintStringRender", "FetchPartFootprint"],
392
+ SourceTraceRender: ["PcbFootprintStringRender", "FetchPartFootprint"]
379
393
  };
380
394
  var globalRenderCounter = 0;
381
395
  var globalAsyncEffectCounter = 0;
@@ -647,6 +661,9 @@ var InvalidProps = class extends Error {
647
661
  this.originalProps = originalProps;
648
662
  this.formattedError = formattedError;
649
663
  }
664
+ componentName;
665
+ originalProps;
666
+ formattedError;
650
667
  };
651
668
 
652
669
  // lib/utils/evaluateCalcString.ts
@@ -3465,6 +3482,7 @@ var TraceConnectionError = class extends Error {
3465
3482
  this.errorData = errorData;
3466
3483
  this.name = "TraceConnectionError";
3467
3484
  }
3485
+ errorData;
3468
3486
  };
3469
3487
 
3470
3488
  // lib/components/primitive-components/Trace/Trace_doInitialSchematicTraceRender.ts
@@ -10981,6 +10999,9 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
10981
10999
  doInitialInitializePortsFromChildren() {
10982
11000
  this.initPorts();
10983
11001
  }
11002
+ updateInitializePortsFromChildren() {
11003
+ this.initPorts();
11004
+ }
10984
11005
  doInitialReactSubtreesRender() {
10985
11006
  const fpElm = this.props.footprint;
10986
11007
  if (isValidElement(fpElm)) {
@@ -18726,7 +18747,7 @@ var package_default = {
18726
18747
  "@tscircuit/math-utils": "^0.0.36",
18727
18748
  "@tscircuit/miniflex": "^0.0.4",
18728
18749
  "@tscircuit/ngspice-spice-engine": "^0.0.8",
18729
- "@tscircuit/props": "^0.0.499",
18750
+ "@tscircuit/props": "^0.0.501",
18730
18751
  "@tscircuit/schematic-match-adapt": "^0.0.16",
18731
18752
  "@tscircuit/schematic-trace-solver": "^v0.0.45",
18732
18753
  "@tscircuit/solver-utils": "^0.0.3",
@@ -22472,28 +22493,162 @@ var Battery = class extends NormalComponent3 {
22472
22493
 
22473
22494
  // lib/components/normal-components/Connector.ts
22474
22495
  import { guessCableInsertCenter } from "@tscircuit/infer-cable-insertion-point";
22475
- import { chipProps as chipProps3 } from "@tscircuit/props";
22496
+ import {
22497
+ connectorProps
22498
+ } from "@tscircuit/props";
22499
+ import { unknown_error_finding_part as unknown_error_finding_part2 } from "circuit-json";
22476
22500
  var Connector = class extends Chip {
22501
+ _getConnectorProps() {
22502
+ return this._parsedProps;
22503
+ }
22504
+ _hasExplicitFootprint() {
22505
+ const props = this._getConnectorProps();
22506
+ return props.footprint !== void 0 || this.children.some((child) => child.componentName === "Footprint");
22507
+ }
22508
+ _shouldUseStandardPartsEngineCircuitJsonFlow() {
22509
+ const props = this._getConnectorProps();
22510
+ if (!props.standard) return false;
22511
+ if (this._hasExplicitFootprint()) return false;
22512
+ if (this.getInheritedProperty("partsEngineDisabled")) return false;
22513
+ return true;
22514
+ }
22515
+ _insertStandardConnectorCircuitJsonError(standard, message) {
22516
+ const { db } = this.root;
22517
+ const errorObj = unknown_error_finding_part2.parse({
22518
+ type: "unknown_error_finding_part",
22519
+ message: `Failed to fetch circuit JSON for ${this.getString()} (standard="${standard}"): ${message}`,
22520
+ source_component_id: this.source_component_id ?? void 0,
22521
+ subcircuit_id: this.getSubcircuit()?.subcircuit_id ?? void 0
22522
+ });
22523
+ db.unknown_error_finding_part.insert(errorObj);
22524
+ }
22525
+ _getSupplierPartNumbersToTry(supplierPartNumbers) {
22526
+ const partNumbers = [];
22527
+ for (const supplier of Object.keys(supplierPartNumbers ?? {})) {
22528
+ const nums = supplierPartNumbers?.[supplier];
22529
+ if (Array.isArray(nums) && nums.length > 0) {
22530
+ partNumbers.push(nums[0]);
22531
+ }
22532
+ }
22533
+ return partNumbers;
22534
+ }
22535
+ async _tryFetchPartCircuitJson(fetchPartCircuitJson, params) {
22536
+ const maybeCircuitJson = await Promise.resolve(fetchPartCircuitJson(params)) ?? null;
22537
+ if (Array.isArray(maybeCircuitJson) && maybeCircuitJson.length > 0) {
22538
+ return maybeCircuitJson;
22539
+ }
22540
+ return null;
22541
+ }
22542
+ async _fetchStandardConnectorCircuitJson(fetchPartCircuitJson, supplierPartNumbers, manufacturerPartNumber) {
22543
+ for (const supplierPartNumber of this._getSupplierPartNumbersToTry(
22544
+ supplierPartNumbers
22545
+ )) {
22546
+ const circuitJson = await this._tryFetchPartCircuitJson(
22547
+ fetchPartCircuitJson,
22548
+ { supplierPartNumber }
22549
+ );
22550
+ if (circuitJson) return circuitJson;
22551
+ }
22552
+ if (!manufacturerPartNumber) return null;
22553
+ return this._tryFetchPartCircuitJson(fetchPartCircuitJson, {
22554
+ manufacturerPartNumber
22555
+ });
22556
+ }
22557
+ _addConnectorFootprintFromCircuitJson(standard, circuitJson) {
22558
+ const props = this._getConnectorProps();
22559
+ const fpComponents = createComponentsFromCircuitJson(
22560
+ {
22561
+ componentName: this.name,
22562
+ componentRotation: String(props.pcbRotation ?? 0),
22563
+ footprinterString: `standard:${standard}`,
22564
+ pinLabels: props.pinLabels,
22565
+ pcbPinLabels: props.pcbPinLabels
22566
+ },
22567
+ circuitJson
22568
+ );
22569
+ this.addAll(fpComponents);
22570
+ }
22477
22571
  get config() {
22478
22572
  return {
22479
22573
  componentName: "Connector",
22480
- zodProps: chipProps3,
22574
+ zodProps: connectorProps,
22481
22575
  shouldRenderAsSchematicBox: true
22482
22576
  };
22483
22577
  }
22484
22578
  doInitialSourceRender() {
22485
22579
  const { db } = this.root;
22486
- const { _parsedProps: props } = this;
22580
+ const props = this._getConnectorProps();
22487
22581
  const source_component = db.source_component.insert({
22488
22582
  ftype: "simple_connector",
22489
22583
  name: this.name,
22490
- manufacturer_part_number: props.manufacturerPartNumber,
22584
+ manufacturer_part_number: props.manufacturerPartNumber ?? props.mfn,
22491
22585
  supplier_part_numbers: props.supplierPartNumbers,
22492
22586
  display_name: props.displayName,
22493
22587
  standard: props.standard
22494
22588
  });
22495
22589
  this.source_component_id = source_component.source_component_id;
22496
22590
  }
22591
+ _isUsingStandardPartsEngineCircuitJsonFlow() {
22592
+ if (!this._shouldUseStandardPartsEngineCircuitJsonFlow()) return false;
22593
+ const partsEngine = this.getInheritedProperty("partsEngine");
22594
+ return Boolean(partsEngine?.fetchPartCircuitJson);
22595
+ }
22596
+ doInitialFetchPartFootprint() {
22597
+ const props = this._getConnectorProps();
22598
+ const standard = props.standard;
22599
+ if (!standard) return;
22600
+ if (!this._shouldUseStandardPartsEngineCircuitJsonFlow()) return;
22601
+ if (this._hasStartedFootprintUrlLoad) return;
22602
+ const partsEngine = this.getInheritedProperty("partsEngine");
22603
+ if (partsEngine && !partsEngine.fetchPartCircuitJson) {
22604
+ this._insertStandardConnectorCircuitJsonError(
22605
+ standard,
22606
+ "partsEngine.fetchPartCircuitJson is not configured"
22607
+ );
22608
+ return;
22609
+ }
22610
+ const fetchPartCircuitJson = partsEngine?.fetchPartCircuitJson;
22611
+ if (!fetchPartCircuitJson) return;
22612
+ this._hasStartedFootprintUrlLoad = true;
22613
+ const sourceComponentForQuery = {
22614
+ ftype: "simple_connector",
22615
+ name: this.name,
22616
+ manufacturer_part_number: props.manufacturerPartNumber ?? props.mfn,
22617
+ standard
22618
+ };
22619
+ this._queueAsyncEffect("load-standard-connector-circuit-json", async () => {
22620
+ const { db } = this.root;
22621
+ try {
22622
+ const supplierPartNumbers = await this._getSupplierPartNumbers(
22623
+ partsEngine,
22624
+ sourceComponentForQuery,
22625
+ `standard:${standard}`
22626
+ );
22627
+ if (this.source_component_id) {
22628
+ db.source_component.update(this.source_component_id, {
22629
+ supplier_part_numbers: supplierPartNumbers
22630
+ });
22631
+ }
22632
+ const circuitJson = await this._fetchStandardConnectorCircuitJson(
22633
+ fetchPartCircuitJson,
22634
+ supplierPartNumbers,
22635
+ sourceComponentForQuery.manufacturer_part_number
22636
+ );
22637
+ if (!circuitJson) return;
22638
+ this._addConnectorFootprintFromCircuitJson(standard, circuitJson);
22639
+ } catch (error) {
22640
+ this._insertStandardConnectorCircuitJsonError(standard, error.message);
22641
+ }
22642
+ });
22643
+ }
22644
+ doInitialPartsEngineRender() {
22645
+ if (this._isUsingStandardPartsEngineCircuitJsonFlow()) return;
22646
+ super.doInitialPartsEngineRender();
22647
+ }
22648
+ updatePartsEngineRender() {
22649
+ if (this._isUsingStandardPartsEngineCircuitJsonFlow()) return;
22650
+ super.updatePartsEngineRender();
22651
+ }
22497
22652
  doInitialPcbComponentSizeCalculation() {
22498
22653
  super.doInitialPcbComponentSizeCalculation();
22499
22654
  if (this.root?.pcbDisabled) return;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1128",
4
+ "version": "0.0.1130",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -46,7 +46,7 @@
46
46
  "@tscircuit/math-utils": "^0.0.36",
47
47
  "@tscircuit/miniflex": "^0.0.4",
48
48
  "@tscircuit/ngspice-spice-engine": "^0.0.8",
49
- "@tscircuit/props": "^0.0.499",
49
+ "@tscircuit/props": "^0.0.501",
50
50
  "@tscircuit/schematic-match-adapt": "^0.0.16",
51
51
  "@tscircuit/schematic-trace-solver": "^v0.0.45",
52
52
  "@tscircuit/solver-utils": "^0.0.3",