@qontinui/ui-bridge-wrapper 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -179,6 +179,65 @@ directory must be empty or not exist yet: a non-empty one is refused before any
179
179
  browser launches, and is never cleared. `--viewport` sides are at most 8192 CSS
180
180
  pixels.
181
181
 
182
+ ### Candidates in situ: the media override, a slow network and a timeline
183
+
184
+ The injected runtime serves the SDK's `mediaOverride` dev control, so a
185
+ candidate image can be judged in the slot it is meant for, then removed:
186
+
187
+ ```bash
188
+ ui-bridge-inject --url http://127.0.0.1:3000/ --throttle slow-3g --no-cache \
189
+ --exec 'mediaOverride {"slotId":"hero","src":"http://127.0.0.1:8080/cand.png"}' \
190
+ --exec 'captureTimeline {"dir":"./tl","frames":6,"intervalMs":200,"reload":false}' \
191
+ --exec 'mediaOverrideRestore {}' --exec 'mediaOverrideList {}'
192
+ ```
193
+
194
+ `mediaOverride` answers only after the browser decoded the candidate and its
195
+ `currentSrc` names it (inside a `<picture>` every `<source srcset>` is replaced
196
+ too); one it cannot confirm is rolled back and fails the step.
197
+ A `loading="lazy"` slot is loaded eagerly while overridden, so an offscreen one
198
+ still decodes. `mediaOverrideRestore` puts every attribute back and verifies
199
+ what the browser then RENDERS (the slot's `currentSrc` back on an original URL,
200
+ or the computed `background-image` off the candidate): only `verified: true`
201
+ with `status: "restored"` is a clean restore, and `restored_with_drift` (the app
202
+ rewrote a value meanwhile) or `verified: false` is an unknown one.
203
+ `mediaOverrideList` returning `active: []` proves nothing is still overridden.
204
+ `--throttle <slow-3g|fast-3g|latency=<ms>,down=<kbps>,up=<kbps>>` applies CDP
205
+ network emulation once the page is ready (it persists across a reload) and
206
+ `--no-cache` disables the HTTP cache; what Chromium accepted is stamped as
207
+ `network` on timeline results, matrix cells and the relay info line.
208
+ `captureTimeline` screenshots the page `frames` times, `intervalMs` apart, each
209
+ frame stamped with its offset; `"reload":true` starts the clock at a fresh
210
+ navigation commit (the loading-to-loaded timeline) and waits for the runtime to
211
+ settle again. `"during":{"action":"mediaOverride","payload":{...}}` runs the
212
+ override concurrently with the frames, so the timeline shows the candidate
213
+ arriving (under `--throttle`, its slow-network load) while the override still
214
+ confirms decode before it answers. In `--capture-matrix` a relative `dir` lands
215
+ in each cell's directory.
216
+
217
+ ### Text hidden for one frame: text over images on real pixels
218
+
219
+ The injected runtime also serves the `textVisibility` dev control, which makes
220
+ every glyph on the page transparent for one frame and then restores the page
221
+ exactly. Frame A (normal) and frame B (text hidden) against one snapshot differ,
222
+ inside each text element's box, exactly where its glyphs paint, and frame B
223
+ shows what they sit on:
224
+
225
+ ```bash
226
+ ui-bridge-inject --url http://127.0.0.1:3000/ --screenshot './frames/frame-{n}.png' \
227
+ --exec 'getControlSnapshot {}' \
228
+ --exec 'textVisibility {"hidden":true}' --exec 'getControlSnapshot {}' \
229
+ --exec 'textVisibility {"hidden":false}'
230
+ ```
231
+
232
+ Hiding writes inline `!important` values on every element: `color`,
233
+ `-webkit-text-fill-color` and SVG text `fill` go transparent, `text-shadow`
234
+ goes `none` and transitions are switched off, so frame B is never caught
235
+ mid-fade. Paint that only followed the text colour (a `currentColor` border or
236
+ icon) is pinned to the colour it had, so only glyphs change. `{"hidden":false}`
237
+ writes every `style` attribute back byte for byte (`restore.verified: true`),
238
+ without the text fading back in; a TTL (`ttlMs`, default 30000) restores the
239
+ page by itself if the run dies.
240
+
182
241
  #### Sourcing credentials from SSM (qontinui operators)
183
242
 
184
243
  The bins read credentials from env / flags only — they intentionally do **not**
@@ -12,6 +12,7 @@
12
12
  * browser per cell is the CLI's job (`inject-cli.ts`, `runMatrix`).
13
13
  */
14
14
  import type { FrameColorScheme, FrameError, FrameRecord } from './frame-capture.js';
15
+ import type { NetworkEmulation } from './network-throttle.js';
15
16
  /** A CSS-pixel viewport. */
16
17
  export interface MatrixViewport {
17
18
  width: number;
@@ -76,6 +77,8 @@ export interface MatrixCellReport {
76
77
  /** Every action's output line, exactly as exec mode prints it (relative path). */
77
78
  results: string | null;
78
79
  pairs: MatrixPair[];
80
+ /** The network emulation applied in this cell (`--throttle` / `--no-cache`); null when none. */
81
+ network?: NetworkEmulation | null;
79
82
  }
80
83
  /** `<dir>/matrix.json`. */
81
84
  export interface MatrixManifest {
@@ -1 +1 @@
1
- {"version":3,"file":"capture-matrix.d.ts","sourceRoot":"","sources":["../src/capture-matrix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEpF,4BAA4B;AAC5B,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAC;IAChC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,WAAW,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACtC;AAED,gFAAgF;AAChF,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,YAAY,EAAE,gBAAgB,EAAE,CAAC;CAClC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,EAAE,CAc3D;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAK/C;AAED,0FAA0F;AAC1F,MAAM,WAAW,UAAU;IACzB,uEAAuE;IACvE,QAAQ,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,2FAA2F;IAC3F,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IAC1B,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED,iCAAiC;AACjC,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C;IACzB,yDAAyD;IACzD,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,kFAAkF;IAClF,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,gGAAgG;IAChG,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACnC;AAED,2BAA2B;AAC3B,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,0BAA0B,CAAC;IACjC,uDAAuD;IACvD,aAAa,EAAE,CAAC,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE;QAAE,IAAI,EAAE,kBAAkB,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAChF,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,wFAAwF;IACxF,IAAI,EAAE,UAAU,CAAC;IACjB,4CAA4C;IAC5C,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IAC/D,KAAK,EAAE,gBAAgB,EAAE,CAAC;CAC3B;AAED,mFAAmF;AACnF,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzE"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Error raised by inject-cli argument / payload validation. The thin CLI
3
+ * wrapper catches this and calls `die()`; tests assert on it WITHOUT
4
+ * triggering `process.exit`.
5
+ *
6
+ * Its own module so the helpers inject-cli composes (`./network-throttle.js`,
7
+ * `./timeline-capture.js`) can throw it without importing the CLI entry.
8
+ */
9
+ export declare class InjectCliArgError extends Error {
10
+ constructor(message: string);
11
+ }
12
+ //# sourceMappingURL=inject-cli-errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inject-cli-errors.d.ts","sourceRoot":"","sources":["../src/inject-cli-errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,OAAO,EAAE,MAAM;CAI5B"}