Trim vendored svgo-client payload
Remove unused svgo-client files while keeping bin/svgo-client/svgo.cmd runtime behavior intact. Drop node_modules/.bin wrappers, TypeScript declaration files (*.d.ts), and obsolete svgo-cli.js wrapper script. Co-Authored-By: Abacus.AI CLI <agent@abacus.ai>
This commit is contained in:
-71
@@ -1,71 +0,0 @@
|
||||
import type { AnyNode } from "domhandler";
|
||||
/**
|
||||
* The medium of a media item.
|
||||
*
|
||||
* @category Feeds
|
||||
*/
|
||||
export type FeedItemMediaMedium = "image" | "audio" | "video" | "document" | "executable";
|
||||
/**
|
||||
* The type of a media item.
|
||||
*
|
||||
* @category Feeds
|
||||
*/
|
||||
export type FeedItemMediaExpression = "sample" | "full" | "nonstop";
|
||||
/**
|
||||
* A media item of a feed entry.
|
||||
*
|
||||
* @category Feeds
|
||||
*/
|
||||
export interface FeedItemMedia {
|
||||
medium: FeedItemMediaMedium | undefined;
|
||||
isDefault: boolean;
|
||||
url?: string;
|
||||
fileSize?: number;
|
||||
type?: string;
|
||||
expression?: FeedItemMediaExpression;
|
||||
bitrate?: number;
|
||||
framerate?: number;
|
||||
samplingrate?: number;
|
||||
channels?: number;
|
||||
duration?: number;
|
||||
height?: number;
|
||||
width?: number;
|
||||
lang?: string;
|
||||
}
|
||||
/**
|
||||
* An entry of a feed.
|
||||
*
|
||||
* @category Feeds
|
||||
*/
|
||||
export interface FeedItem {
|
||||
id?: string;
|
||||
title?: string;
|
||||
link?: string;
|
||||
description?: string;
|
||||
pubDate?: Date;
|
||||
media: FeedItemMedia[];
|
||||
}
|
||||
/**
|
||||
* The root of a feed.
|
||||
*
|
||||
* @category Feeds
|
||||
*/
|
||||
export interface Feed {
|
||||
type: string;
|
||||
id?: string;
|
||||
title?: string;
|
||||
link?: string;
|
||||
description?: string;
|
||||
updated?: Date;
|
||||
author?: string;
|
||||
items: FeedItem[];
|
||||
}
|
||||
/**
|
||||
* Get the feed object from the root of a DOM tree.
|
||||
*
|
||||
* @category Feeds
|
||||
* @param doc - The DOM to to extract the feed from.
|
||||
* @returns The feed.
|
||||
*/
|
||||
export declare function getFeed(doc: AnyNode[]): Feed | null;
|
||||
//# sourceMappingURL=feeds.d.ts.map
|
||||
-59
@@ -1,59 +0,0 @@
|
||||
import { AnyNode } from "domhandler";
|
||||
/**
|
||||
* Given an array of nodes, remove any member that is contained by another
|
||||
* member.
|
||||
*
|
||||
* @category Helpers
|
||||
* @param nodes Nodes to filter.
|
||||
* @returns Remaining nodes that aren't contained by other nodes.
|
||||
*/
|
||||
export declare function removeSubsets(nodes: AnyNode[]): AnyNode[];
|
||||
/**
|
||||
* @category Helpers
|
||||
* @see {@link http://dom.spec.whatwg.org/#dom-node-comparedocumentposition}
|
||||
*/
|
||||
export declare const enum DocumentPosition {
|
||||
DISCONNECTED = 1,
|
||||
PRECEDING = 2,
|
||||
FOLLOWING = 4,
|
||||
CONTAINS = 8,
|
||||
CONTAINED_BY = 16
|
||||
}
|
||||
/**
|
||||
* Compare the position of one node against another node in any other document,
|
||||
* returning a bitmask with the values from {@link DocumentPosition}.
|
||||
*
|
||||
* Document order:
|
||||
* > There is an ordering, document order, defined on all the nodes in the
|
||||
* > document corresponding to the order in which the first character of the
|
||||
* > XML representation of each node occurs in the XML representation of the
|
||||
* > document after expansion of general entities. Thus, the document element
|
||||
* > node will be the first node. Element nodes occur before their children.
|
||||
* > Thus, document order orders element nodes in order of the occurrence of
|
||||
* > their start-tag in the XML (after expansion of entities). The attribute
|
||||
* > nodes of an element occur after the element and before its children. The
|
||||
* > relative order of attribute nodes is implementation-dependent.
|
||||
*
|
||||
* Source:
|
||||
* http://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-document-order
|
||||
*
|
||||
* @category Helpers
|
||||
* @param nodeA The first node to use in the comparison
|
||||
* @param nodeB The second node to use in the comparison
|
||||
* @returns A bitmask describing the input nodes' relative position.
|
||||
*
|
||||
* See http://dom.spec.whatwg.org/#dom-node-comparedocumentposition for
|
||||
* a description of these values.
|
||||
*/
|
||||
export declare function compareDocumentPosition(nodeA: AnyNode, nodeB: AnyNode): number;
|
||||
/**
|
||||
* Sort an array of nodes based on their relative position in the document,
|
||||
* removing any duplicate nodes. If the array contains nodes that do not belong
|
||||
* to the same document, sort order is unspecified.
|
||||
*
|
||||
* @category Helpers
|
||||
* @param nodes Array of DOM nodes.
|
||||
* @returns Collection of unique nodes, sorted in document order.
|
||||
*/
|
||||
export declare function uniqueSort<T extends AnyNode>(nodes: T[]): T[];
|
||||
//# sourceMappingURL=helpers.d.ts.map
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
export * from "./stringify.js";
|
||||
export * from "./traversal.js";
|
||||
export * from "./manipulation.js";
|
||||
export * from "./querying.js";
|
||||
export * from "./legacy.js";
|
||||
export * from "./helpers.js";
|
||||
export * from "./feeds.js";
|
||||
/** @deprecated Use these methods from `domhandler` directly. */
|
||||
export { isTag, isCDATA, isText, isComment, isDocument, hasChildren, } from "domhandler";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
-79
@@ -1,79 +0,0 @@
|
||||
import { AnyNode, Element } from "domhandler";
|
||||
import type { ElementType } from "domelementtype";
|
||||
/**
|
||||
* An object with keys to check elements against. If a key is `tag_name`,
|
||||
* `tag_type` or `tag_contains`, it will check the value against that specific
|
||||
* value. Otherwise, it will check an attribute with the key's name.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
*/
|
||||
export interface TestElementOpts {
|
||||
tag_name?: string | ((name: string) => boolean);
|
||||
tag_type?: string | ((name: string) => boolean);
|
||||
tag_contains?: string | ((data?: string) => boolean);
|
||||
[attributeName: string]: undefined | string | ((attributeValue: string) => boolean);
|
||||
}
|
||||
/**
|
||||
* Checks whether a node matches the description in `options`.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param options An object describing nodes to look for.
|
||||
* @param node The element to test.
|
||||
* @returns Whether the element matches the description in `options`.
|
||||
*/
|
||||
export declare function testElement(options: TestElementOpts, node: AnyNode): boolean;
|
||||
/**
|
||||
* Returns all nodes that match `options`.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param options An object describing nodes to look for.
|
||||
* @param nodes Nodes to search through.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @param limit Maximum number of nodes to return.
|
||||
* @returns All nodes that match `options`.
|
||||
*/
|
||||
export declare function getElements(options: TestElementOpts, nodes: AnyNode | AnyNode[], recurse: boolean, limit?: number): AnyNode[];
|
||||
/**
|
||||
* Returns the node with the supplied ID.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param id The unique ID attribute value to look for.
|
||||
* @param nodes Nodes to search through.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @returns The node with the supplied ID.
|
||||
*/
|
||||
export declare function getElementById(id: string | ((id: string) => boolean), nodes: AnyNode | AnyNode[], recurse?: boolean): Element | null;
|
||||
/**
|
||||
* Returns all nodes with the supplied `tagName`.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param tagName Tag name to search for.
|
||||
* @param nodes Nodes to search through.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @param limit Maximum number of nodes to return.
|
||||
* @returns All nodes with the supplied `tagName`.
|
||||
*/
|
||||
export declare function getElementsByTagName(tagName: string | ((name: string) => boolean), nodes: AnyNode | AnyNode[], recurse?: boolean, limit?: number): Element[];
|
||||
/**
|
||||
* Returns all nodes with the supplied `className`.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param className Class name to search for.
|
||||
* @param nodes Nodes to search through.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @param limit Maximum number of nodes to return.
|
||||
* @returns All nodes with the supplied `className`.
|
||||
*/
|
||||
export declare function getElementsByClassName(className: string | ((name: string) => boolean), nodes: AnyNode | AnyNode[], recurse?: boolean, limit?: number): Element[];
|
||||
/**
|
||||
* Returns all nodes with the supplied `type`.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param type Element type to look for.
|
||||
* @param nodes Nodes to search through.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @param limit Maximum number of nodes to return.
|
||||
* @returns All nodes with the supplied `type`.
|
||||
*/
|
||||
export declare function getElementsByTagType(type: ElementType | ((type: ElementType) => boolean), nodes: AnyNode | AnyNode[], recurse?: boolean, limit?: number): AnyNode[];
|
||||
//# sourceMappingURL=legacy.d.ts.map
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
import type { ChildNode, ParentNode } from "domhandler";
|
||||
/**
|
||||
* Remove an element from the dom
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param elem The element to be removed
|
||||
*/
|
||||
export declare function removeElement(elem: ChildNode): void;
|
||||
/**
|
||||
* Replace an element in the dom
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param elem The element to be replaced
|
||||
* @param replacement The element to be added
|
||||
*/
|
||||
export declare function replaceElement(elem: ChildNode, replacement: ChildNode): void;
|
||||
/**
|
||||
* Append a child to an element.
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param parent The element to append to.
|
||||
* @param child The element to be added as a child.
|
||||
*/
|
||||
export declare function appendChild(parent: ParentNode, child: ChildNode): void;
|
||||
/**
|
||||
* Append an element after another.
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param elem The element to append after.
|
||||
* @param next The element be added.
|
||||
*/
|
||||
export declare function append(elem: ChildNode, next: ChildNode): void;
|
||||
/**
|
||||
* Prepend a child to an element.
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param parent The element to prepend before.
|
||||
* @param child The element to be added as a child.
|
||||
*/
|
||||
export declare function prependChild(parent: ParentNode, child: ChildNode): void;
|
||||
/**
|
||||
* Prepend an element before another.
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param elem The element to prepend before.
|
||||
* @param prev The element be added.
|
||||
*/
|
||||
export declare function prepend(elem: ChildNode, prev: ChildNode): void;
|
||||
//# sourceMappingURL=manipulation.d.ts.map
|
||||
-64
@@ -1,64 +0,0 @@
|
||||
import { Element, AnyNode, ParentNode } from "domhandler";
|
||||
/**
|
||||
* Search a node and its children for nodes passing a test function. If `node` is not an array, it will be wrapped in one.
|
||||
*
|
||||
* @category Querying
|
||||
* @param test Function to test nodes on.
|
||||
* @param node Node to search. Will be included in the result set if it matches.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @param limit Maximum number of nodes to return.
|
||||
* @returns All nodes passing `test`.
|
||||
*/
|
||||
export declare function filter(test: (elem: AnyNode) => boolean, node: AnyNode | AnyNode[], recurse?: boolean, limit?: number): AnyNode[];
|
||||
/**
|
||||
* Search an array of nodes and their children for nodes passing a test function.
|
||||
*
|
||||
* @category Querying
|
||||
* @param test Function to test nodes on.
|
||||
* @param nodes Array of nodes to search.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @param limit Maximum number of nodes to return.
|
||||
* @returns All nodes passing `test`.
|
||||
*/
|
||||
export declare function find(test: (elem: AnyNode) => boolean, nodes: AnyNode[] | ParentNode, recurse: boolean, limit: number): AnyNode[];
|
||||
/**
|
||||
* Finds the first element inside of an array that matches a test function. This is an alias for `Array.prototype.find`.
|
||||
*
|
||||
* @category Querying
|
||||
* @param test Function to test nodes on.
|
||||
* @param nodes Array of nodes to search.
|
||||
* @returns The first node in the array that passes `test`.
|
||||
* @deprecated Use `Array.prototype.find` directly.
|
||||
*/
|
||||
export declare function findOneChild<T>(test: (elem: T) => boolean, nodes: T[]): T | undefined;
|
||||
/**
|
||||
* Finds one element in a tree that passes a test.
|
||||
*
|
||||
* @category Querying
|
||||
* @param test Function to test nodes on.
|
||||
* @param nodes Node or array of nodes to search.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @returns The first node that passes `test`.
|
||||
*/
|
||||
export declare function findOne(test: (elem: Element) => boolean, nodes: AnyNode[] | ParentNode, recurse?: boolean): Element | null;
|
||||
/**
|
||||
* Checks if a tree of nodes contains at least one node passing a test.
|
||||
*
|
||||
* @category Querying
|
||||
* @param test Function to test nodes on.
|
||||
* @param nodes Array of nodes to search.
|
||||
* @returns Whether a tree of nodes contains at least one node passing the test.
|
||||
*/
|
||||
export declare function existsOne(test: (elem: Element) => boolean, nodes: AnyNode[] | ParentNode): boolean;
|
||||
/**
|
||||
* Search an array of nodes and their children for elements passing a test function.
|
||||
*
|
||||
* Same as `find`, but limited to elements and with less options, leading to reduced complexity.
|
||||
*
|
||||
* @category Querying
|
||||
* @param test Function to test nodes on.
|
||||
* @param nodes Array of nodes to search.
|
||||
* @returns All nodes passing `test`.
|
||||
*/
|
||||
export declare function findAll(test: (elem: Element) => boolean, nodes: AnyNode[] | ParentNode): Element[];
|
||||
//# sourceMappingURL=querying.d.ts.map
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
import { AnyNode } from "domhandler";
|
||||
import { DomSerializerOptions } from "dom-serializer";
|
||||
/**
|
||||
* @category Stringify
|
||||
* @deprecated Use the `dom-serializer` module directly.
|
||||
* @param node Node to get the outer HTML of.
|
||||
* @param options Options for serialization.
|
||||
* @returns `node`'s outer HTML.
|
||||
*/
|
||||
export declare function getOuterHTML(node: AnyNode | ArrayLike<AnyNode>, options?: DomSerializerOptions): string;
|
||||
/**
|
||||
* @category Stringify
|
||||
* @deprecated Use the `dom-serializer` module directly.
|
||||
* @param node Node to get the inner HTML of.
|
||||
* @param options Options for serialization.
|
||||
* @returns `node`'s inner HTML.
|
||||
*/
|
||||
export declare function getInnerHTML(node: AnyNode, options?: DomSerializerOptions): string;
|
||||
/**
|
||||
* Get a node's inner text. Same as `textContent`, but inserts newlines for `<br>` tags. Ignores comments.
|
||||
*
|
||||
* @category Stringify
|
||||
* @deprecated Use `textContent` instead.
|
||||
* @param node Node to get the inner text of.
|
||||
* @returns `node`'s inner text.
|
||||
*/
|
||||
export declare function getText(node: AnyNode | AnyNode[]): string;
|
||||
/**
|
||||
* Get a node's text content. Ignores comments.
|
||||
*
|
||||
* @category Stringify
|
||||
* @param node Node to get the text content of.
|
||||
* @returns `node`'s text content.
|
||||
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent}
|
||||
*/
|
||||
export declare function textContent(node: AnyNode | AnyNode[]): string;
|
||||
/**
|
||||
* Get a node's inner text, ignoring `<script>` and `<style>` tags. Ignores comments.
|
||||
*
|
||||
* @category Stringify
|
||||
* @param node Node to get the inner text of.
|
||||
* @returns `node`'s inner text.
|
||||
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/innerText}
|
||||
*/
|
||||
export declare function innerText(node: AnyNode | AnyNode[]): string;
|
||||
//# sourceMappingURL=stringify.d.ts.map
|
||||
-67
@@ -1,67 +0,0 @@
|
||||
import { AnyNode, ChildNode, Element, ParentNode } from "domhandler";
|
||||
/**
|
||||
* Get a node's children.
|
||||
*
|
||||
* @category Traversal
|
||||
* @param elem Node to get the children of.
|
||||
* @returns `elem`'s children, or an empty array.
|
||||
*/
|
||||
export declare function getChildren(elem: AnyNode): ChildNode[];
|
||||
export declare function getParent(elem: AnyNode): ParentNode | null;
|
||||
/**
|
||||
* Gets an elements siblings, including the element itself.
|
||||
*
|
||||
* Attempts to get the children through the element's parent first. If we don't
|
||||
* have a parent (the element is a root node), we walk the element's `prev` &
|
||||
* `next` to get all remaining nodes.
|
||||
*
|
||||
* @category Traversal
|
||||
* @param elem Element to get the siblings of.
|
||||
* @returns `elem`'s siblings, including `elem`.
|
||||
*/
|
||||
export declare function getSiblings(elem: AnyNode): AnyNode[];
|
||||
/**
|
||||
* Gets an attribute from an element.
|
||||
*
|
||||
* @category Traversal
|
||||
* @param elem Element to check.
|
||||
* @param name Attribute name to retrieve.
|
||||
* @returns The element's attribute value, or `undefined`.
|
||||
*/
|
||||
export declare function getAttributeValue(elem: Element, name: string): string | undefined;
|
||||
/**
|
||||
* Checks whether an element has an attribute.
|
||||
*
|
||||
* @category Traversal
|
||||
* @param elem Element to check.
|
||||
* @param name Attribute name to look for.
|
||||
* @returns Returns whether `elem` has the attribute `name`.
|
||||
*/
|
||||
export declare function hasAttrib(elem: Element, name: string): boolean;
|
||||
/**
|
||||
* Get the tag name of an element.
|
||||
*
|
||||
* @category Traversal
|
||||
* @param elem The element to get the name for.
|
||||
* @returns The tag name of `elem`.
|
||||
*/
|
||||
export declare function getName(elem: Element): string;
|
||||
/**
|
||||
* Returns the next element sibling of a node.
|
||||
*
|
||||
* @category Traversal
|
||||
* @param elem The element to get the next sibling of.
|
||||
* @returns `elem`'s next sibling that is a tag, or `null` if there is no next
|
||||
* sibling.
|
||||
*/
|
||||
export declare function nextElementSibling(elem: AnyNode): Element | null;
|
||||
/**
|
||||
* Returns the previous element sibling of a node.
|
||||
*
|
||||
* @category Traversal
|
||||
* @param elem The element to get the previous sibling of.
|
||||
* @returns `elem`'s previous sibling that is a tag, or `null` if there is no
|
||||
* previous sibling.
|
||||
*/
|
||||
export declare function prevElementSibling(elem: AnyNode): Element | null;
|
||||
//# sourceMappingURL=traversal.d.ts.map
|
||||
-71
@@ -1,71 +0,0 @@
|
||||
import type { AnyNode } from "domhandler";
|
||||
/**
|
||||
* The medium of a media item.
|
||||
*
|
||||
* @category Feeds
|
||||
*/
|
||||
export type FeedItemMediaMedium = "image" | "audio" | "video" | "document" | "executable";
|
||||
/**
|
||||
* The type of a media item.
|
||||
*
|
||||
* @category Feeds
|
||||
*/
|
||||
export type FeedItemMediaExpression = "sample" | "full" | "nonstop";
|
||||
/**
|
||||
* A media item of a feed entry.
|
||||
*
|
||||
* @category Feeds
|
||||
*/
|
||||
export interface FeedItemMedia {
|
||||
medium: FeedItemMediaMedium | undefined;
|
||||
isDefault: boolean;
|
||||
url?: string;
|
||||
fileSize?: number;
|
||||
type?: string;
|
||||
expression?: FeedItemMediaExpression;
|
||||
bitrate?: number;
|
||||
framerate?: number;
|
||||
samplingrate?: number;
|
||||
channels?: number;
|
||||
duration?: number;
|
||||
height?: number;
|
||||
width?: number;
|
||||
lang?: string;
|
||||
}
|
||||
/**
|
||||
* An entry of a feed.
|
||||
*
|
||||
* @category Feeds
|
||||
*/
|
||||
export interface FeedItem {
|
||||
id?: string;
|
||||
title?: string;
|
||||
link?: string;
|
||||
description?: string;
|
||||
pubDate?: Date;
|
||||
media: FeedItemMedia[];
|
||||
}
|
||||
/**
|
||||
* The root of a feed.
|
||||
*
|
||||
* @category Feeds
|
||||
*/
|
||||
export interface Feed {
|
||||
type: string;
|
||||
id?: string;
|
||||
title?: string;
|
||||
link?: string;
|
||||
description?: string;
|
||||
updated?: Date;
|
||||
author?: string;
|
||||
items: FeedItem[];
|
||||
}
|
||||
/**
|
||||
* Get the feed object from the root of a DOM tree.
|
||||
*
|
||||
* @category Feeds
|
||||
* @param doc - The DOM to to extract the feed from.
|
||||
* @returns The feed.
|
||||
*/
|
||||
export declare function getFeed(doc: AnyNode[]): Feed | null;
|
||||
//# sourceMappingURL=feeds.d.ts.map
|
||||
-59
@@ -1,59 +0,0 @@
|
||||
import { AnyNode } from "domhandler";
|
||||
/**
|
||||
* Given an array of nodes, remove any member that is contained by another
|
||||
* member.
|
||||
*
|
||||
* @category Helpers
|
||||
* @param nodes Nodes to filter.
|
||||
* @returns Remaining nodes that aren't contained by other nodes.
|
||||
*/
|
||||
export declare function removeSubsets(nodes: AnyNode[]): AnyNode[];
|
||||
/**
|
||||
* @category Helpers
|
||||
* @see {@link http://dom.spec.whatwg.org/#dom-node-comparedocumentposition}
|
||||
*/
|
||||
export declare const enum DocumentPosition {
|
||||
DISCONNECTED = 1,
|
||||
PRECEDING = 2,
|
||||
FOLLOWING = 4,
|
||||
CONTAINS = 8,
|
||||
CONTAINED_BY = 16
|
||||
}
|
||||
/**
|
||||
* Compare the position of one node against another node in any other document,
|
||||
* returning a bitmask with the values from {@link DocumentPosition}.
|
||||
*
|
||||
* Document order:
|
||||
* > There is an ordering, document order, defined on all the nodes in the
|
||||
* > document corresponding to the order in which the first character of the
|
||||
* > XML representation of each node occurs in the XML representation of the
|
||||
* > document after expansion of general entities. Thus, the document element
|
||||
* > node will be the first node. Element nodes occur before their children.
|
||||
* > Thus, document order orders element nodes in order of the occurrence of
|
||||
* > their start-tag in the XML (after expansion of entities). The attribute
|
||||
* > nodes of an element occur after the element and before its children. The
|
||||
* > relative order of attribute nodes is implementation-dependent.
|
||||
*
|
||||
* Source:
|
||||
* http://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-document-order
|
||||
*
|
||||
* @category Helpers
|
||||
* @param nodeA The first node to use in the comparison
|
||||
* @param nodeB The second node to use in the comparison
|
||||
* @returns A bitmask describing the input nodes' relative position.
|
||||
*
|
||||
* See http://dom.spec.whatwg.org/#dom-node-comparedocumentposition for
|
||||
* a description of these values.
|
||||
*/
|
||||
export declare function compareDocumentPosition(nodeA: AnyNode, nodeB: AnyNode): number;
|
||||
/**
|
||||
* Sort an array of nodes based on their relative position in the document,
|
||||
* removing any duplicate nodes. If the array contains nodes that do not belong
|
||||
* to the same document, sort order is unspecified.
|
||||
*
|
||||
* @category Helpers
|
||||
* @param nodes Array of DOM nodes.
|
||||
* @returns Collection of unique nodes, sorted in document order.
|
||||
*/
|
||||
export declare function uniqueSort<T extends AnyNode>(nodes: T[]): T[];
|
||||
//# sourceMappingURL=helpers.d.ts.map
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
export * from "./stringify.js";
|
||||
export * from "./traversal.js";
|
||||
export * from "./manipulation.js";
|
||||
export * from "./querying.js";
|
||||
export * from "./legacy.js";
|
||||
export * from "./helpers.js";
|
||||
export * from "./feeds.js";
|
||||
/** @deprecated Use these methods from `domhandler` directly. */
|
||||
export { isTag, isCDATA, isText, isComment, isDocument, hasChildren, } from "domhandler";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
-79
@@ -1,79 +0,0 @@
|
||||
import { AnyNode, Element } from "domhandler";
|
||||
import type { ElementType } from "domelementtype";
|
||||
/**
|
||||
* An object with keys to check elements against. If a key is `tag_name`,
|
||||
* `tag_type` or `tag_contains`, it will check the value against that specific
|
||||
* value. Otherwise, it will check an attribute with the key's name.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
*/
|
||||
export interface TestElementOpts {
|
||||
tag_name?: string | ((name: string) => boolean);
|
||||
tag_type?: string | ((name: string) => boolean);
|
||||
tag_contains?: string | ((data?: string) => boolean);
|
||||
[attributeName: string]: undefined | string | ((attributeValue: string) => boolean);
|
||||
}
|
||||
/**
|
||||
* Checks whether a node matches the description in `options`.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param options An object describing nodes to look for.
|
||||
* @param node The element to test.
|
||||
* @returns Whether the element matches the description in `options`.
|
||||
*/
|
||||
export declare function testElement(options: TestElementOpts, node: AnyNode): boolean;
|
||||
/**
|
||||
* Returns all nodes that match `options`.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param options An object describing nodes to look for.
|
||||
* @param nodes Nodes to search through.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @param limit Maximum number of nodes to return.
|
||||
* @returns All nodes that match `options`.
|
||||
*/
|
||||
export declare function getElements(options: TestElementOpts, nodes: AnyNode | AnyNode[], recurse: boolean, limit?: number): AnyNode[];
|
||||
/**
|
||||
* Returns the node with the supplied ID.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param id The unique ID attribute value to look for.
|
||||
* @param nodes Nodes to search through.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @returns The node with the supplied ID.
|
||||
*/
|
||||
export declare function getElementById(id: string | ((id: string) => boolean), nodes: AnyNode | AnyNode[], recurse?: boolean): Element | null;
|
||||
/**
|
||||
* Returns all nodes with the supplied `tagName`.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param tagName Tag name to search for.
|
||||
* @param nodes Nodes to search through.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @param limit Maximum number of nodes to return.
|
||||
* @returns All nodes with the supplied `tagName`.
|
||||
*/
|
||||
export declare function getElementsByTagName(tagName: string | ((name: string) => boolean), nodes: AnyNode | AnyNode[], recurse?: boolean, limit?: number): Element[];
|
||||
/**
|
||||
* Returns all nodes with the supplied `className`.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param className Class name to search for.
|
||||
* @param nodes Nodes to search through.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @param limit Maximum number of nodes to return.
|
||||
* @returns All nodes with the supplied `className`.
|
||||
*/
|
||||
export declare function getElementsByClassName(className: string | ((name: string) => boolean), nodes: AnyNode | AnyNode[], recurse?: boolean, limit?: number): Element[];
|
||||
/**
|
||||
* Returns all nodes with the supplied `type`.
|
||||
*
|
||||
* @category Legacy Query Functions
|
||||
* @param type Element type to look for.
|
||||
* @param nodes Nodes to search through.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @param limit Maximum number of nodes to return.
|
||||
* @returns All nodes with the supplied `type`.
|
||||
*/
|
||||
export declare function getElementsByTagType(type: ElementType | ((type: ElementType) => boolean), nodes: AnyNode | AnyNode[], recurse?: boolean, limit?: number): AnyNode[];
|
||||
//# sourceMappingURL=legacy.d.ts.map
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
import type { ChildNode, ParentNode } from "domhandler";
|
||||
/**
|
||||
* Remove an element from the dom
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param elem The element to be removed
|
||||
*/
|
||||
export declare function removeElement(elem: ChildNode): void;
|
||||
/**
|
||||
* Replace an element in the dom
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param elem The element to be replaced
|
||||
* @param replacement The element to be added
|
||||
*/
|
||||
export declare function replaceElement(elem: ChildNode, replacement: ChildNode): void;
|
||||
/**
|
||||
* Append a child to an element.
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param parent The element to append to.
|
||||
* @param child The element to be added as a child.
|
||||
*/
|
||||
export declare function appendChild(parent: ParentNode, child: ChildNode): void;
|
||||
/**
|
||||
* Append an element after another.
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param elem The element to append after.
|
||||
* @param next The element be added.
|
||||
*/
|
||||
export declare function append(elem: ChildNode, next: ChildNode): void;
|
||||
/**
|
||||
* Prepend a child to an element.
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param parent The element to prepend before.
|
||||
* @param child The element to be added as a child.
|
||||
*/
|
||||
export declare function prependChild(parent: ParentNode, child: ChildNode): void;
|
||||
/**
|
||||
* Prepend an element before another.
|
||||
*
|
||||
* @category Manipulation
|
||||
* @param elem The element to prepend before.
|
||||
* @param prev The element be added.
|
||||
*/
|
||||
export declare function prepend(elem: ChildNode, prev: ChildNode): void;
|
||||
//# sourceMappingURL=manipulation.d.ts.map
|
||||
-64
@@ -1,64 +0,0 @@
|
||||
import { Element, AnyNode, ParentNode } from "domhandler";
|
||||
/**
|
||||
* Search a node and its children for nodes passing a test function. If `node` is not an array, it will be wrapped in one.
|
||||
*
|
||||
* @category Querying
|
||||
* @param test Function to test nodes on.
|
||||
* @param node Node to search. Will be included in the result set if it matches.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @param limit Maximum number of nodes to return.
|
||||
* @returns All nodes passing `test`.
|
||||
*/
|
||||
export declare function filter(test: (elem: AnyNode) => boolean, node: AnyNode | AnyNode[], recurse?: boolean, limit?: number): AnyNode[];
|
||||
/**
|
||||
* Search an array of nodes and their children for nodes passing a test function.
|
||||
*
|
||||
* @category Querying
|
||||
* @param test Function to test nodes on.
|
||||
* @param nodes Array of nodes to search.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @param limit Maximum number of nodes to return.
|
||||
* @returns All nodes passing `test`.
|
||||
*/
|
||||
export declare function find(test: (elem: AnyNode) => boolean, nodes: AnyNode[] | ParentNode, recurse: boolean, limit: number): AnyNode[];
|
||||
/**
|
||||
* Finds the first element inside of an array that matches a test function. This is an alias for `Array.prototype.find`.
|
||||
*
|
||||
* @category Querying
|
||||
* @param test Function to test nodes on.
|
||||
* @param nodes Array of nodes to search.
|
||||
* @returns The first node in the array that passes `test`.
|
||||
* @deprecated Use `Array.prototype.find` directly.
|
||||
*/
|
||||
export declare function findOneChild<T>(test: (elem: T) => boolean, nodes: T[]): T | undefined;
|
||||
/**
|
||||
* Finds one element in a tree that passes a test.
|
||||
*
|
||||
* @category Querying
|
||||
* @param test Function to test nodes on.
|
||||
* @param nodes Node or array of nodes to search.
|
||||
* @param recurse Also consider child nodes.
|
||||
* @returns The first node that passes `test`.
|
||||
*/
|
||||
export declare function findOne(test: (elem: Element) => boolean, nodes: AnyNode[] | ParentNode, recurse?: boolean): Element | null;
|
||||
/**
|
||||
* Checks if a tree of nodes contains at least one node passing a test.
|
||||
*
|
||||
* @category Querying
|
||||
* @param test Function to test nodes on.
|
||||
* @param nodes Array of nodes to search.
|
||||
* @returns Whether a tree of nodes contains at least one node passing the test.
|
||||
*/
|
||||
export declare function existsOne(test: (elem: Element) => boolean, nodes: AnyNode[] | ParentNode): boolean;
|
||||
/**
|
||||
* Search an array of nodes and their children for elements passing a test function.
|
||||
*
|
||||
* Same as `find`, but limited to elements and with less options, leading to reduced complexity.
|
||||
*
|
||||
* @category Querying
|
||||
* @param test Function to test nodes on.
|
||||
* @param nodes Array of nodes to search.
|
||||
* @returns All nodes passing `test`.
|
||||
*/
|
||||
export declare function findAll(test: (elem: Element) => boolean, nodes: AnyNode[] | ParentNode): Element[];
|
||||
//# sourceMappingURL=querying.d.ts.map
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
import { AnyNode } from "domhandler";
|
||||
import { DomSerializerOptions } from "dom-serializer";
|
||||
/**
|
||||
* @category Stringify
|
||||
* @deprecated Use the `dom-serializer` module directly.
|
||||
* @param node Node to get the outer HTML of.
|
||||
* @param options Options for serialization.
|
||||
* @returns `node`'s outer HTML.
|
||||
*/
|
||||
export declare function getOuterHTML(node: AnyNode | ArrayLike<AnyNode>, options?: DomSerializerOptions): string;
|
||||
/**
|
||||
* @category Stringify
|
||||
* @deprecated Use the `dom-serializer` module directly.
|
||||
* @param node Node to get the inner HTML of.
|
||||
* @param options Options for serialization.
|
||||
* @returns `node`'s inner HTML.
|
||||
*/
|
||||
export declare function getInnerHTML(node: AnyNode, options?: DomSerializerOptions): string;
|
||||
/**
|
||||
* Get a node's inner text. Same as `textContent`, but inserts newlines for `<br>` tags. Ignores comments.
|
||||
*
|
||||
* @category Stringify
|
||||
* @deprecated Use `textContent` instead.
|
||||
* @param node Node to get the inner text of.
|
||||
* @returns `node`'s inner text.
|
||||
*/
|
||||
export declare function getText(node: AnyNode | AnyNode[]): string;
|
||||
/**
|
||||
* Get a node's text content. Ignores comments.
|
||||
*
|
||||
* @category Stringify
|
||||
* @param node Node to get the text content of.
|
||||
* @returns `node`'s text content.
|
||||
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent}
|
||||
*/
|
||||
export declare function textContent(node: AnyNode | AnyNode[]): string;
|
||||
/**
|
||||
* Get a node's inner text, ignoring `<script>` and `<style>` tags. Ignores comments.
|
||||
*
|
||||
* @category Stringify
|
||||
* @param node Node to get the inner text of.
|
||||
* @returns `node`'s inner text.
|
||||
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/innerText}
|
||||
*/
|
||||
export declare function innerText(node: AnyNode | AnyNode[]): string;
|
||||
//# sourceMappingURL=stringify.d.ts.map
|
||||
-67
@@ -1,67 +0,0 @@
|
||||
import { AnyNode, ChildNode, Element, ParentNode } from "domhandler";
|
||||
/**
|
||||
* Get a node's children.
|
||||
*
|
||||
* @category Traversal
|
||||
* @param elem Node to get the children of.
|
||||
* @returns `elem`'s children, or an empty array.
|
||||
*/
|
||||
export declare function getChildren(elem: AnyNode): ChildNode[];
|
||||
export declare function getParent(elem: AnyNode): ParentNode | null;
|
||||
/**
|
||||
* Gets an elements siblings, including the element itself.
|
||||
*
|
||||
* Attempts to get the children through the element's parent first. If we don't
|
||||
* have a parent (the element is a root node), we walk the element's `prev` &
|
||||
* `next` to get all remaining nodes.
|
||||
*
|
||||
* @category Traversal
|
||||
* @param elem Element to get the siblings of.
|
||||
* @returns `elem`'s siblings, including `elem`.
|
||||
*/
|
||||
export declare function getSiblings(elem: AnyNode): AnyNode[];
|
||||
/**
|
||||
* Gets an attribute from an element.
|
||||
*
|
||||
* @category Traversal
|
||||
* @param elem Element to check.
|
||||
* @param name Attribute name to retrieve.
|
||||
* @returns The element's attribute value, or `undefined`.
|
||||
*/
|
||||
export declare function getAttributeValue(elem: Element, name: string): string | undefined;
|
||||
/**
|
||||
* Checks whether an element has an attribute.
|
||||
*
|
||||
* @category Traversal
|
||||
* @param elem Element to check.
|
||||
* @param name Attribute name to look for.
|
||||
* @returns Returns whether `elem` has the attribute `name`.
|
||||
*/
|
||||
export declare function hasAttrib(elem: Element, name: string): boolean;
|
||||
/**
|
||||
* Get the tag name of an element.
|
||||
*
|
||||
* @category Traversal
|
||||
* @param elem The element to get the name for.
|
||||
* @returns The tag name of `elem`.
|
||||
*/
|
||||
export declare function getName(elem: Element): string;
|
||||
/**
|
||||
* Returns the next element sibling of a node.
|
||||
*
|
||||
* @category Traversal
|
||||
* @param elem The element to get the next sibling of.
|
||||
* @returns `elem`'s next sibling that is a tag, or `null` if there is no next
|
||||
* sibling.
|
||||
*/
|
||||
export declare function nextElementSibling(elem: AnyNode): Element | null;
|
||||
/**
|
||||
* Returns the previous element sibling of a node.
|
||||
*
|
||||
* @category Traversal
|
||||
* @param elem The element to get the previous sibling of.
|
||||
* @returns `elem`'s previous sibling that is a tag, or `null` if there is no
|
||||
* previous sibling.
|
||||
*/
|
||||
export declare function prevElementSibling(elem: AnyNode): Element | null;
|
||||
//# sourceMappingURL=traversal.d.ts.map
|
||||
Reference in New Issue
Block a user