sketchmark 2.1.7 → 2.1.9

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
@@ -181,94 +181,73 @@ const visual = applyPresetFragments(
181
181
 
182
182
  The output `.visual.json` still contains only kernel elements and timelines. Official namespaces include `shapes`, `characters`, `motions`, `effects`, `transitions`, and `scenes`.
183
183
 
184
- ## CLI
185
-
186
- Build first:
187
-
188
- ```bash
189
- npm run build
190
- ```
191
-
192
- Render:
193
-
194
- ```bash
195
- node bin/sketchmark.cjs render examples/basic.visual.json out.svg
196
- node bin/sketchmark.cjs render examples/timeline.visual.json out.html --time 1
197
- node bin/sketchmark.cjs render examples/timeline.visual.json out.mp4
198
- node bin/sketchmark.cjs render examples/timeline.visual.json out.webm --fps 30
199
- ```
200
-
201
- Generate the key-pose walking example:
202
-
203
- ```bash
204
- node examples/make-keypose-walk.cjs
205
- node bin/sketchmark.cjs preview examples/keypose-walk.visual.json
206
- ```
207
-
208
- Generate the key-pose cyclist example:
209
-
210
- ```bash
211
- node examples/make-keypose-cycle.cjs
212
- node bin/sketchmark.cjs preview examples/keypose-cycle.visual.json
213
- ```
214
-
215
- Generate preset-layer examples:
216
-
217
- ```bash
218
- node examples/make-presets-demo.cjs
219
- node examples/make-preset-character-motion.cjs
220
- node bin/sketchmark.cjs preview examples/presets-demo.visual.json
221
- node bin/sketchmark.cjs preview examples/preset-character-motion.visual.json
222
- ```
223
-
224
- Generate heavier real-world stress scenes:
225
-
226
- ```bash
227
- node examples/make-stress-city-traffic.cjs
228
- node examples/make-stress-ops-dashboard.cjs
229
- node examples/make-stress-airport-radar.cjs
230
-
231
- node bin/sketchmark.cjs preview examples/stress-city-traffic.visual.json
232
- node bin/sketchmark.cjs preview examples/stress-ops-dashboard.visual.json
233
- node bin/sketchmark.cjs preview examples/stress-airport-radar.visual.json
234
- ```
235
-
236
- These are intentionally dense (many elements/keyframes) to pressure test preview responsiveness.
237
-
238
- Preview animated timelines in the browser:
239
-
240
- ```bash
241
- node bin/sketchmark.cjs preview examples/timeline.visual.json
242
- ```
243
-
244
- Open the tiny editor:
245
-
246
- ```bash
247
- node bin/sketchmark.cjs edit examples/keypose-walk.visual.json
248
- ```
249
-
250
- Lint:
251
-
252
- ```bash
253
- node bin/sketchmark.cjs lint examples/basic.visual.json
254
- ```
184
+ ## CLI
185
+
186
+ If you're working from a source checkout, build first:
187
+
188
+ ```bash
189
+ npm run build
190
+ ```
191
+
192
+ Render:
193
+
194
+ ```bash
195
+ node bin/sketchmark.cjs render path/to/diagram.visual.json out.svg
196
+ node bin/sketchmark.cjs render path/to/diagram.visual.json out.html --time 1
197
+ node bin/sketchmark.cjs render path/to/diagram.visual.json out.mp4
198
+ node bin/sketchmark.cjs render path/to/diagram.visual.json out.webm --fps 30
199
+ ```
200
+
201
+ Preview animated timelines in the browser:
202
+
203
+ ```bash
204
+ node bin/sketchmark.cjs preview path/to/diagram.visual.json
205
+ ```
206
+
207
+ Open the tiny editor:
208
+
209
+ ```bash
210
+ node bin/sketchmark.cjs edit path/to/diagram.visual.json
211
+ ```
212
+
213
+ Lint:
214
+
215
+ ```bash
216
+ node bin/sketchmark.cjs lint path/to/diagram.visual.json
217
+ ```
255
218
 
256
219
  Video export is an adapter, not a kernel feature. It samples the document timeline into SVG frames, rasterizes those frames, and hands them to `ffmpeg`. It requires `sharp` and `ffmpeg` to be available in the local environment.
257
220
 
258
221
  ## Public API
259
222
 
260
223
  ```ts
261
- import {
262
- validateVisualDocument,
263
- compileKeyframeStates,
264
- timelineCurvePreset,
265
- resolveVisualFrame,
266
- renderToSvg,
267
- renderToHtml,
268
- lintVisualDocument
269
- } from "sketchmark";
270
- ```
271
-
272
- The root package intentionally exports no builders, player, project loader, deck/sequence helpers, 3D renderer, or preset compiler.
224
+ import {
225
+ validateVisualDocument,
226
+ compileKeyframeStates,
227
+ timelineCurvePreset,
228
+ resolveVisualFrame,
229
+ renderToEmbedHtml,
230
+ renderToSvg,
231
+ renderToHtml,
232
+ lintVisualDocument
233
+ } from "sketchmark";
234
+ ```
235
+
236
+ For a reusable browser preview with play/pause and export controls, generate a self-contained HTML embed and mount it in an `iframe` via `srcDoc`:
237
+
238
+ ```ts
239
+ import { renderToEmbedHtml } from "sketchmark";
240
+
241
+ const html = renderToEmbedHtml(doc, {
242
+ title: "Login Flow",
243
+ maxFrames: 180
244
+ });
245
+ ```
246
+
247
+ `renderToEmbedHtml()` inlines sampled SVG frames so the preview can play without a server route. Use `maxFrames` to trade file size for smoother motion.
248
+ The embed chrome defaults to a transparent outer background and uses light/dark-aware translucent controls so it can sit inside either theme more naturally.
249
+ The embed export menu includes MP4 when the browser supports WebCodecs, so Chrome and Edge are the safest targets for video export.
250
+
251
+ The root package intentionally exports no builders, player, project loader, deck/sequence helpers, 3D renderer, or preset compiler.
273
252
 
274
253
  The official preset authoring layer is available from `sketchmark/presets`, not the root kernel entrypoint.