pptx-vanilla-viewer 0.1.0 → 0.1.2

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
@@ -1,8 +1,14 @@
1
1
  # pptx-vanilla-viewer
2
2
 
3
- > **Work in progress** -- this package is under active development and the API
4
- > may change. Full documentation, examples, and a stable release are coming soon.
5
- > For the latest source, issue tracker, and updates visit the GitHub repository:
3
+ > ### ⚠️ Under active development
4
+ >
5
+ > Viewing, presenting, and a first editing pass (select, drag, resize,
6
+ > rotate, inline text, undo/redo, save/download) are all available. There is
7
+ > no property inspector, template (master/layout) editing, export, or
8
+ > collaboration yet - see [PORTING.md](https://github.com/ChristopherVR/pptx-viewer/blob/main/PORTING.md)
9
+ > for the full parity checklist. The API may change.
10
+ >
11
+ > For the latest source, roadmap, and issue tracker visit:
6
12
  >
7
13
  > **https://github.com/ChristopherVR/pptx-viewer**
8
14
 
@@ -25,11 +31,13 @@ const viewer = createPptxViewer(document.getElementById('host')!, {
25
31
  theme: { colors: { primary: '#e34f26' } },
26
32
  locale: 'en',
27
33
  initialSlide: 0,
34
+ editable: true, // select, drag, resize, rotate, inline text, undo/redo, save
28
35
  showToolbar: true,
29
36
  showThumbnails: true,
30
37
  onLoad: ({ slideCount }) => console.log(`${slideCount} slides`),
31
38
  onSlideChange: (index) => console.log('slide', index + 1),
32
39
  onError: (message) => console.error(message),
40
+ onDirtyChange: (dirty) => console.log('unsaved edits:', dirty),
33
41
  });
34
42
 
35
43
  // Navigation / zoom
@@ -42,6 +50,14 @@ viewer.zoomToFit();
42
50
  // Presentation mode (real Fullscreen API; Esc exits)
43
51
  await viewer.enterPresentation();
44
52
 
53
+ // Editing (click/drag/resize/rotate/double-click-to-edit-text happen via the
54
+ // DOM; these are the programmatic entry points)
55
+ viewer.undo();
56
+ viewer.redo();
57
+ viewer.deleteSelected();
58
+ const bytes = await viewer.save(); // serialise the edited deck to .pptx bytes
59
+ await viewer.downloadPptx('quarterly-edited.pptx'); // save() + trigger a download
60
+
45
61
  // Load a different file later
46
62
  await viewer.loadFile(fileInput.files![0]);
47
63
  await viewer.loadUrl('/other-deck.pptx');
@@ -57,9 +73,15 @@ The container should have a size (the viewer fills it: `width/height: 100%`).
57
73
 
58
74
  ## Keyboard
59
75
 
60
- Arrow keys / PageUp / PageDown / Space navigate, Home/End jump to the first or
61
- last slide, Esc exits presentation mode. The viewer root is focusable
62
- (`tabindex="0"`).
76
+ Navigation: arrow keys / PageUp / PageDown / Space, Home/End jump to the
77
+ first or last slide, Esc exits presentation mode. The viewer root is
78
+ focusable (`tabindex="0"`).
79
+
80
+ When `editable` is on and an element is selected: Ctrl/Cmd+Z undoes,
81
+ Ctrl/Cmd+Shift+Z (or Ctrl+Y) redoes, Delete/Backspace deletes the selection,
82
+ Ctrl/Cmd+D duplicates it, arrow keys nudge it by 1px (Shift+arrow for 10px),
83
+ and Escape deselects. Double-click a text-capable element to edit its text
84
+ inline.
63
85
 
64
86
  ## Styling and theming
65
87
 
@@ -72,6 +94,25 @@ All chrome colors come from the shared `--pptx-*` CSS custom properties. Pass
72
94
  a `ViewerTheme` (`theme` option or `setTheme`) to override them; the
73
95
  `vermilionLightTheme` / `vermilionDarkTheme` presets are re-exported.
74
96
 
97
+ ## Editing
98
+
99
+ Pass `editable: true` (or call `setEditable(true)` at runtime) to turn on:
100
+
101
+ - Click to select an element, click empty space to deselect.
102
+ - Drag to move, with snap-to-sibling-edge guides.
103
+ - Resize via 8 handles (Shift locks aspect ratio on the corner handles) and
104
+ rotate via a rotate handle (Shift snaps to angle increments).
105
+ - Double-click a text-capable element for inline text editing.
106
+ - Undo/redo (100-entry history), delete, and duplicate (`Ctrl/Cmd+D`).
107
+ - The toolbar's Save button (shown only when `editable`), which calls
108
+ `downloadPptx()` to serialise and download the edited `.pptx`.
109
+
110
+ There is no property/inspector panel, no template (master/layout) editing,
111
+ and no add-new-element or z-order/group operations yet - see
112
+ `viewer.getSelectedElementId()` and the `onSelectionChange` /
113
+ `onDirtyChange` callbacks to build your own chrome around the selection
114
+ state in the meantime.
115
+
75
116
  ## i18n
76
117
 
77
118
  All UI strings go through the shared `pptx.*` dictionary (English built in).
@@ -81,9 +122,10 @@ fall back to English, then to a humanised label.
81
122
 
82
123
  ## Element coverage
83
124
 
84
- Dedicated renderers: text, shape, image/picture, group, connector. All other
85
- element types (table, chart, SmartArt, media, ink, OLE, ...) currently render
86
- a typed placeholder box. Renderers are dispatched through an open registry, so
125
+ Dedicated renderers: text, shape, image/picture, group, connector, table,
126
+ chart, SmartArt (2D), media (video/audio), ink, and OLE. The remaining niche
127
+ types (content parts, zoom links, 3D models) currently render a typed
128
+ placeholder box. Renderers are dispatched through an open registry, so
87
129
  coverage can be extended without forking:
88
130
 
89
131
  ```ts