@tscircuit/core 0.0.837 → 0.0.838

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 +78 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -15558,6 +15558,80 @@ function inflateSourceGroup(sourceGroup, inflatorContext) {
15558
15558
  return group;
15559
15559
  }
15560
15560
 
15561
+ // lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceChip.ts
15562
+ var mapInternallyConnectedSourcePortIdsToPinLabels = (sourcePortIds, inflatorContext) => {
15563
+ if (!sourcePortIds || sourcePortIds.length === 0) return void 0;
15564
+ const { injectionDb } = inflatorContext;
15565
+ const mapped = sourcePortIds.map(
15566
+ (group) => group.map((sourcePortId) => {
15567
+ const port = injectionDb.source_port.get(
15568
+ sourcePortId
15569
+ );
15570
+ if (!port) return null;
15571
+ if (port.pin_number !== void 0 && port.pin_number !== null) {
15572
+ return `pin${port.pin_number}`;
15573
+ }
15574
+ return port.name;
15575
+ }).filter((value) => value !== null)
15576
+ ).filter((group) => group.length > 0);
15577
+ return mapped.length > 0 ? mapped : void 0;
15578
+ };
15579
+ var inflateSourceChip = (sourceElm, inflatorContext) => {
15580
+ const { injectionDb, subcircuit, groupsMap } = inflatorContext;
15581
+ const pcbElm = injectionDb.pcb_component.getWhere({
15582
+ source_component_id: sourceElm.source_component_id
15583
+ });
15584
+ const schematicElm = injectionDb.schematic_component.getWhere({
15585
+ source_component_id: sourceElm.source_component_id
15586
+ });
15587
+ const cadElm = injectionDb.cad_component.getWhere({
15588
+ source_component_id: sourceElm.source_component_id
15589
+ });
15590
+ const internallyConnectedPins = mapInternallyConnectedSourcePortIdsToPinLabels(
15591
+ sourceElm.internally_connected_source_port_ids,
15592
+ inflatorContext
15593
+ );
15594
+ const chip = new Chip({
15595
+ name: sourceElm.name,
15596
+ manufacturerPartNumber: sourceElm.manufacturer_part_number,
15597
+ supplierPartNumbers: sourceElm.supplier_part_numbers ?? void 0,
15598
+ pinLabels: schematicElm?.port_labels ?? void 0,
15599
+ schWidth: schematicElm?.size?.width,
15600
+ schHeight: schematicElm?.size?.height,
15601
+ schPinSpacing: schematicElm?.pin_spacing,
15602
+ schX: schematicElm?.center?.x,
15603
+ schY: schematicElm?.center?.y,
15604
+ layer: pcbElm?.layer,
15605
+ pcbX: pcbElm?.center?.x,
15606
+ pcbY: pcbElm?.center?.y,
15607
+ pcbRotation: pcbElm?.rotation,
15608
+ doNotPlace: pcbElm?.do_not_place,
15609
+ obstructsWithinBounds: pcbElm?.obstructs_within_bounds,
15610
+ internallyConnectedPins
15611
+ });
15612
+ const footprint = cadElm?.footprinter_string ?? "soic8";
15613
+ if (footprint) {
15614
+ Object.assign(chip.props, { footprint });
15615
+ Object.assign(chip._parsedProps, { footprint });
15616
+ if (!cadElm) {
15617
+ ;
15618
+ chip._addChildrenFromStringFootprint?.();
15619
+ }
15620
+ }
15621
+ if (pcbElm) {
15622
+ inflatePcbComponent(pcbElm, {
15623
+ ...inflatorContext,
15624
+ normalComponent: chip
15625
+ });
15626
+ }
15627
+ if (sourceElm.source_group_id && groupsMap?.has(sourceElm.source_group_id)) {
15628
+ const group = groupsMap.get(sourceElm.source_group_id);
15629
+ group.add(chip);
15630
+ } else {
15631
+ subcircuit.add(chip);
15632
+ }
15633
+ };
15634
+
15561
15635
  // lib/components/primitive-components/Group/Subcircuit/Subcircuit.ts
15562
15636
  var Subcircuit = class extends Group6 {
15563
15637
  constructor(props) {
@@ -15603,6 +15677,9 @@ var Subcircuit = class extends Group6 {
15603
15677
  case "simple_resistor":
15604
15678
  inflateSourceResistor(sourceComponent, inflationCtx);
15605
15679
  break;
15680
+ case "simple_chip":
15681
+ inflateSourceChip(sourceComponent, inflationCtx);
15682
+ break;
15606
15683
  default:
15607
15684
  throw new Error(
15608
15685
  `No inflator implemented for source component ftype: "${sourceComponent.ftype}"`
@@ -17626,7 +17703,7 @@ import { identity as identity6 } from "transformation-matrix";
17626
17703
  var package_default = {
17627
17704
  name: "@tscircuit/core",
17628
17705
  type: "module",
17629
- version: "0.0.836",
17706
+ version: "0.0.837",
17630
17707
  types: "dist/index.d.ts",
17631
17708
  main: "dist/index.js",
17632
17709
  module: "dist/index.js",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.837",
4
+ "version": "0.0.838",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",