@codellyson/framely 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/package.json +3 -2
  2. package/src/AbsoluteFill.tsx +50 -0
  3. package/src/Audio.tsx +294 -0
  4. package/src/Composition.tsx +378 -0
  5. package/src/Easing.ts +294 -0
  6. package/src/ErrorBoundary.tsx +136 -0
  7. package/src/Folder.tsx +66 -0
  8. package/src/Freeze.tsx +63 -0
  9. package/src/IFrame.tsx +100 -0
  10. package/src/Img.tsx +146 -0
  11. package/src/Loop.tsx +139 -0
  12. package/src/Player.tsx +594 -0
  13. package/src/Sequence.tsx +80 -0
  14. package/src/Series.tsx +181 -0
  15. package/src/Text.tsx +376 -0
  16. package/src/Video.tsx +247 -0
  17. package/src/__tests__/Easing.test.js +119 -0
  18. package/src/__tests__/interpolate.test.js +127 -0
  19. package/src/config.ts +406 -0
  20. package/src/context.tsx +241 -0
  21. package/src/delayRender.ts +278 -0
  22. package/src/getInputProps.ts +217 -0
  23. package/src/hooks/useDelayRender.ts +117 -0
  24. package/src/hooks.ts +28 -0
  25. package/src/index.d.ts +571 -0
  26. package/src/index.ts +260 -0
  27. package/src/interpolate.ts +160 -0
  28. package/src/interpolateColors.ts +368 -0
  29. package/src/makeTransform.ts +339 -0
  30. package/src/measureSpring.ts +152 -0
  31. package/src/noise.ts +308 -0
  32. package/src/preload.ts +303 -0
  33. package/src/registerRoot.ts +346 -0
  34. package/src/shapes/Circle.tsx +37 -0
  35. package/src/shapes/Ellipse.tsx +39 -0
  36. package/src/shapes/Line.tsx +37 -0
  37. package/src/shapes/Path.tsx +56 -0
  38. package/src/shapes/Polygon.tsx +39 -0
  39. package/src/shapes/Rect.tsx +43 -0
  40. package/src/shapes/Svg.tsx +39 -0
  41. package/src/shapes/index.ts +16 -0
  42. package/src/shapes/usePathLength.ts +38 -0
  43. package/src/staticFile.ts +117 -0
  44. package/src/templates/api.ts +165 -0
  45. package/src/templates/index.ts +7 -0
  46. package/src/templates/mockData.ts +271 -0
  47. package/src/templates/types.ts +126 -0
  48. package/src/transitions/TransitionSeries.tsx +399 -0
  49. package/src/transitions/index.ts +109 -0
  50. package/src/transitions/presets/fade.ts +89 -0
  51. package/src/transitions/presets/flip.ts +263 -0
  52. package/src/transitions/presets/slide.ts +154 -0
  53. package/src/transitions/presets/wipe.ts +195 -0
  54. package/src/transitions/presets/zoom.ts +183 -0
  55. package/src/useAudioData.ts +260 -0
  56. package/src/useSpring.ts +215 -0
@@ -0,0 +1,271 @@
1
+ import type { Template } from './types';
2
+
3
+ /**
4
+ * Mock templates for development
5
+ * In production, these would come from a remote API
6
+ */
7
+ export const MOCK_TEMPLATES: Template[] = [
8
+ {
9
+ id: 'social-intro-1',
10
+ name: 'Modern Social Intro',
11
+ description:
12
+ 'Clean, modern intro animation perfect for social media videos. Features smooth text reveals and gradient backgrounds.',
13
+ category: 'intro-outro',
14
+ tags: ['intro', 'social', 'modern', 'minimal', 'gradient'],
15
+ preview: {
16
+ thumbnail: 'https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?w=400&h=225&fit=crop',
17
+ preview: undefined,
18
+ },
19
+ author: {
20
+ id: 'framely',
21
+ name: 'Framely Team',
22
+ verified: true,
23
+ },
24
+ bundleUrl: 'https://cdn.framely.dev/templates/social-intro-1/bundle.js',
25
+ version: '1.0.0',
26
+ width: 1080,
27
+ height: 1920,
28
+ fps: 30,
29
+ durationInFrames: 90,
30
+ defaultProps: {
31
+ title: 'Your Title Here',
32
+ subtitle: 'Subtitle text',
33
+ accentColor: '#6366f1',
34
+ },
35
+ downloads: 1250,
36
+ rating: 4.8,
37
+ featured: true,
38
+ createdAt: '2024-01-15T00:00:00Z',
39
+ updatedAt: '2024-01-20T00:00:00Z',
40
+ },
41
+ {
42
+ id: 'youtube-subscribe',
43
+ name: 'Subscribe Animation',
44
+ description:
45
+ 'Eye-catching subscribe button animation with bell notification. Perfect for YouTube outros and CTAs.',
46
+ category: 'social-media',
47
+ tags: ['youtube', 'subscribe', 'animation', 'cta', 'bell'],
48
+ preview: {
49
+ thumbnail: 'https://images.unsplash.com/photo-1611162616475-46b635cb6868?w=400&h=225&fit=crop',
50
+ },
51
+ author: {
52
+ id: 'framely',
53
+ name: 'Framely Team',
54
+ verified: true,
55
+ },
56
+ bundleUrl: 'https://cdn.framely.dev/templates/youtube-subscribe/bundle.js',
57
+ version: '1.0.0',
58
+ width: 1920,
59
+ height: 1080,
60
+ fps: 30,
61
+ durationInFrames: 120,
62
+ defaultProps: {
63
+ channelName: 'Your Channel',
64
+ buttonColor: '#FF0000',
65
+ showBell: true,
66
+ },
67
+ downloads: 2340,
68
+ rating: 4.9,
69
+ featured: true,
70
+ createdAt: '2024-01-10T00:00:00Z',
71
+ updatedAt: '2024-01-18T00:00:00Z',
72
+ },
73
+ {
74
+ id: 'lower-third-1',
75
+ name: 'Clean Lower Third',
76
+ description:
77
+ 'Professional lower third with smooth slide-in animation. Includes name, title, and optional social handle.',
78
+ category: 'lower-thirds',
79
+ tags: ['lower-third', 'professional', 'news', 'interview', 'name'],
80
+ preview: {
81
+ thumbnail: 'https://images.unsplash.com/photo-1478737270239-2f02b77fc618?w=400&h=225&fit=crop',
82
+ },
83
+ author: {
84
+ id: 'motion-pro',
85
+ name: 'Motion Pro',
86
+ verified: true,
87
+ },
88
+ bundleUrl: 'https://cdn.framely.dev/templates/lower-third-1/bundle.js',
89
+ version: '1.2.0',
90
+ width: 1920,
91
+ height: 1080,
92
+ fps: 30,
93
+ durationInFrames: 150,
94
+ defaultProps: {
95
+ name: 'John Doe',
96
+ title: 'CEO & Founder',
97
+ social: '@johndoe',
98
+ accentColor: '#3b82f6',
99
+ },
100
+ downloads: 890,
101
+ rating: 4.6,
102
+ featured: false,
103
+ createdAt: '2024-01-08T00:00:00Z',
104
+ updatedAt: '2024-01-15T00:00:00Z',
105
+ },
106
+ {
107
+ id: 'text-reveal-1',
108
+ name: 'Kinetic Text Reveal',
109
+ description:
110
+ 'Dynamic text reveal with character-by-character animation. Great for quotes, titles, and impact statements.',
111
+ category: 'text-animations',
112
+ tags: ['text', 'kinetic', 'reveal', 'typography', 'motion'],
113
+ preview: {
114
+ thumbnail: 'https://images.unsplash.com/photo-1455390582262-044cdead277a?w=400&h=225&fit=crop',
115
+ },
116
+ author: {
117
+ id: 'type-master',
118
+ name: 'Type Master',
119
+ verified: false,
120
+ },
121
+ bundleUrl: 'https://cdn.framely.dev/templates/text-reveal-1/bundle.js',
122
+ version: '1.0.0',
123
+ width: 1920,
124
+ height: 1080,
125
+ fps: 60,
126
+ durationInFrames: 180,
127
+ defaultProps: {
128
+ text: 'Your text here',
129
+ fontSize: 120,
130
+ fontWeight: 700,
131
+ color: '#ffffff',
132
+ backgroundColor: '#000000',
133
+ },
134
+ downloads: 1567,
135
+ rating: 4.7,
136
+ featured: false,
137
+ createdAt: '2024-01-05T00:00:00Z',
138
+ updatedAt: '2024-01-12T00:00:00Z',
139
+ },
140
+ {
141
+ id: 'gradient-bg-1',
142
+ name: 'Animated Gradient',
143
+ description:
144
+ 'Mesmerizing animated gradient background with smooth color transitions. Use as background for any content.',
145
+ category: 'backgrounds',
146
+ tags: ['background', 'gradient', 'animated', 'loop', 'colorful'],
147
+ preview: {
148
+ thumbnail: 'https://images.unsplash.com/photo-1557682250-33bd709cbe85?w=400&h=225&fit=crop',
149
+ },
150
+ author: {
151
+ id: 'framely',
152
+ name: 'Framely Team',
153
+ verified: true,
154
+ },
155
+ bundleUrl: 'https://cdn.framely.dev/templates/gradient-bg-1/bundle.js',
156
+ version: '1.0.0',
157
+ width: 1920,
158
+ height: 1080,
159
+ fps: 30,
160
+ durationInFrames: 300,
161
+ defaultProps: {
162
+ colors: ['#6366f1', '#8b5cf6', '#d946ef'],
163
+ speed: 1,
164
+ angle: 45,
165
+ },
166
+ downloads: 3210,
167
+ rating: 4.5,
168
+ featured: false,
169
+ createdAt: '2024-01-03T00:00:00Z',
170
+ updatedAt: '2024-01-10T00:00:00Z',
171
+ },
172
+ {
173
+ id: 'promo-slide-1',
174
+ name: 'Product Showcase',
175
+ description:
176
+ 'Professional product showcase template with dynamic transitions. Perfect for e-commerce and marketing.',
177
+ category: 'marketing',
178
+ tags: ['product', 'showcase', 'promo', 'ecommerce', 'marketing'],
179
+ preview: {
180
+ thumbnail: 'https://images.unsplash.com/photo-1460925895917-afdab827c52f?w=400&h=225&fit=crop',
181
+ },
182
+ author: {
183
+ id: 'ad-studio',
184
+ name: 'Ad Studio',
185
+ verified: true,
186
+ },
187
+ bundleUrl: 'https://cdn.framely.dev/templates/promo-slide-1/bundle.js',
188
+ version: '2.0.0',
189
+ width: 1080,
190
+ height: 1080,
191
+ fps: 30,
192
+ durationInFrames: 180,
193
+ defaultProps: {
194
+ productName: 'Product Name',
195
+ tagline: 'Your tagline here',
196
+ price: '$99.99',
197
+ ctaText: 'Shop Now',
198
+ brandColor: '#10b981',
199
+ },
200
+ downloads: 756,
201
+ rating: 4.4,
202
+ featured: true,
203
+ createdAt: '2024-01-01T00:00:00Z',
204
+ updatedAt: '2024-01-08T00:00:00Z',
205
+ },
206
+ {
207
+ id: 'presentation-1',
208
+ name: 'Slide Transition Pack',
209
+ description:
210
+ 'Collection of smooth slide transitions for presentations. Includes fade, slide, zoom, and flip variations.',
211
+ category: 'presentation',
212
+ tags: ['presentation', 'slides', 'transition', 'corporate', 'business'],
213
+ preview: {
214
+ thumbnail: 'https://images.unsplash.com/photo-1531538606174-0f90ff5dce83?w=400&h=225&fit=crop',
215
+ },
216
+ author: {
217
+ id: 'slide-pro',
218
+ name: 'Slide Pro',
219
+ verified: false,
220
+ },
221
+ bundleUrl: 'https://cdn.framely.dev/templates/presentation-1/bundle.js',
222
+ version: '1.1.0',
223
+ width: 1920,
224
+ height: 1080,
225
+ fps: 30,
226
+ durationInFrames: 60,
227
+ defaultProps: {
228
+ transitionType: 'slide',
229
+ direction: 'left',
230
+ duration: 0.5,
231
+ },
232
+ downloads: 445,
233
+ rating: 4.3,
234
+ featured: false,
235
+ createdAt: '2023-12-28T00:00:00Z',
236
+ updatedAt: '2024-01-05T00:00:00Z',
237
+ },
238
+ {
239
+ id: 'instagram-story',
240
+ name: 'Story Template',
241
+ description:
242
+ 'Trendy Instagram story template with animated stickers and text effects. Perfect for social media content.',
243
+ category: 'social-media',
244
+ tags: ['instagram', 'story', 'social', 'trendy', 'vertical'],
245
+ preview: {
246
+ thumbnail: 'https://images.unsplash.com/photo-1611262588024-d12430b98920?w=400&h=225&fit=crop',
247
+ },
248
+ author: {
249
+ id: 'social-creator',
250
+ name: 'Social Creator',
251
+ verified: true,
252
+ },
253
+ bundleUrl: 'https://cdn.framely.dev/templates/instagram-story/bundle.js',
254
+ version: '1.0.0',
255
+ width: 1080,
256
+ height: 1920,
257
+ fps: 30,
258
+ durationInFrames: 150,
259
+ defaultProps: {
260
+ headline: 'New Post!',
261
+ description: 'Check out our latest update',
262
+ backgroundColor: '#f472b6',
263
+ textColor: '#ffffff',
264
+ },
265
+ downloads: 1890,
266
+ rating: 4.6,
267
+ featured: false,
268
+ createdAt: '2023-12-25T00:00:00Z',
269
+ updatedAt: '2024-01-02T00:00:00Z',
270
+ },
271
+ ];
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Template types for the Framely Templates Marketplace
3
+ */
4
+
5
+ /**
6
+ * Template category for filtering
7
+ */
8
+ export type TemplateCategory =
9
+ | 'social-media'
10
+ | 'marketing'
11
+ | 'presentation'
12
+ | 'intro-outro'
13
+ | 'lower-thirds'
14
+ | 'text-animations'
15
+ | 'backgrounds';
16
+
17
+ /**
18
+ * Template author information
19
+ */
20
+ export interface TemplateAuthor {
21
+ id: string;
22
+ name: string;
23
+ avatar?: string;
24
+ verified?: boolean;
25
+ }
26
+
27
+ /**
28
+ * Template preview assets
29
+ */
30
+ export interface TemplatePreview {
31
+ /** Static thumbnail image URL */
32
+ thumbnail: string;
33
+ /** Animated preview GIF/WebM URL */
34
+ preview?: string;
35
+ /** Video preview URL (for modal) */
36
+ video?: string;
37
+ }
38
+
39
+ /**
40
+ * Template metadata
41
+ */
42
+ export interface Template {
43
+ /** Unique identifier */
44
+ id: string;
45
+ /** Display name */
46
+ name: string;
47
+ /** Template description */
48
+ description: string;
49
+ /** Category for filtering */
50
+ category: TemplateCategory;
51
+ /** Tags for search */
52
+ tags: string[];
53
+ /** Preview assets */
54
+ preview: TemplatePreview;
55
+ /** Template author */
56
+ author: TemplateAuthor;
57
+ /** Remote bundle URL for the component */
58
+ bundleUrl: string;
59
+ /** Template version */
60
+ version: string;
61
+ /** Video width */
62
+ width: number;
63
+ /** Video height */
64
+ height: number;
65
+ /** Frames per second */
66
+ fps: number;
67
+ /** Total duration in frames */
68
+ durationInFrames: number;
69
+ /** Default props for the template */
70
+ defaultProps: Record<string, unknown>;
71
+ /** Downloads count */
72
+ downloads?: number;
73
+ /** Average rating (1-5) */
74
+ rating?: number;
75
+ /** Featured flag */
76
+ featured?: boolean;
77
+ /** Creation date */
78
+ createdAt: string;
79
+ /** Last update date */
80
+ updatedAt: string;
81
+ }
82
+
83
+ /**
84
+ * API response for templates list
85
+ */
86
+ export interface TemplatesListResponse {
87
+ templates: Template[];
88
+ total: number;
89
+ page: number;
90
+ pageSize: number;
91
+ hasMore: boolean;
92
+ }
93
+
94
+ /**
95
+ * API request filters for templates
96
+ */
97
+ export interface TemplatesFilterParams {
98
+ category?: TemplateCategory;
99
+ search?: string;
100
+ tags?: string[];
101
+ featured?: boolean;
102
+ sortBy?: 'newest' | 'popular' | 'rating';
103
+ page?: number;
104
+ pageSize?: number;
105
+ }
106
+
107
+ /**
108
+ * Category with count for filter display
109
+ */
110
+ export interface CategoryCount {
111
+ category: TemplateCategory;
112
+ count: number;
113
+ }
114
+
115
+ /**
116
+ * Category display labels
117
+ */
118
+ export const CATEGORY_LABELS: Record<TemplateCategory, string> = {
119
+ 'social-media': 'Social Media',
120
+ 'marketing': 'Marketing',
121
+ 'presentation': 'Presentation',
122
+ 'intro-outro': 'Intro/Outro',
123
+ 'lower-thirds': 'Lower Thirds',
124
+ 'text-animations': 'Text Animations',
125
+ 'backgrounds': 'Backgrounds',
126
+ };