@birdycom/omniaui 0.15.1 → 0.16.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.
Files changed (89) hide show
  1. package/bin/lib/copy-js.mjs +3 -0
  2. package/bin/lib/webicons.mjs +120 -0
  3. package/bin/omniaui.mjs +10 -1
  4. package/dist/carousel.d.ts +2 -0
  5. package/dist/carousel.js +38 -2
  6. package/dist/combobox.d.ts +13 -0
  7. package/dist/combobox.js +143 -0
  8. package/dist/components-extra.css +7 -3
  9. package/dist/components.css +1260 -153
  10. package/dist/components.min.css +1 -1
  11. package/dist/docs-ui.css +1 -1
  12. package/dist/fly.js +13 -2
  13. package/dist/logo.d.ts +14 -0
  14. package/dist/logo.js +98 -0
  15. package/dist/oc-theme.css +1 -1
  16. package/dist/parts/app-0160-apps.css +141 -0
  17. package/dist/parts/app-accordion-accent.css +1 -1
  18. package/dist/parts/app-busy-overlay.css +1 -1
  19. package/dist/parts/app-confirm-dialog.css +4 -18
  20. package/dist/parts/app-cookie-consent.css +1 -1
  21. package/dist/parts/app-data-table-rich.css +1 -1
  22. package/dist/parts/app-mode-badge.css +130 -0
  23. package/dist/parts/app-name-card.css +10 -0
  24. package/dist/parts/app-severity-card.css +4 -3
  25. package/dist/parts/app-sheet-options.css +70 -0
  26. package/dist/parts/app-sidebar-dark.css +1 -1
  27. package/dist/parts/app-sidebar-meta.css +40 -0
  28. package/dist/parts/app-stat-card.css +2 -2
  29. package/dist/parts/app-upgrade-banner.css +1 -1
  30. package/dist/parts/data-chart-line.css +5 -2
  31. package/dist/parts/data-reading.css +2 -1
  32. package/dist/parts/data-stock.css +1 -1
  33. package/dist/parts/forms-affix-input.css +7 -0
  34. package/dist/parts/forms-barcode-input.css +2 -1
  35. package/dist/parts/forms-combobox-icons.css +78 -0
  36. package/dist/parts/forms-language-menu.css +89 -0
  37. package/dist/parts/forms-language-select.css +3 -2
  38. package/dist/parts/forms-phone-input.css +3 -0
  39. package/dist/parts/media-art.css +7 -5
  40. package/dist/parts/media-doc-viewer.css +1 -1
  41. package/dist/parts/media-flip-card.css +1 -1
  42. package/dist/parts/media-glass-liquid.css +14 -0
  43. package/dist/parts/media-glass.css +8 -0
  44. package/dist/parts/media-live-frame.css +58 -0
  45. package/dist/parts/media-logo.css +48 -0
  46. package/dist/parts/media-terminal-log.css +4 -3
  47. package/dist/parts/media-thumb.css +1 -1
  48. package/dist/parts/site-backgrounds.css +1 -1
  49. package/dist/parts/site-base.css +14 -7
  50. package/dist/parts/site-brand-mark.css +1 -1
  51. package/dist/parts/site-cards.css +4 -1
  52. package/dist/parts/site-fact-list.css +1 -1
  53. package/dist/parts/site-fly.css +1 -0
  54. package/dist/parts/site-header-variants.css +6 -1
  55. package/dist/parts/site-layout.css +1 -1
  56. package/dist/parts/site-link-arrow.css +1 -1
  57. package/dist/parts/site-link-row.css +1 -1
  58. package/dist/parts/site-next-teaser.css +2 -2
  59. package/dist/parts/site-paper.css +189 -0
  60. package/dist/parts/site-price-card.css +4 -3
  61. package/dist/parts/site-product-mark.css +1 -1
  62. package/dist/parts/site-project-card.css +13 -8
  63. package/dist/parts/site-stack-list.css +1 -1
  64. package/dist/parts/site-timeline.css +1 -1
  65. package/dist/parts/utility-hover.css +4 -3
  66. package/dist/showcase.css +74 -28
  67. package/dist/theme.js +130 -0
  68. package/manifest.json +40 -0
  69. package/package.json +5 -2
  70. package/snippets/card.html +4 -1
  71. package/snippets/code-plate.html +10 -0
  72. package/snippets/collapsible.html +2 -2
  73. package/snippets/combobox.html +19 -0
  74. package/snippets/context-menu.html +5 -2
  75. package/snippets/definition-list.html +1 -1
  76. package/snippets/dropdown-menu.html +1 -0
  77. package/snippets/language-select.html +15 -0
  78. package/snippets/live-frame.html +3 -1
  79. package/snippets/logo.html +10 -0
  80. package/snippets/mode-badge.html +12 -0
  81. package/snippets/next-teaser.html +1 -1
  82. package/snippets/page-sections.html +1 -1
  83. package/snippets/paper.html +32 -0
  84. package/snippets/project-card.html +4 -4
  85. package/snippets/sheet.html +4 -0
  86. package/snippets/shot-grid.html +2 -2
  87. package/snippets/sidebar.html +2 -0
  88. package/snippets/timeline.html +1 -1
  89. package/snippets/webicon.html +11 -0
package/dist/docs-ui.css CHANGED
@@ -66,7 +66,7 @@
66
66
  .oc-toc-title { margin: 1rem 0 0.5rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--oc-muted-foreground); }
67
67
  .oc-toc-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
68
68
  /* Label above a group of links (Articles, Annexes): a <p> between two lists, or an <li> inside one list. */
69
- .oc-toc-group-label { margin: 1.25rem 0 0.4rem; padding-inline: 0.5rem; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--oc-subtle-foreground, var(--oc-muted-foreground)); }
69
+ .oc-toc-group-label { margin: 1.25rem 0 0.4rem; padding-inline: 0.5rem; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--oc-muted-foreground); }
70
70
  .oc-toc-group-label:first-child { margin-block-start: 0; }
71
71
  .oc-toc-link {
72
72
  display: block;
package/dist/fly.js CHANGED
@@ -37,15 +37,26 @@ function num(value, unitS = false) {
37
37
  return unitS && /\ds$/.test(v) ? n * 1000 : n;
38
38
  }
39
39
 
40
+ /** Free space left and right of the card inside its parent (layout position, so a running fly-in does not count). */
41
+ export function sideRoom(card) {
42
+ const parent = card.parentElement;
43
+ if (!parent) return { left: 0, right: 0 };
44
+ const left = card.offsetParent === parent ? card.offsetLeft : card.offsetLeft - parent.offsetLeft;
45
+ return { left: Math.max(0, left), right: Math.max(0, parent.clientWidth - left - card.offsetWidth) };
46
+ }
47
+
40
48
  /**
41
49
  * data-oc-fly-random: a new random delay (0 to the value of the attribute, default 700ms) and a random start offset
42
- * (left or right, up to two steps or 90px), so the cards of one row do not move together.
50
+ * (left or right, up to two steps or 90px, never outside the parent), so the cards of one row do not move together.
43
51
  */
44
52
  function shuffle(card, holder, step) {
45
53
  const max = num(holder.getAttribute("data-oc-fly-random")) || 700;
46
54
  const reach = Math.max(step * 2, 90);
55
+ // The hidden card stays inside its parent: no sideways start in a single column, so the page never scrolls sideways.
56
+ const { left, right } = sideRoom(card);
57
+ const x = Math.random() < 0.5 ? -Math.random() * Math.min(reach, left) : Math.random() * Math.min(reach, right);
47
58
  card.style.setProperty("--oc-fly-delay", `${Math.round(Math.random() * max)}ms`);
48
- card.style.setProperty("--oc-fly-x", `${Math.round((Math.random() * 2 - 1) * reach)}px`);
59
+ card.style.setProperty("--oc-fly-x", `${Math.round(x)}px`);
49
60
  }
50
61
 
51
62
  /** Let every .oc-reveal--fly under scope fly in once it comes into view. Returns a function that stops watching. */
package/dist/logo.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ // File: packages/ui/src/logo.d.ts
2
+ // Types for the logo plate measuring (.oc-logo[data-plate="auto"]).
3
+
4
+ export type LogoPlate = "light" | "dark" | "both" | "none";
5
+ /** Relative luminance (WCAG) of an sRGB color, channels 0 to 255. */
6
+ export function luminance(r: number, g: number, b: number): number;
7
+ /** Which theme needs a plate, from RGBA pixel data. */
8
+ export function plateFromPixels(data: ArrayLike<number>): LogoPlate;
9
+ /** Measures an image URL once (cached). Another origin without CORS resolves "none". */
10
+ export function measureLogo(src: string): Promise<LogoPlate>;
11
+ /** Measures one .oc-logo[data-plate="auto"] and writes data-plate. */
12
+ export function bindLogo(root: HTMLElement): Promise<void>;
13
+ /** Measures every .oc-logo[data-plate="auto"] in scope. */
14
+ export function initLogos(scope?: ParentNode): Promise<void[]>;
package/dist/logo.js ADDED
@@ -0,0 +1,98 @@
1
+ // File: packages/ui/src/logo.js
2
+ // Map: luminance of a pixel -> plate from the pixels (pure, testable) -> measure an image once (canvas, cached)
3
+ // -> bind one .oc-logo[data-plate="auto"] -> init -> boot
4
+ // Logo: an uploaded logo is shown as it is (own colors, own ratio, never filtered). Only where it would disappear does it
5
+ // get a calm neutral plate: a (nearly) white logo in the light theme, a dark logo in the dark theme. This script looks at
6
+ // the pixels once per image and writes the answer in data-plate ("light", "dark", "both" or "none"); the CSS does the
7
+ // rest. The image must come from the same origin (or send CORS headers), otherwise the canvas cannot be read and the
8
+ // logo stays without a plate. Set data-plate by hand ("light" / "dark" / "both" / "none") to skip the measuring.
9
+
10
+ /** Relative luminance (WCAG) of an sRGB color with channels 0 to 255. */
11
+ export function luminance(r, g, b) {
12
+ const lin = (v) => { const c = v / 255; return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4; };
13
+ return 0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b);
14
+ }
15
+
16
+ /**
17
+ * Which theme needs a plate, from RGBA pixel data (Uint8ClampedArray, 4 bytes per pixel):
18
+ * "light" = the logo is mostly white (a plate in the light theme), "dark" = a large part is too dark for a dark page
19
+ * (a plate in the dark theme), "both" = it has both, "none" = it reads on both, or it brings its own background.
20
+ */
21
+ export function plateFromPixels(data) {
22
+ let seen = 0, opaque = 0, whiteish = 0, darkish = 0;
23
+ const total = data.length / 4;
24
+ for (let i = 0; i < data.length; i += 4) {
25
+ const alpha = data[i + 3] / 255;
26
+ if (alpha > 0.95) opaque++;
27
+ if (alpha < 0.5) continue;
28
+ seen++;
29
+ const l = luminance(data[i], data[i + 1], data[i + 2]);
30
+ // Contrast with a white page below 1.35:1 = disappears in the light theme; with a dark page below 2.5:1 = in the dark.
31
+ if (1.05 / (l + 0.05) < 1.35) whiteish++;
32
+ if ((l + 0.05) / 0.06 < 2.5) darkish++;
33
+ }
34
+ // Nothing visible, or a logo on its own opaque background: it is its own plate.
35
+ if (!seen || opaque / total > 0.9) return "none";
36
+ const white = whiteish / seen, dark = darkish / seen;
37
+ if (white > 0.2 && dark > 0.2) return "both";
38
+ if (white > 0.5) return "light";
39
+ if (dark > 0.25) return "dark";
40
+ return "none";
41
+ }
42
+
43
+ const cache = new Map();
44
+
45
+ /** Measures an image URL once (cached per URL). Resolves "light" | "dark" | "both" | "none". */
46
+ export function measureLogo(src) {
47
+ if (!src) return Promise.resolve("none");
48
+ if (cache.has(src)) return cache.get(src);
49
+ const job = new Promise((done) => {
50
+ const img = new Image();
51
+ img.crossOrigin = "anonymous";
52
+ img.decoding = "async";
53
+ img.onload = () => {
54
+ try {
55
+ const w = 64, h = Math.max(1, Math.round((64 * img.naturalHeight) / Math.max(1, img.naturalWidth)));
56
+ const canvas = document.createElement("canvas");
57
+ canvas.width = w;
58
+ canvas.height = h;
59
+ const g = canvas.getContext("2d", { willReadFrequently: true });
60
+ if (!g) return done("none");
61
+ g.drawImage(img, 0, 0, w, h);
62
+ done(plateFromPixels(g.getImageData(0, 0, w, h).data));
63
+ } catch {
64
+ done("none"); // another origin without CORS: the canvas is locked
65
+ }
66
+ };
67
+ img.onerror = () => done("none");
68
+ img.src = src;
69
+ });
70
+ cache.set(src, job);
71
+ return job;
72
+ }
73
+
74
+ /** Measures one .oc-logo[data-plate="auto"] and writes the answer in data-plate. */
75
+ export async function bindLogo(root) {
76
+ const img = root.querySelector("img");
77
+ if (!img || root.dataset.plate !== "auto") return;
78
+ root.dataset.plate = await measureLogo(img.currentSrc || img.src);
79
+ }
80
+
81
+ /** Measures every .oc-logo[data-plate="auto"] in scope. */
82
+ export function initLogos(scope = document) {
83
+ return Promise.all([...scope.querySelectorAll('.oc-logo[data-plate="auto"]')].map(bindLogo));
84
+ }
85
+
86
+ // Starts on its own as /js/oc-logo.js (`npx omniaui copy-js logo`), with ?auto in the URL or data-oc-auto on the tag.
87
+ function autoStart() {
88
+ if (typeof document === "undefined") return false;
89
+ const url = String(import.meta.url);
90
+ if (url.includes("oc-logo") || /[?&]auto(=|&|$)/.test(url)) return true;
91
+ const file = url.split(/[?#]/)[0];
92
+ return [...document.querySelectorAll("script[data-oc-auto][src]")].some((s) => s.src.split(/[?#]/)[0] === file);
93
+ }
94
+ if (autoStart()) {
95
+ const boot = () => initLogos(document);
96
+ if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", boot);
97
+ else boot();
98
+ }
package/dist/oc-theme.css CHANGED
@@ -1,4 +1,4 @@
1
- /* File: oc-theme.css — generated from tokens/semantic.json by @birdycom/omniacss 0.15.1. Do not edit. */
1
+ /* File: oc-theme.css — generated from tokens/semantic.json by @birdycom/omniacss 0.16.1. Do not edit. */
2
2
  /* Semantic theme tokens: every color is light-dark() of an Omnia palette token (oc-colors.css). */
3
3
  /* Same source as the desktop export: npx omniacss tokens --format json|dtcg|python */
4
4
  :root {
@@ -0,0 +1,141 @@
1
+ /* File: packages/ui/src/parts/app-0160-apps.css
2
+ Map: card tone (accent border + bar) -> card footer (divider, end) + card fill -> status badge -> status list
3
+ -> light / dark image -> card grid that scrolls sideways on a phone -> theme scope accents
4
+ Small additions asked for by the apps that use OmniaUI (0.16.0). Theme tokens only. */
5
+
6
+ /* Card tone: a card that asks for attention, with a border in the tone and a bar on the start side.
7
+ <article class="oc-card" data-tone="primary | info | success | warning | destructive">. */
8
+ .oc-card[data-tone] {
9
+ --oc-card-tone: var(--oc-primary);
10
+ border-color: color-mix(in oklch, var(--oc-card-tone) 45%, var(--oc-card-border, var(--oc-border)));
11
+ box-shadow: inset 3px 0 0 var(--oc-card-tone);
12
+ }
13
+ .oc-card[data-tone]:dir(rtl) { box-shadow: inset -3px 0 0 var(--oc-card-tone); }
14
+ .oc-card[data-tone="info"] { --oc-card-tone: var(--oc-info, var(--oc-primary)); }
15
+ .oc-card[data-tone="success"] { --oc-card-tone: var(--oc-success); }
16
+ .oc-card[data-tone="warning"] { --oc-card-tone: var(--oc-warning); }
17
+ .oc-card[data-tone="destructive"] { --oc-card-tone: var(--oc-destructive); }
18
+
19
+ /* Card footer: a line above it (--divider) and the actions on the end side (--end).
20
+ Card fill: the card takes the full height of its grid or flex cell and the footer stays at the bottom. */
21
+ .oc-card-footer--divider { border-block-start: 1px solid var(--oc-card-border, var(--oc-border)); }
22
+ .oc-card-footer--end { justify-content: flex-end; }
23
+ .oc-card--fill { display: flex; flex-direction: column; block-size: 100%; }
24
+ .oc-card--fill > .oc-card-content { flex-grow: 1; }
25
+ .oc-card--fill > .oc-card-footer { margin-block-start: auto; }
26
+
27
+ /* Status badge: a badge in the color of the status dot with the same name.
28
+ <span class="oc-badge oc-badge--status" data-status="working | waiting | done | error | idle">Working</span> */
29
+ .oc-badge--status {
30
+ --oc-badge-status: var(--oc-muted-foreground);
31
+ gap: 0.4rem;
32
+ border-color: oklch(from var(--oc-badge-status) l c h / 0.4);
33
+ background: oklch(from var(--oc-badge-status) l c h / 0.14);
34
+ color: color-mix(in oklch, var(--oc-badge-status) 65%, var(--oc-foreground));
35
+ }
36
+ .oc-badge--status[data-status="working"] { --oc-badge-status: var(--oc-info, var(--oc-primary)); }
37
+ .oc-badge--status[data-status="waiting"] { --oc-badge-status: var(--oc-warning); }
38
+ .oc-badge--status[data-status="done"] { --oc-badge-status: var(--oc-success); }
39
+ .oc-badge--status[data-status="error"] { --oc-badge-status: var(--oc-destructive); }
40
+ .oc-badge--status[data-status="idle"] { border-color: var(--oc-border); background: transparent; }
41
+
42
+ /* Status list: one quiet line per item (dot, name, muted meta that cuts off), with a small heading above it.
43
+ <section class="oc-status-list"><h3 class="oc-status-list__head">2 idle</h3>
44
+ <ul><li class="oc-status-list__item"><span class="oc-status-dot oc-status-dot--idle"></span>
45
+ <span class="oc-status-list__name">Name</span><span class="oc-status-list__meta">meta</span></li></ul></section> */
46
+ .oc-status-list { display: grid; gap: 0.35rem; min-inline-size: 0; }
47
+ .oc-status-list > :is(ul, ol) { display: grid; gap: 0.15rem; margin: 0; padding: 0; list-style: none; }
48
+ .oc-status-list__head {
49
+ margin: 0;
50
+ color: var(--oc-muted-foreground);
51
+ font-size: 0.6875rem;
52
+ font-weight: 600;
53
+ letter-spacing: 0.06em;
54
+ text-transform: uppercase;
55
+ }
56
+ .oc-status-list__item {
57
+ display: flex;
58
+ align-items: center;
59
+ gap: 0.5rem;
60
+ min-inline-size: 0;
61
+ padding-block: 0.2rem;
62
+ font-size: 0.8125rem;
63
+ line-height: 1.3;
64
+ }
65
+ .oc-status-list__name { flex: none; max-inline-size: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
66
+ .oc-status-list__meta { flex: 1 1 0; min-inline-size: 0; overflow: hidden; color: var(--oc-muted-foreground); text-overflow: ellipsis; white-space: nowrap; }
67
+ .oc-status-list--dim .oc-status-list__item { opacity: 0.75; }
68
+
69
+ /* Light / dark image: two images, the one for the chosen theme is shown.
70
+ <img class="oc-theme-img--light" …><img class="oc-theme-img--dark" …> (also on <picture> or any element).
71
+ Follows the operating system, <html data-theme>, .dark and a .oc-theme-switch on the page. */
72
+ .oc-theme-img--dark { display: none; }
73
+ @media (prefers-color-scheme: dark) {
74
+ .oc-theme-img--light { display: none; }
75
+ .oc-theme-img--dark { display: revert; }
76
+ }
77
+ :is([data-theme="light"], :root:has(.oc-theme-switch input[value="light"]:checked:not(.oc-theme-scope *))) .oc-theme-img--light { display: revert; }
78
+ :is([data-theme="light"], :root:has(.oc-theme-switch input[value="light"]:checked:not(.oc-theme-scope *))) .oc-theme-img--dark { display: none; }
79
+ :is([data-theme="dark"], .dark, :root:has(.oc-theme-switch input[value="dark"]:checked:not(.oc-theme-scope *))) .oc-theme-img--light { display: none; }
80
+ :is([data-theme="dark"], .dark, :root:has(.oc-theme-switch input[value="dark"]:checked:not(.oc-theme-scope *))) .oc-theme-img--dark { display: revert; }
81
+
82
+ /* Card grid that scrolls sideways on a phone instead of stacking every card: one row with scroll snap.
83
+ <div class="oc-card-grid oc-card-grid--scroll">. --oc-card-scroll-width is the width of a card (80%). */
84
+ @media (max-width: 40rem) {
85
+ .oc-card-grid--scroll {
86
+ grid-template-columns: none;
87
+ grid-auto-flow: column;
88
+ grid-auto-columns: var(--oc-card-scroll-width, 80%);
89
+ overflow-x: auto;
90
+ overscroll-behavior-x: contain;
91
+ scroll-snap-type: inline mandatory;
92
+ scroll-padding-inline: var(--oc-card-scroll-pad, 0px);
93
+ /* Room for the hover lift and the focus ring, which the scroll box would cut. */
94
+ padding-block: 0.5rem;
95
+ scrollbar-width: thin;
96
+ }
97
+ .oc-card-grid--scroll > * { scroll-snap-align: start; }
98
+ }
99
+
100
+ /* A theme scope that sets its own brand colors: the accents follow them (the :root values were computed from the
101
+ brand colors of the page). :where() keeps an .oc-accent--* preset on the same element in charge. */
102
+ :where(.oc-theme-scope) {
103
+ --oc-accent-from: var(--oc-brand-1);
104
+ --oc-accent-to: var(--oc-brand-2);
105
+ }
106
+
107
+ /* Theme switch as cards (a settings page): three large choices with the icon above the label; the chosen card has a
108
+ border in the primary color. <fieldset class="oc-theme-switch oc-theme-switch--cards">, same radios as the switch. */
109
+ .oc-theme-switch--cards {
110
+ display: grid;
111
+ grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr));
112
+ gap: 0.75rem;
113
+ padding: 0;
114
+ border: 0;
115
+ border-radius: 0;
116
+ background: none;
117
+ }
118
+ .oc-theme-switch--cards label {
119
+ flex-direction: column;
120
+ justify-content: center;
121
+ gap: 0.5rem;
122
+ padding: 1.1rem 0.75rem;
123
+ border: 1px solid var(--oc-border);
124
+ border-radius: calc(var(--oc-radius) + 4px);
125
+ background: var(--oc-card);
126
+ color: var(--oc-muted-foreground);
127
+ font-size: 0.875rem;
128
+ font-weight: 500;
129
+ transition: border-color var(--oc-transition-fast, 0.15s), color var(--oc-transition-fast, 0.15s);
130
+ }
131
+ .oc-theme-switch--cards label:hover { border-color: var(--oc-border-strong, var(--oc-border)); color: var(--oc-foreground); }
132
+ .oc-theme-switch--cards label:has(input:checked) {
133
+ border-color: var(--oc-primary);
134
+ background: var(--oc-card);
135
+ color: var(--oc-foreground);
136
+ box-shadow: 0 0 0 1px var(--oc-primary);
137
+ }
138
+ .oc-theme-switch--cards label > :is(iconify-icon, svg) { inline-size: 1.75rem; block-size: 1.75rem; font-size: 1.75rem; }
139
+ @media (prefers-reduced-motion: reduce) {
140
+ .oc-theme-switch--cards label { transition: none; }
141
+ }
@@ -42,7 +42,7 @@
42
42
  .oc-accordion--accent .oc-accordion-content { padding: 0.75rem 1rem 1rem; color: var(--oc-foreground); }
43
43
 
44
44
  /* Optional short label at the end of the trigger ("3 items"), in the accent color. */
45
- .oc-accordion-accent-meta { margin-inline: auto 0.75rem; font-size: 0.75rem; font-weight: 500; color: var(--oc-accordion-accent); }
45
+ .oc-accordion-accent-meta { margin-inline: auto 0.75rem; font-size: 0.75rem; font-weight: 500; color: color-mix(in oklch, var(--oc-accordion-accent) 80%, var(--oc-foreground)); }
46
46
 
47
47
  /* Semantic colors (theme tokens), as an alternative to the .oc-accent--* presets. */
48
48
  .oc-accordion--accent .oc-accordion-item--success,
@@ -1,6 +1,6 @@
1
1
  /* File: packages/ui/src/parts/app-busy-overlay.css | Map: dialog + backdrop -> box -> spinner / progress -> title + text -> motion
2
2
  Busy overlay: a modal <dialog closedby="none"> shown while a long request runs (saving, uploading, processing photos).
3
- The modal dialog makes the page inert, so nothing can be clicked twice. Based on the Verdavita admin save overlay. */
3
+ The modal dialog makes the page inert, so nothing can be clicked twice. */
4
4
 
5
5
  .oc-busy-overlay {
6
6
  inline-size: min(100vw - 2rem, 24rem);
@@ -21,24 +21,10 @@
21
21
  }
22
22
  .oc-alert-dialog--confirm .oc-alert-dialog-icon svg { inline-size: 2.25rem; block-size: 2.25rem; }
23
23
 
24
- /* Close (X) in the top corner. Use command="close" commandfor="<dialog id>". */
25
- .oc-alert-dialog-close {
26
- position: absolute;
27
- inset-block-start: 0.75rem;
28
- inset-inline-end: 0.75rem;
29
- display: grid;
30
- place-items: center;
31
- inline-size: 2rem;
32
- block-size: 2rem;
33
- padding: 0;
34
- font-size: 1.25rem;
35
- line-height: 1;
36
- color: var(--oc-muted-foreground);
37
- background: none;
38
- border: 0;
39
- border-radius: var(--oc-radius);
40
- cursor: pointer;
41
- }
24
+ /* Close (X) in the top corner. Use command="close" commandfor="<dialog id>". The square button, the centred cross
25
+ (mask of mdi:close; a literal "×" in the markup is hidden) and the tokens --oc-close-size / --oc-close-icon /
26
+ .oc-close--round are shared with .oc-sheet-close in components.css; only the position differs here. */
27
+ .oc-alert-dialog-close { inset-block-start: 0.75rem; inset-inline-end: 0.75rem; }
42
28
  .oc-alert-dialog-close:hover { color: var(--oc-foreground); background: var(--oc-accent); }
43
29
  .oc-alert-dialog-close:focus-visible { outline: 2px solid var(--oc-ring); outline-offset: 1px; }
44
30
 
@@ -1,7 +1,7 @@
1
1
  /* File: packages/ui/src/parts/app-cookie-consent.css | Map: popover box (corner / bar) -> text -> preferences (details)
2
2
  -> category rows -> actions -> entry animation -> small screens
3
3
  Cookie consent: a non-modal popover="manual" in the top layer, so it never blocks the page. Categories are rows with
4
- the switch component; "necessary" is locked on. Based on the cookie banner of the Verdavita site. */
4
+ the switch component; "necessary" is locked on. Based on the cookie banner of a production site. */
5
5
 
6
6
  .oc-cookie-consent {
7
7
  position: fixed;
@@ -70,7 +70,7 @@
70
70
  .oc-data-table-tabs [aria-selected="true"] .oc-data-table-tab-count { color: var(--oc-primary); background: oklch(from var(--oc-primary) l c h / 0.12); }
71
71
  /* A count in the color of its type (the same tone as the type badge in the table). */
72
72
  .oc-data-table-tab-count:is(.oc-data-table-tab-count--success, .oc-data-table-tab-count--info, .oc-data-table-tab-count--warning) {
73
- color: var(--oc-tab-tone);
73
+ color: color-mix(in oklch, var(--oc-tab-tone) 55%, var(--oc-foreground));
74
74
  background: oklch(from var(--oc-tab-tone) l c h / 0.12);
75
75
  box-shadow: inset 0 0 0 1px oklch(from var(--oc-tab-tone) l c h / 0.35);
76
76
  }
@@ -0,0 +1,130 @@
1
+ /* File: packages/ui/src/parts/app-mode-badge.css
2
+ Map: mode tokens -> mode badge (test, live, both as two parts; sizes) -> card accent (border + band in the tone)
3
+ -> code plate (a white plate around a QR code or barcode, caption on the plate) -> print -> forced colors
4
+ Test and live apart at a glance: a mode badge in fixed colors (the same in light and dark mode, also on a photo or a
5
+ print), a card with a colored band for a set that belongs to one mode, and a caption on the white plate of a code.
6
+ Mode colors: --oc-mode-test (amber) and --oc-mode-live (green), with dark text (--oc-mode-ink). Flat colors only. */
7
+
8
+ :root {
9
+ --oc-mode-test: var(--color-orange-20);
10
+ --oc-mode-live: var(--color-green-10);
11
+ --oc-mode-ink: var(--color-duskblue-90);
12
+ }
13
+
14
+ /* Mode badge: <span class="oc-mode-badge" data-mode="test">Test</span>. Both: two parts side by side,
15
+ <span class="oc-mode-badge" data-mode="both"><span>Test</span><span>Live</span></span>. */
16
+ .oc-mode-badge {
17
+ --oc-mode: var(--oc-mode-test);
18
+ display: inline-flex;
19
+ flex: none;
20
+ align-items: stretch;
21
+ overflow: hidden;
22
+ padding: 0.2rem 0.6rem;
23
+ border-radius: 999px;
24
+ background: var(--oc-mode);
25
+ color: var(--oc-mode-ink);
26
+ font-size: 0.75rem;
27
+ font-weight: 800;
28
+ line-height: 1.3;
29
+ letter-spacing: 0.1em;
30
+ text-transform: uppercase;
31
+ white-space: nowrap;
32
+ vertical-align: middle;
33
+ }
34
+ .oc-mode-badge[data-mode="live"] { --oc-mode: var(--oc-mode-live); }
35
+ .oc-mode-badge[data-mode="both"] { padding: 0; background: none; }
36
+ .oc-mode-badge[data-mode="both"] > * { padding: 0.2rem 0.6rem; background: var(--oc-mode-test); }
37
+ .oc-mode-badge[data-mode="both"] > * + * { background: var(--oc-mode-live); }
38
+ .oc-mode-badge--sm { font-size: 0.625rem; }
39
+ .oc-mode-badge--sm:not([data-mode="both"]),
40
+ .oc-mode-badge--sm[data-mode="both"] > * { padding: 0.1rem 0.45rem; }
41
+ .oc-mode-badge--lg { font-size: 1rem; letter-spacing: 0.12em; }
42
+ .oc-mode-badge--lg:not([data-mode="both"]),
43
+ .oc-mode-badge--lg[data-mode="both"] > * { padding: 0.35rem 0.9rem; }
44
+
45
+ /* Card accent: the card belongs to one tone or mode. A 2px border in that color and, optionally, a band at the top
46
+ (.oc-card-band) on a soft background with a label, a title and a status. data-tone: primary, info, success,
47
+ warning, destructive, test, live. data-active="false" marks a set that is not in use now (dashed, calm band). */
48
+ .oc-card.oc-card--accent {
49
+ --oc-card-tone: var(--oc-primary);
50
+ overflow: clip;
51
+ padding: 0; /* the band runs to the border; the content keeps its own padding (.oc-card-content) */
52
+ border: 2px solid var(--oc-card-tone);
53
+ box-shadow: none;
54
+ }
55
+ .oc-card.oc-card--accent[data-tone] { box-shadow: none; } /* no start bar of the plain tone card, also not right-to-left */
56
+ .oc-card--accent[data-tone="info"] { --oc-card-tone: var(--oc-info, var(--oc-primary)); }
57
+ .oc-card--accent[data-tone="success"] { --oc-card-tone: var(--oc-success); }
58
+ .oc-card--accent[data-tone="warning"] { --oc-card-tone: var(--oc-warning); }
59
+ .oc-card--accent[data-tone="destructive"] { --oc-card-tone: var(--oc-destructive); }
60
+ .oc-card--accent[data-tone="test"] { --oc-card-tone: var(--oc-mode-test); }
61
+ .oc-card--accent[data-tone="live"] { --oc-card-tone: var(--oc-mode-live); }
62
+ /* A fixed minimum height (--oc-card-band-min-h), so the band of two cards side by side is equally high with or without a
63
+ status, and does not jump when the status comes or goes. */
64
+ .oc-card-band {
65
+ display: flex;
66
+ flex-wrap: wrap;
67
+ align-items: center;
68
+ align-content: center;
69
+ gap: 0.5rem 0.75rem;
70
+ min-block-size: var(--oc-card-band-min-h, 4.25rem);
71
+ padding: 0.75rem 1rem;
72
+ background: color-mix(in oklab, var(--oc-card-tone, var(--oc-primary)) 14%, var(--oc-card));
73
+ border-block-end: 1px solid color-mix(in oklab, var(--oc-card-tone, var(--oc-primary)) 50%, transparent);
74
+ }
75
+ .oc-card-band:last-child { border-block-end: 0; }
76
+ .oc-card-band__title { flex: 1 1 12rem; min-inline-size: 0; margin: 0; font-size: 0.9375rem; font-weight: 600; color: var(--oc-foreground); }
77
+ .oc-card-band__title small { display: block; font-size: 0.8125rem; font-weight: 400; color: var(--oc-muted-foreground); }
78
+ .oc-card--accent[data-active="false"] { border-style: dashed; }
79
+ .oc-card--accent[data-active="false"] .oc-card-band { background: var(--oc-surface); }
80
+
81
+ /* Code plate: a QR code or barcode on its own white plate, always light (scans in any theme and on paper), with an
82
+ optional caption ON the plate, so the label is on a photo or a print too. data-mode / data-tone colors the caption. */
83
+ .oc-code-plate {
84
+ color-scheme: light;
85
+ display: inline-grid;
86
+ justify-items: stretch;
87
+ gap: 0.3rem;
88
+ margin: 0;
89
+ padding: 0.375rem;
90
+ border: 1px solid var(--oc-border);
91
+ border-radius: calc(var(--oc-radius) + 2px);
92
+ background: var(--color-white-50);
93
+ color: var(--color-duskblue-90);
94
+ vertical-align: top;
95
+ }
96
+ .oc-code-plate > :is(img, svg, canvas, .oc-barcode) { display: block; inline-size: 100%; block-size: auto; max-inline-size: 100%; }
97
+ .oc-code-plate__caption {
98
+ display: block;
99
+ padding: 0.15rem 0.4rem;
100
+ border-radius: calc(var(--oc-radius) - 2px);
101
+ background: var(--color-frostblue-10);
102
+ color: var(--color-duskblue-90);
103
+ font-size: 0.875rem;
104
+ font-weight: 800;
105
+ line-height: 1.25;
106
+ letter-spacing: 0.12em;
107
+ text-align: center;
108
+ text-transform: uppercase;
109
+ white-space: nowrap;
110
+ }
111
+ .oc-code-plate[data-mode="test"] .oc-code-plate__caption { background: var(--oc-mode-test); }
112
+ .oc-code-plate[data-mode="live"] .oc-code-plate__caption { background: var(--oc-mode-live); }
113
+ .oc-code-plate[data-mode="both"] .oc-code-plate__caption { display: flex; padding: 0; overflow: hidden; }
114
+ .oc-code-plate[data-mode="both"] .oc-code-plate__caption > * { flex: 1 1 0; padding: 0.15rem 0.4rem; background: var(--oc-mode-test); }
115
+ .oc-code-plate[data-mode="both"] .oc-code-plate__caption > * + * { background: var(--oc-mode-live); }
116
+ .oc-code-plate--sm { padding: 0.2rem; }
117
+ .oc-code-plate--sm .oc-code-plate__caption { font-size: 0.5625rem; letter-spacing: 0.06em; padding-block: 0.05rem; }
118
+
119
+ @media print {
120
+ .oc-mode-badge,
121
+ .oc-mode-badge > *,
122
+ .oc-card--accent,
123
+ .oc-card-band,
124
+ .oc-code-plate__caption,
125
+ .oc-code-plate__caption > * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
126
+ }
127
+ @media (forced-colors: active) {
128
+ .oc-mode-badge,
129
+ .oc-mode-badge[data-mode="both"] > * { border: 1px solid CanvasText; }
130
+ }
@@ -60,6 +60,16 @@
60
60
  .oc-name-card__body > .oc-name-card { background: var(--oc-surface); }
61
61
  .oc-name-card--total > .oc-name-card__head .oc-name-card__amount { color: var(--oc-primary); }
62
62
 
63
+ /* Narrow card (a phone, a side column): the quiet meta moves to a second line under the name and the
64
+ nested cards get less indent, so name, amount and delete button still fit on one line. */
65
+ .oc-name-card { container-type: inline-size; }
66
+ @container (max-width: 26rem) {
67
+ .oc-name-card__head { flex-wrap: wrap; row-gap: 0; }
68
+ .oc-name-card__meta { order: 9; flex-basis: 100%; padding-inline-start: 1.5rem; margin-block-start: -0.25rem; }
69
+ .oc-name-card__title { flex: 1 1 0; } /* takes the free space and shrinks first (ellipsis), so nothing else wraps */
70
+ .oc-name-card__body { padding-inline-start: 0.75rem; }
71
+ }
72
+
63
73
  @media (prefers-reduced-motion: reduce) {
64
74
  .oc-name-card__head::before { transition: none; }
65
75
  }
@@ -35,7 +35,7 @@
35
35
  .oc-severity-card-icon { display: inline-flex; flex-shrink: 0; color: var(--oc-severity-color); }
36
36
  .oc-severity-card-icon svg { inline-size: 1.25rem; block-size: 1.25rem; }
37
37
  .oc-severity-card-main { flex: 1; min-inline-size: 0; }
38
- .oc-severity-card-title { display: block; overflow: hidden; font-size: 0.875rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; color: var(--oc-severity-color); }
38
+ .oc-severity-card-title { display: block; overflow: hidden; font-size: 0.875rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; color: color-mix(in oklch, var(--oc-severity-color) 80%, var(--oc-foreground)); }
39
39
  /* Tags under the title (data types, categories). */
40
40
  .oc-severity-card-tags { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-block-start: 0.375rem; }
41
41
  .oc-severity-card-tag { padding: 0.125rem 0.375rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.6875rem; color: var(--oc-muted-foreground); background: var(--oc-muted); border-radius: 4px; }
@@ -48,7 +48,8 @@
48
48
  font-weight: 700;
49
49
  letter-spacing: 0.04em;
50
50
  text-transform: uppercase;
51
- color: var(--oc-severity-color);
51
+ /* the tone mixed toward the text color: still the tone, but readable (4.5:1) on its own tint in light and dark */
52
+ color: color-mix(in oklch, var(--oc-severity-color) 60%, var(--oc-foreground));
52
53
  background: oklch(from var(--oc-severity-color) l c h / 0.14);
53
54
  border: 1px solid oklch(from var(--oc-severity-color) l c h / 0.35);
54
55
  border-radius: 999px;
@@ -83,7 +84,7 @@
83
84
  .oc-severity-card--medium { --oc-severity-color: var(--oc-warning); }
84
85
  .oc-severity-card--high { --oc-severity-color: var(--oc-destructive); }
85
86
  .oc-severity-card--critical { --oc-severity-color: light-dark(var(--color-red-95), var(--color-red-30)); }
86
- .oc-severity-card--critical .oc-severity-card-level { color: var(--oc-destructive-foreground); background: var(--oc-severity-color); }
87
+ .oc-severity-card--critical .oc-severity-card-level { color: light-dark(var(--color-white-50), var(--color-black-60)); background: var(--oc-severity-color); }
87
88
 
88
89
  /* Resolved: back to neutral colors, title struck through. */
89
90
  .oc-severity-card.is-resolved { --oc-severity-color: var(--oc-muted-foreground); background: var(--oc-surface); }
@@ -0,0 +1,70 @@
1
+ /* File: packages/ui/src/parts/app-sheet-options.css
2
+ Map: tokens (panel, scrim) -> glass sheet (blur, light scrim without blur, fallbacks) -> inset (a strip of the page
3
+ stays free) -> footer panel (own background, safe area) -> plain collapsible -> reduced motion / transparency
4
+ Options of the sheet for panels over a live view (a map, a game, a dashboard), plus the plain collapsible for lists
5
+ inside such a panel. Theme tokens only; the glass is a calm see-through surface, no gradients. */
6
+
7
+ /* Tokens of every sheet: the panel color and the scrim behind it. The defaults are the existing look. */
8
+ .oc-sheet-content { background: var(--oc-sheet-bg, var(--oc-background)); }
9
+ dialog.oc-sheet::backdrop { background: var(--oc-sheet-scrim, oklch(from var(--color-black-60) l c h / 0.5)); }
10
+
11
+ /* Glass: the panel lets the page show through (blurred), the scrim is light and not blurred, so the rest of the page
12
+ stays visible. --oc-sheet-bg (panel), --oc-sheet-blur (blur radius), --oc-sheet-scrim (scrim). */
13
+ dialog.oc-sheet--glass {
14
+ --oc-sheet-bg: color-mix(in oklab, var(--oc-background) 84%, transparent);
15
+ --oc-sheet-blur: 16px;
16
+ --oc-sheet-scrim: color-mix(in oklab, var(--oc-foreground) 16%, transparent);
17
+ --oc-sheet-line: color-mix(in oklab, var(--oc-border) 70%, transparent);
18
+ }
19
+ dialog.oc-sheet--glass::backdrop {
20
+ background: var(--oc-sheet-scrim, oklch(from var(--color-black-60) l c h / 0.16));
21
+ backdrop-filter: none;
22
+ }
23
+ dialog.oc-sheet--glass .oc-sheet-content {
24
+ -webkit-backdrop-filter: blur(var(--oc-sheet-blur)) saturate(1.2);
25
+ backdrop-filter: blur(var(--oc-sheet-blur)) saturate(1.2);
26
+ border-color: var(--oc-sheet-line);
27
+ }
28
+ dialog.oc-sheet--glass .oc-sheet-footer { border-color: var(--oc-sheet-line); }
29
+ dialog.oc-sheet--glass .oc-sheet-close:hover { background: color-mix(in oklab, var(--oc-card) 70%, transparent); }
30
+ /* Without backdrop-filter the page would be sharp behind the text: nearly opaque instead. */
31
+ @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
32
+ dialog.oc-sheet--glass { --oc-sheet-bg: color-mix(in oklab, var(--oc-background) 96%, transparent); }
33
+ }
34
+ @media (prefers-reduced-transparency: reduce) {
35
+ dialog.oc-sheet--glass { --oc-sheet-bg: var(--oc-background); }
36
+ dialog.oc-sheet--glass .oc-sheet-content { -webkit-backdrop-filter: none; backdrop-filter: none; }
37
+ }
38
+
39
+ /* Inset: on a narrow screen a strip of the page stays free next to the panel (or above a bottom sheet), so the reader
40
+ still sees where they are and can tap beside the panel to close it (closedby="any"). Size: --oc-sheet-gap. */
41
+ dialog.oc-sheet--inset { --oc-sheet-gap: 3.25rem; inline-size: min(24rem, calc(100% - var(--oc-sheet-gap))); }
42
+ dialog.oc-sheet--inset:has(> .oc-sheet-content--wide) { inline-size: min(40rem, calc(100% - var(--oc-sheet-gap))); }
43
+ dialog.oc-sheet--inset:is(.oc-sheet--top, .oc-sheet--bottom) { inline-size: 100%; max-block-size: calc(100dvh - var(--oc-sheet-gap)); }
44
+ dialog.oc-sheet--inset:is(.oc-sheet--top, .oc-sheet--bottom) .oc-sheet-content { max-block-size: calc(100dvh - var(--oc-sheet-gap)); }
45
+
46
+ /* Footer panel: the footer is a block of content (a brand line, a version, a note) on its own background, not a row of
47
+ buttons. It stays at the bottom while the body scrolls, and keeps clear of the home bar of a phone. */
48
+ .oc-sheet-footer.oc-sheet-footer--panel {
49
+ display: block;
50
+ padding-block-end: max(1rem, env(safe-area-inset-bottom));
51
+ background: var(--oc-sheet-footer-bg, var(--oc-surface));
52
+ font-size: 0.875rem;
53
+ }
54
+ dialog.oc-sheet--glass .oc-sheet-footer--panel { --oc-sheet-footer-bg: color-mix(in oklab, var(--oc-card) 50%, transparent); }
55
+ @media (prefers-reduced-transparency: reduce) {
56
+ dialog.oc-sheet--glass .oc-sheet-footer--panel { --oc-sheet-footer-bg: var(--oc-card); }
57
+ }
58
+
59
+ /* Plain collapsible: no card (no background, border or shadow), for a list of sections inside a panel or a block.
60
+ Large rows, a thin line between neighbours, the content without its own border. */
61
+ details.oc-collapsible.oc-collapsible--plain { background: transparent; border: 0; border-radius: 0; box-shadow: none; }
62
+ details.oc-collapsible--plain > summary { min-block-size: 2.75rem; padding: 0.75rem 0.5rem; border-radius: var(--oc-radius); }
63
+ details.oc-collapsible--plain > summary:hover { background: var(--oc-surface); }
64
+ details.oc-collapsible--plain + details.oc-collapsible--plain { border-block-start: 1px solid var(--oc-border); }
65
+ details.oc-collapsible--plain .oc-collapsible-title { font-size: 0.9375rem; font-weight: 600; }
66
+ details.oc-collapsible--plain .oc-collapsible-content { padding: 0.25rem 0.5rem 1rem; border-block-start: 0; }
67
+
68
+ @media (prefers-reduced-motion: reduce) {
69
+ dialog.oc-sheet--glass .oc-sheet-content { transition: none; }
70
+ }
@@ -1,7 +1,7 @@
1
1
  /* File: packages/ui/src/parts/app-sidebar-dark.css | Map: dark sidebar -> active item accent
2
2
  .oc-sidebar--dark: a sidebar that stays dark in the light theme too (classic CMS admin look).
3
3
  All --oc-* tokens are light-dark() pairs, so color-scheme: dark on the sidebar switches every token inside it.
4
- Based on the Verdavita admin sidebar. */
4
+ */
5
5
 
6
6
  .oc-sidebar--dark {
7
7
  color-scheme: dark;