@gpichot/spectacle-deck 1.1.6 → 1.2.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/index.mjs CHANGED
@@ -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
  }
@@ -621,14 +610,20 @@ var DivWithHeading2 = styled8.div`
621
610
  font-weight: 400;
622
611
  }
623
612
  `;
613
+ function parseRatio(ratio) {
614
+ const [a, b] = ratio.split("/");
615
+ return { left: parseInt(a), right: parseInt(b) };
616
+ }
624
617
  var SidedImageLayout = ({
625
618
  children,
626
619
  image,
627
620
  position,
628
- height
621
+ height,
622
+ ratio: ratioProp
629
623
  }) => {
630
624
  const isReversed = position === "left";
631
625
  const [component, rest] = getMatchingMdxType(children, "Image") || image;
626
+ const ratio = parseRatio(ratioProp || "6/4");
632
627
  if (!image && !component.length) {
633
628
  console.error("No image provided for SidedImageLayout");
634
629
  return null;
@@ -650,7 +645,7 @@ var SidedImageLayout = ({
650
645
  "div",
651
646
  {
652
647
  style: {
653
- flex: "6 0",
648
+ flex: `${ratio.left || 6} 0`,
654
649
  display: "flex",
655
650
  flexDirection: "column",
656
651
  justifyContent: "center",
@@ -663,7 +658,7 @@ var SidedImageLayout = ({
663
658
  "div",
664
659
  {
665
660
  style: {
666
- flex: "4 0",
661
+ flex: `${ratio.right || 4} 0`,
667
662
  display: "flex",
668
663
  flexDirection: "column",
669
664
  justifyContent: "center",
@@ -718,9 +713,12 @@ import "@fontsource/bitter/500.css";
718
713
  import "@fontsource/bitter/700.css";
719
714
  var theme_default = {
720
715
  colors: {
721
- primary: "white",
722
- secondary: "#F49676",
723
- 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)"
724
722
  },
725
723
  fonts: {
726
724
  header: 'Bitter, "Helvetica Neue", Helvetica, Arial, sans-serif',
@@ -755,7 +753,7 @@ var template = ({ slideNumber, numberOfSlides }) => {
755
753
  };
756
754
 
757
755
  // src/components/map.tsx
758
- import React14 from "react";
756
+ import React15 from "react";
759
757
  import { mdxComponentMap } from "spectacle";
760
758
 
761
759
  // src/components/styled.tsx
@@ -775,7 +773,7 @@ var StyledImage = styled9(SpectacleImage)`
775
773
  var Image2 = (props) => /* @__PURE__ */ React12.createElement(FlexBox2, { margin: "0 0", padding: "0 0" }, /* @__PURE__ */ React12.createElement(StyledImage, { ...props }));
776
774
  var CustomHeading = styled9(Heading)`
777
775
  strong {
778
- color: #f49676;
776
+ color: var(--color-secondary);
779
777
  font-weight: 500;
780
778
  }
781
779
  `;
@@ -811,7 +809,7 @@ var HeadingThree = styled9.h3`
811
809
  margin-top: 0;
812
810
 
813
811
  strong {
814
- color: #f49676;
812
+ color: var(--color-secondary);
815
813
  font-weight: 500;
816
814
  }
817
815
  `;
@@ -830,30 +828,26 @@ function range(start, end) {
830
828
  }
831
829
  function parseRangeList(str) {
832
830
  return str.split(",").reduce((acc, line) => {
833
- if (!line.includes("-"))
834
- return [...acc, parseInt(line, 10)];
831
+ if (!line.includes("-")) return [...acc, parseInt(line, 10)];
835
832
  const [start, end] = line.split("-").map(Number);
836
833
  return [...acc, ...range(start, end)];
837
834
  }, []);
838
835
  }
839
836
  function parseShowLines(directive) {
840
837
  const match = directive.match(/showLines\((.*)\)/);
841
- if (!match)
842
- return null;
838
+ if (!match) return null;
843
839
  const lines = parseRangeList(match[1]);
844
840
  return { showLines: lines };
845
841
  }
846
842
  function parseHighlight(directive) {
847
843
  const match = directive.match(/highlight\((.*)\)/);
848
- if (!match)
849
- return null;
844
+ if (!match) return null;
850
845
  const lines = parseRangeList(match[1]);
851
846
  return { highlight: lines };
852
847
  }
853
848
  function parseName(directive) {
854
849
  const match = directive.match(/name\("(.*)"\)/);
855
- if (!match)
856
- return null;
850
+ if (!match) return null;
857
851
  return { name: match[1] };
858
852
  }
859
853
  function parseStepDirective(directive) {
@@ -866,8 +860,7 @@ function parseStepDirective(directive) {
866
860
  }
867
861
  function combineStepDirectives(directives) {
868
862
  let hiddenLines = directives.reduce((acc, { showLines }) => {
869
- if (!showLines)
870
- return acc;
863
+ if (!showLines) return acc;
871
864
  return [...acc, ...showLines];
872
865
  }, []);
873
866
  return directives.map(({ highlight, showLines, name }) => {
@@ -898,11 +891,11 @@ var CodeContainer = styled10.div`
898
891
  &:before {
899
892
  content: " ";
900
893
  position: absolute;
901
- background-color: #f4967688;
894
+ background-color: rgba(var(--color-primary-rgb), 0.5);
902
895
  }
903
896
 
904
897
  &[data-step-active="true"]:before {
905
- background-color: #f49676;
898
+ background-color: var(--color-secondary);
906
899
  }
907
900
  }
908
901
  `;
@@ -1014,64 +1007,114 @@ function CodeStepper({
1014
1007
  alwaysVisible: !hasSteps,
1015
1008
  priority: priority ? priority + 1 : void 0
1016
1009
  },
1017
- (step, _, isActive) => /* @__PURE__ */ React13.createElement(
1018
- CodeWrapper,
1019
- {
1020
- name,
1021
- stepName: step == null ? void 0 : step.name,
1022
- hasName
1023
- },
1024
- /* @__PURE__ */ React13.createElement(
1025
- Highlighter,
1010
+ (step, _, isActive) => {
1011
+ console.log({ step, isActive });
1012
+ return /* @__PURE__ */ React13.createElement(
1013
+ CodeWrapper,
1026
1014
  {
1027
- language,
1028
- wrapLines: true,
1029
- showLineNumbers: true,
1030
- style: gruvboxDark,
1031
- lineNumberStyle: (lineNumber) => {
1032
- const { highlight = [] } = step || {};
1033
- const isHighlighted = highlight.includes(lineNumber);
1034
- return {
1035
- fontWeight: isHighlighted ? "bold" : "normal"
1036
- };
1037
- },
1038
- lineProps: (lineNumber) => {
1039
- const { hiddenLines = [], highlight = [] } = step || {};
1040
- const isVisible = hasSteps && isActive ? !hiddenLines.includes(lineNumber) : isActive || !hasSteps;
1041
- const isHighlighted = highlight.includes(lineNumber);
1042
- const getOpacity = () => {
1043
- if (!isVisible)
1044
- return 0;
1045
- if (isHighlighted || !highlight.length)
1046
- return 1;
1047
- return 0.8;
1048
- };
1049
- return {
1050
- ...isHighlighted && {
1051
- "data-highlight-line": isHighlighted,
1052
- "data-step-active": isActive
1053
- },
1054
- style: {
1055
- opacity: getOpacity(),
1056
- transition: "all 0.3s ease",
1057
- display: "block",
1058
- width: "100%",
1059
- backgroundColor: isHighlighted ? "#f4967622" : ""
1060
- }
1061
- };
1062
- }
1015
+ name,
1016
+ stepName: step == null ? void 0 : step.name,
1017
+ hasName
1063
1018
  },
1064
- codeNormalized
1065
- )
1066
- )
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
+ }
1067
1061
  ));
1068
1062
  }
1069
1063
  CodeStepper.mdxType = "CodeStepper";
1070
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
+
1071
1114
  // src/components/map.tsx
1072
1115
  var componentsMap = {
1073
1116
  ...mdxComponentMap,
1074
- inlineCode: (props) => /* @__PURE__ */ React14.createElement(
1117
+ inlineCode: (props) => /* @__PURE__ */ React15.createElement(
1075
1118
  InlineCode,
1076
1119
  {
1077
1120
  ...props,
@@ -1081,7 +1124,7 @@ var componentsMap = {
1081
1124
  }
1082
1125
  }
1083
1126
  ),
1084
- table: (props) => /* @__PURE__ */ React14.createElement(
1127
+ table: (props) => /* @__PURE__ */ React15.createElement(
1085
1128
  "table",
1086
1129
  {
1087
1130
  ...props,
@@ -1092,7 +1135,7 @@ var componentsMap = {
1092
1135
  }
1093
1136
  }
1094
1137
  ),
1095
- tr: (props) => /* @__PURE__ */ React14.createElement(
1138
+ tr: (props) => /* @__PURE__ */ React15.createElement(
1096
1139
  "tr",
1097
1140
  {
1098
1141
  ...props,
@@ -1104,7 +1147,7 @@ var componentsMap = {
1104
1147
  }
1105
1148
  }
1106
1149
  ),
1107
- td: (props) => /* @__PURE__ */ React14.createElement(
1150
+ td: (props) => /* @__PURE__ */ React15.createElement(
1108
1151
  "td",
1109
1152
  {
1110
1153
  ...props,
@@ -1117,7 +1160,7 @@ var componentsMap = {
1117
1160
  }
1118
1161
  }
1119
1162
  ),
1120
- h1: (props) => /* @__PURE__ */ React14.createElement(
1163
+ h1: (props) => /* @__PURE__ */ React15.createElement(
1121
1164
  CustomHeading,
1122
1165
  {
1123
1166
  fontSize: "h1",
@@ -1133,15 +1176,15 @@ var componentsMap = {
1133
1176
  },
1134
1177
  props.children
1135
1178
  ),
1136
- h2: (props) => /* @__PURE__ */ React14.createElement(HeadingTwo, null, props.children),
1137
- h3: (props) => /* @__PURE__ */ React14.createElement(HeadingThree, { ...props }),
1138
- 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 }),
1139
1182
  pre: CodeStepper,
1140
- li: (props) => /* @__PURE__ */ React14.createElement("li", { ...props, style: { margin: "24px 0" } }),
1141
- 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 }),
1142
1185
  p: (props) => {
1143
1186
  const Text = mdxComponentMap.p;
1144
- return /* @__PURE__ */ React14.createElement(
1187
+ return /* @__PURE__ */ React15.createElement(
1145
1188
  Text,
1146
1189
  {
1147
1190
  style: { margin: "8px 0", padding: "8px 0", lineHeight: "2rem" },
@@ -1149,36 +1192,117 @@ var componentsMap = {
1149
1192
  }
1150
1193
  );
1151
1194
  },
1152
- blockquote: (props) => /* @__PURE__ */ React14.createElement(CustomQuote, { ...props }),
1195
+ blockquote: (props) => /* @__PURE__ */ React15.createElement(CustomQuote, { ...props }),
1153
1196
  a: ({ children, ...props }) => {
1154
1197
  const domain = new URL(props.href || "").hostname;
1155
- return /* @__PURE__ */ React14.createElement("a", { ...props, style: { color: "#f49676", textDecoration: "none" } }, children, " ", /* @__PURE__ */ React14.createElement(
1156
- "small",
1198
+ return /* @__PURE__ */ React15.createElement(
1199
+ "a",
1157
1200
  {
1158
- style: {
1159
- color: "#ffffff44"
1160
- }
1201
+ ...props,
1202
+ style: { color: "var(--color-secondary)", textDecoration: "none" }
1161
1203
  },
1162
- "(",
1163
- domain,
1164
- ")"
1165
- ));
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 });
1166
1225
  }
1167
1226
  };
1168
1227
  var map_default = componentsMap;
1169
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
+
1170
1294
  // src/index.tsx
1171
1295
  export * from "spectacle";
1172
1296
 
1173
1297
  // src/components/FilePane.tsx
1174
- import React15 from "react";
1298
+ import React18 from "react";
1175
1299
  function FilePane({
1176
1300
  name,
1177
1301
  children,
1178
1302
  priority,
1179
1303
  ...divProps
1180
1304
  }) {
1181
- return React15.isValidElement(children) ? React15.cloneElement(children, {
1305
+ return React18.isValidElement(children) ? React18.cloneElement(children, {
1182
1306
  // @ts-expect-error cloning
1183
1307
  priority,
1184
1308
  name
@@ -1187,14 +1311,14 @@ function FilePane({
1187
1311
  FilePane.mdxType = "FilePane";
1188
1312
 
1189
1313
  // src/components/ItemsColumn.tsx
1190
- import React16 from "react";
1314
+ import React19 from "react";
1191
1315
  import { Stepper as Stepper2 } from "spectacle";
1192
1316
  import styled11 from "styled-components";
1193
1317
  import { useSpring, animated } from "react-spring";
1194
1318
  function ItemsColumn(divProps) {
1195
1319
  const { style: style2, children, ...props } = divProps;
1196
- const childrenArray = React16.Children.toArray(children);
1197
- 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(
1198
1322
  "div",
1199
1323
  {
1200
1324
  style: {
@@ -1210,10 +1334,10 @@ function ItemsColumn(divProps) {
1210
1334
  },
1211
1335
  childrenArray.map((child, index) => {
1212
1336
  const isVisible = index <= step;
1213
- if (!React16.isValidElement(child)) {
1337
+ if (!React19.isValidElement(child)) {
1214
1338
  return child;
1215
1339
  }
1216
- return /* @__PURE__ */ React16.createElement(ItemColumnWrapper, { key: index, isVisible }, child);
1340
+ return /* @__PURE__ */ React19.createElement(ItemColumnWrapper, { key: index, isVisible }, child);
1217
1341
  })
1218
1342
  ));
1219
1343
  }
@@ -1230,11 +1354,11 @@ function ItemColumnWrapper({
1230
1354
  ...props
1231
1355
  }) {
1232
1356
  const styles = useSpring({ opacity: isVisible ? 1 : 0 });
1233
- return /* @__PURE__ */ React16.createElement(ItemColumnWrapperStyled, { style: styles, ...props }, children);
1357
+ return /* @__PURE__ */ React19.createElement(ItemColumnWrapperStyled, { style: styles, ...props }, children);
1234
1358
  }
1235
1359
 
1236
1360
  // src/components/DocumentationItem.tsx
1237
- import React17 from "react";
1361
+ import React20 from "react";
1238
1362
  import styled12 from "styled-components";
1239
1363
  var DocWrapper = styled12.div`
1240
1364
  position: absolute;
@@ -1287,14 +1411,14 @@ function Doc({
1287
1411
  link,
1288
1412
  children
1289
1413
  }) {
1290
- 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))));
1291
1415
  }
1292
1416
  function DocItem({ label, link }) {
1293
- 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);
1294
1418
  }
1295
1419
 
1296
1420
  // src/components/HorizontalList.tsx
1297
- import React18 from "react";
1421
+ import React21 from "react";
1298
1422
  import { animated as animated2, useSpring as useSpring2 } from "react-spring";
1299
1423
  import { Stepper as Stepper3 } from "spectacle";
1300
1424
  import styled13 from "styled-components";
@@ -1306,8 +1430,8 @@ function HorizontalList({
1306
1430
  children,
1307
1431
  columns = 3
1308
1432
  }) {
1309
- const items = React18.Children.toArray(children);
1310
- 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(
1311
1435
  Container,
1312
1436
  {
1313
1437
  style: {
@@ -1315,10 +1439,10 @@ function HorizontalList({
1315
1439
  }
1316
1440
  },
1317
1441
  items.map((item, k) => {
1318
- if (!React18.isValidElement(item)) {
1442
+ if (!React21.isValidElement(item)) {
1319
1443
  return item;
1320
1444
  }
1321
- return React18.cloneElement(item, {
1445
+ return React21.cloneElement(item, {
1322
1446
  // @ts-expect-error cloning
1323
1447
  position: k + 1,
1324
1448
  isVisible: k <= step,
@@ -1328,12 +1452,12 @@ function HorizontalList({
1328
1452
  ));
1329
1453
  }
1330
1454
  function Pill({ position }) {
1331
- return /* @__PURE__ */ React18.createElement(
1455
+ return /* @__PURE__ */ React21.createElement(
1332
1456
  "div",
1333
1457
  {
1334
1458
  style: { width: 48, transform: "translate(-25%, -25%)", opacity: 0.9 }
1335
1459
  },
1336
- /* @__PURE__ */ React18.createElement(
1460
+ /* @__PURE__ */ React21.createElement(
1337
1461
  "svg",
1338
1462
  {
1339
1463
  width: "48",
@@ -1342,14 +1466,14 @@ function Pill({ position }) {
1342
1466
  fill: "none",
1343
1467
  xmlns: "http://www.w3.org/2000/svg"
1344
1468
  },
1345
- /* @__PURE__ */ React18.createElement(
1469
+ /* @__PURE__ */ React21.createElement(
1346
1470
  "path",
1347
1471
  {
1348
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",
1349
1473
  fill: "#ffffff"
1350
1474
  }
1351
1475
  ),
1352
- /* @__PURE__ */ React18.createElement(
1476
+ /* @__PURE__ */ React21.createElement(
1353
1477
  "text",
1354
1478
  {
1355
1479
  x: "9",
@@ -1361,7 +1485,7 @@ function Pill({ position }) {
1361
1485
  },
1362
1486
  position
1363
1487
  ),
1364
- /* @__PURE__ */ React18.createElement(
1488
+ /* @__PURE__ */ React21.createElement(
1365
1489
  "path",
1366
1490
  {
1367
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",
@@ -1398,10 +1522,8 @@ function getItemOpacity({
1398
1522
  isLast,
1399
1523
  isVisible
1400
1524
  }) {
1401
- if (isLast)
1402
- return 1;
1403
- if (isVisible)
1404
- return 0.7;
1525
+ if (isLast) return 1;
1526
+ if (isVisible) return 0.7;
1405
1527
  return 0;
1406
1528
  }
1407
1529
  function HorizontalListItem({
@@ -1414,11 +1536,11 @@ function HorizontalListItem({
1414
1536
  const opacityStyles = useSpring2({
1415
1537
  opacity: getItemOpacity({ isVisible, isLast })
1416
1538
  });
1417
- 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));
1418
1540
  }
1419
1541
 
1420
1542
  // src/components/Timeline.tsx
1421
- import React19 from "react";
1543
+ import React22 from "react";
1422
1544
  import { animated as animated3, useSpring as useSpring3 } from "react-spring";
1423
1545
  import { Stepper as Stepper4 } from "spectacle";
1424
1546
 
@@ -1492,8 +1614,8 @@ var style = {
1492
1614
  alignItems: "center"
1493
1615
  };
1494
1616
  function Timeline(props) {
1495
- const children = React19.Children.toArray(props.children);
1496
- return /* @__PURE__ */ React19.createElement(
1617
+ const children = React22.Children.toArray(props.children);
1618
+ return /* @__PURE__ */ React22.createElement(
1497
1619
  Stepper4,
1498
1620
  {
1499
1621
  ...props,
@@ -1503,10 +1625,10 @@ function Timeline(props) {
1503
1625
  },
1504
1626
  (value, step) => {
1505
1627
  return children.map((child, index) => {
1506
- if (!React19.isValidElement(child)) {
1628
+ if (!React22.isValidElement(child)) {
1507
1629
  return child;
1508
1630
  }
1509
- return React19.cloneElement(child, {
1631
+ return React22.cloneElement(child, {
1510
1632
  // @ts-expect-error cloning
1511
1633
  isPhantom: step < index,
1512
1634
  isLast: step === index
@@ -1519,10 +1641,8 @@ function getItemOpacity2({
1519
1641
  isLast,
1520
1642
  isPhantom
1521
1643
  }) {
1522
- if (isPhantom)
1523
- return 0;
1524
- if (isLast)
1525
- return 1;
1644
+ if (isPhantom) return 0;
1645
+ if (isLast) return 1;
1526
1646
  return 0.5;
1527
1647
  }
1528
1648
  function TimelineItem(props) {
@@ -1534,7 +1654,7 @@ function TimelineItem(props) {
1534
1654
  opacity: getItemOpacity2({ isPhantom, isLast })
1535
1655
  });
1536
1656
  const colorStyles = useSpring3({ opacity: isPhantom || isLast ? 1 : 0.15 });
1537
- return /* @__PURE__ */ React19.createElement(
1657
+ return /* @__PURE__ */ React22.createElement(
1538
1658
  TimelineItemStyled,
1539
1659
  {
1540
1660
  ...rest,
@@ -1542,13 +1662,13 @@ function TimelineItem(props) {
1542
1662
  ...appearStyles
1543
1663
  }
1544
1664
  },
1545
- /* @__PURE__ */ React19.createElement(TimelineItemContentPhantom, null, /* @__PURE__ */ React19.createElement(TimelineItemTitle, null, title), /* @__PURE__ */ React19.createElement(TimelineItemBody, null, children)),
1546
- /* @__PURE__ */ React19.createElement(TimelineItemGuide, { style: colorStyles }, /* @__PURE__ */ React19.createElement(Hexagon, null), /* @__PURE__ */ React19.createElement(TimelineItemGuideLine, { style: guideLineProps })),
1547
- /* @__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))
1548
1668
  );
1549
1669
  }
1550
1670
  function Hexagon() {
1551
- return /* @__PURE__ */ React19.createElement(
1671
+ return /* @__PURE__ */ React22.createElement(
1552
1672
  "svg",
1553
1673
  {
1554
1674
  width: "18",
@@ -1557,14 +1677,14 @@ function Hexagon() {
1557
1677
  fill: "none",
1558
1678
  xmlns: "http://www.w3.org/2000/svg"
1559
1679
  },
1560
- /* @__PURE__ */ React19.createElement(
1680
+ /* @__PURE__ */ React22.createElement(
1561
1681
  "path",
1562
1682
  {
1563
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",
1564
1684
  fill: "#F49676"
1565
1685
  }
1566
1686
  ),
1567
- /* @__PURE__ */ React19.createElement(
1687
+ /* @__PURE__ */ React22.createElement(
1568
1688
  "path",
1569
1689
  {
1570
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",
@@ -1575,7 +1695,7 @@ function Hexagon() {
1575
1695
  }
1576
1696
 
1577
1697
  // src/components/IconBox.tsx
1578
- import React20 from "react";
1698
+ import React23 from "react";
1579
1699
  import styled16 from "styled-components";
1580
1700
  var IconBoxContent = styled16.div`
1581
1701
  * {
@@ -1587,7 +1707,7 @@ function IconBox({
1587
1707
  children,
1588
1708
  icon
1589
1709
  }) {
1590
- return /* @__PURE__ */ React20.createElement(
1710
+ return /* @__PURE__ */ React23.createElement(
1591
1711
  "div",
1592
1712
  {
1593
1713
  style: {
@@ -1597,63 +1717,69 @@ function IconBox({
1597
1717
  padding: "1rem 0"
1598
1718
  }
1599
1719
  },
1600
- /* @__PURE__ */ React20.createElement("div", { style: { fontSize: 60 } }, icon),
1601
- /* @__PURE__ */ React20.createElement(IconBoxContent, null, children)
1720
+ /* @__PURE__ */ React23.createElement("div", { style: { fontSize: 60 } }, icon),
1721
+ /* @__PURE__ */ React23.createElement(IconBoxContent, null, children)
1602
1722
  );
1603
1723
  }
1604
1724
 
1605
1725
  // src/index.tsx
1606
1726
  function PassThrough({ children }) {
1607
- return /* @__PURE__ */ React21.createElement(React21.Fragment, null, children);
1608
- }
1609
- function Layout({
1610
- children,
1611
- frontmatter
1612
- }) {
1613
- const layout = (frontmatter == null ? void 0 : frontmatter.layout) || "default";
1614
- const Layout2 = layout in layouts_default ? layouts_default[layout] : null;
1615
- if (layout && !Layout2) {
1616
- console.warn(`Layout ${layout} not found`);
1617
- }
1618
- if (Layout2) {
1619
- return /* @__PURE__ */ React21.createElement(Layout2, { ...frontmatter }, children);
1620
- }
1621
- return /* @__PURE__ */ React21.createElement(React21.Fragment, null, children);
1727
+ return /* @__PURE__ */ React24.createElement(React24.Fragment, null, children);
1622
1728
  }
1729
+ var layouts = layouts_default;
1623
1730
  var componentsMap2 = {
1624
1731
  ...map_default,
1625
- wrapper: Layout
1732
+ wrapper: SlideWrapper
1626
1733
  };
1627
- function Deck({ deck }) {
1628
- React21.useEffect(() => {
1734
+ function Deck({
1735
+ deck,
1736
+ theme,
1737
+ layouts: layouts2 = layouts_default
1738
+ }) {
1739
+ React24.useEffect(() => {
1629
1740
  document.title = deck.metadata.title || "Untitled";
1630
1741
  }, [deck.metadata.title]);
1631
- 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) => {
1632
- const Component = slide.slideComponent;
1633
- return /* @__PURE__ */ React21.createElement(Slide, { key: i }, /* @__PURE__ */ React21.createElement(Component, null));
1634
- }))));
1742
+ const GlobalStyle = React24.useMemo(() => {
1743
+ const cssVariables = createCssVariables(theme.themeTokens.colors);
1744
+ return createGlobalStyle`
1745
+ :root {
1746
+ ${cssVariables}
1747
+ }
1748
+ `;
1749
+ }, [theme]);
1750
+ 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(
1751
+ SpectacleDeck,
1752
+ {
1753
+ theme: { ...theme_default, ...theme.themeTokens },
1754
+ template
1755
+ },
1756
+ deck.slides.map((slide, i) => {
1757
+ const Component = slide.slideComponent;
1758
+ return /* @__PURE__ */ React24.createElement(Slide, { key: i }, /* @__PURE__ */ React24.createElement(Component, null));
1759
+ })
1760
+ ))));
1635
1761
  }
1636
1762
  function Danger({ children }) {
1637
- return /* @__PURE__ */ React21.createElement("div", { style: { color: "red" } }, children);
1763
+ return /* @__PURE__ */ React24.createElement("div", { style: { color: "red" } }, children);
1638
1764
  }
1639
1765
  function Information({ children }) {
1640
- return /* @__PURE__ */ React21.createElement("div", { style: { color: "orange" } }, children);
1766
+ return /* @__PURE__ */ React24.createElement("div", { style: { color: "orange" } }, children);
1641
1767
  }
1642
1768
  function Success({ children }) {
1643
- return /* @__PURE__ */ React21.createElement("div", { style: { color: "green" } }, children);
1769
+ return /* @__PURE__ */ React24.createElement("div", { style: { color: "green" } }, children);
1644
1770
  }
1645
1771
  function Warning({ children }) {
1646
- return /* @__PURE__ */ React21.createElement("div", { style: { color: "yellow" } }, children);
1772
+ return /* @__PURE__ */ React24.createElement("div", { style: { color: "yellow" } }, children);
1647
1773
  }
1648
1774
  function Side({ children }) {
1649
- return /* @__PURE__ */ React21.createElement("div", null, children);
1775
+ return /* @__PURE__ */ React24.createElement("div", null, children);
1650
1776
  }
1651
1777
  Side.mdxType = "Side";
1652
1778
  function Documentation({ children }) {
1653
- return /* @__PURE__ */ React21.createElement("div", null, children);
1779
+ return /* @__PURE__ */ React24.createElement("div", null, children);
1654
1780
  }
1655
1781
  function Box2({ children }) {
1656
- return /* @__PURE__ */ React21.createElement("div", null, children);
1782
+ return /* @__PURE__ */ React24.createElement("div", null, children);
1657
1783
  }
1658
1784
  export {
1659
1785
  Box2 as Box,
@@ -1669,11 +1795,11 @@ export {
1669
1795
  Image,
1670
1796
  Information,
1671
1797
  ItemsColumn,
1672
- Layout,
1673
1798
  PassThrough,
1674
1799
  Side,
1675
1800
  Success,
1676
1801
  Timeline,
1677
1802
  TimelineItem,
1678
- Warning
1803
+ Warning,
1804
+ layouts
1679
1805
  };