Packages

🍩 Lustre Bindings to Oat UI Components

Current section

Files

Jump to
glaze_oat src glaze@oat@meter.erl
Raw

src/glaze@oat@meter.erl

-module(glaze@oat@meter).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/glaze/oat/meter.gleam").
-export([meter/1, value/1, value_int/1, value_float/1, min/1, min_int/1, min_float/1, max/1, max_int/1, max_float/1, low/1, low_int/1, low_float/1, high/1, high_int/1, high_float/1, optimum/1, optimum_int/1, optimum_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/meter/>\n"
"\n"
" Meter helpers for scalar values within a known range.\n"
"\n"
" ## Anatomy\n"
"\n"
" Use [`meter`](#meter) with [`value`](#value), [`min`](#min), and [`max`](#max)\n"
" to represent measurements such as usage, score, or temperature. Optional\n"
" [`low`](#low), [`high`](#high), and [`optimum`](#optimum) set qualitative\n"
" thresholds.\n"
"\n"
" ## Recipe\n"
"\n"
" ```gleam\n"
" import glaze/oat/meter\n"
"\n"
" meter.meter([\n"
" meter.value_int(68),\n"
" meter.min_int(0),\n"
" meter.max_int(100),\n"
" meter.low_int(30),\n"
" meter.high_int(80),\n"
" meter.optimum_int(70),\n"
" ])\n"
" ```\n"
"\n"
" ## References\n"
"\n"
" - MDN `<meter>`: <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meter>\n"
).
-file("src/glaze/oat/meter.gleam", 37).
-spec meter(list(lustre@vdom@vattr:attribute(QGC))) -> lustre@vdom@vnode:element(QGC).
meter(Attrs) ->
lustre@element@html:meter(Attrs, []).
-file("src/glaze/oat/meter.gleam", 41).
-spec value(binary()) -> lustre@vdom@vattr:attribute(any()).
value(Amount) ->
lustre@attribute:value(Amount).
-file("src/glaze/oat/meter.gleam", 45).
-spec value_int(integer()) -> lustre@vdom@vattr:attribute(any()).
value_int(Amount) ->
value(erlang:integer_to_binary(Amount)).
-file("src/glaze/oat/meter.gleam", 49).
-spec value_float(float()) -> lustre@vdom@vattr:attribute(any()).
value_float(Amount) ->
value(gleam_stdlib:float_to_string(Amount)).
-file("src/glaze/oat/meter.gleam", 53).
-spec min(binary()) -> lustre@vdom@vattr:attribute(any()).
min(Amount) ->
lustre@attribute:min(Amount).
-file("src/glaze/oat/meter.gleam", 57).
-spec min_int(integer()) -> lustre@vdom@vattr:attribute(any()).
min_int(Amount) ->
min(erlang:integer_to_binary(Amount)).
-file("src/glaze/oat/meter.gleam", 61).
-spec min_float(float()) -> lustre@vdom@vattr:attribute(any()).
min_float(Amount) ->
min(gleam_stdlib:float_to_string(Amount)).
-file("src/glaze/oat/meter.gleam", 65).
-spec max(binary()) -> lustre@vdom@vattr:attribute(any()).
max(Amount) ->
lustre@attribute:max(Amount).
-file("src/glaze/oat/meter.gleam", 69).
-spec max_int(integer()) -> lustre@vdom@vattr:attribute(any()).
max_int(Amount) ->
max(erlang:integer_to_binary(Amount)).
-file("src/glaze/oat/meter.gleam", 73).
-spec max_float(float()) -> lustre@vdom@vattr:attribute(any()).
max_float(Amount) ->
max(gleam_stdlib:float_to_string(Amount)).
-file("src/glaze/oat/meter.gleam", 77).
-spec low(binary()) -> lustre@vdom@vattr:attribute(any()).
low(Amount) ->
lustre@attribute:attribute(<<"low"/utf8>>, Amount).
-file("src/glaze/oat/meter.gleam", 81).
-spec low_int(integer()) -> lustre@vdom@vattr:attribute(any()).
low_int(Amount) ->
low(erlang:integer_to_binary(Amount)).
-file("src/glaze/oat/meter.gleam", 85).
-spec low_float(float()) -> lustre@vdom@vattr:attribute(any()).
low_float(Amount) ->
low(gleam_stdlib:float_to_string(Amount)).
-file("src/glaze/oat/meter.gleam", 89).
-spec high(binary()) -> lustre@vdom@vattr:attribute(any()).
high(Amount) ->
lustre@attribute:attribute(<<"high"/utf8>>, Amount).
-file("src/glaze/oat/meter.gleam", 93).
-spec high_int(integer()) -> lustre@vdom@vattr:attribute(any()).
high_int(Amount) ->
high(erlang:integer_to_binary(Amount)).
-file("src/glaze/oat/meter.gleam", 97).
-spec high_float(float()) -> lustre@vdom@vattr:attribute(any()).
high_float(Amount) ->
high(gleam_stdlib:float_to_string(Amount)).
-file("src/glaze/oat/meter.gleam", 101).
-spec optimum(binary()) -> lustre@vdom@vattr:attribute(any()).
optimum(Amount) ->
lustre@attribute:attribute(<<"optimum"/utf8>>, Amount).
-file("src/glaze/oat/meter.gleam", 105).
-spec optimum_int(integer()) -> lustre@vdom@vattr:attribute(any()).
optimum_int(Amount) ->
optimum(erlang:integer_to_binary(Amount)).
-file("src/glaze/oat/meter.gleam", 109).
-spec optimum_float(float()) -> lustre@vdom@vattr:attribute(any()).
optimum_float(Amount) ->
optimum(gleam_stdlib:float_to_string(Amount)).