From f18229e7be7b282c8008c151b13eff0f112e98fd Mon Sep 17 00:00:00 2001 From: rebecca <802632-arkandos@users.noreply.gitlab.com> Date: Sun, 3 May 2026 19:42:16 +0200 Subject: [PATCH] msg -> message --- src/off_topic.gleam | 80 ++++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 37 deletions(-) diff --git a/src/off_topic.gleam b/src/off_topic.gleam index 88947e3..2681f5a 100644 --- a/src/off_topic.gleam +++ b/src/off_topic.gleam @@ -262,7 +262,7 @@ pub fn component( /// Prefer serving the pre-built file from off_topic's `priv/static` directory /// when possible. This inline version is useful for development or when you /// do not control the HTML document. -pub fn script() -> Element(msg) { +pub fn script() -> Element(message) { html.script( [attribute.type_("module")], // <> @@ -748,7 +748,9 @@ pub fn on_wheel(send message: fn(Wheel) -> message) -> Subscription(message) { /// Dispatch the current window size, then again whenever it changes. /// /// See also: [breakpoints](#breakpoints), [tailwind_breakpoints](#tailwind_breakpoints) -pub fn window_size(send message: fn(Int, Int) -> msg) -> Subscription(msg) { +pub fn window_size( + send message: fn(Int, Int) -> message, +) -> Subscription(message) { case lustre.is_browser() { True -> { use dispatch <- from(watching: [dep("off-topic/window-size")]) @@ -772,8 +774,8 @@ pub type ScreenOrientation { /// Dispatch the current screen orientation, then again whenever it changes. pub fn screen_orientation( - send message: fn(ScreenOrientation) -> msg, -) -> Subscription(msg) { + send message: fn(ScreenOrientation) -> message, +) -> Subscription(message) { case lustre.is_browser() { True -> { use dispatch <- from(watching: [dep("off-topic/screen-orientation")]) @@ -824,7 +826,9 @@ fn string_decoder( } /// Dispatch the current scroll position, then again whenever it changes. -pub fn window_scroll(send message: fn(Int, Int) -> msg) -> Subscription(msg) { +pub fn window_scroll( + send message: fn(Int, Int) -> message, +) -> Subscription(message) { case lustre.is_browser() { True -> { use dispatch <- from(watching: [dep("off-topic/window-scroll")]) @@ -939,7 +943,9 @@ fn parse_page_state(s: String) -> Result(PageState, Nil) { /// /// Only reliable when the window has focus; browsers do not consistently /// deliver pointer events to unfocused windows. -pub fn window_hover(send message: fn(Bool) -> msg) -> Subscription(msg) { +pub fn window_hover( + send message: fn(Bool) -> message, +) -> Subscription(message) { case lustre.is_browser() { True -> { use dispatch <- from(watching: [dep("off-topic/window-hover")]) @@ -1038,8 +1044,8 @@ fn no_decoder() -> Decoder(message) { /// [element_scroll](#element_scroll), [element_visible](#element_visible) pub fn element_size( selector selector: String, - send message: fn(Int, Int) -> msg, -) -> Subscription(msg) { + send message: fn(Int, Int) -> message, +) -> Subscription(message) { case lustre.is_browser() { True -> { use dispatch, el <- element(watching: [dep(selector)]) @@ -1064,8 +1070,8 @@ pub fn element_size( /// [element_visible](#element_visible) pub fn element_scroll( selector selector: String, - send message: fn(Int, Int) -> msg, -) -> Subscription(msg) { + send message: fn(Int, Int) -> message, +) -> Subscription(message) { case lustre.is_browser() { True -> { use dispatch, el <- element(watching: [dep(selector)]) @@ -1160,8 +1166,8 @@ fn scroll_alignment_string(alignment: ScrollAlignment) -> String { /// See also: [element_size](#element_size), [element_scroll](#element_scroll) pub fn element_visible( selector selector: String, - send message: fn(Bool) -> msg, -) -> Subscription(msg) { + send message: fn(Bool) -> message, +) -> Subscription(message) { case lustre.is_browser() { True -> { use dispatch, el <- element(watching: [dep(selector)]) @@ -1323,7 +1329,7 @@ pub fn form_value(value value: Option(String)) -> Subscription(message) { /// Dispatch the current navigator language, then again whenever it changes. /// /// Dispatches a BCP 47 language tag such as `"en-US"`. -pub fn language(send message: fn(String) -> msg) -> Subscription(msg) { +pub fn language(send message: fn(String) -> message) -> Subscription(message) { case lustre.is_browser() { True -> { use dispatch <- from(watching: [dep("off-topic/language")]) @@ -1344,8 +1350,8 @@ pub type ColourScheme { /// /// See also: [contrast](#contrast), [reduced_motion](#reduced_motion) pub fn colour_scheme( - send message: fn(ColourScheme) -> msg, -) -> Subscription(msg) { + send message: fn(ColourScheme) -> message, +) -> Subscription(message) { use s <- media_query(dep("off-topic/color-scheme"), "light", [ #("(prefers-color-scheme: dark)", "dark"), ]) @@ -1368,8 +1374,8 @@ pub type ContrastPreference { /// /// See also: [colour_scheme](#colour_scheme), [reduced_motion](#reduced_motion) pub fn contrast( - send message: fn(ContrastPreference) -> msg, -) -> Subscription(msg) { + send message: fn(ContrastPreference) -> message, +) -> Subscription(message) { use s <- media_query(dep("off-topic/contrast"), "none", [ #("(prefers-contrast: more)", "more"), #("(prefers-contrast: less)", "less"), @@ -1394,8 +1400,8 @@ pub type MotionPreference { /// /// See also: [colour_scheme](#colour_scheme), [contrast](#contrast) pub fn reduced_motion( - send message: fn(MotionPreference) -> msg, -) -> Subscription(msg) { + send message: fn(MotionPreference) -> message, +) -> Subscription(message) { use s <- media_query(dep("off-topic/reduced-motion"), "no-preference", [ #("(prefers-reduced-motion: reduce)", "reduce"), ]) @@ -1465,8 +1471,8 @@ fn media_query( name: Dependency, fallback: String, pairs: List(#(String, String)), - convert: fn(String) -> msg, -) -> Subscription(msg) { + convert: fn(String) -> message, +) -> Subscription(message) { case lustre.is_browser() { True -> { use dispatch <- from(watching: [name]) @@ -1496,8 +1502,8 @@ fn media_query( /// See also: [session_storage](#session_storage), [set_local_storage](#set_local_storage) pub fn local_storage( key key: String, - send message: fn(Option(String)) -> msg, -) -> Subscription(msg) { + send message: fn(Option(String)) -> message, +) -> Subscription(message) { case lustre.is_browser() { True -> { use dispatch <- from([dep("off-topic/local-storage"), dep(key)]) @@ -1524,8 +1530,8 @@ pub fn local_storage( /// See also: [local_storage](#local_storage) pub fn session_storage( key key: String, - send message: fn(Option(String)) -> msg, -) -> Subscription(msg) { + send message: fn(Option(String)) -> message, +) -> Subscription(message) { case lustre.is_browser() { True -> { use dispatch <- from([dep("off-topic/session-storage"), dep(key)]) @@ -1703,8 +1709,8 @@ pub fn every( /// See also: [page_state](#page_state), [window_hover](#window_hover) pub fn on_idle( after timeout: Duration, - send message: fn(Bool) -> msg, -) -> Subscription(msg) { + send message: fn(Bool) -> message, +) -> Subscription(message) { let ms = duration.to_milliseconds(timeout) case lustre.is_browser() { True -> { @@ -1761,7 +1767,7 @@ fn foldp( /// Dispatch the current network status, then again whenever it changes. /// /// Dispatches `True` when online and `False` when offline. -pub fn online(send message: fn(Bool) -> msg) -> Subscription(msg) { +pub fn online(send message: fn(Bool) -> message) -> Subscription(message) { use dispatch <- from(watching: [dep("off-topic/online")]) subscriptions.online(fn(b) { dispatch(message(b)) }) } @@ -1776,10 +1782,10 @@ pub fn online(send message: fn(Bool) -> msg) -> Subscription(msg) { /// `on_error` fires when the connection is lost, before the next retry. pub fn server_sent_events( url url: String, - on_open opened: msg, - on_message message: fn(String, String) -> msg, - on_error errored: msg, -) -> Subscription(msg) { + on_open opened: message, + on_message message: fn(String, String) -> message, + on_error errored: message, +) -> Subscription(message) { use dispatch <- from(watching: [dep(url)]) subscriptions.sse( url, @@ -1808,10 +1814,10 @@ pub type WebsocketMessage { /// See also: [websocket_send](#websocket_send) pub fn websocket( url url: String, - on_open opened: msg, - on_message message: fn(WebsocketMessage) -> msg, - on_error errored: fn(String) -> msg, -) -> Subscription(msg) { + on_open opened: message, + on_message message: fn(WebsocketMessage) -> message, + on_error errored: fn(String) -> message, +) -> Subscription(message) { use dispatch <- from(watching: [dep(url)]) subscriptions.websocket( url, @@ -1831,7 +1837,7 @@ pub fn websocket( pub fn websocket_send( url url: String, data data: WebsocketMessage, -) -> Effect(msg) { +) -> Effect(message) { effect.from(fn(_) { case data { TextFrame(text) -> commands.websocket_send_text(url, text) -- 2.51.2