unifi-network-maps 1.4.6__py3-none-any.whl → 1.4.7__py3-none-any.whl

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.
@@ -1 +1 @@
1
- __version__ = "1.4.6"
1
+ __version__ = "1.4.7"
@@ -609,9 +609,13 @@ def _render_svg_nodes(
609
609
  node_type = node_types.get(name, "other")
610
610
  fill, stroke = _TYPE_COLORS.get(node_type, _TYPE_COLORS["other"])
611
611
  fill = f"url(#node-{node_type})"
612
- extra_attrs = _svg_node_attrs(node_data, name)
613
- if extra_attrs:
614
- lines.append(f"<g{extra_attrs}>")
612
+ group_attrs = _svg_node_group_attrs(node_data, name, node_type)
613
+ lines.append(f"<g{group_attrs}>")
614
+ lines.append(f"<title>{_escape_text(name)}</title>")
615
+ lines.append(
616
+ f'<rect x="{x}" y="{y}" width="{options.node_width}" height="{options.node_height}" '
617
+ 'fill="transparent" pointer-events="all" class="node-hitbox"/>'
618
+ )
615
619
  lines.append(
616
620
  f'<rect x="{x}" y="{y}" width="{options.node_width}" height="{options.node_height}" '
617
621
  f'rx="6" ry="6" fill="{fill}" stroke="{stroke}" stroke-width="1"/>'
@@ -649,16 +653,25 @@ def _render_svg_nodes(
649
653
  lines.append(
650
654
  f'<text x="{text_x}" y="{text_y}" fill="#1f1f1f" text-anchor="start">{safe_name}</text>'
651
655
  )
652
- if extra_attrs:
653
- lines.append("</g>")
656
+ lines.append("</g>")
654
657
 
655
658
 
656
- def _svg_node_attrs(node_data: dict[str, dict[str, str]] | None, name: str) -> str:
657
- if not node_data:
658
- return ""
659
- attrs = node_data.get(name)
660
- if not attrs:
661
- return ""
659
+ def _svg_node_group_attrs(
660
+ node_data: dict[str, dict[str, str]] | None,
661
+ name: str,
662
+ node_type: str,
663
+ ) -> str:
664
+ attrs: dict[str, str] = {
665
+ "class": "unm-node",
666
+ "data-node-id": name,
667
+ "data-node-type": node_type,
668
+ }
669
+ if node_data and (extra := node_data.get(name)):
670
+ for key, value in extra.items():
671
+ if key == "class":
672
+ attrs["class"] = f"{attrs['class']} {value}".strip()
673
+ else:
674
+ attrs[key] = value
662
675
  rendered = [f' {key}="{_escape_attr(value, quote=True)}"' for key, value in attrs.items()]
663
676
  return "".join(rendered)
664
677
 
@@ -1050,7 +1063,14 @@ def _render_iso_node(
1050
1063
  node_depth = 0.0
1051
1064
  tile_w = layout.tile_width
1052
1065
  tile_h = layout.tile_height
1066
+ group_attrs = _svg_node_group_attrs(None, name, node_type)
1067
+ lines.append(f"<g{group_attrs}>")
1068
+ lines.append(f"<title>{_escape_text(name)}</title>")
1053
1069
  top, left, right = _iso_node_polygons(x, y, tile_w, tile_h, node_depth)
1070
+ lines.append(
1071
+ f'<polygon points="{_points_to_svg(top)}" fill="transparent" '
1072
+ 'pointer-events="all" class="node-hitbox"/>'
1073
+ )
1054
1074
  left_fill = "#d0d0d0" if node_type == "other" else "#dcdcdc"
1055
1075
  right_fill = "#c2c2c2" if node_type == "other" else "#c8c8c8"
1056
1076
  _iso_render_faces(
@@ -1116,6 +1136,7 @@ def _render_iso_node(
1116
1136
  f'<text x="{name_x}" y="{name_y}" text-anchor="middle" fill="#1f1f1f" '
1117
1137
  f'font-size="{name_font_size}" transform="{name_transform}">{_escape_text(name)}</text>'
1118
1138
  )
1139
+ lines.append("</g>")
1119
1140
 
1120
1141
 
1121
1142
  def _render_iso_nodes(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unifi-network-maps
3
- Version: 1.4.6
3
+ Version: 1.4.7
4
4
  Summary: Dynamic UniFi -> network maps in mermaid or svg
5
5
  Author: Merlijn
6
6
  License-Expression: MIT
@@ -25,7 +25,7 @@ Requires-Dist: python-dotenv==1.2.1
25
25
  Requires-Dist: PyYAML==6.0.3
26
26
  Requires-Dist: Jinja2==3.1.6
27
27
  Provides-Extra: dev
28
- Requires-Dist: Faker==40.1.0; extra == "dev"
28
+ Requires-Dist: Faker==40.1.2; extra == "dev"
29
29
  Requires-Dist: behave==1.3.3; extra == "dev"
30
30
  Requires-Dist: pre-commit==4.5.1; extra == "dev"
31
31
  Requires-Dist: pytest==9.0.2; extra == "dev"
@@ -1,4 +1,4 @@
1
- unifi_network_maps/__init__.py,sha256=0optyte4cOxIRRV4Vdh_XYGrxTLJSuPWvhUDQkXvb4U,22
1
+ unifi_network_maps/__init__.py,sha256=pHClr_RD94RdAO4nIJOBug2vXKKjcRzEGxsyrQcqnHY,22
2
2
  unifi_network_maps/__main__.py,sha256=XsOjaqslAVgyVlOTokjVddZ2iT8apZXpJ_OB-9WEEe4,179
3
3
  unifi_network_maps/adapters/__init__.py,sha256=nzx1KsiYalL_YuXKE6acW8Dj5flmMg0-i4gyYO0gV54,22
4
4
  unifi_network_maps/adapters/config.py,sha256=Bx9JDZxxY7Gjxyb8FDT0dxiKfgXt_TmzTDbgvpwB53s,1548
@@ -76,7 +76,7 @@ unifi_network_maps/render/markdown_tables.py,sha256=VvM0fSnSmpeeDPcD5pXaL_j_PTF0
76
76
  unifi_network_maps/render/mermaid.py,sha256=xsC57Xg-nKhmlVATzEbwLkMM2BOeDYlBjZuxBIPhHeI,8324
77
77
  unifi_network_maps/render/mermaid_theme.py,sha256=7nqLlvhaUA4z0YOs0ByEx_yHWcQD_hJJjhDtRcbSpg4,1781
78
78
  unifi_network_maps/render/mkdocs.py,sha256=EOST9_eP1ZoZQax-p-2fjlelrl3AKEJ9Gn-KXW8TI-o,5389
79
- unifi_network_maps/render/svg.py,sha256=KLsQKmk1ActaMYnVnhta3BNCF4HrlcGJYhV8F8VTMmg,39924
79
+ unifi_network_maps/render/svg.py,sha256=W0tiuCkicTxbHTJbeRbnWzFfaO9yawL7e6EJiP7TLnU,40791
80
80
  unifi_network_maps/render/svg_theme.py,sha256=Si1ArM3v_-wAvHZyLFPiOZ0ohQRd6ezIckwC3_b-WIw,2684
81
81
  unifi_network_maps/render/templating.py,sha256=VJbXzZFBPjL8LFFPcLf_EU5Eu53GN9_vpten2Mf9A-k,576
82
82
  unifi_network_maps/render/theme.py,sha256=vKYdPhcGEOV1o_irwqzJlIXPgRvZqQEzYYV2_TxZn4E,4301
@@ -91,9 +91,9 @@ unifi_network_maps/render/templates/mkdocs_html_block.html.j2,sha256=5l5-BbNujOc
91
91
  unifi_network_maps/render/templates/mkdocs_legend.css.j2,sha256=tkTI-RagBSgdjUygVenlTsQFenU09ePbXOfDt_Q7YRM,612
92
92
  unifi_network_maps/render/templates/mkdocs_legend.js.j2,sha256=qMYyCKsJ84uXf1wGgzbc7Bc49RU4oyuaGK9KrgQDQEI,685
93
93
  unifi_network_maps/render/templates/mkdocs_mermaid_block.md.j2,sha256=9IncllWQpoI8BN3A7b2zOQ5cksj97ddsjHJ-aBhpw7o,66
94
- unifi_network_maps-1.4.6.dist-info/licenses/LICENSE,sha256=mYo1siIIfIwyfdOuK2-Zt0ij2xBTii2hnpeTu79nD80,1074
95
- unifi_network_maps-1.4.6.dist-info/METADATA,sha256=pQZefF7brMQc9vGxphkG7AzFaQNrotEy3amCA3sFrYc,9754
96
- unifi_network_maps-1.4.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
97
- unifi_network_maps-1.4.6.dist-info/entry_points.txt,sha256=cdJ7jsBgNgHxSflYUOqgz5BbvuM0Nnh-x8_Hbyh_LFg,67
98
- unifi_network_maps-1.4.6.dist-info/top_level.txt,sha256=G0rUX1PNfVCn1u-KtB6QjFQHopCOVLnPMczvPOoraHg,19
99
- unifi_network_maps-1.4.6.dist-info/RECORD,,
94
+ unifi_network_maps-1.4.7.dist-info/licenses/LICENSE,sha256=mYo1siIIfIwyfdOuK2-Zt0ij2xBTii2hnpeTu79nD80,1074
95
+ unifi_network_maps-1.4.7.dist-info/METADATA,sha256=kHKNrAptcX2vYnP1c4-0sxA9l6bmTBXSHLLOCskIlm0,9754
96
+ unifi_network_maps-1.4.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
97
+ unifi_network_maps-1.4.7.dist-info/entry_points.txt,sha256=cdJ7jsBgNgHxSflYUOqgz5BbvuM0Nnh-x8_Hbyh_LFg,67
98
+ unifi_network_maps-1.4.7.dist-info/top_level.txt,sha256=G0rUX1PNfVCn1u-KtB6QjFQHopCOVLnPMczvPOoraHg,19
99
+ unifi_network_maps-1.4.7.dist-info/RECORD,,