diff --git a/.tool-versions b/.tool-versions index a521d64..fa0adb2 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1,2 @@ -gleam 0.31.0 +gleam 0.32.2 +nodejs 20.9.0 diff --git a/gleam.toml b/gleam.toml index f952cb2..9af4b61 100644 --- a/gleam.toml +++ b/gleam.toml @@ -1,6 +1,7 @@ name = "elektrofoni" version = "1.0.0" target = "javascript" +gleam = ">= 0.32.0" # Fill out these fields if you intend to generate HTML documentation or publish # your project to the Hex package manager. diff --git a/manifest.toml b/manifest.toml index 50a1820..94d0254 100644 --- a/manifest.toml +++ b/manifest.toml @@ -3,15 +3,15 @@ packages = [ { name = "gleam_fetch", version = "0.2.1", build_tools = ["gleam"], requirements = ["gleam_http", "gleam_javascript", "gleam_stdlib"], otp_app = "gleam_fetch", source = "hex", outer_checksum = "F64E93C754D948B2D37ABC4ADD5482FE0FAED4B99C79E66012DDE96BEDC40544" }, - { name = "gleam_http", version = "3.5.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_http", source = "hex", outer_checksum = "FAE9AE3EB1CA90C2194615D20FFFD1E28B630E84DACA670B28D959B37BCBB02C" }, + { name = "gleam_http", version = "3.5.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_http", source = "hex", outer_checksum = "0B09AAE8EB547C4F2F2D3F8917A0A4D2EF75DFF0232389332BAFE19DBBFDB92B" }, { name = "gleam_javascript", version = "0.6.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_javascript", source = "hex", outer_checksum = "BFEBB63ABE4A1694E07DEFD19B160C2980304B5D775A89D4B02E7DE7C9D8008B" }, { name = "gleam_json", version = "0.6.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "thoas"], otp_app = "gleam_json", source = "hex", outer_checksum = "C6CC5BEECA525117E97D0905013AB3F8836537455645DDDD10FE31A511B195EF" }, - { name = "gleam_stdlib", version = "0.31.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "6D1BC5B4D4179B9FEE866B1E69FE180AC2CE485AD90047C0B32B2CA984052736" }, + { name = "gleam_stdlib", version = "0.32.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "07D64C26D014CF570F8ACADCE602761EA2E74C842D26F2FD49B0D61973D9966F" }, { name = "gleeunit", version = "0.11.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "1397E5C4AC4108769EE979939AC39BF7870659C5AFB714630DEEEE16B8272AD5" }, - { name = "lustre", version = "3.0.9", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "lustre", source = "hex", outer_checksum = "CBD20163B7CB7FA2AC2BCFBAB5A083B22AED9612B6522BE479E8FEF09C82A9E1" }, - { name = "plinth", version = "0.1.4", build_tools = ["gleam"], requirements = ["gleam_stdlib", "gleam_javascript"], otp_app = "plinth", source = "hex", outer_checksum = "43307A0271B8AC9B646B3C39F80D22C41DB4022CDAD67ABFAA555BB3F1321E2E" }, + { name = "lustre", version = "3.0.10", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "lustre", source = "hex", outer_checksum = "4D08E12E190FA9F469C1C766AEC66728518B3718D438EDDE28E94D5843B0A5A1" }, + { name = "plinth", version = "0.1.4", build_tools = ["gleam"], requirements = ["gleam_javascript", "gleam_stdlib"], otp_app = "plinth", source = "hex", outer_checksum = "43307A0271B8AC9B646B3C39F80D22C41DB4022CDAD67ABFAA555BB3F1321E2E" }, { name = "thoas", version = "0.4.1", build_tools = ["rebar3"], requirements = [], otp_app = "thoas", source = "hex", outer_checksum = "4918D50026C073C4AB1388437132C77A6F6F7C8AC43C60C13758CC0ADCE2134E" }, - { name = "varasto", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "plinth", "gleam_json"], otp_app = "varasto", source = "hex", outer_checksum = "0621E5BFD0B9B7F7D19B8FC6369C6E2EAC5C1F3858A1E5E51342F5BCE10C3728" }, + { name = "varasto", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib", "plinth"], otp_app = "varasto", source = "hex", outer_checksum = "0621E5BFD0B9B7F7D19B8FC6369C6E2EAC5C1F3858A1E5E51342F5BCE10C3728" }, ] [requirements] diff --git a/src/elekf/library.gleam b/src/elekf/library.gleam index 5e7a6ee..9ef2caa 100644 --- a/src/elekf/library.gleam +++ b/src/elekf/library.gleam @@ -1,9 +1,9 @@ //// The library stores the music library retrieved from iBroadcast. -import gleam/map.{Map} -import elekf/library/track.{Track} -import elekf/library/album.{Album} -import elekf/library/artist.{Artist} +import gleam/map.{type Map} +import elekf/library/track.{type Track} +import elekf/library/album.{type Album} +import elekf/library/artist.{type Artist} pub type Library { Library( diff --git a/src/elekf/library/album_utils.gleam b/src/elekf/library/album_utils.gleam index 25e94ad..4f0a086 100644 --- a/src/elekf/library/album_utils.gleam +++ b/src/elekf/library/album_utils.gleam @@ -1,6 +1,6 @@ import gleam/list -import elekf/library.{Library} -import elekf/library/album.{Album} +import elekf/library.{type Library} +import elekf/library/album.{type Album} /// Get the individual tracks in an album. pub fn get_tracks(library: Library, album: Album) { diff --git a/src/elekf/transfer/album.gleam b/src/elekf/transfer/album.gleam index ba7a78c..011035f 100644 --- a/src/elekf/transfer/album.gleam +++ b/src/elekf/transfer/album.gleam @@ -1,5 +1,5 @@ import gleam/string -import ibroadcast/library/library.{Album as APIAlbum} +import ibroadcast/library/library.{type Album as APIAlbum} import elekf/library/album.{Album} /// Converts API album response to library format. diff --git a/src/elekf/transfer/artist.gleam b/src/elekf/transfer/artist.gleam index 31fa9a3..e48b8d6 100644 --- a/src/elekf/transfer/artist.gleam +++ b/src/elekf/transfer/artist.gleam @@ -1,5 +1,5 @@ import gleam/string -import ibroadcast/library/library.{Artist as APIArtist} +import ibroadcast/library/library.{type Artist as APIArtist} import elekf/library/artist.{Artist} /// Converts API artist response to library format. diff --git a/src/elekf/transfer/library.gleam b/src/elekf/transfer/library.gleam index bc286f2..c7e4465 100644 --- a/src/elekf/transfer/library.gleam +++ b/src/elekf/transfer/library.gleam @@ -1,6 +1,6 @@ import gleam/list -import gleam/map.{Map} -import ibroadcast/library/library.{Library as APILibrary} as api_library +import gleam/map.{type Map} +import ibroadcast/library/library.{type Library as APILibrary} as api_library import elekf/library.{Library} import elekf/transfer/album import elekf/transfer/artist diff --git a/src/elekf/transfer/track.gleam b/src/elekf/transfer/track.gleam index c0f81bf..4d55081 100644 --- a/src/elekf/transfer/track.gleam +++ b/src/elekf/transfer/track.gleam @@ -1,5 +1,5 @@ import gleam/string -import ibroadcast/library/library.{Track as APITrack} +import ibroadcast/library/library.{type Track as APITrack} import elekf/library/track.{Track} /// Converts API track response to library format. diff --git a/src/elekf/utils/date.gleam b/src/elekf/utils/date.gleam index 3631ffd..82408e3 100644 --- a/src/elekf/utils/date.gleam +++ b/src/elekf/utils/date.gleam @@ -1,6 +1,6 @@ import gleam/result -import gleam/order.{Eq, Gt, Lt, Order} -import gleam/dynamic.{DecodeError, Dynamic} +import gleam/order.{type Order, Eq, Gt, Lt} +import gleam/dynamic.{type DecodeError, type Dynamic, DecodeError} pub type Date diff --git a/src/elekf/web/authed_view.gleam b/src/elekf/web/authed_view.gleam index a038743..49a6114 100644 --- a/src/elekf/web/authed_view.gleam +++ b/src/elekf/web/authed_view.gleam @@ -10,17 +10,17 @@ import lustre/element/html.{button, div, nav, p} import lustre/attribute import lustre/effect import lustre/event -import elekf/web/common.{PlayQueue} +import elekf/web/common.{type PlayQueue} import ibroadcast/library/library as library_api -import ibroadcast/authed_request.{RequestConfig} +import ibroadcast/authed_request.{type RequestConfig, RequestConfig} import elekf/api/base_request_config.{base_request_config} import elekf/utils/http -import elekf/library.{Library} -import elekf/library/artist.{Artist} -import elekf/library/track.{Track} +import elekf/library.{type Library} +import elekf/library/artist.{type Artist} +import elekf/library/track.{type Track} import elekf/transfer/library as library_transfer import elekf/web/components/player -import elekf/web/components/library_item.{LibraryItem} +import elekf/web/components/library_item.{type LibraryItem} import elekf/web/components/library_view import elekf/web/components/library_views/tracks_view import elekf/web/components/library_views/artists_view diff --git a/src/elekf/web/common.gleam b/src/elekf/web/common.gleam index 6bbd823..ad6035f 100644 --- a/src/elekf/web/common.gleam +++ b/src/elekf/web/common.gleam @@ -1,4 +1,4 @@ -import elekf/library/track.{Track} +import elekf/library/track.{type Track} import elekf/api/auth/models as auth_models /// A queue of tracks to play, with their IDs. diff --git a/src/elekf/web/components/library_view.gleam b/src/elekf/web/components/library_view.gleam index 333d8e7..9bda60a 100644 --- a/src/elekf/web/components/library_view.gleam +++ b/src/elekf/web/components/library_view.gleam @@ -12,13 +12,13 @@ import lustre/element.{text} import lustre/element/html.{div, h3} import lustre/attribute import lustre/event -import elekf/library.{Library} -import elekf/library/track.{Track} -import elekf/library/artist.{Artist} +import elekf/library.{type Library} +import elekf/library/track.{type Track} +import elekf/library/artist.{type Artist} import elekf/web/events/start_play import elekf/web/events/show_artist import elekf/web/components/search -import elekf/web/components/library_item.{LibraryItem} +import elekf/web/components/library_item.{type LibraryItem} import elekf/web/common /// Function to get the data of the view from the library. diff --git a/src/elekf/web/components/library_views/album_item.gleam b/src/elekf/web/components/library_views/album_item.gleam index ee43579..7a38b96 100644 --- a/src/elekf/web/components/library_views/album_item.gleam +++ b/src/elekf/web/components/library_views/album_item.gleam @@ -9,10 +9,10 @@ import lustre/attribute import lustre/event import ibroadcast/artwork import elekf/library -import elekf/library/album.{Album} +import elekf/library/album.{type Album} import elekf/library/album_utils -import elekf/web/components/library_view.{Model, StartPlay} -import elekf/web/components/library_item.{LibraryItem} +import elekf/web/components/library_view.{type Model, StartPlay} +import elekf/web/components/library_item.{type LibraryItem} pub fn view( model: Model(Album), @@ -32,7 +32,6 @@ pub fn view( [ attribute.id("album-list-" <> int.to_string(album_id)), attribute.class("library-item album-item"), - attribute.type_("button"), event.on_click(StartPlay(tracks, 0)), attribute.attribute("role", "button"), ], diff --git a/src/elekf/web/components/library_views/albums_view.gleam b/src/elekf/web/components/library_views/albums_view.gleam index 677662d..a50d370 100644 --- a/src/elekf/web/components/library_views/albums_view.gleam +++ b/src/elekf/web/components/library_views/albums_view.gleam @@ -5,11 +5,11 @@ import gleam/list import gleam/map import gleam/option import lustre/attribute -import elekf/library.{Library} -import elekf/library/album.{Album} +import elekf/library.{type Library} +import elekf/library/album.{type Album} import elekf/library/album_utils import elekf/web/components/library_view -import elekf/web/components/library_item.{LibraryItem} +import elekf/web/components/library_item.{type LibraryItem} import elekf/web/components/library_views/album_item import elekf/web/common diff --git a/src/elekf/web/components/library_views/artists_view.gleam b/src/elekf/web/components/library_views/artists_view.gleam index eff6284..7cf47d4 100644 --- a/src/elekf/web/components/library_views/artists_view.gleam +++ b/src/elekf/web/components/library_views/artists_view.gleam @@ -10,10 +10,10 @@ import lustre/element.{text} import lustre/attribute import lustre/event import ibroadcast/artwork -import elekf/library.{Library} -import elekf/library/artist.{Artist} -import elekf/web/components/library_view.{Model, ShowArtist} -import elekf/web/components/library_item.{LibraryItem} +import elekf/library.{type Library} +import elekf/library/artist.{type Artist} +import elekf/web/components/library_view.{type Model, ShowArtist} +import elekf/web/components/library_item.{type LibraryItem} import elekf/web/common const component_name = "artists-view" diff --git a/src/elekf/web/components/library_views/single_artist_view.gleam b/src/elekf/web/components/library_views/single_artist_view.gleam index 8d6cafc..89bbb3c 100644 --- a/src/elekf/web/components/library_views/single_artist_view.gleam +++ b/src/elekf/web/components/library_views/single_artist_view.gleam @@ -11,12 +11,12 @@ import lustre/element/html.{div, header} import lustre/element.{text} import lustre/attribute import lustre/effect -import elekf/library.{Library} -import elekf/library/album.{Album} +import elekf/library.{type Library} +import elekf/library/album.{type Album} import elekf/library/album_utils -import elekf/library/artist.{Artist} +import elekf/library/artist.{type Artist} import elekf/web/components/library_view -import elekf/web/components/library_item.{LibraryItem} +import elekf/web/components/library_item.{type LibraryItem} import elekf/web/components/library_views/album_item import elekf/web/common diff --git a/src/elekf/web/components/library_views/tracks_view.gleam b/src/elekf/web/components/library_views/tracks_view.gleam index 6ec740a..c3812c6 100644 --- a/src/elekf/web/components/library_views/tracks_view.gleam +++ b/src/elekf/web/components/library_views/tracks_view.gleam @@ -9,10 +9,10 @@ import lustre/element/html.{div, h3, p} import lustre/element.{text} import lustre/attribute import lustre/event -import elekf/library.{Library} -import elekf/library/track.{Track} -import elekf/web/components/library_view.{Model, StartPlay} -import elekf/web/components/library_item.{LibraryItem} +import elekf/library.{type Library} +import elekf/library/track.{type Track} +import elekf/web/components/library_view.{type Model, StartPlay} +import elekf/web/components/library_item.{type LibraryItem} import elekf/web/common const component_name = "tracks-view" diff --git a/src/elekf/web/components/player.gleam b/src/elekf/web/components/player.gleam index c544d90..8b61aa1 100644 --- a/src/elekf/web/components/player.gleam +++ b/src/elekf/web/components/player.gleam @@ -12,9 +12,9 @@ import elektrofoni import elekf/web/common import elekf/web/components/icon.{Alt, icon} import elekf/web/components/track_length.{track_length} -import elekf/library/track.{Track} +import elekf/library/track.{type Track} import elekf/utils/date -import ibroadcast/authed_request.{RequestConfig} +import ibroadcast/authed_request.{type RequestConfig} import ibroadcast/streaming pub type PlayState { diff --git a/src/elekf/web/events/show_artist.gleam b/src/elekf/web/events/show_artist.gleam index 304c669..9ddaf10 100644 --- a/src/elekf/web/events/show_artist.gleam +++ b/src/elekf/web/events/show_artist.gleam @@ -1,9 +1,9 @@ import gleam/result import gleam/dynamic import lustre/event -import elekf/library/artist.{Artist} -import elekf/web/components/library_item.{LibraryItem} -import elekf/utils/custom_event.{CustomEvent} +import elekf/library/artist.{type Artist} +import elekf/web/components/library_item.{type LibraryItem} +import elekf/utils/custom_event.{type CustomEvent} const event_name = "show-artist" diff --git a/src/elekf/web/events/start_play.gleam b/src/elekf/web/events/start_play.gleam index 6ab00de..7d9d5c5 100644 --- a/src/elekf/web/events/start_play.gleam +++ b/src/elekf/web/events/start_play.gleam @@ -1,8 +1,8 @@ import gleam/result import gleam/dynamic import lustre/event -import elekf/web/common.{PlayQueue} -import elekf/utils/custom_event.{CustomEvent} +import elekf/web/common.{type PlayQueue} +import elekf/utils/custom_event.{type CustomEvent} const event_name = "start-play" diff --git a/src/elekf/web/utils.gleam b/src/elekf/web/utils.gleam index 1d8d5eb..51b0f8b 100644 --- a/src/elekf/web/utils.gleam +++ b/src/elekf/web/utils.gleam @@ -1,4 +1,4 @@ -import lustre/effect.{Effect} +import lustre/effect.{type Effect} /// Update child view of a given view. /// diff --git a/src/ibroadcast/auth/login_token.gleam b/src/ibroadcast/auth/login_token.gleam index 17ca374..7f727d5 100644 --- a/src/ibroadcast/auth/login_token.gleam +++ b/src/ibroadcast/auth/login_token.gleam @@ -2,9 +2,9 @@ import gleam/dynamic import gleam/result import gleam/json import gleam/javascript/promise -import ibroadcast/request_params.{RequestParams} -import ibroadcast/request.{DecodeFailed, RequestConfig, ResponseError} -import ibroadcast/http.{Requestor} +import ibroadcast/request_params.{type RequestParams} +import ibroadcast/request.{type RequestConfig, type ResponseError, DecodeFailed} +import ibroadcast/http.{type Requestor} import ibroadcast/servers pub type Session { diff --git a/src/ibroadcast/auth/logout.gleam b/src/ibroadcast/auth/logout.gleam index 8a33891..a81aea2 100644 --- a/src/ibroadcast/auth/logout.gleam +++ b/src/ibroadcast/auth/logout.gleam @@ -1,5 +1,5 @@ import gleam/json -import ibroadcast/request_params.{RequestParams} +import ibroadcast/request_params.{type RequestParams} pub fn request_params() -> RequestParams { [#("mode", json.string("logout"))] diff --git a/src/ibroadcast/authed_request.gleam b/src/ibroadcast/authed_request.gleam index b0da1c5..deecdbd 100644 --- a/src/ibroadcast/authed_request.gleam +++ b/src/ibroadcast/authed_request.gleam @@ -1,7 +1,7 @@ import gleam/uri import gleam/json -import ibroadcast/http.{Requestor} -import ibroadcast/request_params.{RequestParams} +import ibroadcast/http.{type Requestor} +import ibroadcast/request_params.{type RequestParams} import ibroadcast/request import ibroadcast/utils diff --git a/src/ibroadcast/library/library.gleam b/src/ibroadcast/library/library.gleam index 4020f0c..370a024 100644 --- a/src/ibroadcast/library/library.gleam +++ b/src/ibroadcast/library/library.gleam @@ -1,14 +1,14 @@ import gleam/javascript/promise import gleam/json -import gleam/map.{Map} +import gleam/map.{type Map} import gleam/dynamic import gleam/result import gleam/option import ibroadcast/servers import ibroadcast/request.{DecodeFailed} -import ibroadcast/authed_request.{RequestConfig} -import ibroadcast/request_params.{RequestParams} -import ibroadcast/http.{Requestor} +import ibroadcast/authed_request.{type RequestConfig} +import ibroadcast/request_params.{type RequestParams} +import ibroadcast/http.{type Requestor} import ibroadcast/map_format pub type Album { diff --git a/src/ibroadcast/map_format.gleam b/src/ibroadcast/map_format.gleam index aee9b07..5491335 100644 --- a/src/ibroadcast/map_format.gleam +++ b/src/ibroadcast/map_format.gleam @@ -1,7 +1,7 @@ import gleam/result -import gleam/map.{Map} +import gleam/map.{type Map} import gleam/int -import gleam/dynamic.{Decoder} +import gleam/dynamic.{type Decoder} /// This decoder will attempt to decode a gleam `Map` using the provided decoders. /// If either a key or a value fails to decode, that entry is just ignored. diff --git a/src/ibroadcast/request.gleam b/src/ibroadcast/request.gleam index ce7cb3a..bfb7e1a 100644 --- a/src/ibroadcast/request.gleam +++ b/src/ibroadcast/request.gleam @@ -5,10 +5,10 @@ import gleam/http/request import gleam/javascript/promise import gleam/json import ibroadcast/utils -import ibroadcast/http.{Requestor} -import ibroadcast/app_info.{AppInfo} -import ibroadcast/device_info.{DeviceInfo} -import ibroadcast/request_params.{RequestParams} +import ibroadcast/http.{type Requestor} +import ibroadcast/app_info.{type AppInfo} +import ibroadcast/device_info.{type DeviceInfo} +import ibroadcast/request_params.{type RequestParams} pub type RequestConfig { RequestConfig(app_info: AppInfo, device_info: DeviceInfo) diff --git a/src/ibroadcast/streaming.gleam b/src/ibroadcast/streaming.gleam index 13b9f95..7f9592b 100644 --- a/src/ibroadcast/streaming.gleam +++ b/src/ibroadcast/streaming.gleam @@ -2,7 +2,7 @@ import gleam/string import gleam/int import gleam/uri import gleam/option -import ibroadcast/authed_request.{RequestConfig} +import ibroadcast/authed_request.{type RequestConfig} pub fn form_url( track_file: String, diff --git a/src/ibroadcast/utils.gleam b/src/ibroadcast/utils.gleam index 4642988..64a797a 100644 --- a/src/ibroadcast/utils.gleam +++ b/src/ibroadcast/utils.gleam @@ -1,6 +1,6 @@ import gleam/map import gleam/list -import ibroadcast/request_params.{RequestParams} +import ibroadcast/request_params.{type RequestParams} /// Combine two request parameter lists into one, later values override former. pub fn combine_params(params: List(RequestParams)) -> RequestParams {