@stagecliplk/remotion-template 1.0.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/README.md +396 -0
- package/dist/index.cjs.js +94 -0
- package/dist/index.es.js +12268 -0
- package/package.json +60 -0
package/README.md
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
# @stageclip/remotion-template
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@stageclip/remotion-template)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
A powerful, reusable React component for editing and previewing Remotion video templates. Built with TypeScript and
|
|
7
|
+
designed for production use.
|
|
8
|
+
|
|
9
|
+
## **Features**
|
|
10
|
+
|
|
11
|
+
✅ **Rich Template Editor** - Full-featured UI for customizing video templates
|
|
12
|
+
✅ **Real-time Preview** - Integrated Remotion player for instant feedback
|
|
13
|
+
✅ **TypeScript Support** - Fully typed for excellent DX
|
|
14
|
+
✅ **Flexible API** - Props-based, no global state
|
|
15
|
+
✅ **Modular** - Import only what you need
|
|
16
|
+
✅ **Production Ready** - Battle-tested in StageClip's production environment
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## **Installation**
|
|
21
|
+
|
|
22
|
+
### **Prerequisites**
|
|
23
|
+
|
|
24
|
+
- React >= 18.0.0
|
|
25
|
+
- Node.js >= 18.18.0
|
|
26
|
+
|
|
27
|
+
### **Install from Azure Artifacts**
|
|
28
|
+
|
|
29
|
+
1. **Configure `.npmrc`** in your project root:
|
|
30
|
+
|
|
31
|
+
```ini
|
|
32
|
+
registry=https://pkgs.dev.azure.com/YOUR_ORG/_packaging/YOUR_FEED/npm/registry/
|
|
33
|
+
always-auth=true
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
2. **Install the package:**
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install @stageclip/remotion-template
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Or with yarn:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
yarn add @stageclip/remotion-template
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Note:** Peer dependencies (`react`, `react-dom`, `remotion`, `@remotion/player`, `@remotion/media-utils`) will be
|
|
49
|
+
installed automatically if not present.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## **Quick Start**
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import React, { useState } from 'react';
|
|
57
|
+
import { TemplateEditor, RemotionPlayer, VideoTemplate } from '@stageclip/remotion-template';
|
|
58
|
+
|
|
59
|
+
function App() {
|
|
60
|
+
const [template, setTemplate] = useState<VideoTemplate>({
|
|
61
|
+
compositionDefaults: {
|
|
62
|
+
fps: 30,
|
|
63
|
+
width: 1920,
|
|
64
|
+
height: 1080,
|
|
65
|
+
aspectRatio: '16:9',
|
|
66
|
+
totalFrames: 300,
|
|
67
|
+
},
|
|
68
|
+
globalBranding: {
|
|
69
|
+
institutionName: 'My Institution',
|
|
70
|
+
brandColor1: '#00802b',
|
|
71
|
+
brandColor2: '#005a1e',
|
|
72
|
+
brandColor3: '#00cc44',
|
|
73
|
+
fontFamily: 'Inter',
|
|
74
|
+
fontSize: 48,
|
|
75
|
+
lineSpacing: 1.2,
|
|
76
|
+
logoPrimary: '',
|
|
77
|
+
logoSecondary: '',
|
|
78
|
+
socialMedia: {
|
|
79
|
+
websiteUrl: '',
|
|
80
|
+
contactLine: '',
|
|
81
|
+
instagramHandle: '',
|
|
82
|
+
hashtag: '',
|
|
83
|
+
},
|
|
84
|
+
musicUrl: '',
|
|
85
|
+
musicVolume: 0.3,
|
|
86
|
+
},
|
|
87
|
+
timeline: [],
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<div style={{ display: 'flex', gap: 20 }}>
|
|
92
|
+
<TemplateEditor
|
|
93
|
+
template={template}
|
|
94
|
+
selectedSceneId={null}
|
|
95
|
+
onTemplateChange={setTemplate}
|
|
96
|
+
onClearSelection={() => {}}
|
|
97
|
+
/>
|
|
98
|
+
<RemotionPlayer template={template} />
|
|
99
|
+
</div>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export default App;
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## **Core Components**
|
|
109
|
+
|
|
110
|
+
### **TemplateEditor**
|
|
111
|
+
|
|
112
|
+
Main component for editing video templates.
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
<TemplateEditor
|
|
116
|
+
template={template}
|
|
117
|
+
selectedSceneId={selectedSceneId}
|
|
118
|
+
onTemplateChange={handleTemplateChange}
|
|
119
|
+
onClearSelection={handleClearSelection}
|
|
120
|
+
onOpenMediaLibrary={handleOpenMediaLibrary}
|
|
121
|
+
onAspectRatioChange={handleAspectRatioChange}
|
|
122
|
+
/>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Props:**
|
|
126
|
+
|
|
127
|
+
- `template: VideoTemplate` - Current template configuration
|
|
128
|
+
- `selectedSceneId: string | null` - ID of selected scene
|
|
129
|
+
- `onTemplateChange: (template: VideoTemplate) => void` - Callback when template changes
|
|
130
|
+
- `onClearSelection: () => void` - Callback to clear selection
|
|
131
|
+
- `onOpenMediaLibrary?: (sceneId, propPath, mediaType, options) => void` - Optional media picker
|
|
132
|
+
- `onAspectRatioChange?: (aspectRatio: '16:9' | '9:16') => void` - Optional aspect ratio handler
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
### **RemotionPlayer**
|
|
137
|
+
|
|
138
|
+
Component for previewing video templates.
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
<RemotionPlayer template={template} width={1280} height={720} />
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Props:**
|
|
145
|
+
|
|
146
|
+
- `template: VideoTemplate` - Template to preview
|
|
147
|
+
- `width?: number` - Player width (optional)
|
|
148
|
+
- `height?: number` - Player height (optional)
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## **Exported Components**
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
// Main components
|
|
156
|
+
import { TemplateEditor, RemotionPlayer } from '@stageclip/remotion-template';
|
|
157
|
+
|
|
158
|
+
// Sub-components
|
|
159
|
+
import { ColorPicker, RangeSlider, DualRangeSlider, LogoPicker, SceneTimeline } from '@stageclip/remotion-template';
|
|
160
|
+
|
|
161
|
+
// Types
|
|
162
|
+
import type {
|
|
163
|
+
VideoTemplate,
|
|
164
|
+
CompositionDefaults,
|
|
165
|
+
GlobalBranding,
|
|
166
|
+
SocialMedia,
|
|
167
|
+
ParticipantData,
|
|
168
|
+
GoogleFont,
|
|
169
|
+
LogoOption,
|
|
170
|
+
} from '@stageclip/remotion-template';
|
|
171
|
+
|
|
172
|
+
// Utilities
|
|
173
|
+
import {
|
|
174
|
+
GOOGLE_FONTS,
|
|
175
|
+
loadGoogleFont,
|
|
176
|
+
getFontFamilyString,
|
|
177
|
+
calculateSceneDuration,
|
|
178
|
+
colors,
|
|
179
|
+
fontFamily,
|
|
180
|
+
} from '@stageclip/remotion-template';
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## **TypeScript**
|
|
186
|
+
|
|
187
|
+
Full TypeScript support included. All types are exported:
|
|
188
|
+
|
|
189
|
+
```typescript
|
|
190
|
+
import type { VideoTemplate } from '@stageclip/remotion-template';
|
|
191
|
+
|
|
192
|
+
const myTemplate: VideoTemplate = {
|
|
193
|
+
// Fully typed!
|
|
194
|
+
};
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## **Documentation**
|
|
200
|
+
|
|
201
|
+
- **[Usage Guide](./USAGE.md)** - Comprehensive usage examples and patterns
|
|
202
|
+
- **[Publishing Guide](./PUBLISHING.md)** - How to publish updates to Azure Artifacts
|
|
203
|
+
- **[API Reference](./USAGE.md#api-reference)** - Complete API documentation
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## **Examples**
|
|
208
|
+
|
|
209
|
+
### **With Media Library Integration**
|
|
210
|
+
|
|
211
|
+
```tsx
|
|
212
|
+
function VideoEditorWithMediaLibrary() {
|
|
213
|
+
const [template, setTemplate] = useState<VideoTemplate>(initialTemplate);
|
|
214
|
+
const [selectedSceneId, setSelectedSceneId] = useState<string | null>(null);
|
|
215
|
+
|
|
216
|
+
const handleOpenMediaLibrary = (sceneId, propPath, mediaType, options) => {
|
|
217
|
+
// Open your media library modal
|
|
218
|
+
// Update template with selected media
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
return (
|
|
222
|
+
<TemplateEditor
|
|
223
|
+
template={template}
|
|
224
|
+
selectedSceneId={selectedSceneId}
|
|
225
|
+
onTemplateChange={setTemplate}
|
|
226
|
+
onClearSelection={() => setSelectedSceneId(null)}
|
|
227
|
+
onOpenMediaLibrary={handleOpenMediaLibrary}
|
|
228
|
+
/>
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### **With Auto-Save**
|
|
234
|
+
|
|
235
|
+
```tsx
|
|
236
|
+
import { useDebounce } from 'use-debounce';
|
|
237
|
+
|
|
238
|
+
function VideoEditorWithAutoSave() {
|
|
239
|
+
const [template, setTemplate] = useState<VideoTemplate>(initialTemplate);
|
|
240
|
+
const [debouncedTemplate] = useDebounce(template, 1000);
|
|
241
|
+
|
|
242
|
+
useEffect(() => {
|
|
243
|
+
// Auto-save to backend
|
|
244
|
+
saveToBackend(debouncedTemplate);
|
|
245
|
+
}, [debouncedTemplate]);
|
|
246
|
+
|
|
247
|
+
return (
|
|
248
|
+
<TemplateEditor
|
|
249
|
+
template={template}
|
|
250
|
+
selectedSceneId={null}
|
|
251
|
+
onTemplateChange={setTemplate}
|
|
252
|
+
onClearSelection={() => {}}
|
|
253
|
+
/>
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## **Styling**
|
|
261
|
+
|
|
262
|
+
The component uses inline styles with a built-in theme. You can wrap it in a container for additional styling:
|
|
263
|
+
|
|
264
|
+
```tsx
|
|
265
|
+
import { colors } from '@stageclip/remotion-template';
|
|
266
|
+
|
|
267
|
+
<div
|
|
268
|
+
style={{
|
|
269
|
+
backgroundColor: colors.bgPaper,
|
|
270
|
+
padding: 20,
|
|
271
|
+
borderRadius: 8,
|
|
272
|
+
}}
|
|
273
|
+
>
|
|
274
|
+
<TemplateEditor {...props} />
|
|
275
|
+
</div>;
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
**Available theme colors:**
|
|
279
|
+
|
|
280
|
+
- `colors.primary` - Primary brand color
|
|
281
|
+
- `colors.textPrimary` - Main text color
|
|
282
|
+
- `colors.bgDefault` - Default background
|
|
283
|
+
- `colors.bgPaper` - Paper/card background
|
|
284
|
+
- And more...
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## **Browser Support**
|
|
289
|
+
|
|
290
|
+
- Chrome (latest)
|
|
291
|
+
- Firefox (latest)
|
|
292
|
+
- Safari (latest)
|
|
293
|
+
- Edge (latest)
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## **Requirements**
|
|
298
|
+
|
|
299
|
+
### **Peer Dependencies**
|
|
300
|
+
|
|
301
|
+
```json
|
|
302
|
+
{
|
|
303
|
+
"react": ">=18",
|
|
304
|
+
"react-dom": ">=18",
|
|
305
|
+
"remotion": ">=4",
|
|
306
|
+
"@remotion/player": "^4.0.400",
|
|
307
|
+
"@remotion/media-utils": "^4.0.400",
|
|
308
|
+
"@remotion/transitions": "^4.0.400"
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## **Development**
|
|
315
|
+
|
|
316
|
+
This package is developed inside the StageClip Producer monorepo.
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
# Navigate to package directory
|
|
320
|
+
cd src/shared/remotion-template
|
|
321
|
+
|
|
322
|
+
# Install dependencies
|
|
323
|
+
npm install
|
|
324
|
+
|
|
325
|
+
# Type check
|
|
326
|
+
npm run typecheck
|
|
327
|
+
|
|
328
|
+
# Build
|
|
329
|
+
npm run build
|
|
330
|
+
|
|
331
|
+
# Clean build artifacts
|
|
332
|
+
npm run clean
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## **Publishing**
|
|
338
|
+
|
|
339
|
+
Publishing is handled through Azure Artifacts. See [PUBLISHING.md](./PUBLISHING.md) for detailed instructions.
|
|
340
|
+
|
|
341
|
+
**Quick publish:**
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
cd src/shared/remotion-template
|
|
345
|
+
|
|
346
|
+
# Bump version
|
|
347
|
+
npm version patch # or minor, major
|
|
348
|
+
|
|
349
|
+
# Build and publish
|
|
350
|
+
npm publish
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
## **Versioning**
|
|
356
|
+
|
|
357
|
+
We follow [Semantic Versioning](https://semver.org/):
|
|
358
|
+
|
|
359
|
+
- **MAJOR** - Breaking changes
|
|
360
|
+
- **MINOR** - New features (backward compatible)
|
|
361
|
+
- **PATCH** - Bug fixes
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## **License**
|
|
366
|
+
|
|
367
|
+
MIT © StageClip
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## **Support**
|
|
372
|
+
|
|
373
|
+
For issues, questions, or feature requests:
|
|
374
|
+
|
|
375
|
+
- **Internal:** Contact the StageClip development team
|
|
376
|
+
- **External:** Create an issue in the repository
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
## **Changelog**
|
|
381
|
+
|
|
382
|
+
### **v1.0.0** (Initial Release)
|
|
383
|
+
|
|
384
|
+
- ✨ TemplateEditor component with full editing capabilities
|
|
385
|
+
- ✨ RemotionPlayer for video preview
|
|
386
|
+
- ✨ Sub-components: ColorPicker, LogoPicker, RangeSlider, etc.
|
|
387
|
+
- ✨ Complete TypeScript support
|
|
388
|
+
- ✨ Google Fonts integration
|
|
389
|
+
- ✨ Scene duration calculator utility
|
|
390
|
+
- 📚 Comprehensive documentation
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
## **Contributors**
|
|
395
|
+
|
|
396
|
+
Built and maintained by the StageClip team.
|