@metacensus/library-ui 0.20.0 → 0.21.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 +3 -2
- package/dist/site/links.d.ts +0 -1
- package/dist/site/links.js +0 -2
- package/dist/site/links.js.map +1 -1
- package/dist/tools/CiteThisPage.d.ts +2 -2
- package/dist/tools/CiteThisPage.js +2 -2
- package/package.json +1 -1
- package/src/chrome/Header.astro +1 -6
- package/src/css/styles.css +8 -17
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ import { Header, Nav, Button, displayScript } from '@metacensus/library-ui'
|
|
|
60
60
|
<Button variant="danger">Delete account</Button>
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
`CiteThisPage` takes a `citation` (`title`, `authors` as `Family, Given`, an ISO `date`, `publisher` and `url`) plus `risHref` and `bibHref`, and renders a round `Cite this page` button fixed at the viewport's
|
|
63
|
+
`CiteThisPage` takes a `citation` (`title`, `authors` as `Family, Given`, an ISO `date`, `publisher` and `url`) plus `risHref` and `bibHref`, and renders a round `Cite this page` button fixed at the viewport's bottom-right corner, mirroring `DisplayControls` at the bottom-left. Hover, focus or a tap opens a panel above it with the citation as text and a download link to each file. Render it once per page, from the layout, and hydrate it alone (`client:load`); it renders nothing when `citation.url` is empty. The page owns the URL and its permanence. The formatters are pure functions: a page writes the two files at build and links to them.
|
|
64
64
|
|
|
65
65
|
```astro
|
|
66
66
|
---
|
|
@@ -110,7 +110,8 @@ import Footer from '@metacensus/library-ui/Footer.astro'
|
|
|
110
110
|
[`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.
|
|
111
111
|
|
|
112
112
|
- `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.
|
|
113
|
-
- Site links: `HEADER_LINKS`, `SECTION_LINKS`, `FOOTER_COLUMNS`, `
|
|
113
|
+
- Site links: `HEADER_LINKS`, `SECTION_LINKS`, `FOOTER_COLUMNS`, `JOIN_PATH` and `LEGAL_PATH`.
|
|
114
|
+
- The log-in route is reached by typing `/log-in`; no component links to it.
|
|
114
115
|
|
|
115
116
|
### Route inventory
|
|
116
117
|
|
package/dist/site/links.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export interface SiteLink {
|
|
|
2
2
|
label: string;
|
|
3
3
|
href: string;
|
|
4
4
|
}
|
|
5
|
-
export declare const LOGIN_PATH = "/log-in";
|
|
6
5
|
export declare const JOIN_PATH = "/partner/";
|
|
7
6
|
/** The legal pages' section, which has its own sub-navigation. */
|
|
8
7
|
export declare const LEGAL_PATH = "/legal/";
|
package/dist/site/links.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export const LOGIN_PATH = '/log-in';
|
|
2
1
|
export const JOIN_PATH = '/partner/';
|
|
3
2
|
/** The legal pages' section, which has its own sub-navigation. */
|
|
4
3
|
export const LEGAL_PATH = '/legal/';
|
|
@@ -32,7 +31,6 @@ export const FOOTER_COLUMNS = [
|
|
|
32
31
|
href: '/partner/?interest=early-access',
|
|
33
32
|
},
|
|
34
33
|
{ label: 'Careers', href: '/careers/' },
|
|
35
|
-
{ label: 'Log in', href: LOGIN_PATH },
|
|
36
34
|
],
|
|
37
35
|
},
|
|
38
36
|
{
|
package/dist/site/links.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"links.js","sourceRoot":"","sources":["../../src/site/links.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"links.js","sourceRoot":"","sources":["../../src/site/links.ts"],"names":[],"mappings":"AAKA,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,EA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fixed at the viewport's
|
|
11
|
-
*
|
|
10
|
+
/** A round `Cite this page` button fixed at the viewport's bottom-right
|
|
11
|
+
* corner. Hover, focus or a tap opens a panel above it with the citation as
|
|
12
12
|
* text and a download link to each file; Escape, moving away or a tap
|
|
13
13
|
* elsewhere closes it. It formats what the page gives it and renders nothing
|
|
14
14
|
* without a url. Render it once per page, from the layout; hydrate it alone. */
|
|
@@ -3,8 +3,8 @@ import { formatCitationText } from './cite.js';
|
|
|
3
3
|
import { Button } from './Button.js';
|
|
4
4
|
import { cn } from './cn.js';
|
|
5
5
|
import { Float } from './Float.js';
|
|
6
|
-
/** A round `Cite this page` button fixed at the viewport's
|
|
7
|
-
*
|
|
6
|
+
/** A round `Cite this page` button fixed at the viewport's bottom-right
|
|
7
|
+
* corner. Hover, focus or a tap opens a panel above it with the citation as
|
|
8
8
|
* text and a download link to each file; Escape, moving away or a tap
|
|
9
9
|
* elsewhere closes it. It formats what the page gives it and renders nothing
|
|
10
10
|
* without a url. Render it once per page, from the layout; hydrate it alone. */
|
package/package.json
CHANGED
package/src/chrome/Header.astro
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
---
|
|
2
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'
|
|
3
|
+
import { HEADER_LINKS, JOIN_PATH } from '@metacensus/library-ui/site-links'
|
|
8
4
|
|
|
9
5
|
const path = Astro.url.pathname.replace(/\/?$/, '/')
|
|
10
6
|
const current = (href: string) =>
|
|
@@ -33,7 +29,6 @@ const onJoinPage = path === JOIN_PATH
|
|
|
33
29
|
</ul>
|
|
34
30
|
</nav>
|
|
35
31
|
<div class="mc-header-actions">
|
|
36
|
-
<Button href={LOGIN_PATH} variant="text">Log in</Button>
|
|
37
32
|
{!onJoinPage && <Button href={JOIN_PATH}>Join us</Button>}
|
|
38
33
|
</div>
|
|
39
34
|
</header>
|
package/src/css/styles.css
CHANGED
|
@@ -407,26 +407,17 @@
|
|
|
407
407
|
color: var(--mc-tint-blue-ink);
|
|
408
408
|
}
|
|
409
409
|
|
|
410
|
-
/* CiteThisPage: a floating button at the
|
|
411
|
-
its panel
|
|
410
|
+
/* CiteThisPage: a floating button at the bottom-right corner, mirroring the
|
|
411
|
+
display controls, with its panel above and growing leftward. */
|
|
412
412
|
.mc-cite {
|
|
413
|
-
inset-block-
|
|
414
|
-
inset-inline-
|
|
415
|
-
transform: translateY(-50%);
|
|
413
|
+
inset-block-end: 1rem;
|
|
414
|
+
inset-inline-end: 1rem;
|
|
416
415
|
}
|
|
417
416
|
.mc-cite .mc-float-panel {
|
|
418
|
-
inset-block-
|
|
419
|
-
inset-inline-
|
|
420
|
-
transform: translateY(-50%);
|
|
417
|
+
inset-block-end: calc(100% + 0.5rem);
|
|
418
|
+
inset-inline-end: 0;
|
|
421
419
|
width: 18rem;
|
|
422
|
-
max-width: calc(100vw -
|
|
423
|
-
}
|
|
424
|
-
.mc-cite .mc-float-panel::before {
|
|
425
|
-
inset-block: 0;
|
|
426
|
-
inset-inline-start: -0.5rem;
|
|
427
|
-
inset-inline-end: auto;
|
|
428
|
-
width: 0.5rem;
|
|
429
|
-
height: auto;
|
|
420
|
+
max-width: calc(100vw - 2rem);
|
|
430
421
|
}
|
|
431
422
|
.mc-cite-text {
|
|
432
423
|
margin: 0;
|
|
@@ -491,7 +482,7 @@
|
|
|
491
482
|
|
|
492
483
|
/* Floating controls: a round icon button fixed to the viewport, with a panel
|
|
493
484
|
beside it. DisplayControls sits at the bottom-left corner, the panel above;
|
|
494
|
-
CiteThisPage
|
|
485
|
+
CiteThisPage sits at the bottom-right. */
|
|
495
486
|
.mc-float {
|
|
496
487
|
position: fixed;
|
|
497
488
|
z-index: 40;
|