@tscircuit/core 0.0.611 → 0.0.613
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 +2 -1
- package/dist/index.js +68 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { CircuitJsonUtilObjects } from '@tscircuit/circuit-json-util';
|
|
|
11
11
|
import { ConnectivityMap } from 'circuit-json-to-connectivity-map';
|
|
12
12
|
import { GraphicsObject } from 'graphics-debug';
|
|
13
13
|
|
|
14
|
-
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "PcbFootprintStringRender", "InitializePortsFromChildren", "CreateNetsFromProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SchematicComponentRender", "SchematicPortRender", "SchematicPrimitiveRender", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbLayout", "PcbBoardAutoSize", "PcbTraceHintRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbDesignRuleChecks", "CadModelRender", "PartsEngineRender"];
|
|
14
|
+
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "PcbFootprintStringRender", "InitializePortsFromChildren", "CreateNetsFromProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SchematicPrimitiveRender", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbLayout", "PcbBoardAutoSize", "PcbTraceHintRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbDesignRuleChecks", "CadModelRender", "PartsEngineRender"];
|
|
15
15
|
type RenderPhase = (typeof orderedRenderPhases)[number];
|
|
16
16
|
type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
|
|
17
17
|
type RenderPhaseStates = Record<RenderPhase, {
|
|
@@ -3467,6 +3467,7 @@ declare class Chip<PinLabels extends string = never> extends NormalComponent<typ
|
|
|
3467
3467
|
doInitialSourceRender(): void;
|
|
3468
3468
|
doInitialPcbComponentRender(): void;
|
|
3469
3469
|
doInitialCreateTracesFromProps(): void;
|
|
3470
|
+
doInitialSimulationRender(): void;
|
|
3470
3471
|
}
|
|
3471
3472
|
|
|
3472
3473
|
declare class Diode extends NormalComponent<typeof diodeProps, PolarizedPassivePorts> {
|
package/dist/index.js
CHANGED
|
@@ -98,6 +98,7 @@ var orderedRenderPhases = [
|
|
|
98
98
|
"OptimizeSelectorCache",
|
|
99
99
|
"SourceTraceRender",
|
|
100
100
|
"SourceAddConnectivityMapKey",
|
|
101
|
+
"SimulationRender",
|
|
101
102
|
"SchematicComponentRender",
|
|
102
103
|
"SchematicPortRender",
|
|
103
104
|
"SchematicPrimitiveRender",
|
|
@@ -313,7 +314,24 @@ var InvalidProps = class extends Error {
|
|
|
313
314
|
const propsWithError = Object.keys(formattedError).filter(
|
|
314
315
|
(k) => k !== "_errors"
|
|
315
316
|
);
|
|
317
|
+
const invalidPinLabelMessages = [];
|
|
318
|
+
const pinLabels = originalProps.pinLabels;
|
|
319
|
+
if (pinLabels) {
|
|
320
|
+
for (const [pin, labelOrLabels] of Object.entries(pinLabels)) {
|
|
321
|
+
const labels = Array.isArray(labelOrLabels) ? labelOrLabels : [labelOrLabels];
|
|
322
|
+
for (const label of labels) {
|
|
323
|
+
if (typeof label === "string" && (label.startsWith(" ") || label.endsWith(" "))) {
|
|
324
|
+
invalidPinLabelMessages.push(
|
|
325
|
+
`pinLabels.${pin} ("${label}" has leading or trailing spaces)`
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
316
331
|
const propMessage = propsWithError.map((k) => {
|
|
332
|
+
if (k === "pinLabels" && invalidPinLabelMessages.length > 0) {
|
|
333
|
+
return invalidPinLabelMessages.join(", ");
|
|
334
|
+
}
|
|
317
335
|
if (formattedError[k]._errors[0]) {
|
|
318
336
|
return `${k} (${formattedError[k]._errors[0]})`;
|
|
319
337
|
}
|
|
@@ -9536,6 +9554,54 @@ var Chip = class extends NormalComponent {
|
|
|
9536
9554
|
}
|
|
9537
9555
|
this._createTracesFromConnectionsProp();
|
|
9538
9556
|
}
|
|
9557
|
+
doInitialSimulationRender() {
|
|
9558
|
+
const { db } = this.root;
|
|
9559
|
+
const { pinAttributes } = this.props;
|
|
9560
|
+
if (!pinAttributes) return;
|
|
9561
|
+
let powerPort = null;
|
|
9562
|
+
let groundPort = null;
|
|
9563
|
+
let voltage;
|
|
9564
|
+
const ports = this.selectAll("port");
|
|
9565
|
+
for (const port of ports) {
|
|
9566
|
+
for (const alias of port.getNameAndAliases()) {
|
|
9567
|
+
if (pinAttributes[alias]) {
|
|
9568
|
+
const attributes = pinAttributes[alias];
|
|
9569
|
+
if (attributes.providesPower) {
|
|
9570
|
+
powerPort = port;
|
|
9571
|
+
voltage = attributes.providesVoltage;
|
|
9572
|
+
}
|
|
9573
|
+
if (attributes.providesGround) {
|
|
9574
|
+
groundPort = port;
|
|
9575
|
+
}
|
|
9576
|
+
}
|
|
9577
|
+
}
|
|
9578
|
+
}
|
|
9579
|
+
if (!powerPort || !groundPort || voltage === void 0) {
|
|
9580
|
+
return;
|
|
9581
|
+
}
|
|
9582
|
+
const powerSourcePort = db.source_port.get(powerPort.source_port_id);
|
|
9583
|
+
if (!powerSourcePort?.subcircuit_connectivity_map_key) return;
|
|
9584
|
+
const groundSourcePort = db.source_port.get(groundPort.source_port_id);
|
|
9585
|
+
if (!groundSourcePort?.subcircuit_connectivity_map_key) return;
|
|
9586
|
+
const powerNet = db.source_net.getWhere({
|
|
9587
|
+
subcircuit_connectivity_map_key: powerSourcePort.subcircuit_connectivity_map_key
|
|
9588
|
+
});
|
|
9589
|
+
const groundNet = db.source_net.getWhere({
|
|
9590
|
+
subcircuit_connectivity_map_key: groundSourcePort.subcircuit_connectivity_map_key
|
|
9591
|
+
});
|
|
9592
|
+
if (!powerNet || !groundNet) {
|
|
9593
|
+
return;
|
|
9594
|
+
}
|
|
9595
|
+
;
|
|
9596
|
+
db.simulation_voltage_source.insert({
|
|
9597
|
+
type: "simulation_voltage_source",
|
|
9598
|
+
positive_source_port_id: powerPort.source_port_id,
|
|
9599
|
+
positive_source_net_id: powerNet.source_net_id,
|
|
9600
|
+
negative_source_port_id: groundPort.source_port_id,
|
|
9601
|
+
negative_source_net_id: groundNet.source_net_id,
|
|
9602
|
+
voltage
|
|
9603
|
+
});
|
|
9604
|
+
}
|
|
9539
9605
|
};
|
|
9540
9606
|
|
|
9541
9607
|
// lib/components/normal-components/Diode.ts
|
|
@@ -11546,7 +11612,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
11546
11612
|
var package_default = {
|
|
11547
11613
|
name: "@tscircuit/core",
|
|
11548
11614
|
type: "module",
|
|
11549
|
-
version: "0.0.
|
|
11615
|
+
version: "0.0.612",
|
|
11550
11616
|
types: "dist/index.d.ts",
|
|
11551
11617
|
main: "dist/index.js",
|
|
11552
11618
|
module: "dist/index.js",
|
|
@@ -11592,7 +11658,7 @@ var package_default = {
|
|
|
11592
11658
|
"bun-match-svg": "0.0.12",
|
|
11593
11659
|
"calculate-elbow": "^0.0.5",
|
|
11594
11660
|
"chokidar-cli": "^3.0.0",
|
|
11595
|
-
"circuit-json": "^0.0.
|
|
11661
|
+
"circuit-json": "^0.0.226",
|
|
11596
11662
|
"circuit-json-to-bpc": "^0.0.13",
|
|
11597
11663
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
11598
11664
|
"circuit-json-to-simple-3d": "^0.0.6",
|
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.613",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"bun-match-svg": "0.0.12",
|
|
48
48
|
"calculate-elbow": "^0.0.5",
|
|
49
49
|
"chokidar-cli": "^3.0.0",
|
|
50
|
-
"circuit-json": "^0.0.
|
|
50
|
+
"circuit-json": "^0.0.226",
|
|
51
51
|
"circuit-json-to-bpc": "^0.0.13",
|
|
52
52
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
53
53
|
"circuit-json-to-simple-3d": "^0.0.6",
|