@loidolt/theme-styles 0.10.1 → 0.11.1

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.1",
3
+ "version": "0.11.1",
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.1"
34
+ "@loidolt/theme-tokens": "^0.11.1"
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,
@@ -1,4 +1,11 @@
1
+ /*
2
+ * The wrapper is a scroll region, so it is also the containing block of what it scrolls:
3
+ * visually hidden text (the caption, the live region in every Button) is absolutely positioned,
4
+ * and against an ancestor outside the wrapper it would escape the clipping and stretch the page
5
+ * to where the last row would have been.
6
+ */
1
7
  .ldt-table-wrap {
8
+ position: relative;
2
9
  width: 100%;
3
10
  overflow-x: auto;
4
11
  border: var(--loidolt-border-width) solid var(--loidolt-border);
@@ -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
  }
@@ -189,7 +214,10 @@
189
214
  grid-column: 1 / -1;
190
215
  min-width: 0;
191
216
  }
217
+ /* Positioned so absolutely positioned content (visually hidden text) scrolls and clips with the
218
+ pane instead of stretching the page; see `.ldt-table-wrap`. */
192
219
  .ldt-sidebar {
220
+ position: relative;
193
221
  min-width: 0;
194
222
  overflow-y: auto;
195
223
  padding: var(--loidolt-pad-pane);
@@ -222,21 +250,83 @@
222
250
  .ldt-floating-bar--vertical {
223
251
  flex-direction: column;
224
252
  }
253
+ /* Each corner clears the safe area too, for a stage that fills the screen (a map, a canvas). */
225
254
  .ldt-floating-bar--top-start {
226
- top: var(--loidolt-space-3);
227
- left: var(--loidolt-space-3);
255
+ top: calc(var(--loidolt-space-3) + var(--ldt-safe-top, env(safe-area-inset-top, 0px)));
256
+ left: calc(var(--loidolt-space-3) + var(--ldt-safe-left, env(safe-area-inset-left, 0px)));
228
257
  }
229
258
  .ldt-floating-bar--top-end {
230
- top: var(--loidolt-space-3);
231
- right: var(--loidolt-space-3);
259
+ top: calc(var(--loidolt-space-3) + var(--ldt-safe-top, env(safe-area-inset-top, 0px)));
260
+ right: calc(var(--loidolt-space-3) + var(--ldt-safe-right, env(safe-area-inset-right, 0px)));
232
261
  }
233
262
  .ldt-floating-bar--bottom-start {
234
- bottom: var(--loidolt-space-3);
235
- left: var(--loidolt-space-3);
263
+ bottom: calc(var(--loidolt-space-3) + var(--ldt-safe-bottom, env(safe-area-inset-bottom, 0px)));
264
+ left: calc(var(--loidolt-space-3) + var(--ldt-safe-left, env(safe-area-inset-left, 0px)));
236
265
  }
237
266
  .ldt-floating-bar--bottom-end {
238
- bottom: var(--loidolt-space-3);
239
- right: var(--loidolt-space-3);
267
+ bottom: calc(var(--loidolt-space-3) + var(--ldt-safe-bottom, env(safe-area-inset-bottom, 0px)));
268
+ right: calc(var(--loidolt-space-3) + var(--ldt-safe-right, env(safe-area-inset-right, 0px)));
269
+ }
270
+ /*
271
+ * TabBar: a phone's bottom navigation. Equal destinations edge to edge, so the whole bar is
272
+ * target with no dead space between; each is at least 44px square. The surface runs under the
273
+ * home indicator and the links sit above it (`--ldt-safe-*`; see AppShell).
274
+ */
275
+ .ldt-tab-bar {
276
+ min-width: 0;
277
+ display: flex;
278
+ padding: 0 var(--ldt-safe-right, env(safe-area-inset-right, 0px))
279
+ var(--ldt-safe-bottom, env(safe-area-inset-bottom, 0px))
280
+ var(--ldt-safe-left, env(safe-area-inset-left, 0px));
281
+ border-top: var(--loidolt-border-width) solid var(--loidolt-border);
282
+ color: var(--loidolt-text-muted);
283
+ background: var(--loidolt-surface);
284
+ }
285
+ .ldt-tab-bar__item {
286
+ flex: 1 1 0;
287
+ min-width: 44px;
288
+ min-height: max(44px, calc(var(--loidolt-size-control) * 1.5));
289
+ display: flex;
290
+ flex-direction: column;
291
+ align-items: center;
292
+ justify-content: center;
293
+ gap: var(--loidolt-space-1);
294
+ padding: var(--loidolt-space-2) var(--loidolt-space-1);
295
+ color: inherit;
296
+ font: var(--loidolt-font-size-xs) var(--loidolt-font-utility);
297
+ font-weight: var(--loidolt-control-weight);
298
+ letter-spacing: 0; /* tracking would push short labels into ellipses */
299
+ text-transform: var(--loidolt-control-transform);
300
+ text-decoration: none;
301
+ -webkit-tap-highlight-color: transparent;
302
+ }
303
+ /* A tap leaves `:hover` stuck on touch screens, where it would read as a second current tab. */
304
+ @media (hover: hover) {
305
+ .ldt-tab-bar__item:hover {
306
+ color: var(--loidolt-text);
307
+ background: var(--loidolt-surface-alt);
308
+ text-decoration: none;
309
+ }
310
+ }
311
+ /* The indicator is the edge facing the content — the bar's top. */
312
+ .ldt-tab-bar__item[aria-current='page'] {
313
+ color: var(--loidolt-text-accent);
314
+ background: var(--loidolt-surface-alt);
315
+ box-shadow: inset 0 var(--loidolt-stroke-indicator) 0 var(--loidolt-accent);
316
+ }
317
+ .ldt-tab-bar__icon {
318
+ display: inline-flex;
319
+ flex: none;
320
+ }
321
+ .ldt-tab-bar__icon :where(svg) {
322
+ width: 1.5rem; /* @literal icons are sized for the eye, not the label */
323
+ height: 1.5rem; /* @literal icons are sized for the eye, not the label */
324
+ }
325
+ .ldt-tab-bar__label {
326
+ max-width: 100%;
327
+ overflow: hidden;
328
+ text-overflow: ellipsis;
329
+ white-space: nowrap;
240
330
  }
241
331
  .ldt-page-header {
242
332
  display: flex;
@@ -278,7 +368,8 @@
278
368
  @media (max-width: 760px) {
279
369
  .ldt-topbar {
280
370
  min-height: auto;
281
- padding-block: var(--loidolt-space-3);
371
+ padding-block: calc(var(--loidolt-space-3) + var(--ldt-safe-top, env(safe-area-inset-top, 0px)))
372
+ var(--loidolt-space-3);
282
373
  gap: var(--loidolt-space-3);
283
374
  }
284
375
  .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%);
@@ -506,6 +523,8 @@
506
523
  border-bottom: var(--loidolt-border-width) solid var(--loidolt-border);
507
524
  }
508
525
  .ldt-tabs--rail[data-orientation='vertical'] .ldt-tabs__panels {
526
+ /* The containing block of what it scrolls; see `.ldt-table-wrap`. */
527
+ position: relative;
509
528
  overflow-y: auto;
510
529
  overscroll-behavior: contain;
511
530
  scrollbar-width: thin;