@enhanced-dom/slides 0.0.7 → 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.
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
2
- import { IconWebComponent, IconWebComponentAttributes } from '@enhanced-dom/icon';
1
+ import { type DetailedHTMLProps, HTMLAttributes } from 'react';
2
+ import { IconWebComponent, type IconWebComponentAttributes } from '@enhanced-dom/icon';
3
3
  import { IconDefinition } from '@fortawesome/fontawesome-common-types';
4
- declare type IconComponentProps = IconWebComponentAttributes<IconDefinition> & React.DetailedHTMLProps<React.HTMLAttributes<IconWebComponent>, IconWebComponent>;
4
+ declare type IconComponentProps = IconWebComponentAttributes<IconDefinition> & DetailedHTMLProps<HTMLAttributes<IconWebComponent>, IconWebComponent>;
5
5
  export declare const Icon: import("react").ComponentType<IconComponentProps> & {
6
6
  renderer: import("@enhanced-dom/webcomponent").IRenderingEngine;
7
7
  } & Record<string, AnalyserNode>;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { type ReactNode } from 'react';
2
2
  export declare const ScrollTop: ({ children }: {
3
- children?: React.ReactNode;
4
- }) => import("theme-ui/jsx-runtime").JSX.Element;
3
+ children?: ReactNode;
4
+ }) => import("react").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
2
- import React from 'react';
2
+ import { useCallback, useState } from 'react';
3
3
  import ReactCardFlip from 'react-card-flip';
4
4
  import { faArrowAltCircleUp } from '@fortawesome/free-regular-svg-icons';
5
5
  import * as styles from './scroll-top.style.pcss';
@@ -22,16 +22,15 @@ const scrollOnKey = (e) => {
22
22
  scrollToTop();
23
23
  };
24
24
  export const ScrollTop = ({ children }) => {
25
- const [isFlipped, setFlipped] = React.useState(false);
26
- const showButton = React.useCallback(() => {
25
+ const [isFlipped, setFlipped] = useState(false);
26
+ const showButton = useCallback(() => {
27
27
  if (getBodyScroll()) {
28
28
  setFlipped(true);
29
29
  }
30
30
  }, [setFlipped]);
31
- const showFront = React.useCallback(() => {
31
+ const showFront = useCallback(() => {
32
32
  setFlipped(false);
33
33
  }, [setFlipped]);
34
- const buttonContents = children ? (_jsxs(ReactCardFlip, Object.assign({ isFlipped: isFlipped, flipDirection: "horizontal" }, { children: [_jsx("div", Object.assign({ className: styles.brandingFront }, { children: children }), void 0),
35
- _jsx("div", Object.assign({ className: styles.brandingBack }, { children: _jsx(Icon, { className: styles.scrollIcon, config: { ...faArrowAltCircleUp, namespace: 'fa5' } }, void 0) }), void 0)] }), void 0)) : (_jsx("div", Object.assign({ className: styles.brandingBack }, { children: _jsx(Icon, { className: styles.scrollIcon, 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, onKeyDown: scrollOnKey }, { children: buttonContents }), void 0));
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 }));
37
36
  };
@@ -41,6 +41,7 @@
41
41
  width: 100%;
42
42
  display: flex;
43
43
  justify-content: space-around;
44
+ align-items: center;
44
45
  padding: 0.5rem;
45
46
  }
46
47
  }
@@ -1,7 +1,8 @@
1
+ /// <reference types="react" />
1
2
  export declare const ShellHeader: ({ title, author, profileLink, date, variant, }: {
2
3
  title: string;
3
4
  author: string;
4
5
  profileLink?: string;
5
6
  date: string;
6
7
  variant?: string;
7
- }) => import("theme-ui/jsx-runtime").JSX.Element;
8
+ }) => import("react").JSX.Element;
@@ -1,8 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
2
- import { Themed } from 'theme-ui';
2
+ import { Themed } from '@theme-ui/mdx';
3
3
  export const ShellHeader = ({ title, author, profileLink, date, variant = 'default', }) => {
4
- return (_jsxs("header", { children: [_jsx(Themed.h1, { children: title }, void 0),
5
- _jsxs(Themed.p, Object.assign({ sx: { variant: `styles.shell.${variant}.Author` } }, { children: [profileLink ? (_jsx(Themed.a, Object.assign({ href: "/", sx: { textDecoration: 'none', color: 'inherit', border: 'none' } }, { children: author }), void 0)) : (author),
6
- _jsx("br", {}, void 0),
7
- _jsx("span", Object.assign({ sx: { fontSize: 1 } }, { children: date }), void 0)] }), void 0)] }, void 0));
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 })] })] }));
8
5
  };
@@ -1,18 +1,17 @@
1
- /** @jsxFrag React.Fragment */
2
- import { Theme } from 'theme-ui';
3
- import React from 'react';
1
+ import { type Theme } from 'theme-ui';
2
+ import { type ComponentProps, type FC, type ReactNode } from 'react';
4
3
  import { MDXProvider } from '@mdx-js/react';
5
4
  import { ShellHeader } from './header.component';
6
5
  declare const BrandingSlot: ({ children }: {
7
- children?: React.ReactNode;
8
- }) => import("theme-ui/jsx-runtime").JSX.Element;
9
- declare const ContentsSlot: React.FC<React.ComponentProps<typeof ShellHeader>>;
10
- export declare const Shell: React.FC<{
6
+ children?: ReactNode;
7
+ }) => import("react").JSX.Element;
8
+ declare const ContentsSlot: FC<ComponentProps<typeof ShellHeader>>;
9
+ export declare const Shell: FC<{
11
10
  theme?: Theme;
12
11
  variant?: string;
13
12
  }> & {
14
13
  Branding: typeof BrandingSlot;
15
14
  Contents: typeof ContentsSlot;
16
- mdxComponents: React.ComponentProps<typeof MDXProvider>['components'];
15
+ mdxComponents: ComponentProps<typeof MDXProvider>['components'];
17
16
  };
18
17
  export {};
@@ -1,34 +1,31 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
2
- /** @jsxFrag React.Fragment */
3
- import { Themed, ThemeProvider } from 'theme-ui';
2
+ import { ThemeUIProvider } from 'theme-ui';
3
+ import { Themed } from '@theme-ui/mdx';
4
4
  import { Global } from '@emotion/react';
5
- import React from 'react';
5
+ import { Children as ReactChildren } from 'react';
6
6
  import { MDXProvider } from '@mdx-js/react';
7
7
  import defaultTheme from '../../theme';
8
8
  import { ShellHeader } from './header.component';
9
9
  import { ScrollTop } from '../scroll-top';
10
10
  import { Heading2 } from '../toc';
11
11
  const BrandingSlot = ({ children }) => {
12
- return _jsx(_Fragment, { children: children }, void 0);
12
+ return _jsx(_Fragment, { children: children });
13
13
  };
14
14
  const ContentsSlot = ({ children, ...rest }) => {
15
- return (_jsxs(_Fragment, { children: [_jsx(ShellHeader, Object.assign({}, rest), void 0), children || null] }, void 0));
15
+ return (_jsxs(_Fragment, { children: [_jsx(ShellHeader, { ...rest }), children || null] }));
16
16
  };
17
- const getBranding = (children) => React.Children.toArray(children).find((item) => { var _a; return ((_a = item) === null || _a === void 0 ? void 0 : _a.type) === BrandingSlot; });
18
- const getContents = (children) => React.Children.toArray(children).find((item) => { var _a; return ((_a = item) === null || _a === void 0 ? void 0 : _a.type) === ContentsSlot; });
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
19
  export const Shell = ({ children, theme, variant = 'default' }) => {
20
20
  var _a, _b, _c, _d, _e;
21
21
  const branding = getBranding(children);
22
22
  const contents = getContents(children);
23
- return (_jsx(ThemeProvider, Object.assign({ theme: theme }, { children: _jsxs(Themed.root, Object.assign({ sx: {
23
+ return (_jsx(ThemeUIProvider, { theme: theme, children: _jsxs(Themed.root, { sx: {
24
24
  variant: `styles.shell.${variant}.Root`,
25
- } }, { children: [_jsx(Global, { styles: {
25
+ }, children: [_jsx(Global, { styles: {
26
26
  ...((_b = (_a = theme.styles.global) === null || _a === void 0 ? void 0 : _a[variant]) !== null && _b !== void 0 ? _b : {}),
27
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
- } }, void 0),
29
- _jsx("aside", {}, void 0),
30
- _jsxs("main", { children: [_jsx(MDXProvider, Object.assign({ components: Shell.mdxComponents, disableParentContext: true }, { children: contents }), void 0),
31
- branding ? _jsx(ScrollTop, { children: branding.props.children ? branding : null }, void 0) : null] }, void 0)] }), void 0) }), void 0));
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] })] }) }));
32
29
  };
33
30
  Shell.defaultProps = {
34
31
  theme: defaultTheme,
@@ -2,4 +2,4 @@ import React from 'react';
2
2
  export declare const Heading2: ({ children, id, className, ...forwarded }: React.BaseHTMLAttributes<HTMLElement> & {
3
3
  children: string;
4
4
  variant: string;
5
- }) => import("theme-ui/jsx-runtime").JSX.Element;
5
+ }) => React.JSX.Element;
@@ -30,7 +30,7 @@ export const Heading2 = ({ children, id, className, ...forwarded }) => {
30
30
  const handleCopyReset = useCallback(() => {
31
31
  setCopied(false);
32
32
  }, [setCopied]);
33
- return (_jsx("h2", Object.assign({ className: classnames(styles.heading, className) }, forwarded, { tabIndex: 0, onKeyDown: handleKeyboardCopy, onBlur: handleCopyReset,
33
+ return (_jsx("h2", { className: classnames(styles.heading, className), ...forwarded, tabIndex: 0, onKeyDown: handleKeyboardCopy, onBlur: handleCopyReset,
34
34
  // eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role
35
- role: "link" }, { children: _jsxs("a", Object.assign({ 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' }, void 0)] }), void 0) }), void 0));
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
36
  };
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  interface TocItemProps {
2
3
  heading: string;
3
4
  to?: string;
@@ -5,5 +6,5 @@ interface TocItemProps {
5
6
  }
6
7
  export declare const Toc: ({ headings }: {
7
8
  headings: TocItemProps[];
8
- }) => import("theme-ui/jsx-runtime").JSX.Element;
9
+ }) => React.JSX.Element;
9
10
  export {};
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
2
2
  const TocItem = ({ heading, to, explanation }) => {
3
3
  const anchor = to !== null && to !== void 0 ? to : heading;
4
- return (_jsxs("li", { children: [_jsx("a", Object.assign({ href: `#${anchor.toLowerCase().replace(/\s/, '-')}` }, { children: _jsx("b", { children: heading }, void 0) }), void 0), explanation ? ': ' : '', explanation] }, void 0));
4
+ return (_jsxs("li", { children: [_jsx("a", { href: `#${anchor.toLowerCase().replace(/\s/, '-')}`, children: _jsx("b", { children: heading }) }), explanation ? ': ' : '', explanation] }));
5
5
  };
6
- export const Toc = ({ headings }) => (_jsx("ul", { children: headings.map((h, idx) => (_jsx(TocItem, Object.assign({}, h), idx))) }, void 0));
6
+ export const Toc = ({ headings }) => (_jsx("ul", { children: headings.map((h, idx) => (_jsx(TocItem, { ...h }, idx))) }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enhanced-dom/slides",
3
- "version": "0.0.7",
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,29 +8,29 @@
8
8
  "author": "CD9B4A105290E17E0948E021DF4105107C88693C59C0B891CCC08366C51AEA990902A6A156AC87D88A2FC41422A5E1C3C4071F251F19441C4516000EC25F87DF",
9
9
  "main": "index.js",
10
10
  "dependencies": {
11
- "@emotion/react": "^11.9.0",
12
- "@enhanced-dom/fontawesome": "^0.0.5",
13
- "@enhanced-dom/gatsby-waves": "^0.0.2",
14
- "@enhanced-dom/icon": "^0.0.9",
15
- "@enhanced-dom/react": "^0.0.17",
16
- "@fontsource/montserrat": "^4.5.10",
17
- "@fontsource/noto-serif": "^5.0.15",
18
- "@mdx-js/react": "^2.3.0",
19
- "@theme-ui/typography": "^0.14.5",
20
- "deepmerge": "^4.2.2",
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",
21
21
  "lodash.pick": "^4.4.0",
22
- "react-card-flip": "^1.1.1",
22
+ "react-card-flip": "^1.2.2",
23
23
  "typography-theme-wordpress-2016": "^0.16.19"
24
24
  },
25
25
  "devDependencies": {
26
- "@enhanced-dom/lint": "^0.0.9",
27
- "@enhanced-dom/webpack": "^0.0.11",
28
- "@types/lodash.pick": "^4.4.6",
29
- "@types/react": "^17.0.8",
30
- "@types/react-dom": "^17.0.5"
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"
31
31
  },
32
32
  "engines": {
33
- "node": ">=14.17.0",
34
- "npm": ">=9.0.0"
33
+ "node": ">=18",
34
+ "npm": ">=10"
35
35
  }
36
36
  }