circuit-to-svg 0.0.181 → 0.0.183

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
@@ -1495,7 +1495,7 @@ function getSoftwareUsedString(circuitJson) {
1495
1495
  var package_default = {
1496
1496
  name: "circuit-to-svg",
1497
1497
  type: "module",
1498
- version: "0.0.180",
1498
+ version: "0.0.182",
1499
1499
  description: "Convert Circuit JSON to SVG",
1500
1500
  main: "dist/index.js",
1501
1501
  files: [
@@ -1520,9 +1520,10 @@ var package_default = {
1520
1520
  esbuild: "^0.20.2",
1521
1521
  "performance-now": "^2.1.0",
1522
1522
  react: "19.1.0",
1523
+ "react-dom": "19.1.0",
1523
1524
  "react-cosmos": "7.0.0",
1524
1525
  "react-cosmos-plugin-vite": "7.0.0",
1525
- tscircuit: "^0.0.609",
1526
+ tscircuit: "^0.0.617",
1526
1527
  tsup: "^8.0.2",
1527
1528
  typescript: "^5.4.5",
1528
1529
  "vite-tsconfig-paths": "^5.0.1"
@@ -4694,10 +4695,10 @@ var createSvgObjectsForSchPortBoxLine = ({
4694
4695
  });
4695
4696
  const { has_input_arrow, has_output_arrow } = schPort;
4696
4697
  if ((has_input_arrow || has_output_arrow) && schPort.side_of_component) {
4697
- const arrowSize = Math.abs(transform.a) * 0.15;
4698
+ const arrowSize = Math.abs(transform.a) * 0.1;
4698
4699
  const arrowColor = colorMap.schematic.component_outline;
4699
4700
  const arrowAxialLength = arrowSize * Math.cos(Math.PI / 6);
4700
- const strokeWidth = getSchStrokeSize(transform) / 2;
4701
+ const strokeWidth = getSchStrokeSize(transform) / 3;
4701
4702
  let inputAngleRads = 0;
4702
4703
  let outputAngleRads = 0;
4703
4704
  if (schPort.side_of_component === "left") {
@@ -5370,7 +5371,10 @@ function createSchematicTrace({
5370
5371
  class: "trace",
5371
5372
  "data-layer": "base",
5372
5373
  "data-circuit-json-type": "schematic_trace",
5373
- "data-schematic-trace-id": trace.schematic_trace_id
5374
+ "data-schematic-trace-id": trace.schematic_trace_id,
5375
+ ...trace.subcircuit_connectivity_map_key && {
5376
+ "data-subcircuit-connectivity-map-key": trace.subcircuit_connectivity_map_key
5377
+ }
5374
5378
  },
5375
5379
  children: baseObjects
5376
5380
  },
@@ -5382,7 +5386,10 @@ function createSchematicTrace({
5382
5386
  class: "trace-overlays",
5383
5387
  "data-layer": "overlay",
5384
5388
  "data-circuit-json-type": "schematic_trace",
5385
- "data-schematic-trace-id": trace.schematic_trace_id
5389
+ "data-schematic-trace-id": trace.schematic_trace_id,
5390
+ ...trace.subcircuit_connectivity_map_key && {
5391
+ "data-subcircuit-connectivity-map-key": trace.subcircuit_connectivity_map_key
5392
+ }
5386
5393
  },
5387
5394
  children: overlayObjects
5388
5395
  }
@@ -6067,6 +6074,23 @@ var createSvgObjectsForSchComponentPortHovers = ({
6067
6074
  };
6068
6075
 
6069
6076
  // lib/sch/convert-circuit-json-to-schematic-svg.ts
6077
+ function buildNetHoverStyles(connectivityKeys) {
6078
+ const rules = [];
6079
+ const esc = (v) => String(v).replace(/"/g, '\\"');
6080
+ for (const key of connectivityKeys) {
6081
+ const k = esc(key);
6082
+ const keyAttr = `[data-subcircuit-connectivity-map-key="${k}"]`;
6083
+ const baseSel = `g.trace${keyAttr}`;
6084
+ const overlaySel = `g.trace-overlays${keyAttr}`;
6085
+ const hovered = `:is(${baseSel}, ${overlaySel}):hover`;
6086
+ const target = `:is(${baseSel}, ${overlaySel})`;
6087
+ rules.push(`svg:has(${hovered}) ${target} { filter: invert(1); }`);
6088
+ rules.push(
6089
+ `svg:has(${hovered}) ${overlaySel} .trace-crossing-outline { opacity: 0; }`
6090
+ );
6091
+ }
6092
+ return rules.join("\n");
6093
+ }
6070
6094
  function convertCircuitJsonToSchematicSvg(circuitJson, options) {
6071
6095
  const realBounds = getSchematicBoundsFromCircuitJson(circuitJson);
6072
6096
  const realWidth = realBounds.maxX - realBounds.minX;
@@ -6132,6 +6156,7 @@ function convertCircuitJsonToSchematicSvg(circuitJson, options) {
6132
6156
  const schDebugObjectSvgs = [];
6133
6157
  const schComponentSvgs = [];
6134
6158
  const schTraceSvgs = [];
6159
+ const connectivityKeys = /* @__PURE__ */ new Set();
6135
6160
  const schNetLabel = [];
6136
6161
  const schText = [];
6137
6162
  const voltageProbeSvgs = [];
@@ -6178,6 +6203,7 @@ function convertCircuitJsonToSchematicSvg(circuitJson, options) {
6178
6203
  colorMap: colorMap2
6179
6204
  })
6180
6205
  );
6206
+ connectivityKeys.add(elm.subcircuit_connectivity_map_key);
6181
6207
  } else if (elm.type === "schematic_net_label") {
6182
6208
  schNetLabel.push(
6183
6209
  ...createSvgObjectsForSchNetLabel({
@@ -6273,6 +6299,7 @@ function convertCircuitJsonToSchematicSvg(circuitJson, options) {
6273
6299
  .component { fill: none; stroke: ${colorMap2.schematic.component_outline}; }
6274
6300
  .chip { fill: ${colorMap2.schematic.component_body}; stroke: ${colorMap2.schematic.component_outline}; }
6275
6301
  .component-pin { fill: none; stroke: ${colorMap2.schematic.component_outline}; }
6302
+ /* Basic per-trace hover fallback */
6276
6303
  .trace:hover {
6277
6304
  filter: invert(1);
6278
6305
  }
@@ -6282,6 +6309,10 @@ function convertCircuitJsonToSchematicSvg(circuitJson, options) {
6282
6309
  .trace:hover .trace-junction {
6283
6310
  filter: invert(1);
6284
6311
  }
6312
+ /* Net-hover highlighting: when a trace or its overlays are hovered,
6313
+ invert color for all traces (base + overlays) sharing the same
6314
+ subcircuit connectivity key. Also hide crossing outline during hover. */
6315
+ ${buildNetHoverStyles(connectivityKeys)}
6285
6316
  .text { font-family: sans-serif; fill: ${colorMap2.schematic.wire}; }
6286
6317
  .pin-number { fill: ${colorMap2.schematic.pin_number}; }
6287
6318
  .port-label { fill: ${colorMap2.schematic.reference}; }