Frontend performance and code quality improvements

Performance: cache getBoundingClientRect in card-glare and drag-drop,
build adjacency Maps for O(1) graph BFS, batch WebGL uniform uploads,
cache matchMedia/search text in card-sections, use Map in graph-layout.

Code quality: extract shared FPS chart factory (chart-utils.js) and
FilterListManager (filter-list.js), replace 14-way CSS editor dispatch
with type handler registry, move state to state.js, fix layer violation
in api.js, add i18n for hardcoded strings, sync 53 missing locale keys,
add HTTP error logging in DataCache.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-15 18:14:26 +03:00
parent 014b4175b9
commit 50c40ed13f
20 changed files with 1070 additions and 716 deletions

View File

@@ -27,6 +27,8 @@
"auth.please_login": "请先登录",
"auth.session_expired": "会话已过期或 API 密钥无效,请重新登录。",
"auth.toggle_password": "切换密码可见性",
"auth.prompt_enter": "Enter your API key:",
"auth.prompt_update": "Current API key is set. Enter new key to update or leave blank to remove:",
"displays.title": "可用显示器",
"displays.layout": "显示器",
"displays.information": "显示器信息",
@@ -108,6 +110,7 @@
"templates.test.results.frame_count": "帧数",
"templates.test.results.actual_fps": "实际 FPS",
"templates.test.results.avg_capture_time": "平均采集",
"templates.test.results.resolution": "分辨率:",
"templates.test.error.no_engine": "请选择采集引擎",
"templates.test.error.no_display": "请选择显示器",
"templates.test.error.failed": "测试失败",
@@ -147,6 +150,57 @@
"device.type.dmx.desc": "Art-Net / sACN (E1.31) 舞台灯光",
"device.type.mock": "Mock",
"device.type.mock.desc": "用于测试的虚拟设备",
"device.type.espnow": "ESP-NOW",
"device.type.espnow.desc": "Ultra-low-latency via ESP32 gateway",
"device.type.hue": "Philips Hue",
"device.type.hue.desc": "Hue Entertainment API streaming",
"device.type.usbhid": "USB HID",
"device.type.usbhid.desc": "USB RGB peripherals (keyboards, mice)",
"device.type.spi": "SPI Direct",
"device.type.spi.desc": "Raspberry Pi GPIO/SPI LED strips",
"device.type.chroma": "Razer Chroma",
"device.type.chroma.desc": "Razer peripherals via Chroma SDK",
"device.type.gamesense": "SteelSeries",
"device.type.gamesense.desc": "SteelSeries peripherals via GameSense",
"device.chroma.device_type": "Peripheral Type:",
"device.chroma.device_type.hint": "Which Razer peripheral to control via Chroma SDK",
"device.gamesense.device_type": "Peripheral Type:",
"device.gamesense.device_type.hint": "Which SteelSeries peripheral to control via GameSense",
"device.espnow.peer_mac": "Peer MAC:",
"device.espnow.peer_mac.hint": "MAC address of the remote ESP32 receiver (e.g. AA:BB:CC:DD:EE:FF)",
"device.espnow.channel": "WiFi Channel:",
"device.espnow.channel.hint": "WiFi channel (1-14). Must match the receiver's channel.",
"device.hue.url": "Bridge IP:",
"device.hue.url.hint": "IP address of your Hue bridge",
"device.hue.username": "Bridge Username:",
"device.hue.username.hint": "Hue bridge application key from pairing",
"device.hue.client_key": "Client Key:",
"device.hue.client_key.hint": "Entertainment API client key (hex string from pairing)",
"device.hue.group_id": "Entertainment Group:",
"device.hue.group_id.hint": "Entertainment configuration ID from your Hue bridge",
"device.usbhid.url": "VID:PID:",
"device.usbhid.url.hint": "USB Vendor:Product ID in hex (e.g. 1532:0084)",
"device.spi.url": "GPIO/SPI Path:",
"device.spi.url.hint": "GPIO pin or SPI device path (e.g. spi://gpio:18)",
"device.spi.speed": "SPI Speed (Hz):",
"device.spi.speed.hint": "SPI clock speed. 800000 Hz for WS2812, 2400000 Hz for APA102.",
"device.spi.led_type": "LED Chipset:",
"device.spi.led_type.hint": "Type of addressable LED strip connected to the GPIO/SPI pin",
"device.spi.led_type.ws2812b.desc": "Most common, 800 KHz data, 3-wire RGB",
"device.spi.led_type.ws2812.desc": "Original WS2812, 800 KHz, 3-wire RGB",
"device.spi.led_type.ws2811.desc": "External driver IC, 400 KHz, 12V strips",
"device.spi.led_type.sk6812.desc": "Samsung LED, 800 KHz, 3-wire RGB",
"device.spi.led_type.sk6812_rgbw.desc": "SK6812 with dedicated white channel",
"device.gamesense.peripheral.keyboard": "Keyboard",
"device.gamesense.peripheral.keyboard.desc": "Per-key RGB illumination",
"device.gamesense.peripheral.mouse": "Mouse",
"device.gamesense.peripheral.mouse.desc": "Mouse RGB zones",
"device.gamesense.peripheral.headset": "Headset",
"device.gamesense.peripheral.headset.desc": "Headset earcup lighting",
"device.gamesense.peripheral.mousepad": "Mousepad",
"device.gamesense.peripheral.mousepad.desc": "Mousepad edge lighting zones",
"device.gamesense.peripheral.indicator": "Indicator",
"device.gamesense.peripheral.indicator.desc": "OLED/LED status indicator",
"device.dmx_protocol": "DMX 协议:",
"device.dmx_protocol.hint": "Art-Net 使用 UDP 端口 6454sACN (E1.31) 使用 UDP 端口 5568",
"device.dmx_protocol.artnet.desc": "UDP 单播,端口 6454",
@@ -1461,5 +1515,11 @@
"graph.filter_placeholder": "按名称筛选...",
"graph.filter_clear": "清除筛选",
"graph.filter_running": "运行中",
"graph.filter_stopped": "已停止"
"graph.filter_stopped": "已停止",
"graph.filter_types": "类型",
"graph.filter_group.capture": "捕获",
"graph.filter_group.strip": "色带",
"graph.filter_group.audio": "音频",
"graph.filter_group.targets": "目标",
"graph.filter_group.other": "其他"
}