@myst-theme/frontmatter 0.8.1 → 0.8.3
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/dist/downloads.d.ts.map +1 -1
- package/dist/downloads.js +5 -4
- package/package.json +1 -1
package/dist/downloads.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"downloads.d.ts","sourceRoot":"","sources":["../src/downloads.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG1D,KAAK,UAAU,GAAG;IAChB,OAAO,CAAC,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE,CAAC;CACvC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAKxE;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gBA0BrE;
|
|
1
|
+
{"version":3,"file":"downloads.d.ts","sourceRoot":"","sources":["../src/downloads.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG1D,KAAK,UAAU,GAAG;IAChB,OAAO,CAAC,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE,CAAC;CACvC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAKxE;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gBA0BrE;AAID,wBAAgB,QAAQ,CAAC,EACvB,GAAG,EACH,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,QAAQ,GACT,EAAE;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,2CA8CA;AAED,wBAAgB,iBAAiB,CAAC,EAAE,OAAO,EAAE,EAAE,UAAU,kDAwBxD"}
|
package/dist/downloads.js
CHANGED
|
@@ -55,19 +55,20 @@ export function triggerBlobDownload(blob, filename) {
|
|
|
55
55
|
return true;
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
+
const ICON_CLASS = 'self-center flex-none inline-block mr-3';
|
|
58
59
|
export function Download({ url, filename, format, className, title, internal, }) {
|
|
59
60
|
if (!filename) {
|
|
60
|
-
const icon = internal ? (_jsx(DocumentIcon, { width: "1.25rem", height: "1.25rem", className:
|
|
61
|
-
return (_jsxs("a", { className: classNames(className, 'flex'), href: url, target: !internal ? '_blank' : undefined, rel: !internal ? 'noreferrer noopener' : undefined, children: [_jsxs("span", { className: "sr-only", children: ["Visit URL ", title !== null && title !== void 0 ? title : ''] }), icon, title !== null && title !== void 0 ? title : url] }));
|
|
61
|
+
const icon = internal ? (_jsx(DocumentIcon, { width: "1.25rem", height: "1.25rem", className: ICON_CLASS, "aria-hidden": "true" })) : (_jsx(ArrowTopRightOnSquareIcon, { width: "1.25rem", height: "1.25rem", className: ICON_CLASS, "aria-hidden": "true" }));
|
|
62
|
+
return (_jsxs("a", { className: classNames(className, 'flex no-underline'), href: url, target: !internal ? '_blank' : undefined, rel: !internal ? 'noreferrer noopener' : undefined, children: [_jsxs("span", { className: "sr-only", children: ["Visit URL ", title !== null && title !== void 0 ? title : ''] }), icon, _jsx("span", { className: "w-max max-w-[200px] self-center", children: title !== null && title !== void 0 ? title : url })] }));
|
|
62
63
|
}
|
|
63
64
|
const clickDownload = useCallback((e) => {
|
|
64
65
|
e.preventDefault();
|
|
65
66
|
triggerDirectDownload(url, filename);
|
|
66
67
|
}, [url, filename]);
|
|
67
|
-
return (_jsxs("a", { className: classNames(className, 'flex'), href: url, onClick: clickDownload, children: [_jsxs("span", { className: "sr-only", children: ["Download", format ? ` as ${format}` : '', " ", title !== null && title !== void 0 ? title : ''] }), _jsx(DocumentArrowDownIcon, { width: "1.25rem", height: "1.25rem", className:
|
|
68
|
+
return (_jsxs("a", { className: classNames(className, 'flex no-underline'), href: url, onClick: clickDownload, children: [_jsxs("span", { className: "sr-only", children: ["Download", format ? ` as ${format}` : '', " ", title !== null && title !== void 0 ? title : ''] }), _jsx(DocumentArrowDownIcon, { width: "1.25rem", height: "1.25rem", className: ICON_CLASS, "aria-hidden": "true" }), _jsx("span", { className: "w-max max-w-[200px] self-center", children: title !== null && title !== void 0 ? title : filename })] }));
|
|
68
69
|
}
|
|
69
70
|
export function DownloadsDropdown({ exports }) {
|
|
70
71
|
if (!exports || exports.length === 0)
|
|
71
72
|
return null;
|
|
72
|
-
return (_jsxs(Menu, { as: "div", className: "relative flex inline-block mx-1 grow-0", children: [_jsxs(Menu.Button, { className: "relative", children: [_jsx("span", { className: "sr-only", children: "Downloads" }), _jsx(ArrowDownTrayIcon, { width: "1.25rem", height: "1.25rem",
|
|
73
|
+
return (_jsxs(Menu, { as: "div", className: "relative flex inline-block mx-1 grow-0", children: [_jsxs(Menu.Button, { className: "relative ml-2 -mr-1", children: [_jsx("span", { className: "sr-only", children: "Downloads" }), _jsx(ArrowDownTrayIcon, { width: "1.25rem", height: "1.25rem", "aria-hidden": "true" })] }), _jsx(Menu.Items, { className: "absolute z-10 overflow-hidden bg-white rounded-sm shadow-lg -right-1 dark:bg-slate-800 ring-1 ring-black ring-opacity-5 focus:outline-none", children: exports.map((exp, index) => (_jsx(Menu.Item, { children: _jsx(Download, { className: "block p-3 no-underline hover:bg-stone-700 dark:hover:bg-stone-200 hover:text-white dark:hover:text-black", url: exp.url, filename: exp.filename, format: exp.format, title: exp.title, internal: exp.internal }) }, index))) })] }));
|
|
73
74
|
}
|