@tscircuit/core 0.0.836 → 0.0.837
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.js +66 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15487,7 +15487,7 @@ var inflatePcbComponent = (pcbElm, inflatorContext) => {
|
|
|
15487
15487
|
|
|
15488
15488
|
// lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceResistor.ts
|
|
15489
15489
|
function inflateSourceResistor(sourceElm, inflatorContext) {
|
|
15490
|
-
const { injectionDb, subcircuit } = inflatorContext;
|
|
15490
|
+
const { injectionDb, subcircuit, groupsMap } = inflatorContext;
|
|
15491
15491
|
const pcbElm = injectionDb.pcb_component.getWhere({
|
|
15492
15492
|
source_component_id: sourceElm.source_component_id
|
|
15493
15493
|
});
|
|
@@ -15504,7 +15504,58 @@ function inflateSourceResistor(sourceElm, inflatorContext) {
|
|
|
15504
15504
|
normalComponent: resistor
|
|
15505
15505
|
});
|
|
15506
15506
|
}
|
|
15507
|
-
|
|
15507
|
+
if (sourceElm.source_group_id && groupsMap?.has(sourceElm.source_group_id)) {
|
|
15508
|
+
const group = groupsMap.get(sourceElm.source_group_id);
|
|
15509
|
+
group.add(resistor);
|
|
15510
|
+
} else {
|
|
15511
|
+
subcircuit.add(resistor);
|
|
15512
|
+
}
|
|
15513
|
+
}
|
|
15514
|
+
|
|
15515
|
+
// lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourcePort.ts
|
|
15516
|
+
function inflateSourcePort(sourcePort, inflatorContext) {
|
|
15517
|
+
const { injectionDb, subcircuit } = inflatorContext;
|
|
15518
|
+
if (sourcePort.source_component_id !== null) {
|
|
15519
|
+
return;
|
|
15520
|
+
}
|
|
15521
|
+
const pcbPortFromInjection = injectionDb.pcb_port.getWhere({
|
|
15522
|
+
source_port_id: sourcePort.source_port_id
|
|
15523
|
+
});
|
|
15524
|
+
const port = new Port({
|
|
15525
|
+
name: sourcePort.name,
|
|
15526
|
+
pinNumber: sourcePort.pin_number
|
|
15527
|
+
});
|
|
15528
|
+
subcircuit.add(port);
|
|
15529
|
+
port.source_port_id = sourcePort.source_port_id;
|
|
15530
|
+
const root = subcircuit.root;
|
|
15531
|
+
if (root && pcbPortFromInjection) {
|
|
15532
|
+
const { db } = root;
|
|
15533
|
+
const pcb_port = db.pcb_port.insert({
|
|
15534
|
+
pcb_component_id: void 0,
|
|
15535
|
+
layers: pcbPortFromInjection.layers,
|
|
15536
|
+
subcircuit_id: subcircuit.subcircuit_id ?? void 0,
|
|
15537
|
+
pcb_group_id: subcircuit.getGroup()?.pcb_group_id ?? void 0,
|
|
15538
|
+
x: pcbPortFromInjection.x,
|
|
15539
|
+
y: pcbPortFromInjection.y,
|
|
15540
|
+
source_port_id: sourcePort.source_port_id,
|
|
15541
|
+
is_board_pinout: false
|
|
15542
|
+
});
|
|
15543
|
+
port.pcb_port_id = pcb_port.pcb_port_id;
|
|
15544
|
+
}
|
|
15545
|
+
}
|
|
15546
|
+
|
|
15547
|
+
// lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceGroup.ts
|
|
15548
|
+
function inflateSourceGroup(sourceGroup, inflatorContext) {
|
|
15549
|
+
const { subcircuit, groupsMap } = inflatorContext;
|
|
15550
|
+
const group = new Group6({
|
|
15551
|
+
name: sourceGroup.name
|
|
15552
|
+
});
|
|
15553
|
+
group.source_group_id = sourceGroup.source_group_id;
|
|
15554
|
+
subcircuit.add(group);
|
|
15555
|
+
if (groupsMap) {
|
|
15556
|
+
groupsMap.set(sourceGroup.source_group_id, group);
|
|
15557
|
+
}
|
|
15558
|
+
return group;
|
|
15508
15559
|
}
|
|
15509
15560
|
|
|
15510
15561
|
// lib/components/primitive-components/Group/Subcircuit/Subcircuit.ts
|
|
@@ -15536,11 +15587,17 @@ var Subcircuit = class extends Group6 {
|
|
|
15536
15587
|
if (injectionCircuitJson && children?.length > 0) {
|
|
15537
15588
|
throw new Error("Subcircuit cannot have both circuitJson and children");
|
|
15538
15589
|
}
|
|
15539
|
-
const
|
|
15590
|
+
const groupsMap = /* @__PURE__ */ new Map();
|
|
15540
15591
|
const inflationCtx = {
|
|
15541
15592
|
injectionDb,
|
|
15542
|
-
subcircuit: this
|
|
15593
|
+
subcircuit: this,
|
|
15594
|
+
groupsMap
|
|
15543
15595
|
};
|
|
15596
|
+
const sourceGroups = injectionDb.source_group.list();
|
|
15597
|
+
for (const sourceGroup of sourceGroups) {
|
|
15598
|
+
inflateSourceGroup(sourceGroup, inflationCtx);
|
|
15599
|
+
}
|
|
15600
|
+
const sourceComponents = injectionDb.source_component.list();
|
|
15544
15601
|
for (const sourceComponent of sourceComponents) {
|
|
15545
15602
|
switch (sourceComponent.ftype) {
|
|
15546
15603
|
case "simple_resistor":
|
|
@@ -15552,6 +15609,10 @@ var Subcircuit = class extends Group6 {
|
|
|
15552
15609
|
);
|
|
15553
15610
|
}
|
|
15554
15611
|
}
|
|
15612
|
+
const sourcePorts = injectionDb.source_port.list();
|
|
15613
|
+
for (const sourcePort of sourcePorts) {
|
|
15614
|
+
inflateSourcePort(sourcePort, inflationCtx);
|
|
15615
|
+
}
|
|
15555
15616
|
}
|
|
15556
15617
|
};
|
|
15557
15618
|
|
|
@@ -17565,7 +17626,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
17565
17626
|
var package_default = {
|
|
17566
17627
|
name: "@tscircuit/core",
|
|
17567
17628
|
type: "module",
|
|
17568
|
-
version: "0.0.
|
|
17629
|
+
version: "0.0.836",
|
|
17569
17630
|
types: "dist/index.d.ts",
|
|
17570
17631
|
main: "dist/index.js",
|
|
17571
17632
|
module: "dist/index.js",
|