unifi-network-maps 1.4.2__py3-none-any.whl → 1.4.4__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.
- unifi_network_maps/__init__.py +1 -1
- unifi_network_maps/assets/themes/dark.yaml +3 -0
- unifi_network_maps/cli/main.py +11 -6
- unifi_network_maps/render/mermaid.py +10 -1
- unifi_network_maps/render/mermaid_theme.py +15 -5
- unifi_network_maps/render/theme.py +19 -0
- {unifi_network_maps-1.4.2.dist-info → unifi_network_maps-1.4.4.dist-info}/METADATA +1 -1
- {unifi_network_maps-1.4.2.dist-info → unifi_network_maps-1.4.4.dist-info}/RECORD +12 -12
- {unifi_network_maps-1.4.2.dist-info → unifi_network_maps-1.4.4.dist-info}/WHEEL +0 -0
- {unifi_network_maps-1.4.2.dist-info → unifi_network_maps-1.4.4.dist-info}/entry_points.txt +0 -0
- {unifi_network_maps-1.4.2.dist-info → unifi_network_maps-1.4.4.dist-info}/licenses/LICENSE +0 -0
- {unifi_network_maps-1.4.2.dist-info → unifi_network_maps-1.4.4.dist-info}/top_level.txt +0 -0
unifi_network_maps/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.4.
|
|
1
|
+
__version__ = "1.4.4"
|
unifi_network_maps/cli/main.py
CHANGED
|
@@ -507,9 +507,9 @@ def _write_mkdocs_sidebar_assets(output_path: str) -> None:
|
|
|
507
507
|
(assets_dir / "legend.js").write_text(
|
|
508
508
|
(
|
|
509
509
|
'document.addEventListener("DOMContentLoaded", () => {\n'
|
|
510
|
-
' const
|
|
510
|
+
' const legends = document.querySelectorAll("[data-unifi-legend]");\n'
|
|
511
511
|
' const sidebar = document.querySelector(".md-sidebar--secondary .md-sidebar__scrollwrap");\n'
|
|
512
|
-
" if (!
|
|
512
|
+
" if (!legends.length || !sidebar) {\n"
|
|
513
513
|
" return;\n"
|
|
514
514
|
" }\n"
|
|
515
515
|
' const wrapper = document.createElement("div");\n'
|
|
@@ -518,17 +518,22 @@ def _write_mkdocs_sidebar_assets(output_path: str) -> None:
|
|
|
518
518
|
' title.className = "unifi-legend-title";\n'
|
|
519
519
|
' title.textContent = "Legend";\n'
|
|
520
520
|
" wrapper.appendChild(title);\n"
|
|
521
|
-
"
|
|
521
|
+
" legends.forEach((legend) => {\n"
|
|
522
|
+
" wrapper.appendChild(legend.cloneNode(true));\n"
|
|
523
|
+
' legend.classList.add("unifi-legend-hidden");\n'
|
|
524
|
+
" });\n"
|
|
522
525
|
" sidebar.appendChild(wrapper);\n"
|
|
523
|
-
' legend.classList.add("unifi-legend-hidden");\n'
|
|
524
526
|
"});\n"
|
|
525
527
|
),
|
|
526
528
|
encoding="utf-8",
|
|
527
529
|
)
|
|
528
530
|
(assets_dir / "legend.css").write_text(
|
|
529
531
|
(
|
|
530
|
-
".unifi-legend-hidden
|
|
531
|
-
"
|
|
532
|
+
".unifi-legend-hidden,\n"
|
|
533
|
+
".unifi-legend-hidden.unifi-legend,\n"
|
|
534
|
+
".unifi-legend-hidden.unifi-legend--light,\n"
|
|
535
|
+
".unifi-legend-hidden.unifi-legend--dark {\n"
|
|
536
|
+
" display: none !important;\n"
|
|
532
537
|
"}\n\n"
|
|
533
538
|
".unifi-legend-sidebar {\n"
|
|
534
539
|
" margin-top: 1rem;\n"
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import json
|
|
5
6
|
from collections.abc import Iterable
|
|
6
7
|
|
|
7
8
|
from ..model.topology import Edge
|
|
@@ -163,7 +164,15 @@ def render_mermaid(
|
|
|
163
164
|
) -> str:
|
|
164
165
|
edge_list = list(edges)
|
|
165
166
|
id_map = _build_id_map(edge_list, _group_nodes(groups))
|
|
166
|
-
|
|
167
|
+
theme_vars: dict[str, object] = {}
|
|
168
|
+
if theme.edge_label_border:
|
|
169
|
+
theme_vars["edgeLabelBorderColor"] = theme.edge_label_border
|
|
170
|
+
if theme.edge_label_border_width:
|
|
171
|
+
theme_vars["edgeLabelBorderWidth"] = theme.edge_label_border_width
|
|
172
|
+
lines = []
|
|
173
|
+
if theme_vars:
|
|
174
|
+
lines.append(f'%%{{init: {{"themeVariables": {json.dumps(theme_vars)}}}}}%%')
|
|
175
|
+
lines.append(f"graph {direction}")
|
|
167
176
|
if groups:
|
|
168
177
|
_render_group_sections(lines, groups, group_order=group_order, id_map=id_map)
|
|
169
178
|
use_node_labels = not groups
|
|
@@ -18,6 +18,9 @@ class MermaidTheme:
|
|
|
18
18
|
standard_link: str
|
|
19
19
|
standard_link_width: int
|
|
20
20
|
standard_link_arrow: str
|
|
21
|
+
node_text: str | None = None
|
|
22
|
+
edge_label_border: str | None = None
|
|
23
|
+
edge_label_border_width: int | None = None
|
|
21
24
|
|
|
22
25
|
|
|
23
26
|
DEFAULT_THEME = MermaidTheme(
|
|
@@ -32,15 +35,22 @@ DEFAULT_THEME = MermaidTheme(
|
|
|
32
35
|
standard_link="#2ecc71",
|
|
33
36
|
standard_link_width=2,
|
|
34
37
|
standard_link_arrow="none",
|
|
38
|
+
node_text=None,
|
|
39
|
+
edge_label_border=None,
|
|
40
|
+
edge_label_border_width=None,
|
|
35
41
|
)
|
|
36
42
|
|
|
37
43
|
|
|
38
44
|
def class_defs(theme: MermaidTheme = DEFAULT_THEME) -> list[str]:
|
|
45
|
+
def node_def(name: str, fill: str, stroke: str) -> str:
|
|
46
|
+
color = f",color:{theme.node_text}" if theme.node_text else ""
|
|
47
|
+
return f" classDef {name} fill:{fill},stroke:{stroke},stroke-width:1px{color};"
|
|
48
|
+
|
|
39
49
|
return [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
50
|
+
node_def("node_gateway", theme.node_gateway[0], theme.node_gateway[1]),
|
|
51
|
+
node_def("node_switch", theme.node_switch[0], theme.node_switch[1]),
|
|
52
|
+
node_def("node_ap", theme.node_ap[0], theme.node_ap[1]),
|
|
53
|
+
node_def("node_client", theme.node_client[0], theme.node_client[1]),
|
|
54
|
+
node_def("node_other", theme.node_other[0], theme.node_other[1]),
|
|
45
55
|
" classDef node_legend font-size:10px;",
|
|
46
56
|
]
|
|
@@ -29,6 +29,18 @@ def _coerce_color(value: object, default: str) -> str:
|
|
|
29
29
|
return value if isinstance(value, str) else default
|
|
30
30
|
|
|
31
31
|
|
|
32
|
+
def _coerce_optional_color(value: object, default: str | None) -> str | None:
|
|
33
|
+
return value if isinstance(value, str) else default
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _coerce_optional_int(value: object, default: int | None) -> int | None:
|
|
37
|
+
if isinstance(value, int):
|
|
38
|
+
return value
|
|
39
|
+
if isinstance(value, float):
|
|
40
|
+
return int(value)
|
|
41
|
+
return default
|
|
42
|
+
|
|
43
|
+
|
|
32
44
|
def _mermaid_theme_from_dict(data: dict, base: MermaidTheme) -> MermaidTheme:
|
|
33
45
|
nodes = data.get("nodes", {}) if isinstance(data.get("nodes"), dict) else {}
|
|
34
46
|
|
|
@@ -52,6 +64,13 @@ def _mermaid_theme_from_dict(data: dict, base: MermaidTheme) -> MermaidTheme:
|
|
|
52
64
|
standard_link_arrow=_coerce_color(
|
|
53
65
|
data.get("standard_link_arrow"), base.standard_link_arrow
|
|
54
66
|
),
|
|
67
|
+
node_text=_coerce_optional_color(data.get("node_text"), base.node_text),
|
|
68
|
+
edge_label_border=_coerce_optional_color(
|
|
69
|
+
data.get("edge_label_border"), base.edge_label_border
|
|
70
|
+
),
|
|
71
|
+
edge_label_border_width=_coerce_optional_int(
|
|
72
|
+
data.get("edge_label_border_width"), base.edge_label_border_width
|
|
73
|
+
),
|
|
55
74
|
)
|
|
56
75
|
|
|
57
76
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
unifi_network_maps/__init__.py,sha256=
|
|
1
|
+
unifi_network_maps/__init__.py,sha256=6stz_YFBRP_lguydVylsTgSmj3VTb6WFq8Sp45WYQyY,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
|
|
@@ -48,11 +48,11 @@ unifi_network_maps/assets/icons/isometric/truck-2.svg,sha256=I7MFGbXW2fmr9WdD29N
|
|
|
48
48
|
unifi_network_maps/assets/icons/isometric/truck.svg,sha256=BrpBr9Qf8hplQIrBpfhN2USxUlPvGCKahlV5e-G13r0,7195
|
|
49
49
|
unifi_network_maps/assets/icons/isometric/user.svg,sha256=bYpr0t8rETJ1M7RDTWaNkK-nfF3kq9eMxmxYCthNmE0,23026
|
|
50
50
|
unifi_network_maps/assets/icons/isometric/vm.svg,sha256=in6x9cdS6JgQVJl0KAbA79rap4X140dfIBCuxmgQI7s,3694
|
|
51
|
-
unifi_network_maps/assets/themes/dark.yaml,sha256=
|
|
51
|
+
unifi_network_maps/assets/themes/dark.yaml,sha256=6n4_H6MZbA6DKLdF2eaNcCXYLKNJjVjNN9gmwZX97sA,932
|
|
52
52
|
unifi_network_maps/assets/themes/default.yaml,sha256=F2Jj18NmdaJ_zyERvGAn8NEWBwapjtozrtZUxayd5AU,849
|
|
53
53
|
unifi_network_maps/cli/__init__.py,sha256=2FdmLMpYFh_7P0ew2LnieLANf6ni43Ht9FKzYUDiNis,770
|
|
54
54
|
unifi_network_maps/cli/__main__.py,sha256=nK_jh78VW3h3DRvSpjzpcf64zkCqniP2k82xUR9Hw2I,147
|
|
55
|
-
unifi_network_maps/cli/main.py,sha256=
|
|
55
|
+
unifi_network_maps/cli/main.py,sha256=klDyfD-wPr3vTRulNzfOcslERcONMpxf4iTtrCJpyMQ,27582
|
|
56
56
|
unifi_network_maps/io/__init__.py,sha256=nzx1KsiYalL_YuXKE6acW8Dj5flmMg0-i4gyYO0gV54,22
|
|
57
57
|
unifi_network_maps/io/debug.py,sha256=eUVs6GLfs6VqI6ma8ra7NLhC3q4ek2K8OSRLnpQDF9s,1745
|
|
58
58
|
unifi_network_maps/io/export.py,sha256=2vURunQDja-_fKKMb-gQG-n34aeM8GFprNJqcGaP4qg,843
|
|
@@ -66,14 +66,14 @@ unifi_network_maps/model/topology.py,sha256=JfpY6Pam_pgqnnmsBmzy3oDv4OCi4Ezc8msx
|
|
|
66
66
|
unifi_network_maps/render/__init__.py,sha256=nzx1KsiYalL_YuXKE6acW8Dj5flmMg0-i4gyYO0gV54,22
|
|
67
67
|
unifi_network_maps/render/device_ports_md.py,sha256=QoRiuP9l2CH8BYRHXRaWM5wyucAURz-zByzwMetnND4,15473
|
|
68
68
|
unifi_network_maps/render/lldp_md.py,sha256=Eg5c5SWEwTfEn6AN0fOfD3f41GlsqwZQRO8AzIXFQf4,10753
|
|
69
|
-
unifi_network_maps/render/mermaid.py,sha256=
|
|
70
|
-
unifi_network_maps/render/mermaid_theme.py,sha256=
|
|
69
|
+
unifi_network_maps/render/mermaid.py,sha256=GVn7VN0xdmweDnjk-0Q8nuivqOZ3YFBQ_iTonNydy28,9675
|
|
70
|
+
unifi_network_maps/render/mermaid_theme.py,sha256=7nqLlvhaUA4z0YOs0ByEx_yHWcQD_hJJjhDtRcbSpg4,1781
|
|
71
71
|
unifi_network_maps/render/svg.py,sha256=RHmSmlKxrS8m3-zYsTJu-GZugsZt8X8TDsPpK7DA6tg,38807
|
|
72
72
|
unifi_network_maps/render/svg_theme.py,sha256=Si1ArM3v_-wAvHZyLFPiOZ0ohQRd6ezIckwC3_b-WIw,2684
|
|
73
|
-
unifi_network_maps/render/theme.py,sha256
|
|
74
|
-
unifi_network_maps-1.4.
|
|
75
|
-
unifi_network_maps-1.4.
|
|
76
|
-
unifi_network_maps-1.4.
|
|
77
|
-
unifi_network_maps-1.4.
|
|
78
|
-
unifi_network_maps-1.4.
|
|
79
|
-
unifi_network_maps-1.4.
|
|
73
|
+
unifi_network_maps/render/theme.py,sha256=vKYdPhcGEOV1o_irwqzJlIXPgRvZqQEzYYV2_TxZn4E,4301
|
|
74
|
+
unifi_network_maps-1.4.4.dist-info/licenses/LICENSE,sha256=mYo1siIIfIwyfdOuK2-Zt0ij2xBTii2hnpeTu79nD80,1074
|
|
75
|
+
unifi_network_maps-1.4.4.dist-info/METADATA,sha256=HqLRtIKBUEZDxWvBZxO6DdcnLroyEasUG5O7CwKKIOc,9529
|
|
76
|
+
unifi_network_maps-1.4.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
77
|
+
unifi_network_maps-1.4.4.dist-info/entry_points.txt,sha256=cdJ7jsBgNgHxSflYUOqgz5BbvuM0Nnh-x8_Hbyh_LFg,67
|
|
78
|
+
unifi_network_maps-1.4.4.dist-info/top_level.txt,sha256=G0rUX1PNfVCn1u-KtB6QjFQHopCOVLnPMczvPOoraHg,19
|
|
79
|
+
unifi_network_maps-1.4.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|