circuit-to-svg 0.0.267 → 0.0.269

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
@@ -3963,7 +3963,7 @@ function getSoftwareUsedString(circuitJson) {
3963
3963
  var package_default = {
3964
3964
  name: "circuit-to-svg",
3965
3965
  type: "module",
3966
- version: "0.0.266",
3966
+ version: "0.0.268",
3967
3967
  description: "Convert Circuit JSON to SVG",
3968
3968
  main: "dist/index.js",
3969
3969
  files: [
@@ -3987,7 +3987,7 @@ var package_default = {
3987
3987
  "bun-match-svg": "^0.0.12",
3988
3988
  esbuild: "^0.20.2",
3989
3989
  "performance-now": "^2.1.0",
3990
- "circuit-json": "^0.0.308",
3990
+ "circuit-json": "^0.0.309",
3991
3991
  react: "19.1.0",
3992
3992
  "react-cosmos": "7.0.0",
3993
3993
  "react-cosmos-plugin-vite": "7.0.0",
@@ -8914,6 +8914,60 @@ function createSvgObjectsFromSchVoltageProbe({
8914
8914
  `L ${tipX - arrowWidth * Math.cos((-50 + 210) * Math.PI / 180)},${tipY - arrowWidth * Math.sin((-50 + 210) * Math.PI / 180)}`,
8915
8915
  "Z"
8916
8916
  ].join(" ");
8917
+ const x = (baseX + 8 - (baseX - baseX)).toString();
8918
+ const textChildren = [];
8919
+ if (probe.name && probe.voltage !== void 0) {
8920
+ textChildren.push({
8921
+ type: "element",
8922
+ name: "tspan",
8923
+ value: "",
8924
+ attributes: {
8925
+ x
8926
+ },
8927
+ children: [
8928
+ {
8929
+ type: "text",
8930
+ value: probe.name,
8931
+ name: "",
8932
+ attributes: {},
8933
+ children: []
8934
+ }
8935
+ ]
8936
+ });
8937
+ textChildren.push({
8938
+ type: "element",
8939
+ name: "tspan",
8940
+ value: "",
8941
+ attributes: {
8942
+ x,
8943
+ dy: "1.2em"
8944
+ },
8945
+ children: [
8946
+ {
8947
+ type: "text",
8948
+ value: `${probe.voltage}V`,
8949
+ name: "",
8950
+ attributes: {},
8951
+ children: []
8952
+ }
8953
+ ]
8954
+ });
8955
+ } else {
8956
+ const textParts = [];
8957
+ if (probe.name) {
8958
+ textParts.push(probe.name);
8959
+ }
8960
+ if (probe.voltage !== void 0) {
8961
+ textParts.push(`${probe.voltage}V`);
8962
+ }
8963
+ textChildren.push({
8964
+ type: "text",
8965
+ value: textParts.join(" "),
8966
+ name: "",
8967
+ attributes: {},
8968
+ children: []
8969
+ });
8970
+ }
8917
8971
  return [
8918
8972
  {
8919
8973
  name: "path",
@@ -8932,25 +8986,17 @@ function createSvgObjectsFromSchVoltageProbe({
8932
8986
  name: "text",
8933
8987
  value: "",
8934
8988
  attributes: {
8935
- x: (baseX + 8 - (baseX - baseX)).toString(),
8936
- y: (baseY - 10 + (baseY - baseY)).toString(),
8989
+ x,
8990
+ y: baseY.toString(),
8937
8991
  fill: colorMap2.schematic.reference,
8938
- "text-anchor": "middle",
8992
+ "text-anchor": "start",
8939
8993
  "dominant-baseline": "middle",
8940
8994
  "font-family": "sans-serif",
8941
8995
  "font-size": `${getSchScreenFontSize(transform, "reference_designator")}px`,
8942
8996
  "font-weight": "bold",
8943
8997
  "data-schematic-voltage-probe-id": probe.schematic_voltage_probe_id
8944
8998
  },
8945
- children: [
8946
- {
8947
- type: "text",
8948
- value: probe.voltage ? `${probe.voltage}V` : "",
8949
- name: "",
8950
- attributes: {},
8951
- children: []
8952
- }
8953
- ]
8999
+ children: textChildren
8954
9000
  }
8955
9001
  ];
8956
9002
  }