KeSp_controller/ui/components/dark_line_edit.slint
Mae PUGIN 3e54361d0d refactor: Modularize main.rs (2478 → 58 lines), flat architecture
Split monolithic main.rs into domain modules:
- context.rs: AppContext shared state, BgMsg enum, serial_spawn helper
- models.rs: UI model builders, keycap labels, key entries, layout preview
- config.rs: keyboard config export/import via binary protocol
- dispatch.rs: BgMsg handler + WPM/layout timers
- keymap.rs: key selection, layer switch/rename, heatmap toggle
- key_selector.rs: dispatch_keycode router, apply_keycode, hex/MT/LT
- macros.rs: macro CRUD, shortcut presets, step builder
- advanced.rs: combos, KO, leaders, tap dance, BT, tama, autoshift
- settings.rs: OTA flash, config backup, keyboard layout
- flasher.rs: ESP32 bootloader flash
- layout.rs: layout JSON preview, load/export
- connection.rs: serial connect/disconnect, tab auto-refresh
- stats.rs: stats refresh

Rename logic/ → protocol/ with cleaner file names.
Remove unused original-src/ directory.
Fix DarkLineEdit double styling, add rename popup, macro shortcuts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 12:02:22 +02:00

41 lines
1.1 KiB
Text

import { Theme } from "../theme.slint";
export component DarkLineEdit inherits Rectangle {
in property <string> placeholder-text: "";
in-out property <string> text: "";
callback accepted(string);
callback edited(string);
forward-focus: inner;
height: 28px;
min-width: 60px;
border-radius: 4px;
border-width: 1px;
border-color: inner.has-focus ? Theme.accent-purple : Theme.button-border;
background: Theme.button-bg;
// Placeholder
if root.text == "" && !inner.has-focus : Text {
x: 6px;
y: 0;
width: root.width - 12px;
height: root.height;
text: root.placeholder-text;
color: Theme.fg-secondary;
font-size: 12px;
vertical-alignment: center;
}
inner := TextInput {
x: 6px;
y: 0;
width: root.width - 12px;
height: root.height;
text <=> root.text;
color: Theme.fg-primary;
font-size: 12px;
vertical-alignment: center;
accepted => { root.accepted(root.text); }
edited => { root.edited(root.text); }
}
}