@tscircuit/core 0.0.1038 → 0.0.1039

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
@@ -172,9 +172,9 @@ interface IIsolatedCircuit {
172
172
  interface IRootCircuit extends IIsolatedCircuit {
173
173
  }
174
174
 
175
- declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "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", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbCalcPlacementResolution", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "SimulationSpiceEngineRender"];
175
+ 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", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbCalcPlacementResolution", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "SimulationSpiceEngineRender"];
176
176
  type RenderPhase = (typeof orderedRenderPhases)[number];
177
- declare const renderPhaseIndexMap: Map<"ReactSubtreesRender" | "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" | "PcbComponentRender" | "PcbPrimitiveRender" | "PcbFootprintLayout" | "PcbPortRender" | "PcbPortAttachment" | "PcbComponentSizeCalculation" | "PcbComponentAnchorAlignment" | "PcbCalcPlacementResolution" | "PcbLayout" | "PcbBoardAutoSize" | "PanelLayout" | "PcbTraceHintRender" | "PcbManualTraceRender" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbCopperPourRender" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "SimulationSpiceEngineRender", number>;
177
+ 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" | "PcbComponentRender" | "PcbPrimitiveRender" | "PcbFootprintLayout" | "PcbPortRender" | "PcbPortAttachment" | "PcbComponentSizeCalculation" | "PcbComponentAnchorAlignment" | "PcbCalcPlacementResolution" | "PcbLayout" | "PcbBoardAutoSize" | "PanelLayout" | "PcbTraceHintRender" | "PcbManualTraceRender" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbCopperPourRender" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "SimulationSpiceEngineRender", number>;
178
178
  type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
179
179
  type RenderPhaseStates = Record<RenderPhase, {
180
180
  initialized: boolean;
@@ -290,6 +290,12 @@ declare class IsolatedCircuit {
290
290
  db: CircuitJsonUtilObjects;
291
291
  root: IsolatedCircuit | null;
292
292
  isRootCircuit: boolean;
293
+ /**
294
+ * Optional cache for isolated subcircuit circuit JSON, keyed by prop hash.
295
+ * This is passed down from the RootCircuit when creating isolated circuits
296
+ * for subcircuit rendering.
297
+ */
298
+ cachedSubcircuits?: Map<string, AnyCircuitElement[]>;
293
299
  private _schematicDisabledOverride;
294
300
  get schematicDisabled(): boolean;
295
301
  set schematicDisabled(value: boolean);
@@ -312,9 +318,10 @@ declare class IsolatedCircuit {
312
318
  _hasRenderedAtleastOnce: boolean;
313
319
  private _asyncEffectIdsByPhase;
314
320
  private _asyncEffectPhaseById;
315
- constructor({ platform, projectUrl, }?: {
321
+ constructor({ platform, projectUrl, cachedSubcircuits, }?: {
316
322
  platform?: PlatformConfig;
317
323
  projectUrl?: string;
324
+ cachedSubcircuits?: Map<string, AnyCircuitElement[]>;
318
325
  });
319
326
  add(componentOrElm: PrimitiveComponent | ReactElement): void;
320
327
  setPlatform(platform: Partial<PlatformConfig>): void;
@@ -1670,7 +1677,6 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
1670
1677
  _hasStartedAsyncAutorouting: boolean;
1671
1678
  _isInflatedFromCircuitJson: boolean;
1672
1679
  _isolatedCircuitJson: AnyCircuitElement[] | null;
1673
- _isolatedCircuit: IsolatedCircuit | null;
1674
1680
  get _isIsolatedSubcircuit(): boolean;
1675
1681
  _normalComponentNameMap: Map<string, NormalComponent[]> | null;
1676
1682
  /**
@@ -1703,7 +1709,6 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
1703
1709
  zodProps: Props;
1704
1710
  componentName: string;
1705
1711
  };
1706
- runRenderCycle(): void;
1707
1712
  doInitialSourceGroupRender(): void;
1708
1713
  doInitialSourceRender(): void;
1709
1714
  doInitialSourceParentAttachment(): void;
@@ -3278,6 +3283,22 @@ declare class Board extends Group<typeof boardProps> implements BoardI, Subcircu
3278
3283
 
3279
3284
  declare class Subcircuit extends Group<typeof subcircuitProps> implements SubcircuitI {
3280
3285
  constructor(props: z.input<typeof subcircuitProps>);
3286
+ /**
3287
+ * Computes a hash of this subcircuit's props and children for caching.
3288
+ * Position/identity props are excluded so identical subcircuits at
3289
+ * different locations share the same hash.
3290
+ */
3291
+ getSubcircuitPropHash(): string;
3292
+ /**
3293
+ * Render this subcircuit in isolation if _subcircuitCachingEnabled is set.
3294
+ * This phase runs before InflateSubcircuitCircuitJson to prepare the
3295
+ * isolated circuit JSON that will be inflated.
3296
+ *
3297
+ * The rendering is synchronous - it loops until all async effects in the
3298
+ * isolated circuit are complete, ensuring the cache is populated before
3299
+ * processing the next subcircuit with potentially the same props.
3300
+ */
3301
+ doInitialRenderIsolatedSubcircuits(): void;
3281
3302
  /**
3282
3303
  * During this phase, we inflate the subcircuit circuit json into class
3283
3304
  * instances