23#include <glaze/glaze.hpp>
32namespace morph::forms {
51 Multiline(std::
string text) noexcept(std::is_nothrow_move_constructible_v<std::
string>) :
value{std::move(text)} {}
55 [[nodiscard]]
static constexpr std::string_view
widget() noexcept {
return "textarea"; }
69template <auto Min, auto Max, auto Step = 1>
70 requires(std::is_arithmetic_v<
decltype(Min)> && std::same_as<
decltype(Min),
decltype(Max)> &&
71 std::same_as<
decltype(Min),
decltype(Step)>)
73 static_assert(Min < Max,
"Ranged: Min must be less than Max");
74 static_assert(Step >
decltype(Step){0},
"Ranged: Step must be strictly positive");
77 std::optional<
decltype(Min)>
value;
80 constexpr Ranged() noexcept = default;
84 constexpr
Ranged(decltype(Min) selected) noexcept :
value{selected} {}
88 constexpr Ranged(std::optional<
decltype(Min)> payload) noexcept :
value{payload} {}
92 [[nodiscard]]
constexpr bool hasValue() const noexcept {
return value.has_value(); }
98 [[nodiscard]]
constexpr decltype(Min)
operator*()
const noexcept {
return *
value; }
102 [[nodiscard]]
static constexpr auto min() noexcept {
return Min; }
106 [[nodiscard]]
static constexpr auto max() noexcept {
return Max; }
110 [[nodiscard]]
static constexpr auto step() noexcept {
return Step; }
114 [[nodiscard]]
static constexpr std::string_view
widget() noexcept {
return "slider"; }
129 static constexpr std::string_view name =
"Multiline";
146template <auto Min, auto Max, auto Step>
147struct glz::meta<morph::forms::Ranged<Min, Max, Step>> {
149 static constexpr std::string_view name = morph::forms::detail::rangedSchemaName<
decltype(Min)>;
Compile-time $defs keys for the forms layer's field wrappers.