@gpichot/spectacle-deck 1.0.8 → 1.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/dist/components/DocumentationItem.d.ts +10 -0
- package/{index.cjs → dist/index.cjs} +288 -141
- package/{index.d.ts → dist/index.d.ts} +4 -6
- package/{index.mjs → dist/index.mjs} +287 -140
- package/dist/layouts/QuoteLayout.d.ts +6 -0
- package/{layouts → dist/layouts}/index.d.ts +2 -0
- package/dist/package.json +30 -0
- package/package.json +20 -16
- package/scripts/bundle.ts +84 -0
- package/src/components/CodeStepper/CodeStepper.tsx +223 -0
- package/src/components/CodeStepper/code-directives.test.ts +58 -0
- package/src/components/CodeStepper/code-directives.ts +129 -0
- package/src/components/DocumentationItem.tsx +85 -0
- package/src/components/FilePane.tsx +18 -0
- package/src/components/HorizontalList.tsx +140 -0
- package/src/components/IconBox.tsx +31 -0
- package/src/components/Image.tsx +34 -0
- package/src/components/ItemsColumn.tsx +56 -0
- package/src/components/Timeline.styled.tsx +24 -0
- package/src/components/Timeline.tsx +157 -0
- package/src/components/map.tsx +115 -0
- package/src/components/styled.tsx +73 -0
- package/src/front.png +0 -0
- package/src/index.tsx +109 -0
- package/src/layouts/CenteredLayout.tsx +40 -0
- package/src/layouts/Default3Layout.tsx +159 -0
- package/src/layouts/MainSectionLayout.tsx +31 -0
- package/src/layouts/QuoteLayout.tsx +99 -0
- package/src/layouts/SectionLayout.tsx +14 -0
- package/src/layouts/SideCodeLayout.tsx +44 -0
- package/src/layouts/SideImageLayout.tsx +72 -0
- package/src/layouts/SideLayout.tsx +31 -0
- package/src/layouts/columns.tsx +56 -0
- package/src/layouts/index.tsx +19 -0
- package/src/layouts/styled.ts +7 -0
- package/src/layouts/utils.ts +65 -0
- package/src/node.d.ts +5 -0
- package/src/style.d.ts +10 -0
- package/src/template.tsx +25 -0
- package/src/theme.ts +24 -0
- package/test.js +106 -0
- package/tsconfig.json +29 -0
- /package/{components → dist/components}/CodeStepper/CodeStepper.d.ts +0 -0
- /package/{components → dist/components}/CodeStepper/code-directives.d.ts +0 -0
- /package/{components → dist/components}/FilePane.d.ts +0 -0
- /package/{components → dist/components}/HorizontalList.d.ts +0 -0
- /package/{components → dist/components}/IconBox.d.ts +0 -0
- /package/{components → dist/components}/Image.d.ts +0 -0
- /package/{components → dist/components}/ItemsColumn.d.ts +0 -0
- /package/{components → dist/components}/Timeline.d.ts +0 -0
- /package/{components → dist/components}/Timeline.styled.d.ts +0 -0
- /package/{components → dist/components}/map.d.ts +0 -0
- /package/{components → dist/components}/styled.d.ts +0 -0
- /package/{layouts → dist/layouts}/CenteredLayout.d.ts +0 -0
- /package/{layouts → dist/layouts}/Default3Layout.d.ts +0 -0
- /package/{layouts → dist/layouts}/MainSectionLayout.d.ts +0 -0
- /package/{layouts → dist/layouts}/SectionLayout.d.ts +0 -0
- /package/{layouts → dist/layouts}/SideCodeLayout.d.ts +0 -0
- /package/{layouts → dist/layouts}/SideImageLayout.d.ts +0 -0
- /package/{layouts → dist/layouts}/SideLayout.d.ts +0 -0
- /package/{layouts → dist/layouts}/columns.d.ts +0 -0
- /package/{layouts → dist/layouts}/styled.d.ts +0 -0
- /package/{layouts → dist/layouts}/utils.d.ts +0 -0
- /package/{template.d.ts → dist/template.d.ts} +0 -0
- /package/{theme.d.ts → dist/theme.d.ts} +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
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 ("mdxType" in child.type === false) return false;
|
|
44
|
+
// @ts-expect-error checked above
|
|
45
|
+
return child.type.mdxType === mdxType;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const matches = allChild.filter(matchFn);
|
|
49
|
+
|
|
50
|
+
const rest = allChild.filter((child) => !matchFn(child));
|
|
51
|
+
|
|
52
|
+
return [matches, rest];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function getCodeChildren(children: React.ReactNode) {
|
|
56
|
+
const [code, rest] = getCode(children);
|
|
57
|
+
if (code) return [code, rest];
|
|
58
|
+
|
|
59
|
+
const [codeStepper, rest2] = getMatchingMdxType(children, "CodeStepper");
|
|
60
|
+
if (codeStepper.length > 0) return [codeStepper, rest2];
|
|
61
|
+
|
|
62
|
+
const [codes, rest3] = getMatchingMdxType(children, "FilePane");
|
|
63
|
+
|
|
64
|
+
return [codes, rest3];
|
|
65
|
+
}
|
package/src/node.d.ts
ADDED
package/src/style.d.ts
ADDED
package/src/template.tsx
ADDED
|
@@ -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,24 @@
|
|
|
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
|
+
secondary: "#F49676",
|
|
10
|
+
tertiary: "#042F3B",
|
|
11
|
+
},
|
|
12
|
+
fonts: {
|
|
13
|
+
header: 'Bitter, "Helvetica Neue", Helvetica, Arial, sans-serif',
|
|
14
|
+
text: 'Bitter, "Helvetica Neue", Helvetica, Arial, sans-serif',
|
|
15
|
+
},
|
|
16
|
+
fontSizes: {
|
|
17
|
+
h1: "48px",
|
|
18
|
+
h2: "32px",
|
|
19
|
+
h3: "24px",
|
|
20
|
+
text: "24px",
|
|
21
|
+
monospace: "16px",
|
|
22
|
+
},
|
|
23
|
+
space: [8, 16, 24],
|
|
24
|
+
};
|
package/test.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Timeline, TimelineItem } from "@gpichot/spectacle-deck";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import {Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs} from "react/jsx-runtime";import {useMDXComponents as _provideComponents} from "@mdx-js/react"
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
metadata: {"author":"Gabriel"},
|
|
9
|
+
slides: [{
|
|
10
|
+
metadata: {"layout":"mainSection"},
|
|
11
|
+
slideComponent: (baseProps) => {
|
|
12
|
+
const props = {...baseProps, frontmatter: {"layout":"mainSection"} };
|
|
13
|
+
const _components = {
|
|
14
|
+
h1: "h1",
|
|
15
|
+
strong: "strong",
|
|
16
|
+
..._provideComponents(),
|
|
17
|
+
...props.components
|
|
18
|
+
};
|
|
19
|
+
const {wrapper: MDXLayout} = _components;
|
|
20
|
+
return _jsxs(_components.h1, {
|
|
21
|
+
children: ["Hello, ", _jsx(_components.strong, {
|
|
22
|
+
children: "world!"
|
|
23
|
+
})]
|
|
24
|
+
})});
|
|
25
|
+
}
|
|
26
|
+
},{
|
|
27
|
+
metadata: {"layout":"centered"},
|
|
28
|
+
slideComponent: (baseProps) => {
|
|
29
|
+
const props = {...baseProps, frontmatter: {"layout":"centered"} };
|
|
30
|
+
const _components = {
|
|
31
|
+
h3: "h3",
|
|
32
|
+
p: "p",
|
|
33
|
+
strong: "strong",
|
|
34
|
+
..._provideComponents(),
|
|
35
|
+
...props.components
|
|
36
|
+
};
|
|
37
|
+
const {wrapper: MDXLayout} = _components;
|
|
38
|
+
return _jsx(MDXLayout, {...props,
|
|
39
|
+
children: [_jsx(_components.h3, {
|
|
40
|
+
children: _jsx(_components.strong, {
|
|
41
|
+
children: "History"
|
|
42
|
+
})
|
|
43
|
+
}), "\n", _jsxs(Timeline, {
|
|
44
|
+
children: [_jsx(TimelineItem, {
|
|
45
|
+
title: "2011",
|
|
46
|
+
children: _jsx(_components.p, {
|
|
47
|
+
children: "Created by Jordan Walke, a software engineer at Facebook."
|
|
48
|
+
})
|
|
49
|
+
}), _jsx(TimelineItem, {
|
|
50
|
+
title: "May 2013",
|
|
51
|
+
children: _jsxs(_components.p, {
|
|
52
|
+
children: ["⚛️ ", _jsx(_components.strong, {
|
|
53
|
+
children: "React"
|
|
54
|
+
}), " is open sourced."]
|
|
55
|
+
})
|
|
56
|
+
}), _jsx(TimelineItem, {
|
|
57
|
+
title: "March 2015",
|
|
58
|
+
children: _jsx(_components.p, {
|
|
59
|
+
children: "📱 React Native"
|
|
60
|
+
})
|
|
61
|
+
}), _jsx(TimelineItem, {
|
|
62
|
+
title: "Feb 2019",
|
|
63
|
+
children: _jsxs(_components.p, {
|
|
64
|
+
children: [_jsx(_components.strong, {
|
|
65
|
+
children: "v16.8:"
|
|
66
|
+
}), " React Hooks 🤘"]
|
|
67
|
+
})
|
|
68
|
+
}), _jsx(TimelineItem, {
|
|
69
|
+
title: "Oct 2020",
|
|
70
|
+
children: _jsxs(_components.p, {
|
|
71
|
+
children: [_jsx(_components.strong, {
|
|
72
|
+
children: "v17"
|
|
73
|
+
}), ": 🤷♂️"]
|
|
74
|
+
})
|
|
75
|
+
}), _jsx(TimelineItem, {
|
|
76
|
+
title: "March 2022",
|
|
77
|
+
children: _jsxs(_components.p, {
|
|
78
|
+
children: [_jsx(_components.strong, {
|
|
79
|
+
children: "v18:"
|
|
80
|
+
}), " Concurrent React"]
|
|
81
|
+
})
|
|
82
|
+
})]
|
|
83
|
+
})]
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
},{
|
|
87
|
+
metadata: null,
|
|
88
|
+
slideComponent: (baseProps) => {
|
|
89
|
+
const props = {...baseProps, frontmatter: null };
|
|
90
|
+
const _components = {
|
|
91
|
+
code: "code",
|
|
92
|
+
pre: "pre",
|
|
93
|
+
..._provideComponents(),
|
|
94
|
+
...props.components
|
|
95
|
+
};
|
|
96
|
+
const {wrapper: MDXLayout} = _components;
|
|
97
|
+
return _jsx(MDXLayout, {...props, children: _jsx(_components.pre, {
|
|
98
|
+
children: _jsx(_components.code, {
|
|
99
|
+
className: "language-jsx",
|
|
100
|
+
children: "export default () => <div>Hello, world!</div>;\n"
|
|
101
|
+
})
|
|
102
|
+
})});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Target node 14 */
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"lib": ["ES2020"],
|
|
6
|
+
"target": "ES2020",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
|
|
9
|
+
/* Transpile with esbuild */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowSyntheticDefaultImports": true,
|
|
12
|
+
|
|
13
|
+
/* Linting */
|
|
14
|
+
"strict": true,
|
|
15
|
+
"noUnusedLocals": true,
|
|
16
|
+
"noFallthroughCasesInSwitch": true,
|
|
17
|
+
"useUnknownInCatchVariables": true,
|
|
18
|
+
|
|
19
|
+
// Options
|
|
20
|
+
"outDir": "dist",
|
|
21
|
+
"baseUrl": "./src",
|
|
22
|
+
"esModuleInterop": true,
|
|
23
|
+
"declaration": true,
|
|
24
|
+
"jsx": "react",
|
|
25
|
+
"types": ["./src/node.d.ts"]
|
|
26
|
+
},
|
|
27
|
+
"include": ["src/**/*"],
|
|
28
|
+
"files": ["src/style.d.ts"]
|
|
29
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|