browser-debugger-cli 0.11.0 → 0.13.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.
Files changed (222) hide show
  1. package/.claude/skills/bdg/SKILL.md +4 -4
  2. package/README.md +143 -79
  3. package/dist/commands/cdp.d.ts +22 -1
  4. package/dist/commands/cdp.js +100 -43
  5. package/dist/commands/console.d.ts +12 -0
  6. package/dist/commands/console.js +62 -12
  7. package/dist/commands/css.d.ts +13 -0
  8. package/dist/commands/css.js +53 -0
  9. package/dist/commands/dom/DomElementResolver.d.ts +3 -1
  10. package/dist/commands/dom/DomElementResolver.js +10 -3
  11. package/dist/commands/dom/a11y.js +3 -2
  12. package/dist/commands/dom/audit.d.ts +14 -0
  13. package/dist/commands/dom/audit.js +87 -0
  14. package/dist/commands/dom/eval.d.ts +3 -2
  15. package/dist/commands/dom/eval.js +11 -5
  16. package/dist/commands/dom/form.js +10 -9
  17. package/dist/commands/dom/formInteraction.js +42 -11
  18. package/dist/commands/dom/get.js +8 -8
  19. package/dist/commands/dom/helpers/index.d.ts +1 -1
  20. package/dist/commands/dom/helpers/index.js +1 -1
  21. package/dist/commands/dom/helpers/keyAttributes.d.ts +3 -2
  22. package/dist/commands/dom/helpers/keyAttributes.js +6 -4
  23. package/dist/commands/dom/helpers/query.d.ts +27 -3
  24. package/dist/commands/dom/helpers/query.js +152 -64
  25. package/dist/commands/dom/helpers/screenshot.d.ts +1 -0
  26. package/dist/commands/dom/helpers/screenshot.js +169 -49
  27. package/dist/commands/dom/index.js +7 -2
  28. package/dist/commands/dom/query.d.ts +19 -2
  29. package/dist/commands/dom/query.js +37 -6
  30. package/dist/commands/dom/screenshot.js +12 -7
  31. package/dist/commands/dom/semanticUtils.d.ts +3 -2
  32. package/dist/commands/dom/semanticUtils.js +40 -9
  33. package/dist/commands/dom/wait.js +5 -3
  34. package/dist/commands/helpJson.d.ts +82 -19
  35. package/dist/commands/helpJson.js +112 -41
  36. package/dist/commands/helpTopic.d.ts +16 -1
  37. package/dist/commands/helpTopic.js +59 -1
  38. package/dist/commands/installSkill.d.ts +15 -5
  39. package/dist/commands/installSkill.js +86 -16
  40. package/dist/commands/network/list.js +22 -12
  41. package/dist/commands/optionBehaviors.js +53 -16
  42. package/dist/commands/page.js +7 -4
  43. package/dist/commands/peek.d.ts +7 -0
  44. package/dist/commands/peek.js +65 -23
  45. package/dist/commands/shared/daemonErrorHandler.d.ts +5 -2
  46. package/dist/commands/shared/daemonErrorHandler.js +20 -9
  47. package/dist/commands/shared/dataFetcher.d.ts +12 -4
  48. package/dist/commands/shared/dataFetcher.js +12 -4
  49. package/dist/commands/shared/followMode.d.ts +9 -1
  50. package/dist/commands/shared/followMode.js +22 -4
  51. package/dist/commands/shared/optionTypes.d.ts +9 -2
  52. package/dist/commands/shared/outputFile.js +6 -1
  53. package/dist/commands/start.d.ts +20 -5
  54. package/dist/commands/start.js +84 -23
  55. package/dist/commands/stop.d.ts +11 -0
  56. package/dist/commands/stop.js +24 -1
  57. package/dist/commands/tail.d.ts +7 -1
  58. package/dist/commands/tail.js +13 -62
  59. package/dist/commands.js +2 -0
  60. package/dist/connection/cdp.d.ts +7 -0
  61. package/dist/connection/cdp.js +9 -0
  62. package/dist/connection/launcher.js +3 -2
  63. package/dist/daemon/SessionController.js +6 -1
  64. package/dist/daemon/launcher.d.ts +3 -2
  65. package/dist/daemon/launcher.js +47 -3
  66. package/dist/daemon/session/Session.d.ts +4 -1
  67. package/dist/daemon/session/Session.js +33 -2
  68. package/dist/daemon/session/TelemetryStore.d.ts +8 -1
  69. package/dist/daemon/session/TelemetryStore.js +13 -1
  70. package/dist/daemon/session/commandRegistry.js +36 -14
  71. package/dist/daemon/session/interactions.d.ts +2 -1
  72. package/dist/daemon/session/interactions.js +13 -1
  73. package/dist/daemon/session/plugins.js +19 -53
  74. package/dist/daemon/session/teardown.js +1 -1
  75. package/dist/daemon.js +9234 -7222
  76. package/dist/errors/messages.d.ts +88 -15
  77. package/dist/errors/messages.js +177 -27
  78. package/dist/index.js +19322 -13961
  79. package/dist/ipc/client.d.ts +22 -2
  80. package/dist/ipc/client.js +34 -5
  81. package/dist/ipc/protocol/auditTypes.d.ts +135 -0
  82. package/dist/ipc/protocol/auditTypes.js +6 -0
  83. package/dist/ipc/protocol/commands.d.ts +35 -0
  84. package/dist/ipc/protocol/commands.js +2 -0
  85. package/dist/ipc/protocol/domTypes.d.ts +16 -0
  86. package/dist/ipc/protocol/inspectTypes.d.ts +73 -8
  87. package/dist/ipc/session/types.d.ts +2 -0
  88. package/dist/runtime/css/search.d.ts +39 -0
  89. package/dist/runtime/css/search.js +122 -0
  90. package/dist/runtime/dom/actionEffects.d.ts +9 -2
  91. package/dist/runtime/dom/actionEffects.js +30 -14
  92. package/dist/runtime/dom/audit.d.ts +19 -0
  93. package/dist/runtime/dom/audit.js +37 -0
  94. package/dist/runtime/dom/auditModel.d.ts +45 -0
  95. package/dist/runtime/dom/auditModel.js +220 -0
  96. package/dist/runtime/dom/auditScripts.d.ts +113 -0
  97. package/dist/runtime/dom/auditScripts.js +148 -0
  98. package/dist/runtime/dom/elementGeometry.d.ts +16 -3
  99. package/dist/runtime/dom/elementGeometry.js +49 -10
  100. package/dist/runtime/dom/elementInfo.d.ts +74 -17
  101. package/dist/runtime/dom/elementInfo.js +187 -34
  102. package/dist/runtime/dom/evalHelpers.d.ts +12 -2
  103. package/dist/runtime/dom/evalHelpers.js +67 -7
  104. package/dist/runtime/dom/formDiscovery.d.ts +6 -2
  105. package/dist/runtime/dom/formDiscovery.js +20 -3
  106. package/dist/runtime/dom/formFillHelpers/fill.js +8 -12
  107. package/dist/runtime/dom/formFillHelpers/pressKey.js +2 -2
  108. package/dist/runtime/dom/formFillHelpers/shared.d.ts +16 -10
  109. package/dist/runtime/dom/formFillHelpers/shared.js +19 -52
  110. package/dist/runtime/dom/formSubmitHelpers.js +4 -3
  111. package/dist/runtime/dom/frameLayout.js +1 -0
  112. package/dist/runtime/dom/inspect.d.ts +7 -0
  113. package/dist/runtime/dom/inspect.js +92 -28
  114. package/dist/runtime/dom/inspectAllStyles.d.ts +16 -4
  115. package/dist/runtime/dom/inspectAllStyles.js +90 -7
  116. package/dist/runtime/dom/inspectCascade.d.ts +19 -2
  117. package/dist/runtime/dom/inspectCascade.js +214 -44
  118. package/dist/runtime/dom/inspectCascadeModel.d.ts +8 -0
  119. package/dist/runtime/dom/inspectCascadeModel.js +108 -34
  120. package/dist/runtime/dom/inspectHints.d.ts +26 -3
  121. package/dist/runtime/dom/inspectHints.js +125 -9
  122. package/dist/runtime/dom/inspectModel.d.ts +5 -1
  123. package/dist/runtime/dom/inspectModel.js +37 -10
  124. package/dist/runtime/dom/inspectPaintModel.d.ts +50 -22
  125. package/dist/runtime/dom/inspectPaintModel.js +182 -68
  126. package/dist/runtime/dom/inspectRules.d.ts +19 -0
  127. package/dist/runtime/dom/inspectRules.js +21 -5
  128. package/dist/runtime/dom/inspectScripts.d.ts +112 -12
  129. package/dist/runtime/dom/inspectScripts.js +357 -32
  130. package/dist/runtime/dom/inspectTree.js +10 -2
  131. package/dist/runtime/dom/inspectWhyModel.d.ts +2 -1
  132. package/dist/runtime/dom/inspectWhyModel.js +52 -10
  133. package/dist/runtime/dom/layout.js +40 -16
  134. package/dist/runtime/dom/reactEventHelpers.d.ts +21 -4
  135. package/dist/runtime/dom/reactEventHelpers.js +90 -36
  136. package/dist/runtime/dom/targetNode.d.ts +18 -5
  137. package/dist/runtime/dom/targetNode.js +268 -8
  138. package/dist/runtime/dom/wait.js +2 -1
  139. package/dist/runtime/page/bdgWorld.d.ts +57 -0
  140. package/dist/runtime/page/bdgWorld.js +180 -0
  141. package/dist/runtime/page/emulation.d.ts +13 -4
  142. package/dist/runtime/page/emulation.js +69 -4
  143. package/dist/runtime/page/replacedBuiltins.d.ts +28 -0
  144. package/dist/runtime/page/replacedBuiltins.js +136 -0
  145. package/dist/runtime/page/userAgent.d.ts +17 -0
  146. package/dist/runtime/page/userAgent.js +57 -0
  147. package/dist/session/QueryCacheManager.d.ts +4 -1
  148. package/dist/session/QueryCacheManager.js +5 -2
  149. package/dist/session/chrome.d.ts +4 -1
  150. package/dist/session/chrome.js +7 -1
  151. package/dist/session/cleanup/staleSession.d.ts +21 -4
  152. package/dist/session/cleanup/staleSession.js +79 -9
  153. package/dist/session/cleanup/userCommands.d.ts +4 -1
  154. package/dist/session/cleanup/userCommands.js +10 -5
  155. package/dist/session/daemonSocket.d.ts +10 -0
  156. package/dist/session/daemonSocket.js +22 -0
  157. package/dist/session/lastSession.d.ts +6 -3
  158. package/dist/session/lastSession.js +11 -5
  159. package/dist/session/paths.d.ts +3 -1
  160. package/dist/session/paths.js +5 -5
  161. package/dist/session/portClaims.js +4 -3
  162. package/dist/session/sessionList.d.ts +13 -5
  163. package/dist/session/sessionList.js +31 -7
  164. package/dist/telemetry/a11y.js +2 -2
  165. package/dist/telemetry/console.d.ts +2 -1
  166. package/dist/telemetry/console.js +30 -21
  167. package/dist/telemetry/pageCrash.d.ts +26 -0
  168. package/dist/telemetry/pageCrash.js +53 -0
  169. package/dist/types.d.ts +20 -0
  170. package/dist/ui/formatters/audit.d.ts +19 -0
  171. package/dist/ui/formatters/audit.js +115 -0
  172. package/dist/ui/formatters/cdp.d.ts +138 -0
  173. package/dist/ui/formatters/cdp.js +131 -0
  174. package/dist/ui/formatters/console/chronological.js +3 -1
  175. package/dist/ui/formatters/console/follow.d.ts +2 -1
  176. package/dist/ui/formatters/console/follow.js +2 -2
  177. package/dist/ui/formatters/console/json.d.ts +2 -2
  178. package/dist/ui/formatters/console/json.js +11 -5
  179. package/dist/ui/formatters/console/shared.d.ts +30 -0
  180. package/dist/ui/formatters/console/shared.js +16 -0
  181. package/dist/ui/formatters/console/summarize.d.ts +9 -2
  182. package/dist/ui/formatters/console/summarize.js +40 -9
  183. package/dist/ui/formatters/console.d.ts +2 -1
  184. package/dist/ui/formatters/console.js +7 -5
  185. package/dist/ui/formatters/details.js +3 -1
  186. package/dist/ui/formatters/dom.d.ts +2 -2
  187. package/dist/ui/formatters/dom.js +10 -8
  188. package/dist/ui/formatters/helpFormatters.js +1 -1
  189. package/dist/ui/formatters/inspect.js +50 -17
  190. package/dist/ui/formatters/installSkill.d.ts +9 -1
  191. package/dist/ui/formatters/installSkill.js +32 -6
  192. package/dist/ui/formatters/layout.js +2 -1
  193. package/dist/ui/formatters/networkList.d.ts +1 -1
  194. package/dist/ui/formatters/networkList.js +1 -2
  195. package/dist/ui/formatters/preview.d.ts +2 -0
  196. package/dist/ui/formatters/preview.js +17 -7
  197. package/dist/ui/formatters/sessions.d.ts +2 -2
  198. package/dist/ui/formatters/sessions.js +9 -2
  199. package/dist/ui/formatters/status.js +1 -1
  200. package/dist/ui/logging/logger.d.ts +1 -1
  201. package/dist/ui/messages/commands.d.ts +168 -11
  202. package/dist/ui/messages/commands.js +245 -18
  203. package/dist/ui/messages/consoleMessages.d.ts +24 -0
  204. package/dist/ui/messages/consoleMessages.js +32 -0
  205. package/dist/ui/messages/preview.d.ts +12 -0
  206. package/dist/ui/messages/preview.js +18 -2
  207. package/dist/ui/messages/session.d.ts +13 -2
  208. package/dist/ui/messages/session.js +22 -3
  209. package/dist/utils/cssValues.js +36 -4
  210. package/dist/utils/decisionTrees.js +0 -5
  211. package/dist/utils/directories.d.ts +34 -0
  212. package/dist/utils/directories.js +88 -0
  213. package/dist/utils/display.d.ts +16 -0
  214. package/dist/utils/display.js +42 -0
  215. package/dist/utils/exitCodes.d.ts +1 -0
  216. package/dist/utils/exitCodes.js +6 -0
  217. package/dist/utils/process.d.ts +12 -0
  218. package/dist/utils/process.js +25 -0
  219. package/dist/utils/suggestions.d.ts +4 -2
  220. package/dist/utils/suggestions.js +7 -5
  221. package/dist/utils/taskMappings.js +1 -1
  222. package/package.json +3 -2
@@ -24,6 +24,13 @@ export declare function chromeClosedMessage(pid?: number): string;
24
24
  * @returns Formatted success message
25
25
  */
26
26
  export declare function orphanedDaemonsCleanedMessage(count: number): string;
27
+ /**
28
+ * Where `bdg install-skill` kept the copy it replaced.
29
+ *
30
+ * @param path - Backup path, as the user would type it
31
+ * @returns One line
32
+ */
33
+ export declare function skillBackupMessage(path: string): string;
27
34
  /**
28
35
  * Warning shown when a click falls back from mouse events to `el.click()`.
29
36
  *
@@ -94,6 +101,17 @@ export declare function shownElementText(element: ShownElement): string;
94
101
  * "URL changed to https://example.com/#/active (same document)"
95
102
  */
96
103
  export declare function pageNavigationText(navigation: PageNavigation): string;
104
+ /**
105
+ * Last `New text:` row when an action made more messages appear than are listed.
106
+ *
107
+ * @param count - Messages not listed
108
+ * @returns e.g. `(+4 more)`
109
+ */
110
+ export declare function moreMessagesText(count: number): string;
111
+ /** Result line of `bdg dom hover --off` */
112
+ export declare const HOVER_OFF_DONE = "\u2713 Mouse moved off the page (hover styles and menus that close on mouseleave are gone)";
113
+ /** How `bdg dom hover` is called */
114
+ export declare const HOVER_USAGE = "bdg dom hover <selector|index>, or bdg dom hover --off to move the mouse away";
97
115
  /**
98
116
  * A message an action made appear, for its `New text:` rows.
99
117
  *
@@ -124,6 +142,22 @@ export declare const CLICK_NOT_RECEIVED_WARNING = "The click may not have reache
124
142
  * "... and 8980 more (--json lists the first 100)"
125
143
  */
126
144
  export declare function moreMatchesNote(hidden: number, jsonLimit?: number): string;
145
+ /**
146
+ * Note under `dom query` matches cut by `--limit`.
147
+ *
148
+ * @param omitted - Matches not listed
149
+ * @param indexed - Matches usable by index, when not all of them
150
+ * @returns e.g. `... and 49953 more (--limit 0 lists all; indices 0-999 work with other commands)`
151
+ */
152
+ export declare function queryMoreMatchesNote(omitted: number, indexed?: number): string;
153
+ /**
154
+ * Note under `dom query` matches listed past those whose viewport position
155
+ * was checked.
156
+ *
157
+ * @param checked - First matches checked
158
+ * @returns e.g. `Visibility is checked for the first 100 matches only; bdg dom layout <index> checks any of them`
159
+ */
160
+ export declare function queryViewportCheckedNote(checked: number): string;
127
161
  /**
128
162
  * Note under a list of a11y query matches cut by `--limit`.
129
163
  *
@@ -174,6 +208,31 @@ export declare const LAYOUT_REASONS: {
174
208
  /** Joins an invisible reason to the ancestor causing it */
175
209
  readonly on: " on ";
176
210
  };
211
+ /** Why an out-of-view text's contrast in `dom audit` is approximate: none of its ancestors paints a background */
212
+ export declare const AUDIT_OUT_OF_VIEW_RISK = "only its ancestors were checked";
213
+ /**
214
+ * `dom audit contrast` note for text that looks below the level but cannot
215
+ * be measured exactly (over an image, blended, under or over another layer).
216
+ *
217
+ * @param count - How many such texts
218
+ * @returns e.g. `(+12 more may be below it but cannot be measured: text over images or blended layers; check them with bdg dom inspect)`
219
+ */
220
+ export declare function auditUncertainContrastNote(count: number): string;
221
+ /**
222
+ * `dom audit animations` note for canvas elements, whose script-drawn
223
+ * animations it cannot see.
224
+ *
225
+ * @param count - Visible canvas elements
226
+ * @returns e.g. `(+ 2 canvas elements: animations drawn by scripts on them are not listed)`
227
+ */
228
+ export declare function auditCanvasNote(count: number): string;
229
+ /**
230
+ * A mask over an element, for `dom layout` and `dom inspect`.
231
+ *
232
+ * @param masked - The mask, e.g. `mask-image on div.hero`
233
+ * @returns e.g. `masked by mask-image on div.hero`
234
+ */
235
+ export declare function maskedText(masked: string): string;
177
236
  /**
178
237
  * Off-screen reason for an element out of view on a page whose scrolling is
179
238
  * locked, naming the visible dialog that likely locked it when there is one.
@@ -217,16 +276,53 @@ export declare function layoutPositionLabel(element: LabelledLayout, viewport?:
217
276
  * @returns e.g. `prefers-color-scheme: dark (from the system setting)`
218
277
  */
219
278
  export declare function colorSchemeLabel(scheme: string, emulated: boolean): string;
279
+ /**
280
+ * Suggestion for an action that failed on a page that replaced built-ins
281
+ * bdg's page scripts use.
282
+ *
283
+ * @param replaced - Their dotted names (all are named)
284
+ * @returns Suggestion naming them and a way around
285
+ */
286
+ export declare function brokenByReplacedBuiltinsSuggestion(replaced: readonly string[]): string;
287
+ /**
288
+ * Warning on an action when the page replaced built-ins bdg's page scripts
289
+ * use (polyfills, old frameworks, anti-bot scripts). Names the first four;
290
+ * the action's `replacedBuiltins` (JSON) lists them all.
291
+ *
292
+ * @param replaced - Their dotted names
293
+ * @returns e.g. `the page replaced built-ins bdg's scripts use (Element.prototype.querySelectorAll); bdg found the element in its own world, but the action runs in the page's and may misbehave`
294
+ */
295
+ export declare function replacedBuiltinsWarning(replaced: readonly string[]): string;
220
296
  /**
221
297
  * First line of `bdg status` for a running session.
222
298
  *
223
- * @param page - URL and title of the page, when the session reported them
224
- * @returns e.g. `Session active: https://example.com/ — Example Domain`
299
+ * @param page - URL and title of the page, when the session reported them,
300
+ * and when it crashed
301
+ * @returns e.g. `Session active: https://example.com/ — Example Domain`, with
302
+ * a crash warning on a second line
225
303
  */
226
304
  export declare function sessionActiveLine(page?: {
227
305
  url: string;
228
306
  title: string;
307
+ crashedAt?: number | undefined;
229
308
  }): string;
309
+ /**
310
+ * Warning that the session's page crashed, for `bdg status`, `bdg peek`,
311
+ * `bdg console` and `bdg network list`.
312
+ *
313
+ * @param crashedAt - When it crashed (epoch ms)
314
+ * @returns e.g. `⚠ The page crashed at 18:42:10 (renderer gone); bdg page reload brings it back`
315
+ */
316
+ export declare function pageCrashedNote(crashedAt: number): string;
317
+ /**
318
+ * Put the page-crashed warning before a view of collected data, when the
319
+ * page crashed (what is shown was collected before).
320
+ *
321
+ * @param body - The view
322
+ * @param crashedAt - When the page crashed (epoch ms), if it did
323
+ * @returns The view, after the warning when the page crashed
324
+ */
325
+ export declare function withPageCrashedNote(body: string, crashedAt: number | undefined): string;
230
326
  /**
231
327
  * Page dimensions line of `bdg dom layout`.
232
328
  *
@@ -252,7 +348,7 @@ export declare function layoutHeadline(count: number, listed: number, selector:
252
348
  */
253
349
  export declare function indexLayoutHeadline(target: string): string;
254
350
  /** Help text explaining `bdg dom inspect`'s output notation */
255
- export declare const INSPECT_OUTPUT_LEGEND = "\nOutput notation:\n WxH @x,y rendered border box size and page position (CSS px, no unit)\n m / p / b margin / padding / border widths, 1-4 values in CSS order (top right bottom left)\n in-parent distances to the parent's content edges (l t r b); sib: gaps to the sibling on each side\n scroll WxH the content (pseudo-elements too) is larger than the box\n 16/24 font size / line height; 'webfont loaded' = drawn with a downloaded font;\n (rendered \"X\") = drawn with another font than declared (a fallback)\n contrast 4.47 WCAG ratio, rounded down, against the background behind the text\n (+N not rendered) children with display: none (or not in the layout)\n hints declarations on this element that have no effect, why, the fix and where they are\n ('none': checked, nothing found)\n \u2190 sel (file:N) --rules: the declaration that sets the value (file:line, or file:line:column in\n minified files); 'over X': rules it beats; '= v': the value of a var() expression\n \u2713 / \u2717 --why: the winning declaration / ones it beats, highest precedence first;\n [0,2,0]: selector specificity (ids, classes, types); indented --name lines: where\n the winner's custom properties are set\nSessions follow the system color scheme; start with --color-scheme light|dark to choose.";
351
+ export declare const INSPECT_OUTPUT_LEGEND = "\nOutput notation:\n WxH @x,y rendered border box size and page position (CSS px, no unit)\n m / p / b margin / padding / border widths, 1-4 values in CSS order (top right bottom left)\n in-parent distances to the parent's content edges (l t r b); sib: gaps to the sibling on each side\n scroll WxH the content (pseudo-elements too) is larger than the box\n 16/24 font size / line height; 'webfont loaded' = drawn with a downloaded font;\n (rendered \"X\") = drawn with another font than declared (a fallback);\n (resolves to \"X\") = the font a generic family (sans-serif, system-ui) became\n contrast 4.47 WCAG ratio, rounded down, against the background behind the text\n text in X the text is drawn by descendant X (the one with most of it): its font, color, contrast\n truncated the text is cut off (overflow clip, ellipsis or line clamp); a \"\u2026\" in the header is\n only bdg shortening the text\n .a.b(+3) the first two classes and how many more the element has\n sizing content-box padding and border add to the CSS size (shown only then; border-box is not)\n (+N not rendered) children with display: none (or not in the layout)\n hints declarations on this element that have no effect, why, the fix and where they are\n ('none': checked, nothing found)\n \u2190 sel (file:N) --rules: the declaration that sets the value (file:line, or file:line:column in\n minified files); 'over X': rules it beats; '= v': the value of a var() expression\n \u2713 / \u2717 --why: the winning declaration / ones it beats, highest precedence first;\n [0,2,0]: selector specificity (ids, classes, types); indented --name lines: where\n the winner's custom properties are set\nSessions follow the system color scheme; start with --color-scheme light|dark to choose.";
256
352
  /**
257
353
  * What covers an element: a cover that paints nothing at that point (a
258
354
  * transparent box over it) does not hide it, but takes its clicks.
@@ -270,14 +366,24 @@ export declare function coverText(cover: string, transparent: boolean | undefine
270
366
  * @returns Note
271
367
  */
272
368
  export declare function inspectCascadeNote(reason: 'timeout' | 'failed'): string;
369
+ /**
370
+ * Note of `bdg dom inspect` when the selector named a pseudo-element: its
371
+ * element is inspected and the pseudo-element is on the `pseudo` line.
372
+ *
373
+ * @param pseudo - `::before` or `::after`
374
+ * @returns Note
375
+ */
376
+ export declare function inspectPseudoOfNote(pseudo: string): string;
273
377
  /**
274
378
  * Header badge of `bdg dom inspect` when the page is shown in its dark theme
275
- * because the session follows the system's dark preference: the colors are
276
- * the dark theme's, not what a light-mode visitor sees.
379
+ * because the session follows the system's dark preference, or because
380
+ * `page emulate` asked for dark: the colors are the dark theme's, not what a
381
+ * light-mode visitor sees.
277
382
  *
383
+ * @param emulated - The dark preference comes from `page emulate --color-scheme dark`
278
384
  * @returns Badge
279
385
  */
280
- export declare function inspectDarkThemeBadge(): string;
386
+ export declare function inspectDarkThemeBadge(emulated?: boolean): string;
281
387
  /**
282
388
  * Header badges of `bdg dom inspect` for what keeps an element from being seen.
283
389
  *
@@ -384,6 +490,16 @@ export declare function dialogConsoleText(dialog: {
384
490
  type: string;
385
491
  message: string;
386
492
  }): string;
493
+ /**
494
+ * How far a pointer action scrolled the page to reach its element.
495
+ *
496
+ * @param scrolledBy - Page scroll (CSS px)
497
+ * @returns e.g. `page down 1240px to reach it`, `page right 300px, up 80px to reach it`
498
+ */
499
+ export declare function pointerScrollText(scrolledBy: {
500
+ x: number;
501
+ y: number;
502
+ }): string;
387
503
  /** Headline of each pointer action, e.g. "Element Double-clicked" */
388
504
  export declare const POINTER_ACTION_DONE: {
389
505
  readonly click: "Clicked";
@@ -535,16 +651,29 @@ export declare function elementTextLine(text: string): string;
535
651
  *
536
652
  * @param children - First child elements, e.g. `iframe#app`
537
653
  * @param count - Number of child elements
538
- * @returns e.g. `No text; holds 1 element: iframe (see its HTML with --raw)`
654
+ * @param inShadowRoot - The children are those of its shadow root (`--raw` does not show them)
655
+ * @returns e.g. `No text; holds 1 element: iframe (see its HTML with --raw)`,
656
+ * `No text; its shadow root holds 1 element: button "Close" (see it with bdg dom inspect)`
539
657
  */
540
- export declare function emptyElementLine(children: string[], count: number): string;
658
+ export declare function emptyElementLine(children: string[], count: number, inShadowRoot?: boolean): string;
659
+ /**
660
+ * Note on a screenshot scaled down to keep its image token cost bounded.
661
+ *
662
+ * @param originalWidth - Captured width (CSS px)
663
+ * @param originalHeight - Captured height
664
+ * @param width - Image width
665
+ * @param height - Image height
666
+ * @returns e.g. `scaled from 1920×993 to 1568×811; --no-resize for full size`
667
+ */
668
+ export declare function screenshotScaledNote(originalWidth: number, originalHeight: number, width: number, height: number): string;
541
669
  /**
542
670
  * Note on an element screenshot that captured more than the element's border
543
- * box, because content (floats, positioned children) overflows it.
671
+ * box, because content (floats, positioned children, text, shadows) overflows it.
544
672
  *
545
673
  * @param box - Border box
546
674
  * @param captured - Area captured
547
- * @returns e.g. `grown from 940×37 to 940×285 to include content overflowing the element`
675
+ * @param padding - `--padding` (px), which is not the element's own
676
+ * @returns e.g. `grown from 940×37 to 940×285 to include what it paints outside its box (…)`
548
677
  */
549
678
  export declare function screenshotGrownNote(box: {
550
679
  width: number;
@@ -552,7 +681,7 @@ export declare function screenshotGrownNote(box: {
552
681
  }, captured: {
553
682
  width: number;
554
683
  height: number;
555
- }): string;
684
+ }, padding?: number): string;
556
685
  /**
557
686
  * Next commands after `bdg dom query`, by index so they reach matches in
558
687
  * shadow roots and iframes too.
@@ -568,6 +697,23 @@ export declare function queryNextSteps(index: number): string;
568
697
  * @returns e.g. `Frame: https://pay.example/`
569
698
  */
570
699
  export declare function evalFrameLine(url: string): string;
700
+ /**
701
+ * Warning on a `dom eval` result the browser copied because the page
702
+ * replaced built-ins bdg's own copy uses.
703
+ *
704
+ * @param replaced - Their dotted names (all are named)
705
+ * @returns e.g. `the page replaced Object.keys, so the browser copied the result: undefined, NaN, functions, DOM nodes, dates, maps and sets inside it show as null or {}`
706
+ */
707
+ export declare function evalCopiedByBrowserWarning(replaced: readonly string[]): string;
708
+ /**
709
+ * Warning on a `dom eval` result shown as its preview: the page replaced
710
+ * built-ins bdg's copy uses and the browser could not copy it either (a
711
+ * cycle or a BigInt inside).
712
+ *
713
+ * @param replaced - Their dotted names (all are named)
714
+ * @returns Warning that the value is a shortened preview
715
+ */
716
+ export declare function evalPreviewWarning(replaced: readonly string[]): string;
571
717
  /**
572
718
  * Generate warning message.
573
719
  *
@@ -655,6 +801,7 @@ export declare function pageEmulationLines(result: {
655
801
  viewport?: {
656
802
  width: number;
657
803
  height: number;
804
+ mobile?: boolean;
658
805
  };
659
806
  colorScheme?: string;
660
807
  };
@@ -678,5 +825,15 @@ export declare function inspectAnimatingBadge(animating: readonly string[]): str
678
825
  * @returns Note
679
826
  */
680
827
  export declare function inspectMidTransitionNote(): string;
828
+ /** Examples under `bdg dom audit --help` */
829
+ export declare const AUDIT_HELP_EXAMPLES = "\nExamples:\n bdg dom audit All checks\n bdg dom audit contrast --level AAA Text below WCAG AAA, weakest first\n bdg dom audit overflow What scrolls sideways, cut-off text, scaled images\n bdg dom audit layers animations Fixed/sticky elements and running animations\n\nFollow up on a finding with bdg dom inspect <element> (e.g. --why color).";
830
+ /** Examples under `bdg css search --help` */
831
+ export declare const CSS_SEARCH_HELP_EXAMPLES = "\nExamples:\n bdg css search -- --brand Where a custom property is set and used (-- before a text\n that starts with -; options go before it:\n bdg css search --limit 50 -- --brand)\n bdg css search \"oklch(\" Rules that use oklch colors\n bdg css search \".btn-primary\" Rules of a class, in every stylesheet";
832
+ /**
833
+ * `details` field of `bdg --help --json`: where the full help is.
834
+ *
835
+ * @returns Note
836
+ */
837
+ export declare function helpJsonDetailsNote(): string;
681
838
  export {};
682
839
  //# sourceMappingURL=commands.d.ts.map
@@ -26,6 +26,15 @@ export function chromeClosedMessage(pid) {
26
26
  export function orphanedDaemonsCleanedMessage(count) {
27
27
  return `Cleaned up ${count} orphaned daemon process${count === 1 ? '' : 'es'}`;
28
28
  }
29
+ /**
30
+ * Where `bdg install-skill` kept the copy it replaced.
31
+ *
32
+ * @param path - Backup path, as the user would type it
33
+ * @returns One line
34
+ */
35
+ export function skillBackupMessage(path) {
36
+ return `previous copy kept in ${path}`;
37
+ }
29
38
  /**
30
39
  * Warning shown when a click falls back from mouse events to `el.click()`.
31
40
  *
@@ -136,6 +145,19 @@ export function pageNavigationText(navigation) {
136
145
  const status = navigation.status === undefined ? '' : ` (${navigation.status})`;
137
146
  return `navigated to ${navigation.url}${status}`;
138
147
  }
148
+ /**
149
+ * Last `New text:` row when an action made more messages appear than are listed.
150
+ *
151
+ * @param count - Messages not listed
152
+ * @returns e.g. `(+4 more)`
153
+ */
154
+ export function moreMessagesText(count) {
155
+ return `(+${count} more)`;
156
+ }
157
+ /** Result line of `bdg dom hover --off` */
158
+ export const HOVER_OFF_DONE = '✓ Mouse moved off the page (hover styles and menus that close on mouseleave are gone)';
159
+ /** How `bdg dom hover` is called */
160
+ export const HOVER_USAGE = 'bdg dom hover <selector|index>, or bdg dom hover --off to move the mouse away';
139
161
  /**
140
162
  * A message an action made appear, for its `New text:` rows.
141
163
  *
@@ -182,6 +204,27 @@ export function moreMatchesNote(hidden, jsonLimit) {
182
204
  const where = jsonLimit === undefined ? 'use --json for all' : `--json lists the first ${jsonLimit}`;
183
205
  return `... and ${hidden} more (${where})`;
184
206
  }
207
+ /**
208
+ * Note under `dom query` matches cut by `--limit`.
209
+ *
210
+ * @param omitted - Matches not listed
211
+ * @param indexed - Matches usable by index, when not all of them
212
+ * @returns e.g. `... and 49953 more (--limit 0 lists all; indices 0-999 work with other commands)`
213
+ */
214
+ export function queryMoreMatchesNote(omitted, indexed) {
215
+ const indices = indexed === undefined ? '' : `; indices 0-${indexed - 1} work with other commands`;
216
+ return `... and ${omitted} more (--limit 0 lists all${indices})`;
217
+ }
218
+ /**
219
+ * Note under `dom query` matches listed past those whose viewport position
220
+ * was checked.
221
+ *
222
+ * @param checked - First matches checked
223
+ * @returns e.g. `Visibility is checked for the first 100 matches only; bdg dom layout <index> checks any of them`
224
+ */
225
+ export function queryViewportCheckedNote(checked) {
226
+ return `Visibility is checked for the first ${checked} matches only; ${sessionCommand('bdg dom layout <index>')} checks any of them`;
227
+ }
185
228
  /**
186
229
  * Note under a list of a11y query matches cut by `--limit`.
187
230
  *
@@ -240,6 +283,37 @@ export const LAYOUT_REASONS = {
240
283
  /** Joins an invisible reason to the ancestor causing it */
241
284
  on: ' on ',
242
285
  };
286
+ /** Why an out-of-view text's contrast in `dom audit` is approximate: none of its ancestors paints a background */
287
+ export const AUDIT_OUT_OF_VIEW_RISK = 'only its ancestors were checked';
288
+ /**
289
+ * `dom audit contrast` note for text that looks below the level but cannot
290
+ * be measured exactly (over an image, blended, under or over another layer).
291
+ *
292
+ * @param count - How many such texts
293
+ * @returns e.g. `(+12 more may be below it but cannot be measured: text over images or blended layers; check them with bdg dom inspect)`
294
+ */
295
+ export function auditUncertainContrastNote(count) {
296
+ return `(+${count} more may be below it but cannot be measured: text over images or blended layers; check them with ${sessionCommand('bdg dom inspect <element>')})`;
297
+ }
298
+ /**
299
+ * `dom audit animations` note for canvas elements, whose script-drawn
300
+ * animations it cannot see.
301
+ *
302
+ * @param count - Visible canvas elements
303
+ * @returns e.g. `(+ 2 canvas elements: animations drawn by scripts on them are not listed)`
304
+ */
305
+ export function auditCanvasNote(count) {
306
+ return `(+ ${count} canvas ${count === 1 ? 'element' : 'elements'}: animations drawn by scripts on ${count === 1 ? 'it are' : 'them are'} not listed)`;
307
+ }
308
+ /**
309
+ * A mask over an element, for `dom layout` and `dom inspect`.
310
+ *
311
+ * @param masked - The mask, e.g. `mask-image on div.hero`
312
+ * @returns e.g. `masked by mask-image on div.hero`
313
+ */
314
+ export function maskedText(masked) {
315
+ return `masked by ${masked}`;
316
+ }
243
317
  /** Start of the off-screen reason of an element a scroll-locked page hides ({@link scrollLockedReason}) */
244
318
  const SCROLL_LOCKED_PREFIX = 'page scrolling is locked';
245
319
  /**
@@ -378,16 +452,63 @@ export function colorSchemeLabel(scheme, emulated) {
378
452
  const source = emulated ? 'emulated' : 'from the system setting';
379
453
  return `prefers-color-scheme: ${scheme} (${source})`;
380
454
  }
455
+ /**
456
+ * Suggestion for an action that failed on a page that replaced built-ins
457
+ * bdg's page scripts use.
458
+ *
459
+ * @param replaced - Their dotted names (all are named)
460
+ * @returns Suggestion naming them and a way around
461
+ */
462
+ export function brokenByReplacedBuiltinsSuggestion(replaced) {
463
+ return `The page replaced built-ins bdg's action script uses (${replaced.join(', ')}), which may have broken it; if so, act on the element with ${sessionCommand("bdg dom eval '…'")} instead`;
464
+ }
465
+ /**
466
+ * Warning on an action when the page replaced built-ins bdg's page scripts
467
+ * use (polyfills, old frameworks, anti-bot scripts). Names the first four;
468
+ * the action's `replacedBuiltins` (JSON) lists them all.
469
+ *
470
+ * @param replaced - Their dotted names
471
+ * @returns e.g. `the page replaced built-ins bdg's scripts use (Element.prototype.querySelectorAll); bdg found the element in its own world, but the action runs in the page's and may misbehave`
472
+ */
473
+ export function replacedBuiltinsWarning(replaced) {
474
+ const shown = replaced.slice(0, 4).join(', ') +
475
+ (replaced.length > 4 ? `, +${replaced.length - 4} more (see --json)` : '');
476
+ return `the page replaced built-ins bdg's scripts use (${shown}); bdg found the element in its own world, but the action runs in the page's and may misbehave`;
477
+ }
381
478
  /**
382
479
  * First line of `bdg status` for a running session.
383
480
  *
384
- * @param page - URL and title of the page, when the session reported them
385
- * @returns e.g. `Session active: https://example.com/ — Example Domain`
481
+ * @param page - URL and title of the page, when the session reported them,
482
+ * and when it crashed
483
+ * @returns e.g. `Session active: https://example.com/ — Example Domain`, with
484
+ * a crash warning on a second line
386
485
  */
387
486
  export function sessionActiveLine(page) {
388
487
  if (!page)
389
488
  return 'Session active';
390
- return `Session active: ${page.url}${page.title ? ` — ${page.title}` : ''}`;
489
+ const line = `Session active: ${page.url}${page.title ? ` — ${page.title}` : ''}`;
490
+ return page.crashedAt === undefined ? line : `${line}\n${pageCrashedNote(page.crashedAt)}`;
491
+ }
492
+ /**
493
+ * Warning that the session's page crashed, for `bdg status`, `bdg peek`,
494
+ * `bdg console` and `bdg network list`.
495
+ *
496
+ * @param crashedAt - When it crashed (epoch ms)
497
+ * @returns e.g. `⚠ The page crashed at 18:42:10 (renderer gone); bdg page reload brings it back`
498
+ */
499
+ export function pageCrashedNote(crashedAt) {
500
+ return `⚠ The page crashed at ${new Date(crashedAt).toLocaleTimeString()} (renderer gone); ${sessionCommand('bdg page reload')} brings it back`;
501
+ }
502
+ /**
503
+ * Put the page-crashed warning before a view of collected data, when the
504
+ * page crashed (what is shown was collected before).
505
+ *
506
+ * @param body - The view
507
+ * @param crashedAt - When the page crashed (epoch ms), if it did
508
+ * @returns The view, after the warning when the page crashed
509
+ */
510
+ export function withPageCrashedNote(body, crashedAt) {
511
+ return crashedAt === undefined ? body : `${pageCrashedNote(crashedAt)}\n\n${body}`;
391
512
  }
392
513
  /**
393
514
  * Page dimensions line of `bdg dom layout`.
@@ -432,8 +553,14 @@ Output notation:
432
553
  in-parent distances to the parent's content edges (l t r b); sib: gaps to the sibling on each side
433
554
  scroll WxH the content (pseudo-elements too) is larger than the box
434
555
  16/24 font size / line height; 'webfont loaded' = drawn with a downloaded font;
435
- (rendered "X") = drawn with another font than declared (a fallback)
556
+ (rendered "X") = drawn with another font than declared (a fallback);
557
+ (resolves to "X") = the font a generic family (sans-serif, system-ui) became
436
558
  contrast 4.47 WCAG ratio, rounded down, against the background behind the text
559
+ text in X the text is drawn by descendant X (the one with most of it): its font, color, contrast
560
+ truncated the text is cut off (overflow clip, ellipsis or line clamp); a "…" in the header is
561
+ only bdg shortening the text
562
+ .a.b(+3) the first two classes and how many more the element has
563
+ sizing content-box padding and border add to the CSS size (shown only then; border-box is not)
437
564
  (+N not rendered) children with display: none (or not in the layout)
438
565
  hints declarations on this element that have no effect, why, the fix and where they are
439
566
  ('none': checked, nothing found)
@@ -466,15 +593,29 @@ export function inspectCascadeNote(reason) {
466
593
  ? "CSS rules not read: the page's stylesheets took too long (hints wait 1 s; --rules and --why 5 s)"
467
594
  : 'CSS rules not read: Chrome could not report the rules matching this element';
468
595
  }
596
+ /**
597
+ * Note of `bdg dom inspect` when the selector named a pseudo-element: its
598
+ * element is inspected and the pseudo-element is on the `pseudo` line.
599
+ *
600
+ * @param pseudo - `::before` or `::after`
601
+ * @returns Note
602
+ */
603
+ export function inspectPseudoOfNote(pseudo) {
604
+ return `Inspected the element of ${pseudo}: pseudo-elements cannot be selected; ${pseudo} is on the pseudo line (content, size, position, inset, colors)`;
605
+ }
469
606
  /**
470
607
  * Header badge of `bdg dom inspect` when the page is shown in its dark theme
471
- * because the session follows the system's dark preference: the colors are
472
- * the dark theme's, not what a light-mode visitor sees.
608
+ * because the session follows the system's dark preference, or because
609
+ * `page emulate` asked for dark: the colors are the dark theme's, not what a
610
+ * light-mode visitor sees.
473
611
  *
612
+ * @param emulated - The dark preference comes from `page emulate --color-scheme dark`
474
613
  * @returns Badge
475
614
  */
476
- export function inspectDarkThemeBadge() {
477
- return '[dark theme from system; --color-scheme light for light]';
615
+ export function inspectDarkThemeBadge(emulated = false) {
616
+ return emulated
617
+ ? '[dark theme, emulated; bdg page emulate --color-scheme light for light]'
618
+ : '[dark theme from system; --color-scheme light for light]';
478
619
  }
479
620
  /**
480
621
  * Header badges of `bdg dom inspect` for what keeps an element from being seen.
@@ -491,6 +632,7 @@ export function inspectVisibilityBadges(visibility) {
491
632
  visibility.hidden && `[hidden: ${visibility.hidden}]`,
492
633
  visibility.offscreen && `[offscreen: ${visibility.offscreen}]`,
493
634
  visibility.coveredBy && `[${coverText(visibility.coveredBy, visibility.coverTransparent)}]`,
635
+ visibility.masked && `[${maskedText(visibility.masked)}]`,
494
636
  ].filter((badge) => Boolean(badge));
495
637
  }
496
638
  /**
@@ -641,6 +783,19 @@ export function dialogConsoleText(dialog) {
641
783
  const kind = dialog.type === 'beforeunload' ? 'beforeunload' : `${dialog.type}()`;
642
784
  return `${kind} dialog accepted${dialog.message ? `: "${dialog.message}"` : ''}`;
643
785
  }
786
+ /**
787
+ * How far a pointer action scrolled the page to reach its element.
788
+ *
789
+ * @param scrolledBy - Page scroll (CSS px)
790
+ * @returns e.g. `page down 1240px to reach it`, `page right 300px, up 80px to reach it`
791
+ */
792
+ export function pointerScrollText(scrolledBy) {
793
+ const parts = [
794
+ scrolledBy.y !== 0 && `${scrolledBy.y > 0 ? 'down' : 'up'} ${Math.abs(scrolledBy.y)}px`,
795
+ scrolledBy.x !== 0 && `${scrolledBy.x > 0 ? 'right' : 'left'} ${Math.abs(scrolledBy.x)}px`,
796
+ ].filter(Boolean);
797
+ return `page ${parts.join(', ')} to reach it`;
798
+ }
644
799
  /** Headline of each pointer action, e.g. "Element Double-clicked" */
645
800
  export const POINTER_ACTION_DONE = {
646
801
  click: 'Clicked',
@@ -879,24 +1034,47 @@ export function elementTextLine(text) {
879
1034
  *
880
1035
  * @param children - First child elements, e.g. `iframe#app`
881
1036
  * @param count - Number of child elements
882
- * @returns e.g. `No text; holds 1 element: iframe (see its HTML with --raw)`
1037
+ * @param inShadowRoot - The children are those of its shadow root (`--raw` does not show them)
1038
+ * @returns e.g. `No text; holds 1 element: iframe (see its HTML with --raw)`,
1039
+ * `No text; its shadow root holds 1 element: button "Close" (see it with bdg dom inspect)`
883
1040
  */
884
- export function emptyElementLine(children, count) {
1041
+ export function emptyElementLine(children, count, inShadowRoot = false) {
1042
+ const holder = inShadowRoot ? 'its shadow root holds' : 'holds';
885
1043
  if (count === 0)
886
- return 'No text and no child elements';
1044
+ return `No text and no child elements${inShadowRoot ? ' in its shadow root' : ''}`;
887
1045
  const more = count > children.length ? `, … ${count - children.length} more` : '';
888
- return `No text; holds ${pluralize(count, 'element')}: ${children.join(', ')}${more} (see its HTML with --raw)`;
1046
+ const hint = inShadowRoot ? 'see it with bdg dom inspect' : 'see its HTML with --raw';
1047
+ return `No text; ${holder} ${pluralize(count, 'element')}: ${children.join(', ')}${more} (${hint})`;
1048
+ }
1049
+ /**
1050
+ * Note on a screenshot scaled down to keep its image token cost bounded.
1051
+ *
1052
+ * @param originalWidth - Captured width (CSS px)
1053
+ * @param originalHeight - Captured height
1054
+ * @param width - Image width
1055
+ * @param height - Image height
1056
+ * @returns e.g. `scaled from 1920×993 to 1568×811; --no-resize for full size`
1057
+ */
1058
+ export function screenshotScaledNote(originalWidth, originalHeight, width, height) {
1059
+ return `scaled from ${originalWidth}×${originalHeight} to ${width}×${height}; --no-resize for full size`;
889
1060
  }
890
1061
  /**
891
1062
  * Note on an element screenshot that captured more than the element's border
892
- * box, because content (floats, positioned children) overflows it.
1063
+ * box, because content (floats, positioned children, text, shadows) overflows it.
893
1064
  *
894
1065
  * @param box - Border box
895
1066
  * @param captured - Area captured
896
- * @returns e.g. `grown from 940×37 to 940×285 to include content overflowing the element`
1067
+ * @param padding - `--padding` (px), which is not the element's own
1068
+ * @returns e.g. `grown from 940×37 to 940×285 to include what it paints outside its box (…)`
897
1069
  */
898
- export function screenshotGrownNote(box, captured) {
899
- return `grown from ${box.width}×${box.height} to ${captured.width}×${captured.height} to include content overflowing the element`;
1070
+ export function screenshotGrownNote(box, captured, padding = 0) {
1071
+ const painted = { width: captured.width - 2 * padding, height: captured.height - 2 * padding };
1072
+ const grew = painted.width > box.width + 0.5 || painted.height > box.height + 0.5;
1073
+ const ink = `grown from ${box.width}×${box.height} to ${painted.width}×${painted.height} to include what it paints outside its box (overflowing content, shadows, outline)`;
1074
+ const pad = `${padding}px of page around it (--padding)`;
1075
+ if (!padding)
1076
+ return ink;
1077
+ return grew ? `${ink}, plus ${pad}` : `with ${pad}: ${captured.width}×${captured.height}`;
900
1078
  }
901
1079
  /**
902
1080
  * Next commands after `bdg dom query`, by index so they reach matches in
@@ -917,6 +1095,27 @@ export function queryNextSteps(index) {
917
1095
  export function evalFrameLine(url) {
918
1096
  return `Frame: ${frameUrlLabel(url)}`;
919
1097
  }
1098
+ /**
1099
+ * Warning on a `dom eval` result the browser copied because the page
1100
+ * replaced built-ins bdg's own copy uses.
1101
+ *
1102
+ * @param replaced - Their dotted names (all are named)
1103
+ * @returns e.g. `the page replaced Object.keys, so the browser copied the result: undefined, NaN, functions, DOM nodes, dates, maps and sets inside it show as null or {}`
1104
+ */
1105
+ export function evalCopiedByBrowserWarning(replaced) {
1106
+ return `the page replaced ${replaced.join(', ')}, so the browser copied the result: undefined, NaN, functions, DOM nodes, dates, maps and sets inside it show as null or {}`;
1107
+ }
1108
+ /**
1109
+ * Warning on a `dom eval` result shown as its preview: the page replaced
1110
+ * built-ins bdg's copy uses and the browser could not copy it either (a
1111
+ * cycle or a BigInt inside).
1112
+ *
1113
+ * @param replaced - Their dotted names (all are named)
1114
+ * @returns Warning that the value is a shortened preview
1115
+ */
1116
+ export function evalPreviewWarning(replaced) {
1117
+ return `the page replaced ${replaced.join(', ')}, and the result could not be copied (it holds a cycle or a BigInt), so it is shown as a shortened preview string; return a JSON-safe value (e.g. pick the fields you need)`;
1118
+ }
920
1119
  /**
921
1120
  * Generate warning message.
922
1121
  *
@@ -1010,7 +1209,7 @@ export function startCommandHelpMessage() {
1010
1209
  export function pageEmulateNothingError() {
1011
1210
  return {
1012
1211
  message: 'Nothing to emulate',
1013
- suggestion: 'Give --viewport <WxH>, --color-scheme light|dark, or --reset, e.g. bdg page emulate --viewport 900x700',
1212
+ suggestion: 'Give --viewport <WxH>, --mobile, --color-scheme light|dark, or --reset, e.g. bdg page emulate --viewport 900x700',
1014
1213
  };
1015
1214
  }
1016
1215
  /**
@@ -1022,8 +1221,11 @@ export function pageEmulateNothingError() {
1022
1221
  export function pageEmulationLines(result) {
1023
1222
  const size = (v) => `${v.width}x${v.height}`;
1024
1223
  const { emulated } = result;
1224
+ const phone = emulated.viewport?.mobile
1225
+ ? ' (phone: mobile layout, touch, mobile user agent)'
1226
+ : '';
1025
1227
  return [
1026
- ['Viewport', emulated.viewport ? size(emulated.viewport) : 'the browser window'],
1228
+ ['Viewport', emulated.viewport ? `${size(emulated.viewport)}${phone}` : 'the browser window'],
1027
1229
  ...(result.viewport
1028
1230
  ? [['Layout', `${size(result.viewport)} (without scrollbars)`]]
1029
1231
  : []),
@@ -1052,4 +1254,29 @@ export function inspectAnimatingBadge(animating) {
1052
1254
  export function inspectMidTransitionNote() {
1053
1255
  return '(mid-transition: inspect again for the final value)';
1054
1256
  }
1257
+ /** Examples under `bdg dom audit --help` */
1258
+ export const AUDIT_HELP_EXAMPLES = `
1259
+ Examples:
1260
+ bdg dom audit All checks
1261
+ bdg dom audit contrast --level AAA Text below WCAG AAA, weakest first
1262
+ bdg dom audit overflow What scrolls sideways, cut-off text, scaled images
1263
+ bdg dom audit layers animations Fixed/sticky elements and running animations
1264
+
1265
+ Follow up on a finding with bdg dom inspect <element> (e.g. --why color).`;
1266
+ /** Examples under `bdg css search --help` */
1267
+ export const CSS_SEARCH_HELP_EXAMPLES = `
1268
+ Examples:
1269
+ bdg css search -- --brand Where a custom property is set and used (-- before a text
1270
+ that starts with -; options go before it:
1271
+ bdg css search --limit 50 -- --brand)
1272
+ bdg css search "oklch(" Rules that use oklch colors
1273
+ bdg css search ".btn-primary" Rules of a class, in every stylesheet`;
1274
+ /**
1275
+ * `details` field of `bdg --help --json`: where the full help is.
1276
+ *
1277
+ * @returns Note
1278
+ */
1279
+ export function helpJsonDetailsNote() {
1280
+ return 'Option behaviors, defaults, choices and examples: bdg <command> --help --json (e.g. bdg dom query --help --json). Everything at once: bdg --help --json --full';
1281
+ }
1055
1282
  //# sourceMappingURL=commands.js.map