Download apps/server/src/catalog/hyperframesKnowledgeBase.ts from phucsd/olokaflow: direct link, hf CLI and curl.
- Browser
- Download file 27 kB
-
https://huggingface.co/spaces/phucsd/olokaflow/resolve/main/apps/server/src/catalog/hyperframesKnowledgeBase.ts
- Command line
-
hf download hf://spaces/phucsd/olokaflow/apps/server/src/catalog/hyperframesKnowledgeBase.ts
-
curl -L -o hyperframesKnowledgeBase.ts https://huggingface.co/spaces/phucsd/olokaflow/resolve/main/apps/server/src/catalog/hyperframesKnowledgeBase.ts
27 kB
| import fs from 'node:fs'; | |
| import path from 'node:path'; | |
| import os from 'node:os'; | |
| import { execFile } from 'node:child_process'; | |
| import { promisify } from 'node:util'; | |
| import type { | |
| FramePresetItem, | |
| SceneBlueprintItem, | |
| MotionRuleItem, | |
| TransitionItem, | |
| RegistryCatalogItem, | |
| } from '@olokaflow/shared'; | |
| const execFileAsync = promisify(execFile); | |
| const DEFAULT_SKILLS_ROOT = | |
| process.env.HYPERFRAMES_SKILLS_DIR || | |
| path.join(os.homedir(), '.gemini', 'config', 'skills'); | |
| const PRESETS_DIR = path.join(DEFAULT_SKILLS_ROOT, 'hyperframes-creative', 'frame-presets'); | |
| const BLUEPRINTS_DIR = path.join(DEFAULT_SKILLS_ROOT, 'hyperframes-animation', 'blueprints'); | |
| const RULES_DIR = path.join(DEFAULT_SKILLS_ROOT, 'hyperframes-animation', 'rules'); | |
| const TRANSITIONS_DIR = path.join(DEFAULT_SKILLS_ROOT, 'hyperframes-animation', 'transitions'); | |
| // Built-in metadata for the 13 HyperFrames Frame Presets (works even inside Docker without local skill dir) | |
| const BUILTIN_FRAME_PRESETS: FramePresetItem[] = [ | |
| { | |
| id: 'blue-professional', | |
| name: 'Blue Professional (Enterprise & SaaS)', | |
| description: 'Nền kem ấm (#fdfae7) kết hợp xanh Cobalt sắc nét (#1e2bfa), Space Grotesk + Be Vietnam Pro, thẻ bo tròn tinh tế.', | |
| colors: { bg: '#fdfae7', primary: '#1e2bfa', text: '#111111', textMuted: '#6b6b6b', cardBg: 'rgba(30,43,250,0.05)', border: 'rgba(30,43,250,0.2)' }, | |
| typography: { heading: 'Space Grotesk', body: 'Be Vietnam Pro', mono: 'JetBrains Mono' }, | |
| rawYaml: 'colors:\n bg: "#fdfae7"\n primary: "#1e2bfa"\n text: "#111111"', | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'blockframe', | |
| name: 'Blockframe (Neobrutalist Bold)', | |
| description: 'Phong cách Neobrutalism độ tương phản cao, viền đen dày 2px, đổ bóng cứng 4px, cực hợp TikTok/Reels công nghệ & GenZ.', | |
| colors: { bg: '#f4f0ea', primary: '#ff4d00', text: '#0d0d0d', textMuted: '#4a4a4a', cardBg: '#ffffff', border: '#0d0d0d' }, | |
| typography: { heading: 'Space Grotesk', body: 'Plus Jakarta Sans', mono: 'JetBrains Mono' }, | |
| rawYaml: 'colors:\n bg: "#f4f0ea"\n primary: "#ff4d00"\n text: "#0d0d0d"', | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'code-editorial', | |
| name: 'Code Editorial (Dark AI & Developer)', | |
| description: 'Nền tối Obsidian (#090d16) chuẩn IDE cao cấp, điểm nhấn xanh lục/tím Neon, hoàn hảo cho giới thiệu AI, phần mềm, API.', | |
| colors: { bg: '#090d16', primary: '#38bdf8', text: '#f8fafc', textMuted: '#94a3b8', cardBg: 'rgba(30,41,59,0.75)', border: 'rgba(56,189,248,0.28)' }, | |
| typography: { heading: 'Space Grotesk', body: 'Be Vietnam Pro', mono: 'JetBrains Mono' }, | |
| rawYaml: 'colors:\n bg: "#090d16"\n primary: "#38bdf8"\n text: "#f8fafc"', | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'biennale-yellow', | |
| name: 'Biennale Yellow (High-Impact Exhibition)', | |
| description: 'Nền vàng nghệ thuật rực rỡ kết hợp chữ đen đậm và điểm nhấn đỏ cam, thu hút sự chú ý ngay từ 0.5 giây đầu tiên.', | |
| colors: { bg: '#ffd600', primary: '#111111', text: '#111111', textMuted: '#333333', cardBg: '#fff8cc', border: '#111111' }, | |
| typography: { heading: 'Montserrat', body: 'Be Vietnam Pro', mono: 'JetBrains Mono' }, | |
| rawYaml: 'colors:\n bg: "#ffd600"\n primary: "#111111"\n text: "#111111"', | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'bold-poster', | |
| name: 'Bold Poster (Kinetic Promo & Ad)', | |
| description: 'Thiết kế áp phích đại tự, tương phản Đỏ Crimson - Đen - Trắng mạnh mẽ cho video bán hàng và khuyến mãi.', | |
| colors: { bg: '#0f0f12', primary: '#ef4444', text: '#ffffff', textMuted: '#a1a1aa', cardBg: '#18181b', border: 'rgba(239,68,68,0.4)' }, | |
| typography: { heading: 'Oswald', body: 'Be Vietnam Pro', mono: 'JetBrains Mono' }, | |
| rawYaml: 'colors:\n bg: "#0f0f12"\n primary: "#ef4444"\n text: "#ffffff"', | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'cobalt-grid', | |
| name: 'Cobalt Grid (FinTech & Data Analytics)', | |
| description: 'Hệ lưới kỹ thuật số màu xanh đêm và lục bảo, chuyên trị biểu đồ tài chính, chứng khoán, B2B và báo cáo dữ liệu.', | |
| colors: { bg: '#061325', primary: '#10b981', text: '#f0fdf4', textMuted: '#94a3b8', cardBg: 'rgba(15,35,66,0.8)', border: 'rgba(16,185,129,0.3)' }, | |
| typography: { heading: 'Space Grotesk', body: 'Inter', mono: 'JetBrains Mono' }, | |
| rawYaml: 'colors:\n bg: "#061325"\n primary: "#10b981"\n text: "#f0fdf4"', | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'coral', | |
| name: 'Coral Lifestyle (E-Commerce, Beauty & Brand)', | |
| description: 'Tông hồng cam san hô (#f43f5e) trên nền sáng tinh khôi, lý tưởng cho mỹ phẩm, thời trang, F&B và thương hiệu tiêu dùng.', | |
| colors: { bg: '#fff5f5', primary: '#e11d48', text: '#1f2937', textMuted: '#6b7280', cardBg: '#ffffff', border: 'rgba(225,29,72,0.18)' }, | |
| typography: { heading: 'Playfair Display', body: 'Be Vietnam Pro', mono: 'JetBrains Mono' }, | |
| rawYaml: 'colors:\n bg: "#fff5f5"\n primary: "#e11d48"\n text: "#1f2937"', | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'editorial-forest', | |
| name: 'Editorial Forest (Luxury, Organic & ESG)', | |
| description: 'Xanh rừng sâu kết hợp vàng đồng sang trọng, phù hợp bất động sản, sức khỏe, dược phẩm, nông nghiệp xanh.', | |
| colors: { bg: '#0c241b', primary: '#eab308', text: '#f7fee7', textMuted: '#a3b8b0', cardBg: 'rgba(20,56,42,0.85)', border: 'rgba(234,179,8,0.3)' }, | |
| typography: { heading: 'Playfair Display', body: 'Be Vietnam Pro', mono: 'JetBrains Mono' }, | |
| rawYaml: 'colors:\n bg: "#0c241b"\n primary: "#eab308"\n text: "#f7fee7"', | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'capsule', | |
| name: 'Capsule Modern (Minimal Apple-Style)', | |
| description: 'Thiết kế tối giản lấy cảm hứng từ Apple keynote với các thẻ viên thuốc (pill), đổ bóng mềm và khoảng thở rộng.', | |
| colors: { bg: '#f5f5f7', primary: '#0071e3', text: '#1d1d1f', textMuted: '#86868b', cardBg: '#ffffff', border: 'rgba(0,0,0,0.08)' }, | |
| typography: { heading: 'Plus Jakarta Sans', body: 'Be Vietnam Pro', mono: 'JetBrains Mono' }, | |
| rawYaml: 'colors:\n bg: "#f5f5f7"\n primary: "#0071e3"\n text: "#1d1d1f"', | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'creative-mode', | |
| name: 'Creative Mode (Vibrant Violet Studio)', | |
| description: 'Tím Violet sáng tạo kết hợp hiệu ứng kính mờ (Glassmorphism) và chuyển sắc sống động.', | |
| colors: { bg: '#0f0720', primary: '#a855f7', text: '#faf5ff', textMuted: '#c084fc', cardBg: 'rgba(38,16,74,0.75)', border: 'rgba(168,85,247,0.35)' }, | |
| typography: { heading: 'Plus Jakarta Sans', body: 'Be Vietnam Pro', mono: 'JetBrains Mono' }, | |
| rawYaml: 'colors:\n bg: "#0f0720"\n primary: "#a855f7"\n text: "#faf5ff"', | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'cartesian', | |
| name: 'Cartesian Blueprint (Engineering & Architecture)', | |
| description: 'Phong cách bản vẽ kỹ thuật với lưới tọa độ mảnh, phông chữ kỹ thuật số và độ chính xác cao.', | |
| colors: { bg: '#0b192c', primary: '#38bdf8', text: '#e2e8f0', textMuted: '#64748b', cardBg: 'rgba(15,35,60,0.8)', border: 'rgba(56,189,248,0.25)' }, | |
| typography: { heading: 'Chakra Petch', body: 'Be Vietnam Pro', mono: 'JetBrains Mono' }, | |
| rawYaml: 'colors:\n bg: "#0b192c"\n primary: "#38bdf8"\n text: "#e2e8f0"', | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'broadside', | |
| name: 'Broadside Newspaper (News & Documentary)', | |
| description: 'Bố cục báo chí chính luận, tiêu đề Serif uy tín, đường kẻ phân cột rõ ràng cho video tin tức & phân tích.', | |
| colors: { bg: '#f9f6f0', primary: '#b91c1c', text: '#171717', textMuted: '#525252', cardBg: '#f0ece1', border: '#262626' }, | |
| typography: { heading: 'Playfair Display', body: 'Be Vietnam Pro', mono: 'JetBrains Mono' }, | |
| rawYaml: 'colors:\n bg: "#f9f6f0"\n primary: "#b91c1c"\n text: "#171717"', | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'daisy-days', | |
| name: 'Daisy Days (Friendly Education & Kids)', | |
| description: 'Màu sắc tươi sáng, thân thiện, bo góc tròn mềm mại cho video giáo dục, hướng dẫn và mẹ & bé.', | |
| colors: { bg: '#fefce8', primary: '#16a34a', text: '#14532d', textMuted: '#4d7c0f', cardBg: '#ffffff', border: 'rgba(22,163,74,0.25)' }, | |
| typography: { heading: 'Plus Jakarta Sans', body: 'Be Vietnam Pro', mono: 'JetBrains Mono' }, | |
| rawYaml: 'colors:\n bg: "#fefce8"\n primary: "#16a34a"\n text: "#14532d"', | |
| rawMarkdown: '', | |
| }, | |
| ]; | |
| // Built-in metadata for the 22 Scene Blueprints | |
| const BUILTIN_BLUEPRINTS: SceneBlueprintItem[] = [ | |
| { | |
| id: 'kinetic-type-beats', | |
| title: 'Kinetic-Type Beats (Nhịp Chữ Động)', | |
| intent: 'Chữ lớn giữa màn hình thay đổi theo từng nhịp câu thoại hoặc bật nẩy (spring-pop) kết hợp điểm nhấn màu.', | |
| rolesServed: ['Hook', 'Problem', 'Product_Intro', 'Benefits', 'CTA'], | |
| durationHint: '3.0–6.0s', | |
| motionVocabulary: 'spring-pop scale, word-by-word reveal, drawn accent underline, bg-invert flip', | |
| ruleMapping: ['kinetic-beat-slam', 'spring-pop-entrance', 'css-marker-patterns'], | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'device-surface-showcase', | |
| title: 'Device Surface Showcase (Trình Diễn Sản Phẩm / Giao Diện)', | |
| intent: 'Khung sản phẩm hoặc ảnh chủ đạo nổi bật ở trung tâm với góc nghiêng 3D nhẹ, xung quanh là các nhãn tính năng bật ra theo nhịp.', | |
| rolesServed: ['Product_Intro', 'Key_Feature', 'Benefits'], | |
| durationHint: '4.0–7.0s', | |
| motionVocabulary: '3D perspective tilt, floating callout badges, hero image zoom-settle, glow ring', | |
| ruleMapping: ['3d-camera-flight', 'spring-pop-entrance', 'coordinate-target-zoom'], | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'dataviz-countup', | |
| title: 'DataViz Count-Up (Biểu Đồ & Số Liệu Tăng Trưởng)', | |
| intent: 'Con số thống kê nhảy số tự động (count-up) đi kèm thanh biểu đồ tăng trưởng hoặc thẻ so sánh trực quan.', | |
| rolesServed: ['Data_Proof', 'Benefits', 'Social_Proof'], | |
| durationHint: '4.0–6.5s', | |
| motionVocabulary: 'number count-up, bar width grow stagger, metric card highlight, positive badge pulse', | |
| ruleMapping: ['counting-dynamic-scale', 'chart-scrub-readout', 'waterfall-entry'], | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'grid-card-assemble', | |
| title: 'Grid Card Assemble (Lưới Thẻ Tính Năng Lắp Ghép)', | |
| intent: '2 đến 4 thẻ thông tin/hình ảnh bay vào lắp ghép thành bố cục Bento Grid hiện đại, lần lượt sáng lên theo lời thoại.', | |
| rolesServed: ['Key_Feature', 'Benefits', 'Social_Proof'], | |
| durationHint: '4.5–7.5s', | |
| motionVocabulary: 'staggered card slide-in, active card spotlight scale, icon badge pop', | |
| ruleMapping: ['waterfall-entry', 'spring-pop-entrance', 'coordinate-target-zoom'], | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'comparison-split', | |
| title: 'Comparison Split (So Sánh Trước / Sau hoặc Cũ / Mới)', | |
| intent: 'Chia đôi màn hình đối chiếu rõ rệt giữa Cách Cũ (tối, gạch chéo đỏ) và Giải Pháp Mới (sáng, nổi bật, tích xanh).', | |
| rolesServed: ['Problem', 'Benefits', 'Data_Proof'], | |
| durationHint: '4.5–6.5s', | |
| motionVocabulary: 'split-screen wipe, red cross strike-out vs green check pop, winner card expand', | |
| ruleMapping: ['scale-swap-transition', 'spring-pop-entrance', 'css-marker-patterns'], | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'cursor-ui-demo', | |
| title: 'Cursor UI Demo (Mô Phỏng Thao Tác & Phóng To Chi Tiết)', | |
| intent: 'Con trỏ di chuyển thông minh tới điểm nhấn, click tạo sóng (ripple) và phóng cận cảnh vào kết quả.', | |
| rolesServed: ['Key_Feature', 'Product_Intro'], | |
| durationHint: '4.5–7.0s', | |
| motionVocabulary: 'smooth cursor path, click ripple ring, camera target zoom, tooltip reveal', | |
| ruleMapping: ['cursor-click-ripple', 'coordinate-target-zoom', 'context-sensitive-cursor'], | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'logo-assemble-lockup', | |
| title: 'Logo Assemble & CTA Lockup (Khóa Thương Hiệu & Kêu Gọi Hành Động)', | |
| intent: 'Logo thương hiệu, ảnh sản phẩm chính chủ và nút CTA hội tụ ở trung tâm với hiệu ứng phát sáng khóa màn hình cuối.', | |
| rolesServed: ['CTA', 'Product_Intro'], | |
| durationHint: '3.5–5.5s', | |
| motionVocabulary: 'logo spring lockup, pulsing CTA pill button, radial glow burst, URL/hotline badge', | |
| ruleMapping: ['spring-pop-entrance', 'particle-burst', 'physics-press-reaction'], | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'typewriter-reveal', | |
| title: 'Typewriter Reveal (Gõ Chữ Kịch Tính)', | |
| intent: 'Văn bản hoặc câu hỏi mở đầu được gõ từng ký tự với con trỏ nhấp nháy, sau đó mở bung ra toàn cảnh.', | |
| rolesServed: ['Hook', 'Problem'], | |
| durationHint: '3.5–5.5s', | |
| motionVocabulary: 'char-by-char typing, blinking caret, highlight sweep', | |
| ruleMapping: ['discrete-text-sequence', 'context-sensitive-cursor'], | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'camera-journey', | |
| title: 'Camera Journey (Hành Trình Không Gian 3D)', | |
| intent: 'Camera lướt qua các trạm thông tin/hình ảnh có chiều sâu Z-axis tạo cảm giác điện ảnh.', | |
| rolesServed: ['Product_Intro', 'Key_Feature', 'Benefits'], | |
| durationHint: '5.0–8.0s', | |
| motionVocabulary: 'Z-axis dolly, parallax layers, depth-of-field focus shift', | |
| ruleMapping: ['3d-camera-flight', 'depth-of-field-blur'], | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'overwhelm-surround', | |
| title: 'Overwhelm Surround (Bủa Vây Vấn Đề -> Giải Giải Pháp)', | |
| intent: 'Các thẻ vấn đề/nỗi đau xuất hiện dồn dập xung quanh rồi bị quét sạch để nhường chỗ cho giải pháp duy nhất.', | |
| rolesServed: ['Problem', 'Hook'], | |
| durationHint: '4.0–6.0s', | |
| motionVocabulary: 'pop-up chaos cards, chromatic glitch shake, clean radial sweep', | |
| ruleMapping: ['chromatic-glitch', 'waterfall-entry', 'scale-swap-transition'], | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'prompt-type-submit-generate', | |
| title: 'Prompt Submit & Generate (Nhập Lệnh -> Tạo Kết Quả Tức Thì)', | |
| intent: 'Khung tìm kiếm/nhập lệnh tự gõ nội dung, bấm nút gửi và bung ra kết quả trực quan ngay bên dưới.', | |
| rolesServed: ['Product_Intro', 'Key_Feature'], | |
| durationHint: '4.5–6.5s', | |
| motionVocabulary: 'input typing, button press bounce, result card cascade', | |
| ruleMapping: ['discrete-text-sequence', 'physics-press-reaction', 'waterfall-entry'], | |
| rawMarkdown: '', | |
| }, | |
| { | |
| id: 'video-text-pivot', | |
| title: 'Video B-Roll & Kinetic Text Pivot (Kết Hợp Video Thực Tế & Chữ Động)', | |
| intent: 'Phát đoạn video B-roll thực tế trong khung bo tròn hoặc toàn màn hình kết hợp dải tiêu đề động nổi bật.', | |
| rolesServed: ['Hook', 'Product_Intro', 'Key_Feature', 'Social_Proof'], | |
| durationHint: '4.0–7.0s', | |
| motionVocabulary: 'video frame pan/scale, glassmorphic lower-third badge, kinetic title overlay', | |
| ruleMapping: ['spring-pop-entrance', 'coordinate-target-zoom'], | |
| rawMarkdown: '', | |
| }, | |
| ]; | |
| // Built-in Atomic Motion Rules | |
| const BUILTIN_MOTION_RULES: MotionRuleItem[] = [ | |
| { | |
| id: 'spring-pop-entrance', | |
| title: 'Spring Pop Entrance', | |
| category: 'Entrance', | |
| summary: 'Hiệu ứng bật nẩy đàn hồi `back.out(1.7)` từ `scale: 0.72, opacity: 0` lên `scale: 1, opacity: 1` trong 0.45s.', | |
| rawMarkdown: 'gsap.fromTo(el, { scale: 0.72, opacity: 0, y: 24 }, { scale: 1, opacity: 1, y: 0, duration: 0.48, ease: "back.out(1.7)" })', | |
| }, | |
| { | |
| id: 'waterfall-entry', | |
| title: 'Waterfall Stagger Entry', | |
| category: 'Sequencing', | |
| summary: 'Các thẻ hoặc dòng nội dung trượt lên nối tiếp nhau với `stagger: 0.12` và `power3.out`.', | |
| rawMarkdown: 'gsap.fromTo(cards, { y: 40, opacity: 0 }, { y: 0, opacity: 1, duration: 0.5, stagger: 0.12, ease: "power3.out" })', | |
| }, | |
| { | |
| id: 'kinetic-beat-slam', | |
| title: 'Kinetic Beat Slam', | |
| category: 'Typography', | |
| summary: 'Từ khóa chính phóng từ `scale: 1.4, filter: blur(8px)` về `scale: 1, blur(0px)` khớp chính xác với nhịp câu thoại.', | |
| rawMarkdown: 'gsap.fromTo(word, { scale: 1.35, opacity: 0 }, { scale: 1, opacity: 1, duration: 0.35, ease: "expo.out" })', | |
| }, | |
| { | |
| id: 'counting-dynamic-scale', | |
| title: 'Counting Dynamic Scale', | |
| category: 'DataViz', | |
| summary: 'Số liệu nhảy tăng dần từ 0 tới giá trị đích kết hợp phóng nhẹ khi chạm đích.', | |
| rawMarkdown: 'gsap.to(counterObj, { val: targetVal, duration: 1.4, ease: "power2.out", onUpdate: () => { el.textContent = Math.round(counterObj.val).toLocaleString(); } })', | |
| }, | |
| { | |
| id: '3d-camera-flight', | |
| title: '3D Perspective Camera Flight', | |
| category: 'Camera', | |
| summary: 'Khung hình sản phẩm nghiêng nhẹ trong không gian 3D (`rotateY(-12deg) rotateX(6deg)`) rồi xoay thẳng về chính diện.', | |
| rawMarkdown: 'gsap.fromTo(surface, { rotateY: -14, rotateX: 8, scale: 0.9, opacity: 0 }, { rotateY: 0, rotateX: 0, scale: 1, opacity: 1, duration: 0.85, ease: "power3.out" })', | |
| }, | |
| { | |
| id: 'coordinate-target-zoom', | |
| title: 'Coordinate Target Zoom', | |
| category: 'Camera', | |
| summary: 'Phóng cận cảnh mượt mà vào điểm nhấn quan trọng của bức ảnh tham khảo (Ken Burns / Focus Zoom).', | |
| rawMarkdown: 'gsap.fromTo(img, { scale: 1 }, { scale: 1.12, duration: sceneDuration, ease: "sine.inOut" })', | |
| }, | |
| { | |
| id: 'cursor-click-ripple', | |
| title: 'Cursor Click & Ripple Ring', | |
| category: 'UI Motion', | |
| summary: 'Con trỏ lướt tới nút bấm, nhấn xuống (`scale: 0.94`) và tỏa vòng sóng tròn lan rộng.', | |
| rawMarkdown: 'tl.to(cursor, { x: targetX, y: targetY, duration: 0.6, ease: "power2.inOut" }).to(btn, { scale: 0.94, duration: 0.1, yoyo: true, repeat: 1 })', | |
| }, | |
| { | |
| id: 'chromatic-glitch', | |
| title: 'Chromatic RGB Glitch Shake', | |
| category: 'VFX', | |
| summary: 'Rung lắc nhẹ kèm tách kênh màu đỏ/xanh cho cảnh nêu vấn đề (Problem) hoặc cảnh công nghệ.', | |
| rawMarkdown: 'gsap.fromTo(el, { x: -6, textShadow: "3px 0 #ff0055, -3px 0 #00e5ff" }, { x: 0, textShadow: "0px 0 transparent", duration: 0.35, ease: "rough" })', | |
| }, | |
| { | |
| id: 'css-marker-patterns', | |
| title: 'CSS Marker Highlight Sweep', | |
| category: 'Typography', | |
| summary: 'Dải màu đánh dấu hoặc gạch chân vẽ từ trái sang phải (`scaleX: 0 -> 1`) dưới từ khóa quan trọng.', | |
| rawMarkdown: 'gsap.fromTo(marker, { scaleX: 0, transformOrigin: "left center" }, { scaleX: 1, duration: 0.45, ease: "power2.out" })', | |
| }, | |
| { | |
| id: 'particle-burst', | |
| title: 'Accent Particle / Glow Burst', | |
| category: 'VFX', | |
| summary: 'Vòng sáng hào quang và các hạt điểm nhấn bung tỏa quanh Logo hoặc sản phẩm ở cảnh kết.', | |
| rawMarkdown: 'gsap.fromTo(glow, { scale: 0.6, opacity: 0 }, { scale: 1.25, opacity: 0.85, duration: 0.9, ease: "sine.out" })', | |
| }, | |
| ]; | |
| // Built-in Registry Blocks & Components | |
| const BUILTIN_REGISTRY_CATALOG: RegistryCatalogItem[] = [ | |
| { name: 'quote-card', kind: 'block', description: 'Thẻ trích dẫn / Hook nổi bật với dấu ngoặc kép lớn và nhãn tác giả/thương hiệu', tags: ['hook', 'quote', 'typography', 'card'] }, | |
| { name: 'app-showcase', kind: 'block', description: 'Khung trình diễn sản phẩm / giao diện ứng dụng hoặc hình ảnh thực tế kèm 3 thẻ tính năng nổi', tags: ['product', 'showcase', 'ui', 'device', 'hero'] }, | |
| { name: 'data-chart', kind: 'block', description: 'Bảng biểu đồ cột tăng trưởng & 3 thẻ chỉ số KPI nhảy số tự động', tags: ['chart', 'data', 'metrics', 'numbers', 'growth'] }, | |
| { name: 'flowchart', kind: 'block', description: 'Sơ đồ quy trình 3 bước trực quan với mũi tên nối động', tags: ['process', 'steps', 'workflow', 'diagram'] }, | |
| { name: 'logo-outro', kind: 'block', description: 'Màn hình kết thúc khóa nhận diện Logo, Slogan, Website/Hotline và nút bấm CTA', tags: ['cta', 'outro', 'logo', 'brand', 'ending'] }, | |
| { name: 'tiktok-follow', kind: 'block', description: 'Nút kêu gọi Follow / Đặt hàng chuẩn giao diện TikTok/Reels với hiệu ứng nhấn', tags: ['tiktok', 'social', 'cta', 'vertical'] }, | |
| { name: 'yt-lower-third', kind: 'block', description: 'Thanh tiêu đề phụ góc dưới (Lower-Third) giới thiệu tên sản phẩm / chuyên gia', tags: ['lower-third', 'banner', 'caption', 'title'] }, | |
| { name: 'caption-clip-wipe', kind: 'component', description: 'Bộ phụ đề Karaoke đồng bộ từng từ (Word-by-word active pill highlight)', tags: ['caption', 'subtitles', 'karaoke', 'voice'] }, | |
| { name: 'grain-overlay', kind: 'component', description: 'Lớp phủ hạt phim điện ảnh tinh tế (Film grain texture)', tags: ['texture', 'film', 'overlay'] }, | |
| { name: 'shimmer-sweep', kind: 'component', description: 'Vệt sáng ánh kim quét qua nút bấm CTA hoặc thẻ sản phẩm cao cấp', tags: ['shimmer', 'glow', 'button', 'luxury'] }, | |
| ]; | |
| // Built-in Transitions | |
| const BUILTIN_TRANSITIONS: TransitionItem[] = [ | |
| { | |
| id: 'fade-blur', | |
| name: 'Focus Pull Dissolve', | |
| family: 'css-blur', | |
| description: 'Chuyển cảnh mờ dần kết hợp lấy nét nhẹ mượt mà', | |
| cssOrJsSnippet: 'gsap.fromTo(sceneRoot, { opacity: 0, scale: 1.03 }, { opacity: 1, scale: 1, duration: 0.35, ease: "power2.out" });', | |
| }, | |
| { | |
| id: 'push-up', | |
| name: 'Kinetic Vertical Push', | |
| family: 'css-push', | |
| description: 'Cảnh mới trượt nhanh từ dưới lên theo chuẩn lướt TikTok/Reels', | |
| cssOrJsSnippet: 'gsap.fromTo(sceneRoot, { yPercent: 12, opacity: 0 }, { yPercent: 0, opacity: 1, duration: 0.38, ease: "power3.out" });', | |
| }, | |
| { | |
| id: 'zoom-through', | |
| name: 'Camera Zoom-Through', | |
| family: 'css-scale', | |
| description: 'Phóng xuyên qua không gian vào cảnh tiếp theo', | |
| cssOrJsSnippet: 'gsap.fromTo(sceneRoot, { scale: 0.88, opacity: 0 }, { scale: 1, opacity: 1, duration: 0.4, ease: "expo.out" });', | |
| }, | |
| { | |
| id: 'circle-iris', | |
| name: 'Expanding Circle Iris', | |
| family: 'css-radial', | |
| description: 'Mở vòng tròn từ tâm màn hình ra toàn khung cảnh', | |
| cssOrJsSnippet: 'gsap.fromTo(sceneRoot, { clipPath: "circle(0% at 50% 50%)" }, { clipPath: "circle(150% at 50% 50%)", duration: 0.55, ease: "power3.inOut" });', | |
| }, | |
| ]; | |
| let cachedPresets: FramePresetItem[] | null = null; | |
| let cachedBlueprints: SceneBlueprintItem[] | null = null; | |
| let cachedRules: MotionRuleItem[] | null = null; | |
| export function getFramePresets(): FramePresetItem[] { | |
| if (cachedPresets) return cachedPresets; | |
| const list = [...BUILTIN_FRAME_PRESETS]; | |
| try { | |
| if (fs.existsSync(PRESETS_DIR)) { | |
| for (const preset of list) { | |
| const frameMdPath = path.join(PRESETS_DIR, preset.id, 'FRAME.md'); | |
| if (fs.existsSync(frameMdPath)) { | |
| const content = fs.readFileSync(frameMdPath, 'utf8'); | |
| preset.rawMarkdown = content.slice(0, 4500); | |
| const yamlMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/); | |
| if (yamlMatch) { | |
| preset.rawYaml = yamlMatch[1].slice(0, 2500); | |
| } | |
| } | |
| } | |
| } | |
| } catch (err) { | |
| console.warn('[HyperFramesCatalog] Could not read local preset markdown:', err); | |
| } | |
| cachedPresets = list; | |
| return list; | |
| } | |
| export function getFramePresetById(id: string): FramePresetItem { | |
| const presets = getFramePresets(); | |
| return presets.find((p) => p.id === id) || presets[0]; | |
| } | |
| export function getSceneBlueprints(): SceneBlueprintItem[] { | |
| if (cachedBlueprints) return cachedBlueprints; | |
| const list = [...BUILTIN_BLUEPRINTS]; | |
| try { | |
| if (fs.existsSync(BLUEPRINTS_DIR)) { | |
| for (const bp of list) { | |
| const mdPath = path.join(BLUEPRINTS_DIR, `${bp.id}.md`); | |
| if (fs.existsSync(mdPath)) { | |
| bp.rawMarkdown = fs.readFileSync(mdPath, 'utf8').slice(0, 3500); | |
| } | |
| } | |
| } | |
| } catch (err) { | |
| console.warn('[HyperFramesCatalog] Could not read local blueprint markdown:', err); | |
| } | |
| cachedBlueprints = list; | |
| return list; | |
| } | |
| export function getSceneBlueprintById(id: string): SceneBlueprintItem { | |
| const blueprints = getSceneBlueprints(); | |
| return blueprints.find((b) => b.id === id) || blueprints[0]; | |
| } | |
| export function getMotionRules(): MotionRuleItem[] { | |
| if (cachedRules) return cachedRules; | |
| const list = [...BUILTIN_MOTION_RULES]; | |
| try { | |
| if (fs.existsSync(RULES_DIR)) { | |
| for (const rule of list) { | |
| const mdPath = path.join(RULES_DIR, `${rule.id}.md`); | |
| if (fs.existsSync(mdPath)) { | |
| rule.rawMarkdown = fs.readFileSync(mdPath, 'utf8').slice(0, 2200); | |
| } | |
| } | |
| } | |
| } catch { | |
| // Fallback to built-in rules | |
| } | |
| cachedRules = list; | |
| return list; | |
| } | |
| export function getTransitions(): TransitionItem[] { | |
| return BUILTIN_TRANSITIONS; | |
| } | |
| export function getRegistryCatalogItems(): RegistryCatalogItem[] { | |
| return BUILTIN_REGISTRY_CATALOG; | |
| } | |
| /** | |
| * Searches the HyperFrames Registry Catalog (uses on-device CLI if available + built-in ranked matcher). | |
| */ | |
| export async function searchHyperFramesCatalog(query: string): Promise<RegistryCatalogItem[]> { | |
| const q = (query || '').toLowerCase().trim(); | |
| if (!q) return BUILTIN_REGISTRY_CATALOG; | |
| // Score built-in items first | |
| const tokens = q.split(/\s+/).filter(Boolean); | |
| const scored = BUILTIN_REGISTRY_CATALOG.map((item) => { | |
| const hay = `${item.name} ${item.description} ${item.tags.join(' ')}`.toLowerCase(); | |
| let score = 0; | |
| for (const t of tokens) { | |
| if (hay.includes(t)) score += 10; | |
| } | |
| return { ...item, score }; | |
| }).sort((a, b) => (b.score || 0) - (a.score || 0)); | |
| try { | |
| const isWin = process.platform === 'win32'; | |
| const cmd = isWin ? 'npx.cmd' : 'npx'; | |
| const { stdout } = await execFileAsync( | |
| cmd, | |
| ['hyperframes', 'catalog', '--query', query, '--on-device', '--json'], | |
| { timeout: 6000 } | |
| ); | |
| const parsed = JSON.parse(stdout); | |
| const items = Array.isArray(parsed) ? parsed : Array.isArray(parsed?.items) ? parsed.items : []; | |
| if (items.length > 0) { | |
| const cliMapped: RegistryCatalogItem[] = items.slice(0, 8).map((it: any) => ({ | |
| name: it.name || it.id || 'custom-block', | |
| kind: it.kind === 'component' ? 'component' : 'block', | |
| description: it.description || it.summary || '', | |
| tags: Array.isArray(it.tags) ? it.tags : [], | |
| score: typeof it.score === 'number' ? it.score : 15, | |
| })); | |
| return [...cliMapped, ...scored.slice(0, 4)]; | |
| } | |
| } catch { | |
| // Use scored built-in catalog seamlessly | |
| } | |
| return scored; | |
| } | |