@makoai/app-sdk 2.6.0 → 2.7.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/README.md CHANGED
@@ -1,12 +1,25 @@
1
1
  # @makoai/app-sdk
2
2
 
3
3
  The runtime SDK for [Mako](https://mako.ai) data apps — React hooks over an
4
- app's data bindings, plus a Vite plugin that serves those bindings during a
5
- local `vite dev`.
4
+ app's data bindings, a Vite plugin that serves those bindings during a local
5
+ `vite dev`, and Mako's house dashboard kit (`@makoai/app-sdk/ui`).
6
6
 
7
- Every Mako workspace repository carries this package at `packages/app-sdk`;
8
- apps depend on it with `"@makoai/app-sdk": "file:../../packages/app-sdk"`. Mako
9
- keeps the vendored copy current — do not edit it in a workspace repo.
7
+ Apps depend on the published package with a caret range
8
+ (`"@makoai/app-sdk": "^2.7.0"`), and Mako's deploys move every app to the
9
+ newest release within that range — fixes and design updates reach apps
10
+ without anyone copying files. Do not vendor it into a workspace repo.
11
+
12
+ ## Install
13
+
14
+ Apps use **pnpm** (new apps pin it in `packageManager`; Mako installs each
15
+ app with the package manager its lockfile names):
16
+
17
+ ```bash
18
+ pnpm add @makoai/app-sdk
19
+ ```
20
+
21
+ Do not run `npm install` in a pnpm app — it ignores `pnpm-lock.yaml` and
22
+ writes a competing `package-lock.json`.
10
23
 
11
24
  ## In the app
12
25
 
@@ -87,6 +100,72 @@ this shapes the UI rather than enforcing access. Who may *open* the app is
87
100
  the app's access setting in Mako; server-side row filtering is a follow-up
88
101
  on the same identity (apps.md §28).
89
102
 
103
+ ## The house style: `@makoai/app-sdk/ui`
104
+
105
+ Importing the SDK injects Mako's theme tokens (stone, warm canvas, `#527df2`
106
+ brand; light and dark): `--background`, `--foreground`, `--card`, `--border`,
107
+ `--muted-foreground`, `--brand`, `--canvas`, `--positive` / `--warning` /
108
+ `--negative`, `--chart-1`…`--chart-5`, … Style with these names and the app
109
+ follows the house palette and dark mode for free. Override a token in your own
110
+ stylesheet to re-theme; do not paste the whole block.
111
+
112
+ The kit is the dashboard furniture every app was re-forking:
113
+
114
+ ```tsx
115
+ import "@makoai/app-sdk/ui.css"; // before ./styles.css, so the app wins
116
+ import {
117
+ PageHeader, Card, KpiRow, KpiTile, Button, StatusDot,
118
+ MultiSelect, FreshnessBadge, RefreshAllButton,
119
+ } from "@makoai/app-sdk/ui";
120
+
121
+ <PageHeader
122
+ title="Spain renewals"
123
+ subtitle="Contracts up for renewal in the next 90 days"
124
+ actions={<>
125
+ <FreshnessBadge tone="ok" headline="Synced 12m ago"
126
+ title="Data as of 09:05" schedule="Refreshes 06:30 / 18:30 Europe/Zurich"
127
+ sources={[{ label: "Stripe", value: "09:05", tone: "ok" }]} />
128
+ <RefreshAllButton bindings={__APP_BINDING_NAMES__}
129
+ labels={{ renewals: "Renewals" }} last={["data_freshness*"]} />
130
+ </>}
131
+ />
132
+ <KpiRow>
133
+ <KpiTile label="Up for renewal" value="412" delta="+8%" tone="ok" hint="vs last quarter" />
134
+ </KpiRow>
135
+ <MultiSelect options={["CH", "ES", "IT"]} value={countries} onChange={setCountries} allLabel="All countries" />
136
+ ```
137
+
138
+ - `MultiSelect` — controlled (`value` / `onChange`). An empty selection means
139
+ "all" unless `emptyMeansAll={false}` (then "all" = every value selected).
140
+ Options are strings or `{ value, label, color }`; `showOnly` adds an "Only"
141
+ button per row. On phones the menu is a bottom sheet.
142
+ - `FreshnessBadge` — presentational: the app decides what fresh means and
143
+ passes `tone` (`ok` / `warn` / `bad`, or `green` / `amber` / `red`), a
144
+ `headline`, and per-source rows; `action` is a callout slot (e.g. a "Load
145
+ latest" button).
146
+ - `RefreshAllButton` — rebuilds every binding (`refreshBinding`),
147
+ `concurrency` at a time (default 3 — keep it low), `first` / `last` / `skip`
148
+ patterns (`*` suffix = prefix), with a progress modal. Give it the binding
149
+ names with a build-time define in `vite.config.ts`:
150
+
151
+ ```ts
152
+ import { readdirSync } from "node:fs";
153
+ // inside defineConfig({ … }):
154
+ define: {
155
+ __APP_BINDING_NAMES__: JSON.stringify(
156
+ readdirSync(new URL("./bindings", import.meta.url))
157
+ .filter(f => f.endsWith(".sql")).map(f => f.slice(0, -4)),
158
+ ),
159
+ },
160
+ ```
161
+
162
+ and declare it once (`src/vite-env.d.ts`):
163
+ `declare const __APP_BINDING_NAMES__: string[];`
164
+
165
+ `ui.css` is plain CSS (no Tailwind needed; it coexists with Tailwind) and
166
+ every kit class is prefixed `mk-`. It also sets the house base: Inter 14px on
167
+ the warm `--canvas`.
168
+
90
169
  ## In `vite.config.ts`
91
170
 
92
171
  ```ts
package/index.d.ts CHANGED
@@ -112,6 +112,12 @@ export function useViewer(): ViewerState;
112
112
  export function getViewer(): Promise<Viewer | null>;
113
113
 
114
114
  export function useTheme(): { theme: "light" | "dark" };
115
+
116
+ /**
117
+ * The theme tokens the SDK injects into <head> on import (Mako's house
118
+ * palette: --background, --brand, --canvas, --positive, --chart-1…5, …).
119
+ */
120
+ export const MAKO_THEME_TOKENS_CSS: string;
115
121
  export function useLocation(): MakoLocation;
116
122
  export function useSearchParams(): [
117
123
  URLSearchParams,
package/index.js CHANGED
@@ -492,16 +492,118 @@ export function useSearchParams() {
492
492
  }
493
493
 
494
494
  // ---------------------------------------------------------------------------
495
- // Theme tokens — the same shadcn-style palette the v1 runtime injected around
496
- // every app (app/src/app-runtime/preview.ts THEME_TOKENS_CSS). The v1 skill
497
- // taught agents to write var(--background) / var(--border) / var(--chart-N)
498
- // directly, so migrated apps DEPEND on these names existing; without them a
499
- // v2 build renders with no backgrounds or borders at all. The SDK restores
500
- // the contract wherever it loads: prepended to <head> so any app stylesheet
501
- // overrides it, keyed by id so double-imports no-op, dark on :root.dark (the
502
- // v1 toggle) plus the system preference for standalone.
495
+ // Theme tokens — Mako's house palette, injected wherever the SDK loads.
496
+ //
497
+ // The NAMES are the shadcn-style contract the v1 runtime injected
498
+ // (app/src/app-runtime/preview.ts THEME_TOKENS_CSS): migrated apps write
499
+ // var(--background) / var(--border) / var(--chart-N) directly, so every name
500
+ // must keep existing. The VALUES are the house style the workspace converged
501
+ // on (INTL Sales → Spain Renewals → 0 Moments, Cohort MRR): stone, a warm
502
+ // canvas, #527df2 as the one brand colour. Before 2.7 these were shadcn's zinc
503
+ // defaults and every styled app pasted the same ~90-line override block.
504
+ //
505
+ // Added on top of the v1 names: --brand, --canvas (the page behind cards),
506
+ // --positive / --warning / --negative (status tones). Prepended to <head> so
507
+ // any app stylesheet still overrides it, keyed by id so double-imports no-op,
508
+ // dark on :root.dark (the v1 toggle) plus the system preference.
503
509
  // ---------------------------------------------------------------------------
504
- const MAKO_THEME_TOKENS_CSS = ":root {\n color-scheme: light;\n --background: hsl(0 0% 100%);\n --foreground: hsl(240 10% 3.9%);\n --card: hsl(0 0% 100%);\n --card-foreground: hsl(240 10% 3.9%);\n --popover: hsl(0 0% 100%);\n --popover-foreground: hsl(240 10% 3.9%);\n --primary: hsl(240 5.9% 10%);\n --primary-foreground: hsl(0 0% 98%);\n --secondary: hsl(240 4.8% 95.9%);\n --secondary-foreground: hsl(240 5.9% 10%);\n --muted: hsl(240 4.8% 95.9%);\n --muted-foreground: hsl(240 3.8% 46.1%);\n --accent: hsl(240 4.8% 95.9%);\n --accent-foreground: hsl(240 5.9% 10%);\n --destructive: hsl(0 84.2% 60.2%);\n --destructive-foreground: hsl(0 0% 98%);\n --border: hsl(240 5.9% 90%);\n --input: hsl(240 5.9% 90%);\n --ring: hsl(240 5.9% 10%);\n --chart-1: hsl(12 76% 61%);\n --chart-2: hsl(173 58% 39%);\n --chart-3: hsl(197 37% 24%);\n --chart-4: hsl(43 74% 66%);\n --chart-5: hsl(27 87% 67%);\n --radius: 0.5rem;\n}\n:root.dark {\n color-scheme: dark;\n --background: hsl(240 10% 3.9%);\n --foreground: hsl(0 0% 98%);\n --card: hsl(240 10% 3.9%);\n --card-foreground: hsl(0 0% 98%);\n --popover: hsl(240 10% 3.9%);\n --popover-foreground: hsl(0 0% 98%);\n --primary: hsl(0 0% 98%);\n --primary-foreground: hsl(240 5.9% 10%);\n --secondary: hsl(240 3.7% 15.9%);\n --secondary-foreground: hsl(0 0% 98%);\n --muted: hsl(240 3.7% 15.9%);\n --muted-foreground: hsl(240 5% 64.9%);\n --accent: hsl(240 3.7% 15.9%);\n --accent-foreground: hsl(0 0% 98%);\n --destructive: hsl(0 62.8% 30.6%);\n --destructive-foreground: hsl(0 0% 98%);\n --border: hsl(240 3.7% 15.9%);\n --input: hsl(240 3.7% 15.9%);\n --ring: hsl(240 4.9% 83.9%);\n --chart-1: hsl(220 70% 50%);\n --chart-2: hsl(160 60% 45%);\n --chart-3: hsl(30 80% 55%);\n --chart-4: hsl(280 65% 60%);\n --chart-5: hsl(340 75% 55%);\n}\n@media (prefers-color-scheme: dark) {\n :root:not(.light) {\n color-scheme: dark;\n --background: hsl(240 10% 3.9%);\n --foreground: hsl(0 0% 98%);\n --card: hsl(240 10% 3.9%);\n --card-foreground: hsl(0 0% 98%);\n --popover: hsl(240 10% 3.9%);\n --popover-foreground: hsl(0 0% 98%);\n --primary: hsl(0 0% 98%);\n --primary-foreground: hsl(240 5.9% 10%);\n --secondary: hsl(240 3.7% 15.9%);\n --secondary-foreground: hsl(0 0% 98%);\n --muted: hsl(240 3.7% 15.9%);\n --muted-foreground: hsl(240 5% 64.9%);\n --accent: hsl(240 3.7% 15.9%);\n --accent-foreground: hsl(0 0% 98%);\n --destructive: hsl(0 62.8% 30.6%);\n --destructive-foreground: hsl(0 0% 98%);\n --border: hsl(240 3.7% 15.9%);\n --input: hsl(240 3.7% 15.9%);\n --ring: hsl(240 4.9% 83.9%);\n --chart-1: hsl(220 70% 50%);\n --chart-2: hsl(160 60% 45%);\n --chart-3: hsl(30 80% 55%);\n --chart-4: hsl(280 65% 60%);\n --chart-5: hsl(340 75% 55%);\n }\n}\nbody { background: var(--background); color: var(--foreground); }";
510
+ export const MAKO_THEME_TOKENS_CSS = `:root {
511
+ color-scheme: light;
512
+ --radius: 0.5rem;
513
+ --background: hsl(40 33% 98.5%);
514
+ --foreground: hsl(24 14% 10%);
515
+ --card: hsl(40 40% 99.5%);
516
+ --card-foreground: hsl(24 14% 10%);
517
+ --popover: hsl(40 40% 99.5%);
518
+ --popover-foreground: hsl(24 14% 10%);
519
+ --primary: hsl(24 14% 12%);
520
+ --primary-foreground: hsl(40 33% 98.5%);
521
+ --secondary: hsl(36 24% 92.5%);
522
+ --secondary-foreground: hsl(24 14% 10%);
523
+ --muted: hsl(36 24% 92.5%);
524
+ --muted-foreground: hsl(28 10% 38%);
525
+ --accent: hsl(36 24% 92.5%);
526
+ --accent-foreground: hsl(24 14% 10%);
527
+ --destructive: hsl(0 72% 51%);
528
+ --destructive-foreground: hsl(0 0% 98%);
529
+ --border: hsl(34 16% 83%);
530
+ --input: hsl(34 16% 83%);
531
+ --ring: #527df2;
532
+ --brand: #527df2;
533
+ --canvas: color-mix(in srgb, var(--foreground) 4%, var(--background));
534
+ --positive: hsl(160 52% 36%);
535
+ --warning: hsl(33 80% 42%);
536
+ --negative: hsl(0 66% 48%);
537
+ --chart-1: #527df2;
538
+ --chart-2: hsl(160 52% 36%);
539
+ --chart-3: hsl(33 80% 42%);
540
+ --chart-4: hsl(262 52% 55%);
541
+ --chart-5: hsl(0 66% 48%);
542
+ }
543
+ :root.dark {
544
+ color-scheme: dark;
545
+ --background: hsl(28 9% 7%);
546
+ --foreground: hsl(38 22% 93%);
547
+ --card: hsl(28 8% 10.5%);
548
+ --card-foreground: hsl(38 22% 93%);
549
+ --popover: hsl(28 8% 12%);
550
+ --popover-foreground: hsl(38 22% 93%);
551
+ --primary: hsl(38 22% 93%);
552
+ --primary-foreground: hsl(28 9% 7%);
553
+ --secondary: hsl(28 7% 17%);
554
+ --secondary-foreground: hsl(38 22% 93%);
555
+ --muted: hsl(28 7% 17%);
556
+ --muted-foreground: hsl(34 10% 67%);
557
+ --accent: hsl(28 7% 17%);
558
+ --accent-foreground: hsl(38 22% 93%);
559
+ --destructive: hsl(0 62% 50%);
560
+ --destructive-foreground: hsl(0 0% 98%);
561
+ --border: hsl(28 7% 24%);
562
+ --input: hsl(28 7% 24%);
563
+ --brand: #6f94f6;
564
+ --positive: hsl(158 48% 52%);
565
+ --warning: hsl(36 85% 60%);
566
+ --negative: hsl(0 75% 66%);
567
+ --chart-1: #6f94f6;
568
+ --chart-2: hsl(158 48% 52%);
569
+ --chart-3: hsl(36 85% 60%);
570
+ --chart-4: hsl(262 60% 70%);
571
+ --chart-5: hsl(0 75% 66%);
572
+ }
573
+ @media (prefers-color-scheme: dark) {
574
+ :root:not(.light) {
575
+ color-scheme: dark;
576
+ --background: hsl(28 9% 7%);
577
+ --foreground: hsl(38 22% 93%);
578
+ --card: hsl(28 8% 10.5%);
579
+ --card-foreground: hsl(38 22% 93%);
580
+ --popover: hsl(28 8% 12%);
581
+ --popover-foreground: hsl(38 22% 93%);
582
+ --primary: hsl(38 22% 93%);
583
+ --primary-foreground: hsl(28 9% 7%);
584
+ --secondary: hsl(28 7% 17%);
585
+ --secondary-foreground: hsl(38 22% 93%);
586
+ --muted: hsl(28 7% 17%);
587
+ --muted-foreground: hsl(34 10% 67%);
588
+ --accent: hsl(28 7% 17%);
589
+ --accent-foreground: hsl(38 22% 93%);
590
+ --destructive: hsl(0 62% 50%);
591
+ --destructive-foreground: hsl(0 0% 98%);
592
+ --border: hsl(28 7% 24%);
593
+ --input: hsl(28 7% 24%);
594
+ --brand: #6f94f6;
595
+ --positive: hsl(158 48% 52%);
596
+ --warning: hsl(36 85% 60%);
597
+ --negative: hsl(0 75% 66%);
598
+ --chart-1: #6f94f6;
599
+ --chart-2: hsl(158 48% 52%);
600
+ --chart-3: hsl(36 85% 60%);
601
+ --chart-4: hsl(262 60% 70%);
602
+ --chart-5: hsl(0 75% 66%);
603
+ }
604
+ }
605
+ body { background: var(--background); color: var(--foreground); }
606
+ `;
505
607
  if (
506
608
  typeof document !== "undefined" &&
507
609
  !document.getElementById("mako-theme-tokens")
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@makoai/app-sdk",
3
- "version": "2.6.0",
4
- "description": "Mako app SDK: data bindings (useQuery/useDuckDB), URL state, theme.",
3
+ "version": "2.7.0",
4
+ "description": "Mako app SDK: data bindings (useQuery/useDuckDB), URL state, theme, and the house dashboard kit (/ui).",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -31,7 +31,12 @@
31
31
  "./credentials": {
32
32
  "types": "./credentials.d.ts",
33
33
  "default": "./credentials.js"
34
- }
34
+ },
35
+ "./ui": {
36
+ "types": "./ui.d.ts",
37
+ "default": "./ui.js"
38
+ },
39
+ "./ui.css": "./ui.css"
35
40
  },
36
41
  "files": [
37
42
  "index.js",
@@ -40,10 +45,15 @@
40
45
  "vite.d.ts",
41
46
  "credentials.js",
42
47
  "credentials.d.ts",
48
+ "ui.js",
49
+ "ui-core.js",
50
+ "ui.d.ts",
51
+ "ui.css",
43
52
  "README.md"
44
53
  ],
45
54
  "peerDependencies": {
46
- "react": ">=18"
55
+ "react": ">=18",
56
+ "react-dom": ">=18"
47
57
  },
48
58
  "publishConfig": {
49
59
  "access": "public"
package/ui-core.js ADDED
@@ -0,0 +1,48 @@
1
+ // Pure helpers behind @makoai/app-sdk/ui — no React, so `node --test` can
2
+ // cover them without installing anything.
3
+
4
+ const TONE_ALIASES = {
5
+ green: "ok",
6
+ ok: "ok",
7
+ fresh: "ok",
8
+ amber: "warn",
9
+ warn: "warn",
10
+ warning: "warn",
11
+ stale: "warn",
12
+ red: "bad",
13
+ bad: "bad",
14
+ error: "bad",
15
+ loading: "loading",
16
+ };
17
+
18
+ /** ok | warn | bad | loading | neutral, from either vocabulary. */
19
+ export function normalizeTone(tone) {
20
+ return TONE_ALIASES[tone] ?? "neutral";
21
+ }
22
+
23
+ function matches(patterns, name) {
24
+ return patterns.findIndex(p => (p.endsWith("*") ? name.startsWith(p.slice(0, -1)) : p === name));
25
+ }
26
+
27
+ /**
28
+ * The order a refresh runs in: `first` (slowest/heaviest, so they overlap the
29
+ * light ones), then everything else by name, then `last` (e.g. the freshness
30
+ * snapshot, so the badge reflects the rebuilt data). Patterns ending in `*`
31
+ * match a prefix. `skip` drops bindings that must not be rebuilt on demand.
32
+ */
33
+ export function refreshOrder(bindings, { first = [], last = [], skip = [] } = {}) {
34
+ const rank = name => {
35
+ const l = matches(last, name);
36
+ if (l >= 0) return 1000 + l;
37
+ const f = matches(first, name);
38
+ return f >= 0 ? f : 500;
39
+ };
40
+ return [...bindings]
41
+ .filter(name => matches(skip, name) < 0)
42
+ .sort((a, b) => rank(a) - rank(b) || a.localeCompare(b));
43
+ }
44
+
45
+ /** 75 → "1m 15s", 42 → "42s". */
46
+ export function formatSeconds(s) {
47
+ return s >= 60 ? `${Math.floor(s / 60)}m ${String(s % 60).padStart(2, "0")}s` : `${s}s`;
48
+ }
package/ui.css ADDED
@@ -0,0 +1,280 @@
1
+ /* @makoai/app-sdk/ui.css — Mako's house dashboard style.
2
+ *
3
+ * shadcn/ui "new-york" · stone · warm canvas · #527df2 brand · Inter 14px ·
4
+ * 6px controls · 8px tiles · 12px panels · 1px hairlines with a hairline
5
+ * shadow. Colours come ONLY from the theme tokens the SDK injects (index.js),
6
+ * so an app re-themes by overriding tokens, never these rules.
7
+ *
8
+ * Import it once, before the app's own stylesheet so the app wins:
9
+ * import "@makoai/app-sdk/ui.css";
10
+ * import "./styles.css";
11
+ *
12
+ * Works with or without Tailwind: plain CSS, every kit class prefixed mk-.
13
+ */
14
+
15
+ :root {
16
+ --mk-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
17
+ --mk-radius-sm: 4px;
18
+ --mk-radius-md: 6px;
19
+ --mk-radius-lg: 8px;
20
+ --mk-radius-xl: 12px;
21
+ --mk-shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
22
+ --mk-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
23
+ --mk-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.08);
24
+ --mk-ease: cubic-bezier(0.22, 1, 0.36, 1);
25
+ --mk-ring-focus: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent);
26
+ --mk-row-line: color-mix(in srgb, var(--border) 60%, transparent);
27
+ }
28
+
29
+ /* ---- Base ---------------------------------------------------------------- */
30
+ *, *::before, *::after { box-sizing: border-box; }
31
+ html, body, #root { min-height: 100%; }
32
+ body {
33
+ margin: 0;
34
+ background: var(--canvas);
35
+ color: var(--foreground);
36
+ font-family: var(--mk-font);
37
+ font-size: 14px;
38
+ line-height: 1.5;
39
+ font-synthesis: none;
40
+ -webkit-font-smoothing: antialiased;
41
+ }
42
+ button, input, select, textarea { font-family: inherit; }
43
+ button:not(:disabled), [role="button"]:not(:disabled) { cursor: pointer; }
44
+ @media (prefers-reduced-motion: reduce) {
45
+ *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
46
+ }
47
+
48
+ /* ---- Tones --------------------------------------------------------------- */
49
+ .mk-dot { display: inline-block; width: 6px; height: 6px; border-radius: 999px; flex-shrink: 0; background: var(--muted-foreground); }
50
+ .mk-dot.mk-tone-ok { background: var(--positive); }
51
+ .mk-dot.mk-tone-warn { background: var(--warning); }
52
+ .mk-dot.mk-tone-bad { background: var(--negative); }
53
+ .mk-dot.mk-tone-loading { animation: mk-pulse 1.4s ease-in-out infinite; }
54
+ @keyframes mk-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
55
+
56
+ /* ---- Button -------------------------------------------------------------- */
57
+ .mk-btn {
58
+ appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
59
+ height: 32px; padding: 0 12px; font-size: 14px; font-weight: 500; line-height: 1.4; white-space: nowrap;
60
+ color: var(--foreground); background: var(--background);
61
+ border: 1px solid var(--border); border-radius: var(--mk-radius-md); box-shadow: var(--mk-shadow-xs);
62
+ font-variant-numeric: tabular-nums;
63
+ transition: background .15s var(--mk-ease), border-color .15s var(--mk-ease), color .15s;
64
+ }
65
+ .mk-btn:hover:not(:disabled) { background: var(--accent); color: var(--accent-foreground); }
66
+ .mk-btn:focus-visible { outline: none; border-color: var(--ring); box-shadow: var(--mk-ring-focus); }
67
+ .mk-btn:disabled { cursor: default; opacity: .6; }
68
+ .mk-btn svg { flex: none; }
69
+ /* outline is the base look above; the class exists so variants read uniformly. */
70
+ .mk-btn--outline { background: var(--background); }
71
+ .mk-btn--primary { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
72
+ .mk-btn--primary:hover:not(:disabled) { background: color-mix(in srgb, var(--primary) 88%, transparent); color: var(--primary-foreground); }
73
+ .mk-btn--ghost { background: transparent; border-color: transparent; box-shadow: none; }
74
+ .mk-btn--sm { height: 28px; padding: 0 10px; font-size: 13px; }
75
+
76
+ /* ---- Page blocks --------------------------------------------------------- */
77
+ .mk-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
78
+ .mk-header-text { min-width: 0; }
79
+ .mk-header-title { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; }
80
+ .mk-header-subtitle { margin: 2px 0 0; font-size: 13px; color: var(--muted-foreground); }
81
+ .mk-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
82
+
83
+ .mk-card {
84
+ background: var(--card); color: var(--card-foreground);
85
+ border: 1px solid var(--border); border-radius: var(--mk-radius-xl); box-shadow: var(--mk-shadow-xs);
86
+ padding: 16px;
87
+ }
88
+ .mk-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
89
+ .mk-card-title { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
90
+ .mk-card-desc { margin: 2px 0 0; font-size: 12px; color: var(--muted-foreground); }
91
+ .mk-card-actions { display: flex; align-items: center; gap: 8px; }
92
+
93
+ .mk-kpi-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
94
+ .mk-kpi {
95
+ display: flex; flex-direction: column; min-width: 168px; max-width: 320px; flex: 1 1 168px;
96
+ background: var(--card); border: 1px solid var(--border); border-radius: var(--mk-radius-lg);
97
+ padding: 10px 14px; box-shadow: var(--mk-shadow-xs);
98
+ }
99
+ .mk-kpi-label { font-size: 12px; font-weight: 500; color: var(--muted-foreground); }
100
+ .mk-kpi-value { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; font-variant-numeric: tabular-nums; }
101
+ .mk-kpi-foot { display: flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--muted-foreground); }
102
+ .mk-kpi-hint { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
103
+ .mk-kpi-delta { font-weight: 500; font-variant-numeric: tabular-nums; }
104
+ .mk-kpi-delta.mk-tone-ok { color: var(--positive); }
105
+ .mk-kpi-delta.mk-tone-warn { color: var(--warning); }
106
+ .mk-kpi-delta.mk-tone-bad { color: var(--negative); }
107
+
108
+ /* ---- Popover (MultiSelect menu, freshness panel) ------------------------- */
109
+ .mk-pop {
110
+ position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
111
+ max-width: calc(100vw - 16px);
112
+ background: var(--popover); color: var(--popover-foreground);
113
+ border: 1px solid var(--border); border-radius: var(--mk-radius-md); box-shadow: var(--mk-shadow-md);
114
+ animation: mk-pop-in .14s var(--mk-ease);
115
+ }
116
+ @keyframes mk-pop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
117
+ @media (max-width: 640px) {
118
+ /* Phones: a bottom sheet, thumb-reachable, never clipped by the viewport. */
119
+ .mk-pop {
120
+ position: fixed; top: auto; left: 0 !important; right: 0 !important; bottom: 0; max-width: none;
121
+ max-height: 70vh; overflow: auto; border-radius: var(--mk-radius-xl) var(--mk-radius-xl) 0 0; border-bottom: 0;
122
+ }
123
+ }
124
+
125
+ /* ---- MultiSelect --------------------------------------------------------- */
126
+ .mk-ms { position: relative; display: inline-block; }
127
+ .mk-ms-trigger {
128
+ appearance: none; display: inline-flex; align-items: center; justify-content: space-between; gap: 8px;
129
+ min-width: 148px; max-width: 100%; height: 32px; padding: 0 10px 0 12px;
130
+ background: var(--background); color: var(--foreground); border: 1px solid var(--border);
131
+ border-radius: var(--mk-radius-md); font-size: 14px; font-weight: 500; box-shadow: var(--mk-shadow-xs);
132
+ transition: background .15s var(--mk-ease), border-color .15s var(--mk-ease);
133
+ }
134
+ .mk-ms-trigger:hover { background: var(--accent); }
135
+ .mk-ms-trigger:focus-visible { outline: none; }
136
+ .mk-ms-trigger.open, .mk-ms-trigger:focus-visible { border-color: var(--ring); box-shadow: var(--mk-ring-focus); }
137
+ .mk-ms-value { display: flex; align-items: center; min-width: 0; overflow: hidden; }
138
+ .mk-ms-chips { display: inline-flex; align-items: center; gap: 4px; }
139
+ .mk-ms-chip {
140
+ display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px;
141
+ font-size: 12px; font-weight: 500; border-radius: 999px; white-space: nowrap;
142
+ background: var(--secondary); color: var(--secondary-foreground);
143
+ }
144
+ .mk-ms-more { color: var(--muted-foreground); }
145
+ .mk-ms-caret { color: var(--muted-foreground); flex-shrink: 0; transition: transform .15s ease; }
146
+ .mk-ms-trigger.open .mk-ms-caret { transform: rotate(180deg); }
147
+ .mk-ms-menu {
148
+ min-width: 220px; max-height: min(60vh, 420px); overflow: auto;
149
+ padding: 4px; display: flex; flex-direction: column; gap: 1px;
150
+ scrollbar-width: thin; scrollbar-color: var(--border) transparent;
151
+ }
152
+ .mk-ms-opt {
153
+ display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; flex: none;
154
+ border: 0; background: transparent; color: var(--foreground); white-space: nowrap; cursor: pointer;
155
+ font-size: 14px; font-weight: 400; padding: 6px 8px; border-radius: var(--mk-radius-sm);
156
+ transition: background .12s var(--mk-ease);
157
+ }
158
+ .mk-ms-opt:hover, .mk-ms-opt:focus-visible { background: var(--accent); outline: none; }
159
+ .mk-ms-opt.active { font-weight: 500; }
160
+ .mk-ms-label { flex: 1; }
161
+ .mk-ms-box {
162
+ display: inline-flex; align-items: center; justify-content: center;
163
+ width: 16px; height: 16px; flex-shrink: 0; border-radius: var(--mk-radius-sm);
164
+ border: 1px solid var(--input); background: var(--background); color: transparent; box-shadow: var(--mk-shadow-xs);
165
+ transition: background .12s, border-color .12s, color .12s;
166
+ }
167
+ .mk-ms-box.on { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
168
+ .mk-ms-swatch { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }
169
+ .mk-ms-sep { height: 1px; background: var(--border); margin: 4px -4px; flex: none; }
170
+ .mk-ms-only {
171
+ appearance: none; border: 0; background: transparent; color: var(--muted-foreground);
172
+ font-size: 12px; font-weight: 500; padding: 0 4px; border-radius: var(--mk-radius-sm); visibility: hidden;
173
+ }
174
+ .mk-ms-opt:hover .mk-ms-only, .mk-ms-opt:focus-within .mk-ms-only { visibility: visible; }
175
+ .mk-ms-only:hover { color: var(--foreground); background: var(--muted); }
176
+ @media (max-width: 640px) {
177
+ .mk-ms-trigger { height: 38px; }
178
+ .mk-ms-opt { padding: 10px 8px; }
179
+ .mk-ms-only { visibility: visible; }
180
+ }
181
+
182
+ /* ---- FreshnessBadge ------------------------------------------------------ */
183
+ .mk-fresh { position: relative; display: inline-block; flex-shrink: 0; }
184
+ .mk-fresh-trigger {
185
+ appearance: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px;
186
+ font-size: 12px; color: var(--muted-foreground); white-space: nowrap; font-variant-numeric: tabular-nums;
187
+ background: transparent; border: 1px solid transparent; border-radius: var(--mk-radius-md);
188
+ transition: background .15s, color .15s;
189
+ }
190
+ .mk-fresh-headline { line-height: 1; }
191
+ .mk-fresh-trigger:hover:not(:disabled), .mk-fresh-trigger.open { background: var(--accent); color: var(--foreground); }
192
+ .mk-fresh-trigger:focus-visible { outline: none; box-shadow: var(--mk-ring-focus); }
193
+ .mk-fresh-trigger:disabled { cursor: default; }
194
+ .mk-fresh-trigger.mk-tone-warn { color: var(--warning); }
195
+ .mk-fresh-trigger.mk-tone-bad { color: var(--negative); }
196
+ .mk-fresh-pop { width: 340px; padding: 12px; font-size: 12px; white-space: normal; }
197
+ .mk-fresh-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 13px; }
198
+ .mk-fresh-head span { color: var(--muted-foreground); font-size: 12px; font-variant-numeric: tabular-nums; }
199
+ .mk-fresh-schedule { margin: 2px 0 0; color: var(--muted-foreground); }
200
+ .mk-fresh-action {
201
+ margin-top: 10px; padding: 8px 10px; border-radius: var(--mk-radius-md);
202
+ background: color-mix(in srgb, var(--warning) 10%, transparent);
203
+ border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
204
+ display: flex; align-items: center; justify-content: space-between; gap: 10px;
205
+ }
206
+ .mk-fresh-action p { margin: 0; }
207
+ .mk-fresh-sources { list-style: none; margin: 10px 0 0; padding: 0; display: grid; }
208
+ .mk-fresh-sources li {
209
+ display: grid; grid-template-columns: 6px minmax(0, 1fr) auto; align-items: baseline; gap: 8px;
210
+ padding: 6px 0; border-top: 1px solid var(--mk-row-line);
211
+ }
212
+ .mk-fresh-sources li .mk-dot { transform: translateY(-1px); }
213
+ .mk-fresh-source { display: flex; flex-direction: column; min-width: 0; }
214
+ .mk-fresh-source > span { font-weight: 500; color: var(--foreground); }
215
+ .mk-fresh-source small { font-size: 12px; color: var(--muted-foreground); line-height: 1.4; }
216
+ .mk-fresh-source small.mk-fresh-detail { margin-top: 2px; }
217
+ .mk-fresh-value { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
218
+ .mk-fresh-foot { margin: 8px 0 0; padding-top: 6px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted-foreground); }
219
+ @media (max-width: 640px) { .mk-fresh-pop { width: auto; padding: 16px; } }
220
+
221
+ /* ---- RefreshAllButton + modal -------------------------------------------- */
222
+ .mk-refresh.refreshing svg { animation: mk-spin 0.9s linear infinite; }
223
+ .mk-refresh.ok { color: var(--positive); border-color: color-mix(in srgb, var(--positive) 40%, transparent); }
224
+ .mk-refresh.ok svg { display: none; }
225
+ .mk-refresh.failed { color: var(--negative); border-color: color-mix(in srgb, var(--negative) 40%, transparent); }
226
+ @keyframes mk-spin { to { transform: rotate(360deg); } }
227
+
228
+ /* Portalled to <body>, so it re-declares the font. */
229
+ .mk-rf-backdrop {
230
+ position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px;
231
+ background: rgb(0 0 0 / 0.5); backdrop-filter: blur(2px); animation: mk-fade .15s ease-out;
232
+ font-family: var(--mk-font);
233
+ }
234
+ .mk-rf-modal {
235
+ width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; gap: 12px; padding: 16px;
236
+ background: var(--background); color: var(--foreground); border: 1px solid var(--border); border-radius: var(--mk-radius-xl);
237
+ box-shadow: var(--mk-shadow-lg); animation: mk-modal-in .18s var(--mk-ease); font-size: 14px; line-height: 1.5;
238
+ }
239
+ @keyframes mk-fade { from { opacity: 0; } to { opacity: 1; } }
240
+ @keyframes mk-modal-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
241
+ .mk-rf-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
242
+ .mk-rf-title { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; }
243
+ .mk-rf-desc { margin: 2px 0 0; font-size: 12px; color: var(--muted-foreground); }
244
+ .mk-rf-x {
245
+ appearance: none; border: 0; background: transparent; color: var(--muted-foreground); flex: none;
246
+ width: 28px; height: 28px; border-radius: var(--mk-radius-md); display: inline-flex; align-items: center; justify-content: center; margin: -4px -6px 0 0;
247
+ }
248
+ .mk-rf-x:hover { background: var(--accent); color: var(--foreground); }
249
+ .mk-rf-x:focus-visible { outline: none; box-shadow: var(--mk-ring-focus); }
250
+ .mk-rf-progress { display: grid; gap: 6px; }
251
+ .mk-rf-bar { height: 6px; border-radius: 999px; background: var(--muted); overflow: hidden; }
252
+ .mk-rf-fill { height: 100%; border-radius: 999px; background: var(--brand); transition: width .4s var(--mk-ease); }
253
+ .mk-rf-fill.has-err { background: var(--warning); }
254
+ .mk-rf-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
255
+ .mk-rf-list {
256
+ list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 1px;
257
+ border: 1px solid var(--border); border-radius: var(--mk-radius-lg); overflow: auto; background: var(--card);
258
+ scrollbar-width: thin; scrollbar-color: var(--border) transparent;
259
+ }
260
+ .mk-rf-item { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 5px 10px; border-bottom: 1px solid var(--mk-row-line); min-width: 0; }
261
+ .mk-rf-item:nth-child(odd) { border-right: 1px solid var(--mk-row-line); }
262
+ .mk-rf-ico { display: inline-flex; align-items: center; justify-content: center; height: 20px; color: var(--muted-foreground); }
263
+ .mk-rf-name { font-size: 13px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
264
+ .mk-rf-item.failed .mk-rf-name { white-space: normal; }
265
+ .mk-rf-err { display: block; font-size: 12px; font-weight: 400; color: var(--negative); overflow-wrap: anywhere; }
266
+ .mk-rf-state { font-size: 12px; color: var(--muted-foreground); line-height: 20px; font-variant-numeric: tabular-nums; }
267
+ .mk-rf-item.queued .mk-rf-name { color: var(--muted-foreground); }
268
+ .mk-rf-item.running .mk-rf-state { color: var(--brand); font-weight: 500; }
269
+ .mk-rf-item.done .mk-rf-ico, .mk-rf-item.done .mk-rf-state { color: var(--positive); }
270
+ .mk-rf-item.failed .mk-rf-ico, .mk-rf-item.failed .mk-rf-state { color: var(--negative); }
271
+ .mk-rf-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--border); }
272
+ .mk-rf-spin { width: 14px; height: 14px; border-radius: 999px; border: 2px solid color-mix(in srgb, var(--brand) 25%, transparent); border-top-color: var(--brand); animation: mk-spin .8s linear infinite; }
273
+ .mk-rf-foot { display: flex; justify-content: flex-end; gap: 8px; }
274
+ @media (max-width: 640px) {
275
+ .mk-rf-backdrop { align-items: flex-end; padding: 0; }
276
+ .mk-rf-modal { max-width: none; border-radius: var(--mk-radius-xl) var(--mk-radius-xl) 0 0; border-bottom: 0; }
277
+ .mk-rf-list { grid-template-columns: 1fr; }
278
+ .mk-rf-item:nth-child(odd) { border-right: 0; }
279
+ .mk-btn { height: 38px; padding: 0 14px; }
280
+ }