screenci 0.0.76 → 0.0.79
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/dist/cli.d.ts +58 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +584 -200
- package/dist/cli.js.map +1 -1
- package/dist/docs/manifest.d.ts +253 -98
- package/dist/docs/manifest.d.ts.map +1 -1
- package/dist/docs/manifest.js +92 -32
- package/dist/docs/manifest.js.map +1 -1
- package/dist/docs/video-sources/camera-and-zooming.screenci.d.ts +2 -0
- package/dist/docs/video-sources/camera-and-zooming.screenci.d.ts.map +1 -0
- package/dist/docs/video-sources/camera-and-zooming.screenci.js +57 -0
- package/dist/docs/video-sources/camera-and-zooming.screenci.js.map +1 -0
- package/dist/docs/video-sources/installation.screenci.js +9 -6
- package/dist/docs/video-sources/installation.screenci.js.map +1 -1
- package/dist/docs/video-sources/languages.screenci.d.ts +2 -0
- package/dist/docs/video-sources/languages.screenci.d.ts.map +1 -0
- package/dist/docs/video-sources/languages.screenci.js +68 -0
- package/dist/docs/video-sources/languages.screenci.js.map +1 -0
- package/dist/docs/video-sources/locator-highlight-animated.screenci.js +1 -1
- package/dist/docs/video-sources/locator-highlight-animated.screenci.js.map +1 -1
- package/dist/docs/video-sources/narration.screenci.d.ts +2 -0
- package/dist/docs/video-sources/narration.screenci.d.ts.map +1 -0
- package/dist/docs/video-sources/narration.screenci.js +71 -0
- package/dist/docs/video-sources/narration.screenci.js.map +1 -0
- package/dist/docs/video-sources/public-urls-and-embeds.screenci.d.ts +2 -0
- package/dist/docs/video-sources/public-urls-and-embeds.screenci.d.ts.map +1 -0
- package/dist/docs/video-sources/public-urls-and-embeds.screenci.js +60 -0
- package/dist/docs/video-sources/public-urls-and-embeds.screenci.js.map +1 -0
- package/dist/docs/video-sources/speaking-style.screenci.d.ts +2 -0
- package/dist/docs/video-sources/speaking-style.screenci.d.ts.map +1 -0
- package/dist/docs/video-sources/speaking-style.screenci.js +76 -0
- package/dist/docs/video-sources/speaking-style.screenci.js.map +1 -0
- package/dist/docs/video-sources/vertical-video.screenci.d.ts +2 -0
- package/dist/docs/video-sources/vertical-video.screenci.d.ts.map +1 -0
- package/dist/docs/video-sources/vertical-video.screenci.js +58 -0
- package/dist/docs/video-sources/vertical-video.screenci.js.map +1 -0
- package/dist/docs/videos.d.ts +20 -0
- package/dist/docs/videos.d.ts.map +1 -1
- package/dist/docs/videos.js +25 -0
- package/dist/docs/videos.js.map +1 -1
- package/dist/e2e/instrument.e2e.js +8 -0
- package/dist/e2e/instrument.e2e.js.map +1 -1
- package/dist/e2e/redact.e2e.d.ts +2 -0
- package/dist/e2e/redact.e2e.d.ts.map +1 -0
- package/dist/e2e/redact.e2e.js +161 -0
- package/dist/e2e/redact.e2e.js.map +1 -0
- package/dist/index.d.ts +10 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/src/asset.d.ts +154 -13
- package/dist/src/asset.d.ts.map +1 -1
- package/dist/src/asset.js +262 -32
- package/dist/src/asset.js.map +1 -1
- package/dist/src/assetHash.d.ts +27 -0
- package/dist/src/assetHash.d.ts.map +1 -0
- package/dist/src/assetHash.js +0 -0
- package/dist/src/assetHash.js.map +1 -0
- package/dist/src/audio.d.ts +8 -5
- package/dist/src/audio.d.ts.map +1 -1
- package/dist/src/audio.js +56 -31
- package/dist/src/audio.js.map +1 -1
- package/dist/src/builder.d.ts +132 -32
- package/dist/src/builder.d.ts.map +1 -1
- package/dist/src/builder.js +66 -20
- package/dist/src/builder.js.map +1 -1
- package/dist/src/changeFocus.d.ts.map +1 -1
- package/dist/src/changeFocus.js +103 -34
- package/dist/src/changeFocus.js.map +1 -1
- package/dist/src/cue.d.ts +29 -17
- package/dist/src/cue.d.ts.map +1 -1
- package/dist/src/cue.js +138 -61
- package/dist/src/cue.js.map +1 -1
- package/dist/src/declare.d.ts +8 -4
- package/dist/src/declare.d.ts.map +1 -1
- package/dist/src/declare.js +28 -10
- package/dist/src/declare.js.map +1 -1
- package/dist/src/defaults.d.ts +23 -0
- package/dist/src/defaults.d.ts.map +1 -1
- package/dist/src/defaults.js +23 -0
- package/dist/src/defaults.js.map +1 -1
- package/dist/src/events.d.ts +289 -25
- package/dist/src/events.d.ts.map +1 -1
- package/dist/src/events.js +145 -13
- package/dist/src/events.js.map +1 -1
- package/dist/src/htmlRasterizer.d.ts +10 -0
- package/dist/src/htmlRasterizer.d.ts.map +1 -1
- package/dist/src/htmlRasterizer.js +12 -2
- package/dist/src/htmlRasterizer.js.map +1 -1
- package/dist/src/init.d.ts +2 -0
- package/dist/src/init.d.ts.map +1 -1
- package/dist/src/init.js +60 -28
- package/dist/src/init.js.map +1 -1
- package/dist/src/instrument.d.ts.map +1 -1
- package/dist/src/instrument.js +25 -7
- package/dist/src/instrument.js.map +1 -1
- package/dist/src/locales.d.ts.map +1 -1
- package/dist/src/locales.js +1 -0
- package/dist/src/locales.js.map +1 -1
- package/dist/src/localize.d.ts +25 -17
- package/dist/src/localize.d.ts.map +1 -1
- package/dist/src/localize.js +18 -10
- package/dist/src/localize.js.map +1 -1
- package/dist/src/localizeRuntime.d.ts +18 -13
- package/dist/src/localizeRuntime.d.ts.map +1 -1
- package/dist/src/localizeRuntime.js +28 -18
- package/dist/src/localizeRuntime.js.map +1 -1
- package/dist/src/logger.d.ts +5 -0
- package/dist/src/logger.d.ts.map +1 -1
- package/dist/src/logger.js +7 -0
- package/dist/src/logger.js.map +1 -1
- package/dist/src/narrationVisibility.d.ts +19 -0
- package/dist/src/narrationVisibility.d.ts.map +1 -0
- package/dist/src/narrationVisibility.js +26 -0
- package/dist/src/narrationVisibility.js.map +1 -0
- package/dist/src/recordingData.d.ts +7 -0
- package/dist/src/recordingData.d.ts.map +1 -1
- package/dist/src/recordingSize.d.ts +32 -0
- package/dist/src/recordingSize.d.ts.map +1 -0
- package/dist/src/recordingSize.js +54 -0
- package/dist/src/recordingSize.js.map +1 -0
- package/dist/src/redact.d.ts +68 -0
- package/dist/src/redact.d.ts.map +1 -0
- package/dist/src/redact.js +138 -0
- package/dist/src/redact.js.map +1 -0
- package/dist/src/redactController.d.ts +61 -0
- package/dist/src/redactController.d.ts.map +1 -0
- package/dist/src/redactController.js +232 -0
- package/dist/src/redactController.js.map +1 -0
- package/dist/src/runtimeContext.d.ts +32 -0
- package/dist/src/runtimeContext.d.ts.map +1 -1
- package/dist/src/runtimeContext.js +21 -0
- package/dist/src/runtimeContext.js.map +1 -1
- package/dist/src/runtimeMode.d.ts +15 -7
- package/dist/src/runtimeMode.d.ts.map +1 -1
- package/dist/src/runtimeMode.js +17 -6
- package/dist/src/runtimeMode.js.map +1 -1
- package/dist/src/screenAudio.d.ts +34 -4
- package/dist/src/screenAudio.d.ts.map +1 -1
- package/dist/src/screenAudio.js +0 -0
- package/dist/src/screenAudio.js.map +1 -1
- package/dist/src/screenAudioSink.d.ts +12 -0
- package/dist/src/screenAudioSink.d.ts.map +1 -1
- package/dist/src/screenAudioSink.js +30 -0
- package/dist/src/screenAudioSink.js.map +1 -1
- package/dist/src/screenshot.d.ts +16 -14
- package/dist/src/screenshot.d.ts.map +1 -1
- package/dist/src/screenshot.js +11 -11
- package/dist/src/screenshot.js.map +1 -1
- package/dist/src/sourceTrim.d.ts +29 -0
- package/dist/src/sourceTrim.d.ts.map +1 -0
- package/dist/src/sourceTrim.js +76 -0
- package/dist/src/sourceTrim.js.map +1 -0
- package/dist/src/studio.d.ts +71 -3
- package/dist/src/studio.d.ts.map +1 -1
- package/dist/src/studio.js +19 -1
- package/dist/src/studio.js.map +1 -1
- package/dist/src/timelineOffset.d.ts +46 -0
- package/dist/src/timelineOffset.d.ts.map +1 -0
- package/dist/src/timelineOffset.js +66 -0
- package/dist/src/timelineOffset.js.map +1 -0
- package/dist/src/titleValidation.d.ts +38 -0
- package/dist/src/titleValidation.d.ts.map +1 -1
- package/dist/src/titleValidation.js +42 -0
- package/dist/src/titleValidation.js.map +1 -1
- package/dist/src/types.d.ts +85 -0
- 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 +37 -34
- package/dist/src/video.d.ts.map +1 -1
- package/dist/src/video.js +99 -48
- package/dist/src/video.js.map +1 -1
- package/dist/src/voiceSampleAudio.d.ts +34 -0
- package/dist/src/voiceSampleAudio.d.ts.map +1 -0
- package/dist/src/voiceSampleAudio.js +105 -0
- package/dist/src/voiceSampleAudio.js.map +1 -0
- package/dist/src/voices.d.ts +2 -2
- package/dist/src/voices.d.ts.map +1 -1
- package/dist/src/voices.js +8 -3
- package/dist/src/voices.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/templates/recordings/assets/logo.png +0 -0
|
@@ -29,6 +29,18 @@ export declare function workerSinkName(pid?: number): string;
|
|
|
29
29
|
* the command fails (callers fall back to the default device and warn).
|
|
30
30
|
*/
|
|
31
31
|
export declare function createNullSink(name?: string, deps?: SinkDeps): Promise<NullSink | null>;
|
|
32
|
+
/**
|
|
33
|
+
* Verifies that screen-audio capture can actually run on this machine: the
|
|
34
|
+
* `pactl` control tool is in PATH and a PulseAudio-compatible server is
|
|
35
|
+
* reachable. Throws an actionable error otherwise, so captureAudio fails fast
|
|
36
|
+
* instead of producing a recording that silently lacks the isolated audio it
|
|
37
|
+
* promises.
|
|
38
|
+
*
|
|
39
|
+
* Only `pactl` plus a running pulse server are required. The `pulseaudio` daemon
|
|
40
|
+
* binary itself is NOT needed: PipeWire systems provide the pulse server and
|
|
41
|
+
* `pactl` (via pipewire-pulse) without it, and capture works there.
|
|
42
|
+
*/
|
|
43
|
+
export declare function assertScreenAudioCaptureReady(deps?: SinkDeps): Promise<void>;
|
|
32
44
|
/** Unloads a previously created null sink. Best effort: never throws. */
|
|
33
45
|
export declare function unloadNullSink(sink: NullSink, deps?: SinkDeps): Promise<void>;
|
|
34
46
|
//# sourceMappingURL=screenAudioSink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenAudioSink.d.ts","sourceRoot":"","sources":["../../src/screenAudioSink.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"screenAudioSink.d.ts","sourceRoot":"","sources":["../../src/screenAudioSink.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAA;IAChB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAA;IAChB,mEAAmE;IACnE,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,oCAAoC;AACpC,MAAM,MAAM,QAAQ,GAAG;IACrB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAClE,CAAA;AAMD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,GAAE,MAAoB,GAAG,MAAM,CAEhE;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,IAAI,GAAE,MAAyB,EAC/B,IAAI,GAAE,QAAsB,GAC3B,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAgB1B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,GAAE,QAAsB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAmBf;AAED,yEAAyE;AACzE,wBAAsB,cAAc,CAClC,IAAI,EAAE,QAAQ,EACd,IAAI,GAAE,QAAsB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAMf"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { execFile as nodeExecFile } from 'child_process';
|
|
2
2
|
import { promisify } from 'util';
|
|
3
|
+
import { SCREEN_AUDIO_DOCS_URL } from './screenAudio.js';
|
|
3
4
|
const execFileAsync = promisify(nodeExecFile);
|
|
4
5
|
const defaultDeps = {
|
|
5
6
|
run: (cmd, args) => execFileAsync(cmd, args),
|
|
@@ -35,6 +36,35 @@ export async function createNullSink(name = workerSinkName(), deps = defaultDeps
|
|
|
35
36
|
return null;
|
|
36
37
|
}
|
|
37
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Verifies that screen-audio capture can actually run on this machine: the
|
|
41
|
+
* `pactl` control tool is in PATH and a PulseAudio-compatible server is
|
|
42
|
+
* reachable. Throws an actionable error otherwise, so captureAudio fails fast
|
|
43
|
+
* instead of producing a recording that silently lacks the isolated audio it
|
|
44
|
+
* promises.
|
|
45
|
+
*
|
|
46
|
+
* Only `pactl` plus a running pulse server are required. The `pulseaudio` daemon
|
|
47
|
+
* binary itself is NOT needed: PipeWire systems provide the pulse server and
|
|
48
|
+
* `pactl` (via pipewire-pulse) without it, and capture works there.
|
|
49
|
+
*/
|
|
50
|
+
export async function assertScreenAudioCaptureReady(deps = defaultDeps) {
|
|
51
|
+
try {
|
|
52
|
+
await deps.run('pactl', ['--version']);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
throw new Error(`[screenci] captureAudio: "pactl" is not installed or not in PATH. ` +
|
|
56
|
+
`Install "pulseaudio-utils" (or "pipewire-pulse") and try again. ` +
|
|
57
|
+
`See ${SCREEN_AUDIO_DOCS_URL} for setup instructions.`);
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
await deps.run('pactl', ['info']);
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
throw new Error(`[screenci] captureAudio: no PulseAudio/PipeWire server is reachable ` +
|
|
64
|
+
`(\`pactl info\` failed). Start one (for example "pulseaudio --start") ` +
|
|
65
|
+
`and try again. See ${SCREEN_AUDIO_DOCS_URL} for setup instructions.`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
38
68
|
/** Unloads a previously created null sink. Best effort: never throws. */
|
|
39
69
|
export async function unloadNullSink(sink, deps = defaultDeps) {
|
|
40
70
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenAudioSink.js","sourceRoot":"","sources":["../../src/screenAudioSink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,eAAe,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"screenAudioSink.js","sourceRoot":"","sources":["../../src/screenAudioSink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,eAAe,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAExD,MAAM,aAAa,GAAG,SAAS,CAAC,YAAY,CAAC,CAAA;AAqB7C,MAAM,WAAW,GAAa;IAC5B,GAAG,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC;CAC7C,CAAA;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc,OAAO,CAAC,GAAG;IACtD,OAAO,YAAY,GAAG,EAAE,CAAA;AAC1B,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAAe,cAAc,EAAE,EAC/B,OAAiB,WAAW;IAE5B,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;YACzC,aAAa;YACb,kBAAkB;YAClB,aAAa,IAAI,EAAE;YACnB,sCAAsC,IAAI,EAAE;SAC7C,CAAC,CAAA;QACF,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,EAAE,CAAA;QAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAA;QACb,CAAC;QACD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,IAAI,UAAU,EAAE,CAAA;IACvE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,OAAiB,WAAW;IAE5B,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,oEAAoE;YAClE,kEAAkE;YAClE,OAAO,qBAAqB,0BAA0B,CACzD,CAAA;IACH,CAAC;IACD,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,sEAAsE;YACpE,wEAAwE;YACxE,sBAAsB,qBAAqB,0BAA0B,CACxE,CAAA;IACH,CAAC;AACH,CAAC;AAED,yEAAyE;AACzE,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAAc,EACd,OAAiB,WAAW;IAE5B,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAA;IAC3D,CAAC;IAAC,MAAM,CAAC;QACP,kEAAkE;IACpE,CAAC;AACH,CAAC"}
|
package/dist/src/screenshot.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { TestType, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, TestDetails, TestInfo } from '@playwright/test';
|
|
2
2
|
import type { RecordOptions, RenderOptions, ScreenCIPage } from './types.js';
|
|
3
|
+
import type { StudioMarker } from './studio.js';
|
|
3
4
|
import { type OverlayController, type OverlayInputOrFactory } from './asset.js';
|
|
4
5
|
import type { CropTarget, CropOptions } from './crop.js';
|
|
5
6
|
import { type MediaBuilder } from './builder.js';
|
|
6
7
|
import type { NormalizedFeature } from './declare.js';
|
|
7
|
-
import { type
|
|
8
|
+
import { type Values } from './localizeRuntime.js';
|
|
8
9
|
/**
|
|
9
10
|
* The `crop` fixture argument. Call it inside a `screenshot()` body to crop the
|
|
10
11
|
* implicit end-of-body capture to a locator or pixel region. Replaces the
|
|
@@ -12,14 +13,14 @@ import { type TextValues } from './localizeRuntime.js';
|
|
|
12
13
|
*/
|
|
13
14
|
export type CropFixture = (target: CropTarget, options?: CropOptions) => Promise<void>;
|
|
14
15
|
type ScreenshotFixtureOptions = {
|
|
15
|
-
recordOptions: RecordOptions |
|
|
16
|
-
renderOptions: RenderOptions |
|
|
16
|
+
recordOptions: RecordOptions | StudioMarker<Partial<RecordOptions>>;
|
|
17
|
+
renderOptions: RenderOptions | StudioMarker<Partial<RenderOptions>> | undefined;
|
|
17
18
|
/** Active language for this pass; see {@link video} for details. Internal. */
|
|
18
19
|
_screenciLanguage: string | undefined;
|
|
19
20
|
/** Grouping name written to `metadata.videoName`. Internal. */
|
|
20
21
|
_screenciVideoName: string | undefined;
|
|
21
|
-
/**
|
|
22
|
-
|
|
22
|
+
/** Values-field declaration (`screenshot.values(...)`). Internal. */
|
|
23
|
+
_screenciValues: NormalizedFeature<string> | undefined;
|
|
23
24
|
/** Overlay declaration (`screenshot.overlays(...)`). Internal. */
|
|
24
25
|
_screenciOverlays: NormalizedFeature<OverlayInputOrFactory> | undefined;
|
|
25
26
|
/**
|
|
@@ -34,11 +35,11 @@ type ScreenshotFixtures = {
|
|
|
34
35
|
/** The language being captured in this pass; `undefined` outside per-language mode. */
|
|
35
36
|
language: string | undefined;
|
|
36
37
|
/**
|
|
37
|
-
* Injected
|
|
38
|
-
* declared in `screenshot.
|
|
38
|
+
* Injected values fields for the active language, keyed by the field names
|
|
39
|
+
* declared in `screenshot.values(...)`. A still is silent, so there is no
|
|
39
40
|
* `narration` fixture.
|
|
40
41
|
*/
|
|
41
|
-
|
|
42
|
+
values: Values;
|
|
42
43
|
/**
|
|
43
44
|
* Overlay controllers for the names declared in `screenshot.overlays(...)`.
|
|
44
45
|
* Empty when none are declared.
|
|
@@ -93,16 +94,17 @@ interface Screenshot extends ScreenshotCallSignatures {
|
|
|
93
94
|
/**
|
|
94
95
|
* Capture one localized screenshot per declared language. By default each
|
|
95
96
|
* language is captured in its own pass with the browser `locale` set from the
|
|
96
|
-
* language, and the body receives the active `language` and `
|
|
97
|
+
* language, and the body receives the active `language` and `values` fields.
|
|
97
98
|
* Chainable with `.each(...)`.
|
|
98
99
|
*/
|
|
99
|
-
/** Declare on-screen
|
|
100
|
-
|
|
101
|
-
/** Declare overlays (
|
|
100
|
+
/** Declare on-screen values fields (array = Studio-owned, object = code values). */
|
|
101
|
+
values: MediaBuilder<ScreenshotArgs>['values'];
|
|
102
|
+
/** Declare overlays (`studio([...])` = Studio-owned, object = code values/factories). */
|
|
102
103
|
overlays: MediaBuilder<ScreenshotArgs>['overlays'];
|
|
103
104
|
/**
|
|
104
|
-
* Declare the recorded language set / capture mode. Pass `
|
|
105
|
-
* web app own the set
|
|
105
|
+
* Declare the recorded language set / capture mode. Pass `studio()` to let the
|
|
106
|
+
* web app own the set (`studio(['en', 'fi'])` to seed it), an array
|
|
107
|
+
* `['en', 'fi']`, or an options object.
|
|
106
108
|
*/
|
|
107
109
|
languages: MediaBuilder<ScreenshotArgs>['languages'];
|
|
108
110
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../src/screenshot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,WAAW,EACX,QAAQ,EACT,MAAM,kBAAkB,CAAA;AAGzB,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,YA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GACxE,IAAI,CAAA;IACP,UAAU,CACR,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,GACxE,IAAI,CAAA;IACP,SAAS,CACP,KAAK,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,GACxE,IAAI,CAAA;IACP,SAAS,CACP,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,CAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,GACxE,IAAI,CAAA;IAEP,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,CAAA;IACpC,SAAS,EAAE,cAAc,CAAC,WAAW,CAAC,CAAA;IACtC,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,CAAA;IACpC,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,CAAA;IAC1B,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAA;IAChC,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;IAC5B,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;IAC5B,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAA;IAChC,UAAU,EAAE,cAAc,CAAC,YAAY,CAAC,CAAA;CACzC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,UAAU,EAAiC,UAAU,CAAA"}
|
package/dist/src/screenshot.js
CHANGED
|
@@ -16,8 +16,8 @@ import { getRuntimePage, setRuntimeCrop } from './runtimeContext.js';
|
|
|
16
16
|
import { ScreenciError } from './errors.js';
|
|
17
17
|
import { withActiveRecordingContext, resolveEffectiveRecordOptions, resolveStudioRecordOptions, resolveStudioRenderOptions, } from './video.js';
|
|
18
18
|
import { createVideoBuilder, SCREENSHOT_FEATURES, } from './builder.js';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
19
|
+
import { buildValuesDeclaration, buildValues, } from './localizeRuntime.js';
|
|
20
|
+
import { parseValuesOverrides } from './runtimeMode.js';
|
|
21
21
|
/** File name of the raw page capture written beside `data.json`. */
|
|
22
22
|
const SCREENSHOT_FILE_NAME = 'screenshot.png';
|
|
23
23
|
const _screenshotBase = base.extend({
|
|
@@ -25,14 +25,14 @@ const _screenshotBase = base.extend({
|
|
|
25
25
|
renderOptions: [undefined, { option: true }],
|
|
26
26
|
_screenciLanguage: [undefined, { option: true }],
|
|
27
27
|
_screenciVideoName: [undefined, { option: true }],
|
|
28
|
-
|
|
28
|
+
_screenciValues: [undefined, { option: true }],
|
|
29
29
|
_screenciOverlays: [undefined, { option: true }],
|
|
30
30
|
_screenciSourceFile: [undefined, { option: true }],
|
|
31
31
|
language: async ({ _screenciLanguage }, use) => {
|
|
32
32
|
await use(_screenciLanguage);
|
|
33
33
|
},
|
|
34
|
-
|
|
35
|
-
await use(
|
|
34
|
+
values: async ({ _screenciValues, _screenciLanguage }, use) => {
|
|
35
|
+
await use(buildValues(_screenciValues, _screenciLanguage, parseValuesOverrides()));
|
|
36
36
|
},
|
|
37
37
|
overlays: async ({ _screenciOverlays, _screenciLanguage }, use) => {
|
|
38
38
|
await use(buildOverlays(_screenciOverlays, _screenciLanguage));
|
|
@@ -96,7 +96,7 @@ const _screenshotBase = base.extend({
|
|
|
96
96
|
await context.close();
|
|
97
97
|
}
|
|
98
98
|
},
|
|
99
|
-
page: async ({ context, recordOptions: codeRecordOptions, renderOptions, deviceScaleFactor, _screenciLanguage,
|
|
99
|
+
page: async ({ context, recordOptions: codeRecordOptions, renderOptions, deviceScaleFactor, _screenciLanguage, _screenciValues, _screenciVideoName, _screenciSourceFile, }, use, testInfo) => {
|
|
100
100
|
const shouldRecord = process.env.SCREENCI_RECORDING === 'true';
|
|
101
101
|
const { base: baseRecordOptions, studio: studioRecord } = resolveStudioRecordOptions(codeRecordOptions);
|
|
102
102
|
const { obj: renderOptionsObj, studio: studioRender } = resolveStudioRenderOptions(renderOptions);
|
|
@@ -106,9 +106,9 @@ const _screenshotBase = base.extend({
|
|
|
106
106
|
recordOptions: studioRecord,
|
|
107
107
|
});
|
|
108
108
|
recorder.setActiveLanguage(_screenciLanguage ?? null);
|
|
109
|
-
// Declared `
|
|
109
|
+
// Declared `values` fields (and the active language's seeds) emitted once at
|
|
110
110
|
// recording start so the backend/Studio learn them.
|
|
111
|
-
const
|
|
111
|
+
const valuesDeclaration = buildValuesDeclaration(_screenciValues, _screenciLanguage);
|
|
112
112
|
const videoName = _screenciVideoName ?? testInfo.title;
|
|
113
113
|
// Asset paths are authored relative to the user's script. Playwright reports
|
|
114
114
|
// `testInfo.file` as the builder module that registered the test, so prefer
|
|
@@ -129,7 +129,7 @@ const _screenshotBase = base.extend({
|
|
|
129
129
|
page,
|
|
130
130
|
recorder,
|
|
131
131
|
unendedOverlays: 'autoEnd',
|
|
132
|
-
|
|
132
|
+
valuesDeclaration,
|
|
133
133
|
fn: async () => {
|
|
134
134
|
await use(page);
|
|
135
135
|
},
|
|
@@ -166,7 +166,7 @@ const _screenshotBase = base.extend({
|
|
|
166
166
|
page,
|
|
167
167
|
recorder,
|
|
168
168
|
unendedOverlays: 'autoEnd',
|
|
169
|
-
|
|
169
|
+
valuesDeclaration,
|
|
170
170
|
fn: async () => {
|
|
171
171
|
await use(page);
|
|
172
172
|
},
|
|
@@ -235,7 +235,7 @@ const _screenshotBase = base.extend({
|
|
|
235
235
|
export const screenshot = _screenshotBase;
|
|
236
236
|
// Attach the chainable fan-out builders, mirroring `video`.
|
|
237
237
|
const _screenshotRootBuilder = createVideoBuilder(_screenshotBase, SCREENSHOT_FEATURES);
|
|
238
|
-
screenshot.
|
|
238
|
+
screenshot.values = _screenshotRootBuilder.values;
|
|
239
239
|
screenshot.overlays = _screenshotRootBuilder.overlays;
|
|
240
240
|
screenshot.languages = _screenshotRootBuilder.languages;
|
|
241
241
|
screenshot.each = _screenshotRootBuilder.each;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot.js","sourceRoot":"","sources":["../../src/screenshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAU/C,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"screenshot.js","sourceRoot":"","sources":["../../src/screenshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAU/C,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AAGrC,OAAO,EACL,aAAa,GAGd,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,sCAAsC,GACvC,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAA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D,CAAC;aACH,CAAA;YAED,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAA;YAClE,yEAAyE;YACzE,0EAA0E;YAC1E,MAAM,QAAQ,CAAC,WAAW,CACxB,aAAa,EACb,SAAS,EACT,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC,EACjC;gBACE,MAAM,EAAE,YAAY;gBACpB,UAAU;gBACV,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,CAAC;aACpC,CACF,CAAA;QACH,CAAC;gBAAS,CAAC;YACT,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;QACpB,CAAC;IACH,CAAC;CACF,CAAC,CAAA;AA4HF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,eAAwC,CAAA;AAElE,4DAA4D;AAC5D,MAAM,sBAAsB,GAAG,kBAAkB,CAC/C,eAAsE,EACtE,mBAAmB,CACpB,CAAA;AACD,UAAU,CAAC,MAAM,GAAG,sBAAsB,CAAC,MAAM,CAAA;AACjD,UAAU,CAAC,QAAQ,GAAG,sBAAsB,CAAC,QAAQ,CAAA;AACrD,UAAU,CAAC,SAAS,GAAG,sBAAsB,CAAC,SAAS,CAAA;AACvD,UAAU,CAAC,IAAI,GAAG,sBAAsB,CAAC,IAAI,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared validation and parsing for the source `crop` rectangle and the
|
|
3
|
+
* `start`/`end` source-trim positions accepted by file overlays, narration video
|
|
4
|
+
* cues, and `selected()` render dependencies.
|
|
5
|
+
*
|
|
6
|
+
* `crop` is a rectangle in the source file's own pixels. `start`/`end` are time
|
|
7
|
+
* strings (`'2s'`, `'0:02'`, `'50%'`): seconds/timecodes resolve to a concrete ms
|
|
8
|
+
* offset into the source, while a percentage stays symbolic (a fraction of the
|
|
9
|
+
* SOURCE duration) because the source length is not known until render time.
|
|
10
|
+
*/
|
|
11
|
+
import { type TimelineOffset } from './timelineOffset.js';
|
|
12
|
+
import type { OverlayCrop, SourceTrimPoint } from './events.js';
|
|
13
|
+
/**
|
|
14
|
+
* Validates a {@link OverlayCrop}: every field finite, `x`/`y` non-negative, and
|
|
15
|
+
* `width`/`height` strictly positive. Returns the crop unchanged so callers can
|
|
16
|
+
* thread it inline.
|
|
17
|
+
*/
|
|
18
|
+
export declare function validateCrop(label: string, crop: OverlayCrop): OverlayCrop;
|
|
19
|
+
/**
|
|
20
|
+
* Parses and validates the optional `start`/`end` source-trim pair. When both are
|
|
21
|
+
* concrete (ms or percent), `start` must come before `end`; a mixed ms/percent
|
|
22
|
+
* pair cannot be compared here (the source length is unknown) and is deferred to
|
|
23
|
+
* the renderer. Returns the parsed points to thread onto the recorded event.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveSourceTrim(label: string, start: TimelineOffset | undefined, end: TimelineOffset | undefined): {
|
|
26
|
+
sourceStart?: SourceTrimPoint;
|
|
27
|
+
sourceEnd?: SourceTrimPoint;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=sourceTrim.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sourceTrim.d.ts","sourceRoot":"","sources":["../../src/sourceTrim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC9E,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE/D;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,WAAW,CAgB1E;AA2BD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,cAAc,GAAG,SAAS,EACjC,GAAG,EAAE,cAAc,GAAG,SAAS,GAC9B;IAAE,WAAW,CAAC,EAAE,eAAe,CAAC;IAAC,SAAS,CAAC,EAAE,eAAe,CAAA;CAAE,CAiChE"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared validation and parsing for the source `crop` rectangle and the
|
|
3
|
+
* `start`/`end` source-trim positions accepted by file overlays, narration video
|
|
4
|
+
* cues, and `selected()` render dependencies.
|
|
5
|
+
*
|
|
6
|
+
* `crop` is a rectangle in the source file's own pixels. `start`/`end` are time
|
|
7
|
+
* strings (`'2s'`, `'0:02'`, `'50%'`): seconds/timecodes resolve to a concrete ms
|
|
8
|
+
* offset into the source, while a percentage stays symbolic (a fraction of the
|
|
9
|
+
* SOURCE duration) because the source length is not known until render time.
|
|
10
|
+
*/
|
|
11
|
+
import { parseTimelineOffset } from './timelineOffset.js';
|
|
12
|
+
/**
|
|
13
|
+
* Validates a {@link OverlayCrop}: every field finite, `x`/`y` non-negative, and
|
|
14
|
+
* `width`/`height` strictly positive. Returns the crop unchanged so callers can
|
|
15
|
+
* thread it inline.
|
|
16
|
+
*/
|
|
17
|
+
export function validateCrop(label, crop) {
|
|
18
|
+
const { x, y, width, height } = crop;
|
|
19
|
+
const finite = (v) => typeof v === 'number' && Number.isFinite(v);
|
|
20
|
+
if (!finite(x) || !finite(y) || !finite(width) || !finite(height)) {
|
|
21
|
+
throw new Error(`[screenci] ${label} crop must have finite numeric x, y, width, and height (source pixels). Received: ${JSON.stringify(crop)}`);
|
|
22
|
+
}
|
|
23
|
+
if (x < 0 || y < 0) {
|
|
24
|
+
throw new Error(`[screenci] ${label} crop x and y must be >= 0.`);
|
|
25
|
+
}
|
|
26
|
+
if (width <= 0 || height <= 0) {
|
|
27
|
+
throw new Error(`[screenci] ${label} crop width and height must be > 0.`);
|
|
28
|
+
}
|
|
29
|
+
return crop;
|
|
30
|
+
}
|
|
31
|
+
/** Parses a single `start`/`end` time string into a {@link SourceTrimPoint}. */
|
|
32
|
+
function parseSourceTrimPoint(value, label) {
|
|
33
|
+
if (typeof value !== 'string') {
|
|
34
|
+
throw new Error(`[screenci] ${label} must be a time string such as '2s', '0:02', or '50%', got ${typeof value}.`);
|
|
35
|
+
}
|
|
36
|
+
const parsed = parseTimelineOffset(value);
|
|
37
|
+
if (parsed.kind === 'percent') {
|
|
38
|
+
if (parsed.fraction <= 0 || parsed.fraction > 1) {
|
|
39
|
+
throw new Error(`[screenci] ${label} percentage must be greater than 0% and at most 100%. Received: '${value}'.`);
|
|
40
|
+
}
|
|
41
|
+
return { percent: parsed.fraction };
|
|
42
|
+
}
|
|
43
|
+
if (parsed.ms < 0) {
|
|
44
|
+
throw new Error(`[screenci] ${label} must be >= 0. Received: '${value}'.`);
|
|
45
|
+
}
|
|
46
|
+
return { ms: parsed.ms };
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Parses and validates the optional `start`/`end` source-trim pair. When both are
|
|
50
|
+
* concrete (ms or percent), `start` must come before `end`; a mixed ms/percent
|
|
51
|
+
* pair cannot be compared here (the source length is unknown) and is deferred to
|
|
52
|
+
* the renderer. Returns the parsed points to thread onto the recorded event.
|
|
53
|
+
*/
|
|
54
|
+
export function resolveSourceTrim(label, start, end) {
|
|
55
|
+
const sourceStart = start !== undefined
|
|
56
|
+
? parseSourceTrimPoint(start, `${label} start`)
|
|
57
|
+
: undefined;
|
|
58
|
+
const sourceEnd = end !== undefined ? parseSourceTrimPoint(end, `${label} end`) : undefined;
|
|
59
|
+
if (sourceStart !== undefined && sourceEnd !== undefined) {
|
|
60
|
+
if ('ms' in sourceStart &&
|
|
61
|
+
'ms' in sourceEnd &&
|
|
62
|
+
sourceStart.ms >= sourceEnd.ms) {
|
|
63
|
+
throw new Error(`[screenci] ${label} start must be before end (got start ${start}, end ${end}).`);
|
|
64
|
+
}
|
|
65
|
+
if ('percent' in sourceStart &&
|
|
66
|
+
'percent' in sourceEnd &&
|
|
67
|
+
sourceStart.percent >= sourceEnd.percent) {
|
|
68
|
+
throw new Error(`[screenci] ${label} start must be before end (got start ${start}, end ${end}).`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
...(sourceStart !== undefined && { sourceStart }),
|
|
73
|
+
...(sourceEnd !== undefined && { sourceEnd }),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=sourceTrim.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sourceTrim.js","sourceRoot":"","sources":["../../src/sourceTrim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,mBAAmB,EAAuB,MAAM,qBAAqB,CAAA;AAG9E;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa,EAAE,IAAiB;IAC3D,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IACpC,MAAM,MAAM,GAAG,CAAC,CAAU,EAAe,EAAE,CACzC,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC7C,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CACb,cAAc,KAAK,qFAAqF,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAC/H,CAAA;IACH,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,cAAc,KAAK,6BAA6B,CAAC,CAAA;IACnE,CAAC;IACD,IAAI,KAAK,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,cAAc,KAAK,qCAAqC,CAAC,CAAA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SAAS,EAAE,CAAC;QACzD,IACE,IAAI,IAAI,WAAW;YACnB,IAAI,IAAI,SAAS;YACjB,WAAW,CAAC,EAAE,IAAI,SAAS,CAAC,EAAE,EAC9B,CAAC;YACD,MAAM,IAAI,KAAK,CACb,cAAc,KAAK,wCAAwC,KAAK,SAAS,GAAG,IAAI,CACjF,CAAA;QACH,CAAC;QACD,IACE,SAAS,IAAI,WAAW;YACxB,SAAS,IAAI,SAAS;YACtB,WAAW,CAAC,OAAO,IAAI,SAAS,CAAC,OAAO,EACxC,CAAC;YACD,MAAM,IAAI,KAAK,CACb,cAAc,KAAK,wCAAwC,KAAK,SAAS,GAAG,IAAI,CACjF,CAAA;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,GAAG,CAAC,WAAW,KAAK,SAAS,IAAI,EAAE,WAAW,EAAE,CAAC;QACjD,GAAG,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,SAAS,EAAE,CAAC;KAC9C,CAAA;AACH,CAAC"}
|
package/dist/src/studio.d.ts
CHANGED
|
@@ -1,10 +1,78 @@
|
|
|
1
|
+
import type { ContentMajor, LanguageMajor } from './declare.js';
|
|
1
2
|
/**
|
|
2
|
-
* The studio
|
|
3
|
-
*
|
|
4
|
-
* sentinel;
|
|
3
|
+
* The studio axes deferred to the ScreenCI web app, read by the recorder to
|
|
4
|
+
* stamp `metadata.studio`. `renderOptions`/`recordOptions` come from the
|
|
5
|
+
* matching `'studio'` sentinel; `languages` is set when the recording's
|
|
6
|
+
* language set is web-owned (`video.languages(studio())`).
|
|
5
7
|
*/
|
|
6
8
|
export type StudioOptionFlags = {
|
|
7
9
|
renderOptions: boolean;
|
|
8
10
|
recordOptions: boolean;
|
|
11
|
+
/** Whether the language set is owned by the web app (`video.languages(studio())`). */
|
|
12
|
+
languages?: boolean;
|
|
13
|
+
};
|
|
14
|
+
/** Brand marking a value produced by {@link studio}. */
|
|
15
|
+
export declare const STUDIO: unique symbol;
|
|
16
|
+
/**
|
|
17
|
+
* A Studio-owned declaration produced by {@link studio}: the content (or, for
|
|
18
|
+
* `languages`, the set) is owned by the ScreenCI web app. `names` lists the
|
|
19
|
+
* declared keys (cue / overlay / audio names, or language codes); `seed`, when
|
|
20
|
+
* present, supplies initial values the web app starts from but may override.
|
|
21
|
+
*
|
|
22
|
+
* `S` carries the seed shape so the consuming feature method validates seed
|
|
23
|
+
* values against its own value type (e.g. narration seeds are checked as
|
|
24
|
+
* narration cues). A blank declaration (`studio([...])`) has `seed` undefined.
|
|
25
|
+
*/
|
|
26
|
+
export type StudioMarker<S = unknown> = {
|
|
27
|
+
readonly [STUDIO]: true;
|
|
28
|
+
readonly names: readonly string[];
|
|
29
|
+
readonly seed?: S;
|
|
30
|
+
};
|
|
31
|
+
/** A blank Studio declaration: names only, no seed. */
|
|
32
|
+
export type StudioNames = StudioMarker<undefined> & {
|
|
33
|
+
readonly seed?: undefined;
|
|
34
|
+
/** Phantom guard: keeps the keyless form ({@link StudioPending}) out of feature args. */
|
|
35
|
+
readonly languagesOnly?: never;
|
|
36
|
+
};
|
|
37
|
+
/** A seeded Studio declaration: the web app starts from `seed` but may override it. */
|
|
38
|
+
export type StudioSeeded<S> = StudioMarker<S> & {
|
|
39
|
+
readonly seed: S;
|
|
40
|
+
readonly languagesOnly?: never;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The keyless form, `studio()`: the web app owns the entire set. Only
|
|
44
|
+
* `video.languages(studio())` accepts it (a content feature has no keys to
|
|
45
|
+
* defer, so its keyless form is rejected by {@link FeatureArg}). The
|
|
46
|
+
* `languagesOnly` brand is what makes it unassignable to {@link StudioNames}.
|
|
47
|
+
*/
|
|
48
|
+
export type StudioPending = StudioMarker<undefined> & {
|
|
49
|
+
readonly names: readonly [];
|
|
50
|
+
readonly seed?: undefined;
|
|
51
|
+
readonly languagesOnly: true;
|
|
52
|
+
};
|
|
53
|
+
/** Whether a value was produced by {@link studio}. */
|
|
54
|
+
export declare function isStudioMarker(value: unknown): value is StudioMarker;
|
|
55
|
+
/**
|
|
56
|
+
* Declare something Studio-owned: its content is configured in the ScreenCI web
|
|
57
|
+
* app, and code only declares that it exists. Three forms:
|
|
58
|
+
*
|
|
59
|
+
* - `studio(['intro', 'cta'])`: blank names. The keys exist in code (so the test
|
|
60
|
+
* body can reference `narration.intro`), but the web app owns their content.
|
|
61
|
+
* - `studio({ intro: 'Welcome' })`: seeded. The web app starts from these values
|
|
62
|
+
* but owns them: once edited in Studio, the Studio value wins (a seed never
|
|
63
|
+
* clobbers an existing Studio edit).
|
|
64
|
+
* - `studio()`: keyless. Only `video.languages(studio())` accepts it: the web app
|
|
65
|
+
* owns the entire language set. Content features have keys to declare, so their
|
|
66
|
+
* keyless form does not type-check.
|
|
67
|
+
*
|
|
68
|
+
* For `video.languages`, the names are language codes: `studio(['en', 'fi'])`
|
|
69
|
+
* seeds the initial set (web-owned, but starts with those languages).
|
|
70
|
+
*/
|
|
71
|
+
export declare function studio(): StudioPending;
|
|
72
|
+
export declare function studio<const N extends readonly string[]>(names: N): StudioNames & {
|
|
73
|
+
readonly names: N;
|
|
74
|
+
};
|
|
75
|
+
export declare function studio<const S extends ContentMajor<unknown> | LanguageMajor<unknown>>(seed: S): StudioSeeded<S> & {
|
|
76
|
+
readonly names: readonly (keyof S & string)[];
|
|
9
77
|
};
|
|
10
78
|
//# sourceMappingURL=studio.d.ts.map
|
package/dist/src/studio.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"studio.d.ts","sourceRoot":"","sources":["../../src/studio.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"studio.d.ts","sourceRoot":"","sources":["../../src/studio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAE/D;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,OAAO,CAAA;IACtB,aAAa,EAAE,OAAO,CAAA;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E,CAAC,GACP,WAAW,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAA;AACtC,wBAAgB,MAAM,CACpB,KAAK,CAAC,CAAC,SAAS,YAAY,CAAC,OAAO,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,EAC9D,IAAI,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,CAAA;CAAE,CAAA"}
|
package/dist/src/studio.js
CHANGED
|
@@ -1,2 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
/** Brand marking a value produced by {@link studio}. */
|
|
2
|
+
export const STUDIO = Symbol.for('screenci.studio');
|
|
3
|
+
/** Whether a value was produced by {@link studio}. */
|
|
4
|
+
export function isStudioMarker(value) {
|
|
5
|
+
return (typeof value === 'object' &&
|
|
6
|
+
value !== null &&
|
|
7
|
+
value[STUDIO] === true);
|
|
8
|
+
}
|
|
9
|
+
export function studio(arg) {
|
|
10
|
+
if (arg === undefined)
|
|
11
|
+
return { [STUDIO]: true, names: [] };
|
|
12
|
+
if (Array.isArray(arg))
|
|
13
|
+
return { [STUDIO]: true, names: [...arg] };
|
|
14
|
+
return {
|
|
15
|
+
[STUDIO]: true,
|
|
16
|
+
names: Object.keys(arg),
|
|
17
|
+
seed: arg,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
2
20
|
//# sourceMappingURL=studio.js.map
|
package/dist/src/studio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"studio.js","sourceRoot":"","sources":["../../src/studio.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"studio.js","sourceRoot":"","sources":["../../src/studio.ts"],"names":[],"mappings":"AAeA,wDAAwD;AACxD,MAAM,CAAC,MAAM,MAAM,GAAkB,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;AA2ClE,sDAAsD;AACtD,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACb,KAAsC,CAAC,MAAM,CAAC,KAAK,IAAI,CACzD,CAAA;AACH,CAAC;AAyBD,MAAM,UAAU,MAAM,CACpB,GAAiD;IAEjD,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;IAC3D,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,EAAE,CAAA;IAClE,OAAO;QACL,CAAC,MAAM,CAAC,EAAE,IAAI;QACd,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;QACvB,IAAI,EAAE,GAA4B;KACnC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parsing for the string position arguments accepted by the narration and
|
|
3
|
+
* overlay controllers, e.g. `narration.intro('0:02')` or `overlays.tip('56%')`.
|
|
4
|
+
*
|
|
5
|
+
* A controller called with a NUMBER keeps its existing meaning (a relative
|
|
6
|
+
* duration in milliseconds). A controller called with a STRING means an absolute
|
|
7
|
+
* position in the final video: "this cue/overlay window should reach this point."
|
|
8
|
+
* Only strings flow through this module; numbers never do.
|
|
9
|
+
*
|
|
10
|
+
* Absolute positions are resolved against the finished render, so a percentage
|
|
11
|
+
* cannot be turned into milliseconds here (the total length is not known until
|
|
12
|
+
* render time). The parser therefore returns a discriminated union: concrete
|
|
13
|
+
* `'<n>s'`/timecode forms resolve to milliseconds, while `'<n>%'` surfaces a
|
|
14
|
+
* fraction the renderer multiplies by the final total.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* A position within the final video. Strings only (numbers are the existing
|
|
18
|
+
* duration path on each controller). Accepts:
|
|
19
|
+
* - `'<n>s'` seconds, e.g. `'2s'` or `'5.51s'`
|
|
20
|
+
* - `'m:ss(.f)'` timecode minutes:seconds, e.g. `'0:05.51'` (= 5.51s)
|
|
21
|
+
* - `'h:mm:ss(.f)'` timecode hours:minutes:seconds, e.g. `'1:02:03.5'`
|
|
22
|
+
* - `'<n>%'` percentage of the total video, e.g. `'56.1%'`
|
|
23
|
+
*
|
|
24
|
+
* The template-literal members give editor hints for the common forms; the
|
|
25
|
+
* trailing `string` keeps timecodes (which the type system cannot express)
|
|
26
|
+
* assignable. Validation happens at runtime in {@link parseTimelineOffset}.
|
|
27
|
+
*/
|
|
28
|
+
export type TimelineOffset = `${number}s` | `${number}%` | string;
|
|
29
|
+
/** Result of parsing a {@link TimelineOffset} string. */
|
|
30
|
+
export type ParsedTimelineOffset =
|
|
31
|
+
/** From `'<n>s'` or a timecode: a concrete absolute position in milliseconds. */
|
|
32
|
+
{
|
|
33
|
+
kind: 'absolute';
|
|
34
|
+
ms: number;
|
|
35
|
+
}
|
|
36
|
+
/** From `'<n>%'`: a fraction (0.561 for `'56.1%'`), resolved against the total at render. */
|
|
37
|
+
| {
|
|
38
|
+
kind: 'percent';
|
|
39
|
+
fraction: number;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Parses a string position into a {@link ParsedTimelineOffset}. Throws on any
|
|
43
|
+
* unrecognized or malformed input. Pure: no I/O, no globals.
|
|
44
|
+
*/
|
|
45
|
+
export declare function parseTimelineOffset(value: string): ParsedTimelineOffset;
|
|
46
|
+
//# sourceMappingURL=timelineOffset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timelineOffset.d.ts","sourceRoot":"","sources":["../../src/timelineOffset.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,cAAc,GAAG,GAAG,MAAM,GAAG,GAAG,GAAG,MAAM,GAAG,GAAG,MAAM,CAAA;AAEjE,yDAAyD;AACzD,MAAM,MAAM,oBAAoB;AAC9B,iFAAiF;AAC/E;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE;AAClC,6FAA6F;GAC3F;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAA;AAmBzC;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,oBAAoB,CAqCvE"}
|