@apliteni/apliteni-ui 0.149.0 → 0.154.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.
@@ -184,6 +184,12 @@ export const iconOnlyAllowed = {
184
184
  // and one button opens the full navigation in a drawer. The three-bar glyph is the
185
185
  // reader's own mark for this action.
186
186
  menu: 'open the navigation drawer',
187
+ // A document viewer's page and zoom steps, chosen by Artur on #736: a slim row of
188
+ // steppers either side of the readout they move, so the readout names the action.
189
+ chevronLeft: 'step to the previous page',
190
+ chevronRight: 'step to the next page',
191
+ minus: 'zoom out',
192
+ plus: 'zoom in',
187
193
  // A chart card's view switch, decided by Artur on #742: the bars and the grid
188
194
  // are the two views themselves, side by side in one toolbar at the card's corner.
189
195
  chart: 'show the values as a chart',
@@ -209,6 +215,10 @@ export const iconOnlyNames = {
209
215
  // something else.
210
216
  download: ['export', 'download'],
211
217
  menu: ['menu'],
218
+ chevronLeft: ['previous'],
219
+ chevronRight: ['next'],
220
+ minus: ['zoom'],
221
+ plus: ['zoom'],
212
222
  chart: ['chart'],
213
223
  table: ['table'],
214
224
  };
@@ -216,6 +216,19 @@ function ddScrollBox(dd, panel) {
216
216
  return { el: el || els[0], els, top, bottom, height };
217
217
  }
218
218
 
219
+ /* Does a body round the panel hide part of its width? Only `hidden` and `clip` count:
220
+ * a body that scrolls across still shows the rest. */
221
+ function ddClipsAcross(box, panel) {
222
+ const view = ddViewOf(panel);
223
+ const p = panel.getBoundingClientRect();
224
+ return box.els.some((at) => {
225
+ const overflow = view.getComputedStyle(at).overflowX;
226
+ if (overflow !== 'hidden' && overflow !== 'clip') return false;
227
+ const left = at.getBoundingClientRect().left + at.clientLeft;
228
+ return p.left < left - 0.5 || p.right > left + at.clientWidth + 0.5;
229
+ });
230
+ }
231
+
219
232
  /* The top of what has to stay in view over the panel: the field's label when the
220
233
  * trigger has one above it, so the reader still sees what the list is for. */
221
234
  function ddAnchorTop(dd, t) {
@@ -240,12 +253,15 @@ function ddContentHeight(panel) {
240
253
  * the 8px edge where the body cannot. Where even then the body cannot hold the floor
241
254
  * (or the whole list, when that is shorter), the panel is lifted out of the body.
242
255
  * Measured from the heights alone, so the answer is the same however far the body is
243
- * scrolled. `null` with no scrolling body.
256
+ * scrolled. A body that clips across and is narrower than the panel lifts it too: no
257
+ * scroll shows what it cuts off, as the shell's rail cut the account menu (#736).
258
+ * `null` with no scrolling body.
244
259
  */
245
260
  function ddBodyFit(dd, panel) {
246
261
  const trigger = dd.querySelector('[data-dropdown-trigger]');
247
262
  const box = ddScrollBox(dd, panel);
248
263
  if (!box || !trigger) return null;
264
+ if (ddClipsAcross(box, panel)) return { box, lift: true };
249
265
  const t = trigger.getBoundingClientRect();
250
266
  const edge = ddEdge(panel);
251
267
  const gap = ddGap(panel);
@@ -1,8 +1,8 @@
1
1
  /* ============================================================================
2
2
  * Back link — .ui-back
3
3
  * The way up from a page to the page it sits under. It stands above the page
4
- * title, in the slot a breadcrumb trail would take, and it is quiet at rest: it
5
- * is on every page below a list, and it is never what the page is for.
4
+ * title, and it is quiet at rest: it is on every page below a list, and it
5
+ * is never what the page is for.
6
6
  * why: docs/components.md#the-back-link
7
7
  * ========================================================================== */
8
8
 
@@ -1,6 +1,7 @@
1
1
  /* ============================================================================
2
2
  * Card — .ui-card (a filled surface one step off the page: edged in both themes)
3
3
  * Rows: .ui-card__row / headers: .ui-card__title / .ui-card__sub
4
+ * Title row: .ui-card__head holds the title and .ui-card__tools at its end
4
5
  * ========================================================================== */
5
6
 
6
7
  /* The surface is the step; the line makes it legible. Both themes edge the card with
@@ -61,6 +62,49 @@
61
62
  border-color: color-mix(in srgb, var(--green) 22%, transparent);
62
63
  }
63
64
 
65
+ /* A viewer: a document shown inside a card, set apart from the controls that act on it.
66
+ The card's .ui-toolbar becomes a slim row between two hairlines, and its scroll box
67
+ becomes a recessed stage that runs to the card's sides and bottom. The document
68
+ itself is a .ui-card__page on that stage: a sheet one level up, so it reads as the
69
+ object and the row above it as the tools. Decided on #736.
70
+ why: docs/foundations.md#elevation */
71
+ .ui-card__viewer {
72
+ margin: var(--space-4) calc(-1 * var(--space-6)) calc(-1 * var(--space-6));
73
+ border-top: 1px solid var(--card-edge);
74
+ }
75
+ .ui-card__viewer > .ui-toolbar {
76
+ /* One row on a phone too: the page steps hold the start and the zoom the end. */
77
+ flex-wrap: nowrap;
78
+ align-items: center;
79
+ padding: var(--space-2) var(--space-4);
80
+ border-bottom: 1px solid var(--card-edge);
81
+ }
82
+ .ui-card__viewer > .ui-table-scroll {
83
+ /* The stage is the lowest rung, so an inline code chip on it takes the card. */
84
+ --table-bg: var(--surface-2);
85
+ --table-code-bg: var(--surface);
86
+ max-height: none;
87
+ /* With the scroll box's own 4px band at the sides and bottom, an even 24px inset. */
88
+ padding: var(--space-6) var(--space-5) var(--space-5);
89
+ border-radius: 0 0 calc(var(--radius-xl) - 1px) calc(var(--radius-xl) - 1px);
90
+ }
91
+ /* A4 at the least, so a short document still reads as a page and not as a panel.
92
+ The page carries the light palette in both themes (src/tokens/tokens.css), so its
93
+ own ink is set here: the inherited colour is the theme's. */
94
+ .ui-card__page {
95
+ box-sizing: border-box;
96
+ aspect-ratio: 210 / 297;
97
+ padding: var(--space-6) var(--space-5);
98
+ color: var(--text);
99
+ background: var(--surface);
100
+ border: 1px solid var(--card-edge);
101
+ box-shadow: var(--elev-rest);
102
+ border-radius: var(--radius-xs);
103
+ /* A table on the page takes the page's ground, not the stage's, and hands a chip the page. */
104
+ --table-bg: var(--surface);
105
+ --table-code-bg: var(--bg);
106
+ }
107
+
64
108
  /* Interactive card (link / button semantics) */
65
109
  .ui-card--interactive {
66
110
  cursor: pointer;
@@ -93,6 +137,17 @@
93
137
  /* Title to description: the step, not the 5px it was. why: docs/foundations.md#spacing-and-rhythm */
94
138
  margin: 0 0 var(--space-2);
95
139
  }
140
+ /* The title row: the title, then the card's tools centred on its line, in the
141
+ title's step. why: docs/components.md#content-and-status */
142
+ .ui-card__head {
143
+ display: flex;
144
+ align-items: center;
145
+ gap: var(--space-2);
146
+ margin: 0 0 var(--space-2);
147
+ }
148
+ .ui-card__head > .ui-card__title { flex: 1 1 auto; min-width: 0; margin: 0; }
149
+ .ui-card__tools { display: flex; flex: none; align-items: center; gap: var(--space-1); margin-inline-start: auto; }
150
+ .ui-card__tools:empty { display: none; }
96
151
  /* The title of a card that supports its neighbour, such as a document beside the
97
152
  data read from it. The size, weight and rank stay the card title's.
98
153
  why: docs/foundations.md#text-ink */
@@ -248,10 +248,16 @@
248
248
  .ui-chart__dot { fill: var(--ui-chart-tone); stroke: var(--ui-chart-ground); stroke-width: 2; }
249
249
  .ui-chart--line-thin .ui-chart__line { stroke-width: 1.5; }
250
250
  .ui-chart--line-points .ui-chart__line { stroke-width: 2.5; }
251
+ /* The curves look's point is a ring of its tone around the ground. */
252
+ .ui-chart--area-curves .ui-chart__dot { fill: var(--ui-chart-ground); stroke: var(--ui-chart-tone); }
251
253
  /* An area is the fade of its tone. Where its values vary, the component names a
252
254
  ramp as --ui-chart-paint: the fade at the lowest value, the tone at the highest.
253
255
  The edge line on top of it holds the value. */
254
256
  .ui-chart__area { fill: var(--ui-chart-paint, var(--ui-chart-fade)); stroke: none; }
257
+ /* A curves area washes its tone from its highest value to clear at zero. The
258
+ series overlap, so the wash is thin enough to show the ones under it. */
259
+ .ui-chart__wash-top { stop-color: var(--ui-chart-tone); stop-opacity: 0.32; }
260
+ .ui-chart__wash-floor { stop-color: var(--ui-chart-tone); stop-opacity: 0; }
255
261
  /* A stacked part, a share band and a ring slice. The ground between two parts
256
262
  keeps them apart where two tones of one hue meet. */
257
263
  .ui-chart__segment {
@@ -331,11 +331,13 @@
331
331
  /* Hover is a fill and an outline means focus, so a hovered row draws no edge. A row that is
332
332
  hovered AND focused draws the ring over the fill.
333
333
  why: docs/foundations.md#elevation */
334
+ .ui-dropdown__item[aria-expanded="true"],
334
335
  .ui-dropdown__item:hover { background: var(--surface); /* code-bg: inherit — control paint; the containing surface is the ground, for a chip and for a band alike. */ }
335
336
  /* Light only: the panel is --bg-elevated, which --surface matches exactly there, so the
336
337
  hover fill above changed nothing. --surface-3 is the quiet fill the drawer's close mark
337
338
  takes on hover, one step under the --surface-2 that .is-active takes below.
338
339
  why: docs/foundations.md#elevation */
340
+ :where(:root[data-theme="light"]) .ui-dropdown__item[aria-expanded="true"],
339
341
  :where(:root[data-theme="light"]) .ui-dropdown__item:hover { background: var(--surface-3); /* code-bg: inherit — control paint; the containing surface is the ground, for a chip and for a band alike. */ }
340
342
  @media (forced-colors: active) {
341
343
  .ui-dropdown__item:hover { border: 1px solid Highlight; padding: 8px 11px; }
@@ -356,6 +358,18 @@
356
358
  .ui-dropdown__item.is-selected .ui-dropdown__tick { display: inline-flex; } /* motion: still — a mark inside a row whose highlight already transitions; picking it closes the panel, which fades out over --dur-med */
357
359
  .ui-dropdown__item.is-selected .ui-dropdown__label { color: var(--text); }
358
360
 
361
+ /* A row that opens a submenu (#736): the current value at the trailing edge in body ink,
362
+ then a chevron. The submenu is a second panel beside this one, or, in a panel marked
363
+ is-sub, the only rows showing.
364
+ why: docs/components.md#a-submenu-row */
365
+ .ui-dropdown__aside { margin-left: auto; flex: none; font-size: var(--text-xs); color: var(--text); }
366
+ .ui-dropdown__more { margin-left: auto; display: inline-flex; flex: none; /* muted-ink: glyph — submenu chevron */ color: var(--muted); }
367
+ .ui-dropdown__aside + .ui-dropdown__more { margin-left: 0; }
368
+ .ui-dropdown__more svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.25; }
369
+ .ui-dropdown__panel.is-sub > :not(.ui-dropdown__sub) { display: none; } /* The rows swap in one step, inside a panel that is already open. */
370
+ /* Three short choices: the width of a choice and its tick, not the 240px a menu of labels needs. */
371
+ .ui-dropdown__panel--sub { min-width: 180px; }
372
+
359
373
  /* When a row has both a badge and a tick, keep the badge from eating the margin */
360
374
  .ui-dropdown__badge + .ui-dropdown__tick { margin-left: 8px; }
361
375
 
@@ -401,9 +401,6 @@
401
401
  why: docs/components.md#the-page-shell */
402
402
  .ui-app__bar .toggle, .topbar__in .toggle { flex: none; }
403
403
  .ui-app__user--bar .ui-app__av { margin-inline-start: 0; }
404
- /* Crumb, then the title block. At --space-2 the crumb sat 8px off the h1 and
405
- the h1 8px off its subtitle, so all three ranks read as one. */
406
- .ui-app__main .ui-nav--crumbs { margin-bottom: var(--space-5); }
407
404
  .ui-app__main h1 {
408
405
  color: var(--strong);
409
406
  /* rank: page-title */
@@ -416,6 +413,13 @@
416
413
  .ui-app__sub { color: var(--text); font-size: calc(var(--text-base) + 0.5px); line-height: 1.6; max-width: var(--prose-body); margin-bottom: var(--space-8); }
417
414
  /* A page may open on its title alone; then the title carries the head's step. */
418
415
  .ui-app__main > h1:not(:has(+ .ui-app__sub)) { margin-bottom: var(--space-8); }
416
+ /* Page tools stand at the end of the title row, and the lede goes under the whole row.
417
+ The row takes the h1's steps: 8px to a lede, 32px when the page opens on its title alone.
418
+ 16px keeps the tools off a long title, and the tools stand 12px apart. */
419
+ .ui-app__title-row { display: flex; align-items: center; gap: var(--space-4); margin-bottom: 8px; }
420
+ .ui-app__title-row:not(:has(+ .ui-app__sub)) { margin-bottom: var(--space-8); }
421
+ .ui-app__main .ui-app__title-row > h1 { flex: 1 1 auto; min-width: 0; margin-bottom: 0; }
422
+ .ui-app__tools { display: flex; flex: none; align-items: center; gap: var(--space-3); }
419
423
  .ui-app__body { display: flex; flex-direction: column; gap: var(--space-5); }
420
424
  /* A flex child's min-width is its content by default, so one wide block — a
421
425
  ledger, a code sample — pushes the whole page sideways instead of scrolling
@@ -1,5 +1,5 @@
1
1
  /* ============================================================================
2
- * Navigation — sidebar rail, horizontal tabs, breadcrumbs. One token-driven
2
+ * Navigation — sidebar rail and horizontal tabs. One token-driven
3
3
  * class family (ui-nav__…) so every variant re-themes across accents +
4
4
  * light/dark. appShell() draws its rail from sidebarNav(), so this file is the
5
5
  * page shell's rail as well as a standalone component. States are pure tokens.
@@ -394,39 +394,6 @@
394
394
  .ui-nav__tab.is-disabled { /* muted-ink: state — unavailable control */ color: var(--disabled-ink); cursor: default; }
395
395
  .ui-nav__tab .ui-nav__badge { height: 18px; }
396
396
 
397
- /* -- Breadcrumbs --------------------------------------------------------- */
398
- /* The chip hangs out by its own padding so the first LABEL lands on the column's edge,
399
- level with the page title under it. */
400
- .ui-nav__crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-inline-start: -6px; }
401
- .ui-nav__crumb-item { display: inline-flex; align-items: center; }
402
- .ui-nav__crumb-item + .ui-nav__crumb-item::before {
403
- content: "";
404
- width: 6px; height: 6px;
405
- margin: 0 8px;
406
- border-right: 1.4px solid var(--muted);
407
- border-bottom: 1.4px solid var(--muted);
408
- transform: rotate(-45deg);
409
- opacity: 0.7;
410
- }
411
- .ui-nav__crumb {
412
- display: inline-flex;
413
- align-items: center;
414
- gap: 6px;
415
- padding: 3px 6px;
416
- border-radius: 7px;
417
- text-decoration: none;
418
- font-size: var(--text-sm);
419
- transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
420
- }
421
- /* Carries the block's class as well as its own, for the reason .ui-nav__item
422
- does above: a linked crumb is an <a>, and a host stylesheet's `a:link` is
423
- (0,1,1), which outranks a bare (0,1,0) class. */
424
- .ui-nav .ui-nav__crumb { color: var(--text); }
425
- a.ui-nav__crumb:hover { color: var(--strong); background: var(--surface); /* code-bg: inherit — control paint; the containing surface is the ground, for a chip and for a band alike. */ }
426
- a.ui-nav__crumb:focus-visible { outline: var(--ring); outline-offset: var(--ring-offset); }
427
- .ui-nav__crumb.is-current { color: var(--strong); font-weight: 500; }
428
- .ui-nav__crumb .ui-nav__ic svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2.5; }
429
-
430
397
  /* Forced colours replace every author background, so a selected item takes the system
431
398
  pair as its fill. `forced-color-adjust: none` is what keeps the pair from sitting on
432
399
  Chromium's Canvas backplate, which would leave the label unreadable. Focus keeps its
@@ -438,8 +405,7 @@ a.ui-nav__crumb:focus-visible { outline: var(--ring); outline-offset: var(--ring
438
405
  .ui-nav__item.is-active:not(.is-disabled),
439
406
  .ui-nav__item.is-current:not(.is-disabled),
440
407
  .ui-nav__tab.is-active:not(.is-disabled),
441
- .ui-nav--tabs.is-pill .ui-nav__tab.is-active:not(.is-disabled),
442
- .ui-nav__crumb.is-current {
408
+ .ui-nav--tabs.is-pill .ui-nav__tab.is-active:not(.is-disabled) {
443
409
  forced-color-adjust: none;
444
410
  background: Highlight !important;
445
411
  color: HighlightText !important;
@@ -447,8 +413,7 @@ a.ui-nav__crumb:focus-visible { outline: var(--ring); outline-offset: var(--ring
447
413
  }
448
414
  .ui-nav__item.is-active:not(.is-disabled) .ui-nav__ic svg,
449
415
  .ui-nav__item.is-current:not(.is-disabled) .ui-nav__ic svg,
450
- .ui-nav__tab.is-active:not(.is-disabled) .ui-nav__ic svg,
451
- .ui-nav__crumb.is-current .ui-nav__ic svg { stroke: HighlightText; }
416
+ .ui-nav__tab.is-active:not(.is-disabled) .ui-nav__ic svg { stroke: HighlightText; }
452
417
  .ui-nav__item.is-active .ui-nav__caret,
453
418
  .ui-nav__item.is-current .ui-nav__caret { border-color: currentColor; }
454
419
  .ui-nav__item.is-active:not(.is-disabled) .ui-nav__badge,
@@ -169,6 +169,14 @@
169
169
  }
170
170
  .ui-table__act { --tap-clear-x: var(--tap-gap); --tap-clear-y: 0px; }
171
171
 
172
+ /* A card's title row holds small tools at its end, such as a 24px icon-only
173
+ button: across, the room beside it is title text, and down, the row opens
174
+ to 12px, because the layer reaches 10px under it and the title gap is 8.
175
+ Between two tools the gap opens to --tap-gap, so neither layer reaches the
176
+ other. A chart's switch there keeps the clearance .ui-seg declares. */
177
+ .ui-card__head { margin-bottom: var(--space-3, 12px) !important; }
178
+ .ui-card__tools { column-gap: var(--tap-gap) !important; --tap-clear-x: var(--tap-gap); --tap-clear-y: var(--tap-gap); }
179
+
172
180
  /* The selection box is 19px in a 58px row and a 34px header: the layer has room to reach the floor both ways. */
173
181
  .ui-table__selection { --tap-clear-x: var(--tap-min); --tap-clear-y: var(--tap-min); }
174
182
  /* A dense or compact table's rows are 33px to 40px apart and share an edge, so a layer that grows down takes the pixels nearest the next row's box. Those rows keep the 24px floor. */
@@ -358,7 +358,11 @@
358
358
 
359
359
  /* ============================================================================
360
360
  * LIGHT THEME — deck light palette from viz/account.mjs
361
+ *
362
+ * A document sheet (.ui-card__page) takes this palette in both themes: the document
363
+ * is paper, so it stays white with dark ink on a dark stage too. Decided on #736.
361
364
  * ========================================================================== */
365
+ .ui-card__page,
362
366
  :root[data-theme="light"] {
363
367
  color-scheme: light;
364
368
 
@@ -537,6 +541,13 @@
537
541
  --grad-from: var(--purple-light);
538
542
  --grad-to: var(--cyan);
539
543
  }
544
+ /* The ring is declared once, in the dark block, and computed at :root. The sheet takes the
545
+ light accent above, so it computes its ring again or a focus on the paper keeps the dark one. */
546
+ .ui-card__page {
547
+ --ring-color: var(--accent);
548
+ --ring: var(--ring-width) solid var(--ring-color);
549
+ --ring-scroll: var(--ring);
550
+ }
540
551
 
541
552
  /* ============================================================================
542
553
  * WIDTHS BELOW THE PAGE — the box, and the line. Two scales, and one rule for
@@ -592,6 +603,7 @@
592
603
  .ui-card,
593
604
  .ui-card--accent,
594
605
  .ui-card--live,
606
+ .ui-card__page,
595
607
  .ui-cmdk__panel,
596
608
  .ui-confirm__panel,
597
609
  .ui-drawer__footer,