pro-visu 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pro Laico
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,377 @@
1
+ # pro-visu
2
+
3
+ A portable CLI for generating marketing/showcase assets (scroll reels, responsive
4
+ screenshots, media walls — with more asset types to come) of the websites you build. Install it
5
+ into any website repo, point it at a URL, and it writes assets into a gitignored `pro-visu/`
6
+ folder.
7
+
8
+ > Status: **0.2** (pre-1.0; the option surface may still shift). Generators: `scroll-reel` (deterministic frame-stepped recording → mp4 — scroll
9
+ > reels, choreographed tours, scripted interaction, social formats and more), `screenshots`
10
+ > (responsive full-page + element captures), `wall` (a seamless-looping media wall of your
11
+ > assets), `image` (register a file for reuse), plus `specimen`/`palette`/`palette-reel`. The
12
+ > pipeline is a plugin contract, so new asset types slot in without core changes.
13
+
14
+ > Requires Node ≥ 18.18. The first run downloads a managed Chromium (cached and shared
15
+ > across projects); ffmpeg is bundled — no global installs required.
16
+
17
+ ## Install & usage
18
+
19
+ Two ways to run it — same `pro-visu` CLI, same generators. They differ only in how you install it
20
+ and author config:
21
+
22
+ | | **Dev dependency** (recommended) | **Global / `npx`** (no install) |
23
+ |---|---|---|
24
+ | Install | `pnpm add -D pro-visu` | `npm i -g pro-visu`, or just `npx pro-visu …` |
25
+ | Config | TS `pro-visu.config.ts` (`defineConfig`) — or JSON | JSON `pro-visu.config.json` |
26
+ | Editor help | Full TypeScript checking + autocomplete + hover docs | Autocomplete + validation + hover docs from a generated JSON Schema |
27
+ | Version | Pinned in your lockfile → you and CI build identical assets | Floating (npx fetches latest; pin with `pro-visu@x.y.z`) |
28
+ | Best for | A repo you own, and CI pipelines | One-off captures, trying it out, throwaway scripts |
29
+
30
+ > **Why a TS config needs the dev-dependency:** `pro-visu.config.ts` does
31
+ > `import { defineConfig } from "pro-visu"`, which must resolve from your project's
32
+ > `node_modules` — both to type-check *and* to run. A JSON config has no import, so it works in every
33
+ > mode, and the generated `pro-visu.schema.json` gives editors the same autocomplete, validation, and
34
+ > hover docs. So: want the typed config and reproducible pins → dev dependency; want zero install →
35
+ > global/npx with a JSON config.
36
+
37
+ ### As a dev dependency (recommended)
38
+
39
+ ```bash
40
+ pnpm add -D pro-visu # or: npm i -D pro-visu / yarn add -D pro-visu
41
+ npx pro-visu init # scaffolds pro-visu.config.ts, gitignores pro-visu/, ensures a browser
42
+ # edit pro-visu.config.ts, start your site (or use a deployed URL), then:
43
+ npx pro-visu generate
44
+ ```
45
+
46
+ ### Globally or via `npx` (no install)
47
+
48
+ ```bash
49
+ npx pro-visu init --json # scaffolds pro-visu.config.json + pro-visu.schema.json
50
+ # edit pro-visu.config.json, then:
51
+ npx pro-visu generate
52
+ ```
53
+
54
+ …or install once with `npm i -g pro-visu` and drop the `npx`. `init --json` points the config at
55
+ the generated schema (`"$schema": "./pro-visu.schema.json"`), so your editor gives full autocomplete +
56
+ validation with no project dependency — refresh it after upgrading the tool with `pro-visu schema`.
57
+
58
+ ## Config
59
+
60
+ `pro-visu init` writes a `pro-visu.config.ts`. It has two sections — `settings`
61
+ (repo-level CLI behavior) and `assets` (what to generate):
62
+
63
+ ```ts
64
+ import { defineConfig } from "pro-visu";
65
+
66
+ export default defineConfig({
67
+ settings: {
68
+ outDir: "pro-visu",
69
+ concurrency: 2,
70
+ browser: { headless: true },
71
+ defaults: { "scroll-reel": { width: 1440, height: 900, fps: 30 } },
72
+ },
73
+ assets: [
74
+ { name: "home-reel", url: "https://your-site.com", generator: "scroll-reel" },
75
+ ],
76
+ });
77
+ ```
78
+
79
+ Config is discovered in multiple formats: `pro-visu.config.{ts,js,mjs,cjs,json}`,
80
+ `.pro-visurc`, or a `pro-visu` key in `package.json`. Use `--config <path>` to override.
81
+
82
+ Prefer JSON (or running via `npx`/global)? `pro-visu init --json` writes the same config as
83
+ `pro-visu.config.json` plus a `pro-visu.schema.json`, wired up with `"$schema": "./pro-visu.schema.json"`
84
+ so your editor still autocompletes and validates every field. `pro-visu schema` regenerates that
85
+ schema (run it after upgrading the tool).
86
+
87
+ ## Generators
88
+
89
+ Each asset picks a `generator`. Defaults live under `settings.defaults["<generator-id>"]`
90
+ and are merged beneath each asset's own `options`.
91
+
92
+ | Generator | Output | Key options |
93
+ |---|---|---|
94
+ | `scroll-reel` | mp4 of the site (frame-stepped by default) — scroll reels, choreographed tours, interaction demos | `width`/`height`/`fps`/`duration`/`easing` plus `capture`, `choreography`, `autoSections`, `kenBurns`, `loop`, clean-capture, `colorScheme`/`viewports`, `aspect`, `outputs`, `intro`/`outro`, `annotations`, `actions`, `focus`, `routes` — see [Recording reels in depth](#recording-reels-in-depth-scroll-reel) |
95
+ | `screenshots` | png/jpeg page + element captures per breakpoint | `breakpoints[]`, `fullPage`, `format`, `elements[]`, `deviceScaleFactor` |
96
+ | `wall` | mp4 media wall — columns of your assets, each scrolling on its own, looping seamlessly | `columns[]` (tiles + per-column motion), `pulses`, `loops`, `pan`, `gap`/`tileAspect`/`cornerRadius`, `stagger`, `test` |
97
+ | `image` | passthrough — registers an existing image file as an asset (e.g. a wall tile) | `src`, `fileName` |
98
+ | `specimen` / `palette` / `palette-reel` | type specimen / colour palette (still + reel) | see the [docs](https://pro-visu.com/docs) |
99
+
100
+ ```ts
101
+ assets: [
102
+ { name: "home-reel", url: "https://your-site.com", generator: "scroll-reel" },
103
+ {
104
+ name: "home-shots",
105
+ url: "https://your-site.com",
106
+ generator: "screenshots",
107
+ options: {
108
+ breakpoints: [
109
+ { name: "desktop", width: 1440, height: 900 },
110
+ { name: "mobile", width: 390, height: 844 },
111
+ ],
112
+ elements: [{ selector: "header", name: "nav" }],
113
+ },
114
+ },
115
+ ],
116
+ ```
117
+
118
+ ## Recording reels in depth (`scroll-reel`)
119
+
120
+ `scroll-reel` is the workhorse. By default it captures **frame-stepped**: it drives a virtual
121
+ clock, screenshots each frame, and pipes them to ffmpeg — so output is frame-accurate, crisp
122
+ (supersampled by `deviceScaleFactor`), parallelized across `workers`, and **byte-identical
123
+ run-to-run**. Every option below is a `scroll-reel` option.
124
+
125
+ > Every option has hover docs in `pro-visu.config.ts` — the authoring types are generated from
126
+ > the validation schema, so the editor always matches what the tool accepts.
127
+
128
+ ### Capture mode
129
+
130
+ | Option | Meaning |
131
+ |---|---|
132
+ | `capture` | `"frames"` (default) deterministic frame-stepping; `"realtime"` records live (fallback for time-based hero animations / autoplay video). |
133
+ | `workers` | Parallel render contexts for `"frames"` (default ≈ half the cores). |
134
+ | `frameFormat` | Intermediate frame format for `"frames"`: `"jpeg"` (default) or `"png"` (lossless). |
135
+
136
+ Choreography, auto-sections, variants, cards, annotations, aspect and extra outputs are
137
+ **frames-only**; `realtime` ignores them (with a warning).
138
+
139
+ ### Motion & cinematography
140
+
141
+ ```ts
142
+ options: {
143
+ // pause-on-section tour: scroll to a target (0..1, "NN%", or a selector) and hold
144
+ choreography: [
145
+ { to: "#hero", holdMs: 1200 },
146
+ { to: "#features", holdMs: 1500 },
147
+ { to: "100%", durationMs: 1000 },
148
+ ],
149
+ kenBurns: { scaleTo: 1.06 }, // slow zoom over the clip
150
+ loop: "boomerang", // play forward then back → seamless loop
151
+ }
152
+ ```
153
+
154
+ - `easing` — `linear`, `easeInOutCubic`/`Quad`, `easeOutCubic`/`Quint`, `easeInOutSine`/`Expo`.
155
+ - `choreography: [{ to, durationMs?, holdMs?, easing? }]` — replaces the single sweep with an
156
+ authored sequence (`to` = a `0..1` number, an `"NN%"` string, or a CSS selector to bring into view).
157
+ - `autoSections: true | { minHeightFraction?, selector?, holdMs?, durationMs?, maxSections?, constantVelocity? }`
158
+ — auto-detect the page's sections and pan/hold through them within a fixed `durationMs` budget.
159
+ - `kenBurns: { scaleFrom?, scaleTo?, easing?, originX?, originY? }` — slow zoom (folds automatically
160
+ under `loop: "boomerang"` so it stays seamless).
161
+ - `loop: "none" | "boomerang"`.
162
+
163
+ ### Clean capture
164
+
165
+ Suppress real-site noise so frames are clean and deterministic:
166
+
167
+ - `hideSelectors: []`, `injectCss`, `clickSelectors: []` (best-effort consent dismissal),
168
+ `hideScrollbars` (default `true`), `pauseAnimations`, `freezeClock` (pin `Date.now` /
169
+ `performance.now` / `Math.random`).
170
+ - Network: `blockTrackers` (default `true` — aborts common analytics/ads/session-replay),
171
+ `blockHosts: []`, `blockResourceTypes: []` (e.g. `["media", "font"]`).
172
+ - Settling: `settlePerFrame` (default on; off in `--draft`) waits for fonts + in-view images each
173
+ frame; bounded by `settleMaxMs`.
174
+
175
+ ### Variants — one config, many assets
176
+
177
+ ```ts
178
+ options: {
179
+ colorScheme: "both", // → <name>-light and <name>-dark
180
+ viewports: [
181
+ { name: "desktop", width: 1440, height: 900 },
182
+ { name: "mobile", width: 390, height: 844, deviceScaleFactor: 3 },
183
+ ], // → <name>-desktop, <name>-mobile (× schemes)
184
+ }
185
+ ```
186
+
187
+ - `colorScheme: "light" | "dark" | "both"` (+ `themeClass` to toggle a CSS-class theme).
188
+ - `viewports: [{ name, width, height, deviceScaleFactor? }]`.
189
+
190
+ The viewport × color-scheme matrix is emitted as separate assets (`<name>-<suffix>`).
191
+
192
+ ### Output formats & framing
193
+
194
+ - `aspect: "16:9" | "9:16" | "1:1" | { width, height }` with `fit: "cover" | "contain"` and `padColor`
195
+ — reframe for social (e.g. `9:16` reels).
196
+ - `outputs: ("mp4" | "gif" | "webp" | "poster")[]` (default `["mp4"]`) — each becomes its own asset;
197
+ `gifFps` tunes the GIF/WebP frame rate.
198
+ - `intro` / `outro: { title?, subtitle?, background?, color?, durationMs?, fadeMs? }` — fade-in title
199
+ card / end card.
200
+ - `annotations: [{ text?, ring?, spotlight?, atMs?, untilMs?, position? }]` — timed captions, a
201
+ highlight ring around a selector, or a spotlight that dims everything else.
202
+
203
+ ```ts
204
+ options: {
205
+ aspect: "9:16",
206
+ outputs: ["mp4", "gif", "poster"],
207
+ intro: { title: "Acme", subtitle: "Botanik" },
208
+ annotations: [{ text: "Real-time data", ring: "#chart", atMs: 1000, untilMs: 3000 }],
209
+ }
210
+ ```
211
+
212
+ ### Scripted interaction & element focus (realtime)
213
+
214
+ ```ts
215
+ options: {
216
+ cursor: { color: "#e91e63" },
217
+ actions: [
218
+ { do: "click", selector: "#menu-button" },
219
+ { do: "hover", selector: ".dropdown a:first-child" },
220
+ { do: "type", selector: "input[type=search]", text: "shoes" },
221
+ ],
222
+ }
223
+ ```
224
+
225
+ - `actions: [{ do: "move" | "click" | "hover" | "type" | "scrollTo" | "wait", selector?, x?, y?, text?, to?, durationMs?, holdMs? }]`
226
+ drives a scripted tour with a synthetic `cursor: { show?, size?, color? }`. Records **realtime**
227
+ (interactions and their animations are time-based).
228
+ - `focus: { selector, padding?, actions?, holdMs? }` — capture a single component (optionally trigger
229
+ it first), cropped to its box.
230
+
231
+ ### Multi-page tour
232
+
233
+ ```ts
234
+ options: {
235
+ routes: [
236
+ "https://site.com",
237
+ { url: "https://site.com/pricing", autoSections: true },
238
+ { url: "https://site.com/contact", durationMs: 2000 },
239
+ ],
240
+ }
241
+ ```
242
+
243
+ `routes` captures each page as a frame-stepped segment and concatenates them into one reel; aspect
244
+ and extra `outputs` apply to the final tour.
245
+
246
+ ## Media wall & composition
247
+
248
+ Assets can depend on other assets via `inputs: { slot: assetName }` — producers run first and
249
+ their output is fed to the consumer. The **`wall`** generator composites assets into a seamless
250
+ media wall: each column lists the assets it stacks (by name), and the wall **derives** its
251
+ dependencies from those names — so the producers run first and there's no `inputs` map to write.
252
+ Every tile fills its column's **width** and takes its **own height** from its media's aspect ratio
253
+ (16:9 → short, 9:16 → tall) — a natural masonry, not a fixed grid; you don't set a tile size.
254
+
255
+ ```ts
256
+ assets: [
257
+ { name: "img-coat", generator: "image", options: { src: "public/img/coat.jpg" } },
258
+ { name: "ui-home", url: "/", generator: "screenshots", options: { fullPage: false } },
259
+ // …enough to fill the columns…
260
+ {
261
+ name: "wall",
262
+ generator: "wall", // no url, no inputs — derived from the tiles below
263
+ options: {
264
+ durationSeconds: 16,
265
+ pan: { direction: "left", loops: 1 },
266
+ columns: [
267
+ { tiles: ["img-coat", "ui-home"], direction: "down",
268
+ pulses: [{ at: 0.1, duration: 0.15, distance: 0.5 }] },
269
+ { tiles: ["ui-home", "img-coat"], direction: "up", loops: 1, stagger: 0.4 },
270
+ { tiles: ["img-coat", "ui-home"], stagger: 0.15 },
271
+ ],
272
+ },
273
+ },
274
+ ],
275
+ ```
276
+
277
+ - **Motion** is a uniform *pulse* model: a column's travel = `loops` continuous periods + its
278
+ `pulses` (each `{ at, duration, distance, easing }`, all clip-relative), rounded up to a whole
279
+ number so it loops seamlessly. `loops` defaults to `0` (static unless a pulse moves it); `stagger`
280
+ (0–1) phase-shifts a column so similar tiles don't line up.
281
+ - **Tile sizing:** tiles fit the column width and take their height from the media's aspect, so
282
+ columns scroll as a masonry. `tileAspect` is only a **fallback** for faux (`test`) tiles that don't
283
+ set their own `aspect` — real tiles ignore it.
284
+ - **Test mode:** `test: true` renders faux labeled colour boxes instead of real assets — no
285
+ producers run and the managed server is auto-skipped, so it previews in seconds. Give a faux tile
286
+ an `aspect` (w/h) to mirror the real tile's height. Pair with `capture: "realtime"` while
287
+ iterating; drop both for the final render.
288
+ - **Capture modes:** `capture: "frames"` (default) steps deterministically (frame-accurate, exact
289
+ duration, parallelized by `workers`); `capture: "realtime"` records the scene live (faster).
290
+
291
+ ## Commands
292
+
293
+ | Command | What it does |
294
+ |---|---|
295
+ | `pro-visu init` | Scaffold config, create + gitignore the output dir, ensure Chromium. `--json` scaffolds a dependency-free JSON config + JSON Schema instead of the TS one |
296
+ | `pro-visu generate [--asset <name>]` | Run generators per config; writes assets + `manifest.json` |
297
+ | `pro-visu list` | Show generated assets recorded in the manifest |
298
+ | `pro-visu schema [--out <path>]` | Write a JSON Schema for `pro-visu.config.json` (editor autocomplete); re-run after upgrading to refresh it |
299
+ | `pro-visu reset` | Clean up orphaned processes/temp from an interrupted run |
300
+
301
+ `generate` flags: `--draft` (faster, lower-fidelity iteration), `--cache` (skip assets whose
302
+ inputs+options are unchanged), `--skip-server` (use an already-running site), `--skip-build`
303
+ (keep the managed server but skip its build), `--concurrency`, `--verbose`. A managed server
304
+ (`settings.server`) can build → start → capture → stop the site automatically so the npm script
305
+ is just `pro-visu generate`. See the [CLI docs](https://pro-visu.com/docs/cli) for the
306
+ full flag list.
307
+
308
+ The CLI checks npm at most once a day and, if a newer version is out, prints an upgrade notice
309
+ after the command finishes. It's best-effort and non-blocking, and stays quiet in CI and piped
310
+ output; disable it with `NO_UPDATE_NOTIFIER=1` or `--no-update-notifier`.
311
+
312
+ ## Using an unreleased build (from source)
313
+
314
+ The published package covers the modes above. To use an **unreleased** build — while contributing,
315
+ or to pin `main` — pick one:
316
+
317
+ **A — From this GitHub repo (simplest):**
318
+ ```bash
319
+ pnpm add -D github:pro-laico/pro-visu
320
+ ```
321
+ pnpm builds it on install (via the `prepare` script), so the `pro-visu` binary is ready.
322
+
323
+ **B — From a local clone with `pnpm link` (best while iterating on the tool):**
324
+ ```bash
325
+ # in the pro-visu repo
326
+ pnpm install && pnpm build && pnpm link --global
327
+ # in your website repo
328
+ pnpm link --global pro-visu
329
+ ```
330
+ Re-run `pnpm build` in the tool repo after changes; the link picks them up.
331
+
332
+ **C — As a local `file:` dependency (pinned path):**
333
+ ```bash
334
+ pnpm -C /path/to/pro-visu install && pnpm -C /path/to/pro-visu build
335
+ # then in your website repo's package.json:
336
+ # "devDependencies": { "pro-visu": "file:/path/to/pro-visu" }
337
+ pnpm install
338
+ ```
339
+
340
+ Then, in your website repo:
341
+ ```bash
342
+ npx pro-visu init # scaffolds pro-visu.config.ts, gitignores pro-visu/, installs Chromium
343
+ npx pro-visu generate # point a target at a deployed URL or a localhost you've started
344
+ ```
345
+
346
+ The first run downloads a Chromium for Playwright (one-time, cached and shared across
347
+ projects).
348
+
349
+ ## Developing pro-visu
350
+
351
+ ```bash
352
+ pnpm install # installs deps; `prepare` builds dist/
353
+ pnpm dev # tsup --watch
354
+ pnpm build # tsup -> dist/
355
+ pnpm typecheck # tsc --noEmit
356
+ pnpm test # vitest (unit)
357
+ ```
358
+
359
+ **Manual end-to-end run** — drive the built CLI against a throwaway folder, no linking needed.
360
+ A JSON config avoids needing the package resolvable for a `defineConfig` import:
361
+ ```bash
362
+ pnpm build
363
+ mkdir /tmp/probe && cd /tmp/probe
364
+ printf '{ "assets": [ { "name": "demo", "url": "https://example.com", "generator": "scroll-reel" } ] }' > pro-visu.config.json
365
+ node /path/to/pro-visu/dist/cli/index.js generate --cwd . --config pro-visu.config.json
366
+ ```
367
+ To exercise the real consumer path (a TS `pro-visu.config.ts` that imports `defineConfig`,
368
+ or the `wall` loading its bundled scene web app), the package must be resolvable from that folder —
369
+ use option B/C above, or a `node_modules/pro-visu` junction to this repo.
370
+
371
+ **Adding a generator:** implement the `Generator` contract in `src/generators/<id>/`,
372
+ `register()` it in `src/generators/registry.ts`, and extend the `AssetSpecInput` union +
373
+ `settings.defaults` in `src/config/define-config.ts`. No pipeline or CLI changes needed.
374
+
375
+ ## License
376
+
377
+ MIT
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node