@metacensus/library-ui 0.15.0 → 0.16.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 +78 -16
- package/TRADEMARKS.md +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -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 +13 -0
- package/dist/organization/facts.js +9 -0
- package/dist/organization/facts.js.map +1 -0
- package/dist/organization/index.d.ts +2 -0
- package/dist/organization/index.js +3 -0
- package/dist/organization/index.js.map +1 -0
- package/dist/organization/serialize.d.ts +17 -0
- package/dist/organization/serialize.js +40 -0
- package/dist/organization/serialize.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/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 +131 -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
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
MetaCensus's brand layer and a small set of UI tools, as one ESM React package (React 18 peer).
|
|
4
4
|
|
|
5
|
-
The first release's contents are tracked in this repository's issues. So far it ships the marks, the brand tokens, the components and the PDF anchor format.
|
|
5
|
+
The first release's contents are tracked in this repository's issues. So far it ships the marks, the brand tokens, the components, the shared layout and the PDF anchor format.
|
|
6
6
|
|
|
7
7
|
## Use
|
|
8
8
|
|
|
@@ -22,7 +22,7 @@ Marks are importable as `@metacensus/library-ui/marks/mark.svg` and its siblings
|
|
|
22
22
|
|
|
23
23
|
`styles.css` is plain CSS, every class `mc-` prefixed and none scoped to a site, reading the roles in `tokens.css`. No Tailwind is needed. Set `font-family: var(--mc-font-sans)` on your page.
|
|
24
24
|
|
|
25
|
-
`styles.css` declares `@layer mc`, so its rules sit in a cascade layer and lose to any unlayered rule of yours. `tokens.css` stays unlayered: custom properties do not compete with utilities. With Tailwind 4, put this line first so utilities beat the components, and `className="p-0"` or `"hidden"` on `Button`, `Header`, `Nav` or `
|
|
25
|
+
`styles.css` declares `@layer mc`, so its rules sit in a cascade layer and lose to any unlayered rule of yours. `tokens.css` stays unlayered: custom properties do not compete with utilities. With Tailwind 4, put this line first so utilities beat the components, and `className="p-0"` or `"hidden"` on `Button`, `Header`, `Nav` or `DisplayControls` wins without `!important`:
|
|
26
26
|
|
|
27
27
|
```css
|
|
28
28
|
@layer theme, base, mc, components, utilities;
|
|
@@ -30,27 +30,27 @@ Marks are importable as `@metacensus/library-ui/marks/mark.svg` and its siblings
|
|
|
30
30
|
|
|
31
31
|
Any unlayered rule of yours now beats the package's, whatever its specificity: a bare `button { ... }` beats `.mc-button`, which it did not before. That is how your own CSS wins. To choose the layer's name, import it as `@import '@metacensus/library-ui/styles.css' layer(brand);`, which nests the rules as `brand.mc`, and name `brand` in the ordering line in place of `mc`.
|
|
32
32
|
|
|
33
|
-
Components render on the server: no router, auth or API client, and no browser global while rendering. In Astro, add `@astrojs/react`; the marks and chrome render at build with no `client:` directive and ship no JS. Only `
|
|
33
|
+
Components render on the server: no router, auth or API client, and no browser global while rendering. In Astro, add `@astrojs/react`; the marks and chrome render at build with no `client:` directive and ship no JS. Only `DisplayControls` and `ContributorCard` need one, as `client:visible`.
|
|
34
34
|
|
|
35
35
|
- Marks: `MetaCensusMark`, `MetaCensusLockup`, `MetaCensusWordmark` (the lockup's letters alone, in `WORDMARK_VIEWBOX`), `MetaCensusArrow`, `LogoArrowMorph`, and the shared geometry, including the lockup's spacing (`LOCKUP_VIEWBOX`, and `LOCKUP_MARK_BOX` for the mark's box within it).
|
|
36
36
|
- Chrome: `Header` (`nav` and `actions` slots, which wrap on a narrow screen; with no `nav`, the `actions` sit at the end of the row), `Footer` (`brand` replaces the linked lockup and its link is the consumer's; `tagline`; link columns as children), `Nav` (`links`).
|
|
37
|
-
- Tools: `cn`, `Button`, `Notice`, `Chip`, the form kit (`Field`, `Label`, `Input`, `Textarea`, `Select`, `Checkbox`, `RadioGroup`, `FieldError`), `useTheme`, `
|
|
37
|
+
- Tools: `cn`, `Button`, `Notice`, `Chip`, the form kit (`Field`, `Label`, `Input`, `Textarea`, `Select`, `Checkbox`, `RadioGroup`, `FieldError`), `useTheme`, `useStill`, `DisplayControls`, `displayScript`.
|
|
38
38
|
- People: `ContributorCard` (a person's photo, name, role, flavor chip and bio, whose bio floats open on hover or focus until Escape), `ContributorFlavorKey`, and `AudienceIcon` for each of `AUDIENCES`, labelled from `AUDIENCE_LABELS`. The floating card is portaled into `<body>`, so import `tokens.css` and set the theme on `:root`, not on a wrapper.
|
|
39
39
|
|
|
40
|
-
- Marks take `variant`: `auto` (the default: solid on
|
|
40
|
+
- Marks take `variant`: `auto` (the default: solid on every ground, over a Soft Lavender halo on dark that spills about one mark-height past its box, so its container must not clip it), `solid` or `reversed`. Mark usage is in [TRADEMARKS.md](TRADEMARKS.md).
|
|
41
41
|
- `LogoArrowMorph` is a pure function of `progress`, 0 the mark and 1 the arrow; whatever places it owns the timing. Keep it horizontal.
|
|
42
42
|
- `Nav`'s mobile menu is a checkbox and CSS, so it works without JS.
|
|
43
|
-
- `Button` takes `variant`: `primary` (the default; one per view), `secondary`, `text`, `danger` or `inverse`. A solid Garnet fill marks only a risky action: one that destroys, discards, revokes or cannot be undone. A vote, a filter or a choice between options is not risky. `inverse` is a white fill for the call to action on a `--mc-fill-solid
|
|
43
|
+
- `Button` takes `variant`: `primary` (the default; one per view), `secondary`, `text`, `danger` or `inverse`. A solid Garnet fill marks only a risky action: one that destroys, discards, revokes or cannot be undone. A vote, a filter or a choice between options is not risky. `inverse` is a white fill for the call to action on a `--mc-fill-solid` or `--mc-night` ground, where `primary` is the ground's own colour or nearly so. Use it on those grounds only: it reads the same in light and dark, and `secondary` inside `.dark` is its quieter sibling.
|
|
44
44
|
- `Notice` takes `tone`: `alert` (the default, which reads the `--mc-alert-*` roles), `info` (the blue tint) or `success` (the purple tint fill with the accent ink, since the palette has no green). It renders `role="note"`; pass `role="alert"` for an error.
|
|
45
45
|
- `Button` and `Notice` follow the guidelines' illustrated Actions and Callout patterns. Those patterns do not bind yet: the guidelines have yet to state their shape.
|
|
46
|
-
-
|
|
46
|
+
- Display: inline `displayScript` in `<head>` so the stored choices are on `<html>` before first paint. `DisplayControls` is a round icon button fixed at the viewport's bottom-left corner; hover, focus or a tap opens a panel with the theme (`system`, the OS, `light` or `dark`) and a switch that stops animations. Render it once, from the layout; the panel may cover content on a phone. `useTheme` and `useStill` read and set the same choices. Stopped animations put `still` on `<html>`, whether the viewer chose it or the OS prefers reduced motion, so a page styles its own animations from `:root.still`, as the marks' halo does. With no stored choice the theme and `still` follow the system.
|
|
47
47
|
|
|
48
48
|
```astro
|
|
49
49
|
---
|
|
50
|
-
import { Header, Nav, Button,
|
|
50
|
+
import { Header, Nav, Button, displayScript } from '@metacensus/library-ui'
|
|
51
51
|
---
|
|
52
52
|
<head>
|
|
53
|
-
<script is:inline set:html={
|
|
53
|
+
<script is:inline set:html={displayScript} />
|
|
54
54
|
</head>
|
|
55
55
|
<Header>
|
|
56
56
|
<Nav slot="nav" links={[{ href: '/research', label: 'Research' }]} />
|
|
@@ -61,6 +61,75 @@ import { Header, Nav, Button, themeScript } from '@metacensus/library-ui'
|
|
|
61
61
|
|
|
62
62
|
In `.astro` files, pass `Header`'s `nav` and `actions` as named slots; JSX props there fail the build.
|
|
63
63
|
|
|
64
|
+
## Layout
|
|
65
|
+
|
|
66
|
+
The shared layout is `Header.astro` and `Footer.astro`, Astro components that take no props: they read the site links (`@metacensus/library-ui/site-links`) and the [organization's facts](#organization-facts). A site's layout composes them with the display controls and passes only what is its own. The React `Header` and `Footer` above are separate components, not these.
|
|
67
|
+
|
|
68
|
+
```astro
|
|
69
|
+
---
|
|
70
|
+
import Header from '@metacensus/library-ui/Header.astro'
|
|
71
|
+
import Footer from '@metacensus/library-ui/Footer.astro'
|
|
72
|
+
---
|
|
73
|
+
<Header><slot name="section-bar" /></Header>
|
|
74
|
+
<Footer />
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
[`browser/site`](browser/site) is the whole layout, which the browser suite builds. Put `Header` directly under `body`: the sticky section bar depends on it.
|
|
78
|
+
|
|
79
|
+
- `Header`'s slot renders after the main bar, outside it, so a page's `<nav slot="section-bar" class="mc-section-bar">` sticks at the viewport's top while the main bar scrolls away.
|
|
80
|
+
- Site links: `HEADER_LINKS`, `SECTION_LINKS`, `FOOTER_COLUMNS`, `LOGIN_PATH`, `JOIN_PATH` and `LEGAL_PATH`.
|
|
81
|
+
|
|
82
|
+
### Route inventory
|
|
83
|
+
|
|
84
|
+
`@metacensus/library-ui/inventory/routes.mjs` is an Astro integration that writes `ROUTES.md` at build: every page, its audience and purpose from `src/inventory/routes.json`, and the links and forms in its built HTML. The build fails when a route has no entry or an entry has no route. `deniedLinks` takes a function from a page's hrefs to those it may not link to, and fails the build on any.
|
|
85
|
+
|
|
86
|
+
```js
|
|
87
|
+
// astro.config.mjs
|
|
88
|
+
import routeInventory from '@metacensus/library-ui/inventory/routes.mjs'
|
|
89
|
+
|
|
90
|
+
export default defineConfig({
|
|
91
|
+
integrations: [routeInventory({ deniedLinks })],
|
|
92
|
+
})
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Organization facts
|
|
96
|
+
|
|
97
|
+
`@metacensus/library-ui/organization` holds the organization's name, URL, logo, contact address and the people credited as plain `organization` data, with no Astro or React, and what every site derives from it: `organizationJsonLd()`, `organizationJsonLdScript()` and `humansTxt()`.
|
|
98
|
+
|
|
99
|
+
In an Astro layout's `<head>`:
|
|
100
|
+
|
|
101
|
+
```astro
|
|
102
|
+
---
|
|
103
|
+
import OrganizationJsonLd from '@metacensus/library-ui/OrganizationJsonLd.astro'
|
|
104
|
+
---
|
|
105
|
+
<head>
|
|
106
|
+
<OrganizationJsonLd />
|
|
107
|
+
</head>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
In React, render the same function's output:
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
import { organizationJsonLdScript } from '@metacensus/library-ui/organization'
|
|
114
|
+
|
|
115
|
+
;<script
|
|
116
|
+
type="application/ld+json"
|
|
117
|
+
dangerouslySetInnerHTML={{ __html: organizationJsonLdScript() }}
|
|
118
|
+
/>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`humans.txt` is an Astro endpoint, built to `/humans.txt`:
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
// src/pages/humans.txt.ts
|
|
125
|
+
import { humansTxt } from '@metacensus/library-ui/organization'
|
|
126
|
+
|
|
127
|
+
export const GET = () =>
|
|
128
|
+
new Response(humansTxt(), {
|
|
129
|
+
headers: { 'Content-Type': 'text/plain; charset=utf-8' },
|
|
130
|
+
})
|
|
131
|
+
```
|
|
132
|
+
|
|
64
133
|
## PDF
|
|
65
134
|
|
|
66
135
|
`@metacensus/library-ui/pdf` is a separate entry point, so the main one never loads pdf.js.
|
|
@@ -145,13 +214,6 @@ The default for a chip, pill, badge or callout: the family's tint as the fill, i
|
|
|
145
214
|
|
|
146
215
|
`--mc-grey-mid` is for text demoted in place: copy that stops being the subject and becomes context for what replaced it. Copy that is merely secondary starts in Charcoal, which is `--mc-ink`. On white Slate Mist is about 3.2:1, under the 4.5:1 minimum for small text, so `--mc-ink-secondary` is not for small text there. For an outline, use `--mc-line-input`.
|
|
147
216
|
|
|
148
|
-
### Gradients
|
|
149
|
-
|
|
150
|
-
- `--mc-gradient-hero`, `#3B0E75` to `#915EDA`, for hero fills.
|
|
151
|
-
- `--mc-gradient-lockup`, `#37128A` to `#AB82EC`, the lockup's own.
|
|
152
|
-
|
|
153
|
-
Two stops each; add no third and route neither through an accent family.
|
|
154
|
-
|
|
155
217
|
### Shape (provisional)
|
|
156
218
|
|
|
157
219
|
- `--mc-radius: 6px`
|
package/TRADEMARKS.md
CHANGED
|
@@ -22,7 +22,7 @@ The marks are the primary mark, the wordmark lockup, the wordmark alone, the arr
|
|
|
22
22
|
|
|
23
23
|
- **Clear space:** keep the height of the smallest bar clear on all sides.
|
|
24
24
|
- **Minimum size:** 24px tall on screen, 12mm in print, 16px for a favicon.
|
|
25
|
-
- **Variants:**
|
|
25
|
+
- **Variants:** solid `#3B0E75`, reversed white on dark, grayscale. Use the reversed variant on dark or violet grounds.
|
|
26
26
|
- **Scale** proportionally from these vector files.
|
|
27
27
|
- **The arrow** may be rotated to follow reading direction. Nothing else may.
|
|
28
28
|
|
|
@@ -31,5 +31,5 @@ The marks are the primary mark, the wordmark lockup, the wordmark alone, the arr
|
|
|
31
31
|
- Don't rebuild or re-draw the marks, or re-set the wordmark in another typeface.
|
|
32
32
|
- Don't recolor outside the variants above, and don't use the coral signal color in a mark.
|
|
33
33
|
- Don't rotate (except the arrow), stretch, compress, skew or distort a mark, or alter the spacing between bars.
|
|
34
|
-
- Don't add
|
|
35
|
-
- Don't place
|
|
34
|
+
- Don't add shadows or effects: a mark is one flat color.
|
|
35
|
+
- Don't place a mark on a busy or low-contrast photograph.
|
package/dist/index.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ export { Checkbox, Field, FieldError, Input, Label, RadioGroup, Select, Textarea
|
|
|
10
10
|
export { Notice } from './tools/Notice.js';
|
|
11
11
|
export { AUDIENCES, AUDIENCE_LABELS, AudienceIcon, type Audience, } from './people/AudienceIcon.js';
|
|
12
12
|
export { ContributorCard, ContributorFlavorKey, type ContributorFlavor, } from './people/ContributorCard.js';
|
|
13
|
-
export {
|
|
13
|
+
export { DisplayControls, displayScript, useStill, useTheme, type Theme, } from './tools/display.js';
|
package/dist/index.js
CHANGED
|
@@ -10,5 +10,5 @@ export { Checkbox, Field, FieldError, Input, Label, RadioGroup, Select, Textarea
|
|
|
10
10
|
export { Notice } from './tools/Notice.js';
|
|
11
11
|
export { AUDIENCES, AUDIENCE_LABELS, AudienceIcon, } from './people/AudienceIcon.js';
|
|
12
12
|
export { ContributorCard, ContributorFlavorKey, } from './people/ContributorCard.js';
|
|
13
|
-
export {
|
|
13
|
+
export { DisplayControls, displayScript, useStill, useTheme, } from './tools/display.js';
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,kBAAkB,GACnB,MAAM,kBAAkB,CAAA;AACzB,cAAc,qBAAqB,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,GAAG,EAAgB,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AAClC,OAAO,EACL,QAAQ,EACR,KAAK,EACL,UAAU,EACV,KAAK,EACL,KAAK,EACL,UAAU,EACV,MAAM,EACN,QAAQ,GACT,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EACL,SAAS,EACT,eAAe,EACf,YAAY,GAEb,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,eAAe,EACf,oBAAoB,GAErB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,kBAAkB,GACnB,MAAM,kBAAkB,CAAA;AACzB,cAAc,qBAAqB,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,GAAG,EAAgB,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAA;AAClC,OAAO,EACL,QAAQ,EACR,KAAK,EACL,UAAU,EACV,KAAK,EACL,KAAK,EACL,UAAU,EACV,MAAM,EACN,QAAQ,GACT,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EACL,SAAS,EACT,eAAe,EACf,YAAY,GAEb,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,eAAe,EACf,oBAAoB,GAErB,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,eAAe,EACf,aAAa,EACb,QAAQ,EACR,QAAQ,GAET,MAAM,oBAAoB,CAAA"}
|
package/dist/marks/Marks.d.ts
CHANGED
|
@@ -6,11 +6,8 @@ type MarkProps = {
|
|
|
6
6
|
};
|
|
7
7
|
/** The primary mark: the six bars of the forest plot. */
|
|
8
8
|
export declare function MetaCensusMark({ variant, className, title, }: MarkProps): import("react").JSX.Element;
|
|
9
|
-
/** The mark and wordmark, outlined.
|
|
10
|
-
|
|
11
|
-
export declare function MetaCensusLockup({ variant, className, title, }: Omit<MarkProps, 'variant'> & {
|
|
12
|
-
variant?: Variant | 'gradient';
|
|
13
|
-
}): import("react").JSX.Element;
|
|
9
|
+
/** The mark and wordmark, outlined. */
|
|
10
|
+
export declare function MetaCensusLockup({ variant, className, title, }: MarkProps): import("react").JSX.Element;
|
|
14
11
|
/** The wordmark alone: the lockup's letters, outlined, without the bars. */
|
|
15
12
|
export declare function MetaCensusWordmark({ variant, className, title, }: MarkProps): import("react").JSX.Element;
|
|
16
13
|
/** The arrow. Decorative unless given a `title`. It may be rotated to follow
|
package/dist/marks/Marks.js
CHANGED
|
@@ -1,23 +1,48 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useId } from 'react';
|
|
3
3
|
import { cn } from '../tools/cn.js';
|
|
4
4
|
import { ARROW_SEGMENTS, ARROW_VIEWBOX, BARS, BAR_RECTS, CAP_RADIUS, LOCKUP_VIEWBOX, MARK_VIEWBOX, STROKE_WIDTH, WORDMARK_VIEWBOX, barAt, } from './geometry.js';
|
|
5
5
|
import { LOCKUP_PATHS } from './lockupPaths.js';
|
|
6
6
|
const fillClass = (variant) => `mc-fill-${variant}`;
|
|
7
|
+
/** A DOM id unique to this render, safe inside `url(#…)`. */
|
|
8
|
+
const useSvgId = (prefix) => `${prefix}-${useId().replace(/[^\w-]/g, '')}`;
|
|
9
|
+
/** Draws `children` over the dark-ground halo: Soft Lavender, diffused,
|
|
10
|
+
* rippling like water, with a thin still rim beneath the mark; still under
|
|
11
|
+
* reduced motion. Its numbers are in the lockup's units, 23 tall; `height`
|
|
12
|
+
* scales them to the viewBox. styles.css renders it on dark grounds only. */
|
|
13
|
+
function Haloed({ viewBox, children, }) {
|
|
14
|
+
const id = useSvgId('mc-halo');
|
|
15
|
+
const [x, y, w, h] = viewBox.split(' ').map(Number);
|
|
16
|
+
const u = h / 23;
|
|
17
|
+
const pad = 24 * u;
|
|
18
|
+
const region = {
|
|
19
|
+
filterUnits: 'userSpaceOnUse',
|
|
20
|
+
x: x - pad,
|
|
21
|
+
y: y - pad,
|
|
22
|
+
width: w + 2 * pad,
|
|
23
|
+
height: h + 2 * pad,
|
|
24
|
+
};
|
|
25
|
+
const period = region.width / 2;
|
|
26
|
+
const edge = (_jsxs(_Fragment, { children: [_jsx("feMorphology", { in: "SourceAlpha", operator: "dilate", radius: 2.1 * u }), _jsx("feGaussianBlur", { stdDeviation: 6 * u, result: "edge" })] }));
|
|
27
|
+
/** Floods Soft Lavender through the `mask` result at alpha `slope`. */
|
|
28
|
+
const tint = (mask, slope, breathing) => (_jsxs(_Fragment, { children: [_jsx("feFlood", { className: "mc-halo-flood" }), _jsx("feComposite", { in2: mask, operator: "in" }), _jsx("feComponentTransfer", { result: "tinted", children: _jsx("feFuncA", { type: "linear", slope: slope, children: breathing }) })] }));
|
|
29
|
+
// Laid over the tinted halo, after its breathing, so it does not breathe.
|
|
30
|
+
const rim = (_jsxs(_Fragment, { children: [_jsx("feMorphology", { in: "SourceAlpha", operator: "dilate", radius: 0.8 * u }), _jsx("feGaussianBlur", { stdDeviation: 0.8 * u }), _jsx("feComponentTransfer", { result: "rim", children: _jsx("feFuncA", { type: "linear", slope: "0.40" }) }), _jsx("feFlood", { className: "mc-halo-flood" }), _jsx("feComposite", { in2: "rim", operator: "in" }), _jsx("feComposite", { in2: "tinted", operator: "over" })] }));
|
|
31
|
+
return (_jsxs(_Fragment, { children: [_jsxs("defs", { children: [_jsxs("filter", { id: `${id}-moving`, ...region, children: [edge, _jsx("feTurbulence", { type: "fractalNoise", baseFrequency: `${0.06 / u} ${0.155 / u}`, stitchTiles: "stitch", x: x, width: period }), _jsx("feTile", { x: region.x, width: region.width }), _jsx("feOffset", { x: region.x, width: period, children: _jsx("animate", { attributeName: "dx", values: `0;${-period}`, dur: "12s", repeatCount: "indefinite" }) }), _jsx("feTile", { x: region.x, width: region.width }), _jsx("feDisplacementMap", { in: "edge", scale: 7.5 * u, xChannelSelector: "R", yChannelSelector: "G", result: "water" }), _jsx("feMorphology", { in: "SourceAlpha", operator: "dilate", radius: 1.5 * u, children: _jsx("animate", { attributeName: "radius", values: `${1.5 * u};${10.5 * u}`, dur: "4.1s", repeatCount: "indefinite" }) }), _jsx("feGaussianBlur", { stdDeviation: 3 * u }), _jsx("feComponentTransfer", { children: _jsx("feFuncA", { type: "linear", slope: "0.35", children: _jsx("animate", { attributeName: "slope", values: "0.35;0", dur: "4.1s", repeatCount: "indefinite" }) }) }), _jsx("feComposite", { in2: "edge", operator: "in" }), _jsx("feComposite", { in2: "water", operator: "over", result: "halo" }), tint('halo', 0.48, _jsx("animate", { attributeName: "slope", values: "0.48;0.64;0.48", dur: "4.9s", repeatCount: "indefinite" })), rim] }), _jsxs("filter", { id: `${id}-still`, ...region, children: [edge, tint('edge', 0.64), rim] }), _jsx("g", { id: id, children: children })] }), _jsxs("g", { className: "mc-halo", children: [_jsx("use", { href: `#${id}`, filter: `url(#${id}-moving)`, className: "mc-halo-moving" }), _jsx("use", { href: `#${id}`, filter: `url(#${id}-still)`, className: "mc-halo-still" })] }), _jsx("use", { href: `#${id}` })] }));
|
|
32
|
+
}
|
|
33
|
+
/** The marks' shapes, haloed when `auto`. */
|
|
34
|
+
const drawn = (variant, viewBox, shapes) => variant === 'auto' ? _jsx(Haloed, { viewBox: viewBox, children: shapes }) : shapes;
|
|
7
35
|
/** The primary mark: the six bars of the forest plot. */
|
|
8
36
|
export function MetaCensusMark({ variant = 'auto', className, title = 'MetaCensus', }) {
|
|
9
|
-
return (_jsxs("svg", { viewBox: MARK_VIEWBOX, className: cn('mc-mark', fillClass(variant), className), role: "img", "aria-label": title, children: [_jsx("title", { children: title }), BAR_RECTS.map((b) => (_jsx("rect", { x: b.x, y: b.y, width: b.w, height: STROKE_WIDTH, rx: CAP_RADIUS }, b.y)))] }));
|
|
37
|
+
return (_jsxs("svg", { viewBox: MARK_VIEWBOX, className: cn('mc-mark', fillClass(variant), className), role: "img", "aria-label": title, children: [_jsx("title", { children: title }), drawn(variant, MARK_VIEWBOX, BAR_RECTS.map((b) => (_jsx("rect", { x: b.x, y: b.y, width: b.w, height: STROKE_WIDTH, rx: CAP_RADIUS }, b.y))))] }));
|
|
10
38
|
}
|
|
11
|
-
/** The mark and wordmark, outlined.
|
|
12
|
-
* needs a white or very light ground. */
|
|
39
|
+
/** The mark and wordmark, outlined. */
|
|
13
40
|
export function MetaCensusLockup({ variant = 'auto', className, title = 'MetaCensus', }) {
|
|
14
|
-
|
|
15
|
-
const gradient = variant === 'gradient';
|
|
16
|
-
return (_jsxs("svg", { viewBox: LOCKUP_VIEWBOX, className: cn('mc-lockup', !gradient && fillClass(variant), className), fill: gradient ? `url(#${gradientId})` : undefined, role: "img", "aria-label": title, children: [_jsx("title", { children: title }), gradient && (_jsx("defs", { children: _jsxs("linearGradient", { id: gradientId, x1: "0", x2: "158.055", y1: "0", y2: "0", gradientUnits: "userSpaceOnUse", children: [_jsx("stop", { offset: "0", stopColor: "#37128A" }), _jsx("stop", { offset: "1", stopColor: "#AB82EC" })] }) })), LOCKUP_PATHS.map((d) => (_jsx("path", { d: d }, d)))] }));
|
|
41
|
+
return (_jsxs("svg", { viewBox: LOCKUP_VIEWBOX, className: cn('mc-lockup', fillClass(variant), className), role: "img", "aria-label": title, children: [_jsx("title", { children: title }), drawn(variant, LOCKUP_VIEWBOX, LOCKUP_PATHS.map((d) => _jsx("path", { d: d }, d)))] }));
|
|
17
42
|
}
|
|
18
43
|
/** The wordmark alone: the lockup's letters, outlined, without the bars. */
|
|
19
44
|
export function MetaCensusWordmark({ variant = 'auto', className, title = 'MetaCensus', }) {
|
|
20
|
-
return (_jsxs("svg", { viewBox: WORDMARK_VIEWBOX, className: cn('mc-wordmark', fillClass(variant), className), role: "img", "aria-label": title, children: [_jsx("title", { children: title }), LOCKUP_PATHS.slice(BAR_RECTS.length).map((d) => (_jsx("path", { d: d }, d)))] }));
|
|
45
|
+
return (_jsxs("svg", { viewBox: WORDMARK_VIEWBOX, className: cn('mc-wordmark', fillClass(variant), className), role: "img", "aria-label": title, children: [_jsx("title", { children: title }), drawn(variant, WORDMARK_VIEWBOX, LOCKUP_PATHS.slice(BAR_RECTS.length).map((d) => (_jsx("path", { d: d }, d))))] }));
|
|
21
46
|
}
|
|
22
47
|
/** The arrow. Decorative unless given a `title`. It may be rotated to follow
|
|
23
48
|
* reading direction; nothing else of the brand may. */
|
package/dist/marks/Marks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Marks.js","sourceRoot":"","sources":["../../src/marks/Marks.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"Marks.js","sourceRoot":"","sources":["../../src/marks/Marks.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAkB,MAAM,OAAO,CAAA;AAC7C,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAA;AACnC,OAAO,EACL,cAAc,EACd,aAAa,EACb,IAAI,EACJ,SAAS,EACT,UAAU,EACV,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,KAAK,GACN,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAW/C,MAAM,SAAS,GAAG,CAAC,OAAgB,EAAE,EAAE,CAAC,WAAW,OAAO,EAAE,CAAA;AAE5D,6DAA6D;AAC7D,MAAM,QAAQ,GAAG,CAAC,MAAc,EAAE,EAAE,CAClC,GAAG,MAAM,IAAI,KAAK,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,CAAA;AAE/C;;;8EAG8E;AAC9E,SAAS,MAAM,CAAC,EACd,OAAO,EACP,QAAQ,GAIT;IACC,MAAM,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAA;IAC9B,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,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AClD,MAAM,UAAU,cAAc,CAAC,EAC7B,QAAQ,EACR,OAAO,GAAG,MAAM,EAChB,SAAS,EACT,KAAK,GAAG,4BAA4B,GACH;IACjC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAA;IAC5C,OAAO,CACL,eACE,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,aAAa,OAAO,EAAE,EAAE,SAAS,CAAC,EAC3D,IAAI,EAAC,KAAK,gBACE,KAAK,EACjB,IAAI,EAAC,MAAM,EACX,WAAW,EAAE,YAAY,EACzB,aAAa,EAAC,OAAO,aAErB,0BAAQ,KAAK,GAAS,EACrB,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;gBACnB,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;gBACrB,OAAO,eAAmB,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAA9C,GAAG,CAAC,EAAE,CAA4C,CAAA;YACtE,CAAC,CAAC,IACE,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface Organization {
|
|
2
|
+
name: string;
|
|
3
|
+
/** No trailing slash. */
|
|
4
|
+
url: string;
|
|
5
|
+
logo: string;
|
|
6
|
+
email: string;
|
|
7
|
+
copyrightYears: string;
|
|
8
|
+
people: readonly {
|
|
9
|
+
name: string;
|
|
10
|
+
role: string;
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
export declare const organization: Organization;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const organization = {
|
|
2
|
+
name: 'MetaCensus',
|
|
3
|
+
url: 'https://www.metacensus.org',
|
|
4
|
+
logo: 'https://raw.githubusercontent.com/metacensus/library-ui/main/marks/mark.svg',
|
|
5
|
+
email: 'brand@metacensus.io',
|
|
6
|
+
copyrightYears: '2023–2026',
|
|
7
|
+
people: [],
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=facts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"facts.js","sourceRoot":"","sources":["../../src/organization/facts.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,YAAY,GAAiB;IACxC,IAAI,EAAE,YAAY;IAClB,GAAG,EAAE,4BAA4B;IACjC,IAAI,EAAE,6EAA6E;IACnF,KAAK,EAAE,qBAAqB;IAC5B,cAAc,EAAE,WAAW;IAC3B,MAAM,EAAE,EAAE;CACX,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/organization/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,YAAY,CAAA;AAC5D,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare function organizationJsonLd(): {
|
|
2
|
+
employee?: {
|
|
3
|
+
'@type': string;
|
|
4
|
+
name: string;
|
|
5
|
+
jobTitle: string;
|
|
6
|
+
}[] | undefined;
|
|
7
|
+
'@context': string;
|
|
8
|
+
'@type': string;
|
|
9
|
+
name: string;
|
|
10
|
+
url: string;
|
|
11
|
+
logo: string;
|
|
12
|
+
email: string;
|
|
13
|
+
};
|
|
14
|
+
/** The JSON-LD as the body of a `<script>`: `<` is escaped so no value can close it. */
|
|
15
|
+
export declare function organizationJsonLdScript(): string;
|
|
16
|
+
/** Ends in a newline. */
|
|
17
|
+
export declare function humansTxt(): string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { organization as org } from './facts.js';
|
|
2
|
+
export function organizationJsonLd() {
|
|
3
|
+
return {
|
|
4
|
+
'@context': 'https://schema.org',
|
|
5
|
+
'@type': 'Organization',
|
|
6
|
+
name: org.name,
|
|
7
|
+
url: org.url,
|
|
8
|
+
logo: org.logo,
|
|
9
|
+
email: org.email,
|
|
10
|
+
...(org.people.length > 0 && {
|
|
11
|
+
employee: org.people.map(({ name, role }) => ({
|
|
12
|
+
'@type': 'Person',
|
|
13
|
+
name,
|
|
14
|
+
jobTitle: role,
|
|
15
|
+
})),
|
|
16
|
+
}),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/** The JSON-LD as the body of a `<script>`: `<` is escaped so no value can close it. */
|
|
20
|
+
export function organizationJsonLdScript() {
|
|
21
|
+
return JSON.stringify(organizationJsonLd()).replace(/</g, '\\u003c');
|
|
22
|
+
}
|
|
23
|
+
/** Ends in a newline. */
|
|
24
|
+
export function humansTxt() {
|
|
25
|
+
return [
|
|
26
|
+
...(org.people.length > 0
|
|
27
|
+
? [
|
|
28
|
+
'/* TEAM */',
|
|
29
|
+
...org.people.map(({ name, role }) => `${role}: ${name}`),
|
|
30
|
+
'',
|
|
31
|
+
]
|
|
32
|
+
: []),
|
|
33
|
+
'/* SITE */',
|
|
34
|
+
`Organization: ${org.name}`,
|
|
35
|
+
`URL: ${org.url}`,
|
|
36
|
+
`Contact: ${org.email}`,
|
|
37
|
+
'',
|
|
38
|
+
].join('\n');
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=serialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../src/organization/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,GAAG,EAAE,MAAM,YAAY,CAAA;AAEhD,MAAM,UAAU,kBAAkB;IAChC,OAAO;QACL,UAAU,EAAE,oBAAoB;QAChC,OAAO,EAAE,cAAc;QACvB,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,GA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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,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;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QAAQ,EACb,SAAS,EAAC,mBAAmB,gBAClB,SAAS,mBACL,IAAI,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,YAI5B,eACE,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAE,CAAC,EACd,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,iBACV,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.16.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 />
|
package/src/css/styles.css
CHANGED
|
@@ -17,7 +17,42 @@
|
|
|
17
17
|
width: auto;
|
|
18
18
|
}
|
|
19
19
|
.mc-fill-auto {
|
|
20
|
-
fill:
|
|
20
|
+
fill: var(--mc-purple-bold);
|
|
21
|
+
overflow: visible;
|
|
22
|
+
}
|
|
23
|
+
/* The halo under an `auto` mark, rendered only on a dark ground: the OS
|
|
24
|
+
setting, or the nearest `.dark` or `.light` ancestor, as tokens.css
|
|
25
|
+
resolves the scheme. */
|
|
26
|
+
.mc-halo-flood {
|
|
27
|
+
flood-color: var(--mc-purple-tint);
|
|
28
|
+
}
|
|
29
|
+
.mc-halo {
|
|
30
|
+
display: none;
|
|
31
|
+
}
|
|
32
|
+
@media (prefers-color-scheme: dark) {
|
|
33
|
+
.mc-halo {
|
|
34
|
+
display: inline;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
@scope (.dark) {
|
|
38
|
+
.mc-halo {
|
|
39
|
+
display: inline;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
@scope (.light) {
|
|
43
|
+
.mc-halo {
|
|
44
|
+
display: none;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
.mc-halo-still {
|
|
48
|
+
display: none;
|
|
49
|
+
}
|
|
50
|
+
/* `.still`: animations stopped, as displayScript sets it. */
|
|
51
|
+
:root.still .mc-halo-moving {
|
|
52
|
+
display: none;
|
|
53
|
+
}
|
|
54
|
+
:root.still .mc-halo-still {
|
|
55
|
+
display: inline;
|
|
21
56
|
}
|
|
22
57
|
.mc-fill-solid {
|
|
23
58
|
fill: var(--mc-purple-bold);
|
|
@@ -64,6 +99,52 @@
|
|
|
64
99
|
gap: 0.75rem;
|
|
65
100
|
}
|
|
66
101
|
|
|
102
|
+
.mc-main-bar {
|
|
103
|
+
z-index: 40;
|
|
104
|
+
flex-wrap: nowrap;
|
|
105
|
+
gap: 1rem;
|
|
106
|
+
}
|
|
107
|
+
.mc-main-bar .mc-nav {
|
|
108
|
+
margin-inline: auto;
|
|
109
|
+
}
|
|
110
|
+
.mc-main-bar .mc-header-home {
|
|
111
|
+
margin-inline-end: 0;
|
|
112
|
+
}
|
|
113
|
+
@media (width < 48rem) {
|
|
114
|
+
.mc-main-bar {
|
|
115
|
+
padding-block: 0.5rem;
|
|
116
|
+
}
|
|
117
|
+
.mc-main-bar .mc-header-home {
|
|
118
|
+
flex: none;
|
|
119
|
+
width: calc(1.5rem * 27 / 23);
|
|
120
|
+
overflow: hidden;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* The page's section bar: scrolls with the page until it reaches the viewport's top. */
|
|
125
|
+
.mc-section-bar {
|
|
126
|
+
position: sticky;
|
|
127
|
+
top: 0;
|
|
128
|
+
z-index: 30;
|
|
129
|
+
display: flex;
|
|
130
|
+
justify-content: safe center;
|
|
131
|
+
gap: clamp(0.75rem, 3vw, 1.5rem);
|
|
132
|
+
padding: 0.625rem 1rem;
|
|
133
|
+
background: var(--mc-ground);
|
|
134
|
+
border-bottom: 1px solid var(--mc-hairline);
|
|
135
|
+
font-size: 0.875rem;
|
|
136
|
+
font-weight: 500;
|
|
137
|
+
white-space: nowrap;
|
|
138
|
+
overflow-x: auto;
|
|
139
|
+
}
|
|
140
|
+
.mc-section-bar a {
|
|
141
|
+
color: var(--mc-ink);
|
|
142
|
+
text-decoration: none;
|
|
143
|
+
}
|
|
144
|
+
.mc-section-bar a:hover {
|
|
145
|
+
color: var(--mc-ink-accent);
|
|
146
|
+
}
|
|
147
|
+
|
|
67
148
|
/* Nav: a checkbox opens the list on a narrow screen, with no JS. */
|
|
68
149
|
.mc-nav {
|
|
69
150
|
position: relative;
|
|
@@ -151,6 +232,14 @@
|
|
|
151
232
|
flex-wrap: wrap;
|
|
152
233
|
gap: 2rem;
|
|
153
234
|
}
|
|
235
|
+
.mc-footer-column {
|
|
236
|
+
display: flex;
|
|
237
|
+
flex-direction: column;
|
|
238
|
+
gap: 0.75rem;
|
|
239
|
+
}
|
|
240
|
+
.mc-footer a {
|
|
241
|
+
color: var(--mc-ink);
|
|
242
|
+
}
|
|
154
243
|
|
|
155
244
|
/* Button. */
|
|
156
245
|
.mc-button {
|
|
@@ -321,56 +410,66 @@
|
|
|
321
410
|
font-size: 0.875rem;
|
|
322
411
|
}
|
|
323
412
|
|
|
324
|
-
/*
|
|
325
|
-
|
|
326
|
-
.mc-
|
|
413
|
+
/* Display controls: a round icon button fixed at the viewport's bottom-left
|
|
414
|
+
corner, with a panel above it. */
|
|
415
|
+
.mc-display {
|
|
327
416
|
position: fixed;
|
|
328
417
|
inset-block-end: 1rem;
|
|
329
|
-
inset-inline-
|
|
418
|
+
inset-inline-start: 1rem;
|
|
330
419
|
z-index: 40;
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
420
|
+
}
|
|
421
|
+
.mc-display-button {
|
|
422
|
+
display: grid;
|
|
423
|
+
place-items: center;
|
|
424
|
+
width: 2.75rem;
|
|
334
425
|
height: 2.75rem;
|
|
335
|
-
padding: 0
|
|
426
|
+
padding: 0;
|
|
336
427
|
border: 1px solid var(--mc-hairline);
|
|
337
428
|
border-radius: 999px;
|
|
338
429
|
background: var(--mc-card);
|
|
339
430
|
color: var(--mc-ink);
|
|
340
431
|
box-shadow: 0 2px 8px color-mix(in srgb, var(--mc-ink) 20%, transparent);
|
|
341
|
-
font: inherit;
|
|
342
|
-
font-weight: 500;
|
|
343
|
-
white-space: nowrap;
|
|
344
432
|
cursor: pointer;
|
|
345
433
|
}
|
|
346
|
-
.mc-
|
|
347
|
-
flex: none;
|
|
434
|
+
.mc-display-button svg {
|
|
348
435
|
width: 1.25rem;
|
|
349
436
|
height: 1.25rem;
|
|
350
437
|
}
|
|
351
|
-
.mc-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
438
|
+
.mc-display-panel {
|
|
439
|
+
position: absolute;
|
|
440
|
+
inset-block-end: calc(100% + 0.5rem);
|
|
441
|
+
inset-inline-start: 0;
|
|
442
|
+
box-sizing: border-box;
|
|
443
|
+
width: 14rem;
|
|
444
|
+
max-width: calc(100vw - 2rem);
|
|
445
|
+
display: flex;
|
|
446
|
+
flex-direction: column;
|
|
447
|
+
gap: 0.75rem;
|
|
448
|
+
padding: 0.75rem 1rem;
|
|
449
|
+
border: 1px solid var(--mc-hairline);
|
|
450
|
+
border-radius: var(--mc-radius);
|
|
451
|
+
background: var(--mc-card);
|
|
452
|
+
color: var(--mc-ink);
|
|
453
|
+
box-shadow: 0 2px 8px color-mix(in srgb, var(--mc-ink) 20%, transparent);
|
|
454
|
+
}
|
|
455
|
+
/* Bridges the gap to the button so the pointer crosses it without leaving. */
|
|
456
|
+
.mc-display-panel::before {
|
|
457
|
+
content: '';
|
|
458
|
+
position: absolute;
|
|
459
|
+
inset-inline: 0;
|
|
460
|
+
inset-block-start: 100%;
|
|
461
|
+
height: 0.5rem;
|
|
357
462
|
}
|
|
358
|
-
.mc-
|
|
359
|
-
|
|
360
|
-
max-width: 4rem;
|
|
361
|
-
margin-inline: 0.5rem 0.25rem;
|
|
463
|
+
.mc-display-panel[hidden] {
|
|
464
|
+
display: none;
|
|
362
465
|
}
|
|
363
|
-
.mc-
|
|
466
|
+
.mc-display-button:focus-visible,
|
|
467
|
+
.mc-display-panel input:focus-visible {
|
|
364
468
|
outline: 2px solid var(--mc-ink-accent);
|
|
365
469
|
outline-offset: 2px;
|
|
366
470
|
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
transition: none;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
/* The footer's last line stays clear of the toggle at the page's end. */
|
|
373
|
-
:root:has(.mc-theme-toggle) .mc-footer {
|
|
471
|
+
/* The footer's last line stays clear of the button at the page's end. */
|
|
472
|
+
:root:has(.mc-display) .mc-footer {
|
|
374
473
|
padding-block-end: 5rem;
|
|
375
474
|
}
|
|
376
475
|
|
package/src/css/tokens.css
CHANGED
|
@@ -83,14 +83,6 @@
|
|
|
83
83
|
);
|
|
84
84
|
--mc-tint-blue-ink: light-dark(var(--mc-blue-bold), var(--mc-blue-mid));
|
|
85
85
|
|
|
86
|
-
/* Gradients: two stops, never a third. */
|
|
87
|
-
--mc-gradient-hero: linear-gradient(
|
|
88
|
-
to right,
|
|
89
|
-
var(--mc-purple-bold),
|
|
90
|
-
var(--mc-purple-mid)
|
|
91
|
-
);
|
|
92
|
-
--mc-gradient-lockup: linear-gradient(to right, #37128a, #ab82ec);
|
|
93
|
-
|
|
94
86
|
/* Type: the face only, no scale. */
|
|
95
87
|
--mc-font-sans:
|
|
96
88
|
'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto,
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// Writes ROUTES.md from the build: every page Astro emits, its audience and
|
|
2
|
+
// purpose from a JSON file of entries, and the links and forms in its built
|
|
3
|
+
// HTML. The build fails when a route has no entry, an entry has no route, or a
|
|
4
|
+
// page links where `deniedLinks` denies.
|
|
5
|
+
import { readFile, writeFile } from 'node:fs/promises'
|
|
6
|
+
import { URL, fileURLToPath } from 'node:url'
|
|
7
|
+
|
|
8
|
+
const ENTRIES = 'src/inventory/routes.json'
|
|
9
|
+
const OUTPUT = 'ROUTES.md'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @param {object} [options]
|
|
13
|
+
* @param {(hrefs: string[]) => string[]} [options.deniedLinks] The hrefs a page may not link to.
|
|
14
|
+
* @returns {import("astro").AstroIntegration}
|
|
15
|
+
*/
|
|
16
|
+
export default function routeInventory({ deniedLinks = () => [] } = {}) {
|
|
17
|
+
let base = '/'
|
|
18
|
+
let root = new URL('file:///')
|
|
19
|
+
return {
|
|
20
|
+
name: 'route-inventory',
|
|
21
|
+
hooks: {
|
|
22
|
+
'astro:config:done': ({ config }) => {
|
|
23
|
+
base = config.base.replace(/\/?$/, '/')
|
|
24
|
+
root = config.root
|
|
25
|
+
},
|
|
26
|
+
'astro:build:done': async ({ dir, assets }) => {
|
|
27
|
+
/** @type {Record<string, { audience: string, purpose: string }>} */
|
|
28
|
+
const entries = JSON.parse(
|
|
29
|
+
await readFile(new URL(ENTRIES, root), 'utf8'),
|
|
30
|
+
)
|
|
31
|
+
const patterns = [...assets.keys()].sort()
|
|
32
|
+
const missing = patterns.filter((p) => !entries[p])
|
|
33
|
+
const stale = Object.keys(entries).filter((p) => !assets.has(p))
|
|
34
|
+
if (missing.length || stale.length) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
`${ENTRIES} must name every route once: ` +
|
|
37
|
+
`missing ${missing.join(', ') || 'none'}; ` +
|
|
38
|
+
`no such route ${stale.join(', ') || 'none'}`,
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const dirPath = fileURLToPath(dir)
|
|
43
|
+
const sections = []
|
|
44
|
+
const denied = []
|
|
45
|
+
for (const pattern of patterns) {
|
|
46
|
+
const { audience, purpose } = entries[pattern]
|
|
47
|
+
const lines = [
|
|
48
|
+
`## \`${pattern}\``,
|
|
49
|
+
'',
|
|
50
|
+
`- Audience: ${audience}`,
|
|
51
|
+
`- Purpose: ${purpose}`,
|
|
52
|
+
]
|
|
53
|
+
for (const file of [...(assets.get(pattern) ?? [])].sort((a, b) =>
|
|
54
|
+
a.href.localeCompare(b.href),
|
|
55
|
+
)) {
|
|
56
|
+
const path = fileURLToPath(file)
|
|
57
|
+
.slice(dirPath.length)
|
|
58
|
+
.replace(/(^|\/)index\.html$/, '$1')
|
|
59
|
+
const html = await readFile(file, 'utf8')
|
|
60
|
+
const links = linksIn(html)
|
|
61
|
+
for (const href of deniedLinks(links)) {
|
|
62
|
+
denied.push(`${base}${path} links ${href}`)
|
|
63
|
+
}
|
|
64
|
+
lines.push(
|
|
65
|
+
`- \`${base}${path}\``,
|
|
66
|
+
` - Links: ${list(links)}`,
|
|
67
|
+
` - Forms: ${list(formsIn(html))}`,
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
sections.push(lines.join('\n'))
|
|
71
|
+
}
|
|
72
|
+
if (denied.length) {
|
|
73
|
+
throw new Error(
|
|
74
|
+
`A page links where deniedLinks denies: ${denied.join('; ')}`,
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
await writeFile(
|
|
78
|
+
new URL(OUTPUT, root),
|
|
79
|
+
`# Routes\n\nGenerated by the build from the built pages and ${ENTRIES}. Edit the entries, not this file.\n\n${sections.join('\n\n')}\n`,
|
|
80
|
+
)
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** @param {string[]} items */
|
|
87
|
+
const list = (items) =>
|
|
88
|
+
items.length ? items.map((i) => `\`${i}\``).join(', ') : 'none'
|
|
89
|
+
|
|
90
|
+
/** @param {string} value */
|
|
91
|
+
const decode = (value) => value.replaceAll('&', '&')
|
|
92
|
+
|
|
93
|
+
/** Every distinct `<a href>`, sorted. @param {string} html */
|
|
94
|
+
const linksIn = (html) =>
|
|
95
|
+
[
|
|
96
|
+
...new Set(
|
|
97
|
+
[...html.matchAll(/<a\b[^>]*?\shref="([^"]*)"/g)].map((m) =>
|
|
98
|
+
decode(m[1]),
|
|
99
|
+
),
|
|
100
|
+
),
|
|
101
|
+
].sort()
|
|
102
|
+
|
|
103
|
+
/** Each `<form>` as its method, action and field names. @param {string} html */
|
|
104
|
+
const formsIn = (html) =>
|
|
105
|
+
[...html.matchAll(/<form\b([^>]*)>([\s\S]*?)<\/form>/g)].map(
|
|
106
|
+
([, attrs, body]) => {
|
|
107
|
+
const method = (
|
|
108
|
+
/\smethod="([^"]*)"/.exec(attrs)?.[1] ?? 'get'
|
|
109
|
+
).toUpperCase()
|
|
110
|
+
const action = /\saction="([^"]*)"/.exec(attrs)?.[1]
|
|
111
|
+
const fields = [
|
|
112
|
+
...new Set(
|
|
113
|
+
[
|
|
114
|
+
...body.matchAll(
|
|
115
|
+
/<(?:input|select|textarea)\b[^>]*?\sname="([^"]*)"/g,
|
|
116
|
+
),
|
|
117
|
+
].map((m) => m[1]),
|
|
118
|
+
),
|
|
119
|
+
]
|
|
120
|
+
return `${action ? `${method} ${decode(action)}` : 'no action'}: ${fields.join(' ')}`
|
|
121
|
+
},
|
|
122
|
+
)
|
package/dist/tools/theme.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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 override on
|
|
4
|
-
* `<html>` as the `.light` or `.dark` class that tokens.css honours. */
|
|
5
|
-
export declare const themeScript: string;
|
|
6
|
-
declare function write(theme: Theme): void;
|
|
7
|
-
/** The viewer's theme and a setter. Renders `system` on the server. */
|
|
8
|
-
export declare function useTheme(): {
|
|
9
|
-
theme: Theme;
|
|
10
|
-
setTheme: typeof write;
|
|
11
|
-
};
|
|
12
|
-
/** A round button fixed at the bottom of the viewport: the current theme's
|
|
13
|
-
* icon, its name on hover or focus, and a click to the next of system, light,
|
|
14
|
-
* dark. Render it once per page, from the layout; hydrate it alone. */
|
|
15
|
-
export declare function ThemeToggle({ className }: {
|
|
16
|
-
className?: string;
|
|
17
|
-
}): import("react").JSX.Element;
|
|
18
|
-
export {};
|
package/dist/tools/theme.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useSyncExternalStore } from 'react';
|
|
3
|
-
import { cn } from './cn.js';
|
|
4
|
-
const KEY = 'mc-theme';
|
|
5
|
-
/** Inline this in `<head>`, before first paint: it puts the stored override on
|
|
6
|
-
* `<html>` as the `.light` or `.dark` class that tokens.css honours. */
|
|
7
|
-
export const themeScript = `try{var t=localStorage.getItem(${JSON.stringify(KEY)});if(t==="light"||t==="dark")document.documentElement.classList.add(t)}catch(e){}`;
|
|
8
|
-
const listeners = new Set();
|
|
9
|
-
function subscribe(listener) {
|
|
10
|
-
listeners.add(listener);
|
|
11
|
-
return () => void listeners.delete(listener);
|
|
12
|
-
}
|
|
13
|
-
// The class on `<html>` is the truth: the head script set it from storage.
|
|
14
|
-
function read() {
|
|
15
|
-
const classes = document.documentElement.classList;
|
|
16
|
-
return classes.contains('dark')
|
|
17
|
-
? 'dark'
|
|
18
|
-
: classes.contains('light')
|
|
19
|
-
? 'light'
|
|
20
|
-
: 'system';
|
|
21
|
-
}
|
|
22
|
-
function write(theme) {
|
|
23
|
-
const root = document.documentElement;
|
|
24
|
-
root.classList.remove('light', 'dark');
|
|
25
|
-
if (theme !== 'system')
|
|
26
|
-
root.classList.add(theme);
|
|
27
|
-
try {
|
|
28
|
-
if (theme === 'system')
|
|
29
|
-
localStorage.removeItem(KEY);
|
|
30
|
-
else
|
|
31
|
-
localStorage.setItem(KEY, theme);
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
34
|
-
// Blocked storage: the override lasts the page.
|
|
35
|
-
}
|
|
36
|
-
listeners.forEach((listener) => listener());
|
|
37
|
-
}
|
|
38
|
-
/** The viewer's theme and a setter. Renders `system` on the server. */
|
|
39
|
-
export function useTheme() {
|
|
40
|
-
const theme = useSyncExternalStore(subscribe, read, () => 'system');
|
|
41
|
-
return { theme, setTheme: write };
|
|
42
|
-
}
|
|
43
|
-
const NEXT = {
|
|
44
|
-
system: 'light',
|
|
45
|
-
light: 'dark',
|
|
46
|
-
dark: 'system',
|
|
47
|
-
};
|
|
48
|
-
const NAMES = {
|
|
49
|
-
system: 'System',
|
|
50
|
-
light: 'Light',
|
|
51
|
-
dark: 'Dark',
|
|
52
|
-
};
|
|
53
|
-
/** Lucide's `monitor`, `sun` and `moon` on a 24-unit square, under the ISC
|
|
54
|
-
* license in LICENSES/ISC.txt. */
|
|
55
|
-
const ICONS = {
|
|
56
|
-
system: (_jsxs(_Fragment, { children: [_jsx("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }), _jsx("path", { d: "M8 21h8M12 17v4" })] })),
|
|
57
|
-
light: (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "12", cy: "12", r: "4" }), _jsx("path", { d: "M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41" })] })),
|
|
58
|
-
dark: _jsx("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }),
|
|
59
|
-
};
|
|
60
|
-
/** A round button fixed at the bottom of the viewport: the current theme's
|
|
61
|
-
* icon, its name on hover or focus, and a click to the next of system, light,
|
|
62
|
-
* dark. Render it once per page, from the layout; hydrate it alone. */
|
|
63
|
-
export function ThemeToggle({ className }) {
|
|
64
|
-
const { theme, setTheme } = useTheme();
|
|
65
|
-
const name = NAMES[theme];
|
|
66
|
-
return (_jsxs("button", { type: "button", className: cn('mc-theme-toggle', className), "aria-label": `Theme: ${name}. Switch to ${NAMES[NEXT[theme]]}`, onClick: () => setTheme(NEXT[theme]), children: [_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: ICONS[theme] }), _jsx("span", { className: "mc-theme-toggle-name", children: name })] }));
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=theme.js.map
|
package/dist/tools/theme.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/tools/theme.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAkB,MAAM,OAAO,CAAA;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAK5B,MAAM,GAAG,GAAG,UAAU,CAAA;AAEtB;yEACyE;AACzE,MAAM,CAAC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