@loidolt/theme-styles 0.10.0 → 0.11.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loidolt/theme-styles",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Base styles, fonts, accessibility helpers, and utilities for Loidolt applications",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -31,7 +31,7 @@
31
31
  "build": "node -e \"console.log('theme-styles: source CSS is publish-ready')\""
32
32
  },
33
33
  "dependencies": {
34
- "@loidolt/theme-tokens": "^0.10.0"
34
+ "@loidolt/theme-tokens": "^0.11.0"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public",
@@ -20,6 +20,7 @@
20
20
  .ldt-dialog__body,
21
21
  .ldt-drawer__body,
22
22
  .ldt-tabs__list,
23
+ .ldt-tab-bar,
23
24
  .ldt-toggle-group,
24
25
  .ldt-listbox,
25
26
  .ldt-media-grid,
@@ -140,13 +140,24 @@
140
140
  background-position: -200% 0;
141
141
  }
142
142
  }
143
+ /*
144
+ * Every inset adds the matching safe area (`--ldt-safe-*`; see AppShell), so a toast never lands
145
+ * under a notch or the home indicator. The logical start inset cannot know which physical side
146
+ * it ends up on, so it clears the larger of the two.
147
+ */
143
148
  .ldt-toast-viewport {
144
149
  position: fixed;
145
150
  z-index: var(--loidolt-z-toast);
146
- right: 1rem;
147
- bottom: 1rem;
151
+ right: calc(1rem + var(--ldt-safe-right, env(safe-area-inset-right, 0px)));
152
+ bottom: calc(1rem + var(--ldt-safe-bottom, env(safe-area-inset-bottom, 0px)));
148
153
  display: grid;
149
- width: min(24rem, calc(100vw - 2rem));
154
+ width: min(
155
+ 24rem,
156
+ calc(
157
+ 100vw - 2rem - var(--ldt-safe-left, env(safe-area-inset-left, 0px)) -
158
+ var(--ldt-safe-right, env(safe-area-inset-right, 0px))
159
+ )
160
+ );
150
161
  gap: var(--loidolt-space-2);
151
162
  }
152
163
  .ldt-toast {
@@ -199,7 +210,14 @@
199
210
  .ldt-toast-viewport--bottom-start {
200
211
  right: auto;
201
212
  left: 1rem;
202
- inset-inline: 1rem auto;
213
+ inset-inline: calc(
214
+ 1rem +
215
+ max(
216
+ var(--ldt-safe-left, env(safe-area-inset-left, 0px)),
217
+ var(--ldt-safe-right, env(safe-area-inset-right, 0px))
218
+ )
219
+ )
220
+ auto;
203
221
  }
204
222
  .ldt-toast-viewport--bottom-center,
205
223
  .ldt-toast-viewport--top-center {
@@ -210,12 +228,19 @@
210
228
  .ldt-toast-viewport--top-end,
211
229
  .ldt-toast-viewport--top-start,
212
230
  .ldt-toast-viewport--top-center {
213
- top: 1rem;
231
+ top: calc(1rem + var(--ldt-safe-top, env(safe-area-inset-top, 0px)));
214
232
  bottom: auto;
215
233
  }
216
234
  .ldt-toast-viewport--top-start {
217
235
  right: auto;
218
- inset-inline: 1rem auto;
236
+ inset-inline: calc(
237
+ 1rem +
238
+ max(
239
+ var(--ldt-safe-left, env(safe-area-inset-left, 0px)),
240
+ var(--ldt-safe-right, env(safe-area-inset-right, 0px))
241
+ )
242
+ )
243
+ auto;
219
244
  }
220
245
  /* A colored dot that reports state where a Badge would be too loud. */
221
246
  .ldt-status-dot {
@@ -21,15 +21,40 @@
21
21
  utility covers standalone workspaces without imposing a wrapper element in the component. */
22
22
  container: loidolt-workspace / inline-size;
23
23
  }
24
+ /*
25
+ * Safe areas. Under `viewport-fit=cover` a phone draws the page beneath its notch, rounded
26
+ * corners and home indicator; `env(safe-area-inset-*)` reports how far, and is 0 everywhere else,
27
+ * so none of this moves a desktop layout. Each edge reads `--ldt-safe-<edge>` first: set it to
28
+ * `0px` on an element that does not touch that screen edge, or to a length to fake an inset.
29
+ * The header row pads itself (Topbar), so the shell insets only the rows below it, and the
30
+ * bottom inset goes to whichever row is last — a TabBar takes it when there is one. Zero
31
+ * specificity, so an app's own padding on these rows still wins.
32
+ */
33
+ :where(.ldt-app-shell > :is(main, .ldt-app-shell__main, footer)) {
34
+ padding-right: var(--ldt-safe-right, env(safe-area-inset-right, 0px));
35
+ padding-left: var(--ldt-safe-left, env(safe-area-inset-left, 0px));
36
+ }
37
+ :where(.ldt-app-shell > :is(main, .ldt-app-shell__main, footer):last-child) {
38
+ padding-bottom: var(--ldt-safe-bottom, env(safe-area-inset-bottom, 0px));
39
+ }
40
+ /* A TabBar in AppShell's `tabBar` slot stays on screen while the page scrolls under it. */
41
+ :where(.ldt-app-shell > .ldt-tab-bar) {
42
+ position: sticky;
43
+ bottom: 0;
44
+ z-index: var(--loidolt-z-sticky);
45
+ }
24
46
  .ldt-topbar {
25
47
  min-width: 0;
26
- min-height: var(--loidolt-size-topbar);
48
+ /* The top inset is added to the height rather than taken out of it. */
49
+ min-height: calc(var(--loidolt-size-topbar) + var(--ldt-safe-top, env(safe-area-inset-top, 0px)));
27
50
  display: flex;
28
51
  /* Reflow at whatever width runs out of room, rather than only at the compact breakpoint. */
29
52
  flex-wrap: wrap;
30
53
  align-items: center;
31
54
  gap: var(--loidolt-space-5);
32
- padding: 0 var(--loidolt-pad-bar-x);
55
+ padding: var(--ldt-safe-top, env(safe-area-inset-top, 0px))
56
+ calc(var(--loidolt-pad-bar-x) + var(--ldt-safe-right, env(safe-area-inset-right, 0px))) 0
57
+ calc(var(--loidolt-pad-bar-x) + var(--ldt-safe-left, env(safe-area-inset-left, 0px)));
33
58
  color: var(--loidolt-text);
34
59
  background: var(--loidolt-surface);
35
60
  }
@@ -222,21 +247,83 @@
222
247
  .ldt-floating-bar--vertical {
223
248
  flex-direction: column;
224
249
  }
250
+ /* Each corner clears the safe area too, for a stage that fills the screen (a map, a canvas). */
225
251
  .ldt-floating-bar--top-start {
226
- top: var(--loidolt-space-3);
227
- left: var(--loidolt-space-3);
252
+ top: calc(var(--loidolt-space-3) + var(--ldt-safe-top, env(safe-area-inset-top, 0px)));
253
+ left: calc(var(--loidolt-space-3) + var(--ldt-safe-left, env(safe-area-inset-left, 0px)));
228
254
  }
229
255
  .ldt-floating-bar--top-end {
230
- top: var(--loidolt-space-3);
231
- right: var(--loidolt-space-3);
256
+ top: calc(var(--loidolt-space-3) + var(--ldt-safe-top, env(safe-area-inset-top, 0px)));
257
+ right: calc(var(--loidolt-space-3) + var(--ldt-safe-right, env(safe-area-inset-right, 0px)));
232
258
  }
233
259
  .ldt-floating-bar--bottom-start {
234
- bottom: var(--loidolt-space-3);
235
- left: var(--loidolt-space-3);
260
+ bottom: calc(var(--loidolt-space-3) + var(--ldt-safe-bottom, env(safe-area-inset-bottom, 0px)));
261
+ left: calc(var(--loidolt-space-3) + var(--ldt-safe-left, env(safe-area-inset-left, 0px)));
236
262
  }
237
263
  .ldt-floating-bar--bottom-end {
238
- bottom: var(--loidolt-space-3);
239
- right: var(--loidolt-space-3);
264
+ bottom: calc(var(--loidolt-space-3) + var(--ldt-safe-bottom, env(safe-area-inset-bottom, 0px)));
265
+ right: calc(var(--loidolt-space-3) + var(--ldt-safe-right, env(safe-area-inset-right, 0px)));
266
+ }
267
+ /*
268
+ * TabBar: a phone's bottom navigation. Equal destinations edge to edge, so the whole bar is
269
+ * target with no dead space between; each is at least 44px square. The surface runs under the
270
+ * home indicator and the links sit above it (`--ldt-safe-*`; see AppShell).
271
+ */
272
+ .ldt-tab-bar {
273
+ min-width: 0;
274
+ display: flex;
275
+ padding: 0 var(--ldt-safe-right, env(safe-area-inset-right, 0px))
276
+ var(--ldt-safe-bottom, env(safe-area-inset-bottom, 0px))
277
+ var(--ldt-safe-left, env(safe-area-inset-left, 0px));
278
+ border-top: var(--loidolt-border-width) solid var(--loidolt-border);
279
+ color: var(--loidolt-text-muted);
280
+ background: var(--loidolt-surface);
281
+ }
282
+ .ldt-tab-bar__item {
283
+ flex: 1 1 0;
284
+ min-width: 44px;
285
+ min-height: max(44px, calc(var(--loidolt-size-control) * 1.5));
286
+ display: flex;
287
+ flex-direction: column;
288
+ align-items: center;
289
+ justify-content: center;
290
+ gap: var(--loidolt-space-1);
291
+ padding: var(--loidolt-space-2) var(--loidolt-space-1);
292
+ color: inherit;
293
+ font: var(--loidolt-font-size-xs) var(--loidolt-font-utility);
294
+ font-weight: var(--loidolt-control-weight);
295
+ letter-spacing: 0; /* tracking would push short labels into ellipses */
296
+ text-transform: var(--loidolt-control-transform);
297
+ text-decoration: none;
298
+ -webkit-tap-highlight-color: transparent;
299
+ }
300
+ /* A tap leaves `:hover` stuck on touch screens, where it would read as a second current tab. */
301
+ @media (hover: hover) {
302
+ .ldt-tab-bar__item:hover {
303
+ color: var(--loidolt-text);
304
+ background: var(--loidolt-surface-alt);
305
+ text-decoration: none;
306
+ }
307
+ }
308
+ /* The indicator is the edge facing the content — the bar's top. */
309
+ .ldt-tab-bar__item[aria-current='page'] {
310
+ color: var(--loidolt-text-accent);
311
+ background: var(--loidolt-surface-alt);
312
+ box-shadow: inset 0 var(--loidolt-stroke-indicator) 0 var(--loidolt-accent);
313
+ }
314
+ .ldt-tab-bar__icon {
315
+ display: inline-flex;
316
+ flex: none;
317
+ }
318
+ .ldt-tab-bar__icon :where(svg) {
319
+ width: 1.5rem; /* @literal icons are sized for the eye, not the label */
320
+ height: 1.5rem; /* @literal icons are sized for the eye, not the label */
321
+ }
322
+ .ldt-tab-bar__label {
323
+ max-width: 100%;
324
+ overflow: hidden;
325
+ text-overflow: ellipsis;
326
+ white-space: nowrap;
240
327
  }
241
328
  .ldt-page-header {
242
329
  display: flex;
@@ -278,7 +365,8 @@
278
365
  @media (max-width: 760px) {
279
366
  .ldt-topbar {
280
367
  min-height: auto;
281
- padding-block: var(--loidolt-space-3);
368
+ padding-block: calc(var(--loidolt-space-3) + var(--ldt-safe-top, env(safe-area-inset-top, 0px)))
369
+ var(--loidolt-space-3);
282
370
  gap: var(--loidolt-space-3);
283
371
  }
284
372
  .ldt-topbar__actions {
@@ -141,6 +141,23 @@
141
141
  border-top-width: var(--loidolt-border-width);
142
142
  animation: ldt-drawer-in-bottom var(--loidolt-motion-slow) var(--loidolt-motion-easing);
143
143
  }
144
+ /*
145
+ * The panel's surface runs under the notch and home indicator on the three screen edges it
146
+ * touches, and its content is inset from them (`--ldt-safe-*`; see AppShell). The open edge
147
+ * faces the page and needs none.
148
+ */
149
+ :where(.ldt-drawer--left, .ldt-drawer--right, .ldt-drawer--top) {
150
+ padding-top: var(--ldt-safe-top, env(safe-area-inset-top, 0px));
151
+ }
152
+ :where(.ldt-drawer--left, .ldt-drawer--right, .ldt-drawer--bottom) {
153
+ padding-bottom: var(--ldt-safe-bottom, env(safe-area-inset-bottom, 0px));
154
+ }
155
+ :where(.ldt-drawer--left, .ldt-drawer--top, .ldt-drawer--bottom) {
156
+ padding-left: var(--ldt-safe-left, env(safe-area-inset-left, 0px));
157
+ }
158
+ :where(.ldt-drawer--right, .ldt-drawer--top, .ldt-drawer--bottom) {
159
+ padding-right: var(--ldt-safe-right, env(safe-area-inset-right, 0px));
160
+ }
144
161
  @keyframes ldt-drawer-in-left {
145
162
  from {
146
163
  transform: translateX(-100%);
@@ -397,33 +414,6 @@
397
414
  .ldt-tabs__content[data-orientation='vertical'] {
398
415
  padding-block: var(--loidolt-space-4);
399
416
  }
400
- /* A rail left vertical on a phone lays its tabs out as one row above the panels. */
401
- .ldt-tabs--rail[data-orientation='vertical'] {
402
- height: auto;
403
- }
404
- .ldt-tabs--rail .ldt-tabs__list[data-orientation='vertical'] {
405
- min-width: 0;
406
- flex-direction: row;
407
- gap: 0;
408
- padding: var(--loidolt-space-1);
409
- border-inline-end: 0;
410
- }
411
- .ldt-tabs--rail .ldt-tabs__trigger[data-orientation='vertical'] {
412
- flex: 1 1 0;
413
- padding-inline: 0;
414
- }
415
- .ldt-tabs--rail .ldt-tabs__trigger[data-state='active'][data-orientation='vertical'] {
416
- box-shadow: inset 0 calc(-1 * var(--loidolt-stroke-indicator)) 0 var(--loidolt-accent);
417
- }
418
- .ldt-tabs--rail[data-orientation='vertical'] .ldt-tabs__panels {
419
- overflow: visible;
420
- }
421
- .ldt-tabs--rail[data-orientation='vertical'] .ldt-tabs__panel-header {
422
- position: static;
423
- }
424
- .ldt-tabs--rail .ldt-tabs__content[data-orientation='vertical'] {
425
- padding-block: 0;
426
- }
427
417
  }
428
418
  /* A tab's leading icon, beside its label. */
429
419
  .ldt-tabs__trigger:has(.ldt-tabs__icon) {
@@ -451,8 +441,9 @@
451
441
  * panels, which never scrolls sideways. Give the root a height for the vertical panels to scroll.
452
442
  */
453
443
  .ldt-tabs--rail {
454
- /* Room for an icon over a label of about nine characters; override per app. */
455
- --ldt-rail-width: 3.75rem;
444
+ /* The vertical rail's whole width: room for an icon over a label of about nine characters.
445
+ Override per app. */
446
+ --ldt-rail-width: 4.75rem;
456
447
  min-height: 0;
457
448
  }
458
449
  .ldt-tabs--rail[data-orientation='vertical'] {
@@ -466,12 +457,13 @@
466
457
  /* The rail's width is its own (a fixed column, or the row it shares); long labels end in an
467
458
  ellipsis rather than widening whatever holds the rail. */
468
459
  contain: inline-size;
469
- gap: var(--loidolt-space-1);
470
- padding: var(--loidolt-space-2);
460
+ /* Tabs meet edge to edge, so the whole rail is target and hover area, with no dead space. */
461
+ gap: 0;
462
+ padding: 0;
471
463
  overflow: hidden;
472
464
  }
473
465
  .ldt-tabs--rail .ldt-tabs__list[data-orientation='vertical'] {
474
- min-width: calc(var(--ldt-rail-width) + 2 * var(--loidolt-space-2));
466
+ min-width: var(--ldt-rail-width);
475
467
  overflow-y: auto;
476
468
  border-right: 0;
477
469
  border-inline-end: var(--loidolt-border-width) solid var(--loidolt-border);
@@ -487,7 +479,7 @@
487
479
  gap: var(--loidolt-space-1);
488
480
  padding: var(--loidolt-space-2) var(--loidolt-space-1);
489
481
  border: 0;
490
- border-radius: var(--loidolt-radius-control);
482
+ border-radius: 0;
491
483
  font-size: var(--loidolt-font-size-xs);
492
484
  letter-spacing: 0; /* tracking would push short labels into ellipses */
493
485
  text-align: center;
@@ -497,10 +489,10 @@
497
489
  flex: 1 1 0;
498
490
  padding-inline: 0;
499
491
  }
500
- /* A row of rail tabs shares one line edge to edge, down to a 320px phone. */
501
- .ldt-tabs--rail .ldt-tabs__list[data-orientation='horizontal'] {
502
- gap: 0;
503
- padding: var(--loidolt-space-1);
492
+ /* The vertical indicator sits on the rail's leading edge. Both sides carry a border so the
493
+ icon stays centred; only the leading one takes the accent. */
494
+ .ldt-tabs--rail .ldt-tabs__trigger[data-orientation='vertical'] {
495
+ border-inline: var(--loidolt-stroke-indicator) solid transparent;
504
496
  }
505
497
  .ldt-tabs--rail .ldt-tabs__icon :where(svg) {
506
498
  width: 1.25rem; /* @literal rail icons are sized for the eye, not the label */
@@ -521,7 +513,8 @@
521
513
  background: var(--loidolt-surface-alt);
522
514
  }
523
515
  .ldt-tabs--rail .ldt-tabs__trigger[data-state='active'][data-orientation='vertical'] {
524
- box-shadow: inset calc(-1 * var(--loidolt-stroke-indicator)) 0 0 var(--loidolt-accent);
516
+ border-inline-start-color: var(--loidolt-accent);
517
+ border-inline-end-color: transparent;
525
518
  }
526
519
  .ldt-tabs--rail .ldt-tabs__trigger[data-state='active'][data-orientation='horizontal'] {
527
520
  box-shadow: inset 0 calc(-1 * var(--loidolt-stroke-indicator)) 0 var(--loidolt-accent);
@@ -543,6 +536,35 @@
543
536
  .ldt-tabs--rail .ldt-tabs__content {
544
537
  padding-block: 0;
545
538
  }
539
+ /* After the rail rules, so the phone layout wins over them at equal specificity. */
540
+ @media (max-width: 760px) {
541
+ /* A rail left vertical on a phone lays its tabs out as one row above the panels. */
542
+ .ldt-tabs--rail[data-orientation='vertical'] {
543
+ height: auto;
544
+ }
545
+ .ldt-tabs--rail .ldt-tabs__list[data-orientation='vertical'] {
546
+ min-width: 0;
547
+ flex-direction: row;
548
+ border-inline-end: 0;
549
+ }
550
+ .ldt-tabs--rail .ldt-tabs__trigger[data-orientation='vertical'] {
551
+ flex: 1 1 0;
552
+ padding-inline: 0;
553
+ border-inline: 0;
554
+ }
555
+ .ldt-tabs--rail .ldt-tabs__trigger[data-state='active'][data-orientation='vertical'] {
556
+ box-shadow: inset 0 calc(-1 * var(--loidolt-stroke-indicator)) 0 var(--loidolt-accent);
557
+ }
558
+ .ldt-tabs--rail[data-orientation='vertical'] .ldt-tabs__panels {
559
+ overflow: visible;
560
+ }
561
+ .ldt-tabs--rail[data-orientation='vertical'] .ldt-tabs__panel-header {
562
+ position: static;
563
+ }
564
+ .ldt-tabs--rail .ldt-tabs__content[data-orientation='vertical'] {
565
+ padding-block: 0;
566
+ }
567
+ }
546
568
 
547
569
  /* The option list of Combobox and MultiSelect: the menu surface, sized to its field. */
548
570
  .ldt-listbox {