@tscircuit/core 0.0.1026 → 0.0.1028

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 ["RenderIsolatedSubcircuits", "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", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "SimulationSpiceEngineRender"];
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", "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<"RenderIsolatedSubcircuits" | "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" | "PcbLayout" | "PcbBoardAutoSize" | "PanelLayout" | "PcbTraceHintRender" | "PcbManualTraceRender" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbCopperPourRender" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "SimulationSpiceEngineRender", 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" | "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;
@@ -399,7 +399,7 @@ declare class IsolatedCircuit {
399
399
  _guessRootComponent(): void;
400
400
  render(): void;
401
401
  renderUntilSettled(): Promise<void>;
402
- private _hasIncompleteAsyncEffects;
402
+ _hasIncompleteAsyncEffects(): boolean;
403
403
  _hasIncompleteAsyncEffectsForPhase(phase: RenderPhase): boolean;
404
404
  getCircuitJson(): AnyCircuitElement[];
405
405
  toJson(): AnyCircuitElement[];
@@ -1655,6 +1655,7 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
1655
1655
  _hasStartedAsyncAutorouting: boolean;
1656
1656
  _isInflatedFromCircuitJson: boolean;
1657
1657
  _isolatedCircuitJson: AnyCircuitElement[] | null;
1658
+ _isolatedCircuit: IsolatedCircuit | null;
1658
1659
  get _isIsolatedSubcircuit(): boolean;
1659
1660
  _normalComponentNameMap: Map<string, NormalComponent[]> | null;
1660
1661
  /**
@@ -1687,8 +1688,7 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
1687
1688
  zodProps: Props;
1688
1689
  componentName: string;
1689
1690
  };
1690
- runRenderPhaseForChildren(phase: RenderPhase): void;
1691
- doInitialRenderIsolatedSubcircuits(): void;
1691
+ runRenderCycle(): void;
1692
1692
  doInitialSourceGroupRender(): void;
1693
1693
  doInitialSourceRender(): void;
1694
1694
  doInitialSourceParentAttachment(): void;
package/dist/index.js CHANGED
@@ -117,7 +117,6 @@ import { DefaultEventPriority } from "react-reconciler/constants.js";
117
117
  import Debug from "debug";
118
118
  var debug = Debug("tscircuit:renderable");
119
119
  var orderedRenderPhases = [
120
- "RenderIsolatedSubcircuits",
121
120
  "ReactSubtreesRender",
122
121
  "InflateSubcircuitCircuitJson",
123
122
  "SourceNameDuplicateComponentRemoval",
@@ -173,7 +172,6 @@ var renderPhaseIndexMap = new Map(
173
172
  orderedRenderPhases.map((phase, index) => [phase, index])
174
173
  );
175
174
  var asyncPhaseDependencies = {
176
- InflateSubcircuitCircuitJson: ["RenderIsolatedSubcircuits"],
177
175
  PcbFootprintLayout: ["PcbFootprintStringRender"],
178
176
  PcbComponentSizeCalculation: ["PcbFootprintStringRender"],
179
177
  PcbLayout: ["PcbFootprintStringRender"],
@@ -14662,7 +14660,7 @@ import { identity as identity4 } from "transformation-matrix";
14662
14660
  var package_default = {
14663
14661
  name: "@tscircuit/core",
14664
14662
  type: "module",
14665
- version: "0.0.1025",
14663
+ version: "0.0.1027",
14666
14664
  types: "dist/index.d.ts",
14667
14665
  main: "dist/index.js",
14668
14666
  module: "dist/index.js",
@@ -14725,7 +14723,7 @@ var package_default = {
14725
14723
  "circuit-json-to-connectivity-map": "^0.0.23",
14726
14724
  "circuit-json-to-gltf": "^0.0.62",
14727
14725
  "circuit-json-to-simple-3d": "^0.0.9",
14728
- "circuit-json-to-spice": "^0.0.33",
14726
+ "circuit-json-to-spice": "^0.0.34",
14729
14727
  "circuit-to-svg": "^0.0.327",
14730
14728
  concurrently: "^9.1.2",
14731
14729
  "connectivity-map": "^1.0.0",
@@ -15033,26 +15031,28 @@ var IsolatedCircuit = class {
15033
15031
 
15034
15032
  // lib/components/primitive-components/Group/Group_doInitialRenderIsolatedSubcircuits.ts
15035
15033
  function Group_doInitialRenderIsolatedSubcircuits(group) {
15036
- if (!group._isIsolatedSubcircuit) return;
15037
- if (!group.root) return;
15038
- const parentRoot = group.root;
15039
- const isolatedCircuit = new IsolatedCircuit({
15040
- platform: {
15041
- ...parentRoot.platform,
15042
- pcbDisabled: parentRoot.pcbDisabled,
15043
- schematicDisabled: parentRoot.schematicDisabled
15034
+ if (!group._isolatedCircuit) {
15035
+ const parentRoot = group.root;
15036
+ group._isolatedCircuit = new IsolatedCircuit({
15037
+ platform: {
15038
+ ...parentRoot.platform,
15039
+ pcbDisabled: parentRoot.pcbDisabled,
15040
+ schematicDisabled: parentRoot.schematicDisabled
15041
+ }
15042
+ });
15043
+ for (const child of group.children) {
15044
+ group._isolatedCircuit.add(child);
15044
15045
  }
15045
- });
15046
- const childrenSnapshot = [...group.children];
15047
- for (const child of childrenSnapshot) {
15048
- isolatedCircuit.add(child);
15049
- }
15050
- group._queueAsyncEffect("render-isolated-subcircuit", async () => {
15051
- await isolatedCircuit.renderUntilSettled();
15052
- group.children = [];
15053
- group._normalComponentNameMap = null;
15054
- group._isolatedCircuitJson = isolatedCircuit.getCircuitJson();
15055
- });
15046
+ }
15047
+ group._isolatedCircuit.render();
15048
+ if (group._isolatedCircuit._hasIncompleteAsyncEffects()) {
15049
+ return false;
15050
+ }
15051
+ group._isolatedCircuitJson = group._isolatedCircuit.getCircuitJson();
15052
+ group.children = [];
15053
+ group._normalComponentNameMap = null;
15054
+ group._isolatedCircuit = null;
15055
+ return true;
15056
15056
  }
15057
15057
 
15058
15058
  // lib/components/primitive-components/Group/Group.ts
@@ -15063,6 +15063,7 @@ var Group6 = class extends NormalComponent3 {
15063
15063
  _hasStartedAsyncAutorouting = false;
15064
15064
  _isInflatedFromCircuitJson = false;
15065
15065
  _isolatedCircuitJson = null;
15066
+ _isolatedCircuit = null;
15066
15067
  get _isIsolatedSubcircuit() {
15067
15068
  return Boolean(this._parsedProps._subcircuitCachingEnabled);
15068
15069
  }
@@ -15102,12 +15103,13 @@ var Group6 = class extends NormalComponent3 {
15102
15103
  componentName: "Group"
15103
15104
  };
15104
15105
  }
15105
- runRenderPhaseForChildren(phase) {
15106
- if (this._isIsolatedSubcircuit && !this._isInflatedFromCircuitJson) return;
15107
- super.runRenderPhaseForChildren(phase);
15108
- }
15109
- doInitialRenderIsolatedSubcircuits() {
15110
- Group_doInitialRenderIsolatedSubcircuits(this);
15106
+ runRenderCycle() {
15107
+ if (!this._isIsolatedSubcircuit || !this.root) {
15108
+ super.runRenderCycle();
15109
+ return;
15110
+ }
15111
+ if (!Group_doInitialRenderIsolatedSubcircuits(this)) return;
15112
+ super.runRenderCycle();
15111
15113
  }
15112
15114
  doInitialSourceGroupRender() {
15113
15115
  const { db } = this.root;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1026",
4
+ "version": "0.0.1028",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -64,7 +64,7 @@
64
64
  "circuit-json-to-connectivity-map": "^0.0.23",
65
65
  "circuit-json-to-gltf": "^0.0.62",
66
66
  "circuit-json-to-simple-3d": "^0.0.9",
67
- "circuit-json-to-spice": "^0.0.33",
67
+ "circuit-json-to-spice": "^0.0.34",
68
68
  "circuit-to-svg": "^0.0.327",
69
69
  "concurrently": "^9.1.2",
70
70
  "connectivity-map": "^1.0.0",