-module(agnostic@attribute). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/agnostic/attribute.gleam"). -export([attribute/2, property/2, class/1, none/0, accesskey/1, autocapitalize/1, autocorrect/1, autofocus/1, classes/1, closedby/1, command/1, commandfor/1, contenteditable/1, data/2, dir/1, draggable/1, enterkeyhint/1, hidden/1, id/1, inert/1, inputmode/1, is/1, itemid/1, itemprop/1, itemscope/1, itemtype/1, lang/1, nonce/1, popover/1, spellcheck/1, style/2, styles/1, tabindex/1, title/1, translate/1, writingsuggestions/1, open/1, href/1, target/1, download/1, ping/1, rel/1, hreflang/1, referrerpolicy/1, as_/1, blocking/1, integrity/1, alt/1, src/1, srcset/1, sizes/1, crossorigin/1, usemap/1, ismap/1, width/1, height/1, decoding/1, loading/1, fetchpriority/1, accept_charset/1, action/1, enctype/1, method/1, novalidate/1, accept/1, alpha/1, autocomplete/1, checked/1, default_checked/1, colorspace/1, cols/1, dirname/1, disabled/1, for/1, form/1, formaction/1, formenctype/1, formmethod/1, formnovalidate/1, formtarget/1, list/1, max/1, maxlength/1, min/1, minlength/1, multiple/1, name/1, pattern/1, placeholder/1, popovertarget/1, popovertargetaction/1, readonly/1, required/1, rows/1, selected/1, default_selected/1, size/1, step/1, type_/1, value/1, default_value/1, http_equiv/1, content/1, charset/1, media/1, autoplay/1, controls/1, loop/1, muted/1, playsinline/1, poster/1, preload/1, shadowrootmode/1, shadowrootdelegatesfocus/1, shadowrootclonable/1, shadowrootserializable/1, abbr/1, colspan/1, headers/1, rowspan/1, span/1, scope/1, datetime/1, aria/2, role/1, aria_activedescendant/1, aria_atomic/1, aria_autocomplete/1, aria_braillelabel/1, aria_brailleroledescription/1, aria_busy/1, aria_checked/1, aria_colcount/1, aria_colindex/1, aria_colindextext/1, aria_colspan/1, aria_controls/1, aria_current/1, aria_describedby/1, aria_description/1, aria_details/1, aria_disabled/1, aria_errormessage/1, aria_expanded/1, aria_flowto/1, aria_haspopup/1, aria_hidden/1, aria_invalid/1, aria_keyshortcuts/1, aria_label/1, aria_labelledby/1, aria_level/1, aria_live/1, aria_modal/1, aria_multiline/1, aria_multiselectable/1, aria_orientation/1, aria_owns/1, aria_placeholder/1, aria_posinset/1, aria_pressed/1, aria_readonly/1, aria_relevant/1, aria_required/1, aria_roledescription/1, aria_rowcount/1, aria_rowindex/1, aria_rowindextext/1, aria_rowspan/1, aria_selected/1, aria_setsize/1, aria_sort/1, aria_valuemax/1, aria_valuemin/1, aria_valuenow/1, aria_valuetext/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. -file("src/agnostic/attribute.gleam", 34). ?DOC( " Create an HTML attribute. This is like saying `element.setAttribute(\"class\", \"wibble\")`\n" " in JavaScript. Attributes will be rendered when calling [`element.to_string`](./element.html#to_string).\n" "\n" " > **Note**: there is a subtle difference between attributes and properties. You\n" " > can read more about the implications of this\n" " > [here](https://github.com/lustre-labs/lustre/blob/main/pages/hints/attributes-vs-properties.md).\n" ). -spec attribute(binary(), binary()) -> agnostic@vdom@vattr:attribute(any()). attribute(Name, Value) -> agnostic@vdom@vattr:attribute(Name, Value). -file("src/agnostic/attribute.gleam", 53). ?DOC( " Create a DOM property. This is like saying `element.className = \"wibble\"` in\n" " JavaScript. Properties will be **not** be rendered when calling\n" " [`element.to_string`](./element.html#to_string).\n" "\n" " > **Note**: there is a subtle difference between attributes and properties. You\n" " > can read more about the implications of this\n" " > [here](https://github.com/lustre-labs/lustre/blob/main/pages/hints/attributes-vs-properties.md).\n" ). -spec property(binary(), gleam@json:json()) -> agnostic@vdom@vattr:attribute(any()). property(Name, Value) -> agnostic@vdom@vattr:property(Name, Value). -file("src/agnostic/attribute.gleam", 38). -spec boolean_attribute(binary(), boolean()) -> agnostic@vdom@vattr:attribute(any()). boolean_attribute(Name, Value) -> case Value of true -> attribute(Name, <<""/utf8>>); false -> property(Name, gleam@json:bool(false)) end. -file("src/agnostic/attribute.gleam", 148). ?DOC( " A class is a non-unique identifier for an element primarily used for styling\n" " purposes. You can provide multiple classes as a space-separated list and any\n" " style rules that apply to any of the classes will be applied to the element.\n" "\n" " To conditionally toggle classes on and off, you can use the [`classes`](#classes)\n" " function instead.\n" "\n" " > **Note**: unlike most attributes, multiple `class` attributes are merged\n" " > with any existing other classes on an element. Classes added _later_ in the\n" " > list will override classes added earlier.\n" ). -spec class(binary()) -> agnostic@vdom@vattr:attribute(any()). class(Name) -> attribute(<<"class"/utf8>>, Name). -file("src/agnostic/attribute.gleam", 61). ?DOC( " Create an empty attribute. This is not added to the DOM and not rendered when\n" " calling [`element.to_string`](./element.html#to_string), but it is useful for\n" " _conditionally_ adding attributes to an element.\n" ). -spec none() -> agnostic@vdom@vattr:attribute(any()). none() -> class(<<""/utf8>>). -file("src/agnostic/attribute.gleam", 79). ?DOC( " Defines a shortcut key to activate or focus the element. Multiple options\n" " may be provided as a set of space-separated characters that are exactly one\n" " code point each.\n" "\n" " The way to activate the access key depends on the browser and its platform:\n" "\n" " | | Windows | Linux | Mac OS |\n" " |---------|-------------------|---------------------|---------------------|\n" " | Firefox | Alt + Shift + key | Alt + Shift + key | Ctrl + Option + key |\n" " | Chrome | Alt + key | Ctrl + Option + key | Ctrl + Option + key |\n" " | Safari | | | Ctrl + Option + key |\n" ). -spec accesskey(binary()) -> agnostic@vdom@vattr:attribute(any()). accesskey(Key) -> attribute(<<"accesskey"/utf8>>, Key). -file("src/agnostic/attribute.gleam", 112). ?DOC( " Controls whether text input is automatically capitalised. The following values\n" " are accepted:\n" "\n" " | Value | Mode |\n" " |--------------|------------|\n" " | \"\" | default |\n" " | \"none\" | none |\n" " | \"off\" | |\n" " | \"sentences\" | sentences |\n" " | \"on\" | |\n" " | \"words\" | words |\n" " | \"characters\" | characters |\n" "\n" " The autocapitalisation processing model is based on the following five modes:\n" "\n" " - **default**: The user agent and input method should make their own determination\n" " of whether or not to enable autocapitalization.\n" "\n" " - **none**: No autocapitalisation should be applied (all letters should default\n" " to lowercase).\n" "\n" " - **sentences**: The first letter of each sentence should default to a capital\n" " letter; all other letters should default to lowercase.\n" "\n" " - **words**: The first letter of each word should default to a capital letter;\n" " all other letters should default to lowercase.\n" "\n" " - **characters**: All letters should default to uppercase.\n" ). -spec autocapitalize(binary()) -> agnostic@vdom@vattr:attribute(any()). autocapitalize(Value) -> attribute(<<"autocapitalize"/utf8>>, Value). -file("src/agnostic/attribute.gleam", 122). ?DOC( " Controls whether the user agent may automatically correct mispelled words\n" " while typing. Whether or not spelling is corrected is left up to the user\n" " agent and may also depend on the user's settings.\n" "\n" " When disabled the user agent is **never** allowed to correct spelling.\n" ). -spec autocorrect(boolean()) -> agnostic@vdom@vattr:attribute(any()). autocorrect(Enabled) -> boolean_attribute(<<"autocorrect"/utf8>>, Enabled). -file("src/agnostic/attribute.gleam", 133). ?DOC( " For server-rendered HTML, this attribute controls whether an element should\n" " be focused when the page first loads.\n" "\n" " > **Note**: Lustre's runtime augments that native behaviour of this attribute.\n" " > Whenever it is toggled true, the element will be automatically focused even\n" " > if it already exists in the DOM.\n" ). -spec autofocus(boolean()) -> agnostic@vdom@vattr:attribute(any()). autofocus(Should_autofocus) -> boolean_attribute(<<"autofocus"/utf8>>, Should_autofocus). -file("src/agnostic/attribute.gleam", 165). -spec do_classes(list({binary(), boolean()}), binary()) -> binary(). do_classes(Names, Class) -> case Names of [] -> Class; [{Name, true} | Rest] -> <<<<<>/binary, " "/utf8>>/binary, (do_classes(Rest, Class))/binary>>; [{_, false} | Rest@1] -> do_classes(Rest@1, Class) end. -file("src/agnostic/attribute.gleam", 161). ?DOC( " A class is a non-unique identifier for an element primarily used for styling\n" " purposes. You can provide multiple classes as a space-separated list and any\n" " style rules that apply to any of the classes will be applied to the element.\n" " This function allows you to conditionally toggle classes on and off.\n" "\n" " > **Note**: unlike most attributes, multiple `class` attributes are merged\n" " > with any existing other classes on an element. Classes added _later_ in the\n" " > list will override classes added earlier.\n" ). -spec classes(list({binary(), boolean()})) -> agnostic@vdom@vattr:attribute(any()). classes(Names) -> class(do_classes(Names, <<""/utf8>>)). -file("src/agnostic/attribute.gleam", 181). ?DOC( " Specifies the user actions that can close a `` element.\n" "\n" " | Value | Description |\n" " |----------------|---------------------------------------------------------------------------------------------------|\n" " | \"any\" | The dialog can be closed with any method. |\n" " | \"closerequest\" | The dialog can be closed with a platform-specific user action or a developer-specified mechanism. |\n" " | \"none\" | The dialog can be closed with a developer-specified mechanism. |\n" ). -spec closedby(binary()) -> agnostic@vdom@vattr:attribute(any()). closedby(Value) -> attribute(<<"closedby"/utf8>>, Value). -file("src/agnostic/attribute.gleam", 199). ?DOC( " Specifies the action to be performed on the dialog or popover referenced by\n" " the `commandfor` attribute.\n" "\n" " The attribute is supported by the `