@gpichot/spectacle-deck 1.1.7 → 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 (80) hide show
  1. package/.turbo/turbo-build.log +4 -0
  2. package/.turbo/turbo-dev.log +4 -0
  3. package/dist/SlideWrapper.d.ts +7 -0
  4. package/dist/colors.d.ts +14 -0
  5. package/dist/components/QRCode.d.ts +6 -0
  6. package/dist/components/Timeline.styled.d.ts +7 -0
  7. package/{components → dist/components}/map.d.ts +2 -0
  8. package/dist/components/styled.d.ts +12 -0
  9. package/dist/context.d.ts +11 -0
  10. package/{index.cjs → dist/index.cjs} +321 -200
  11. package/{index.d.ts → dist/index.d.ts} +30 -7
  12. package/{index.mjs → dist/index.mjs} +312 -191
  13. package/{layouts → dist/layouts}/BaseLayout.d.ts +1 -1
  14. package/dist/layouts/SectionLayout.d.ts +2 -0
  15. package/{layouts → dist/layouts}/index.d.ts +1 -1
  16. package/dist/layouts/styled.d.ts +2 -0
  17. package/package.json +29 -23
  18. package/publish.sh +7 -0
  19. package/scripts/bundle.ts +84 -0
  20. package/src/SlideWrapper.tsx +25 -0
  21. package/src/colors.ts +42 -0
  22. package/src/components/CodeStepper/CodeStepper.tsx +228 -0
  23. package/src/components/CodeStepper/code-directives.test.ts +58 -0
  24. package/src/components/CodeStepper/code-directives.ts +129 -0
  25. package/src/components/DocumentationItem.tsx +85 -0
  26. package/src/components/FilePane.tsx +18 -0
  27. package/src/components/HorizontalList.tsx +141 -0
  28. package/src/components/IconBox.tsx +31 -0
  29. package/src/components/Image.tsx +39 -0
  30. package/src/components/ItemsColumn.tsx +60 -0
  31. package/src/components/QRCode.tsx +55 -0
  32. package/src/components/Timeline.styled.tsx +24 -0
  33. package/src/components/Timeline.tsx +159 -0
  34. package/src/components/map.tsx +128 -0
  35. package/src/components/styled.tsx +73 -0
  36. package/src/context.tsx +33 -0
  37. package/src/front.png +0 -0
  38. package/src/index.tsx +127 -0
  39. package/src/layouts/BaseLayout.tsx +52 -0
  40. package/src/layouts/CenteredLayout.tsx +40 -0
  41. package/src/layouts/Default3Layout.tsx +159 -0
  42. package/src/layouts/MainSectionLayout.tsx +31 -0
  43. package/src/layouts/QuoteLayout.tsx +107 -0
  44. package/src/layouts/SectionLayout.tsx +14 -0
  45. package/src/layouts/SideCodeLayout.tsx +44 -0
  46. package/src/layouts/SideImageLayout.tsx +82 -0
  47. package/src/layouts/SideLayout.tsx +31 -0
  48. package/src/layouts/columns.tsx +56 -0
  49. package/src/layouts/index.tsx +19 -0
  50. package/src/layouts/styled.ts +7 -0
  51. package/src/layouts/utils.ts +66 -0
  52. package/src/node.d.ts +5 -0
  53. package/src/style.d.ts +10 -0
  54. package/src/template.tsx +25 -0
  55. package/src/theme.ts +28 -0
  56. package/tsconfig.json +29 -0
  57. package/components/Timeline.styled.d.ts +0 -7
  58. package/components/styled.d.ts +0 -12
  59. package/layouts/SectionLayout.d.ts +0 -2
  60. package/layouts/styled.d.ts +0 -2
  61. /package/{components → dist/components}/CodeStepper/CodeStepper.d.ts +0 -0
  62. /package/{components → dist/components}/CodeStepper/code-directives.d.ts +0 -0
  63. /package/{components → dist/components}/DocumentationItem.d.ts +0 -0
  64. /package/{components → dist/components}/FilePane.d.ts +0 -0
  65. /package/{components → dist/components}/HorizontalList.d.ts +0 -0
  66. /package/{components → dist/components}/IconBox.d.ts +0 -0
  67. /package/{components → dist/components}/Image.d.ts +0 -0
  68. /package/{components → dist/components}/ItemsColumn.d.ts +0 -0
  69. /package/{components → dist/components}/Timeline.d.ts +0 -0
  70. /package/{layouts → dist/layouts}/CenteredLayout.d.ts +0 -0
  71. /package/{layouts → dist/layouts}/Default3Layout.d.ts +0 -0
  72. /package/{layouts → dist/layouts}/MainSectionLayout.d.ts +0 -0
  73. /package/{layouts → dist/layouts}/QuoteLayout.d.ts +0 -0
  74. /package/{layouts → dist/layouts}/SideCodeLayout.d.ts +0 -0
  75. /package/{layouts → dist/layouts}/SideImageLayout.d.ts +0 -0
  76. /package/{layouts → dist/layouts}/SideLayout.d.ts +0 -0
  77. /package/{layouts → dist/layouts}/columns.d.ts +0 -0
  78. /package/{layouts → dist/layouts}/utils.d.ts +0 -0
  79. /package/{template.d.ts → dist/template.d.ts} +0 -0
  80. /package/{theme.d.ts → dist/theme.d.ts} +0 -0
@@ -1,5 +1,5 @@
1
1
  // src/index.tsx
2
- import React21 from "react";
2
+ import React24 from "react";
3
3
  import { MDXProvider } from "@mdx-js/react";
4
4
  import { Deck as SpectacleDeck, Slide } from "spectacle";
5
5
 
@@ -16,11 +16,9 @@ var Margins = {
16
16
  };
17
17
  function getHeading(children) {
18
18
  const allChild = React.Children.toArray(children);
19
- if (allChild.length === 0)
20
- return [null, allChild];
19
+ if (allChild.length === 0) return [null, allChild];
21
20
  const [candidate, ...rest] = allChild;
22
- if (!React.isValidElement(candidate))
23
- return [null, allChild];
21
+ if (!React.isValidElement(candidate)) return [null, allChild];
24
22
  if (["h2", "h3"].includes(candidate.props.originalType)) {
25
23
  return [candidate, rest];
26
24
  }
@@ -28,15 +26,12 @@ function getHeading(children) {
28
26
  }
29
27
  function getCode(children) {
30
28
  const allChild = React.Children.toArray(children);
31
- if (allChild.length === 0)
32
- return [null, allChild];
29
+ if (allChild.length === 0) return [null, allChild];
33
30
  const index = allChild.findIndex((child) => {
34
- if (!React.isValidElement(child))
35
- return false;
31
+ if (!React.isValidElement(child)) return false;
36
32
  return child.props.originalType === "pre";
37
33
  });
38
- if (index === -1)
39
- return [null, allChild];
34
+ if (index === -1) return [null, allChild];
40
35
  const candidate = allChild[index];
41
36
  const rest = allChild.filter((_, i) => i !== index);
42
37
  return [candidate, rest];
@@ -44,14 +39,10 @@ function getCode(children) {
44
39
  function getMatchingMdxType(children, mdxType) {
45
40
  const allChild = React.Children.toArray(children);
46
41
  const matchFn = (child) => {
47
- if (!React.isValidElement(child))
48
- return false;
49
- if (typeof child.type !== "function")
50
- return false;
51
- if (child.type.name === mdxType)
52
- return true;
53
- if ("mdxType" in child.type === false)
54
- return false;
42
+ if (!React.isValidElement(child)) return false;
43
+ if (typeof child.type !== "function") return false;
44
+ if (child.type.name === mdxType) return true;
45
+ if ("mdxType" in child.type === false) return false;
55
46
  return child.type.mdxType === mdxType;
56
47
  };
57
48
  const matches = allChild.filter(matchFn);
@@ -60,11 +51,9 @@ function getMatchingMdxType(children, mdxType) {
60
51
  }
61
52
  function getCodeChildren(children) {
62
53
  const [code, rest] = getCode(children);
63
- if (code)
64
- return [code, rest];
54
+ if (code) return [code, rest];
65
55
  const [codeStepper, rest2] = getMatchingMdxType(children, "CodeStepper");
66
- if (codeStepper.length > 0)
67
- return [codeStepper, rest2];
56
+ if (codeStepper.length > 0) return [codeStepper, rest2];
68
57
  const [codes, rest3] = getMatchingMdxType(children, "FilePane");
69
58
  return [codes, rest3];
70
59
  }
@@ -475,7 +464,7 @@ var DivWithHeading = styled5.div`
475
464
  margin-top: 0;
476
465
  }
477
466
  h2 strong {
478
- color: #f49676;
467
+ color: var(--color-secondary);
479
468
  font-weight: 400;
480
469
  }
481
470
  `;
@@ -617,7 +606,7 @@ var DivWithHeading2 = styled8.div`
617
606
  margin-top: 0;
618
607
  }
619
608
  h2 strong {
620
- color: #f49676;
609
+ color: var(--color-secondary);
621
610
  font-weight: 400;
622
611
  }
623
612
  `;
@@ -724,9 +713,12 @@ import "@fontsource/bitter/500.css";
724
713
  import "@fontsource/bitter/700.css";
725
714
  var theme_default = {
726
715
  colors: {
727
- primary: "white",
728
- secondary: "#F49676",
729
- tertiary: "#042F3B"
716
+ //primary: "white",
717
+ primary: "rgb(43,19,90)",
718
+ secondary: "rgb(86,212,248)",
719
+ // secondary: "#F49676",
720
+ // tertiary: "#042F3B",
721
+ tertiary: "rgb(43,19,90)"
730
722
  },
731
723
  fonts: {
732
724
  header: 'Bitter, "Helvetica Neue", Helvetica, Arial, sans-serif',
@@ -761,7 +753,7 @@ var template = ({ slideNumber, numberOfSlides }) => {
761
753
  };
762
754
 
763
755
  // src/components/map.tsx
764
- import React14 from "react";
756
+ import React15 from "react";
765
757
  import { mdxComponentMap } from "spectacle";
766
758
 
767
759
  // src/components/styled.tsx
@@ -781,7 +773,7 @@ var StyledImage = styled9(SpectacleImage)`
781
773
  var Image2 = (props) => /* @__PURE__ */ React12.createElement(FlexBox2, { margin: "0 0", padding: "0 0" }, /* @__PURE__ */ React12.createElement(StyledImage, { ...props }));
782
774
  var CustomHeading = styled9(Heading)`
783
775
  strong {
784
- color: #f49676;
776
+ color: var(--color-secondary);
785
777
  font-weight: 500;
786
778
  }
787
779
  `;
@@ -817,7 +809,7 @@ var HeadingThree = styled9.h3`
817
809
  margin-top: 0;
818
810
 
819
811
  strong {
820
- color: #f49676;
812
+ color: var(--color-secondary);
821
813
  font-weight: 500;
822
814
  }
823
815
  `;
@@ -836,30 +828,26 @@ function range(start, end) {
836
828
  }
837
829
  function parseRangeList(str) {
838
830
  return str.split(",").reduce((acc, line) => {
839
- if (!line.includes("-"))
840
- return [...acc, parseInt(line, 10)];
831
+ if (!line.includes("-")) return [...acc, parseInt(line, 10)];
841
832
  const [start, end] = line.split("-").map(Number);
842
833
  return [...acc, ...range(start, end)];
843
834
  }, []);
844
835
  }
845
836
  function parseShowLines(directive) {
846
837
  const match = directive.match(/showLines\((.*)\)/);
847
- if (!match)
848
- return null;
838
+ if (!match) return null;
849
839
  const lines = parseRangeList(match[1]);
850
840
  return { showLines: lines };
851
841
  }
852
842
  function parseHighlight(directive) {
853
843
  const match = directive.match(/highlight\((.*)\)/);
854
- if (!match)
855
- return null;
844
+ if (!match) return null;
856
845
  const lines = parseRangeList(match[1]);
857
846
  return { highlight: lines };
858
847
  }
859
848
  function parseName(directive) {
860
849
  const match = directive.match(/name\("(.*)"\)/);
861
- if (!match)
862
- return null;
850
+ if (!match) return null;
863
851
  return { name: match[1] };
864
852
  }
865
853
  function parseStepDirective(directive) {
@@ -872,8 +860,7 @@ function parseStepDirective(directive) {
872
860
  }
873
861
  function combineStepDirectives(directives) {
874
862
  let hiddenLines = directives.reduce((acc, { showLines }) => {
875
- if (!showLines)
876
- return acc;
863
+ if (!showLines) return acc;
877
864
  return [...acc, ...showLines];
878
865
  }, []);
879
866
  return directives.map(({ highlight, showLines, name }) => {
@@ -904,11 +891,11 @@ var CodeContainer = styled10.div`
904
891
  &:before {
905
892
  content: " ";
906
893
  position: absolute;
907
- background-color: #f4967688;
894
+ background-color: rgba(var(--color-primary-rgb), 0.5);
908
895
  }
909
896
 
910
897
  &[data-step-active="true"]:before {
911
- background-color: #f49676;
898
+ background-color: var(--color-secondary);
912
899
  }
913
900
  }
914
901
  `;
@@ -1020,64 +1007,114 @@ function CodeStepper({
1020
1007
  alwaysVisible: !hasSteps,
1021
1008
  priority: priority ? priority + 1 : void 0
1022
1009
  },
1023
- (step, _, isActive) => /* @__PURE__ */ React13.createElement(
1024
- CodeWrapper,
1025
- {
1026
- name,
1027
- stepName: step == null ? void 0 : step.name,
1028
- hasName
1029
- },
1030
- /* @__PURE__ */ React13.createElement(
1031
- Highlighter,
1010
+ (step, _, isActive) => {
1011
+ console.log({ step, isActive });
1012
+ return /* @__PURE__ */ React13.createElement(
1013
+ CodeWrapper,
1032
1014
  {
1033
- language,
1034
- wrapLines: true,
1035
- showLineNumbers: true,
1036
- style: gruvboxDark,
1037
- lineNumberStyle: (lineNumber) => {
1038
- const { highlight = [] } = step || {};
1039
- const isHighlighted = highlight.includes(lineNumber);
1040
- return {
1041
- fontWeight: isHighlighted ? "bold" : "normal"
1042
- };
1043
- },
1044
- lineProps: (lineNumber) => {
1045
- const { hiddenLines = [], highlight = [] } = step || {};
1046
- const isVisible = hasSteps && isActive ? !hiddenLines.includes(lineNumber) : isActive || !hasSteps;
1047
- const isHighlighted = highlight.includes(lineNumber);
1048
- const getOpacity = () => {
1049
- if (!isVisible)
1050
- return 0;
1051
- if (isHighlighted || !highlight.length)
1052
- return 1;
1053
- return 0.8;
1054
- };
1055
- return {
1056
- ...isHighlighted && {
1057
- "data-highlight-line": isHighlighted,
1058
- "data-step-active": isActive
1059
- },
1060
- style: {
1061
- opacity: getOpacity(),
1062
- transition: "all 0.3s ease",
1063
- display: "block",
1064
- width: "100%",
1065
- backgroundColor: isHighlighted ? "#f4967622" : ""
1066
- }
1067
- };
1068
- }
1015
+ name,
1016
+ stepName: step == null ? void 0 : step.name,
1017
+ hasName
1069
1018
  },
1070
- codeNormalized
1071
- )
1072
- )
1019
+ /* @__PURE__ */ React13.createElement(
1020
+ Highlighter,
1021
+ {
1022
+ language,
1023
+ wrapLines: true,
1024
+ showLineNumbers: true,
1025
+ style: gruvboxDark,
1026
+ lineNumberStyle: (lineNumber) => {
1027
+ const { highlight = [] } = step || {};
1028
+ const isHighlighted = highlight.includes(lineNumber);
1029
+ return {
1030
+ fontWeight: isHighlighted ? "bold" : "normal"
1031
+ };
1032
+ },
1033
+ lineProps: (lineNumber) => {
1034
+ const { hiddenLines = [], highlight = [] } = step || {};
1035
+ const isVisible = hasSteps && isActive ? !hiddenLines.includes(lineNumber) : isActive || !hasSteps;
1036
+ const isHighlighted = highlight.includes(lineNumber);
1037
+ const getOpacity = () => {
1038
+ if (!isVisible) return 0;
1039
+ if (isHighlighted || !highlight.length) return 1;
1040
+ return 0.8;
1041
+ };
1042
+ return {
1043
+ ...isHighlighted && {
1044
+ "data-highlight-line": isHighlighted,
1045
+ "data-step-active": isActive
1046
+ },
1047
+ style: {
1048
+ opacity: getOpacity(),
1049
+ transition: "all 0.3s ease",
1050
+ display: "block",
1051
+ width: "100%",
1052
+ backgroundColor: isHighlighted ? "rgba(var(--color-secondary-rgb), 0.13)" : ""
1053
+ }
1054
+ };
1055
+ }
1056
+ },
1057
+ codeNormalized
1058
+ )
1059
+ );
1060
+ }
1073
1061
  ));
1074
1062
  }
1075
1063
  CodeStepper.mdxType = "CodeStepper";
1076
1064
 
1065
+ // src/components/QRCode.tsx
1066
+ import QrCreator from "qr-creator";
1067
+ import React14, { useContext } from "react";
1068
+ import { DeckContext } from "spectacle";
1069
+ var MapSize = {
1070
+ xs: 64,
1071
+ sm: 128,
1072
+ md: 256,
1073
+ lg: 512
1074
+ };
1075
+ function QRCode({ url, size = "md" }) {
1076
+ var _a, _b;
1077
+ const id = React14.useId().replace(/:/g, "___");
1078
+ const deck = useContext(DeckContext);
1079
+ const width = MapSize[size];
1080
+ const backgroundColor = ((_b = (_a = deck.theme) == null ? void 0 : _a.colors) == null ? void 0 : _b.primary) || "#ffffff";
1081
+ React14.useEffect(() => {
1082
+ var _a2, _b2;
1083
+ const element = document.querySelector(`#${id}`);
1084
+ if (!element) return console.error("QRCode element not mounted");
1085
+ QrCreator.render(
1086
+ {
1087
+ text: url,
1088
+ radius: 0.5,
1089
+ ecLevel: "H",
1090
+ // L, M, Q, H
1091
+ fill: ((_b2 = (_a2 = deck.theme) == null ? void 0 : _a2.colors) == null ? void 0 : _b2.secondary) || "#000000",
1092
+ background: backgroundColor,
1093
+ size: width
1094
+ },
1095
+ element
1096
+ );
1097
+ return () => {
1098
+ element.replaceChildren();
1099
+ };
1100
+ }, [url]);
1101
+ return /* @__PURE__ */ React14.createElement(
1102
+ "div",
1103
+ {
1104
+ id,
1105
+ style: {
1106
+ padding: "1rem 1rem 0.6rem 1rem",
1107
+ borderRadius: "1rem",
1108
+ backgroundColor
1109
+ }
1110
+ }
1111
+ );
1112
+ }
1113
+
1077
1114
  // src/components/map.tsx
1078
1115
  var componentsMap = {
1079
1116
  ...mdxComponentMap,
1080
- inlineCode: (props) => /* @__PURE__ */ React14.createElement(
1117
+ inlineCode: (props) => /* @__PURE__ */ React15.createElement(
1081
1118
  InlineCode,
1082
1119
  {
1083
1120
  ...props,
@@ -1087,7 +1124,7 @@ var componentsMap = {
1087
1124
  }
1088
1125
  }
1089
1126
  ),
1090
- table: (props) => /* @__PURE__ */ React14.createElement(
1127
+ table: (props) => /* @__PURE__ */ React15.createElement(
1091
1128
  "table",
1092
1129
  {
1093
1130
  ...props,
@@ -1098,7 +1135,7 @@ var componentsMap = {
1098
1135
  }
1099
1136
  }
1100
1137
  ),
1101
- tr: (props) => /* @__PURE__ */ React14.createElement(
1138
+ tr: (props) => /* @__PURE__ */ React15.createElement(
1102
1139
  "tr",
1103
1140
  {
1104
1141
  ...props,
@@ -1110,7 +1147,7 @@ var componentsMap = {
1110
1147
  }
1111
1148
  }
1112
1149
  ),
1113
- td: (props) => /* @__PURE__ */ React14.createElement(
1150
+ td: (props) => /* @__PURE__ */ React15.createElement(
1114
1151
  "td",
1115
1152
  {
1116
1153
  ...props,
@@ -1123,7 +1160,7 @@ var componentsMap = {
1123
1160
  }
1124
1161
  }
1125
1162
  ),
1126
- h1: (props) => /* @__PURE__ */ React14.createElement(
1163
+ h1: (props) => /* @__PURE__ */ React15.createElement(
1127
1164
  CustomHeading,
1128
1165
  {
1129
1166
  fontSize: "h1",
@@ -1139,15 +1176,15 @@ var componentsMap = {
1139
1176
  },
1140
1177
  props.children
1141
1178
  ),
1142
- h2: (props) => /* @__PURE__ */ React14.createElement(HeadingTwo, null, props.children),
1143
- h3: (props) => /* @__PURE__ */ React14.createElement(HeadingThree, { ...props }),
1144
- img: (props) => /* @__PURE__ */ React14.createElement(Image2, { ...props }),
1179
+ h2: (props) => /* @__PURE__ */ React15.createElement(HeadingTwo, null, props.children),
1180
+ h3: (props) => /* @__PURE__ */ React15.createElement(HeadingThree, { ...props }),
1181
+ img: (props) => /* @__PURE__ */ React15.createElement(Image2, { ...props }),
1145
1182
  pre: CodeStepper,
1146
- li: (props) => /* @__PURE__ */ React14.createElement("li", { ...props, style: { margin: "24px 0" } }),
1147
- Side: (props) => /* @__PURE__ */ React14.createElement("div", { ...props }),
1183
+ li: (props) => /* @__PURE__ */ React15.createElement("li", { ...props, style: { margin: "24px 0" } }),
1184
+ Side: (props) => /* @__PURE__ */ React15.createElement("div", { ...props }),
1148
1185
  p: (props) => {
1149
1186
  const Text = mdxComponentMap.p;
1150
- return /* @__PURE__ */ React14.createElement(
1187
+ return /* @__PURE__ */ React15.createElement(
1151
1188
  Text,
1152
1189
  {
1153
1190
  style: { margin: "8px 0", padding: "8px 0", lineHeight: "2rem" },
@@ -1155,36 +1192,117 @@ var componentsMap = {
1155
1192
  }
1156
1193
  );
1157
1194
  },
1158
- blockquote: (props) => /* @__PURE__ */ React14.createElement(CustomQuote, { ...props }),
1195
+ blockquote: (props) => /* @__PURE__ */ React15.createElement(CustomQuote, { ...props }),
1159
1196
  a: ({ children, ...props }) => {
1160
1197
  const domain = new URL(props.href || "").hostname;
1161
- return /* @__PURE__ */ React14.createElement("a", { ...props, style: { color: "#f49676", textDecoration: "none" } }, children, " ", /* @__PURE__ */ React14.createElement(
1162
- "small",
1198
+ return /* @__PURE__ */ React15.createElement(
1199
+ "a",
1163
1200
  {
1164
- style: {
1165
- color: "#ffffff44"
1166
- }
1201
+ ...props,
1202
+ style: { color: "var(--color-secondary)", textDecoration: "none" }
1167
1203
  },
1168
- "(",
1169
- domain,
1170
- ")"
1171
- ));
1204
+ children,
1205
+ " ",
1206
+ /* @__PURE__ */ React15.createElement(
1207
+ "small",
1208
+ {
1209
+ style: {
1210
+ color: "#ffffff44"
1211
+ }
1212
+ },
1213
+ "(",
1214
+ domain,
1215
+ ")"
1216
+ )
1217
+ );
1218
+ },
1219
+ directive: (props) => {
1220
+ if (props._name === "qrcode") {
1221
+ const url = React15.Children.toArray(props.children)[0].props.href;
1222
+ return /* @__PURE__ */ React15.createElement(QRCode, { url });
1223
+ }
1224
+ return /* @__PURE__ */ React15.createElement("div", { ...props });
1172
1225
  }
1173
1226
  };
1174
1227
  var map_default = componentsMap;
1175
1228
 
1229
+ // src/index.tsx
1230
+ import { createGlobalStyle } from "styled-components";
1231
+
1232
+ // src/SlideWrapper.tsx
1233
+ import React17 from "react";
1234
+
1235
+ // src/context.tsx
1236
+ import React16 from "react";
1237
+ var PestacleContext = React16.createContext(void 0);
1238
+ function usePestacle() {
1239
+ const context = React16.useContext(PestacleContext);
1240
+ if (!context) {
1241
+ throw new Error("usePestacle must be used within a PestacleProvider");
1242
+ }
1243
+ return context;
1244
+ }
1245
+ function PestacleProvider({
1246
+ children,
1247
+ layouts: layouts2
1248
+ }) {
1249
+ return /* @__PURE__ */ React16.createElement(PestacleContext.Provider, { value: { layouts: layouts2 } }, children);
1250
+ }
1251
+
1252
+ // src/SlideWrapper.tsx
1253
+ function SlideWrapper({
1254
+ children,
1255
+ frontmatter
1256
+ }) {
1257
+ const { layouts: layouts2 } = usePestacle();
1258
+ const layout = (frontmatter == null ? void 0 : frontmatter.layout) || "default";
1259
+ console.log(layouts2, layout);
1260
+ const Layout = layout in layouts2 ? layouts2[layout] : null;
1261
+ if (layout && !Layout) {
1262
+ console.warn(`Layout ${layout} not found`);
1263
+ }
1264
+ if (Layout) {
1265
+ return /* @__PURE__ */ React17.createElement(Layout, { ...frontmatter }, children);
1266
+ }
1267
+ return /* @__PURE__ */ React17.createElement(React17.Fragment, null, children);
1268
+ }
1269
+
1270
+ // src/colors.ts
1271
+ function extractColors(color) {
1272
+ if (color.startsWith("rgb")) {
1273
+ const [r, g, b] = color.replace("rgb(", "").replace("rgba(", "").replace(")", "").split(",").map((c) => parseInt(c.trim(), 10));
1274
+ return { r, g, b };
1275
+ } else if (color.startsWith("#")) {
1276
+ const hex = color.replace("#", "");
1277
+ const r = parseInt(hex.substring(0, 2), 16);
1278
+ const g = parseInt(hex.substring(2, 4), 16);
1279
+ const b = parseInt(hex.substring(4, 6), 16);
1280
+ return { r, g, b };
1281
+ }
1282
+ throw new Error(`Invalid color format: ${color}`);
1283
+ }
1284
+ function createCssVariables(colors) {
1285
+ const base = Object.entries(colors).map(([key, value]) => `--color-${key}: ${value};`).join("\n");
1286
+ const rgbs = Object.entries(colors).map(([key, value]) => {
1287
+ const { r, g, b } = extractColors(value);
1288
+ return `--color-${key}-rgb: ${r}, ${g}, ${b};`;
1289
+ }).join("\n");
1290
+ return `${base}
1291
+ ${rgbs}`;
1292
+ }
1293
+
1176
1294
  // src/index.tsx
1177
1295
  export * from "spectacle";
1178
1296
 
1179
1297
  // src/components/FilePane.tsx
1180
- import React15 from "react";
1298
+ import React18 from "react";
1181
1299
  function FilePane({
1182
1300
  name,
1183
1301
  children,
1184
1302
  priority,
1185
1303
  ...divProps
1186
1304
  }) {
1187
- return React15.isValidElement(children) ? React15.cloneElement(children, {
1305
+ return React18.isValidElement(children) ? React18.cloneElement(children, {
1188
1306
  // @ts-expect-error cloning
1189
1307
  priority,
1190
1308
  name
@@ -1193,14 +1311,14 @@ function FilePane({
1193
1311
  FilePane.mdxType = "FilePane";
1194
1312
 
1195
1313
  // src/components/ItemsColumn.tsx
1196
- import React16 from "react";
1314
+ import React19 from "react";
1197
1315
  import { Stepper as Stepper2 } from "spectacle";
1198
1316
  import styled11 from "styled-components";
1199
1317
  import { useSpring, animated } from "react-spring";
1200
1318
  function ItemsColumn(divProps) {
1201
1319
  const { style: style2, children, ...props } = divProps;
1202
- const childrenArray = React16.Children.toArray(children);
1203
- return /* @__PURE__ */ React16.createElement(Stepper2, { values: childrenArray }, (value, step) => /* @__PURE__ */ React16.createElement(
1320
+ const childrenArray = React19.Children.toArray(children);
1321
+ return /* @__PURE__ */ React19.createElement(Stepper2, { values: childrenArray }, (value, step) => /* @__PURE__ */ React19.createElement(
1204
1322
  "div",
1205
1323
  {
1206
1324
  style: {
@@ -1216,10 +1334,10 @@ function ItemsColumn(divProps) {
1216
1334
  },
1217
1335
  childrenArray.map((child, index) => {
1218
1336
  const isVisible = index <= step;
1219
- if (!React16.isValidElement(child)) {
1337
+ if (!React19.isValidElement(child)) {
1220
1338
  return child;
1221
1339
  }
1222
- return /* @__PURE__ */ React16.createElement(ItemColumnWrapper, { key: index, isVisible }, child);
1340
+ return /* @__PURE__ */ React19.createElement(ItemColumnWrapper, { key: index, isVisible }, child);
1223
1341
  })
1224
1342
  ));
1225
1343
  }
@@ -1236,11 +1354,11 @@ function ItemColumnWrapper({
1236
1354
  ...props
1237
1355
  }) {
1238
1356
  const styles = useSpring({ opacity: isVisible ? 1 : 0 });
1239
- return /* @__PURE__ */ React16.createElement(ItemColumnWrapperStyled, { style: styles, ...props }, children);
1357
+ return /* @__PURE__ */ React19.createElement(ItemColumnWrapperStyled, { style: styles, ...props }, children);
1240
1358
  }
1241
1359
 
1242
1360
  // src/components/DocumentationItem.tsx
1243
- import React17 from "react";
1361
+ import React20 from "react";
1244
1362
  import styled12 from "styled-components";
1245
1363
  var DocWrapper = styled12.div`
1246
1364
  position: absolute;
@@ -1266,8 +1384,8 @@ var DocContainer = styled12.div`
1266
1384
  var DocLink = styled12.a`
1267
1385
  text-decoration: none;
1268
1386
  font-weight: normal;
1269
- font-family: Bitter, "Helvetica Neue", Helvetica, Arial, sans-serif;
1270
- color: #f49676;
1387
+ font-family: var(--font-family);
1388
+ color: var(--color-secondary);
1271
1389
  `;
1272
1390
  var DocLinkItem = styled12(DocLink)`
1273
1391
  width: fit-content;
@@ -1293,14 +1411,14 @@ function Doc({
1293
1411
  link,
1294
1412
  children
1295
1413
  }) {
1296
- return /* @__PURE__ */ React17.createElement(DocWrapper, null, /* @__PURE__ */ React17.createElement(DocContainer, null, children && /* @__PURE__ */ React17.createElement(DocContent, null, children), /* @__PURE__ */ React17.createElement("div", null, /* @__PURE__ */ React17.createElement(DocLink, { target: "_blank", rel: "noopener noreferrer", href: link }, label))));
1414
+ return /* @__PURE__ */ React20.createElement(DocWrapper, null, /* @__PURE__ */ React20.createElement(DocContainer, null, children && /* @__PURE__ */ React20.createElement(DocContent, null, children), /* @__PURE__ */ React20.createElement("div", null, /* @__PURE__ */ React20.createElement(DocLink, { target: "_blank", rel: "noopener noreferrer", href: link }, label))));
1297
1415
  }
1298
1416
  function DocItem({ label, link }) {
1299
- return /* @__PURE__ */ React17.createElement(DocLinkItem, { target: "_blank", rel: "noopener noreferrer", href: link }, label);
1417
+ return /* @__PURE__ */ React20.createElement(DocLinkItem, { target: "_blank", rel: "noopener noreferrer", href: link }, label);
1300
1418
  }
1301
1419
 
1302
1420
  // src/components/HorizontalList.tsx
1303
- import React18 from "react";
1421
+ import React21 from "react";
1304
1422
  import { animated as animated2, useSpring as useSpring2 } from "react-spring";
1305
1423
  import { Stepper as Stepper3 } from "spectacle";
1306
1424
  import styled13 from "styled-components";
@@ -1312,8 +1430,8 @@ function HorizontalList({
1312
1430
  children,
1313
1431
  columns = 3
1314
1432
  }) {
1315
- const items = React18.Children.toArray(children);
1316
- return /* @__PURE__ */ React18.createElement(Stepper3, { values: items }, (_, step) => /* @__PURE__ */ React18.createElement(
1433
+ const items = React21.Children.toArray(children);
1434
+ return /* @__PURE__ */ React21.createElement(Stepper3, { values: items }, (_, step) => /* @__PURE__ */ React21.createElement(
1317
1435
  Container,
1318
1436
  {
1319
1437
  style: {
@@ -1321,10 +1439,10 @@ function HorizontalList({
1321
1439
  }
1322
1440
  },
1323
1441
  items.map((item, k) => {
1324
- if (!React18.isValidElement(item)) {
1442
+ if (!React21.isValidElement(item)) {
1325
1443
  return item;
1326
1444
  }
1327
- return React18.cloneElement(item, {
1445
+ return React21.cloneElement(item, {
1328
1446
  // @ts-expect-error cloning
1329
1447
  position: k + 1,
1330
1448
  isVisible: k <= step,
@@ -1334,12 +1452,12 @@ function HorizontalList({
1334
1452
  ));
1335
1453
  }
1336
1454
  function Pill({ position }) {
1337
- return /* @__PURE__ */ React18.createElement(
1455
+ return /* @__PURE__ */ React21.createElement(
1338
1456
  "div",
1339
1457
  {
1340
1458
  style: { width: 48, transform: "translate(-25%, -25%)", opacity: 0.9 }
1341
1459
  },
1342
- /* @__PURE__ */ React18.createElement(
1460
+ /* @__PURE__ */ React21.createElement(
1343
1461
  "svg",
1344
1462
  {
1345
1463
  width: "48",
@@ -1348,14 +1466,14 @@ function Pill({ position }) {
1348
1466
  fill: "none",
1349
1467
  xmlns: "http://www.w3.org/2000/svg"
1350
1468
  },
1351
- /* @__PURE__ */ React18.createElement(
1469
+ /* @__PURE__ */ React21.createElement(
1352
1470
  "path",
1353
1471
  {
1354
1472
  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",
1355
1473
  fill: "#ffffff"
1356
1474
  }
1357
1475
  ),
1358
- /* @__PURE__ */ React18.createElement(
1476
+ /* @__PURE__ */ React21.createElement(
1359
1477
  "text",
1360
1478
  {
1361
1479
  x: "9",
@@ -1367,7 +1485,7 @@ function Pill({ position }) {
1367
1485
  },
1368
1486
  position
1369
1487
  ),
1370
- /* @__PURE__ */ React18.createElement(
1488
+ /* @__PURE__ */ React21.createElement(
1371
1489
  "path",
1372
1490
  {
1373
1491
  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",
@@ -1404,10 +1522,8 @@ function getItemOpacity({
1404
1522
  isLast,
1405
1523
  isVisible
1406
1524
  }) {
1407
- if (isLast)
1408
- return 1;
1409
- if (isVisible)
1410
- return 0.7;
1525
+ if (isLast) return 1;
1526
+ if (isVisible) return 0.7;
1411
1527
  return 0;
1412
1528
  }
1413
1529
  function HorizontalListItem({
@@ -1420,11 +1536,11 @@ function HorizontalListItem({
1420
1536
  const opacityStyles = useSpring2({
1421
1537
  opacity: getItemOpacity({ isVisible, isLast })
1422
1538
  });
1423
- return /* @__PURE__ */ React18.createElement(Item, { style: opacityStyles }, /* @__PURE__ */ React18.createElement(ItemHead, null, /* @__PURE__ */ React18.createElement(Pill, { position }), /* @__PURE__ */ React18.createElement("p", null, title)), /* @__PURE__ */ React18.createElement(ItemContent, null, children));
1539
+ return /* @__PURE__ */ React21.createElement(Item, { style: opacityStyles }, /* @__PURE__ */ React21.createElement(ItemHead, null, /* @__PURE__ */ React21.createElement(Pill, { position }), /* @__PURE__ */ React21.createElement("p", null, title)), /* @__PURE__ */ React21.createElement(ItemContent, null, children));
1424
1540
  }
1425
1541
 
1426
1542
  // src/components/Timeline.tsx
1427
- import React19 from "react";
1543
+ import React22 from "react";
1428
1544
  import { animated as animated3, useSpring as useSpring3 } from "react-spring";
1429
1545
  import { Stepper as Stepper4 } from "spectacle";
1430
1546
 
@@ -1498,8 +1614,8 @@ var style = {
1498
1614
  alignItems: "center"
1499
1615
  };
1500
1616
  function Timeline(props) {
1501
- const children = React19.Children.toArray(props.children);
1502
- return /* @__PURE__ */ React19.createElement(
1617
+ const children = React22.Children.toArray(props.children);
1618
+ return /* @__PURE__ */ React22.createElement(
1503
1619
  Stepper4,
1504
1620
  {
1505
1621
  ...props,
@@ -1509,10 +1625,10 @@ function Timeline(props) {
1509
1625
  },
1510
1626
  (value, step) => {
1511
1627
  return children.map((child, index) => {
1512
- if (!React19.isValidElement(child)) {
1628
+ if (!React22.isValidElement(child)) {
1513
1629
  return child;
1514
1630
  }
1515
- return React19.cloneElement(child, {
1631
+ return React22.cloneElement(child, {
1516
1632
  // @ts-expect-error cloning
1517
1633
  isPhantom: step < index,
1518
1634
  isLast: step === index
@@ -1525,10 +1641,8 @@ function getItemOpacity2({
1525
1641
  isLast,
1526
1642
  isPhantom
1527
1643
  }) {
1528
- if (isPhantom)
1529
- return 0;
1530
- if (isLast)
1531
- return 1;
1644
+ if (isPhantom) return 0;
1645
+ if (isLast) return 1;
1532
1646
  return 0.5;
1533
1647
  }
1534
1648
  function TimelineItem(props) {
@@ -1540,7 +1654,7 @@ function TimelineItem(props) {
1540
1654
  opacity: getItemOpacity2({ isPhantom, isLast })
1541
1655
  });
1542
1656
  const colorStyles = useSpring3({ opacity: isPhantom || isLast ? 1 : 0.15 });
1543
- return /* @__PURE__ */ React19.createElement(
1657
+ return /* @__PURE__ */ React22.createElement(
1544
1658
  TimelineItemStyled,
1545
1659
  {
1546
1660
  ...rest,
@@ -1548,13 +1662,13 @@ function TimelineItem(props) {
1548
1662
  ...appearStyles
1549
1663
  }
1550
1664
  },
1551
- /* @__PURE__ */ React19.createElement(TimelineItemContentPhantom, null, /* @__PURE__ */ React19.createElement(TimelineItemTitle, null, title), /* @__PURE__ */ React19.createElement(TimelineItemBody, null, children)),
1552
- /* @__PURE__ */ React19.createElement(TimelineItemGuide, { style: colorStyles }, /* @__PURE__ */ React19.createElement(Hexagon, null), /* @__PURE__ */ React19.createElement(TimelineItemGuideLine, { style: guideLineProps })),
1553
- /* @__PURE__ */ React19.createElement(TimelineItemContent, null, /* @__PURE__ */ React19.createElement(TimelineItemTitle, null, title), /* @__PURE__ */ React19.createElement(TimelineItemBody, null, children))
1665
+ /* @__PURE__ */ React22.createElement(TimelineItemContentPhantom, null, /* @__PURE__ */ React22.createElement(TimelineItemTitle, null, title), /* @__PURE__ */ React22.createElement(TimelineItemBody, null, children)),
1666
+ /* @__PURE__ */ React22.createElement(TimelineItemGuide, { style: colorStyles }, /* @__PURE__ */ React22.createElement(Hexagon, null), /* @__PURE__ */ React22.createElement(TimelineItemGuideLine, { style: guideLineProps })),
1667
+ /* @__PURE__ */ React22.createElement(TimelineItemContent, null, /* @__PURE__ */ React22.createElement(TimelineItemTitle, null, title), /* @__PURE__ */ React22.createElement(TimelineItemBody, null, children))
1554
1668
  );
1555
1669
  }
1556
1670
  function Hexagon() {
1557
- return /* @__PURE__ */ React19.createElement(
1671
+ return /* @__PURE__ */ React22.createElement(
1558
1672
  "svg",
1559
1673
  {
1560
1674
  width: "18",
@@ -1563,14 +1677,14 @@ function Hexagon() {
1563
1677
  fill: "none",
1564
1678
  xmlns: "http://www.w3.org/2000/svg"
1565
1679
  },
1566
- /* @__PURE__ */ React19.createElement(
1680
+ /* @__PURE__ */ React22.createElement(
1567
1681
  "path",
1568
1682
  {
1569
1683
  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",
1570
1684
  fill: "#F49676"
1571
1685
  }
1572
1686
  ),
1573
- /* @__PURE__ */ React19.createElement(
1687
+ /* @__PURE__ */ React22.createElement(
1574
1688
  "path",
1575
1689
  {
1576
1690
  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",
@@ -1581,7 +1695,7 @@ function Hexagon() {
1581
1695
  }
1582
1696
 
1583
1697
  // src/components/IconBox.tsx
1584
- import React20 from "react";
1698
+ import React23 from "react";
1585
1699
  import styled16 from "styled-components";
1586
1700
  var IconBoxContent = styled16.div`
1587
1701
  * {
@@ -1593,7 +1707,7 @@ function IconBox({
1593
1707
  children,
1594
1708
  icon
1595
1709
  }) {
1596
- return /* @__PURE__ */ React20.createElement(
1710
+ return /* @__PURE__ */ React23.createElement(
1597
1711
  "div",
1598
1712
  {
1599
1713
  style: {
@@ -1603,63 +1717,70 @@ function IconBox({
1603
1717
  padding: "1rem 0"
1604
1718
  }
1605
1719
  },
1606
- /* @__PURE__ */ React20.createElement("div", { style: { fontSize: 60 } }, icon),
1607
- /* @__PURE__ */ React20.createElement(IconBoxContent, null, children)
1720
+ /* @__PURE__ */ React23.createElement("div", { style: { fontSize: 60 } }, icon),
1721
+ /* @__PURE__ */ React23.createElement(IconBoxContent, null, children)
1608
1722
  );
1609
1723
  }
1610
1724
 
1611
1725
  // src/index.tsx
1612
1726
  function PassThrough({ children }) {
1613
- return /* @__PURE__ */ React21.createElement(React21.Fragment, null, children);
1614
- }
1615
- function Layout({
1616
- children,
1617
- frontmatter
1618
- }) {
1619
- const layout = (frontmatter == null ? void 0 : frontmatter.layout) || "default";
1620
- const Layout2 = layout in layouts_default ? layouts_default[layout] : null;
1621
- if (layout && !Layout2) {
1622
- console.warn(`Layout ${layout} not found`);
1623
- }
1624
- if (Layout2) {
1625
- return /* @__PURE__ */ React21.createElement(Layout2, { ...frontmatter }, children);
1626
- }
1627
- return /* @__PURE__ */ React21.createElement(React21.Fragment, null, children);
1727
+ return /* @__PURE__ */ React24.createElement(React24.Fragment, null, children);
1628
1728
  }
1729
+ var layouts = layouts_default;
1629
1730
  var componentsMap2 = {
1630
1731
  ...map_default,
1631
- wrapper: Layout
1732
+ wrapper: SlideWrapper
1632
1733
  };
1633
- function Deck({ deck }) {
1634
- React21.useEffect(() => {
1734
+ function Deck({
1735
+ deck,
1736
+ theme,
1737
+ layouts: layouts2 = layouts_default
1738
+ }) {
1739
+ React24.useEffect(() => {
1635
1740
  document.title = deck.metadata.title || "Untitled";
1636
1741
  }, [deck.metadata.title]);
1637
- return /* @__PURE__ */ React21.createElement(React21.StrictMode, null, /* @__PURE__ */ React21.createElement(MDXProvider, { components: componentsMap2 }, /* @__PURE__ */ React21.createElement(SpectacleDeck, { theme: theme_default, template }, deck.slides.map((slide, i) => {
1638
- const Component = slide.slideComponent;
1639
- return /* @__PURE__ */ React21.createElement(Slide, { key: i }, /* @__PURE__ */ React21.createElement(Component, null));
1640
- }))));
1742
+ const GlobalStyle = React24.useMemo(() => {
1743
+ const cssVariables = createCssVariables(theme.themeTokens.colors);
1744
+ return createGlobalStyle`
1745
+ :root {
1746
+ ${cssVariables}
1747
+ --font-family: ${theme_default.fonts.text}
1748
+ }
1749
+ `;
1750
+ }, [theme]);
1751
+ return /* @__PURE__ */ React24.createElement(React24.StrictMode, null, /* @__PURE__ */ React24.createElement(PestacleProvider, { layouts: layouts2 }, /* @__PURE__ */ React24.createElement(MDXProvider, { components: componentsMap2 }, /* @__PURE__ */ React24.createElement(GlobalStyle, null), /* @__PURE__ */ React24.createElement(
1752
+ SpectacleDeck,
1753
+ {
1754
+ theme: { ...theme_default, ...theme.themeTokens },
1755
+ template
1756
+ },
1757
+ deck.slides.map((slide, i) => {
1758
+ const Component = slide.slideComponent;
1759
+ return /* @__PURE__ */ React24.createElement(Slide, { key: i }, /* @__PURE__ */ React24.createElement(Component, null));
1760
+ })
1761
+ ))));
1641
1762
  }
1642
1763
  function Danger({ children }) {
1643
- return /* @__PURE__ */ React21.createElement("div", { style: { color: "red" } }, children);
1764
+ return /* @__PURE__ */ React24.createElement("div", { style: { color: "red" } }, children);
1644
1765
  }
1645
1766
  function Information({ children }) {
1646
- return /* @__PURE__ */ React21.createElement("div", { style: { color: "orange" } }, children);
1767
+ return /* @__PURE__ */ React24.createElement("div", { style: { color: "orange" } }, children);
1647
1768
  }
1648
1769
  function Success({ children }) {
1649
- return /* @__PURE__ */ React21.createElement("div", { style: { color: "green" } }, children);
1770
+ return /* @__PURE__ */ React24.createElement("div", { style: { color: "green" } }, children);
1650
1771
  }
1651
1772
  function Warning({ children }) {
1652
- return /* @__PURE__ */ React21.createElement("div", { style: { color: "yellow" } }, children);
1773
+ return /* @__PURE__ */ React24.createElement("div", { style: { color: "yellow" } }, children);
1653
1774
  }
1654
1775
  function Side({ children }) {
1655
- return /* @__PURE__ */ React21.createElement("div", null, children);
1776
+ return /* @__PURE__ */ React24.createElement("div", null, children);
1656
1777
  }
1657
1778
  Side.mdxType = "Side";
1658
1779
  function Documentation({ children }) {
1659
- return /* @__PURE__ */ React21.createElement("div", null, children);
1780
+ return /* @__PURE__ */ React24.createElement("div", null, children);
1660
1781
  }
1661
1782
  function Box2({ children }) {
1662
- return /* @__PURE__ */ React21.createElement("div", null, children);
1783
+ return /* @__PURE__ */ React24.createElement("div", null, children);
1663
1784
  }
1664
1785
  export {
1665
1786
  Box2 as Box,
@@ -1675,11 +1796,11 @@ export {
1675
1796
  Image,
1676
1797
  Information,
1677
1798
  ItemsColumn,
1678
- Layout,
1679
1799
  PassThrough,
1680
1800
  Side,
1681
1801
  Success,
1682
1802
  Timeline,
1683
1803
  TimelineItem,
1684
- Warning
1804
+ Warning,
1805
+ layouts
1685
1806
  };