promptslide 0.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.
Files changed (39) hide show
  1. package/dist/index.d.ts +377 -0
  2. package/dist/index.js +963 -0
  3. package/dist/index.js.map +1 -0
  4. package/package.json +65 -0
  5. package/src/commands/build.mjs +73 -0
  6. package/src/commands/create.mjs +197 -0
  7. package/src/commands/preview.mjs +22 -0
  8. package/src/commands/studio.mjs +27 -0
  9. package/src/core/animated.tsx +153 -0
  10. package/src/core/animation-config.ts +98 -0
  11. package/src/core/animation-context.tsx +54 -0
  12. package/src/core/index.ts +73 -0
  13. package/src/core/layouts/shared-footer.tsx +43 -0
  14. package/src/core/morph.tsx +153 -0
  15. package/src/core/slide-deck.tsx +430 -0
  16. package/src/core/slide-error-boundary.tsx +50 -0
  17. package/src/core/theme-context.tsx +48 -0
  18. package/src/core/transitions.ts +200 -0
  19. package/src/core/types.ts +136 -0
  20. package/src/core/use-slide-navigation.ts +142 -0
  21. package/src/core/utils.ts +8 -0
  22. package/src/index.mjs +70 -0
  23. package/src/utils/ansi.mjs +5 -0
  24. package/src/utils/colors.mjs +44 -0
  25. package/src/utils/prompts.mjs +50 -0
  26. package/src/utils/tsconfig.mjs +35 -0
  27. package/src/vite/config.mjs +40 -0
  28. package/src/vite/plugin.mjs +66 -0
  29. package/templates/default/AGENTS.md +453 -0
  30. package/templates/default/README.md +35 -0
  31. package/templates/default/package.json +26 -0
  32. package/templates/default/public/logo.svg +7 -0
  33. package/templates/default/src/App.tsx +11 -0
  34. package/templates/default/src/deck-config.ts +8 -0
  35. package/templates/default/src/globals.css +157 -0
  36. package/templates/default/src/layouts/slide-layout-centered.tsx +59 -0
  37. package/templates/default/src/slides/slide-example.tsx +53 -0
  38. package/templates/default/src/slides/slide-title.tsx +27 -0
  39. package/templates/default/src/theme.ts +8 -0
@@ -0,0 +1,377 @@
1
+ import { Variants, Transition } from 'framer-motion';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import React$1 from 'react';
4
+ import { ClassValue } from 'clsx';
5
+
6
+ /**
7
+ * Centralized animation configuration for the slide deck framework.
8
+ * All animation timings, easings, and spring configs are defined here.
9
+ */
10
+ /** Duration for slide-to-slide transitions (seconds) */
11
+ declare const SLIDE_TRANSITION_DURATION = 0.3;
12
+ /** Duration for morph/layout animations between slides (seconds) */
13
+ declare const MORPH_DURATION = 0.8;
14
+ /** Duration for within-slide step animations (seconds) */
15
+ declare const STEP_ANIMATION_DURATION = 0.4;
16
+ /** Default stagger delay for grouped animations (seconds) */
17
+ declare const STAGGER_DELAY = 0.1;
18
+ declare const EASE_DEFAULT: "easeInOut";
19
+ declare const EASE_OUT: "easeOut";
20
+ declare const EASE_IN: "easeIn";
21
+ /** Smooth ease-in-out curve for morph animations (cubic bezier) */
22
+ declare const EASE_MORPH: readonly [0.4, 0, 0.2, 1];
23
+ /** Spring config for snappy, responsive animations */
24
+ declare const SPRING_SNAPPY: {
25
+ type: "spring";
26
+ stiffness: number;
27
+ damping: number;
28
+ };
29
+ /** Spring config for smooth, gentle animations */
30
+ declare const SPRING_SMOOTH: {
31
+ type: "spring";
32
+ stiffness: number;
33
+ damping: number;
34
+ };
35
+ /** Spring config for bouncy animations */
36
+ declare const SPRING_BOUNCY: {
37
+ type: "spring";
38
+ stiffness: number;
39
+ damping: number;
40
+ };
41
+ /** Standard transition for slide transitions */
42
+ declare const SLIDE_TRANSITION: {
43
+ readonly duration: 0.3;
44
+ readonly ease: "easeInOut";
45
+ };
46
+ /** Standard transition for morph animations (smooth ease-in-out) */
47
+ declare const MORPH_TRANSITION: {
48
+ duration: number;
49
+ ease: readonly [0.4, 0, 0.2, 1];
50
+ };
51
+ /** Standard transition for step animations (spring-based, duration computed from stiffness/damping) */
52
+ declare const STEP_TRANSITION: {
53
+ type: "spring";
54
+ stiffness: number;
55
+ damping: number;
56
+ };
57
+ /** Distance for slide animations */
58
+ declare const SLIDE_DISTANCE = 100;
59
+ /** Distance for within-slide element animations */
60
+ declare const ELEMENT_SLIDE_DISTANCE = 30;
61
+ /** Standard slide dimensions (16:9 aspect ratio) */
62
+ declare const SLIDE_DIMENSIONS: {
63
+ readonly width: 1280;
64
+ readonly height: 720;
65
+ readonly aspectRatio: number;
66
+ };
67
+
68
+ /**
69
+ * Slide transition variants for the slide deck framework.
70
+ * These define how slides enter and exit during navigation.
71
+ */
72
+
73
+ type SlideTransitionType = "fade" | "slide-left" | "slide-right" | "slide-up" | "slide-down" | "zoom" | "zoom-fade" | "morph" | "none";
74
+ interface SlideTransitionConfig {
75
+ /** The transition type */
76
+ type: SlideTransitionType;
77
+ /** Optional custom duration (overrides default) */
78
+ duration?: number;
79
+ /** Whether to use directional transitions based on navigation direction */
80
+ directional?: boolean;
81
+ }
82
+ declare const SLIDE_VARIANTS: Record<SlideTransitionType, Variants>;
83
+ declare function createDirectionalVariants(axis?: "x" | "y"): (direction: number) => Variants;
84
+ /** Horizontal directional slide (left/right based on direction) */
85
+ declare const directionalSlideX: (direction: number) => Variants;
86
+ /** Vertical directional slide (up/down based on direction) */
87
+ declare const directionalSlideY: (direction: number) => Variants;
88
+ declare function getSlideVariants(config: SlideTransitionConfig | SlideTransitionType, direction?: number): Variants;
89
+ declare function getSlideTransition(config?: SlideTransitionConfig | SlideTransitionType): {
90
+ duration: number;
91
+ ease: typeof SLIDE_TRANSITION.ease;
92
+ };
93
+ declare const DEFAULT_SLIDE_TRANSITION: SlideTransitionType;
94
+
95
+ /**
96
+ * Shared types for the slide deck framework.
97
+ */
98
+
99
+ /**
100
+ * Props that all slide components receive.
101
+ */
102
+ interface SlideProps {
103
+ slideNumber: number;
104
+ totalSlides: number;
105
+ }
106
+ /**
107
+ * A React component that renders a slide.
108
+ */
109
+ type SlideComponent = React.ComponentType<SlideProps>;
110
+ /**
111
+ * Configuration for a single slide including its animation step count.
112
+ * The `steps` property declares how many animation steps the slide has,
113
+ * eliminating the need for runtime step discovery.
114
+ */
115
+ interface SlideConfig {
116
+ /** The slide component to render */
117
+ component: SlideComponent;
118
+ /** Number of animation steps (0 = no animations). This is the max step number used in <Animated step={N}> */
119
+ steps: number;
120
+ /** Display name for grid view thumbnails, navigation, and accessibility */
121
+ title?: string;
122
+ /** Speaker notes (not rendered on slide, shown in notes panel) */
123
+ notes?: string;
124
+ /** Per-slide transition override (falls back to deck-level transition) */
125
+ transition?: SlideTransitionType;
126
+ /** Section/chapter name for grouping slides in grid view */
127
+ section?: string;
128
+ }
129
+ /**
130
+ * Direction of slide navigation.
131
+ * - 1: Forward (next slide)
132
+ * - -1: Backward (previous slide)
133
+ * - 0: Direct jump (no direction)
134
+ */
135
+ type NavigationDirection = -1 | 0 | 1;
136
+ /**
137
+ * Logo variants for different contexts.
138
+ */
139
+ interface ThemeLogos {
140
+ /** Full logo (default, used in footers) */
141
+ full?: string;
142
+ /** Icon-only mark (used in compact spaces) */
143
+ icon?: string;
144
+ /** Light version for dark backgrounds */
145
+ fullLight?: string;
146
+ /** Light icon for dark backgrounds */
147
+ iconLight?: string;
148
+ }
149
+ /**
150
+ * Brand color overrides using OKLCH strings.
151
+ * Injected as CSS custom properties at runtime.
152
+ * If omitted, the existing globals.css values apply.
153
+ */
154
+ interface ThemeColors {
155
+ primary?: string;
156
+ primaryForeground?: string;
157
+ secondary?: string;
158
+ secondaryForeground?: string;
159
+ accent?: string;
160
+ accentForeground?: string;
161
+ }
162
+ /**
163
+ * Corporate visual assets (paths relative to public/).
164
+ */
165
+ interface ThemeAssets {
166
+ /** Background image URL (e.g. for title slides) */
167
+ backgroundImage?: string;
168
+ /** Subtle pattern overlay URL */
169
+ patternImage?: string;
170
+ }
171
+ /**
172
+ * Typography preferences. Font names must be loaded via
173
+ * <link> in index.html or @font-face in globals.css.
174
+ */
175
+ interface ThemeFonts {
176
+ heading?: string;
177
+ body?: string;
178
+ }
179
+ /**
180
+ * Full theme configuration.
181
+ */
182
+ interface ThemeConfig {
183
+ /** Company/product name (shown in footers) */
184
+ name: string;
185
+ /** Optional tagline */
186
+ tagline?: string;
187
+ /** Logo configuration */
188
+ logo?: ThemeLogos;
189
+ /** Brand color overrides (OKLCH strings) */
190
+ colors?: ThemeColors;
191
+ /** Corporate visual assets */
192
+ assets?: ThemeAssets;
193
+ /** Typography preferences */
194
+ fonts?: ThemeFonts;
195
+ }
196
+
197
+ interface AnimationContextValue {
198
+ /** Current animation step (0 = no animations shown yet) */
199
+ currentStep: number;
200
+ /** Total animation steps in this slide (declared in slide config) */
201
+ totalSteps: number;
202
+ /** When true, all animation steps should be visible (used for backward navigation) */
203
+ showAllAnimations: boolean;
204
+ }
205
+ interface AnimationProviderProps {
206
+ children: React.ReactNode;
207
+ /** Current animation step (0 = no animations shown yet) */
208
+ currentStep: number;
209
+ /** Total animation steps declared in slide config */
210
+ totalSteps: number;
211
+ /** When true, show all animations regardless of currentStep (for backward navigation) */
212
+ showAllAnimations?: boolean;
213
+ }
214
+ /**
215
+ * Provides animation context to child components.
216
+ *
217
+ * The totalSteps is now passed from parent (declared in slide config)
218
+ * rather than discovered at runtime, eliminating race conditions.
219
+ */
220
+ declare function AnimationProvider({ children, currentStep, totalSteps, showAllAnimations }: AnimationProviderProps): react_jsx_runtime.JSX.Element;
221
+ declare function useAnimationContext(): AnimationContextValue;
222
+
223
+ type AnimationType = "fade" | "slide-up" | "slide-down" | "slide-left" | "slide-right" | "scale";
224
+ interface AnimatedProps {
225
+ /** Which step reveals this content (1-indexed) */
226
+ step: number;
227
+ /** Animation type */
228
+ animation?: AnimationType;
229
+ /** Animation duration in seconds */
230
+ duration?: number;
231
+ /** Delay after trigger in seconds */
232
+ delay?: number;
233
+ /** Custom className */
234
+ className?: string;
235
+ children: React.ReactNode;
236
+ }
237
+ /**
238
+ * Animated element that appears at a specific animation step.
239
+ *
240
+ * The step count is now declared in slide config rather than discovered
241
+ * at runtime, so this component simply consumes the context without
242
+ * needing to register itself.
243
+ */
244
+ declare function Animated({ step, animation, duration, delay, className, children }: AnimatedProps): react_jsx_runtime.JSX.Element;
245
+ /**
246
+ * Wrapper for staggering multiple children.
247
+ * Each direct child will be animated in sequence.
248
+ */
249
+ interface AnimatedGroupProps {
250
+ /** Starting step for the first child */
251
+ startStep: number;
252
+ /** Animation type for all children */
253
+ animation?: AnimationType;
254
+ /** Delay between each child in seconds */
255
+ staggerDelay?: number;
256
+ className?: string;
257
+ children: React.ReactNode;
258
+ }
259
+ declare function AnimatedGroup({ startStep, animation, staggerDelay, className, children }: AnimatedGroupProps): react_jsx_runtime.JSX.Element;
260
+
261
+ interface MorphProps {
262
+ layoutId: string;
263
+ transition?: Transition;
264
+ className?: string;
265
+ children: React.ReactNode;
266
+ }
267
+ interface MorphGroupProps {
268
+ groupId: string;
269
+ transition?: Transition;
270
+ className?: string;
271
+ children: React.ReactNode;
272
+ }
273
+ /**
274
+ * Wrapper component that enables morph/shared-layout animations between slides.
275
+ *
276
+ * Usage:
277
+ * ```tsx
278
+ * // Slide 1 - Large version
279
+ * <Morph layoutId="hero-title">
280
+ * <h1 className="text-6xl">Title</h1>
281
+ * </Morph>
282
+ *
283
+ * // Slide 2 - Small version (same layoutId = morphs between them)
284
+ * <Morph layoutId="hero-title">
285
+ * <h1 className="text-2xl">Title</h1>
286
+ * </Morph>
287
+ * ```
288
+ */
289
+ declare function Morph({ layoutId, transition, className, children }: MorphProps): react_jsx_runtime.JSX.Element;
290
+ declare function MorphGroup({ groupId, transition, className, children }: MorphGroupProps): react_jsx_runtime.JSX.Element;
291
+ interface MorphItemProps {
292
+ id: string;
293
+ prefix?: string;
294
+ transition?: Transition;
295
+ className?: string;
296
+ children: React.ReactNode;
297
+ }
298
+ declare function MorphItem({ id, prefix, transition, className, children }: MorphItemProps): react_jsx_runtime.JSX.Element;
299
+ interface MorphTextProps {
300
+ layoutId: string;
301
+ as?: "h1" | "h2" | "h3" | "h4" | "p" | "span";
302
+ transition?: Transition;
303
+ className?: string;
304
+ children: React.ReactNode;
305
+ }
306
+ declare function MorphText({ layoutId, as: Component, transition, className, children }: MorphTextProps): react_jsx_runtime.JSX.Element;
307
+
308
+ interface UseSlideNavigationOptions {
309
+ slides: SlideConfig[];
310
+ initialSlide?: number;
311
+ onSlideChange?: (slideIndex: number) => void;
312
+ }
313
+ interface UseSlideNavigationReturn {
314
+ currentSlide: number;
315
+ animationStep: number;
316
+ totalSteps: number;
317
+ direction: NavigationDirection;
318
+ isTransitioning: boolean;
319
+ showAllAnimations: boolean;
320
+ advance: () => void;
321
+ goBack: () => void;
322
+ goToSlide: (index: number) => void;
323
+ onTransitionComplete: () => void;
324
+ }
325
+ declare function useSlideNavigation({ slides, initialSlide, onSlideChange }: UseSlideNavigationOptions): UseSlideNavigationReturn;
326
+
327
+ /**
328
+ * Access the full theme config. Returns null outside SlideThemeProvider.
329
+ */
330
+ declare function useTheme(): ThemeConfig | null;
331
+ interface SlideThemeProviderProps {
332
+ theme: ThemeConfig;
333
+ children: React.ReactNode;
334
+ }
335
+ /**
336
+ * Provides the full theme to all descendants.
337
+ * Injects CSS variable overrides via inline style.
338
+ */
339
+ declare function SlideThemeProvider({ theme, children }: SlideThemeProviderProps): react_jsx_runtime.JSX.Element;
340
+
341
+ interface SlideFooterProps {
342
+ slideNumber: number;
343
+ totalSlides: number;
344
+ /** Use light text/logo for dark slide backgrounds */
345
+ variant?: "default" | "light";
346
+ }
347
+ declare function SlideFooter({ slideNumber, totalSlides, variant }: SlideFooterProps): react_jsx_runtime.JSX.Element | null;
348
+
349
+ interface SlideDeckProps {
350
+ slides: SlideConfig[];
351
+ transition?: SlideTransitionType;
352
+ directionalTransition?: boolean;
353
+ }
354
+ declare function SlideDeck({ slides, transition, directionalTransition }: SlideDeckProps): react_jsx_runtime.JSX.Element;
355
+
356
+ interface SlideErrorBoundaryProps {
357
+ slideIndex: number;
358
+ slideTitle?: string;
359
+ children: React$1.ReactNode;
360
+ }
361
+ interface SlideErrorBoundaryState {
362
+ hasError: boolean;
363
+ error: Error | null;
364
+ }
365
+ declare class SlideErrorBoundary extends React$1.Component<SlideErrorBoundaryProps, SlideErrorBoundaryState> {
366
+ state: SlideErrorBoundaryState;
367
+ static getDerivedStateFromError(error: Error): {
368
+ hasError: boolean;
369
+ error: Error;
370
+ };
371
+ componentDidCatch(error: Error, errorInfo: React$1.ErrorInfo): void;
372
+ render(): string | number | bigint | boolean | Iterable<React$1.ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<React$1.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
373
+ }
374
+
375
+ declare function cn(...inputs: ClassValue[]): string;
376
+
377
+ export { Animated, AnimatedGroup, AnimationProvider, type AnimationType, DEFAULT_SLIDE_TRANSITION, EASE_DEFAULT, EASE_IN, EASE_MORPH, EASE_OUT, ELEMENT_SLIDE_DISTANCE, MORPH_DURATION, MORPH_TRANSITION, Morph, MorphGroup, MorphItem, MorphText, type NavigationDirection, SLIDE_DIMENSIONS, SLIDE_DISTANCE, SLIDE_TRANSITION, SLIDE_TRANSITION_DURATION, SLIDE_VARIANTS, SPRING_BOUNCY, SPRING_SMOOTH, SPRING_SNAPPY, STAGGER_DELAY, STEP_ANIMATION_DURATION, STEP_TRANSITION, type SlideComponent, type SlideConfig, SlideDeck, SlideErrorBoundary, SlideFooter, type SlideProps, SlideThemeProvider, type SlideTransitionConfig, type SlideTransitionType, type ThemeConfig, type UseSlideNavigationOptions, type UseSlideNavigationReturn, cn, createDirectionalVariants, directionalSlideX, directionalSlideY, getSlideTransition, getSlideVariants, useAnimationContext, useSlideNavigation, useTheme };