screenci 0.0.68 → 0.0.70
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 +45 -122
- package/dist/cli.d.ts +3 -18
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +117 -158
- package/dist/cli.js.map +1 -1
- package/dist/docs/manifest.d.ts +66 -35
- package/dist/docs/manifest.d.ts.map +1 -1
- package/dist/docs/manifest.js +22 -11
- package/dist/docs/manifest.js.map +1 -1
- package/dist/docs/video-sources/cli.screenci.d.ts +2 -0
- package/dist/docs/video-sources/cli.screenci.d.ts.map +1 -0
- package/dist/docs/video-sources/{cli.video.js → cli.screenci.js} +1 -1
- package/dist/docs/video-sources/cli.screenci.js.map +1 -0
- package/dist/docs/video-sources/installation.screenci.d.ts +2 -0
- package/dist/docs/video-sources/installation.screenci.d.ts.map +1 -0
- package/dist/docs/video-sources/{installation.video.js → installation.screenci.js} +1 -1
- package/dist/docs/video-sources/installation.screenci.js.map +1 -0
- package/dist/docs/video-sources/landing.screenci.d.ts +2 -0
- package/dist/docs/video-sources/landing.screenci.d.ts.map +1 -0
- package/dist/docs/video-sources/{landing.video.js → landing.screenci.js} +1 -1
- package/dist/docs/video-sources/landing.screenci.js.map +1 -0
- package/dist/docs/video-sources/locator-highlight-animated.screenci.d.ts +2 -0
- package/dist/docs/video-sources/locator-highlight-animated.screenci.d.ts.map +1 -0
- package/dist/docs/video-sources/locator-highlight-animated.screenci.js +53 -0
- package/dist/docs/video-sources/locator-highlight-animated.screenci.js.map +1 -0
- package/dist/docs/video-sources/locator-highlight-still.screenci.d.ts +2 -0
- package/dist/docs/video-sources/locator-highlight-still.screenci.d.ts.map +1 -0
- package/dist/docs/video-sources/locator-highlight-still.screenci.js +24 -0
- package/dist/docs/video-sources/locator-highlight-still.screenci.js.map +1 -0
- package/dist/docs/video-sources/product-pitch.screenci.d.ts +2 -0
- package/dist/docs/video-sources/product-pitch.screenci.d.ts.map +1 -0
- package/dist/docs/video-sources/product-pitch.screenci.js +136 -0
- package/dist/docs/video-sources/product-pitch.screenci.js.map +1 -0
- package/dist/docs/video-sources/public-urls.screenci.d.ts +2 -0
- package/dist/docs/video-sources/public-urls.screenci.d.ts.map +1 -0
- package/dist/docs/video-sources/public-urls.screenci.js +34 -0
- package/dist/docs/video-sources/public-urls.screenci.js.map +1 -0
- package/dist/docs/video-sources/studio.screenci.d.ts +2 -0
- package/dist/docs/video-sources/studio.screenci.d.ts.map +1 -0
- package/dist/docs/video-sources/studio.screenci.js +57 -0
- package/dist/docs/video-sources/studio.screenci.js.map +1 -0
- package/dist/docs/videos.d.ts +36 -15
- package/dist/docs/videos.d.ts.map +1 -1
- package/dist/docs/videos.js +27 -2
- package/dist/docs/videos.js.map +1 -1
- package/dist/e2e/htmlRasterizer.e2e.d.ts +2 -0
- package/dist/e2e/htmlRasterizer.e2e.d.ts.map +1 -0
- package/dist/e2e/htmlRasterizer.e2e.js +107 -0
- package/dist/e2e/htmlRasterizer.e2e.js.map +1 -0
- package/dist/e2e/screenshot.e2e.d.ts +2 -0
- package/dist/e2e/screenshot.e2e.d.ts.map +1 -0
- package/dist/e2e/screenshot.e2e.js +73 -0
- package/dist/e2e/screenshot.e2e.js.map +1 -0
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/src/asset.d.ts +245 -53
- package/dist/src/asset.d.ts.map +1 -1
- package/dist/src/asset.js +718 -77
- package/dist/src/asset.js.map +1 -1
- package/dist/src/audio.d.ts +127 -0
- package/dist/src/audio.d.ts.map +1 -0
- package/dist/src/audio.js +207 -0
- package/dist/src/audio.js.map +1 -0
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +9 -3
- package/dist/src/config.js.map +1 -1
- package/dist/src/contextOptions.d.ts +48 -0
- package/dist/src/contextOptions.d.ts.map +1 -0
- package/dist/src/contextOptions.js +71 -0
- package/dist/src/contextOptions.js.map +1 -0
- package/dist/src/crop.d.ts +93 -0
- package/dist/src/crop.d.ts.map +1 -0
- package/dist/src/crop.js +133 -0
- package/dist/src/crop.js.map +1 -0
- package/dist/src/cue.d.ts +17 -4
- package/dist/src/cue.d.ts.map +1 -1
- package/dist/src/cue.js +31 -3
- package/dist/src/cue.js.map +1 -1
- package/dist/src/defaults.d.ts +13 -1
- package/dist/src/defaults.d.ts.map +1 -1
- package/dist/src/defaults.js +13 -0
- package/dist/src/defaults.js.map +1 -1
- package/dist/src/dimensions.d.ts +6 -0
- package/dist/src/dimensions.d.ts.map +1 -1
- package/dist/src/dimensions.js +15 -0
- package/dist/src/dimensions.js.map +1 -1
- package/dist/src/events.d.ts +283 -13
- package/dist/src/events.d.ts.map +1 -1
- package/dist/src/events.js +134 -5
- package/dist/src/events.js.map +1 -1
- package/dist/src/htmlRasterizer.d.ts +153 -0
- package/dist/src/htmlRasterizer.d.ts.map +1 -0
- package/dist/src/htmlRasterizer.js +386 -0
- package/dist/src/htmlRasterizer.js.map +1 -0
- package/dist/src/init.d.ts +17 -0
- package/dist/src/init.d.ts.map +1 -1
- package/dist/src/init.js +131 -11
- package/dist/src/init.js.map +1 -1
- package/dist/src/linkSession.d.ts +36 -0
- package/dist/src/linkSession.d.ts.map +1 -0
- package/dist/src/linkSession.js +122 -0
- package/dist/src/linkSession.js.map +1 -0
- package/dist/src/overlayFlush.d.ts +18 -0
- package/dist/src/overlayFlush.d.ts.map +1 -0
- package/dist/src/overlayFlush.js +56 -0
- package/dist/src/overlayFlush.js.map +1 -0
- package/dist/src/overlayRect.d.ts +69 -0
- package/dist/src/overlayRect.d.ts.map +1 -0
- package/dist/src/overlayRect.js +55 -0
- package/dist/src/overlayRect.js.map +1 -0
- package/dist/src/performance.d.ts +1 -3
- package/dist/src/performance.d.ts.map +1 -1
- package/dist/src/performance.js +0 -12
- package/dist/src/performance.js.map +1 -1
- package/dist/src/recording.d.ts +3 -2
- package/dist/src/recording.d.ts.map +1 -1
- package/dist/src/recordingData.d.ts +22 -2
- package/dist/src/recordingData.d.ts.map +1 -1
- package/dist/src/runtimeContext.d.ts +57 -1
- package/dist/src/runtimeContext.d.ts.map +1 -1
- package/dist/src/runtimeContext.js +40 -0
- package/dist/src/runtimeContext.js.map +1 -1
- package/dist/src/screenshot.d.ts +105 -0
- package/dist/src/screenshot.d.ts.map +1 -0
- package/dist/src/screenshot.js +188 -0
- package/dist/src/screenshot.js.map +1 -0
- package/dist/src/stillCapture.d.ts +68 -0
- package/dist/src/stillCapture.d.ts.map +1 -0
- package/dist/src/stillCapture.js +119 -0
- package/dist/src/stillCapture.js.map +1 -0
- package/dist/src/studio.d.ts +8 -11
- package/dist/src/studio.d.ts.map +1 -1
- package/dist/src/studio.js +2 -25
- package/dist/src/studio.js.map +1 -1
- package/dist/src/types.d.ts +125 -15
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/src/video.d.ts +54 -1
- package/dist/src/video.d.ts.map +1 -1
- package/dist/src/video.js +190 -42
- package/dist/src/video.js.map +1 -1
- package/dist/src/voices.d.ts +22 -9
- package/dist/src/voices.d.ts.map +1 -1
- package/dist/src/voices.js +6 -24
- package/dist/src/voices.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +16 -2
- package/skills/screenci/SKILL.md +37 -15
- package/skills/screenci/references/init.md +3 -1
- package/skills/screenci/references/record.md +8 -3
- package/dist/docs/video-sources/cli.video.d.ts +0 -2
- package/dist/docs/video-sources/cli.video.d.ts.map +0 -1
- package/dist/docs/video-sources/cli.video.js.map +0 -1
- package/dist/docs/video-sources/installation.video.d.ts +0 -2
- package/dist/docs/video-sources/installation.video.d.ts.map +0 -1
- package/dist/docs/video-sources/installation.video.js.map +0 -1
- package/dist/docs/video-sources/landing.video.d.ts +0 -2
- package/dist/docs/video-sources/landing.video.d.ts.map +0 -1
- package/dist/docs/video-sources/landing.video.js.map +0 -1
package/dist/src/asset.d.ts
CHANGED
|
@@ -1,85 +1,267 @@
|
|
|
1
|
+
import type { Locator } from '@playwright/test';
|
|
1
2
|
import type { IEventRecorder } from './events.js';
|
|
2
|
-
export
|
|
3
|
-
export type
|
|
4
|
-
export type Mp4Path = `${string}.mp4`;
|
|
3
|
+
export { setOverlayCss } from './htmlRasterizer.js';
|
|
4
|
+
export type { OverlayPlacement } from './events.js';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Minimal structural stand-in for a React element. Defined here so the core SDK
|
|
7
|
+
* never has to depend on `@types/react`: any JSX element is assignable to this,
|
|
8
|
+
* while a plain {@link OverlayConfig} object is not (it has no `type`/`props`).
|
|
9
|
+
* React itself is detected structurally at runtime and rendered lazily, so it
|
|
10
|
+
* stays an optional peer dependency.
|
|
8
11
|
*/
|
|
9
|
-
export type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
audio?: never;
|
|
12
|
+
export type ReactElementLike = {
|
|
13
|
+
type: unknown;
|
|
14
|
+
props: unknown;
|
|
15
|
+
key?: string | null;
|
|
14
16
|
};
|
|
15
17
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
18
|
+
* Display options for an overlay. Placement fields are flat (not nested) and use
|
|
19
|
+
* CSS pixels in the recording viewport (the same space as Playwright's
|
|
20
|
+
* `boundingBox()`, `page.mouse`, and `viewportSize()`), each defaulting
|
|
21
|
+
* independently: `relativeTo: 'recording'`, `x: 0`, `y: 0`. Provide exactly one
|
|
22
|
+
* of `width`/`height` (the other follows the source aspect, or `aspectRatio`).
|
|
23
|
+
* When no placement field is set, the overlay fills the recording area.
|
|
19
24
|
*/
|
|
20
|
-
export type
|
|
21
|
-
path:
|
|
25
|
+
export type OverlayConfig = {
|
|
26
|
+
/** File path: `.html` (rendered), `.svg`/`.png` (image), or `.mp4` (video). */
|
|
27
|
+
path?: string;
|
|
28
|
+
/**
|
|
29
|
+
* A React element, rendered to a transparent PNG. Use this for overlays built
|
|
30
|
+
* in JSX. Provide exactly one source: `path`, `element`, or `html`.
|
|
31
|
+
*/
|
|
32
|
+
element?: ReactElementLike;
|
|
33
|
+
/**
|
|
34
|
+
* An inline HTML fragment, rendered to a transparent PNG. Use this when you
|
|
35
|
+
* want plain HTML without a React dependency or a separate `.html` file. It
|
|
36
|
+
* must be a fragment (for example `'<div class="badge">New</div>'`), never a
|
|
37
|
+
* full document: `<!doctype>`, `<html>`, `<head>`, and `<body>` tags are
|
|
38
|
+
* rejected because screenci wraps the markup in its own document. Provide
|
|
39
|
+
* exactly one source: `path`, `element`, or `html`.
|
|
40
|
+
*/
|
|
41
|
+
html?: string;
|
|
42
|
+
/** Reference box for placement coordinates. Defaults to `'recording'`. */
|
|
43
|
+
relativeTo?: 'screen' | 'recording';
|
|
44
|
+
/** Left edge in CSS px of the recording viewport. Defaults to `0`. */
|
|
45
|
+
x?: number;
|
|
46
|
+
/** Top edge in CSS px of the recording viewport. Defaults to `0`. */
|
|
47
|
+
y?: number;
|
|
48
|
+
/** Width in CSS px. Provide instead of `height` (exactly one). */
|
|
49
|
+
width?: number;
|
|
50
|
+
/** Height in CSS px. Provide instead of `width` (exactly one). */
|
|
51
|
+
height?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Aspect ratio (`width / height`) used to derive the unset axis from the one
|
|
54
|
+
* you provide, instead of the source's intrinsic aspect. Optional.
|
|
55
|
+
*/
|
|
56
|
+
aspectRatio?: number;
|
|
57
|
+
/** Fill the whole output frame. Overrides x/y/width/height. */
|
|
58
|
+
fullScreen?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Position the overlay over a live element, captured at recording time from
|
|
61
|
+
* the locator's bounding box. The overlay is sized to that box (plus
|
|
62
|
+
* {@link margin}) and fills it, so it frames the element exactly. Overrides
|
|
63
|
+
* `x`/`y`/`width`/`height`/`relativeTo`/`fullScreen` (placement is always
|
|
64
|
+
* recording-relative). HTML files, inline `html`, and React elements only;
|
|
65
|
+
* your content should fill its box (for example `width:100%;height:100%`).
|
|
66
|
+
*/
|
|
67
|
+
over?: Locator;
|
|
68
|
+
/**
|
|
69
|
+
* Extra space (CSS px) added around the {@link over} element on every side,
|
|
70
|
+
* so the overlay surrounds it rather than sitting exactly on its edges. Only
|
|
71
|
+
* valid together with `over`.
|
|
72
|
+
*/
|
|
73
|
+
margin?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Visible length for the blocking call form (`await overlays.logo(1200)`).
|
|
76
|
+
* Omit when driving with `start()`/`end()`. Image/HTML/React overlays only.
|
|
77
|
+
*
|
|
78
|
+
* For animated overlays (`animate: true`) this is also the capture length: it
|
|
79
|
+
* is required when driving with `start()`/`end()` (the capture length is
|
|
80
|
+
* otherwise unknown).
|
|
81
|
+
*/
|
|
82
|
+
durationMs?: number;
|
|
83
|
+
/**
|
|
84
|
+
* Capture the overlay as an animation so its CSS/JS animation plays back in
|
|
85
|
+
* the video (HTML files and React elements only). The animation is sampled
|
|
86
|
+
* over the resolved duration with a transparent background preserved.
|
|
87
|
+
*/
|
|
88
|
+
animate?: boolean;
|
|
89
|
+
/** Animation capture frame rate. Only valid with `animate`. Defaults to `30`. */
|
|
90
|
+
fps?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Extra CSS injected into the overlay document so it can be styled with
|
|
93
|
+
* `className` (for example a compiled Tailwind stylesheet). Merged on top of
|
|
94
|
+
* any global CSS set via `setOverlayCss`. HTML files and React elements only.
|
|
95
|
+
*/
|
|
96
|
+
css?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Transparent padding (CSS px) added around the overlay content. Lets an
|
|
99
|
+
* animation move, scale, or rotate beyond its box without being clipped (an
|
|
100
|
+
* automatic "stage"), at the cost of the placement sizing the padded box.
|
|
101
|
+
* HTML files and React elements only.
|
|
102
|
+
*/
|
|
103
|
+
capturePadding?: number;
|
|
104
|
+
/**
|
|
105
|
+
* Soundtrack level for `.mp4` overlays as a linear gain. `1` (the default)
|
|
106
|
+
* plays the source at its natural level, `0` mutes it, and values above `1`
|
|
107
|
+
* boost it (e.g. `2` is twice the natural level). Capped at
|
|
108
|
+
* {@link MAX_AUDIO_LEVEL}.
|
|
109
|
+
*/
|
|
22
110
|
audio?: number;
|
|
23
|
-
|
|
24
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Playback-rate multiplier for `.mp4` overlays. `2` plays the clip (and its
|
|
113
|
+
* audio) twice as fast, `0.5` at half speed; `1` (the default) is the natural
|
|
114
|
+
* rate. Works like {@link speed} for a recording. For a blocking overlay
|
|
115
|
+
* (`await overlays.clip()`) this also shortens or lengthens the window it
|
|
116
|
+
* holds, so later content shifts; a live overlay (`start()`/`end()`) keeps
|
|
117
|
+
* its window and just plays the source faster/slower inside it. Mutually
|
|
118
|
+
* exclusive with {@link time}. Video overlays only.
|
|
119
|
+
*/
|
|
120
|
+
speed?: number;
|
|
121
|
+
/**
|
|
122
|
+
* Target playback duration (ms) for a `.mp4` overlay, an alternative to
|
|
123
|
+
* {@link speed}: the clip is sped up or slowed down so its source plays over
|
|
124
|
+
* exactly this long. Works like {@link time} for a recording. Mutually
|
|
125
|
+
* exclusive with {@link speed}. Video overlays only.
|
|
126
|
+
*/
|
|
127
|
+
time?: number;
|
|
25
128
|
};
|
|
26
|
-
|
|
27
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Upper bound for an audio level (linear gain). `4` is +12 dB, plenty of
|
|
131
|
+
* headroom for a boost while guarding against accidental extreme distortion.
|
|
132
|
+
*/
|
|
133
|
+
export declare const MAX_AUDIO_LEVEL = 4;
|
|
134
|
+
/**
|
|
135
|
+
* A value accepted by {@link createOverlays} for each key:
|
|
136
|
+
*
|
|
137
|
+
* - a `string` file path (`.html`/`.svg`/`.png`/`.mp4`),
|
|
138
|
+
* - a React element, or
|
|
139
|
+
* - an {@link OverlayConfig} object.
|
|
140
|
+
*/
|
|
141
|
+
export type OverlayInput = string | ReactElementLike | OverlayConfig;
|
|
142
|
+
/**
|
|
143
|
+
* A factory that builds an {@link OverlayConfig} from caller-supplied props.
|
|
144
|
+
* Use this to make an overlay programmatic: the returned config (its content and
|
|
145
|
+
* its placement) can depend on values only known at runtime, for example a
|
|
146
|
+
* locator's position captured with {@link overlayRect}. Both the `element`/`html`
|
|
147
|
+
* content and the placement may vary per call.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```tsx
|
|
151
|
+
* const overlays = createOverlays({
|
|
152
|
+
* note: (p: { text: string }) => ({ html: `<div class="note">${p.text}</div>` }),
|
|
153
|
+
* })
|
|
154
|
+
* await overlays.note({ text: 'Saved' })(1200)
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
export type OverlayConfigFactory<P = unknown> = (props: P) => OverlayConfig;
|
|
158
|
+
/**
|
|
159
|
+
* A value accepted by {@link createOverlays}: a static input or a config
|
|
160
|
+
* factory. The factory arm uses a `never` parameter so a factory with any
|
|
161
|
+
* concrete props type is assignable (function parameters are contravariant);
|
|
162
|
+
* {@link OverlayControllerFor} then recovers the real props type per key.
|
|
163
|
+
*/
|
|
164
|
+
export type OverlayInputOrFactory = OverlayInput | ((props: never) => OverlayConfig);
|
|
165
|
+
export declare function setAssetSleepFn(fn: (ms: number) => void): void;
|
|
28
166
|
export declare function setActiveAssetRecorder(recorder: IEventRecorder | null): void;
|
|
29
167
|
export declare function resetRegisteredAssetPaths(): void;
|
|
168
|
+
export declare function resetAssetChain(): void;
|
|
30
169
|
export declare function validateRegisteredAssetPaths(testFilePath: string): Promise<void>;
|
|
31
170
|
/**
|
|
32
|
-
* An
|
|
171
|
+
* An overlay controller.
|
|
33
172
|
*
|
|
34
|
-
* Calling it
|
|
35
|
-
*
|
|
36
|
-
*
|
|
173
|
+
* Calling it shows the overlay over a frozen frame for a fixed duration
|
|
174
|
+
* (blocking). Use `start()`/`end()` to keep the overlay on screen while the page
|
|
175
|
+
* is driven underneath.
|
|
176
|
+
*
|
|
177
|
+
* Overlays may overlap: several can be live at once (interleaved, not just
|
|
178
|
+
* nested), and a blocking overlay can run while others stay live. Each overlay
|
|
179
|
+
* you `start()` must be `end()`ed before the video function returns, and the
|
|
180
|
+
* same overlay cannot be started twice without ending it in between.
|
|
37
181
|
*
|
|
38
182
|
* @example
|
|
39
183
|
* ```ts
|
|
40
|
-
*
|
|
41
|
-
* await
|
|
42
|
-
*
|
|
184
|
+
* // Blocking: hold the overlay for 1.2s, then continue.
|
|
185
|
+
* await overlays.logo(1200)
|
|
186
|
+
*
|
|
187
|
+
* // Live: keep the overlay up while interacting with the page.
|
|
188
|
+
* await overlays.badge.start()
|
|
189
|
+
* await page.click('#next')
|
|
190
|
+
* await overlays.badge.end()
|
|
191
|
+
*
|
|
192
|
+
* // Overlapping: two overlays live at the same time, ended independently.
|
|
193
|
+
* await overlays.badge.start()
|
|
194
|
+
* await overlays.logo.start()
|
|
195
|
+
* await page.click('#next')
|
|
196
|
+
* await overlays.badge.end()
|
|
197
|
+
* await overlays.logo.end()
|
|
43
198
|
* ```
|
|
44
199
|
*/
|
|
45
|
-
export type
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
200
|
+
export type OverlayController = {
|
|
201
|
+
(durationMs?: number): Promise<void>;
|
|
202
|
+
start(): Promise<void>;
|
|
203
|
+
end(): Promise<void>;
|
|
49
204
|
};
|
|
50
205
|
/**
|
|
51
|
-
*
|
|
206
|
+
* The controller type for one {@link createOverlays} value: a static input
|
|
207
|
+
* (string/element/config) yields a plain {@link OverlayController}; a config
|
|
208
|
+
* factory yields a `(props) => OverlayController` so props are passed at the
|
|
209
|
+
* call site. A static input is never callable, so it never matches the factory
|
|
210
|
+
* arm: existing static maps keep exactly today's controller type.
|
|
211
|
+
*/
|
|
212
|
+
export type OverlayControllerFor<V> = V extends (props: infer P) => OverlayConfig ? (props: P) => OverlayController : OverlayController;
|
|
213
|
+
/** Typed overlay controllers keyed by the names passed to {@link createOverlays}. */
|
|
214
|
+
export type Overlays<T extends Record<string, OverlayInputOrFactory>> = {
|
|
215
|
+
[K in keyof T]: OverlayControllerFor<T[K]>;
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Creates a set of typed overlay controllers, one per key in the map. Each value
|
|
219
|
+
* is a file path string, a React element, or an {@link OverlayConfig} object.
|
|
220
|
+
* A config can draw its content from exactly one source: a file `path`, a React
|
|
221
|
+
* `element`, or an inline `html` fragment.
|
|
222
|
+
*
|
|
223
|
+
* Calling a controller shows the overlay in the recording timeline. Image
|
|
224
|
+
* (`.svg`/`.png`), HTML, and React overlays need a `durationMs` (in the config
|
|
225
|
+
* or passed to the blocking call) unless driven with `start()`/`end()`; `.mp4`
|
|
226
|
+
* overlays use their natural duration and default `audio` to `1` (natural level).
|
|
52
227
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
228
|
+
* Placement defaults to the full recording area (`relativeTo: 'recording'`);
|
|
229
|
+
* override any field independently. Coordinates are CSS px of the recording
|
|
230
|
+
* viewport.
|
|
56
231
|
*
|
|
57
232
|
* @example
|
|
58
|
-
* ```
|
|
59
|
-
* const
|
|
60
|
-
*
|
|
61
|
-
*
|
|
233
|
+
* ```tsx
|
|
234
|
+
* const overlays = createOverlays({
|
|
235
|
+
* hint: 'callout.html', // HTML file
|
|
236
|
+
* badge: <Badge label="New" />, // React element
|
|
237
|
+
* note: { html: '<div class="note">Tip</div>', x: 1340, y: 110, width: 380 },
|
|
238
|
+
* logo: { path: 'logo.png', x: 96, y: 96, width: 240 },
|
|
239
|
+
* intro: { path: 'intro.mp4', fullScreen: true },
|
|
62
240
|
* })
|
|
63
241
|
*
|
|
64
242
|
* video('Product demo', async ({ page }) => {
|
|
65
|
-
* await
|
|
243
|
+
* await overlays.intro()
|
|
66
244
|
* await page.goto('/dashboard')
|
|
67
|
-
* await
|
|
245
|
+
* await overlays.logo(1200)
|
|
68
246
|
* })
|
|
69
247
|
* ```
|
|
248
|
+
*
|
|
249
|
+
* A value can also be an {@link OverlayConfigFactory} `(props) => OverlayConfig`,
|
|
250
|
+
* making the overlay programmatic. Calling `overlays.name(props)` builds and
|
|
251
|
+
* returns a controller you then drive with `(durationMs)`, `start()`, or
|
|
252
|
+
* `end()`. The factory runs (and its config is validated) on each call, so
|
|
253
|
+
* content and placement can depend on runtime values.
|
|
70
254
|
*/
|
|
71
|
-
export declare function
|
|
72
|
-
[K in keyof T]: AssetConfigForPath<T[K]['path']>;
|
|
73
|
-
}): Assets<T>;
|
|
255
|
+
export declare function createOverlays<const T extends Record<string, OverlayInputOrFactory>>(overlays: T): Overlays<T>;
|
|
74
256
|
/**
|
|
75
|
-
* Creates typed
|
|
257
|
+
* Creates typed overlay controllers whose files and display options are
|
|
76
258
|
* configured on the ScreenCI Studio page instead of in code. Business tier
|
|
77
259
|
* only.
|
|
78
260
|
*
|
|
79
|
-
* Each key becomes a callable
|
|
80
|
-
* behavior as {@link
|
|
81
|
-
* `.mp4`),
|
|
82
|
-
* from Studio.
|
|
261
|
+
* Each key becomes a callable overlay controller with the same timeline
|
|
262
|
+
* behavior as {@link createOverlays} controllers, including `start()`/`end()`.
|
|
263
|
+
* The file (`.svg`, `.png`, or `.mp4`), placement, image duration, and video
|
|
264
|
+
* audio level all come from Studio.
|
|
83
265
|
*
|
|
84
266
|
* On the first upload of a studio-mode video, rendering is held until the
|
|
85
267
|
* video is configured in Studio (the CLI prints a direct link). Later uploads
|
|
@@ -87,15 +269,25 @@ export declare function createAssets<const T extends Record<string, AssetConfig>
|
|
|
87
269
|
*
|
|
88
270
|
* @example
|
|
89
271
|
* ```ts
|
|
90
|
-
* const
|
|
272
|
+
* const overlays = createStudioOverlays('intro', 'logo')
|
|
91
273
|
*
|
|
92
274
|
* video('Product demo', async ({ page }) => {
|
|
93
|
-
* await
|
|
275
|
+
* await overlays.intro()
|
|
94
276
|
* await page.goto('/dashboard')
|
|
95
|
-
* await
|
|
277
|
+
* await overlays.logo()
|
|
96
278
|
* })
|
|
97
279
|
* ```
|
|
98
280
|
*/
|
|
99
|
-
export declare function
|
|
100
|
-
|
|
281
|
+
export declare function createStudioOverlays<const K extends readonly [string, ...string[]]>(...keys: K): Record<K[number], OverlayController>;
|
|
282
|
+
/**
|
|
283
|
+
* Upper bound for a playback-speed multiplier. `16` is already an extreme rate;
|
|
284
|
+
* the cap guards against accidental runaway values producing degenerate output.
|
|
285
|
+
*/
|
|
286
|
+
export declare const MAX_SPEED = 16;
|
|
287
|
+
/**
|
|
288
|
+
* Validates a `speed`/`time` pair shared by `.mp4` overlays and audio tracks.
|
|
289
|
+
* `speed` must be a finite multiplier in `(0, MAX_SPEED]`; `time` must be a
|
|
290
|
+
* finite duration greater than 0 (ms). They are mutually exclusive.
|
|
291
|
+
*/
|
|
292
|
+
export declare function validateSpeedTime(label: string, speed: number | undefined, time: number | undefined): void;
|
|
101
293
|
//# sourceMappingURL=asset.d.ts.map
|
package/dist/src/asset.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset.d.ts","sourceRoot":"","sources":["../../src/asset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"asset.d.ts","sourceRoot":"","sources":["../../src/asset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,aAAa,CAAA;AAWnE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAWnD,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,OAAO,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACpB,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,+EAA+E;IAC/E,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAA;IAC1B;;;;;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