@enhanced-dom/slides 0.0.6 → 0.1.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/components/icon.component.d.ts +8 -0
- package/components/{shell/scroll-top/icon.component.js → icon.component.js} +1 -2
- package/components/index.d.ts +1 -1
- package/components/index.js +1 -1
- package/components/scroll-top/scroll-top.component.d.ts +4 -0
- package/components/scroll-top/scroll-top.component.js +36 -0
- package/components/scroll-top/scroll-top.style.pcss +52 -0
- package/components/scroll-top/scroll-top.style.pcss.d.ts +4 -0
- package/components/shell/header.component.d.ts +5 -2
- package/components/shell/header.component.js +3 -17
- package/components/shell/shell.component.d.ts +9 -7
- package/components/shell/shell.component.js +23 -30
- package/components/toc/heading2.component.d.ts +5 -0
- package/components/toc/heading2.component.js +36 -0
- package/components/toc/index.d.ts +2 -0
- package/components/toc/index.js +2 -0
- package/components/toc/toc.component.d.ts +10 -0
- package/components/toc/toc.component.js +6 -0
- package/components/toc/toc.style.pcss +70 -0
- package/components/toc/toc.style.pcss.d.ts +4 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +19 -17
- package/theme.d.ts +27 -26
- package/theme.js +148 -141
- package/components/shell/scroll-top/icon.component.d.ts +0 -13
- package/components/shell/scroll-top/scroll-top.component.d.ts +0 -2
- package/components/shell/scroll-top/scroll-top.component.js +0 -37
- package/components/shell/scroll-top/scroll-top.style.pcss +0 -25
- package/components/shell/scroll-top/scroll-top.style.pcss.d.ts +0 -2
- package/components/toc.component.d.ts +0 -14
- package/components/toc.component.js +0 -8
- /package/components/{shell/scroll-top → scroll-top}/index.d.ts +0 -0
- /package/components/{shell/scroll-top → scroll-top}/index.js +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
2
|
+
import { IconWebComponent, type IconWebComponentAttributes } from '@enhanced-dom/icon';
|
|
3
|
+
import { IconDefinition } from '@fortawesome/fontawesome-common-types';
|
|
4
|
+
declare type IconComponentProps = IconWebComponentAttributes<IconDefinition> & DetailedHTMLProps<HTMLAttributes<IconWebComponent>, IconWebComponent>;
|
|
5
|
+
export declare const Icon: import("react").ComponentType<IconComponentProps> & {
|
|
6
|
+
renderer: import("@enhanced-dom/webcomponent").IRenderingEngine;
|
|
7
|
+
} & Record<string, AnalyserNode>;
|
|
8
|
+
export {};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { withReactAdapter } from '@enhanced-dom/react';
|
|
2
1
|
import { IconWebComponent } from '@enhanced-dom/icon';
|
|
3
2
|
import { FontawesomeIconRenderer } from '@enhanced-dom/fontawesome';
|
|
3
|
+
import { withReactAdapter } from '@enhanced-dom/react';
|
|
4
4
|
IconWebComponent.addIconInterpreter('fa5', new FontawesomeIconRenderer());
|
|
5
|
-
IconWebComponent.register();
|
|
6
5
|
export const Icon = withReactAdapter({
|
|
7
6
|
type: IconWebComponent,
|
|
8
7
|
});
|
package/components/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './toc
|
|
1
|
+
export * from './toc';
|
|
2
2
|
export * from './shell';
|
package/components/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './toc
|
|
1
|
+
export * from './toc';
|
|
2
2
|
export * from './shell';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
2
|
+
import { useCallback, useState } from 'react';
|
|
3
|
+
import ReactCardFlip from 'react-card-flip';
|
|
4
|
+
import { faArrowAltCircleUp } from '@fortawesome/free-regular-svg-icons';
|
|
5
|
+
import * as styles from './scroll-top.style.pcss';
|
|
6
|
+
import { Icon } from '../icon.component';
|
|
7
|
+
const getBodyScroll = () => {
|
|
8
|
+
return document.body.scrollTop !== 0 || document.documentElement.scrollTop !== 0;
|
|
9
|
+
};
|
|
10
|
+
const scrollToTop = () => {
|
|
11
|
+
if (getBodyScroll()) {
|
|
12
|
+
window.scrollBy(0, -50);
|
|
13
|
+
requestAnimationFrame(scrollToTop);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const scrollOnKey = (e) => {
|
|
17
|
+
if (e.altKey || e.shiftKey || e.ctrlKey || e.key !== 'Enter') {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
e.stopPropagation();
|
|
21
|
+
e.preventDefault();
|
|
22
|
+
scrollToTop();
|
|
23
|
+
};
|
|
24
|
+
export const ScrollTop = ({ children }) => {
|
|
25
|
+
const [isFlipped, setFlipped] = useState(false);
|
|
26
|
+
const showButton = useCallback(() => {
|
|
27
|
+
if (getBodyScroll()) {
|
|
28
|
+
setFlipped(true);
|
|
29
|
+
}
|
|
30
|
+
}, [setFlipped]);
|
|
31
|
+
const showFront = useCallback(() => {
|
|
32
|
+
setFlipped(false);
|
|
33
|
+
}, [setFlipped]);
|
|
34
|
+
const buttonContents = children ? (_jsxs(ReactCardFlip, { isFlipped: isFlipped, flipDirection: "horizontal", children: [_jsx("div", { className: styles.brandingFront, children: children }), _jsx("div", { className: styles.brandingBack, children: _jsx(Icon, { className: styles.scrollIcon, config: { ...faArrowAltCircleUp, namespace: 'fa5' } }) })] })) : (_jsx("div", { className: styles.brandingBack, children: _jsx(Icon, { className: styles.scrollIcon, config: { ...faArrowAltCircleUp, namespace: 'fa5' } }) }));
|
|
35
|
+
return (_jsx("div", { className: styles.branding, tabIndex: 0, role: "button", onClick: scrollToTop, onFocus: showButton, onBlur: showFront, onMouseEnter: showButton, onMouseLeave: showFront, onKeyDown: scrollOnKey, children: buttonContents }));
|
|
36
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
.branding {
|
|
2
|
+
width: 3rem;
|
|
3
|
+
height: 3rem;
|
|
4
|
+
position: fixed;
|
|
5
|
+
bottom: 1.5rem;
|
|
6
|
+
right: 1.5rem;
|
|
7
|
+
z-index: 1;
|
|
8
|
+
border-radius: 50%;
|
|
9
|
+
color: var(--theme-ui-colors-highlight, inherit);
|
|
10
|
+
|
|
11
|
+
&:focus,
|
|
12
|
+
&:active {
|
|
13
|
+
/* stylelint-disable-next-line unit-allowed-list */
|
|
14
|
+
box-shadow: inset 0 0 1px 1px var(--theme-ui-colors-dark-text, inherit);
|
|
15
|
+
outline: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
> div {
|
|
19
|
+
height: 100%;
|
|
20
|
+
width: 100%;
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: space-around;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&-back {
|
|
27
|
+
height: 100%;
|
|
28
|
+
width: 100%;
|
|
29
|
+
background-color: transparent;
|
|
30
|
+
font-size: 2rem;
|
|
31
|
+
color: var(--theme-uicolors-highlight, inherit);
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: space-around;
|
|
35
|
+
align-items: center;
|
|
36
|
+
padding: 0.5rem;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&-front {
|
|
40
|
+
height: 100%;
|
|
41
|
+
width: 100%;
|
|
42
|
+
display: flex;
|
|
43
|
+
justify-content: space-around;
|
|
44
|
+
align-items: center;
|
|
45
|
+
padding: 0.5rem;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.scroll-icon {
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const ShellHeader: ({ title, author, profileLink, date, variant, }: {
|
|
2
3
|
title: string;
|
|
3
4
|
author: string;
|
|
5
|
+
profileLink?: string;
|
|
4
6
|
date: string;
|
|
5
|
-
|
|
7
|
+
variant?: string;
|
|
8
|
+
}) => import("react").JSX.Element;
|
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
2
|
-
import { Themed } from 'theme-ui';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return (_jsxs("div", Object.assign({ sx: { position: 'relative' } }, { children: [_jsx("div", Object.assign({ sx: {
|
|
6
|
-
position: ['static', 'absolute'],
|
|
7
|
-
width: '100%',
|
|
8
|
-
height: ['auto', '100%'],
|
|
9
|
-
right: ['auto', SizeVariableNames.FULL_CONTENT_WIDTH],
|
|
10
|
-
color: ['text', ColorVariableNames.LIGHT_TEXT],
|
|
11
|
-
} }, { children: _jsx("div", Object.assign({ sx: {
|
|
12
|
-
float: ['none', 'right'],
|
|
13
|
-
display: ['block', 'inline-block'],
|
|
14
|
-
textAlign: ['left', 'right'],
|
|
15
|
-
} }, { children: _jsx(Themed.h1, Object.assign({ sx: { paddingBottom: '80px' } }, { children: title }), void 0) }), void 0) }), void 0),
|
|
16
|
-
_jsx("div", { children: _jsxs(Themed.p, Object.assign({ sx: { paddingTop: 1 } }, { children: [_jsx(Themed.a, Object.assign({ href: "/", sx: { textDecoration: 'none', color: 'inherit', border: 'none' } }, { children: author }), void 0),
|
|
17
|
-
_jsx("br", {}, void 0),
|
|
18
|
-
_jsx("span", Object.assign({ sx: { fontSize: 1 } }, { children: date }), void 0)] }), void 0) }, void 0)] }), void 0));
|
|
2
|
+
import { Themed } from '@theme-ui/mdx';
|
|
3
|
+
export const ShellHeader = ({ title, author, profileLink, date, variant = 'default', }) => {
|
|
4
|
+
return (_jsxs("header", { children: [_jsx(Themed.h1, { children: title }), _jsxs(Themed.p, { sx: { variant: `styles.shell.${variant}.Author` }, children: [profileLink ? (_jsx(Themed.a, { href: "/", sx: { textDecoration: 'none', color: 'inherit', border: 'none' }, children: author })) : (author), _jsx("br", {}), _jsx("span", { sx: { fontSize: 1 }, children: date })] })] }));
|
|
19
5
|
};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { type Theme } from 'theme-ui';
|
|
2
|
+
import { type ComponentProps, type FC, type ReactNode } from 'react';
|
|
3
|
+
import { MDXProvider } from '@mdx-js/react';
|
|
4
4
|
import { ShellHeader } from './header.component';
|
|
5
5
|
declare const BrandingSlot: ({ children }: {
|
|
6
|
-
children
|
|
7
|
-
}) =>
|
|
8
|
-
declare const ContentsSlot:
|
|
9
|
-
export declare const Shell:
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
}) => import("react").JSX.Element;
|
|
8
|
+
declare const ContentsSlot: FC<ComponentProps<typeof ShellHeader>>;
|
|
9
|
+
export declare const Shell: FC<{
|
|
10
10
|
theme?: Theme;
|
|
11
|
+
variant?: string;
|
|
11
12
|
}> & {
|
|
12
13
|
Branding: typeof BrandingSlot;
|
|
13
14
|
Contents: typeof ContentsSlot;
|
|
15
|
+
mdxComponents: ComponentProps<typeof MDXProvider>['components'];
|
|
14
16
|
};
|
|
15
17
|
export {};
|
|
@@ -1,44 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { Themed
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
2
|
+
import { ThemeUIProvider } from 'theme-ui';
|
|
3
|
+
import { Themed } from '@theme-ui/mdx';
|
|
4
4
|
import { Global } from '@emotion/react';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import { Children as ReactChildren } from 'react';
|
|
6
|
+
import { MDXProvider } from '@mdx-js/react';
|
|
7
|
+
import defaultTheme from '../../theme';
|
|
7
8
|
import { ShellHeader } from './header.component';
|
|
8
|
-
import { ScrollTop } from '
|
|
9
|
+
import { ScrollTop } from '../scroll-top';
|
|
10
|
+
import { Heading2 } from '../toc';
|
|
9
11
|
const BrandingSlot = ({ children }) => {
|
|
10
|
-
return children
|
|
12
|
+
return _jsx(_Fragment, { children: children });
|
|
11
13
|
};
|
|
12
14
|
const ContentsSlot = ({ children, ...rest }) => {
|
|
13
|
-
return (_jsxs(_Fragment, { children: [_jsx(ShellHeader,
|
|
15
|
+
return (_jsxs(_Fragment, { children: [_jsx(ShellHeader, { ...rest }), children || null] }));
|
|
14
16
|
};
|
|
15
|
-
const getBranding = (children) =>
|
|
16
|
-
const getContents = (children) =>
|
|
17
|
-
export const Shell = ({ children, theme, }) => {
|
|
17
|
+
const getBranding = (children) => ReactChildren.toArray(children).find((item) => (item === null || item === void 0 ? void 0 : item.type) === BrandingSlot);
|
|
18
|
+
const getContents = (children) => ReactChildren.toArray(children).find((item) => (item === null || item === void 0 ? void 0 : item.type) === ContentsSlot);
|
|
19
|
+
export const Shell = ({ children, theme, variant = 'default' }) => {
|
|
20
|
+
var _a, _b, _c, _d, _e;
|
|
18
21
|
const branding = getBranding(children);
|
|
19
22
|
const contents = getContents(children);
|
|
20
|
-
return (_jsx(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
body: { margin: 0, overflowX: 'hidden' },
|
|
25
|
-
} },
|
|
26
|
-
_jsx("aside", { sx: {
|
|
27
|
-
bg: ColorVariableNames.DARK_BACKGROUND,
|
|
28
|
-
color: ColorVariableNames.LIGHT_TEXT,
|
|
29
|
-
width: [0, '40vw'],
|
|
30
|
-
minHeight: '100vh',
|
|
31
|
-
} }, void 0),
|
|
32
|
-
_jsx("div", Object.assign({ sx: { bg: ColorVariableNames.BACKGROUND, color: ColorVariableNames.TEXT, width: ['100vw', '60vw'] } }, { children: _jsxs("main", Object.assign({ sx: {
|
|
33
|
-
py: [5, SizeVariableNames.TOP_MARGIN],
|
|
34
|
-
pl: [0, SizeVariableNames.INNER_MARGIN],
|
|
35
|
-
width: [SizeVariableNames.CONTENT, SizeVariableNames.CONTENT],
|
|
36
|
-
maxWidth: ['80%', 'none'],
|
|
37
|
-
mx: ['auto', 0],
|
|
38
|
-
} }, { children: [contents, branding ? _jsx(ScrollTop, { children: branding }, void 0) : null] }), void 0) }), void 0)] }), void 0) }), void 0));
|
|
23
|
+
return (_jsx(ThemeUIProvider, { theme: theme, children: _jsxs(Themed.root, { sx: {
|
|
24
|
+
variant: `styles.shell.${variant}.Root`,
|
|
25
|
+
}, children: [_jsx(Global, { styles: {
|
|
26
|
+
...((_b = (_a = theme.styles.global) === null || _a === void 0 ? void 0 : _a[variant]) !== null && _b !== void 0 ? _b : {}),
|
|
27
|
+
body: { margin: 0, overflowX: 'hidden', ...((_e = (_d = (_c = theme.styles.global) === null || _c === void 0 ? void 0 : _c[variant]) === null || _d === void 0 ? void 0 : _d.body) !== null && _e !== void 0 ? _e : {}) },
|
|
28
|
+
} }), _jsx("aside", {}), _jsxs("main", { children: [_jsx(MDXProvider, { components: Shell.mdxComponents, disableParentContext: true, children: contents }), branding ? _jsx(ScrollTop, { children: branding.props.children ? branding : null }) : null] })] }) }));
|
|
39
29
|
};
|
|
40
30
|
Shell.defaultProps = {
|
|
41
31
|
theme: defaultTheme,
|
|
42
32
|
};
|
|
33
|
+
Shell.mdxComponents = {
|
|
34
|
+
h2: Heading2,
|
|
35
|
+
};
|
|
43
36
|
Shell.Branding = BrandingSlot;
|
|
44
37
|
Shell.Contents = ContentsSlot;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
import { faLink } from '@fortawesome/free-solid-svg-icons';
|
|
5
|
+
import { faClipboard } from '@fortawesome/free-regular-svg-icons';
|
|
6
|
+
import * as styles from './toc.style.pcss';
|
|
7
|
+
import { Icon } from '../icon.component';
|
|
8
|
+
export const Heading2 = ({ children, id, className, ...forwarded }) => {
|
|
9
|
+
const anchorRef = id !== null && id !== void 0 ? id : children.toLowerCase().replace(/\s/, '-');
|
|
10
|
+
const url = useMemo(() => {
|
|
11
|
+
const modifiedUrl = new URL(window.location.href);
|
|
12
|
+
modifiedUrl.hash = anchorRef;
|
|
13
|
+
return modifiedUrl;
|
|
14
|
+
}, [anchorRef]);
|
|
15
|
+
const [copied, setCopied] = useState(false);
|
|
16
|
+
const handleCopyLink = useCallback(() => {
|
|
17
|
+
navigator.clipboard.writeText(url.toString());
|
|
18
|
+
setCopied(true);
|
|
19
|
+
}, [url, setCopied]);
|
|
20
|
+
const handleKeyboardCopy = useCallback((e) => {
|
|
21
|
+
const hasModifier = e.altKey || e.ctrlKey || e.metaKey || e.shiftKey;
|
|
22
|
+
const isActionKey = e.key == ' ' || e.key == 'Enter';
|
|
23
|
+
if (!hasModifier && isActionKey) {
|
|
24
|
+
e.stopPropagation();
|
|
25
|
+
e.preventDefault();
|
|
26
|
+
handleCopyLink();
|
|
27
|
+
}
|
|
28
|
+
}, [handleCopyLink]);
|
|
29
|
+
const iconConfig = useMemo(() => ({ ...(copied ? faClipboard : faLink), namespace: 'fa5' }), [copied]);
|
|
30
|
+
const handleCopyReset = useCallback(() => {
|
|
31
|
+
setCopied(false);
|
|
32
|
+
}, [setCopied]);
|
|
33
|
+
return (_jsx("h2", { className: classnames(styles.heading, className), ...forwarded, tabIndex: 0, onKeyDown: handleKeyboardCopy, onBlur: handleCopyReset,
|
|
34
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
|
|
35
|
+
role: "link", children: _jsxs("a", { id: anchorRef, className: styles.anchor, href: url.toString(), children: [children, _jsx(Icon, { onClick: copied ? undefined : handleCopyLink, config: iconConfig, className: classnames(styles.icon, { [styles.copied]: copied }), title: copied ? 'Copied to clipboard!' : 'Copy link' })] }) }));
|
|
36
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
2
|
+
const TocItem = ({ heading, to, explanation }) => {
|
|
3
|
+
const anchor = to !== null && to !== void 0 ? to : heading;
|
|
4
|
+
return (_jsxs("li", { children: [_jsx("a", { href: `#${anchor.toLowerCase().replace(/\s/, '-')}`, children: _jsx("b", { children: heading }) }), explanation ? ': ' : '', explanation] }));
|
|
5
|
+
};
|
|
6
|
+
export const Toc = ({ headings }) => (_jsx("ul", { children: headings.map((h, idx) => (_jsx(TocItem, { ...h }, idx))) }));
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
.heading {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: flex-start;
|
|
4
|
+
|
|
5
|
+
.anchor {
|
|
6
|
+
cursor: default;
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-wrap: nowrap;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: 0.5rem;
|
|
11
|
+
border: none;
|
|
12
|
+
outline: none;
|
|
13
|
+
|
|
14
|
+
.icon {
|
|
15
|
+
visibility: hidden;
|
|
16
|
+
font-size: 1rem;
|
|
17
|
+
|
|
18
|
+
&:hover {
|
|
19
|
+
color: var(--theme-ui-colors-highlight, inherit);
|
|
20
|
+
|
|
21
|
+
&.copied {
|
|
22
|
+
color: inherit;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&:hover,
|
|
28
|
+
&:focus,
|
|
29
|
+
&:active,
|
|
30
|
+
&:focus-within,
|
|
31
|
+
&:focus-visible {
|
|
32
|
+
outline: none;
|
|
33
|
+
color: inherit;
|
|
34
|
+
/* stylelint-disable-next-line unit-allowed-list */
|
|
35
|
+
box-shadow: 0 1px 0 0;
|
|
36
|
+
|
|
37
|
+
.icon {
|
|
38
|
+
visibility: visible;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
|
|
41
|
+
&.copied {
|
|
42
|
+
cursor: inherit;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&:hover,
|
|
49
|
+
&:focus,
|
|
50
|
+
&:active,
|
|
51
|
+
&:focus-within,
|
|
52
|
+
&:focus-visible {
|
|
53
|
+
outline: none;
|
|
54
|
+
|
|
55
|
+
.anchor {
|
|
56
|
+
color: inherit;
|
|
57
|
+
/* stylelint-disable-next-line unit-allowed-list */
|
|
58
|
+
box-shadow: 0 1px 0 0;
|
|
59
|
+
|
|
60
|
+
.icon {
|
|
61
|
+
visibility: visible;
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
|
|
64
|
+
&.copied {
|
|
65
|
+
cursor: inherit;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './components';
|
|
2
|
-
export { default as defaultTheme } from './theme';
|
|
2
|
+
export { default as defaultTheme, ColorVariableNames, SizeVariableNames, FontVariableNames, variables as defaultThemeVariables, } from './theme';
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './components';
|
|
2
|
-
export { default as defaultTheme } from './theme';
|
|
2
|
+
export { default as defaultTheme, ColorVariableNames, SizeVariableNames, FontVariableNames, variables as defaultThemeVariables, } from './theme';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enhanced-dom/slides",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Basic building blocks for html slides",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"repository": "https://github.com/enhanced-dom/slides.git",
|
|
@@ -8,27 +8,29 @@
|
|
|
8
8
|
"author": "CD9B4A105290E17E0948E021DF4105107C88693C59C0B891CCC08366C51AEA990902A6A156AC87D88A2FC41422A5E1C3C4071F251F19441C4516000EC25F87DF",
|
|
9
9
|
"main": "index.js",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@emotion/react": "^11.
|
|
12
|
-
"@enhanced-dom/fontawesome": "^0.0
|
|
13
|
-
"@enhanced-dom/gatsby-waves": "^0.0
|
|
14
|
-
"@enhanced-dom/icon": "^0.0
|
|
15
|
-
"@enhanced-dom/react": "^0.0
|
|
16
|
-
"@fontsource/montserrat": "^
|
|
17
|
-
"@
|
|
18
|
-
"
|
|
11
|
+
"@emotion/react": "^11.11.3",
|
|
12
|
+
"@enhanced-dom/fontawesome": "^0.1.0",
|
|
13
|
+
"@enhanced-dom/gatsby-waves": "^0.1.0",
|
|
14
|
+
"@enhanced-dom/icon": "^0.1.0",
|
|
15
|
+
"@enhanced-dom/react": "^0.1.0",
|
|
16
|
+
"@fontsource/montserrat": "^5.0.16",
|
|
17
|
+
"@fontsource/noto-serif": "^5.0.18",
|
|
18
|
+
"@mdx-js/react": "^3.0.1",
|
|
19
|
+
"@theme-ui/typography": "^0.16.2",
|
|
20
|
+
"deepmerge": "^4.3.1",
|
|
19
21
|
"lodash.pick": "^4.4.0",
|
|
20
|
-
"react-card-flip": "^1.
|
|
22
|
+
"react-card-flip": "^1.2.2",
|
|
21
23
|
"typography-theme-wordpress-2016": "^0.16.19"
|
|
22
24
|
},
|
|
23
25
|
"devDependencies": {
|
|
24
|
-
"@enhanced-dom/lint": "^0.
|
|
25
|
-
"@enhanced-dom/webpack": "^0.0
|
|
26
|
-
"@types/lodash.pick": "^4.4.
|
|
27
|
-
"@types/react": "^17.0.
|
|
28
|
-
"@types/react-dom": "^17.0.
|
|
26
|
+
"@enhanced-dom/lint": "^0.1.4",
|
|
27
|
+
"@enhanced-dom/webpack": "^0.1.0",
|
|
28
|
+
"@types/lodash.pick": "^4.4.9",
|
|
29
|
+
"@types/react": "^17.0.75",
|
|
30
|
+
"@types/react-dom": "^17.0.25"
|
|
29
31
|
},
|
|
30
32
|
"engines": {
|
|
31
|
-
"node": ">=
|
|
32
|
-
"npm": ">=
|
|
33
|
+
"node": ">=18",
|
|
34
|
+
"npm": ">=10"
|
|
33
35
|
}
|
|
34
36
|
}
|
package/theme.d.ts
CHANGED
|
@@ -1,47 +1,48 @@
|
|
|
1
1
|
import '@fontsource/montserrat';
|
|
2
|
+
import '@fontsource/noto-serif';
|
|
2
3
|
export declare enum ColorVariableNames {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
DARK_BACKGROUND = "
|
|
6
|
-
LIGHT_TEXT = "
|
|
4
|
+
LIGHT_BACKGROUND = "light-background",
|
|
5
|
+
DARK_TEXT = "dark-text",
|
|
6
|
+
DARK_BACKGROUND = "dark-background",
|
|
7
|
+
LIGHT_TEXT = "light-text",
|
|
7
8
|
HIGHLIGHT = "highlight",
|
|
8
|
-
|
|
9
|
-
LIGHTER_BLUE = "lighterBlue",
|
|
10
|
-
LIGHT_BLUE = "lightBlue",
|
|
11
|
-
HEADING = "heading"
|
|
9
|
+
CODE_KEYWORDS = "code-keywords"
|
|
12
10
|
}
|
|
13
11
|
export declare enum SizeVariableNames {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
CENTRAL_GAP = "centralGap",
|
|
12
|
+
CONTENT_WIDTH = "content",
|
|
13
|
+
SECTION_SLEEVE = "sectionSleeve",
|
|
17
14
|
TOP_MARGIN = "topMargin",
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
SECTION_GAP = "sectionGap",
|
|
16
|
+
PARAGRAPH_GAP = "paragraphGap",
|
|
17
|
+
STEP_HEIGHT = "stepHeight",
|
|
18
|
+
ASIDE_WIDTH = "asideWidth"
|
|
20
19
|
}
|
|
21
20
|
export declare enum FontVariableNames {
|
|
22
21
|
BODY = "body",
|
|
22
|
+
HEADING = "heading",
|
|
23
23
|
MONOSPACE = "monospace"
|
|
24
24
|
}
|
|
25
25
|
export declare const variables: {
|
|
26
26
|
colors: {
|
|
27
|
-
background: string;
|
|
28
|
-
text: string;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
heading: string;
|
|
34
|
-
lightBlue: string;
|
|
27
|
+
"light-background": string;
|
|
28
|
+
"dark-text": string;
|
|
29
|
+
"dark-background": string;
|
|
30
|
+
"light-text": string;
|
|
31
|
+
highlight: string;
|
|
32
|
+
"code-keywords": string;
|
|
35
33
|
};
|
|
36
34
|
sizes: {
|
|
37
|
-
content:
|
|
38
|
-
|
|
39
|
-
topMargin:
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
content: string;
|
|
36
|
+
sectionSleeve: string;
|
|
37
|
+
topMargin: string;
|
|
38
|
+
sectionGap: string;
|
|
39
|
+
paragraphGap: string;
|
|
40
|
+
stepHeight: string;
|
|
41
|
+
asideWidth: string;
|
|
42
42
|
};
|
|
43
43
|
fonts: {
|
|
44
44
|
body: string;
|
|
45
|
+
heading: string;
|
|
45
46
|
monospace: string;
|
|
46
47
|
};
|
|
47
48
|
};
|
package/theme.js
CHANGED
|
@@ -3,202 +3,221 @@ import { toTheme } from '@theme-ui/typography';
|
|
|
3
3
|
import typography from 'typography-theme-wordpress-2016';
|
|
4
4
|
import merge from 'deepmerge';
|
|
5
5
|
import '@fontsource/montserrat';
|
|
6
|
+
import '@fontsource/noto-serif';
|
|
6
7
|
import pick from 'lodash.pick';
|
|
7
|
-
import { blogTheme } from '@enhanced-dom/gatsby-waves';
|
|
8
8
|
const typographyTheme = toTheme(typography);
|
|
9
9
|
export var ColorVariableNames;
|
|
10
10
|
(function (ColorVariableNames) {
|
|
11
|
-
ColorVariableNames["
|
|
12
|
-
ColorVariableNames["
|
|
13
|
-
ColorVariableNames["DARK_BACKGROUND"] = "
|
|
14
|
-
ColorVariableNames["LIGHT_TEXT"] = "
|
|
11
|
+
ColorVariableNames["LIGHT_BACKGROUND"] = "light-background";
|
|
12
|
+
ColorVariableNames["DARK_TEXT"] = "dark-text";
|
|
13
|
+
ColorVariableNames["DARK_BACKGROUND"] = "dark-background";
|
|
14
|
+
ColorVariableNames["LIGHT_TEXT"] = "light-text";
|
|
15
15
|
ColorVariableNames["HIGHLIGHT"] = "highlight";
|
|
16
|
-
ColorVariableNames["
|
|
17
|
-
ColorVariableNames["LIGHTER_BLUE"] = "lighterBlue";
|
|
18
|
-
ColorVariableNames["LIGHT_BLUE"] = "lightBlue";
|
|
19
|
-
ColorVariableNames["HEADING"] = "heading";
|
|
16
|
+
ColorVariableNames["CODE_KEYWORDS"] = "code-keywords";
|
|
20
17
|
})(ColorVariableNames || (ColorVariableNames = {}));
|
|
21
18
|
export var SizeVariableNames;
|
|
22
19
|
(function (SizeVariableNames) {
|
|
23
|
-
SizeVariableNames["
|
|
24
|
-
SizeVariableNames["
|
|
25
|
-
SizeVariableNames["CENTRAL_GAP"] = "centralGap";
|
|
20
|
+
SizeVariableNames["CONTENT_WIDTH"] = "content";
|
|
21
|
+
SizeVariableNames["SECTION_SLEEVE"] = "sectionSleeve";
|
|
26
22
|
SizeVariableNames["TOP_MARGIN"] = "topMargin";
|
|
27
|
-
SizeVariableNames["
|
|
28
|
-
SizeVariableNames["
|
|
23
|
+
SizeVariableNames["SECTION_GAP"] = "sectionGap";
|
|
24
|
+
SizeVariableNames["PARAGRAPH_GAP"] = "paragraphGap";
|
|
25
|
+
SizeVariableNames["STEP_HEIGHT"] = "stepHeight";
|
|
26
|
+
SizeVariableNames["ASIDE_WIDTH"] = "asideWidth";
|
|
29
27
|
})(SizeVariableNames || (SizeVariableNames = {}));
|
|
30
28
|
export var FontVariableNames;
|
|
31
29
|
(function (FontVariableNames) {
|
|
32
30
|
FontVariableNames["BODY"] = "body";
|
|
31
|
+
FontVariableNames["HEADING"] = "heading";
|
|
33
32
|
FontVariableNames["MONOSPACE"] = "monospace";
|
|
34
33
|
})(FontVariableNames || (FontVariableNames = {}));
|
|
35
34
|
export const variables = {
|
|
36
35
|
colors: {
|
|
37
|
-
[ColorVariableNames.
|
|
38
|
-
[ColorVariableNames.
|
|
36
|
+
[ColorVariableNames.LIGHT_BACKGROUND]: '#f1f5f8',
|
|
37
|
+
[ColorVariableNames.DARK_TEXT]: '#3D4851',
|
|
39
38
|
[ColorVariableNames.DARK_BACKGROUND]: '#3D4851',
|
|
40
39
|
[ColorVariableNames.LIGHT_TEXT]: 'white',
|
|
41
|
-
[ColorVariableNames.
|
|
42
|
-
[ColorVariableNames.
|
|
43
|
-
[ColorVariableNames.HEADING]: '#e2001a',
|
|
44
|
-
[ColorVariableNames.LIGHT_BLUE]: '#aaf6d9',
|
|
40
|
+
[ColorVariableNames.HIGHLIGHT]: '#e2001a',
|
|
41
|
+
[ColorVariableNames.CODE_KEYWORDS]: '#aaf6d9',
|
|
45
42
|
},
|
|
46
43
|
sizes: {
|
|
47
|
-
[SizeVariableNames.
|
|
48
|
-
[SizeVariableNames.
|
|
49
|
-
[SizeVariableNames.TOP_MARGIN]:
|
|
50
|
-
[SizeVariableNames.
|
|
51
|
-
[SizeVariableNames.
|
|
44
|
+
[SizeVariableNames.CONTENT_WIDTH]: '420px',
|
|
45
|
+
[SizeVariableNames.SECTION_SLEEVE]: '85px',
|
|
46
|
+
[SizeVariableNames.TOP_MARGIN]: '256px',
|
|
47
|
+
[SizeVariableNames.SECTION_GAP]: '28px',
|
|
48
|
+
[SizeVariableNames.PARAGRAPH_GAP]: '20px',
|
|
49
|
+
[SizeVariableNames.STEP_HEIGHT]: '400px',
|
|
50
|
+
[SizeVariableNames.ASIDE_WIDTH]: '40vw',
|
|
52
51
|
},
|
|
53
52
|
fonts: {
|
|
54
53
|
[FontVariableNames.BODY]: 'Montserrat, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, sans-serif',
|
|
55
|
-
[FontVariableNames.
|
|
54
|
+
[FontVariableNames.HEADING]: 'Noto Serif, serif',
|
|
55
|
+
[FontVariableNames.MONOSPACE]: 'Consolas, Menlo, Monaco, source-code-pro, Courier New, monospace',
|
|
56
56
|
},
|
|
57
57
|
};
|
|
58
58
|
const theme = merge.all([
|
|
59
|
-
blogTheme,
|
|
60
59
|
typographyTheme,
|
|
61
60
|
{
|
|
62
61
|
colors: variables.colors,
|
|
62
|
+
breakpoints: ['1000px'],
|
|
63
63
|
space: {
|
|
64
64
|
...typographyTheme.space,
|
|
65
|
-
...
|
|
66
|
-
SizeVariableNames.INNER_MARGIN,
|
|
67
|
-
SizeVariableNames.TOP_MARGIN,
|
|
68
|
-
SizeVariableNames.FULL_CONTENT_WIDTH,
|
|
69
|
-
SizeVariableNames.CENTRAL_GAP,
|
|
70
|
-
]),
|
|
65
|
+
...variables.sizes,
|
|
71
66
|
},
|
|
72
|
-
sizes: pick(variables.sizes, [
|
|
67
|
+
sizes: pick(variables.sizes, [
|
|
68
|
+
SizeVariableNames.CONTENT_WIDTH,
|
|
69
|
+
SizeVariableNames.ASIDE_WIDTH,
|
|
70
|
+
SizeVariableNames.SECTION_SLEEVE,
|
|
71
|
+
SizeVariableNames.TOP_MARGIN,
|
|
72
|
+
]),
|
|
73
73
|
fonts: variables.fonts,
|
|
74
74
|
styles: {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
a: {
|
|
79
|
-
color: 'inherit',
|
|
80
|
-
textDecoration: 'none',
|
|
81
|
-
borderBottom: '1px solid',
|
|
82
|
-
borderColor: ColorVariableNames.MUTED,
|
|
83
|
-
},
|
|
84
|
-
li: {
|
|
85
|
-
marginBottom: '4px',
|
|
86
|
-
code: {
|
|
87
|
-
fontSize: `inherit`,
|
|
75
|
+
global: {
|
|
76
|
+
body: {
|
|
77
|
+
fontFamily: FontVariableNames.BODY,
|
|
88
78
|
},
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
hyphens: `none`,
|
|
95
|
-
overflow: `auto`,
|
|
96
|
-
borderRadius: 10,
|
|
97
|
-
p: 0,
|
|
98
|
-
pl: 2,
|
|
99
|
-
color: ColorVariableNames.TEXT,
|
|
100
|
-
backgroundColor: ColorVariableNames.BACKGROUND,
|
|
101
|
-
marginBottom: '28px',
|
|
102
|
-
whiteSpace: 'pre-wrap',
|
|
103
|
-
},
|
|
104
|
-
code: {
|
|
105
|
-
fontFamily: FontVariableNames.MONOSPACE,
|
|
106
|
-
fontSize: `inherit`,
|
|
107
|
-
},
|
|
108
|
-
h1: {
|
|
109
|
-
fontStyle: 'italic',
|
|
110
|
-
color: ColorVariableNames.HEADING,
|
|
111
|
-
},
|
|
112
|
-
h2: {
|
|
113
|
-
marginTop: '60px',
|
|
114
|
-
fontStyle: 'italic',
|
|
115
|
-
},
|
|
116
|
-
h3: {
|
|
117
|
-
marginTop: '4px',
|
|
118
|
-
},
|
|
119
|
-
inlineCode: {
|
|
120
|
-
borderRadius: `0.3em`,
|
|
121
|
-
paddingTop: `0.15em`,
|
|
122
|
-
paddingBottom: `0.05em`,
|
|
123
|
-
paddingX: `0.2em`,
|
|
124
|
-
},
|
|
125
|
-
hr: {
|
|
126
|
-
borderColor: ColorVariableNames.MUTED,
|
|
127
|
-
},
|
|
128
|
-
p: {
|
|
129
|
-
marginBottom: '20px',
|
|
130
|
-
marginTop: '20px',
|
|
131
|
-
code: {
|
|
132
|
-
fontSize: `inherit`,
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
blockquote: {
|
|
136
|
-
color: `inherit`,
|
|
137
|
-
borderLeftColor: `inherit`,
|
|
138
|
-
opacity: 0.8,
|
|
139
|
-
'&.translation': {
|
|
140
|
-
fontSize: `1em`,
|
|
79
|
+
img: {
|
|
80
|
+
objectFit: 'contain',
|
|
81
|
+
margin: 0,
|
|
82
|
+
maxWidth: '100%',
|
|
83
|
+
maxHeight: '100%',
|
|
141
84
|
},
|
|
142
85
|
},
|
|
143
86
|
waves: {
|
|
144
87
|
default: {
|
|
145
88
|
Wave: {
|
|
146
|
-
width:
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
89
|
+
width: '100vw',
|
|
90
|
+
marginLeft: [
|
|
91
|
+
0,
|
|
92
|
+
`calc(-${variables.sizes[SizeVariableNames.ASIDE_WIDTH]} - ${variables.sizes[SizeVariableNames.SECTION_SLEEVE]})`,
|
|
93
|
+
],
|
|
94
|
+
marginBottom: SizeVariableNames.SECTION_GAP,
|
|
150
95
|
position: 'relative',
|
|
151
96
|
display: ['block', 'flex'],
|
|
152
97
|
},
|
|
153
98
|
ScrollerContainer: {
|
|
154
|
-
paddingTop: [
|
|
155
|
-
|
|
156
|
-
|
|
99
|
+
paddingTop: [SizeVariableNames.SECTION_SLEEVE, 0],
|
|
100
|
+
paddingRight: SizeVariableNames.SECTION_SLEEVE,
|
|
101
|
+
paddingBottom: [SizeVariableNames.SECTION_SLEEVE, 0],
|
|
102
|
+
paddingLeft: [SizeVariableNames.SECTION_SLEEVE, 0],
|
|
103
|
+
width: '100%',
|
|
104
|
+
marginLeft: [0, SizeVariableNames.SECTION_SLEEVE],
|
|
157
105
|
},
|
|
158
106
|
ScrollerStep: {
|
|
159
107
|
position: 'relative',
|
|
160
108
|
padding: 0,
|
|
161
|
-
minHeight:
|
|
109
|
+
minHeight: SizeVariableNames.STEP_HEIGHT,
|
|
162
110
|
display: 'flex',
|
|
163
111
|
alignItems: 'center',
|
|
164
112
|
borderLeft: 0,
|
|
165
113
|
},
|
|
166
114
|
ScrollerProgress: {
|
|
167
|
-
backgroundColor: ColorVariableNames.
|
|
115
|
+
backgroundColor: ColorVariableNames.DARK_TEXT,
|
|
168
116
|
borderRadius: '3px',
|
|
169
117
|
position: 'absolute',
|
|
170
118
|
left: '-24px',
|
|
171
119
|
},
|
|
172
120
|
StickerContainer: {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
position:
|
|
176
|
-
top: [0, '
|
|
121
|
+
minWidth: ['100vw', SizeVariableNames.ASIDE_WIDTH],
|
|
122
|
+
maxWidth: ['100vw', SizeVariableNames.ASIDE_WIDTH],
|
|
123
|
+
position: 'sticky',
|
|
124
|
+
top: ['0', '10vh'],
|
|
177
125
|
zIndex: [1, 'auto'],
|
|
178
|
-
height: ['
|
|
179
|
-
|
|
126
|
+
height: ['30vh', 'auto'],
|
|
127
|
+
maxHeight: ['50vh', '80vh'],
|
|
128
|
+
display: 'flex',
|
|
129
|
+
flexDirection: ['row', 'column'],
|
|
130
|
+
justifyContent: 'space-around',
|
|
131
|
+
alignItems: 'center',
|
|
180
132
|
backgroundColor: ColorVariableNames.DARK_BACKGROUND,
|
|
181
133
|
color: ColorVariableNames.LIGHT_TEXT,
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
maxHeight: ['100%', '80vh'],
|
|
188
|
-
top: ['auto', '2rem'],
|
|
189
|
-
marginLeft: [0, variables.sizes.innerMargin],
|
|
134
|
+
paddingRight: SizeVariableNames.SECTION_SLEEVE,
|
|
135
|
+
paddingLeft: SizeVariableNames.SECTION_SLEEVE,
|
|
136
|
+
a: {
|
|
137
|
+
border: 'none',
|
|
138
|
+
},
|
|
190
139
|
},
|
|
191
140
|
StickerStep: {
|
|
192
|
-
position: '
|
|
141
|
+
position: 'relative',
|
|
193
142
|
height: '100%',
|
|
194
143
|
width: '100%',
|
|
195
144
|
display: 'flex',
|
|
196
145
|
justifyContent: 'center',
|
|
197
146
|
},
|
|
198
147
|
// this is used to select the active scroller step
|
|
148
|
+
// 0.8 the step that is at 80% the screen height
|
|
199
149
|
// 0.5 selects the step that is at half the screen height
|
|
200
|
-
|
|
201
|
-
|
|
150
|
+
focus: [0.8, 0.5],
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
shell: {
|
|
154
|
+
default: {
|
|
155
|
+
Root: {
|
|
156
|
+
display: 'flex',
|
|
157
|
+
width: '100vw',
|
|
158
|
+
h1: {
|
|
159
|
+
marginLeft: [SizeVariableNames.SECTION_SLEEVE, 0],
|
|
160
|
+
color: ColorVariableNames.HIGHLIGHT,
|
|
161
|
+
},
|
|
162
|
+
h2: {
|
|
163
|
+
marginLeft: [SizeVariableNames.SECTION_SLEEVE, 0],
|
|
164
|
+
marginTop: '60px',
|
|
165
|
+
},
|
|
166
|
+
h3: {
|
|
167
|
+
marginLeft: [SizeVariableNames.SECTION_SLEEVE, 0],
|
|
168
|
+
marginTop: '4px',
|
|
169
|
+
},
|
|
170
|
+
hr: {
|
|
171
|
+
borderColor: ColorVariableNames.DARK_TEXT,
|
|
172
|
+
},
|
|
173
|
+
a: {
|
|
174
|
+
color: 'inherit',
|
|
175
|
+
textDecoration: 'none',
|
|
176
|
+
borderBottom: '1px solid',
|
|
177
|
+
borderColor: ColorVariableNames.DARK_TEXT,
|
|
178
|
+
'&:visited': {
|
|
179
|
+
color: 'inherit',
|
|
180
|
+
},
|
|
181
|
+
'&:hover': {
|
|
182
|
+
color: ColorVariableNames.HIGHLIGHT,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
aside: {
|
|
186
|
+
bg: ColorVariableNames.DARK_BACKGROUND,
|
|
187
|
+
color: ColorVariableNames.LIGHT_TEXT,
|
|
188
|
+
minWidth: [0, SizeVariableNames.ASIDE_WIDTH],
|
|
189
|
+
maxWidth: ['100vw', SizeVariableNames.ASIDE_WIDTH],
|
|
190
|
+
minHeight: '100vh',
|
|
191
|
+
},
|
|
192
|
+
main: {
|
|
193
|
+
py: [5, SizeVariableNames.TOP_MARGIN],
|
|
194
|
+
pl: [0, SizeVariableNames.SECTION_SLEEVE],
|
|
195
|
+
bg: ColorVariableNames.LIGHT_BACKGROUND,
|
|
196
|
+
color: ColorVariableNames.DARK_TEXT,
|
|
197
|
+
width: ['100vw', '100%'],
|
|
198
|
+
mx: ['auto', 0],
|
|
199
|
+
},
|
|
200
|
+
header: {
|
|
201
|
+
position: 'relative',
|
|
202
|
+
paddingX: [SizeVariableNames.SECTION_SLEEVE, 0],
|
|
203
|
+
display: 'flex',
|
|
204
|
+
flexDirection: ['row-reverse', 'column'],
|
|
205
|
+
alignItems: ['center', 'flex-start'],
|
|
206
|
+
justifyContent: ['space-between', 'start'],
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
Author: {
|
|
210
|
+
display: 'flex',
|
|
211
|
+
flexDirection: 'column',
|
|
212
|
+
paddingTop: [1, undefined],
|
|
213
|
+
},
|
|
214
|
+
Title: {
|
|
215
|
+
position: ['relative', 'static'],
|
|
216
|
+
width: '100%',
|
|
217
|
+
height: ['auto', '100%'],
|
|
218
|
+
right: ['auto', `calc(100vw - ${variables.sizes[SizeVariableNames.CONTENT_WIDTH]}})`],
|
|
219
|
+
color: ['text', ColorVariableNames.LIGHT_TEXT],
|
|
220
|
+
},
|
|
202
221
|
},
|
|
203
222
|
},
|
|
204
223
|
CodeSurfer: {
|
|
@@ -206,29 +225,17 @@ const theme = merge.all([
|
|
|
206
225
|
color: ColorVariableNames.LIGHT_TEXT,
|
|
207
226
|
backgroundColor: ColorVariableNames.DARK_BACKGROUND,
|
|
208
227
|
},
|
|
209
|
-
code: {
|
|
210
|
-
color: ColorVariableNames.LIGHT_TEXT,
|
|
211
|
-
backgroundColor: ColorVariableNames.DARK_BACKGROUND,
|
|
212
|
-
},
|
|
213
228
|
tokens: {
|
|
229
|
+
'builtin changed keyword punctuation operator tag deleted string attr-value char number inserted': {
|
|
230
|
+
color: ColorVariableNames.CODE_KEYWORDS,
|
|
231
|
+
},
|
|
214
232
|
'comment cdata doctype': {
|
|
215
233
|
fontStyle: 'italic',
|
|
216
234
|
},
|
|
217
|
-
'builtin changed keyword punctuation operator tag deleted string attr-value char number inserted': {
|
|
218
|
-
color: ColorVariableNames.LIGHT_BLUE,
|
|
219
|
-
},
|
|
220
235
|
},
|
|
221
236
|
},
|
|
222
237
|
},
|
|
223
238
|
},
|
|
224
239
|
]);
|
|
225
|
-
theme.
|
|
226
|
-
theme.prism = {
|
|
227
|
-
'.builtin, .changed, .keyword, .punctuation, .operator, .tag, .deleted, .string, .attr-value, .char, .number, .inserted': {
|
|
228
|
-
color: '#0f8f5e',
|
|
229
|
-
},
|
|
230
|
-
'.comment, .cdata, .doctype': {
|
|
231
|
-
fontStyle: 'italic',
|
|
232
|
-
},
|
|
233
|
-
};
|
|
240
|
+
theme.mergeWith = (otherTheme) => merge.all([theme, otherTheme]);
|
|
234
241
|
export default theme;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { IconWebComponent, IIconConfig } from '@enhanced-dom/icon';
|
|
3
|
-
import { IconDefinition } from '@fortawesome/fontawesome-common-types';
|
|
4
|
-
declare type IconConfigType = IIconConfig<IconDefinition>;
|
|
5
|
-
declare interface IconAttributes extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<IconWebComponent>, IconWebComponent>, 'class' | 'style'> {
|
|
6
|
-
className?: string;
|
|
7
|
-
style?: React.CSSProperties;
|
|
8
|
-
config: IconConfigType;
|
|
9
|
-
}
|
|
10
|
-
export declare const Icon: import("react").ComponentType<IconAttributes> & {
|
|
11
|
-
renderer: import("@enhanced-dom/icon").MultiIconRenderer;
|
|
12
|
-
} & Record<string, AnalyserNode>;
|
|
13
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import ReactCardFlip from 'react-card-flip';
|
|
4
|
-
import { faArrowAltCircleUp } from '@fortawesome/free-regular-svg-icons';
|
|
5
|
-
import * as styles from './scroll-top.style.pcss';
|
|
6
|
-
import { Icon } from './icon.component';
|
|
7
|
-
const getBodyScroll = () => {
|
|
8
|
-
return document.body.scrollTop !== 0 || document.documentElement.scrollTop !== 0;
|
|
9
|
-
};
|
|
10
|
-
const scrollToTop = () => {
|
|
11
|
-
if (getBodyScroll()) {
|
|
12
|
-
window.scrollBy(0, -50);
|
|
13
|
-
requestAnimationFrame(scrollToTop);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
const scrollOnKey = (e) => {
|
|
17
|
-
if (e.altKey || e.shiftKey || e.ctrlKey || e.key !== 'Enter') {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
e.stopPropagation();
|
|
21
|
-
e.preventDefault();
|
|
22
|
-
scrollToTop();
|
|
23
|
-
};
|
|
24
|
-
export const ScrollTop = ({ children }) => {
|
|
25
|
-
const [isFlipped, setFlipped] = React.useState(false);
|
|
26
|
-
const showButton = React.useCallback(() => {
|
|
27
|
-
if (getBodyScroll()) {
|
|
28
|
-
setFlipped(true);
|
|
29
|
-
}
|
|
30
|
-
}, [setFlipped]);
|
|
31
|
-
const showFront = React.useCallback(() => {
|
|
32
|
-
setFlipped(false);
|
|
33
|
-
}, [setFlipped]);
|
|
34
|
-
const buttonContents = children ? (_jsxs(ReactCardFlip, Object.assign({ isFlipped: isFlipped, flipDirection: "horizontal" }, { children: [_jsx("div", { children: children }, void 0),
|
|
35
|
-
_jsx("div", Object.assign({ className: styles.brandingBack }, { children: _jsx(Icon, { config: { ...faArrowAltCircleUp, namespace: 'fa5' } }, void 0) }), void 0)] }), void 0)) : (_jsx("div", Object.assign({ className: styles.brandingBack }, { children: _jsx(Icon, { config: { ...faArrowAltCircleUp, namespace: 'fa5' } }, void 0) }), void 0));
|
|
36
|
-
return (_jsx("div", Object.assign({ className: styles.branding, tabIndex: 0, role: "button", onClick: scrollToTop, onFocus: showButton, onBlur: showFront, onMouseEnter: showButton, onMouseLeave: showFront, onKeyPress: scrollOnKey }, { children: buttonContents }), void 0));
|
|
37
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
.branding {
|
|
2
|
-
width: 3rem;
|
|
3
|
-
height: 3rem;
|
|
4
|
-
position: fixed;
|
|
5
|
-
bottom: 2.5rem;
|
|
6
|
-
right: 2.5rem;
|
|
7
|
-
z-index: 1;
|
|
8
|
-
outline-color: #e2001a;
|
|
9
|
-
color: #e2001a;
|
|
10
|
-
|
|
11
|
-
> div {
|
|
12
|
-
height: 100%;
|
|
13
|
-
width: 100%;
|
|
14
|
-
display: flex;
|
|
15
|
-
align-items: center;
|
|
16
|
-
justify-content: space-around;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
&-back {
|
|
20
|
-
background-color: transparent;
|
|
21
|
-
font-size: 2rem;
|
|
22
|
-
color: #e2001a;
|
|
23
|
-
cursor: pointer;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
interface TocItemProps {
|
|
2
|
-
heading: string;
|
|
3
|
-
to?: string;
|
|
4
|
-
explanation?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const Toc: {
|
|
7
|
-
({ headings }: {
|
|
8
|
-
headings: TocItemProps[];
|
|
9
|
-
}): import("theme-ui/jsx-runtime").JSX.Element;
|
|
10
|
-
Heading: ({ heading }: {
|
|
11
|
-
heading: string;
|
|
12
|
-
}) => import("theme-ui/jsx-runtime").JSX.Element;
|
|
13
|
-
};
|
|
14
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
2
|
-
const Heading = ({ heading }) => (_jsxs("h2", { children: [heading, _jsx("a", Object.assign({ href: `#${heading.toLowerCase().replace(/\s/, '-')}`, style: { display: 'none' }, id: heading.toLowerCase().replace(/\s/, '-') }, { children: '' }), void 0)] }, void 0));
|
|
3
|
-
const TocItem = ({ heading, to, explanation }) => {
|
|
4
|
-
const anchor = to !== null && to !== void 0 ? to : heading;
|
|
5
|
-
return (_jsxs("li", { children: [_jsx("a", Object.assign({ href: `#${anchor.toLowerCase().replace(/\s/, '-')}` }, { children: _jsx("em", { children: heading }, void 0) }), void 0), explanation ? ': ' : '', explanation] }, void 0));
|
|
6
|
-
};
|
|
7
|
-
export const Toc = ({ headings }) => (_jsx("ul", { children: headings.map((h, idx) => (_jsx(TocItem, Object.assign({}, h), idx))) }, void 0));
|
|
8
|
-
Toc.Heading = Heading;
|
|
File without changes
|
|
File without changes
|