tagscope 0.1.0__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.
- tagscope/__init__.py +5 -0
- tagscope/__main__.py +3 -0
- tagscope/cli.py +215 -0
- tagscope/collector.py +154 -0
- tagscope/config.py +159 -0
- tagscope/hub.py +148 -0
- tagscope/simulator.py +175 -0
- tagscope/static/app.css +219 -0
- tagscope/static/app.js +469 -0
- tagscope/static/index.html +87 -0
- tagscope/static/vendor/uPlot.LICENSE +21 -0
- tagscope/static/vendor/uPlot.iife.min.js +2 -0
- tagscope/static/vendor/uPlot.min.css +1 -0
- tagscope/storage.py +262 -0
- tagscope/web.py +111 -0
- tagscope-0.1.0.dist-info/METADATA +207 -0
- tagscope-0.1.0.dist-info/RECORD +20 -0
- tagscope-0.1.0.dist-info/WHEEL +4 -0
- tagscope-0.1.0.dist-info/entry_points.txt +2 -0
- tagscope-0.1.0.dist-info/licenses/LICENSE +21 -0
tagscope/simulator.py
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"""A small simulated plant served over OPC UA, used by ``tagscope demo``.
|
|
2
|
+
|
|
3
|
+
The process: a tank is filled by a feed valve and emptied by a pump. A
|
|
4
|
+
heater keeps a reactor at temperature, and a filler counts bottles. Every
|
|
5
|
+
few minutes the pump trips, so the level climbs into alarm and recovers,
|
|
6
|
+
which makes the demo dashboard come alive.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import asyncio
|
|
12
|
+
import math
|
|
13
|
+
import random
|
|
14
|
+
import time
|
|
15
|
+
|
|
16
|
+
from asyncua import Server, ua
|
|
17
|
+
|
|
18
|
+
from .config import Config, ServerConfig, TagConfig, WebConfig
|
|
19
|
+
|
|
20
|
+
NAMESPACE = "urn:tagscope:demo-plant"
|
|
21
|
+
DEFAULT_ENDPOINT = "opc.tcp://127.0.0.1:4841/tagscope/demo"
|
|
22
|
+
|
|
23
|
+
#: (path, unit, description, low, high, deadband, initial value)
|
|
24
|
+
SIGNALS: list[tuple[str, str, str, float | None, float | None, float, float | bool]] = [
|
|
25
|
+
("Tank1.Level", "%", "Buffer tank level", 20, 80, 0.05, 50.0),
|
|
26
|
+
("Tank1.InletFlow", "m³/h", "Feed flow into the tank", None, None, 0.05, 12.0),
|
|
27
|
+
("Tank1.OutletFlow", "m³/h", "Pump discharge flow", None, None, 0.05, 12.0),
|
|
28
|
+
("Pump1.Running", "", "Transfer pump running", None, None, 0, True),
|
|
29
|
+
("Pump1.Speed", "rpm", "Transfer pump speed", None, 1720, 1, 1200.0),
|
|
30
|
+
("Pump1.Current", "A", "Motor current", None, 38, 0.05, 24.0),
|
|
31
|
+
("Reactor.Temperature", "°C", "Reactor temperature", 70, 90, 0.05, 80.0),
|
|
32
|
+
("Reactor.Pressure", "bar", "Reactor pressure", None, 6.5, 0.01, 4.2),
|
|
33
|
+
("Filler.BottleCount", "pcs", "Bottles filled since start", None, None, 0, 0.0),
|
|
34
|
+
("Line.PowerKw", "kW", "Line power consumption", None, None, 0.1, 42.0),
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def demo_config(endpoint: str = DEFAULT_ENDPOINT, storage: str = "sqlite:///tagscope-demo.db") -> Config:
|
|
39
|
+
"""The configuration ``tagscope demo`` uses to log the simulated plant."""
|
|
40
|
+
tags = [
|
|
41
|
+
TagConfig(
|
|
42
|
+
name=path,
|
|
43
|
+
node=f"ns=2;s=Plant.{path}",
|
|
44
|
+
unit=unit,
|
|
45
|
+
description=desc,
|
|
46
|
+
low=low,
|
|
47
|
+
high=high,
|
|
48
|
+
deadband=deadband,
|
|
49
|
+
server="demo-plant",
|
|
50
|
+
)
|
|
51
|
+
for path, unit, desc, low, high, deadband, _ in SIGNALS
|
|
52
|
+
]
|
|
53
|
+
server = ServerConfig(name="demo-plant", endpoint=endpoint, publishing_interval_ms=250, tags=tags)
|
|
54
|
+
return Config(storage=storage, retention_days=7, web=WebConfig(), servers=[server])
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class Plant:
|
|
58
|
+
"""Deterministic-ish process model, stepped at a fixed rate."""
|
|
59
|
+
|
|
60
|
+
def __init__(self, seed: int | None = None) -> None:
|
|
61
|
+
self.rng = random.Random(seed)
|
|
62
|
+
self.state: dict[str, float | bool] = {path: init for path, *_, init in SIGNALS}
|
|
63
|
+
self.t = 0.0
|
|
64
|
+
self.trip_until = 0.0
|
|
65
|
+
self.next_trip = 45.0
|
|
66
|
+
self._bottles = 0.0
|
|
67
|
+
|
|
68
|
+
def step(self, dt: float) -> dict[str, float | bool]:
|
|
69
|
+
self.t += dt
|
|
70
|
+
s, rng = self.state, self.rng
|
|
71
|
+
|
|
72
|
+
# Pump trips now and then; it restarts automatically after a while.
|
|
73
|
+
if self.t >= self.next_trip and self.t >= self.trip_until:
|
|
74
|
+
self.trip_until = self.t + rng.uniform(30, 45)
|
|
75
|
+
self.next_trip = self.trip_until + rng.uniform(90, 180)
|
|
76
|
+
running = self.t >= self.trip_until
|
|
77
|
+
|
|
78
|
+
inlet = 12 + 2.5 * math.sin(self.t / 23) + rng.gauss(0, 0.25)
|
|
79
|
+
level = float(s["Tank1.Level"])
|
|
80
|
+
target_speed = min(1750.0, max(600.0, 1200 + (level - 50) * 25)) if running else 0.0
|
|
81
|
+
speed = float(s["Pump1.Speed"]) + (target_speed - float(s["Pump1.Speed"])) * min(1.0, dt * 1.5)
|
|
82
|
+
outlet = max(0.0, speed / 1200 * 12 + rng.gauss(0, 0.2)) if speed > 50 else 0.0
|
|
83
|
+
level = min(100.0, max(0.0, level + (inlet - outlet) * dt * 0.05))
|
|
84
|
+
current = 4 + speed / 1200 * 18 + rng.gauss(0, 0.3) if speed > 50 else 0.0
|
|
85
|
+
|
|
86
|
+
temp = float(s["Reactor.Temperature"])
|
|
87
|
+
setpoint = 80 + 4 * math.sin(self.t / 70)
|
|
88
|
+
temp += (setpoint - temp) * dt * 0.08 + rng.gauss(0, 0.06)
|
|
89
|
+
pressure = 2.2 + (temp - 20) * 0.033 + rng.gauss(0, 0.02)
|
|
90
|
+
|
|
91
|
+
if running:
|
|
92
|
+
self._bottles += dt * (outlet / 12) * 4.2
|
|
93
|
+
power = 18 + current * 0.9 + (temp - 20) * 0.12 + rng.gauss(0, 0.4)
|
|
94
|
+
|
|
95
|
+
s.update(
|
|
96
|
+
{
|
|
97
|
+
"Tank1.Level": round(level, 2),
|
|
98
|
+
"Tank1.InletFlow": round(inlet, 2),
|
|
99
|
+
"Tank1.OutletFlow": round(outlet, 2),
|
|
100
|
+
"Pump1.Running": running,
|
|
101
|
+
"Pump1.Speed": round(speed, 0),
|
|
102
|
+
"Pump1.Current": round(max(0.0, current), 2),
|
|
103
|
+
"Reactor.Temperature": round(temp, 2),
|
|
104
|
+
"Reactor.Pressure": round(pressure, 3),
|
|
105
|
+
"Filler.BottleCount": float(int(self._bottles)),
|
|
106
|
+
"Line.PowerKw": round(power, 1),
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
return dict(s)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def backfill(storage, config: Config, plant: Plant, minutes: float = 30, rate_hz: float = 1.0) -> int:
|
|
113
|
+
"""Fill an empty demo database with ``minutes`` of simulated history.
|
|
114
|
+
|
|
115
|
+
This way the dashboard shows full trends the first time it opens.
|
|
116
|
+
"""
|
|
117
|
+
if storage.sample_count():
|
|
118
|
+
return 0
|
|
119
|
+
from .hub import Hub
|
|
120
|
+
|
|
121
|
+
hub = Hub(config)
|
|
122
|
+
by_path = {tag.node.removeprefix("ns=2;s=Plant."): tag.name for tag in config.tags}
|
|
123
|
+
now = time.time()
|
|
124
|
+
steps = int(minutes * 60 * rate_hz)
|
|
125
|
+
written = 0
|
|
126
|
+
for i in range(steps):
|
|
127
|
+
ts = now - (steps - i) / rate_hz
|
|
128
|
+
for path, value in plant.step(1.0 / rate_hz).items():
|
|
129
|
+
if path in by_path:
|
|
130
|
+
hub.update(by_path[path], value, ts)
|
|
131
|
+
if i % 300 == 0:
|
|
132
|
+
written += storage.write_samples(hub.drain_samples())
|
|
133
|
+
written += storage.write_samples(hub.drain_samples())
|
|
134
|
+
for event in hub.drain_events():
|
|
135
|
+
storage.add_event(event["kind"], event["message"], event["tag"], event["ts"])
|
|
136
|
+
return written
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
async def run_simulator(
|
|
140
|
+
endpoint: str = DEFAULT_ENDPOINT,
|
|
141
|
+
rate_hz: float = 4.0,
|
|
142
|
+
plant: Plant | None = None,
|
|
143
|
+
ready: asyncio.Event | None = None,
|
|
144
|
+
) -> None:
|
|
145
|
+
"""Serve the simulated plant until cancelled."""
|
|
146
|
+
server = Server()
|
|
147
|
+
await server.init()
|
|
148
|
+
server.set_endpoint(endpoint)
|
|
149
|
+
server.set_server_name("TagScope demo plant")
|
|
150
|
+
server.set_security_policy([ua.SecurityPolicyType.NoSecurity])
|
|
151
|
+
idx = await server.register_namespace(NAMESPACE)
|
|
152
|
+
|
|
153
|
+
plant_obj = await server.nodes.objects.add_folder(ua.NodeId("Plant", idx), "Plant")
|
|
154
|
+
groups: dict[str, object] = {}
|
|
155
|
+
variables = {}
|
|
156
|
+
for path, *_meta, init in SIGNALS:
|
|
157
|
+
group, leaf = path.split(".")
|
|
158
|
+
if group not in groups:
|
|
159
|
+
groups[group] = await plant_obj.add_object(ua.NodeId(f"Plant.{group}", idx), group)
|
|
160
|
+
vtype = ua.VariantType.Boolean if isinstance(init, bool) else ua.VariantType.Double
|
|
161
|
+
var = await groups[group].add_variable(ua.NodeId(f"Plant.{path}", idx), leaf, ua.Variant(init, vtype))
|
|
162
|
+
variables[path] = (var, vtype)
|
|
163
|
+
|
|
164
|
+
plant = plant or Plant()
|
|
165
|
+
dt = 1.0 / rate_hz
|
|
166
|
+
async with server:
|
|
167
|
+
if ready is not None:
|
|
168
|
+
ready.set()
|
|
169
|
+
next_tick = time.monotonic()
|
|
170
|
+
while True:
|
|
171
|
+
values = plant.step(dt)
|
|
172
|
+
for path, (var, vtype) in variables.items():
|
|
173
|
+
await var.write_value(ua.Variant(values[path], vtype))
|
|
174
|
+
next_tick += dt
|
|
175
|
+
await asyncio.sleep(max(0.0, next_tick - time.monotonic()))
|
tagscope/static/app.css
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/* TagScope. Calm greys, colour only when something needs attention (ISA-101 style). */
|
|
2
|
+
:root {
|
|
3
|
+
--bg: #0a0e13;
|
|
4
|
+
--panel: #10161d;
|
|
5
|
+
--panel-2: #151d26;
|
|
6
|
+
--line: #1f2a36;
|
|
7
|
+
--line-2: #2a3846;
|
|
8
|
+
--text: #e6edf3;
|
|
9
|
+
--muted: #8796a8;
|
|
10
|
+
--faint: #56677a;
|
|
11
|
+
--accent: #38d9b0;
|
|
12
|
+
--accent-ink: #062a21;
|
|
13
|
+
--ok: #3ccf8e;
|
|
14
|
+
--warn: #f5b13d;
|
|
15
|
+
--bad: #ff5d6c;
|
|
16
|
+
--info: #6aa8ff;
|
|
17
|
+
--shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.25);
|
|
18
|
+
--mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
|
|
19
|
+
--sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
20
|
+
--radius: 12px;
|
|
21
|
+
color-scheme: dark;
|
|
22
|
+
}
|
|
23
|
+
:root[data-theme="light"] {
|
|
24
|
+
--bg: #eef1f5;
|
|
25
|
+
--panel: #ffffff;
|
|
26
|
+
--panel-2: #f5f7fa;
|
|
27
|
+
--line: #dde3ea;
|
|
28
|
+
--line-2: #c9d2dc;
|
|
29
|
+
--text: #17212b;
|
|
30
|
+
--muted: #5a6878;
|
|
31
|
+
--faint: #8a97a6;
|
|
32
|
+
--accent: #0b9f7c;
|
|
33
|
+
--accent-ink: #ffffff;
|
|
34
|
+
--shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 16px rgba(16,24,40,.05);
|
|
35
|
+
color-scheme: light;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
* { box-sizing: border-box; }
|
|
39
|
+
html, body { margin: 0; height: 100%; }
|
|
40
|
+
body {
|
|
41
|
+
background: var(--bg);
|
|
42
|
+
color: var(--text);
|
|
43
|
+
font: 14px/1.45 var(--sans);
|
|
44
|
+
-webkit-font-smoothing: antialiased;
|
|
45
|
+
}
|
|
46
|
+
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
|
47
|
+
button { font: inherit; color: inherit; cursor: pointer; }
|
|
48
|
+
.muted { color: var(--muted); font-weight: 400; }
|
|
49
|
+
.hidden { display: none !important; }
|
|
50
|
+
|
|
51
|
+
/* ---- top bar ---------------------------------------------------------- */
|
|
52
|
+
.topbar {
|
|
53
|
+
position: sticky; top: 0; z-index: 5;
|
|
54
|
+
display: flex; align-items: center; gap: 18px;
|
|
55
|
+
height: 56px; padding: 0 18px;
|
|
56
|
+
background: color-mix(in srgb, var(--panel) 88%, transparent);
|
|
57
|
+
backdrop-filter: blur(10px);
|
|
58
|
+
border-bottom: 1px solid var(--line);
|
|
59
|
+
}
|
|
60
|
+
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; letter-spacing: -.01em; }
|
|
61
|
+
.brand svg { width: 28px; height: 28px; }
|
|
62
|
+
.brand-bg { fill: var(--panel-2); stroke: var(--line-2); stroke-width: 1; }
|
|
63
|
+
.brand-line { stroke: var(--accent); stroke-width: 2.6; }
|
|
64
|
+
.brand b { color: var(--accent); font-weight: 700; }
|
|
65
|
+
.servers { display: flex; gap: 8px; overflow-x: auto; flex: 1; scrollbar-width: none; }
|
|
66
|
+
.server {
|
|
67
|
+
display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
|
|
68
|
+
padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px;
|
|
69
|
+
background: var(--panel-2); font-size: 12.5px; color: var(--muted);
|
|
70
|
+
}
|
|
71
|
+
.server b { color: var(--text); font-weight: 600; }
|
|
72
|
+
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
|
|
73
|
+
.dot.connected { background: var(--ok); box-shadow: 0 0 0 0 rgba(60,207,142,.6); animation: pulse 2.4s infinite; }
|
|
74
|
+
.dot.connecting { background: var(--warn); }
|
|
75
|
+
.dot.disconnected, .dot.error { background: var(--bad); }
|
|
76
|
+
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(60,207,142,.55); } 70% { box-shadow: 0 0 0 7px rgba(60,207,142,0); } 100% { box-shadow: 0 0 0 0 rgba(60,207,142,0); } }
|
|
77
|
+
.topbar-right { display: flex; align-items: center; gap: 18px; }
|
|
78
|
+
.stat { display: flex; align-items: baseline; gap: 4px; font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
|
|
79
|
+
.stat small { color: var(--faint); font-family: var(--sans); font-size: 11.5px; }
|
|
80
|
+
.clock { color: var(--muted); }
|
|
81
|
+
.icon-btn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); }
|
|
82
|
+
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
|
|
83
|
+
|
|
84
|
+
/* ---- layout ----------------------------------------------------------- */
|
|
85
|
+
.layout { display: grid; grid-template-columns: 292px minmax(0, 1fr); min-height: calc(100vh - 56px); background: linear-gradient(90deg, var(--panel) 291px, var(--line) 291px 292px, transparent 292px); }
|
|
86
|
+
.sidebar {
|
|
87
|
+
position: sticky; top: 56px; height: calc(100vh - 56px);
|
|
88
|
+
display: flex; flex-direction: column; gap: 12px;
|
|
89
|
+
padding: 14px; border-right: 1px solid var(--line); background: var(--panel);
|
|
90
|
+
}
|
|
91
|
+
.main { display: flex; flex-direction: column; gap: 14px; padding: 14px 16px; min-width: 0; }
|
|
92
|
+
|
|
93
|
+
.search { position: relative; }
|
|
94
|
+
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
|
|
95
|
+
.search input {
|
|
96
|
+
width: 100%; padding: 9px 12px 9px 34px; border-radius: 9px;
|
|
97
|
+
border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; outline: none;
|
|
98
|
+
}
|
|
99
|
+
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
|
|
100
|
+
|
|
101
|
+
.taglist { flex: 1; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
|
|
102
|
+
.group { margin: 10px 4px 4px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
|
|
103
|
+
.tag {
|
|
104
|
+
position: relative; display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 9px;
|
|
105
|
+
width: 100%; padding: 7px 9px; border: 1px solid transparent; border-radius: 8px;
|
|
106
|
+
background: none; text-align: left;
|
|
107
|
+
}
|
|
108
|
+
.tag:hover { background: var(--panel-2); }
|
|
109
|
+
.tag.selected { background: var(--panel-2); border-color: var(--line); }
|
|
110
|
+
.swatch { width: 12px; height: 12px; border-radius: 4px; border: 1.5px solid var(--line-2); }
|
|
111
|
+
.tag.selected .swatch { border-color: transparent; }
|
|
112
|
+
.tag-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
|
|
113
|
+
.tag-value { font-family: var(--mono); font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; transition: color .4s; }
|
|
114
|
+
.tag-value.flash { color: var(--text); }
|
|
115
|
+
.tag.high .tag-value, .tag.low .tag-value { color: var(--warn); font-weight: 600; }
|
|
116
|
+
.tag.bad .tag-value { color: var(--faint); text-decoration: line-through; }
|
|
117
|
+
|
|
118
|
+
.ghost-btn {
|
|
119
|
+
display: inline-flex; align-items: center; justify-content: center; gap: 7px;
|
|
120
|
+
padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-size: 13px;
|
|
121
|
+
}
|
|
122
|
+
.ghost-btn:hover { color: var(--text); border-color: var(--line-2); }
|
|
123
|
+
.ghost-btn.wide { width: 100%; }
|
|
124
|
+
|
|
125
|
+
/* ---- cards ------------------------------------------------------------ */
|
|
126
|
+
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 10px; }
|
|
127
|
+
.card {
|
|
128
|
+
position: relative; overflow: hidden;
|
|
129
|
+
padding: 11px 12px 10px; border-radius: var(--radius);
|
|
130
|
+
background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
|
|
131
|
+
transition: border-color .3s, background .3s;
|
|
132
|
+
}
|
|
133
|
+
.card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: transparent; transition: background .3s; }
|
|
134
|
+
.card.high::before, .card.low::before { background: var(--warn); }
|
|
135
|
+
.card.high, .card.low { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: color-mix(in srgb, var(--warn) 6%, var(--panel)); }
|
|
136
|
+
.card.bad { opacity: .55; }
|
|
137
|
+
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
|
|
138
|
+
.card-name { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
139
|
+
.state { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; padding: 2px 7px; border-radius: 999px; text-transform: uppercase; }
|
|
140
|
+
.state.high, .state.low { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
|
|
141
|
+
.state.on { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
|
|
142
|
+
.state.off { background: var(--panel-2); color: var(--faint); }
|
|
143
|
+
.card-value { margin: 3px 0 0; font-family: var(--mono); font-size: 24px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
|
|
144
|
+
.card-value small { margin-left: 4px; font-size: 13px; font-weight: 400; color: var(--muted); font-family: var(--sans); }
|
|
145
|
+
.spark { display: block; width: 100%; height: 30px; }
|
|
146
|
+
.limits { position: relative; height: 4px; margin-top: 8px; border-radius: 2px; background: var(--panel-2); }
|
|
147
|
+
.limits .band { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--ok) 30%, transparent); border-radius: 2px; }
|
|
148
|
+
.limits .pos { position: absolute; top: -3px; width: 2px; height: 10px; background: var(--text); border-radius: 1px; transition: left .5s ease; }
|
|
149
|
+
|
|
150
|
+
/* ---- panels ----------------------------------------------------------- */
|
|
151
|
+
.panel { padding: 14px 16px 12px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0; }
|
|
152
|
+
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
|
|
153
|
+
.panel h2 { margin: 0; font-size: 14.5px; font-weight: 600; }
|
|
154
|
+
.panel-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
|
155
|
+
.segmented { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); }
|
|
156
|
+
.segmented button { padding: 4px 10px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-size: 12.5px; }
|
|
157
|
+
.segmented button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.25); }
|
|
158
|
+
.segmented.small button { padding: 3px 9px; font-size: 12px; }
|
|
159
|
+
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-size: 12.5px; }
|
|
160
|
+
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
|
|
161
|
+
.pill.live.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
|
|
162
|
+
.pill.live.on i { background: var(--accent); animation: blink 1.6s infinite; }
|
|
163
|
+
@keyframes blink { 50% { opacity: .25; } }
|
|
164
|
+
|
|
165
|
+
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; min-height: 22px; margin: 2px 0 6px; font-size: 12.5px; }
|
|
166
|
+
.legend span { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
|
|
167
|
+
.legend i { width: 14px; height: 3px; border-radius: 2px; }
|
|
168
|
+
.legend b { color: var(--text); font-family: var(--mono); font-weight: 500; font-variant-numeric: tabular-nums; }
|
|
169
|
+
.chart { height: clamp(260px, calc(100vh - 470px), 520px); }
|
|
170
|
+
.chart .u-select { background: color-mix(in srgb, var(--accent) 14%, transparent); }
|
|
171
|
+
.chart .u-cursor-x, .chart .u-cursor-y { border-color: var(--line-2) !important; }
|
|
172
|
+
.empty { display: grid; place-items: center; height: 100%; color: var(--faint); }
|
|
173
|
+
.hint { margin: 6px 0 0; font-size: 12px; color: var(--faint); }
|
|
174
|
+
.hint code { font-family: var(--mono); color: var(--muted); }
|
|
175
|
+
|
|
176
|
+
.badge { display: inline-block; min-width: 20px; padding: 1px 7px; margin-left: 6px; border-radius: 999px; background: var(--warn); color: #1d1300; font-size: 11.5px; text-align: center; font-weight: 700; }
|
|
177
|
+
.eventlist { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
|
|
178
|
+
.eventlist li { display: grid; grid-template-columns: 74px 78px 1fr; gap: 10px; align-items: center; padding: 7px 4px; border-top: 1px solid var(--line); font-size: 13px; }
|
|
179
|
+
.eventlist li:first-child { border-top: 0; }
|
|
180
|
+
.eventlist li.new { animation: slidein .45s ease; }
|
|
181
|
+
@keyframes slidein { from { background: color-mix(in srgb, var(--accent) 14%, transparent); } to { background: transparent; } }
|
|
182
|
+
.eventlist time { font-family: var(--mono); font-size: 12px; color: var(--faint); }
|
|
183
|
+
.kind { justify-self: start; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; }
|
|
184
|
+
.kind.alarm { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
|
|
185
|
+
.kind.cleared { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
|
|
186
|
+
.kind.error, .kind.warning { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
|
|
187
|
+
.kind.info { background: color-mix(in srgb, var(--info) 16%, transparent); color: var(--info); }
|
|
188
|
+
.eventlist .empty { display: block; padding: 18px 4px; }
|
|
189
|
+
|
|
190
|
+
/* ---- browser dialog --------------------------------------------------- */
|
|
191
|
+
.browser { width: min(720px, calc(100vw - 32px)); max-height: 80vh; padding: 16px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--panel); color: var(--text); box-shadow: 0 24px 64px rgba(0,0,0,.45); }
|
|
192
|
+
.browser::backdrop { background: rgba(4,8,12,.6); backdrop-filter: blur(3px); }
|
|
193
|
+
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
|
|
194
|
+
.tree ul { padding-left: 18px; border-left: 1px dashed var(--line-2); margin-left: 7px; }
|
|
195
|
+
.tree { max-height: 60vh; overflow: auto; font-size: 13px; }
|
|
196
|
+
.node { display: grid; grid-template-columns: 16px 1fr auto auto; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 6px; cursor: default; }
|
|
197
|
+
.node:hover { background: var(--panel-2); }
|
|
198
|
+
.node.folder { cursor: pointer; }
|
|
199
|
+
.node .caret { color: var(--faint); transition: transform .15s; }
|
|
200
|
+
.node.open .caret { transform: rotate(90deg); }
|
|
201
|
+
.node code { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
|
|
202
|
+
.node .val { font-family: var(--mono); font-size: 12px; color: var(--accent); }
|
|
203
|
+
.copy { border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); border-radius: 6px; padding: 1px 7px; font-size: 11.5px; }
|
|
204
|
+
|
|
205
|
+
.toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 20px); opacity: 0; padding: 9px 16px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: 13px; transition: .25s; pointer-events: none; }
|
|
206
|
+
.toast.show { opacity: 1; transform: translate(-50%, 0); }
|
|
207
|
+
|
|
208
|
+
@media (max-width: 860px) {
|
|
209
|
+
.layout { grid-template-columns: 1fr; background: none; }
|
|
210
|
+
.sidebar { position: static; height: auto; max-height: 300px; border-right: 0; border-bottom: 1px solid var(--line); }
|
|
211
|
+
.main { padding: 12px; }
|
|
212
|
+
.topbar { gap: 10px; padding: 0 12px; }
|
|
213
|
+
.topbar .stat { display: none; }
|
|
214
|
+
.sidebar { order: 2; }
|
|
215
|
+
.chart { height: 260px; }
|
|
216
|
+
.eventlist li { grid-template-columns: 64px 1fr; }
|
|
217
|
+
.eventlist li .kind { display: none; }
|
|
218
|
+
}
|
|
219
|
+
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
|