lumina-slides 8.1.0 → 8.2.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.
package/README.md CHANGED
@@ -3,24 +3,37 @@
3
3
  <div align="center">
4
4
  <br />
5
5
  <p>
6
- <b>The Declarative Presentation Engine for the Modern Web</b>
6
+ <b>The Interface Layer for the Agentic Era</b>
7
7
  </p>
8
- <p>
9
- Create cinematic, timeline-driven presentations using simple JSON and the full power of Vue 3 + GSAP.
8
+ The first presentation engine designed for <b>LLMs</b>. Turn JSON into cinematic, interactive experiences.
10
9
  </p>
11
10
  <br />
11
+
12
+ <img src="public/demo.gif" alt="Lumina Engine Demo" width="100%" style="border-radius: 8px; border: 1px solid rgba(255,255,255,0.1);" />
13
+
14
+ <br />
12
15
  </div>
13
16
 
14
- **Lumina Engine** is a high-performance, drop-in library that turns declarative JSON definitions into GPU-accelerated, interactive slide decks. It is designed for developers who want to build immersive storytelling experiences without getting bogged down in animation logic.
17
+ **Lumina Engine** is a high-performance, declarative library that enables AI agents and LLMs to generate professional, interactive UI and slide decks by simply outputting JSON. It bridges the gap between text generation and visual storytelling, offering deterministic, GPU-accelerated rendering without the hallucination of pixel-generation.
18
+
19
+ > [!IMPORTANT] > **Building an Agent?**
20
+ > Read the complete **[Lumina for Agents Guide](./AGENTS.md)** to learn about Streaming, Auto-Layouts, and Token Optimization.
21
+
22
+ ## 🤖 Why for LLMs?
23
+
24
+ Traditional UI libraries require understanding complex component trees, CSS modules, and state management. Lumina abstracts this into a **single, flat JSON schema**.
25
+
26
+ - **structured_output Friendly**: Designed to match the capabilities of models like GPT-4o, Claude 3.5 Sonnet, and Gemini Pro.
27
+ - **Hallucination Proof**: The renderer handles the "how", the LLM only cares about the "what".
28
+ - **Zero Config**: No build steps or bundler configuration needed to generate visual content dynamically.
15
29
 
16
30
  ## ✨ Features
17
31
 
18
- - **� Declarative First**: Define your entire deck structure, content, and flow in a single JSON object.
19
- - **🚀 Performance Core**: Built on Vue 3's Composition API for reactivity and GSAP for buttery smooth standard-compliant animations.
20
- - **🎨 Cinematic Layouts**: Comes with 5+ responsive, production-ready layouts (`statement`, `timeline`, `features`, `half`, `steps`).
21
- - **🛡️ Type Safe**: Written in 100% strict TypeScript.
22
- - **🔌 Event Driven**: Hook into every slide change, interaction, and state update with a robust event system.
23
- - **� Theming API**: Runtime CSS variable generation for instant branding (Dark/Light mode ready).
32
+ - **📄 JSON-First Architecture**: Define entire decks, including content, styling, and flow, in one serializable object.
33
+ - **⚡ Reactive & Performant**: Built on Vue 3 + GSAP for 60fps animations even on mobile.
34
+ - **🎨 Cinematic Layouts**: "Pro" layouts (`timeline`, `statement`, `features`) that look good by default.
35
+ - **🛡️ Type Safe**: Full TypeScript support with exported types for your AI system prompts.
36
+ - **🔌 Event Driven**: Hook into every user interaction to feed state back to your agent.
24
37
 
25
38
  ## 📦 Installation
26
39
 
@@ -28,104 +41,115 @@
28
41
  npm install lumina-slides gsap
29
42
  ```
30
43
 
31
- ## ⚡ Quick Start
44
+ ## ⚡ Quick Start for Agents
45
+
46
+ ### 1. The "System Prompt"
47
+
48
+ Your agent generates this structure:
49
+
50
+ ```json
51
+ {
52
+ "meta": { "title": "Quarterly Review" },
53
+ "slides": [
54
+ {
55
+ "type": "statement",
56
+ "title": "Q4 Performance",
57
+ "subtitle": "Exceeding expectations.",
58
+ "meta": { "variant": "gradient" }
59
+ },
60
+ {
61
+ "type": "features",
62
+ "title": "Key Metrics",
63
+ "features": [
64
+ {
65
+ "title": "Growth",
66
+ "description": "+145% YoY",
67
+ "icon": "trending-up"
68
+ },
69
+ { "title": "Retention", "description": "98% Renewal", "icon": "users" }
70
+ ]
71
+ }
72
+ ]
73
+ }
74
+ ```
32
75
 
33
- ### 1. Initialize the Engine
76
+ ### 2. The Engine Renders
34
77
 
35
- Mount the engine to any DOM element.
78
+ You pass that JSON directly to Lumina.
36
79
 
37
80
  ```typescript
38
81
  import { Lumina } from "lumina-slides";
39
82
  import "lumina-slides/style.css";
40
83
 
41
- const engine = new Lumina("#app", {
42
- theme: {
43
- colors: { primary: "#6366f1" }, // Customize your brand color
44
- },
45
- });
46
- ```
47
-
48
- ### 2. Load Your Deck
84
+ const engine = new Lumina("#app");
49
85
 
50
- Pass your declarative JSON structure to the `load` method.
86
+ // Imagine this comes from your LLM stream
87
+ const llmOutput = await agent.generatePresentation();
51
88
 
52
- ```typescript
53
- engine.load({
54
- meta: { title: "Project Roadmap" },
55
- slides: [
56
- {
57
- type: "statement",
58
- title: "Welcome to Lumina",
59
- subtitle: "Declarative presentations for the web.",
60
- meta: { orbColor: "#4f46e5" },
61
- },
62
- {
63
- type: "timeline",
64
- title: "History",
65
- timeline: [
66
- { date: "2023", title: "Inception", description: "Project started." },
67
- { date: "2024", title: "Launch", description: "v1.0 Release." },
68
- ],
69
- },
70
- ],
71
- });
89
+ engine.load(llmOutput);
72
90
  ```
73
91
 
74
92
  ## 🧩 Built-in Layouts
75
93
 
76
- Lumina comes with a set of "Pro" layouts out of the box. Just specify the `type` property in your slide object.
94
+ Lumina provides semantic layout types that LLMs can easily select based on context.
77
95
 
78
- | Type | Description | Key Props |
79
- | :-------------- | :--------------------------------------------------------- | :--------------------------------- |
80
- | **`statement`** | High-impact text focus. Perfect for covers and quotes. | `title`, `subtitle`, `tag` |
81
- | **`half`** | Split layout with image on one side, content on the other. | `image`, `imageSide`, `paragraphs` |
82
- | **`features`** | Responsive grid of cards with icons. | `features` (array of cards) |
83
- | **`timeline`** | Vertical interactive chronological list. | `timeline` (array of events) |
84
- | **`steps`** | Sequential process steps with numbers. | `steps` (array of steps) |
96
+ ### **Statement**
85
97
 
86
- ## 📚 API Reference
98
+ Big ideas, quotes, titles. Great for "cover" slides.
87
99
 
88
- ### `engine.on(event, callback)`
100
+ [![Statement Layout](public/layout-statement.png)](public/layout-statement.json)
101
+ [View JSON Source](public/layout-statement.json)
89
102
 
90
- Listen to engine events to build custom navigational controls or analytics.
103
+ ### **Half**
91
104
 
92
- ```typescript
93
- // Slide Change Event
94
- engine.on("slideChange", (payload) => {
95
- console.log(`Current Slide Index: ${payload.index}`);
96
- console.log("Active Slide Data:", payload.slide);
97
- });
105
+ Comparisons, text + image context.
98
106
 
99
- // User Actions (Buttons, Links)
100
- engine.on("action", (payload) => {
101
- if (payload.type === "cta-click") {
102
- window.open(payload.value, "_blank");
103
- }
104
- });
105
- ```
107
+ [![Half Layout](public/layout-half.png)](public/layout-half.json)
108
+ [View JSON Source](public/layout-half.json)
109
+
110
+ ### **Features**
111
+
112
+ Lists of benefits, KPIs, or grid items.
113
+
114
+ [![Features Layout](public/layout-features.png)](public/layout-features.json)
115
+ [View JSON Source](public/layout-features.json)
116
+
117
+ ### **Timeline**
118
+
119
+ Chronological events, roadmaps, history.
120
+
121
+ [![Timeline Layout](public/layout-timeline.png)](public/layout-timeline.json)
122
+ [View JSON Source](public/layout-timeline.json)
123
+
124
+ ### **Steps**
106
125
 
107
- ### Configuration Options
126
+ Tutorials, flows, numbered processes.
108
127
 
109
- Pass these to the constructor `new Lumina(selector, options)`.
128
+ [![Steps Layout](public/layout-steps.png)](public/layout-steps.json)
129
+ [View JSON Source](public/layout-steps.json)
130
+
131
+ ### **Embedded (Widget Mode)**
132
+
133
+ Slides constrained to a container, perfect for dashboards.
134
+
135
+ [![Embedded Layout](public/layout-embedded.png)](public/layout-embedded.json)
136
+ [View JSON Source](public/layout-embedded.json)
137
+
138
+ ## 📚 API Reference
139
+
140
+ ### `engine.load(deck: DeckDefinition)`
141
+
142
+ Loads a new deck. This is reactive - calling it again with new data (e.g. streaming chunks) will update the view seamlessly.
143
+
144
+ ### `engine.on(event, callback)`
145
+
146
+ Listen to interactions to create loops where the user's action prompts the AI for the next step.
110
147
 
111
148
  ```typescript
112
- interface LuminaOptions {
113
- /** Enable infinite looping of slides */
114
- loop?: boolean;
115
- /** Enable keyboard arrow navigation */
116
- keyboard?: boolean;
117
- /** UI Visibility Settings */
118
- ui?: {
119
- showProgressBar?: boolean;
120
- showControls?: boolean;
121
- showSlideCount?: boolean;
122
- };
123
- /** Animation Tunings */
124
- animation?: {
125
- stagger?: number; // Time between element entries
126
- durationIn?: number; // Slide entry speed
127
- };
128
- }
149
+ engine.on("action", (payload) => {
150
+ // Feed user interaction back to the AI
151
+ agent.send(`User clicked on button: ${payload.value}`);
152
+ });
129
153
  ```
130
154
 
131
155
  ## 📄 License