@tscircuit/core 0.0.813 → 0.0.815

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
@@ -19025,6 +19025,7 @@ declare class FabricationNoteDimension extends PrimitiveComponent<typeof fabrica
19025
19025
  width: number;
19026
19026
  height: number;
19027
19027
  };
19028
+ private _formatDistanceText;
19028
19029
  }
19029
19030
 
19030
19031
  declare class PcbNoteLine extends PrimitiveComponent<typeof pcbNoteLineProps> {
@@ -19536,6 +19537,7 @@ declare class PcbNoteDimension extends PrimitiveComponent<typeof pcbNoteDimensio
19536
19537
  width: number;
19537
19538
  height: number;
19538
19539
  };
19540
+ private _formatDistanceText;
19539
19541
  }
19540
19542
 
19541
19543
  declare class Footprint extends PrimitiveComponent<typeof footprintProps> {
package/dist/index.js CHANGED
@@ -14929,6 +14929,7 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
14929
14929
  );
14930
14930
  }
14931
14931
  const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id;
14932
+ const text = props.text ?? this._formatDistanceText({ from, to });
14932
14933
  const fabrication_note_dimension = db.pcb_fabrication_note_dimension.insert(
14933
14934
  {
14934
14935
  pcb_component_id,
@@ -14937,7 +14938,7 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
14937
14938
  layer,
14938
14939
  from,
14939
14940
  to,
14940
- text: props.text,
14941
+ text,
14941
14942
  offset: props.offset,
14942
14943
  font: props.font ?? "tscircuit2024",
14943
14944
  font_size: props.fontSize ?? 1,
@@ -14956,6 +14957,18 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
14956
14957
  height: Math.abs(to.y - from.y)
14957
14958
  };
14958
14959
  }
14960
+ _formatDistanceText({
14961
+ from,
14962
+ to
14963
+ }) {
14964
+ const dx = to.x - from.x;
14965
+ const dy = to.y - from.y;
14966
+ const distance6 = Math.sqrt(dx * dx + dy * dy);
14967
+ const roundedDistance = Math.round(distance6);
14968
+ const isWholeNumber = Math.abs(distance6 - roundedDistance) < 1e-9;
14969
+ const valueText = isWholeNumber ? `${roundedDistance}` : distance6.toFixed(2);
14970
+ return `${valueText}mm`;
14971
+ }
14959
14972
  };
14960
14973
 
14961
14974
  // lib/components/primitive-components/PcbNoteLine.ts
@@ -15182,13 +15195,14 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
15182
15195
  const subcircuit = this.getSubcircuit();
15183
15196
  const group = this.getGroup();
15184
15197
  const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id ?? void 0;
15198
+ const text = props.text ?? this._formatDistanceText({ from, to });
15185
15199
  const pcb_note_dimension = db.pcb_note_dimension.insert({
15186
15200
  pcb_component_id,
15187
15201
  subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
15188
15202
  pcb_group_id: group?.pcb_group_id ?? void 0,
15189
15203
  from,
15190
15204
  to,
15191
- text: props.text,
15205
+ text,
15192
15206
  font: props.font ?? "tscircuit2024",
15193
15207
  font_size: props.fontSize ?? 1,
15194
15208
  color: props.color,
@@ -15205,6 +15219,18 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
15205
15219
  height: Math.abs(to.y - from.y)
15206
15220
  };
15207
15221
  }
15222
+ _formatDistanceText({
15223
+ from,
15224
+ to
15225
+ }) {
15226
+ const dx = to.x - from.x;
15227
+ const dy = to.y - from.y;
15228
+ const distance6 = Math.sqrt(dx * dx + dy * dy);
15229
+ const roundedDistance = Math.round(distance6);
15230
+ const isWholeNumber = Math.abs(distance6 - roundedDistance) < 1e-9;
15231
+ const valueText = isWholeNumber ? `${roundedDistance}` : distance6.toFixed(2);
15232
+ return `${valueText}mm`;
15233
+ }
15208
15234
  };
15209
15235
 
15210
15236
  // lib/components/primitive-components/Group/Subcircuit.ts
@@ -17227,7 +17253,7 @@ import { identity as identity6 } from "transformation-matrix";
17227
17253
  var package_default = {
17228
17254
  name: "@tscircuit/core",
17229
17255
  type: "module",
17230
- version: "0.0.812",
17256
+ version: "0.0.814",
17231
17257
  types: "dist/index.d.ts",
17232
17258
  main: "dist/index.js",
17233
17259
  module: "dist/index.js",
@@ -17327,7 +17353,7 @@ var package_default = {
17327
17353
  dependencies: {
17328
17354
  "@flatten-js/core": "^1.6.2",
17329
17355
  "@lume/kiwi": "^0.4.3",
17330
- "calculate-packing": "0.0.49",
17356
+ "calculate-packing": "0.0.50",
17331
17357
  "css-select": "5.1.0",
17332
17358
  "format-si-unit": "^0.0.3",
17333
17359
  nanoid: "^5.0.7",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.813",
4
+ "version": "0.0.815",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -101,7 +101,7 @@
101
101
  "dependencies": {
102
102
  "@flatten-js/core": "^1.6.2",
103
103
  "@lume/kiwi": "^0.4.3",
104
- "calculate-packing": "0.0.49",
104
+ "calculate-packing": "0.0.50",
105
105
  "css-select": "5.1.0",
106
106
  "format-si-unit": "^0.0.3",
107
107
  "nanoid": "^5.0.7",