@tscircuit/core 0.0.155 → 0.0.156
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 +9 -2
- package/dist/index.js +35 -2
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { Matrix } from 'transformation-matrix';
|
|
|
9
9
|
import { SoupUtilObjects } from '@tscircuit/soup-util';
|
|
10
10
|
import * as _tscircuit_layout from '@tscircuit/layout';
|
|
11
11
|
|
|
12
|
-
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "InitializePortsFromChildren", "CreateNetsFromProps", "CreateTracesFromProps", "CreateTraceHintsFromProps", "SourceRender", "SourceParentAttachment", "PortDiscovery", "PortMatching", "SourceTraceRender", "SchematicComponentRender", "SchematicPortRender", "SchematicLayout", "SchematicTraceRender", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbLayout", "PcbTraceRender", "PcbTraceHintRender", "PcbRouteNetIslands", "PcbComponentSizeCalculation", "CadModelRender"];
|
|
12
|
+
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "InitializePortsFromChildren", "CreateNetsFromProps", "CreateTracesFromProps", "CreateTraceHintsFromProps", "SourceRender", "SourceParentAttachment", "PortDiscovery", "PortMatching", "SourceTraceRender", "SourceAddConnectivityMapKey", "SchematicComponentRender", "SchematicPortRender", "SchematicLayout", "SchematicTraceRender", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbLayout", "PcbTraceRender", "PcbTraceHintRender", "PcbRouteNetIslands", "PcbComponentSizeCalculation", "CadModelRender"];
|
|
13
13
|
type RenderPhase = (typeof orderedRenderPhases)[number];
|
|
14
14
|
type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
|
|
15
15
|
type RenderPhaseStates = Record<RenderPhase, {
|
|
@@ -351,11 +351,17 @@ declare class Net extends PrimitiveComponent<typeof netProps> {
|
|
|
351
351
|
renderError(message: Parameters<typeof PrimitiveComponent.prototype.renderError>[0]): void;
|
|
352
352
|
}
|
|
353
353
|
|
|
354
|
-
|
|
354
|
+
interface TraceI extends PrimitiveComponent<typeof traceProps> {
|
|
355
|
+
source_trace_id: string | null;
|
|
356
|
+
subcircuit_connectivity_map_key: string | null;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
declare class Trace extends PrimitiveComponent<typeof traceProps> implements TraceI {
|
|
355
360
|
source_trace_id: string | null;
|
|
356
361
|
pcb_trace_id: string | null;
|
|
357
362
|
schematic_trace_id: string | null;
|
|
358
363
|
_portsRoutedOnPcb: Port[];
|
|
364
|
+
subcircuit_connectivity_map_key: string | null;
|
|
359
365
|
constructor(props: z.input<typeof traceProps>);
|
|
360
366
|
get config(): {
|
|
361
367
|
zodProps: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
|
@@ -841,6 +847,7 @@ declare class Group<Props extends z.ZodType<any, any, any> = typeof groupProps>
|
|
|
841
847
|
};
|
|
842
848
|
doInitialCreateTraceHintsFromProps(): void;
|
|
843
849
|
_getSimpleRouteJsonFromPcbTraces(): SimpleRouteJson;
|
|
850
|
+
doInitialSourceAddConnectivityMapKey(): void;
|
|
844
851
|
doInitialPcbTraceRender(): void;
|
|
845
852
|
updatePcbTraceRender(): void;
|
|
846
853
|
doInitialSchematicLayout(): void;
|
package/dist/index.js
CHANGED
|
@@ -62,6 +62,7 @@ var orderedRenderPhases = [
|
|
|
62
62
|
"PortDiscovery",
|
|
63
63
|
"PortMatching",
|
|
64
64
|
"SourceTraceRender",
|
|
65
|
+
"SourceAddConnectivityMapKey",
|
|
65
66
|
"SchematicComponentRender",
|
|
66
67
|
"SchematicPortRender",
|
|
67
68
|
"SchematicLayout",
|
|
@@ -1654,7 +1655,7 @@ var Port = class extends PrimitiveComponent {
|
|
|
1654
1655
|
const matchedPcbElm = this.matchedComponents.find((c) => c.isPcbPrimitive);
|
|
1655
1656
|
if (!matchedPcbElm) {
|
|
1656
1657
|
throw new Error(
|
|
1657
|
-
`Port ${this} has no matched pcb component, can't get global
|
|
1658
|
+
`Port ${this} has no matched pcb component, can't get global pcb position`
|
|
1658
1659
|
);
|
|
1659
1660
|
}
|
|
1660
1661
|
return matchedPcbElm?._getGlobalPcbPositionBeforeLayout() ?? { x: 0, y: 0 };
|
|
@@ -2929,6 +2930,7 @@ var TraceHint = class extends PrimitiveComponent {
|
|
|
2929
2930
|
// lib/components/primitive-components/Group/Group.ts
|
|
2930
2931
|
import * as SAL from "@tscircuit/schematic-autolayout";
|
|
2931
2932
|
import { getObstaclesFromSoup } from "@tscircuit/infgrid-ijump-astar";
|
|
2933
|
+
import { ConnectivityMap } from "circuit-json-to-connectivity-map";
|
|
2932
2934
|
var Group = class extends NormalComponent {
|
|
2933
2935
|
_asyncAutoroutingResult = null;
|
|
2934
2936
|
get config() {
|
|
@@ -3001,6 +3003,35 @@ var Group = class extends NormalComponent {
|
|
|
3001
3003
|
minTraceWidth: this._parsedProps.minTraceWidth ?? 0.1
|
|
3002
3004
|
};
|
|
3003
3005
|
}
|
|
3006
|
+
doInitialSourceAddConnectivityMapKey() {
|
|
3007
|
+
if (!this.isSubcircuit) return;
|
|
3008
|
+
const { db } = this.root;
|
|
3009
|
+
const traces = this.selectAll("trace");
|
|
3010
|
+
const connMap = new ConnectivityMap({});
|
|
3011
|
+
connMap.addConnections(
|
|
3012
|
+
traces.map((t) => {
|
|
3013
|
+
const source_trace = db.source_trace.get(
|
|
3014
|
+
t.source_trace_id
|
|
3015
|
+
);
|
|
3016
|
+
if (!source_trace) return null;
|
|
3017
|
+
return [
|
|
3018
|
+
source_trace.source_trace_id,
|
|
3019
|
+
...source_trace.connected_source_port_ids,
|
|
3020
|
+
...source_trace.connected_source_net_ids
|
|
3021
|
+
];
|
|
3022
|
+
}).filter((c) => c !== null)
|
|
3023
|
+
);
|
|
3024
|
+
for (const trace of traces) {
|
|
3025
|
+
if (!trace.source_trace_id) continue;
|
|
3026
|
+
const connNetId = connMap.getNetConnectedToId(trace.source_trace_id);
|
|
3027
|
+
if (!connNetId) continue;
|
|
3028
|
+
const { name: subcircuitName } = this._parsedProps;
|
|
3029
|
+
trace.subcircuit_connectivity_map_key = `${subcircuitName ?? `unnamedsubcircuit${this._renderId}`}_${connNetId}`;
|
|
3030
|
+
db.source_trace.update(trace.source_trace_id, {
|
|
3031
|
+
subcircuit_connectivity_map_key: trace.subcircuit_connectivity_map_key
|
|
3032
|
+
});
|
|
3033
|
+
}
|
|
3034
|
+
}
|
|
3004
3035
|
doInitialPcbTraceRender() {
|
|
3005
3036
|
if (this._shouldUseTraceByTraceRouting()) return;
|
|
3006
3037
|
if (this.props.autorouter?.serverUrl) {
|
|
@@ -3484,6 +3515,7 @@ var Trace = class extends PrimitiveComponent {
|
|
|
3484
3515
|
pcb_trace_id = null;
|
|
3485
3516
|
schematic_trace_id = null;
|
|
3486
3517
|
_portsRoutedOnPcb;
|
|
3518
|
+
subcircuit_connectivity_map_key = null;
|
|
3487
3519
|
constructor(props) {
|
|
3488
3520
|
super(props);
|
|
3489
3521
|
this._portsRoutedOnPcb = [];
|
|
@@ -3957,7 +3989,8 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
3957
3989
|
);
|
|
3958
3990
|
const trace = db.schematic_trace.insert({
|
|
3959
3991
|
source_trace_id: this.source_trace_id,
|
|
3960
|
-
edges
|
|
3992
|
+
edges,
|
|
3993
|
+
junctions: []
|
|
3961
3994
|
});
|
|
3962
3995
|
this.schematic_trace_id = trace.schematic_trace_id;
|
|
3963
3996
|
}
|
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.156",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"@tscircuit/props": "^0.0.86",
|
|
44
44
|
"@tscircuit/schematic-autolayout": "^0.0.5",
|
|
45
45
|
"@tscircuit/soup-util": "^0.0.33",
|
|
46
|
-
"circuit-json": "^0.0.
|
|
46
|
+
"circuit-json": "^0.0.98",
|
|
47
47
|
"circuit-json-to-connectivity-map": "^0.0.17",
|
|
48
|
-
"circuit-to-svg": "^0.0.
|
|
48
|
+
"circuit-to-svg": "^0.0.64",
|
|
49
49
|
"format-si-unit": "^0.0.2",
|
|
50
50
|
"nanoid": "^5.0.7",
|
|
51
51
|
"performance-now": "^2.1.0",
|