diff options
author | RaindropsSys <contact@minteck.org> | 2023-04-06 22:18:28 +0200 |
---|---|---|
committer | RaindropsSys <contact@minteck.org> | 2023-04-06 22:18:28 +0200 |
commit | 83354b2b88218090988dd6e526b0a2505b57e0f1 (patch) | |
tree | e3c73c38a122a78bb7e66fbb99056407edd9d4b9 /includes/external/addressbook/node_modules/parse5/dist/tree-adapters | |
parent | 47b8f2299a483024c4a6a8876af825a010954caa (diff) | |
download | pluralconnect-83354b2b88218090988dd6e526b0a2505b57e0f1.tar.gz pluralconnect-83354b2b88218090988dd6e526b0a2505b57e0f1.tar.bz2 pluralconnect-83354b2b88218090988dd6e526b0a2505b57e0f1.zip |
Updated 5 files and added 1110 files (automated)
Diffstat (limited to 'includes/external/addressbook/node_modules/parse5/dist/tree-adapters')
4 files changed, 511 insertions, 0 deletions
diff --git a/includes/external/addressbook/node_modules/parse5/dist/tree-adapters/default.d.ts b/includes/external/addressbook/node_modules/parse5/dist/tree-adapters/default.d.ts new file mode 100644 index 0000000..547d714 --- /dev/null +++ b/includes/external/addressbook/node_modules/parse5/dist/tree-adapters/default.d.ts @@ -0,0 +1,85 @@ +import { DOCUMENT_MODE, type NS } from '../common/html.js'; +import type { Attribute, Location, ElementLocation } from '../common/token.js'; +import type { TreeAdapter, TreeAdapterTypeMap } from './interface.js'; +export interface Document { + /** The name of the node. */ + nodeName: '#document'; + /** + * Document mode. + * + * @see {@link DOCUMENT_MODE} */ + mode: DOCUMENT_MODE; + /** The node's children. */ + childNodes: ChildNode[]; + /** Comment source code location info. Available if location info is enabled. */ + sourceCodeLocation?: Location | null; +} +export interface DocumentFragment { + /** The name of the node. */ + nodeName: '#document-fragment'; + /** The node's children. */ + childNodes: ChildNode[]; + /** Comment source code location info. Available if location info is enabled. */ + sourceCodeLocation?: Location | null; +} +export interface Element { + /** Element tag name. Same as {@link tagName}. */ + nodeName: string; + /** Element tag name. Same as {@link nodeName}. */ + tagName: string; + /** List of element attributes. */ + attrs: Attribute[]; + /** Element namespace. */ + namespaceURI: NS; + /** Element source code location info, with attributes. Available if location info is enabled. */ + sourceCodeLocation?: ElementLocation | null; + /** Parent node. */ + parentNode: ParentNode | null; + /** The node's children. */ + childNodes: ChildNode[]; +} +export interface CommentNode { + /** The name of the node. */ + nodeName: '#comment'; + /** Parent node. */ + parentNode: ParentNode | null; + /** Comment text. */ + data: string; + /** Comment source code location info. Available if location info is enabled. */ + sourceCodeLocation?: Location | null; +} +export interface TextNode { + nodeName: '#text'; + /** Parent node. */ + parentNode: ParentNode | null; + /** Text content. */ + value: string; + /** Comment source code location info. Available if location info is enabled. */ + sourceCodeLocation?: Location | null; +} +export interface Template extends Element { + nodeName: 'template'; + tagName: 'template'; + /** The content of a `template` tag. */ + content: DocumentFragment; +} +export interface DocumentType { + /** The name of the node. */ + nodeName: '#documentType'; + /** Parent node. */ + parentNode: ParentNode | null; + /** Document type name. */ + name: string; + /** Document type public identifier. */ + publicId: string; + /** Document type system identifier. */ + systemId: string; + /** Comment source code location info. Available if location info is enabled. */ + sourceCodeLocation?: Location | null; +} +export type ParentNode = Document | DocumentFragment | Element | Template; +export type ChildNode = Element | Template | CommentNode | TextNode | DocumentType; +export type Node = ParentNode | ChildNode; +export type DefaultTreeAdapterMap = TreeAdapterTypeMap<Node, ParentNode, ChildNode, Document, DocumentFragment, Element, CommentNode, TextNode, Template, DocumentType>; +export declare const defaultTreeAdapter: TreeAdapter<DefaultTreeAdapterMap>; +//# sourceMappingURL=default.d.ts.map
\ No newline at end of file diff --git a/includes/external/addressbook/node_modules/parse5/dist/tree-adapters/default.js b/includes/external/addressbook/node_modules/parse5/dist/tree-adapters/default.js new file mode 100644 index 0000000..9db7d1c --- /dev/null +++ b/includes/external/addressbook/node_modules/parse5/dist/tree-adapters/default.js @@ -0,0 +1,174 @@ +import { DOCUMENT_MODE } from '../common/html.js'; +function createTextNode(value) { + return { + nodeName: '#text', + value, + parentNode: null, + }; +} +export const defaultTreeAdapter = { + //Node construction + createDocument() { + return { + nodeName: '#document', + mode: DOCUMENT_MODE.NO_QUIRKS, + childNodes: [], + }; + }, + createDocumentFragment() { + return { + nodeName: '#document-fragment', + childNodes: [], + }; + }, + createElement(tagName, namespaceURI, attrs) { + return { + nodeName: tagName, + tagName, + attrs, + namespaceURI, + childNodes: [], + parentNode: null, + }; + }, + createCommentNode(data) { + return { + nodeName: '#comment', + data, + parentNode: null, + }; + }, + //Tree mutation + appendChild(parentNode, newNode) { + parentNode.childNodes.push(newNode); + newNode.parentNode = parentNode; + }, + insertBefore(parentNode, newNode, referenceNode) { + const insertionIdx = parentNode.childNodes.indexOf(referenceNode); + parentNode.childNodes.splice(insertionIdx, 0, newNode); + newNode.parentNode = parentNode; + }, + setTemplateContent(templateElement, contentElement) { + templateElement.content = contentElement; + }, + getTemplateContent(templateElement) { + return templateElement.content; + }, + setDocumentType(document, name, publicId, systemId) { + const doctypeNode = document.childNodes.find((node) => node.nodeName === '#documentType'); + if (doctypeNode) { + doctypeNode.name = name; + doctypeNode.publicId = publicId; + doctypeNode.systemId = systemId; + } + else { + const node = { + nodeName: '#documentType', + name, + publicId, + systemId, + parentNode: null, + }; + defaultTreeAdapter.appendChild(document, node); + } + }, + setDocumentMode(document, mode) { + document.mode = mode; + }, + getDocumentMode(document) { + return document.mode; + }, + detachNode(node) { + if (node.parentNode) { + const idx = node.parentNode.childNodes.indexOf(node); + node.parentNode.childNodes.splice(idx, 1); + node.parentNode = null; + } + }, + insertText(parentNode, text) { + if (parentNode.childNodes.length > 0) { + const prevNode = parentNode.childNodes[parentNode.childNodes.length - 1]; + if (defaultTreeAdapter.isTextNode(prevNode)) { + prevNode.value += text; + return; + } + } + defaultTreeAdapter.appendChild(parentNode, createTextNode(text)); + }, + insertTextBefore(parentNode, text, referenceNode) { + const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1]; + if (prevNode && defaultTreeAdapter.isTextNode(prevNode)) { + prevNode.value += text; + } + else { + defaultTreeAdapter.insertBefore(parentNode, createTextNode(text), referenceNode); + } + }, + adoptAttributes(recipient, attrs) { + const recipientAttrsMap = new Set(recipient.attrs.map((attr) => attr.name)); + for (let j = 0; j < attrs.length; j++) { + if (!recipientAttrsMap.has(attrs[j].name)) { + recipient.attrs.push(attrs[j]); + } + } + }, + //Tree traversing + getFirstChild(node) { + return node.childNodes[0]; + }, + getChildNodes(node) { + return node.childNodes; + }, + getParentNode(node) { + return node.parentNode; + }, + getAttrList(element) { + return element.attrs; + }, + //Node data + getTagName(element) { + return element.tagName; + }, + getNamespaceURI(element) { + return element.namespaceURI; + }, + getTextNodeContent(textNode) { + return textNode.value; + }, + getCommentNodeContent(commentNode) { + return commentNode.data; + }, + getDocumentTypeNodeName(doctypeNode) { + return doctypeNode.name; + }, + getDocumentTypeNodePublicId(doctypeNode) { + return doctypeNode.publicId; + }, + getDocumentTypeNodeSystemId(doctypeNode) { + return doctypeNode.systemId; + }, + //Node types + isTextNode(node) { + return node.nodeName === '#text'; + }, + isCommentNode(node) { + return node.nodeName === '#comment'; + }, + isDocumentTypeNode(node) { + return node.nodeName === '#documentType'; + }, + isElementNode(node) { + return Object.prototype.hasOwnProperty.call(node, 'tagName'); + }, + // Source code location + setNodeSourceCodeLocation(node, location) { + node.sourceCodeLocation = location; + }, + getNodeSourceCodeLocation(node) { + return node.sourceCodeLocation; + }, + updateNodeSourceCodeLocation(node, endLocation) { + node.sourceCodeLocation = { ...node.sourceCodeLocation, ...endLocation }; + }, +}; +//# sourceMappingURL=default.js.map
\ No newline at end of file diff --git a/includes/external/addressbook/node_modules/parse5/dist/tree-adapters/interface.d.ts b/includes/external/addressbook/node_modules/parse5/dist/tree-adapters/interface.d.ts new file mode 100644 index 0000000..8de74ee --- /dev/null +++ b/includes/external/addressbook/node_modules/parse5/dist/tree-adapters/interface.d.ts @@ -0,0 +1,250 @@ +import type { DOCUMENT_MODE, NS } from '../common/html.js'; +import type { Attribute, ElementLocation } from '../common/token.js'; +export interface TreeAdapterTypeMap<Node = unknown, ParentNode = unknown, ChildNode = unknown, Document = unknown, DocumentFragment = unknown, Element = unknown, CommentNode = unknown, TextNode = unknown, Template = unknown, DocumentType = unknown> { + node: Node; + parentNode: ParentNode; + childNode: ChildNode; + document: Document; + documentFragment: DocumentFragment; + element: Element; + commentNode: CommentNode; + textNode: TextNode; + template: Template; + documentType: DocumentType; +} +/** + * Tree adapter is a set of utility functions that provides minimal required abstraction layer beetween parser and a specific AST format. + * Note that `TreeAdapter` is not designed to be a general purpose AST manipulation library. You can build such library + * on top of existing `TreeAdapter` or use one of the existing libraries from npm. + * + * @see The default implementation {@link parse5.treeAdapters.default} + */ +export interface TreeAdapter<T extends TreeAdapterTypeMap = TreeAdapterTypeMap> { + /** + * Copies attributes to the given element. Only attributes that are not yet present in the element are copied. + * + * @param recipient - Element to copy attributes into. + * @param attrs - Attributes to copy. + */ + adoptAttributes(recipient: T['element'], attrs: Attribute[]): void; + /** + * Appends a child node to the given parent node. + * + * @param parentNode - Parent node. + * @param newNode - Child node. + */ + appendChild(parentNode: T['parentNode'], newNode: T['childNode']): void; + /** + * Creates a comment node. + * + * @param data - Comment text. + */ + createCommentNode(data: string): T['commentNode']; + /** + * Creates a document node. + */ + createDocument(): T['document']; + /** + * Creates a document fragment node. + */ + createDocumentFragment(): T['documentFragment']; + /** + * Creates an element node. + * + * @param tagName - Tag name of the element. + * @param namespaceURI - Namespace of the element. + * @param attrs - Attribute name-value pair array. Foreign attributes may contain `namespace` and `prefix` fields as well. + */ + createElement(tagName: string, namespaceURI: NS, attrs: Attribute[]): T['element']; + /** + * Removes a node from its parent. + * + * @param node - Node to remove. + */ + detachNode(node: T['childNode']): void; + /** + * Returns the given element's attributes in an array, in the form of name-value pairs. + * Foreign attributes may contain `namespace` and `prefix` fields as well. + * + * @param element - Element. + */ + getAttrList(element: T['element']): Attribute[]; + /** + * Returns the given node's children in an array. + * + * @param node - Node. + */ + getChildNodes(node: T['parentNode']): T['childNode'][]; + /** + * Returns the given comment node's content. + * + * @param commentNode - Comment node. + */ + getCommentNodeContent(commentNode: T['commentNode']): string; + /** + * Returns [document mode](https://dom.spec.whatwg.org/#concept-document-limited-quirks). + * + * @param document - Document node. + */ + getDocumentMode(document: T['document']): DOCUMENT_MODE; + /** + * Returns the given document type node's name. + * + * @param doctypeNode - Document type node. + */ + getDocumentTypeNodeName(doctypeNode: T['documentType']): string; + /** + * Returns the given document type node's public identifier. + * + * @param doctypeNode - Document type node. + */ + getDocumentTypeNodePublicId(doctypeNode: T['documentType']): string; + /** + * Returns the given document type node's system identifier. + * + * @param doctypeNode - Document type node. + */ + getDocumentTypeNodeSystemId(doctypeNode: T['documentType']): string; + /** + * Returns the first child of the given node. + * + * @param node - Node. + */ + getFirstChild(node: T['parentNode']): T['childNode'] | null; + /** + * Returns the given element's namespace. + * + * @param element - Element. + */ + getNamespaceURI(element: T['element']): NS; + /** + * Returns the given node's source code location information. + * + * @param node - Node. + */ + getNodeSourceCodeLocation(node: T['node']): ElementLocation | undefined | null; + /** + * Returns the given node's parent. + * + * @param node - Node. + */ + getParentNode(node: T['node']): T['parentNode'] | null; + /** + * Returns the given element's tag name. + * + * @param element - Element. + */ + getTagName(element: T['element']): string; + /** + * Returns the given text node's content. + * + * @param textNode - Text node. + */ + getTextNodeContent(textNode: T['textNode']): string; + /** + * Returns the `<template>` element content element. + * + * @param templateElement - `<template>` element. + */ + getTemplateContent(templateElement: T['template']): T['documentFragment']; + /** + * Inserts a child node to the given parent node before the given reference node. + * + * @param parentNode - Parent node. + * @param newNode - Child node. + * @param referenceNode - Reference node. + */ + insertBefore(parentNode: T['parentNode'], newNode: T['childNode'], referenceNode: T['childNode']): void; + /** + * Inserts text into a node. If the last child of the node is a text node, the provided text will be appended to the + * text node content. Otherwise, inserts a new text node with the given text. + * + * @param parentNode - Node to insert text into. + * @param text - Text to insert. + */ + insertText(parentNode: T['parentNode'], text: string): void; + /** + * Inserts text into a sibling node that goes before the reference node. If this sibling node is the text node, + * the provided text will be appended to the text node content. Otherwise, inserts a new sibling text node with + * the given text before the reference node. + * + * @param parentNode - Node to insert text into. + * @param text - Text to insert. + * @param referenceNode - Node to insert text before. + */ + insertTextBefore(parentNode: T['parentNode'], text: string, referenceNode: T['childNode']): void; + /** + * Determines if the given node is a comment node. + * + * @param node - Node. + */ + isCommentNode(node: T['node']): node is T['commentNode']; + /** + * Determines if the given node is a document type node. + * + * @param node - Node. + */ + isDocumentTypeNode(node: T['node']): node is T['documentType']; + /** + * Determines if the given node is an element. + * + * @param node - Node. + */ + isElementNode(node: T['node']): node is T['element']; + /** + * Determines if the given node is a text node. + * + * @param node - Node. + */ + isTextNode(node: T['node']): node is T['textNode']; + /** + * Sets the [document mode](https://dom.spec.whatwg.org/#concept-document-limited-quirks). + * + * @param document - Document node. + * @param mode - Document mode. + */ + setDocumentMode(document: T['document'], mode: DOCUMENT_MODE): void; + /** + * Sets the document type. If the `document` already contains a document type node, the `name`, `publicId` and `systemId` + * properties of this node will be updated with the provided values. Otherwise, creates a new document type node + * with the given properties and inserts it into the `document`. + * + * @param document - Document node. + * @param name - Document type name. + * @param publicId - Document type public identifier. + * @param systemId - Document type system identifier. + */ + setDocumentType(document: T['document'], name: string, publicId: string, systemId: string): void; + /** + * Attaches source code location information to the node. + * + * @param node - Node. + */ + setNodeSourceCodeLocation(node: T['node'], location: ElementLocation | null): void; + /** + * Updates the source code location information of the node. + * + * @param node - Node. + */ + updateNodeSourceCodeLocation(node: T['node'], location: Partial<ElementLocation>): void; + /** + * Sets the `<template>` element content element. + * + * @param templateElement - `<template>` element. + * @param contentElement - Content element. + */ + setTemplateContent(templateElement: T['template'], contentElement: T['documentFragment']): void; + /** + * Optional callback for elements being pushed to the stack of open elements. + * + * @param element The element being pushed to the stack of open elements. + */ + onItemPush?: (item: T['element']) => void; + /** + * Optional callback for elements being popped from the stack of open elements. + * + * @param item The element being popped. + */ + onItemPop?: (item: T['element'], newTop: T['parentNode']) => void; +} +//# sourceMappingURL=interface.d.ts.map
\ No newline at end of file diff --git a/includes/external/addressbook/node_modules/parse5/dist/tree-adapters/interface.js b/includes/external/addressbook/node_modules/parse5/dist/tree-adapters/interface.js new file mode 100644 index 0000000..95423ac --- /dev/null +++ b/includes/external/addressbook/node_modules/parse5/dist/tree-adapters/interface.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=interface.js.map
\ No newline at end of file |