@tscircuit/core 0.0.497 → 0.0.499

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
@@ -4735,6 +4735,7 @@ declare class Jumper<PinLabels extends string = never> extends NormalComponent<t
4735
4735
  }>>;
4736
4736
  pinCount: zod.ZodOptional<zod.ZodUnion<[zod.ZodLiteral<2>, zod.ZodLiteral<3>]>>;
4737
4737
  internallyConnectedPins: zod.ZodOptional<zod.ZodArray<zod.ZodArray<zod.ZodString, "many">, "many">>;
4738
+ connections: zod.ZodOptional<zod.ZodPipeline<zod.ZodType<Partial<Record<string, string | string[] | readonly string[]>>, zod.ZodTypeDef, Partial<Record<string, string | string[] | readonly string[]>>>, zod.ZodRecord<zod.ZodString, zod.ZodUnion<[zod.ZodUnion<[zod.ZodString, zod.ZodReadonly<zod.ZodArray<zod.ZodString, "many">>]>, zod.ZodArray<zod.ZodString, "many">]>>>>;
4738
4739
  }, "strip", zod.ZodTypeAny, {
4739
4740
  name: string;
4740
4741
  pcbX?: number | undefined;
@@ -4845,6 +4846,7 @@ declare class Jumper<PinLabels extends string = never> extends NormalComponent<t
4845
4846
  bottomMargin?: number | undefined;
4846
4847
  }> | undefined;
4847
4848
  schPinSpacing?: number | undefined;
4849
+ connections?: Record<string, string | readonly string[] | string[]> | undefined;
4848
4850
  schDirection?: "left" | "right" | undefined;
4849
4851
  pinCount?: 2 | 3 | undefined;
4850
4852
  }, {
@@ -4959,6 +4961,7 @@ declare class Jumper<PinLabels extends string = never> extends NormalComponent<t
4959
4961
  bottomMargin?: string | number | undefined;
4960
4962
  }> | undefined;
4961
4963
  schPinSpacing?: string | number | undefined;
4964
+ connections?: Partial<Record<string, string | string[] | readonly string[]>> | undefined;
4962
4965
  schDirection?: "left" | "right" | undefined;
4963
4966
  pinCount?: 2 | 3 | undefined;
4964
4967
  }>;
@@ -5370,6 +5373,7 @@ declare class SolderJumper<PinLabels extends string = never> extends NormalCompo
5370
5373
  }>>;
5371
5374
  pinCount: zod.ZodOptional<zod.ZodUnion<[zod.ZodLiteral<2>, zod.ZodLiteral<3>]>>;
5372
5375
  internallyConnectedPins: zod.ZodOptional<zod.ZodArray<zod.ZodArray<zod.ZodString, "many">, "many">>;
5376
+ connections: zod.ZodOptional<zod.ZodPipeline<zod.ZodType<Partial<Record<string, string | string[] | readonly string[]>>, zod.ZodTypeDef, Partial<Record<string, string | string[] | readonly string[]>>>, zod.ZodRecord<zod.ZodString, zod.ZodUnion<[zod.ZodUnion<[zod.ZodString, zod.ZodReadonly<zod.ZodArray<zod.ZodString, "many">>]>, zod.ZodArray<zod.ZodString, "many">]>>>>;
5373
5377
  } & {
5374
5378
  bridgedPins: zod.ZodOptional<zod.ZodArray<zod.ZodArray<zod.ZodString, "many">, "many">>;
5375
5379
  }, "strip", zod.ZodTypeAny, {
@@ -5482,6 +5486,7 @@ declare class SolderJumper<PinLabels extends string = never> extends NormalCompo
5482
5486
  bottomMargin?: number | undefined;
5483
5487
  }> | undefined;
5484
5488
  schPinSpacing?: number | undefined;
5489
+ connections?: Record<string, string | readonly string[] | string[]> | undefined;
5485
5490
  schDirection?: "left" | "right" | undefined;
5486
5491
  pinCount?: 2 | 3 | undefined;
5487
5492
  bridgedPins?: string[][] | undefined;
@@ -5597,6 +5602,7 @@ declare class SolderJumper<PinLabels extends string = never> extends NormalCompo
5597
5602
  bottomMargin?: string | number | undefined;
5598
5603
  }> | undefined;
5599
5604
  schPinSpacing?: string | number | undefined;
5605
+ connections?: Partial<Record<string, string | string[] | readonly string[]>> | undefined;
5600
5606
  schDirection?: "left" | "right" | undefined;
5601
5607
  pinCount?: 2 | 3 | undefined;
5602
5608
  bridgedPins?: string[][] | undefined;
@@ -14761,8 +14767,8 @@ type PolarizedSel = Record<`C${Nums40}` | `L${Nums40}` | `LED${Nums40}` | `D${Nu
14761
14767
  }>;
14762
14768
  type CommonNetNames = "VCC" | "GND" | "VDD" | "PWR" | "V5" | "V3_3" | "VIN" | "SHLD" | "EN" | "SCL" | "SDA" | "MOSI" | "MISO" | "SCK" | "CS" | "FLASH_SDO" | "FLASH_SDI" | "FLASH_SCK" | "FLASH_N_CS" | "FLASH_N_WP" | "FLASH_N_HOLD";
14763
14769
  type TransistorSel = Record<`Q${Nums40}`, Record<TransistorPinNames, string>>;
14764
- type JumperSel = Record<`J${Nums40}` | `CN${Nums40}`, Record<PinNumbers100 | CommonPinNames, string> & ChipFnSel>;
14765
- type ChipSel = Record<`U${Nums40}`, Record<CommonPinNames, string> & ChipFnSel>;
14770
+ type JumperSel = Record<`J${Nums40}` | `JP${Nums40}` | `CN${Nums40}`, Record<PinNumbers100 | CommonPinNames, string> & ChipFnSel>;
14771
+ type ChipSel = Record<`U${Nums40}` | "USBC", Record<CommonPinNames | PinNumbers100, string> & ChipFnSel>;
14766
14772
  type NetSelFn<N extends string = CommonNetNames> = (<N2 extends string>() => Record<N | N2, string>) & Record<N, string>;
14767
14773
  type NetSel<N extends string = CommonNetNames> = Record<"net", NetSelFn<N>>;
14768
14774
  type ExplicitModuleSel = Record<"subcircuit" | "module" | "group", Record<`S${Nums40}` | `M${Nums40}` | `G${Nums40}`, SelWithoutSubcircuit>>;
package/dist/index.js CHANGED
@@ -4646,16 +4646,49 @@ var Trace2 = class extends PrimitiveComponent2 {
4646
4646
  }));
4647
4647
  for (const { selector, port } of portsWithSelectors) {
4648
4648
  if (!port) {
4649
- const parentSelector = selector.replace(/(\> )?[^ ]+$/, "");
4650
- const targetComponent = this.getSubcircuit().selectOne(parentSelector);
4649
+ let parentSelector;
4650
+ let portToken;
4651
+ const dotIndex = selector.lastIndexOf(".");
4652
+ if (dotIndex !== -1 && dotIndex > selector.lastIndexOf(" ")) {
4653
+ parentSelector = selector.slice(0, dotIndex);
4654
+ portToken = selector.slice(dotIndex + 1);
4655
+ } else {
4656
+ const match = selector.match(/^(.*[ >])?([^ >]+)$/);
4657
+ parentSelector = match?.[1]?.trim() ?? "";
4658
+ portToken = match?.[2] ?? selector;
4659
+ }
4660
+ let targetComponent = parentSelector ? this.getSubcircuit().selectOne(parentSelector) : null;
4661
+ if (!targetComponent && parentSelector && !/[.#\[]/.test(parentSelector)) {
4662
+ targetComponent = this.getSubcircuit().selectOne(`.${parentSelector}`);
4663
+ }
4651
4664
  if (!targetComponent) {
4652
- this.renderError(`Could not find port for selector "${selector}"`);
4665
+ if (parentSelector) {
4666
+ this.renderError(
4667
+ `Could not find port for selector "${selector}". Component "${parentSelector}" not found`
4668
+ );
4669
+ } else {
4670
+ this.renderError(`Could not find port for selector "${selector}"`);
4671
+ }
4653
4672
  } else {
4673
+ const ports = targetComponent.children.filter(
4674
+ (c) => c.componentName === "Port"
4675
+ );
4676
+ const portLabel = portToken.includes(".") ? portToken.split(".").pop() ?? "" : portToken;
4677
+ const portNames = ports.map((c) => c.getNameAndAliases()).flat();
4678
+ const hasCustomLabels = portNames.some(
4679
+ (n) => !/^(pin\d+|\d+)$/.test(n)
4680
+ );
4681
+ const labelList = Array.from(new Set(portNames)).join(", ");
4682
+ let detail;
4683
+ if (ports.length === 0) {
4684
+ detail = "It has no ports";
4685
+ } else if (!hasCustomLabels) {
4686
+ detail = `It has ${ports.length} pins and no pinLabels (consider adding pinLabels)`;
4687
+ } else {
4688
+ detail = `It has [${labelList}]`;
4689
+ }
4654
4690
  this.renderError(
4655
- `Could not find port for selector "${selector}" (did you forget to include the pin name?)
4656
- searched component ${targetComponent.getString()}, which has ports: ${targetComponent.children.filter((c) => c.componentName === "Port").map(
4657
- (c) => `${c.getString()}(${c.getNameAndAliases().join(",")})`
4658
- ).join(" & ")}`
4691
+ `Could not find port for selector "${selector}". Component "${targetComponent.props.name ?? parentSelector}" found, but does not have pin "${portLabel}". ${detail}`
4659
4692
  );
4660
4693
  }
4661
4694
  }
@@ -10334,7 +10367,7 @@ import { identity as identity4 } from "transformation-matrix";
10334
10367
  var package_default = {
10335
10368
  name: "@tscircuit/core",
10336
10369
  type: "module",
10337
- version: "0.0.496",
10370
+ version: "0.0.498",
10338
10371
  types: "dist/index.d.ts",
10339
10372
  main: "dist/index.js",
10340
10373
  module: "dist/index.js",
@@ -10366,7 +10399,7 @@ var package_default = {
10366
10399
  "@tscircuit/layout": "^0.0.28",
10367
10400
  "@tscircuit/log-soup": "^1.0.2",
10368
10401
  "@tscircuit/math-utils": "^0.0.18",
10369
- "@tscircuit/props": "^0.0.237",
10402
+ "@tscircuit/props": "^0.0.238",
10370
10403
  "@tscircuit/schematic-autolayout": "^0.0.6",
10371
10404
  "@tscircuit/schematic-match-adapt": "^0.0.16",
10372
10405
  "@tscircuit/simple-3d-svg": "^0.0.6",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.497",
4
+ "version": "0.0.499",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -33,7 +33,7 @@
33
33
  "@tscircuit/layout": "^0.0.28",
34
34
  "@tscircuit/log-soup": "^1.0.2",
35
35
  "@tscircuit/math-utils": "^0.0.18",
36
- "@tscircuit/props": "^0.0.237",
36
+ "@tscircuit/props": "^0.0.238",
37
37
  "@tscircuit/schematic-autolayout": "^0.0.6",
38
38
  "@tscircuit/schematic-match-adapt": "^0.0.16",
39
39
  "@tscircuit/simple-3d-svg": "^0.0.6",