@tscircuit/core 0.0.1353 → 0.0.1355

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 +34 -24
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -18096,7 +18096,15 @@ import Debug8 from "debug";
18096
18096
  import { getBoundFromCenteredRect } from "@tscircuit/math-utils";
18097
18097
  import { symbols as symbols3 } from "schematic-symbols";
18098
18098
  var SYMBOL_TEXT_FONT_SIZE = 0.18;
18099
- var TEXT_BOX_ENABLED_FTYPES = /* @__PURE__ */ new Set(["simple_resistor", "simple_capacitor"]);
18099
+ var TEXT_BOX_ENABLED_FTYPES = /* @__PURE__ */ new Set([
18100
+ "simple_resistor",
18101
+ "simple_capacitor",
18102
+ "simple_inductor",
18103
+ "simple_crystal",
18104
+ "simple_resonator",
18105
+ "simple_potentiometer",
18106
+ "simple_fuse"
18107
+ ]);
18100
18108
  function getTextBounds({
18101
18109
  text,
18102
18110
  position,
@@ -18209,19 +18217,28 @@ function getSchematicComponentWithTextBounds(db, schematicComponent) {
18209
18217
  const boxBounds = getSymbolBoxBounds(schematicComponent);
18210
18218
  const isVertical = schematicComponent.size.height > schematicComponent.size.width;
18211
18219
  if (isVertical) return textBounds;
18212
- const padX = Math.max(
18213
- boxBounds.minX - textBounds.minX,
18214
- textBounds.maxX - boxBounds.maxX
18215
- );
18216
- const padY = Math.max(
18217
- textBounds.maxY - boxBounds.maxY,
18218
- boxBounds.minY - textBounds.minY
18219
- );
18220
- return getBoundFromCenteredRect({
18221
- center: schematicComponent.center,
18222
- width: schematicComponent.size.width + 2 * padX,
18223
- height: schematicComponent.size.height + 2 * padY
18224
- });
18220
+ const padLeft = Math.max(0, boxBounds.minX - textBounds.minX);
18221
+ const padRight = Math.max(0, textBounds.maxX - boxBounds.maxX);
18222
+ const padTop = Math.max(0, textBounds.maxY - boxBounds.maxY);
18223
+ const padBottom = Math.max(0, boxBounds.minY - textBounds.minY);
18224
+ let left = padLeft;
18225
+ let right = padRight;
18226
+ if (padLeft > 0 && padRight > 0) {
18227
+ left = Math.max(padLeft, padRight);
18228
+ right = left;
18229
+ }
18230
+ let top = padTop;
18231
+ let bottom = padBottom;
18232
+ if (padTop > 0 && padBottom > 0) {
18233
+ top = Math.max(padTop, padBottom);
18234
+ bottom = top;
18235
+ }
18236
+ return {
18237
+ minX: boxBounds.minX - left,
18238
+ maxX: boxBounds.maxX + right,
18239
+ minY: boxBounds.minY - bottom,
18240
+ maxY: boxBounds.maxY + top
18241
+ };
18225
18242
  }
18226
18243
 
18227
18244
  // lib/components/primitive-components/Group/applySchematicMatchPackLayoutToTree.ts
@@ -24214,7 +24231,7 @@ import { identity as identity5 } from "transformation-matrix";
24214
24231
  var package_default = {
24215
24232
  name: "@tscircuit/core",
24216
24233
  type: "module",
24217
- version: "0.0.1352",
24234
+ version: "0.0.1354",
24218
24235
  types: "dist/index.d.ts",
24219
24236
  main: "dist/index.js",
24220
24237
  module: "dist/index.js",
@@ -24251,7 +24268,7 @@ var package_default = {
24251
24268
  "@tscircuit/checks": "0.0.138",
24252
24269
  "@tscircuit/circuit-json-util": "^0.0.96",
24253
24270
  "@tscircuit/common": "^0.0.20",
24254
- "@tscircuit/copper-pour-solver": "^0.0.29",
24271
+ "@tscircuit/copper-pour-solver": "^0.0.34",
24255
24272
  "@tscircuit/footprinter": "^0.0.357",
24256
24273
  "@tscircuit/image-utils": "^0.0.8",
24257
24274
  "@tscircuit/infer-cable-insertion-point": "^0.0.2",
@@ -28965,7 +28982,6 @@ import {
28965
28982
  convertCircuitJsonToInputProblem,
28966
28983
  initializeManifoldGeometry
28967
28984
  } from "@tscircuit/copper-pour-solver";
28968
- import { getFullConnectivityMapFromCircuitJson as getFullConnectivityMapFromCircuitJson4 } from "circuit-json-to-connectivity-map";
28969
28985
 
28970
28986
  // lib/components/primitive-components/CopperPour/utils/mark-trace-segments-inside-copper-pour.ts
28971
28987
  var EPSILON = 1e-9;
@@ -29118,16 +29134,10 @@ var CopperPour = class extends PrimitiveComponent2 {
29118
29134
  }
29119
29135
  const subcircuit = this.getSubcircuit();
29120
29136
  const circuitJson = db.toArray();
29121
- const sourceNet = circuitJson.find(
29122
- (elm) => elm.type === "source_net" && elm.name === net.name
29123
- );
29124
- const connectivityMap = getFullConnectivityMapFromCircuitJson4(circuitJson);
29125
- const connectedNetId = sourceNet?.source_net_id ?? net.source_net_id;
29126
- const pourConnectivityKey = (connectedNetId ? connectivityMap.getNetConnectedToId(connectedNetId) : void 0) || sourceNet?.subcircuit_connectivity_map_key || "";
29127
29137
  const clearance = props.clearance ?? 0.2;
29128
29138
  const inputProblem = convertCircuitJsonToInputProblem(circuitJson, {
29129
29139
  layer: props.layer,
29130
- pour_connectivity_key: pourConnectivityKey,
29140
+ source_net_id: net.source_net_id,
29131
29141
  pad_margin: props.padMargin ?? clearance,
29132
29142
  trace_margin: props.traceMargin ?? clearance,
29133
29143
  board_edge_margin: props.boardEdgeMargin ?? clearance,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1353",
4
+ "version": "0.0.1355",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -38,7 +38,7 @@
38
38
  "@tscircuit/checks": "0.0.138",
39
39
  "@tscircuit/circuit-json-util": "^0.0.96",
40
40
  "@tscircuit/common": "^0.0.20",
41
- "@tscircuit/copper-pour-solver": "^0.0.29",
41
+ "@tscircuit/copper-pour-solver": "^0.0.34",
42
42
  "@tscircuit/footprinter": "^0.0.357",
43
43
  "@tscircuit/image-utils": "^0.0.8",
44
44
  "@tscircuit/infer-cable-insertion-point": "^0.0.2",