@tscircuit/core 0.0.1884 → 0.0.1886

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 +25 -8
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -56080,7 +56080,7 @@ var TEXT_BOX_ENABLED_FTYPES = /* @__PURE__ */ new Set([
56080
56080
  "simple_voltage_source",
56081
56081
  "simple_test_point"
56082
56082
  ]);
56083
- function getTextBounds({
56083
+ function getSchematicTextBounds({
56084
56084
  text,
56085
56085
  position,
56086
56086
  anchor,
@@ -56139,7 +56139,7 @@ function getSymbolTextBounds({
56139
56139
  }
56140
56140
  if (!value) continue;
56141
56141
  textBounds.push(
56142
- getTextBounds({
56142
+ getSchematicTextBounds({
56143
56143
  text: value,
56144
56144
  position: {
56145
56145
  x: primitive.x - symbol.center.x + schematicComponent.center.x,
@@ -59004,7 +59004,7 @@ import {
59004
59004
  // lib/components/primitive-components/Group/Group_doInitialSchematicTraceRender/getSchematicTextBounds.ts
59005
59005
  import { getBoundsFromPoints as getBoundsFromPoints7 } from "@tscircuit/math-utils";
59006
59006
  var DEFAULT_SCHEMATIC_TEXT_FONT_SIZE = 0.18;
59007
- function getSchematicTextBounds(text) {
59007
+ function getSchematicTextBounds2(text) {
59008
59008
  const fontSize = text.font_size ?? DEFAULT_SCHEMATIC_TEXT_FONT_SIZE;
59009
59009
  const width = getSchematicTextWidth({
59010
59010
  text: text.text ?? "",
@@ -59060,7 +59060,7 @@ function isReferenceDesignatorText(text, sourceComponent) {
59060
59060
  }
59061
59061
  function schematicTextToTextBox(text, options = {}) {
59062
59062
  if (!text.text) return null;
59063
- const bounds = getSchematicTextBounds(text);
59063
+ const bounds = getSchematicTextBounds2(text);
59064
59064
  if (isReferenceDesignatorText(text, options.sourceComponent) && options.schematicComponent?.center && options.schematicComponent?.size) {
59065
59065
  const componentBounds = getBoundFromCenteredRect5({
59066
59066
  center: options.schematicComponent.center,
@@ -61596,7 +61596,7 @@ function Group_getRoutingPhasePlans(group) {
61596
61596
  var package_default = {
61597
61597
  name: "@tscircuit/core",
61598
61598
  type: "module",
61599
- version: "0.0.1883",
61599
+ version: "0.0.1885",
61600
61600
  types: "dist/index.d.ts",
61601
61601
  main: "dist/index.js",
61602
61602
  module: "dist/index.js",
@@ -61631,7 +61631,7 @@ var package_default = {
61631
61631
  "@tscircuit/alphabet": "0.0.25",
61632
61632
  "@tscircuit/bga-fanout-solver": "github:tscircuit/bga-fanout-solver#247c835cb8d69b65e53891dcf869731079415b39",
61633
61633
  "@tscircuit/capacity-autorouter": "^0.0.892",
61634
- "@tscircuit/checks": "^0.0.187",
61634
+ "@tscircuit/checks": "^0.0.188",
61635
61635
  "@tscircuit/circuit-json-util": "^0.0.113",
61636
61636
  "@tscircuit/common": "^0.0.20",
61637
61637
  "@tscircuit/copper-pour-solver": "^0.0.54",
@@ -74683,6 +74683,18 @@ var SchematicSection = class _SchematicSection extends PrimitiveComponent2 {
74683
74683
  minY: schComp.center.y - hh,
74684
74684
  maxY: schComp.center.y + hh
74685
74685
  });
74686
+ for (const text of db.schematic_text.list({
74687
+ schematic_component_id: schematicComponentId
74688
+ })) {
74689
+ positions.push(
74690
+ getSchematicTextBounds({
74691
+ text: text.text,
74692
+ position: text.position,
74693
+ anchor: text.anchor,
74694
+ fontSize: text.font_size
74695
+ })
74696
+ );
74697
+ }
74686
74698
  }
74687
74699
  if (positions.length === 0) return null;
74688
74700
  return computeBoundsFromCellContents(positions);
@@ -74779,14 +74791,19 @@ var SchematicSection = class _SchematicSection extends PrimitiveComponent2 {
74779
74791
  if (dividersToLeft.length > 0) {
74780
74792
  leftBoundary = Math.max(...dividersToLeft);
74781
74793
  }
74794
+ const fontSize = sectionTitleFontSize ?? 0.18;
74782
74795
  db.schematic_text.insert({
74783
74796
  anchor: "top_left",
74784
74797
  text: displayName,
74785
- font_size: sectionTitleFontSize ?? 0.18,
74798
+ font_size: fontSize,
74786
74799
  color: "#000000",
74787
74800
  position: {
74788
74801
  x: leftBoundary + LABEL_PADDING,
74789
- y: topBoundary - LABEL_PADDING
74802
+ // A top-left anchor extends downwards by the title's font size.
74803
+ y: Math.max(
74804
+ topBoundary - LABEL_PADDING,
74805
+ rawBounds.maxY + LABEL_PADDING + fontSize
74806
+ )
74790
74807
  },
74791
74808
  rotation: 0,
74792
74809
  schematic_sheet_id: schematicSheetId
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1884",
4
+ "version": "0.0.1886",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -36,7 +36,7 @@
36
36
  "@tscircuit/alphabet": "0.0.25",
37
37
  "@tscircuit/bga-fanout-solver": "github:tscircuit/bga-fanout-solver#247c835cb8d69b65e53891dcf869731079415b39",
38
38
  "@tscircuit/capacity-autorouter": "^0.0.892",
39
- "@tscircuit/checks": "^0.0.187",
39
+ "@tscircuit/checks": "^0.0.188",
40
40
  "@tscircuit/circuit-json-util": "^0.0.113",
41
41
  "@tscircuit/common": "^0.0.20",
42
42
  "@tscircuit/copper-pour-solver": "^0.0.54",