@tscircuit/core 0.0.893 → 0.0.894

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 CHANGED
@@ -1365,6 +1365,7 @@ interface SubcircuitI {
1365
1365
  add(component: PrimitiveComponent): void;
1366
1366
  root: RootCircuit | null;
1367
1367
  getGroup(): IGroup | null;
1368
+ source_group_id: string | null;
1368
1369
  }
1369
1370
 
1370
1371
  declare class Board extends Group<typeof boardProps> implements BoardI, SubcircuitI {
package/dist/index.js CHANGED
@@ -14962,13 +14962,18 @@ function inflateSourceDiode(sourceElm, inflatorContext) {
14962
14962
  function inflateSourceGroup(sourceGroup, inflatorContext) {
14963
14963
  const { subcircuit, groupsMap } = inflatorContext;
14964
14964
  const group = new Group6({
14965
- name: sourceGroup.name
14965
+ name: sourceGroup.name ?? `inflated_group_${sourceGroup.source_group_id}`
14966
14966
  });
14967
14967
  group.source_group_id = sourceGroup.source_group_id;
14968
- subcircuit.add(group);
14969
14968
  if (groupsMap) {
14970
14969
  groupsMap.set(sourceGroup.source_group_id, group);
14971
14970
  }
14971
+ if (sourceGroup.parent_source_group_id && groupsMap?.has(sourceGroup.parent_source_group_id)) {
14972
+ const parentGroup = groupsMap.get(sourceGroup.parent_source_group_id);
14973
+ parentGroup.add(group);
14974
+ } else {
14975
+ subcircuit.add(group);
14976
+ }
14972
14977
  return group;
14973
14978
  }
14974
14979
 
@@ -15190,14 +15195,17 @@ function inflateSourceResistor(sourceElm, inflatorContext) {
15190
15195
  }
15191
15196
 
15192
15197
  // lib/components/primitive-components/Group/Subcircuit/inflators/inflateSourceTrace.ts
15193
- var getSelectorPath = (component, db) => {
15198
+ var getSelectorPath = (component, inflatorContext) => {
15199
+ const { injectionDb, subcircuit, groupsMap } = inflatorContext;
15194
15200
  const path_parts = [];
15195
15201
  let currentGroupId = component.source_group_id;
15196
- while (currentGroupId) {
15197
- const group = db.source_group.get(currentGroupId);
15198
- if (!group) break;
15199
- path_parts.unshift(`.${group.name}`);
15200
- currentGroupId = group.parent_source_group_id;
15202
+ while (currentGroupId && currentGroupId !== subcircuit.source_group_id) {
15203
+ const sourceGroup = injectionDb.source_group.get(currentGroupId);
15204
+ const groupInstance = groupsMap?.get(currentGroupId);
15205
+ if (!sourceGroup || !groupInstance) break;
15206
+ const groupName = groupInstance.props.name ?? groupInstance.fallbackUnassignedName;
15207
+ path_parts.unshift(`.${groupName}`);
15208
+ currentGroupId = sourceGroup.parent_source_group_id;
15201
15209
  }
15202
15210
  path_parts.push(`.${component.name}`);
15203
15211
  return path_parts.join(" > ");
@@ -15207,7 +15215,9 @@ function inflateSourceTrace(sourceTrace, inflatorContext) {
15207
15215
  const connectedSelectors = [];
15208
15216
  for (const sourcePortId of sourceTrace.connected_source_port_ids) {
15209
15217
  const sourcePort = injectionDb.source_port.get(sourcePortId);
15210
- if (!sourcePort) continue;
15218
+ if (!sourcePort) {
15219
+ continue;
15220
+ }
15211
15221
  let selector;
15212
15222
  if (sourcePort.source_component_id) {
15213
15223
  const sourceComponent = injectionDb.source_component.get(
@@ -15219,7 +15229,7 @@ function inflateSourceTrace(sourceTrace, inflatorContext) {
15219
15229
  name: sourceComponent.name,
15220
15230
  source_group_id: sourceComponent.source_group_id
15221
15231
  },
15222
- injectionDb
15232
+ inflatorContext
15223
15233
  );
15224
15234
  selector = `${path} > .${sourcePort.name}`;
15225
15235
  }
@@ -15236,7 +15246,9 @@ function inflateSourceTrace(sourceTrace, inflatorContext) {
15236
15246
  connectedSelectors.push(`net.${sourceNet.name}`);
15237
15247
  }
15238
15248
  }
15239
- if (connectedSelectors.length < 2) return;
15249
+ if (connectedSelectors.length < 2) {
15250
+ return;
15251
+ }
15240
15252
  const trace = new Trace3({
15241
15253
  path: connectedSelectors
15242
15254
  });
@@ -19202,7 +19214,7 @@ import { identity as identity6 } from "transformation-matrix";
19202
19214
  var package_default = {
19203
19215
  name: "@tscircuit/core",
19204
19216
  type: "module",
19205
- version: "0.0.892",
19217
+ version: "0.0.893",
19206
19218
  types: "dist/index.d.ts",
19207
19219
  main: "dist/index.js",
19208
19220
  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.893",
4
+ "version": "0.0.894",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",