@enhanced-dom/slides 0.0.2 → 0.0.5

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,11 +1,11 @@
1
1
  import React from 'react';
2
2
  const Heading = ({ heading }) => (React.createElement("h2", null,
3
3
  heading,
4
- React.createElement("a", { style: { display: 'none' }, id: heading.toLowerCase().replace(/\s/, '-') })));
4
+ React.createElement("a", { href: `#${heading.toLowerCase().replace(/\s/, '-')}`, style: { display: 'none' }, id: heading.toLowerCase().replace(/\s/, '-') }, '')));
5
5
  const TocItem = ({ heading, to, explanation }) => {
6
6
  const anchor = to !== null && to !== void 0 ? to : heading;
7
7
  return (React.createElement("li", null,
8
- React.createElement("a", { href: anchor.toLowerCase().replace(/\s/, '-') },
8
+ React.createElement("a", { href: `#${anchor.toLowerCase().replace(/\s/, '-')}` },
9
9
  React.createElement("em", null, heading)),
10
10
  explanation ? ': ' : '',
11
11
  explanation));
@@ -5,6 +5,6 @@ export declare abstract class Wave extends React.PureComponent<{
5
5
  children: React.ReactNode;
6
6
  }> {
7
7
  protected abstract toColumns: (children: React.ReactElement[]) => [React.ReactElement[], React.ReactElement[]];
8
- private childrenToColumns;
8
+ private _childrenToColumns;
9
9
  render(): jsx.JSX.Element;
10
10
  }
@@ -25,13 +25,13 @@ const Sticker = ({ progress = 0, steps, variant = 'default' }) => {
25
25
  export class Wave extends React.PureComponent {
26
26
  constructor() {
27
27
  super(...arguments);
28
- this.childrenToColumns = (children) => {
28
+ this._childrenToColumns = (children) => {
29
29
  const items = React.Children.toArray(children);
30
30
  const columns = this.toColumns(items);
31
31
  return columns;
32
32
  };
33
33
  }
34
34
  render() {
35
- return jsx(BaseWave, Object.assign({ columnComponents: [Sticker, Scroller], childrenToStepColumns: this.childrenToColumns }, this.props));
35
+ return jsx(BaseWave, Object.assign({ columnComponents: [Sticker, Scroller], childrenToStepColumns: this._childrenToColumns }, this.props));
36
36
  }
37
37
  }
package/package.json CHANGED
@@ -1,47 +1,47 @@
1
- {
2
- "name": "@enhanced-dom/slides",
3
- "version": "0.0.2",
4
- "description": "Basic building blocks for html slides",
5
- "keywords": [],
6
- "repository": "https://github.com/enhanced-dom/slides.git",
7
- "license": "MIT",
8
- "author": "CD9B4A105290E17E0948E021DF4105107C88693C59C0B891CCC08366C51AEA990902A6A156AC87D88A2FC41422A5E1C3C4071F251F19441C4516000EC25F87DF",
9
- "main": "index.js",
10
- "scripts": {
11
- "package": "cd dist && npm pack",
12
- "prebuild": "rimraf dist/*",
13
- "build": "tsc -p ./tsconfig.json",
14
- "postbuild": "copyfiles package.json LICENSE.md README.md dist && copyfiles -u 1 src/**/*.scss* dist",
15
- "lint": "eslint src/** --fix --config eslint.config.js"
16
- },
17
- "dependencies": {
18
- "@emotion/react": "^11.4.0",
19
- "@enhanced-dom/fontawesome": "^0.0.2",
20
- "@enhanced-dom/icon": "^0.0.2",
21
- "@enhanced-dom/react": "^0.0.2",
22
- "@fontsource/montserrat": "^4.4.5",
23
- "@fortawesome/free-regular-svg-icons": "^5.15.3",
24
- "@fortawesome/free-solid-svg-icons": "^5.15.3",
25
- "@theme-ui/typography": "^0.10.0",
26
- "deepmerge": "^4.2.2",
27
- "gatsby-theme-blog": "^3.0.0",
28
- "gatsby-theme-waves": "^0.1.6",
29
- "lodash.pick": "^4.4.0",
30
- "react-card-flip": "^1.1.1",
31
- "theme-ui": "^0.9.1",
32
- "typography-theme-wordpress-2016": "^0.16.19"
33
- },
34
- "devDependencies": {
35
- "@enhanced-dom/lint": "^0.0.3",
36
- "@types/lodash.pick": "^4.4.6",
37
- "@types/react": "^17.0.8",
38
- "@types/react-dom": "^17.0.5",
39
- "copyfiles": "2.4.1",
40
- "rimraf": "3.0.2",
41
- "typescript": "4.2.2"
42
- },
43
- "engines": {
44
- "node": ">=14.17.0",
45
- "npm": ">=8.0.0"
46
- }
47
- }
1
+ {
2
+ "name": "@enhanced-dom/slides",
3
+ "version": "0.0.5",
4
+ "description": "Basic building blocks for html slides",
5
+ "keywords": [],
6
+ "repository": "https://github.com/enhanced-dom/slides.git",
7
+ "license": "MIT",
8
+ "author": "CD9B4A105290E17E0948E021DF4105107C88693C59C0B891CCC08366C51AEA990902A6A156AC87D88A2FC41422A5E1C3C4071F251F19441C4516000EC25F87DF",
9
+ "main": "index.js",
10
+ "dependencies": {
11
+ "@emotion/react": "^11.4.0",
12
+ "@enhanced-dom/fontawesome": "^0.0.2",
13
+ "@enhanced-dom/icon": "^0.0.4",
14
+ "@enhanced-dom/react": "^0.0.6",
15
+ "@fontsource/montserrat": "^4.4.5",
16
+ "@fortawesome/free-regular-svg-icons": "^5.15.3",
17
+ "@fortawesome/free-solid-svg-icons": "^5.15.3",
18
+ "@theme-ui/typography": "^0.10.0",
19
+ "deepmerge": "^4.2.2",
20
+ "gatsby-theme-blog": "^3.0.0",
21
+ "gatsby-theme-waves": "^0.1.6",
22
+ "lodash.pick": "^4.4.0",
23
+ "react-card-flip": "^1.1.1",
24
+ "theme-ui": "^0.9.1",
25
+ "typography-theme-wordpress-2016": "^0.16.19"
26
+ },
27
+ "devDependencies": {
28
+ "@enhanced-dom/lint": "^0.0.7",
29
+ "@enhanced-dom/webpack": "^0.0.6",
30
+ "@types/lodash.pick": "^4.4.6",
31
+ "@types/react": "^17.0.8",
32
+ "@types/react-dom": "^17.0.5",
33
+ "copyfiles": "2.4.1",
34
+ "rimraf": "3.0.2",
35
+ "typescript": "4.2.2"
36
+ },
37
+ "overrides": {
38
+ "react": "^17.0.2",
39
+ "react-dom": "^17.0.2",
40
+ "theme-ui": "^0.9.1",
41
+ "gatsby": "^3.0.0"
42
+ },
43
+ "engines": {
44
+ "node": ">=14.17.0",
45
+ "npm": ">=8.0.0"
46
+ }
47
+ }
@@ -7,13 +7,6 @@ declare interface IconAttributes extends Omit<React.DetailedHTMLProps<React.HTML
7
7
  style?: React.CSSProperties;
8
8
  config: IconConfigType;
9
9
  }
10
- declare global {
11
- namespace JSX {
12
- interface IntrinsicElements {
13
- ['enhanced-dom-icon']: IconAttributes;
14
- }
15
- }
16
- }
17
10
  export declare const Icon: import("react").ComponentType<IconAttributes> & {
18
11
  renderer: import("@enhanced-dom/icon").MultiIconRenderer;
19
12
  } & Record<string, AnalyserNode>;
@@ -2,7 +2,7 @@ import { withReactAdapter } from '@enhanced-dom/react';
2
2
  import { IconWebComponent } from '@enhanced-dom/icon';
3
3
  import { FontawesomeIconRenderer } from '@enhanced-dom/fontawesome';
4
4
  IconWebComponent.addIconInterpreter('fa5', new FontawesomeIconRenderer());
5
+ IconWebComponent.register();
5
6
  export const Icon = withReactAdapter({
6
7
  type: IconWebComponent,
7
- name: 'enhanced-dom-icon',
8
8
  });
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import ReactCardFlip from 'react-card-flip';
3
3
  import { faArrowAltCircleUp } from '@fortawesome/free-regular-svg-icons';
4
- import * as styles from './scroll-top.style.scss';
4
+ import * as styles from './scroll-top.style.pcss';
5
5
  import { Icon } from './icon.component';
6
6
  const getBodyScroll = () => {
7
7
  return document.body.scrollTop !== 0 || document.documentElement.scrollTop !== 0;
@@ -12,20 +12,28 @@ const scrollToTop = () => {
12
12
  requestAnimationFrame(scrollToTop);
13
13
  }
14
14
  };
15
+ const scrollOnKey = (e) => {
16
+ if (e.altKey || e.shiftKey || e.ctrlKey || e.key !== 'Enter') {
17
+ return;
18
+ }
19
+ e.stopPropagation();
20
+ e.preventDefault();
21
+ scrollToTop();
22
+ };
15
23
  export const ScrollTop = ({ children }) => {
16
24
  const [isFlipped, setFlipped] = React.useState(false);
17
- const showButton = () => {
25
+ const showButton = React.useCallback(() => {
18
26
  if (getBodyScroll()) {
19
27
  setFlipped(true);
20
28
  }
21
- };
22
- const showFront = () => {
29
+ }, [setFlipped]);
30
+ const showFront = React.useCallback(() => {
23
31
  setFlipped(false);
24
- };
32
+ }, [setFlipped]);
25
33
  const buttonContents = children ? (React.createElement(ReactCardFlip, { isFlipped: isFlipped, flipDirection: "horizontal" },
26
34
  React.createElement("div", null, children),
27
35
  React.createElement("div", { className: styles.brandingBack },
28
36
  React.createElement(Icon, { config: { ...faArrowAltCircleUp, namespace: 'fa5' } })))) : (React.createElement("div", { className: styles.brandingBack },
29
37
  React.createElement(Icon, { config: { ...faArrowAltCircleUp, namespace: 'fa5' } })));
30
- return (React.createElement("div", { className: styles.branding, tabIndex: 0, role: "button", onClick: scrollToTop, onFocus: showButton, onBlur: showFront, onMouseEnter: showButton, onMouseLeave: showFront }, buttonContents));
38
+ return (React.createElement("div", { className: styles.branding, tabIndex: 0, role: "button", onClick: scrollToTop, onFocus: showButton, onBlur: showFront, onMouseEnter: showButton, onMouseLeave: showFront, onKeyPress: scrollOnKey }, buttonContents));
31
39
  };
@@ -0,0 +1,25 @@
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
+ }
package/theme.js CHANGED
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention */
1
2
  import { toTheme } from '@theme-ui/typography';
2
3
  import typography from 'typography-theme-wordpress-2016';
3
4
  import merge from 'deepmerge';
@@ -1,26 +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
-
26
- }