screenci 0.0.14 → 0.0.16
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 +26 -26
- package/dist/cli.d.ts +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +65 -22
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/src/browserLaunchOptions.d.ts +5 -0
- package/dist/src/browserLaunchOptions.d.ts.map +1 -0
- package/dist/src/browserLaunchOptions.js +23 -0
- package/dist/src/browserLaunchOptions.js.map +1 -0
- package/dist/src/cue.d.ts +276 -0
- package/dist/src/cue.d.ts.map +1 -0
- package/dist/src/{caption.js → cue.js} +120 -90
- package/dist/src/cue.js.map +1 -0
- package/dist/src/events.d.ts +54 -40
- package/dist/src/events.d.ts.map +1 -1
- package/dist/src/events.js +21 -21
- package/dist/src/events.js.map +1 -1
- package/dist/src/instrument.js +3 -3
- package/dist/src/instrument.js.map +1 -1
- package/dist/src/recordingData.d.ts +16 -16
- package/dist/src/recordingData.d.ts.map +1 -1
- package/dist/src/types.d.ts +4 -4
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/src/video.d.ts +3 -3
- package/dist/src/video.d.ts.map +1 -1
- package/dist/src/video.js +11 -25
- package/dist/src/video.js.map +1 -1
- package/dist/src/voices.d.ts +18 -18
- package/dist/src/voices.js +15 -15
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/skills/screenci/SKILL.md +20 -18
- package/skills/screenci/references/record.md +9 -6
- package/dist/src/caption.d.ts +0 -262
- package/dist/src/caption.d.ts.map +0 -1
- package/dist/src/caption.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export type { AspectRatio, FPS, Quality, Trace, RecordOptions, RenderOptions, ResolvedRenderOptions, ScreenCIConfig, ExtendedScreenCIConfig,
|
|
1
|
+
export type { AspectRatio, FPS, Quality, Trace, RecordOptions, RenderOptions, ResolvedRenderOptions, ScreenCIConfig, ExtendedScreenCIConfig, CueConfig, AutoZoomOptions, Easing, PostClickMove, ClickBeforeFillOption, } from './src/types.js';
|
|
2
2
|
export { RENDER_OPTIONS_DEFAULTS } from './src/types.js';
|
|
3
3
|
export { voices, modelTypes, languageRegions, isCustomVoiceRef, } from './src/voices.js';
|
|
4
4
|
export type { VoiceKey, VoiceName, VoiceForLang, CustomVoiceRef, ModelType, } from './src/voices.js';
|
|
5
|
-
export type { RecordingEvent, RecordingData, ElementRect, VideoStartEvent, InputEvent, MouseMoveEvent, MouseDownEvent, MouseUpEvent, MouseShowEvent, MouseHideEvent, MouseWaitEvent,
|
|
5
|
+
export type { RecordingEvent, RecordingData, ElementRect, VideoStartEvent, InputEvent, MouseMoveEvent, MouseDownEvent, MouseUpEvent, MouseShowEvent, MouseHideEvent, MouseWaitEvent, CueStartEvent, CueEndEvent, VideoCueStartEvent, HideStartEvent, HideEndEvent, AutoZoomStartEvent, AutoZoomEndEvent, } from './src/events.js';
|
|
6
6
|
export { DEFAULT_ASPECT_RATIO, DEFAULT_FPS, DEFAULT_QUALITY, DEFAULT_TRACE, DEFAULT_SEND_TRACES, DEFAULT_VIDEO_DIR, DEFAULT_VIDEO_OPTIONS, } from './src/defaults.js';
|
|
7
7
|
export { getDimensions } from './src/dimensions.js';
|
|
8
8
|
export { defineConfig } from './src/config.js';
|
|
9
9
|
export { video } from './src/video.js';
|
|
10
10
|
export type { ScreenCIPage, ScreenCILocator } from './src/types.js';
|
|
11
|
-
export {
|
|
12
|
-
export type {
|
|
13
|
-
export type {
|
|
11
|
+
export { createNarration, createVideoCues } from './src/cue.js';
|
|
12
|
+
export type { CueController, Cues, VideoCueEntry, VideoCues, TopLevelVoiceConfig, LangNarrationOverride, CueMapValue, } from './src/cue.js';
|
|
13
|
+
export type { CueTranslation, VideoCueTranslation, VideoCueTranslationFile, VoiceLanguageMeta, } from './src/events.js';
|
|
14
14
|
export { hide } from './src/hide.js';
|
|
15
15
|
export { autoZoom } from './src/autoZoom.js';
|
|
16
16
|
export { createAssets } from './src/asset.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,WAAW,EACX,GAAG,EACH,OAAO,EACP,KAAK,EACL,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,sBAAsB,EACtB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,WAAW,EACX,GAAG,EACH,OAAO,EACP,KAAK,EACL,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,sBAAsB,EACtB,SAAS,EACT,eAAe,EACf,MAAM,EACN,aAAa,EACb,qBAAqB,GACtB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAGxD,OAAO,EACL,MAAM,EACN,UAAU,EACV,eAAe,EACf,gBAAgB,GACjB,MAAM,iBAAiB,CAAA;AACxB,YAAY,EACV,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,cAAc,EACd,SAAS,GACV,MAAM,iBAAiB,CAAA;AAGxB,YAAY,EACV,cAAc,EACd,aAAa,EACb,WAAW,EACX,eAAe,EACf,UAAU,EACV,cAAc,EACd,cAAc,EACd,YAAY,EACZ,cAAc,EACd,cAAc,EACd,cAAc,EACd,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAGnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAG9C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC/D,YAAY,EACV,aAAa,EACb,IAAI,EACJ,aAAa,EACb,SAAS,EACT,mBAAmB,EACnB,qBAAqB,EACrB,WAAW,GACZ,MAAM,cAAc,CAAA;AACrB,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAC1E,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -7,9 +7,9 @@ export { DEFAULT_ASPECT_RATIO, DEFAULT_FPS, DEFAULT_QUALITY, DEFAULT_TRACE, DEFA
|
|
|
7
7
|
export { getDimensions } from './src/dimensions.js';
|
|
8
8
|
// Re-export config function
|
|
9
9
|
export { defineConfig } from './src/config.js';
|
|
10
|
-
// Re-export video fixture and
|
|
10
|
+
// Re-export video fixture and cue
|
|
11
11
|
export { video } from './src/video.js';
|
|
12
|
-
export {
|
|
12
|
+
export { createNarration, createVideoCues } from './src/cue.js';
|
|
13
13
|
export { hide } from './src/hide.js';
|
|
14
14
|
export { autoZoom } from './src/autoZoom.js';
|
|
15
15
|
export { createAssets } from './src/asset.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAExD,mBAAmB;AACnB,OAAO,EACL,MAAM,EACN,UAAU,EACV,eAAe,EACf,gBAAgB,GACjB,MAAM,iBAAiB,CAAA;AA+BxB,2BAA2B;AAC3B,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,mBAAmB,CAAA;AAE1B,6BAA6B;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,4BAA4B;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAExD,mBAAmB;AACnB,OAAO,EACL,MAAM,EACN,UAAU,EACV,eAAe,EACf,gBAAgB,GACjB,MAAM,iBAAiB,CAAA;AA+BxB,2BAA2B;AAC3B,OAAO,EACL,oBAAoB,EACpB,WAAW,EACX,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,mBAAmB,CAAA;AAE1B,6BAA6B;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,4BAA4B;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,kCAAkC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAEtC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAgB/D,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browserLaunchOptions.d.ts","sourceRoot":"","sources":["../../src/browserLaunchOptions.ts"],"names":[],"mappings":"AAcA,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,OAAO,GAC1D;IACE,QAAQ,EAAE,KAAK,CAAA;IACf,IAAI,EAAE,MAAM,EAAE,CAAA;CACf,GACD,SAAS,CASZ"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const RECORDING_CHROMIUM_ARGS = [
|
|
2
|
+
'--window-position=0,0',
|
|
3
|
+
'--kiosk',
|
|
4
|
+
'--disable-translate',
|
|
5
|
+
'--disable-spell-checking',
|
|
6
|
+
'--disable-notifications', // no permission popups
|
|
7
|
+
'--disable-save-password-bubble', // no "save password?" dialog
|
|
8
|
+
'--deny-permission-prompts',
|
|
9
|
+
'--disable-save-password-bubble', // no "save password?" dialog
|
|
10
|
+
'--disable-infobars', // no "Chrome is being controlled by..." bar
|
|
11
|
+
'--no-first-run', // skip first-run UI
|
|
12
|
+
'--hide-scrollbars', // scrollbars invisible in recordings
|
|
13
|
+
];
|
|
14
|
+
export function getChromiumLaunchOptions(shouldRecord) {
|
|
15
|
+
if (!shouldRecord) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
headless: false,
|
|
20
|
+
args: [...RECORDING_CHROMIUM_ARGS],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=browserLaunchOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browserLaunchOptions.js","sourceRoot":"","sources":["../../src/browserLaunchOptions.ts"],"names":[],"mappings":"AAAA,MAAM,uBAAuB,GAAG;IAC9B,uBAAuB;IACvB,SAAS;IACT,qBAAqB;IACrB,0BAA0B;IAC1B,yBAAyB,EAAE,uBAAuB;IAClD,gCAAgC,EAAE,6BAA6B;IAC/D,2BAA2B;IAC3B,gCAAgC,EAAE,6BAA6B;IAC/D,oBAAoB,EAAE,4CAA4C;IAClE,gBAAgB,EAAE,oBAAoB;IACtC,mBAAmB,EAAE,qCAAqC;CAClD,CAAA;AAEV,MAAM,UAAU,wBAAwB,CAAC,YAAqB;IAM5D,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,CAAC,GAAG,uBAAuB,CAAC;KACnC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import type { IEventRecorder } from './events.js';
|
|
2
|
+
import type { VoiceKey, VoiceForLang, Lang, CustomVoiceRef, ModelType } from './voices.js';
|
|
3
|
+
export declare const ONE_FRAME_MS: number;
|
|
4
|
+
export declare function setSleepFn(fn: (ms: number) => void): void;
|
|
5
|
+
export declare function setActiveCueRecorder(recorder: IEventRecorder | null): void;
|
|
6
|
+
export declare function resetCueChain(): void;
|
|
7
|
+
export declare function resetRegisteredCustomVoiceRefs(): void;
|
|
8
|
+
export declare function validateCustomVoiceRefs(testFilePath: string): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* A narration controller. Awaiting it starts the narration segment.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* await narration.intro
|
|
15
|
+
* await page.goto('/dashboard')
|
|
16
|
+
* await narration.nextStep
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export type CueController = PromiseLike<void>;
|
|
20
|
+
type NarrationCueObject = {
|
|
21
|
+
text: string;
|
|
22
|
+
} | {
|
|
23
|
+
media: string;
|
|
24
|
+
subtitle?: string;
|
|
25
|
+
} | {
|
|
26
|
+
path: string;
|
|
27
|
+
subtitle?: string;
|
|
28
|
+
};
|
|
29
|
+
/** A single narration cue value in a multi-language map. */
|
|
30
|
+
export type CueMapValue = string | NarrationCueObject;
|
|
31
|
+
export type Cues<T extends Record<string, CueMapValue>> = {
|
|
32
|
+
[K in keyof T]: CueController;
|
|
33
|
+
} & {
|
|
34
|
+
/**
|
|
35
|
+
* Waits for the current narration segment to finish before the next action.
|
|
36
|
+
*
|
|
37
|
+
* Only needed when an action must happen _after_ narration ends.
|
|
38
|
+
* Consecutive `await narration.x` calls sequence automatically — each
|
|
39
|
+
* one ends the previous before starting.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* await narration.intro
|
|
44
|
+
* await narration.wait() // wait for intro audio to finish
|
|
45
|
+
* await page.click('#next') // click happens after intro ends
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
wait(): Promise<void>;
|
|
49
|
+
};
|
|
50
|
+
export type VideoCueEntry = string | {
|
|
51
|
+
path: string;
|
|
52
|
+
subtitle?: string;
|
|
53
|
+
};
|
|
54
|
+
export type VideoCues<T extends Record<string, VideoCueEntry>> = {
|
|
55
|
+
[K in keyof T]: CueController;
|
|
56
|
+
} & {
|
|
57
|
+
/**
|
|
58
|
+
* Waits for the current narration segment to finish before the next action.
|
|
59
|
+
* @see {@link Cues.wait}
|
|
60
|
+
*/
|
|
61
|
+
wait(): Promise<void>;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Top-level voice configuration shared across all languages.
|
|
65
|
+
* `seed` is not allowed here — use per-language `voice` overrides instead.
|
|
66
|
+
*
|
|
67
|
+
* Use `style` for expressive synthesis, or `modelType` for an explicit
|
|
68
|
+
* model choice. `style` and `modelType` are mutually exclusive.
|
|
69
|
+
*/
|
|
70
|
+
export type TopLevelVoiceConfig = {
|
|
71
|
+
name: VoiceKey | CustomVoiceRef;
|
|
72
|
+
/** Speaking style prompt for expressive synthesis. Implies `expressive` model type. */
|
|
73
|
+
style: string;
|
|
74
|
+
/** Can be omitted when `style` is set — `expressive` is implied. */
|
|
75
|
+
modelType?: 'expressive';
|
|
76
|
+
/**
|
|
77
|
+
* Accent description for expressive synthesis.
|
|
78
|
+
* The more specific, the better — e.g. `'Southern American English'` or `'Received Pronunciation British'`.
|
|
79
|
+
* Omitted from the prompt when not set — the voice uses its natural default.
|
|
80
|
+
*/
|
|
81
|
+
accent?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Pacing description for expressive synthesis.
|
|
84
|
+
* Describes the overall speed and tempo — e.g. `'Measured and deliberate'` or `'Brisk and energetic'`.
|
|
85
|
+
*/
|
|
86
|
+
pacing?: string;
|
|
87
|
+
} | {
|
|
88
|
+
name: VoiceKey | CustomVoiceRef;
|
|
89
|
+
style?: never;
|
|
90
|
+
accent?: never;
|
|
91
|
+
pacing?: never;
|
|
92
|
+
/** TTS model type — `modelTypes.expressive` or `modelTypes.consistent`. Defaults to `consistent`. */
|
|
93
|
+
modelType?: ModelType;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Per-language narration override. Can override the top-level voice name and
|
|
97
|
+
* optionally set a `seed` for TTS generation.
|
|
98
|
+
*
|
|
99
|
+
* Use `style` for expressive synthesis, or `modelType` for an explicit
|
|
100
|
+
* model choice. `style` and `modelType` are mutually exclusive.
|
|
101
|
+
*/
|
|
102
|
+
export type LangNarrationOverride = {
|
|
103
|
+
name: VoiceKey | CustomVoiceRef;
|
|
104
|
+
/**
|
|
105
|
+
* Integer seed included in the audio cache key. A different seed always forces
|
|
106
|
+
* regeneration. Consistent output is not guaranteed across all voice types.
|
|
107
|
+
*/
|
|
108
|
+
seed?: number;
|
|
109
|
+
/** Speaking style prompt for expressive synthesis. Implies `expressive` model type. */
|
|
110
|
+
style: string;
|
|
111
|
+
/** Can be omitted when `style` is set — `expressive` is implied. */
|
|
112
|
+
modelType?: 'expressive';
|
|
113
|
+
/**
|
|
114
|
+
* Accent description for expressive synthesis.
|
|
115
|
+
* The more specific, the better — e.g. `'Southern American English'` or `'Received Pronunciation British'`.
|
|
116
|
+
* Omitted from the prompt when not set — the voice uses its natural default.
|
|
117
|
+
*/
|
|
118
|
+
accent?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Pacing description for expressive synthesis.
|
|
121
|
+
* Describes the overall speed and tempo — e.g. `'Measured and deliberate'` or `'Brisk and energetic'`.
|
|
122
|
+
*/
|
|
123
|
+
pacing?: string;
|
|
124
|
+
} | {
|
|
125
|
+
name: VoiceKey | CustomVoiceRef;
|
|
126
|
+
/**
|
|
127
|
+
* Integer seed included in the audio cache key. A different seed always forces
|
|
128
|
+
* regeneration. Consistent output is not guaranteed across all voice types.
|
|
129
|
+
*/
|
|
130
|
+
seed?: number;
|
|
131
|
+
style?: never;
|
|
132
|
+
accent?: never;
|
|
133
|
+
pacing?: never;
|
|
134
|
+
/** TTS model type — `modelTypes.expressive` or `modelTypes.consistent`. Defaults to `consistent`. */
|
|
135
|
+
modelType?: ModelType;
|
|
136
|
+
};
|
|
137
|
+
/** Converts a union type to an intersection: `A | B` → `A & B` */
|
|
138
|
+
type UnionToIntersection<U> = (U extends unknown ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
|
|
139
|
+
/**
|
|
140
|
+
* Produces a record requiring every key that appears in any language's cues.
|
|
141
|
+
* Uses each language's key set with CueMapValue values before intersecting,
|
|
142
|
+
* so value types don't conflict (e.g. string vs { path, subtitle } for the same key).
|
|
143
|
+
*/
|
|
144
|
+
type LanguageEntryBase = {
|
|
145
|
+
voice?: LangNarrationOverride;
|
|
146
|
+
region?: string;
|
|
147
|
+
};
|
|
148
|
+
type LanguageCuesEntry<C extends Record<string, CueMapValue>> = LanguageEntryBase & {
|
|
149
|
+
cues: C;
|
|
150
|
+
};
|
|
151
|
+
type AllCues<M extends Partial<Record<Lang, LanguageCuesEntry<Record<string, CueMapValue>>>>> = UnionToIntersection<{
|
|
152
|
+
[L in keyof M]: M[L] extends {
|
|
153
|
+
cues: infer C;
|
|
154
|
+
} ? Record<keyof C & string, CueMapValue> : never;
|
|
155
|
+
}[keyof M]> & Record<string, CueMapValue>;
|
|
156
|
+
type LangNarrationOverrideForLang<L extends string> = {
|
|
157
|
+
name: (L extends Lang ? VoiceForLang<L> : VoiceKey) | CustomVoiceRef;
|
|
158
|
+
seed?: number;
|
|
159
|
+
style: string;
|
|
160
|
+
modelType?: 'expressive';
|
|
161
|
+
accent?: string;
|
|
162
|
+
pacing?: string;
|
|
163
|
+
} | {
|
|
164
|
+
name: (L extends Lang ? VoiceForLang<L> : VoiceKey) | CustomVoiceRef;
|
|
165
|
+
seed?: number;
|
|
166
|
+
style?: never;
|
|
167
|
+
accent?: never;
|
|
168
|
+
pacing?: never;
|
|
169
|
+
modelType?: ModelType;
|
|
170
|
+
};
|
|
171
|
+
type LanguagesMap<M extends Partial<Record<Lang, LanguageCuesEntry<Record<string, CueMapValue>>>>> = M & {
|
|
172
|
+
[L in keyof M]: {
|
|
173
|
+
voice?: L extends string ? LangNarrationOverrideForLang<L> : never;
|
|
174
|
+
/** BCP-47 region code for TTS synthesis, e.g. `languageRegions.en.US`. */
|
|
175
|
+
region?: string;
|
|
176
|
+
} & {
|
|
177
|
+
cues: AllCues<M>;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Creates a set of typed narration controllers, one per key in the map.
|
|
182
|
+
*
|
|
183
|
+
* Each controller has `start()` and `end()`.
|
|
184
|
+
* At render time screenci generates narration, and syncs the audio to the
|
|
185
|
+
* recording. You write text; the voice is handled for you.
|
|
186
|
+
*
|
|
187
|
+
* The top-level `voice` applies to all languages. Override it per-language via
|
|
188
|
+
* the `voice` field inside each language entry. Only language-level overrides
|
|
189
|
+
* may set `seed`.
|
|
190
|
+
*
|
|
191
|
+
* TypeScript enforces that every language has the same cue keys.
|
|
192
|
+
* Forget a translation key → compile error.
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* ```ts
|
|
196
|
+
* const narration = createNarration({
|
|
197
|
+
* voice: { name: voices.Ava, style: 'Clear and friendly' },
|
|
198
|
+
* languages: {
|
|
199
|
+
* en: { cues: { intro: 'Welcome.', next: 'Click here.' } },
|
|
200
|
+
* fi: {
|
|
201
|
+
* voice: { name: voices.Nora, style: 'Selkeä opastus', seed: 42 },
|
|
202
|
+
* cues: { intro: 'Tervetuloa.', next: 'Napsauta tästä.' },
|
|
203
|
+
* },
|
|
204
|
+
* },
|
|
205
|
+
* })
|
|
206
|
+
*
|
|
207
|
+
* // Await a narration segment directly to start it:
|
|
208
|
+
* await narration.intro
|
|
209
|
+
* await page.goto('/dashboard')
|
|
210
|
+
*
|
|
211
|
+
* // Consecutive narration segments sequence automatically:
|
|
212
|
+
* await narration.intro
|
|
213
|
+
* await narration.next // ends intro, then starts next
|
|
214
|
+
*
|
|
215
|
+
* // Wait for audio to finish before an action:
|
|
216
|
+
* await narration.intro
|
|
217
|
+
* await narration.wait()
|
|
218
|
+
* await page.click('#start')
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
export declare function createNarration<M extends Partial<Record<Lang, LanguageCuesEntry<Record<string, CueMapValue>>>>>(input: {
|
|
222
|
+
voice: TopLevelVoiceConfig;
|
|
223
|
+
languages: LanguagesMap<M>;
|
|
224
|
+
}): Cues<AllCues<M>>;
|
|
225
|
+
type RequireAllSameVideoKeys<M extends Partial<Record<Lang, {
|
|
226
|
+
cues: Record<string, VideoCueEntry>;
|
|
227
|
+
}>>> = {
|
|
228
|
+
[L in keyof M]: {
|
|
229
|
+
cues: UnionToIntersection<M[keyof M] extends {
|
|
230
|
+
cues: infer C;
|
|
231
|
+
} ? C : never>;
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* Creates cue controllers backed by pre-recorded asset files instead of
|
|
236
|
+
* TTS-generated audio. Each entry maps a name to either an asset path string
|
|
237
|
+
* or an object with `assetPath` and an optional `subtitle` text.
|
|
238
|
+
*
|
|
239
|
+
* At render time the asset file is used directly as narration audio.
|
|
240
|
+
* If `subtitle` is provided, words are spread with equal timing across the
|
|
241
|
+
* audio duration (no word-level TTS data available).
|
|
242
|
+
*
|
|
243
|
+
* Same constraints as `createNarration`: cannot overlap with other cues,
|
|
244
|
+
* and cannot fall inside input events.
|
|
245
|
+
*
|
|
246
|
+
* Two overloads:
|
|
247
|
+
*
|
|
248
|
+
* **1. Single-language:**
|
|
249
|
+
* ```ts
|
|
250
|
+
* const cues = createVideoCues({
|
|
251
|
+
* intro: '/assets/intro.mp3',
|
|
252
|
+
* demo: { assetPath: '/assets/demo.mp3', subtitle: 'Watch the demo.' },
|
|
253
|
+
* })
|
|
254
|
+
* ```
|
|
255
|
+
*
|
|
256
|
+
* **2. Multi-language (type-safe):**
|
|
257
|
+
* TypeScript enforces that every language has the same cue keys.
|
|
258
|
+
* ```ts
|
|
259
|
+
* const cues = createVideoCues({
|
|
260
|
+
* en: { cues: { intro: '/assets/en/intro.mp3' } },
|
|
261
|
+
* fi: { cues: { intro: '/assets/fi/intro.mp3' } },
|
|
262
|
+
* })
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
export declare function createVideoCues<T extends Record<string, VideoCueEntry>>(cuesMap: T): VideoCues<T>;
|
|
266
|
+
export declare function createVideoCues<L extends Lang, T extends Record<string, VideoCueEntry>>(languagesMap: {
|
|
267
|
+
[K in L]: {
|
|
268
|
+
cues: T;
|
|
269
|
+
};
|
|
270
|
+
} & RequireAllSameVideoKeys<{
|
|
271
|
+
[K in L]: {
|
|
272
|
+
cues: Record<string, VideoCueEntry>;
|
|
273
|
+
};
|
|
274
|
+
}>): VideoCues<T & Record<string, VideoCueEntry>>;
|
|
275
|
+
export {};
|
|
276
|
+
//# sourceMappingURL=cue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cue.d.ts","sourceRoot":"","sources":["../../src/cue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAMf,MAAM,aAAa,CAAA;AAC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