Packages

🍩 Lustre Bindings to Oat UI Components

Current section

Files

Jump to
glaze_oat src glaze_oat@progress.erl
Raw

src/glaze_oat@progress.erl

-module(glaze_oat@progress).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/glaze_oat/progress.gleam").
-export([progress/1, value/1, value_int/1, value_float/1, max/1, max_int/1, max_float/1]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(
" Oat documentation: <https://oat.ink/components/progress/>\n"
"\n"
" Progress helpers for linear completion indicators.\n"
"\n"
" ## Anatomy\n"
"\n"
" Use [`progress`](#progress) with [`value`](#value) and [`max`](#max) to show\n"
" task completion. Typed helpers are available for `Int` and `Float` values.\n"
"\n"
" ## Recipe\n"
"\n"
" ```gleam\n"
" import glaze_oat/progress\n"
"\n"
" progress.progress([\n"
" progress.value_int(32),\n"
" progress.max_int(100),\n"
" ])\n"
" ```\n"
"\n"
" ## References\n"
"\n"
" - MDN `<progress>`: <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress>\n"
).
-file("src/glaze_oat/progress.gleam", 31).
-spec progress(list(lustre@vdom@vattr:attribute(QKK))) -> lustre@vdom@vnode:element(QKK).
progress(Attrs) ->
lustre@element@html:progress(Attrs, []).
-file("src/glaze_oat/progress.gleam", 35).
-spec value(binary()) -> lustre@vdom@vattr:attribute(any()).
value(Amount) ->
lustre@attribute:value(Amount).
-file("src/glaze_oat/progress.gleam", 39).
-spec value_int(integer()) -> lustre@vdom@vattr:attribute(any()).
value_int(Amount) ->
value(erlang:integer_to_binary(Amount)).
-file("src/glaze_oat/progress.gleam", 43).
-spec value_float(float()) -> lustre@vdom@vattr:attribute(any()).
value_float(Amount) ->
value(gleam_stdlib:float_to_string(Amount)).
-file("src/glaze_oat/progress.gleam", 47).
-spec max(binary()) -> lustre@vdom@vattr:attribute(any()).
max(Amount) ->
lustre@attribute:max(Amount).
-file("src/glaze_oat/progress.gleam", 51).
-spec max_int(integer()) -> lustre@vdom@vattr:attribute(any()).
max_int(Amount) ->
max(erlang:integer_to_binary(Amount)).
-file("src/glaze_oat/progress.gleam", 55).
-spec max_float(float()) -> lustre@vdom@vattr:attribute(any()).
max_float(Amount) ->
max(gleam_stdlib:float_to_string(Amount)).