@addiscorp/kit 0.5.0 → 0.6.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 +34 -0
- package/dist/account/index.d.ts +32 -0
- package/dist/account/index.js +66 -0
- package/dist/account/shared.d.ts +56 -0
- package/dist/account/shared.js +69 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/kit.css +43 -0
- package/dist/tool/tools.d.ts +2 -1
- package/dist/tool/tools.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -75,6 +75,40 @@ const p8: License = { // a for
|
|
|
75
75
|
- **`note`** on the page is for what the product must add: a part that keeps an upstream license.
|
|
76
76
|
- **`href`** moves the page from `/license/`.
|
|
77
77
|
|
|
78
|
+
## The account control
|
|
79
|
+
|
|
80
|
+
`AccountMenu` is the standard account control for every Addis app (Sami, 5 Dec), top right, often in the
|
|
81
|
+
Header's `end` slot. Signed out, it shows a plain "Sign in". Signed in, it shows a pill with the photo
|
|
82
|
+
(or initial) in a ring and the first name. The pill opens a small menu:
|
|
83
|
+
- the photo again, with a pencil to change it;
|
|
84
|
+
- the name and email;
|
|
85
|
+
- the account links;
|
|
86
|
+
- "Sign out".
|
|
87
|
+
|
|
88
|
+
Escape, a click outside, or focus leaving closes the menu.
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
import { AccountMenu, accountLinks } from '@addiscorp/kit';
|
|
92
|
+
|
|
93
|
+
<AccountMenu
|
|
94
|
+
who={{ name: 'Meron Tesfaye', initial: 'M', email: 'meron@example.com', avatarUrl }} // or null
|
|
95
|
+
signInHref="/auth/login/?returnTo=%2F"
|
|
96
|
+
signOut={{ action: '/auth/signout/' }} // or { onSelect: () => … } in a desktop app
|
|
97
|
+
links={accountLinks()} // account.addis.gg's sections (the default)
|
|
98
|
+
ring="#FFE14D" // any CSS background; the addis flag by default
|
|
99
|
+
action={<a href="/dashboard/">Dashboard</a>} // optional, beside the pill
|
|
100
|
+
/>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
A pre-rendered page renders it with `who={null}`, an `id`, and `read`, its own strict reader of the
|
|
104
|
+
display cookies. `read` fills the control on every mount, client-side navigations included. Right after
|
|
105
|
+
the control, the page puts the script `accountScript(id, readSource)` returns, which fills it before
|
|
106
|
+
first paint. That script carries a `__name` stand-in, because Cloudflare's bundler adds calls to one.
|
|
107
|
+
Signed in with no one to show gives a bare "Sign out". `labels` translates the words. The helpers
|
|
108
|
+
(`accountLinks`, `accountScript`, `fillAccount`, `ADDIS_RING`, the types) live in a module without
|
|
109
|
+
`'use client'`, so a server component can call them. `read` is a function, so render `<AccountMenu read={…}>`
|
|
110
|
+
from a client component: a server component can't pass a function to it.
|
|
111
|
+
|
|
78
112
|
## Make it yours
|
|
79
113
|
|
|
80
114
|
- **Colours and fonts** are variables. Set your brand's after importing `kit.css`:
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type AccountLabels, type AccountLink, type AccountState, type AccountWho } from './shared.js';
|
|
3
|
+
export type AccountMenuProps = {
|
|
4
|
+
/** Who is signed in; null for a visitor, or for a pre-rendered page that `fillAccount` fills. */
|
|
5
|
+
who: AccountWho | null;
|
|
6
|
+
/** Where "Sign in" goes: the app's own sign-in, which comes back signed in. */
|
|
7
|
+
signInHref: string;
|
|
8
|
+
/** "Sign out": a POST to `action` (a website), or `onSelect` (a desktop app). */
|
|
9
|
+
signOut: {
|
|
10
|
+
action: string;
|
|
11
|
+
} | {
|
|
12
|
+
onSelect: () => void;
|
|
13
|
+
};
|
|
14
|
+
/** The menu's links. Default: account.addis.gg's sections. */
|
|
15
|
+
links?: AccountLink[];
|
|
16
|
+
/** Where the pencil on the photo goes. Default: the Avatar section of account.addis.gg. */
|
|
17
|
+
pictureHref?: string;
|
|
18
|
+
/** The ring around the photo: any CSS background (a colour or a gradient). Default: the addis flag. */
|
|
19
|
+
ring?: string;
|
|
20
|
+
/** Beside the pill: the app's main action ("Dashboard"), signed in only. */
|
|
21
|
+
action?: ReactNode;
|
|
22
|
+
labels?: Partial<AccountLabels>;
|
|
23
|
+
/** The root's id: what `accountScript` finds it by on a pre-rendered page. */
|
|
24
|
+
id?: string;
|
|
25
|
+
/**
|
|
26
|
+
* A pre-rendered page's reader (its display cookies, say): called on every mount, a client-side
|
|
27
|
+
* navigation included, and drawn in with `fillAccount`, so the control is right without React drawing
|
|
28
|
+
* who it is. Leave it out when `who` is known at render.
|
|
29
|
+
*/
|
|
30
|
+
read?: () => AccountState;
|
|
31
|
+
};
|
|
32
|
+
export declare function AccountMenu({ who, signInHref, signOut, links, pictureHref, ring, action, labels, id, read }: AccountMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
// The account control every Addis app shows top right (Sami, 5 Dec: the standard account component).
|
|
4
|
+
// Signed out: a plain "Sign in" button. Signed in: a pill with the photo (or initial) in a ring and the
|
|
5
|
+
// first name, which opens a small menu: the photo again with a pencil to change it, the name and email,
|
|
6
|
+
// the app's account links, then "Sign out". Escape, a click outside, or focus leaving closes it.
|
|
7
|
+
//
|
|
8
|
+
// Two ways to use it:
|
|
9
|
+
// - An app that knows who is signed in when it renders (account.addis.gg, staff) passes `who`.
|
|
10
|
+
// - A pre-rendered site (addis.gg, heyava.ca) renders it with `who={null}` and fills it before first paint
|
|
11
|
+
// with `fillAccount`, from an inline script right after it and again once React has hydrated. React then
|
|
12
|
+
// never draws the name or photo itself, so hydration has nothing to disagree with: every text node it
|
|
13
|
+
// could disagree on holds one placeholder character and carries suppressHydrationWarning.
|
|
14
|
+
import { useEffect, useId, useLayoutEffect, useRef, useState } from 'react';
|
|
15
|
+
import { ACCOUNT_LABELS, ADDIS_RING, accountLinks, fillAccount, firstName } from './shared.js';
|
|
16
|
+
/** A no-break space: the text node `fillAccount` replaces. */
|
|
17
|
+
const PLACEHOLDER = ' ';
|
|
18
|
+
/** The menu links' icons: 24-unit line drawings in the text's colour. Decorative: the label says what it is. */
|
|
19
|
+
const ICONS = {
|
|
20
|
+
edit: _jsxs(_Fragment, { children: [_jsx("path", { d: "M4 20h4L19 9a2.8 2.8 0 0 0-4-4L4 16v4z" }), _jsx("path", { d: "M13.5 6.5l4 4" })] }),
|
|
21
|
+
account: _jsxs(_Fragment, { children: [_jsx("circle", { cx: "12", cy: "8", r: "4" }), _jsx("path", { d: "M4 20c1.5-4 4.5-6 8-6s6.5 2 8 6" })] }),
|
|
22
|
+
security: _jsxs(_Fragment, { children: [_jsx("path", { d: "M12 3l7 3v5c0 4.5-3 8.2-7 10-4-1.8-7-5.5-7-10V6l7-3z" }), _jsx("path", { d: "M9 12l2 2 4-4" })] }),
|
|
23
|
+
apps: _jsxs(_Fragment, { children: [_jsx("rect", { x: "4", y: "4", width: "6.5", height: "6.5", rx: "1.5" }), _jsx("rect", { x: "13.5", y: "4", width: "6.5", height: "6.5", rx: "1.5" }), _jsx("rect", { x: "4", y: "13.5", width: "6.5", height: "6.5", rx: "1.5" }), _jsx("rect", { x: "13.5", y: "13.5", width: "6.5", height: "6.5", rx: "1.5" })] }),
|
|
24
|
+
support: _jsxs(_Fragment, { children: [_jsx("circle", { cx: "12", cy: "12", r: "8.5" }), _jsx("path", { d: "M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .8-1 1.5v.4" }), _jsx("path", { d: "M12 16.8v.2" })] }),
|
|
25
|
+
family: _jsxs(_Fragment, { children: [_jsx("circle", { cx: "9", cy: "8", r: "3.2" }), _jsx("circle", { cx: "17", cy: "10", r: "2.4" }), _jsx("path", { d: "M3.5 19c.9-3.2 3-5 5.5-5s4.6 1.8 5.5 5" }), _jsx("path", { d: "M14.5 15.2c.8-.8 1.6-1.2 2.5-1.2 2 0 3.4 1.6 4 5" })] }),
|
|
26
|
+
};
|
|
27
|
+
function Icon({ name }) {
|
|
28
|
+
return (_jsx("svg", { className: "ak-account-icon", viewBox: "0 0 24 24", width: "16", height: "16", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: ICONS[name] }));
|
|
29
|
+
}
|
|
30
|
+
/** The photo (or initial) in its ring, at one size. */
|
|
31
|
+
function Photo({ who, size }) {
|
|
32
|
+
return (_jsxs("span", { className: "ak-account-ring", children: [_jsx("img", { className: "ak-account-photo", alt: "", width: size, height: size, referrerPolicy: "no-referrer", src: who?.avatarUrl, hidden: !who?.avatarUrl, suppressHydrationWarning: true }), _jsx("span", { className: "ak-account-initial", "aria-hidden": "true", hidden: Boolean(who?.avatarUrl), suppressHydrationWarning: true, children: who?.initial ?? PLACEHOLDER })] }));
|
|
33
|
+
}
|
|
34
|
+
export function AccountMenu({ who, signInHref, signOut, links = accountLinks(), pictureHref = 'https://account.addis.gg/account#avatar', ring = ADDIS_RING, action, labels, id, read }) {
|
|
35
|
+
const words = { ...ACCOUNT_LABELS, ...labels };
|
|
36
|
+
const root = useRef(null);
|
|
37
|
+
const button = useRef(null);
|
|
38
|
+
const [open, setOpen] = useState(false);
|
|
39
|
+
useLayoutEffect(() => {
|
|
40
|
+
if (!read || !root.current)
|
|
41
|
+
return;
|
|
42
|
+
const state = read();
|
|
43
|
+
fillAccount(root.current, state.who, state.signedIn);
|
|
44
|
+
}, [read]);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (!open)
|
|
47
|
+
return;
|
|
48
|
+
const outside = (e) => { if (!root.current?.contains(e.target))
|
|
49
|
+
setOpen(false); };
|
|
50
|
+
const key = (e) => { if (e.key === 'Escape') {
|
|
51
|
+
setOpen(false);
|
|
52
|
+
button.current?.focus();
|
|
53
|
+
} };
|
|
54
|
+
document.addEventListener('pointerdown', outside);
|
|
55
|
+
document.addEventListener('focusin', outside);
|
|
56
|
+
document.addEventListener('keydown', key);
|
|
57
|
+
return () => {
|
|
58
|
+
document.removeEventListener('pointerdown', outside);
|
|
59
|
+
document.removeEventListener('focusin', outside);
|
|
60
|
+
document.removeEventListener('keydown', key);
|
|
61
|
+
};
|
|
62
|
+
}, [open]);
|
|
63
|
+
// Unique on the page (two controls, say a header and a drawer), and the same on the server and in the browser.
|
|
64
|
+
const menuId = `${useId()}menu`;
|
|
65
|
+
return (_jsxs("div", { id: id, className: "ak-account", "data-account": who ? 'signed-in' : 'signed-out', "data-who": who ? 'shown' : 'none', ref: root, style: { '--ak-account-ring': ring }, suppressHydrationWarning: true, children: [_jsx("a", { className: "ak-account-signin", href: signInHref, suppressHydrationWarning: true, children: words.signIn }), _jsxs("span", { className: "ak-account-in", children: [_jsxs("button", { ref: button, type: "button", className: "ak-account-pill", "aria-label": words.menu, "aria-expanded": open, "aria-controls": menuId, onClick: () => setOpen((o) => !o), children: [_jsx(Photo, { who: who, size: 28 }), _jsx("span", { className: "ak-account-first", "aria-hidden": "true", suppressHydrationWarning: true, children: who ? firstName(who.name) : PLACEHOLDER })] }), _jsxs("div", { id: menuId, className: "ak-account-menu", hidden: !open, children: [_jsxs("div", { className: "ak-account-head", children: [_jsxs("span", { className: "ak-account-frame", children: [_jsx(Photo, { who: who, size: 48 }), _jsx("a", { className: "ak-account-edit", href: pictureHref, "aria-label": words.changePicture, title: words.changePicture, children: _jsx(Icon, { name: "edit" }) })] }), _jsx("strong", { className: "ak-account-name", suppressHydrationWarning: true, children: who?.name ?? PLACEHOLDER }), _jsx("span", { className: "ak-account-email", hidden: !who?.email, suppressHydrationWarning: true, children: who?.email ?? PLACEHOLDER })] }), _jsx("div", { className: "ak-account-links", children: links.map((l) => _jsxs("a", { href: l.href, children: [l.icon ? _jsx(Icon, { name: l.icon }) : null, l.label] }, l.href)) }), 'action' in signOut ? (_jsx("form", { className: "ak-account-out", action: signOut.action, method: "post", children: _jsx("button", { type: "submit", className: "ak-account-signout", children: words.signOut }) })) : (_jsx("div", { className: "ak-account-out", children: _jsx("button", { type: "button", className: "ak-account-signout", onClick: () => { setOpen(false); signOut.onSelect(); }, children: words.signOut }) }))] }), action] }), 'action' in signOut ? (_jsx("form", { className: "ak-account-bare", action: signOut.action, method: "post", children: _jsx("button", { type: "submit", className: "ak-account-signin", children: words.signOut }) })) : (_jsx("span", { className: "ak-account-bare", children: _jsx("button", { type: "button", className: "ak-account-signin", onClick: signOut.onSelect, children: words.signOut }) }))] }));
|
|
66
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** Who is signed in, as the control shows them. */
|
|
2
|
+
export type AccountWho = {
|
|
3
|
+
name: string;
|
|
4
|
+
/** One character, shown when there is no photo. */
|
|
5
|
+
initial: string;
|
|
6
|
+
/** An https URL without credentials. */
|
|
7
|
+
avatarUrl?: string;
|
|
8
|
+
email?: string;
|
|
9
|
+
};
|
|
10
|
+
/** What a page knows about who is signed in: signed in with no one to show gives a bare "Sign out". */
|
|
11
|
+
export type AccountState = {
|
|
12
|
+
signedIn: boolean;
|
|
13
|
+
who: AccountWho | null;
|
|
14
|
+
};
|
|
15
|
+
export type AccountIcon = 'account' | 'security' | 'apps' | 'support' | 'family';
|
|
16
|
+
export type AccountLink = {
|
|
17
|
+
label: string;
|
|
18
|
+
href: string;
|
|
19
|
+
icon?: AccountIcon;
|
|
20
|
+
};
|
|
21
|
+
/** The words the control shows, for an app that translates them. */
|
|
22
|
+
export type AccountLabels = {
|
|
23
|
+
signIn: string;
|
|
24
|
+
signOut: string;
|
|
25
|
+
menu: string;
|
|
26
|
+
changePicture: string;
|
|
27
|
+
};
|
|
28
|
+
export declare const ACCOUNT_LABELS: AccountLabels;
|
|
29
|
+
/**
|
|
30
|
+
* account.addis.gg's sections for every Addis account (addiscorp/account lib/account-paths.ts, without
|
|
31
|
+
* the staff-only ones), in its order and words; `family` adds Ava's Family. Titles only: short labels
|
|
32
|
+
* translate cleanly.
|
|
33
|
+
*/
|
|
34
|
+
export declare function accountLinks(origin?: string, { family }?: {
|
|
35
|
+
family?: boolean | undefined;
|
|
36
|
+
}): AccountLink[];
|
|
37
|
+
/** The three colours of the addis mark's flag, in equal thirds clockwise from the top. */
|
|
38
|
+
export declare const ADDIS_RING = "conic-gradient(#078930 0deg 120deg, #fcdd09 120deg 240deg, #da121a 240deg 360deg)";
|
|
39
|
+
/** The first name: the name up to its first space. */
|
|
40
|
+
export declare function firstName(name: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Draws who is signed in into a rendered AccountMenu (`root` is its element): which half shows, the
|
|
43
|
+
* names, the email, and the photo or initial in both places. Text and attributes only, never markup.
|
|
44
|
+
* Self-contained and with no named inner functions, so its source text runs on its own in an inline
|
|
45
|
+
* script (see `accountScript`).
|
|
46
|
+
*/
|
|
47
|
+
export declare function fillAccount(root: HTMLElement, who: AccountWho | null, signedIn?: boolean): void;
|
|
48
|
+
/**
|
|
49
|
+
* The inline script a pre-rendered page puts right after its AccountMenu, so the control is filled
|
|
50
|
+
* before first paint. `read` is the source of an expression giving the page's AccountState (its own
|
|
51
|
+
* strict cookie reader, called on document.cookie). The script brings a `__name` that returns its
|
|
52
|
+
* argument: Cloudflare's bundler (esbuild, keepNames) wraps functions in `__name(fn, "name")`, a helper
|
|
53
|
+
* that exists only inside its bundle, and without it the script would throw. Any error leaves the
|
|
54
|
+
* pre-rendered "Sign in" until React hydrates.
|
|
55
|
+
*/
|
|
56
|
+
export declare function accountScript(rootId: string, read: string): string;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// The account control's plain parts: its types, words, links, ring, and the function that fills a
|
|
2
|
+
// pre-rendered control. No 'use client': a server component (a layout, say) can call these and gets the
|
|
3
|
+
// real values, not client references. The component itself is in ./index.tsx.
|
|
4
|
+
export const ACCOUNT_LABELS = { signIn: 'Sign in', signOut: 'Sign out', menu: 'Your account', changePicture: 'Change your picture' };
|
|
5
|
+
/**
|
|
6
|
+
* account.addis.gg's sections for every Addis account (addiscorp/account lib/account-paths.ts, without
|
|
7
|
+
* the staff-only ones), in its order and words; `family` adds Ava's Family. Titles only: short labels
|
|
8
|
+
* translate cleanly.
|
|
9
|
+
*/
|
|
10
|
+
export function accountLinks(origin = 'https://account.addis.gg', { family = false } = {}) {
|
|
11
|
+
return [
|
|
12
|
+
{ label: 'Account', href: `${origin}/account`, icon: 'account' },
|
|
13
|
+
{ label: 'Security', href: `${origin}/account/security`, icon: 'security' },
|
|
14
|
+
{ label: 'Apps', href: `${origin}/account/apps`, icon: 'apps' },
|
|
15
|
+
...(family ? [{ label: 'Family', href: `${origin}/account/family`, icon: 'family' }] : []),
|
|
16
|
+
{ label: 'Support', href: `${origin}/account/support`, icon: 'support' },
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
/** The three colours of the addis mark's flag, in equal thirds clockwise from the top. */
|
|
20
|
+
export const ADDIS_RING = 'conic-gradient(#078930 0deg 120deg, #fcdd09 120deg 240deg, #da121a 240deg 360deg)';
|
|
21
|
+
/** The first name: the name up to its first space. */
|
|
22
|
+
export function firstName(name) {
|
|
23
|
+
return name.trim().split(/\s+/)[0] || name;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Draws who is signed in into a rendered AccountMenu (`root` is its element): which half shows, the
|
|
27
|
+
* names, the email, and the photo or initial in both places. Text and attributes only, never markup.
|
|
28
|
+
* Self-contained and with no named inner functions, so its source text runs on its own in an inline
|
|
29
|
+
* script (see `accountScript`).
|
|
30
|
+
*/
|
|
31
|
+
export function fillAccount(root, who, signedIn = who !== null) {
|
|
32
|
+
root.dataset.account = signedIn ? 'signed-in' : 'signed-out';
|
|
33
|
+
root.dataset.who = who ? 'shown' : 'none';
|
|
34
|
+
if (!who)
|
|
35
|
+
return;
|
|
36
|
+
const name = root.querySelector('.ak-account-name');
|
|
37
|
+
if (name)
|
|
38
|
+
name.textContent = who.name;
|
|
39
|
+
const first = root.querySelector('.ak-account-first');
|
|
40
|
+
if (first)
|
|
41
|
+
first.textContent = who.name.trim().split(/\s+/)[0] || who.name;
|
|
42
|
+
const email = root.querySelector('.ak-account-email');
|
|
43
|
+
if (email) {
|
|
44
|
+
email.textContent = who.email ?? '';
|
|
45
|
+
email.hidden = !who.email;
|
|
46
|
+
}
|
|
47
|
+
for (const el of Array.from(root.querySelectorAll('.ak-account-initial'))) {
|
|
48
|
+
el.textContent = who.initial;
|
|
49
|
+
el.hidden = Boolean(who.avatarUrl);
|
|
50
|
+
}
|
|
51
|
+
for (const img of Array.from(root.querySelectorAll('img.ak-account-photo'))) {
|
|
52
|
+
if (who.avatarUrl)
|
|
53
|
+
img.setAttribute('src', who.avatarUrl);
|
|
54
|
+
else
|
|
55
|
+
img.removeAttribute('src');
|
|
56
|
+
img.hidden = !who.avatarUrl;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The inline script a pre-rendered page puts right after its AccountMenu, so the control is filled
|
|
61
|
+
* before first paint. `read` is the source of an expression giving the page's AccountState (its own
|
|
62
|
+
* strict cookie reader, called on document.cookie). The script brings a `__name` that returns its
|
|
63
|
+
* argument: Cloudflare's bundler (esbuild, keepNames) wraps functions in `__name(fn, "name")`, a helper
|
|
64
|
+
* that exists only inside its bundle, and without it the script would throw. Any error leaves the
|
|
65
|
+
* pre-rendered "Sign in" until React hydrates.
|
|
66
|
+
*/
|
|
67
|
+
export function accountScript(rootId, read) {
|
|
68
|
+
return `(function(){var __name=function(f){return f};var r=document.getElementById(${JSON.stringify(rootId)});if(!r)return;try{var s=(${read});(${fillAccount.toString()})(r,s.who,s.signedIn)}catch(e){}})();`;
|
|
69
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// Import the styles once: `import '@addiscorp/kit/kit.css'`, then set the
|
|
3
3
|
// brand's colours (see README).
|
|
4
4
|
export * from './header/index.js';
|
|
5
|
+
export * from './account/index.js';
|
|
6
|
+
export * from './account/shared.js';
|
|
5
7
|
export * from './footer/index.js';
|
|
6
8
|
export * from './theme/index.js';
|
|
7
9
|
export * from './license/index.js';
|
package/dist/kit.css
CHANGED
|
@@ -164,3 +164,46 @@
|
|
|
164
164
|
.ak-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
165
165
|
.ak-menu { width: min(480px, calc(100vw - 24px)); }
|
|
166
166
|
}
|
|
167
|
+
|
|
168
|
+
/* The account control (src/account): "Sign in" for a visitor; signed in, a pill (photo in a ring, first
|
|
169
|
+
name) that opens a small menu. Colours come from the --ak tokens; the ring from --ak-account-ring. */
|
|
170
|
+
.ak-account { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; }
|
|
171
|
+
.ak-account[data-account="signed-in"] > .ak-account-signin, .ak-account:not([data-account="signed-in"]) > .ak-account-in { display: none; }
|
|
172
|
+
.ak-account:not([data-account="signed-in"][data-who="none"]) > .ak-account-bare,
|
|
173
|
+
.ak-account[data-who="none"] .ak-account-pill, .ak-account[data-who="none"] .ak-account-menu { display: none; }
|
|
174
|
+
.ak-account-in { display: flex; align-items: center; gap: 10px; }
|
|
175
|
+
.ak-account-bare { margin: 0; }
|
|
176
|
+
.ak-account-signin { display: inline-flex; align-items: center; min-height: 40px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--ak-panel);
|
|
177
|
+
box-shadow: inset 0 0 0 1.5px var(--ak-edge); color: var(--ak-ink); font: 600 14px var(--ak-display); text-decoration: none; white-space: nowrap; cursor: pointer; }
|
|
178
|
+
.ak-account-signin:hover { box-shadow: inset 0 0 0 1.5px var(--ak-accent); }
|
|
179
|
+
.ak-account-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; max-width: 12rem; padding: 0 16px 0 4px; border: 0; border-radius: 999px;
|
|
180
|
+
background: var(--ak-panel); box-shadow: inset 0 0 0 1.5px var(--ak-edge); color: var(--ak-ink); font: 600 14px var(--ak-display); cursor: pointer; }
|
|
181
|
+
.ak-account-pill:hover, .ak-account-pill[aria-expanded="true"] { box-shadow: inset 0 0 0 1.5px var(--ak-accent); }
|
|
182
|
+
.ak-account-pill:focus-visible, .ak-account-signin:focus-visible, .ak-account-edit:focus-visible { outline: 2px solid var(--ak-accent); outline-offset: 2px; }
|
|
183
|
+
.ak-account-first { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
184
|
+
.ak-account-ring { display: inline-grid; place-items: center; flex: none; padding: 2px; border-radius: 50%; background: var(--ak-account-ring, var(--ak-accent)); }
|
|
185
|
+
.ak-account-ring > * { box-sizing: border-box; width: 28px; height: 28px; border: 2px solid var(--ak-panel); border-radius: 50%; object-fit: cover; }
|
|
186
|
+
.ak-account-initial { display: inline-grid; place-items: center; background: var(--ak-ink); color: var(--ak-ground); font: 700 13px var(--ak-display); }
|
|
187
|
+
.ak-account-ring > [hidden] { display: none; }
|
|
188
|
+
.ak-account-menu { position: absolute; z-index: 30; top: calc(100% + 10px); right: 0; width: min(264px, calc(100vw - 32px)); padding: 6px; border-radius: 14px;
|
|
189
|
+
background: var(--ak-panel); color: var(--ak-ink); box-shadow: 0 0 0 1px var(--ak-edge), 0 12px 32px rgb(0 0 0 / .28); }
|
|
190
|
+
.ak-account-menu[hidden] { display: none; }
|
|
191
|
+
.ak-account-head { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: center; padding: 10px 10px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--ak-edge); }
|
|
192
|
+
.ak-account-frame { grid-row: 1 / span 2; position: relative; }
|
|
193
|
+
.ak-account-frame .ak-account-ring > * { width: 48px; height: 48px; }
|
|
194
|
+
.ak-account-frame .ak-account-initial { font-size: 20px; }
|
|
195
|
+
.ak-account-edit { position: absolute; right: -5px; bottom: -5px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
|
|
196
|
+
background: var(--ak-menu); color: var(--ak-ink); box-shadow: 0 0 0 2px var(--ak-panel); }
|
|
197
|
+
.ak-account-edit:hover { background: var(--ak-edge); }
|
|
198
|
+
.ak-account-edit .ak-account-icon { width: 12px; height: 12px; color: inherit; }
|
|
199
|
+
.ak-account-name { align-self: end; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 15px var(--ak-display); }
|
|
200
|
+
.ak-account-email { align-self: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ak-soft); font-size: 13px; }
|
|
201
|
+
.ak-account-email[hidden] { display: none; }
|
|
202
|
+
.ak-account-links { display: grid; }
|
|
203
|
+
.ak-account-links a, .ak-account-signout { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border: 0; border-radius: 9px; background: none;
|
|
204
|
+
color: inherit; font: 500 14px/1.3 var(--ak-display); text-align: left; text-decoration: none; cursor: pointer; }
|
|
205
|
+
.ak-account-links a:hover, .ak-account-signout:hover, .ak-account-links a:focus-visible, .ak-account-signout:focus-visible { background: var(--ak-menu); outline: none; }
|
|
206
|
+
.ak-account-icon { flex: none; color: var(--ak-soft); }
|
|
207
|
+
.ak-account-out { margin: 6px 0 0; padding-top: 6px; border-top: 1px solid var(--ak-edge); }
|
|
208
|
+
.ak-account-signout { color: var(--ak-soft); }
|
|
209
|
+
@media (max-width: 480px) { .ak-account-first { display: none; } .ak-account-pill { padding: 0 4px; } }
|
package/dist/tool/tools.d.ts
CHANGED
|
@@ -11,7 +11,8 @@ export type ToolInfo = {
|
|
|
11
11
|
export declare const TOOLS: ToolInfo[];
|
|
12
12
|
/**
|
|
13
13
|
* The "More from Addis" card on every tool site, in this order: ava first, then the projects in
|
|
14
|
-
* addis.gg's order (Sami, 28 Nov). rixse
|
|
14
|
+
* addis.gg's order (Sami, 28 Nov). rixse and kebele left the list but keep their sites; gelada came back
|
|
15
|
+
* in gild's place, and gild keeps its site (Sami, 5 Dec).
|
|
15
16
|
*/
|
|
16
17
|
export declare const FAMILY: ToolId[];
|
|
17
18
|
export declare function toolInfo(id: ToolId): ToolInfo;
|
package/dist/tool/tools.js
CHANGED
|
@@ -13,9 +13,10 @@ export const TOOLS = [
|
|
|
13
13
|
];
|
|
14
14
|
/**
|
|
15
15
|
* The "More from Addis" card on every tool site, in this order: ava first, then the projects in
|
|
16
|
-
* addis.gg's order (Sami, 28 Nov). rixse
|
|
16
|
+
* addis.gg's order (Sami, 28 Nov). rixse and kebele left the list but keep their sites; gelada came back
|
|
17
|
+
* in gild's place, and gild keeps its site (Sami, 5 Dec).
|
|
17
18
|
*/
|
|
18
|
-
export const FAMILY = ['ava', 'p8', 'simien', 'mirab', 'woreda', '
|
|
19
|
+
export const FAMILY = ['ava', 'p8', 'simien', 'mirab', 'woreda', 'gelada', 'harar', 'securecore'];
|
|
19
20
|
export function toolInfo(id) {
|
|
20
21
|
const info = TOOLS.find((t) => t.id === id);
|
|
21
22
|
if (!info)
|
package/package.json
CHANGED