chahuadev's picture
Upload 51 files
f462b1c verified
// ══════════════════════════════════════════════════════════════════════════════
// Chahua Video Builder - Video Templates
// Multiple Professional Templates for Video Creation
// ══════════════════════════════════════════════════════════════════════════════
// Company: Chahua Development Co., Ltd.
// Version: 1.0.0
// License: MIT
// ══════════════════════════════════════════════════════════════════════════════
// สีหลักที่ใช้ร่วมกันทุก template
const SHARED_COLORS = {
primary: '#60a5fa', // Blue
secondary: '#a855f7', // Purple
background: '#0a1628', // Dark blue-black
surface: '#132337', // Dark blue-gray
text: '#e2e8f0', // Light gray
textSecondary: '#94a3b8', // Medium gray
accent: '#06b6d4' // Cyan
};
export const VIDEO_TEMPLATES = {
// ════════════════════════════════════════════════════════════════════════════
// Modern Template - Inter Font + Rounded Corners
// ════════════════════════════════════════════════════════════════════════════
modern: {
id: 'modern',
name: 'Modern',
description: 'Clean and professional design with gradient accents',
colors: { ...SHARED_COLORS },
fonts: {
primary: "'Inter', 'Segoe UI', sans-serif",
code: "'Source Code Pro', monospace"
},
animations: {
duration: 0.6,
easing: 'cubic-bezier(0.4, 0, 0.2, 1)',
fadeIn: 'fadeIn 0.6s ease-out',
slideUp: 'slideUp 0.6s ease-out'
},
styles: {
borderRadius: '1.25rem',
shadow: '0 20px 40px rgba(0, 0, 0, 0.3)',
gradient: 'linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(168, 85, 247, 0.2))'
}
},
// ════════════════════════════════════════════════════════════════════════════
// Classic Template - Serif Font + Traditional Style
// ════════════════════════════════════════════════════════════════════════════
classic: {
id: 'classic',
name: 'Classic',
description: 'Traditional elegant design with serif fonts',
colors: { ...SHARED_COLORS },
fonts: {
primary: "'Playfair Display', 'Georgia', serif",
code: "'Courier Prime', 'Courier New', monospace"
},
animations: {
duration: 0.8,
easing: 'ease-in-out',
fadeIn: 'fadeIn 0.8s ease-in-out',
slideUp: 'slideUp 0.8s ease-in-out'
},
styles: {
borderRadius: '0.5rem',
shadow: '0 10px 30px rgba(0, 0, 0, 0.5)',
gradient: 'linear-gradient(180deg, rgba(59, 130, 246, 0.1), transparent)'
}
},
// ════════════════════════════════════════════════════════════════════════════
// Minimal Template - Helvetica + Sharp Edges
// ════════════════════════════════════════════════════════════════════════════
minimal: {
id: 'minimal',
name: 'Minimal',
description: 'Ultra-clean minimalist design',
colors: { ...SHARED_COLORS },
fonts: {
primary: "'Helvetica Neue', 'Arial', sans-serif",
code: "'SF Mono', 'Monaco', monospace"
},
animations: {
duration: 0.4,
easing: 'linear',
fadeIn: 'fadeIn 0.4s linear',
slideUp: 'slideUp 0.4s linear'
},
styles: {
borderRadius: '0',
shadow: 'none',
gradient: 'none'
}
},
// ════════════════════════════════════════════════════════════════════════════
// Mono Template - Monospace Font + Terminal Style
// ════════════════════════════════════════════════════════════════════════════
mono: {
id: 'mono',
name: 'Mono',
description: 'Monospace terminal-inspired style',
colors: { ...SHARED_COLORS },
fonts: {
primary: "'Roboto Mono', 'Consolas', monospace",
code: "'Fira Code', 'Courier New', monospace"
},
animations: {
duration: 0.3,
easing: 'ease-out',
fadeIn: 'fadeIn 0.3s ease-out',
slideUp: 'slideUp 0.3s ease-out'
},
styles: {
borderRadius: '0',
shadow: '0 0 20px rgba(0, 255, 0, 0.3)',
gradient: 'radial-gradient(circle, rgba(0, 255, 0, 0.1), transparent)'
}
},
// ════════════════════════════════════════════════════════════════════════════
// Rounded Template - Poppins Font + Maximum Roundness
// ════════════════════════════════════════════════════════════════════════════
rounded: {
id: 'rounded',
name: 'Rounded',
description: 'Soft and friendly with rounded corners',
colors: { ...SHARED_COLORS },
fonts: {
primary: "'Poppins', 'Nunito', sans-serif",
code: "'JetBrains Mono', monospace"
},
animations: {
duration: 0.7,
easing: 'cubic-bezier(0.68, -0.55, 0.265, 1.55)',
fadeIn: 'fadeIn 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55)',
slideUp: 'slideUp 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55)'
},
styles: {
borderRadius: '0.25rem',
shadow: '0 4px 8px rgba(96, 165, 250, 0.15)',
gradient: 'none'
}
},
// ════════════════════════════════════════════════════════════════════════════
// Rounded Template - Poppins Font + Maximum Roundness
// ════════════════════════════════════════════════════════════════════════════
rounded: {
id: 'rounded',
name: 'Rounded',
description: 'Soft and friendly with rounded corners',
colors: { ...SHARED_COLORS },
fonts: {
primary: "'Poppins', 'Nunito', sans-serif",
code: "'JetBrains Mono', monospace"
},
animations: {
duration: 0.65,
easing: 'cubic-bezier(0.34, 1.56, 0.64, 1)',
fadeIn: 'fadeIn 0.65s cubic-bezier(0.34, 1.56, 0.64, 1)',
slideUp: 'slideUp 0.65s cubic-bezier(0.34, 1.56, 0.64, 1)'
},
styles: {
borderRadius: '2.5rem',
shadow: '0 25px 50px rgba(96, 165, 250, 0.3)',
gradient: 'linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(168, 85, 247, 0.2))'
}
},
// ════════════════════════════════════════════════════════════════════════════
// Space Template - Space Grotesk Font + Futuristic
// ════════════════════════════════════════════════════════════════════════════
space: {
id: 'space',
name: 'Space',
description: 'Futuristic space-themed design',
colors: { ...SHARED_COLORS },
fonts: {
primary: "'Space Grotesk', 'Orbitron', sans-serif",
code: "'Space Mono', monospace"
},
animations: {
duration: 0.55,
easing: 'cubic-bezier(0.19, 1, 0.22, 1)',
fadeIn: 'fadeIn 0.55s cubic-bezier(0.19, 1, 0.22, 1)',
slideUp: 'slideUp 0.55s cubic-bezier(0.19, 1, 0.22, 1)'
},
styles: {
borderRadius: '0.75rem',
shadow: '0 0 20px rgba(96, 165, 250, 0.4), 0 0 40px rgba(168, 85, 247, 0.2)',
gradient: 'radial-gradient(circle, rgba(96, 165, 250, 0.15), transparent)'
}
},
// ════════════════════════════════════════════════════════════════════════════
// Code Template - Developer-Friendly Monospace
// ════════════════════════════════════════════════════════════════════════════
code: {
id: 'code',
name: 'Code',
description: 'Developer-friendly monospace design',
colors: { ...SHARED_COLORS },
fonts: {
primary: "'Fira Code', 'Cascadia Code', monospace",
code: "'JetBrains Mono', 'Source Code Pro', monospace"
},
animations: {
duration: 0.38,
easing: 'cubic-bezier(0, 0, 0.2, 1)',
fadeIn: 'fadeIn 0.38s cubic-bezier(0, 0, 0.2, 1)',
slideUp: 'slideUp 0.38s cubic-bezier(0, 0, 0.2, 1)'
},
styles: {
borderRadius: '0.5rem',
shadow: '0 8px 24px rgba(96, 165, 250, 0.15)',
gradient: 'linear-gradient(135deg, rgba(96, 165, 250, 0.1), rgba(168, 85, 247, 0.1))'
}
},
// ════════════════════════════════════════════════════════════════════════════
// Tech Template - Ubuntu Font + Clean Tech Style
// ════════════════════════════════════════════════════════════════════════════
tech: {
id: 'tech',
name: 'Tech',
description: 'Clean technical presentation style',
colors: { ...SHARED_COLORS },
fonts: {
primary: "'Ubuntu', 'Roboto', sans-serif",
code: "'Ubuntu Mono', 'Inconsolata', monospace"
},
animations: {
duration: 0.48,
easing: 'cubic-bezier(0.25, 0.1, 0.25, 1)',
fadeIn: 'fadeIn 0.48s cubic-bezier(0.25, 0.1, 0.25, 1)',
slideUp: 'slideUp 0.48s cubic-bezier(0.25, 0.1, 0.25, 1)'
},
styles: {
borderRadius: '0.5rem',
shadow: '0 8px 24px rgba(96, 165, 250, 0.15)',
gradient: 'linear-gradient(135deg, rgba(96, 165, 250, 0.1), rgba(168, 85, 247, 0.1))'
}
},
// ════════════════════════════════════════════════════════════════════════════
// Tech Template - Ubuntu Font + Clean Tech Style
// ════════════════════════════════════════════════════════════════════════════
tech: {
id: 'tech',
name: 'Tech',
description: 'Clean technical presentation style',
colors: { ...SHARED_COLORS },
fonts: {
primary: "'Ubuntu', 'Roboto', sans-serif",
code: "'Ubuntu Mono', 'Inconsolata', monospace"
},
animations: {
duration: 0.72,
easing: 'cubic-bezier(0.16, 1, 0.3, 1)',
fadeIn: 'fadeIn 0.72s cubic-bezier(0.16, 1, 0.3, 1)',
slideUp: 'slideUp 0.72s cubic-bezier(0.16, 1, 0.3, 1)'
},
styles: {
borderRadius: '1rem',
shadow: '0 20px 40px rgba(96, 165, 250, 0.3)',
gradient: 'linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(168, 85, 247, 0.2))'
}
},
// ════════════════════════════════════════════════════════════════════════════
// Corporate Template - Professional Business Style
// ════════════════════════════════════════════════════════════════════════════
corporate: {
id: 'corporate',
name: 'Corporate',
description: 'Professional business presentation',
colors: { ...SHARED_COLORS },
fonts: {
primary: "'Lato', 'Open Sans', sans-serif",
code: "'Consolas', monospace"
},
animations: {
duration: 0.52,
easing: 'cubic-bezier(0.45, 0, 0.55, 1)',
fadeIn: 'fadeIn 0.52s cubic-bezier(0.45, 0, 0.55, 1)',
slideUp: 'slideUp 0.52s cubic-bezier(0.45, 0, 0.55, 1)'
},
styles: {
borderRadius: '0.5rem',
shadow: '0 6px 20px rgba(96, 165, 250, 0.2)',
gradient: 'linear-gradient(180deg, rgba(96, 165, 250, 0.1), transparent)'
}
},
// ════════════════════════════════════════════════════════════════════════════
// Display Template - Display Fonts + High Impact
// ════════════════════════════════════════════════════════════════════════════
display: {
id: 'display',
name: 'Display',
description: 'Bold display fonts for maximum impact',
colors: { ...SHARED_COLORS },
fonts: {
primary: "'Montserrat', 'Oswald', sans-serif",
code: "'Inconsolata', monospace"
},
animations: {
duration: 0.72,
easing: 'cubic-bezier(0.16, 1, 0.3, 1)',
fadeIn: 'fadeIn 0.72s cubic-bezier(0.16, 1, 0.3, 1)',
slideUp: 'slideUp 0.72s cubic-bezier(0.16, 1, 0.3, 1)'
},
styles: {
borderRadius: '1rem',
shadow: '0 20px 40px rgba(96, 165, 250, 0.3)',
gradient: 'linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(168, 85, 247, 0.2))'
}
},
// ════════════════════════════════════════════════════════════════════════════
// Corporate Template - Professional Business Style
// ════════════════════════════════════════════════════════════════════════════
corporate: {
id: 'corporate',
name: 'Corporate',
description: 'Professional business presentation',
colors: { ...SHARED_COLORS },
fonts: {
primary: "'Lato', 'Open Sans', sans-serif",
code: "'Consolas', monospace"
},
animations: {
duration: 0.5,
easing: 'ease-in-out',
fadeIn: 'fadeIn 0.5s ease-in-out',
slideUp: 'slideUp 0.5s ease-in-out'
},
styles: {
borderRadius: '0.5rem',
shadow: '0 8px 20px rgba(96, 165, 250, 0.15)',
gradient: 'linear-gradient(135deg, rgba(96, 165, 250, 0.08), rgba(168, 85, 247, 0.08))'
}
}
};
// ══════════════════════════════════════════════════════════════════════════════
// Template Helper Functions
// ══════════════════════════════════════════════════════════════════════════════
export function getTemplate(templateId) {
return VIDEO_TEMPLATES[templateId] || VIDEO_TEMPLATES.modern;
}
export function getAllTemplates() {
return Object.values(VIDEO_TEMPLATES);
}
export function applyTemplate(templateId) {
const template = getTemplate(templateId);
const root = document.documentElement;
// Apply colors as CSS variables
Object.entries(template.colors).forEach(([key, value]) => {
root.style.setProperty(`--color-${key}`, value);
});
// Apply fonts
root.style.setProperty('--font-primary', template.fonts.primary);
root.style.setProperty('--font-code', template.fonts.code);
// Apply animation settings
root.style.setProperty('--anim-duration', `${template.animations.duration}s`);
root.style.setProperty('--anim-easing', template.animations.easing);
// Apply styles
root.style.setProperty('--border-radius', template.styles.borderRadius);
root.style.setProperty('--shadow', template.styles.shadow);
root.style.setProperty('--gradient', template.styles.gradient);
// Apply syntax highlighting colors (if available)
if (template.syntax) {
Object.entries(template.syntax).forEach(([key, value]) => {
root.style.setProperty(`--syntax-${key}`, value);
});
}
return template;
}
export function generateCSS(template) {
return `
:root {
--color-primary: ${template.colors.primary};
--color-secondary: ${template.colors.secondary};
--color-background: ${template.colors.background};
--color-surface: ${template.colors.surface};
--color-text: ${template.colors.text};
--color-text-secondary: ${template.colors.textSecondary};
--color-accent: ${template.colors.accent};
--font-primary: ${template.fonts.primary};
--font-code: ${template.fonts.code};
--anim-duration: ${template.animations.duration}s;
--anim-easing: ${template.animations.easing};
--border-radius: ${template.styles.borderRadius};
--shadow: ${template.styles.shadow};
--gradient: ${template.styles.gradient};
}
body {
font-family: var(--font-primary);
background-color: var(--color-background);
color: var(--color-text);
}
.code-block {
font-family: var(--font-code);
background: var(--color-surface);
border-radius: var(--border-radius);
box-shadow: var(--shadow);
}
.gradient-backdrop {
background: var(--gradient);
}
`;
}