@metacensus/library-ui 0.15.0 → 0.17.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 +110 -16
- package/TRADEMARKS.md +4 -4
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/marks/Marks.d.ts +2 -5
- package/dist/marks/Marks.js +33 -8
- package/dist/marks/Marks.js.map +1 -1
- package/dist/organization/facts.d.ts +15 -0
- package/dist/organization/facts.js +21 -0
- package/dist/organization/facts.js.map +1 -0
- package/dist/organization/index.d.ts +3 -0
- package/dist/organization/index.js +4 -0
- package/dist/organization/index.js.map +1 -0
- package/dist/organization/serialize.d.ts +12 -0
- package/dist/organization/serialize.js +47 -0
- package/dist/organization/serialize.js.map +1 -0
- package/dist/organization/stewards.d.ts +16 -0
- package/dist/organization/stewards.js +111 -0
- package/dist/organization/stewards.js.map +1 -0
- package/dist/site/links.d.ts +14 -0
- package/dist/site/links.js +44 -0
- package/dist/site/links.js.map +1 -0
- package/dist/tools/CiteThisPage.d.ts +14 -0
- package/dist/tools/CiteThisPage.js +13 -0
- package/dist/tools/CiteThisPage.js.map +1 -0
- package/dist/tools/cite.d.ts +18 -0
- package/dist/tools/cite.js +73 -0
- package/dist/tools/cite.js.map +1 -0
- package/dist/tools/display.d.ts +28 -0
- package/dist/tools/display.js +101 -0
- package/dist/tools/display.js.map +1 -0
- package/marks/wordmark-lockup.svg +1 -7
- package/package.json +18 -1
- package/src/chrome/Footer.astro +25 -0
- package/src/chrome/Header.astro +40 -0
- package/src/css/styles.css +158 -32
- package/src/css/tokens.css +0 -8
- package/src/inventory/routes.mjs +122 -0
- package/src/organization/OrganizationJsonLd.astro +5 -0
- package/dist/tools/theme.d.ts +0 -18
- package/dist/tools/theme.js +0 -68
- package/dist/tools/theme.js.map +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SiteLink {
|
|
2
|
+
label: string;
|
|
3
|
+
href: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const LOGIN_PATH = "/log-in";
|
|
6
|
+
export declare const JOIN_PATH = "/partner/";
|
|
7
|
+
/** The legal pages' section, which has its own sub-navigation. */
|
|
8
|
+
export declare const LEGAL_PATH = "/legal/";
|
|
9
|
+
export declare const HEADER_LINKS: readonly SiteLink[];
|
|
10
|
+
export declare const SECTION_LINKS: readonly SiteLink[];
|
|
11
|
+
export declare const FOOTER_COLUMNS: readonly {
|
|
12
|
+
label: string;
|
|
13
|
+
links: readonly SiteLink[];
|
|
14
|
+
}[];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export const LOGIN_PATH = '/log-in';
|
|
2
|
+
export const JOIN_PATH = '/partner/';
|
|
3
|
+
/** The legal pages' section, which has its own sub-navigation. */
|
|
4
|
+
export const LEGAL_PATH = '/legal/';
|
|
5
|
+
const BLOG_LINK = { label: 'Blog', href: '/blog/' };
|
|
6
|
+
export const HEADER_LINKS = [
|
|
7
|
+
{ label: 'Why', href: '/' },
|
|
8
|
+
{ label: 'Research', href: 'https://research.metacensus.org/' },
|
|
9
|
+
BLOG_LINK,
|
|
10
|
+
];
|
|
11
|
+
export const SECTION_LINKS = [
|
|
12
|
+
{ label: 'The problem', href: '/#problem' },
|
|
13
|
+
{ label: 'The cost', href: '/#cost' },
|
|
14
|
+
{ label: 'The solution', href: '/#solution' },
|
|
15
|
+
{ label: 'The people', href: '/#stewards' },
|
|
16
|
+
];
|
|
17
|
+
export const FOOTER_COLUMNS = [
|
|
18
|
+
{
|
|
19
|
+
label: 'Sections',
|
|
20
|
+
links: [
|
|
21
|
+
...SECTION_LINKS,
|
|
22
|
+
BLOG_LINK,
|
|
23
|
+
{ label: 'The full team', href: '/stewards/' },
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: 'Join us',
|
|
28
|
+
links: [
|
|
29
|
+
{ label: 'Join us', href: JOIN_PATH },
|
|
30
|
+
{
|
|
31
|
+
label: 'Request early access',
|
|
32
|
+
href: '/partner/?interest=early-access',
|
|
33
|
+
},
|
|
34
|
+
{ label: 'Careers', href: '/careers/' },
|
|
35
|
+
{ label: 'Log in', href: LOGIN_PATH },
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: 'Open source',
|
|
40
|
+
links: [{ label: 'GitHub', href: 'https://github.com/metacensus' }],
|
|
41
|
+
},
|
|
42
|
+
{ label: 'About this site', links: [{ label: 'Legal', href: LEGAL_PATH }] },
|
|
43
|
+
];
|
|
44
|
+
//# sourceMappingURL=links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"links.js","sourceRoot":"","sources":["../../src/site/links.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAA;AACnC,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAA;AAEpC,kEAAkE;AAClE,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAA;AAEnC,MAAM,SAAS,GAAa,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAA;AAE7D,MAAM,CAAC,MAAM,YAAY,GAAwB;IAC/C,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE;IAC3B,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,kCAAkC,EAAE;IAC/D,SAAS;CACV,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAwB;IAChD,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,WAAW,EAAE;IAC3C,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE;IACrC,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,YAAY,EAAE;IAC7C,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE;CAC5C,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAGrB;IACJ;QACE,KAAK,EAAE,UAAU;QACjB,KAAK,EAAE;YACL,GAAG,aAAa;YAChB,SAAS;YACT,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,YAAY,EAAE;SAC/C;KACF;IACD;QACE,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE;YACL,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;YACrC;gBACE,KAAK,EAAE,sBAAsB;gBAC7B,IAAI,EAAE,iCAAiC;aACxC;YACD,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE;YACvC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE;SACtC;KACF;IACD;QACE,KAAK,EAAE,aAAa;QACpB,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,+BAA+B,EAAE,CAAC;KACpE;IACD,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE;CAC5E,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DetailsHTMLAttributes } from 'react';
|
|
2
|
+
import { type Citation } from './cite.js';
|
|
3
|
+
type CiteThisPageProps = Omit<DetailsHTMLAttributes<HTMLDetailsElement>, 'children'> & {
|
|
4
|
+
citation: Citation;
|
|
5
|
+
/** Where the page serves its RIS file, from `formatRis`. */
|
|
6
|
+
risHref: string;
|
|
7
|
+
/** Where the page serves its BibTeX file, from `formatBibtex`. */
|
|
8
|
+
bibHref: string;
|
|
9
|
+
};
|
|
10
|
+
/** A `Cite this page` disclosure: the citation as text and a download link to
|
|
11
|
+
* each file. It formats what the page gives it and renders nothing without a
|
|
12
|
+
* url. It needs no JS. */
|
|
13
|
+
export declare function CiteThisPage({ citation, risHref, bibHref, className, ...props }: CiteThisPageProps): import("react").JSX.Element | null;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { formatCitationText } from './cite.js';
|
|
3
|
+
import { Button } from './Button.js';
|
|
4
|
+
import { cn } from './cn.js';
|
|
5
|
+
/** A `Cite this page` disclosure: the citation as text and a download link to
|
|
6
|
+
* each file. It formats what the page gives it and renders nothing without a
|
|
7
|
+
* url. It needs no JS. */
|
|
8
|
+
export function CiteThisPage({ citation, risHref, bibHref, className, ...props }) {
|
|
9
|
+
if (!citation.url?.trim())
|
|
10
|
+
return null;
|
|
11
|
+
return (_jsxs("details", { className: cn('mc-cite', className), ...props, children: [_jsx("summary", { className: "mc-cite-summary", children: "Cite this page" }), _jsx("p", { className: "mc-cite-text", children: formatCitationText(citation) }), _jsxs("p", { className: "mc-cite-downloads", children: [_jsx(Button, { variant: "secondary", href: risHref, download: true, children: "Download RIS" }), _jsx(Button, { variant: "secondary", href: bibHref, download: true, children: "Download BibTeX" })] })] }));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=CiteThisPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CiteThisPage.js","sourceRoot":"","sources":["../../src/tools/CiteThisPage.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAiB,MAAM,WAAW,CAAA;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAa5B;;2BAE2B;AAC3B,MAAM,UAAU,YAAY,CAAC,EAC3B,QAAQ,EACR,OAAO,EACP,OAAO,EACP,SAAS,EACT,GAAG,KAAK,EACU;IAClB,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE;QAAE,OAAO,IAAI,CAAA;IACtC,OAAO,CACL,mBAAS,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,KAAM,KAAK,aACrD,kBAAS,SAAS,EAAC,iBAAiB,+BAAyB,EAC7D,YAAG,SAAS,EAAC,cAAc,YAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAK,EAC9D,aAAG,SAAS,EAAC,mBAAmB,aAC9B,KAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,mCAE1C,EACT,KAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,sCAE1C,IACP,IACI,CACX,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** What a page says about itself. `authors` are written as the citation should
|
|
2
|
+
* print them, as `Family, Given`; `date` is ISO, `2026`, `2026-11` or
|
|
3
|
+
* `2026-11-10`. The page owns the url and its permanence. */
|
|
4
|
+
export type Citation = {
|
|
5
|
+
title: string;
|
|
6
|
+
authors: string[];
|
|
7
|
+
date: string;
|
|
8
|
+
publisher: string;
|
|
9
|
+
url: string;
|
|
10
|
+
};
|
|
11
|
+
/** The citation as RIS: type `ELEC`, one `AU` per author, ending `ER - `. */
|
|
12
|
+
export declare function formatRis(c: Citation): string;
|
|
13
|
+
/** The citation as one BibTeX `@misc` entry. Text is escaped; the url is
|
|
14
|
+
* verbatim, as `url` and `\url` read it literally. */
|
|
15
|
+
export declare function formatBibtex(c: Citation): string;
|
|
16
|
+
/** The citation as the sentence a page shows: authors (date). Title.
|
|
17
|
+
* Publisher. url */
|
|
18
|
+
export declare function formatCitationText(c: Citation): string;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const DATE = /^(\d{4})(?:-(\d{2}))?(?:-(\d{2}))?/;
|
|
2
|
+
/** One line of text: a newline in a value would end its RIS field. */
|
|
3
|
+
const flat = (value) => value.replace(/\s+/g, ' ').trim();
|
|
4
|
+
const ris = (tag, value) => value ? [`${tag} - ${flat(value)}`] : [];
|
|
5
|
+
/** The citation as RIS: type `ELEC`, one `AU` per author, ending `ER - `. */
|
|
6
|
+
export function formatRis(c) {
|
|
7
|
+
const [, year, month, day] = DATE.exec(c.date) ?? [];
|
|
8
|
+
const date = [year, month, day].filter(Boolean).join('/');
|
|
9
|
+
return [
|
|
10
|
+
'TY - ELEC',
|
|
11
|
+
...ris('TI', c.title),
|
|
12
|
+
...c.authors.flatMap((a) => ris('AU', a)),
|
|
13
|
+
...ris('PY', year ?? ''),
|
|
14
|
+
...ris('DA', date),
|
|
15
|
+
...ris('PB', c.publisher),
|
|
16
|
+
...ris('UR', c.url),
|
|
17
|
+
'ER - ',
|
|
18
|
+
].join('\n');
|
|
19
|
+
}
|
|
20
|
+
const TEX = {
|
|
21
|
+
'\\': '\\textbackslash{}',
|
|
22
|
+
'{': '\\{',
|
|
23
|
+
'}': '\\}',
|
|
24
|
+
'%': '\\%',
|
|
25
|
+
'&': '\\&',
|
|
26
|
+
'#': '\\#',
|
|
27
|
+
_: '\\_',
|
|
28
|
+
};
|
|
29
|
+
const tex = (value) => flat(value).replace(/[\\{}%&#_]/g, (c) => TEX[c]);
|
|
30
|
+
/** The key: the first author's family name and the year, as `doe2026`. */
|
|
31
|
+
function bibKey(c, year) {
|
|
32
|
+
const family = (c.authors[0] ?? '').split(',')[0].split(' ').pop();
|
|
33
|
+
return ((family + (year ?? '')).toLowerCase().replace(/[^a-z0-9]/g, '') || 'cite');
|
|
34
|
+
}
|
|
35
|
+
/** The citation as one BibTeX `@misc` entry. Text is escaped; the url is
|
|
36
|
+
* verbatim, as `url` and `\url` read it literally. */
|
|
37
|
+
export function formatBibtex(c) {
|
|
38
|
+
const [, year, month] = DATE.exec(c.date) ?? [];
|
|
39
|
+
const fields = [
|
|
40
|
+
['title', tex(c.title)],
|
|
41
|
+
['author', c.authors.map(tex).join(' and ')],
|
|
42
|
+
['year', year ?? ''],
|
|
43
|
+
['month', month ? String(Number(month)) : ''],
|
|
44
|
+
['publisher', tex(c.publisher)],
|
|
45
|
+
['url', flat(c.url)],
|
|
46
|
+
['howpublished', c.url ? `\\url{${flat(c.url)}}` : ''],
|
|
47
|
+
];
|
|
48
|
+
const body = fields
|
|
49
|
+
.filter(([, value]) => value)
|
|
50
|
+
.map(([name, value]) => ` ${name} = {${value}}`)
|
|
51
|
+
.join(',\n');
|
|
52
|
+
return `@misc{${bibKey(c, year)},\n${body}\n}\n`;
|
|
53
|
+
}
|
|
54
|
+
/** Authors as a sentence: `A`, `A and B`, `A, B, and C`. */
|
|
55
|
+
const names = (authors) => authors.length < 3
|
|
56
|
+
? authors.join(' and ')
|
|
57
|
+
: `${authors.slice(0, -1).join(', ')}, and ${authors.at(-1)}`;
|
|
58
|
+
/** The citation as the sentence a page shows: authors (date). Title.
|
|
59
|
+
* Publisher. url */
|
|
60
|
+
export function formatCitationText(c) {
|
|
61
|
+
const who = names(c.authors.map(flat).filter(Boolean));
|
|
62
|
+
const when = flat(c.date);
|
|
63
|
+
const lead = [who, when && `(${when})`].filter(Boolean).join(' ');
|
|
64
|
+
const sentence = (part) => (part.endsWith('.') ? part : `${part}.`);
|
|
65
|
+
return [lead, c.title, c.publisher]
|
|
66
|
+
.map(flat)
|
|
67
|
+
.filter(Boolean)
|
|
68
|
+
.map(sentence)
|
|
69
|
+
.concat(flat(c.url))
|
|
70
|
+
.filter(Boolean)
|
|
71
|
+
.join(' ');
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=cite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cite.js","sourceRoot":"","sources":["../../src/tools/cite.ts"],"names":[],"mappings":"AAWA,MAAM,IAAI,GAAG,oCAAoC,CAAA;AAEjD,sEAAsE;AACtE,MAAM,IAAI,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;AAEjE,MAAM,GAAG,GAAG,CAAC,GAAW,EAAE,KAAa,EAAE,EAAE,CACzC,KAAK,CAAC,CAAC,CAAC,CA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AC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAA;IAC3E,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,CAAC;SAChC,GAAG,CAAC,IAAI,CAAC;SACT,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,QAAQ,CAAC;SACb,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;SACnB,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAA;AACd,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** `system` follows the OS; `light` and `dark` are the viewer's override. */
|
|
2
|
+
export type Theme = 'system' | 'light' | 'dark';
|
|
3
|
+
/** Inline this in `<head>`, before first paint: it puts the stored theme on
|
|
4
|
+
* `<html>` as the `.light` or `.dark` class that tokens.css honours, and
|
|
5
|
+
* `.still` when animations are stopped, by the viewer or by the OS's
|
|
6
|
+
* `prefers-reduced-motion`. */
|
|
7
|
+
export declare const displayScript: string;
|
|
8
|
+
declare function write(theme: Theme): void;
|
|
9
|
+
/** The viewer's theme and a setter. Renders `system` on the server. */
|
|
10
|
+
export declare function useTheme(): {
|
|
11
|
+
theme: Theme;
|
|
12
|
+
setTheme: typeof write;
|
|
13
|
+
};
|
|
14
|
+
declare function writeStill(still: boolean): void;
|
|
15
|
+
/** Whether animations are stopped, and a setter; `:root.still` is the same
|
|
16
|
+
* state for CSS. Renders `false` on the server. */
|
|
17
|
+
export declare function useStill(): {
|
|
18
|
+
still: boolean;
|
|
19
|
+
setStill: typeof writeStill;
|
|
20
|
+
};
|
|
21
|
+
/** A round button fixed at the viewport's bottom-left corner. Hover, focus or a
|
|
22
|
+
* tap opens a panel above it with the theme and a switch that stops
|
|
23
|
+
* animations; Escape, moving away or a tap elsewhere closes it. Render it once
|
|
24
|
+
* per page, from the layout; hydrate it alone. */
|
|
25
|
+
export declare function DisplayControls({ className }: {
|
|
26
|
+
className?: string;
|
|
27
|
+
}): import("react").JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState, useSyncExternalStore } from 'react';
|
|
3
|
+
import { cn } from './cn.js';
|
|
4
|
+
import { Checkbox, RadioGroup } from './form.js';
|
|
5
|
+
const THEME_KEY = 'mc-theme';
|
|
6
|
+
const MOTION_KEY = 'mc-motion';
|
|
7
|
+
const REDUCE = '(prefers-reduced-motion: reduce)';
|
|
8
|
+
/** Inline this in `<head>`, before first paint: it puts the stored theme on
|
|
9
|
+
* `<html>` as the `.light` or `.dark` class that tokens.css honours, and
|
|
10
|
+
* `.still` when animations are stopped, by the viewer or by the OS's
|
|
11
|
+
* `prefers-reduced-motion`. */
|
|
12
|
+
export const displayScript = `var r=document.documentElement,g=function(k){try{return localStorage.getItem(k)}catch(e){}},t=g(${JSON.stringify(THEME_KEY)}),m=g(${JSON.stringify(MOTION_KEY)});if(t==="light"||t==="dark")r.classList.add(t);if(m==="still"||m!=="full"&&matchMedia(${JSON.stringify(REDUCE)}).matches)r.classList.add("still")`;
|
|
13
|
+
const listeners = new Set();
|
|
14
|
+
function subscribe(listener) {
|
|
15
|
+
listeners.add(listener);
|
|
16
|
+
return () => void listeners.delete(listener);
|
|
17
|
+
}
|
|
18
|
+
function store(key, value) {
|
|
19
|
+
try {
|
|
20
|
+
if (value === null)
|
|
21
|
+
localStorage.removeItem(key);
|
|
22
|
+
else
|
|
23
|
+
localStorage.setItem(key, value);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
// Blocked storage: the choice lasts the page.
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// The classes on `<html>` are the truth: the head script set them from storage.
|
|
30
|
+
function read() {
|
|
31
|
+
const classes = document.documentElement.classList;
|
|
32
|
+
return classes.contains('dark')
|
|
33
|
+
? 'dark'
|
|
34
|
+
: classes.contains('light')
|
|
35
|
+
? 'light'
|
|
36
|
+
: 'system';
|
|
37
|
+
}
|
|
38
|
+
function write(theme) {
|
|
39
|
+
const root = document.documentElement;
|
|
40
|
+
root.classList.remove('light', 'dark');
|
|
41
|
+
if (theme !== 'system')
|
|
42
|
+
root.classList.add(theme);
|
|
43
|
+
store(THEME_KEY, theme === 'system' ? null : theme);
|
|
44
|
+
listeners.forEach((listener) => listener());
|
|
45
|
+
}
|
|
46
|
+
/** The viewer's theme and a setter. Renders `system` on the server. */
|
|
47
|
+
export function useTheme() {
|
|
48
|
+
const theme = useSyncExternalStore(subscribe, read, () => 'system');
|
|
49
|
+
return { theme, setTheme: write };
|
|
50
|
+
}
|
|
51
|
+
const readStill = () => document.documentElement.classList.contains('still');
|
|
52
|
+
function writeStill(still) {
|
|
53
|
+
document.documentElement.classList.toggle('still', still);
|
|
54
|
+
// Only a choice against the OS's is kept.
|
|
55
|
+
store(MOTION_KEY, still === matchMedia(REDUCE).matches ? null : still ? 'still' : 'full');
|
|
56
|
+
listeners.forEach((listener) => listener());
|
|
57
|
+
}
|
|
58
|
+
/** Whether animations are stopped, and a setter; `:root.still` is the same
|
|
59
|
+
* state for CSS. Renders `false` on the server. */
|
|
60
|
+
export function useStill() {
|
|
61
|
+
const still = useSyncExternalStore(subscribe, readStill, () => false);
|
|
62
|
+
return { still, setStill: writeStill };
|
|
63
|
+
}
|
|
64
|
+
const THEME_OPTIONS = [
|
|
65
|
+
{ value: 'system', label: 'System' },
|
|
66
|
+
{ value: 'light', label: 'Light' },
|
|
67
|
+
{ value: 'dark', label: 'Dark' },
|
|
68
|
+
];
|
|
69
|
+
/** A round button fixed at the viewport's bottom-left corner. Hover, focus or a
|
|
70
|
+
* tap opens a panel above it with the theme and a switch that stops
|
|
71
|
+
* animations; Escape, moving away or a tap elsewhere closes it. Render it once
|
|
72
|
+
* per page, from the layout; hydrate it alone. */
|
|
73
|
+
export function DisplayControls({ className }) {
|
|
74
|
+
const { theme, setTheme } = useTheme();
|
|
75
|
+
const { still, setStill } = useStill();
|
|
76
|
+
const [open, setOpen] = useState(false);
|
|
77
|
+
const button = useRef(null);
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (!open)
|
|
80
|
+
return;
|
|
81
|
+
const close = (e) => {
|
|
82
|
+
if (!e.target.closest('.mc-display'))
|
|
83
|
+
setOpen(false);
|
|
84
|
+
};
|
|
85
|
+
document.addEventListener('pointerdown', close);
|
|
86
|
+
return () => document.removeEventListener('pointerdown', close);
|
|
87
|
+
}, [open]);
|
|
88
|
+
return (_jsxs("div", { className: cn('mc-display', className), onPointerEnter: (e) => e.pointerType === 'mouse' && setOpen(true), onPointerLeave: (e) => e.pointerType === 'mouse' && setOpen(false), onFocus: () => setOpen(true),
|
|
89
|
+
// Safari does not focus a control it is clicked on: no `relatedTarget`
|
|
90
|
+
// means focus went nowhere a page can name, not that it left.
|
|
91
|
+
onBlur: (e) => {
|
|
92
|
+
if (e.relatedTarget && !e.currentTarget.contains(e.relatedTarget))
|
|
93
|
+
setOpen(false);
|
|
94
|
+
}, onKeyDown: (e) => {
|
|
95
|
+
if (e.key !== 'Escape')
|
|
96
|
+
return;
|
|
97
|
+
button.current?.focus();
|
|
98
|
+
setOpen(false);
|
|
99
|
+
}, children: [_jsx("button", { ref: button, type: "button", className: "mc-display-button", "aria-label": "Display", "aria-expanded": open, onClick: () => setOpen(true), children: _jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [_jsx("path", { d: "M21 4h-7M10 4H3M21 12h-9M8 12H3M21 20h-5M12 20H3" }), _jsx("path", { d: "M14 2v4M8 10v4M16 18v4" })] }) }), _jsxs("div", { className: "mc-display-panel", hidden: !open, children: [_jsx(RadioGroup, { legend: "Theme", name: "mc-display-theme", options: THEME_OPTIONS, value: theme, onChange: (value) => setTheme(value) }), _jsx(Checkbox, { label: "Stop animations", checked: still, onChange: (e) => setStill(e.target.checked) })] })] }));
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=display.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.js","sourceRoot":"","sources":["../../src/tools/display.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AACzE,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAKhD,MAAM,SAAS,GAAG,UAAU,CAAA;AAC5B,MAAM,UAAU,GAAG,WAAW,CAAA;AAC9B,MAAM,MAAM,GAAG,kCAAkC,CAAA;AAEjD;;;gCAGgC;AAChC,MAAM,CAAC,MAAM,aAAa,GAAG,mGAAmG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,0FAA0F,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,oCAAoC,CAAA;AAEhV,MAAM,SAAS,GAAG,IAAI,GAAG,EAAc,CAAA;AAEvC,SAAS,SAAS,CAAC,QAAoB;IACrC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACvB,OAAO,GAAG,EAAE,CAAC,KAAK,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC9C,CAAC;AAED,SAAS,KAAK,CAAC,GAAW,EAAE,KAAoB;IAC9C,IAAI,CAAC;QACH,IAAI,KAAK,KAAK,IAAI;YAAE,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;;YAC3C,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,8CAA8C;IAChD,CAAC;AACH,CAAC;AAED,gFAAgF;AAChF,SAAS,IAAI;IACX,MAAM,OAAO,GAAG,QAAQ,C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ACV,MAAM,aAElB,eAAM,CAAC,EAAC,kDAAkD,GAAG,EAC7D,eAAM,CAAC,EAAC,wBAAwB,GAAG,IAC/B,GACC,EACT,eAAK,SAAS,EAAC,kBAAkB,EAAC,MAAM,EAAE,CAAC,IAAI,aAC7C,KAAC,UAAU,IACT,MAAM,EAAC,OAAO,EACd,IAAI,EAAC,kBAAkB,EACvB,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAc,CAAC,GAC7C,EACF,KAAC,QAAQ,IACP,KAAK,EAAC,iBAAiB,EACvB,OAAO,EAAE,KAAK,EACd,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAC3C,IACE,IACF,CACP,CAAA;AACH,CAAC"}
|
|
@@ -8,13 +8,7 @@
|
|
|
8
8
|
role="img"
|
|
9
9
|
aria-label="MetaCensus">
|
|
10
10
|
<title>MetaCensus</title>
|
|
11
|
-
<
|
|
12
|
-
<linearGradient id="mcLockup" x1="0" y1="11.25" x2="158.055" y2="11.25" gradientUnits="userSpaceOnUse">
|
|
13
|
-
<stop offset="0" stop-color="#37128A" />
|
|
14
|
-
<stop offset="1" stop-color="#AB82EC" />
|
|
15
|
-
</linearGradient>
|
|
16
|
-
</defs>
|
|
17
|
-
<g fill="url(#mcLockup)">
|
|
11
|
+
<g fill="#3B0E75">
|
|
18
12
|
<path d="M11.0455 1.25C11.0455 0.559644 11.6051 0 12.2955 0H14.7045C15.3949 0 15.9545 0.559644 15.9545 1.25C15.9545 1.94036 15.3949 2.5 14.7045 2.5H12.2955C11.6051 2.5 11.0455 1.94036 11.0455 1.25Z" />
|
|
19
13
|
<path d="M8.59091 5.25C8.59091 4.55964 9.15055 4 9.84091 4H18.3864C19.0767 4 19.6364 4.55964 19.6364 5.25C19.6364 5.94036 19.0767 6.5 18.3864 6.5H9.84091C9.15056 6.5 8.59091 5.94036 8.59091 5.25Z" />
|
|
20
14
|
<path d="M0 9.25C0 8.55964 0.559644 8 1.25 8H15.75C16.4404 8 17 8.55964 17 9.25C17 9.94036 16.4404 10.5 15.75 10.5H1.25C0.559644 10.5 0 9.94036 0 9.25Z" />
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metacensus/library-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "MetaCensus brand layer and UI tools for React.",
|
|
5
5
|
"license": "AGPL-3.0-only AND LicenseRef-MetaCensus-Marks",
|
|
6
6
|
"repository": {
|
|
@@ -19,6 +19,18 @@
|
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
20
20
|
"default": "./dist/index.js"
|
|
21
21
|
},
|
|
22
|
+
"./organization": {
|
|
23
|
+
"types": "./dist/organization/index.d.ts",
|
|
24
|
+
"default": "./dist/organization/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./site-links": {
|
|
27
|
+
"types": "./dist/site/links.d.ts",
|
|
28
|
+
"default": "./dist/site/links.js"
|
|
29
|
+
},
|
|
30
|
+
"./Header.astro": "./src/chrome/Header.astro",
|
|
31
|
+
"./Footer.astro": "./src/chrome/Footer.astro",
|
|
32
|
+
"./inventory/routes.mjs": "./src/inventory/routes.mjs",
|
|
33
|
+
"./OrganizationJsonLd.astro": "./src/organization/OrganizationJsonLd.astro",
|
|
22
34
|
"./pdf": {
|
|
23
35
|
"types": "./dist/pdf/index.d.ts",
|
|
24
36
|
"default": "./dist/pdf/index.js"
|
|
@@ -38,6 +50,9 @@
|
|
|
38
50
|
"dist",
|
|
39
51
|
"marks",
|
|
40
52
|
"src/css",
|
|
53
|
+
"src/chrome/*.astro",
|
|
54
|
+
"src/inventory/routes.mjs",
|
|
55
|
+
"src/organization/OrganizationJsonLd.astro",
|
|
41
56
|
"src/pdf/anchor.schema.json",
|
|
42
57
|
"LICENSE",
|
|
43
58
|
"TRADEMARKS.md",
|
|
@@ -60,6 +75,7 @@
|
|
|
60
75
|
"react-dom": "^18.3.1"
|
|
61
76
|
},
|
|
62
77
|
"devDependencies": {
|
|
78
|
+
"@astrojs/react": "^7.1.9",
|
|
63
79
|
"@axe-core/playwright": "^4.14.0",
|
|
64
80
|
"@eslint/js": "^9.39.0",
|
|
65
81
|
"@pdf-lib/fontkit": "^1.1.1",
|
|
@@ -68,6 +84,7 @@
|
|
|
68
84
|
"@types/react": "^18.3.3",
|
|
69
85
|
"@types/react-dom": "^18.3.7",
|
|
70
86
|
"ajv": "^8.20.0",
|
|
87
|
+
"astro": "^7.4.13",
|
|
71
88
|
"esbuild": "^0.28.2",
|
|
72
89
|
"eslint": "^9.39.0",
|
|
73
90
|
"pdf-lib": "^1.17.1",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { MetaCensusLockup } from '@metacensus/library-ui'
|
|
3
|
+
import { organization } from '@metacensus/library-ui/organization'
|
|
4
|
+
import { FOOTER_COLUMNS } from '@metacensus/library-ui/site-links'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<footer class="mc-footer">
|
|
8
|
+
<div class="mc-footer-brand">
|
|
9
|
+
<a href="/"><MetaCensusLockup /></a>
|
|
10
|
+
<p class="mc-footer-tagline">
|
|
11
|
+
{`© ${organization.copyrightYears} ${organization.name}.`}
|
|
12
|
+
</p>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="mc-footer-columns">
|
|
15
|
+
{
|
|
16
|
+
FOOTER_COLUMNS.map((column) => (
|
|
17
|
+
<nav class="mc-footer-column" aria-label={`Footer: ${column.label}`}>
|
|
18
|
+
{column.links.map((link) => (
|
|
19
|
+
<a href={link.href}>{link.label}</a>
|
|
20
|
+
))}
|
|
21
|
+
</nav>
|
|
22
|
+
))
|
|
23
|
+
}
|
|
24
|
+
</div>
|
|
25
|
+
</footer>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { Button, MetaCensusLockup } from '@metacensus/library-ui'
|
|
3
|
+
import {
|
|
4
|
+
HEADER_LINKS,
|
|
5
|
+
JOIN_PATH,
|
|
6
|
+
LOGIN_PATH,
|
|
7
|
+
} from '@metacensus/library-ui/site-links'
|
|
8
|
+
|
|
9
|
+
const path = Astro.url.pathname.replace(/\/?$/, '/')
|
|
10
|
+
const current = (href: string) =>
|
|
11
|
+
href === '/' ? path === '/' : path.startsWith(href)
|
|
12
|
+
const onJoinPage = path === JOIN_PATH
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<header class="mc-header mc-main-bar">
|
|
16
|
+
<a href="/" class="mc-header-home"><MetaCensusLockup /></a>
|
|
17
|
+
<nav class="mc-nav" aria-label="Primary">
|
|
18
|
+
<input id="mc-nav-toggle" type="checkbox" class="mc-nav-toggle" />
|
|
19
|
+
<label for="mc-nav-toggle" class="mc-nav-menu">Menu</label>
|
|
20
|
+
<ul class="mc-nav-links">
|
|
21
|
+
{
|
|
22
|
+
HEADER_LINKS.map((link) => (
|
|
23
|
+
<li>
|
|
24
|
+
<a
|
|
25
|
+
href={link.href}
|
|
26
|
+
aria-current={current(link.href) ? 'page' : undefined}
|
|
27
|
+
>
|
|
28
|
+
{link.label}
|
|
29
|
+
</a>
|
|
30
|
+
</li>
|
|
31
|
+
))
|
|
32
|
+
}
|
|
33
|
+
</ul>
|
|
34
|
+
</nav>
|
|
35
|
+
<div class="mc-header-actions">
|
|
36
|
+
<Button href={LOGIN_PATH} variant="text">Log in</Button>
|
|
37
|
+
{!onJoinPage && <Button href={JOIN_PATH}>Join us</Button>}
|
|
38
|
+
</div>
|
|
39
|
+
</header>
|
|
40
|
+
<slot />
|