first commit

This commit is contained in:
2026-06-02 20:24:26 -03:00
commit 7b8a8d722d
3354 changed files with 627959 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
declare global {
interface Window {
/**
* @internal
*/
__ariaQuerySelector(root: Node, selector: string): Promise<Node | null>;
/**
* @internal
*/
__ariaQuerySelectorAll(root: Node, selector: string): Promise<Node[]>;
}
}
/**
* @internal
*/
export declare const ariaQuerySelector: (root: Node, selector: string) => Promise<Node | null>;
/**
* @internal
*/
export declare const ariaQuerySelectorAll: (root: Node, selector: string) => AsyncIterable<Node>;
//# sourceMappingURL=ARIAQuerySelector.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ARIAQuerySelector.d.ts","sourceRoot":"","sources":["../../../src/injected/ARIAQuerySelector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd;;WAEG;QACH,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;QACxE;;WAEG;QACH,sBAAsB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;KACvE;CACF;AACD;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,MAAM,IAAI,EACV,UAAU,MAAM,KACf,OAAO,CAAC,IAAI,GAAG,IAAI,CAGrB,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAC/B,MAAM,IAAI,EACV,UAAU,MAAM,KACf,aAAa,CAAC,IAAI,CAMpB,CAAC"}

View File

@@ -0,0 +1,20 @@
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @internal
*/
export const ariaQuerySelector = (root, selector) => {
// In Firefox sandboxes globalThis !== window and we expose bindings on globalThis.
return globalThis.__ariaQuerySelector(root, selector);
};
/**
* @internal
*/
export const ariaQuerySelectorAll = async function* (root, selector) {
// In Firefox sandboxes globalThis !== window and we expose bindings on globalThis.
yield* await globalThis.__ariaQuerySelectorAll(root, selector);
};
//# sourceMappingURL=ARIAQuerySelector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ARIAQuerySelector.js","sourceRoot":"","sources":["../../../src/injected/ARIAQuerySelector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,IAAU,EACV,QAAgB,EACM,EAAE;IACxB,mFAAmF;IACnF,OAAQ,UAAgC,CAAC,mBAAmB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC/E,CAAC,CAAC;AACF;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,SAAS,CAAC,EACjD,IAAU,EACV,QAAgB;IAEhB,mFAAmF;IACnF,KAAK,CAAC,CAAC,MAAO,UAAgC,CAAC,sBAAsB,CACnE,IAAI,EACJ,QAAQ,CACT,CAAC;AACJ,CAAC,CAAC"}

View File

@@ -0,0 +1,14 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @internal
*/
export declare const cssQuerySelector: (root: Node, selector: string) => Element | null;
/**
* @internal
*/
export declare const cssQuerySelectorAll: (root: Node, selector: string) => Iterable<Element>;
//# sourceMappingURL=CSSSelector.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CSSSelector.d.ts","sourceRoot":"","sources":["../../../src/injected/CSSSelector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC3B,MAAM,IAAI,EACV,UAAU,MAAM,KACf,OAAO,GAAG,IAGZ,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,MAAM,IAAI,EACV,UAAU,MAAM,KACf,QAAQ,CAAC,OAAO,CAGlB,CAAC"}

View File

@@ -0,0 +1,20 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @internal
*/
export const cssQuerySelector = (root, selector) => {
// @ts-expect-error assume element root
return root.querySelector(selector);
};
/**
* @internal
*/
export const cssQuerySelectorAll = function (root, selector) {
// @ts-expect-error assume element root
return root.querySelectorAll(selector);
};
//# sourceMappingURL=CSSSelector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CSSSelector.js","sourceRoot":"","sources":["../../../src/injected/CSSSelector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,IAAU,EACV,QAAgB,EACA,EAAE;IAClB,uCAAuC;IACvC,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AACtC,CAAC,CAAC;AACF;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,UACjC,IAAU,EACV,QAAgB;IAEhB,uCAAuC;IACvC,OAAO,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;AACzC,CAAC,CAAC"}

View File

@@ -0,0 +1,30 @@
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import type { CustomQueryHandler } from '../common/CustomQueryHandler.js';
import type { Awaitable, AwaitableIterable } from '../common/types.js';
/**
* @public
*/
export interface CustomQuerySelector {
querySelector(root: Node, selector: string): Awaitable<Node | null>;
querySelectorAll(root: Node, selector: string): AwaitableIterable<Node>;
}
/**
* This class mimics the injected {@link CustomQuerySelectorRegistry}.
*/
declare class CustomQuerySelectorRegistry {
#private;
register(name: string, handler: CustomQueryHandler): void;
unregister(name: string): void;
get(name: string): CustomQuerySelector | undefined;
clear(): void;
}
/**
* @internal
*/
export declare const customQuerySelectors: CustomQuerySelectorRegistry;
export {};
//# sourceMappingURL=CustomQuerySelector.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CustomQuerySelector.d.ts","sourceRoot":"","sources":["../../../src/injected/CustomQuerySelector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAC,SAAS,EAAE,iBAAiB,EAAC,MAAM,oBAAoB,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACpE,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;CACzE;AAED;;GAEG;AACH,cAAM,2BAA2B;;IAG/B,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAyBzD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI9B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS;IAIlD,KAAK;CAGN;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,6BAAoC,CAAC"}

View File

@@ -0,0 +1,50 @@
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
/**
* This class mimics the injected {@link CustomQuerySelectorRegistry}.
*/
class CustomQuerySelectorRegistry {
#selectors = new Map();
register(name, handler) {
if (!handler.queryOne && handler.queryAll) {
const querySelectorAll = handler.queryAll;
handler.queryOne = (node, selector) => {
for (const result of querySelectorAll(node, selector)) {
return result;
}
return null;
};
}
else if (handler.queryOne && !handler.queryAll) {
const querySelector = handler.queryOne;
handler.queryAll = (node, selector) => {
const result = querySelector(node, selector);
return result ? [result] : [];
};
}
else if (!handler.queryOne || !handler.queryAll) {
throw new Error('At least one query method must be defined.');
}
this.#selectors.set(name, {
querySelector: handler.queryOne,
querySelectorAll: handler.queryAll,
});
}
unregister(name) {
this.#selectors.delete(name);
}
get(name) {
return this.#selectors.get(name);
}
clear() {
this.#selectors.clear();
}
}
/**
* @internal
*/
export const customQuerySelectors = new CustomQuerySelectorRegistry();
//# sourceMappingURL=CustomQuerySelector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CustomQuerySelector.js","sourceRoot":"","sources":["../../../src/injected/CustomQuerySelector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH;;GAEG;AACH,MAAM,2BAA2B;IAC/B,UAAU,GAAG,IAAI,GAAG,EAA+B,CAAC;IAEpD,QAAQ,CAAC,IAAY,EAAE,OAA2B;QAChD,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC1C,MAAM,gBAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC;YAC1C,OAAO,CAAC,QAAQ,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE;gBACpC,KAAK,MAAM,MAAM,IAAI,gBAAgB,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC;oBACtD,OAAO,MAAM,CAAC;gBAChB,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC,CAAC;QACJ,CAAC;aAAM,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YACjD,MAAM,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC;YACvC,OAAO,CAAC,QAAQ,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE;gBACpC,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;gBAC7C,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAChC,CAAC,CAAC;QACJ,CAAC;aAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YAClD,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAChE,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE;YACxB,aAAa,EAAE,OAAO,CAAC,QAAQ;YAC/B,gBAAgB,EAAE,OAAO,CAAC,QAAS;SACpC,CAAC,CAAC;IACL,CAAC;IAED,UAAU,CAAC,IAAY;QACrB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,KAAK;QACH,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,2BAA2B,EAAE,CAAC"}

View File

@@ -0,0 +1,49 @@
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import type { AwaitableIterable } from '../common/types.js';
/**
* @internal
*/
export type CSSSelector = string;
/**
* @internal
*/
export interface PPseudoSelector {
name: string;
value: string;
}
/**
* @internal
*/
export declare const enum PCombinator {
Descendent = ">>>",
Child = ">>>>"
}
/**
* @internal
*/
export type CompoundPSelector = Array<CSSSelector | PPseudoSelector>;
/**
* @internal
*/
export type ComplexPSelector = Array<CompoundPSelector | PCombinator>;
/**
* @internal
*/
export type ComplexPSelectorList = ComplexPSelector[];
/**
* Queries the given node for all nodes matching the given text selector.
*
* @internal
*/
export declare const pQuerySelectorAll: (root: Node, selector: string) => AwaitableIterable<Node>;
/**
* Queries the given node for all nodes matching the given text selector.
*
* @internal
*/
export declare const pQuerySelector: (root: Node, selector: string) => Promise<Node | null>;
//# sourceMappingURL=PQuerySelector.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"PQuerySelector.d.ts","sourceRoot":"","sources":["../../../src/injected/PQuerySelector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,oBAAoB,CAAC;AAW1D;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AACjC;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AACD;;GAEG;AACH,0BAAkB,WAAW;IAC3B,UAAU,QAAQ;IAClB,KAAK,SAAS;CACf;AACD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,WAAW,GAAG,eAAe,CAAC,CAAC;AACrE;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,iBAAiB,GAAG,WAAW,CAAC,CAAC;AACtE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,EAAE,CAAC;AAoMtD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,MAAM,IAAI,EACV,UAAU,MAAM,KACf,iBAAiB,CAAC,IAAI,CA4BxB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACzB,MAAM,IAAI,EACV,UAAU,MAAM,KACf,OAAO,CAAC,IAAI,GAAG,IAAI,CAKrB,CAAC"}

View File

@@ -0,0 +1,216 @@
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import { AsyncIterableUtil } from '../util/AsyncIterableUtil.js';
import { ariaQuerySelectorAll } from './ARIAQuerySelector.js';
import { customQuerySelectors } from './CustomQuerySelector.js';
import { textQuerySelectorAll } from './TextQuerySelector.js';
import { pierce, pierceAll } from './util.js';
import { xpathQuerySelectorAll } from './XPathQuerySelector.js';
const IDENT_TOKEN_START = /[-\w\P{ASCII}*]/u;
const isQueryableNode = (node) => {
return 'querySelectorAll' in node;
};
class PQueryEngine {
#complexSelector;
#compoundSelector = [];
#selector = undefined;
elements;
constructor(element, complexSelector) {
this.elements = [element];
this.#complexSelector = complexSelector;
this.#next();
}
async run() {
if (typeof this.#selector === 'string') {
switch (this.#selector.trimStart()) {
case ':scope':
// `:scope` has some special behavior depending on the node. It always
// represents the current node within a compound selector, but by
// itself, it depends on the node. For example, Document is
// represented by `<html>`, but any HTMLElement is not represented by
// itself (i.e. `null`). This can be troublesome if our combinators
// are used right after so we treat this selector specially.
this.#next();
break;
}
}
for (; this.#selector !== undefined; this.#next()) {
const selector = this.#selector;
if (typeof selector === 'string') {
// The regular expression tests if the selector is a type/universal
// selector. Any other case means we want to apply the selector onto
// the element itself (e.g. `element.class`, `element>div`,
// `element:hover`, etc.).
if (selector[0] && IDENT_TOKEN_START.test(selector[0])) {
this.elements = AsyncIterableUtil.flatMap(this.elements, async function* (element) {
if (isQueryableNode(element)) {
yield* element.querySelectorAll(selector);
}
});
}
else {
this.elements = AsyncIterableUtil.flatMap(this.elements, async function* (element) {
if (!element.parentElement) {
if (!isQueryableNode(element)) {
return;
}
yield* element.querySelectorAll(selector);
return;
}
let index = 0;
for (const child of element.parentElement.children) {
++index;
if (child === element) {
break;
}
}
yield* element.parentElement.querySelectorAll(`:scope>:nth-child(${index})${selector}`);
});
}
}
else {
this.elements = AsyncIterableUtil.flatMap(this.elements, async function* (element) {
switch (selector.name) {
case 'text':
yield* textQuerySelectorAll(element, selector.value);
break;
case 'xpath':
yield* xpathQuerySelectorAll(element, selector.value);
break;
case 'aria':
yield* ariaQuerySelectorAll(element, selector.value);
break;
default:
const querySelector = customQuerySelectors.get(selector.name);
if (!querySelector) {
throw new Error(`Unknown selector type: ${selector.name}`);
}
yield* querySelector.querySelectorAll(element, selector.value);
}
});
}
}
}
#next() {
if (this.#compoundSelector.length !== 0) {
this.#selector = this.#compoundSelector.shift();
return;
}
if (this.#complexSelector.length === 0) {
this.#selector = undefined;
return;
}
const selector = this.#complexSelector.shift();
switch (selector) {
case ">>>>" /* PCombinator.Child */: {
this.elements = AsyncIterableUtil.flatMap(this.elements, pierce);
this.#next();
break;
}
case ">>>" /* PCombinator.Descendent */: {
this.elements = AsyncIterableUtil.flatMap(this.elements, pierceAll);
this.#next();
break;
}
default:
this.#compoundSelector = selector;
this.#next();
break;
}
}
}
class DepthCalculator {
#cache = new WeakMap();
calculate(node, depth = []) {
if (node === null) {
return depth;
}
if (node instanceof ShadowRoot) {
node = node.host;
}
const cachedDepth = this.#cache.get(node);
if (cachedDepth) {
return [...cachedDepth, ...depth];
}
let index = 0;
for (let prevSibling = node.previousSibling; prevSibling; prevSibling = prevSibling.previousSibling) {
++index;
}
const value = this.calculate(node.parentNode, [index]);
this.#cache.set(node, value);
return [...value, ...depth];
}
}
const compareDepths = (a, b) => {
if (a.length + b.length === 0) {
return 0;
}
const [i = -1, ...otherA] = a;
const [j = -1, ...otherB] = b;
if (i === j) {
return compareDepths(otherA, otherB);
}
return i < j ? -1 : 1;
};
const domSort = async function* (elements) {
const results = new Set();
for await (const element of elements) {
results.add(element);
}
const calculator = new DepthCalculator();
yield* [...results.values()]
.map(result => {
return [result, calculator.calculate(result)];
})
.sort(([, a], [, b]) => {
return compareDepths(a, b);
})
.map(([result]) => {
return result;
});
};
/**
* Queries the given node for all nodes matching the given text selector.
*
* @internal
*/
export const pQuerySelectorAll = function (root, selector) {
const selectors = JSON.parse(selector);
// If there are any empty elements, then this implies the selector has
// contiguous combinators (e.g. `>>> >>>>`) or starts/ends with one which we
// treat as illegal, similar to existing behavior.
if (selectors.some(parts => {
let i = 0;
return parts.some(parts => {
if (typeof parts === 'string') {
++i;
}
else {
i = 0;
}
return i > 1;
});
})) {
throw new Error('Multiple deep combinators found in sequence.');
}
return domSort(AsyncIterableUtil.flatMap(selectors, selectorParts => {
const query = new PQueryEngine(root, selectorParts);
void query.run();
return query.elements;
}));
};
/**
* Queries the given node for all nodes matching the given text selector.
*
* @internal
*/
export const pQuerySelector = async function (root, selector) {
for await (const element of pQuerySelectorAll(root, selector)) {
return element;
}
return null;
};
//# sourceMappingURL=PQuerySelector.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,14 @@
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @internal
*/
export declare const pierceQuerySelector: (root: Node, selector: string) => Element | null;
/**
* @internal
*/
export declare const pierceQuerySelectorAll: (element: Node, selector: string) => Element[];
//# sourceMappingURL=PierceQuerySelector.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"PierceQuerySelector.d.ts","sourceRoot":"","sources":["../../../src/injected/PierceQuerySelector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,MAAM,IAAI,EACV,UAAU,MAAM,KACf,OAAO,GAAG,IAsBZ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,SAAS,IAAI,EACb,UAAU,MAAM,KACf,OAAO,EAsBT,CAAC"}

View File

@@ -0,0 +1,58 @@
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @internal
*/
export const pierceQuerySelector = (root, selector) => {
let found = null;
const search = (root) => {
const iter = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT);
do {
const currentNode = iter.currentNode;
if (currentNode.shadowRoot) {
search(currentNode.shadowRoot);
}
if (currentNode instanceof ShadowRoot) {
continue;
}
if (currentNode !== root && !found && currentNode.matches(selector)) {
found = currentNode;
}
} while (!found && iter.nextNode());
};
if (root instanceof Document) {
root = root.documentElement;
}
search(root);
return found;
};
/**
* @internal
*/
export const pierceQuerySelectorAll = (element, selector) => {
const result = [];
const collect = (root) => {
const iter = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT);
do {
const currentNode = iter.currentNode;
if (currentNode.shadowRoot) {
collect(currentNode.shadowRoot);
}
if (currentNode instanceof ShadowRoot) {
continue;
}
if (currentNode !== root && currentNode.matches(selector)) {
result.push(currentNode);
}
} while (iter.nextNode());
};
if (element instanceof Document) {
element = element.documentElement;
}
collect(element);
return result;
};
//# sourceMappingURL=PierceQuerySelector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"PierceQuerySelector.js","sourceRoot":"","sources":["../../../src/injected/PierceQuerySelector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,IAAU,EACV,QAAgB,EACA,EAAE;IAClB,IAAI,KAAK,GAAgB,IAAI,CAAC;IAC9B,MAAM,MAAM,GAAG,CAAC,IAAU,EAAE,EAAE;QAC5B,MAAM,IAAI,GAAG,QAAQ,CAAC,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;QACtE,GAAG,CAAC;YACF,MAAM,WAAW,GAAG,IAAI,CAAC,WAAsB,CAAC;YAChD,IAAI,WAAW,CAAC,UAAU,EAAE,CAAC;gBAC3B,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;YACjC,CAAC;YACD,IAAI,WAAW,YAAY,UAAU,EAAE,CAAC;gBACtC,SAAS;YACX,CAAC;YACD,IAAI,WAAW,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACpE,KAAK,GAAG,WAAW,CAAC;YACtB,CAAC;QACH,CAAC,QAAQ,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,EAAE;IACtC,CAAC,CAAC;IACF,IAAI,IAAI,YAAY,QAAQ,EAAE,CAAC;QAC7B,IAAI,GAAG,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,CAAC;IACb,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,OAAa,EACb,QAAgB,EACL,EAAE;IACb,MAAM,MAAM,GAAc,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAG,CAAC,IAAU,EAAE,EAAE;QAC7B,MAAM,IAAI,GAAG,QAAQ,CAAC,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;QACtE,GAAG,CAAC;YACF,MAAM,WAAW,GAAG,IAAI,CAAC,WAAsB,CAAC;YAChD,IAAI,WAAW,CAAC,UAAU,EAAE,CAAC;gBAC3B,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;YAClC,CAAC;YACD,IAAI,WAAW,YAAY,UAAU,EAAE,CAAC;gBACtC,SAAS;YACX,CAAC;YACD,IAAI,WAAW,KAAK,IAAI,IAAI,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC1D,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC,QAAQ,IAAI,CAAC,QAAQ,EAAE,EAAE;IAC5B,CAAC,CAAC;IACF,IAAI,OAAO,YAAY,QAAQ,EAAE,CAAC;QAChC,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC;IACpC,CAAC;IACD,OAAO,CAAC,OAAO,CAAC,CAAC;IACjB,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}

View File

@@ -0,0 +1,44 @@
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @internal
*/
export interface Poller<T> {
start(): Promise<void>;
stop(): Promise<void>;
result(): Promise<T>;
}
/**
* @internal
*/
export declare class MutationPoller<T> implements Poller<T> {
#private;
constructor(fn: () => Promise<T>, root: Node);
start(): Promise<void>;
stop(): Promise<void>;
result(): Promise<T>;
}
/**
* @internal
*/
export declare class RAFPoller<T> implements Poller<T> {
#private;
constructor(fn: () => Promise<T>);
start(): Promise<void>;
stop(): Promise<void>;
result(): Promise<T>;
}
/**
* @internal
*/
export declare class IntervalPoller<T> implements Poller<T> {
#private;
constructor(fn: () => Promise<T>, ms: number);
start(): Promise<void>;
stop(): Promise<void>;
result(): Promise<T>;
}
//# sourceMappingURL=Poller.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Poller.d.ts","sourceRoot":"","sources":["../../../src/injected/Poller.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,MAAM,WAAW,MAAM,CAAC,CAAC;IACvB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,cAAc,CAAC,CAAC,CAAE,YAAW,MAAM,CAAC,CAAC,CAAC;;gBAOrC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI;IAKtC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAuBtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAW3B,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC;CAIrB;AAED;;GAEG;AACH,qBAAa,SAAS,CAAC,CAAC,CAAE,YAAW,MAAM,CAAC,CAAC,CAAC;;gBAGhC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC;IAI1B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAuBtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAO3B,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC;CAIrB;AAED;;GAEG;AAEH,qBAAa,cAAc,CAAC,CAAC,CAAE,YAAW,MAAM,CAAC,CAAC,CAAC;;gBAMrC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM;IAKtC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAkBtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAW3B,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC;CAIrB"}

View File

@@ -0,0 +1,140 @@
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import { assert } from '../util/assert.js';
import { Deferred } from '../util/Deferred.js';
/**
* @internal
*/
export class MutationPoller {
#fn;
#root;
#observer;
#deferred;
constructor(fn, root) {
this.#fn = fn;
this.#root = root;
}
async start() {
const deferred = (this.#deferred = Deferred.create());
const result = await this.#fn();
if (result) {
deferred.resolve(result);
return;
}
this.#observer = new MutationObserver(async () => {
const result = await this.#fn();
if (!result) {
return;
}
deferred.resolve(result);
await this.stop();
});
this.#observer.observe(this.#root, {
childList: true,
subtree: true,
attributes: true,
});
}
async stop() {
assert(this.#deferred, 'Polling never started.');
if (!this.#deferred.finished()) {
this.#deferred.reject(new Error('Polling stopped'));
}
if (this.#observer) {
this.#observer.disconnect();
this.#observer = undefined;
}
}
result() {
assert(this.#deferred, 'Polling never started.');
return this.#deferred.valueOrThrow();
}
}
/**
* @internal
*/
export class RAFPoller {
#fn;
#deferred;
constructor(fn) {
this.#fn = fn;
}
async start() {
const deferred = (this.#deferred = Deferred.create());
const result = await this.#fn();
if (result) {
deferred.resolve(result);
return;
}
const poll = async () => {
if (deferred.finished()) {
return;
}
const result = await this.#fn();
if (!result) {
window.requestAnimationFrame(poll);
return;
}
deferred.resolve(result);
await this.stop();
};
window.requestAnimationFrame(poll);
}
async stop() {
assert(this.#deferred, 'Polling never started.');
if (!this.#deferred.finished()) {
this.#deferred.reject(new Error('Polling stopped'));
}
}
result() {
assert(this.#deferred, 'Polling never started.');
return this.#deferred.valueOrThrow();
}
}
/**
* @internal
*/
export class IntervalPoller {
#fn;
#ms;
#interval;
#deferred;
constructor(fn, ms) {
this.#fn = fn;
this.#ms = ms;
}
async start() {
const deferred = (this.#deferred = Deferred.create());
const result = await this.#fn();
if (result) {
deferred.resolve(result);
return;
}
this.#interval = setInterval(async () => {
const result = await this.#fn();
if (!result) {
return;
}
deferred.resolve(result);
await this.stop();
}, this.#ms);
}
async stop() {
assert(this.#deferred, 'Polling never started.');
if (!this.#deferred.finished()) {
this.#deferred.reject(new Error('Polling stopped'));
}
if (this.#interval) {
clearInterval(this.#interval);
this.#interval = undefined;
}
}
result() {
assert(this.#deferred, 'Polling never started.');
return this.#deferred.valueOrThrow();
}
}
//# sourceMappingURL=Poller.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Poller.js","sourceRoot":"","sources":["../../../src/injected/Poller.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAC,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAW7C;;GAEG;AACH,MAAM,OAAO,cAAc;IACzB,GAAG,CAAmB;IAEtB,KAAK,CAAO;IAEZ,SAAS,CAAoB;IAC7B,SAAS,CAAe;IACxB,YAAY,EAAoB,EAAE,IAAU;QAC1C,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,MAAM,EAAK,CAAC,CAAC;QACzD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;QAChC,IAAI,MAAM,EAAE,CAAC;YACX,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACzB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,SAAS,GAAG,IAAI,gBAAgB,CAAC,KAAK,IAAI,EAAE;YAC/C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;YAChC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO;YACT,CAAC;YACD,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACzB,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QACpB,CAAC,CAAC,CAAC;QACH,IAAI,CAAC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M,CAAC,CAAC;YACzB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,SAAS,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;YACtC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;YAChC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO;YACT,CAAC;YACD,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACzB,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QACpB,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,CAAC;YAC/B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;QACtD,CAAC;QACD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC9B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,MAAM;QACJ,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC;IACvC,CAAC;CACF"}

View File

@@ -0,0 +1,29 @@
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
/**
* Determines whether a given node is suitable for text matching.
*
* @internal
*/
export declare const isSuitableNodeForTextMatching: (node: Node) => boolean;
/**
* @internal
*/
export interface TextContent {
full: string;
immediate: string[];
}
/**
* Builds the text content of a node using some custom logic.
*
* @remarks
* The primary reason this function exists is due to {@link ShadowRoot}s not having
* text content.
*
* @internal
*/
export declare const createTextContent: (root: Node) => TextContent;
//# sourceMappingURL=TextContent.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TextContent.d.ts","sourceRoot":"","sources":["../../../src/injected/TextContent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA+BH;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,GAAI,MAAM,IAAI,KAAG,OAI1D,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,WAAW;IAE1B,IAAI,EAAE,MAAM,CAAC;IAEb,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AA2BD;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,IAAI,KAAG,WAuD9C,CAAC"}

View File

@@ -0,0 +1,117 @@
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
const TRIVIAL_VALUE_INPUT_TYPES = new Set(['checkbox', 'image', 'radio']);
/**
* Determines if the node has a non-trivial value property.
*
* @internal
*/
const isNonTrivialValueNode = (node) => {
if (node instanceof HTMLSelectElement) {
return true;
}
if (node instanceof HTMLTextAreaElement) {
return true;
}
if (node instanceof HTMLInputElement &&
!TRIVIAL_VALUE_INPUT_TYPES.has(node.type)) {
return true;
}
return false;
};
const UNSUITABLE_NODE_NAMES = new Set(['SCRIPT', 'STYLE']);
/**
* Determines whether a given node is suitable for text matching.
*
* @internal
*/
export const isSuitableNodeForTextMatching = (node) => {
return (!UNSUITABLE_NODE_NAMES.has(node.nodeName) && !document.head?.contains(node));
};
/**
* Maps {@link Node}s to their computed {@link TextContent}.
*/
const textContentCache = new WeakMap();
const eraseFromCache = (node) => {
while (node) {
textContentCache.delete(node);
if (node instanceof ShadowRoot) {
node = node.host;
}
else {
node = node.parentNode;
}
}
};
/**
* Erases the cache when the tree has mutated text.
*/
const observedNodes = new WeakSet();
const textChangeObserver = new MutationObserver(mutations => {
for (const mutation of mutations) {
eraseFromCache(mutation.target);
}
});
/**
* Builds the text content of a node using some custom logic.
*
* @remarks
* The primary reason this function exists is due to {@link ShadowRoot}s not having
* text content.
*
* @internal
*/
export const createTextContent = (root) => {
let value = textContentCache.get(root);
if (value) {
return value;
}
value = { full: '', immediate: [] };
if (!isSuitableNodeForTextMatching(root)) {
return value;
}
let currentImmediate = '';
if (isNonTrivialValueNode(root)) {
value.full = root.value;
value.immediate.push(root.value);
root.addEventListener('input', event => {
eraseFromCache(event.target);
}, { once: true, capture: true });
}
else {
for (let child = root.firstChild; child; child = child.nextSibling) {
if (child.nodeType === Node.TEXT_NODE) {
value.full += child.nodeValue ?? '';
currentImmediate += child.nodeValue ?? '';
continue;
}
if (currentImmediate) {
value.immediate.push(currentImmediate);
}
currentImmediate = '';
if (child.nodeType === Node.ELEMENT_NODE) {
value.full += createTextContent(child).full;
}
}
if (currentImmediate) {
value.immediate.push(currentImmediate);
}
if (root instanceof Element && root.shadowRoot) {
value.full += createTextContent(root.shadowRoot).full;
}
if (!observedNodes.has(root)) {
textChangeObserver.observe(root, {
childList: true,
characterData: true,
subtree: true,
});
observedNodes.add(root);
}
}
textContentCache.set(root, value);
return value;
};
//# sourceMappingURL=TextContent.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TextContent.js","sourceRoot":"","sources":["../../../src/injected/TextContent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAE1E;;;;GAIG;AACH,MAAM,qBAAqB,GAAG,CAAC,IAAU,EAA+B,EAAE;IACxE,IAAI,IAAI,YAAY,iBAAiB,EAAE,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,IAAI,YAAY,mBAAmB,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IACE,IAAI,YAAY,gBAAgB;QAChC,CAAC,yBAAyB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EACzC,CAAC;QACD,OAAO,IAAI,CAA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C9C,CAAC;QACH,CAAC;QACD,IAAI,gBAAgB,EAAE,CAAC;YACrB,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACzC,CAAC;QACD,IAAI,IAAI,YAAY,OAAO,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAC/C,KAAK,CAAC,IAAI,IAAI,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;QACxD,CAAC;QAED,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7B,kBAAkB,CAAC,OAAO,CAAC,IAAI,EAAE;gBAC/B,SAAS,EAAE,IAAI;gBACf,aAAa,EAAE,IAAI;gBACnB,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;YACH,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,gBAAgB,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}

View File

@@ -0,0 +1,12 @@
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
/**
* Queries the given node for all nodes matching the given text selector.
*
* @internal
*/
export declare const textQuerySelectorAll: (root: Node, selector: string) => Generator<Element>;
//# sourceMappingURL=TextQuerySelector.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TextQuerySelector.d.ts","sourceRoot":"","sources":["../../../src/injected/TextQuerySelector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,MAAM,IAAI,EACV,UAAU,MAAM,KACf,SAAS,CAAC,OAAO,CA0BnB,CAAC"}

View File

@@ -0,0 +1,39 @@
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import { createTextContent, isSuitableNodeForTextMatching, } from './TextContent.js';
/**
* Queries the given node for all nodes matching the given text selector.
*
* @internal
*/
export const textQuerySelectorAll = function* (root, selector) {
let yielded = false;
for (const node of root.childNodes) {
if (node instanceof Element && isSuitableNodeForTextMatching(node)) {
let matches;
if (!node.shadowRoot) {
matches = textQuerySelectorAll(node, selector);
}
else {
matches = textQuerySelectorAll(node.shadowRoot, selector);
}
for (const match of matches) {
yield match;
yielded = true;
}
}
}
if (yielded) {
return;
}
if (root instanceof Element && isSuitableNodeForTextMatching(root)) {
const textContent = createTextContent(root);
if (textContent.full.includes(selector)) {
yield root;
}
}
};
//# sourceMappingURL=TextQuerySelector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TextQuerySelector.js","sourceRoot":"","sources":["../../../src/injected/TextQuerySelector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,iBAAiB,EACjB,6BAA6B,GAC9B,MAAM,kBAAkB,CAAC;AAE1B;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC,EAC3C,IAAU,EACV,QAAgB;IAEhB,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QACnC,IAAI,IAAI,YAAY,OAAO,IAAI,6BAA6B,CAAC,IAAI,CAAC,EAAE,CAAC;YACnE,IAAI,OAAoC,CAAC;YACzC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;gBACrB,OAAO,GAAG,oBAAoB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YACjD,CAAC;iBAAM,CAAC;gBACN,OAAO,GAAG,oBAAoB,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YAC5D,CAAC;YACD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;gBAC5B,MAAM,KAAK,CAAC;gBACZ,OAAO,GAAG,IAAI,CAAC;YACjB,CAAC;QACH,CAAC;IACH,CAAC;IACD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO;IACT,CAAC;IAED,IAAI,IAAI,YAAY,OAAO,IAAI,6BAA6B,CAAC,IAAI,CAAC,EAAE,CAAC;QACnE,MAAM,WAAW,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACxC,MAAM,IAAI,CAAC;QACb,CAAC;IACH,CAAC;AACH,CAAC,CAAC"}

View File

@@ -0,0 +1,10 @@
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @internal
*/
export declare const xpathQuerySelectorAll: (root: Node, selector: string, maxResults?: number) => Iterable<Node>;
//# sourceMappingURL=XPathQuerySelector.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"XPathQuerySelector.d.ts","sourceRoot":"","sources":["../../../src/injected/XPathQuerySelector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAChC,MAAM,IAAI,EACV,UAAU,MAAM,EAChB,mBAAe,KACd,QAAQ,CAAC,IAAI,CAyBf,CAAC"}

View File

@@ -0,0 +1,28 @@
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @internal
*/
export const xpathQuerySelectorAll = function* (root, selector, maxResults = -1) {
const doc = root.ownerDocument || document;
const iterator = doc.evaluate(selector, root, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE);
const items = [];
let item;
// Read all results upfront to avoid
// https://stackoverflow.com/questions/48235278/xpath-error-the-document-has-mutated-since-the-result-was-returned.
while ((item = iterator.iterateNext())) {
items.push(item);
if (maxResults && items.length === maxResults) {
break;
}
}
for (let i = 0; i < items.length; i++) {
item = items[i];
yield item;
items[i] = null;
}
};
//# sourceMappingURL=XPathQuerySelector.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"XPathQuerySelector.js","sourceRoot":"","sources":["../../../src/injected/XPathQuerySelector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,QAAQ,CAAC,EAC5C,IAAU,EACV,QAAgB,EAChB,UAAU,GAAG,CAAC,CAAC;IAEf,MAAM,GAAG,GAAG,IAAI,CAAC,aAAa,IAAI,QAAQ,CAAC;IAC3C,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAC3B,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,WAAW,CAAC,0BAA0B,CACvC,CAAC;IACF,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,IAAI,IAAI,CAAC;IAET,oCAAoC;IACpC,mHAAmH;IACnH,OAAO,CAAC,IAAI,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;QACvC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,IAAI,UAAU,IAAI,KAAK,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;YAC9C,MAAM;QACR,CAAC;IACH,CAAC;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAChB,MAAM,IAAY,CAAC;QACnB,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAClB,CAAC;AACH,CAAC,CAAC"}

View File

@@ -0,0 +1,51 @@
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import { Deferred } from '../util/Deferred.js';
import * as CustomQuerySelectors from './CustomQuerySelector.js';
import { IntervalPoller, MutationPoller, RAFPoller } from './Poller.js';
import * as PQuerySelector from './PQuerySelector.js';
/**
* @internal
*/
declare const PuppeteerUtil: Readonly<{
Deferred: typeof Deferred;
createFunction: (functionValue: string) => ((...args: unknown[]) => unknown);
createTextContent: (root: Node) => import("./TextContent.js").TextContent;
IntervalPoller: typeof IntervalPoller;
isSuitableNodeForTextMatching: (node: Node) => boolean;
MutationPoller: typeof MutationPoller;
RAFPoller: typeof RAFPoller;
cssQuerySelector: (root: Node, selector: string) => Element | null;
cssQuerySelectorAll: (root: Node, selector: string) => Iterable<Element>;
xpathQuerySelectorAll: (root: Node, selector: string, maxResults?: number) => Iterable<Node>;
pierce(root: Node): IterableIterator<Node | ShadowRoot>;
pierceAll(root: Node): IterableIterator<Node | ShadowRoot>;
checkVisibility: (node: Node | null, visible?: boolean) => Node | boolean;
textQuerySelectorAll: (root: Node, selector: string) => Generator<Element>;
PCombinator: typeof PQuerySelector.PCombinator;
pQuerySelectorAll: (root: Node, selector: string) => import("../index-browser.js").AwaitableIterable<Node>;
pQuerySelector: (root: Node, selector: string) => Promise<Node | null>;
pierceQuerySelector: (root: Node, selector: string) => Element | null;
pierceQuerySelectorAll: (element: Node, selector: string) => Element[];
customQuerySelectors: {
"__#208@#selectors": Map<string, CustomQuerySelectors.CustomQuerySelector>;
register(name: string, handler: import("../index-browser.js").CustomQueryHandler): void;
unregister(name: string): void;
get(name: string): CustomQuerySelectors.CustomQuerySelector | undefined;
clear(): void;
};
ariaQuerySelector: (root: Node, selector: string) => Promise<Node | null>;
ariaQuerySelectorAll: (root: Node, selector: string) => AsyncIterable<Node>;
}>;
/**
* @internal
*/
export type PuppeteerInjectedUtil = typeof PuppeteerUtil;
/**
* @internal
*/
export default PuppeteerUtil;
//# sourceMappingURL=injected.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"injected.d.ts","sourceRoot":"","sources":["../../../src/injected/injected.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAK7C,OAAO,KAAK,oBAAoB,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EAAC,cAAc,EAAE,cAAc,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AACtE,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AAStD;;GAEG;AACH,QAAA,MAAM,aAAa;;iDAhBqB,GAAG;;;;;;uBAHnC,UAAa,EAAC,gBAAmB;0BAIY,UACrD,EAAC,gBAAmB;4BALI,UAAY,EAAC,gBAElC,EAAC,mBAAkB;;;sBAAV,iBAAmB,EAAC,iBAAoB;2BAEzB,UAAa,EAAC,gBAAmB;;wBA0C4gL,UAAa,EAAC,gBAAmB;qBAAi8B,UAAa,EAAC,gBAAmB;0BA9ChkN,UAAa,EAAC,gBAAmB;6BAqBrC,aAAgB,EAAC,gBACR;;;;;;;;wBAjB0B,UAAa,EAAC,gBAC9C;2BAOH,UAAa,EAAE,gBACjB;EAqBH,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,aAAa,CAAC;AAEzD;;GAEG;AACH,eAAe,aAAa,CAAC"}

View File

@@ -0,0 +1,42 @@
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
import { Deferred } from '../util/Deferred.js';
import { createFunction } from '../util/Function.js';
import * as ARIAQuerySelector from './ARIAQuerySelector.js';
import * as CSSSelector from './CSSSelector.js';
import * as CustomQuerySelectors from './CustomQuerySelector.js';
import * as PierceQuerySelector from './PierceQuerySelector.js';
import { IntervalPoller, MutationPoller, RAFPoller } from './Poller.js';
import * as PQuerySelector from './PQuerySelector.js';
import { createTextContent, isSuitableNodeForTextMatching, } from './TextContent.js';
import * as TextQuerySelector from './TextQuerySelector.js';
import * as util from './util.js';
import * as XPathQuerySelector from './XPathQuerySelector.js';
/**
* @internal
*/
const PuppeteerUtil = Object.freeze({
...ARIAQuerySelector,
...CustomQuerySelectors,
...PierceQuerySelector,
...PQuerySelector,
...TextQuerySelector,
...util,
...XPathQuerySelector,
...CSSSelector,
Deferred,
createFunction,
createTextContent,
IntervalPoller,
isSuitableNodeForTextMatching,
MutationPoller,
RAFPoller,
});
/**
* @internal
*/
export default PuppeteerUtil;
//# sourceMappingURL=injected.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"injected.js","sourceRoot":"","sources":["../../../src/injected/injected.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAEnD,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,oBAAoB,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAC,cAAc,EAAE,cAAc,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AACtE,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACL,iBAAiB,EACjB,6BAA6B,GAC9B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAC;AAE9D;;GAEG;AACH,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IAClC,GAAG,iBAAiB;IACpB,GAAG,oBAAoB;IACvB,GAAG,mBAAmB;IACtB,GAAG,cAAc;IACjB,GAAG,iBAAiB;IACpB,GAAG,IAAI;IACP,GAAG,kBAAkB;IACrB,GAAG,WAAW;IACd,QAAQ;IACR,cAAc;IACd,iBAAiB;IACjB,cAAc;IACd,6BAA6B;IAC7B,cAAc;IACd,SAAS;CACV,CAAC,CAAC;AAOH;;GAEG;AACH,eAAe,aAAa,CAAC"}

View File

@@ -0,0 +1,13 @@
/**
* @internal
*/
export declare const checkVisibility: (node: Node | null, visible?: boolean) => Node | boolean;
/**
* @internal
*/
export declare function pierce(root: Node): IterableIterator<Node | ShadowRoot>;
/**
* @internal
*/
export declare function pierceAll(root: Node): IterableIterator<Node | ShadowRoot>;
//# sourceMappingURL=util.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/injected/util.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,MAAM,IAAI,GAAG,IAAI,EACjB,UAAU,OAAO,KAChB,IAAI,GAAG,OAiBT,CAAC;AAWF;;GAEG;AACH,wBAAiB,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,gBAAgB,CAAC,IAAI,GAAG,UAAU,CAAC,CAMvE;AAED;;GAEG;AACH,wBAAiB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,gBAAgB,CAAC,IAAI,GAAG,UAAU,CAAC,CAgB1E"}

View File

@@ -0,0 +1,60 @@
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
const HIDDEN_VISIBILITY_VALUES = ['hidden', 'collapse'];
/**
* @internal
*/
export const checkVisibility = (node, visible) => {
if (!node) {
return visible === false;
}
if (visible === undefined) {
return node;
}
const element = (node.nodeType === Node.TEXT_NODE ? node.parentElement : node);
const style = window.getComputedStyle(element);
const isVisible = style &&
!HIDDEN_VISIBILITY_VALUES.includes(style.visibility) &&
!isBoundingBoxEmpty(element);
return visible === isVisible ? node : false;
};
function isBoundingBoxEmpty(element) {
const rect = element.getBoundingClientRect();
return rect.width === 0 || rect.height === 0;
}
const hasShadowRoot = (node) => {
return 'shadowRoot' in node && node.shadowRoot instanceof ShadowRoot;
};
/**
* @internal
*/
export function* pierce(root) {
if (hasShadowRoot(root)) {
yield root.shadowRoot;
}
else {
yield root;
}
}
/**
* @internal
*/
export function* pierceAll(root) {
root = pierce(root).next().value;
yield root;
const walkers = [document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT)];
for (const walker of walkers) {
let node;
while ((node = walker.nextNode())) {
if (!node.shadowRoot) {
continue;
}
yield node.shadowRoot;
walkers.push(document.createTreeWalker(node.shadowRoot, NodeFilter.SHOW_ELEMENT));
}
}
}
//# sourceMappingURL=util.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../src/injected/util.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,wBAAwB,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAExD;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,IAAiB,EACjB,OAAiB,EACD,EAAE;IAClB,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,OAAO,KAAK,KAAK,CAAC;IAC3B,CAAC;IACD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,OAAO,GAAG,CACd,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAClD,CAAC;IAEb,MAAM,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC/C,MAAM,SAAS,GACb,KAAK;QACL,CAAC,wBAAwB,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC;QACpD,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC/B,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AAC9C,CAAC,CAAC;AAEF,SAAS,kBAAkB,CAAC,OAAgB;IAC1C,MAAM,IAAI,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAC7C,OAAO,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,aAAa,GAAG,CAAC,IAAU,EAA2C,EAAE;IAC5E,OAAO,YAAY,IAAI,IAAI,IAAI,IAAI,CAAC,UAAU,YAAY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