Current section
Files
Jump to
Current section
Files
src/legos@region.erl
-module(legos@region).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/legos/region.gleam").
-export([main_content/0, aside/0, navigation/0, footer/0, heading/1, announce_urgently/0, announce/0, description/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/legos/region.gleam", 5).
?DOC(" Mark an element as the main content area\n").
-spec main_content() -> legos@internal@model:attribute(legos@internal@model:aligned(), any()).
main_content() ->
{describe, main}.
-file("src/legos/region.gleam", 10).
?DOC(" Mark an element as an aside/complementary content\n").
-spec aside() -> legos@internal@model:attribute(legos@internal@model:aligned(), any()).
aside() ->
{describe, complementary}.
-file("src/legos/region.gleam", 15).
?DOC(" Mark an element as navigation\n").
-spec navigation() -> legos@internal@model:attribute(legos@internal@model:aligned(), any()).
navigation() ->
{describe, navigation}.
-file("src/legos/region.gleam", 20).
?DOC(" Mark an element as a footer/content info\n").
-spec footer() -> legos@internal@model:attribute(legos@internal@model:aligned(), any()).
footer() ->
{describe, content_info}.
-file("src/legos/region.gleam", 38).
?DOC(
" Mark an element as a heading with the specified level (h1, h2, etc.)\n"
" This is smart enough to not conflict with existing nodes.\n"
"\n"
" For example:\n"
" ```gleam\n"
" link([region.heading(1)], LinkConfig(url: \"http://fruits.com\", label: text(\"Best site ever\")))\n"
" ```\n"
"\n"
" will generate:\n"
" ```html\n"
" <a href=\"http://fruits.com\">\n"
" <h1>Best site ever</h1>\n"
" </a>\n"
" ```\n"
).
-spec heading(integer()) -> legos@internal@model:attribute(legos@internal@model:aligned(), any()).
heading(Level) ->
{describe, {heading, Level}}.
-file("src/legos/region.gleam", 44).
?DOC(
" Screen readers will announce changes to this element urgently,\n"
" potentially interrupting other announcements\n"
).
-spec announce_urgently() -> legos@internal@model:attribute(legos@internal@model:aligned(), any()).
announce_urgently() ->
{describe, live_assertive}.
-file("src/legos/region.gleam", 50).
?DOC(
" Screen readers will announce changes to this element politely,\n"
" waiting for other announcements to finish\n"
).
-spec announce() -> legos@internal@model:attribute(legos@internal@model:aligned(), any()).
announce() ->
{describe, live_polite}.
-file("src/legos/region.gleam", 58).
?DOC(
" Adds an aria-label for accessibility software to identify\n"
" otherwise unlabeled elements.\n"
"\n"
" Common use case: labeling buttons that only have an icon.\n"
).
-spec description(binary()) -> legos@internal@model:attribute(legos@internal@model:aligned(), any()).
description(Desc) ->
{describe, {label, Desc}}.