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 +62 -83
- package/bin/editor-ui.cjs +404 -329
- package/bin/editor-ui.d.ts +0 -1
- package/bin/sketchmark.cjs +84 -28
- package/dist/src/browser-export.d.ts +1 -1
- package/dist/src/browser-export.js +6 -0
- package/dist/src/edit.d.ts +33 -0
- package/dist/src/edit.js +216 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +6 -0
- package/dist/src/mp4-muxer-source.d.ts +1 -0
- package/dist/src/mp4-muxer-source.js +5 -0
- package/dist/src/render/embed.d.ts +11 -0
- package/dist/src/render/embed.js +688 -0
- package/dist/tests/run.js +82 -0
- package/package.json +6 -1
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
|
-
|
|
187
|
-
|
|
188
|
-
```bash
|
|
189
|
-
npm run build
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
Render:
|
|
193
|
-
|
|
194
|
-
```bash
|
|
195
|
-
node bin/sketchmark.cjs render
|
|
196
|
-
node bin/sketchmark.cjs render
|
|
197
|
-
node bin/sketchmark.cjs render
|
|
198
|
-
node bin/sketchmark.cjs render
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
```bash
|
|
204
|
-
node
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
```
|
|
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
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
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.
|