@zumer/snapdom 3.2.1-dev.4 → 3.3.0

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
@@ -52,7 +52,8 @@ This checkout documents **v3.x.x**. The migration guide below compares it with *
52
52
  | Reuse a capture in a texture, overlay or transition | Canvas plus capture geometry | Core |
53
53
  | Save a page fragment for later display | HTML with captured styles and fonts | `html-export` plugin |
54
54
  | Give an agent or a log a view of page content | Text/JSON context, or an image with an element map | `context-export` / `agent-map` plugins |
55
- | Download a document or record changing content | Image-based PDF, animated GIF or browser-encoded video | `pdf-image` / `gif-export` / `video-export` plugins |
55
+ | Download a document or record changing content | Searchable, paginated PDF, animated GIF or browser-encoded video | `pdf` / `gif-export` / `video-export` plugins |
56
+ | Export editable artwork or paste into Figma | Native SVG shapes and text, or a Figma clipboard payload | `vector` plugin |
56
57
 
57
58
  Image, HTML and context exports use the captured state. GIF and video plugins record the live element over time.
58
59
 
@@ -81,12 +82,14 @@ The result keeps that capture even if the source element later changes. Call `sn
81
82
 
82
83
  ## Installation
83
84
 
84
- Install the core and, when you need them, the official plugins; use matching major versions:
85
+ Install the core and, when you need them, the official plugins; choose a core supported by the plugins’ peer dependency:
85
86
 
86
87
  ```sh
87
88
  npm i @zumer/snapdom@latest @zumer/snapdom-plugins@latest
88
89
  ```
89
90
 
91
+ Plugins 4.x in this checkout require core 3.x. The full PDF and Vector exporters are open source under MIT here, but have not been published to npm; the `@latest` command above does not install these new exporters. Run `npm run compile` and `npm run site` to try them against the local build.
92
+
90
93
  Or load it in a browser:
91
94
 
92
95
  ```html
@@ -213,7 +216,7 @@ for (let y = 0; y < h0; y += pieceHeight) {
213
216
 
214
217
  ### Export HTML or structured context
215
218
 
216
- Official plugins are published separately as `@zumer/snapdom-plugins` and must match the core major version; they declare a peer dependency on a v3 core. Their sources live in `packages/plugins/` in this checkout.
219
+ Official plugins are published separately as `@zumer/snapdom-plugins`. Plugins 4.x in this checkout require core 3.x and include the full PDF and Vector exporters under MIT. Their sources live in `packages/plugins/`.
217
220
 
218
221
  ```js
219
222
  import { htmlExport, contextExport } from '@zumer/snapdom-plugins';
@@ -228,6 +231,25 @@ const context = await result.toContext();
228
231
 
229
232
  The same plugin system supports overlays, redaction and custom exporters. Local plugins override global plugins by name. See the [official plugin reference](packages/plugins/README.md) and [plugin specification](PLUGIN_SPEC.md).
230
233
 
234
+ ### Export PDF and editable vectors
235
+
236
+ These examples use plugins 4.x from this checkout. PDF returns a `Blob` with searchable, selectable text, links, pagination and optional form fields. Vector returns an SVG string without `<foreignObject>`, preserving supported shapes and editable text.
237
+
238
+ ```js
239
+ import { snapdom } from '@zumer/snapdom';
240
+ import { pdf } from '@zumer/snapdom-plugins/pdf';
241
+ import { vector } from '@zumer/snapdom-plugins/vector';
242
+
243
+ const documentCapture = await snapdom(element, { plugins: [pdf()] });
244
+ const blob = await documentCapture.toPdf({ page: 'a4', margin: 36 });
245
+
246
+ const artwork = await snapdom(element, { plugins: [vector()] });
247
+ const svg = await artwork.toVector();
248
+ copyButton.addEventListener('click', () => artwork.toFigma());
249
+ ```
250
+
251
+ Pass PDF capture settings to `pdf()` and paper, margin and download settings to `toPdf()`. `toFigma()` returns `Promise<void>` and needs the async clipboard API on HTTPS or localhost, called from a user action. Vector requires a connected source element; unsupported paint is diagnosed by the engine. See the [PDF reference](packages/plugins/pdf/REFERENCE.md) and [Vector contract](packages/plugins/vector/CONTRACT.md).
252
+
231
253
  ### Capture HTML strings
232
254
 
233
255
  ```js
@@ -347,6 +369,7 @@ For a useful comparison, use the same scene, output format, scale and DPR. Compa
347
369
 
348
370
  ## Documentation
349
371
 
372
+ - [Interactive Playground](https://snapdom.dev/playground/), [PDF demos](https://snapdom.dev/pro/pdf/) and [Vector demos](https://snapdom.dev/pro/vector/)
350
373
  - [Archived v2 documentation](https://snapdom.dev/v2/) and [v2 source](https://github.com/zumerlab/snapdom/tree/v2)
351
374
  - [API](https://snapdom.dev/docs/api/) and [options](https://snapdom.dev/docs/options/)
352
375
  - [Framework guides](https://snapdom.dev/guides/) and [how-to examples](https://snapdom.dev/how-to/)