@aeolus-fleet/ui 0.0.0 → 0.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +11 -1
- package/dist/atoms/avatar.d.ts +16 -0
- package/dist/atoms/avatar.js +44 -0
- package/dist/atoms/avatar.js.map +1 -0
- package/dist/atoms/button.d.ts +22 -0
- package/dist/atoms/button.js +48 -0
- package/dist/atoms/button.js.map +1 -0
- package/dist/atoms/dialog-surface.d.ts +19 -0
- package/dist/atoms/dialog-surface.js +32 -0
- package/dist/atoms/dialog-surface.js.map +1 -0
- package/dist/atoms/dialog.d.ts +19 -0
- package/dist/atoms/dialog.js +37 -0
- package/dist/atoms/dialog.js.map +1 -0
- package/dist/atoms/dropdown-menu.d.ts +21 -0
- package/dist/atoms/dropdown-menu.js +42 -0
- package/dist/atoms/dropdown-menu.js.map +1 -0
- package/dist/atoms/kbd.d.ts +7 -0
- package/dist/atoms/kbd.js +11 -0
- package/dist/atoms/kbd.js.map +1 -0
- package/dist/atoms/sheet.d.ts +23 -0
- package/dist/atoms/sheet.js +52 -0
- package/dist/atoms/sheet.js.map +1 -0
- package/dist/atoms/tooltip.d.ts +10 -0
- package/dist/atoms/tooltip.js +24 -0
- package/dist/atoms/tooltip.js.map +1 -0
- package/dist/class-names.d.ts +3 -0
- package/dist/class-names.js +29 -0
- package/dist/class-names.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/molecules/app-switcher.d.ts +20 -0
- package/dist/molecules/app-switcher.js +57 -0
- package/dist/molecules/app-switcher.js.map +1 -0
- package/dist/molecules/avatar-entry.d.ts +21 -0
- package/dist/molecules/avatar-entry.js +6 -0
- package/dist/molecules/avatar-entry.js.map +1 -0
- package/dist/molecules/avatar-menu.d.ts +43 -0
- package/dist/molecules/avatar-menu.js +111 -0
- package/dist/molecules/avatar-menu.js.map +1 -0
- package/dist/molecules/signed-in-as.d.ts +4 -0
- package/dist/molecules/signed-in-as.js +6 -0
- package/dist/molecules/signed-in-as.js.map +1 -0
- package/dist/organisms/app-header.d.ts +27 -0
- package/dist/organisms/app-header.js +18 -0
- package/dist/organisms/app-header.js.map +1 -0
- package/dist/organisms/command-palette.d.ts +44 -0
- package/dist/organisms/command-palette.js +77 -0
- package/dist/organisms/command-palette.js.map +1 -0
- package/dist/organisms/sign-in-background.d.ts +10 -0
- package/dist/organisms/sign-in-background.js +48 -0
- package/dist/organisms/sign-in-background.js.map +1 -0
- package/dist/organisms/sign-in-backgrounds.d.ts +40 -0
- package/dist/organisms/sign-in-backgrounds.js +135 -0
- package/dist/organisms/sign-in-backgrounds.js.map +1 -0
- package/dist/theme.css +168 -0
- package/dist/tokens.css +154 -0
- package/package.json +56 -4
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* One entry of the palette: what it shows, and where it goes. An entry with
|
|
4
|
+
* an href opens another app: the browser leaves, so the palette stays open
|
|
5
|
+
* and says "Opening ..." until it does. Any other entry is handed to
|
|
6
|
+
* onSelect and the palette closes.
|
|
7
|
+
*/
|
|
8
|
+
export interface CommandEntry {
|
|
9
|
+
key: string;
|
|
10
|
+
content: ReactNode;
|
|
11
|
+
href?: string;
|
|
12
|
+
/** The name "Opening ..." uses for an entry with an href. */
|
|
13
|
+
name?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface CommandGroup {
|
|
16
|
+
key: string;
|
|
17
|
+
label: string;
|
|
18
|
+
entries: readonly CommandEntry[];
|
|
19
|
+
}
|
|
20
|
+
export interface CommandPaletteProps {
|
|
21
|
+
isOpen: boolean;
|
|
22
|
+
onOpenChange: (isOpen: boolean) => void;
|
|
23
|
+
/** The groups to show for what is typed: the app filters, and leaves out an empty group. */
|
|
24
|
+
groupsOf: (query: string) => readonly CommandGroup[];
|
|
25
|
+
onSelect: (key: string) => void;
|
|
26
|
+
/** The search field's name and placeholder: "Search ships or jump to". */
|
|
27
|
+
label: string;
|
|
28
|
+
/** What to say when nothing matches what is typed. */
|
|
29
|
+
emptyMessage: (query: string) => string;
|
|
30
|
+
/** While the entries load, rows in their shape stand in. */
|
|
31
|
+
isLoading?: boolean;
|
|
32
|
+
/** What the search starts with when it opens; empty when not given. For stories. */
|
|
33
|
+
initialQuery?: string;
|
|
34
|
+
/** Each change of the query as typed, so the app can ask the server for what matches. */
|
|
35
|
+
onQueryChange?: (query: string) => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The command palette (header design, docs/design/png/CommandPalette.png):
|
|
39
|
+
* search, then the app's groups of entries, filtered as you type. Arrow keys
|
|
40
|
+
* move, Enter opens, Escape closes. Desktop: a dialog near the top, opened
|
|
41
|
+
* with ⌘K or the header's search. Phone: the search icon opens it full
|
|
42
|
+
* screen (H6). While the entries load, rows in their shape stand in.
|
|
43
|
+
*/
|
|
44
|
+
export declare function CommandPalette({ isOpen, onOpenChange, ...body }: CommandPaletteProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { CornerDownLeft, LoaderCircle, Search } from 'lucide-react';
|
|
4
|
+
import { useId, useState } from 'react';
|
|
5
|
+
import { Button } from '../atoms/button.js';
|
|
6
|
+
import { Dialog, DialogClose, DialogContent, DialogTitle } from '../atoms/dialog.js';
|
|
7
|
+
import { dialogSurface } from '../atoms/dialog-surface.js';
|
|
8
|
+
import { Kbd } from '../atoms/kbd.js';
|
|
9
|
+
import { classNames } from '../class-names.js';
|
|
10
|
+
/** Rows standing in while the entries load. */
|
|
11
|
+
const SKELETON_ROWS = 4;
|
|
12
|
+
function LoadingRows() {
|
|
13
|
+
return (_jsx("ul", { "aria-label": "Loading", "aria-busy": true, "data-testid": "command-palette-loading", className: "flex flex-col gap-1 p-1", children: Array.from({ length: SKELETON_ROWS }, (_, row) => `row-${String(row)}`).map((row) => (_jsxs("li", { className: "flex h-(--size-control) items-center gap-2.5 px-2.5 max-sm:h-(--size-control-touch)", children: [_jsx("span", { className: "size-5 shrink-0 animate-pulse rounded-full bg-muted motion-reduce:animate-none" }), _jsx("span", { className: "h-3 w-40 animate-pulse rounded bg-muted motion-reduce:animate-none" })] }, row))) }));
|
|
14
|
+
}
|
|
15
|
+
/** The open palette: its query, the entry the keys move to and the one opening live here, so each opening starts fresh. */
|
|
16
|
+
function PaletteBody({ groupsOf, onSelect, onOpenChange, label, emptyMessage, isLoading = false, initialQuery = '', onQueryChange }) {
|
|
17
|
+
const listId = useId();
|
|
18
|
+
const optionId = useId();
|
|
19
|
+
const [query, setQuery] = useState(initialQuery);
|
|
20
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
21
|
+
const [opening, setOpening] = useState(undefined);
|
|
22
|
+
const groups = groupsOf(query);
|
|
23
|
+
const entries = groups.flatMap((group) => group.entries);
|
|
24
|
+
const active = entries[Math.min(activeIndex, entries.length - 1)];
|
|
25
|
+
const idOf = (entry) => `${optionId}-${entry.key}`;
|
|
26
|
+
const choose = (entry) => {
|
|
27
|
+
if (opening !== undefined) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (entry.href !== undefined) {
|
|
31
|
+
setOpening(entry);
|
|
32
|
+
window.location.assign(entry.href);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
onSelect(entry.key);
|
|
36
|
+
onOpenChange(false);
|
|
37
|
+
};
|
|
38
|
+
const onKeyDown = (event) => {
|
|
39
|
+
if (entries.length === 0) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
const step = event.key === 'ArrowDown' ? 1 : -1;
|
|
45
|
+
const current = active ? entries.indexOf(active) : 0;
|
|
46
|
+
setActiveIndex((current + step + entries.length) % entries.length);
|
|
47
|
+
}
|
|
48
|
+
else if (event.key === 'Enter' && active) {
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
choose(active);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return (_jsxs(_Fragment, { children: [_jsx(DialogTitle, { className: "sr-only", children: label }), _jsxs("div", { className: "flex h-12 items-center gap-2.5 border-b border-border px-4 max-sm:h-(--size-header)", children: [_jsx(Search, { "aria-hidden": true, className: "size-(--size-icon) shrink-0 text-muted-foreground" }), _jsx("input", { role: "combobox", "aria-expanded": true, "aria-controls": listId, "aria-activedescendant": active ? idOf(active) : undefined, "aria-autocomplete": "list", "aria-label": label, autoComplete: "off", autoCapitalize: "off", spellCheck: false, placeholder: label, disabled: opening !== undefined, "data-testid": "command-palette-input", className: "h-full min-w-0 grow bg-transparent text-body text-foreground outline-none placeholder:text-muted-foreground disabled:opacity-60 max-sm:text-body-touch", value: query, onChange: (event) => {
|
|
54
|
+
setQuery(event.target.value);
|
|
55
|
+
setActiveIndex(0);
|
|
56
|
+
onQueryChange?.(event.target.value);
|
|
57
|
+
}, onKeyDown: onKeyDown }), _jsx(Kbd, { children: "esc" }), _jsx(DialogClose, { render: _jsx(Button, { variant: "ghost", size: "sm", className: "sm:hidden" }), children: "Cancel" })] }), _jsxs("div", { className: "max-h-[min(60dvh,var(--spacing)*100)] overflow-y-auto p-2 max-sm:max-h-none max-sm:grow", children: [entries.length === 0 && isLoading ? _jsx(LoadingRows, {}) : null, entries.length === 0 && !isLoading ? _jsx("p", { className: "px-4 py-6 text-center text-meta text-muted-foreground", children: emptyMessage(query.trim()) }) : null, entries.length === 0 ? null : (_jsx("ul", { id: listId, role: "listbox", "aria-label": "Results", className: "flex flex-col gap-2", children: groups.map((group) => (_jsxs("li", { role: "presentation", className: "flex flex-col gap-0.5", children: [_jsx("p", { id: `${listId}-${group.key}`, className: "px-2.5 pt-1 pb-0.5 text-caption font-medium text-muted-foreground", children: group.label }), _jsx("ul", { role: "group", "aria-labelledby": `${listId}-${group.key}`, className: "flex flex-col gap-0.5", children: group.entries.map((entry) => {
|
|
58
|
+
const isActive = entry === active;
|
|
59
|
+
const isOpening = entry === opening;
|
|
60
|
+
return (_jsx("li", { id: idOf(entry), role: "option", "aria-selected": isActive, "aria-disabled": opening !== undefined && !isOpening ? true : undefined, "data-testid": "command-palette-item", "data-item-key": entry.key, className: classNames('flex h-(--size-control) cursor-pointer items-center gap-2.5 rounded-md px-2.5 text-body text-foreground aria-disabled:opacity-60 max-sm:h-(--size-control-touch)', isActive ? 'bg-accent' : undefined), onPointerMove: () => {
|
|
61
|
+
setActiveIndex(entries.indexOf(entry));
|
|
62
|
+
}, onClick: () => {
|
|
63
|
+
choose(entry);
|
|
64
|
+
}, children: isOpening ? (_jsxs(_Fragment, { children: [_jsx(LoaderCircle, { "aria-hidden": true, className: "size-(--size-icon) shrink-0 animate-spin text-muted-foreground motion-reduce:animate-none" }), _jsxs("span", { className: "min-w-0 truncate", children: ["Opening ", entry.name ?? ''] })] })) : (entry.content) }, entry.key));
|
|
65
|
+
}) })] }, group.key))) }))] }), _jsxs("div", { className: "flex items-center gap-3 border-t border-border px-4 py-2 text-caption text-muted-foreground max-sm:hidden", children: [_jsxs("span", { className: "inline-flex items-center gap-1", children: [_jsx(Kbd, { children: "\u2191" }), _jsx(Kbd, { children: "\u2193" }), "Move"] }), _jsxs("span", { className: "inline-flex items-center gap-1", children: [_jsx(Kbd, { children: _jsx(CornerDownLeft, { "aria-hidden": true, className: "size-3" }) }), "Open"] }), _jsxs("span", { className: "inline-flex items-center gap-1", children: [_jsx(Kbd, { children: "esc" }), "Close"] })] })] }));
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The command palette (header design, docs/design/png/CommandPalette.png):
|
|
69
|
+
* search, then the app's groups of entries, filtered as you type. Arrow keys
|
|
70
|
+
* move, Enter opens, Escape closes. Desktop: a dialog near the top, opened
|
|
71
|
+
* with ⌘K or the header's search. Phone: the search icon opens it full
|
|
72
|
+
* screen (H6). While the entries load, rows in their shape stand in.
|
|
73
|
+
*/
|
|
74
|
+
export function CommandPalette({ isOpen, onOpenChange, ...body }) {
|
|
75
|
+
return (_jsx(Dialog, { open: isOpen, onOpenChange: onOpenChange, children: _jsx(DialogContent, { size: "md", "data-testid": "command-palette", className: classNames('gap-0 p-0 sm:top-[12dvh] sm:translate-y-0', dialogSurface.phoneFullScreen, 'max-sm:flex max-sm:flex-col'), children: _jsx(PaletteBody, { onOpenChange: onOpenChange, ...body }) }) }));
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=command-palette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-palette.js","sourceRoot":"","sources":["../../src/organisms/command-palette.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAsC,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAwC/C,+CAA+C;AAC/C,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB,SAAS,WAAW;IAClB,OAAO,CACL,2BAAe,SAAS,oCAAuB,yBAAyB,EAAC,SAAS,EAAC,yBAAyB,YACzG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,OAAO,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAA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AAK,CAAC,OAAO,CACd,IAzBI,KAAK,CAAC,GAAG,CA0BX,CACN,CAAC;oCACJ,CAAC,CAAC,GACC,KA3CE,KAAK,CAAC,GAAG,CA4Cb,CACN,CAAC,GACC,CACN,IACG,EACN,eAAK,SAAS,EAAC,2GAA2G,aACxH,gBAAM,SAAS,EAAC,gCAAgC,aAC9C,KAAC,GAAG,yBAAQ,EACZ,KAAC,GAAG,yBAAQ,YAEP,EACP,gBAAM,SAAS,EAAC,gCAAgC,aAC9C,KAAC,GAAG,cACF,KAAC,cAAc,yBAAa,SAAS,EAAC,QAAQ,GAAG,GAC7C,YAED,EACP,gBAAM,SAAS,EAAC,gCAAgC,aAC9C,KAAC,GAAG,sBAAU,aAET,IACH,IACL,CACJ,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,EAAuB;IACnF,OAAO,CACL,KAAC,MAAM,IAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,YAC9C,KAAC,aAAa,IACZ,IAAI,EAAC,IAAI,iBACG,iBAAiB,EAC7B,SAAS,EAAE,UAAU,CAAC,2CAA2C,EAAE,aAAa,CAAC,eAAe,EAAE,6BAA6B,CAAC,YAEhI,KAAC,WAAW,IAAC,YAAY,EAAE,YAAY,KAAM,IAAI,GAAI,GACvC,GACT,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type SignInBackgroundName } from './sign-in-backgrounds.js';
|
|
2
|
+
/**
|
|
3
|
+
* The ground of a signed-out screen (docs/design/sign-in-backgrounds): one of
|
|
4
|
+
* the six backgrounds, picked at random at load, covering its positioned
|
|
5
|
+
* parent behind the card. Without a background named, it shows the one picked.
|
|
6
|
+
*/
|
|
7
|
+
export declare function SignInBackground({ background, className }: {
|
|
8
|
+
background?: SignInBackgroundName;
|
|
9
|
+
className?: string;
|
|
10
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId, useSyncExternalStore } from 'react';
|
|
4
|
+
import { classNames } from '../class-names.js';
|
|
5
|
+
import { SIGN_IN_CANVAS, SIGN_IN_HORIZON, SIGN_IN_SUN_SHARE, drawSignInBackground, pickSignInBackground, } from './sign-in-backgrounds.js';
|
|
6
|
+
/**
|
|
7
|
+
* Picked once per page load in the browser, so every screen that shows a
|
|
8
|
+
* background in this load shows the same one. The server picks none: the
|
|
9
|
+
* background appears once the page runs, and server and browser agree.
|
|
10
|
+
*/
|
|
11
|
+
const PICKED_AT_LOAD = pickSignInBackground(Math.random);
|
|
12
|
+
function pickedAtLoad() {
|
|
13
|
+
return PICKED_AT_LOAD;
|
|
14
|
+
}
|
|
15
|
+
function pickedOnServer() {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
function staysPut() {
|
|
19
|
+
return () => undefined;
|
|
20
|
+
}
|
|
21
|
+
/** The faintness from the mockup, on the brand foreground and primary; the sun and the sky have their own light and dark. */
|
|
22
|
+
const TONES = classNames('[--sign-in-faint:color-mix(in_oklch,var(--foreground)_11%,transparent)] [--sign-in-brand:color-mix(in_oklch,var(--primary)_22%,transparent)]', '[--sign-in-warm:oklch(0.88_0.06_60)] [--sign-in-sky:oklch(0.9_0.04_255)]', 'dark:[--sign-in-faint:color-mix(in_oklch,var(--foreground)_9%,transparent)] dark:[--sign-in-brand:color-mix(in_oklch,var(--primary)_20%,transparent)]', 'dark:[--sign-in-warm:oklch(0.55_0.06_55)] dark:[--sign-in-sky:oklch(0.3_0.05_260)]');
|
|
23
|
+
const COLOUR = {
|
|
24
|
+
faint: 'var(--sign-in-faint)',
|
|
25
|
+
brand: 'var(--sign-in-brand)',
|
|
26
|
+
warm: 'var(--sign-in-warm)',
|
|
27
|
+
};
|
|
28
|
+
const { width: WIDTH, height: HEIGHT } = SIGN_IN_CANVAS;
|
|
29
|
+
const HORIZON_PERCENT = `${String((SIGN_IN_HORIZON / HEIGHT) * 100)}%`;
|
|
30
|
+
const HILLS = `M0 ${String(SIGN_IN_HORIZON)} L0 186 C 180 166 320 182 470 172 S 760 192 920 178 S 1260 160 1420 182 L ${String(WIDTH)} 176 L ${String(WIDTH)} ${String(SIGN_IN_HORIZON)} Z`;
|
|
31
|
+
const SUN_TRANSFORM = `translate(${String(SIGN_IN_SUN_SHARE)} 0.2) scale(0.35 1) translate(${String(-SIGN_IN_SUN_SHARE)} -0.2)`;
|
|
32
|
+
/**
|
|
33
|
+
* The ground of a signed-out screen (docs/design/sign-in-backgrounds): one of
|
|
34
|
+
* the six backgrounds, picked at random at load, covering its positioned
|
|
35
|
+
* parent behind the card. Without a background named, it shows the one picked.
|
|
36
|
+
*/
|
|
37
|
+
export function SignInBackground({ background, className }) {
|
|
38
|
+
const picked = useSyncExternalStore(staysPut, pickedAtLoad, pickedOnServer);
|
|
39
|
+
const id = useId();
|
|
40
|
+
const shown = background ?? picked;
|
|
41
|
+
if (shown === undefined) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const skyId = `${id}-sky`;
|
|
45
|
+
const sunId = `${id}-sun`;
|
|
46
|
+
return (_jsxs("svg", { "data-testid": "sign-in-background", "data-background": shown, "aria-hidden": "true", viewBox: `0 0 ${String(WIDTH)} ${String(HEIGHT)}`, preserveAspectRatio: "xMidYMid slice", className: classNames('pointer-events-none absolute inset-0 size-full', TONES, className), children: [_jsxs("defs", { children: [_jsxs("linearGradient", { id: skyId, x1: 0, y1: 0, x2: 0, y2: 1, children: [_jsx("stop", { offset: "0%", stopColor: "var(--sign-in-sky)", stopOpacity: 0 }), _jsx("stop", { offset: HORIZON_PERCENT, stopColor: "var(--sign-in-warm)", stopOpacity: 0.4 }), _jsx("stop", { offset: "50%", stopColor: "var(--sign-in-sky)", stopOpacity: 0.12 }), _jsx("stop", { offset: "100%", stopColor: "var(--sign-in-sky)", stopOpacity: 0 })] }), _jsxs("radialGradient", { id: sunId, cx: SIGN_IN_SUN_SHARE, cy: 0.2, r: 0.35, gradientTransform: SUN_TRANSFORM, children: [_jsx("stop", { offset: "0%", stopColor: "var(--sign-in-warm)", stopOpacity: 0.4 }), _jsx("stop", { offset: "100%", stopColor: "var(--sign-in-warm)", stopOpacity: 0 })] })] }), _jsx("rect", { width: WIDTH, height: HEIGHT, fill: `url(#${skyId})` }), _jsx("rect", { width: WIDTH, height: HEIGHT, fill: `url(#${sunId})` }), _jsx("path", { d: HILLS, fill: COLOUR.brand, opacity: 0.45 }), _jsx("line", { x1: 0, y1: SIGN_IN_HORIZON, x2: WIDTH, y2: SIGN_IN_HORIZON, stroke: COLOUR.faint, strokeWidth: 1 }), drawSignInBackground(shown).map((mark) => mark.kind === 'boat' ? (_jsxs("g", { transform: `translate(${String(mark.x)} ${String(mark.y)}) scale(${String(mark.scale)})`, fill: COLOUR[mark.tone], children: [_jsx("path", { d: "M0 -26 L0 0 L13 0 Z" }), _jsx("path", { d: "M-2 -20 L-2 0 L-11 0 Z", opacity: 0.75 }), _jsx("path", { d: "M-13 3 L15 3 L11 8 L-9 8 Z" })] }, `boat ${String(mark.x)} ${String(mark.y)}`)) : (_jsx("line", { x1: mark.x1, y1: mark.y1, x2: mark.x2, y2: mark.y2, stroke: COLOUR[mark.tone], strokeWidth: mark.width, opacity: mark.opacity, strokeLinecap: mark.isDashed ? undefined : 'round', strokeDasharray: mark.isDashed ? '4 6' : undefined }, `line ${String(mark.x1)} ${String(mark.y1)} ${String(mark.x2)} ${String(mark.y2)}`)))] }));
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=sign-in-background.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sign-in-background.js","sourceRoot":"","sources":["../../src/organisms/sign-in-background.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,KAAK,EAAE,oBAAoB,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,EAAE,IAAI,CAAC,EAAE,EACX,EAAE,EAAE,IAAI,CAAC,EAAE,EACX,EAAE,EAAE,IAAI,CAAC,EAAE,EACX,EAAE,EAAE,IAAI,CAAC,EAAE,EACX,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EACzB,WAAW,EAAE,IAAI,CAAC,KAAK,EACvB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,EAClD,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,IAT7C,QAAQ,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAUvF,CACH,CACF,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The six backgrounds of the signed-out screens, ported from
|
|
3
|
+
* docs/design/sign-in-backgrounds/mockup.html: the sea seen from above with
|
|
4
|
+
* single ships, and in five of them squadrons sailing among them. Each draws
|
|
5
|
+
* the same every time from its seeds, on a 1600 by 1000 canvas; one is picked
|
|
6
|
+
* at random when a screen loads.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SIGN_IN_BACKGROUNDS: readonly ["from-above-1", "squadrons-1", "squadrons-3", "squadrons-4", "squadrons-5", "squadrons-6"];
|
|
9
|
+
export type SignInBackgroundName = (typeof SIGN_IN_BACKGROUNDS)[number];
|
|
10
|
+
/** The canvas every background is drawn on; it covers the screen, cut at the sides or the top and bottom. */
|
|
11
|
+
export declare const SIGN_IN_CANVAS: {
|
|
12
|
+
readonly width: 1600;
|
|
13
|
+
readonly height: 1000;
|
|
14
|
+
};
|
|
15
|
+
export declare const SIGN_IN_HORIZON: number;
|
|
16
|
+
/** Where the sun's glow on the water sits, as a share of the width. */
|
|
17
|
+
export declare const SIGN_IN_SUN_SHARE = 0.68;
|
|
18
|
+
/** faint: the foreground, barely there. brand: the primary, a little stronger. warm: the sun's glow. */
|
|
19
|
+
export type SignInTone = 'faint' | 'brand' | 'warm';
|
|
20
|
+
export type SignInMark = {
|
|
21
|
+
readonly kind: 'line';
|
|
22
|
+
readonly x1: number;
|
|
23
|
+
readonly y1: number;
|
|
24
|
+
readonly x2: number;
|
|
25
|
+
readonly y2: number;
|
|
26
|
+
readonly tone: SignInTone;
|
|
27
|
+
readonly width: number;
|
|
28
|
+
readonly opacity: number;
|
|
29
|
+
readonly isDashed: boolean;
|
|
30
|
+
} | {
|
|
31
|
+
readonly kind: 'boat';
|
|
32
|
+
readonly x: number;
|
|
33
|
+
readonly y: number;
|
|
34
|
+
readonly scale: number;
|
|
35
|
+
readonly tone: SignInTone;
|
|
36
|
+
};
|
|
37
|
+
/** Which background a screen shows, from a random number in [0, 1). */
|
|
38
|
+
export declare function pickSignInBackground(random: () => number): SignInBackgroundName;
|
|
39
|
+
/** The marks of one background, back to front: the water, then each ship's wake and the ship. */
|
|
40
|
+
export declare function drawSignInBackground(background: SignInBackgroundName): readonly SignInMark[];
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The six backgrounds of the signed-out screens, ported from
|
|
3
|
+
* docs/design/sign-in-backgrounds/mockup.html: the sea seen from above with
|
|
4
|
+
* single ships, and in five of them squadrons sailing among them. Each draws
|
|
5
|
+
* the same every time from its seeds, on a 1600 by 1000 canvas; one is picked
|
|
6
|
+
* at random when a screen loads.
|
|
7
|
+
*/
|
|
8
|
+
export const SIGN_IN_BACKGROUNDS = ['from-above-1', 'squadrons-1', 'squadrons-3', 'squadrons-4', 'squadrons-5', 'squadrons-6'];
|
|
9
|
+
/** The canvas every background is drawn on; it covers the screen, cut at the sides or the top and bottom. */
|
|
10
|
+
export const SIGN_IN_CANVAS = { width: 1600, height: 1000 };
|
|
11
|
+
/** Where the sea meets the hills, as a share of the height. */
|
|
12
|
+
const HORIZON_SHARE = 0.2;
|
|
13
|
+
export const SIGN_IN_HORIZON = SIGN_IN_CANVAS.height * HORIZON_SHARE;
|
|
14
|
+
/** Where the sun's glow on the water sits, as a share of the width. */
|
|
15
|
+
export const SIGN_IN_SUN_SHARE = 0.68;
|
|
16
|
+
const WATER_SEED = 41;
|
|
17
|
+
const WATER_LINES = 190;
|
|
18
|
+
const SHIPS_FROM_ABOVE = [
|
|
19
|
+
[0.14, 0.25, 20], [0.42, 0.12, -10], [0.83, 0.2, 200], [0.9, 0.55, -30], [0.22, 0.7, 15], [0.62, 0.82, 195], [0.08, 0.95, -20], [0.95, 0.9, 170],
|
|
20
|
+
[0.5, 0.4, 10], [0.33, 0.5, 190], [0.7, 0.06, 0], [0.27, 0.06, 180], [0.58, 0.3, 200], [0.04, 0.45, 10], [0.76, 0.68, -15], [0.4, 0.96, 185],
|
|
21
|
+
];
|
|
22
|
+
const SINGLE_SHIPS = [
|
|
23
|
+
[0.14, 0.25, 20], [0.42, 0.12, -10], [0.83, 0.2, 200], [0.9, 0.55, -30], [0.08, 0.95, -20], [0.95, 0.9, 170],
|
|
24
|
+
[0.33, 0.5, 190], [0.04, 0.45, 10], [0.7, 0.06, 0], [0.27, 0.07, 180], [0.58, 0.32, 200], [0.52, 0.05, 10],
|
|
25
|
+
];
|
|
26
|
+
const SQUADRONS = {
|
|
27
|
+
'squadrons-1': { seed: 61, squadrons: [[0.2, 0.72, 15, 'loose', 4], [0.74, 0.6, 195, 'loose', 5], [0.6, 0.15, 5, 'loose', 3]] },
|
|
28
|
+
'squadrons-3': { seed: 89, squadrons: [[0.18, 0.78, 15, 'line', 4], [0.8, 0.6, 195, 'line', 5], [0.55, 0.18, 5, 'line', 4], [0.3, 0.3, 190, 'line', 3]] },
|
|
29
|
+
'squadrons-4': { seed: 97, squadrons: [[0.2, 0.72, 15, 'loose', 4], [0.8, 0.6, 195, 'line', 4], [0.58, 0.16, 5, 'loose', 3], [0.3, 0.32, 190, 'line', 3]] },
|
|
30
|
+
'squadrons-5': { seed: 53, squadrons: [[0.2, 0.74, 15, 'tight', 5], [0.76, 0.6, 195, 'tight', 4], [0.6, 0.15, 5, 'tight', 3], [0.12, 0.4, 10, 'tight', 3]] },
|
|
31
|
+
'squadrons-6': { seed: 83, squadrons: [[0.18, 0.78, 15, 'curve', 5], [0.82, 0.6, 195, 'curve', 5], [0.55, 0.17, 5, 'curve', 4]] },
|
|
32
|
+
};
|
|
33
|
+
/** The card's place in the middle of the canvas, where no ship sails. */
|
|
34
|
+
const CARD_HALF_WIDTH = 250;
|
|
35
|
+
const CARD_HALF_HEIGHT = 200;
|
|
36
|
+
/** Which background a screen shows, from a random number in [0, 1). */
|
|
37
|
+
export function pickSignInBackground(random) {
|
|
38
|
+
const index = Math.min(SIGN_IN_BACKGROUNDS.length - 1, Math.floor(random() * SIGN_IN_BACKGROUNDS.length));
|
|
39
|
+
return SIGN_IN_BACKGROUNDS[index] ?? 'from-above-1';
|
|
40
|
+
}
|
|
41
|
+
/** The marks of one background, back to front: the water, then each ship's wake and the ship. */
|
|
42
|
+
export function drawSignInBackground(background) {
|
|
43
|
+
const random = seededRandom(WATER_SEED);
|
|
44
|
+
const water = Array.from({ length: WATER_LINES }, () => waterLine(random));
|
|
45
|
+
const ships = background === 'from-above-1' ? SHIPS_FROM_ABOVE : shipsInSquadrons(SQUADRONS[background]);
|
|
46
|
+
return [...water, ...ships.flatMap(shipMarks)];
|
|
47
|
+
}
|
|
48
|
+
/** The mockup's generator (Park and Miller), so each seed draws what the mockup drew. */
|
|
49
|
+
function seededRandom(seed) {
|
|
50
|
+
const modulus = 2147483647;
|
|
51
|
+
const multiplier = 16807;
|
|
52
|
+
let state = seed;
|
|
53
|
+
return () => {
|
|
54
|
+
state = (state * multiplier) % modulus;
|
|
55
|
+
return state / modulus;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** A short line on the water, longer and thicker toward the viewer, warm where the sun glows on it. */
|
|
59
|
+
function waterLine(random) {
|
|
60
|
+
const { width, height } = SIGN_IN_CANVAS;
|
|
61
|
+
const toward = Math.pow(random(), 1.6);
|
|
62
|
+
const y = SIGN_IN_HORIZON + 4 + (height - SIGN_IN_HORIZON) * toward;
|
|
63
|
+
const x = random() * width;
|
|
64
|
+
const length = (6 + random() * 18) * (0.4 + toward * 3);
|
|
65
|
+
const isNearSun = Math.abs(x - width * SIGN_IN_SUN_SHARE) < 40 + toward * 260;
|
|
66
|
+
return {
|
|
67
|
+
kind: 'line',
|
|
68
|
+
x1: x - length / 2,
|
|
69
|
+
y1: y,
|
|
70
|
+
x2: x + length / 2,
|
|
71
|
+
y2: y,
|
|
72
|
+
tone: isNearSun ? 'warm' : 'faint',
|
|
73
|
+
width: 0.6 + toward * 1.2,
|
|
74
|
+
opacity: isNearSun ? 0.8 : 0.6,
|
|
75
|
+
isDashed: false,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/** The single ships, then each squadron's ships around its lead. */
|
|
79
|
+
function shipsInSquadrons({ seed, squadrons }) {
|
|
80
|
+
const random = seededRandom(seed);
|
|
81
|
+
const inSquadrons = squadrons.flatMap(([across, toward, heading, shape, size]) => {
|
|
82
|
+
const direction = Math.cos(radians(heading)) >= 0 ? 1 : -1;
|
|
83
|
+
return Array.from({ length: size }, (_, place) => {
|
|
84
|
+
const [offsetAcross, offsetToward] = squadronOffset({ shape, place, size, direction, random });
|
|
85
|
+
return [across + offsetAcross, Math.min(0.99, Math.max(0.02, toward + offsetToward)), heading];
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
return [...SINGLE_SHIPS, ...inSquadrons];
|
|
89
|
+
}
|
|
90
|
+
/** Where a ship sails from its squadron's lead: scattered, close abreast, astern on a bending course, or astern in line. */
|
|
91
|
+
function squadronOffset({ shape, place, size, direction, random }) {
|
|
92
|
+
switch (shape) {
|
|
93
|
+
case 'loose': {
|
|
94
|
+
const across = (random() - 0.5) * 0.09;
|
|
95
|
+
return [across, (random() - 0.5) * 0.08];
|
|
96
|
+
}
|
|
97
|
+
case 'tight': {
|
|
98
|
+
const across = (place - (size - 1) / 2) * 0.018 + (random() - 0.5) * 0.02;
|
|
99
|
+
return [across, (random() - 0.5) * 0.05];
|
|
100
|
+
}
|
|
101
|
+
case 'curve':
|
|
102
|
+
return [-direction * place * 0.03, place * 0.012 + Math.sin(place * 0.9) * 0.025];
|
|
103
|
+
case 'line':
|
|
104
|
+
return [-direction * place * 0.03, place * 0.012];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/** A ship and its wake, bigger toward the viewer; none sails where the card sits. */
|
|
108
|
+
function shipMarks([across, toward, heading]) {
|
|
109
|
+
const { width, height } = SIGN_IN_CANVAS;
|
|
110
|
+
const x = across * width;
|
|
111
|
+
const y = SIGN_IN_HORIZON + (height - SIGN_IN_HORIZON) * toward;
|
|
112
|
+
if (Math.abs(x - width / 2) < CARD_HALF_WIDTH && Math.abs(y - height / 2) < CARD_HALF_HEIGHT) {
|
|
113
|
+
return [];
|
|
114
|
+
}
|
|
115
|
+
const scale = 0.3 + toward * 1.2;
|
|
116
|
+
const tone = toward > 0.6 ? 'brand' : 'faint';
|
|
117
|
+
const isHeadingLeft = heading > 90 && heading < 270;
|
|
118
|
+
return [...wake({ x, y: y + 6 * scale, scale: scale * 0.8, heading: isHeadingLeft ? 180 : 0, length: 40 + toward * 120, tone }), { kind: 'boat', x, y, scale, tone }];
|
|
119
|
+
}
|
|
120
|
+
/** The V a ship leaves behind it, and the dashed line along its middle. */
|
|
121
|
+
function wake({ x, y, scale, heading, length, tone }) {
|
|
122
|
+
const back = radians(heading + 180);
|
|
123
|
+
const sternX = x + Math.cos(back) * 14 * scale;
|
|
124
|
+
const sternY = y + Math.sin(back) * 14 * scale;
|
|
125
|
+
const arms = [-14, 14].map((spread) => {
|
|
126
|
+
const angle = back + radians(spread);
|
|
127
|
+
return { kind: 'line', x1: sternX, y1: sternY, x2: x + Math.cos(angle) * length, y2: y + Math.sin(angle) * length, tone, width: Math.max(0.6, scale * 0.9), opacity: 0.7, isDashed: false };
|
|
128
|
+
});
|
|
129
|
+
const middle = { kind: 'line', x1: sternX, y1: sternY, x2: x + Math.cos(back) * length * 1.1, y2: y + Math.sin(back) * length * 1.1, tone, width: Math.max(0.5, scale * 0.6), opacity: 0.4, isDashed: true };
|
|
130
|
+
return [...arms, middle];
|
|
131
|
+
}
|
|
132
|
+
function radians(degrees) {
|
|
133
|
+
return (degrees * Math.PI) / 180;
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=sign-in-backgrounds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sign-in-backgrounds.js","sourceRoot":"","sources":["../../src/organisms/sign-in-backgrounds.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,CAAU,CAAC;AAIxI,6GAA6G;AAC7G,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAW,CAAC;AAErE,+DAA+D;AAC/D,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC,MAAM,GAAG,aAAa,CAAC;AAErE,uEAAuE;AACvE,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AA2BtC,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,MAAM,gBAAgB,GAAoB;IACxC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,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
1
|
+
/*
|
|
2
|
+
* The theme every Aeolus web app shows. tokens.css is the single copy of the
|
|
3
|
+
* design tokens, light on :root and dark on .dark. It is imported unlayered,
|
|
4
|
+
* so its values win over Tailwind's theme layer at runtime.
|
|
5
|
+
*
|
|
6
|
+
* Tailwind makes utilities only for keys it knows. Colours are mapped onto its
|
|
7
|
+
* --color-* names. Every other token already has a Tailwind name (--text-*,
|
|
8
|
+
* --radius-*, --shadow-*, --font-*), so it is registered as a reference to
|
|
9
|
+
* itself: the utility reads the variable, and tokens.css sets it. No value is
|
|
10
|
+
* written twice.
|
|
11
|
+
*
|
|
12
|
+
* Each app imports Tailwind and tw-animate-css first, then this file, and
|
|
13
|
+
* scans @aeolus-fleet/ui with @source.
|
|
14
|
+
*/
|
|
15
|
+
@import './tokens.css';
|
|
16
|
+
|
|
17
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
18
|
+
|
|
19
|
+
@theme inline {
|
|
20
|
+
--color-background: var(--background);
|
|
21
|
+
--color-foreground: var(--foreground);
|
|
22
|
+
--color-card: var(--card);
|
|
23
|
+
--color-card-foreground: var(--card-foreground);
|
|
24
|
+
--color-popover: var(--popover);
|
|
25
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
26
|
+
--color-muted: var(--muted);
|
|
27
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
28
|
+
--color-secondary: var(--secondary);
|
|
29
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
30
|
+
--color-accent: var(--accent);
|
|
31
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
32
|
+
--color-sidebar: var(--sidebar);
|
|
33
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
34
|
+
--color-highlight: var(--highlight);
|
|
35
|
+
--color-overlay: var(--overlay);
|
|
36
|
+
--color-primary: var(--primary);
|
|
37
|
+
--color-primary-hover: var(--primary-hover);
|
|
38
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
39
|
+
--color-destructive: var(--destructive);
|
|
40
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
41
|
+
--color-destructive-text: var(--destructive-text);
|
|
42
|
+
--color-border: var(--border);
|
|
43
|
+
--color-input: var(--input);
|
|
44
|
+
--color-ring: var(--ring);
|
|
45
|
+
--color-tone-waiting-bg: var(--tone-waiting-bg);
|
|
46
|
+
--color-tone-waiting-fg: var(--tone-waiting-fg);
|
|
47
|
+
--color-tone-waiting-border: var(--tone-waiting-border);
|
|
48
|
+
--color-tone-active-bg: var(--tone-active-bg);
|
|
49
|
+
--color-tone-active-fg: var(--tone-active-fg);
|
|
50
|
+
--color-tone-active-border: var(--tone-active-border);
|
|
51
|
+
--color-tone-ok-bg: var(--tone-ok-bg);
|
|
52
|
+
--color-tone-ok-fg: var(--tone-ok-fg);
|
|
53
|
+
--color-tone-ok-border: var(--tone-ok-border);
|
|
54
|
+
--color-tone-attention-bg: var(--tone-attention-bg);
|
|
55
|
+
--color-tone-attention-fg: var(--tone-attention-fg);
|
|
56
|
+
--color-tone-attention-border: var(--tone-attention-border);
|
|
57
|
+
--color-tone-ended-bg: var(--tone-ended-bg);
|
|
58
|
+
--color-tone-ended-fg: var(--tone-ended-fg);
|
|
59
|
+
--color-tone-ended-border: var(--tone-ended-border);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@theme {
|
|
63
|
+
--font-sans: var(--font-sans);
|
|
64
|
+
--font-mono: var(--font-mono);
|
|
65
|
+
--radius-xs: var(--radius-xs);
|
|
66
|
+
--radius-sm: var(--radius-sm);
|
|
67
|
+
--radius-md: var(--radius-md);
|
|
68
|
+
--radius-lg: var(--radius-lg);
|
|
69
|
+
--radius-xl: var(--radius-xl);
|
|
70
|
+
--radius-2xl: var(--radius-2xl);
|
|
71
|
+
--shadow-sm: var(--shadow-sm);
|
|
72
|
+
--shadow-md: var(--shadow-md);
|
|
73
|
+
--shadow-lg: var(--shadow-lg);
|
|
74
|
+
--ease-standard: var(--ease-standard);
|
|
75
|
+
--ease-exit: var(--ease-exit);
|
|
76
|
+
--text-micro: var(--text-micro);
|
|
77
|
+
--text-micro--line-height: var(--text-micro--line-height);
|
|
78
|
+
--text-caption: var(--text-caption);
|
|
79
|
+
--text-caption--line-height: var(--text-caption--line-height);
|
|
80
|
+
--text-meta: var(--text-meta);
|
|
81
|
+
--text-meta--line-height: var(--text-meta--line-height);
|
|
82
|
+
--text-body: var(--text-body);
|
|
83
|
+
--text-body--line-height: var(--text-body--line-height);
|
|
84
|
+
--text-section: var(--text-section);
|
|
85
|
+
--text-section--line-height: var(--text-section--line-height);
|
|
86
|
+
--text-body-touch: var(--text-body-touch);
|
|
87
|
+
--text-body-touch--line-height: var(--text-body-touch--line-height);
|
|
88
|
+
--text-input-touch: var(--text-input-touch);
|
|
89
|
+
--text-input-touch--line-height: var(--text-input-touch--line-height);
|
|
90
|
+
--text-heading: var(--text-heading);
|
|
91
|
+
--text-heading--line-height: var(--text-heading--line-height);
|
|
92
|
+
--text-heading-touch: var(--text-heading-touch);
|
|
93
|
+
--text-heading-touch--line-height: var(--text-heading-touch--line-height);
|
|
94
|
+
--text-title: var(--text-title);
|
|
95
|
+
--text-title--line-height: var(--text-title--line-height);
|
|
96
|
+
--text-title-touch: var(--text-title-touch);
|
|
97
|
+
--text-title-touch--line-height: var(--text-title-touch--line-height);
|
|
98
|
+
--text-metric: var(--text-metric);
|
|
99
|
+
--text-metric--line-height: var(--text-metric--line-height);
|
|
100
|
+
--text-id: var(--text-id);
|
|
101
|
+
--text-id--line-height: var(--text-id--line-height);
|
|
102
|
+
--text-code: var(--text-code);
|
|
103
|
+
--text-code--line-height: var(--text-code--line-height);
|
|
104
|
+
|
|
105
|
+
/* A row that just appeared starts on --highlight and fades back (Table). */
|
|
106
|
+
--animate-highlight: highlight-fade var(--duration-highlight) var(--ease-standard);
|
|
107
|
+
|
|
108
|
+
@keyframes highlight-fade {
|
|
109
|
+
from {
|
|
110
|
+
background-color: var(--highlight);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@layer base {
|
|
116
|
+
* {
|
|
117
|
+
@apply border-border;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
body {
|
|
121
|
+
@apply bg-background font-sans text-body text-foreground antialiased;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
:focus-visible {
|
|
125
|
+
@apply outline-2 outline-offset-2 outline-ring;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* Every clickable control shows the pointer, once, here (docs/design/conventions.md, "Stack"). */
|
|
129
|
+
button,
|
|
130
|
+
[role='button'],
|
|
131
|
+
[data-slot='button'],
|
|
132
|
+
[role='menuitem'],
|
|
133
|
+
[role='menuitemcheckbox'],
|
|
134
|
+
[role='menuitemradio'],
|
|
135
|
+
[role='option'],
|
|
136
|
+
[role='tab'],
|
|
137
|
+
[role='checkbox'],
|
|
138
|
+
[role='switch'] {
|
|
139
|
+
cursor: pointer;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* A disabled control takes the default cursor. */
|
|
143
|
+
:is(
|
|
144
|
+
button,
|
|
145
|
+
[role='button'],
|
|
146
|
+
[data-slot='button'],
|
|
147
|
+
[role='menuitem'],
|
|
148
|
+
[role='menuitemcheckbox'],
|
|
149
|
+
[role='menuitemradio'],
|
|
150
|
+
[role='option'],
|
|
151
|
+
[role='tab'],
|
|
152
|
+
[role='checkbox'],
|
|
153
|
+
[role='switch']
|
|
154
|
+
):is(:disabled, [aria-disabled='true'], [data-disabled]) {
|
|
155
|
+
cursor: default;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@media (prefers-reduced-motion: reduce) {
|
|
159
|
+
*,
|
|
160
|
+
::before,
|
|
161
|
+
::after {
|
|
162
|
+
animation-duration: 0ms !important;
|
|
163
|
+
animation-iteration-count: 1 !important;
|
|
164
|
+
transition-duration: 0ms !important;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|