trace-avatar-render 0.2.0 → 0.2.2

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.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  main,
6
6
  parse,
7
7
  reportOf
8
- } from "./chunk-EAMOVIQK.js";
8
+ } from "./chunk-NFJMQBQ4.js";
9
9
  export {
10
10
  USAGE,
11
11
  UsageError,
package/dist/index.d.ts CHANGED
@@ -97,6 +97,8 @@ declare function watermarkOf(v: string | Watermark): Watermark;
97
97
  /** What a brand file may set: the polish options, nothing about what is played. */
98
98
  interface Brand {
99
99
  canvas?: CanvasSpec;
100
+ /** Shapes that fill the picture (no window, no margins), e.g. ["16:9"]; the others keep `frame`. */
101
+ fill?: CanvasSpec[];
100
102
  watermark?: string | Watermark;
101
103
  frame?: 'none' | 'browser';
102
104
  background?: string;
@@ -135,7 +137,7 @@ interface Layout {
135
137
  * The output size for a capture of srcW×srcH shown `width` wide (default: the capture's width, never
136
138
  * upscaled), with or without a browser window around it.
137
139
  */
138
- declare function layoutOf(srcW: number, srcH: number, width: number | undefined, frame?: FrameStyle, canvas?: Canvas): Layout;
140
+ declare function layoutOf(srcW: number, srcH: number, width: number | undefined, frame?: FrameStyle, canvas?: Canvas, fill?: boolean): Layout;
139
141
 
140
142
  /**
141
143
  * The parts of a frame that have text in them (the window's title bar, burned-in captions, title and end
@@ -668,6 +670,9 @@ interface RenderOptions {
668
670
  /** Compose onto a picture of this shape: '9:16' (1080×1920), '4:5', '1:1', '16:9', 'WxH' or { width, height }.
669
671
  * The app is placed between safe margins on the background; an output's width scales the whole canvas. */
670
672
  canvas?: CanvasSpec;
673
+ /** Shapes whose outputs fill the picture: no window, no margins (e.g. ['16:9']). The other outputs keep `frame`.
674
+ * Capture at the same shape (e.g. --viewport 1280x720 for 16:9) and nothing is cropped or padded. */
675
+ fill?: CanvasSpec[];
671
676
  /** A small badge on every frame, cards included: its text, or { text, at, opacity, logo }. */
672
677
  watermark?: string | Watermark;
673
678
  /** The AI for qa and alt (see trace-avatar/assist). Without it nothing calls a model. */
@@ -692,7 +697,7 @@ interface RenderOptions {
692
697
  repairVision?: boolean;
693
698
  }
694
699
  /** What finish() takes besides the capture: the composing options, with the cards resolved. */
695
- type FinishOptions = Pick<RenderOptions, 'cuts' | 'timeline' | 'frame' | 'background' | 'camera' | 'captions' | 'captionsAt' | 'poster' | 'canvas' | 'watermark'> & {
700
+ type FinishOptions = Pick<RenderOptions, 'cuts' | 'timeline' | 'frame' | 'background' | 'camera' | 'captions' | 'captionsAt' | 'poster' | 'canvas' | 'fill' | 'watermark'> & {
696
701
  cards?: {
697
702
  title?: CardOptions;
698
703
  end?: CardOptions;
@@ -1077,6 +1082,11 @@ interface Shot {
1077
1082
  * The frames finish() gets: each screencast frame, and one every 1/30 s while the cursor moves or a click ring shows,
1078
1083
  * all with the cursor drawn. A still page with a still cursor needs no more frames.
1079
1084
  */
1085
+ /**
1086
+ * The scale of the captured frames (frame pixels per CSS pixel). Chrome's screencast does not always send frames at
1087
+ * the device scale factor (headless, a 414×736 page at scale 2 comes as 414×736), so it is measured, not assumed.
1088
+ */
1089
+ declare function frameScale(shots: readonly Shot[], viewportWidth: number, fallback?: number): number;
1080
1090
  declare function withCursor(shots: readonly Shot[], moves: readonly Move[], clicks: readonly Move[], o?: {
1081
1091
  scale?: number;
1082
1092
  sprite?: Sprite;
@@ -1118,6 +1128,8 @@ interface DirectorCard {
1118
1128
  * A director's cards for finish(): each in the look of the video's end card (its logo and colour, else the title
1119
1129
  * card's), with its own title; the product's address only on those that ask for it.
1120
1130
  */
1131
+ /** What a card reads, as one line: its title, then its address when it shows one. */
1132
+ declare function cardCaption(title: string, url?: string): string;
1121
1133
  declare function cardsOf(cards: readonly DirectorCard[], finishCards?: FinishOptions['cards'], appName?: string): {
1122
1134
  t: number;
1123
1135
  ms: number;
@@ -1458,4 +1470,4 @@ declare function makeCampaign(c: LoadedCampaign, o?: MakeOptions): Promise<{
1458
1470
  */
1459
1471
  declare function saysOf(c: Pick<LoadedCampaign, 'out'>, renderId: string): string[] | null;
1460
1472
 
1461
- export { type Action, type Alias, type Brand, CAMPAIGN_KINDS, CAMPAIGN_SHAPES, CANVASES, CATALOGUE_FORMATS, CATALOGUE_KINDS, CATALOGUE_REQUIRED, CATALOGUE_SHAPES, CATALOGUE_SPEC, CORNERS, type CameraOptions, type Campaign, type CampaignApp, type CampaignLook, type CampaignRender, type CampaignVideo, type Canvas, type CanvasSpec, type Capture, type CaptureOptions, type CapturedFrame, type CardOptions, type Catalogue, type CatalogueCheck, type CatalogueEntry, type CheckOptions, type Corner, type Cue, DEFAULT_BACKGROUND, DEFAULT_MAX_WAIT_MS, DIRECTOR_VIEWPORT, type DirectOptions, type DirectResult, type Director, type DirectorCard, type EditOptions, type FinishOptions, type FrameStyle, GEMINI_TTS, type GifOptions, type GifResult, type GifWriter, type Image, type Layers, type Layout, type LoadedCampaign, type LookOf, type Made, type MakeOptions, type Move, type NarrationPlan, type OutFormat, type OutSpec, type Pcm, type Phase, type PlanOptions, type PlannedLine, type Point, type Progress, type Rect, RenderError, type RenderOptions, type RenderOutput, type RenderResult, type RepairOutcome, type RepairSuggestion, SKIP_KEEP_MS, type Scene, type Script, type Segment, type Session, type Shot, type Span, type Sprite, TRACK_RATE, type TimelineEvent, type Unresolved, type Voice, type Watermark, ZOOM_KINDS, actionsOf, aliasOf, arrowSprite, badgeAt, blank, brandFile, brandOf, cached, cameraKeys, cameraPath, canvasOf, captionCues, capture, cardFrames, cardOf, cardsOf, catalogueId, chapterCues, checkCampaign, checkCatalogue, createGifWriter, createLayers, crop, crossfade, cueAt, cursorAt, dataUri, direct, drawCursor, drawRegion, durationOf, editList, encodeGif, encodeMp4, endsWithOf, ensureApp, filesOf, findFfmpeg, findPlayer, finish, fitWidth, formatOf, frameTimes, fromS16le, fromWav, geminiVoice, layoutOf, linesOf, loadCampaign, lookOptions, makeCampaign, mix, mp4Args, mp4Head, msOf, narrationText, openAiVoice, outputAt, overlay, pageAt, paletteOf, parseScript, pathOf, pickFrames, pixel, planNarration, progressOf, providerOf, readCampaign, render, rendersOf, repairGuide, repairScriptOf, resample, resize, runQa, sayFrom, sayVoice, saysOf, shapeTag, sourceAt, spansOf, stallInspector, statusOf, stepCues, suggestScript, toVtt, toWav, travelMs, trimSilence, voiceOf, vttEnds, watermarkOf, withCards, withCursor, withHolds };
1473
+ export { type Action, type Alias, type Brand, CAMPAIGN_KINDS, CAMPAIGN_SHAPES, CANVASES, CATALOGUE_FORMATS, CATALOGUE_KINDS, CATALOGUE_REQUIRED, CATALOGUE_SHAPES, CATALOGUE_SPEC, CORNERS, type CameraOptions, type Campaign, type CampaignApp, type CampaignLook, type CampaignRender, type CampaignVideo, type Canvas, type CanvasSpec, type Capture, type CaptureOptions, type CapturedFrame, type CardOptions, type Catalogue, type CatalogueCheck, type CatalogueEntry, type CheckOptions, type Corner, type Cue, DEFAULT_BACKGROUND, DEFAULT_MAX_WAIT_MS, DIRECTOR_VIEWPORT, type DirectOptions, type DirectResult, type Director, type DirectorCard, type EditOptions, type FinishOptions, type FrameStyle, GEMINI_TTS, type GifOptions, type GifResult, type GifWriter, type Image, type Layers, type Layout, type LoadedCampaign, type LookOf, type Made, type MakeOptions, type Move, type NarrationPlan, type OutFormat, type OutSpec, type Pcm, type Phase, type PlanOptions, type PlannedLine, type Point, type Progress, type Rect, RenderError, type RenderOptions, type RenderOutput, type RenderResult, type RepairOutcome, type RepairSuggestion, SKIP_KEEP_MS, type Scene, type Script, type Segment, type Session, type Shot, type Span, type Sprite, TRACK_RATE, type TimelineEvent, type Unresolved, type Voice, type Watermark, ZOOM_KINDS, actionsOf, aliasOf, arrowSprite, badgeAt, blank, brandFile, brandOf, cached, cameraKeys, cameraPath, canvasOf, captionCues, capture, cardCaption, cardFrames, cardOf, cardsOf, catalogueId, chapterCues, checkCampaign, checkCatalogue, createGifWriter, createLayers, crop, crossfade, cueAt, cursorAt, dataUri, direct, drawCursor, drawRegion, durationOf, editList, encodeGif, encodeMp4, endsWithOf, ensureApp, filesOf, findFfmpeg, findPlayer, finish, fitWidth, formatOf, frameScale, frameTimes, fromS16le, fromWav, geminiVoice, layoutOf, linesOf, loadCampaign, lookOptions, makeCampaign, mix, mp4Args, mp4Head, msOf, narrationText, openAiVoice, outputAt, overlay, pageAt, paletteOf, parseScript, pathOf, pickFrames, pixel, planNarration, progressOf, providerOf, readCampaign, render, rendersOf, repairGuide, repairScriptOf, resample, resize, runQa, sayFrom, sayVoice, saysOf, shapeTag, sourceAt, spansOf, stallInspector, statusOf, stepCues, suggestScript, toVtt, toWav, travelMs, trimSilence, voiceOf, vttEnds, watermarkOf, withCards, withCursor, withHolds };
package/dist/index.js CHANGED
@@ -29,6 +29,7 @@ import {
29
29
  canvasOf,
30
30
  captionCues,
31
31
  capture,
32
+ cardCaption,
32
33
  cardFrames,
33
34
  cardOf,
34
35
  cardsOf,
@@ -58,6 +59,7 @@ import {
58
59
  finish,
59
60
  fitWidth,
60
61
  formatOf,
62
+ frameScale,
61
63
  frameTimes,
62
64
  fromS16le,
63
65
  fromWav,
@@ -112,7 +114,7 @@ import {
112
114
  withCards,
113
115
  withCursor,
114
116
  withHolds
115
- } from "./chunk-EAMOVIQK.js";
117
+ } from "./chunk-NFJMQBQ4.js";
116
118
  export {
117
119
  CAMPAIGN_KINDS,
118
120
  CAMPAIGN_SHAPES,
@@ -144,6 +146,7 @@ export {
144
146
  canvasOf,
145
147
  captionCues,
146
148
  capture,
149
+ cardCaption,
147
150
  cardFrames,
148
151
  cardOf,
149
152
  cardsOf,
@@ -173,6 +176,7 @@ export {
173
176
  finish,
174
177
  fitWidth,
175
178
  formatOf,
179
+ frameScale,
176
180
  frameTimes,
177
181
  fromS16le,
178
182
  fromWav,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trace-avatar-render",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Render a trace-avatar guide to a GIF or MP4 by playing it on your real app in headless Chromium.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -65,6 +65,7 @@
65
65
  "trace-avatar": "^0.1.14"
66
66
  },
67
67
  "devDependencies": {
68
+ "@playwright/test": "^1.65.0",
68
69
  "@types/node": "^22.0.0",
69
70
  "@types/pngjs": "^6.0.5",
70
71
  "omggif": "^1.0.10",