@tscircuit/core 0.0.1037 → 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 +32 -5
- package/dist/index.js +752 -634
- package/package.json +2 -2
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;
|
|
@@ -1317,6 +1324,7 @@ declare class Trace extends PrimitiveComponent<typeof traceProps> implements Tra
|
|
|
1317
1324
|
declare const portProps: z.ZodObject<{
|
|
1318
1325
|
name: z.ZodOptional<z.ZodString>;
|
|
1319
1326
|
pinNumber: z.ZodOptional<z.ZodNumber>;
|
|
1327
|
+
schStemLength: z.ZodOptional<z.ZodNumber>;
|
|
1320
1328
|
aliases: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1321
1329
|
layer: z.ZodOptional<z.ZodString>;
|
|
1322
1330
|
layers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -1329,6 +1337,7 @@ declare const portProps: z.ZodObject<{
|
|
|
1329
1337
|
layers?: string[] | undefined;
|
|
1330
1338
|
name?: string | undefined;
|
|
1331
1339
|
pinNumber?: number | undefined;
|
|
1340
|
+
schStemLength?: number | undefined;
|
|
1332
1341
|
aliases?: string[] | undefined;
|
|
1333
1342
|
schX?: number | undefined;
|
|
1334
1343
|
schY?: number | undefined;
|
|
@@ -1339,6 +1348,7 @@ declare const portProps: z.ZodObject<{
|
|
|
1339
1348
|
layers?: string[] | undefined;
|
|
1340
1349
|
name?: string | undefined;
|
|
1341
1350
|
pinNumber?: number | undefined;
|
|
1351
|
+
schStemLength?: number | undefined;
|
|
1342
1352
|
aliases?: string[] | undefined;
|
|
1343
1353
|
schX?: number | undefined;
|
|
1344
1354
|
schY?: number | undefined;
|
|
@@ -1358,6 +1368,7 @@ declare class Port extends PrimitiveComponent<typeof portProps> {
|
|
|
1358
1368
|
zodProps: z.ZodObject<{
|
|
1359
1369
|
name: z.ZodOptional<z.ZodString>;
|
|
1360
1370
|
pinNumber: z.ZodOptional<z.ZodNumber>;
|
|
1371
|
+
schStemLength: z.ZodOptional<z.ZodNumber>;
|
|
1361
1372
|
aliases: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1362
1373
|
layer: z.ZodOptional<z.ZodString>;
|
|
1363
1374
|
layers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -1370,6 +1381,7 @@ declare class Port extends PrimitiveComponent<typeof portProps> {
|
|
|
1370
1381
|
layers?: string[] | undefined;
|
|
1371
1382
|
name?: string | undefined;
|
|
1372
1383
|
pinNumber?: number | undefined;
|
|
1384
|
+
schStemLength?: number | undefined;
|
|
1373
1385
|
aliases?: string[] | undefined;
|
|
1374
1386
|
schX?: number | undefined;
|
|
1375
1387
|
schY?: number | undefined;
|
|
@@ -1380,6 +1392,7 @@ declare class Port extends PrimitiveComponent<typeof portProps> {
|
|
|
1380
1392
|
layers?: string[] | undefined;
|
|
1381
1393
|
name?: string | undefined;
|
|
1382
1394
|
pinNumber?: number | undefined;
|
|
1395
|
+
schStemLength?: number | undefined;
|
|
1383
1396
|
aliases?: string[] | undefined;
|
|
1384
1397
|
schX?: number | undefined;
|
|
1385
1398
|
schY?: number | undefined;
|
|
@@ -1664,7 +1677,6 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
|
|
|
1664
1677
|
_hasStartedAsyncAutorouting: boolean;
|
|
1665
1678
|
_isInflatedFromCircuitJson: boolean;
|
|
1666
1679
|
_isolatedCircuitJson: AnyCircuitElement[] | null;
|
|
1667
|
-
_isolatedCircuit: IsolatedCircuit | null;
|
|
1668
1680
|
get _isIsolatedSubcircuit(): boolean;
|
|
1669
1681
|
_normalComponentNameMap: Map<string, NormalComponent[]> | null;
|
|
1670
1682
|
/**
|
|
@@ -1697,7 +1709,6 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
|
|
|
1697
1709
|
zodProps: Props;
|
|
1698
1710
|
componentName: string;
|
|
1699
1711
|
};
|
|
1700
|
-
runRenderCycle(): void;
|
|
1701
1712
|
doInitialSourceGroupRender(): void;
|
|
1702
1713
|
doInitialSourceRender(): void;
|
|
1703
1714
|
doInitialSourceParentAttachment(): void;
|
|
@@ -3272,6 +3283,22 @@ declare class Board extends Group<typeof boardProps> implements BoardI, Subcircu
|
|
|
3272
3283
|
|
|
3273
3284
|
declare class Subcircuit extends Group<typeof subcircuitProps> implements SubcircuitI {
|
|
3274
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;
|
|
3275
3302
|
/**
|
|
3276
3303
|
* During this phase, we inflate the subcircuit circuit json into class
|
|
3277
3304
|
* instances
|