@reticlehq/browser 2.0.1 → 2.2.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/NOTICE +5 -0
- package/dist/actions/actions-dom.d.ts.map +1 -1
- package/dist/actions/actions-dom.js +3 -20
- package/dist/actions/actions-dom.js.map +1 -1
- package/dist/actions/actions.d.ts +1 -1
- package/dist/actions/actions.d.ts.map +1 -1
- package/dist/actions/actions.js +37 -19
- package/dist/actions/actions.js.map +1 -1
- package/dist/commands/commands.d.ts +2 -0
- package/dist/commands/commands.d.ts.map +1 -1
- package/dist/commands/commands.js +30 -31
- package/dist/commands/commands.js.map +1 -1
- package/dist/dom/a11y.d.ts +17 -6
- package/dist/dom/a11y.d.ts.map +1 -1
- package/dist/dom/a11y.js +68 -32
- package/dist/dom/a11y.js.map +1 -1
- package/dist/dom/auto-anchor.d.ts +10 -10
- package/dist/dom/auto-anchor.js +10 -10
- package/dist/dom/blind-spots.d.ts +14 -0
- package/dist/dom/blind-spots.d.ts.map +1 -0
- package/dist/dom/blind-spots.js +30 -0
- package/dist/dom/blind-spots.js.map +1 -0
- package/dist/dom/chart.d.ts +93 -0
- package/dist/dom/chart.d.ts.map +1 -0
- package/dist/dom/chart.js +119 -0
- package/dist/dom/chart.js.map +1 -0
- package/dist/dom/dom-ignore.d.ts +2 -0
- package/dist/dom/dom-ignore.d.ts.map +1 -1
- package/dist/dom/dom-ignore.js +17 -2
- package/dist/dom/dom-ignore.js.map +1 -1
- package/dist/dom/occlusion.d.ts +9 -0
- package/dist/dom/occlusion.d.ts.map +1 -0
- package/dist/dom/occlusion.js +21 -0
- package/dist/dom/occlusion.js.map +1 -0
- package/dist/dom/query.d.ts +17 -4
- package/dist/dom/query.d.ts.map +1 -1
- package/dist/dom/query.js +185 -30
- package/dist/dom/query.js.map +1 -1
- package/dist/dom/refs.d.ts +26 -3
- package/dist/dom/refs.d.ts.map +1 -1
- package/dist/dom/refs.js +79 -4
- package/dist/dom/refs.js.map +1 -1
- package/dist/dom/snapshot.d.ts +7 -1
- package/dist/dom/snapshot.d.ts.map +1 -1
- package/dist/dom/snapshot.js +43 -16
- package/dist/dom/snapshot.js.map +1 -1
- package/dist/dom/source.d.ts +40 -0
- package/dist/dom/source.d.ts.map +1 -0
- package/dist/dom/source.js +59 -0
- package/dist/dom/source.js.map +1 -0
- package/dist/dom/theme.js +2 -2
- package/dist/dom/theme.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/observers/animation.d.ts +1 -1
- package/dist/observers/animation.d.ts.map +1 -1
- package/dist/observers/animation.js +1 -1
- package/dist/observers/animation.js.map +1 -1
- package/dist/observers/blind-spots.d.ts +19 -0
- package/dist/observers/blind-spots.d.ts.map +1 -0
- package/dist/observers/blind-spots.js +89 -0
- package/dist/observers/blind-spots.js.map +1 -0
- package/dist/observers/console.d.ts.map +1 -1
- package/dist/observers/console.js +39 -6
- package/dist/observers/console.js.map +1 -1
- package/dist/observers/dom.d.ts +1 -1
- package/dist/observers/dom.d.ts.map +1 -1
- package/dist/observers/dom.js +69 -10
- package/dist/observers/dom.js.map +1 -1
- package/dist/observers/focus.d.ts +10 -0
- package/dist/observers/focus.d.ts.map +1 -0
- package/dist/observers/focus.js +49 -0
- package/dist/observers/focus.js.map +1 -0
- package/dist/observers/network-body.d.ts +19 -0
- package/dist/observers/network-body.d.ts.map +1 -0
- package/dist/observers/network-body.js +143 -0
- package/dist/observers/network-body.js.map +1 -0
- package/dist/observers/network-redact.d.ts +8 -0
- package/dist/observers/network-redact.d.ts.map +1 -0
- package/dist/observers/network-redact.js +66 -0
- package/dist/observers/network-redact.js.map +1 -0
- package/dist/observers/network.d.ts +19 -7
- package/dist/observers/network.d.ts.map +1 -1
- package/dist/observers/network.js +439 -53
- package/dist/observers/network.js.map +1 -1
- package/dist/observers/perf.d.ts +13 -0
- package/dist/observers/perf.d.ts.map +1 -0
- package/dist/observers/perf.js +62 -0
- package/dist/observers/perf.js.map +1 -0
- package/dist/observers/route.d.ts.map +1 -1
- package/dist/observers/route.js +19 -10
- package/dist/observers/route.js.map +1 -1
- package/dist/observers/scroll.d.ts +1 -1
- package/dist/observers/scroll.d.ts.map +1 -1
- package/dist/observers/scroll.js +36 -9
- package/dist/observers/scroll.js.map +1 -1
- package/dist/observers/state.d.ts +20 -0
- package/dist/observers/state.d.ts.map +1 -0
- package/dist/observers/state.js +87 -0
- package/dist/observers/state.js.map +1 -0
- package/dist/observers/storage.d.ts +23 -0
- package/dist/observers/storage.d.ts.map +1 -0
- package/dist/observers/storage.js +177 -0
- package/dist/observers/storage.js.map +1 -0
- package/dist/observers/types.d.ts +15 -0
- package/dist/observers/types.d.ts.map +1 -1
- package/dist/observers/types.js +29 -1
- package/dist/observers/types.js.map +1 -1
- package/dist/patching/capture-method.d.ts +27 -0
- package/dist/patching/capture-method.d.ts.map +1 -0
- package/dist/patching/capture-method.js +37 -0
- package/dist/patching/capture-method.js.map +1 -0
- package/dist/presenter/presenter-config.d.ts +3 -3
- package/dist/presenter/presenter-config.d.ts.map +1 -1
- package/dist/presenter/presenter-config.js +3 -3
- package/dist/presenter/presenter-config.js.map +1 -1
- package/dist/presenter/presenter-controls.d.ts +1 -1
- package/dist/presenter/presenter-controls.d.ts.map +1 -1
- package/dist/presenter/presenter-controls.js +3 -3
- package/dist/presenter/presenter-controls.js.map +1 -1
- package/dist/presenter/presenter-glow.d.ts +1 -1
- package/dist/presenter/presenter-glow.js +1 -1
- package/dist/presenter/presenter-styles.d.ts +1 -1
- package/dist/presenter/presenter-styles.d.ts.map +1 -1
- package/dist/presenter/presenter-styles.js +12 -3
- package/dist/presenter/presenter-styles.js.map +1 -1
- package/dist/presenter/presenter-test-helpers.d.ts +16 -0
- package/dist/presenter/presenter-test-helpers.d.ts.map +1 -0
- package/dist/presenter/presenter-test-helpers.js +42 -0
- package/dist/presenter/presenter-test-helpers.js.map +1 -0
- package/dist/presenter/presenter.d.ts +4 -6
- package/dist/presenter/presenter.d.ts.map +1 -1
- package/dist/presenter/presenter.js +5 -9
- package/dist/presenter/presenter.js.map +1 -1
- package/dist/recorder/recorder.d.ts +8 -8
- package/dist/recorder/recorder.d.ts.map +1 -1
- package/dist/recorder/recorder.js +22 -9
- package/dist/recorder/recorder.js.map +1 -1
- package/dist/registry/capabilities.d.ts +2 -2
- package/dist/registry/capabilities.d.ts.map +1 -1
- package/dist/registry/capabilities.js +1 -1
- package/dist/registry/capabilities.js.map +1 -1
- package/dist/registry/domains.d.ts +1 -1
- package/dist/registry/domains.js +1 -1
- package/dist/registry/emitter.d.ts +2 -2
- package/dist/registry/emitter.js +2 -2
- package/dist/registry/store-adapters.d.ts +128 -0
- package/dist/registry/store-adapters.d.ts.map +1 -0
- package/dist/registry/store-adapters.js +135 -0
- package/dist/registry/store-adapters.js.map +1 -0
- package/dist/registry/stores.d.ts +45 -3
- package/dist/registry/stores.d.ts.map +1 -1
- package/dist/registry/stores.js +121 -8
- package/dist/registry/stores.js.map +1 -1
- package/dist/reticle.d.ts +28 -4
- package/dist/reticle.d.ts.map +1 -1
- package/dist/reticle.js +83 -15
- package/dist/reticle.js.map +1 -1
- package/dist/review/annotator.d.ts.map +1 -1
- package/dist/review/annotator.js +4 -2
- package/dist/review/annotator.js.map +1 -1
- package/dist/review/mark-anchor.d.ts.map +1 -1
- package/dist/review/mark-anchor.js +1 -21
- package/dist/review/mark-anchor.js.map +1 -1
- package/dist/security/serialization.d.ts +29 -1
- package/dist/security/serialization.d.ts.map +1 -1
- package/dist/security/serialization.js +172 -20
- package/dist/security/serialization.js.map +1 -1
- package/dist/timers/clock.d.ts +13 -0
- package/dist/timers/clock.d.ts.map +1 -1
- package/dist/timers/clock.js +76 -6
- package/dist/timers/clock.js.map +1 -1
- package/dist/transport/transport.d.ts +1 -1
- package/dist/transport/transport.d.ts.map +1 -1
- package/dist/transport/transport.js +49 -8
- package/dist/transport/transport.js.map +1 -1
- package/package.json +7 -3
package/dist/dom/a11y.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ElementState, REDACTED_VALUE } from '@reticlehq/core';
|
|
2
2
|
import { refs } from './refs.js';
|
|
3
|
+
import { inspectChart } from './chart.js';
|
|
3
4
|
import { isSensitiveKey } from '../security/serialization.js';
|
|
5
|
+
import { formatSource, sourceFromDom } from './source.js';
|
|
4
6
|
/** Roles whose accessible name comes from their text content. */
|
|
5
7
|
const NAME_FROM_CONTENT = new Set([
|
|
6
8
|
'button',
|
|
@@ -154,13 +156,13 @@ function ariaBool(el, attr) {
|
|
|
154
156
|
return undefined;
|
|
155
157
|
return value === 'true';
|
|
156
158
|
}
|
|
157
|
-
/**
|
|
158
|
-
|
|
159
|
+
/**
|
|
160
|
+
* The set of states relevant to assertions. `visible` is an O(depth) forced-style walk; callers that
|
|
161
|
+
* already computed it (describe) pass it in so it isn't resolved twice per element.
|
|
162
|
+
*/
|
|
163
|
+
export function getStates(el, visible = isVisible(el)) {
|
|
159
164
|
const states = [ElementState.PRESENT];
|
|
160
|
-
|
|
161
|
-
states.push(ElementState.VISIBLE);
|
|
162
|
-
else
|
|
163
|
-
states.push(ElementState.HIDDEN);
|
|
165
|
+
states.push(visible ? ElementState.VISIBLE : ElementState.HIDDEN);
|
|
164
166
|
const disabledProp = (el instanceof HTMLButtonElement ||
|
|
165
167
|
el instanceof HTMLInputElement ||
|
|
166
168
|
el instanceof HTMLSelectElement ||
|
|
@@ -212,52 +214,86 @@ export function getValue(el) {
|
|
|
212
214
|
const valueNow = el.getAttribute('aria-valuenow');
|
|
213
215
|
return valueNow ?? undefined;
|
|
214
216
|
}
|
|
215
|
-
/** Whether the element
|
|
216
|
-
|
|
217
|
-
if (
|
|
218
|
-
return
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
if (style.display === 'none' ||
|
|
229
|
-
style.visibility === 'hidden' ||
|
|
230
|
-
style.visibility === 'collapse') {
|
|
231
|
-
return false;
|
|
232
|
-
}
|
|
233
|
-
if (Number.parseFloat(style.opacity || '1') === 0)
|
|
234
|
-
return false;
|
|
217
|
+
/** Whether the element's OWN box hides it — one forced-style resolution, no ancestor walk. */
|
|
218
|
+
function selfHidden(el) {
|
|
219
|
+
if (el.getAttribute('aria-hidden') === 'true')
|
|
220
|
+
return true;
|
|
221
|
+
if (el instanceof HTMLElement && el.hidden)
|
|
222
|
+
return true;
|
|
223
|
+
const view = el.ownerDocument.defaultView;
|
|
224
|
+
if (view !== null) {
|
|
225
|
+
const style = view.getComputedStyle(el);
|
|
226
|
+
if (style.display === 'none' ||
|
|
227
|
+
style.visibility === 'hidden' ||
|
|
228
|
+
style.visibility === 'collapse') {
|
|
229
|
+
return true;
|
|
235
230
|
}
|
|
236
|
-
|
|
231
|
+
if (Number.parseFloat(style.opacity || '1') === 0)
|
|
232
|
+
return true;
|
|
237
233
|
}
|
|
238
|
-
return
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Whether the element is actually visible (not display:none/hidden/aria-hidden/opacity:0), walking to
|
|
238
|
+
* root. This is an O(depth) forced-style walk PER node; `memo` (optional, scoped to ONE synchronous
|
|
239
|
+
* query pass) caches the full inherited result per element so a broad state-filtered query stops
|
|
240
|
+
* re-resolving getComputedStyle up the same ancestor chain for every sibling. Sound because the DOM is
|
|
241
|
+
* static for the pass's duration — the cache MUST be a per-call Map, never module-level (that would go
|
|
242
|
+
* stale the instant the app mutates, the same trap the shadow-root note in query.ts documents).
|
|
243
|
+
*/
|
|
244
|
+
export function isVisible(el, memo) {
|
|
245
|
+
if (!el.isConnected)
|
|
246
|
+
return false;
|
|
247
|
+
const cached = memo?.get(el);
|
|
248
|
+
if (cached !== undefined)
|
|
249
|
+
return cached;
|
|
250
|
+
const parent = el.parentElement;
|
|
251
|
+
// Each cached boolean already folds in that node's own aria-hidden/[hidden]/display/visibility/opacity,
|
|
252
|
+
// so inherited visibility composes by AND up the chain and a sibling short-circuits at the first
|
|
253
|
+
// cached ancestor.
|
|
254
|
+
const result = !selfHidden(el) && (parent === null || isVisible(parent, memo));
|
|
255
|
+
if (memo !== undefined)
|
|
256
|
+
memo.set(el, result);
|
|
257
|
+
return result;
|
|
239
258
|
}
|
|
240
259
|
const MAX_TEXT = 80;
|
|
241
260
|
function getVisibleText(el) {
|
|
242
261
|
const text = collapse(el.textContent ?? '');
|
|
243
262
|
return text.length > MAX_TEXT ? `${text.slice(0, MAX_TEXT)}…` : text;
|
|
244
263
|
}
|
|
245
|
-
/** Build the compact descriptor surfaced to the agent.
|
|
246
|
-
|
|
264
|
+
/** Build the compact descriptor surfaced to the agent. `memo` (optional) shares the per-call
|
|
265
|
+
* visibility cache with the query's state filter so ancestors aren't re-walked per element. */
|
|
266
|
+
export function describe(el, memo) {
|
|
247
267
|
const value = getValue(el);
|
|
248
268
|
const text = getVisibleText(el);
|
|
249
269
|
const name = getAccessibleName(el);
|
|
270
|
+
const visible = isVisible(el, memo); // O(depth) style walk — computed ONCE and reused by getStates
|
|
250
271
|
const base = {
|
|
251
272
|
ref: refs.refFor(el),
|
|
252
273
|
role: getRole(el),
|
|
253
274
|
name,
|
|
254
|
-
states: getStates(el),
|
|
255
|
-
visible
|
|
275
|
+
states: getStates(el, visible),
|
|
276
|
+
visible,
|
|
256
277
|
};
|
|
257
278
|
if (value !== undefined && value.length > 0)
|
|
258
279
|
base.value = value;
|
|
259
280
|
if (text.length > 0 && text !== name)
|
|
260
281
|
base.text = text;
|
|
282
|
+
// DOM-only lookup on purpose: describe() runs once per matched element, so the adapter's fiber walk
|
|
283
|
+
// would turn a broad query into thousands of tree traversals. The stamped attribute answers the
|
|
284
|
+
// same question for a fraction of the cost, and single-element paths that can afford the better
|
|
285
|
+
// answer (inspect, act, review) use sourceFor() instead.
|
|
286
|
+
const source = formatSource(sourceFromDom(el));
|
|
287
|
+
if (source !== undefined)
|
|
288
|
+
base.source = source;
|
|
289
|
+
// Chart faults, only when there are any. Gated on the element actually containing plot geometry so
|
|
290
|
+
// the common case — every non-chart element on the page — pays one querySelector miss and nothing
|
|
291
|
+
// else, and a HEALTHY chart adds no bytes to the wire either.
|
|
292
|
+
if (el.querySelector('path, polyline, polygon') !== null) {
|
|
293
|
+
const faults = inspectChart(el).findings;
|
|
294
|
+
if (faults.length > 0)
|
|
295
|
+
base.chart = faults;
|
|
296
|
+
}
|
|
261
297
|
return base;
|
|
262
298
|
}
|
|
263
299
|
//# sourceMappingURL=a11y.js.map
|
package/dist/dom/a11y.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"a11y.js","sourceRoot":"","sources":["../../src/dom/a11y.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAA0B,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"a11y.js","sourceRoot":"","sources":["../../src/dom/a11y.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAA0B,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE1D,iEAAiE;AACjE,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,QAAQ;IACR,MAAM;IACN,SAAS;IACT,QAAQ;IACR,UAAU;IACV,MAAM;IACN,cAAc;IACd,WAAW;IACX,KAAK;IACL,UAAU;IACV,kBAAkB;IAClB,eAAe;IACf,UAAU;IACV,UAAU;IAC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AAC,CAAC;IAC/C,IAAI,MAAM,KAAK,SAAS;QAAE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IAC/C,mGAAmG;IACnG,kGAAkG;IAClG,8DAA8D;IAC9D,IAAI,EAAE,CAAC,aAAa,CAAC,yBAAyB,CAAC,KAAK,IAAI,EAAE,CAAC;QACzD,MAAM,MAAM,GAAG,YAAY,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC;QACzC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;YAAE,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;IAC7C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
* adapter, fills it in) and returns the chosen anchor + whether it is stable. No DOM, no fiber here.
|
|
9
9
|
*
|
|
10
10
|
* Priority (most → least durable). Each tier is only used when the one above is unavailable:
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
11
|
+
* 1. testid — explicit, author-chosen, the gold standard. Stable.
|
|
12
|
+
* 2. component@source — component display name + source file:line. Survives text/markup/style
|
|
13
|
+
* changes; uniquely identifies WHERE in the source the element comes from.
|
|
14
|
+
* Stable (a move that changes the source line is a real change worth re-pinning).
|
|
15
|
+
* 3. component+role/name — component name plus role/accessible-name when no source is available.
|
|
16
|
+
* Stable enough: the component identity anchors it, role/name disambiguate.
|
|
17
|
+
* 4. role+name — semantic but content-dependent: an accessible name can change with copy.
|
|
18
|
+
* NOT marked stable (a healed locator could drift to a renamed element).
|
|
19
|
+
* 5. role / position — last resort. NOT stable; surfaced so the element is still addressable, but
|
|
20
|
+
* a flow built on it should be flagged (the recorder marks the step degraded).
|
|
21
21
|
*
|
|
22
22
|
* The point: tiers 1–3 are "stable" (a flow anchored on them can be trusted to re-resolve to the
|
|
23
23
|
* same element); tiers 4–5 are best-effort. Today most elements without a testid fall to role/text
|
package/dist/dom/auto-anchor.js
CHANGED
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
* adapter, fills it in) and returns the chosen anchor + whether it is stable. No DOM, no fiber here.
|
|
9
9
|
*
|
|
10
10
|
* Priority (most → least durable). Each tier is only used when the one above is unavailable:
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
11
|
+
* 1. testid — explicit, author-chosen, the gold standard. Stable.
|
|
12
|
+
* 2. component@source — component display name + source file:line. Survives text/markup/style
|
|
13
|
+
* changes; uniquely identifies WHERE in the source the element comes from.
|
|
14
|
+
* Stable (a move that changes the source line is a real change worth re-pinning).
|
|
15
|
+
* 3. component+role/name — component name plus role/accessible-name when no source is available.
|
|
16
|
+
* Stable enough: the component identity anchors it, role/name disambiguate.
|
|
17
|
+
* 4. role+name — semantic but content-dependent: an accessible name can change with copy.
|
|
18
|
+
* NOT marked stable (a healed locator could drift to a renamed element).
|
|
19
|
+
* 5. role / position — last resort. NOT stable; surfaced so the element is still addressable, but
|
|
20
|
+
* a flow built on it should be flagged (the recorder marks the step degraded).
|
|
21
21
|
*
|
|
22
22
|
* The point: tiers 1–3 are "stable" (a flow anchored on them can be trusted to re-resolve to the
|
|
23
23
|
* same element); tiers 4–5 are best-effort. Today most elements without a testid fall to role/text
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Blind-spot detection, the detectable half). Cross-origin iframes are a real observation gap — the
|
|
3
|
+
* SDK cannot see inside them (same-origin policy). We COUNT them so a result can say "coverage: partial —
|
|
4
|
+
* 2 cross-origin frames unobserved" instead of implying it saw the whole page. Closed shadow roots are a
|
|
5
|
+
* blind spot too, but undetectable by design (element.shadowRoot === null), so they are not counted here.
|
|
6
|
+
*/
|
|
7
|
+
/** Pure: how many frames are cross-origin, given each frame's same-origin flag + whether it has a src. */
|
|
8
|
+
export declare function classifyCrossOriginFrames(frames: ReadonlyArray<{
|
|
9
|
+
sameOrigin: boolean;
|
|
10
|
+
hasSrc: boolean;
|
|
11
|
+
}>): number;
|
|
12
|
+
/** Probe the live document: count iframes whose document is unreachable (cross-origin). */
|
|
13
|
+
export declare function countCrossOriginFrames(): number;
|
|
14
|
+
//# sourceMappingURL=blind-spots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blind-spots.d.ts","sourceRoot":"","sources":["../../src/dom/blind-spots.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,0GAA0G;AAC1G,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,aAAa,CAAC;IAAE,UAAU,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC,GAC9D,MAAM,CAER;AAED,2FAA2F;AAC3F,wBAAgB,sBAAsB,IAAI,MAAM,CAe/C"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Blind-spot detection, the detectable half). Cross-origin iframes are a real observation gap — the
|
|
3
|
+
* SDK cannot see inside them (same-origin policy). We COUNT them so a result can say "coverage: partial —
|
|
4
|
+
* 2 cross-origin frames unobserved" instead of implying it saw the whole page. Closed shadow roots are a
|
|
5
|
+
* blind spot too, but undetectable by design (element.shadowRoot === null), so they are not counted here.
|
|
6
|
+
*/
|
|
7
|
+
/** Pure: how many frames are cross-origin, given each frame's same-origin flag + whether it has a src. */
|
|
8
|
+
export function classifyCrossOriginFrames(frames) {
|
|
9
|
+
return frames.filter((f) => f.hasSrc && !f.sameOrigin).length;
|
|
10
|
+
}
|
|
11
|
+
/** Probe the live document: count iframes whose document is unreachable (cross-origin). */
|
|
12
|
+
export function countCrossOriginFrames() {
|
|
13
|
+
if (typeof document === 'undefined')
|
|
14
|
+
return 0;
|
|
15
|
+
const frames = [];
|
|
16
|
+
for (const frame of document.querySelectorAll('iframe')) {
|
|
17
|
+
const hasSrc = frame.getAttribute('src') !== null && frame.getAttribute('src') !== '';
|
|
18
|
+
let sameOrigin = true;
|
|
19
|
+
try {
|
|
20
|
+
// Reaching contentDocument throws (or yields null) for a cross-origin frame.
|
|
21
|
+
sameOrigin = frame.contentDocument !== null;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
sameOrigin = false;
|
|
25
|
+
}
|
|
26
|
+
frames.push({ sameOrigin, hasSrc });
|
|
27
|
+
}
|
|
28
|
+
return classifyCrossOriginFrames(frames);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=blind-spots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blind-spots.js","sourceRoot":"","sources":["../../src/dom/blind-spots.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,0GAA0G;AAC1G,MAAM,UAAU,yBAAyB,CACvC,MAA+D;IAE/D,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC;AAChE,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,sBAAsB;IACpC,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAoD,EAAE,CAAC;IACnE,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxD,MAAM,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACtF,IAAI,UAAU,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC;YACH,6EAA6E;YAC7E,UAAU,GAAG,KAAK,CAAC,eAAe,KAAK,IAAI,CAAC;QAC9C,CAAC;QAAC,MAAM,CAAC;YACP,UAAU,GAAG,KAAK,CAAC;QACrB,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,yBAAyB,CAAC,MAAM,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart inspection — the one dashboard surface Reticle could not previously see.
|
|
3
|
+
*
|
|
4
|
+
* A chart is where the store and the screen diverge most easily and most silently. Everything else on
|
|
5
|
+
* a dashboard is text: a KPI card renders a number you can read, a table renders rows you can count,
|
|
6
|
+
* and if the store disagrees with either, a state-vs-DOM comparison catches it. A chart renders
|
|
7
|
+
* GEOMETRY — the data has been through a scale function into `points`/`d` coordinates — and geometry
|
|
8
|
+
* is not text. `series` can be perfectly correct in the store while the polyline is blank, flat, or
|
|
9
|
+
* full of NaN, and no reader of either side would notice.
|
|
10
|
+
*
|
|
11
|
+
* Two failure classes are worth detecting, and they are chosen because they are DECIDABLE from the
|
|
12
|
+
* element alone — no baseline image, no per-library scale inversion, no false positives from a chart
|
|
13
|
+
* that is merely ugly:
|
|
14
|
+
*
|
|
15
|
+
* 1. **Non-finite coordinates.** `NaN`/`Infinity` in a path reaches the DOM whenever the scale math
|
|
16
|
+
* divides by a zero range — an empty series, a single-point series, or min === max. The browser
|
|
17
|
+
* silently renders nothing. This is a genuine bug every time; there is no chart for which NaN
|
|
18
|
+
* coordinates are correct.
|
|
19
|
+
* 2. **Degenerate geometry.** A chart element that exists but encloses no area: no points at all, or
|
|
20
|
+
* every point identical. Distinguishes "the chart is missing" (already catchable — the element is
|
|
21
|
+
* absent) from "the chart is present and empty", which looks healthy to a presence check and to a
|
|
22
|
+
* screenshot diff against a baseline that was also empty.
|
|
23
|
+
*
|
|
24
|
+
* Deliberately NOT attempted: comparing plotted geometry against the source data. That needs the
|
|
25
|
+
* chart's scale functions inverted per library, is a large surface to get wrong, and `chartInstance`
|
|
26
|
+
* below obsoletes it for the libraries people actually use — Chart.js and ECharts both hang their
|
|
27
|
+
* instance off the canvas element, so their data can be read directly rather than reverse-engineered
|
|
28
|
+
* from pixels.
|
|
29
|
+
*/
|
|
30
|
+
export interface ChartFinding {
|
|
31
|
+
/** What is wrong, as a stable machine-readable kind. */
|
|
32
|
+
kind: 'non-finite-coordinates' | 'empty-geometry' | 'degenerate-geometry';
|
|
33
|
+
/** The offending element's tag, so the agent can find it. */
|
|
34
|
+
tag: string;
|
|
35
|
+
/** Which attribute carried the fault. */
|
|
36
|
+
attr: string;
|
|
37
|
+
/** A short excerpt of the offending value — bounded; the full path can be thousands of chars. */
|
|
38
|
+
sample: string;
|
|
39
|
+
}
|
|
40
|
+
export interface ChartReport {
|
|
41
|
+
/** How many data-bearing geometry elements were examined. */
|
|
42
|
+
examined: number;
|
|
43
|
+
findings: ChartFinding[];
|
|
44
|
+
/** True when a canvas is present, i.e. the geometry is NOT in the DOM and this report cannot see it. */
|
|
45
|
+
canvas: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Every number embedded in a geometry attribute. Path data interleaves single-letter drawing
|
|
49
|
+
* commands with coordinate pairs, so this extracts numeric-looking tokens rather than parsing the
|
|
50
|
+
* path grammar — the question here is only "is any coordinate non-finite", which does not need a
|
|
51
|
+
* full parser.
|
|
52
|
+
*/
|
|
53
|
+
export declare function geometryNumbers(value: string): number[];
|
|
54
|
+
/** True when the attribute contains a coordinate the browser cannot render. */
|
|
55
|
+
export declare function hasNonFiniteCoordinate(value: string): boolean;
|
|
56
|
+
/** True when the geometry encloses no area — no coordinates, or every coordinate pair identical. */
|
|
57
|
+
export declare function isDegenerate(value: string): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Inspect a subtree for chart geometry faults. Pure over the element — no events, no globals — so it
|
|
60
|
+
* can back a tool call, an assertion, or a snapshot annotation without any of them owning it.
|
|
61
|
+
*/
|
|
62
|
+
export declare function inspectChart(root: Element): ChartReport;
|
|
63
|
+
/** The shape a canvas charting library hangs off its canvas element, once located. */
|
|
64
|
+
export interface CanvasChartData {
|
|
65
|
+
library: 'chartjs' | 'echarts';
|
|
66
|
+
/** The library's own data structure — series/datasets — read directly, not inferred from pixels. */
|
|
67
|
+
data: unknown;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Read the data behind a CANVAS chart.
|
|
71
|
+
*
|
|
72
|
+
* Canvas is the one place where "instrument from inside the app" is not merely cheaper than pixels but
|
|
73
|
+
* is the only option at all: the chart is a bitmap, so the DOM shows an empty `<canvas>` and a
|
|
74
|
+
* screenshot shows colours no assertion can interpret. Both major canvas libraries keep their live
|
|
75
|
+
* instance reachable from the element — Chart.js via its registry, ECharts via a per-DOM lookup — so
|
|
76
|
+
* the series data is READABLE rather than reverse-engineerable.
|
|
77
|
+
*
|
|
78
|
+
* Takes the globals as arguments rather than reaching for `window`, so this stays pure and testable
|
|
79
|
+
* and the SDK never depends on either library being present.
|
|
80
|
+
*/
|
|
81
|
+
export declare function canvasChartData(canvas: Element, globals: {
|
|
82
|
+
Chart?: {
|
|
83
|
+
getChart?: (el: Element) => {
|
|
84
|
+
data?: unknown;
|
|
85
|
+
} | undefined;
|
|
86
|
+
};
|
|
87
|
+
echarts?: {
|
|
88
|
+
getInstanceByDom?: (el: Element) => {
|
|
89
|
+
getOption?: () => unknown;
|
|
90
|
+
} | undefined;
|
|
91
|
+
};
|
|
92
|
+
}): CanvasChartData | null;
|
|
93
|
+
//# sourceMappingURL=chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../src/dom/chart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AASH,MAAM,WAAW,YAAY;IAC3B,wDAAwD;IACxD,IAAI,EAAE,wBAAwB,GAAG,gBAAgB,GAAG,qBAAqB,CAAC;IAC1E,6DAA6D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one dashboard surface Reticle could not previously see.
|
|
3
|
+
*
|
|
4
|
+
* A chart is where the store and the screen diverge most easily and most silently. Everything else on
|
|
5
|
+
* a dashboard is text: a KPI card renders a number you can read, a table renders rows you can count,
|
|
6
|
+
* and if the store disagrees with either, a state-vs-DOM comparison catches it. A chart renders
|
|
7
|
+
* GEOMETRY — the data has been through a scale function into `points`/`d` coordinates — and geometry
|
|
8
|
+
* is not text. `series` can be perfectly correct in the store while the polyline is blank, flat, or
|
|
9
|
+
* full of NaN, and no reader of either side would notice.
|
|
10
|
+
*
|
|
11
|
+
* Two failure classes are worth detecting, and they are chosen because they are DECIDABLE from the
|
|
12
|
+
* element alone — no baseline image, no per-library scale inversion, no false positives from a chart
|
|
13
|
+
* that is merely ugly:
|
|
14
|
+
*
|
|
15
|
+
* 1. **Non-finite coordinates.** `NaN`/`Infinity` in a path reaches the DOM whenever the scale math
|
|
16
|
+
* divides by a zero range — an empty series, a single-point series, or min === max. The browser
|
|
17
|
+
* silently renders nothing. This is a genuine bug every time; there is no chart for which NaN
|
|
18
|
+
* coordinates are correct.
|
|
19
|
+
* 2. **Degenerate geometry.** A chart element that exists but encloses no area: no points at all, or
|
|
20
|
+
* every point identical. Distinguishes "the chart is missing" (already catchable — the element is
|
|
21
|
+
* absent) from "the chart is present and empty", which looks healthy to a presence check and to a
|
|
22
|
+
* screenshot diff against a baseline that was also empty.
|
|
23
|
+
*
|
|
24
|
+
* Deliberately NOT attempted: comparing plotted geometry against the source data. That needs the
|
|
25
|
+
* chart's scale functions inverted per library, is a large surface to get wrong, and `chartInstance`
|
|
26
|
+
* below obsoletes it for the libraries people actually use — Chart.js and ECharts both hang their
|
|
27
|
+
* instance off the canvas element, so their data can be read directly rather than reverse-engineered
|
|
28
|
+
* from pixels.
|
|
29
|
+
*/
|
|
30
|
+
/** Elements whose geometry encodes data. `line`/`circle`/`rect` are excluded: they are used for axes,
|
|
31
|
+
* gridlines and backgrounds, where a zero-extent element is normal rather than a fault. */
|
|
32
|
+
const GEOMETRY_TAGS = ['path', 'polyline', 'polygon'];
|
|
33
|
+
/** Attributes carrying that geometry, per tag. */
|
|
34
|
+
const GEOMETRY_ATTRS = ['d', 'points'];
|
|
35
|
+
const SAMPLE_MAX = 120;
|
|
36
|
+
/**
|
|
37
|
+
* Every number embedded in a geometry attribute. Path data interleaves single-letter drawing
|
|
38
|
+
* commands with coordinate pairs, so this extracts numeric-looking tokens rather than parsing the
|
|
39
|
+
* path grammar — the question here is only "is any coordinate non-finite", which does not need a
|
|
40
|
+
* full parser.
|
|
41
|
+
*/
|
|
42
|
+
export function geometryNumbers(value) {
|
|
43
|
+
const tokens = value.match(/-?\d*\.?\d+(?:e[-+]?\d+)?|NaN|Infinity|-Infinity/gi) ?? [];
|
|
44
|
+
return tokens.map((t) => Number(t));
|
|
45
|
+
}
|
|
46
|
+
/** True when the attribute contains a coordinate the browser cannot render. */
|
|
47
|
+
export function hasNonFiniteCoordinate(value) {
|
|
48
|
+
// Checked textually first: `NaN` and `Infinity` survive into the attribute as literal words, and a
|
|
49
|
+
// string scan catches them without depending on how the number extractor tokenises.
|
|
50
|
+
if (/NaN|Infinity/i.test(value))
|
|
51
|
+
return true;
|
|
52
|
+
return geometryNumbers(value).some((n) => !Number.isFinite(n));
|
|
53
|
+
}
|
|
54
|
+
/** True when the geometry encloses no area — no coordinates, or every coordinate pair identical. */
|
|
55
|
+
export function isDegenerate(value) {
|
|
56
|
+
const nums = geometryNumbers(value).filter((n) => Number.isFinite(n));
|
|
57
|
+
if (nums.length === 0)
|
|
58
|
+
return true;
|
|
59
|
+
// A polyline of one repeated point draws nothing. Compare pairs, not raw numbers, so a legitimately
|
|
60
|
+
// flat line (varying x, constant y) is NOT flagged — that is a real chart of constant data.
|
|
61
|
+
const xs = nums.filter((_, i) => i % 2 === 0);
|
|
62
|
+
const ys = nums.filter((_, i) => i % 2 === 1);
|
|
63
|
+
const allSame = (arr) => arr.every((v) => v === arr[0]);
|
|
64
|
+
return xs.length > 1 && allSame(xs) && allSame(ys);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Inspect a subtree for chart geometry faults. Pure over the element — no events, no globals — so it
|
|
68
|
+
* can back a tool call, an assertion, or a snapshot annotation without any of them owning it.
|
|
69
|
+
*/
|
|
70
|
+
export function inspectChart(root) {
|
|
71
|
+
const findings = [];
|
|
72
|
+
let examined = 0;
|
|
73
|
+
for (const tag of GEOMETRY_TAGS) {
|
|
74
|
+
for (const el of Array.from(root.querySelectorAll(tag))) {
|
|
75
|
+
for (const attr of GEOMETRY_ATTRS) {
|
|
76
|
+
const value = el.getAttribute(attr);
|
|
77
|
+
if (value === null)
|
|
78
|
+
continue;
|
|
79
|
+
examined += 1;
|
|
80
|
+
const sample = value.length > SAMPLE_MAX ? `${value.slice(0, SAMPLE_MAX)}…` : value;
|
|
81
|
+
if (hasNonFiniteCoordinate(value)) {
|
|
82
|
+
findings.push({ kind: 'non-finite-coordinates', tag, attr, sample });
|
|
83
|
+
}
|
|
84
|
+
else if (value.trim().length === 0) {
|
|
85
|
+
findings.push({ kind: 'empty-geometry', tag, attr, sample });
|
|
86
|
+
}
|
|
87
|
+
else if (isDegenerate(value)) {
|
|
88
|
+
findings.push({ kind: 'degenerate-geometry', tag, attr, sample });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const canvas = root.querySelectorAll('canvas').length > 0;
|
|
94
|
+
return { examined, findings, canvas };
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Read the data behind a CANVAS chart.
|
|
98
|
+
*
|
|
99
|
+
* Canvas is the one place where "instrument from inside the app" is not merely cheaper than pixels but
|
|
100
|
+
* is the only option at all: the chart is a bitmap, so the DOM shows an empty `<canvas>` and a
|
|
101
|
+
* screenshot shows colours no assertion can interpret. Both major canvas libraries keep their live
|
|
102
|
+
* instance reachable from the element — Chart.js via its registry, ECharts via a per-DOM lookup — so
|
|
103
|
+
* the series data is READABLE rather than reverse-engineerable.
|
|
104
|
+
*
|
|
105
|
+
* Takes the globals as arguments rather than reaching for `window`, so this stays pure and testable
|
|
106
|
+
* and the SDK never depends on either library being present.
|
|
107
|
+
*/
|
|
108
|
+
export function canvasChartData(canvas, globals) {
|
|
109
|
+
const chartjs = globals.Chart?.getChart?.(canvas);
|
|
110
|
+
if (chartjs !== undefined && chartjs !== null) {
|
|
111
|
+
return { library: 'chartjs', data: chartjs.data ?? null };
|
|
112
|
+
}
|
|
113
|
+
const echart = globals.echarts?.getInstanceByDom?.(canvas);
|
|
114
|
+
if (echart !== undefined && echart !== null) {
|
|
115
|
+
return { library: 'echarts', data: echart.getOption?.() ?? null };
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart.js","sourceRoot":"","sources":["../../src/dom/chart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH;4FAC4F;AAC5F,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAU,CAAC;AAE/D,kDAAkD;AAClD,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAU,CAAC;AAqBhD,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,oDAAoD,CAAC,IAAI,EAAE,CAAC;IACvF,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACtC,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,sBAAsB,CAAC,KAAa;IAClD,mGAAmG;IACnG,oFAAoF;IACpF,IAAI,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IA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;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC;IAClD,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QAC9C,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;IAC5D,CAAC;IACD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,gBAAgB,EAAE,CAAC,MAAM,CAAC,CAAC;IAC3D,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QAC5C,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC;IACpE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/dom/dom-ignore.d.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
export declare function setIgnoreSelectors(selectors: string[]): void;
|
|
3
3
|
/** True if the element is part of Reticle's own presenter overlay. */
|
|
4
4
|
export declare function isReticleOverlay(el: Element): boolean;
|
|
5
|
+
/** Walk ancestors: true iff any element in the chain carries a data-reticle* attribute (Reticle's own UI). */
|
|
6
|
+
export declare function isReticleUi(node: Element | null): boolean;
|
|
5
7
|
/** True if the element should be excluded from snapshots/queries (Reticle overlay or dev overlay). */
|
|
6
8
|
export declare function isIgnored(el: Element): boolean;
|
|
7
9
|
//# sourceMappingURL=dom-ignore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom-ignore.d.ts","sourceRoot":"","sources":["../../src/dom/dom-ignore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dom-ignore.d.ts","sourceRoot":"","sources":["../../src/dom/dom-ignore.ts"],"names":[],"mappings":"AAeA,2FAA2F;AAC3F,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,CAE5D;AAED,sEAAsE;AACtE,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAErD;AAED,8GAA8G;AAC9G,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,GAAG,OAAO,CAOzD;AAED,sGAAsG;AACtG,wBAAgB,SAAS,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAM9C"}
|
package/dist/dom/dom-ignore.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Selectors for Reticle's own presenter overlay (cursor, HUD, glow) + the annotator's "flag a bug"
|
|
3
|
+
* UI (`data-reticle-mark`) — never observed/snapshotted. The annotator mounts by DEFAULT with the
|
|
4
|
+
* presenter, so omitting its selector here leaked a phantom `<button>Flag a bug</button>` into every
|
|
5
|
+
* snapshot and streamed its highlight-box mutations/transitions as if the APP had rendered them.
|
|
6
|
+
*/
|
|
7
|
+
const RETICLE_OVERLAY = '[data-reticle-overlay],[data-reticle-cursor],[data-reticle-hud],[data-reticle-glow],[data-reticle-mark]';
|
|
3
8
|
/** Known third-party dev overlays to keep out of snapshots (Agentation, Next dev UI). */
|
|
4
9
|
const DEV_OVERLAYS = '[data-agentation],#__next-build-watcher,nextjs-portal,[data-nextjs-dialog],[data-nextjs-toast]';
|
|
5
10
|
let extraIgnore = '';
|
|
@@ -11,6 +16,16 @@ export function setIgnoreSelectors(selectors) {
|
|
|
11
16
|
export function isReticleOverlay(el) {
|
|
12
17
|
return el.closest(RETICLE_OVERLAY) !== null;
|
|
13
18
|
}
|
|
19
|
+
/** Walk ancestors: true iff any element in the chain carries a data-reticle* attribute (Reticle's own UI). */
|
|
20
|
+
export function isReticleUi(node) {
|
|
21
|
+
for (let n = node; n !== null; n = n.parentElement) {
|
|
22
|
+
for (const attr of Array.from(n.attributes)) {
|
|
23
|
+
if (attr.name.startsWith('data-reticle'))
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
14
29
|
/** True if the element should be excluded from snapshots/queries (Reticle overlay or dev overlay). */
|
|
15
30
|
export function isIgnored(el) {
|
|
16
31
|
const sel = extraIgnore.length > 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom-ignore.js","sourceRoot":"","sources":["../../src/dom/dom-ignore.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"dom-ignore.js","sourceRoot":"","sources":["../../src/dom/dom-ignore.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,eAAe,GACnB,yGAAyG,CAAC;AAE5G,yFAAyF;AACzF,MAAM,YAAY,GAChB,gGAAgG,CAAC;AAEnG,IAAI,WAAW,GAAG,EAAE,CAAC;AAErB,2FAA2F;AAC3F,MAAM,UAAU,kBAAkB,CAAC,SAAmB;IACpD,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpC,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,gBAAgB,CAAC,EAAW;IAC1C,OAAO,EAAE,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;AAC9C,CAAC;AAED,8GAA8G;AAC9G,MAAM,UAAU,WAAW,CAAC,IAAoB;IAC9C,KAAK,IAAI,CAAC,GAAmB,IAAI,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,CAAC;QACnE,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC;YAC5C,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC;gBAAE,OAAO,IAAI,CAAC;QACxD,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,SAAS,CAAC,EAAW;IACnC,MAAM,GAAG,GACP,WAAW,CAAC,MAAM,GAAG,CAAC;QACpB,CAAC,CAAC,GAAG,eAAe,IAAI,YAAY,IAAI,WAAW,EAAE;QACrD,CAAC,CAAC,GAAG,eAAe,IAAI,YAAY,EAAE,CAAC;IAC3C,OAAO,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Center-point hit-test, shared by click-geometry (actions) and occlusion detection (commands) so the
|
|
3
|
+
* two can't drift. Returns the top NON-Reticle element covering `el`'s center, or null when nothing
|
|
4
|
+
* foreign is on top — i.e. `el` itself, an ancestor wrapping it, or a descendant is on top (all "not
|
|
5
|
+
* occluded"). A zero-area or unlayouted box (jsdom / detached node) returns null: we cannot tell, so
|
|
6
|
+
* we never false-positive an occlusion. Reticle's own HUD is never treated as an occluder.
|
|
7
|
+
*/
|
|
8
|
+
export declare function hitTestOccluder(el: Element, rect: DOMRect): Element | null;
|
|
9
|
+
//# sourceMappingURL=occlusion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"occlusion.d.ts","sourceRoot":"","sources":["../../src/dom/occlusion.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAQ1E"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isReticleUi } from './dom-ignore.js';
|
|
2
|
+
/**
|
|
3
|
+
* Center-point hit-test, shared by click-geometry (actions) and occlusion detection (commands) so the
|
|
4
|
+
* two can't drift. Returns the top NON-Reticle element covering `el`'s center, or null when nothing
|
|
5
|
+
* foreign is on top — i.e. `el` itself, an ancestor wrapping it, or a descendant is on top (all "not
|
|
6
|
+
* occluded"). A zero-area or unlayouted box (jsdom / detached node) returns null: we cannot tell, so
|
|
7
|
+
* we never false-positive an occlusion. Reticle's own HUD is never treated as an occluder.
|
|
8
|
+
*/
|
|
9
|
+
export function hitTestOccluder(el, rect) {
|
|
10
|
+
if (rect.width === 0 || rect.height === 0)
|
|
11
|
+
return null;
|
|
12
|
+
const doc = el.ownerDocument;
|
|
13
|
+
if (typeof doc.elementFromPoint !== 'function')
|
|
14
|
+
return null;
|
|
15
|
+
const top = doc.elementFromPoint(rect.left + rect.width / 2, rect.top + rect.height / 2);
|
|
16
|
+
if (top === null || isReticleUi(top))
|
|
17
|
+
return null;
|
|
18
|
+
const lands = top === el || el.contains(top) || top.contains(el);
|
|
19
|
+
return lands ? null : top;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=occlusion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"occlusion.js","sourceRoot":"","sources":["../../src/dom/occlusion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,EAAW,EAAE,IAAa;IACxD,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACvD,MAAM,GAAG,GAAG,EAAE,CAAC,aAAa,CAAC;IAC7B,IAAI,OAAO,GAAG,CAAC,gBAAgB,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC;IAC5D,MAAM,GAAG,GAAG,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACzF,IAAI,GAAG,KAAK,IAAI,IAAI,WAAW,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAClD,MAAM,KAAK,GAAG,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACjE,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;AAC5B,CAAC"}
|