" row and the secret field. Each returns escaped * HTML in the chrome's recipes (assets/src/fields.css); the page echoes it through Markup::out(). The widths (`xs`), a * button's and a field row's `reason` and the help tied to its control are options of Ui's own builders. * * The behaviour is the library's: assets/fields.js (the colour's swatch and hex kept in step, a segmented switch that * falls back to radios when it does not fit, a secret's Replace, the media picker's Choose and Remove) and * assets/board.js (an ordered list's and a media picker's rows moved by their grip, as a board's cards). A builder * enqueues what it needs, so a screen without one pays nothing. * * @package RoosterAdmin */ namespace Rooster\Admin; defined( 'ABSPATH' ) || exit; /** * Static. */ final class Fields { /** * The longest option a segmented switch shows as a segment (FR9: "at most about 16 characters an option"); a * longer one makes the switch radios on one line from the start. */ public const SEGMENT_MAX = 20; /** * What a saved secret shows in place of its value (FR18: never revealed). */ public const MASK = '••••••••••••'; /** * A colour field (UI-Design-Patterns §6, "one look everywhere"): a swatch that opens the browser's picker and the * hex beside it, 10rem in all. The hex is the value posted (its `name`); the swatch has none, and the script keeps * the two in step. An empty value is the inherited one: the swatch shows `default`. * * With `alpha` (0.63.1) the text takes any CSS colour (`#rrggbbaa`, `rgb()`, `rgba()`, `hsl()`, a name, * `transparent`), checked in the browser (`CSS.supports( 'color', … )`; an invalid one is marked under the field * and blocks its card's Save), the swatch drawn over a checkerboard so a transparent colour reads as one, and the * browser's picker setting the red, green and blue while the alpha stays (transparent turns opaque: a colour picked * is a colour seen). See color_alpha(). * * @param string $name The name ('' for a script's own field: no name). * @param string $value The colour, `#rrggbb` or `#rgb` ('' for none); with `alpha`, any CSS colour. * @param array $opts id (the hex's id, the one a field row's label is for; default the name), label * (raw: the field's name; the swatch is "