@tscircuit/core 0.0.835 → 0.0.836
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 +44 -23
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3019,12 +3019,12 @@ var calculateCcwRotation = (componentRotationStr, elementCcwRotation) => {
|
|
|
3019
3019
|
var createComponentsFromCircuitJson = ({
|
|
3020
3020
|
componentName,
|
|
3021
3021
|
componentRotation,
|
|
3022
|
-
|
|
3022
|
+
footprinterString,
|
|
3023
3023
|
pinLabels,
|
|
3024
3024
|
pcbPinLabels
|
|
3025
|
-
},
|
|
3025
|
+
}, circuitJson) => {
|
|
3026
3026
|
const components = [];
|
|
3027
|
-
for (const elm of
|
|
3027
|
+
for (const elm of circuitJson) {
|
|
3028
3028
|
if (elm.type === "pcb_smtpad" && elm.shape === "rect") {
|
|
3029
3029
|
components.push(
|
|
3030
3030
|
new SmtPad({
|
|
@@ -3209,11 +3209,11 @@ var createComponentsFromCircuitJson = ({
|
|
|
3209
3209
|
componentRotation,
|
|
3210
3210
|
elm.ccw_rotation
|
|
3211
3211
|
);
|
|
3212
|
-
if (
|
|
3212
|
+
if (footprinterString?.includes("pinrow") && elm.text.includes("PIN")) {
|
|
3213
3213
|
components.push(
|
|
3214
3214
|
createPinrowSilkscreenText({
|
|
3215
3215
|
elm,
|
|
3216
|
-
pinLabels: pcbPinLabels ?? pinLabels,
|
|
3216
|
+
pinLabels: pcbPinLabels ?? pinLabels ?? {},
|
|
3217
3217
|
layer: elm.layer,
|
|
3218
3218
|
readableRotation: ccwRotation,
|
|
3219
3219
|
anchorAlignment: elm.anchor_alignment
|
|
@@ -7378,7 +7378,7 @@ function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsync
|
|
|
7378
7378
|
{
|
|
7379
7379
|
componentName: component.name,
|
|
7380
7380
|
componentRotation: pcbRotation,
|
|
7381
|
-
|
|
7381
|
+
footprinterString: footprintUrl,
|
|
7382
7382
|
pinLabels,
|
|
7383
7383
|
pcbPinLabels
|
|
7384
7384
|
},
|
|
@@ -7422,7 +7422,7 @@ function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsync
|
|
|
7422
7422
|
{
|
|
7423
7423
|
componentName: component.name,
|
|
7424
7424
|
componentRotation: pcbRotation,
|
|
7425
|
-
|
|
7425
|
+
footprinterString: url,
|
|
7426
7426
|
pinLabels,
|
|
7427
7427
|
pcbPinLabels
|
|
7428
7428
|
},
|
|
@@ -7477,7 +7477,7 @@ function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsync
|
|
|
7477
7477
|
{
|
|
7478
7478
|
componentName: component.name,
|
|
7479
7479
|
componentRotation: pcbRotation,
|
|
7480
|
-
footprint,
|
|
7480
|
+
footprinterString: footprint,
|
|
7481
7481
|
pinLabels,
|
|
7482
7482
|
pcbPinLabels
|
|
7483
7483
|
},
|
|
@@ -7523,7 +7523,7 @@ function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsync
|
|
|
7523
7523
|
{
|
|
7524
7524
|
componentName: component.name,
|
|
7525
7525
|
componentRotation: pcbRotation,
|
|
7526
|
-
|
|
7526
|
+
footprinterString: "",
|
|
7527
7527
|
pinLabels,
|
|
7528
7528
|
pcbPinLabels
|
|
7529
7529
|
},
|
|
@@ -7912,7 +7912,7 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
7912
7912
|
{
|
|
7913
7913
|
componentName: this.name ?? this.componentName,
|
|
7914
7914
|
componentRotation: pcbRotation,
|
|
7915
|
-
footprint,
|
|
7915
|
+
footprinterString: footprint,
|
|
7916
7916
|
pinLabels,
|
|
7917
7917
|
pcbPinLabels
|
|
7918
7918
|
},
|
|
@@ -15469,20 +15469,41 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
|
15469
15469
|
import "@tscircuit/props";
|
|
15470
15470
|
import { cju } from "@tscircuit/circuit-json-util";
|
|
15471
15471
|
|
|
15472
|
+
// lib/components/primitive-components/Group/Subcircuit/inflators/inflatePcbComponent.ts
|
|
15473
|
+
var inflatePcbComponent = (pcbElm, inflatorContext) => {
|
|
15474
|
+
const { injectionDb, normalComponent } = inflatorContext;
|
|
15475
|
+
if (!normalComponent) return;
|
|
15476
|
+
const components = createComponentsFromCircuitJson(
|
|
15477
|
+
{
|
|
15478
|
+
componentName: normalComponent.name,
|
|
15479
|
+
componentRotation: "0deg"
|
|
15480
|
+
},
|
|
15481
|
+
injectionDb.toArray().filter(
|
|
15482
|
+
(elm) => "pcb_component_id" in elm && elm.pcb_component_id === pcbElm.pcb_component_id
|
|
15483
|
+
)
|
|
15484
|
+
);
|
|
15485
|
+
normalComponent.addAll(components);
|
|
15486
|
+
};
|
|
15487
|
+
|
|
15472
15488
|
// lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceResistor.ts
|
|
15473
|
-
function inflateSourceResistor(sourceElm,
|
|
15474
|
-
const { injectionDb, subcircuit } =
|
|
15489
|
+
function inflateSourceResistor(sourceElm, inflatorContext) {
|
|
15490
|
+
const { injectionDb, subcircuit } = inflatorContext;
|
|
15475
15491
|
const pcbElm = injectionDb.pcb_component.getWhere({
|
|
15476
|
-
|
|
15492
|
+
source_component_id: sourceElm.source_component_id
|
|
15477
15493
|
});
|
|
15478
15494
|
const cadElm = injectionDb.cad_component.getWhere({
|
|
15479
|
-
|
|
15495
|
+
source_component_id: sourceElm.source_component_id
|
|
15480
15496
|
});
|
|
15481
15497
|
const resistor = new Resistor({
|
|
15482
15498
|
name: sourceElm.name,
|
|
15483
|
-
resistance: sourceElm.resistance
|
|
15484
|
-
footprint: cadElm?.footprinter_string
|
|
15499
|
+
resistance: sourceElm.resistance
|
|
15485
15500
|
});
|
|
15501
|
+
if (pcbElm) {
|
|
15502
|
+
inflatePcbComponent(pcbElm, {
|
|
15503
|
+
...inflatorContext,
|
|
15504
|
+
normalComponent: resistor
|
|
15505
|
+
});
|
|
15506
|
+
}
|
|
15486
15507
|
subcircuit.add(resistor);
|
|
15487
15508
|
}
|
|
15488
15509
|
|
|
@@ -15509,15 +15530,15 @@ var Subcircuit = class extends Group6 {
|
|
|
15509
15530
|
* - Add components to groups in the appropriate hierarchy
|
|
15510
15531
|
*/
|
|
15511
15532
|
doInitialInflateSubcircuitCircuitJson() {
|
|
15512
|
-
const { circuitJson, children } = this._parsedProps;
|
|
15513
|
-
if (!
|
|
15514
|
-
const
|
|
15515
|
-
if (
|
|
15533
|
+
const { circuitJson: injectionCircuitJson, children } = this._parsedProps;
|
|
15534
|
+
if (!injectionCircuitJson) return;
|
|
15535
|
+
const injectionDb = cju(injectionCircuitJson);
|
|
15536
|
+
if (injectionCircuitJson && children?.length > 0) {
|
|
15516
15537
|
throw new Error("Subcircuit cannot have both circuitJson and children");
|
|
15517
15538
|
}
|
|
15518
|
-
const sourceComponents =
|
|
15539
|
+
const sourceComponents = injectionDb.source_component.list();
|
|
15519
15540
|
const inflationCtx = {
|
|
15520
|
-
injectionDb
|
|
15541
|
+
injectionDb,
|
|
15521
15542
|
subcircuit: this
|
|
15522
15543
|
};
|
|
15523
15544
|
for (const sourceComponent of sourceComponents) {
|
|
@@ -17544,7 +17565,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
17544
17565
|
var package_default = {
|
|
17545
17566
|
name: "@tscircuit/core",
|
|
17546
17567
|
type: "module",
|
|
17547
|
-
version: "0.0.
|
|
17568
|
+
version: "0.0.835",
|
|
17548
17569
|
types: "dist/index.d.ts",
|
|
17549
17570
|
main: "dist/index.js",
|
|
17550
17571
|
module: "dist/index.js",
|