@aiquants/console-ui 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @aiquants/console-ui
2
2
 
3
- Host-agnostic UI foundation for React admin consoles: design tokens (TypeScript is the source, CSS is generated), a WCAG 2 contrast computation with the palette table, layout arithmetic, number, zoned-time and instant formatting, a read contract with a keep-last-good state machine and a keyset paging state machine, the minimal components a console is drawn with, and the colour-role scan a console runs on its own screens.
3
+ Host-agnostic UI foundation for React admin consoles: design tokens computed from a few formulas on a 4 px lattice and a 44 px target (TypeScript is the source, CSS is generated), a light and a dark palette with a WCAG 2 contrast computation and the pair table of both schemes at AAA, layout arithmetic, number, zoned-time and instant formatting, a read contract with a keep-last-good state machine and a keyset paging state machine, the minimal components a console is drawn with, and the colour-role scan a console runs on its own screens.
4
4
 
5
5
  ## Prerequisites
6
6
 
@@ -18,13 +18,14 @@ pnpm add @aiquants/console-ui
18
18
  | Import path | Contents |
19
19
  | --- | --- |
20
20
  | `@aiquants/console-ui` | Components and hooks; re-exports everything from `@aiquants/console-ui/core`. |
21
- | `@aiquants/console-ui/core` | React-free: the tokens and the contrast computation, the layout arithmetic, number, zoned-time and instant formatting, the label catalogs, the read contract with its keep-last-good machine, and the keyset paging machine (listed below). Server-side loaders and hosts import from here without loading React. |
21
+ | `@aiquants/console-ui/core` | React-free: the tokens with the geometry of their formulas and the contrast computation, the layout arithmetic, number, zoned-time and instant formatting, the label catalogs, the read contract with its keep-last-good machine, and the keyset paging machine (listed below). Server-side loaders and hosts import from here without loading React. |
22
22
  | `@aiquants/console-ui/testing` | DOM-only: `scanColourRoles(root)`, the colour-role scan a console runs on its own rendered DOM (see Tokens and colours). It takes an element and loads no React. |
23
23
  | `@aiquants/console-ui/styles/console-ui.css` | The stylesheet: the token variables on `[data-cui-root]` and the component rules, all inside `@layer cui`. |
24
24
 
25
25
  The `/core` exports:
26
26
 
27
- - Tokens and contrast: `TOKENS`, `cssVar`, `contrastRatio`, `hexToSrgb`, `CONTRAST_PAIRS`, `CONTRAST_MINIMUM`.
27
+ - Tokens and contrast: `TOKENS`, `cssVar`, `contrastRatio`, `hexToSrgb`, `CONTRAST_PAIRS`, `CONTRAST_MINIMUM`, and the types `ColorScheme`, `SchemeColor` and `MotionToken` beside the other token names.
28
+ - The geometry the tokens are computed on: `LATTICE_PX` (4), `TARGET_PX` (44), `ROW_WITH_CONTROL_PX` (52) and `ceilToLattice(px)` (the smallest lattice multiple at or above a length).
28
29
  - Layout arithmetic: `textWidthEm`, `monoTextWidthEm`, `ceil8`, `tileGridPlan`, `tableMinInlinePx`, `masterDetailPlan`.
29
30
  - Formatting: `formatCount`, `toOffsetIso`, `toWallTime`, `formatInstant`, `ZonedTimeError`.
30
31
  - Labels: `CONSOLE_UI_LABEL_CATALOGS`, `resolveConsoleUiLabels` (a UI language's catalog, whose `loadFailed`, `refreshFailed` and `forbiddenBecause` build the failure sentences and whose `failureSentence` is the one rule that chooses between them), `reasonAside` (a failure's reason as a parenthetical).
@@ -40,7 +41,7 @@ Load the stylesheet once, bind the package's neutral font variables to the host'
40
41
 
41
42
  ### Loading the stylesheet
42
43
 
43
- Every rule of the stylesheet sits in the cascade layer `cui`. Cascade layers rank in the order they are first declared, and the `cui` layer must rank above any layer that holds a reset: the paddings and borders the layout arithmetic counts (the card's 24 px padding and 1 px rule, the 32 px controls, the 40 px rows) are otherwise overridden by the reset (Tailwind's preflight sets `padding: 0; border: 0 solid` on every element in its `base` layer).
44
+ Every rule of the stylesheet sits in the cascade layer `cui`. Cascade layers rank in the order they are first declared, and the `cui` layer must rank above any layer that holds a reset: the paddings and borders the layout arithmetic counts (the card's 1 px rule and the 23 px padding inside it, the 44 px controls and rows, the 52 px rows that hold a control) are otherwise overridden by the reset (Tailwind's preflight sets `padding: 0; border: 0 solid` on every element in its `base` layer).
44
45
  Unlayered host rules beat every layer whatever their order or specificity, so the host's reset must itself sit in a layer ranked below `cui`: an unlayered reset (normalize.css, modern-normalize, Tailwind v3's `@tailwind base`) overrides the package.
45
46
 
46
47
  - **Tailwind v4 host**: `@import` the stylesheet in the CSS entry after the Tailwind layer statement, so `cui` is declared after `base` (it then ranks last), or name the order explicitly:
@@ -96,49 +97,59 @@ export const Console = ({ orphanCount }: { orphanCount: number | null }) => (
96
97
  A console shows every instant with `formatInstant(iso, formatLocale, timeZone)` from the values `useConsoleUi()` returns, so every panel names the same instant with the same string and a page rendered on the server hydrates without a mismatch (the ambient time zone differs between the server and the browser).
97
98
  A console has exactly one root: a `ConsoleUiRoot` rendered inside another one throws, because a second root would add a second live region and a second token scope and could switch the language partway through the console. A view that is also used inside a console built on the package therefore takes the root from its host instead of wrapping itself in one.
98
99
 
99
- The root sets no font property: host content inside the root keeps its own font family, size, weight and line height, and inherits only the root's text colour (the `fg` role), `color-scheme: light` and the `--cui-*` variables, drawn over the root's `surface` background. The package's body type (13/20) and sans face are declared by `Card` for what is drawn in it.
100
+ The root sets no font property: host content inside the root keeps its own font family, size, weight and line height, and inherits only the root's text colour (the `fg` role) and the `--cui-*` variables, drawn over the root's `surface` background. The package's body type (13/20) and sans face are declared by `Card` for what is drawn in it.
101
+ The root declares no `color-scheme` either: every colour is a `light-dark()` pair, so the palette follows the scheme the root inherits. A host with its own light and dark modes binds them to `color-scheme` (`html { color-scheme: light; }` and `html.dark { color-scheme: dark; }`), so the console and the host never show different schemes; `color-scheme: light dark` on `:root` would follow the operating system instead and can disagree with the host's own switch.
100
102
 
101
103
  Every component that renders an element throws outside the root, because the token variables and the colour roles are scoped to the root's DOM and would not reach it; the hooks `useFocusRescue`, `useEscapeToClose`, `useResource` and `usePagedResource` do not need the root. For the same reason an overlay must render inside the root's DOM, not in a portal to `<body>`: a portal keeps the React context but loses every `--cui-*` variable.
102
- Draw it as a non-modal `<dialog>` (opened with `show()`) or a popover placed in the tree. A modal `<dialog>` (`showModal()`) makes everything outside it inert, the root's announcer included, and so does a host's `inert` or `aria-hidden="true"` on the console: a write to the hidden announcer throws instead of being dropped (see Focus and announcements). Announce after the modal closes, or draw the outcome inside the dialog.
104
+ Draw a modal as a `Dialog`: a modal `<dialog>` (`showModal()`) makes everything outside it inert, the root's live region included, so `Dialog` holds a live region of its own, which takes the announcements while it is the topmost open modal (see Focus and announcements). Draw any other overlay as a non-modal `<dialog>` (opened with `show()`) or a popover placed in the tree. A modal that is not the console's `Dialog`, or a host's `inert` or `aria-hidden="true"` on the console, hides the announcer: a write to it then throws instead of being dropped; announce after that modal closes.
103
105
 
104
106
  ### Tokens and colours
105
107
 
106
- - Spacing is an 8 px grid with a 4 px half step (`space-1` 4 … `space-12` 48). Type follows a 1.25 ratio: `caption` 11/16, `body` 13/20, `prose` 13/24, `title` 16/24, `heading` 20/28, `display` 25/32. A `prose` line with 4 px block padding makes rows of 8 + 24k px.
107
- - The token variables are declared on `[data-cui-root]` (never `:root`) with lengths in rem and the strokes (`border-width` 1, `focus-width` 2, `focus-offset` 2) in px, and the root declares `color-scheme: light`: the palette is tested on light surfaces only. A browser snaps a used border width down to whole device pixels, so a rem stroke would leave the paddings that compensate for the border (`calc(… - var(--cui-border-width))`) off the grid for a reader who enlarges the root font size; in px every 8 + 24k measure scales exactly with the root font size around a 1 px border.
108
- - Text and surface colours are applied through role attributes only. `data-cui-fg` paints text, `data-cui-surface` paints the surface text sits on, `data-cui-accent` paints non-text graphics. `CONTRAST_PAIRS` lists, for every role, the surfaces it may be drawn on with the WCAG 2 ratio on each; every pair meets AA (`CONTRAST_MINIMUM`: 4.5 for text, 3 for non-text), and a pair not in the table is never drawn. `Text` is the only component that paints caller text, and it paints only through a text role.
109
- - The remaining colours are fixed non-text strokes, each drawn against listed surfaces of `CONTRAST_PAIRS`: the control border (`border-control`), the invalid border (`danger-accent`), the selected-row band and the radio mark (`info-accent`), and the focus ring (`focus`). The solid buttons' border is their own fill, and the card and row rules (`border-subtle`) are decorative, never a component's only boundary.
110
- - In forced-colors mode (Windows high contrast), which removes surfaces, shadows and backgrounds, the selected row's start band is drawn in `Highlight`, the progress track and fill are drawn in `CanvasText` / `Highlight`, and table rows, comparison rows and stacked comparison headings get `CanvasText` rules.
108
+ - Every length, type step and duration is computed from a few formulas (no value is written by hand):
109
+ - a 4 px lattice (`LATTICE_PX`) and the spaces 4, 8, 12, 16, 24, 32, 48, 64 and 96 (`space-1` … `space-24`, multipliers whose prime factors are 2 and 3);
110
+ - type steps of round(16 × 1.25^k) px, never below 11 px, each line the smallest lattice multiple at or above 1.5 times its size (WCAG 1.4.8; `title`, beside controls, and `prose`, the reading line, at 1.75): `caption` 11/20, `body` 13/20, `prose` 13/24, `title` 16/28, `heading` 20/32, `display` 25/40, `display-lg` 31/48;
111
+ - the 44 px target (`TARGET_PX`: a `body` line with 12 px above and below), which is also the height of a control and of a table row (`size-target`, `size-control`, `size-row`), and the 52 px row that holds a control (`ROW_WITH_CONTROL_PX`: the target with one lattice unit above and below, `size-row-control`);
112
+ - motion of 120, 180 and 270 ms (`motion-1` … `motion-3`, 120 × 1.5^(k − 1)).
113
+ Only `body` (20) and `title` (28) lines, whose difference from 44 is a multiple of 8, can be centred in a 44 px box on the lattice, so every control draws its text in `body` or `title`.
114
+ - The token variables are declared on `[data-cui-root]` (never `:root`) with lengths in rem, the strokes (`border-width` 1, `focus-width` 2, `focus-offset` 2, `marker-width` 2) in px and the durations in ms. A browser snaps a used border width down to whole device pixels, so a rem stroke would leave the paddings that compensate for the border (`calc(… - var(--cui-border-width))`) off the lattice for a reader who enlarges the root font size; in px every lattice measure scales exactly with the root font size around a 1 px border.
115
+ - Every duration is read from the `--cui-motion-*` variables, which are `0ms` while the reader prefers reduced motion (`prefers-reduced-motion: reduce`), so a component that moves stops without a rule of its own; no rule writes a duration by hand, and the indeterminate progress segment sweeps only for a reader who allows motion.
116
+ - Text and surface colours are applied through role attributes only. `data-cui-fg` paints text, `data-cui-surface` paints the surface text sits on, `data-cui-accent` paints non-text graphics. Every role has a light and a dark value, written as `light-dark(<light>, <dark>)` (see Wrapping a console for the scheme). `CONTRAST_PAIRS.light` and `CONTRAST_PAIRS.dark` list the same pairs: for every role, the surfaces it may be drawn on with the WCAG 2 ratio on each in that scheme.
117
+ Every pair meets AAA (`CONTRAST_MINIMUM`: 7 for text, 4.5 for large text, 3 for non-text; the lowest text and non-text ratios are 7.12 and 3.47 in the light scheme, 9.29 and 5.54 in the dark one), and a pair not in the table is never drawn. `Text` is the only component that paints caller text, and it paints only through a text role.
118
+ - The remaining colours are fixed non-text graphics, each drawn against listed surfaces of `CONTRAST_PAIRS`: the control border (`border-control`) of inputs, secondary buttons, segments and the switch's track, the slider's rail and a pending step's ring, the invalid border (`danger-accent`), the selected-row band, the radio mark, the current tab's marker and the slider's thumb (`info-accent`), and the focus ring (`focus`).
119
+ The solid buttons', the pressed segment's and the checked switch track's border is their own fill, and the rules of cards, tables, comparison headings, description lists and dialogs (`border-subtle`) are decorative, never a component's only boundary. A switch's thumb stands out from its track by at least 3 : 1 in both schemes.
120
+ - In forced-colors mode (Windows high contrast), which removes surfaces, shadows and backgrounds and paints transparent borders, the package redraws its non-colour cues in system colours: the selected row's start band (`Highlight`), the progress and meter tracks and fills (`CanvasText` / `Highlight`), the current tab's marker (`Highlight`, the other tabs' markers sunk into `Canvas`), the switch's thumb (`CanvasText`, `HighlightText` on a `Highlight` track when on), the slider's rail and thumb (`CanvasText` / `Highlight`),
121
+ and the pressed segment and the current step's marker (`Highlight` with `HighlightText`).
111
122
  The band is the row's own inline-start border, taken out of its inline-start padding (the row's box and text stay where an unselected row has them, and the band stays at the start in a right-to-left root). The focus ring sets only `outline`, so a selected row that has focus keeps its band.
112
- Each rule is its cell's own bottom border, taken out of the cell's bottom padding, and the tables separate their cell borders while forced (a collapsed border would add half a rule to each row), so every row keeps its 8 + 24k height. Nothing is positioned for them, so the focus rings of rows and of controls in cells stay whole.
113
- - A console scans its own rendered DOM with `scanColourRoles(root)` from `@aiquants/console-ui/testing`, the same oracle the package runs on its components: for each text node it reads the nearest `data-cui-fg` and `data-cui-surface` and looks the pair up in `CONTRAST_PAIRS`, and it fails a text with no role, a pair not in the table, and any inline paint declaration from the text up to its farther role element
123
+ Every rule is a border (the cell's own bottom border, taken out of the cell's bottom padding; no rule is drawn as a shadow, which forced colours remove), so it stays in the forced `CanvasText` with no rule of its own, and nothing is positioned for forced colours, so the focus rings of rows and of controls in cells stay whole.
124
+ - A console scans its own rendered DOM with `scanColourRoles(root)` from `@aiquants/console-ui/testing`, the same oracle the package runs on its components: for each text node it reads the nearest `data-cui-fg` and `data-cui-surface` and looks the pair up in `CONTRAST_PAIRS` (both schemes list the same pairs), and it fails a text with no role, a pair not in the table, and any inline paint declaration from the text up to its farther role element
114
125
  — every declared inline property whose name contains `color`, `background`, `fill`, `stroke` or `shadow` (so every longhand such as `border-top-color` or `outline-color`), the `border`, `outline`, `text-decoration`, `column-rule` and `text-emphasis` shorthands, `border-image`, `opacity`, filters and blend modes.
115
126
  It returns `{failures, measured, texts}`; assert `failures` empty and `measured` non-empty. `contrastRatio` (sRGB channels in [0, 1], with `hexToSrgb` for `#rrggbb`) is the one contrast computation.
116
127
 
117
128
  ### Layout
118
129
 
119
- - The outermost element of each layout component (`TileGrid`, `DataTable`, `ComparisonGrid`, `MasterDetail`) is an anonymous container (`container-type: inline-size`) whose width the component queries; no viewport breakpoint is used. `Card` has a 1 px rule and 24 px padding, `CardSection` has no padding, rule or surface, so inside a card every layout measures the card's content width.
130
+ - The outermost element of each layout component (`TileGrid`, `DataTable`, `ComparisonGrid`, `MasterDetail`) is an anonymous container (`container-type: inline-size`) whose width the component queries; no viewport breakpoint is used. `Card` has a 1 px rule and 23 px padding (the rule's width comes out of the padding, so rule and padding sum to 24 and the card's outer box stays on the 4 px lattice), `CardSection` has no padding, rule or surface, so inside a card every layout measures the card's content width.
120
131
  - Layout components need a definite inline size from their parent. A container's content does not size it, so the anonymous container takes `inline-size: 100%` of its parent: in block flow (`Stack`, `Card`, `CardSection`, a `MasterDetail` pane) that is the parent's width, and in a wrapping flex row (`Cluster`, a host flex row) it claims a full line. Inside a parent that sizes itself to its content (a card's `actions`, an inline-block, a float) it gets no width of its own, so do not place a layout component there.
121
132
  - Container-query rules are emitted as React 19 `<style href precedence="cui">` elements keyed by their inputs (identical grids emit one element), outside the `cui` layer, so they win over the layered base rules.
122
133
  - `TileGrid` chooses its column count among the divisors of the tile count (`tileGridPlan`), so the last row is never short. `DataTable` is `table-layout: fixed` with rem column widths from px numbers; flexible columns share the rest equally, so their minimums must be equal (`tableMinInlinePx` rejects the table otherwise). `ComparisonGrid` stacks one `<dl>` per column below `attributePx + columns × columnMinPx`.
123
134
  - `MasterDetail` goes side by side when both minimums and the 24 px gap fit, the master preferring the 1 : φ share while neither pane goes below its minimum: master = min(max(masterMin, (c − 24) / (1 + φ)), c − 24 − detailMin), and the detail takes the rest. The upper clamp matters only when detailMin > φ × masterMin (a narrow list beside a wide detail).
124
135
  - Every rule that draws caller text wraps anywhere; nothing is cut with an ellipsis. A `Pill` keeps its text width + 16 px and wraps inside itself only when its text is longer than the column was sized for, instead of spilling into the next column.
136
+ - Every `Text` keeps its own type step's line wherever it is placed (no rule forces a line height), and every line is a multiple of 4, so a cell, a list row or a stack mixing steps stays on the lattice: an outcome over its muted `caption` reason paragraph in a table cell is 12 + 20 + 20 + 11 + 1 = 64 px. An inline `Text` of a larger step than the line it sits on stretches that line off the lattice by the difference of the faces' metrics; give it a block of its own (`as="p"`).
125
137
  - The table's scroll frame is `position: relative`, so it is the containing block of visually hidden text in its cells (for example the full name of a count button): the frame clips that text and scrolls it with the table, and a wide table scrolls inside its frame without widening the page.
126
138
  - A visible table caption (`captionHidden={false}`) wraps at the frame's visible width, not at the table's width, and stays at the frame's start while the table scrolls sideways, so the whole name of a table wider than its card is readable without scrolling.
127
- - Table cells are top-aligned. In a table whose rows hold bordered buttons (`rowSize="row-control"`, 40 px rows) the cells are centred, which, for one-line bordered buttons, puts the text's baseline on the button label's baseline and keeps multi-line rows at max(40, 8 + 24k) px.
128
- Size the button column so the label fits on one line (its width + 24 px padding + 2 px border): a label that wraps to k lines makes the button 12 + 20k px and the row 20 + 20k px (60 and 100 px for 2 and 4 lines, off the 8 + 24k grid), and its centred lines no longer share the text's baseline.
129
- This also holds only for buttons without an `unavailable` reason: an unavailable button belongs in card actions or a `Cluster`, because its reason is drawn beside it in `body` (13/20) and wraps under it in a narrow cell (a row of 8 + 32 + 8 + 20k px).
130
- - Controls size by `box-sizing: border-box` whatever the host's reset: a text input, a select and a one-line bordered button are all 32 px high, and a text area of k rows is 8 + 24k px. A bordered button holds its 5 px block padding (1 + 5 + 20 + 5 + 1 = 32), so a label that wraps to k lines stays clear of the border at 12 + 20k px.
131
- - Every direct child of a `RowButton` except a `Pill` gets the `prose` line height (24 px) at any type step up to `heading`, so a row of k lines is 8 + 24k px also with a `body` or `caption` line (`display`, 25 px, is larger than the 24 px line and does not belong in a row: its wrapped lines would overlap).
132
- The same holds for a block `Text` (`as="p"` or `"div"`) placed directly in a value cell (a `DataTable` cell, a `ComparisonGrid` cell in either layout): a cell whose second line is a muted `caption` paragraph (an outcome over its reason) is 8 + 24k px.
133
- An inline `Text` (the default `span`) of the `caption` or `body` step (for example a `caption` mono key) keeps its own step and sits inside the cell's 24 px `prose` line. A `prose`, `title` or `heading` `Text` in a value cell must be a block `Text` (`as="p"`): inline, its box of 24 px or more sits off that line's baseline unless it shares the cell's face and size, or is taller than the line, and stretches the row past 8 + 24k (33 to 41 px for one line); a `display` `Text` does not belong in a value cell.
134
- Only the cell's direct children get it; a `Text` nested deeper, inside a button's label for instance, keeps its own step, so a bordered button in a cell stays 32 px.
135
- - A card's `actions` are centred on the title's 24 px line: their box is 32 px high with its content centred and overlaps the title line by 4 px above and below, so a 32 px bordered button and a 24 px `Pill` share the title's centre and the header stays as high as the title line. When the title and the actions do not fit on one line, the actions wrap below the title 8 px apart (the header's 12 px row gap gives back the 4 px overlap); the wrapped row still overhangs the header box by 4 px, so the card's next child is 12 px below it instead of 16 (on the 4 px half step).
136
- - A `RadioGroup` legend is 4 px above its first option, like a `Field` label above its control (the rendered legend sits outside the fieldset's flex box, so it carries the 4 px as its own padding). Each radio mark is a 16 px box without the browser's default margins: it starts at the legend's edge, sits centred in the 24 px option line (4 px above and below), and the option text starts 16 + 8 = 24 px from the edge.
137
- - `Button variant="link"` and `Link` draw on the `prose` line (13/24) in the regular weight of the surrounding text, `info-fg` and an underline, as the same `inline-flex` box: a one-line link is the 24 px target and a label that wraps to k lines is 24k px high, so a table row holding a wrapping link stays at 8 + 24k px.
139
+ - A table row is 12 + 20 + 11 + 1 = 44 px: 12 px above a `body` line, 11 px below and the row's rule as each cell's own 1 px bottom border (the tables separate their borders, since a collapsed border adds half a rule to each row). A cell of k `body` lines is 24 + 20k px. Table cells are top-aligned.
140
+ In a table whose rows hold controls (`rowSize="row-control"`, 52 px rows: 4 + 44 + 3 + 1) the cells are centred, which puts a one-line text on the centre line of a one-line bordered button's label. Size the button column so the label fits on one line (its width + 24 px padding + 2 px border): a label that wraps to k lines makes the button 24 + 20k px and the row 32 + 20k px, and its centred lines no longer share the text's line.
141
+ This also holds only for buttons without an `unavailable` reason: an unavailable button belongs in card actions or a `Cluster`, because its reason is drawn beside it in `body` (13/20) and wraps under it in a narrow cell.
142
+ - Controls size by `box-sizing: border-box` whatever the host's reset: a text input, a select, a one-line bordered button and a segment are all 44 px high (1 + 11 + 20 + 11 + 1), a bordered label that wraps to k lines is 24 + 20k px, and a text area of k rows is 24(k + 1) px (1 + 11 + 24k + 11 + 1), never the height of a one-line field.
143
+ - A `RowButton` is `body` text with 12 px of block padding, so a one-line row is the 44 px target. Its direct children are lines 4 px apart (the reach of a `Pill` beyond the 20 px line it sits on), each keeping its own type step's line, so a row of k `body` lines is 20 + 24k px and a row mixing a `title` name and `body` lines stays on the lattice.
144
+ - A `Pill` is 28 px high (a `caption` line with 4 px above and below): in a 44 px control or row it sits 8 px from each edge, and on a `body` line it overlaps the line by 4 px above and below (negative block margins), so its box is centred on the line and the line stays 20 px. Lines stacked next to a line of pills therefore need 4 px between them (a `RowButton` keeps them apart), and pills that may wrap onto several lines belong in a `Cluster` with a gap of at least `space-2`, whose wrapped rows keep the 28 px boxes apart (pills inline in one run of text overlap by 8 px when the run wraps).
145
+ - A card's `actions` are centred on the title's 28 px line: their box is 44 px high with its content centred and overlaps the title line by 8 px above and below, so a 44 px bordered button and a 28 px `Pill` share the title's centre and the header stays as high as the title line. When the title and the actions do not fit on one line, the actions wrap below the title 8 px apart (the header's 16 px row gap gives back the 8 px overlap); the wrapped row still overhangs the header box by 8 px, so the card's next child is 8 px below it instead of 16. A `Dialog`'s header shares these rules.
146
+ - A `RadioGroup` legend is 4 px above its first option, like a `Field` label above its control (the rendered legend sits outside the fieldset's flex box, so it carries the 4 px as its own padding). Each radio mark is a 20 px box (a `body` line) without the browser's default margins: it starts at the legend's edge, sits centred in the 44 px option line (12 px above and below), and the option text starts 20 + 8 = 28 px from the edge.
147
+ - `Button variant="link"` and `Link` draw a `body` line (13/20) with 12 px of block padding in the regular weight of the surrounding text, `info-fg` and an underline, as the same `inline-flex` box at least 44 px wide: a one-line link is exactly the 44 px target and a label that wraps to k lines is 24 + 20k px, on the lattice (a 44 px minimum height with the text centred would put a two-line label 2 px off it).
138
148
  Every `Button` and `Link` draws its label (`children`, or `busyLabel` while busy) inside one label span, the only in-flow item of its flex box, so a label that mixes text and elements (`所見 <Measured …/> 件を開く`) is one paragraph:
139
- its spaces survive, it wraps as one text (24k px for the link-looking controls, 12 + 20k px for a bordered button) and its lines align like the control (start, or end in an end-aligned column, for the link-looking controls; centred in a bordered button, as the browser centres a button's text), while `justify-content` places the label in a box wider than it. Visually hidden parts of the label stay out of flow.
140
- Place them on a `prose` line (a table cell, a `RowButton` line, prose text) or on a line of their own: inside a `body` (13/20) sentence the 24 px box stretches that line to 24 px and the paragraph gets uneven leading. Bordered buttons draw their label in `body` (13/20) and medium.
141
- Every clickable control (`Button`, `Link`, `RowButton`) inherits `font-variant-numeric` (the browser's `font` shorthand on `<button>` resets it), so a clickable count in an end-aligned table column keeps the column's tabular figures.
149
+ its spaces survive, it wraps as one text (24 + 20k px for the link-looking controls and for a bordered button) and its lines align like the control (start, or end in an end-aligned column, for the link-looking controls; centred in a bordered button, as the browser centres a button's text), while `justify-content` places the label in a box wider than it. Visually hidden parts of the label stay out of flow.
150
+ Every control is at least 44 px high, so place it on a line of its own, in card actions, in a `Cluster` or in a `row-control` table row: inside a sentence its box stretches that line. Bordered buttons draw their label in `body` (13/20) and medium.
151
+ Every clickable control (`Button`, `Link`, `RowButton`, `Switch`, `SegmentedControl`'s segments, `Disclosure`'s button) inherits `font-variant-numeric` (the browser's `font` shorthand on `<button>` resets it), so a clickable count in an end-aligned table column keeps the column's tabular figures.
152
+ - The added controls are on the same lattice: a tab is 12 + 20 + 10 + 2 = 44 px (the 2 px marker is its bottom border, so its text stays centred), a breadcrumb item, a switch, a slider, a disclosure button and a step are 44 px lines, a switch's track is 52 × 28 px (two 20 px thumb places and three 4 px gaps across), a slider's thumb is a 20 px disc on a 4 px rail centred in its 44 px box, a step's marker is 28 px (the pill's height) and a description-list row is a table row (44 px, 24 + 20k px for k lines).
142
153
  - In the stacked layout of `ComparisonGrid` each column is its heading, 8 px above its definition list and underlined by the same decorative rule as the table layout's header row, then the attribute pairs 8 px apart; columns are 16 px apart.
143
154
 
144
155
  ### Focus and announcements
@@ -154,14 +165,18 @@ Draw it as a non-modal `<dialog>` (opened with `show()`) or a popover placed in
154
165
  - `data-cui-row-focus` is the public row-focus hook `LoadMore` finds rows by: inside `rows.ref` each shown row carries exactly one element with it (`rows.count` in all), and a row keeps that element while it stays shown (key rows by their record).
155
166
  `DataTable` rows and `RowButton` set it; a custom row list (cards, a tree, grouped rows) sets `data-cui-row-focus=""` on each row's focusable element (for example with `tabIndex={-1}`) and passes the element holding them as `rows.ref`. In the first commit after a press, `LoadMore` throws when `rows.ref` is not attached or holds a number of marked elements other than `rows.count`.
156
167
  - The focus ring (2 px `focus`, 2 px outset) is drawn only on the elements the package lets take focus; host controls placed inside the root keep their own focus style.
157
- - The root owns the only polite live region: `useAnnounce()` returns `announce(text)`.
168
+ - `Toolbar` is one stop in the Tab order (a roving tabindex over its buttons, `aria-disabled` ones included): Tab enters it at the control that last had focus (the first until then), the arrow keys move to the next and previous control and wrap around (swapped in a right-to-left toolbar), and Home and End move to the first and the last. `Tabs` and `Breadcrumb` are real links, each in the Tab order.
169
+ - `Dialog` opens with `showModal()`, so the browser traps focus in it, makes the rest of the document inert and closes it on Escape; focus starts on its close button and returns, when it closes or unmounts open, to the element that had it when it opened. `onClose` is called when the operator closes it (the close button or Escape), not when the caller sets `open` to `false`. Escape does not close it while focus is in a text field holding a value, as `useEscapeToClose`.
170
+ - The root owns the one announcer: `useAnnounce()` returns `announce(text)`. It writes to the root's polite live region or, while a `Dialog` of the console is the topmost open modal, to that dialog's own polite region (which the modal leaves reachable while it hides the root's).
158
171
  Calls are coalesced over a quiet window: every call restarts a timer of `ANNOUNCE_SETTLE_MS` (150 ms), and when it passes without a call (or 1 s after the first pending call, so a stream of calls cannot hold the write back) the pending sentences are written to the region once, as one string in call order.
159
172
  A browser exposes the accessibility tree per rendering update, not per task, while one operator action spreads its calls over several tasks (an async handler continues after `await`, and React runs a default-lane commit's passive effects in a later task), so a write per task would let a later sentence replace an earlier one before it is read.
160
173
  The merge is by time, not by cause: calls less than 150 ms apart are one write unless the 1 s deadline of the pending write falls between them. The calls of one commit or one action are therefore one write when they come within the window and before that deadline; a handler that awaits longer than the window between two calls, or a commit whose passive effects run after the deadline, gives two writes. Any two writes are at least 150 ms apart, so no sentence is replaced before it is exposed.
161
174
  The same sentence announced again later is read again. `announce` throws `RangeError` for an empty or blank sentence (a missing label or outcome text), which would otherwise clear the region or pad the merged string. `AlertMessage` (`role="alert"`, keyed by the failure's `occurrence`) is used for failures only; `Notice` has no live-region role.
162
- A live region hidden from assistive technology drops every sentence without an error, so the write throws `Error` (from the timer, as an uncaught error that names the lost sentences) when, at that moment, the console is rendered but its announcer is hidden from assistive technology: an ancestor of the announcer is `inert` or `aria-hidden="true"` (in any letter case, as ARIA reads the value), or the topmost open modal `<dialog>` does not contain the console (everything outside the topmost modal is inert, lower modal dialogs included).
163
- The DOM does not expose which open modal is topmost, so it is told from focus, which inert content cannot hold: the candidates are the open modal dialogs that contain the focused element, or all of them while focus is in none. The write lands when every candidate contains the console and throws when none does; when only some do (modal dialogs inside and outside the console's ancestors are open at once, and focus is in none of them) whether the sentence would be heard cannot be told, and the write throws as well.
164
- The check runs at the write, not at the call, so a handler may announce its outcome and close the modal in the same task, or let an effect close it, as long as the modal is closed when the quiet window passes.
175
+ A live region hidden from assistive technology drops every sentence without an error, so the write throws `Error` (from the timer, as an uncaught error that names the lost sentences) when, at that moment, the console is rendered but its announcer is hidden from assistive technology: an ancestor of the announcer is `inert` or `aria-hidden="true"` (in any letter case, as ARIA reads the value), or the topmost open modal `<dialog>` does not contain the console and is not a `Dialog` of the console (everything outside the topmost modal is inert, lower modal dialogs included).
176
+ The DOM does not expose which open modal is topmost, so it is told from focus, which inert content cannot hold: the candidates are the open modal dialogs that contain the focused element, or all of them while focus is in none.
177
+ The write lands in the root's region when every candidate contains the console; otherwise, when the innermost candidate (the one inside all the others, which is the topmost) is a `Dialog` of the console, it lands in that dialog's region; otherwise it throws when no candidate contains the console, and when only some do (modal dialogs inside and outside the console's ancestors are open at once, and focus is in none of them) whether the sentence would be heard cannot be told, and the write throws as well.
178
+ The check runs at the write, not at the call, so a handler may announce its outcome and close the modal in the same task, or let an effect close it, as long as the modal is closed when the quiet window passes: an outcome announced inside a `Dialog` that then closes is heard in the root's region.
179
+ `JobCard`'s state line is a live region of its own (polite and atomic, holding the job's hidden name and its state pill), so a changed state is read as `<name> <state>` without moving focus or interrupting (WCAG 2.2.4), exactly as drawn.
165
180
  The check needs the `:modal` selector (Chrome 105, Firefox 103, Safari 15.6): `ConsoleUiRoot` probes it once when it mounts and throws there, naming the requirement, in a document without it.
166
181
  A console that is not rendered is not checked: an ancestor with `hidden` or `display: none`, `visibility: hidden` or `content-visibility: hidden`, a closed `<details>` or `<dialog>`, or `<Activity mode="hidden">` (which detaches the announcer while keeping the root) hides the console from the operator as well, so its announcements are dropped without an error, as after unmount. A host that must not lose an outcome keeps the console rendered until the outcome is read.
167
182
  - `useEscapeToClose(onClose)` ignores Escape during IME composition and in a text field that holds a value, including a partly typed date, time or number field (its `value` is `""` while `validity.badInput` is true): closing the region would discard what the operator typed.
@@ -234,16 +249,30 @@ Draw it as a non-modal `<dialog>` (opened with `show()`) or a popover placed in
234
249
  | `Card`, `CardSection` | `h2` card (a named region that draws its content in the body type and the sans face) and flat `h3` section (a landmark only with `region`, for a non-modal region such as an inspector); `headingRef` makes the heading a programmatic focus target (`tabIndex={-1}`). A card or section that another control expands takes that control's `aria-controls` target as its `id` (the detail of a `SelectableList` is `<CardSection id={detailId} …>`), so the reference resolves. |
235
250
  | `Stack`, `Cluster` | Vertical and wrapping horizontal layout with a spacing token. |
236
251
  | `Button`, `Link` | Buttons that keep focus when they cannot act; an in-document move drawn as a link (no `href`). |
237
- | `Pill` | A text status label, 24 px high, text width + 16 px wide, `vertical-align: top`; as a line of a `RowButton` it keeps that width. A line mixing a `Pill` and text is one `Text` span containing the `Pill`. |
252
+ | `Pill` | A text status label, 28 px high (a body line it sits on stays 20 px), text width + 16 px wide, `vertical-align: top`; as a line of a `RowButton` it keeps that width. A line mixing a `Pill` and text is one `Text` span containing the `Pill`. |
238
253
  | `Notice`, `AlertMessage` | Quiet note; failure message read once per occurrence. |
239
254
  | `Measured` | A count, or the `unmeasured` label for `null` (never `0`). |
240
- | `MetricTile`, `TileGrid` | Metric tiles (88 px high) and the divisor grid. `count` is checked against the element children: a Fragment's children count one by one, a condition that renders no tile (`false`, `null`) does not count, a text child throws, and a component child counts as one tile whatever it renders (a wrapper returning `null` or two tiles is still one), so render `MetricTile` elements directly. |
255
+ | `MetricTile`, `TileGrid` | Metric tiles (100 px high) and the divisor grid. `count` is checked against the element children: a Fragment's children count one by one, a condition that renders no tile (`false`, `null`) does not count, a text child throws, and a component child counts as one tile whatever it renders (a wrapper returning `null` or two tiles is still one), so render `MetricTile` elements directly. |
241
256
  | `DataTable`, `LoadMore` | Fixed-layout table in a focusable named scroll frame; load-more that moves focus to the first row the page appended or the end-of-records text. |
257
+ | `CodeBlock` | Preformatted text (a JSON document, an excerpt of a log) drawn exactly as given in the mono face and the `body` type, without wrapping, in a scroll frame on `sunken` with 8 px padding: a region named by `label` that takes keyboard focus, so a long line can be scrolled into view from the keyboard. |
242
258
  | `SelectableList`, `RowButton` | Master list of selectable rows (`data-selected`, `aria-expanded`, `aria-controls`); the list carries an explicit `role="list"`, which WebKit needs to expose an unstyled list as a list. |
243
259
  | `ComparisonGrid` | Side-by-side comparison: a table named by its (visually hidden) `caption`, or one group per column named by its heading. Both layouts are in the DOM; each cell is a function called once per layout with `"table"` or `"stack"`, so every cell is rendered and mounted twice (the hidden copy included) and the caller gives each copy its own ids, test ids and refs. Cells must be presentational: no data read (`useResource`), announcement (`useAnnounce`) or focus management (`useFocusRescue`); keep state and effects above the grid and pass values into the cells. |
244
260
  | `Field`, `TextInput`, `TextArea`, `Select`, `RadioGroup` | Fields tied to their label, description and error with `useId`. |
245
261
  | `ProgressBar` | Determinate with a maximum (clamped at 100 %); indeterminate without, drawn as a quarter-length segment that sweeps the track when motion is allowed and rests in its middle otherwise. The visible label names the bar; the visible value text is hidden from assistive technology, which reads it once as the bar's `aria-valuetext`. |
262
+ | `Meter` | A value at its place in a fixed range (a score in [0, 1], a share of a quota), not progress: `role="meter"` named by `label` (no visible label; the row or field around it says what it measures), its fill in `info-accent` on a `sunken` track as long as the value's place in the range, beside the value text in `fg` (hidden from assistive technology, which reads it once as the meter's `aria-valuetext`). It is phrasing content that fits one `body` line, so it can be a line of a `RowButton`: the 8 px track is centred on the value text's 20 px line and takes the width left after the text, never less than 48 px. Refuses a range that is not finite or whose `min` is not below `max`, and a value outside the range. |
246
263
  | `MasterDetail` | Master–detail layout by container width; side by side, neither pane goes below its minimum. |
264
+ | `Heading` | A page or region heading outside a `Card`: `h1` to `h3` in a heading step (`title`, `heading`, `display`, `display-lg`), bold, without margins; with `headingRef` a programmatic focus target (`tabIndex={-1}`) for the focus a host moves after a navigation. |
265
+ | `Tabs` | The tab row of a console whose tabs are routes: a named `nav` of real links (not an ARIA `tablist`), the current one `aria-current="page"` with an `info-accent` marker and the medium weight. A plain click hands the tab's `href` to `onNavigate` (the host's router); a click with a modifier key or another button keeps the link's own behaviour. |
266
+ | `Breadcrumb` | The trail to the current page: a `nav` named by the UI language's `breadcrumb` label around an ordered list of the ancestors' links (drawn like `Link`) and the current page's name as `aria-current="page"` text; separators are hidden from assistive technology. Clicks as `Tabs`. |
267
+ | `Toolbar` | `role="toolbar"` with a roving tabindex over its buttons (see Focus and announcements), laid out like a `Cluster` with an 8 px gap. |
268
+ | `Dialog` | A modal `<dialog>` named by its title, with its close button and its own live region (see Focus and announcements); at most 40 ideographs plus its padding wide (WCAG 1.4.8), never wider than the viewport less 24 px on each side. |
269
+ | `Switch` | An on/off setting that takes effect at once: `role="switch"` with `aria-checked`, named by its label; the thumb sits at the track's start when off and at its end when on, moving over `motion-1`. |
270
+ | `Slider` | A labelled native `input type="range"` whose value text is its `aria-valuetext`, drawn beside it and hidden from assistive technology; changes arrive as numbers. Refuses a range that is not finite, `min` not below `max`, a step that is not positive and a value outside the range. |
271
+ | `SegmentedControl` | One choice among a few options: a named group of toggle buttons (`aria-pressed`) with exactly one pressed (`info-solid` with `on-solid` text); a press on the pressed option asks for nothing. Needs two or more options with unique values. |
272
+ | `Disclosure` | A button with `aria-expanded` and `aria-controls` over the panel it shows and hides (`hidden` while closed), with a ▸ / ▾ marker; the open state is the caller's. |
273
+ | `DescriptionList` | A `dl` of name–value rows (`dt` and `dd` grouped in a `div`), the term a third of the row in `fg-secondary`. |
274
+ | `Stepper` | A job's steps as a named ordered list: the current step `aria-current="step"`, the others followed by the hidden `stepDone` or `stepPending` word; a finished step's marker is a check mark on `success-solid`, the current one its number on `info-solid`. The states must run done, at most one current, then pending. |
275
+ | `JobCard` | One job in a `Card`: its state pill in a live region of its own, an optional `ProgressBar` and an optional cancel button in the card's actions that is busy while the cancel is under way. |
247
276
  | `useEscapeToClose`, `useFocusRescue`, `useResource`, `usePagedResource`, `ResourceFailed` | See above. |
248
277
 
249
278
  Every component except `Text` requires `testId`, exposes its state as `data-*` attributes, takes no `className`, and accepts caller `data-*` attributes through `dataAttributes` where a host needs to mark it (`data-cui-*` and `data-testid` are reserved and rejected there). The one `data-cui-*` attribute a host writes itself is the row-focus hook `data-cui-row-focus`, on the row elements of its own row list (see Focus and announcements).
@@ -253,6 +282,16 @@ The test ids a component derives from its `testId` are public test hooks:
253
282
  | Component | Derived test ids |
254
283
  | --- | --- |
255
284
  | `ConsoleUiRoot` | `<testId>-announcer` (the live region) |
285
+ | `Tabs` | `<testId>-<id>` (each tab's link) |
286
+ | `Breadcrumb` | `<testId>-<id>` (each ancestor's link), `<testId>-current` (the current page's name) |
287
+ | `Dialog` | `<testId>-close` (the close button), `<testId>-announcer` (the dialog's live region) |
288
+ | `Switch` | `<testId>-track`, `<testId>-thumb` |
289
+ | `Slider` | `<testId>-field` (the field root; `testId` itself is on the input), `<testId>-value` (the drawn value text) |
290
+ | `SegmentedControl` | `<testId>-<value>` (each option's button) |
291
+ | `Disclosure` | `<testId>-button`, `<testId>-panel` |
292
+ | `DescriptionList` | `<testId>-<key>` (each row) |
293
+ | `Stepper` | `<testId>-<id>` (each step) |
294
+ | `JobCard` | `<testId>-status` (the live region), `<testId>-status-pill`, `<testId>-progress` (with the `ProgressBar` ids), `<testId>-cancel` |
256
295
  | `Button` | `<testId>-reason` (the `unavailable` reason) |
257
296
  | `DataTable` | `<testId>-frame` (the scroll frame), `<testId>-empty` (the `empty` text) |
258
297
  | `SelectableList` | `<testId>-empty` (the `empty` text) |
@@ -261,6 +300,8 @@ The test ids a component derives from its `testId` are public test hooks:
261
300
  | `TextInput`, `TextArea`, `Select` | `<testId>-field` (the field root; `testId` itself is on the control), `<testId>-description`, `<testId>-error` |
262
301
  | `Field`, `RadioGroup` | `<testId>-description`, `<testId>-error`; `RadioGroup` also `<testId>-option-<value>` |
263
302
  | `ProgressBar` | `<testId>-bar` (the `progressbar`), `<testId>-fill`, `<testId>-value` (the visible value text) |
303
+ | `Meter` | `<testId>-bar` (the `meter`), `<testId>-fill`, `<testId>-value` (the visible value text) |
304
+ | `CodeBlock` | `<testId>-code` (the `pre`; `testId` itself is on the frame) |
264
305
  | `MetricTile` | `<testId>-value` (the `Measured` value) |
265
306
  | `MasterDetail` | `<testId>-master`, `<testId>-detail` |
266
307
 
@@ -285,6 +326,8 @@ Announcements are written once the quiet window passes (`ANNOUNCE_SETTLE_MS`, 15
285
326
 
286
327
  `ConsoleUiRoot` needs a test DOM that parses the `:modal` selector (see Focus and announcements): jsdom 27 or later. On jsdom 26 and earlier the root throws when it mounts (`ConsoleUiRoot requires the :modal selector …`). jsdom 27 and later, and happy-dom, parse `:modal` but never match it, even after `showModal()`, so a test of an announcement under a modal dialog answers `document.querySelectorAll("dialog:modal")` itself with the dialogs a browser would return, and moves focus as the browser would (into the topmost modal).
287
328
 
329
+ jsdom 27 reflects a dialog's `open` but implements neither `showModal()` nor `close()`, which `Dialog` calls, so a test of a `Dialog` installs both on `HTMLDialogElement.prototype` first: a model that sets and removes `open`, focuses the dialog's first focusable descendant, returns focus on close to the element that had it at the open, and fires `close` in a later task (the browser's order). It cannot make the rest of the document inert.
330
+
288
331
  jsdom does not evaluate container queries, so only the layout components' default rules apply there. For `ComparisonGrid` that is the stacked layout: the column groups and the `stack` copy of every cell are shown and reachable by role, while the table is `display: none` and therefore not in the accessibility tree. Query the stacked copy (for example a cell test id `tie-stack`, or `getByRole("group", { name })`), and pass `hidden: true` to reach the table (`getByRole("table", { name, hidden: true })`); `toBeVisible()` is false for the table and its cells.
289
332
 
290
333
  ## License
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var w=new Map,Y= exports.a =(e,r)=>{if(!(Number.isSafeInteger(e)&&e>=0))throw new RangeError(`A count must be a non-negative safe integer: ${e}`);let n=w.get(r);return n===void 0&&(n=new Intl.NumberFormat(r,{maximumFractionDigits:0,useGrouping:!0}),w.set(r,n)),n.format(e)};var i=class extends RangeError{constructor(r,n){super(n),this.name="ZonedTimeError",this.reason=r}},K=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?$/,V=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(?:(Z)|([+-])(\d{2}):(\d{2}))$/,q=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(?:(Z)|([+-])(\d{2}):?(\d{2}))$/,M=864e5,b=6e4,f={min:1,max:9999},_=new Map,N=new Map,J=e=>{let r=_.get(e);return r===void 0&&(r=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),_.set(e,r)),r},$=e=>{let r=new Date(0);return r.setUTCFullYear(e.year,e.month-1,e.day),r.setUTCHours(e.hour,e.minute,e.second,0),r.getUTCFullYear()===e.year&&r.getUTCMonth()===e.month-1&&r.getUTCDate()===e.day&&r.getUTCHours()===e.hour&&r.getUTCMinutes()===e.minute&&r.getUTCSeconds()===e.second?r.getTime():null},h=(e,r)=>{let[n,t,o,s,l,a,y]=r;if(y!==void 0&&/[1-9]/.test(y))throw new i("subsecond",`Fractions of a second cannot be kept: ${e}`);let c={year:Number(n),month:Number(t),day:Number(o),hour:Number(s),minute:Number(l),second:a===void 0?0:Number(a)},P=c.year>=f.min?$(c):null;if(P===null)throw new i("malformed",`Not a calendar date and time: ${e}`);return{fields:c,millis:P}},k=(e,r)=>{let n=new Map(J(r).formatToParts(new Date(e)).map(o=>[o.type,o.value])),t={year:Number(n.get("year")),month:Number(n.get("month")),day:Number(n.get("day")),hour:Number(n.get("hour")),minute:Number(n.get("minute")),second:Number(n.get("second"))};if(n.get("era")!=="AD"||t.year>f.max)throw new i("malformed",`The wall clock falls outside years ${f.min}-${f.max}: ${new Date(e).toISOString()}`);return t},T=(e,r)=>$(k(e,r))-e,d=e=>String(e).padStart(2,"0"),I=(e,r)=>{let n=`${String(e.year).padStart(4,"0")}-${d(e.month)}-${d(e.day)}T${d(e.hour)}:${d(e.minute)}`;return r||e.second!==0?`${n}:${d(e.second)}`:n},Z=e=>{if(e%b!==0)throw new i("malformed",`The zone's offset is not a whole number of minutes: ${e} ms`);let r=Math.abs(e)/b;return`${e<0?"-":"+"}${d(Math.floor(r/60))}:${d(r%60)}`},Q= exports.c =(e,r)=>{let n=K.exec(e);if(n===null)throw new i("malformed",`Not a wall time (YYYY-MM-DDTHH:mm[:ss]): ${e}`);let{fields:t,millis:o}=h(e,n.slice(1)),l=[...new Set([T(o-M,r),T(o+M,r)])].filter(a=>T(o-a,r)===a);if(l.length===0)throw new i("nonexistent",`${e} does not exist in ${r}`);if(l.length>1)throw new i("ambiguous",`${e} occurs twice in ${r}`);return`${I(t,!0)}${Z(l[0])}`},F=(e,r)=>{let[n,t,o,s]=r;if(n!==void 0)return 0;if(Number(o)>23||Number(s)>59)throw new i("malformed",`Not a valid offset: ${e}`);return(t==="-"?-1:1)*(Number(o)*60+Number(s))*b},ee= exports.d =(e,r)=>{let n=V.exec(e);if(n===null)throw new i("malformed",`Not an ISO 8601 instant with an offset: ${e}`);let{millis:t}=h(e,n.slice(1,8));return I(k(t-F(e,n.slice(8)),r),!1)},re=(e,r)=>{let n=JSON.stringify([e,r]),t=N.get(n);return t===void 0&&(t=new Intl.DateTimeFormat(e,{timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}),N.set(n,t)),t},ne= exports.e =(e,r,n)=>{let t=q.exec(e);if(t===null)throw new i("malformed",`Not an ISO 8601 instant with an offset: ${e}`);let{millis:o}=h(e,[...t.slice(1,7),void 0]),s=o-F(e,t.slice(7));return k(s,n),re(r,n).format(s)};var L=403,te= exports.g =(e,r)=>e.ok?{ok:!0,value:r(e.value)}:e,oe= exports.h =(e,r)=>e.ok?r(e.value):e,Ue= exports.i ={kind:"idle"},ae= exports.j ={kind:"loading"},x= exports.k =(e,r)=>e.kind==="ready"?{...e,refreshing:!0}:e.kind==="failed"?r==="reload"?{...e,retrying:!0}:e:ae,R= exports.l =(e,r)=>r.ok?{kind:"ready",value:r.value,refreshing:!1,refreshFailure:null}:e.kind==="failed"&&e.status===403?e.retrying?{...e,retrying:!1}:e:e.kind==="ready"&&r.status!==403?{kind:"ready",value:e.value,refreshing:!1,refreshFailure:{status:r.status,reason:r.reason}}:{kind:"failed",status:r.status,reason:r.reason,occurrence:e.kind==="failed"?e.occurrence+1:1,retrying:!1};var m=e=>e===""?"":` (${e})`,A=e=>(r,n,t)=>r.status===403?e(n,r.reason):t(r.reason),v=(e,r)=>r===""?e:`${e} Reason: ${r}.`,D=(e,r)=>r===""?e:`${e}${r}\u3002`,p= exports.n ={en:{unmeasured:"Not measured",loading:"Loading",loadFailed:e=>`Could not load${m(e)}.`,refreshFailed:e=>`Could not refresh${m(e)}.`,forbiddenBecause:v,failureSentence:A(v),loadMore:e=>`Show ${e} more`,endOfRecords:"No more records",close:"Close",cancel:"Cancel",reload:"Reload",breadcrumb:"Breadcrumb",stepDone:"Done",stepPending:"Not started"},ja:{unmeasured:"\u672A\u6E2C\u5B9A",loading:"\u8AAD\u307F\u8FBC\u307F\u4E2D",loadFailed:e=>`\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F${m(e)}\u3002`,refreshFailed:e=>`\u66F4\u65B0\u306B\u5931\u6557\u3057\u307E\u3057\u305F${m(e)}\u3002`,forbiddenBecause:D,failureSentence:A(D),loadMore:e=>`\u3055\u3089\u306B ${e} \u4EF6\u3092\u8868\u793A`,endOfRecords:"\u3053\u308C\u4EE5\u4E0A\u306E\u8A18\u9332\u306F\u3042\u308A\u307E\u305B\u3093",close:"\u9589\u3058\u308B",cancel:"\u3084\u3081\u308B",reload:"\u518D\u8AAD\u307F\u8FBC\u307F",breadcrumb:"\u30D1\u30F3\u304F\u305A",stepDone:"\u5B8C\u4E86",stepPending:"\u672A\u7740\u624B"}},ie= exports.o =e=>{if(!Object.hasOwn(p,e))throw new RangeError(`No console UI labels for locale "${e}"; supported: ${Object.keys(p).join(", ")}`);return p[e]};var se=e=>{if(!(Number.isFinite(e)&&e>=0))throw new RangeError(`Length must be a finite px value >= 0: ${e}`);return e},u= exports.p =e=>`${se(e)/16}rem`;var U=(1+Math.sqrt(5))/2,W=({masterMinPx:e,detailMinPx:r,gapPx:n})=>{for(let t of[e,r])if(!(Number.isFinite(t)&&t>0))throw new RangeError(`Pane minimum must be a positive px value: ${t}`);if(!(Number.isFinite(n)&&n>=0))throw new RangeError(`Gap must be a px value >= 0: ${n}`);return e+n+r},le= exports.q =(e,r)=>{let n=W(r);if(!(Number.isFinite(e)&&e>=0))throw new RangeError(`Container width must be a px value >= 0: ${e}`);if(e<n)return{sideBySide:!1,sideBySideFromPx:n,masterInlinePx:e,detailInlinePx:e};let t=(e-r.gapPx)/(1+U),o=Math.min(Math.max(r.masterMinPx,t),e-r.gapPx-r.detailMinPx);return{sideBySide:!0,sideBySideFromPx:n,masterInlinePx:o,detailInlinePx:e-r.gapPx-o}},Ge= exports.r =e=>{let r=W(e),n=`cui-master-detail-m${e.masterMinPx}-d${e.detailMinPx}-g${e.gapPx}`,t=`[data-cui-master-detail="${n}"]`,o=u(e.gapPx),s=`${t}{grid-template-columns:minmax(0,1fr);gap:${o}}`,l=`clamp(${u(e.masterMinPx)},calc((100% - ${o}) / ${1+U}),calc(100% - ${o} - ${u(e.detailMinPx)}))`,a=`@container (min-width:${u(r)}){${t}{grid-template-columns:${l} minmax(0,1fr)}}`;return{key:n,css:s+a}};var z=e=>{if(!(Number.isFinite(e)&&e>0))throw new RangeError(`Column width must be a positive px value: ${e}`);return e},de= exports.s =e=>{if(e.length===0)throw new RangeError("A table needs at least one column");let r=0,n=null;for(let{width:t}of e){if(t.fixedPx!==void 0){r+=z(t.fixedPx);continue}let o=z(t.minPx);if(n!==null&&n!==o)throw new RangeError(`Flexible columns share the remaining width equally, so their minimums must be equal: ${n} and ${o}`);n=o,r+=o}return r};var ue=e=>e>=32&&e<=126||e>=65377&&e<=65500||e>=65512&&e<=65518,H=(e,r)=>{let n=0,t=0;for(let o of e)ue(o.codePointAt(0))?t+=1:n+=1;return n*1+t*r},ce= exports.t =e=>H(e,.55),me= exports.u =e=>H(e,.6),ge= exports.v =e=>{if(!(Number.isFinite(e)&&e>=0))throw new RangeError(`Length must be a finite px value >= 0: ${e}`);return Math.max(0,Math.ceil((e-1e-9)/8))*8};var ye=(e,r,n)=>{if(!(Number.isSafeInteger(e)&&e>0))throw new RangeError(`Tile count must be a positive integer: ${e}`);if(!(Number.isFinite(r)&&r>0))throw new RangeError(`Tile minimum width must be a positive px value: ${r}`);if(!(Number.isFinite(n)&&n>=0))throw new RangeError(`Tile gap must be a px value >= 0: ${n}`);let t=[];for(let a=1;a<=e;a+=1)e%a===0&&t.push({columns:a,minContainerPx:a*r+(a-1)*n});let o=`cui-tiles-n${e}-m${r}-g${n}`,s=`[data-cui-tile-grid="${o}"]`,l=t.map(({columns:a,minContainerPx:y})=>{let c=`${s}{grid-template-columns:repeat(${a},minmax(0,1fr))}`;return a===1?c:`@container (min-width:${u(y)}){${c}}`});return{key:o,steps:t,css:l.join("")}};var fe=(e,r)=>{let n=x(e,r);return n.kind==="ready"?{...n,value:{...n.value,loadingMore:!1}}:n},pe= exports.y =(e,r)=>R(e,r.ok?{ok:!0,value:{rows:r.value.rows,next:r.value.next,meta:r.value.meta,loadingMore:!1,moreFailure:null}}:r),Te= exports.z =e=>e.kind==="ready"&&!e.refreshing&&e.value.next!==null&&!e.value.loadingMore?{...e,value:{...e.value,loadingMore:!0}}:e,be= exports.A =(e,r,n)=>{if(!(e.kind==="ready"&&e.value.loadingMore&&Object.is(e.value.next,r)))return e;if(n.ok)return{...e,value:{...e.value,rows:[...e.value.rows,...n.value.rows],next:n.value.next,loadingMore:!1,moreFailure:null}};let t=e.value.moreFailure===null?1:e.value.moreFailure.occurrence+1;return{...e,value:{...e.value,loadingMore:!1,moreFailure:{reason:n.reason,occurrence:t}}}},he= exports.B =(e,r)=>{if(e.kind!=="ready")return e;let{rows:n,meta:t}=r({rows:e.value.rows,meta:e.value.meta});return{...e,value:{...e.value,rows:n,meta:t}}};var ke=4,xe=[1,2,3,4,6,8,12,16,24],Re=16,Ce=5/4,S={caption:-2,body:-1,title:0,heading:1,display:2,"display-lg":3},Se=11,B=3/2,Oe=7/4,Ee=7/4,Pe=120,we=3/2,Me=[1,2,3],G= exports.D =e=>{if(!(Number.isFinite(e)&&e>=0))throw new RangeError(`A length must be a finite number of px at or above 0: ${e}`);return Math.ceil(e/4)*4},O=e=>{if(!Number.isInteger(e))throw new RangeError(`A type step must be an integer: ${e}`);return Math.max(Se,Math.round(Re*Ce**e))},E=(e,r)=>G(e*r),g= exports.E =E(O(S.body),B)+24,X= exports.F =g+8,C={weight:{regular:400,medium:500,bold:700},radius:{"radius-control":4,"radius-item":8,"radius-container":12,"radius-pill":9999},stroke:{"border-width":1,"focus-width":2,"focus-offset":2,"marker-width":2}},_e=()=>Object.fromEntries(xe.map(e=>[`space-${e}`,e*4])),Ne=()=>{let e=Object.fromEntries(Object.entries(S).map(([n,t])=>{let o=O(t);return[n,{size:o,lineHeight:E(o,n==="title"?Ee:B)}]})),r=O(S.body);return{...e,prose:{size:r,lineHeight:E(r,Oe)}}},$e=()=>Object.fromEntries(Me.map(e=>[`motion-${e}`,Pe*we**(e-1)])),j=e=>Object.freeze({space:Object.freeze(_e()),type:Object.freeze(Ne()),weight:C.weight,radius:C.radius,size:Object.freeze({"size-target":g,"size-control":g,"size-row":g,"size-row-control":X}),stroke:C.stroke,motion:Object.freeze($e()),color:Object.freeze({...e})});var Ie={fg:{light:"#0f172b",dark:"#f8fafc"},"fg-secondary":{light:"#314158",dark:"#e2e8f0"},"fg-muted":{light:"#44536a",dark:"#cad5e2"},"danger-fg":{light:"#9f0712",dark:"#ffc9c9"},"warning-fg":{light:"#7b3306",dark:"#fee685"},"success-fg":{light:"#006045",dark:"#a4f4cf"},"info-fg":{light:"#193cb8",dark:"#bedbff"},"on-solid":{light:"#ffffff",dark:"#0f172b"},surface:{light:"#ffffff",dark:"#0f172b"},subtle:{light:"#f8fafc",dark:"#1d293d"},sunken:{light:"#f1f5f9",dark:"#020618"},"danger-tint":{light:"#fef2f2",dark:"#460809"},"warning-tint":{light:"#fffbeb",dark:"#461901"},"success-tint":{light:"#ecfdf5",dark:"#002c22"},"info-tint":{light:"#eff6ff",dark:"#162456"},"neutral-solid":{light:"#314158",dark:"#cad5e2"},"danger-solid":{light:"#9f0712",dark:"#ffa2a2"},"success-solid":{light:"#006045",dark:"#5ee9b5"},"info-solid":{light:"#193cb8",dark:"#8ec5ff"},"warning-solid":{light:"#7b3306",dark:"#ffd230"},"danger-accent":{light:"#e7000b",dark:"#ff6467"},"warning-accent":{light:"#bb4d00",dark:"#fcbb00"},"success-accent":{light:"#009966",dark:"#00d492"},"info-accent":{light:"#155dfc",dark:"#51a2ff"},focus:{light:"#155dfc",dark:"#51a2ff"},"border-control":{light:"#62748e",dark:"#90a1b9"},"border-subtle":{light:"#e2e8f0",dark:"#314158"}},Fe= exports.G =j(Ie),Le="--cui-",Ae= exports.H =e=>`var(${Le}${e})`;exports.a = Y; exports.b = i; exports.c = Q; exports.d = ee; exports.e = ne; exports.f = L; exports.g = te; exports.h = oe; exports.i = Ue; exports.j = ae; exports.k = x; exports.l = R; exports.m = m; exports.n = p; exports.o = ie; exports.p = u; exports.q = le; exports.r = Ge; exports.s = de; exports.t = ce; exports.u = me; exports.v = ge; exports.w = ye; exports.x = fe; exports.y = pe; exports.z = Te; exports.A = be; exports.B = he; exports.C = ke; exports.D = G; exports.E = g; exports.F = X; exports.G = Fe; exports.H = Ae;
@@ -0,0 +1 @@
1
+ var u=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i;var i=n=>{let e=u.exec(n);if(e===null)throw new RangeError(`Colour must be #rrggbb: ${n}`);let[,s,r,t]=e;return[Number.parseInt(s,16)/255,Number.parseInt(r,16)/255,Number.parseInt(t,16)/255]},o=n=>n<=.04045?n/12.92:((n+.055)/1.055)**2.4,c=n=>{for(let t of n)if(!(t>=0&&t<=1))throw new RangeError(`sRGB channels must be numbers in [0, 1]: ${n.join(", ")}`);let[e,s,r]=n;return .2126*o(e)+.7152*o(s)+.0722*o(r)},f=(n,e)=>{let[s,r]=[c(n),c(e)].sort((t,a)=>a-t);return(s+.05)/(r+.05)},g={text:7,largeText:4.5,nonText:3},l={light:{fg:{surface:17.83,subtle:17.04,sunken:16.28,"danger-tint":16.3,"warning-tint":17.19,"success-tint":16.93,"info-tint":16.38},"fg-secondary":{surface:10.36,subtle:9.9,sunken:9.45},"fg-muted":{surface:7.8,subtle:7.46,sunken:7.12,"danger-tint":7.13,"warning-tint":7.52,"info-tint":7.17},"danger-fg":{surface:8.36,subtle:7.99,"danger-tint":7.64},"warning-fg":{surface:9.06,subtle:8.66,"warning-tint":8.73},"success-fg":{surface:7.61,subtle:7.27,"success-tint":7.23},"info-fg":{surface:8.82,"info-tint":8.11,subtle:8.43},"on-solid":{"neutral-solid":10.36,"danger-solid":8.36,"success-solid":7.61,"info-solid":8.82,"warning-solid":9.06},"danger-accent":{surface:4.77,"danger-tint":4.36},"warning-accent":{surface:5.03,"warning-tint":4.85},"success-accent":{surface:3.65,"success-tint":3.47},"info-accent":{surface:5.25,subtle:5.01,sunken:4.79,"info-tint":4.82},focus:{surface:5.25,subtle:5.01,sunken:4.79,"info-tint":4.82},"border-control":{surface:4.76,subtle:4.55,sunken:4.35}},dark:{fg:{surface:17.04,subtle:13.97,sunken:19.27,"danger-tint":15.45,"warning-tint":14.34,"success-tint":14.51,"info-tint":14.13},"fg-secondary":{surface:14.46,subtle:11.86,sunken:16.35},"fg-muted":{surface:12,subtle:9.83,sunken:13.56,"danger-tint":10.87,"warning-tint":10.09,"info-tint":9.94},"danger-fg":{surface:12.27,subtle:10.06,"danger-tint":11.12},"warning-fg":{surface:14.33,subtle:11.74,"warning-tint":12.05},"success-fg":{surface:13.94,subtle:11.43,"success-tint":11.87},"info-fg":{surface:12.54,"info-tint":10.39,subtle:10.28},"on-solid":{"neutral-solid":12,"danger-solid":9.29,"success-solid":11.72,"info-solid":9.83,"warning-solid":12.32},"danger-accent":{surface:6.17,"danger-tint":5.6},"warning-accent":{surface:10.4,"warning-tint":8.75},"success-accent":{surface:9.2,"success-tint":7.83},"info-accent":{surface:6.76,subtle:5.54,sunken:7.64,"info-tint":5.6},focus:{surface:6.76,subtle:5.54,sunken:7.64,"info-tint":5.6},"border-control":{surface:6.78,subtle:5.56,sunken:7.66}}};export{i as a,f as b,g as c,l as d};
@@ -0,0 +1 @@
1
+ var w=new Map,Y=(e,r)=>{if(!(Number.isSafeInteger(e)&&e>=0))throw new RangeError(`A count must be a non-negative safe integer: ${e}`);let n=w.get(r);return n===void 0&&(n=new Intl.NumberFormat(r,{maximumFractionDigits:0,useGrouping:!0}),w.set(r,n)),n.format(e)};var i=class extends RangeError{reason;constructor(r,n){super(n),this.name="ZonedTimeError",this.reason=r}},K=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?$/,V=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(?:(Z)|([+-])(\d{2}):(\d{2}))$/,q=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(?:(Z)|([+-])(\d{2}):?(\d{2}))$/,M=864e5,b=6e4,f={min:1,max:9999},_=new Map,N=new Map,J=e=>{let r=_.get(e);return r===void 0&&(r=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),_.set(e,r)),r},$=e=>{let r=new Date(0);return r.setUTCFullYear(e.year,e.month-1,e.day),r.setUTCHours(e.hour,e.minute,e.second,0),r.getUTCFullYear()===e.year&&r.getUTCMonth()===e.month-1&&r.getUTCDate()===e.day&&r.getUTCHours()===e.hour&&r.getUTCMinutes()===e.minute&&r.getUTCSeconds()===e.second?r.getTime():null},h=(e,r)=>{let[n,t,o,s,l,a,y]=r;if(y!==void 0&&/[1-9]/.test(y))throw new i("subsecond",`Fractions of a second cannot be kept: ${e}`);let c={year:Number(n),month:Number(t),day:Number(o),hour:Number(s),minute:Number(l),second:a===void 0?0:Number(a)},P=c.year>=f.min?$(c):null;if(P===null)throw new i("malformed",`Not a calendar date and time: ${e}`);return{fields:c,millis:P}},k=(e,r)=>{let n=new Map(J(r).formatToParts(new Date(e)).map(o=>[o.type,o.value])),t={year:Number(n.get("year")),month:Number(n.get("month")),day:Number(n.get("day")),hour:Number(n.get("hour")),minute:Number(n.get("minute")),second:Number(n.get("second"))};if(n.get("era")!=="AD"||t.year>f.max)throw new i("malformed",`The wall clock falls outside years ${f.min}-${f.max}: ${new Date(e).toISOString()}`);return t},T=(e,r)=>$(k(e,r))-e,d=e=>String(e).padStart(2,"0"),I=(e,r)=>{let n=`${String(e.year).padStart(4,"0")}-${d(e.month)}-${d(e.day)}T${d(e.hour)}:${d(e.minute)}`;return r||e.second!==0?`${n}:${d(e.second)}`:n},Z=e=>{if(e%b!==0)throw new i("malformed",`The zone's offset is not a whole number of minutes: ${e} ms`);let r=Math.abs(e)/b;return`${e<0?"-":"+"}${d(Math.floor(r/60))}:${d(r%60)}`},Q=(e,r)=>{let n=K.exec(e);if(n===null)throw new i("malformed",`Not a wall time (YYYY-MM-DDTHH:mm[:ss]): ${e}`);let{fields:t,millis:o}=h(e,n.slice(1)),l=[...new Set([T(o-M,r),T(o+M,r)])].filter(a=>T(o-a,r)===a);if(l.length===0)throw new i("nonexistent",`${e} does not exist in ${r}`);if(l.length>1)throw new i("ambiguous",`${e} occurs twice in ${r}`);return`${I(t,!0)}${Z(l[0])}`},F=(e,r)=>{let[n,t,o,s]=r;if(n!==void 0)return 0;if(Number(o)>23||Number(s)>59)throw new i("malformed",`Not a valid offset: ${e}`);return(t==="-"?-1:1)*(Number(o)*60+Number(s))*b},ee=(e,r)=>{let n=V.exec(e);if(n===null)throw new i("malformed",`Not an ISO 8601 instant with an offset: ${e}`);let{millis:t}=h(e,n.slice(1,8));return I(k(t-F(e,n.slice(8)),r),!1)},re=(e,r)=>{let n=JSON.stringify([e,r]),t=N.get(n);return t===void 0&&(t=new Intl.DateTimeFormat(e,{timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}),N.set(n,t)),t},ne=(e,r,n)=>{let t=q.exec(e);if(t===null)throw new i("malformed",`Not an ISO 8601 instant with an offset: ${e}`);let{millis:o}=h(e,[...t.slice(1,7),void 0]),s=o-F(e,t.slice(7));return k(s,n),re(r,n).format(s)};var L=403,te=(e,r)=>e.ok?{ok:!0,value:r(e.value)}:e,oe=(e,r)=>e.ok?r(e.value):e,Ue={kind:"idle"},ae={kind:"loading"},x=(e,r)=>e.kind==="ready"?{...e,refreshing:!0}:e.kind==="failed"?r==="reload"?{...e,retrying:!0}:e:ae,R=(e,r)=>r.ok?{kind:"ready",value:r.value,refreshing:!1,refreshFailure:null}:e.kind==="failed"&&e.status===403?e.retrying?{...e,retrying:!1}:e:e.kind==="ready"&&r.status!==403?{kind:"ready",value:e.value,refreshing:!1,refreshFailure:{status:r.status,reason:r.reason}}:{kind:"failed",status:r.status,reason:r.reason,occurrence:e.kind==="failed"?e.occurrence+1:1,retrying:!1};var m=e=>e===""?"":` (${e})`,A=e=>(r,n,t)=>r.status===403?e(n,r.reason):t(r.reason),v=(e,r)=>r===""?e:`${e} Reason: ${r}.`,D=(e,r)=>r===""?e:`${e}${r}\u3002`,p={en:{unmeasured:"Not measured",loading:"Loading",loadFailed:e=>`Could not load${m(e)}.`,refreshFailed:e=>`Could not refresh${m(e)}.`,forbiddenBecause:v,failureSentence:A(v),loadMore:e=>`Show ${e} more`,endOfRecords:"No more records",close:"Close",cancel:"Cancel",reload:"Reload",breadcrumb:"Breadcrumb",stepDone:"Done",stepPending:"Not started"},ja:{unmeasured:"\u672A\u6E2C\u5B9A",loading:"\u8AAD\u307F\u8FBC\u307F\u4E2D",loadFailed:e=>`\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F${m(e)}\u3002`,refreshFailed:e=>`\u66F4\u65B0\u306B\u5931\u6557\u3057\u307E\u3057\u305F${m(e)}\u3002`,forbiddenBecause:D,failureSentence:A(D),loadMore:e=>`\u3055\u3089\u306B ${e} \u4EF6\u3092\u8868\u793A`,endOfRecords:"\u3053\u308C\u4EE5\u4E0A\u306E\u8A18\u9332\u306F\u3042\u308A\u307E\u305B\u3093",close:"\u9589\u3058\u308B",cancel:"\u3084\u3081\u308B",reload:"\u518D\u8AAD\u307F\u8FBC\u307F",breadcrumb:"\u30D1\u30F3\u304F\u305A",stepDone:"\u5B8C\u4E86",stepPending:"\u672A\u7740\u624B"}},ie=e=>{if(!Object.hasOwn(p,e))throw new RangeError(`No console UI labels for locale "${e}"; supported: ${Object.keys(p).join(", ")}`);return p[e]};var se=e=>{if(!(Number.isFinite(e)&&e>=0))throw new RangeError(`Length must be a finite px value >= 0: ${e}`);return e},u=e=>`${se(e)/16}rem`;var U=(1+Math.sqrt(5))/2,W=({masterMinPx:e,detailMinPx:r,gapPx:n})=>{for(let t of[e,r])if(!(Number.isFinite(t)&&t>0))throw new RangeError(`Pane minimum must be a positive px value: ${t}`);if(!(Number.isFinite(n)&&n>=0))throw new RangeError(`Gap must be a px value >= 0: ${n}`);return e+n+r},le=(e,r)=>{let n=W(r);if(!(Number.isFinite(e)&&e>=0))throw new RangeError(`Container width must be a px value >= 0: ${e}`);if(e<n)return{sideBySide:!1,sideBySideFromPx:n,masterInlinePx:e,detailInlinePx:e};let t=(e-r.gapPx)/(1+U),o=Math.min(Math.max(r.masterMinPx,t),e-r.gapPx-r.detailMinPx);return{sideBySide:!0,sideBySideFromPx:n,masterInlinePx:o,detailInlinePx:e-r.gapPx-o}},Ge=e=>{let r=W(e),n=`cui-master-detail-m${e.masterMinPx}-d${e.detailMinPx}-g${e.gapPx}`,t=`[data-cui-master-detail="${n}"]`,o=u(e.gapPx),s=`${t}{grid-template-columns:minmax(0,1fr);gap:${o}}`,l=`clamp(${u(e.masterMinPx)},calc((100% - ${o}) / ${1+U}),calc(100% - ${o} - ${u(e.detailMinPx)}))`,a=`@container (min-width:${u(r)}){${t}{grid-template-columns:${l} minmax(0,1fr)}}`;return{key:n,css:s+a}};var z=e=>{if(!(Number.isFinite(e)&&e>0))throw new RangeError(`Column width must be a positive px value: ${e}`);return e},de=e=>{if(e.length===0)throw new RangeError("A table needs at least one column");let r=0,n=null;for(let{width:t}of e){if(t.fixedPx!==void 0){r+=z(t.fixedPx);continue}let o=z(t.minPx);if(n!==null&&n!==o)throw new RangeError(`Flexible columns share the remaining width equally, so their minimums must be equal: ${n} and ${o}`);n=o,r+=o}return r};var ue=e=>e>=32&&e<=126||e>=65377&&e<=65500||e>=65512&&e<=65518,H=(e,r)=>{let n=0,t=0;for(let o of e)ue(o.codePointAt(0))?t+=1:n+=1;return n*1+t*r},ce=e=>H(e,.55),me=e=>H(e,.6),ge=e=>{if(!(Number.isFinite(e)&&e>=0))throw new RangeError(`Length must be a finite px value >= 0: ${e}`);return Math.max(0,Math.ceil((e-1e-9)/8))*8};var ye=(e,r,n)=>{if(!(Number.isSafeInteger(e)&&e>0))throw new RangeError(`Tile count must be a positive integer: ${e}`);if(!(Number.isFinite(r)&&r>0))throw new RangeError(`Tile minimum width must be a positive px value: ${r}`);if(!(Number.isFinite(n)&&n>=0))throw new RangeError(`Tile gap must be a px value >= 0: ${n}`);let t=[];for(let a=1;a<=e;a+=1)e%a===0&&t.push({columns:a,minContainerPx:a*r+(a-1)*n});let o=`cui-tiles-n${e}-m${r}-g${n}`,s=`[data-cui-tile-grid="${o}"]`,l=t.map(({columns:a,minContainerPx:y})=>{let c=`${s}{grid-template-columns:repeat(${a},minmax(0,1fr))}`;return a===1?c:`@container (min-width:${u(y)}){${c}}`});return{key:o,steps:t,css:l.join("")}};var fe=(e,r)=>{let n=x(e,r);return n.kind==="ready"?{...n,value:{...n.value,loadingMore:!1}}:n},pe=(e,r)=>R(e,r.ok?{ok:!0,value:{rows:r.value.rows,next:r.value.next,meta:r.value.meta,loadingMore:!1,moreFailure:null}}:r),Te=e=>e.kind==="ready"&&!e.refreshing&&e.value.next!==null&&!e.value.loadingMore?{...e,value:{...e.value,loadingMore:!0}}:e,be=(e,r,n)=>{if(!(e.kind==="ready"&&e.value.loadingMore&&Object.is(e.value.next,r)))return e;if(n.ok)return{...e,value:{...e.value,rows:[...e.value.rows,...n.value.rows],next:n.value.next,loadingMore:!1,moreFailure:null}};let t=e.value.moreFailure===null?1:e.value.moreFailure.occurrence+1;return{...e,value:{...e.value,loadingMore:!1,moreFailure:{reason:n.reason,occurrence:t}}}},he=(e,r)=>{if(e.kind!=="ready")return e;let{rows:n,meta:t}=r({rows:e.value.rows,meta:e.value.meta});return{...e,value:{...e.value,rows:n,meta:t}}};var ke=4,xe=[1,2,3,4,6,8,12,16,24],Re=16,Ce=5/4,S={caption:-2,body:-1,title:0,heading:1,display:2,"display-lg":3},Se=11,B=3/2,Oe=7/4,Ee=7/4,Pe=120,we=3/2,Me=[1,2,3],G=e=>{if(!(Number.isFinite(e)&&e>=0))throw new RangeError(`A length must be a finite number of px at or above 0: ${e}`);return Math.ceil(e/4)*4},O=e=>{if(!Number.isInteger(e))throw new RangeError(`A type step must be an integer: ${e}`);return Math.max(Se,Math.round(Re*Ce**e))},E=(e,r)=>G(e*r),g=E(O(S.body),B)+24,X=g+8,C={weight:{regular:400,medium:500,bold:700},radius:{"radius-control":4,"radius-item":8,"radius-container":12,"radius-pill":9999},stroke:{"border-width":1,"focus-width":2,"focus-offset":2,"marker-width":2}},_e=()=>Object.fromEntries(xe.map(e=>[`space-${e}`,e*4])),Ne=()=>{let e=Object.fromEntries(Object.entries(S).map(([n,t])=>{let o=O(t);return[n,{size:o,lineHeight:E(o,n==="title"?Ee:B)}]})),r=O(S.body);return{...e,prose:{size:r,lineHeight:E(r,Oe)}}},$e=()=>Object.fromEntries(Me.map(e=>[`motion-${e}`,Pe*we**(e-1)])),j=e=>Object.freeze({space:Object.freeze(_e()),type:Object.freeze(Ne()),weight:C.weight,radius:C.radius,size:Object.freeze({"size-target":g,"size-control":g,"size-row":g,"size-row-control":X}),stroke:C.stroke,motion:Object.freeze($e()),color:Object.freeze({...e})});var Ie={fg:{light:"#0f172b",dark:"#f8fafc"},"fg-secondary":{light:"#314158",dark:"#e2e8f0"},"fg-muted":{light:"#44536a",dark:"#cad5e2"},"danger-fg":{light:"#9f0712",dark:"#ffc9c9"},"warning-fg":{light:"#7b3306",dark:"#fee685"},"success-fg":{light:"#006045",dark:"#a4f4cf"},"info-fg":{light:"#193cb8",dark:"#bedbff"},"on-solid":{light:"#ffffff",dark:"#0f172b"},surface:{light:"#ffffff",dark:"#0f172b"},subtle:{light:"#f8fafc",dark:"#1d293d"},sunken:{light:"#f1f5f9",dark:"#020618"},"danger-tint":{light:"#fef2f2",dark:"#460809"},"warning-tint":{light:"#fffbeb",dark:"#461901"},"success-tint":{light:"#ecfdf5",dark:"#002c22"},"info-tint":{light:"#eff6ff",dark:"#162456"},"neutral-solid":{light:"#314158",dark:"#cad5e2"},"danger-solid":{light:"#9f0712",dark:"#ffa2a2"},"success-solid":{light:"#006045",dark:"#5ee9b5"},"info-solid":{light:"#193cb8",dark:"#8ec5ff"},"warning-solid":{light:"#7b3306",dark:"#ffd230"},"danger-accent":{light:"#e7000b",dark:"#ff6467"},"warning-accent":{light:"#bb4d00",dark:"#fcbb00"},"success-accent":{light:"#009966",dark:"#00d492"},"info-accent":{light:"#155dfc",dark:"#51a2ff"},focus:{light:"#155dfc",dark:"#51a2ff"},"border-control":{light:"#62748e",dark:"#90a1b9"},"border-subtle":{light:"#e2e8f0",dark:"#314158"}},Fe=j(Ie),Le="--cui-",Ae=e=>`var(${Le}${e})`;export{Y as a,i as b,Q as c,ee as d,ne as e,L as f,te as g,oe as h,Ue as i,ae as j,x as k,R as l,m,p as n,ie as o,u as p,le as q,Ge as r,de as s,ce as t,me as u,ge as v,ye as w,fe as x,pe as y,Te as z,be as A,he as B,ke as C,G as D,g as E,X as F,Fe as G,Ae as H};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var u=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i;var i=n=>{let e=u.exec(n);if(e===null)throw new RangeError(`Colour must be #rrggbb: ${n}`);let[,s,r,t]=e;return[Number.parseInt(s,16)/255,Number.parseInt(r,16)/255,Number.parseInt(t,16)/255]},o=n=>n<=.04045?n/12.92:((n+.055)/1.055)**2.4,c=n=>{for(let t of n)if(!(t>=0&&t<=1))throw new RangeError(`sRGB channels must be numbers in [0, 1]: ${n.join(", ")}`);let[e,s,r]=n;return .2126*o(e)+.7152*o(s)+.0722*o(r)},f= exports.b =(n,e)=>{let[s,r]=[c(n),c(e)].sort((t,a)=>a-t);return(s+.05)/(r+.05)},g= exports.c ={text:7,largeText:4.5,nonText:3},l= exports.d ={light:{fg:{surface:17.83,subtle:17.04,sunken:16.28,"danger-tint":16.3,"warning-tint":17.19,"success-tint":16.93,"info-tint":16.38},"fg-secondary":{surface:10.36,subtle:9.9,sunken:9.45},"fg-muted":{surface:7.8,subtle:7.46,sunken:7.12,"danger-tint":7.13,"warning-tint":7.52,"info-tint":7.17},"danger-fg":{surface:8.36,subtle:7.99,"danger-tint":7.64},"warning-fg":{surface:9.06,subtle:8.66,"warning-tint":8.73},"success-fg":{surface:7.61,subtle:7.27,"success-tint":7.23},"info-fg":{surface:8.82,"info-tint":8.11,subtle:8.43},"on-solid":{"neutral-solid":10.36,"danger-solid":8.36,"success-solid":7.61,"info-solid":8.82,"warning-solid":9.06},"danger-accent":{surface:4.77,"danger-tint":4.36},"warning-accent":{surface:5.03,"warning-tint":4.85},"success-accent":{surface:3.65,"success-tint":3.47},"info-accent":{surface:5.25,subtle:5.01,sunken:4.79,"info-tint":4.82},focus:{surface:5.25,subtle:5.01,sunken:4.79,"info-tint":4.82},"border-control":{surface:4.76,subtle:4.55,sunken:4.35}},dark:{fg:{surface:17.04,subtle:13.97,sunken:19.27,"danger-tint":15.45,"warning-tint":14.34,"success-tint":14.51,"info-tint":14.13},"fg-secondary":{surface:14.46,subtle:11.86,sunken:16.35},"fg-muted":{surface:12,subtle:9.83,sunken:13.56,"danger-tint":10.87,"warning-tint":10.09,"info-tint":9.94},"danger-fg":{surface:12.27,subtle:10.06,"danger-tint":11.12},"warning-fg":{surface:14.33,subtle:11.74,"warning-tint":12.05},"success-fg":{surface:13.94,subtle:11.43,"success-tint":11.87},"info-fg":{surface:12.54,"info-tint":10.39,subtle:10.28},"on-solid":{"neutral-solid":12,"danger-solid":9.29,"success-solid":11.72,"info-solid":9.83,"warning-solid":12.32},"danger-accent":{surface:6.17,"danger-tint":5.6},"warning-accent":{surface:10.4,"warning-tint":8.75},"success-accent":{surface:9.2,"success-tint":7.83},"info-accent":{surface:6.76,subtle:5.54,sunken:7.64,"info-tint":5.6},focus:{surface:6.76,subtle:5.54,sunken:7.64,"info-tint":5.6},"border-control":{surface:6.78,subtle:5.56,sunken:7.66}}};exports.a = i; exports.b = f; exports.c = g; exports.d = l;
package/dist/core.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkHFWVEGN3cjs = require('./chunk-HFWVEGN3.cjs');var _chunkBEDKWWJCcjs = require('./chunk-BEDKWWJC.cjs');exports.CONSOLE_UI_LABEL_CATALOGS = _chunkHFWVEGN3cjs.n; exports.CONTRAST_MINIMUM = _chunkBEDKWWJCcjs.c; exports.CONTRAST_PAIRS = _chunkBEDKWWJCcjs.d; exports.HTTP_FORBIDDEN = _chunkHFWVEGN3cjs.f; exports.TOKENS = _chunkHFWVEGN3cjs.C; exports.ZonedTimeError = _chunkHFWVEGN3cjs.b; exports.beginPage = _chunkHFWVEGN3cjs.z; exports.beginPagedReload = _chunkHFWVEGN3cjs.x; exports.beginReload = _chunkHFWVEGN3cjs.k; exports.ceil8 = _chunkHFWVEGN3cjs.v; exports.contrastRatio = _chunkBEDKWWJCcjs.b; exports.cssVar = _chunkHFWVEGN3cjs.D; exports.flatMapOutcome = _chunkHFWVEGN3cjs.h; exports.formatCount = _chunkHFWVEGN3cjs.a; exports.formatInstant = _chunkHFWVEGN3cjs.e; exports.hexToSrgb = _chunkBEDKWWJCcjs.a; exports.keepLastGood = _chunkHFWVEGN3cjs.l; exports.mapOutcome = _chunkHFWVEGN3cjs.g; exports.mapPagedList = _chunkHFWVEGN3cjs.B; exports.masterDetailPlan = _chunkHFWVEGN3cjs.q; exports.monoTextWidthEm = _chunkHFWVEGN3cjs.u; exports.reasonAside = _chunkHFWVEGN3cjs.m; exports.resolveConsoleUiLabels = _chunkHFWVEGN3cjs.o; exports.settleFirstPage = _chunkHFWVEGN3cjs.y; exports.settlePage = _chunkHFWVEGN3cjs.A; exports.tableMinInlinePx = _chunkHFWVEGN3cjs.s; exports.textWidthEm = _chunkHFWVEGN3cjs.t; exports.tileGridPlan = _chunkHFWVEGN3cjs.w; exports.toOffsetIso = _chunkHFWVEGN3cjs.c; exports.toWallTime = _chunkHFWVEGN3cjs.d;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkA4D4K2WFcjs = require('./chunk-A4D4K2WF.cjs');var _chunkIR2WTSOWcjs = require('./chunk-IR2WTSOW.cjs');exports.CONSOLE_UI_LABEL_CATALOGS = _chunkA4D4K2WFcjs.n; exports.CONTRAST_MINIMUM = _chunkIR2WTSOWcjs.c; exports.CONTRAST_PAIRS = _chunkIR2WTSOWcjs.d; exports.HTTP_FORBIDDEN = _chunkA4D4K2WFcjs.f; exports.LATTICE_PX = _chunkA4D4K2WFcjs.C; exports.ROW_WITH_CONTROL_PX = _chunkA4D4K2WFcjs.F; exports.TARGET_PX = _chunkA4D4K2WFcjs.E; exports.TOKENS = _chunkA4D4K2WFcjs.G; exports.ZonedTimeError = _chunkA4D4K2WFcjs.b; exports.beginPage = _chunkA4D4K2WFcjs.z; exports.beginPagedReload = _chunkA4D4K2WFcjs.x; exports.beginReload = _chunkA4D4K2WFcjs.k; exports.ceil8 = _chunkA4D4K2WFcjs.v; exports.ceilToLattice = _chunkA4D4K2WFcjs.D; exports.contrastRatio = _chunkIR2WTSOWcjs.b; exports.cssVar = _chunkA4D4K2WFcjs.H; exports.flatMapOutcome = _chunkA4D4K2WFcjs.h; exports.formatCount = _chunkA4D4K2WFcjs.a; exports.formatInstant = _chunkA4D4K2WFcjs.e; exports.hexToSrgb = _chunkIR2WTSOWcjs.a; exports.keepLastGood = _chunkA4D4K2WFcjs.l; exports.mapOutcome = _chunkA4D4K2WFcjs.g; exports.mapPagedList = _chunkA4D4K2WFcjs.B; exports.masterDetailPlan = _chunkA4D4K2WFcjs.q; exports.monoTextWidthEm = _chunkA4D4K2WFcjs.u; exports.reasonAside = _chunkA4D4K2WFcjs.m; exports.resolveConsoleUiLabels = _chunkA4D4K2WFcjs.o; exports.settleFirstPage = _chunkA4D4K2WFcjs.y; exports.settlePage = _chunkA4D4K2WFcjs.A; exports.tableMinInlinePx = _chunkA4D4K2WFcjs.s; exports.textWidthEm = _chunkA4D4K2WFcjs.t; exports.tileGridPlan = _chunkA4D4K2WFcjs.w; exports.toOffsetIso = _chunkA4D4K2WFcjs.c; exports.toWallTime = _chunkA4D4K2WFcjs.d;