slidecanvas 1.0.5 → 1.0.7
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 +35 -3
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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.
|
|
@@ -72,7 +75,9 @@ import { PptEditor } from 'slidecanvas';
|
|
|
72
75
|
export default function App() {
|
|
73
76
|
const pptxUrl = "https://example.com/presentations/q1-report.pptx";
|
|
74
77
|
|
|
75
|
-
|
|
78
|
+
// Custom proxy endpoint (defaults to undefined, causing direct fetch)
|
|
79
|
+
// If your app has an API route at /api/proxy, specify it here:
|
|
80
|
+
return <PptEditor url={pptxUrl} proxyUrl="/api/proxy" />;
|
|
76
81
|
}
|
|
77
82
|
```
|
|
78
83
|
|
|
@@ -98,9 +103,34 @@ export async function GET(request: NextRequest) {
|
|
|
98
103
|
}
|
|
99
104
|
```
|
|
100
105
|
|
|
101
|
-
|
|
106
|
+
> [!IMPORTANT]
|
|
107
|
+
> To use the custom proxy above, pass its path to the `proxyUrl` prop in the `PptEditor` component (e.g., `<PptEditor proxyUrl="/api/proxy" ... />`).
|
|
102
108
|
|
|
103
|
-
|
|
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.
|
|
113
|
+
|
|
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.
|
|
104
134
|
|
|
105
135
|
```tsx
|
|
106
136
|
import { PptEditor } from 'slidecanvas';
|
|
@@ -251,6 +281,8 @@ async function extractCaptions(fileBuffer: ArrayBuffer) {
|
|
|
251
281
|
| `appName` | `string` | `"SlideCanvas"` | Brand name shown in the ribbon. |
|
|
252
282
|
| `appBgColor` | `string` | `"#B7472A"` | Primary brand color for the UI. |
|
|
253
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). |
|
|
254
286
|
| `showHomeOnEmpty` | `boolean` | `false` | Shows a "New / Upload" splash if no data provided. |
|
|
255
287
|
| `onChange` | `(pres: Presentation) => void` | `undefined` | Fired on any change to the deck. |
|
|
256
288
|
| `onSourceChange` | `(src, url?) => void` | `undefined` | Fired when the deck origin changes (useful for routing). |
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
type ElementType = 'text' | 'image' | 'shape';
|
|
4
|
-
type ShapeType = 'rect' | 'ellipse' | 'triangle' | 'line';
|
|
4
|
+
type ShapeType = 'rect' | 'ellipse' | 'triangle' | 'rightTriangle' | 'rhombus' | 'parallelogram' | 'trapezoid' | 'pentagon' | 'hexagon' | 'heptagon' | 'octagon' | 'heart' | 'smiley' | 'sun' | 'moon' | 'arrowRight' | 'arrowLeft' | 'arrowUp' | 'arrowDown' | 'arrowLeftRight' | 'arrowUpDown' | 'star4' | 'star5' | 'star6' | 'star8' | 'cloud' | 'lightning' | 'plus' | 'minus' | 'multiply' | 'divide' | 'equal' | 'line';
|
|
5
5
|
type PresentationSource = 'scratch' | 'uploaded' | 'url';
|
|
6
6
|
interface BaseElement {
|
|
7
7
|
id: string;
|
|
@@ -60,6 +60,8 @@ interface PptEditorProps {
|
|
|
60
60
|
showHomeOnEmpty?: boolean;
|
|
61
61
|
initialSource?: PresentationSource;
|
|
62
62
|
onSourceChange?: (source: PresentationSource, url?: string) => void;
|
|
63
|
+
proxyUrl?: string;
|
|
64
|
+
onGenerateImage?: (prompt: string) => Promise<string>;
|
|
63
65
|
}
|
|
64
66
|
declare const PptEditor: React.FC<PptEditorProps>;
|
|
65
67
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
type ElementType = 'text' | 'image' | 'shape';
|
|
4
|
-
type ShapeType = 'rect' | 'ellipse' | 'triangle' | 'line';
|
|
4
|
+
type ShapeType = 'rect' | 'ellipse' | 'triangle' | 'rightTriangle' | 'rhombus' | 'parallelogram' | 'trapezoid' | 'pentagon' | 'hexagon' | 'heptagon' | 'octagon' | 'heart' | 'smiley' | 'sun' | 'moon' | 'arrowRight' | 'arrowLeft' | 'arrowUp' | 'arrowDown' | 'arrowLeftRight' | 'arrowUpDown' | 'star4' | 'star5' | 'star6' | 'star8' | 'cloud' | 'lightning' | 'plus' | 'minus' | 'multiply' | 'divide' | 'equal' | 'line';
|
|
5
5
|
type PresentationSource = 'scratch' | 'uploaded' | 'url';
|
|
6
6
|
interface BaseElement {
|
|
7
7
|
id: string;
|
|
@@ -60,6 +60,8 @@ interface PptEditorProps {
|
|
|
60
60
|
showHomeOnEmpty?: boolean;
|
|
61
61
|
initialSource?: PresentationSource;
|
|
62
62
|
onSourceChange?: (source: PresentationSource, url?: string) => void;
|
|
63
|
+
proxyUrl?: string;
|
|
64
|
+
onGenerateImage?: (prompt: string) => Promise<string>;
|
|
63
65
|
}
|
|
64
66
|
declare const PptEditor: React.FC<PptEditorProps>;
|
|
65
67
|
|