@devopsplaybook.io/common-web 0.14.0-beta.25.5639705 → 0.14.0-beta.25.e3a770b

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/CHANGELOG.md CHANGED
@@ -18,14 +18,36 @@ and [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
18
18
  recursive polling with exponential backoff, pause/resume on visibility and
19
19
  focus, abortable requests, session capture and terminal states.
20
20
  - `LoginCodeInput`, `LoginWithCodeCard` and `AuthorizeDeviceCard`: accessible
21
- code entry, the requesting-device flow and the approver flow with an optional
22
- password step-up, all localisable through `labels` props.
21
+ code entry, the requesting-device flow (with a fresh request after expiry or
22
+ cancellation) and the approver flow with an optional password step-up, all
23
+ localisable through `labels` props.
23
24
  - A playground page plus component, service, composable, SSR, accessibility and
24
25
  no-Nuxt-import tests.
26
+ - `--color-on-primary` in `assets/css/tokens.css` (`#ffffff` in the light theme,
27
+ `#171717` in both dark blocks) for primary-button labels; `tests/contrast.spec.ts`
28
+ gates it at AA against `--color-primary`.
25
29
 
26
- Everything is additive: no existing export, prop or behaviour changed, and no
27
- dependency was added or upgraded (the service reuses the existing axios
28
- dependency).
30
+ ### Changed
31
+
32
+ - The login-with-code components theme themselves from the host application's
33
+ tokens through an internal `--lc-*` layer: host tokens win, token-less and
34
+ partial palettes get theme-aware `light-dark()` fallbacks, and the raised
35
+ surface is derived with `color-mix()` when `--color-surface-raised` is absent.
36
+ This fixes the components rendering light-only panels, invisible code and
37
+ white-on-light buttons in a dark non-layer host such as Planner.
38
+ - Warning and error states are callouts (accent border, text in the host text
39
+ colour) instead of solid fills, so `--color-on-warning`/`--color-on-error` are
40
+ no longer required by these components.
41
+ - Primary buttons use `--color-on-primary`; secondary buttons and the input use
42
+ the host surface, border and text tokens; focus rings follow `--color-primary`.
43
+ - `LoginWithCodeCard` and `AuthorizeDeviceCard` accept `variant` (`card` |
44
+ `plain`) and `headingLevel` (`2` | `3` | `4`) to embed in an existing card or
45
+ section without duplicated chrome or headings.
46
+ - Spacing goes through `--lc-space`, bridging `--space-base` and `--space-md`.
47
+
48
+ The API stays additive: no existing export, prop or behaviour changed, and no
49
+ runtime dependency was added or upgraded (the service reuses the existing axios
50
+ dependency; `postcss` is a dev-only dependency of the theme-contract test).
29
51
 
30
52
  ## [0.13.0] - 2026-11-25
31
53
 
package/README.md CHANGED
@@ -296,7 +296,8 @@ linked by `aria-describedby`.
296
296
 
297
297
  `<LoginWithCodeCard>` shows the created code with copy, refresh and expiry
298
298
  countdowns, a polite live status region and Cancel / Use password instead /
299
- Try again actions. Props: `service`, `autoStart` (default `true`), `onSession`
299
+ Try again actions. Try again appears after an error, expiry or cancellation and
300
+ starts a fresh request. Props: `service`, `autoStart` (default `true`), `onSession`
300
301
  and `labels` (a `Partial` of the English defaults: `title`, `instructions`,
301
302
  `codeLabel`, `preparing`, `waiting`, `approved`, `expired`, `cancelled`, `error`,
302
303
  `unavailable`, `refreshIn` / `expiresIn` (`{seconds}` placeholder), `copy`,
@@ -316,6 +317,12 @@ is local and generic; the server message is never rendered. Both cards render a
316
317
  live region only for status changes, and `AuthorizeDeviceCard` keeps the warning
317
318
  visible in every state.
318
319
 
320
+ Both cards accept `variant` (`"card"` by default, or `"plain"` to drop their own
321
+ border, radius, background, shadow and outer padding when they are embedded in a
322
+ host card or section) and `headingLevel` (`2`, `3` or `4`, default `2`) so the
323
+ title matches the surrounding heading structure. The `aria-labelledby` wiring
324
+ follows the rendered heading id.
325
+
319
326
  ### Using the layer
320
327
 
321
328
  With the layer extended, the components and composable are auto-imported:
@@ -370,8 +377,99 @@ import { LoginCodeService } from "@devopsplaybook.io/common-web/services/LoginCo
370
377
 
371
378
  The shipped files import only `vue`, `axios`, `./Config`, the login-code service
372
379
  and each other; a regression test fails if Nuxt auto-imports (`#imports`,
373
- `useRuntimeConfig`, `navigateTo`, …) creep in. The feature adds no dependency:
374
- the service reuses the package's existing axios dependency.
380
+ `useRuntimeConfig`, `navigateTo`, …) creep in. The feature adds no runtime
381
+ dependency: the service reuses the package's existing axios dependency (the
382
+ theme-contract test adds `postcss` as a dev-only dependency).
383
+
384
+ ### Theming and non-layer hosts
385
+
386
+ `LoginCodeInput`, `LoginWithCodeCard` and `AuthorizeDeviceCard` theme themselves
387
+ from the host application's tokens, so they work in the Nuxt layer (which ships
388
+ `assets/css/tokens.css`) and when the SFCs are imported directly into a plain
389
+ Vue/Nuxt app that defines only a partial palette. Every component root carries
390
+ the `lc-theme` class and maps the host tokens onto internal `--lc-*` variables.
391
+
392
+ No token is strictly required: each has a fallback. For a faithful theme, define:
393
+
394
+ | Token | Use |
395
+ | --- | --- |
396
+ | `--color-surface` | card and input background |
397
+ | `--color-text` | body, code, labels and button text |
398
+ | `--color-text-muted` | instructions, countdowns and secondary labels |
399
+ | `--color-border` | card, input and secondary-button borders |
400
+ | `--color-primary`, `--color-primary-hover` | primary buttons, links, focus rings |
401
+ | `--color-on-primary` | primary-button label |
402
+ | `--color-warning` | warning callout accent (used as a tint, not a fill) |
403
+ | `--color-error` **or** `--color-danger` | error text and the invalid input border |
404
+ | `--color-success` | approval confirmation |
405
+
406
+ Optional: `--color-surface-raised` (otherwise derived with `color-mix()` as 5 %
407
+ of the text colour over the surface, tinted with the host palette) and either
408
+ `--space-base` or `--space-md` (plus `--space-xs/sm/lg/xl` when present). Host
409
+ tokens always win; the fallbacks only fill the gaps.
410
+
411
+ Warning and error states are callouts — text in `--lc-text` on a tinted (or
412
+ transparent) background with an accent border — so hosts do not need
413
+ `--color-on-warning` or `--color-on-error` for these components.
414
+
415
+ The `light-dark()` fallbacks used by token-less hosts follow the inherited CSS
416
+ `color-scheme`. The layer and Planner set it; a token-less host should too:
417
+
418
+ ```css
419
+ :root {
420
+ color-scheme: light dark;
421
+ }
422
+ ```
423
+
424
+ Browsers without `light-dark()` or `color-mix()` fall back to the light palette
425
+ and a transparent warning callout with a solid accent border. Text contrast
426
+ follows the host tokens: with a faithful palette the components meet WCAG 2.2 AA
427
+ in light and dark. Secondary text is bounded by `--color-text-muted`, so a muted
428
+ token that is too light (for example a grey below 4.5:1 on the surface) caps the
429
+ contrast the library can offer.
430
+
431
+ Override individual values through the `--lc-*` variables on the component or any
432
+ ancestor without redefining the whole host palette:
433
+
434
+ ```css
435
+ .lc-theme {
436
+ --lc-space-sm: var(--space-sm, 0.5rem);
437
+ --lc-space: var(--space-base, var(--space-md, 1rem));
438
+ --lc-space-lg: var(--space-lg, 1.5rem);
439
+ --lc-space-xl: var(--space-xl, 2rem);
440
+
441
+ --lc-surface: var(--color-surface, #fff);
442
+ --lc-raised: var(--color-surface-raised, #f5f5f5);
443
+ --lc-text: var(--color-text, #171717);
444
+ --lc-muted: var(--color-text-muted, #5f6368);
445
+ --lc-border: var(--color-border, #d6d6d6);
446
+ --lc-primary: var(--color-primary, #c62828);
447
+ --lc-primary-hover: var(--color-primary-hover, #a61f1f);
448
+ --lc-on-primary: var(--color-on-primary, #fff);
449
+ --lc-warning: var(--color-warning, #8a5a00);
450
+ --lc-danger: var(--color-error, var(--color-danger, #b3261e));
451
+ --lc-success: var(--color-success, #2e7d32);
452
+ }
453
+ ```
454
+
455
+ Embed the cards in an existing card or section with `variant="plain"` (no border,
456
+ radius, background, shadow or outer padding) and match the heading structure with
457
+ `headingLevel`:
458
+
459
+ ```vue
460
+ <article class="login-card">
461
+ <LoginWithCodeCard
462
+ :service="service"
463
+ variant="plain"
464
+ :heading-level="3"
465
+ @approved="signedIn"
466
+ />
467
+ </article>
468
+ ```
469
+
470
+ `tests/theme-contract.spec.ts` guards the contract: no raw colour literals in
471
+ colour declarations, only documented host tokens, `--color-on-primary` shipped in
472
+ every theme block, and the spacing bridge through `--lc-space`.
375
473
 
376
474
  ## Authentication state and HTTP integration
377
475
 
@@ -493,17 +591,19 @@ exercised by `npm test` and by both CI workflows.
493
591
 
494
592
  The layer loads `assets/css/tokens.css` and `assets/css/app-shell.css`.
495
593
  Tokens include `--color-*` (including the per-status foreground tokens
496
- `--color-on-success`, `--color-on-error` and `--color-on-warning` used with
497
- `--color-success`, `--color-error` and `--color-warning`),
594
+ `--color-on-primary`, `--color-on-success`, `--color-on-error` and
595
+ `--color-on-warning` used with `--color-primary`, `--color-success`,
596
+ `--color-error` and `--color-warning`),
498
597
  `--space-*`, `--text-*`, `--radius-*`, `--shadow-*`, `--header-height`, and
499
598
  `--app-height`. Dark mode can be selected with `data-theme="dark"` or comes
500
599
  from `prefers-color-scheme` when no explicit light preference is set. Status
501
600
  colors meet WCAG AA against their `--color-on-*` foreground tokens in both
502
601
  themes. `--color-primary` and `--color-primary-hover` are defined in both
503
602
  themes and meet AA (4.5:1) on the shipped `--color-surface` and
504
- `--color-surface-raised` backgrounds. `tests/contrast.spec.ts` gates text,
505
- muted text, primary, primary hover and the status color pairs in the light and
506
- both dark blocks. The `dpb-fade-in` and `dpb-blink` helper classes are disabled
603
+ `--color-surface-raised` backgrounds, and `--color-on-primary` meets AA on
604
+ `--color-primary`. `tests/contrast.spec.ts` gates text,
605
+ muted text, primary, primary hover, the primary label and the status color pairs
606
+ in the light and both dark blocks. The `dpb-fade-in` and `dpb-blink` helper classes are disabled
507
607
  under `prefers-reduced-motion: reduce`.
508
608
 
509
609
  Load app-specific CSS after the layer and redefine only the values you need:
@@ -13,6 +13,7 @@
13
13
  --color-success: #2e7d32;
14
14
  --color-error: #c62828;
15
15
  --color-warning: #8a5a00;
16
+ --color-on-primary: #ffffff;
16
17
  --color-on-success: #ffffff;
17
18
  --color-on-error: #ffffff;
18
19
  --color-on-warning: #ffffff;
@@ -60,6 +61,7 @@
60
61
  --color-success: #43a047;
61
62
  --color-error: #ef5350;
62
63
  --color-warning: #f0b429;
64
+ --color-on-primary: #171717;
63
65
  --color-on-success: #171717;
64
66
  --color-on-error: #171717;
65
67
  --color-on-warning: #171717;
@@ -84,6 +86,7 @@
84
86
  --color-success: #43a047;
85
87
  --color-error: #ef5350;
86
88
  --color-warning: #f0b429;
89
+ --color-on-primary: #171717;
87
90
  --color-on-success: #171717;
88
91
  --color-on-error: #171717;
89
92
  --color-on-warning: #171717;
@@ -1,6 +1,12 @@
1
1
  <template>
2
- <section class="authorize-device-card" :aria-labelledby="titleId">
3
- <h2 :id="titleId" class="authorize-device-title">{{ copy.title }}</h2>
2
+ <section
3
+ class="authorize-device-card lc-theme"
4
+ :class="variantClass"
5
+ :aria-labelledby="titleId"
6
+ >
7
+ <component :is="titleTag" :id="titleId" class="authorize-device-title">
8
+ {{ copy.title }}
9
+ </component>
4
10
  <p class="authorize-device-warning">{{ copy.warning }}</p>
5
11
 
6
12
  <p v-if="loading" class="authorize-device-preparing">
@@ -169,10 +175,14 @@ const props = withDefaults(
169
175
  defineProps<{
170
176
  service?: LoginCodeService;
171
177
  labels?: Partial<AuthorizeDeviceCardLabels>;
178
+ variant?: "card" | "plain";
179
+ headingLevel?: 2 | 3 | 4;
172
180
  }>(),
173
181
  {
174
182
  service: () => new LoginCodeService(),
175
183
  labels: undefined,
184
+ variant: "card",
185
+ headingLevel: 2,
176
186
  },
177
187
  );
178
188
 
@@ -190,6 +200,9 @@ const uid = useId();
190
200
  const titleId = `authorize-device-title-${uid}`;
191
201
  const passwordId = `authorize-device-password-${uid}`;
192
202
 
203
+ const titleTag = computed(() => `h${props.headingLevel}` as "h2" | "h3" | "h4");
204
+ const variantClass = computed(() => `authorize-device-card--${props.variant}`);
205
+
193
206
  const capabilities = ref<LoginCodeCapabilities | null>(null);
194
207
  const loading = ref(true);
195
208
  const stage = ref<"idle" | "previewing" | "preview" | "approving" | "approved">(
@@ -424,47 +437,105 @@ onUnmounted(() => {
424
437
  </script>
425
438
 
426
439
  <style scoped>
440
+ /* Internal theme layer: host tokens win, theme-aware fallbacks otherwise. */
441
+ .lc-theme {
442
+ --lc-space-xs: var(--space-xs, 0.25rem);
443
+ --lc-space-sm: var(--space-sm, 0.5rem);
444
+ --lc-space: var(--space-base, var(--space-md, 1rem));
445
+ --lc-space-lg: var(--space-lg, 1.5rem);
446
+ --lc-space-xl: var(--space-xl, 2rem);
447
+
448
+ --lc-surface: var(--color-surface, #fff);
449
+ --lc-raised: var(--color-surface-raised, #f5f5f5);
450
+ --lc-text: var(--color-text, #171717);
451
+ --lc-muted: var(--color-text-muted, #5f6368);
452
+ --lc-border: var(--color-border, #d6d6d6);
453
+ --lc-primary: var(--color-primary, #c62828);
454
+ --lc-primary-hover: var(--color-primary-hover, #a61f1f);
455
+ --lc-on-primary: var(--color-on-primary, #fff);
456
+ --lc-warning: var(--color-warning, #8a5a00);
457
+ --lc-danger: var(--color-error, var(--color-danger, #b3261e));
458
+ --lc-success: var(--color-success, #2e7d32);
459
+ }
460
+
461
+ @supports (background: color-mix(in srgb, red, blue)) {
462
+ .lc-theme {
463
+ --lc-raised: var(--color-surface-raised,
464
+ color-mix(in srgb, var(--lc-text) 5%, var(--lc-surface)));
465
+ --lc-warning-bg: color-mix(in srgb, var(--lc-warning) 14%, var(--lc-surface));
466
+ --lc-danger-bg: color-mix(in srgb, var(--lc-danger) 12%, var(--lc-surface));
467
+ }
468
+ }
469
+
470
+ @supports (color: light-dark(#000, #fff)) {
471
+ .lc-theme {
472
+ --lc-surface: var(--color-surface, light-dark(#fff, #1b242c));
473
+ --lc-text: var(--color-text, light-dark(#171717, #d7dee4));
474
+ --lc-muted: var(--color-text-muted, light-dark(#5f6368, #8a99a6));
475
+ --lc-border: var(--color-border, light-dark(#d6d6d6, #2e3a44));
476
+ --lc-primary: var(--color-primary, light-dark(#c62828, #ff8a80));
477
+ --lc-primary-hover: var(--color-primary-hover, light-dark(#a61f1f, #ffb4ab));
478
+ --lc-on-primary: var(--color-on-primary, light-dark(#fff, #171717));
479
+ --lc-warning: var(--color-warning, light-dark(#8a5a00, #f0b429));
480
+ --lc-danger: var(--color-error, var(--color-danger, light-dark(#b3261e, #ff8a80)));
481
+ --lc-success: var(--color-success, light-dark(#2e7d32, #66bb6a));
482
+ }
483
+ }
484
+
427
485
  .authorize-device-card {
428
486
  max-width: 32rem;
429
- padding: clamp(var(--space-base, 1rem), 3vw, var(--space-xl, 2rem));
430
- color: var(--color-text, #171717);
431
- background: var(--color-surface, #fff);
432
- border: 1px solid var(--color-border, #d6d6d6);
487
+ color: var(--lc-text);
488
+ }
489
+
490
+ .authorize-device-card--card {
491
+ padding: clamp(var(--lc-space), 3vw, var(--lc-space-xl));
492
+ background: var(--lc-surface);
493
+ border: 1px solid var(--lc-border);
433
494
  border-radius: var(--radius-lg, 0.5rem);
434
495
  box-shadow: var(--shadow-sm, 0 1px 2px rgb(0 0 0 / 10%));
435
496
  }
436
497
 
437
498
  .authorize-device-title {
438
- margin: 0 0 var(--space-sm, 0.5rem);
499
+ margin: 0 0 var(--lc-space-sm);
439
500
  font-size: var(--text-xl, 1.25rem);
440
501
  line-height: 1.3;
441
502
  }
442
503
 
443
504
  .authorize-device-warning {
444
- padding: var(--space-sm, 0.5rem) var(--space-base, 1rem);
445
- margin: 0 0 var(--space-base, 1rem);
446
- color: var(--color-on-warning, #fff);
505
+ padding: var(--lc-space-sm) var(--lc-space);
506
+ margin: 0 0 var(--lc-space);
507
+ color: var(--lc-text);
447
508
  font-size: var(--text-sm, 0.875rem);
448
509
  font-weight: 600;
449
- background: var(--color-warning, #8a5a00);
510
+ background: transparent;
511
+ border: 1px solid var(--lc-warning);
512
+ border-left: 3px solid var(--lc-warning);
450
513
  border-radius: var(--radius-sm, 0.25rem);
451
514
  }
452
515
 
516
+ @supports (background: color-mix(in srgb, red, blue)) {
517
+ .lc-theme .authorize-device-warning {
518
+ background: var(--lc-warning-bg);
519
+ border-color: transparent;
520
+ border-left-color: var(--lc-warning);
521
+ }
522
+ }
523
+
453
524
  .authorize-device-preparing,
454
525
  .authorize-device-unavailable {
455
- margin: 0 0 var(--space-base, 1rem);
456
- color: var(--color-text-muted, #5f6368);
526
+ margin: 0 0 var(--lc-space);
527
+ color: var(--lc-muted);
457
528
  }
458
529
 
459
530
  .authorize-device-form {
460
531
  display: flex;
461
532
  flex-direction: column;
462
- gap: var(--space-sm, 0.5rem);
533
+ gap: var(--lc-space-sm);
463
534
  }
464
535
 
465
536
  .authorize-device-button {
466
537
  align-self: flex-start;
467
- padding: var(--space-sm, 0.5rem) var(--space-base, 1rem);
538
+ padding: var(--lc-space-sm) var(--lc-space);
468
539
  font: inherit;
469
540
  font-size: var(--text-sm, 0.875rem);
470
541
  border-radius: var(--radius-md, 0.375rem);
@@ -472,7 +543,7 @@ onUnmounted(() => {
472
543
  }
473
544
 
474
545
  .authorize-device-button:focus-visible {
475
- outline: 3px solid var(--color-primary, #c62828);
546
+ outline: 2px solid var(--lc-primary);
476
547
  outline-offset: 2px;
477
548
  }
478
549
 
@@ -482,50 +553,50 @@ onUnmounted(() => {
482
553
  }
483
554
 
484
555
  .authorize-device-button-primary {
485
- color: #fff;
486
- background: var(--color-primary, #c62828);
487
- border: 1px solid var(--color-primary, #c62828);
556
+ color: var(--lc-on-primary);
557
+ background: var(--lc-primary);
558
+ border: 1px solid var(--lc-primary);
488
559
  }
489
560
 
490
561
  .authorize-device-button-primary:hover:not(:disabled) {
491
- background: var(--color-primary-hover, #a61f1f);
492
- border-color: var(--color-primary-hover, #a61f1f);
562
+ background: var(--lc-primary-hover);
563
+ border-color: var(--lc-primary-hover);
493
564
  }
494
565
 
495
566
  .authorize-device-button-secondary {
496
- color: var(--color-text, #171717);
497
- background: var(--color-surface, #fff);
498
- border: 1px solid var(--color-text-muted, #5f6368);
567
+ color: var(--lc-text);
568
+ background: transparent;
569
+ border: 1px solid var(--lc-border);
499
570
  }
500
571
 
501
572
  .authorize-device-error {
502
- margin: var(--space-sm, 0.5rem) 0;
503
- color: var(--color-error, #c62828);
573
+ margin: var(--lc-space-sm) 0;
574
+ color: var(--lc-danger);
504
575
  font-size: var(--text-sm, 0.875rem);
505
576
  font-weight: 600;
506
577
  }
507
578
 
508
579
  .authorize-device-preview {
509
- padding: var(--space-base, 1rem);
510
- margin-top: var(--space-base, 1rem);
511
- background: var(--color-surface-raised, #f5f5f5);
580
+ padding: var(--lc-space);
581
+ margin-top: var(--lc-space);
582
+ background: var(--lc-raised);
512
583
  border-radius: var(--radius-md, 0.375rem);
513
584
  }
514
585
 
515
586
  .authorize-device-sign-in {
516
- margin: 0 0 var(--space-sm, 0.5rem);
587
+ margin: 0 0 var(--lc-space-sm);
517
588
  }
518
589
 
519
590
  .authorize-device-details {
520
591
  display: grid;
521
592
  grid-template-columns: max-content 1fr;
522
- gap: var(--space-xs, 0.25rem) var(--space-base, 1rem);
523
- margin: 0 0 var(--space-base, 1rem);
593
+ gap: var(--lc-space-xs) var(--lc-space);
594
+ margin: 0 0 var(--lc-space);
524
595
  font-size: var(--text-sm, 0.875rem);
525
596
  }
526
597
 
527
598
  .authorize-device-details dt {
528
- color: var(--color-text-muted, #5f6368);
599
+ color: var(--lc-muted);
529
600
  font-weight: 600;
530
601
  }
531
602
 
@@ -537,39 +608,39 @@ onUnmounted(() => {
537
608
  .authorize-device-password {
538
609
  display: flex;
539
610
  flex-direction: column;
540
- gap: var(--space-xs, 0.25rem);
541
- margin-bottom: var(--space-base, 1rem);
611
+ gap: var(--lc-space-xs);
612
+ margin-bottom: var(--lc-space);
542
613
  }
543
614
 
544
615
  .authorize-device-label {
545
- color: var(--color-text, #171717);
616
+ color: var(--lc-text);
546
617
  font-size: var(--text-sm, 0.875rem);
547
618
  font-weight: 600;
548
619
  }
549
620
 
550
621
  .authorize-device-input {
551
- padding: var(--space-sm, 0.5rem) var(--space-base, 1rem);
552
- color: var(--color-text, #171717);
622
+ padding: var(--lc-space-sm) var(--lc-space);
623
+ color: var(--lc-text);
553
624
  font: inherit;
554
- background: var(--color-surface, #fff);
555
- border: 2px solid var(--color-border, #d6d6d6);
625
+ background: var(--lc-surface);
626
+ border: 2px solid var(--lc-border);
556
627
  border-radius: var(--radius-md, 0.375rem);
557
628
  }
558
629
 
559
630
  .authorize-device-input:focus-visible {
560
- outline: 3px solid var(--color-primary, #c62828);
631
+ outline: 2px solid var(--lc-primary);
561
632
  outline-offset: 2px;
562
633
  }
563
634
 
564
635
  .authorize-device-success {
565
- margin: 0 0 var(--space-base, 1rem);
566
- color: var(--color-success, #2e7d32);
636
+ margin: 0 0 var(--lc-space);
637
+ color: var(--lc-success);
567
638
  font-weight: 600;
568
639
  }
569
640
 
570
641
  .authorize-device-actions {
571
642
  display: flex;
572
643
  flex-wrap: wrap;
573
- gap: var(--space-sm, 0.5rem);
644
+ gap: var(--lc-space-sm);
574
645
  }
575
646
  </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="login-code-input">
2
+ <div class="login-code-input lc-theme">
3
3
  <label class="login-code-input-label" :for="inputId">{{ label }}</label>
4
4
  <input
5
5
  :id="inputId"
@@ -92,50 +92,95 @@ function onEnter(): void {
92
92
  </script>
93
93
 
94
94
  <style scoped>
95
+ /* Internal theme layer: host tokens win, theme-aware fallbacks otherwise. */
96
+ .lc-theme {
97
+ --lc-space-xs: var(--space-xs, 0.25rem);
98
+ --lc-space-sm: var(--space-sm, 0.5rem);
99
+ --lc-space: var(--space-base, var(--space-md, 1rem));
100
+ --lc-space-lg: var(--space-lg, 1.5rem);
101
+ --lc-space-xl: var(--space-xl, 2rem);
102
+
103
+ --lc-surface: var(--color-surface, #fff);
104
+ --lc-raised: var(--color-surface-raised, #f5f5f5);
105
+ --lc-text: var(--color-text, #171717);
106
+ --lc-muted: var(--color-text-muted, #5f6368);
107
+ --lc-border: var(--color-border, #d6d6d6);
108
+ --lc-primary: var(--color-primary, #c62828);
109
+ --lc-primary-hover: var(--color-primary-hover, #a61f1f);
110
+ --lc-on-primary: var(--color-on-primary, #fff);
111
+ --lc-warning: var(--color-warning, #8a5a00);
112
+ --lc-danger: var(--color-error, var(--color-danger, #b3261e));
113
+ --lc-success: var(--color-success, #2e7d32);
114
+ }
115
+
116
+ @supports (background: color-mix(in srgb, red, blue)) {
117
+ .lc-theme {
118
+ --lc-raised: var(--color-surface-raised,
119
+ color-mix(in srgb, var(--lc-text) 5%, var(--lc-surface)));
120
+ --lc-warning-bg: color-mix(in srgb, var(--lc-warning) 14%, var(--lc-surface));
121
+ --lc-danger-bg: color-mix(in srgb, var(--lc-danger) 12%, var(--lc-surface));
122
+ }
123
+ }
124
+
125
+ @supports (color: light-dark(#000, #fff)) {
126
+ .lc-theme {
127
+ --lc-surface: var(--color-surface, light-dark(#fff, #1b242c));
128
+ --lc-text: var(--color-text, light-dark(#171717, #d7dee4));
129
+ --lc-muted: var(--color-text-muted, light-dark(#5f6368, #8a99a6));
130
+ --lc-border: var(--color-border, light-dark(#d6d6d6, #2e3a44));
131
+ --lc-primary: var(--color-primary, light-dark(#c62828, #ff8a80));
132
+ --lc-primary-hover: var(--color-primary-hover, light-dark(#a61f1f, #ffb4ab));
133
+ --lc-on-primary: var(--color-on-primary, light-dark(#fff, #171717));
134
+ --lc-warning: var(--color-warning, light-dark(#8a5a00, #f0b429));
135
+ --lc-danger: var(--color-error, var(--color-danger, light-dark(#b3261e, #ff8a80)));
136
+ --lc-success: var(--color-success, light-dark(#2e7d32, #66bb6a));
137
+ }
138
+ }
139
+
95
140
  .login-code-input {
96
141
  display: flex;
97
142
  flex-direction: column;
98
- gap: var(--space-xs, 0.25rem);
99
- margin-bottom: var(--space-base, 1rem);
143
+ gap: var(--lc-space-xs);
144
+ margin-bottom: var(--lc-space);
100
145
  }
101
146
 
102
147
  .login-code-input-label {
103
- color: var(--color-text, #171717);
148
+ color: var(--lc-text);
104
149
  font-size: var(--text-sm, 0.875rem);
105
150
  font-weight: 600;
106
151
  }
107
152
 
108
153
  .login-code-input-field {
109
154
  width: 100%;
110
- padding: var(--space-sm, 0.5rem) var(--space-base, 1rem);
111
- color: var(--color-text, #171717);
155
+ padding: var(--lc-space-sm) var(--lc-space);
156
+ color: var(--lc-text);
112
157
  font-family: ui-monospace, "SFMono-Regular", "Consolas", monospace;
113
158
  font-size: var(--text-xl, 1.25rem);
114
159
  letter-spacing: 0.2em;
115
160
  text-transform: uppercase;
116
- background: var(--color-surface, #fff);
117
- border: 2px solid var(--color-border, #d6d6d6);
161
+ background: var(--lc-surface);
162
+ border: 2px solid var(--lc-border);
118
163
  border-radius: var(--radius-md, 0.375rem);
119
164
  }
120
165
 
121
166
  .login-code-input-field:focus-visible {
122
- outline: 3px solid var(--color-primary, #c62828);
167
+ outline: 2px solid var(--lc-primary);
123
168
  outline-offset: 2px;
124
169
  }
125
170
 
126
171
  .login-code-input-field-invalid {
127
- border-color: var(--color-error, #c62828);
172
+ border-color: var(--lc-danger);
128
173
  }
129
174
 
130
175
  .login-code-input-field:disabled {
131
- color: var(--color-text-muted, #5f6368);
132
- background: var(--color-surface-raised, #f5f5f5);
176
+ color: var(--lc-muted);
177
+ background: var(--lc-raised);
133
178
  cursor: not-allowed;
134
179
  }
135
180
 
136
181
  .login-code-input-error {
137
182
  margin: 0;
138
- color: var(--color-error, #c62828);
183
+ color: var(--lc-danger);
139
184
  font-size: var(--text-sm, 0.875rem);
140
185
  }
141
186
  </style>
@@ -1,6 +1,12 @@
1
1
  <template>
2
- <section class="login-with-code-card" :aria-labelledby="titleId">
3
- <h2 :id="titleId" class="login-with-code-title">{{ copy.title }}</h2>
2
+ <section
3
+ class="login-with-code-card lc-theme"
4
+ :class="variantClass"
5
+ :aria-labelledby="titleId"
6
+ >
7
+ <component :is="titleTag" :id="titleId" class="login-with-code-title">
8
+ {{ copy.title }}
9
+ </component>
4
10
  <p class="login-with-code-instructions">{{ copy.instructions }}</p>
5
11
 
6
12
  <template v-if="!unavailable">
@@ -118,12 +124,16 @@ const props = withDefaults(
118
124
  onSession?: (token: string, user: unknown) => void | Promise<void>;
119
125
  autoStart?: boolean;
120
126
  labels?: Partial<LoginWithCodeCardLabels>;
127
+ variant?: "card" | "plain";
128
+ headingLevel?: 2 | 3 | 4;
121
129
  }>(),
122
130
  {
123
131
  service: undefined,
124
132
  onSession: undefined,
125
133
  autoStart: true,
126
134
  labels: undefined,
135
+ variant: "card",
136
+ headingLevel: 2,
127
137
  },
128
138
  );
129
139
 
@@ -147,6 +157,9 @@ const uid = useId();
147
157
  const titleId = `login-with-code-title-${uid}`;
148
158
  const statusId = `login-with-code-status-${uid}`;
149
159
 
160
+ const titleTag = computed(() => `h${props.headingLevel}` as "h2" | "h3" | "h4");
161
+ const variantClass = computed(() => `login-with-code-card--${props.variant}`);
162
+
150
163
  const copied = ref(false);
151
164
  let copyTimer: ReturnType<typeof setTimeout> | null = null;
152
165
 
@@ -172,9 +185,13 @@ const canCancel = computed(
172
185
  loginCode.status.value === "waiting",
173
186
  );
174
187
 
175
- const canRetry = computed(
176
- () => loginCode.status.value === "error" && !unavailable.value,
177
- );
188
+ const canRetry = computed(() => {
189
+ const status = loginCode.status.value;
190
+ return (
191
+ !unavailable.value &&
192
+ (status === "error" || status === "expired" || status === "cancelled")
193
+ );
194
+ });
178
195
 
179
196
  const statusText = computed(() => {
180
197
  if (unavailable.value) return copy.value.unavailable;
@@ -266,25 +283,73 @@ onUnmounted(() => {
266
283
  </script>
267
284
 
268
285
  <style scoped>
286
+ /* Internal theme layer: host tokens win, theme-aware fallbacks otherwise. */
287
+ .lc-theme {
288
+ --lc-space-xs: var(--space-xs, 0.25rem);
289
+ --lc-space-sm: var(--space-sm, 0.5rem);
290
+ --lc-space: var(--space-base, var(--space-md, 1rem));
291
+ --lc-space-lg: var(--space-lg, 1.5rem);
292
+ --lc-space-xl: var(--space-xl, 2rem);
293
+
294
+ --lc-surface: var(--color-surface, #fff);
295
+ --lc-raised: var(--color-surface-raised, #f5f5f5);
296
+ --lc-text: var(--color-text, #171717);
297
+ --lc-muted: var(--color-text-muted, #5f6368);
298
+ --lc-border: var(--color-border, #d6d6d6);
299
+ --lc-primary: var(--color-primary, #c62828);
300
+ --lc-primary-hover: var(--color-primary-hover, #a61f1f);
301
+ --lc-on-primary: var(--color-on-primary, #fff);
302
+ --lc-warning: var(--color-warning, #8a5a00);
303
+ --lc-danger: var(--color-error, var(--color-danger, #b3261e));
304
+ --lc-success: var(--color-success, #2e7d32);
305
+ }
306
+
307
+ @supports (background: color-mix(in srgb, red, blue)) {
308
+ .lc-theme {
309
+ --lc-raised: var(--color-surface-raised,
310
+ color-mix(in srgb, var(--lc-text) 5%, var(--lc-surface)));
311
+ --lc-warning-bg: color-mix(in srgb, var(--lc-warning) 14%, var(--lc-surface));
312
+ --lc-danger-bg: color-mix(in srgb, var(--lc-danger) 12%, var(--lc-surface));
313
+ }
314
+ }
315
+
316
+ @supports (color: light-dark(#000, #fff)) {
317
+ .lc-theme {
318
+ --lc-surface: var(--color-surface, light-dark(#fff, #1b242c));
319
+ --lc-text: var(--color-text, light-dark(#171717, #d7dee4));
320
+ --lc-muted: var(--color-text-muted, light-dark(#5f6368, #8a99a6));
321
+ --lc-border: var(--color-border, light-dark(#d6d6d6, #2e3a44));
322
+ --lc-primary: var(--color-primary, light-dark(#c62828, #ff8a80));
323
+ --lc-primary-hover: var(--color-primary-hover, light-dark(#a61f1f, #ffb4ab));
324
+ --lc-on-primary: var(--color-on-primary, light-dark(#fff, #171717));
325
+ --lc-warning: var(--color-warning, light-dark(#8a5a00, #f0b429));
326
+ --lc-danger: var(--color-error, var(--color-danger, light-dark(#b3261e, #ff8a80)));
327
+ --lc-success: var(--color-success, light-dark(#2e7d32, #66bb6a));
328
+ }
329
+ }
330
+
269
331
  .login-with-code-card {
270
332
  max-width: 30rem;
271
- padding: clamp(var(--space-base, 1rem), 3vw, var(--space-xl, 2rem));
272
- color: var(--color-text, #171717);
273
- background: var(--color-surface, #fff);
274
- border: 1px solid var(--color-border, #d6d6d6);
333
+ color: var(--lc-text);
334
+ }
335
+
336
+ .login-with-code-card--card {
337
+ padding: clamp(var(--lc-space), 3vw, var(--lc-space-xl));
338
+ background: var(--lc-surface);
339
+ border: 1px solid var(--lc-border);
275
340
  border-radius: var(--radius-lg, 0.5rem);
276
341
  box-shadow: var(--shadow-sm, 0 1px 2px rgb(0 0 0 / 10%));
277
342
  }
278
343
 
279
344
  .login-with-code-title {
280
- margin: 0 0 var(--space-sm, 0.5rem);
345
+ margin: 0 0 var(--lc-space-sm);
281
346
  font-size: var(--text-xl, 1.25rem);
282
347
  line-height: 1.3;
283
348
  }
284
349
 
285
350
  .login-with-code-instructions {
286
- margin: 0 0 var(--space-base, 1rem);
287
- color: var(--color-text-muted, #5f6368);
351
+ margin: 0 0 var(--lc-space);
352
+ color: var(--lc-muted);
288
353
  font-size: var(--text-sm, 0.875rem);
289
354
  }
290
355
 
@@ -292,21 +357,21 @@ onUnmounted(() => {
292
357
  display: flex;
293
358
  flex-direction: column;
294
359
  align-items: center;
295
- gap: var(--space-sm, 0.5rem);
296
- padding: var(--space-base, 1rem);
297
- margin-bottom: var(--space-base, 1rem);
298
- background: var(--color-surface-raised, #f5f5f5);
360
+ gap: var(--lc-space-sm);
361
+ padding: var(--lc-space);
362
+ margin-bottom: var(--lc-space);
363
+ background: var(--lc-raised);
299
364
  border-radius: var(--radius-md, 0.375rem);
300
365
  }
301
366
 
302
367
  .login-with-code-label {
303
368
  margin: 0;
304
- color: var(--color-text-muted, #5f6368);
369
+ color: var(--lc-muted);
305
370
  font-size: var(--text-sm, 0.875rem);
306
371
  }
307
372
 
308
373
  .login-with-code-value {
309
- color: var(--color-text, #171717);
374
+ color: var(--lc-text);
310
375
  font-family: ui-monospace, "SFMono-Regular", "Consolas", monospace;
311
376
  font-size: 2.5rem;
312
377
  font-weight: 700;
@@ -328,43 +393,43 @@ onUnmounted(() => {
328
393
  }
329
394
 
330
395
  .login-with-code-copy {
331
- padding: var(--space-xs, 0.25rem) var(--space-base, 1rem);
332
- color: var(--color-text, #171717);
396
+ padding: var(--lc-space-xs) var(--lc-space);
397
+ color: var(--lc-text);
333
398
  font: inherit;
334
399
  font-size: var(--text-sm, 0.875rem);
335
- background: var(--color-surface, #fff);
336
- border: 1px solid var(--color-border, #d6d6d6);
400
+ background: var(--lc-surface);
401
+ border: 1px solid var(--lc-border);
337
402
  border-radius: var(--radius-sm, 0.25rem);
338
403
  cursor: pointer;
339
404
  }
340
405
 
341
406
  .login-with-code-copy:focus-visible {
342
- outline: 3px solid var(--color-primary, #c62828);
407
+ outline: 2px solid var(--lc-primary);
343
408
  outline-offset: 2px;
344
409
  }
345
410
 
346
411
  .login-with-code-countdown {
347
- margin: 0 0 var(--space-base, 1rem);
348
- color: var(--color-text-muted, #5f6368);
412
+ margin: 0 0 var(--lc-space);
413
+ color: var(--lc-muted);
349
414
  font-size: var(--text-sm, 0.875rem);
350
415
  text-align: center;
351
416
  }
352
417
 
353
418
  .login-with-code-status {
354
- margin: 0 0 var(--space-base, 1rem);
355
- color: var(--color-text, #171717);
419
+ margin: 0 0 var(--lc-space);
420
+ color: var(--lc-text);
356
421
  font-weight: 600;
357
422
  }
358
423
 
359
424
  .login-with-code-actions {
360
425
  display: flex;
361
426
  flex-wrap: wrap;
362
- gap: var(--space-sm, 0.5rem);
427
+ gap: var(--lc-space-sm);
363
428
  align-items: center;
364
429
  }
365
430
 
366
431
  .login-with-code-button {
367
- padding: var(--space-sm, 0.5rem) var(--space-base, 1rem);
432
+ padding: var(--lc-space-sm) var(--lc-space);
368
433
  font: inherit;
369
434
  font-size: var(--text-sm, 0.875rem);
370
435
  border-radius: var(--radius-md, 0.375rem);
@@ -372,31 +437,31 @@ onUnmounted(() => {
372
437
  }
373
438
 
374
439
  .login-with-code-button:focus-visible {
375
- outline: 3px solid var(--color-primary, #c62828);
440
+ outline: 2px solid var(--lc-primary);
376
441
  outline-offset: 2px;
377
442
  }
378
443
 
379
444
  .login-with-code-button-primary {
380
- color: #fff;
381
- background: var(--color-primary, #c62828);
382
- border: 1px solid var(--color-primary, #c62828);
445
+ color: var(--lc-on-primary);
446
+ background: var(--lc-primary);
447
+ border: 1px solid var(--lc-primary);
383
448
  }
384
449
 
385
450
  .login-with-code-button-primary:hover {
386
- background: var(--color-primary-hover, #a61f1f);
387
- border-color: var(--color-primary-hover, #a61f1f);
451
+ background: var(--lc-primary-hover);
452
+ border-color: var(--lc-primary-hover);
388
453
  }
389
454
 
390
455
  .login-with-code-button-secondary {
391
- color: var(--color-text, #171717);
392
- background: var(--color-surface, #fff);
393
- border: 1px solid var(--color-text-muted, #5f6368);
456
+ color: var(--lc-text);
457
+ background: transparent;
458
+ border: 1px solid var(--lc-border);
394
459
  }
395
460
 
396
461
  .login-with-code-button-link {
397
- padding-right: var(--space-xs, 0.25rem);
398
- padding-left: var(--space-xs, 0.25rem);
399
- color: var(--color-primary, #c62828);
462
+ padding-right: var(--lc-space-xs);
463
+ padding-left: var(--lc-space-xs);
464
+ color: var(--lc-primary);
400
465
  background: transparent;
401
466
  border: 1px solid transparent;
402
467
  text-decoration: underline;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devopsplaybook.io/common-web",
3
- "version": "0.14.0-beta.25.5639705",
3
+ "version": "0.14.0-beta.25.e3a770b",
4
4
  "description": "Shared Nuxt layer for DevOpsPlaybook web applications",
5
5
  "license": "ISC",
6
6
  "repository": {
@@ -71,6 +71,7 @@
71
71
  "nuxt": "^4.6.4",
72
72
  "oxlint": "^1.94.0",
73
73
  "pinia": "^4.1.0",
74
+ "postcss": "^8.5.32",
74
75
  "typescript": "^6.0.3",
75
76
  "vitest": "^5.1.1",
76
77
  "vue-tsc": "^3.3.14"