@gpichot/spectacle-deck 1.7.0 → 1.10.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.
- package/SkipStepsShortcut.d.ts +5 -0
- package/index.cjs +106 -59
- package/index.mjs +61 -14
- package/layouts/FullImageLayout.d.ts +5 -1
- package/package.json +9 -1
package/index.cjs
CHANGED
|
@@ -61,9 +61,9 @@ __export(src_exports, {
|
|
|
61
61
|
noneTransition: () => noneTransition,
|
|
62
62
|
resolveTransition: () => resolveTransition
|
|
63
63
|
});
|
|
64
|
-
var
|
|
65
|
-
var
|
|
66
|
-
var
|
|
64
|
+
var import_react17 = require("@mdx-js/react");
|
|
65
|
+
var import_react18 = __toESM(require("react"));
|
|
66
|
+
var import_spectacle12 = require("spectacle");
|
|
67
67
|
var import_styled_components20 = require("styled-components");
|
|
68
68
|
|
|
69
69
|
// src/colors.ts
|
|
@@ -1080,7 +1080,7 @@ var Overlay = import_styled_components6.default.div`
|
|
|
1080
1080
|
display: flex;
|
|
1081
1081
|
flex-flow: column nowrap;
|
|
1082
1082
|
justify-content: flex-end;
|
|
1083
|
-
padding: 4rem 6rem;
|
|
1083
|
+
padding: ${(props) => props.$padding || "4rem 6rem"};
|
|
1084
1084
|
z-index: 1;
|
|
1085
1085
|
|
|
1086
1086
|
h1,
|
|
@@ -1096,7 +1096,11 @@ function FullImageLayout({
|
|
|
1096
1096
|
children,
|
|
1097
1097
|
image,
|
|
1098
1098
|
position = "bottom",
|
|
1099
|
-
dim = 0
|
|
1099
|
+
dim = 0,
|
|
1100
|
+
fit = "cover",
|
|
1101
|
+
backgroundColor,
|
|
1102
|
+
margin,
|
|
1103
|
+
padding
|
|
1100
1104
|
}) {
|
|
1101
1105
|
const [images, rest] = getMatchingMdxType(children, "Image");
|
|
1102
1106
|
const firstImage = images[0];
|
|
@@ -1121,12 +1125,15 @@ function FullImageLayout({
|
|
|
1121
1125
|
position: "absolute",
|
|
1122
1126
|
inset: 0,
|
|
1123
1127
|
backgroundImage: backgroundImage ? `url(${backgroundImage})` : void 0,
|
|
1124
|
-
backgroundSize:
|
|
1125
|
-
backgroundPosition: "center"
|
|
1128
|
+
backgroundSize: fit,
|
|
1129
|
+
backgroundPosition: "center",
|
|
1130
|
+
backgroundRepeat: "no-repeat",
|
|
1131
|
+
backgroundColor,
|
|
1132
|
+
margin
|
|
1126
1133
|
}
|
|
1127
1134
|
}
|
|
1128
1135
|
),
|
|
1129
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1136
|
+
dim > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1130
1137
|
"div",
|
|
1131
1138
|
{
|
|
1132
1139
|
style: {
|
|
@@ -1136,7 +1143,14 @@ function FullImageLayout({
|
|
|
1136
1143
|
}
|
|
1137
1144
|
}
|
|
1138
1145
|
),
|
|
1139
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1146
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1147
|
+
Overlay,
|
|
1148
|
+
{
|
|
1149
|
+
$padding: padding,
|
|
1150
|
+
style: { justifyContent: justifyMap[position] },
|
|
1151
|
+
children: firstImage ? rest : children
|
|
1152
|
+
}
|
|
1153
|
+
)
|
|
1140
1154
|
]
|
|
1141
1155
|
}
|
|
1142
1156
|
);
|
|
@@ -1543,6 +1557,36 @@ var layouts_default = {
|
|
|
1543
1557
|
bigNumber: BigNumberLayout
|
|
1544
1558
|
};
|
|
1545
1559
|
|
|
1560
|
+
// src/SkipStepsShortcut.tsx
|
|
1561
|
+
var import_react9 = require("react");
|
|
1562
|
+
var import_spectacle6 = require("spectacle");
|
|
1563
|
+
function SkipStepsShortcut() {
|
|
1564
|
+
const {
|
|
1565
|
+
skipTo,
|
|
1566
|
+
activeView: { slideIndex },
|
|
1567
|
+
slideCount
|
|
1568
|
+
} = (0, import_react9.useContext)(import_spectacle6.DeckContext);
|
|
1569
|
+
(0, import_spectacle6.useMousetrap)(
|
|
1570
|
+
{
|
|
1571
|
+
"shift+right": () => {
|
|
1572
|
+
if (slideIndex < slideCount - 1) {
|
|
1573
|
+
skipTo({ slideIndex: slideIndex + 1, stepIndex: 0 });
|
|
1574
|
+
}
|
|
1575
|
+
},
|
|
1576
|
+
"shift+left": () => {
|
|
1577
|
+
if (slideIndex > 0) {
|
|
1578
|
+
skipTo({
|
|
1579
|
+
slideIndex: slideIndex - 1,
|
|
1580
|
+
stepIndex: null
|
|
1581
|
+
});
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
},
|
|
1585
|
+
[slideIndex, slideCount, skipTo]
|
|
1586
|
+
);
|
|
1587
|
+
return null;
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1546
1590
|
// src/SlideWrapper.tsx
|
|
1547
1591
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1548
1592
|
function SlideWrapper({
|
|
@@ -1564,7 +1608,7 @@ function SlideWrapper({
|
|
|
1564
1608
|
}
|
|
1565
1609
|
|
|
1566
1610
|
// src/template.tsx
|
|
1567
|
-
var
|
|
1611
|
+
var import_spectacle7 = require("spectacle");
|
|
1568
1612
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1569
1613
|
var template = ({
|
|
1570
1614
|
slideNumber,
|
|
@@ -1572,7 +1616,7 @@ var template = ({
|
|
|
1572
1616
|
}) => {
|
|
1573
1617
|
const percentage = slideNumber / numberOfSlides * 100;
|
|
1574
1618
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { style: { position: "absolute", bottom: 0, left: 0, right: 0 }, children: [
|
|
1575
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1619
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_spectacle7.Box, { padding: "0 0 0.5em 0.7em", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_spectacle7.FullScreen, {}) }),
|
|
1576
1620
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { width: "100%", height: "4px", background: "#ffffff11" }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1577
1621
|
"div",
|
|
1578
1622
|
{
|
|
@@ -1616,7 +1660,7 @@ var theme_default = {
|
|
|
1616
1660
|
};
|
|
1617
1661
|
|
|
1618
1662
|
// src/transitions.ts
|
|
1619
|
-
var
|
|
1663
|
+
var import_spectacle8 = require("spectacle");
|
|
1620
1664
|
var dropTransition = {
|
|
1621
1665
|
from: { transform: "translateY(-100%)", opacity: 0 },
|
|
1622
1666
|
enter: { transform: "translateY(0%)", opacity: 1 },
|
|
@@ -1628,8 +1672,8 @@ var noneTransition = {
|
|
|
1628
1672
|
leave: { opacity: 0 }
|
|
1629
1673
|
};
|
|
1630
1674
|
var transitionMap = {
|
|
1631
|
-
fade:
|
|
1632
|
-
slide:
|
|
1675
|
+
fade: import_spectacle8.fadeTransition,
|
|
1676
|
+
slide: import_spectacle8.slideTransition,
|
|
1633
1677
|
drop: dropTransition,
|
|
1634
1678
|
none: noneTransition
|
|
1635
1679
|
};
|
|
@@ -1645,11 +1689,11 @@ __reExport(src_exports, require("spectacle"));
|
|
|
1645
1689
|
var import_web = require("@react-spring/web");
|
|
1646
1690
|
|
|
1647
1691
|
// src/components/animations/useInView.ts
|
|
1648
|
-
var
|
|
1692
|
+
var import_react10 = __toESM(require("react"));
|
|
1649
1693
|
function useInView() {
|
|
1650
|
-
const ref =
|
|
1651
|
-
const [isInView, setIsInView] =
|
|
1652
|
-
|
|
1694
|
+
const ref = import_react10.default.useRef(null);
|
|
1695
|
+
const [isInView, setIsInView] = import_react10.default.useState(false);
|
|
1696
|
+
import_react10.default.useEffect(() => {
|
|
1653
1697
|
const el = ref.current;
|
|
1654
1698
|
if (!el) return;
|
|
1655
1699
|
const observer = new IntersectionObserver(
|
|
@@ -1847,7 +1891,7 @@ function Spotlight({
|
|
|
1847
1891
|
|
|
1848
1892
|
// src/components/animations/StaggerChildren.tsx
|
|
1849
1893
|
var import_web5 = require("@react-spring/web");
|
|
1850
|
-
var
|
|
1894
|
+
var import_react11 = __toESM(require("react"));
|
|
1851
1895
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1852
1896
|
function StaggerChildren({
|
|
1853
1897
|
children,
|
|
@@ -1858,7 +1902,7 @@ function StaggerChildren({
|
|
|
1858
1902
|
distance = 20
|
|
1859
1903
|
}) {
|
|
1860
1904
|
const [ref, isInView] = useInView();
|
|
1861
|
-
const items =
|
|
1905
|
+
const items = import_react11.default.Children.toArray(children);
|
|
1862
1906
|
const translateMap = {
|
|
1863
1907
|
up: `translateY(${distance}px)`,
|
|
1864
1908
|
down: `translateY(-${distance}px)`,
|
|
@@ -1879,14 +1923,14 @@ function StaggerChildren({
|
|
|
1879
1923
|
}
|
|
1880
1924
|
|
|
1881
1925
|
// src/components/animations/TypeWriter.tsx
|
|
1882
|
-
var
|
|
1926
|
+
var import_react12 = __toESM(require("react"));
|
|
1883
1927
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1884
1928
|
function extractText(node) {
|
|
1885
1929
|
if (typeof node === "string") return node;
|
|
1886
1930
|
if (typeof node === "number") return String(node);
|
|
1887
1931
|
if (!node) return "";
|
|
1888
1932
|
if (Array.isArray(node)) return node.map(extractText).join("");
|
|
1889
|
-
if (
|
|
1933
|
+
if (import_react12.default.isValidElement(node)) {
|
|
1890
1934
|
const props = node.props;
|
|
1891
1935
|
return extractText(props.children);
|
|
1892
1936
|
}
|
|
@@ -1900,9 +1944,9 @@ function TypeWriter({
|
|
|
1900
1944
|
}) {
|
|
1901
1945
|
const text = extractText(children);
|
|
1902
1946
|
const [ref, isInView] = useInView();
|
|
1903
|
-
const [displayed, setDisplayed] =
|
|
1904
|
-
const [done, setDone] =
|
|
1905
|
-
|
|
1947
|
+
const [displayed, setDisplayed] = import_react12.default.useState("");
|
|
1948
|
+
const [done, setDone] = import_react12.default.useState(false);
|
|
1949
|
+
import_react12.default.useEffect(() => {
|
|
1906
1950
|
if (!isInView) return;
|
|
1907
1951
|
let index = 0;
|
|
1908
1952
|
setDisplayed("");
|
|
@@ -2001,7 +2045,7 @@ function DocItem({ label, link }) {
|
|
|
2001
2045
|
}
|
|
2002
2046
|
|
|
2003
2047
|
// src/components/FilePane.tsx
|
|
2004
|
-
var
|
|
2048
|
+
var import_react13 = __toESM(require("react"));
|
|
2005
2049
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2006
2050
|
function FilePane({
|
|
2007
2051
|
name,
|
|
@@ -2010,7 +2054,7 @@ function FilePane({
|
|
|
2010
2054
|
minWidth,
|
|
2011
2055
|
...divProps
|
|
2012
2056
|
}) {
|
|
2013
|
-
const content =
|
|
2057
|
+
const content = import_react13.default.isValidElement(children) ? import_react13.default.cloneElement(children, {
|
|
2014
2058
|
// @ts-expect-error cloning
|
|
2015
2059
|
priority,
|
|
2016
2060
|
name
|
|
@@ -2024,8 +2068,8 @@ FilePane.mdxType = "FilePane";
|
|
|
2024
2068
|
|
|
2025
2069
|
// src/components/HorizontalList.tsx
|
|
2026
2070
|
var import_web6 = require("@react-spring/web");
|
|
2027
|
-
var
|
|
2028
|
-
var
|
|
2071
|
+
var import_react14 = __toESM(require("react"));
|
|
2072
|
+
var import_spectacle9 = require("spectacle");
|
|
2029
2073
|
var import_styled_components15 = __toESM(require("styled-components"));
|
|
2030
2074
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2031
2075
|
var Container = import_styled_components15.default.div`
|
|
@@ -2036,18 +2080,18 @@ function HorizontalList({
|
|
|
2036
2080
|
children,
|
|
2037
2081
|
columns = 3
|
|
2038
2082
|
}) {
|
|
2039
|
-
const items =
|
|
2040
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2083
|
+
const items = import_react14.default.Children.toArray(children);
|
|
2084
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_spectacle9.Stepper, { values: items, children: (_, step) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2041
2085
|
Container,
|
|
2042
2086
|
{
|
|
2043
2087
|
style: {
|
|
2044
2088
|
gridTemplateColumns: `repeat(${columns}, 1fr)`
|
|
2045
2089
|
},
|
|
2046
2090
|
children: items.map((item, k) => {
|
|
2047
|
-
if (!
|
|
2091
|
+
if (!import_react14.default.isValidElement(item)) {
|
|
2048
2092
|
return item;
|
|
2049
2093
|
}
|
|
2050
|
-
return
|
|
2094
|
+
return import_react14.default.cloneElement(item, {
|
|
2051
2095
|
// @ts-expect-error cloning
|
|
2052
2096
|
position: k + 1,
|
|
2053
2097
|
isVisible: k <= step,
|
|
@@ -2185,14 +2229,14 @@ function IconBox({
|
|
|
2185
2229
|
|
|
2186
2230
|
// src/components/ItemsColumn.tsx
|
|
2187
2231
|
var import_web7 = require("@react-spring/web");
|
|
2188
|
-
var
|
|
2189
|
-
var
|
|
2232
|
+
var import_react15 = __toESM(require("react"));
|
|
2233
|
+
var import_spectacle10 = require("spectacle");
|
|
2190
2234
|
var import_styled_components17 = __toESM(require("styled-components"));
|
|
2191
2235
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2192
2236
|
function ItemsColumn(divProps) {
|
|
2193
2237
|
const { style: style2, children, ...props } = divProps;
|
|
2194
|
-
const childrenArray =
|
|
2195
|
-
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2238
|
+
const childrenArray = import_react15.default.Children.toArray(children);
|
|
2239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_spectacle10.Stepper, { values: childrenArray, children: (_value, step) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2196
2240
|
"div",
|
|
2197
2241
|
{
|
|
2198
2242
|
style: {
|
|
@@ -2207,7 +2251,7 @@ function ItemsColumn(divProps) {
|
|
|
2207
2251
|
...props,
|
|
2208
2252
|
children: childrenArray.map((child, index) => {
|
|
2209
2253
|
const isVisible = index <= step;
|
|
2210
|
-
if (!
|
|
2254
|
+
if (!import_react15.default.isValidElement(child)) {
|
|
2211
2255
|
return child;
|
|
2212
2256
|
}
|
|
2213
2257
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ItemColumnWrapper, { isVisible, children: child }, index);
|
|
@@ -2233,8 +2277,8 @@ function ItemColumnWrapper({
|
|
|
2233
2277
|
|
|
2234
2278
|
// src/components/Timeline.tsx
|
|
2235
2279
|
var import_web8 = require("@react-spring/web");
|
|
2236
|
-
var
|
|
2237
|
-
var
|
|
2280
|
+
var import_react16 = __toESM(require("react"));
|
|
2281
|
+
var import_spectacle11 = require("spectacle");
|
|
2238
2282
|
var import_styled_components19 = __toESM(require("styled-components"));
|
|
2239
2283
|
|
|
2240
2284
|
// src/components/Timeline.styled.tsx
|
|
@@ -2308,13 +2352,13 @@ var style = {
|
|
|
2308
2352
|
};
|
|
2309
2353
|
function Timeline(props) {
|
|
2310
2354
|
const { activeIndex, ...rest } = props;
|
|
2311
|
-
const children =
|
|
2355
|
+
const children = import_react16.default.Children.toArray(rest.children);
|
|
2312
2356
|
if (activeIndex != null) {
|
|
2313
2357
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { ...rest, style: { ...style, ...rest.style }, children: children.map((child, index) => {
|
|
2314
|
-
if (!
|
|
2358
|
+
if (!import_react16.default.isValidElement(child)) {
|
|
2315
2359
|
return child;
|
|
2316
2360
|
}
|
|
2317
|
-
return
|
|
2361
|
+
return import_react16.default.cloneElement(child, {
|
|
2318
2362
|
// @ts-expect-error cloning
|
|
2319
2363
|
isPhantom: activeIndex < index,
|
|
2320
2364
|
isLast: activeIndex === index
|
|
@@ -2322,7 +2366,7 @@ function Timeline(props) {
|
|
|
2322
2366
|
}) });
|
|
2323
2367
|
}
|
|
2324
2368
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2325
|
-
|
|
2369
|
+
import_spectacle11.Stepper,
|
|
2326
2370
|
{
|
|
2327
2371
|
...rest,
|
|
2328
2372
|
values: children,
|
|
@@ -2330,10 +2374,10 @@ function Timeline(props) {
|
|
|
2330
2374
|
inactiveStyle: style,
|
|
2331
2375
|
children: (_value, step) => {
|
|
2332
2376
|
return children.map((child, index) => {
|
|
2333
|
-
if (!
|
|
2377
|
+
if (!import_react16.default.isValidElement(child)) {
|
|
2334
2378
|
return child;
|
|
2335
2379
|
}
|
|
2336
|
-
return
|
|
2380
|
+
return import_react16.default.cloneElement(child, {
|
|
2337
2381
|
// @ts-expect-error cloning
|
|
2338
2382
|
isPhantom: step < index,
|
|
2339
2383
|
isLast: step === index
|
|
@@ -2429,10 +2473,10 @@ function Deck({
|
|
|
2429
2473
|
layouts: layouts2 = layouts_default,
|
|
2430
2474
|
transition
|
|
2431
2475
|
}) {
|
|
2432
|
-
|
|
2476
|
+
import_react18.default.useEffect(() => {
|
|
2433
2477
|
document.title = deck.metadata.title || "Untitled";
|
|
2434
2478
|
}, [deck.metadata.title]);
|
|
2435
|
-
const mergedTheme =
|
|
2479
|
+
const mergedTheme = import_react18.default.useMemo(() => {
|
|
2436
2480
|
const fonts = {
|
|
2437
2481
|
...theme_default.fonts,
|
|
2438
2482
|
...theme.themeTokens.fonts ?? {}
|
|
@@ -2443,7 +2487,7 @@ function Deck({
|
|
|
2443
2487
|
fonts
|
|
2444
2488
|
};
|
|
2445
2489
|
}, [theme]);
|
|
2446
|
-
const GlobalStyle =
|
|
2490
|
+
const GlobalStyle = import_react18.default.useMemo(() => {
|
|
2447
2491
|
const cssVariables = createCssVariables(theme.themeTokens.colors);
|
|
2448
2492
|
return import_styled_components20.createGlobalStyle`
|
|
2449
2493
|
:root {
|
|
@@ -2452,21 +2496,24 @@ function Deck({
|
|
|
2452
2496
|
}
|
|
2453
2497
|
`;
|
|
2454
2498
|
}, [theme, mergedTheme]);
|
|
2455
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2499
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react18.default.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PestacleProvider, { layouts: layouts2, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react17.MDXProvider, { components: componentsMap2, children: [
|
|
2456
2500
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(GlobalStyle, {}),
|
|
2457
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.
|
|
2458
|
-
|
|
2501
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
2502
|
+
import_spectacle12.Deck,
|
|
2459
2503
|
{
|
|
2460
2504
|
theme: mergedTheme,
|
|
2461
2505
|
template,
|
|
2462
2506
|
transition: resolveTransition(transition),
|
|
2463
|
-
children:
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2507
|
+
children: [
|
|
2508
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SkipStepsShortcut, {}),
|
|
2509
|
+
deck.slides.map((slide, i) => {
|
|
2510
|
+
var _a;
|
|
2511
|
+
const Component = slide.slideComponent;
|
|
2512
|
+
const slideTransitionName = (_a = slide.metadata) == null ? void 0 : _a.transition;
|
|
2513
|
+
const slideTransition2 = resolveTransition(slideTransitionName);
|
|
2514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_spectacle12.Slide, { transition: slideTransition2, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Component, {}) }, i);
|
|
2515
|
+
})
|
|
2516
|
+
]
|
|
2470
2517
|
}
|
|
2471
2518
|
)
|
|
2472
2519
|
] }) }) });
|
package/index.mjs
CHANGED
|
@@ -1022,7 +1022,7 @@ var Overlay = styled6.div`
|
|
|
1022
1022
|
display: flex;
|
|
1023
1023
|
flex-flow: column nowrap;
|
|
1024
1024
|
justify-content: flex-end;
|
|
1025
|
-
padding: 4rem 6rem;
|
|
1025
|
+
padding: ${(props) => props.$padding || "4rem 6rem"};
|
|
1026
1026
|
z-index: 1;
|
|
1027
1027
|
|
|
1028
1028
|
h1,
|
|
@@ -1038,7 +1038,11 @@ function FullImageLayout({
|
|
|
1038
1038
|
children,
|
|
1039
1039
|
image,
|
|
1040
1040
|
position = "bottom",
|
|
1041
|
-
dim = 0
|
|
1041
|
+
dim = 0,
|
|
1042
|
+
fit = "cover",
|
|
1043
|
+
backgroundColor,
|
|
1044
|
+
margin,
|
|
1045
|
+
padding
|
|
1042
1046
|
}) {
|
|
1043
1047
|
const [images, rest] = getMatchingMdxType(children, "Image");
|
|
1044
1048
|
const firstImage = images[0];
|
|
@@ -1063,12 +1067,15 @@ function FullImageLayout({
|
|
|
1063
1067
|
position: "absolute",
|
|
1064
1068
|
inset: 0,
|
|
1065
1069
|
backgroundImage: backgroundImage ? `url(${backgroundImage})` : void 0,
|
|
1066
|
-
backgroundSize:
|
|
1067
|
-
backgroundPosition: "center"
|
|
1070
|
+
backgroundSize: fit,
|
|
1071
|
+
backgroundPosition: "center",
|
|
1072
|
+
backgroundRepeat: "no-repeat",
|
|
1073
|
+
backgroundColor,
|
|
1074
|
+
margin
|
|
1068
1075
|
}
|
|
1069
1076
|
}
|
|
1070
1077
|
),
|
|
1071
|
-
/* @__PURE__ */ jsx10(
|
|
1078
|
+
dim > 0 && /* @__PURE__ */ jsx10(
|
|
1072
1079
|
"div",
|
|
1073
1080
|
{
|
|
1074
1081
|
style: {
|
|
@@ -1078,7 +1085,14 @@ function FullImageLayout({
|
|
|
1078
1085
|
}
|
|
1079
1086
|
}
|
|
1080
1087
|
),
|
|
1081
|
-
/* @__PURE__ */ jsx10(
|
|
1088
|
+
/* @__PURE__ */ jsx10(
|
|
1089
|
+
Overlay,
|
|
1090
|
+
{
|
|
1091
|
+
$padding: padding,
|
|
1092
|
+
style: { justifyContent: justifyMap[position] },
|
|
1093
|
+
children: firstImage ? rest : children
|
|
1094
|
+
}
|
|
1095
|
+
)
|
|
1082
1096
|
]
|
|
1083
1097
|
}
|
|
1084
1098
|
);
|
|
@@ -1485,6 +1499,36 @@ var layouts_default = {
|
|
|
1485
1499
|
bigNumber: BigNumberLayout
|
|
1486
1500
|
};
|
|
1487
1501
|
|
|
1502
|
+
// src/SkipStepsShortcut.tsx
|
|
1503
|
+
import { useContext as useContext2 } from "react";
|
|
1504
|
+
import { DeckContext as DeckContext2, useMousetrap } from "spectacle";
|
|
1505
|
+
function SkipStepsShortcut() {
|
|
1506
|
+
const {
|
|
1507
|
+
skipTo,
|
|
1508
|
+
activeView: { slideIndex },
|
|
1509
|
+
slideCount
|
|
1510
|
+
} = useContext2(DeckContext2);
|
|
1511
|
+
useMousetrap(
|
|
1512
|
+
{
|
|
1513
|
+
"shift+right": () => {
|
|
1514
|
+
if (slideIndex < slideCount - 1) {
|
|
1515
|
+
skipTo({ slideIndex: slideIndex + 1, stepIndex: 0 });
|
|
1516
|
+
}
|
|
1517
|
+
},
|
|
1518
|
+
"shift+left": () => {
|
|
1519
|
+
if (slideIndex > 0) {
|
|
1520
|
+
skipTo({
|
|
1521
|
+
slideIndex: slideIndex - 1,
|
|
1522
|
+
stepIndex: null
|
|
1523
|
+
});
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
},
|
|
1527
|
+
[slideIndex, slideCount, skipTo]
|
|
1528
|
+
);
|
|
1529
|
+
return null;
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1488
1532
|
// src/SlideWrapper.tsx
|
|
1489
1533
|
import { Fragment, jsx as jsx18 } from "react/jsx-runtime";
|
|
1490
1534
|
function SlideWrapper({
|
|
@@ -2399,19 +2443,22 @@ function Deck({
|
|
|
2399
2443
|
}, [theme, mergedTheme]);
|
|
2400
2444
|
return /* @__PURE__ */ jsx33(React16.StrictMode, { children: /* @__PURE__ */ jsx33(PestacleProvider, { layouts: layouts2, children: /* @__PURE__ */ jsxs22(MDXProvider, { components: componentsMap2, children: [
|
|
2401
2445
|
/* @__PURE__ */ jsx33(GlobalStyle, {}),
|
|
2402
|
-
/* @__PURE__ */
|
|
2446
|
+
/* @__PURE__ */ jsxs22(
|
|
2403
2447
|
SpectacleDeck,
|
|
2404
2448
|
{
|
|
2405
2449
|
theme: mergedTheme,
|
|
2406
2450
|
template,
|
|
2407
2451
|
transition: resolveTransition(transition),
|
|
2408
|
-
children:
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2452
|
+
children: [
|
|
2453
|
+
/* @__PURE__ */ jsx33(SkipStepsShortcut, {}),
|
|
2454
|
+
deck.slides.map((slide, i) => {
|
|
2455
|
+
var _a;
|
|
2456
|
+
const Component = slide.slideComponent;
|
|
2457
|
+
const slideTransitionName = (_a = slide.metadata) == null ? void 0 : _a.transition;
|
|
2458
|
+
const slideTransition2 = resolveTransition(slideTransitionName);
|
|
2459
|
+
return /* @__PURE__ */ jsx33(Slide, { transition: slideTransition2, children: /* @__PURE__ */ jsx33(Component, {}) }, i);
|
|
2460
|
+
})
|
|
2461
|
+
]
|
|
2415
2462
|
}
|
|
2416
2463
|
)
|
|
2417
2464
|
] }) }) });
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare function FullImageLayout({ children, image, position, dim, }: {
|
|
2
|
+
export declare function FullImageLayout({ children, image, position, dim, fit, backgroundColor, margin, padding, }: {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
image?: string;
|
|
5
5
|
position?: "center" | "bottom" | "top";
|
|
6
6
|
dim?: number;
|
|
7
|
+
fit?: "cover" | "contain";
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
margin?: string;
|
|
10
|
+
padding?: string;
|
|
7
11
|
}): import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gpichot/spectacle-deck",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.cjs",
|
|
@@ -16,6 +16,14 @@
|
|
|
16
16
|
"keywords": [
|
|
17
17
|
"spectacle"
|
|
18
18
|
],
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/gpichot/pestacle.git",
|
|
22
|
+
"directory": "packages/spectacle-deck"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
19
27
|
"dependencies": {
|
|
20
28
|
"@fontsource/bitter": "^5.2.10",
|
|
21
29
|
"@mdx-js/react": "^3.1.1",
|