@particle-academy/fancy-slides 0.1.5 → 0.1.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/dist/{chart-host-BHP6GUWO.js → chart-host-X55F6S44.js} +6 -4
- package/dist/chart-host-X55F6S44.js.map +1 -0
- package/dist/chunk-WIUXPQAK.js +47 -0
- package/dist/chunk-WIUXPQAK.js.map +1 -0
- package/dist/index.cjs +55 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +484 -0
- package/dist/index.d.ts +484 -0
- package/dist/index.js +15 -6
- package/dist/index.js.map +1 -1
- package/dist/registry.cjs +14 -2
- package/dist/registry.cjs.map +1 -1
- package/dist/registry.d.cts +11 -0
- package/dist/registry.d.ts +11 -0
- package/dist/registry.js +1 -1
- package/dist/styles.d.cts +2 -0
- package/dist/styles.d.ts +2 -0
- package/dist/types-Bc-psiRF.d.cts +290 -0
- package/dist/types-Bc-psiRF.d.ts +290 -0
- package/package.json +1 -1
- package/dist/chart-host-BHP6GUWO.js.map +0 -1
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode, CSSProperties } from 'react';
|
|
3
|
+
import { f as Slide$1, m as Theme, h as SlideElement, D as Deck, c as DeckOp, e as ShapeKind, k as TextElement, I as ImageElement, S as ShapeElement, i as SlideLayout, g as SlideBackground } from './types-Bc-psiRF.cjs';
|
|
4
|
+
export { C as ChartElement, a as CodeElement, b as DeckActivity, E as ElementBase, d as EmbedElement, j as SlideTransition, T as TableElement, l as TextStyle, n as ThemeColors, o as ThemeFonts, p as TransitionKind } from './types-Bc-psiRF.cjs';
|
|
5
|
+
|
|
6
|
+
interface SlideProps {
|
|
7
|
+
/** The slide to render. */
|
|
8
|
+
slide: Slide$1;
|
|
9
|
+
/** Deck theme — controls fonts/colors/aspect-ratio when the slide doesn't override. */
|
|
10
|
+
theme?: Theme;
|
|
11
|
+
/** Pin the slide to this width in px. When omitted, the slide fills its container with auto-resize. */
|
|
12
|
+
width?: number;
|
|
13
|
+
/** Aspect ratio override — falls back to theme.aspectRatio. */
|
|
14
|
+
aspectRatio?: number;
|
|
15
|
+
/** Edit mode flag — passed to element renderers + enables drag/resize affordances. */
|
|
16
|
+
editing?: boolean;
|
|
17
|
+
/** Called when a text element's content is edited (only in editing mode). */
|
|
18
|
+
onElementContentChange?: (elementId: string, content: string) => void;
|
|
19
|
+
/** Called when an element is clicked — host-driven selection. */
|
|
20
|
+
onElementSelect?: (elementId: string | null) => void;
|
|
21
|
+
/** Selected element id — adds a focus ring and shows resize handles when editing. */
|
|
22
|
+
selectedElementId?: string | null;
|
|
23
|
+
/** Called when the user drags an element body to a new position (slide-relative 0..1). */
|
|
24
|
+
onElementMove?: (elementId: string, x: number, y: number) => void;
|
|
25
|
+
/** Called when the user resizes via a corner / edge handle (slide-relative 0..1). */
|
|
26
|
+
onElementResize?: (elementId: string, patch: {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
w: number;
|
|
30
|
+
h: number;
|
|
31
|
+
}) => void;
|
|
32
|
+
/** Optional override renderer for a custom element type (or to replace one of the built-ins). */
|
|
33
|
+
renderElement?: (element: SlideElement, slideWidthPx: number) => ReactNode | undefined;
|
|
34
|
+
className?: string;
|
|
35
|
+
style?: CSSProperties;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Slide — the shared renderer. Used by SlideViewer, DeckEditor canvas,
|
|
39
|
+
* SlideThumbnail, and the agent bridge's preview tools. All resolution-
|
|
40
|
+
* independence lives here: child elements get a `slideWidthPx` so they can
|
|
41
|
+
* scale font sizes / stroke widths to the rendered slide size.
|
|
42
|
+
*
|
|
43
|
+
* In `editing` mode this component grows two extra affordances:
|
|
44
|
+
* - pointer-drag on an element body moves it
|
|
45
|
+
* - selected elements show 8 resize handles (4 corners, 4 edges)
|
|
46
|
+
*
|
|
47
|
+
* Both fire through `onElementMove` / `onElementResize` so the host owns
|
|
48
|
+
* the state — Slide stays a pure renderer.
|
|
49
|
+
*/
|
|
50
|
+
declare function Slide({ slide, theme, width, aspectRatio, editing, onElementContentChange, onElementSelect, selectedElementId, onElementMove, onElementResize, renderElement, className, style, }: SlideProps): react_jsx_runtime.JSX.Element;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* What the surrounding <Slide> knows about itself. Exposed to children
|
|
54
|
+
* (including `renderElement` callbacks and registry hosts like chart-host)
|
|
55
|
+
* via React context so they can react to the deck's theme without the
|
|
56
|
+
* renderElement signature having to carry it around.
|
|
57
|
+
*/
|
|
58
|
+
interface SlideContextValue {
|
|
59
|
+
/** Fully-resolved theme (merged with defaults). */
|
|
60
|
+
theme: Theme;
|
|
61
|
+
/**
|
|
62
|
+
* Heuristic: true when the resolved background is dark enough that
|
|
63
|
+
* native-rendered widgets (charts, code blocks) should use a dark variant.
|
|
64
|
+
* Computed once from `theme.colors.background` luminance.
|
|
65
|
+
*/
|
|
66
|
+
isDark: boolean;
|
|
67
|
+
/** Slide width in CSS pixels at the current render size. */
|
|
68
|
+
slideWidthPx: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Read the surrounding <Slide>'s context. Returns null when called outside
|
|
72
|
+
* a Slide — chart-host / code-host can use that signal to fall back to
|
|
73
|
+
* a sensible default (light theme, no resize anchor).
|
|
74
|
+
*/
|
|
75
|
+
declare function useSlideContext(): SlideContextValue | null;
|
|
76
|
+
/**
|
|
77
|
+
* Convenience: returns the resolved theme, or undefined when the caller
|
|
78
|
+
* isn't inside a Slide.
|
|
79
|
+
*/
|
|
80
|
+
declare function useSlideTheme(): Theme | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Convenience: returns true when the surrounding slide's background reads
|
|
83
|
+
* as "dark enough" — useful for charts/code blocks that ship a dark variant.
|
|
84
|
+
*/
|
|
85
|
+
declare function useIsDarkSlide(): boolean;
|
|
86
|
+
|
|
87
|
+
interface SlideViewerProps {
|
|
88
|
+
/** Deck to play. */
|
|
89
|
+
deck: Deck;
|
|
90
|
+
/** Controlled current slide index. Use with `onIndexChange`. */
|
|
91
|
+
index?: number;
|
|
92
|
+
/** Default current slide index (uncontrolled). */
|
|
93
|
+
defaultIndex?: number;
|
|
94
|
+
/** Called when the viewer advances. */
|
|
95
|
+
onIndexChange?: (index: number) => void;
|
|
96
|
+
/** Called when the viewer exits (Esc). */
|
|
97
|
+
onExit?: () => void;
|
|
98
|
+
/** Auto-advance interval in ms — kiosk mode. Omit to disable. */
|
|
99
|
+
autoAdvanceMs?: number;
|
|
100
|
+
/** Hide the bottom progress bar + slide counter. */
|
|
101
|
+
hideChrome?: boolean;
|
|
102
|
+
/** Optional custom renderer for element types Slide doesn't render natively (chart/code/table/embed). */
|
|
103
|
+
renderElement?: (element: SlideElement, slideWidthPx: number) => ReactNode | undefined;
|
|
104
|
+
/** Extra classes on the viewer wrapper. */
|
|
105
|
+
className?: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Read-only deck viewer. Renders one slide at a time at the maximum size
|
|
109
|
+
* that fits the container while preserving the theme's aspect ratio.
|
|
110
|
+
* Keyboard nav is built in; expand a fullscreen-ready container around
|
|
111
|
+
* `<SlideViewer>` to get the F11-style experience.
|
|
112
|
+
*/
|
|
113
|
+
declare function SlideViewer({ deck, index: controlledIndex, defaultIndex, onIndexChange, onExit, autoAdvanceMs, hideChrome, renderElement, className, }: SlideViewerProps): react_jsx_runtime.JSX.Element;
|
|
114
|
+
|
|
115
|
+
interface PresenterViewProps {
|
|
116
|
+
/** Deck being presented. */
|
|
117
|
+
deck: Deck;
|
|
118
|
+
/** Controlled current slide index. */
|
|
119
|
+
index?: number;
|
|
120
|
+
/** Default current slide index (uncontrolled). */
|
|
121
|
+
defaultIndex?: number;
|
|
122
|
+
/** Called when the presenter advances. */
|
|
123
|
+
onIndexChange?: (index: number) => void;
|
|
124
|
+
/** Called when the presenter exits (Esc). */
|
|
125
|
+
onExit?: () => void;
|
|
126
|
+
/** Reset the elapsed timer to this `Date.now()` value. Defaults to mount time. */
|
|
127
|
+
startedAt?: number;
|
|
128
|
+
/** Optional custom renderer for non-built-in element types. */
|
|
129
|
+
renderElement?: (element: SlideElement, slideWidthPx: number) => ReactNode | undefined;
|
|
130
|
+
className?: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Speaker-only side view designed to live on a second monitor while the
|
|
134
|
+
* audience sees a `<SlideViewer>`. Layout:
|
|
135
|
+
*
|
|
136
|
+
* ┌────────────────────────────┬────────────────────┐
|
|
137
|
+
* │ │ next slide │
|
|
138
|
+
* │ ├────────────────────┤
|
|
139
|
+
* │ current slide │ │
|
|
140
|
+
* │ (largest viewport) │ speaker notes │
|
|
141
|
+
* │ │ │
|
|
142
|
+
* ├────────────────────────────┴────────────────────┤
|
|
143
|
+
* │ 3 / 12 elapsed 04:21 clock 14:35 prev / │
|
|
144
|
+
* │ next │
|
|
145
|
+
* └─────────────────────────────────────────────────┘
|
|
146
|
+
*
|
|
147
|
+
* Keyboard: same set as SlideViewer — ←/→/Space/Esc/Home/End/B/F/1-9.
|
|
148
|
+
* Notes pane shows the current slide's `notes` field (rendered as
|
|
149
|
+
* preformatted text for now; markdown rendering arrives with the
|
|
150
|
+
* ContentRenderer integration in 0.2).
|
|
151
|
+
*/
|
|
152
|
+
declare function PresenterView({ deck, index: controlledIndex, defaultIndex, onIndexChange, onExit, startedAt, renderElement, className, }: PresenterViewProps): react_jsx_runtime.JSX.Element;
|
|
153
|
+
|
|
154
|
+
interface SlideThumbnailProps {
|
|
155
|
+
slide: Slide$1;
|
|
156
|
+
theme?: Theme;
|
|
157
|
+
/** Width of the thumbnail in px. Height comes from the theme's aspect ratio. */
|
|
158
|
+
width?: number;
|
|
159
|
+
/** When true, the thumbnail is rendered with a focused outline. */
|
|
160
|
+
active?: boolean;
|
|
161
|
+
onClick?: () => void;
|
|
162
|
+
onContextMenu?: (e: React.MouseEvent) => void;
|
|
163
|
+
renderElement?: (element: SlideElement, slideWidthPx: number) => ReactNode | undefined;
|
|
164
|
+
className?: string;
|
|
165
|
+
style?: CSSProperties;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Compact slide preview. Used by the slide rail in the editor, by the
|
|
169
|
+
* presenter view, and anywhere else a deck wants to show its slides as
|
|
170
|
+
* thumbnails. Re-uses the shared <Slide> so the layout matches the viewer
|
|
171
|
+
* exactly — no second rendering path.
|
|
172
|
+
*/
|
|
173
|
+
declare function SlideThumbnail({ slide, theme, width, active, onClick, onContextMenu, renderElement, className, style, }: SlideThumbnailProps): react_jsx_runtime.JSX.Element;
|
|
174
|
+
|
|
175
|
+
interface DeckEditorProps {
|
|
176
|
+
/** Controlled deck — pair with `onChange`. */
|
|
177
|
+
value: Deck;
|
|
178
|
+
onChange: (next: Deck) => void;
|
|
179
|
+
/** Called after every mutation with the op that produced it — feed into AgentPanel / audit log. */
|
|
180
|
+
onOp?: (op: DeckOp) => void;
|
|
181
|
+
/** Called when the user clicks Present. The host decides how to open the SlideViewer. */
|
|
182
|
+
onPresent?: () => void;
|
|
183
|
+
/** Controlled selected slide id. Uncontrolled by default. */
|
|
184
|
+
selectedSlideId?: string | null;
|
|
185
|
+
onSelectedSlideChange?: (id: string | null) => void;
|
|
186
|
+
/** Optional renderer for chart / code / table / embed elements (the elements this package doesn't render natively). */
|
|
187
|
+
renderElement?: (element: SlideElement, slideWidthPx: number) => ReactNode | undefined;
|
|
188
|
+
/** Hide the slide rail (e.g. for embedded use). */
|
|
189
|
+
hideRail?: boolean;
|
|
190
|
+
/** Hide the speaker notes panel. */
|
|
191
|
+
hideNotes?: boolean;
|
|
192
|
+
/** Hide the toolbar. */
|
|
193
|
+
hideToolbar?: boolean;
|
|
194
|
+
/** Hide the inspector. */
|
|
195
|
+
hideInspector?: boolean;
|
|
196
|
+
/** Optional extra content on the toolbar's trailing edge. */
|
|
197
|
+
toolbarExtra?: ReactNode;
|
|
198
|
+
className?: string;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Full deck editor — toolbar + rail + canvas + inspector + speaker notes.
|
|
202
|
+
*
|
|
203
|
+
* Controlled (`value` + `onChange`). State is intentionally simple: deck
|
|
204
|
+
* lives in the consumer, the editor just renders a view + dispatches ops.
|
|
205
|
+
* The same `DeckOp` enum that the agent bridge speaks runs through here —
|
|
206
|
+
* agents and humans drive identical mutations.
|
|
207
|
+
*/
|
|
208
|
+
declare function DeckEditor({ value, onChange, onOp, onPresent, selectedSlideId: controlledSlideId, onSelectedSlideChange, renderElement, hideRail, hideNotes, hideToolbar, hideInspector, toolbarExtra, className, }: DeckEditorProps): react_jsx_runtime.JSX.Element;
|
|
209
|
+
|
|
210
|
+
interface SlideRailProps {
|
|
211
|
+
/** Slides to render in the rail. */
|
|
212
|
+
slides: Slide$1[];
|
|
213
|
+
/** Currently-selected slide id. */
|
|
214
|
+
selectedId: string | null;
|
|
215
|
+
/** Theme used for thumbnail rendering. */
|
|
216
|
+
theme?: Theme;
|
|
217
|
+
/** Select a slide by id. */
|
|
218
|
+
onSelect: (id: string) => void;
|
|
219
|
+
/** Add a slide after the given index (or at the end if absent). */
|
|
220
|
+
onAdd: (afterIndex?: number) => void;
|
|
221
|
+
/** Duplicate the given slide. */
|
|
222
|
+
onDuplicate: (id: string) => void;
|
|
223
|
+
/** Delete the given slide. */
|
|
224
|
+
onRemove: (id: string) => void;
|
|
225
|
+
/** Move a slide from `fromIndex` to `toIndex`. */
|
|
226
|
+
onReorder: (id: string, toIndex: number) => void;
|
|
227
|
+
/** Optional custom renderer for non-built-in element types — forwarded to the thumbnails. */
|
|
228
|
+
renderElement?: (element: SlideElement, slideWidthPx: number) => ReactNode | undefined;
|
|
229
|
+
/** Thumbnail width in px. Defaults to 184. */
|
|
230
|
+
thumbnailWidth?: number;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Left-hand slide rail. Built on react-fancy's `Sidebar` for the chrome and
|
|
234
|
+
* `ContextMenu` for right-click actions. Drag-to-reorder uses native HTML5
|
|
235
|
+
* drag events so we don't take a DnD dependency.
|
|
236
|
+
*/
|
|
237
|
+
declare function SlideRail({ slides, selectedId, theme, onSelect, onAdd, onDuplicate, onRemove, onReorder, renderElement, thumbnailWidth, }: SlideRailProps): react_jsx_runtime.JSX.Element;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Starter chart-element preset. Picked from the toolbar Insert→Chart
|
|
241
|
+
* dropdown; expands into a starter `ChartElement.option` inside
|
|
242
|
+
* `DeckEditor.insertChart`. The actual saved `ChartElement` doesn't
|
|
243
|
+
* carry this — once the agent or user edits the option JSON, the
|
|
244
|
+
* "kind" is just whatever ECharts series.type the option says.
|
|
245
|
+
*/
|
|
246
|
+
type ChartKind$1 = "bar" | "line" | "pie" | "area" | "scatter";
|
|
247
|
+
interface EditorToolbarProps {
|
|
248
|
+
/** Current deck title — shown left of the toolbar. */
|
|
249
|
+
title: string;
|
|
250
|
+
onTitleChange?: (title: string) => void;
|
|
251
|
+
/** Current theme name. */
|
|
252
|
+
themeName?: string;
|
|
253
|
+
/** Apply a theme. */
|
|
254
|
+
onApplyTheme?: (theme: Theme) => void;
|
|
255
|
+
/** Insert a text element on the active slide. */
|
|
256
|
+
onInsertText?: () => void;
|
|
257
|
+
/** Insert an image element. */
|
|
258
|
+
onInsertImage?: () => void;
|
|
259
|
+
/** Insert a shape element. */
|
|
260
|
+
onInsertShape?: (shape: ShapeKind) => void;
|
|
261
|
+
/** Insert a chart element. The `kind` arg picks a starter ECharts option
|
|
262
|
+
* (`bar` / `line` / `pie` / `area` / `scatter`). Hosts can ignore the
|
|
263
|
+
* arg if they only support a single chart type. */
|
|
264
|
+
onInsertChart?: (kind: ChartKind$1) => void;
|
|
265
|
+
/** Insert a code element. */
|
|
266
|
+
onInsertCode?: () => void;
|
|
267
|
+
/** Insert a table element. */
|
|
268
|
+
onInsertTable?: () => void;
|
|
269
|
+
/** Open the viewer (presentation mode). */
|
|
270
|
+
onPresent?: () => void;
|
|
271
|
+
/** When true, disables every Insert button (e.g. when no slide is selected). */
|
|
272
|
+
disabled?: boolean;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Top toolbar. Built on react-fancy's `Action`, `Dropdown`, `Tooltip`,
|
|
276
|
+
* `Badge`, `Separator`. Designed to be slotted into the editor chrome —
|
|
277
|
+
* doesn't manage its own scroll or sticky behavior.
|
|
278
|
+
*/
|
|
279
|
+
declare function EditorToolbar({ title, onTitleChange, themeName, onApplyTheme, onInsertText, onInsertImage, onInsertShape, onInsertChart, onInsertCode, onInsertTable, onPresent, disabled, }: EditorToolbarProps): react_jsx_runtime.JSX.Element;
|
|
280
|
+
|
|
281
|
+
interface ElementInspectorProps {
|
|
282
|
+
/** Element being inspected. `null` shows the empty state. */
|
|
283
|
+
element: SlideElement | null;
|
|
284
|
+
/** Patch a property on the element. */
|
|
285
|
+
onPatch: (patch: Partial<SlideElement>) => void;
|
|
286
|
+
/** Delete the element. */
|
|
287
|
+
onDelete?: () => void;
|
|
288
|
+
/** Lock toggle. */
|
|
289
|
+
onLockToggle?: (locked: boolean) => void;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Right-hand inspector. Tabs split position + style + advanced properties.
|
|
293
|
+
* Per-element-type controls drop in under the Style tab. Built on
|
|
294
|
+
* react-fancy `Card`, `Tabs`, `Input`, `Select`, `Slider`, `ColorPicker`,
|
|
295
|
+
* `Action`.
|
|
296
|
+
*/
|
|
297
|
+
declare function ElementInspector({ element, onPatch, onDelete, onLockToggle }: ElementInspectorProps): react_jsx_runtime.JSX.Element;
|
|
298
|
+
|
|
299
|
+
interface SpeakerNotesProps {
|
|
300
|
+
notes?: string;
|
|
301
|
+
onChange: (notes: string) => void;
|
|
302
|
+
placeholder?: string;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Bottom-of-editor speaker notes panel. Just a labelled `Textarea` from
|
|
306
|
+
* react-fancy — the rest of the editor chrome controls how much vertical
|
|
307
|
+
* space this gets.
|
|
308
|
+
*/
|
|
309
|
+
declare function SpeakerNotes({ notes, onChange, placeholder }: SpeakerNotesProps): react_jsx_runtime.JSX.Element;
|
|
310
|
+
|
|
311
|
+
interface TextElementRendererProps {
|
|
312
|
+
element: TextElement;
|
|
313
|
+
theme?: Theme;
|
|
314
|
+
/** Rendered slide width in px (for font-size scaling). */
|
|
315
|
+
slideWidthPx: number;
|
|
316
|
+
/**
|
|
317
|
+
* Edit mode — when true, the element is potentially editable.
|
|
318
|
+
* The textarea actually becomes pointer-interactive only when both
|
|
319
|
+
* `editing` and `selected` are true, so the first click on an
|
|
320
|
+
* unselected text element selects it (handled by the parent Slide)
|
|
321
|
+
* rather than landing on the textarea.
|
|
322
|
+
*/
|
|
323
|
+
editing?: boolean;
|
|
324
|
+
/** Element is selected — gates whether the textarea grabs pointer events. */
|
|
325
|
+
selected?: boolean;
|
|
326
|
+
/** Called when the user edits the content (only fires when the textarea is focusable). */
|
|
327
|
+
onContentChange?: (content: string) => void;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Renderer for `text` elements. Three formats:
|
|
331
|
+
*
|
|
332
|
+
* - `"markdown"` (default) — parsed via react-fancy's ContentRenderer.
|
|
333
|
+
* Bullets, bold/italic, code spans, links, headings.
|
|
334
|
+
* - `"html"` — parsed sanitized HTML via ContentRenderer's html path.
|
|
335
|
+
* - `"plain"` — raw text rendered into a single block; preserves newlines
|
|
336
|
+
* via `white-space: pre-wrap`.
|
|
337
|
+
*
|
|
338
|
+
* In editing mode + when the element is selected, the renderer swaps to a
|
|
339
|
+
* textarea showing the raw source. Edits flow back via `onContentChange`.
|
|
340
|
+
*/
|
|
341
|
+
declare function TextElementRenderer({ element, theme, slideWidthPx, editing, selected, onContentChange, }: TextElementRendererProps): react_jsx_runtime.JSX.Element;
|
|
342
|
+
|
|
343
|
+
interface ImageElementRendererProps {
|
|
344
|
+
element: ImageElement;
|
|
345
|
+
}
|
|
346
|
+
declare function ImageElementRenderer({ element }: ImageElementRendererProps): react_jsx_runtime.JSX.Element;
|
|
347
|
+
|
|
348
|
+
interface ShapeElementRendererProps {
|
|
349
|
+
element: ShapeElement;
|
|
350
|
+
theme?: Theme;
|
|
351
|
+
slideWidthPx: number;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* SVG-rendered shape primitive. Sized to fill its element box; the box
|
|
355
|
+
* decides world position via the parent Slide's positioning wrapper.
|
|
356
|
+
*/
|
|
357
|
+
declare function ShapeElementRenderer({ element, theme, slideWidthPx }: ShapeElementRendererProps): react_jsx_runtime.JSX.Element;
|
|
358
|
+
|
|
359
|
+
interface SlideKeyboardOptions {
|
|
360
|
+
/** Number of slides — clamps next/prev to bounds. */
|
|
361
|
+
total: number;
|
|
362
|
+
/** Current slide index. */
|
|
363
|
+
index: number;
|
|
364
|
+
/** Move to a specific slide. */
|
|
365
|
+
goTo: (index: number) => void;
|
|
366
|
+
/** Called on Esc — typically exits fullscreen. */
|
|
367
|
+
onExit?: () => void;
|
|
368
|
+
/** Called on `B` — typically blacks/whites out the screen. */
|
|
369
|
+
onBlank?: () => void;
|
|
370
|
+
/** Called on `F` — typically toggles fullscreen. */
|
|
371
|
+
onFullscreen?: () => void;
|
|
372
|
+
/** Disable when the editor is focused / a modal is open. */
|
|
373
|
+
enabled?: boolean;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Standard slideshow keyboard plumbing:
|
|
377
|
+
*
|
|
378
|
+
* ← / PageUp — previous slide
|
|
379
|
+
* → / PageDown / Space — next slide
|
|
380
|
+
* Home — first slide
|
|
381
|
+
* End — last slide
|
|
382
|
+
* Esc — onExit
|
|
383
|
+
* B / . — onBlank (blackout)
|
|
384
|
+
* F — onFullscreen
|
|
385
|
+
* 1..9 — jump to slide N
|
|
386
|
+
*/
|
|
387
|
+
declare function useSlideKeyboard({ total, index, goTo, onExit, onBlank, onFullscreen, enabled, }: SlideKeyboardOptions): void;
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Hook that wraps a controlled deck with a typed mutation API. Every helper
|
|
391
|
+
* applies a `DeckOp` and emits the new deck via `onChange`. Consumers that
|
|
392
|
+
* want raw control over the deck can skip this and edit the deck directly
|
|
393
|
+
* — the helpers exist so the editor / agent bridge / undo system all funnel
|
|
394
|
+
* through the same shape.
|
|
395
|
+
*/
|
|
396
|
+
interface UseDeckStateOptions {
|
|
397
|
+
value: Deck;
|
|
398
|
+
onChange: (next: Deck) => void;
|
|
399
|
+
/** Called after every mutation with the op that produced it — wire up an AgentPanel / audit log. */
|
|
400
|
+
onOp?: (op: DeckOp) => void;
|
|
401
|
+
}
|
|
402
|
+
interface DeckStateApi {
|
|
403
|
+
/** Apply a raw DeckOp — the catch-all that every helper funnels through. */
|
|
404
|
+
apply: (op: DeckOp) => void;
|
|
405
|
+
/** Deck-level helpers. */
|
|
406
|
+
setTitle: (title: string) => void;
|
|
407
|
+
applyTheme: (theme: Theme) => void;
|
|
408
|
+
/** Slide-level helpers. */
|
|
409
|
+
addSlide: (index?: number, partial?: Partial<Slide$1>) => string;
|
|
410
|
+
duplicateSlide: (id: string) => string;
|
|
411
|
+
removeSlide: (id: string) => void;
|
|
412
|
+
reorderSlide: (id: string, toIndex: number) => void;
|
|
413
|
+
setLayout: (id: string, layout: SlideLayout) => void;
|
|
414
|
+
setNotes: (id: string, notes: string) => void;
|
|
415
|
+
setBackground: (id: string, bg?: SlideBackground) => void;
|
|
416
|
+
/** Element-level helpers. */
|
|
417
|
+
addElement: (slideId: string, element: Omit<SlideElement, "id"> & {
|
|
418
|
+
id?: string;
|
|
419
|
+
}) => string;
|
|
420
|
+
removeElement: (slideId: string, elementId: string) => void;
|
|
421
|
+
updateElement: (slideId: string, elementId: string, patch: Partial<SlideElement>) => void;
|
|
422
|
+
moveElement: (slideId: string, elementId: string, x: number, y: number) => void;
|
|
423
|
+
resizeElement: (slideId: string, elementId: string, w: number, h: number) => void;
|
|
424
|
+
/** Convenience lookups. */
|
|
425
|
+
getSlide: (id: string) => Slide$1 | undefined;
|
|
426
|
+
getElement: (slideId: string, elementId: string) => SlideElement | undefined;
|
|
427
|
+
}
|
|
428
|
+
declare function useDeckState({ value, onChange, onOp }: UseDeckStateOptions): DeckStateApi;
|
|
429
|
+
/**
|
|
430
|
+
* Pure reducer — the single source of truth for how every DeckOp mutates a
|
|
431
|
+
* Deck. Agents, undo stacks, replay logs, and the editor all funnel through
|
|
432
|
+
* this. Never mutates the input.
|
|
433
|
+
*/
|
|
434
|
+
declare function reduce(deck: Deck, op: DeckOp): Deck;
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* The default Fancy UI deck theme. Conservative neutral palette, modern
|
|
438
|
+
* geometric typography, 16:9 ratio. Custom themes can extend this — see
|
|
439
|
+
* `defineTheme()` in `./theme-utils`.
|
|
440
|
+
*/
|
|
441
|
+
declare const defaultTheme: Theme;
|
|
442
|
+
/** Dark inverse of the default theme. */
|
|
443
|
+
declare const darkTheme: Theme;
|
|
444
|
+
/** A loud, brand-forward theme — handy for marketing decks. */
|
|
445
|
+
declare const vividTheme: Theme;
|
|
446
|
+
declare const builtinThemes: Record<string, Theme>;
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Merge a partial theme with the defaults so consumers can override just the
|
|
450
|
+
* pieces they care about (colors, fonts, aspect ratio) and inherit the rest.
|
|
451
|
+
*/
|
|
452
|
+
declare function defineTheme(overrides: Partial<Theme> & {
|
|
453
|
+
name: string;
|
|
454
|
+
}): Theme;
|
|
455
|
+
/** Resolve the effective theme for a deck — applies the default for any missing fields. */
|
|
456
|
+
declare function resolveTheme(theme: Theme | undefined): Theme;
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Stable id generator. Deliberately simple — uses a counter + timestamp so
|
|
460
|
+
* generated ids are URL-safe and human-readable, not cryptographically
|
|
461
|
+
* unique. Servers / collaborative sessions should overwrite these with real
|
|
462
|
+
* UUIDs when persisting.
|
|
463
|
+
*/
|
|
464
|
+
declare function nextId(prefix?: string): string;
|
|
465
|
+
declare function slideId(): string;
|
|
466
|
+
declare function elementId(): string;
|
|
467
|
+
declare function deckId(): string;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Starter ECharts option objects for each `ChartKind`. Used by
|
|
471
|
+
* `DeckEditor.insertChart(kind)` so each toolbar dropdown choice spawns
|
|
472
|
+
* a renderable chart with sensible defaults — bar/line/area on a
|
|
473
|
+
* Q1-Q4 category axis, pie with three slices, scatter with a small
|
|
474
|
+
* random cluster.
|
|
475
|
+
*
|
|
476
|
+
* Once the agent or user edits the chart's `option`, the original
|
|
477
|
+
* `kind` is irrelevant — `option.series[0].type` is the source of
|
|
478
|
+
* truth from then on.
|
|
479
|
+
*/
|
|
480
|
+
type ChartKind = "bar" | "line" | "pie" | "area" | "scatter";
|
|
481
|
+
type Option = Record<string, unknown>;
|
|
482
|
+
declare function chartStarterOption(kind: ChartKind): Option;
|
|
483
|
+
|
|
484
|
+
export { type ChartKind$1 as ChartKind, Deck, DeckEditor, type DeckEditorProps, DeckOp, type DeckStateApi, EditorToolbar, type EditorToolbarProps, ElementInspector, type ElementInspectorProps, ImageElement, ImageElementRenderer, type ImageElementRendererProps, PresenterView, type PresenterViewProps, ShapeElement, ShapeElementRenderer, type ShapeElementRendererProps, ShapeKind, Slide, SlideBackground, type SlideContextValue, Slide$1 as SlideData, SlideElement, type SlideKeyboardOptions, SlideLayout, type SlideProps, SlideRail, type SlideRailProps, SlideThumbnail, type SlideThumbnailProps, SlideViewer, type SlideViewerProps, SpeakerNotes, type SpeakerNotesProps, TextElement, TextElementRenderer, type TextElementRendererProps, Theme, type UseDeckStateOptions, builtinThemes, chartStarterOption, darkTheme, deckId, defaultTheme, defineTheme, elementId, nextId, reduce as reduceDeck, resolveTheme, slideId, useDeckState, useIsDarkSlide, useSlideContext, useSlideKeyboard, useSlideTheme, vividTheme };
|