@strategicnerds/slide-nerds 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands/analytics.d.ts +6 -0
- package/dist/cli/commands/analytics.d.ts.map +1 -0
- package/dist/cli/commands/analytics.js +44 -0
- package/dist/cli/commands/analytics.js.map +1 -0
- package/dist/cli/commands/create.d.ts +4 -0
- package/dist/cli/commands/create.d.ts.map +1 -0
- package/dist/cli/commands/create.js +87 -0
- package/dist/cli/commands/create.js.map +1 -0
- package/dist/cli/commands/export.d.ts +6 -0
- package/dist/cli/commands/export.d.ts.map +1 -0
- package/dist/cli/commands/export.js +109 -0
- package/dist/cli/commands/export.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +12 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/template-path.d.ts +4 -0
- package/dist/cli/template-path.d.ts.map +1 -0
- package/dist/cli/template-path.js +13 -0
- package/dist/cli/template-path.js.map +1 -0
- package/dist/runtime/export-api.d.ts +15 -0
- package/dist/runtime/export-api.d.ts.map +1 -0
- package/dist/runtime/export-api.js +21 -0
- package/dist/runtime/export-api.js.map +1 -0
- package/dist/runtime/index.d.ts +12 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +8 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/light-table.d.ts +8 -0
- package/dist/runtime/light-table.d.ts.map +1 -0
- package/dist/runtime/light-table.js +104 -0
- package/dist/runtime/light-table.js.map +1 -0
- package/dist/runtime/presenter-view.d.ts +7 -0
- package/dist/runtime/presenter-view.d.ts.map +1 -0
- package/dist/runtime/presenter-view.js +62 -0
- package/dist/runtime/presenter-view.js.map +1 -0
- package/dist/runtime/slide-context.d.ts +16 -0
- package/dist/runtime/slide-context.d.ts.map +1 -0
- package/dist/runtime/slide-context.js +18 -0
- package/dist/runtime/slide-context.js.map +1 -0
- package/dist/runtime/slide-controls.d.ts +3 -0
- package/dist/runtime/slide-controls.d.ts.map +1 -0
- package/dist/runtime/slide-controls.js +177 -0
- package/dist/runtime/slide-controls.js.map +1 -0
- package/dist/runtime/slide-dom.d.ts +17 -0
- package/dist/runtime/slide-dom.d.ts.map +1 -0
- package/dist/runtime/slide-dom.js +89 -0
- package/dist/runtime/slide-dom.js.map +1 -0
- package/dist/runtime/slide-runtime.d.ts +7 -0
- package/dist/runtime/slide-runtime.d.ts.map +1 -0
- package/dist/runtime/slide-runtime.js +125 -0
- package/dist/runtime/slide-runtime.js.map +1 -0
- package/dist/runtime/slide-shape.d.ts +21 -0
- package/dist/runtime/slide-shape.d.ts.map +1 -0
- package/dist/runtime/slide-shape.js +115 -0
- package/dist/runtime/slide-shape.js.map +1 -0
- package/dist/runtime/types.d.ts +150 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +38 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/runtime/use-presenter-mode.d.ts +14 -0
- package/dist/runtime/use-presenter-mode.d.ts.map +1 -0
- package/dist/runtime/use-presenter-mode.js +52 -0
- package/dist/runtime/use-presenter-mode.js.map +1 -0
- package/dist/runtime/use-slide-navigation.d.ts +13 -0
- package/dist/runtime/use-slide-navigation.d.ts.map +1 -0
- package/dist/runtime/use-slide-navigation.js +230 -0
- package/dist/runtime/use-slide-navigation.js.map +1 -0
- package/package.json +64 -0
- package/skills/accessibility/SKILL.md +236 -0
- package/skills/advanced-layouts/SKILL.md +429 -0
- package/skills/analytics/SKILL.md +97 -0
- package/skills/animation/SKILL.md +364 -0
- package/skills/brand/SKILL.md +200 -0
- package/skills/data-visualization/SKILL.md +533 -0
- package/skills/deck-templates/SKILL.md +93 -0
- package/skills/diagrams/SKILL.md +395 -0
- package/skills/export/SKILL.md +119 -0
- package/skills/interactive/SKILL.md +292 -0
- package/skills/layout/SKILL.md +178 -0
- package/skills/narrative-frameworks/SKILL.md +250 -0
- package/skills/react-component-embeds/SKILL.md +73 -0
- package/skills/slide-types/SKILL.md +384 -0
- package/skills/slidenerds-runtime/SKILL.md +163 -0
- package/skills/speaker-notes/SKILL.md +128 -0
- package/skills/strategic-frameworks/SKILL.md +392 -0
- package/skills/visual-design/SKILL.md +373 -0
- package/templates/analytics/custom.tsx.tmpl +20 -0
- package/templates/analytics/ga4.tsx.tmpl +15 -0
- package/templates/analytics/gtm.tsx.tmpl +9 -0
- package/templates/analytics/plausible.tsx.tmpl +10 -0
- package/templates/analytics/posthog.tsx.tmpl +14 -0
- package/templates/next-app/CLAUDE.md.tmpl +574 -0
- package/templates/next-app/README.md.tmpl +35 -0
- package/templates/next-app/app/globals.css.tmpl +274 -0
- package/templates/next-app/app/layout.tsx.tmpl +31 -0
- package/templates/next-app/app/page.tsx.tmpl +38 -0
- package/templates/next-app/brand.config.ts.tmpl +32 -0
- package/templates/next-app/package.json.tmpl +25 -0
- package/templates/next-app/postcss.config.mjs.tmpl +8 -0
- package/templates/next-app/tsconfig.json.tmpl +21 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId } from 'react';
|
|
4
|
+
const r2 = (n) => Math.round(n * 100) / 100;
|
|
5
|
+
const regularPolygon = (w, h, sides, rotationOffset) => {
|
|
6
|
+
const cx = w / 2;
|
|
7
|
+
const cy = h / 2;
|
|
8
|
+
const rad = Math.min(cx, cy);
|
|
9
|
+
const pts = Array.from({ length: sides }, (_, i) => {
|
|
10
|
+
const angle = (Math.PI * 2 * i) / sides - rotationOffset;
|
|
11
|
+
return `${r2(cx + rad * Math.cos(angle))},${r2(cy + rad * Math.sin(angle))}`;
|
|
12
|
+
});
|
|
13
|
+
return `M ${pts.join(' L ')} Z`;
|
|
14
|
+
};
|
|
15
|
+
const SHAPE_PATHS = {
|
|
16
|
+
circle: (w, h) => {
|
|
17
|
+
const rx = w / 2;
|
|
18
|
+
const ry = h / 2;
|
|
19
|
+
return `M ${rx},0 A ${rx},${ry} 0 1,1 ${rx},${h} A ${rx},${ry} 0 1,1 ${rx},0 Z`;
|
|
20
|
+
},
|
|
21
|
+
square: (w, h) => `M 0,0 L ${w},0 L ${w},${h} L 0,${h} Z`,
|
|
22
|
+
'rounded-square': (w, h) => {
|
|
23
|
+
const r = Math.min(w, h) * 0.12;
|
|
24
|
+
return `M ${r},0 L ${w - r},0 Q ${w},0 ${w},${r} L ${w},${h - r} Q ${w},${h} ${w - r},${h} L ${r},${h} Q 0,${h} 0,${h - r} L 0,${r} Q 0,0 ${r},0 Z`;
|
|
25
|
+
},
|
|
26
|
+
triangle: (w, h) => `M ${w / 2},0 L ${w},${h} L 0,${h} Z`,
|
|
27
|
+
diamond: (w, h) => `M ${w / 2},0 L ${w},${h / 2} L ${w / 2},${h} L 0,${h / 2} Z`,
|
|
28
|
+
pentagon: (w, h) => regularPolygon(w, h, 5, Math.PI / 2),
|
|
29
|
+
hexagon: (w, h) => regularPolygon(w, h, 6, Math.PI / 6),
|
|
30
|
+
octagon: (w, h) => regularPolygon(w, h, 8, Math.PI / 8),
|
|
31
|
+
star: (w, h) => {
|
|
32
|
+
const cx = w / 2;
|
|
33
|
+
const cy = h / 2;
|
|
34
|
+
const outer = Math.min(cx, cy);
|
|
35
|
+
const inner = outer * 0.4;
|
|
36
|
+
const pts = Array.from({ length: 10 }, (_, i) => {
|
|
37
|
+
const angle = (Math.PI * 2 * i) / 10 - Math.PI / 2;
|
|
38
|
+
const rad = i % 2 === 0 ? outer : inner;
|
|
39
|
+
return `${r2(cx + rad * Math.cos(angle))},${r2(cy + rad * Math.sin(angle))}`;
|
|
40
|
+
});
|
|
41
|
+
return `M ${pts.join(' L ')} Z`;
|
|
42
|
+
},
|
|
43
|
+
plus: (w, h) => {
|
|
44
|
+
const t = Math.min(w, h) * 0.3;
|
|
45
|
+
const cx = w / 2;
|
|
46
|
+
const cy = h / 2;
|
|
47
|
+
return `M ${cx - t / 2},0 L ${cx + t / 2},0 L ${cx + t / 2},${cy - t / 2} L ${w},${cy - t / 2} L ${w},${cy + t / 2} L ${cx + t / 2},${cy + t / 2} L ${cx + t / 2},${h} L ${cx - t / 2},${h} L ${cx - t / 2},${cy + t / 2} L 0,${cy + t / 2} L 0,${cy - t / 2} L ${cx - t / 2},${cy - t / 2} Z`;
|
|
48
|
+
},
|
|
49
|
+
cloud: (w, h) => {
|
|
50
|
+
const cx = w / 2;
|
|
51
|
+
return `M ${r2(w * 0.2)},${r2(h * 0.65)} A ${r2(w * 0.2)},${r2(w * 0.2)} 0 1,1 ${r2(w * 0.35)},${r2(h * 0.35)} A ${r2(w * 0.18)},${r2(w * 0.18)} 0 1,1 ${r2(cx)},${r2(h * 0.2)} A ${r2(w * 0.2)},${r2(w * 0.2)} 0 1,1 ${r2(w * 0.7)},${r2(h * 0.3)} A ${r2(w * 0.18)},${r2(w * 0.18)} 0 1,1 ${r2(w * 0.85)},${r2(h * 0.55)} A ${r2(w * 0.15)},${r2(w * 0.15)} 0 1,1 ${r2(w * 0.75)},${r2(h * 0.75)} L ${r2(w * 0.25)},${r2(h * 0.75)} A ${r2(w * 0.12)},${r2(w * 0.12)} 0 1,1 ${r2(w * 0.2)},${r2(h * 0.65)} Z`;
|
|
52
|
+
},
|
|
53
|
+
'arrow-right': (w, h) => {
|
|
54
|
+
const shaft = h * 0.3;
|
|
55
|
+
const cy = h / 2;
|
|
56
|
+
return `M 0,${cy - shaft / 2} L ${w * 0.6},${cy - shaft / 2} L ${w * 0.6},0 L ${w},${cy} L ${w * 0.6},${h} L ${w * 0.6},${cy + shaft / 2} L 0,${cy + shaft / 2} Z`;
|
|
57
|
+
},
|
|
58
|
+
'arrow-left': (w, h) => {
|
|
59
|
+
const shaft = h * 0.3;
|
|
60
|
+
const cy = h / 2;
|
|
61
|
+
return `M ${w},${cy - shaft / 2} L ${w * 0.4},${cy - shaft / 2} L ${w * 0.4},0 L 0,${cy} L ${w * 0.4},${h} L ${w * 0.4},${cy + shaft / 2} L ${w},${cy + shaft / 2} Z`;
|
|
62
|
+
},
|
|
63
|
+
'chevron-right': (w, h) => {
|
|
64
|
+
const t = w * 0.35;
|
|
65
|
+
return `M 0,0 L ${w},${h / 2} L 0,${h} L ${t},${h / 2} Z`;
|
|
66
|
+
},
|
|
67
|
+
pill: (w, h) => {
|
|
68
|
+
const r = h / 2;
|
|
69
|
+
return `M ${r},0 L ${w - r},0 A ${r},${r} 0 1,1 ${w - r},${h} L ${r},${h} A ${r},${r} 0 1,1 ${r},0 Z`;
|
|
70
|
+
},
|
|
71
|
+
badge: (w, h) => {
|
|
72
|
+
const notch = w * 0.08;
|
|
73
|
+
return `M 0,0 L ${w},0 L ${w},${h} L ${w / 2 + notch},${h} L ${w / 2},${h - notch * 1.5} L ${w / 2 - notch},${h} L 0,${h} Z`;
|
|
74
|
+
},
|
|
75
|
+
parallelogram: (w, h) => {
|
|
76
|
+
const skew = w * 0.2;
|
|
77
|
+
return `M ${skew},0 L ${w},0 L ${w - skew},${h} L 0,${h} Z`;
|
|
78
|
+
},
|
|
79
|
+
heart: (w, h) => {
|
|
80
|
+
const cx = w / 2;
|
|
81
|
+
return `M ${cx},${r2(h * 0.35)} C ${cx},${r2(h * 0.2)} ${r2(cx - w * 0.05)},0 ${r2(w * 0.25)},0 C ${r2(w * 0.1)},0 0,${r2(h * 0.1)} 0,${r2(h * 0.3)} C 0,${r2(h * 0.55)} ${cx},${r2(h * 0.8)} ${cx},${h} C ${cx},${r2(h * 0.8)} ${w},${r2(h * 0.55)} ${w},${r2(h * 0.3)} C ${w},${r2(h * 0.1)} ${r2(w * 0.9)},0 ${r2(w * 0.75)},0 C ${r2(cx + w * 0.05)},0 ${cx},${r2(h * 0.2)} ${cx},${r2(h * 0.35)} Z`;
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
export const SlideShape = ({ shape, size, width: widthProp, height: heightProp, fill = 'var(--color-surface)', stroke = 'var(--color-border)', strokeWidth = 1, opacity, imageSrc, children, className, style, ...rest }) => {
|
|
85
|
+
const clipId = useId();
|
|
86
|
+
const w = widthProp ?? size ?? 120;
|
|
87
|
+
const h = heightProp ?? size ?? 120;
|
|
88
|
+
const pathFn = SHAPE_PATHS[shape];
|
|
89
|
+
const d = pathFn(w, h);
|
|
90
|
+
const dataAttrs = {};
|
|
91
|
+
if (rest['data-magic-id'])
|
|
92
|
+
dataAttrs['data-magic-id'] = rest['data-magic-id'];
|
|
93
|
+
if (rest['data-step'] !== undefined)
|
|
94
|
+
dataAttrs['data-step'] = rest['data-step'];
|
|
95
|
+
return (_jsxs("div", { className: className, style: {
|
|
96
|
+
position: 'relative',
|
|
97
|
+
display: 'inline-flex',
|
|
98
|
+
alignItems: 'center',
|
|
99
|
+
justifyContent: 'center',
|
|
100
|
+
width: w,
|
|
101
|
+
height: h,
|
|
102
|
+
...style,
|
|
103
|
+
}, ...dataAttrs, children: [_jsxs("svg", { width: w, height: h, viewBox: `0 0 ${w} ${h}`, fill: "none", xmlns: "http://www.w3.org/2000/svg", style: { position: 'absolute', inset: 0 }, children: [imageSrc && (_jsx("defs", { children: _jsx("clipPath", { id: clipId, children: _jsx("path", { d: d }) }) })), imageSrc ? (_jsx("image", { href: imageSrc, x: 0, y: 0, width: w, height: h, preserveAspectRatio: "xMidYMid slice", clipPath: `url(#${clipId})` })) : (_jsx("path", { d: d, fill: fill, stroke: stroke, strokeWidth: strokeWidth, opacity: opacity })), imageSrc && stroke !== 'none' && (_jsx("path", { d: d, fill: "none", stroke: stroke, strokeWidth: strokeWidth, opacity: opacity }))] }), children && (_jsx("div", { style: {
|
|
104
|
+
position: 'relative',
|
|
105
|
+
zIndex: 1,
|
|
106
|
+
display: 'flex',
|
|
107
|
+
alignItems: 'center',
|
|
108
|
+
justifyContent: 'center',
|
|
109
|
+
width: '100%',
|
|
110
|
+
height: '100%',
|
|
111
|
+
padding: '15%',
|
|
112
|
+
textAlign: 'center',
|
|
113
|
+
}, children: children }))] }));
|
|
114
|
+
};
|
|
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ACxB,KAAK,EAAE,MAAM;oBACb,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE,KAAK;oBACd,SAAS,EAAE,QAAQ;iBACpB,YAEA,QAAQ,GACL,CACP,IACG,CACP,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const BrandConfigSchema: z.ZodObject<{
|
|
3
|
+
colors: z.ZodObject<{
|
|
4
|
+
primary: z.ZodString;
|
|
5
|
+
accent: z.ZodString;
|
|
6
|
+
background: z.ZodString;
|
|
7
|
+
surface: z.ZodString;
|
|
8
|
+
text: z.ZodString;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
text: string;
|
|
11
|
+
background: string;
|
|
12
|
+
primary: string;
|
|
13
|
+
accent: string;
|
|
14
|
+
surface: string;
|
|
15
|
+
}, {
|
|
16
|
+
text: string;
|
|
17
|
+
background: string;
|
|
18
|
+
primary: string;
|
|
19
|
+
accent: string;
|
|
20
|
+
surface: string;
|
|
21
|
+
}>;
|
|
22
|
+
fonts: z.ZodObject<{
|
|
23
|
+
heading: z.ZodString;
|
|
24
|
+
body: z.ZodString;
|
|
25
|
+
mono: z.ZodString;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
body: string;
|
|
28
|
+
heading: string;
|
|
29
|
+
mono: string;
|
|
30
|
+
}, {
|
|
31
|
+
body: string;
|
|
32
|
+
heading: string;
|
|
33
|
+
mono: string;
|
|
34
|
+
}>;
|
|
35
|
+
spacing: z.ZodObject<{
|
|
36
|
+
slide: z.ZodString;
|
|
37
|
+
section: z.ZodString;
|
|
38
|
+
element: z.ZodString;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
section: string;
|
|
41
|
+
slide: string;
|
|
42
|
+
element: string;
|
|
43
|
+
}, {
|
|
44
|
+
section: string;
|
|
45
|
+
slide: string;
|
|
46
|
+
element: string;
|
|
47
|
+
}>;
|
|
48
|
+
logo: z.ZodOptional<z.ZodObject<{
|
|
49
|
+
src: z.ZodString;
|
|
50
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
51
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
src: string;
|
|
54
|
+
width?: number | undefined;
|
|
55
|
+
height?: number | undefined;
|
|
56
|
+
}, {
|
|
57
|
+
src: string;
|
|
58
|
+
width?: number | undefined;
|
|
59
|
+
height?: number | undefined;
|
|
60
|
+
}>>;
|
|
61
|
+
tailwind: z.ZodOptional<z.ZodObject<{
|
|
62
|
+
extend: z.ZodOptional<z.ZodObject<{
|
|
63
|
+
colors: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
64
|
+
fontFamily: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
65
|
+
spacing: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
|
67
|
+
fontFamily?: Record<string, string[]> | undefined;
|
|
68
|
+
colors?: Record<string, string> | undefined;
|
|
69
|
+
spacing?: Record<string, string> | undefined;
|
|
70
|
+
}, {
|
|
71
|
+
fontFamily?: Record<string, string[]> | undefined;
|
|
72
|
+
colors?: Record<string, string> | undefined;
|
|
73
|
+
spacing?: Record<string, string> | undefined;
|
|
74
|
+
}>>;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
extend?: {
|
|
77
|
+
fontFamily?: Record<string, string[]> | undefined;
|
|
78
|
+
colors?: Record<string, string> | undefined;
|
|
79
|
+
spacing?: Record<string, string> | undefined;
|
|
80
|
+
} | undefined;
|
|
81
|
+
}, {
|
|
82
|
+
extend?: {
|
|
83
|
+
fontFamily?: Record<string, string[]> | undefined;
|
|
84
|
+
colors?: Record<string, string> | undefined;
|
|
85
|
+
spacing?: Record<string, string> | undefined;
|
|
86
|
+
} | undefined;
|
|
87
|
+
}>>;
|
|
88
|
+
}, "strip", z.ZodTypeAny, {
|
|
89
|
+
colors: {
|
|
90
|
+
text: string;
|
|
91
|
+
background: string;
|
|
92
|
+
primary: string;
|
|
93
|
+
accent: string;
|
|
94
|
+
surface: string;
|
|
95
|
+
};
|
|
96
|
+
spacing: {
|
|
97
|
+
section: string;
|
|
98
|
+
slide: string;
|
|
99
|
+
element: string;
|
|
100
|
+
};
|
|
101
|
+
fonts: {
|
|
102
|
+
body: string;
|
|
103
|
+
heading: string;
|
|
104
|
+
mono: string;
|
|
105
|
+
};
|
|
106
|
+
logo?: {
|
|
107
|
+
src: string;
|
|
108
|
+
width?: number | undefined;
|
|
109
|
+
height?: number | undefined;
|
|
110
|
+
} | undefined;
|
|
111
|
+
tailwind?: {
|
|
112
|
+
extend?: {
|
|
113
|
+
fontFamily?: Record<string, string[]> | undefined;
|
|
114
|
+
colors?: Record<string, string> | undefined;
|
|
115
|
+
spacing?: Record<string, string> | undefined;
|
|
116
|
+
} | undefined;
|
|
117
|
+
} | undefined;
|
|
118
|
+
}, {
|
|
119
|
+
colors: {
|
|
120
|
+
text: string;
|
|
121
|
+
background: string;
|
|
122
|
+
primary: string;
|
|
123
|
+
accent: string;
|
|
124
|
+
surface: string;
|
|
125
|
+
};
|
|
126
|
+
spacing: {
|
|
127
|
+
section: string;
|
|
128
|
+
slide: string;
|
|
129
|
+
element: string;
|
|
130
|
+
};
|
|
131
|
+
fonts: {
|
|
132
|
+
body: string;
|
|
133
|
+
heading: string;
|
|
134
|
+
mono: string;
|
|
135
|
+
};
|
|
136
|
+
logo?: {
|
|
137
|
+
src: string;
|
|
138
|
+
width?: number | undefined;
|
|
139
|
+
height?: number | undefined;
|
|
140
|
+
} | undefined;
|
|
141
|
+
tailwind?: {
|
|
142
|
+
extend?: {
|
|
143
|
+
fontFamily?: Record<string, string[]> | undefined;
|
|
144
|
+
colors?: Record<string, string> | undefined;
|
|
145
|
+
spacing?: Record<string, string> | undefined;
|
|
146
|
+
} | undefined;
|
|
147
|
+
} | undefined;
|
|
148
|
+
}>;
|
|
149
|
+
export type BrandConfig = z.infer<typeof BrandConfigSchema>;
|
|
150
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAQvB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8B5B,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const TailwindExtendSchema = z.object({
|
|
3
|
+
colors: z.record(z.string()).optional(),
|
|
4
|
+
fontFamily: z.record(z.array(z.string())).optional(),
|
|
5
|
+
spacing: z.record(z.string()).optional(),
|
|
6
|
+
});
|
|
7
|
+
export const BrandConfigSchema = z.object({
|
|
8
|
+
colors: z.object({
|
|
9
|
+
primary: z.string(),
|
|
10
|
+
accent: z.string(),
|
|
11
|
+
background: z.string(),
|
|
12
|
+
surface: z.string(),
|
|
13
|
+
text: z.string(),
|
|
14
|
+
}),
|
|
15
|
+
fonts: z.object({
|
|
16
|
+
heading: z.string(),
|
|
17
|
+
body: z.string(),
|
|
18
|
+
mono: z.string(),
|
|
19
|
+
}),
|
|
20
|
+
spacing: z.object({
|
|
21
|
+
slide: z.string(),
|
|
22
|
+
section: z.string(),
|
|
23
|
+
element: z.string(),
|
|
24
|
+
}),
|
|
25
|
+
logo: z
|
|
26
|
+
.object({
|
|
27
|
+
src: z.string(),
|
|
28
|
+
width: z.number().optional(),
|
|
29
|
+
height: z.number().optional(),
|
|
30
|
+
})
|
|
31
|
+
.optional(),
|
|
32
|
+
tailwind: z
|
|
33
|
+
.object({
|
|
34
|
+
extend: TailwindExtendSchema.optional(),
|
|
35
|
+
})
|
|
36
|
+
.optional(),
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACvC,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE;IACpD,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CACzC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;QAClB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;QACtB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;KACjB,CAAC;IACF,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;KACjB,CAAC;IACF,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;QAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;KACpB,CAAC;IACF,IAAI,EAAE,CAAC;SACJ,MAAM,CAAC;QACN,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;QACf,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC9B,CAAC;SACD,QAAQ,EAAE;IACb,QAAQ,EAAE,CAAC;SACR,MAAM,CAAC;QACN,MAAM,EAAE,oBAAoB,CAAC,QAAQ,EAAE;KACxC,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type PresenterModeOptions = {
|
|
2
|
+
currentSlide: number;
|
|
3
|
+
currentStep: number;
|
|
4
|
+
onSlideChange: (slide: number) => void;
|
|
5
|
+
onStepChange?: (step: number) => void;
|
|
6
|
+
};
|
|
7
|
+
type PresenterModeResult = {
|
|
8
|
+
openPresenterWindow: () => void;
|
|
9
|
+
closePresenterWindow: () => void;
|
|
10
|
+
isPresenterOpen: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const usePresenterMode: (options: PresenterModeOptions) => PresenterModeResult;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=use-presenter-mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-presenter-mode.d.ts","sourceRoot":"","sources":["../../src/runtime/use-presenter-mode.ts"],"names":[],"mappings":"AAUA,KAAK,oBAAoB,GAAG;IAC1B,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CACtC,CAAA;AAED,KAAK,mBAAmB,GAAG;IACzB,mBAAmB,EAAE,MAAM,IAAI,CAAA;IAC/B,oBAAoB,EAAE,MAAM,IAAI,CAAA;IAChC,eAAe,EAAE,OAAO,CAAA;CACzB,CAAA;AAID,eAAO,MAAM,gBAAgB,GAAI,SAAS,oBAAoB,KAAG,mBAyDhE,CAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
+
const CHANNEL_NAME = 'slidenerds-presenter';
|
|
4
|
+
export const usePresenterMode = (options) => {
|
|
5
|
+
const { currentSlide, currentStep, onSlideChange, onStepChange } = options;
|
|
6
|
+
const channelRef = useRef(null);
|
|
7
|
+
const presenterWindowRef = useRef(null);
|
|
8
|
+
const [isPresenterOpen, setIsPresenterOpen] = useState(false);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (typeof BroadcastChannel === 'undefined')
|
|
11
|
+
return;
|
|
12
|
+
const channel = new BroadcastChannel(CHANNEL_NAME);
|
|
13
|
+
channelRef.current = channel;
|
|
14
|
+
channel.onmessage = (event) => {
|
|
15
|
+
const { type, slide, step } = event.data;
|
|
16
|
+
if (type === 'slide-change') {
|
|
17
|
+
onSlideChange(slide);
|
|
18
|
+
}
|
|
19
|
+
else if (type === 'step-change') {
|
|
20
|
+
onStepChange?.(step);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
return () => {
|
|
24
|
+
channel.close();
|
|
25
|
+
channelRef.current = null;
|
|
26
|
+
};
|
|
27
|
+
}, [onSlideChange, onStepChange]);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
channelRef.current?.postMessage({
|
|
30
|
+
type: 'slide-change',
|
|
31
|
+
slide: currentSlide,
|
|
32
|
+
step: currentStep,
|
|
33
|
+
});
|
|
34
|
+
}, [currentSlide, currentStep]);
|
|
35
|
+
const openPresenterWindow = useCallback(() => {
|
|
36
|
+
const url = new URL(window.location.href);
|
|
37
|
+
url.searchParams.set('presenter', 'true');
|
|
38
|
+
presenterWindowRef.current = window.open(url.toString(), 'slidenerds-presenter', 'width=1024,height=768');
|
|
39
|
+
setIsPresenterOpen(true);
|
|
40
|
+
}, []);
|
|
41
|
+
const closePresenterWindow = useCallback(() => {
|
|
42
|
+
presenterWindowRef.current?.close();
|
|
43
|
+
presenterWindowRef.current = null;
|
|
44
|
+
setIsPresenterOpen(false);
|
|
45
|
+
}, []);
|
|
46
|
+
return {
|
|
47
|
+
openPresenterWindow,
|
|
48
|
+
closePresenterWindow,
|
|
49
|
+
isPresenterOpen,
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=use-presenter-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-presenter-mode.js","sourceRoot":"","sources":["../../src/runtime/use-presenter-mode.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAqBhE,MAAM,YAAY,GAAG,sBAAsB,CAAA;AAE3C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAA6B,EAAuB,EAAE;IACrF,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,OAAO,CAAA;IAC1E,MAAM,UAAU,GAAG,MAAM,CAA0B,IAAI,CAAC,CAAA;IACxD,MAAM,kBAAkB,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAA;IACtD,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE7D,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,gBAAgB,KAAK,WAAW;Y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AAA;IAC1B,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,oBAAoB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC5C,kBAAkB,CAAC,OAAO,EAAE,KAAK,EAAE,CAAA;QACnC,kBAAkB,CAAC,OAAO,GAAG,IAAI,CAAA;QACjC,kBAAkB,CAAC,KAAK,CAAC,CAAA;IAC3B,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO;QACL,mBAAmB;QACnB,oBAAoB;QACpB,eAAe;KAChB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type SlideNavigationState = {
|
|
2
|
+
currentSlide: number;
|
|
3
|
+
currentStep: number;
|
|
4
|
+
totalSlides: number;
|
|
5
|
+
stepsForCurrentSlide: number;
|
|
6
|
+
isExiting: boolean;
|
|
7
|
+
goToSlide: (index: number) => void;
|
|
8
|
+
nextStep: () => void;
|
|
9
|
+
previousStep: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const useSlideNavigation: () => SlideNavigationState;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=use-slide-navigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-slide-navigation.d.ts","sourceRoot":"","sources":["../../src/runtime/use-slide-navigation.ts"],"names":[],"mappings":"AAaA,KAAK,oBAAoB,GAAG;IAC1B,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,SAAS,EAAE,OAAO,CAAA;IAClB,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,YAAY,EAAE,MAAM,IAAI,CAAA;CACzB,CAAA;AAgDD,eAAO,MAAM,kBAAkB,QAAO,oBA2NrC,CAAA"}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { getSlideElements, getExitStepElements, getStepEntries, hasExitAnimations, } from './slide-dom.js';
|
|
4
|
+
const EXIT_ANIMATION_DURATION = 400;
|
|
5
|
+
const MAGIC_MOVE_DURATION = 420;
|
|
6
|
+
const parseSlideFromUrl = () => {
|
|
7
|
+
if (typeof window === 'undefined')
|
|
8
|
+
return 0;
|
|
9
|
+
const params = new URLSearchParams(window.location.search);
|
|
10
|
+
const slide = params.get('slide');
|
|
11
|
+
if (!slide)
|
|
12
|
+
return 0;
|
|
13
|
+
const parsed = parseInt(slide, 10);
|
|
14
|
+
return Number.isNaN(parsed) ? 0 : Math.max(0, parsed - 1);
|
|
15
|
+
};
|
|
16
|
+
const syncUrlToSlide = (slideIndex) => {
|
|
17
|
+
if (typeof window === 'undefined')
|
|
18
|
+
return;
|
|
19
|
+
const url = new URL(window.location.href);
|
|
20
|
+
url.searchParams.set('slide', String(slideIndex + 1));
|
|
21
|
+
window.history.replaceState({}, '', url.toString());
|
|
22
|
+
};
|
|
23
|
+
const toggleClassByThreshold = (elements, visibleCount, className) => {
|
|
24
|
+
for (let i = 0; i < elements.length; i++) {
|
|
25
|
+
elements[i].classList.toggle(className, i < visibleCount);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const applyStepVisibility = (slideIndex, visibleSteps) => {
|
|
29
|
+
const entries = getStepEntries(slideIndex);
|
|
30
|
+
for (const [i, entry] of entries.entries()) {
|
|
31
|
+
const isVisible = i < visibleSteps;
|
|
32
|
+
for (const el of entry.elements) {
|
|
33
|
+
el.classList.toggle('step-visible', isVisible);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const setActiveSlide = (slides, targetIndex) => {
|
|
38
|
+
slides.forEach((slide, index) => {
|
|
39
|
+
slide.classList.toggle('active', index === targetIndex);
|
|
40
|
+
if (index !== targetIndex)
|
|
41
|
+
slide.classList.remove('exiting');
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
export const useSlideNavigation = () => {
|
|
45
|
+
const [currentSlide, setCurrentSlide] = useState(parseSlideFromUrl);
|
|
46
|
+
const [currentStep, setCurrentStep] = useState(0);
|
|
47
|
+
const [totalSlides, setTotalSlides] = useState(0);
|
|
48
|
+
const [stepsForCurrentSlide, setStepsForCurrentSlide] = useState(0);
|
|
49
|
+
const [isExiting, setIsExiting] = useState(false);
|
|
50
|
+
const totalSlidesRef = useRef(0);
|
|
51
|
+
const exitTimeoutRef = useRef(null);
|
|
52
|
+
const autoStepTimeoutRef = useRef(null);
|
|
53
|
+
const currentExitStep = useRef(0);
|
|
54
|
+
const cachedStepEntriesRef = useRef([]);
|
|
55
|
+
const cachedExitStepCountRef = useRef(0);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
const count = getSlideElements().length;
|
|
58
|
+
totalSlidesRef.current = count;
|
|
59
|
+
setTotalSlides(count);
|
|
60
|
+
setActiveSlide(getSlideElements(), currentSlide);
|
|
61
|
+
}, []);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
const entries = getStepEntries(currentSlide);
|
|
64
|
+
cachedStepEntriesRef.current = entries;
|
|
65
|
+
cachedExitStepCountRef.current = getExitStepElements(currentSlide).length;
|
|
66
|
+
setStepsForCurrentSlide(entries.length);
|
|
67
|
+
}, [currentSlide]);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
return () => {
|
|
70
|
+
if (exitTimeoutRef.current !== null)
|
|
71
|
+
clearTimeout(exitTimeoutRef.current);
|
|
72
|
+
if (autoStepTimeoutRef.current !== null)
|
|
73
|
+
clearTimeout(autoStepTimeoutRef.current);
|
|
74
|
+
};
|
|
75
|
+
}, []);
|
|
76
|
+
const clearAutoStepTimer = useCallback(() => {
|
|
77
|
+
if (autoStepTimeoutRef.current !== null) {
|
|
78
|
+
clearTimeout(autoStepTimeoutRef.current);
|
|
79
|
+
autoStepTimeoutRef.current = null;
|
|
80
|
+
}
|
|
81
|
+
}, []);
|
|
82
|
+
const performSlideTransition = useCallback((targetSlide) => {
|
|
83
|
+
const slides = getSlideElements();
|
|
84
|
+
const prevEl = slides[currentSlide];
|
|
85
|
+
const nextEl = slides[targetSlide];
|
|
86
|
+
const previousMagicIds = new Set();
|
|
87
|
+
if (prevEl) {
|
|
88
|
+
prevEl.querySelectorAll('[data-magic-id]').forEach((el) => {
|
|
89
|
+
const id = el.getAttribute('data-magic-id');
|
|
90
|
+
if (id)
|
|
91
|
+
previousMagicIds.add(id);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
setActiveSlide(slides, targetSlide);
|
|
95
|
+
if (nextEl && previousMagicIds.size > 0) {
|
|
96
|
+
nextEl.querySelectorAll('[data-magic-id]').forEach((el) => {
|
|
97
|
+
const id = el.getAttribute('data-magic-id');
|
|
98
|
+
if (!id || !previousMagicIds.has(id))
|
|
99
|
+
return;
|
|
100
|
+
const htmlEl = el;
|
|
101
|
+
htmlEl.style.transition = 'none';
|
|
102
|
+
htmlEl.style.opacity = '0';
|
|
103
|
+
htmlEl.style.transform = 'scale(0.96)';
|
|
104
|
+
const cleanupStyles = () => {
|
|
105
|
+
htmlEl.style.transition = '';
|
|
106
|
+
htmlEl.style.opacity = '';
|
|
107
|
+
htmlEl.style.transform = '';
|
|
108
|
+
};
|
|
109
|
+
requestAnimationFrame(() => {
|
|
110
|
+
requestAnimationFrame(() => {
|
|
111
|
+
htmlEl.style.transition =
|
|
112
|
+
`opacity ${MAGIC_MOVE_DURATION}ms cubic-bezier(0.4, 0, 0.2, 1), transform ${MAGIC_MOVE_DURATION}ms cubic-bezier(0.4, 0, 0.2, 1)`;
|
|
113
|
+
htmlEl.style.opacity = '1';
|
|
114
|
+
htmlEl.style.transform = 'scale(1)';
|
|
115
|
+
htmlEl.addEventListener('transitionend', cleanupStyles, { once: true });
|
|
116
|
+
setTimeout(cleanupStyles, MAGIC_MOVE_DURATION + 50);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
setCurrentSlide(targetSlide);
|
|
122
|
+
setCurrentStep(0);
|
|
123
|
+
setIsExiting(false);
|
|
124
|
+
currentExitStep.current = 0;
|
|
125
|
+
}, [currentSlide]);
|
|
126
|
+
const startExitTransition = useCallback((targetSlide) => {
|
|
127
|
+
const slides = getSlideElements();
|
|
128
|
+
const currentEl = slides[currentSlide];
|
|
129
|
+
if (!currentEl || !hasExitAnimations(currentSlide)) {
|
|
130
|
+
performSlideTransition(targetSlide);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
setIsExiting(true);
|
|
134
|
+
currentEl.classList.add('exiting');
|
|
135
|
+
if (exitTimeoutRef.current !== null) {
|
|
136
|
+
clearTimeout(exitTimeoutRef.current);
|
|
137
|
+
}
|
|
138
|
+
exitTimeoutRef.current = setTimeout(() => {
|
|
139
|
+
performSlideTransition(targetSlide);
|
|
140
|
+
exitTimeoutRef.current = null;
|
|
141
|
+
}, EXIT_ANIMATION_DURATION);
|
|
142
|
+
}, [currentSlide, performSlideTransition]);
|
|
143
|
+
const goToSlide = useCallback((index) => {
|
|
144
|
+
const total = totalSlidesRef.current;
|
|
145
|
+
if (total === 0)
|
|
146
|
+
return;
|
|
147
|
+
const clamped = Math.max(0, Math.min(index, total - 1));
|
|
148
|
+
if (clamped === currentSlide)
|
|
149
|
+
return;
|
|
150
|
+
clearAutoStepTimer();
|
|
151
|
+
startExitTransition(clamped);
|
|
152
|
+
}, [currentSlide, startExitTransition, clearAutoStepTimer]);
|
|
153
|
+
const nextStep = useCallback(() => {
|
|
154
|
+
if (isExiting)
|
|
155
|
+
return;
|
|
156
|
+
const logicalSteps = cachedStepEntriesRef.current.length;
|
|
157
|
+
const exitSteps = cachedExitStepCountRef.current;
|
|
158
|
+
if (currentStep < logicalSteps) {
|
|
159
|
+
setCurrentStep(currentStep + 1);
|
|
160
|
+
}
|
|
161
|
+
else if (exitSteps > 0 && currentExitStep.current < exitSteps) {
|
|
162
|
+
currentExitStep.current++;
|
|
163
|
+
toggleClassByThreshold(getExitStepElements(currentSlide), currentExitStep.current, 'exit-visible');
|
|
164
|
+
if (currentExitStep.current >= exitSteps && currentSlide < totalSlidesRef.current - 1) {
|
|
165
|
+
startExitTransition(currentSlide + 1);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
else if (currentSlide < totalSlidesRef.current - 1) {
|
|
169
|
+
clearAutoStepTimer();
|
|
170
|
+
startExitTransition(currentSlide + 1);
|
|
171
|
+
}
|
|
172
|
+
}, [currentSlide, currentStep, isExiting, startExitTransition, clearAutoStepTimer]);
|
|
173
|
+
const previousStep = useCallback(() => {
|
|
174
|
+
if (isExiting)
|
|
175
|
+
return;
|
|
176
|
+
if (currentExitStep.current > 0) {
|
|
177
|
+
currentExitStep.current--;
|
|
178
|
+
toggleClassByThreshold(getExitStepElements(currentSlide), currentExitStep.current, 'exit-visible');
|
|
179
|
+
}
|
|
180
|
+
else if (currentStep > 0) {
|
|
181
|
+
clearAutoStepTimer();
|
|
182
|
+
setCurrentStep(currentStep - 1);
|
|
183
|
+
}
|
|
184
|
+
else if (currentSlide > 0) {
|
|
185
|
+
clearAutoStepTimer();
|
|
186
|
+
startExitTransition(currentSlide - 1);
|
|
187
|
+
}
|
|
188
|
+
}, [currentSlide, currentStep, isExiting, startExitTransition, clearAutoStepTimer]);
|
|
189
|
+
useEffect(() => {
|
|
190
|
+
clearAutoStepTimer();
|
|
191
|
+
const entries = cachedStepEntriesRef.current;
|
|
192
|
+
if (entries.length === 0)
|
|
193
|
+
return;
|
|
194
|
+
const scheduleAutoStep = (stepIndex) => {
|
|
195
|
+
if (stepIndex >= entries.length)
|
|
196
|
+
return;
|
|
197
|
+
const entry = entries[stepIndex];
|
|
198
|
+
if (!entry.isAuto)
|
|
199
|
+
return;
|
|
200
|
+
autoStepTimeoutRef.current = setTimeout(() => {
|
|
201
|
+
setCurrentStep((prev) => {
|
|
202
|
+
const next = prev + 1;
|
|
203
|
+
scheduleAutoStep(next);
|
|
204
|
+
return next;
|
|
205
|
+
});
|
|
206
|
+
}, entry.autoDelay);
|
|
207
|
+
};
|
|
208
|
+
if (currentStep < entries.length && entries[currentStep]?.isAuto) {
|
|
209
|
+
scheduleAutoStep(currentStep);
|
|
210
|
+
}
|
|
211
|
+
return () => clearAutoStepTimer();
|
|
212
|
+
}, [currentSlide, clearAutoStepTimer]);
|
|
213
|
+
useEffect(() => {
|
|
214
|
+
applyStepVisibility(currentSlide, currentStep);
|
|
215
|
+
}, [currentSlide, currentStep]);
|
|
216
|
+
useEffect(() => {
|
|
217
|
+
syncUrlToSlide(currentSlide);
|
|
218
|
+
}, [currentSlide]);
|
|
219
|
+
return {
|
|
220
|
+
currentSlide,
|
|
221
|
+
currentStep,
|
|
222
|
+
totalSlides,
|
|
223
|
+
stepsForCurrentSlide,
|
|
224
|
+
isExiting,
|
|
225
|
+
goToSlide,
|
|
226
|
+
nextStep,
|
|
227
|
+
previousStep,
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
//# sourceMappingURL=use-slide-navigation.js.map
|