@gpichot/spectacle-deck 1.1.1 → 1.1.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.
Files changed (66) hide show
  1. package/{dist/index.cjs → index.cjs} +200 -148
  2. package/{dist/index.mjs → index.mjs} +199 -147
  3. package/layouts/BaseLayout.d.ts +5 -0
  4. package/package.json +16 -20
  5. package/dist/package.json +0 -30
  6. package/scripts/bundle.ts +0 -84
  7. package/src/components/CodeStepper/CodeStepper.tsx +0 -223
  8. package/src/components/CodeStepper/code-directives.test.ts +0 -58
  9. package/src/components/CodeStepper/code-directives.ts +0 -129
  10. package/src/components/DocumentationItem.tsx +0 -85
  11. package/src/components/FilePane.tsx +0 -18
  12. package/src/components/HorizontalList.tsx +0 -140
  13. package/src/components/IconBox.tsx +0 -31
  14. package/src/components/Image.tsx +0 -34
  15. package/src/components/ItemsColumn.tsx +0 -56
  16. package/src/components/Timeline.styled.tsx +0 -24
  17. package/src/components/Timeline.tsx +0 -159
  18. package/src/components/map.tsx +0 -115
  19. package/src/components/styled.tsx +0 -73
  20. package/src/front.png +0 -0
  21. package/src/index.tsx +0 -109
  22. package/src/layouts/CenteredLayout.tsx +0 -40
  23. package/src/layouts/Default3Layout.tsx +0 -159
  24. package/src/layouts/MainSectionLayout.tsx +0 -31
  25. package/src/layouts/QuoteLayout.tsx +0 -99
  26. package/src/layouts/SectionLayout.tsx +0 -14
  27. package/src/layouts/SideCodeLayout.tsx +0 -44
  28. package/src/layouts/SideImageLayout.tsx +0 -72
  29. package/src/layouts/SideLayout.tsx +0 -31
  30. package/src/layouts/columns.tsx +0 -56
  31. package/src/layouts/index.tsx +0 -19
  32. package/src/layouts/styled.ts +0 -7
  33. package/src/layouts/utils.ts +0 -65
  34. package/src/node.d.ts +0 -5
  35. package/src/style.d.ts +0 -10
  36. package/src/template.tsx +0 -25
  37. package/src/theme.ts +0 -24
  38. package/test.js +0 -106
  39. package/tsconfig.json +0 -29
  40. /package/{dist/components → components}/CodeStepper/CodeStepper.d.ts +0 -0
  41. /package/{dist/components → components}/CodeStepper/code-directives.d.ts +0 -0
  42. /package/{dist/components → components}/DocumentationItem.d.ts +0 -0
  43. /package/{dist/components → components}/FilePane.d.ts +0 -0
  44. /package/{dist/components → components}/HorizontalList.d.ts +0 -0
  45. /package/{dist/components → components}/IconBox.d.ts +0 -0
  46. /package/{dist/components → components}/Image.d.ts +0 -0
  47. /package/{dist/components → components}/ItemsColumn.d.ts +0 -0
  48. /package/{dist/components → components}/Timeline.d.ts +0 -0
  49. /package/{dist/components → components}/Timeline.styled.d.ts +0 -0
  50. /package/{dist/components → components}/map.d.ts +0 -0
  51. /package/{dist/components → components}/styled.d.ts +0 -0
  52. /package/{dist/index.d.ts → index.d.ts} +0 -0
  53. /package/{dist/layouts → layouts}/CenteredLayout.d.ts +0 -0
  54. /package/{dist/layouts → layouts}/Default3Layout.d.ts +0 -0
  55. /package/{dist/layouts → layouts}/MainSectionLayout.d.ts +0 -0
  56. /package/{dist/layouts → layouts}/QuoteLayout.d.ts +0 -0
  57. /package/{dist/layouts → layouts}/SectionLayout.d.ts +0 -0
  58. /package/{dist/layouts → layouts}/SideCodeLayout.d.ts +0 -0
  59. /package/{dist/layouts → layouts}/SideImageLayout.d.ts +0 -0
  60. /package/{dist/layouts → layouts}/SideLayout.d.ts +0 -0
  61. /package/{dist/layouts → layouts}/columns.d.ts +0 -0
  62. /package/{dist/layouts → layouts}/index.d.ts +0 -0
  63. /package/{dist/layouts → layouts}/styled.d.ts +0 -0
  64. /package/{dist/layouts → layouts}/utils.d.ts +0 -0
  65. /package/{dist/template.d.ts → template.d.ts} +0 -0
  66. /package/{dist/theme.d.ts → theme.d.ts} +0 -0
@@ -1,140 +0,0 @@
1
- import React from "react";
2
- import { animated, useSpring } from "react-spring";
3
- import { Stepper } from "spectacle";
4
- import styled from "styled-components";
5
-
6
- const Container = styled.div`
7
- display: grid;
8
- grid-gap: 2rem;
9
- `;
10
-
11
- export default function HorizontalList({
12
- children,
13
- columns = 3,
14
- }: {
15
- columns?: number;
16
- children: React.ReactNode;
17
- }) {
18
- const items = React.Children.toArray(children);
19
- return (
20
- <Stepper values={items}>
21
- {(_, step) => (
22
- <Container
23
- style={{
24
- gridTemplateColumns: `repeat(${columns}, 1fr)`,
25
- }}
26
- >
27
- {items.map((item, k) => {
28
- if (!React.isValidElement(item)) {
29
- return item;
30
- }
31
- return React.cloneElement(item, {
32
- // @ts-expect-error cloning
33
- position: k + 1,
34
- isVisible: k <= step,
35
- isLast: k === step,
36
- });
37
- })}
38
- </Container>
39
- )}
40
- </Stepper>
41
- );
42
- }
43
-
44
- function Pill({ position }: { position: number }) {
45
- return (
46
- <div
47
- style={{ width: 48, transform: "translate(-25%, -25%)", opacity: 0.9 }}
48
- >
49
- <svg
50
- width="48"
51
- height="48"
52
- viewBox="0 0 18 20"
53
- fill="none"
54
- xmlns="http://www.w3.org/2000/svg"
55
- >
56
- <path
57
- d="M8.64717 20L0 15.0094V5.00134L8.64717 0L17.289 5.00134V15.0094L8.64717 20ZM1.48222 14.141L8.64717 18.2846L15.8068 14.141V5.85902L8.64717 1.71536L1.48222 5.85902V14.141Z"
58
- fill="#ffffff"
59
- ></path>
60
- <text
61
- x="9"
62
- y="11"
63
- text-anchor="middle"
64
- dominant-baseline="middle"
65
- fill="#f49676"
66
- style={{ fontSize: "50%" }}
67
- >
68
- {position}
69
- </text>
70
- <path
71
- d="M 8.758 16.01 L 3.549 13.004 L 3.549 6.975 L 8.758 3.963 L 13.964 6.975 L 13.964 13.004 L 8.758 16.01 Z"
72
- fill="transparent"
73
- ></path>
74
- </svg>
75
- </div>
76
- );
77
- }
78
-
79
- const Item = styled(animated.div)`
80
- display: flex;
81
- flex-direction: column;
82
- font-family: Bitter, "Helvetica Neue", Helvetica, Arial, sans-serif;
83
- `;
84
- const ItemHead = styled.div`
85
- display: flex;
86
- flex-direction: row;
87
- font-size: 1.3rem;
88
- margin-bottom: 0.4rem;
89
-
90
- p {
91
- margin: 0;
92
- }
93
- `;
94
- const ItemContent = styled.div`
95
- > * {
96
- font-size: 1rem;
97
- padding: 4px !important;
98
- line-height: 1.5rem !important;
99
- margin-top: 0;
100
- }
101
- `;
102
-
103
- function getItemOpacity({
104
- isLast,
105
- isVisible,
106
- }: {
107
- isLast?: boolean;
108
- isVisible?: boolean;
109
- }) {
110
- if (isLast) return 1;
111
- if (isVisible) return 0.7;
112
- return 0;
113
- }
114
- export function HorizontalListItem({
115
- title,
116
- children,
117
- position,
118
- isVisible,
119
- isLast,
120
- }: {
121
- title: string;
122
- position: number;
123
- isVisible?: boolean;
124
- isLast?: boolean;
125
- children: React.ReactNode;
126
- }) {
127
- const opacityStyles = useSpring({
128
- opacity: getItemOpacity({ isVisible, isLast }),
129
- });
130
- return (
131
- <Item style={opacityStyles}>
132
- <ItemHead>
133
- <Pill position={position} />
134
- <p>{title}</p>
135
- </ItemHead>
136
-
137
- <ItemContent>{children}</ItemContent>
138
- </Item>
139
- );
140
- }
@@ -1,31 +0,0 @@
1
- import React from "react";
2
- import styled from "styled-components";
3
-
4
- const IconBoxContent = styled.div`
5
- * {
6
- margin: 0.2rem !important;
7
- padding: 0 !important;
8
- }
9
- `;
10
-
11
- export function IconBox({
12
- children,
13
- icon,
14
- }: {
15
- children: React.ReactNode;
16
- icon: React.ReactNode;
17
- }) {
18
- return (
19
- <div
20
- style={{
21
- display: "flex",
22
- flexDirection: "column",
23
- alignItems: "center",
24
- padding: "1rem 0",
25
- }}
26
- >
27
- <div style={{ fontSize: 60 }}>{icon}</div>
28
- <IconBoxContent>{children}</IconBoxContent>
29
- </div>
30
- );
31
- }
@@ -1,34 +0,0 @@
1
- import React from "react";
2
- import { SVGObject } from "../layouts/styled";
3
-
4
- export interface ImageProps extends React.ComponentProps<"img"> {}
5
-
6
- export function Image(props: ImageProps) {
7
- const { src, height } = props;
8
- if (!src?.endsWith(".svg")) {
9
- return (
10
- <img
11
- src={src}
12
- alt="image"
13
- style={{
14
- height: height || "100%",
15
- objectFit: "cover",
16
- objectPosition: "center",
17
- }}
18
- />
19
- );
20
- }
21
- return (
22
- <SVGObject
23
- type="image/svg+xml"
24
- data={src}
25
- style={{
26
- height: height || "100%",
27
- minWidth: "30vw",
28
- width: "100%",
29
- }}
30
- />
31
- );
32
- }
33
-
34
- Image.mdxType = "Image";
@@ -1,56 +0,0 @@
1
- import React from "react";
2
- import { Stepper } from "spectacle";
3
- import styled from "styled-components";
4
- import { useSpring, animated } from "react-spring";
5
-
6
- export function ItemsColumn(divProps: React.ComponentProps<"div">) {
7
- const { style, children, ...props } = divProps;
8
- const childrenArray = React.Children.toArray(children);
9
- return (
10
- <Stepper values={childrenArray}>
11
- {(value, step) => (
12
- <div
13
- style={{
14
- display: "flex",
15
- flexDirection: "column",
16
- alignItems: "center",
17
- height: "100%",
18
- ...style,
19
- }}
20
- {...props}
21
- >
22
- {childrenArray.map((child, index) => {
23
- const isVisible = index <= step;
24
- if (!React.isValidElement(child)) {
25
- return child;
26
- }
27
- return (
28
- <ItemColumnWrapper key={index} isVisible={isVisible}>
29
- {child}
30
- </ItemColumnWrapper>
31
- );
32
- })}
33
- </div>
34
- )}
35
- </Stepper>
36
- );
37
- }
38
-
39
- const ItemColumnWrapperStyled = styled(animated.div)`
40
- * {
41
- text-align: center !important;
42
- }
43
- `;
44
-
45
- function ItemColumnWrapper({
46
- children,
47
- isVisible,
48
- ...props
49
- }: React.ComponentPropsWithRef<"div"> & { isVisible: boolean }) {
50
- const styles = useSpring({ opacity: isVisible ? 1 : 0 });
51
- return (
52
- <ItemColumnWrapperStyled style={styles} {...props}>
53
- {children}
54
- </ItemColumnWrapperStyled>
55
- );
56
- }
@@ -1,24 +0,0 @@
1
- import styled from "styled-components";
2
-
3
- export const TimelineItemContent = styled.div`
4
- display: flex;
5
- padding: 0.7rem 0 1rem 12px;
6
- `;
7
- export const TimelineItemContentPhantom = styled(TimelineItemContent)`
8
- opacity: 0;
9
- `;
10
-
11
- export const TimelineItemBody = styled.div`
12
- &,
13
- & > * {
14
- font-size: 1.3rem !important;
15
- color: #ffffff !important;
16
- }
17
- `;
18
-
19
- export const TimelineItemTitle = styled.div`
20
- font-family: Bitter, "Helvetica Neue", Helvetica, Arial, sans-serif;
21
- font-size: 1rem;
22
- font-weight: bold;
23
- color: #ffffffbb;
24
- `;
@@ -1,159 +0,0 @@
1
- import React from "react";
2
- import { animated, useSpring } from "react-spring";
3
- import { Stepper } from "spectacle";
4
-
5
- import {
6
- TimelineItemBody,
7
- TimelineItemContent,
8
- TimelineItemContentPhantom,
9
- TimelineItemTitle,
10
- } from "./Timeline.styled";
11
- import styled from "styled-components";
12
-
13
- const TimelineItemStyled = styled(animated.div)<{
14
- isOdd?: boolean;
15
- isEven?: boolean;
16
- }>`
17
- flex: 1;
18
- flex-flow: column nowrap;
19
- display: inline-flex;
20
-
21
- &:nth-child(odd) {
22
- &,
23
- ${TimelineItemContent} {
24
- flex-direction: column;
25
- }
26
- }
27
- &:nth-child(even) {
28
- &,
29
- ${TimelineItemContent} {
30
- flex-direction: column-reverse;
31
- }
32
- }
33
- `;
34
-
35
- const TimelineItemGuide = styled(animated.div)`
36
- width: 100%;
37
- padding-top: 2px;
38
- display: flex;
39
- flex-flow: row;
40
- align-items: center;
41
-
42
- svg {
43
- height: 28px;
44
- width: 28px;
45
- path {
46
- fill: #ffffff;
47
- }
48
- margin-right: 4px;
49
- }
50
- `;
51
-
52
- const TimelineItemGuideLine = styled(animated.div)`
53
- border-top: 4px solid #ffffff;
54
- margin-right: 4px;
55
- `;
56
-
57
- const style = {
58
- display: "flex",
59
- position: "relative",
60
- flexFlow: "row nowrap",
61
- alignItems: "center",
62
- };
63
-
64
- export default function Timeline(props: React.ComponentPropsWithoutRef<"div">) {
65
- const children = React.Children.toArray(props.children);
66
- return (
67
- <Stepper
68
- {...props}
69
- values={children}
70
- activeStyle={style}
71
- inactiveStyle={style}
72
- >
73
- {(value, step) => {
74
- return children.map((child, index) => {
75
- if (!React.isValidElement(child)) {
76
- return child;
77
- }
78
- return React.cloneElement(child, {
79
- // @ts-expect-error cloning
80
- isPhantom: step < index,
81
- isLast: step === index,
82
- });
83
- });
84
- }}
85
- </Stepper>
86
- );
87
- }
88
-
89
- function getItemOpacity({
90
- isLast,
91
- isPhantom,
92
- }: {
93
- isLast?: boolean;
94
- isPhantom?: boolean;
95
- }) {
96
- if (isPhantom) return 0;
97
- if (isLast) return 1;
98
- return 0.5;
99
- }
100
-
101
- export function TimelineItem(
102
- props: React.ComponentPropsWithoutRef<"div"> & {
103
- isPhantom?: boolean;
104
- isLast?: boolean;
105
- isOdd?: boolean;
106
- isEven?: boolean;
107
- }
108
- ) {
109
- const { children, title, isPhantom, isLast, ...rest } = props;
110
- const guideLineProps = useSpring({
111
- width: isPhantom || isLast ? "0%" : "100%",
112
- });
113
- const appearStyles = useSpring({
114
- opacity: getItemOpacity({ isPhantom, isLast }),
115
- });
116
- const colorStyles = useSpring({ opacity: isPhantom || isLast ? 1 : 0.15 });
117
- return (
118
- <TimelineItemStyled
119
- {...rest}
120
- style={{
121
- ...appearStyles,
122
- }}
123
- >
124
- <TimelineItemContentPhantom>
125
- <TimelineItemTitle>{title}</TimelineItemTitle>
126
- <TimelineItemBody>{children}</TimelineItemBody>
127
- </TimelineItemContentPhantom>
128
- <TimelineItemGuide style={colorStyles}>
129
- <Hexagon />
130
- <TimelineItemGuideLine style={guideLineProps} />
131
- </TimelineItemGuide>
132
- <TimelineItemContent>
133
- <TimelineItemTitle>{title}</TimelineItemTitle>
134
- <TimelineItemBody>{children}</TimelineItemBody>
135
- </TimelineItemContent>
136
- </TimelineItemStyled>
137
- );
138
- }
139
-
140
- function Hexagon() {
141
- return (
142
- <svg
143
- width="18"
144
- height="20"
145
- viewBox="0 0 18 20"
146
- fill="none"
147
- xmlns="http://www.w3.org/2000/svg"
148
- >
149
- <path
150
- d="M8.64717 20L0 15.0094V5.00134L8.64717 0L17.289 5.00134V15.0094L8.64717 20ZM1.48222 14.141L8.64717 18.2846L15.8068 14.141V5.85902L8.64717 1.71536L1.48222 5.85902V14.141Z"
151
- fill="#F49676"
152
- ></path>
153
- <path
154
- d="M 8.758 16.01 L 3.549 13.004 L 3.549 6.975 L 8.758 3.963 L 13.964 6.975 L 13.964 13.004 L 8.758 16.01 Z"
155
- fill="#F49676"
156
- ></path>
157
- </svg>
158
- );
159
- }
@@ -1,115 +0,0 @@
1
- import React from "react";
2
- import { mdxComponentMap } from "spectacle";
3
- import {
4
- CustomHeading,
5
- CustomQuote,
6
- HeadingThree,
7
- HeadingTwo,
8
- InlineCode,
9
- Image,
10
- } from "./styled";
11
-
12
- import CodeStepper from "./CodeStepper/CodeStepper";
13
-
14
- const componentsMap = {
15
- ...mdxComponentMap,
16
- inlineCode: (props: React.ComponentPropsWithoutRef<"code">) => (
17
- <InlineCode
18
- {...props}
19
- style={{
20
- fontWeight: 500,
21
- display: "inline-block",
22
- }}
23
- />
24
- ),
25
- table: (props: React.ComponentPropsWithoutRef<"table">) => (
26
- <table
27
- {...props}
28
- style={{
29
- borderCollapse: "collapse",
30
- width: "100%",
31
- textAlign: "center",
32
- }}
33
- />
34
- ),
35
- tr: (props: React.ComponentPropsWithoutRef<"tr">) => (
36
- <tr
37
- {...props}
38
- style={{
39
- textAlign: "center",
40
- color: "white",
41
- fontFamily: 'Bitter,"Helvetica Neue",Helvetica,Arial,sans-serif',
42
- fontSize: 24,
43
- }}
44
- />
45
- ),
46
- td: (props: React.ComponentPropsWithoutRef<"td">) => (
47
- <td
48
- {...props}
49
- style={{
50
- textAlign: "center",
51
- padding: "0.3rem 0",
52
- color: "white",
53
- fontFamily: 'Bitter,"Helvetica Neue",Helvetica,Arial,sans-serif',
54
- fontSize: 24,
55
- }}
56
- />
57
- ),
58
- h1: (props: React.ComponentProps<"h1">) => (
59
- <CustomHeading
60
- fontSize="h1"
61
- color="white"
62
- style={{
63
- fontWeight: 500,
64
- fontFamily: 'Bitter,"Helvetica Neue",Helvetica,Arial,sans-serif',
65
- fontSize: 67,
66
- flex: "0 1 65vw",
67
- maxWidth: "65%",
68
- textAlign: "left",
69
- }}
70
- >
71
- {props.children}
72
- </CustomHeading>
73
- ),
74
- h2: (props: React.ComponentProps<"h2">) => (
75
- <HeadingTwo>{props.children}</HeadingTwo>
76
- ),
77
- h3: (props: React.ComponentPropsWithoutRef<"h3">) => (
78
- <HeadingThree {...props} />
79
- ),
80
- img: (props: React.ComponentProps<typeof Image>) => <Image {...props} />,
81
- pre: CodeStepper,
82
- li: (props: React.ComponentProps<"li">) => (
83
- <li {...props} style={{ margin: "24px 0" }} />
84
- ),
85
- Side: (props: React.ComponentProps<"div">) => <div {...props} />,
86
- p: (props: React.ComponentProps<"p">) => {
87
- const Text = mdxComponentMap.p!;
88
- return (
89
- <Text
90
- style={{ margin: "8px 0", padding: "8px 0", lineHeight: "2rem" }}
91
- {...props}
92
- />
93
- );
94
- },
95
- blockquote: (props: React.ComponentProps<"blockquote">) => (
96
- <CustomQuote {...props} />
97
- ),
98
- a: ({ children, ...props }: React.ComponentProps<"a">) => {
99
- const domain = new URL(props.href || "").hostname;
100
- return (
101
- <a {...props} style={{ color: "#f49676", textDecoration: "none" }}>
102
- {children}{" "}
103
- <small
104
- style={{
105
- color: "#ffffff44",
106
- }}
107
- >
108
- ({domain})
109
- </small>
110
- </a>
111
- );
112
- },
113
- } as const;
114
-
115
- export default componentsMap;
@@ -1,73 +0,0 @@
1
- import React from "react";
2
- import {
3
- Link as SpectacleLink,
4
- Image as SpectacleImage,
5
- Heading,
6
- FlexBox,
7
- } from "spectacle";
8
- import styled from "styled-components";
9
-
10
- export const Link = (props: { href: string; children: React.ReactNode }) => (
11
- <SpectacleLink href={props.href} target="_blank" rel="noopener noreferrer">
12
- {props.children} [{props.href}]
13
- </SpectacleLink>
14
- );
15
-
16
- const StyledImage = styled(SpectacleImage)`
17
- object-fit: contain;
18
- max-height: 30vh;
19
- max-width: 70vw;
20
- `;
21
-
22
- export const Image = (props: React.ComponentProps<typeof SpectacleImage>) => (
23
- <FlexBox margin="0 0" padding="0 0">
24
- <StyledImage {...props} />
25
- </FlexBox>
26
- );
27
-
28
- export const CustomHeading = styled(Heading)`
29
- strong {
30
- color: #f49676;
31
- font-weight: 500;
32
- }
33
- `;
34
-
35
- export const CustomQuote = styled.blockquote`
36
- margin: 1rem 0;
37
- padding-left: 1.5rem;
38
- padding-top: 0;
39
- padding-bottom: 0;
40
- opacity: 0.8;
41
-
42
- > * {
43
- padding: 0 !important;
44
- }
45
- `;
46
-
47
- export const InlineCode = styled.code`
48
- filter: brightness(1.05);
49
- zoom: 1.1;
50
- &:before,
51
- &:after {
52
- content: "\`";
53
- font-size: 0.8em;
54
- }
55
- `;
56
-
57
- export const HeadingTwo = styled.h2`
58
- font-family: Bitter, \"Helvetica Neue\", Helvetica, Arial, sans-serif;
59
- font-size: 55px;
60
- font-weight: 400;
61
- `;
62
-
63
- export const HeadingThree = styled.h3`
64
- font-family: Bitter, \"Helvetica Neue\", Helvetica, Arial, sans-serif;
65
- font-size: 40px;
66
- font-weight: 400;
67
- margin-top: 0;
68
-
69
- strong {
70
- color: #f49676;
71
- font-weight: 500;
72
- }
73
- `;
package/src/front.png DELETED
Binary file