iya-sts
    Preparing search index...

    Class export=

    The console's rendering kit: escaping, the statistics tile, and the prose helpers that fold a paragraph longer than a line. Loadable in a browser; it requires nothing.

    A static utility class; it holds no state and takes no dependencies.

    Index
    CHOICE_NOTES: Record<string, Record<string, string>> = ...
    CHOOSER_HITS: 20
    CLIP_CHARS: 46 = CLIP_CHARS

    How much of a long value clipped() draws before the full text is behind a hover.

    DEFAULT_PER_PAGE: 50
    FIND_PER_PAGE: 5
    LIST_PARAMS: {
        "/admin/acme": string[];
        "/admin/acme/monitor": string[];
        "/admin/applications": string[];
        "/admin/authorization-servers": string[];
        "/admin/caep": string[];
        "/admin/caep-sessions": string[];
        "/admin/cert-issuance": string[];
        "/admin/consent": string[];
        "/admin/delegation": string[];
        "/admin/delegation-settings": string[];
        "/admin/est": string[];
        "/admin/est/monitor": string[];
        "/admin/federation": string[];
        "/admin/gnap": string[];
        "/admin/gnap/monitor": string[];
        "/admin/groups": string[];
        "/admin/kerberos/principals": string[];
        "/admin/kerberos/trusts": string[];
        "/admin/logout": string[];
        "/admin/oauth2/monitor": string[];
        "/admin/oidfed": string[];
        "/admin/pki/trust": string[];
        "/admin/policies": string[];
        "/admin/rbac": string[];
        "/admin/realms": string[];
        "/admin/risc": string[];
        "/admin/risc-accounts": string[];
        "/admin/roles": string[];
        "/admin/saml11": string[];
        "/admin/saml2": string[];
        "/admin/scep": string[];
        "/admin/scep/monitor": string[];
        "/admin/sessions": string[];
        "/admin/signals": string[];
        "/admin/spiffe/agents": string[];
        "/admin/spiffe/brokers": string[];
        "/admin/spiffe/entries": string[];
        "/admin/ssf/dead-letters": string[];
        "/admin/tls/trust": string[];
        "/admin/tokens": string[];
        "/admin/uma": string[];
        "/admin/users": string[];
    } = LIST_PARAMS
    MAX_ROWS: 300
    ONE_LINE_CHARS: 110 = ONE_LINE_CHARS

    About one rendered line of .note text: past this a note is folded.

    SUMMARY_CHARS: 96 = SUMMARY_CHARS

    The longest summary a fold may carry.

    TIP_CHARS: 190 = TIP_CHARS

    The longest tooltip tip() writes by default.

    • Encodes a string's UTF-8 bytes as base64.

      Parameters

      • text: any

        the string

      Returns string

      the base64, padded

    • Draws one item of a prose list, folded when longer than a line.

      An item opening with a link is never folded; one opening with <code> keeps it in the summary.

      Parameters

      • html: any

        the item as HTML

      • Optionallabel: any

        optional; a summary, which also forces the fold

      Returns string

      the <li> as HTML

    • The check mark a value seen in use carries (#706), inline for the trash icon's reason.

      Returns string

      the SVG as HTML

    • The label a choice is drawn with: a URN's last two sections, any other value as it is.

      Parameters

      • value: any

        the value

      Returns string

      the label

    • The tooltip a choice carries: its full value where the label shortens it, and what it means where CHOICE_NOTES knows.

      Parameters

      • attribute: any

        the attribute

      • value: any

        the value

      • t: any

        the page's translator (#539)

      Returns string

      the tooltip text, or '' for none

    • Answers whether any of an entry's names contains what was typed.

      Parameters

      • names: any

        every spelling of the entry

      • wanted: any

        what was typed; '' matches everything

      Returns any

      true when it matches

    • Draws a search box and a paged, scrolling pane of matching entries, shared by every chooser on the console.

      The form submits back to the page it is drawn on, carrying the rest of the query, with a fragment that returns the reader to the pane; a stale offset is clamped to the first page.

      Parameters

      • spec: any

        here, param, fromParam, label, placeholder, entries, selectedKey and nothing, as the comment above describes

      • t: WebTranslator = ...

        optional; the translator (#539), the default when left out

      Returns string

      the form, the pane and its paging note as HTML

    • Draws a value clipped to a limit, with the whole of it on focus.

      A value over the limit gets a hover/focus panel holding the full text.

      Parameters

      • value: any

        the value to draw; a dash when null or empty

      • keep: any

        the character limit (CLIP_CHARS when not given)

      • t: WebTranslator = ...

        optional; the translator (#539), the default when left out

      Returns string

      the clipped value as HTML

    • Draws an attribute's values, each clipped, one per line.

      Parameters

      • values: any

        one value or an array of them

      • Optionalkeep: any

        optional; the character limit passed to clipped()

      • t: WebTranslator = ...

        optional; the translator (#539), the default when left out

      Returns string

      the values as one inline-block column of HTML

    • Draws a list of names, each in its own <code>, joined with commas.

      Parameters

      • names: any

        the names to draw

      Returns any

      the list as HTML

    • Builds the render context a page's renderer takes beside its view.

      Parameters

      • Optionalquery: any

        the page's query parameters, by name

      • Optionalwrite: any

        whether the reader may write

      • Optionalt: any

        the page's translator (#539 phase 5): the runtime's, built from GET /admin-api/console's locale; without one, the default (English in node, set by common/i18n.ts; key-drawing in a browser)

      • Optionalsecurity: any

        whether the reader holds the Security Administrator's role (#645), which a policy page asks before it offers a Save

      Returns { query: {}; security: boolean; t: any; write: boolean }

      { query, write, security, t }, the query copied and the two flags booleans

    • Draws a hidden Copy button for a value, which /admin/copy.js reveals.

      Parameters

      • value: any

        the text the button copies

      • t: WebTranslator = ...

        optional; the translator (#539), the default when left out

      Returns string

      the markup

    • The key a list value a delegated permission grant declares carries (#1141), inline for the trash icon's reason.

      Returns string

      the SVG as HTML

    • The values a delegated permission grant declares in a list cell (#1141): read-only, each with the key, its details as a tooltip, and a link to the Permissions tab where the delegated permission grant is changed. None is an input, so a save neither posts nor stores them.

      Parameters

      • derived: any

        { value, permission, api, apiName } each

      • t: any

        the page's translator (#539)

      Returns any

      the entries as HTML, or '' for none

    • Draws a drill-down's head: a back link to the tab it was opened from, then its title with a note beside it.

      Parameters

      • titleHtml: string

        the title, as HTML

      • asideHtml: string

        beside the title (such as the route's path), as HTML; '' for none

      • backHref: string

        the parent tab's address, page and fragment

      • backHtml: string

        the back link's text, as HTML

      Returns string

      the heading row as HTML

    • Formats a duration as days, hours, minutes and seconds.

      Parameters

      • ms: any

        the duration in milliseconds

      Returns string

      the text, such as 1d 2h 3m 4s

    • Escapes a value for HTML, drawing null and undefined as empty.

      Parameters

      • v: any

        the value to escape

      Returns string

      the escaped text, with an apostrophe as &apos;

    • Returns the CSS classes that show a block only while one of its families is ticked.

      Parameters

      • ids: any

        the family ids the block serves

      Returns string

      pf pf-<id> ..., or an empty string for an unconditional block

    • Draws one field of the grid: its name (with its sentence as a tooltip), the families it belongs to, and the control its type needs.

      Parameters

      • row: any

        the field's row, typed by gridFieldTyped()

      • values: any

        the grid's values by attribute

      • options: any

        redraw (the route "+" and delete post to), showSet (show a cell holding a value whatever is ticked), generateSecret, secretLifetime (HTML drawn after Generate Secret, #394), and protocols, the families a cell's labels are named from; views (#500), the cell is classed fg-adv unless row.simple, so its form's simple / advanced switch (viewSwitch()) can hide it; derived (#1141), the read-only values a list holds without storing them, by attribute (derivedListItems())

      • t: WebTranslator = ...

        optional; the translator (#539), the default when left out

      Returns string

      the cell as HTML

    • Draws a field grid: each group's cells under its heading.

      Parameters

      • typed: any

        the rows, typed for their controls

      • groups: any

        the field groups, in drawing order (id, label)

      • values: any

        the grid's values by attribute

      • options: any

        fieldGridCell()'s options, protocols among them

      • t: WebTranslator = ...

        optional; the translator (#539), the default when left out

      Returns any

      the grid as HTML

    • Draws a list field's search: the box, Find, and the page of results.

      Parameters

      • attribute: any

        the list's attribute

      • kind: any

        applications, groups or parties (people or applications, one value), what the search finds

      • found: any

        the last search's results for this list, or nothing

      • redraw: any

        the route the grid's round trips post to

      • t: WebTranslator = ...

        optional; the translator (#539), the default when left out

      Returns string

      the search as HTML

    • Returns a list view without its page and per parameters.

      Parameters

      • view: any

        the list view's parameters

      Returns {}

      a new object holding every other parameter

    • Wraps the messages a pressed button came back with in the strip that stays at the top of the window, so they are seen wherever the page lands.

      Parameters

      • html: any

        the messages as HTML

      Returns string

      the strip, or '' for no messages

    • Splits a note into the summary and the body of a fold.

      Parameters

      • html: any

        the note as HTML

      • label: any

        a summary to use instead of the derived one, or nothing

      Returns { body: any; summary: any }

      the summary and body, both as HTML

    • Draws a block inside a section frame.

      Parameters

      • html: any

        the block as HTML, its heading first

      Returns string

      the framed block, or '' for an empty one

    • Reads the grid's values out of a posted form, keeping every list box — an empty one included — in box order, and applies a "+" or a delete.

      Parameters

      • draft: any

        the posted form

      • OptionallongText: any

        optional; the attributes one box holds whole (applications.LONG_TEXT_ATTRIBUTES)

      Returns {}

      the values by attribute

    • Whether a sub-tab's fields earn a simple / advanced switch: six or more, some shown by the simple view and some not.

      Parameters

      • rows: any

        the fields the sub-tab draws, each with simple

      Returns boolean

      true when the switch is drawn

    • Words a number of seconds as a person reads it: exact below a minute, to one decimal place in minutes, hours or days above.

      Parameters

      • seconds: any

        the number of seconds

      • t: WebTranslator = ...

        optional; the translator (#539), the default when left out

      Returns string

      the phrase, or "no allowance at all" for zero

    • Draws an application's kinds as one cell, one per line, or unstated.

      Parameters

      • kinds: any

        the kinds to draw

      Returns any

      the cell's HTML

    • Draws the console's language chooser.

      Parameters

      • t: any

        the page's translator

      • locale: any

        GET /admin-api/console's locale member

      Returns string

      the chooser as HTML, or '' when nothing is offered

    • Rebuilds a list view from a form's back query string.

      It is rebuilt through listViewOf() and never echoed, so it cannot carry an open redirect or a header injection.

      Parameters

      • section: any

        the list page's path

      • raw: any

        the back field's value

      Returns {}

      the list view; empty when the field cannot be parsed

    • Picks a list page's filter and page parameters out of a query.

      Only the keys LIST_PARAMS names for the section are kept; the first of a repeated parameter wins.

      Parameters

      • section: any

        the list page's path

      • query: any

        the request's query object

      Returns {}

      the list view, as parameter names to strings

    • Draws the ticked "mail it to them" checkbox (deliver=mail) for a link, or a note that the realm has no mail transport.

      Parameters

      • what: any

        what is mailed, as the sentence names it

      • Optionalavailable: any

        optional; whether the realm has a mail transport

      • t: WebTranslator = ...

        optional; the translator (#539), the default when left out

      Returns string

      the box or the note as HTML

    • Draws a block inside a section frame that the tab splitter keeps on Metadata.

      Parameters

      • html: any

        the block as HTML, its heading first

      Returns string

      the framed block, or '' for an empty one

    • Draws a paragraph of explanation, folded when longer than a line.

      Parameters

      • html: any

        the paragraph as HTML

      • Optionallabel: any

        optional; a summary, which also forces the fold

      Returns string

      the note as HTML

    • Builds the paging control for one list, as a head and a foot copy.

      Only the head copy carries the id its links' fragment names; both are empty when the list fits on one page.

      Parameters

      • path: any

        the page the links point at

      • params: any

        the page parameters every link carries

      • pg: any

        the list's paging object from pagingOf()

      • t: WebTranslator = ...

        optional; the translator (#539), the default when left out

      Returns { foot: string; head: string }

      an object whose head and foot are each the control as HTML

    • Returns a query's view parameters, first value each, without format, notice and error.

      Parameters

      • query: any

        the query

      Returns Record<string, any>

      the parameters

    • Draws a stand-alone rows-per-table form for a drill-down page.

      Submitting it resets every table's page to the first.

      Parameters

      • path: any

        the page the form submits to

      • key: any

        the name of the hidden parameter that selects the drill-down, or '' for a list with no drill-down to select

      • value: any

        that parameter's value

      • perPage: any

        the page size in use

      • OptionalextraNote: any

        optional; a sentence added to the form's note

      • Optionalcarry: any

        optional; the list filter to carry as hidden inputs

      • t: WebTranslator = ...

        optional; the translator (#539), the default when left out

      Returns string

      the form as HTML

    • Draws the options of the rows-per-page select.

      A size that is not one of the offered choices is added to the list.

      Parameters

      • perPage: any

        the page size in use, which is marked selected

      • t: WebTranslator = ...

        optional; the translator (#539), the default when left out

      Returns string

      the

    • Returns a fragment's visible text: tags removed, whitespace collapsed.

      Entities are left as they were, so the result is still valid HTML text.

      Parameters

      • html: any

        an HTML fragment

      Returns string

      the text

    • Returns one query parameter's first value as text.

      Parameters

      • query: any

        the query

      • key: any

        the parameter's name

      Returns string

      the value, or '' when absent

    • Builds a query string from page parameters, with some overridden; an empty, null or undefined value is left out.

      Parameters

      • params: any

        the parameters to carry

      • overrides: any

        the parameters to set or clear

      Returns string

      the query string with its ?, or '' when nothing is left

    • Draws a refusal in the floating banner, the shape the application pages use: a heading and the reasons as a list (#1066).

      Parameters

      • errors: any

        the reasons, in the server's words

      • Optionaltitle: any

        optional; the heading, English as every refusal is (#539)

      Returns string

      the banner as HTML, or '' when there is no reason

    • Draws a one-box search form over one section of a multi-table page.

      The form submits to a fragment naming itself, carries every other page parameter, and drops the search term and the section's page number.

      Parameters

      • spec: any

        the path, query, param, pageParam, label, placeholder and what of the search

      • t: WebTranslator = ...

        optional; the translator (#539), the default when left out

      Returns string

      the form, and the optional note under it, as HTML

    • Finds where the opening sentence ends, as an offset into the markup.

      Only at element depth zero and at least thirty characters in.

      Parameters

      • html: any

        an HTML fragment

      Returns number

      the offset after the sentence's stop, or -1

    • Draws a long opaque value shortened, with the whole value in the title.

      Parameters

      • value: any

        the value to draw; a dash when empty

      • keep: any

        how many characters to keep (18 when not given)

      Returns string

      a element as HTML

    • Formats a duration in at most two units, such as "4 min 12 s".

      Parameters

      • ms: number

        the duration in milliseconds

      Returns string

      the text

    • Draws panels as sub-tabs: a bar of links, then each panel with something in it, the first shown when no fragment picks one. tabbedPanels()'s mechanism one level down.

      Parameters

      • label: any

        what the bar is, for a screen reader

      • panels: any

        { id, label, html } in tab order; href as tabbedPanels() takes it

      Returns string

      the sub-tabs as HTML

    • Draws panels as tabs: a bar of links, then each panel with something in it, the first shown when no fragment picks one.

      Parameters

      • cls: any

        an extra class for the container

      • panels: any

        { id, label, html } in tab order; optionally href (the tab is a link there; with no html, no panel is drawn)

      Returns string

      the tabs as HTML

    • Cuts text to a summary line at a word boundary, ending in an ellipsis.

      Parameters

      • text: any

        the text

      • Optionalmax: any

        optional; the length, SUMMARY_CHARS by default

      Returns any

      the text, cut if it was longer

    • Draws one statistics tile.

      Parameters

      • n: any

        the number

      • label: any

        what it counts

      Returns string

      the tile as HTML

    • Builds a title attribute, with its leading space, from prose.

      Parameters

      • text: any

        the prose, as markup or plain text

      • Optionalmax: any

        optional; the length, TIP_CHARS by default; Infinity keeps the whole text

      Returns string

      the attribute; empty when there is no text

    • The trash-can icon a list box's delete button carries, inline so the console still makes no image request.

      Returns string

      the SVG as HTML

    • Resolves the entities a title attribute cannot show.

      Parameters

      • text: any

        the text

      Returns string

      the text with those entities resolved, &amp; last

    • A section's markup without its own heading, any further <h2> drawn as an <h3>.

      Parameters

      • html: string

        the section, its heading first

      Returns string

      the section's body

    • Draws a sub-tab form's simple / advanced switch.

      Parameters

      • label: any

        what the switch is for, for its group's name

      • advanced: any

        true to draw it on the advanced view

      • hidden: any

        how many fields the simplified view hides

      • held: any

        how many of those hold a value

      • t: WebTranslator = ...

        optional; the translator (#539), the default when left out

      Returns string

      the switch as HTML

    • Measures how long text reads, counting each entity as one character.

      Parameters

      • text: any

        plainTextOf()'s output

      Returns any

      the length

    • Draws a warning box, folded when longer than a line.

      Parameters

      • html: any

        the warning as HTML

      • Optionallabel: any

        optional; a summary, which also forces the fold

      Returns string

      the warning as HTML

    • The warning mark a value seen but not declared carries (#708), inline for the trash icon's reason.

      Returns string

      the SVG as HTML

    • Formats an instant as a UTC date and time without milliseconds.

      Parameters

      • ms: any

        milliseconds since the epoch

      Returns string

      the text; a dash when there is none

    • Wraps a wide table in a focusable box that scrolls sideways.

      Parameters

      • label: any

        the region's accessible name

      • html: any

        the whole table as HTML

      Returns string

      the wrapped table as HTML

    • A panel's markup with its documentation link, unless it is a tab container.

      Parameters

      • one: any

        { id, html, docs? }

      Returns string

      the panel body