@metacensus/library-ui 0.19.0 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/tools/CiteThisPage.d.ts +8 -6
- package/dist/tools/CiteThisPage.js +10 -5
- package/dist/tools/CiteThisPage.js.map +1 -1
- package/dist/tools/Float.d.ts +11 -0
- package/dist/tools/Float.js +34 -0
- package/dist/tools/Float.js.map +1 -0
- package/dist/tools/display.js +6 -25
- package/dist/tools/display.js.map +1 -1
- package/package.json +1 -1
- package/src/css/styles.css +31 -30
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 `Cite this page`
|
|
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
|
---
|
|
@@ -68,7 +68,7 @@ import { Header, Nav, Button, displayScript } from '@metacensus/library-ui'
|
|
|
68
68
|
import { CiteThisPage } from '@metacensus/library-ui'
|
|
69
69
|
import { citation } from '../citation'
|
|
70
70
|
---
|
|
71
|
-
<CiteThisPage citation={citation} risHref="/a-page.ris" bibHref="/a-page.bib" />
|
|
71
|
+
<CiteThisPage client:load citation={citation} risHref="/a-page.ris" bibHref="/a-page.bib" />
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
```ts
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import type { DetailsHTMLAttributes } from 'react';
|
|
2
1
|
import { type Citation } from './cite.js';
|
|
3
|
-
type CiteThisPageProps =
|
|
2
|
+
type CiteThisPageProps = {
|
|
4
3
|
citation: Citation;
|
|
5
4
|
/** Where the page serves its RIS file, from `formatRis`. */
|
|
6
5
|
risHref: string;
|
|
7
6
|
/** Where the page serves its BibTeX file, from `formatBibtex`. */
|
|
8
7
|
bibHref: string;
|
|
8
|
+
className?: string;
|
|
9
9
|
};
|
|
10
|
-
/** A `Cite this page`
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
|
|
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
|
+
* text and a download link to each file; Escape, moving away or a tap
|
|
13
|
+
* elsewhere closes it. It formats what the page gives it and renders nothing
|
|
14
|
+
* without a url. Render it once per page, from the layout; hydrate it alone. */
|
|
15
|
+
export declare function CiteThisPage({ citation, risHref, bibHref, className, }: CiteThisPageProps): import("react").JSX.Element | null;
|
|
14
16
|
export {};
|
|
@@ -2,12 +2,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { formatCitationText } from './cite.js';
|
|
3
3
|
import { Button } from './Button.js';
|
|
4
4
|
import { cn } from './cn.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
|
|
5
|
+
import { Float } from './Float.js';
|
|
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
|
+
* text and a download link to each file; Escape, moving away or a tap
|
|
9
|
+
* elsewhere closes it. It formats what the page gives it and renders nothing
|
|
10
|
+
* without a url. Render it once per page, from the layout; hydrate it alone. */
|
|
11
|
+
export function CiteThisPage({ citation, risHref, bibHref, className, }) {
|
|
9
12
|
if (!citation.url?.trim())
|
|
10
13
|
return null;
|
|
11
|
-
return (_jsxs(
|
|
14
|
+
return (_jsxs(Float, { className: cn('mc-cite', className), label: "Cite this page", icon:
|
|
15
|
+
/* Lucide's `quote`, under the ISC license in LICENSES/ISC.txt. */
|
|
16
|
+
_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [_jsx("path", { d: "M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z" }), _jsx("path", { d: "M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z" })] }), children: [_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
17
|
}
|
|
13
18
|
//# sourceMappingURL=CiteThisPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CiteThisPage.js","sourceRoot":"","sources":["../../src/tools/CiteThisPage.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"CiteThisPage.js","sourceRoot":"","sources":["../../src/tools/CiteThisPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAiB,MAAM,WAAW,CAAA;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAWlC;;;;iFAIiF;AACjF,MAAM,UAAU,YAAY,CAAC,EAC3B,QAAQ,EACR,OAAO,EACP,OAAO,EACP,SAAS,GACS;IAClB,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE;QAAE,OAAO,IAAI,CAAA;IACtC,OAAO,CACL,MAAC,KAAK,IACJ,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,EACnC,KAAK,EAAC,gBAAgB,EACtB,IAAI;QACF,kEAAkE;QAClE,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,gIAAgI,GAAG,EAC3I,eAAM,CAAC,EAAC,+HAA+H,GAAG,IACtI,aAGR,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,IACE,CACT,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/** A round icon button fixed to the viewport, with a panel beside it. Hover,
|
|
3
|
+
* focus or a tap opens the panel; Escape, moving away or a tap elsewhere
|
|
4
|
+
* closes it, and Escape returns focus to the button. Where it sits is the
|
|
5
|
+
* caller's class. */
|
|
6
|
+
export declare function Float({ className, label, icon, children, }: {
|
|
7
|
+
className?: string;
|
|
8
|
+
label: string;
|
|
9
|
+
icon: ReactNode;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { cn } from './cn.js';
|
|
4
|
+
/** A round icon button fixed to the viewport, with a panel beside it. Hover,
|
|
5
|
+
* focus or a tap opens the panel; Escape, moving away or a tap elsewhere
|
|
6
|
+
* closes it, and Escape returns focus to the button. Where it sits is the
|
|
7
|
+
* caller's class. */
|
|
8
|
+
export function Float({ className, label, icon, children, }) {
|
|
9
|
+
const [open, setOpen] = useState(false);
|
|
10
|
+
const button = useRef(null);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (!open)
|
|
13
|
+
return;
|
|
14
|
+
const close = (e) => {
|
|
15
|
+
if (!e.target.closest('.mc-float'))
|
|
16
|
+
setOpen(false);
|
|
17
|
+
};
|
|
18
|
+
document.addEventListener('pointerdown', close);
|
|
19
|
+
return () => document.removeEventListener('pointerdown', close);
|
|
20
|
+
}, [open]);
|
|
21
|
+
return (_jsxs("div", { className: cn('mc-float', className), onPointerEnter: (e) => e.pointerType === 'mouse' && setOpen(true), onPointerLeave: (e) => e.pointerType === 'mouse' && setOpen(false), onFocus: () => setOpen(true),
|
|
22
|
+
// Safari does not focus a control it is clicked on: no `relatedTarget`
|
|
23
|
+
// means focus went nowhere a page can name, not that it left.
|
|
24
|
+
onBlur: (e) => {
|
|
25
|
+
if (e.relatedTarget && !e.currentTarget.contains(e.relatedTarget))
|
|
26
|
+
setOpen(false);
|
|
27
|
+
}, onKeyDown: (e) => {
|
|
28
|
+
if (e.key !== 'Escape')
|
|
29
|
+
return;
|
|
30
|
+
button.current?.focus();
|
|
31
|
+
setOpen(false);
|
|
32
|
+
}, children: [_jsx("button", { ref: button, type: "button", className: "mc-float-button", "aria-label": label, "aria-expanded": open, onClick: () => setOpen(true), children: icon }), _jsx("div", { className: "mc-float-panel", hidden: !open, children: children })] }));
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=Float.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Float.js","sourceRoot":"","sources":["../../src/tools/Float.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AACnE,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAE5B;;;sBAGsB;AACtB,MAAM,UAAU,KAAK,CAAC,EACpB,SAAS,EACT,KAAK,EACL,IAAI,EACJ,QAAQ,GAMT;IACC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IACvC,MAAM,MAAM,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAA;IAE9C,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,IAAI;YAAE,OAAM;QACjB,MAAM,KAAK,GAAG,CAAC,CAAe,EAAE,EAAE;YAChC,IAAI,CAAE,CAAC,CAAC,MAAkB,CAAC,OAAO,CAAC,WAAW,CAAC;gBAAE,OAAO,CAAC,KAAK,CAAC,CAAA;QACjE,CAAC,CAAA;QACD,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE,KAAK,CAAC,CAAA;QAC/C,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC,aAAa,EAAE,KAAK,CAAC,CAAA;IACjE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAEV,OAAO,CACL,eACE,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,EACpC,cAAc,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,EACjE,cAAc,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,EAClE,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;QAC5B,uEAAuE;QACvE,8DAA8D;QAC9D,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE;YACZ,IAAI,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC;gBAC/D,OAAO,CAAC,KAAK,CAAC,CAAA;QAClB,CAAC,EACD,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;YACf,IAAI,CAAC,CAAC,GAAG,KAAK,QAAQ;gBAAE,OAAM;YAC9B,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,CAAA;YACvB,OAAO,CAAC,KAAK,CAAC,CAAA;QAChB,CAAC,aAED,iBACE,GAAG,EAAE,MAAM,EACX,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,iBAAiB,gBACf,KAAK,mBACF,IAAI,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,YAE3B,IAAI,GACE,EACT,cAAK,SAAS,EAAC,gBAAgB,EAAC,MAAM,EAAE,CAAC,IAAI,YAC1C,QAAQ,GACL,IACF,CACP,CAAA;AACH,CAAC"}
|
package/dist/tools/display.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useSyncExternalStore } from 'react';
|
|
3
3
|
import { cn } from './cn.js';
|
|
4
|
+
import { Float } from './Float.js';
|
|
4
5
|
import { Checkbox, RadioGroup } from './form.js';
|
|
5
6
|
const THEME_KEY = 'mc-theme';
|
|
6
7
|
const MOTION_KEY = 'mc-motion';
|
|
@@ -73,29 +74,9 @@ const THEME_OPTIONS = [
|
|
|
73
74
|
export function DisplayControls({ className }) {
|
|
74
75
|
const { theme, setTheme } = useTheme();
|
|
75
76
|
const { still, setStill } = useStill();
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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) })] })] }));
|
|
77
|
+
return (_jsxs(Float, { className: cn('mc-display', className), label: "Display", icon:
|
|
78
|
+
/* Lucide's `sliders-horizontal`, under the ISC license in
|
|
79
|
+
LICENSES/ISC.txt. */
|
|
80
|
+
_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" })] }), 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
81
|
}
|
|
101
82
|
//# sourceMappingURL=display.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display.js","sourceRoot":"","sources":["../../src/tools/display.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"display.js","sourceRoot":"","sources":["../../src/tools/display.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAC5C,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,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,C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QAAQ,EAAE,CAAA;IACtC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE,CAAA;IACtC,OAAO,CACL,MAAC,KAAK,IACJ,SAAS,EAAE,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC,EACtC,KAAK,EAAC,SAAS,EACf,IAAI;QACF;+BACuB;QACvB,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,aAGR,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,IACI,CACT,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
package/src/css/styles.css
CHANGED
|
@@ -407,24 +407,20 @@
|
|
|
407
407
|
color: var(--mc-tint-blue-ink);
|
|
408
408
|
}
|
|
409
409
|
|
|
410
|
-
/* CiteThisPage: a
|
|
410
|
+
/* CiteThisPage: a floating button at the bottom-right corner, mirroring the
|
|
411
|
+
display controls, with its panel above and growing leftward. */
|
|
411
412
|
.mc-cite {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
border-radius: var(--mc-radius);
|
|
415
|
-
background: var(--mc-card);
|
|
416
|
-
color: var(--mc-ink);
|
|
417
|
-
}
|
|
418
|
-
.mc-cite-summary {
|
|
419
|
-
cursor: pointer;
|
|
420
|
-
font-weight: 500;
|
|
413
|
+
inset-block-end: 1rem;
|
|
414
|
+
inset-inline-end: 1rem;
|
|
421
415
|
}
|
|
422
|
-
.mc-cite-
|
|
423
|
-
|
|
424
|
-
|
|
416
|
+
.mc-cite .mc-float-panel {
|
|
417
|
+
inset-block-end: calc(100% + 0.5rem);
|
|
418
|
+
inset-inline-end: 0;
|
|
419
|
+
width: 18rem;
|
|
420
|
+
max-width: calc(100vw - 2rem);
|
|
425
421
|
}
|
|
426
422
|
.mc-cite-text {
|
|
427
|
-
margin: 0
|
|
423
|
+
margin: 0;
|
|
428
424
|
overflow-wrap: anywhere;
|
|
429
425
|
}
|
|
430
426
|
.mc-cite-downloads {
|
|
@@ -484,15 +480,14 @@
|
|
|
484
480
|
font-size: 0.875rem;
|
|
485
481
|
}
|
|
486
482
|
|
|
487
|
-
/*
|
|
488
|
-
corner,
|
|
489
|
-
|
|
483
|
+
/* Floating controls: a round icon button fixed to the viewport, with a panel
|
|
484
|
+
beside it. DisplayControls sits at the bottom-left corner, the panel above;
|
|
485
|
+
CiteThisPage sits at the bottom-right. */
|
|
486
|
+
.mc-float {
|
|
490
487
|
position: fixed;
|
|
491
|
-
inset-block-end: 1rem;
|
|
492
|
-
inset-inline-start: 1rem;
|
|
493
488
|
z-index: 40;
|
|
494
489
|
}
|
|
495
|
-
.mc-
|
|
490
|
+
.mc-float-button {
|
|
496
491
|
display: grid;
|
|
497
492
|
place-items: center;
|
|
498
493
|
width: 2.75rem;
|
|
@@ -505,17 +500,13 @@
|
|
|
505
500
|
box-shadow: 0 2px 8px color-mix(in srgb, var(--mc-ink) 20%, transparent);
|
|
506
501
|
cursor: pointer;
|
|
507
502
|
}
|
|
508
|
-
.mc-
|
|
503
|
+
.mc-float-button svg {
|
|
509
504
|
width: 1.25rem;
|
|
510
505
|
height: 1.25rem;
|
|
511
506
|
}
|
|
512
|
-
.mc-
|
|
507
|
+
.mc-float-panel {
|
|
513
508
|
position: absolute;
|
|
514
|
-
inset-block-end: calc(100% + 0.5rem);
|
|
515
|
-
inset-inline-start: 0;
|
|
516
509
|
box-sizing: border-box;
|
|
517
|
-
width: 14rem;
|
|
518
|
-
max-width: calc(100vw - 2rem);
|
|
519
510
|
display: flex;
|
|
520
511
|
flex-direction: column;
|
|
521
512
|
gap: 0.75rem;
|
|
@@ -527,21 +518,31 @@
|
|
|
527
518
|
box-shadow: 0 2px 8px color-mix(in srgb, var(--mc-ink) 20%, transparent);
|
|
528
519
|
}
|
|
529
520
|
/* Bridges the gap to the button so the pointer crosses it without leaving. */
|
|
530
|
-
.mc-
|
|
521
|
+
.mc-float-panel::before {
|
|
531
522
|
content: '';
|
|
532
523
|
position: absolute;
|
|
533
524
|
inset-inline: 0;
|
|
534
525
|
inset-block-start: 100%;
|
|
535
526
|
height: 0.5rem;
|
|
536
527
|
}
|
|
537
|
-
.mc-
|
|
528
|
+
.mc-float-panel[hidden] {
|
|
538
529
|
display: none;
|
|
539
530
|
}
|
|
540
|
-
.mc-
|
|
541
|
-
.mc-
|
|
531
|
+
.mc-float-button:focus-visible,
|
|
532
|
+
.mc-float-panel input:focus-visible {
|
|
542
533
|
outline: 2px solid var(--mc-ink-accent);
|
|
543
534
|
outline-offset: 2px;
|
|
544
535
|
}
|
|
536
|
+
.mc-display {
|
|
537
|
+
inset-block-end: 1rem;
|
|
538
|
+
inset-inline-start: 1rem;
|
|
539
|
+
}
|
|
540
|
+
.mc-display .mc-float-panel {
|
|
541
|
+
inset-block-end: calc(100% + 0.5rem);
|
|
542
|
+
inset-inline-start: 0;
|
|
543
|
+
width: 14rem;
|
|
544
|
+
max-width: calc(100vw - 2rem);
|
|
545
|
+
}
|
|
545
546
|
/* The footer's last line stays clear of the button at the page's end. */
|
|
546
547
|
:root:has(.mc-display) .mc-footer {
|
|
547
548
|
padding-block-end: 5rem;
|