@gpichot/spectacle-deck 1.2.0 → 1.2.1

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 (76) hide show
  1. package/.turbo/turbo-build.log +4 -0
  2. package/.turbo/turbo-dev.log +4 -0
  3. package/{index.cjs → dist/index.cjs} +5 -4
  4. package/{index.mjs → dist/index.mjs} +5 -4
  5. package/package.json +21 -16
  6. package/publish.sh +7 -0
  7. package/scripts/bundle.ts +84 -0
  8. package/src/SlideWrapper.tsx +25 -0
  9. package/src/colors.ts +42 -0
  10. package/src/components/CodeStepper/CodeStepper.tsx +228 -0
  11. package/src/components/CodeStepper/code-directives.test.ts +58 -0
  12. package/src/components/CodeStepper/code-directives.ts +129 -0
  13. package/src/components/DocumentationItem.tsx +85 -0
  14. package/src/components/FilePane.tsx +18 -0
  15. package/src/components/HorizontalList.tsx +141 -0
  16. package/src/components/IconBox.tsx +31 -0
  17. package/src/components/Image.tsx +39 -0
  18. package/src/components/ItemsColumn.tsx +60 -0
  19. package/src/components/QRCode.tsx +55 -0
  20. package/src/components/Timeline.styled.tsx +24 -0
  21. package/src/components/Timeline.tsx +159 -0
  22. package/src/components/map.tsx +128 -0
  23. package/src/components/styled.tsx +73 -0
  24. package/src/context.tsx +33 -0
  25. package/src/front.png +0 -0
  26. package/src/index.tsx +127 -0
  27. package/src/layouts/BaseLayout.tsx +52 -0
  28. package/src/layouts/CenteredLayout.tsx +40 -0
  29. package/src/layouts/Default3Layout.tsx +159 -0
  30. package/src/layouts/MainSectionLayout.tsx +31 -0
  31. package/src/layouts/QuoteLayout.tsx +107 -0
  32. package/src/layouts/SectionLayout.tsx +14 -0
  33. package/src/layouts/SideCodeLayout.tsx +44 -0
  34. package/src/layouts/SideImageLayout.tsx +82 -0
  35. package/src/layouts/SideLayout.tsx +31 -0
  36. package/src/layouts/columns.tsx +56 -0
  37. package/src/layouts/index.tsx +19 -0
  38. package/src/layouts/styled.ts +7 -0
  39. package/src/layouts/utils.ts +66 -0
  40. package/src/node.d.ts +5 -0
  41. package/src/style.d.ts +10 -0
  42. package/src/template.tsx +25 -0
  43. package/src/theme.ts +28 -0
  44. package/tsconfig.json +29 -0
  45. /package/{SlideWrapper.d.ts → dist/SlideWrapper.d.ts} +0 -0
  46. /package/{colors.d.ts → dist/colors.d.ts} +0 -0
  47. /package/{components → dist/components}/CodeStepper/CodeStepper.d.ts +0 -0
  48. /package/{components → dist/components}/CodeStepper/code-directives.d.ts +0 -0
  49. /package/{components → dist/components}/DocumentationItem.d.ts +0 -0
  50. /package/{components → dist/components}/FilePane.d.ts +0 -0
  51. /package/{components → dist/components}/HorizontalList.d.ts +0 -0
  52. /package/{components → dist/components}/IconBox.d.ts +0 -0
  53. /package/{components → dist/components}/Image.d.ts +0 -0
  54. /package/{components → dist/components}/ItemsColumn.d.ts +0 -0
  55. /package/{components → dist/components}/QRCode.d.ts +0 -0
  56. /package/{components → dist/components}/Timeline.d.ts +0 -0
  57. /package/{components → dist/components}/Timeline.styled.d.ts +0 -0
  58. /package/{components → dist/components}/map.d.ts +0 -0
  59. /package/{components → dist/components}/styled.d.ts +0 -0
  60. /package/{context.d.ts → dist/context.d.ts} +0 -0
  61. /package/{index.d.ts → dist/index.d.ts} +0 -0
  62. /package/{layouts → dist/layouts}/BaseLayout.d.ts +0 -0
  63. /package/{layouts → dist/layouts}/CenteredLayout.d.ts +0 -0
  64. /package/{layouts → dist/layouts}/Default3Layout.d.ts +0 -0
  65. /package/{layouts → dist/layouts}/MainSectionLayout.d.ts +0 -0
  66. /package/{layouts → dist/layouts}/QuoteLayout.d.ts +0 -0
  67. /package/{layouts → dist/layouts}/SectionLayout.d.ts +0 -0
  68. /package/{layouts → dist/layouts}/SideCodeLayout.d.ts +0 -0
  69. /package/{layouts → dist/layouts}/SideImageLayout.d.ts +0 -0
  70. /package/{layouts → dist/layouts}/SideLayout.d.ts +0 -0
  71. /package/{layouts → dist/layouts}/columns.d.ts +0 -0
  72. /package/{layouts → dist/layouts}/index.d.ts +0 -0
  73. /package/{layouts → dist/layouts}/styled.d.ts +0 -0
  74. /package/{layouts → dist/layouts}/utils.d.ts +0 -0
  75. /package/{template.d.ts → dist/template.d.ts} +0 -0
  76. /package/{theme.d.ts → dist/theme.d.ts} +0 -0
@@ -0,0 +1,159 @@
1
+ import React from "react";
2
+ import styled from "styled-components";
3
+ import { Margins } from "./utils";
4
+
5
+ function MultipleHexagons({ position }: { position: "left" | "right" }) {
6
+ return (
7
+ <svg
8
+ viewBox={`${position === "left" ? "0" : "2"} 0 12 20`}
9
+ width="12"
10
+ height="20"
11
+ fill="none"
12
+ xmlns="http://www.w3.org/2000/svg"
13
+ >
14
+ <path
15
+ d="M 3.913 5.381 L 2.063 4.314 L 2.063 2.173 L 3.913 1.103 L 5.761 2.173 L 5.761 4.314 L 3.913 5.381 Z M 2.38 4.128 L 3.913 5.014 L 5.444 4.128 L 5.444 2.356 L 3.913 1.47 L 2.38 2.356 L 2.38 4.128 Z"
16
+ fill="#F49676"
17
+ />
18
+ <path
19
+ d="M 8.047 5.401 L 6.197 4.334 L 6.197 2.193 L 8.047 1.123 L 9.895 2.193 L 9.895 4.334 L 8.047 5.401 Z M 6.514 4.148 L 8.047 5.034 L 9.578 4.148 L 9.578 2.376 L 8.047 1.49 L 6.514 2.376 L 6.514 4.148 Z"
20
+ fill="#F49676"
21
+ />
22
+ <path
23
+ d="M 8.071 4.548 L 6.956 3.905 L 6.956 2.615 L 8.071 1.97 L 9.184 2.615 L 9.184 3.905 L 8.071 4.548 Z"
24
+ fill="#F49676"
25
+ />
26
+ <path
27
+ d="M 5.982 8.898 L 4.132 7.831 L 4.132 5.69 L 5.982 4.62 L 7.83 5.69 L 7.83 7.831 L 5.982 8.898 Z M 4.449 7.645 L 5.982 8.531 L 7.513 7.645 L 7.513 5.873 L 5.982 4.987 L 4.449 5.873 L 4.449 7.645 Z"
28
+ fill="#F49676"
29
+ />
30
+ <path
31
+ d="M 6.006 8.045 L 4.891 7.402 L 4.891 6.112 L 6.006 5.467 L 7.119 6.112 L 7.119 7.402 L 6.006 8.045 Z"
32
+ fill="#F49676"
33
+ />
34
+ <path
35
+ d="M 8.056 12.323 L 6.206 11.256 L 6.206 9.115 L 8.056 8.045 L 9.904 9.115 L 9.904 11.256 L 8.056 12.323 Z M 6.523 11.07 L 8.056 11.956 L 9.587 11.07 L 9.587 9.298 L 8.056 8.412 L 6.523 9.298 L 6.523 11.07 Z"
36
+ fill="#F49676"
37
+ />
38
+ <path
39
+ d="M 8.08 11.47 L 6.965 10.827 L 6.965 9.537 L 8.08 8.892 L 9.193 9.537 L 9.193 10.827 L 8.08 11.47 Z"
40
+ fill="#F49676"
41
+ />
42
+ <path
43
+ d="M 10.101 8.878 L 8.251 7.811 L 8.251 5.67 L 10.101 4.6 L 11.949 5.67 L 11.949 7.811 L 10.101 8.878 Z M 8.568 7.625 L 10.101 8.511 L 11.632 7.625 L 11.632 5.853 L 10.101 4.967 L 8.568 5.853 L 8.568 7.625 Z"
44
+ fill="#F49676"
45
+ />
46
+ <path
47
+ d="M 10.125 8.025 L 9.01 7.382 L 9.01 6.092 L 10.125 5.447 L 11.238 6.092 L 11.238 7.382 L 10.125 8.025 Z"
48
+ fill="#F49676"
49
+ />
50
+ <path
51
+ d="M 12.077 12.301 L 10.227 11.234 L 10.227 9.093 L 12.077 8.023 L 13.925 9.093 L 13.925 11.234 L 12.077 12.301 Z M 10.544 11.048 L 12.077 11.934 L 13.608 11.048 L 13.608 9.276 L 12.077 8.39 L 10.544 9.276 L 10.544 11.048 Z"
52
+ fill="#F49676"
53
+ />
54
+ <path
55
+ d="M 12.101 11.448 L 10.986 10.805 L 10.986 9.515 L 12.101 8.87 L 13.214 9.515 L 13.214 10.805 L 12.101 11.448 Z"
56
+ fill="#F49676"
57
+ />
58
+ <path
59
+ d="M 10.062 15.781 L 8.212 14.714 L 8.212 12.573 L 10.062 11.503 L 11.91 12.573 L 11.91 14.714 L 10.062 15.781 Z M 8.529 14.528 L 10.062 15.414 L 11.593 14.528 L 11.593 12.756 L 10.062 11.87 L 8.529 12.756 L 8.529 14.528 Z"
60
+ fill="#F49676"
61
+ />
62
+ <path
63
+ d="M 8.029 19.193 L 6.179 18.126 L 6.179 15.985 L 8.029 14.915 L 9.877 15.985 L 9.877 18.126 L 8.029 19.193 Z M 6.496 17.94 L 8.029 18.826 L 9.56 17.94 L 9.56 16.168 L 8.029 15.282 L 6.496 16.168 L 6.496 17.94 Z"
64
+ fill="#F49676"
65
+ />
66
+ <path
67
+ d="M 6.068 15.716 L 4.218 14.649 L 4.218 12.508 L 6.068 11.438 L 7.916 12.508 L 7.916 14.649 L 6.068 15.716 Z M 4.535 14.463 L 6.068 15.349 L 7.599 14.463 L 7.599 12.691 L 6.068 11.805 L 4.535 12.691 L 4.535 14.463 Z"
68
+ fill="#F49676"
69
+ />
70
+ <path
71
+ d="M 6.092 14.863 L 4.977 14.22 L 4.977 12.93 L 6.092 12.285 L 7.205 12.93 L 7.205 14.22 L 6.092 14.863 Z"
72
+ fill="#F49676"
73
+ />
74
+ <path
75
+ d="M 4.011 12.393 L 2.161 11.326 L 2.161 9.185 L 4.011 8.115 L 5.859 9.185 L 5.859 11.326 L 4.011 12.393 Z M 2.478 11.14 L 4.011 12.026 L 5.542 11.14 L 5.542 9.368 L 4.011 8.482 L 2.478 9.368 L 2.478 11.14 Z"
76
+ fill="#F49676"
77
+ />
78
+ <path
79
+ d="M 2.083 15.773 L 0.233 14.706 L 0.233 12.565 L 2.083 11.495 L 3.931 12.565 L 3.931 14.706 L 2.083 15.773 Z M 0.55 14.52 L 2.083 15.406 L 3.614 14.52 L 3.614 12.748 L 2.083 11.862 L 0.55 12.748 L 0.55 14.52 Z"
80
+ fill="#F49676"
81
+ />
82
+ <path
83
+ d="M 2.107 14.92 L 0.992 14.277 L 0.992 12.987 L 2.107 12.342 L 3.22 12.987 L 3.22 14.277 L 2.107 14.92 Z"
84
+ fill="#F49676"
85
+ />
86
+ <path
87
+ d="M 3.966 19.231 L 2.116 18.164 L 2.116 16.023 L 3.966 14.953 L 5.814 16.023 L 5.814 18.164 L 3.966 19.231 Z M 2.433 17.978 L 3.966 18.864 L 5.497 17.978 L 5.497 16.206 L 3.966 15.32 L 2.433 16.206 L 2.433 17.978 Z"
88
+ fill="#F49676"
89
+ />
90
+ <path
91
+ d="M 3.99 18.378 L 2.875 17.735 L 2.875 16.445 L 3.99 15.8 L 5.103 16.445 L 5.103 17.735 L 3.99 18.378 Z"
92
+ fill="#F49676"
93
+ />
94
+ </svg>
95
+ );
96
+ }
97
+
98
+ const Default3SideContainer = styled.div`
99
+ svg {
100
+ height: 100%;
101
+ width: auto;
102
+ path {
103
+ fill: #ffffff22;
104
+ transition: fill 3s;
105
+ &:hover {
106
+ fill: #ffffffbb;
107
+ }
108
+ }
109
+ }
110
+ `;
111
+ const Default2LayoutContainer = styled.div`
112
+ h2,
113
+ h3 {
114
+ text-align: left;
115
+ color: white;
116
+ }
117
+ `;
118
+ export const Default3Layout = ({
119
+ children,
120
+ position = "right",
121
+ }: {
122
+ children: React.ReactNode;
123
+ position?: "left" | "right";
124
+ }) => {
125
+ const isReversed = position === "left";
126
+ return (
127
+ <Default2LayoutContainer
128
+ style={{
129
+ display: "flex",
130
+ position: "absolute",
131
+ flexDirection: isReversed ? "row-reverse" : "row",
132
+ inset: 0,
133
+ alignItems: "center",
134
+ }}
135
+ >
136
+ <Default3SideContainer
137
+ style={{
138
+ flex: 1,
139
+ height: "100%",
140
+ padding: "2rem",
141
+ transform: isReversed
142
+ ? "scale(2) translate(25%, 4%)"
143
+ : "scale(2) translate(-25%, 15%)",
144
+ }}
145
+ >
146
+ <MultipleHexagons position={position} />
147
+ </Default3SideContainer>
148
+ <div
149
+ style={{
150
+ flex: 4,
151
+ marginLeft: isReversed ? Margins.horizontal : "2rem",
152
+ marginRight: isReversed ? "2rem" : Margins.horizontal,
153
+ }}
154
+ >
155
+ {children}
156
+ </div>
157
+ </Default2LayoutContainer>
158
+ );
159
+ };
@@ -0,0 +1,31 @@
1
+ import React from "react";
2
+
3
+ import { FlexBox } from "spectacle";
4
+
5
+ import frontImage from "../front.png";
6
+
7
+ export const MainSectionLayout = ({
8
+ children,
9
+ }: {
10
+ children: React.ReactNode;
11
+ }) => {
12
+ return (
13
+ <FlexBox
14
+ height="100%"
15
+ width="100%"
16
+ flexDirection="row"
17
+ style={{
18
+ position: "absolute",
19
+ inset: "none",
20
+ right: 0,
21
+ top: 0,
22
+ bottom: 0,
23
+ }}
24
+ >
25
+ <div style={{ paddingLeft: "8rem", flex: 1 }}>{children}</div>
26
+ <div style={{ flex: "0 0", height: "100%", paddingLeft: "5rem" }}>
27
+ <img src={frontImage} alt="Front" style={{ height: "100%" }} />
28
+ </div>
29
+ </FlexBox>
30
+ );
31
+ };
@@ -0,0 +1,107 @@
1
+ import React from "react";
2
+ import styled from "styled-components";
3
+ import { getMatchingMdxType } from "./utils";
4
+ import { BaseLayout } from "./BaseLayout";
5
+
6
+ function invariant(condition: any, message: string) {
7
+ if (!condition) {
8
+ throw new Error(message);
9
+ }
10
+ }
11
+
12
+ const QuoteBaseLayout = styled.div`
13
+ position: absolute;
14
+ inset: 0;
15
+ display: flex;
16
+ flex-flow: column nowrap;
17
+ justify-content: center;
18
+ .blockquote > * {
19
+ border-left: 0;
20
+ }
21
+ .blockquote {
22
+ text-align: justify;
23
+ position: relative;
24
+ }
25
+ .blockquote > :first-child {
26
+ &:before {
27
+ content: "“";
28
+ position: absolute;
29
+ font-size: 16rem;
30
+ left: -5rem;
31
+ font-family: serif;
32
+ top: 50%;
33
+ transform: translateY(-50%);
34
+ color: #ffffff22;
35
+ }
36
+ &:after {
37
+ content: "”";
38
+ position: absolute;
39
+ font-size: 16rem;
40
+ right: 3rem;
41
+ bottom: -5rem;
42
+ font-family: serif;
43
+ color: #ffffff22;
44
+ pointer-events: none;
45
+ }
46
+ }
47
+ .blockquote * {
48
+ line-height: 3.5rem !important;
49
+ font-size: 2.5rem;
50
+ }
51
+ .source {
52
+ font-family: Bitter, "Helvetica Neue", Helvetica, Arial, sans-serif;
53
+ box-sizing: border-box;
54
+ width: 100%;
55
+ margin-top: 4rem;
56
+ text-align: right;
57
+ font-size: 2rem;
58
+ a {
59
+ text-decoration: none;
60
+ color: #ffffff77;
61
+ }
62
+ }
63
+ `;
64
+ export function QuoteLayout({
65
+ children,
66
+ author,
67
+ sourceUrl,
68
+ }: {
69
+ children: React.ReactNode;
70
+ author: string;
71
+ sourceUrl?: string;
72
+ }) {
73
+ const [blockquote, rest] = getMatchingMdxType(children, "blockquote");
74
+ invariant(rest, "QuoteLayout can only have one blockquote");
75
+ return (
76
+ <QuoteBaseLayout>
77
+ <div
78
+ style={{
79
+ display: "flex",
80
+ flexDirection: "column",
81
+ alignItems: "flex-start",
82
+ justifyContent: "center",
83
+ textAlign: "center",
84
+ margin: "0 4rem 0 12rem",
85
+ }}
86
+ >
87
+ <div
88
+ style={{
89
+ flex: 1,
90
+ padding: "0 12rem 0 2rem",
91
+ boxSizing: "border-box",
92
+ }}
93
+ className="blockquote"
94
+ >
95
+ {blockquote}
96
+ </div>
97
+ <div className="source" style={{ flex: 1, padding: "0 4rem" }}>
98
+ {
99
+ <a href={sourceUrl} target="_blank" rel="noopener noreferrer">
100
+ {author}
101
+ </a>
102
+ }
103
+ </div>
104
+ </div>
105
+ </QuoteBaseLayout>
106
+ );
107
+ }
@@ -0,0 +1,14 @@
1
+ import styled from "styled-components";
2
+
3
+ export const SectionLayout = styled.div`
4
+ display: flex;
5
+ flex-direction: row;
6
+ align-items: center;
7
+ justify-content: space-between;
8
+ height: 100%;
9
+ padding-left: 9rem;
10
+
11
+ h2 {
12
+ color: white;
13
+ }
14
+ `;
@@ -0,0 +1,44 @@
1
+ import React from "react";
2
+ import { ColumnsLayout } from "./columns";
3
+ import { Margins, getCodeChildren } from "./utils";
4
+ import styled from "styled-components";
5
+
6
+ const CodeSide = styled.div`
7
+ pre {
8
+ font-size: 0.9rem;
9
+ }
10
+ `;
11
+
12
+ export function SidedCodeLayout({
13
+ children,
14
+ position = "right",
15
+ }: {
16
+ children: React.ReactNode;
17
+ position?: "left" | "right";
18
+ }) {
19
+ const [code, rest] = getCodeChildren(children);
20
+
21
+ return (
22
+ <ColumnsLayout reverse={position === "left"}>
23
+ <div
24
+ style={{
25
+ marginLeft: Margins.horizontal,
26
+ paddingRight: Margins.horizontalInternal,
27
+ }}
28
+ >
29
+ {rest}
30
+ </div>
31
+ <CodeSide
32
+ style={{
33
+ backgroundColor: "#1d2021",
34
+ height: "100%",
35
+ display: "flex",
36
+ flexDirection: "column",
37
+ justifyContent: "center",
38
+ }}
39
+ >
40
+ {code}
41
+ </CodeSide>
42
+ </ColumnsLayout>
43
+ );
44
+ }
@@ -0,0 +1,82 @@
1
+ import React from "react";
2
+ import styled from "styled-components";
3
+ import { SVGObject } from "./styled";
4
+ import { getMatchingMdxType } from "./utils";
5
+ import { Image } from "../components/Image";
6
+
7
+ const DivWithHeading = styled.div`
8
+ h2 {
9
+ margin-top: 0;
10
+ }
11
+ h2 strong {
12
+ color: var(--color-secondary);
13
+ font-weight: 400;
14
+ }
15
+ `;
16
+
17
+ /**
18
+ * Parse a ratio like 6/5
19
+ */
20
+ function parseRatio(ratio: string) {
21
+ const [a, b] = ratio.split("/");
22
+ return { left: parseInt(a), right: parseInt(b) };
23
+ }
24
+
25
+ export const SidedImageLayout = ({
26
+ children,
27
+ image,
28
+ position,
29
+ height,
30
+ ratio: ratioProp,
31
+ }: {
32
+ children: React.ReactNode;
33
+ image?: string;
34
+ position?: "left" | "right";
35
+ ratio?: string;
36
+ height?: number;
37
+ }) => {
38
+ const isReversed = position === "left";
39
+ const [component, rest] = getMatchingMdxType(children, "Image") || image;
40
+ const ratio = parseRatio(ratioProp || "6/4");
41
+
42
+ if (!image && !component.length) {
43
+ console.error("No image provided for SidedImageLayout");
44
+ return null;
45
+ }
46
+ return (
47
+ <DivWithHeading
48
+ style={{
49
+ display: "flex",
50
+ flexDirection: isReversed ? "row-reverse" : "row",
51
+ position: "absolute",
52
+ left: 0,
53
+ right: 0,
54
+ bottom: 0,
55
+ top: 0,
56
+ }}
57
+ >
58
+ <div
59
+ style={{
60
+ flex: `${ratio.left || 6} 0`,
61
+ display: "flex",
62
+ flexDirection: "column",
63
+ justifyContent: "center",
64
+ padding: isReversed ? "0 7rem 0 4rem" : "0 4rem 0 7rem",
65
+ }}
66
+ >
67
+ {rest}
68
+ </div>
69
+ <div
70
+ style={{
71
+ flex: `${ratio.right || 4} 0`,
72
+ display: "flex",
73
+ flexDirection: "column",
74
+ justifyContent: "center",
75
+ backgroundColor: "white",
76
+ }}
77
+ >
78
+ {component || <Image src={image} />}
79
+ </div>
80
+ </DivWithHeading>
81
+ );
82
+ };
@@ -0,0 +1,31 @@
1
+ import React from "react";
2
+ import { ColumnsLayout } from "./columns";
3
+ import { Margins, getMatchingMdxType } from "./utils";
4
+
5
+ export function SideLayout({
6
+ children,
7
+ position = "right",
8
+ }: {
9
+ children: React.ReactNode;
10
+ position?: "right" | "left";
11
+ }) {
12
+ const [side, rest] = getMatchingMdxType(children, "Side");
13
+ return (
14
+ <ColumnsLayout reverse={position === "left"}>
15
+ <div style={{ marginLeft: Margins.horizontal }}>{rest}</div>
16
+ <div
17
+ style={{
18
+ marginLeft: Margins.horizontalInternal,
19
+ padding: `0 ${Margins.vertical}`,
20
+ backgroundColor: "#00000044",
21
+ display: "flex",
22
+ flexDirection: "column",
23
+ justifyContent: "center",
24
+ height: "100%",
25
+ }}
26
+ >
27
+ {side}
28
+ </div>
29
+ </ColumnsLayout>
30
+ );
31
+ }
@@ -0,0 +1,56 @@
1
+ import React from "react";
2
+ import styled from "styled-components";
3
+
4
+ const DivWithHeading = styled.div`
5
+ h2 {
6
+ margin-top: 0;
7
+ }
8
+ h2 strong {
9
+ color: var(--color-secondary);
10
+ font-weight: 400;
11
+ }
12
+ `;
13
+
14
+ const ColumnsContainer = styled(DivWithHeading)`
15
+ display: flex;
16
+ flex-direction: row;
17
+ position: absolute;
18
+ left: 0;
19
+ right: 0;
20
+ top: 0;
21
+ bottom: 0;
22
+ alignitems: center;
23
+ `;
24
+
25
+ export function ColumnsLayout({
26
+ children,
27
+ reverse,
28
+ }: {
29
+ children: React.ReactNode;
30
+ reverse?: boolean;
31
+ }) {
32
+ const childrenArray = React.Children.toArray(children);
33
+ return (
34
+ <ColumnsContainer
35
+ style={{
36
+ flexDirection: reverse ? "row-reverse" : "row",
37
+ }}
38
+ >
39
+ {childrenArray.map((child, i) => (
40
+ <div
41
+ key={i}
42
+ style={{
43
+ flex: 1,
44
+ height: "100%",
45
+ display: "flex",
46
+ flexFlow: "column",
47
+ justifyContent: "center",
48
+ boxSizing: "border-box",
49
+ }}
50
+ >
51
+ {child}
52
+ </div>
53
+ ))}
54
+ </ColumnsContainer>
55
+ );
56
+ }
@@ -0,0 +1,19 @@
1
+ import { CenteredLayout } from "./CenteredLayout";
2
+ import { Default3Layout } from "./Default3Layout";
3
+ import { MainSectionLayout } from "./MainSectionLayout";
4
+ import { QuoteLayout } from "./QuoteLayout";
5
+ import { SectionLayout } from "./SectionLayout";
6
+ import { SidedCodeLayout } from "./SideCodeLayout";
7
+ import { SidedImageLayout } from "./SideImageLayout";
8
+ import { SideLayout } from "./SideLayout";
9
+
10
+ export default {
11
+ mainSection: MainSectionLayout,
12
+ centered: CenteredLayout,
13
+ default3: Default3Layout,
14
+ quote: QuoteLayout,
15
+ sidedCode: SidedCodeLayout,
16
+ sidedImage: SidedImageLayout,
17
+ side: SideLayout,
18
+ section: SectionLayout,
19
+ };
@@ -0,0 +1,7 @@
1
+ import styled from "styled-components";
2
+
3
+ export const SVGObject = styled.object`
4
+ padding: 3rem 2rem;
5
+ box-sizing: border-box;
6
+ background-color: white;
7
+ `;
@@ -0,0 +1,66 @@
1
+ import React from "react";
2
+
3
+ export const Margins = {
4
+ vertical: "4rem",
5
+ horizontal: "7rem",
6
+ horizontalInternal: "2rem",
7
+ };
8
+
9
+ export function getHeading(children: React.ReactNode) {
10
+ const allChild = React.Children.toArray(children);
11
+ if (allChild.length === 0) return [null, allChild];
12
+ const [candidate, ...rest] = allChild;
13
+ if (!React.isValidElement(candidate)) return [null, allChild];
14
+ if (["h2", "h3"].includes(candidate.props.originalType)) {
15
+ return [candidate, rest];
16
+ }
17
+ return [null, allChild];
18
+ }
19
+
20
+ export function getCode(children: React.ReactNode) {
21
+ const allChild = React.Children.toArray(children);
22
+
23
+ if (allChild.length === 0) return [null, allChild];
24
+
25
+ const index = allChild.findIndex((child) => {
26
+ if (!React.isValidElement(child)) return false;
27
+ return child.props.originalType === "pre";
28
+ });
29
+
30
+ if (index === -1) return [null, allChild];
31
+
32
+ const candidate = allChild[index];
33
+ const rest = allChild.filter((_, i) => i !== index);
34
+ return [candidate, rest];
35
+ }
36
+
37
+ export function getMatchingMdxType(children: React.ReactNode, mdxType: string) {
38
+ const allChild = React.Children.toArray(children);
39
+
40
+ const matchFn = (child: React.ReactNode) => {
41
+ if (!React.isValidElement(child)) return false;
42
+ if (typeof child.type !== "function") return false;
43
+ if (child.type.name === mdxType) return true;
44
+ if ("mdxType" in child.type === false) return false;
45
+
46
+ return child.type.mdxType === mdxType;
47
+ };
48
+
49
+ const matches = allChild.filter(matchFn);
50
+
51
+ const rest = allChild.filter((child) => !matchFn(child));
52
+
53
+ return [matches, rest];
54
+ }
55
+
56
+ export function getCodeChildren(children: React.ReactNode) {
57
+ const [code, rest] = getCode(children);
58
+ if (code) return [code, rest];
59
+
60
+ const [codeStepper, rest2] = getMatchingMdxType(children, "CodeStepper");
61
+ if (codeStepper.length > 0) return [codeStepper, rest2];
62
+
63
+ const [codes, rest3] = getMatchingMdxType(children, "FilePane");
64
+
65
+ return [codes, rest3];
66
+ }
package/src/node.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ interface ImportMeta {
2
+ env: {
3
+ DEV: boolean;
4
+ };
5
+ }
package/src/style.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ // Typings for .module.scss
2
+ declare module "*.module.scss" {
3
+ const content: { [className: string]: string };
4
+ export default content;
5
+ }
6
+
7
+ declare module "*.png" {
8
+ const content: any;
9
+ export default content;
10
+ }
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+
3
+ import { Box, FullScreen } from "spectacle";
4
+
5
+ export const template = ({ slideNumber, numberOfSlides }) => {
6
+ const percentage = (slideNumber / numberOfSlides) * 100;
7
+ return (
8
+ <div style={{ position: "absolute", bottom: 0, left: 0, right: 0 }}>
9
+ <Box padding="0 0 0.5em 0.7em">
10
+ <FullScreen />
11
+ </Box>
12
+
13
+ <div style={{ width: "100%", height: "4px", background: "#ffffff11" }}>
14
+ <div
15
+ style={{
16
+ width: `${percentage}%`,
17
+ height: "2px",
18
+ background: "#ffffff77",
19
+ transition: "width 0.3s ease",
20
+ }}
21
+ />
22
+ </div>
23
+ </div>
24
+ );
25
+ };
package/src/theme.ts ADDED
@@ -0,0 +1,28 @@
1
+ import "@fontsource/bitter/300.css";
2
+ import "@fontsource/bitter/400.css";
3
+ import "@fontsource/bitter/500.css";
4
+ import "@fontsource/bitter/700.css";
5
+
6
+ export default {
7
+ colors: {
8
+ //primary: "white",
9
+ primary: "rgb(43,19,90)",
10
+
11
+ secondary: "rgb(86,212,248)",
12
+ // secondary: "#F49676",
13
+ // tertiary: "#042F3B",
14
+ tertiary: "rgb(43,19,90)",
15
+ },
16
+ fonts: {
17
+ header: 'Bitter, "Helvetica Neue", Helvetica, Arial, sans-serif',
18
+ text: 'Bitter, "Helvetica Neue", Helvetica, Arial, sans-serif',
19
+ },
20
+ fontSizes: {
21
+ h1: "48px",
22
+ h2: "32px",
23
+ h3: "24px",
24
+ text: "24px",
25
+ monospace: "16px",
26
+ },
27
+ space: [8, 16, 24],
28
+ };