circuit-to-svg 0.0.163 → 0.0.164

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.js CHANGED
@@ -1866,8 +1866,16 @@ import { applyToPoint as applyToPoint21 } from "transformation-matrix";
1866
1866
 
1867
1867
  // lib/utils/get-sch-font-size.ts
1868
1868
  import "transformation-matrix";
1869
+ var fontSizeMap = {
1870
+ pin_number: 0.15,
1871
+ negated_pin_number: 0.15 * 0.8,
1872
+ reference_designator: 0.18,
1873
+ manufacturer_number: 0.18,
1874
+ net_label: 0.18,
1875
+ error: 0.05
1876
+ };
1869
1877
  var getSchMmFontSize = (textType, fontSize) => {
1870
- return textType === "error" ? 0.05 : textType === "pin_number" ? 0.15 : fontSize ? fontSize : 0.18;
1878
+ return fontSize ?? fontSizeMap[textType];
1871
1879
  };
1872
1880
  var getSchScreenFontSize = (transform, textType, fontSize) => {
1873
1881
  return Math.abs(transform.a) * getSchMmFontSize(textType, fontSize);
@@ -4432,6 +4440,10 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
4432
4440
  if (!label) return [];
4433
4441
  const isNegated = label.startsWith("N_");
4434
4442
  const displayLabel = isNegated ? label.slice(2) : label;
4443
+ let fontSizePx = getSchScreenFontSize(
4444
+ transform,
4445
+ isNegated ? "negated_pin_number" : "pin_number"
4446
+ );
4435
4447
  svgObjects.push({
4436
4448
  name: "text",
4437
4449
  type: "element",
@@ -4443,7 +4455,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
4443
4455
  fill: colorMap.schematic.pin_number,
4444
4456
  "text-anchor": schPort.side_of_component === "left" || schPort.side_of_component === "bottom" ? "start" : "end",
4445
4457
  "dominant-baseline": "middle",
4446
- "font-size": `${getSchScreenFontSize(transform, "pin_number")}px`,
4458
+ "font-size": `${fontSizePx}px`,
4447
4459
  transform: schPort.side_of_component === "top" || schPort.side_of_component === "bottom" ? `rotate(-90 ${screenPinNumberTextPos.x} ${screenPinNumberTextPos.y})` : ""
4448
4460
  },
4449
4461
  children: [
@@ -5220,8 +5232,7 @@ var createSvgObjectsForSchNetLabel = ({
5220
5232
  colorMap: colorMap2
5221
5233
  }) => {
5222
5234
  if (!schNetLabel.text) return [];
5223
- const isNegated = schNetLabel.text.startsWith("N_");
5224
- const labelText = isNegated ? schNetLabel.text.slice(2) : schNetLabel.text;
5235
+ const labelText = schNetLabel.text;
5225
5236
  if (schNetLabel.symbol_name) {
5226
5237
  return createSvgObjectsForSchNetLabelWithSymbol({
5227
5238
  schNetLabel,
@@ -5341,8 +5352,7 @@ var createSvgObjectsForSchNetLabel = ({
5341
5352
  "font-family": "sans-serif",
5342
5353
  "font-variant-numeric": "tabular-nums",
5343
5354
  "font-size": `${fontSizePx}px`,
5344
- transform: textTransformString,
5345
- ...isNegated ? { style: "text-decoration: overline;" } : {}
5355
+ transform: textTransformString
5346
5356
  },
5347
5357
  children: [
5348
5358
  {