@tscircuit/core 0.0.834 → 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.
Files changed (2) hide show
  1. package/dist/index.js +46 -24
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -3019,12 +3019,12 @@ var calculateCcwRotation = (componentRotationStr, elementCcwRotation) => {
3019
3019
  var createComponentsFromCircuitJson = ({
3020
3020
  componentName,
3021
3021
  componentRotation,
3022
- footprint,
3022
+ footprinterString,
3023
3023
  pinLabels,
3024
3024
  pcbPinLabels
3025
- }, soup) => {
3025
+ }, circuitJson) => {
3026
3026
  const components = [];
3027
- for (const elm of soup) {
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 (footprint.includes("pinrow") && elm.text.includes("PIN")) {
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
- footprint: footprintUrl,
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
- footprint: url,
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
- footprint: "",
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, context) {
15474
- const { injectionDb, subcircuit } = context;
15489
+ function inflateSourceResistor(sourceElm, inflatorContext) {
15490
+ const { injectionDb, subcircuit } = inflatorContext;
15475
15491
  const pcbElm = injectionDb.pcb_component.getWhere({
15476
- name: sourceElm.name
15492
+ source_component_id: sourceElm.source_component_id
15477
15493
  });
15478
15494
  const cadElm = injectionDb.cad_component.getWhere({
15479
- name: sourceElm.name
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 (!circuitJson) return;
15514
- const { db } = this.root;
15515
- if (circuitJson && children?.length > 0) {
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 = cju(circuitJson).source_component.list();
15539
+ const sourceComponents = injectionDb.source_component.list();
15519
15540
  const inflationCtx = {
15520
- injectionDb: db,
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.833",
17568
+ version: "0.0.835",
17548
17569
  types: "dist/index.d.ts",
17549
17570
  main: "dist/index.js",
17550
17571
  module: "dist/index.js",
@@ -17569,7 +17590,8 @@ var package_default = {
17569
17590
  "smoke-test:dist": "bun run scripts/smoke-tests/test-dist-simple-circuit.tsx",
17570
17591
  "build:benchmarking": "bun build --experimental-html ./benchmarking/website/index.html --outdir ./benchmarking-dist",
17571
17592
  "build:benchmarking:watch": `chokidar "./{benchmarking,lib}/**/*.{ts,tsx}" -c 'bun build --experimental-html ./benchmarking/website/index.html --outdir ./benchmarking-dist'`,
17572
- "start:benchmarking": 'concurrently "bun run build:benchmarking:watch" "live-server ./benchmarking-dist"'
17593
+ "start:benchmarking": 'concurrently "bun run build:benchmarking:watch" "live-server ./benchmarking-dist"',
17594
+ "generate-test-plan": "bun run scripts/generate-test-plan.ts"
17573
17595
  },
17574
17596
  devDependencies: {
17575
17597
  "@biomejs/biome": "^1.8.3",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.834",
4
+ "version": "0.0.836",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -26,7 +26,8 @@
26
26
  "smoke-test:dist": "bun run scripts/smoke-tests/test-dist-simple-circuit.tsx",
27
27
  "build:benchmarking": "bun build --experimental-html ./benchmarking/website/index.html --outdir ./benchmarking-dist",
28
28
  "build:benchmarking:watch": "chokidar \"./{benchmarking,lib}/**/*.{ts,tsx}\" -c 'bun build --experimental-html ./benchmarking/website/index.html --outdir ./benchmarking-dist'",
29
- "start:benchmarking": "concurrently \"bun run build:benchmarking:watch\" \"live-server ./benchmarking-dist\""
29
+ "start:benchmarking": "concurrently \"bun run build:benchmarking:watch\" \"live-server ./benchmarking-dist\"",
30
+ "generate-test-plan": "bun run scripts/generate-test-plan.ts"
30
31
  },
31
32
  "devDependencies": {
32
33
  "@biomejs/biome": "^1.8.3",