@tscircuit/core 0.0.1340 → 0.0.1342

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
@@ -1715,6 +1715,15 @@ declare abstract class PrimitiveComponent<ZodProps extends ZodType = any> extend
1715
1715
  getGroup(): IGroup | null;
1716
1716
  doInitialAssignNameToUnnamedComponents(): void;
1717
1717
  doInitialOptimizeSelectorCache(): void;
1718
+ /**
1719
+ * The selector caches memoize results assuming the component tree is stable.
1720
+ * When the tree changes after the cache is first built (e.g. a connector adds
1721
+ * its ports asynchronously once a parts-engine fetch resolves), this phase is
1722
+ * re-marked dirty via _markDirty and re-runs as an update. Drop the stale
1723
+ * memoized results so later queries see the current tree, then re-warm the
1724
+ * subcircuit cache.
1725
+ */
1726
+ updateOptimizeSelectorCache(): void;
1718
1727
  _cachedSelectAllQueries: Map<string, PrimitiveComponent[]>;
1719
1728
  selectAll<T extends PrimitiveComponent = PrimitiveComponent>(selectorRaw: string): T[];
1720
1729
  _cachedSelectOneQueries: Map<string, PrimitiveComponent | null>;
package/dist/index.js CHANGED
@@ -2039,6 +2039,19 @@ var PrimitiveComponent2 = class extends Renderable {
2039
2039
  }
2040
2040
  }
2041
2041
  }
2042
+ /**
2043
+ * The selector caches memoize results assuming the component tree is stable.
2044
+ * When the tree changes after the cache is first built (e.g. a connector adds
2045
+ * its ports asynchronously once a parts-engine fetch resolves), this phase is
2046
+ * re-marked dirty via _markDirty and re-runs as an update. Drop the stale
2047
+ * memoized results so later queries see the current tree, then re-warm the
2048
+ * subcircuit cache.
2049
+ */
2050
+ updateOptimizeSelectorCache() {
2051
+ this._cachedSelectAllQueries.clear();
2052
+ this._cachedSelectOneQueries.clear();
2053
+ this.doInitialOptimizeSelectorCache();
2054
+ }
2042
2055
  _cachedSelectAllQueries = /* @__PURE__ */ new Map();
2043
2056
  selectAll(selectorRaw) {
2044
2057
  if (this._cachedSelectAllQueries.has(selectorRaw)) {
@@ -18078,7 +18091,7 @@ import Debug8 from "debug";
18078
18091
  import { getBoundFromCenteredRect } from "@tscircuit/math-utils";
18079
18092
  import { symbols as symbols3 } from "schematic-symbols";
18080
18093
  var SYMBOL_TEXT_FONT_SIZE = 0.18;
18081
- var TEXT_BOX_ENABLED_FTYPES = /* @__PURE__ */ new Set(["simple_resistor"]);
18094
+ var TEXT_BOX_ENABLED_FTYPES = /* @__PURE__ */ new Set(["simple_resistor", "simple_capacitor"]);
18082
18095
  function getTextBounds({
18083
18096
  text,
18084
18097
  position,
@@ -19789,6 +19802,11 @@ function extendTraceEndpointsToReachPinsInsideExpandedBoundingBox(params, db) {
19789
19802
  const result = points.map((p) => ({ x: p.x, y: p.y }));
19790
19803
  const d2 = (a, b) => (a.x - b.x) ** 2 + (a.y - b.y) ** 2;
19791
19804
  const usedCenters = /* @__PURE__ */ new Set();
19805
+ for (let i = 0; i < centers.length; i++) {
19806
+ if (result.some((p) => d2(centers[i], p) <= 1e-12)) {
19807
+ usedCenters.add(i);
19808
+ }
19809
+ }
19792
19810
  const snap = (endpoint) => {
19793
19811
  const pt = endpoint === "start" ? result[0] : result[result.length - 1];
19794
19812
  let bestIndex = -1;
@@ -24034,7 +24052,7 @@ import { identity as identity5 } from "transformation-matrix";
24034
24052
  var package_default = {
24035
24053
  name: "@tscircuit/core",
24036
24054
  type: "module",
24037
- version: "0.0.1339",
24055
+ version: "0.0.1341",
24038
24056
  types: "dist/index.d.ts",
24039
24057
  main: "dist/index.js",
24040
24058
  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.1340",
4
+ "version": "0.0.1342",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",