Left-clicking the Digital Clock (or the Binary Clock) opens a calendar flyout that slides up out of the panel; Escape, a click elsewhere or another click on the clock slides it back in. - lib/clock/calendar.mbt: month maths (leap years, weekday, ISO week numbers), a six-week grid, the flyout's state, drawing and hit testing. Header with the time (in the clock's own 12/24-hour format) and the long date; month and year with previous / Today / next buttons; weekday names; today circled in the accent colour, other months' days muted. Keys: Escape closes, t today, p/n previous/next month. - Module settings (right click): "Week starts on" Sunday/Monday and "Show week numbers", for both clocks (saved per module like the other settings). - compositor/shell/slide.mbt: popups of the clock modules slide (200 ms, ease-out in, ease-in out), clipped to their final place so they come out of the panel edge; the popup takes input at its final place at once. A popup below the panel would slide the other way. Theme comes from the module's tokens, so dark/light follow. - CPU: has_timed_work() is true only while a slide runs, so the main loop only keeps the frame pace for those 200 ms; an open calendar redraws only when its minute or month changes. - Tests: lib/clock calendar tests (wasm), compositor/host/calendar_test.mbt (open, slide finishes, month buttons, Escape / click outside / toggle, settings, binary clock). Host failures are the 5 known input_test ones. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hjahaLE5XqnCWoEwKv
This commit is contained in:
9 files changed
+893
-18
No files matched your search
@@ -18,12 +18,18 @@ pub fn render(size : @types.Size) -> Array[@types.DrawOp] {
|
||||
@logic.render_binary(size, @theme.get_tokens(), @clock.now(), seconds=@logic.binary_config.seconds)
|
||||
}
|
||||
|
||||
///|
|
||||
///| The calendar flyout (left click opens it; the shell slides it out of the panel).
|
||||
pub fn popup() -> PopupSurface? {
|
||||
None
|
||||
let cal = @logic.binary_config.cal
|
||||
if !cal.open {
|
||||
return None
|
||||
}
|
||||
let (w, h) = cal.size()
|
||||
let ops = cal.render(@theme.get_tokens(), @clock.now())
|
||||
Some({ size: { w: w.reinterpret_as_uint(), h: h.reinterpret_as_uint() }, ops })
|
||||
}
|
||||
|
||||
///|
|
||||
pub fn on_event(_target : Surface, _event : @types.InputEvent) -> Bool {
|
||||
false
|
||||
pub fn on_event(target : Surface, event : @types.InputEvent) -> Bool {
|
||||
@logic.binary_config.cal.handle(target is POPUP, event, @clock.now())
|
||||
}
|
||||
@@ -19,12 +19,18 @@ pub fn render(size : @types.Size) -> Array[@types.DrawOp] {
|
||||
@logic.render_digital(size, @theme.get_tokens(), @clock.now(), hour12=c.hour12, show_date=c.show_date, ampm=c.ampm)
|
||||
}
|
||||
|
||||
///|
|
||||
///| The calendar flyout (left click opens it; the shell slides it out of the panel).
|
||||
pub fn popup() -> PopupSurface? {
|
||||
None
|
||||
let c = @logic.digital_config
|
||||
if !c.cal.open {
|
||||
return None
|
||||
}
|
||||
let (w, h) = c.cal.size()
|
||||
let ops = c.cal.render(@theme.get_tokens(), @clock.now(), hour12=c.hour12, ampm=c.ampm)
|
||||
Some({ size: { w: w.reinterpret_as_uint(), h: h.reinterpret_as_uint() }, ops })
|
||||
}
|
||||
|
||||
///|
|
||||
pub fn on_event(_target : Surface, _event : @types.InputEvent) -> Bool {
|
||||
false
|
||||
pub fn on_event(target : Surface, event : @types.InputEvent) -> Bool {
|
||||
@logic.digital_config.cal.handle(target is POPUP, event, @clock.now())
|
||||
}
|
||||
Reference in new issue
Block a user