grid: packing, pinning, resize steps (port of Layout.js and app.py's grid logic). gesture: pointer state machine (tap, long press, drag, release, swipe). updater: release/version parsing and the update decision. vdom: pure virtual DOM with an HTML-text renderer for tests. app: Elm-style Model/Msg/update/view with effects as data, persistence (JSON layout, import of the old WebView build's localStorage), drawer/search, menus, drag and resize. 60 headless tests drive it through pointer input. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
58 lines
1.1 KiB
Plaintext
58 lines
1.1 KiB
Plaintext
// Generated using `moon info`, DON'T EDIT IT
|
|
package "experiments/launcher/gesture"
|
|
|
|
import {
|
|
"moonbitlang/core/debug",
|
|
}
|
|
|
|
// Values
|
|
pub fn classify_swipe(Double, Double, Int32) -> Swipe?
|
|
|
|
pub let hold_ms : Int32
|
|
|
|
pub let slop : Double
|
|
|
|
// Errors
|
|
|
|
// Types and methods
|
|
#derive(Eq, @debug.Debug)
|
|
pub(all) enum Input {
|
|
Down(x~ : Double, y~ : Double, chain~ : Array[Int32])
|
|
Move(x~ : Double, y~ : Double)
|
|
Up(x~ : Double, y~ : Double)
|
|
Cancel
|
|
Hold(Int32)
|
|
}
|
|
|
|
#derive(Eq, @debug.Debug)
|
|
pub(all) enum Out {
|
|
Schedule(Int32, Int32)
|
|
Began(chain~ : Array[Int32], x~ : Double, y~ : Double)
|
|
Tap(chain~ : Array[Int32])
|
|
Press(chain~ : Array[Int32])
|
|
Drag(x~ : Double, y~ : Double, x0~ : Double, y0~ : Double)
|
|
Release(moved~ : Bool, held~ : Bool)
|
|
}
|
|
|
|
pub(all) struct State {
|
|
mut down : Bool
|
|
mut x0 : Double
|
|
mut y0 : Double
|
|
mut moved : Bool
|
|
mut held : Bool
|
|
mut chain : Array[Int32]
|
|
mut token : Int32
|
|
}
|
|
pub fn State::new() -> Self
|
|
pub fn State::step(Self, Input) -> Array[Out]
|
|
|
|
#derive(Eq, @debug.Debug)
|
|
pub(all) enum Swipe {
|
|
Down
|
|
Up
|
|
}
|
|
|
|
// Type aliases
|
|
|
|
// Traits
|