@tscircuit/core 0.0.1004 → 0.0.1006

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 +51 -5
  2. package/package.json +5 -4
package/dist/index.js CHANGED
@@ -1666,6 +1666,45 @@ var ErrorPlaceholderComponent = class extends PrimitiveComponent2 {
1666
1666
  schY: props.schY
1667
1667
  };
1668
1668
  }
1669
+ formatErrorDetails() {
1670
+ const selectorValue = this._parsedProps.selector ?? this._parsedProps.selectors ?? this._parsedProps.in ?? this._parsedProps.within;
1671
+ const selectorText = selectorValue === void 0 ? void 0 : typeof selectorValue === "string" ? selectorValue : this.safeStringify(selectorValue);
1672
+ const propsText = this.safeStringify(this._parsedProps);
1673
+ return {
1674
+ selectorText,
1675
+ propsText
1676
+ };
1677
+ }
1678
+ safeStringify(value) {
1679
+ const seen = /* @__PURE__ */ new WeakSet();
1680
+ const json = JSON.stringify(
1681
+ value,
1682
+ (_key, item) => {
1683
+ if (typeof item === "bigint") {
1684
+ return item.toString();
1685
+ }
1686
+ if (typeof item === "function") {
1687
+ return `[Function ${item.name || "anonymous"}]`;
1688
+ }
1689
+ if (typeof item === "symbol") {
1690
+ return item.toString();
1691
+ }
1692
+ if (typeof item === "object" && item !== null) {
1693
+ if (seen.has(item)) return "[Circular]";
1694
+ seen.add(item);
1695
+ }
1696
+ return item;
1697
+ },
1698
+ 2
1699
+ );
1700
+ if (!json) {
1701
+ return "undefined";
1702
+ }
1703
+ if (json.length > 2e3) {
1704
+ return `${json.slice(0, 2e3)}\u2026`;
1705
+ }
1706
+ return json;
1707
+ }
1669
1708
  get config() {
1670
1709
  return {
1671
1710
  componentName: "ErrorPlaceholder",
@@ -1676,10 +1715,16 @@ var ErrorPlaceholderComponent = class extends PrimitiveComponent2 {
1676
1715
  if (this.root?.db) {
1677
1716
  const pcbPosition = this._getGlobalPcbPositionBeforeLayout();
1678
1717
  const schematicPosition = this._getGlobalSchematicPositionBeforeLayout();
1718
+ const { selectorText, propsText } = this.formatErrorDetails();
1719
+ const messageDetails = [
1720
+ selectorText ? `Within selector: ${selectorText}` : null,
1721
+ `Props: ${propsText}`
1722
+ ].filter(Boolean).join(" ");
1723
+ const baseMessage = `Could not create ${this._parsedProps.componentType ?? "component"}${this._parsedProps.name ? ` "${this._parsedProps.name}"` : ""}. ${this._parsedProps.error?.formattedError?._errors?.join("; ") || this._parsedProps.message}`;
1679
1724
  this.root.db.source_failed_to_create_component_error.insert({
1680
1725
  component_name: this._parsedProps.component_name,
1681
1726
  error_type: "source_failed_to_create_component_error",
1682
- message: `Could not create ${this._parsedProps.componentType ?? "component"}${this._parsedProps.name ? ` "${this._parsedProps.name}"` : ""}. ${this._parsedProps.error?.formattedError?._errors?.join("; ") || this._parsedProps.message}`,
1727
+ message: `${baseMessage}${messageDetails ? ` Details: ${messageDetails}` : ""}`,
1683
1728
  pcb_center: pcbPosition,
1684
1729
  schematic_center: schematicPosition
1685
1730
  });
@@ -21700,7 +21745,7 @@ import { identity as identity5 } from "transformation-matrix";
21700
21745
  var package_default = {
21701
21746
  name: "@tscircuit/core",
21702
21747
  type: "module",
21703
- version: "0.0.1003",
21748
+ version: "0.0.1005",
21704
21749
  types: "dist/index.d.ts",
21705
21750
  main: "dist/index.js",
21706
21751
  module: "dist/index.js",
@@ -21731,6 +21776,7 @@ var package_default = {
21731
21776
  devDependencies: {
21732
21777
  "@biomejs/biome": "^1.8.3",
21733
21778
  "@resvg/resvg-js": "^2.6.2",
21779
+ "@tscircuit/alphabet": "0.0.18",
21734
21780
  "@tscircuit/capacity-autorouter": "^0.0.264",
21735
21781
  "@tscircuit/checks": "^0.0.87",
21736
21782
  "@tscircuit/circuit-json-util": "^0.0.77",
@@ -21747,6 +21793,7 @@ var package_default = {
21747
21793
  "@tscircuit/schematic-match-adapt": "^0.0.16",
21748
21794
  "@tscircuit/schematic-trace-solver": "^v0.0.45",
21749
21795
  "@tscircuit/solver-utils": "^0.0.3",
21796
+ "@tscircuit/soup-util": "^0.0.41",
21750
21797
  "@types/bun": "^1.2.16",
21751
21798
  "@types/debug": "^4.1.12",
21752
21799
  "@types/react": "^19.1.8",
@@ -21762,7 +21809,7 @@ var package_default = {
21762
21809
  "circuit-json-to-gltf": "^0.0.62",
21763
21810
  "circuit-json-to-simple-3d": "^0.0.9",
21764
21811
  "circuit-json-to-spice": "^0.0.33",
21765
- "circuit-to-svg": "^0.0.319",
21812
+ "circuit-to-svg": "^0.0.321",
21766
21813
  concurrently: "^9.1.2",
21767
21814
  "connectivity-map": "^1.0.0",
21768
21815
  debug: "^4.3.6",
@@ -21780,8 +21827,7 @@ var package_default = {
21780
21827
  "schematic-symbols": "^0.0.208",
21781
21828
  spicey: "^0.0.14",
21782
21829
  "ts-expect": "^1.3.0",
21783
- tsup: "^8.2.4",
21784
- "@tscircuit/soup-util": "^0.0.41"
21830
+ tsup: "^8.2.4"
21785
21831
  },
21786
21832
  peerDependencies: {
21787
21833
  "@tscircuit/capacity-autorouter": "*",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1004",
4
+ "version": "0.0.1006",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -32,6 +32,7 @@
32
32
  "devDependencies": {
33
33
  "@biomejs/biome": "^1.8.3",
34
34
  "@resvg/resvg-js": "^2.6.2",
35
+ "@tscircuit/alphabet": "0.0.18",
35
36
  "@tscircuit/capacity-autorouter": "^0.0.264",
36
37
  "@tscircuit/checks": "^0.0.87",
37
38
  "@tscircuit/circuit-json-util": "^0.0.77",
@@ -48,6 +49,7 @@
48
49
  "@tscircuit/schematic-match-adapt": "^0.0.16",
49
50
  "@tscircuit/schematic-trace-solver": "^v0.0.45",
50
51
  "@tscircuit/solver-utils": "^0.0.3",
52
+ "@tscircuit/soup-util": "^0.0.41",
51
53
  "@types/bun": "^1.2.16",
52
54
  "@types/debug": "^4.1.12",
53
55
  "@types/react": "^19.1.8",
@@ -63,7 +65,7 @@
63
65
  "circuit-json-to-gltf": "^0.0.62",
64
66
  "circuit-json-to-simple-3d": "^0.0.9",
65
67
  "circuit-json-to-spice": "^0.0.33",
66
- "circuit-to-svg": "^0.0.319",
68
+ "circuit-to-svg": "^0.0.321",
67
69
  "concurrently": "^9.1.2",
68
70
  "connectivity-map": "^1.0.0",
69
71
  "debug": "^4.3.6",
@@ -81,8 +83,7 @@
81
83
  "schematic-symbols": "^0.0.208",
82
84
  "spicey": "^0.0.14",
83
85
  "ts-expect": "^1.3.0",
84
- "tsup": "^8.2.4",
85
- "@tscircuit/soup-util": "^0.0.41"
86
+ "tsup": "^8.2.4"
86
87
  },
87
88
  "peerDependencies": {
88
89
  "@tscircuit/capacity-autorouter": "*",