slidecanvas 1.0.6 → 1.0.8

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
@@ -10,6 +10,9 @@
10
10
  - **AI-Powered Editing**: Integrated Gemini AI for smart text manipulation (Shorten, Reframe, Lengthen) with side-by-side controls.
11
11
  - **Enterprise-Grade Parsing**: Deep internal processing of XML-based PPTX structures.
12
12
  - **Professional Ribbon UI**: A high-density, Microsoft Office-style toolbar layout (120px height) with optimized visibility for all controls.
13
+ - **Slash Commands (`/`)**: A fast, context-aware command menu triggered by typing `/` anywhere on the canvas or in a text box.
14
+ - **AI-Powered Image Generation**: Integrated flow for generating design assets via optional `onGenerateImage` hook, with built-in preview and replacement logic.
15
+ - **AI Suggestion Box**: A side-by-side text refinement UI for reviewing Shorten/Reframe/Lengthen suggestions before applying them.
13
16
  - **Smart Actions Group**: Prominent buttons for Present, Export (PPTX), and Delete, with a subtle "Saved" status indicator.
14
17
  - **Professional Export**: High-quality `.pptx` generation with support for transparency and layout mapping.
15
18
  - **S3 & Remote Support**: Built-in architecture for loading presentations via secure proxy tunnels.
@@ -103,9 +106,31 @@ export async function GET(request: NextRequest) {
103
106
  > [!IMPORTANT]
104
107
  > To use the custom proxy above, pass its path to the `proxyUrl` prop in the `PptEditor` component (e.g., `<PptEditor proxyUrl="/api/proxy" ... />`).
105
108
 
106
- ### 3. Enabling AI Features
109
+ ### 4. Slash Commands & AI design
110
+ SlideCanvas features a powerful Slash Command system. Type `/` at any time to:
111
+ - **Insert Elements**: Instantly add Text, Images, or Shapes.
112
+ - **AI Actions**: Trigger text transformations or **AI Image Generation** directly at your cursor.
107
113
 
108
- SlideCanvas comes battery-included with Gemini AI support. To enable smart text actions (Shorten, Reframe, Lengthen), simply pass your Gemini API key to the component:
114
+ ---
115
+
116
+ ### 5. Custom AI Image Generation
117
+ You can integrate your own AI image provider (e.g., DALL-E, Midjourney, or a custom S3-backed service) by passing the `onGenerateImage` prop:
118
+
119
+ ```tsx
120
+ <PptEditor
121
+ onGenerateImage={async (prompt) => {
122
+ const response = await fetch('/api/my-ai', { body: JSON.stringify({ prompt }) });
123
+ const data = await response.json();
124
+ return data.s3ImageUrl; // Return a URL string
125
+ }}
126
+ />
127
+ ```
128
+
129
+ > [!TIP]
130
+ > When an image is generated, SlideCanvas provides a professional **Preview Modal** allowing users to **Insert** as new, **Replace** a selected image (preserving dimensions), or **Discard**.
131
+
132
+ ### 6. Enabling AI Text Refinement
133
+ SlideCanvas comes battery-included with Gemini AI support for text.
109
134
 
110
135
  ```tsx
111
136
  import { PptEditor } from 'slidecanvas';
@@ -256,6 +281,8 @@ async function extractCaptions(fileBuffer: ArrayBuffer) {
256
281
  | `appName` | `string` | `"SlideCanvas"` | Brand name shown in the ribbon. |
257
282
  | `appBgColor` | `string` | `"#B7472A"` | Primary brand color for the UI. |
258
283
  | `geminiApiKey` | `string` | `undefined` | API key for built-in AI text actions. |
284
+ | `onGenerateImage` | `(prompt: string) => Promise<string>` | `undefined` | Custom hook to handle AI image generation. |
285
+ | `proxyUrl` | `string` | `undefined` | Base path for the proxy API (used for PPTX loading and image previews). |
259
286
  | `showHomeOnEmpty` | `boolean` | `false` | Shows a "New / Upload" splash if no data provided. |
260
287
  | `onChange` | `(pres: Presentation) => void` | `undefined` | Fired on any change to the deck. |
261
288
  | `onSourceChange` | `(src, url?) => void` | `undefined` | Fired when the deck origin changes (useful for routing). |
package/dist/index.d.mts CHANGED
@@ -61,6 +61,7 @@ interface PptEditorProps {
61
61
  initialSource?: PresentationSource;
62
62
  onSourceChange?: (source: PresentationSource, url?: string) => void;
63
63
  proxyUrl?: string;
64
+ onGenerateImage?: (prompt: string) => Promise<string>;
64
65
  }
65
66
  declare const PptEditor: React.FC<PptEditorProps>;
66
67
 
package/dist/index.d.ts CHANGED
@@ -61,6 +61,7 @@ interface PptEditorProps {
61
61
  initialSource?: PresentationSource;
62
62
  onSourceChange?: (source: PresentationSource, url?: string) => void;
63
63
  proxyUrl?: string;
64
+ onGenerateImage?: (prompt: string) => Promise<string>;
64
65
  }
65
66
  declare const PptEditor: React.FC<PptEditorProps>;
66
67