@tscircuit/core 0.0.1387 → 0.0.1389
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 +7 -2
- package/dist/index.js +80 -5
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { Matrix } from 'transformation-matrix';
|
|
|
14
14
|
import { PackSolver2 } from 'calculate-packing';
|
|
15
15
|
import { AutoroutingPipelineSolver, AssignableAutoroutingPipeline2, AssignableAutoroutingPipeline3, AutoroutingPipeline1_OriginalUnravel, AutoroutingPipelineSolver3_HgPortPointPathing, AutoroutingPipelineSolver4, AutoroutingPipelineSolver5, AutoroutingPipelineSolver8, SimplifiedPcbTrace as SimplifiedPcbTrace$1, SimpleRouteJson as SimpleRouteJson$1 } from '@tscircuit/capacity-autorouter';
|
|
16
16
|
import { CopperPourPipelineSolver } from '@tscircuit/copper-pour-solver';
|
|
17
|
+
import { SchematicTracePipelineSolver } from '@tscircuit/schematic-trace-solver';
|
|
17
18
|
import { Bounds } from '@tscircuit/math-utils';
|
|
18
19
|
import { ConnectivityMap } from 'circuit-json-to-connectivity-map';
|
|
19
20
|
import { GraphicsObject } from 'graphics-debug';
|
|
@@ -30,6 +31,7 @@ declare const SOLVERS: {
|
|
|
30
31
|
AutoroutingPipelineSolver7_MultiGraph: typeof AutoroutingPipelineSolver;
|
|
31
32
|
AutoroutingPipelineSolver8: typeof AutoroutingPipelineSolver8;
|
|
32
33
|
CopperPourPipelineSolver: typeof CopperPourPipelineSolver;
|
|
34
|
+
SchematicTracePipelineSolver: typeof SchematicTracePipelineSolver;
|
|
33
35
|
};
|
|
34
36
|
type SolverName = keyof typeof SOLVERS;
|
|
35
37
|
|
|
@@ -239,9 +241,9 @@ interface IIsolatedCircuit {
|
|
|
239
241
|
interface IRootCircuit extends IIsolatedCircuit {
|
|
240
242
|
}
|
|
241
243
|
|
|
242
|
-
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "RenderIsolatedSubcircuits", "InflateSubcircuitCircuitJson", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "FetchPartFootprint", "ResolveFootprintPinLabels", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "CreateAutoplacedBreakoutPoints", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceComponentPropertyValidation", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SymbolContainerRender", "SchematicPrimitiveRender", "SchematicSymbolResize", "SchematicComponentSizeCalculation", "SchematicLayout", "SchematicSectionRender", "SchematicTraceRender", "SchematicSheetRender", "SchematicReplaceNetLabelsWithSymbols", "PanelBoardLayout", "ValidatePcbCoordinates", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbCalcPlacementResolution", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbAutoplaceBreakoutPoints", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "SupplierFootprintMismatchWarning", "SimulationSpiceEngineRender"];
|
|
244
|
+
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "RenderIsolatedSubcircuits", "InflateSubcircuitCircuitJson", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "FetchPartFootprint", "ResolveFootprintPinLabels", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "CreateAutoplacedBreakoutPoints", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "CheckRefDesConvention", "SourceComponentPropertyValidation", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SymbolContainerRender", "SchematicPrimitiveRender", "SchematicSymbolResize", "SchematicComponentSizeCalculation", "SchematicLayout", "SchematicSectionRender", "SchematicTraceRender", "SchematicSheetRender", "SchematicReplaceNetLabelsWithSymbols", "PanelBoardLayout", "ValidatePcbCoordinates", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbCalcPlacementResolution", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbAutoplaceBreakoutPoints", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "SupplierFootprintMismatchWarning", "SimulationSpiceEngineRender"];
|
|
243
245
|
type RenderPhase = (typeof orderedRenderPhases)[number];
|
|
244
|
-
declare const renderPhaseIndexMap: Map<"ReactSubtreesRender" | "RenderIsolatedSubcircuits" | "InflateSubcircuitCircuitJson" | "SourceNameDuplicateComponentRemoval" | "PcbFootprintStringRender" | "FetchPartFootprint" | "ResolveFootprintPinLabels" | "InitializePortsFromChildren" | "CreateNetsFromProps" | "AssignFallbackProps" | "CreateTracesFromProps" | "CreateTracesFromNetLabels" | "CreateTraceHintsFromProps" | "CreateAutoplacedBreakoutPoints" | "SourceGroupRender" | "AssignNameToUnnamedComponents" | "SourceRender" | "SourceComponentPropertyValidation" | "SourceParentAttachment" | "PortMatching" | "OptimizeSelectorCache" | "SourceTraceRender" | "SourceAddConnectivityMapKey" | "SourceDesignRuleChecks" | "SimulationRender" | "SchematicComponentRender" | "SchematicPortRender" | "SymbolContainerRender" | "SchematicPrimitiveRender" | "SchematicSymbolResize" | "SchematicComponentSizeCalculation" | "SchematicLayout" | "SchematicSectionRender" | "SchematicTraceRender" | "SchematicSheetRender" | "SchematicReplaceNetLabelsWithSymbols" | "PanelBoardLayout" | "ValidatePcbCoordinates" | "PcbComponentRender" | "PcbPrimitiveRender" | "PcbFootprintLayout" | "PcbPortRender" | "PcbPortAttachment" | "PcbComponentSizeCalculation" | "PcbComponentAnchorAlignment" | "PcbCalcPlacementResolution" | "PcbLayout" | "PcbBoardAutoSize" | "PanelLayout" | "PcbAutoplaceBreakoutPoints" | "PcbTraceHintRender" | "PcbManualTraceRender" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbCopperPourRender" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "SupplierFootprintMismatchWarning" | "SimulationSpiceEngineRender", number>;
|
|
246
|
+
declare const renderPhaseIndexMap: Map<"ReactSubtreesRender" | "RenderIsolatedSubcircuits" | "InflateSubcircuitCircuitJson" | "SourceNameDuplicateComponentRemoval" | "PcbFootprintStringRender" | "FetchPartFootprint" | "ResolveFootprintPinLabels" | "InitializePortsFromChildren" | "CreateNetsFromProps" | "AssignFallbackProps" | "CreateTracesFromProps" | "CreateTracesFromNetLabels" | "CreateTraceHintsFromProps" | "CreateAutoplacedBreakoutPoints" | "SourceGroupRender" | "AssignNameToUnnamedComponents" | "SourceRender" | "CheckRefDesConvention" | "SourceComponentPropertyValidation" | "SourceParentAttachment" | "PortMatching" | "OptimizeSelectorCache" | "SourceTraceRender" | "SourceAddConnectivityMapKey" | "SourceDesignRuleChecks" | "SimulationRender" | "SchematicComponentRender" | "SchematicPortRender" | "SymbolContainerRender" | "SchematicPrimitiveRender" | "SchematicSymbolResize" | "SchematicComponentSizeCalculation" | "SchematicLayout" | "SchematicSectionRender" | "SchematicTraceRender" | "SchematicSheetRender" | "SchematicReplaceNetLabelsWithSymbols" | "PanelBoardLayout" | "ValidatePcbCoordinates" | "PcbComponentRender" | "PcbPrimitiveRender" | "PcbFootprintLayout" | "PcbPortRender" | "PcbPortAttachment" | "PcbComponentSizeCalculation" | "PcbComponentAnchorAlignment" | "PcbCalcPlacementResolution" | "PcbLayout" | "PcbBoardAutoSize" | "PanelLayout" | "PcbAutoplaceBreakoutPoints" | "PcbTraceHintRender" | "PcbManualTraceRender" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbCopperPourRender" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "SupplierFootprintMismatchWarning" | "SimulationSpiceEngineRender", number>;
|
|
245
247
|
type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
|
|
246
248
|
type RenderPhaseStates = Record<RenderPhase, {
|
|
247
249
|
initialized: boolean;
|
|
@@ -2211,6 +2213,8 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
|
|
|
2211
2213
|
get portMap(): PortMap<PortNames>;
|
|
2212
2214
|
getInstanceForReactElement(element: ReactElement): NormalComponent | null;
|
|
2213
2215
|
doInitialSourceRender(): void;
|
|
2216
|
+
getRefDesPrefixes(): string[] | undefined;
|
|
2217
|
+
doInitialCheckRefDesConvention(): void;
|
|
2214
2218
|
/**
|
|
2215
2219
|
* After ports have their source_port_id assigned, create
|
|
2216
2220
|
* source_component_internal_connection records so that the connectivity
|
|
@@ -29514,6 +29518,7 @@ declare class Diode extends NormalComponent<typeof diodeProps, PolarizedPassiveP
|
|
|
29514
29518
|
};
|
|
29515
29519
|
initPorts(): void;
|
|
29516
29520
|
doInitialSourceRender(): void;
|
|
29521
|
+
getRefDesPrefixes(): string[];
|
|
29517
29522
|
get pos(): Port;
|
|
29518
29523
|
get anode(): Port;
|
|
29519
29524
|
get neg(): Port;
|
package/dist/index.js
CHANGED
|
@@ -337,6 +337,7 @@ var orderedRenderPhases = [
|
|
|
337
337
|
"SourceGroupRender",
|
|
338
338
|
"AssignNameToUnnamedComponents",
|
|
339
339
|
"SourceRender",
|
|
340
|
+
"CheckRefDesConvention",
|
|
340
341
|
"SourceComponentPropertyValidation",
|
|
341
342
|
"SourceParentAttachment",
|
|
342
343
|
"PortMatching",
|
|
@@ -11952,6 +11953,63 @@ var Footprint = class extends PrimitiveComponent2 {
|
|
|
11952
11953
|
}
|
|
11953
11954
|
};
|
|
11954
11955
|
|
|
11956
|
+
// lib/components/base-components/NormalComponent/NormalComponent_doInitialCheckRefDesConvention.ts
|
|
11957
|
+
var defaultExpectedPrefixesByFtype = {
|
|
11958
|
+
simple_ammeter: ["A"],
|
|
11959
|
+
simple_battery: ["B", "BT"],
|
|
11960
|
+
simple_capacitor: ["C"],
|
|
11961
|
+
simple_chip: ["U", "IC"],
|
|
11962
|
+
simple_connector: ["J", "P", "CONN"],
|
|
11963
|
+
simple_crystal: ["Y", "X"],
|
|
11964
|
+
simple_current_source: ["I", "IS"],
|
|
11965
|
+
simple_diode: ["D"],
|
|
11966
|
+
simple_fuse: ["F"],
|
|
11967
|
+
simple_inductor: ["L", "FB"],
|
|
11968
|
+
simple_interconnect: ["ICN"],
|
|
11969
|
+
simple_led: ["D", "LED"],
|
|
11970
|
+
simple_mosfet: ["Q"],
|
|
11971
|
+
simple_op_amp: ["U", "IC"],
|
|
11972
|
+
simple_pin_header: ["J", "P", "JP"],
|
|
11973
|
+
simple_pinout: ["J", "P"],
|
|
11974
|
+
simple_potentiometer: ["RV", "RP"],
|
|
11975
|
+
simple_power_source: ["B", "BT", "V", "VS"],
|
|
11976
|
+
simple_push_button: ["SW", "S"],
|
|
11977
|
+
simple_resistor: ["R"],
|
|
11978
|
+
simple_resonator: ["Y", "X"],
|
|
11979
|
+
simple_switch: ["SW", "S"],
|
|
11980
|
+
simple_test_point: ["TP"],
|
|
11981
|
+
simple_transistor: ["Q"],
|
|
11982
|
+
simple_voltage_probe: ["VP"],
|
|
11983
|
+
simple_voltage_source: ["V", "VS"]
|
|
11984
|
+
};
|
|
11985
|
+
var getDefaultExpectedRefDesPrefixesForFtype = (ftype) => {
|
|
11986
|
+
if (!ftype) return void 0;
|
|
11987
|
+
return defaultExpectedPrefixesByFtype[ftype];
|
|
11988
|
+
};
|
|
11989
|
+
var getRefDesPrefix = (refDes) => refDes.match(/^[A-Za-z]+/)?.[0]?.toUpperCase();
|
|
11990
|
+
var NormalComponent_doInitialCheckRefDesConvention = (component) => {
|
|
11991
|
+
const { db } = component.root;
|
|
11992
|
+
if (!component.source_component_id) return;
|
|
11993
|
+
const sourceComponent = db.source_component.get(component.source_component_id);
|
|
11994
|
+
if (!sourceComponent?.name || !sourceComponent.ftype) return;
|
|
11995
|
+
const expectedPrefixes = component.getRefDesPrefixes();
|
|
11996
|
+
if (!expectedPrefixes || expectedPrefixes.length === 0) return;
|
|
11997
|
+
const actualPrefix = getRefDesPrefix(sourceComponent.name);
|
|
11998
|
+
if (actualPrefix && expectedPrefixes.includes(actualPrefix)) return;
|
|
11999
|
+
const expectedPrefixMessage = expectedPrefixes.length === 1 ? expectedPrefixes[0] : `one of ${expectedPrefixes.join(", ")}`;
|
|
12000
|
+
db.insert({
|
|
12001
|
+
type: "source_refdes_convention_warning",
|
|
12002
|
+
warning_type: "source_refdes_convention_warning",
|
|
12003
|
+
message: `Component ${sourceComponent.name} has ftype="${sourceComponent.ftype}" but reference designator should start with ${expectedPrefixMessage}`,
|
|
12004
|
+
source_component_id: sourceComponent.source_component_id,
|
|
12005
|
+
refdes: sourceComponent.name,
|
|
12006
|
+
source_component_ftype: sourceComponent.ftype,
|
|
12007
|
+
expected_prefixes: expectedPrefixes,
|
|
12008
|
+
actual_prefix: actualPrefix,
|
|
12009
|
+
subcircuit_id: sourceComponent.subcircuit_id
|
|
12010
|
+
});
|
|
12011
|
+
};
|
|
12012
|
+
|
|
11955
12013
|
// lib/components/base-components/NormalComponent/NormalComponent__getMinimumFlexContainerSize.ts
|
|
11956
12014
|
import { getBoundsFromPoints as getBoundsFromPoints2 } from "@tscircuit/math-utils";
|
|
11957
12015
|
var NormalComponent__getMinimumFlexContainerSize = (component) => {
|
|
@@ -13370,6 +13428,12 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
13370
13428
|
});
|
|
13371
13429
|
this.source_component_id = source_component.source_component_id;
|
|
13372
13430
|
}
|
|
13431
|
+
getRefDesPrefixes() {
|
|
13432
|
+
return getDefaultExpectedRefDesPrefixesForFtype(this.config.sourceFtype);
|
|
13433
|
+
}
|
|
13434
|
+
doInitialCheckRefDesConvention() {
|
|
13435
|
+
NormalComponent_doInitialCheckRefDesConvention(this);
|
|
13436
|
+
}
|
|
13373
13437
|
/**
|
|
13374
13438
|
* After ports have their source_port_id assigned, create
|
|
13375
13439
|
* source_component_internal_connection records so that the connectivity
|
|
@@ -15103,6 +15167,9 @@ var Diode = class extends NormalComponent3 {
|
|
|
15103
15167
|
});
|
|
15104
15168
|
this.source_component_id = source_component.source_component_id;
|
|
15105
15169
|
}
|
|
15170
|
+
getRefDesPrefixes() {
|
|
15171
|
+
return ["D"];
|
|
15172
|
+
}
|
|
15106
15173
|
get pos() {
|
|
15107
15174
|
return this.portMap.pos;
|
|
15108
15175
|
}
|
|
@@ -15268,6 +15335,7 @@ import {
|
|
|
15268
15335
|
AutoroutingPipelineSolver8
|
|
15269
15336
|
} from "@tscircuit/capacity-autorouter";
|
|
15270
15337
|
import { CopperPourPipelineSolver } from "@tscircuit/copper-pour-solver";
|
|
15338
|
+
import { SchematicTracePipelineSolver } from "@tscircuit/schematic-trace-solver";
|
|
15271
15339
|
var SOLVERS = {
|
|
15272
15340
|
PackSolver2,
|
|
15273
15341
|
AutoroutingPipelineSolver,
|
|
@@ -15279,7 +15347,8 @@ var SOLVERS = {
|
|
|
15279
15347
|
AutoroutingPipelineSolver5,
|
|
15280
15348
|
AutoroutingPipelineSolver7_MultiGraph,
|
|
15281
15349
|
AutoroutingPipelineSolver8,
|
|
15282
|
-
CopperPourPipelineSolver
|
|
15350
|
+
CopperPourPipelineSolver,
|
|
15351
|
+
SchematicTracePipelineSolver
|
|
15283
15352
|
};
|
|
15284
15353
|
|
|
15285
15354
|
// lib/utils/autorouting/CapacityMeshAutorouter.ts
|
|
@@ -19725,7 +19794,7 @@ function Group_doInitialSchematicLayoutSections(group) {
|
|
|
19725
19794
|
}
|
|
19726
19795
|
|
|
19727
19796
|
// lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/Group_doInitialSchematicTraceRender.ts
|
|
19728
|
-
import { SchematicTracePipelineSolver as
|
|
19797
|
+
import { SchematicTracePipelineSolver as SchematicTracePipelineSolver4 } from "@tscircuit/schematic-trace-solver";
|
|
19729
19798
|
import Debug12 from "debug";
|
|
19730
19799
|
|
|
19731
19800
|
// lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/createSchematicTraceSolverInputProblem.ts
|
|
@@ -21108,7 +21177,13 @@ var Group_doInitialSchematicTraceRender = (group) => {
|
|
|
21108
21177
|
content: JSON.stringify(inputProblem, null, 2)
|
|
21109
21178
|
});
|
|
21110
21179
|
}
|
|
21111
|
-
const solver = new
|
|
21180
|
+
const solver = new SchematicTracePipelineSolver4(inputProblem);
|
|
21181
|
+
group.root?.emit("solver:started", {
|
|
21182
|
+
type: "solver:started",
|
|
21183
|
+
solverName: "SchematicTracePipelineSolver",
|
|
21184
|
+
solverParams: solver.getConstructorParams(),
|
|
21185
|
+
componentName: group.getString()
|
|
21186
|
+
});
|
|
21112
21187
|
solver.solve();
|
|
21113
21188
|
const schematicPortIdsWithRoutedTraces = getSchematicPortIdsWithRoutedTraces({
|
|
21114
21189
|
solver,
|
|
@@ -25075,7 +25150,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
25075
25150
|
var package_default = {
|
|
25076
25151
|
name: "@tscircuit/core",
|
|
25077
25152
|
type: "module",
|
|
25078
|
-
version: "0.0.
|
|
25153
|
+
version: "0.0.1388",
|
|
25079
25154
|
types: "dist/index.d.ts",
|
|
25080
25155
|
main: "dist/index.js",
|
|
25081
25156
|
module: "dist/index.js",
|
|
@@ -25138,7 +25213,7 @@ var package_default = {
|
|
|
25138
25213
|
"bun-match-svg": "0.0.12",
|
|
25139
25214
|
"calculate-elbow": "^0.0.12",
|
|
25140
25215
|
"chokidar-cli": "^3.0.0",
|
|
25141
|
-
"circuit-json": "^0.0.
|
|
25216
|
+
"circuit-json": "^0.0.446",
|
|
25142
25217
|
"circuit-json-to-bpc": "^0.0.13",
|
|
25143
25218
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
25144
25219
|
"circuit-json-to-gltf": "^0.0.105",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.1389",
|
|
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
|
"bun-match-svg": "0.0.12",
|
|
65
65
|
"calculate-elbow": "^0.0.12",
|
|
66
66
|
"chokidar-cli": "^3.0.0",
|
|
67
|
-
"circuit-json": "^0.0.
|
|
67
|
+
"circuit-json": "^0.0.446",
|
|
68
68
|
"circuit-json-to-bpc": "^0.0.13",
|
|
69
69
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
70
70
|
"circuit-json-to-gltf": "^0.0.105",
|