@oozcitak/dom
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -58,2 +58,3 @@ "use strict"; | ||
} | ||
exports.CustomElementAlgorithmImpl = CustomElementAlgorithmImpl; | ||
CustomElementAlgorithmImpl.PotentialCustomElementName = /[a-z]([\0-\t\x2D\._a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*-([\0-\t\x2D\._a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*/; | ||
@@ -72,3 +73,2 @@ CustomElementAlgorithmImpl.NamesWithHyphen = ['annotation-xml', 'color-profile', | ||
'nav', 'p', 'section', 'span']; | ||
exports.CustomElementAlgorithmImpl = CustomElementAlgorithmImpl; | ||
//# sourceMappingURL=CustomElementAlgorithmImpl.js.map |
@@ -5,2 +5,3 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
const util_2 = require("@oozcitak/util"); | ||
const dom_1 = require("../dom"); | ||
@@ -37,3 +38,3 @@ /** | ||
if (options !== undefined) { | ||
if (util_1.isString(options)) { | ||
if (util_2.isString(options)) { | ||
is = options; | ||
@@ -40,0 +41,0 @@ } |
@@ -47,53 +47,53 @@ import { DOMAlgorithm, RemovingStep, CloningStep, AdoptingStep, ChildTextContentChangeStep, TreeAlgorithm, OrderedSetAlgorithm, NamespaceAlgorithm, SelectorsAlgorithm, EventAlgorithm, EventTargetAlgorithm, AbortAlgorithm, ShadowTreeAlgorithm, MutationAlgorithm, InsertionStep, ParentNodeAlgorithm, CreateAlgorithm, MutationObserverAlgorithm, AttrAlgorithm, ElementAlgorithm, CharacterDataAlgorithm, TextAlgorithm, NodeAlgorithm, DocumentAlgorithm, BoundaryPointAlgorithm, RangeAlgorithm, TraversalAlgorithm, NodeIteratorAlgorithm, TreeWalkerAlgorithm, NodeIteratorPreRemovingStep, DOMTokenListAlgorithm, EventConstructingStep, CustomElementAlgorithm, XMLAlgorithm } from './interfaces'; | ||
/** @inheritdoc */ | ||
readonly tree: TreeAlgorithm; | ||
get tree(): TreeAlgorithm; | ||
/** @inheritdoc */ | ||
readonly orderedSet: OrderedSetAlgorithm; | ||
get orderedSet(): OrderedSetAlgorithm; | ||
/** @inheritdoc */ | ||
readonly namespace: NamespaceAlgorithm; | ||
get namespace(): NamespaceAlgorithm; | ||
/** @inheritdoc */ | ||
readonly selectors: SelectorsAlgorithm; | ||
get selectors(): SelectorsAlgorithm; | ||
/** @inheritdoc */ | ||
readonly event: EventAlgorithm; | ||
get event(): EventAlgorithm; | ||
/** @inheritdoc */ | ||
readonly eventTarget: EventTargetAlgorithm; | ||
get eventTarget(): EventTargetAlgorithm; | ||
/** @inheritdoc */ | ||
readonly abort: AbortAlgorithm; | ||
get abort(): AbortAlgorithm; | ||
/** @inheritdoc */ | ||
readonly shadowTree: ShadowTreeAlgorithm; | ||
get shadowTree(): ShadowTreeAlgorithm; | ||
/** @inheritdoc */ | ||
readonly mutation: MutationAlgorithm; | ||
get mutation(): MutationAlgorithm; | ||
/** @inheritdoc */ | ||
readonly parentNode: ParentNodeAlgorithm; | ||
get parentNode(): ParentNodeAlgorithm; | ||
/** @inheritdoc */ | ||
readonly create: CreateAlgorithm; | ||
get create(): CreateAlgorithm; | ||
/** @inheritdoc */ | ||
readonly observer: MutationObserverAlgorithm; | ||
get observer(): MutationObserverAlgorithm; | ||
/** @inheritdoc */ | ||
readonly attr: AttrAlgorithm; | ||
get attr(): AttrAlgorithm; | ||
/** @inheritdoc */ | ||
readonly element: ElementAlgorithm; | ||
get element(): ElementAlgorithm; | ||
/** @inheritdoc */ | ||
readonly characterData: CharacterDataAlgorithm; | ||
get characterData(): CharacterDataAlgorithm; | ||
/** @inheritdoc */ | ||
readonly text: TextAlgorithm; | ||
get text(): TextAlgorithm; | ||
/** @inheritdoc */ | ||
readonly node: NodeAlgorithm; | ||
get node(): NodeAlgorithm; | ||
/** @inheritdoc */ | ||
readonly document: DocumentAlgorithm; | ||
get document(): DocumentAlgorithm; | ||
/** @inheritdoc */ | ||
readonly boundaryPoint: BoundaryPointAlgorithm; | ||
get boundaryPoint(): BoundaryPointAlgorithm; | ||
/** @inheritdoc */ | ||
readonly range: RangeAlgorithm; | ||
get range(): RangeAlgorithm; | ||
/** @inheritdoc */ | ||
readonly traversal: TraversalAlgorithm; | ||
get traversal(): TraversalAlgorithm; | ||
/** @inheritdoc */ | ||
readonly nodeIterator: NodeIteratorAlgorithm; | ||
get nodeIterator(): NodeIteratorAlgorithm; | ||
/** @inheritdoc */ | ||
readonly treeWalker: TreeWalkerAlgorithm; | ||
get treeWalker(): TreeWalkerAlgorithm; | ||
/** @inheritdoc */ | ||
readonly tokenList: DOMTokenListAlgorithm; | ||
get tokenList(): DOMTokenListAlgorithm; | ||
/** @inheritdoc */ | ||
readonly customElement: CustomElementAlgorithm; | ||
get customElement(): CustomElementAlgorithm; | ||
/** @inheritdoc */ | ||
readonly xml: XMLAlgorithm; | ||
get xml(): XMLAlgorithm; | ||
/** @inheritdoc */ | ||
@@ -100,0 +100,0 @@ runRemovingSteps(thisObj: any, removedNode: Node, oldParent?: Node | null): void; |
@@ -6,2 +6,3 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
const util_2 = require("@oozcitak/util"); | ||
const dom_1 = require("../dom"); | ||
@@ -677,3 +678,3 @@ /** | ||
if (idlAttributes) { | ||
for (const [key, value] of util_1.forEachObject(idlAttributes)) { | ||
for (const [key, value] of util_2.forEachObject(idlAttributes)) { | ||
const idlObj = event; | ||
@@ -680,0 +681,0 @@ idlObj[key] = value; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const SubAlgorithmImpl_1 = require("./SubAlgorithmImpl"); | ||
const util_1 = require("../util"); | ||
const util_1 = require("@oozcitak/util"); | ||
/** | ||
@@ -6,0 +6,0 @@ * Contains event target algorithms. |
import { Node, Document, Element, HTMLCollection, Attr, DOMImplementation, DocumentType, DocumentFragment, Text, CDATASection, Comment, ProcessingInstruction, NodeList, NamedNodeMap, Range, NodeIterator, TreeWalker, NodeFilter, Event, EventTarget, AbortSignal, Slotable, Slot, MutationRecord, CharacterData, XMLDocument, DOMTokenList, ShadowRoot, AbstractRange, AbortController, Window, AddEventListenerOptions, EventListenerOptions, EventListenerEntry, PotentialEventTarget, EventPathItem, BoundaryPoint, BoundaryPosition, FilterResult, CustomElementDefinition, EventHandler } from "../dom/interfaces"; | ||
import { EventImpl } from "../dom/EventImpl"; | ||
import { DOMObjectCache } from "../util/interfaces"; | ||
import { ObjectCache } from "@oozcitak/util"; | ||
import { Interfaces as URLInterfaces } from "@oozcitak/url"; | ||
@@ -1501,3 +1501,3 @@ /** | ||
*/ | ||
readonly rangeList: DOMObjectCache<Range>; | ||
readonly rangeList: ObjectCache<Range>; | ||
} | ||
@@ -1532,3 +1532,3 @@ /** | ||
*/ | ||
readonly iteratorList: DOMObjectCache<NodeIterator>; | ||
readonly iteratorList: ObjectCache<NodeIterator>; | ||
} | ||
@@ -1535,0 +1535,0 @@ /** |
@@ -7,2 +7,3 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
const util_2 = require("@oozcitak/util"); | ||
const infra_1 = require("@oozcitak/infra"); | ||
@@ -290,3 +291,3 @@ /** | ||
if (util_1.Guard.isShadowRoot(this.dom.tree.rootNode(parent)) && | ||
util_1.Guard.isSlot(parent) && util_1.isEmpty(parent._assignedNodes)) { | ||
util_1.Guard.isSlot(parent) && util_2.isEmpty(parent._assignedNodes)) { | ||
this.dom.shadowTree.signalASlotChange(parent); | ||
@@ -659,3 +660,3 @@ } | ||
if (util_1.Guard.isShadowRoot(this.dom.tree.rootNode(parent)) && | ||
util_1.Guard.isSlot(parent) && util_1.isEmpty(parent._assignedNodes)) { | ||
util_1.Guard.isSlot(parent) && util_2.isEmpty(parent._assignedNodes)) { | ||
this.dom.shadowTree.signalASlotChange(parent); | ||
@@ -662,0 +663,0 @@ } |
import { DOMAlgorithm, NodeIteratorAlgorithm } from './interfaces'; | ||
import { SubAlgorithmImpl } from './SubAlgorithmImpl'; | ||
import { Node, NodeIterator } from '../dom/interfaces'; | ||
import { DOMObjectCache } from '../util/interfaces'; | ||
import { ObjectCache } from '@oozcitak/util'; | ||
/** | ||
@@ -18,3 +18,3 @@ * Contains tree walker algorithms. | ||
/** @inheritdoc */ | ||
readonly iteratorList: DOMObjectCache<NodeIterator>; | ||
get iteratorList(): ObjectCache<NodeIterator>; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const SubAlgorithmImpl_1 = require("./SubAlgorithmImpl"); | ||
const util_1 = require("../util"); | ||
const util_1 = require("@oozcitak/util"); | ||
/** | ||
@@ -6,0 +6,0 @@ * Contains parent node algorithms. |
import { DOMAlgorithm, RangeAlgorithm } from './interfaces'; | ||
import { SubAlgorithmImpl } from './SubAlgorithmImpl'; | ||
import { Node, AbstractRange, DocumentFragment, Range } from '../dom/interfaces'; | ||
import { DOMObjectCache } from '../util/interfaces'; | ||
import { ObjectCache } from '@oozcitak/util'; | ||
/** | ||
@@ -40,3 +40,3 @@ * Contains range algorithms. | ||
/** @inheritdoc */ | ||
readonly rangeList: DOMObjectCache<Range>; | ||
get rangeList(): ObjectCache<Range>; | ||
} |
@@ -5,2 +5,3 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
const util_2 = require("@oozcitak/util"); | ||
/** | ||
@@ -108,3 +109,3 @@ * Contains shadow tree algorithms. | ||
const slotables = this.findSlotables(slot); | ||
if (util_1.isEmpty(slotables)) { | ||
if (util_2.isEmpty(slotables)) { | ||
for (const slotable of slot.childNodes) { | ||
@@ -111,0 +112,0 @@ if (util_1.Guard.isSlotable(slotable)) { |
@@ -14,3 +14,3 @@ import { DOMAlgorithm, SubAlgorithm } from './interfaces'; | ||
/** @inheritdoc */ | ||
readonly dom: DOMAlgorithm; | ||
get dom(): DOMAlgorithm; | ||
} |
@@ -38,2 +38,3 @@ "use strict"; | ||
} | ||
exports.XMLAlgorithmImpl = XMLAlgorithmImpl; | ||
XMLAlgorithmImpl.NameStartChar = /[:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF]/; | ||
@@ -81,3 +82,2 @@ XMLAlgorithmImpl.NameChar = /[\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF]/; | ||
XMLAlgorithmImpl.InvalidChar_11 = /[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; | ||
exports.XMLAlgorithmImpl = XMLAlgorithmImpl; | ||
//# sourceMappingURL=XMLAlgorithmImpl.js.map |
@@ -14,5 +14,5 @@ import { AbortSignal, AbortController } from "./interfaces"; | ||
/** @inheritdoc */ | ||
readonly signal: AbortSignal; | ||
get signal(): AbortSignal; | ||
/** @inheritdoc */ | ||
abort(): void; | ||
} |
@@ -15,5 +15,6 @@ import { EventHandler, AbortSignal } from "./interfaces"; | ||
/** @inheritdoc */ | ||
readonly aborted: boolean; | ||
get aborted(): boolean; | ||
/** @inheritdoc */ | ||
onabort: EventHandler; | ||
get onabort(): EventHandler; | ||
set onabort(val: EventHandler); | ||
/** | ||
@@ -20,0 +21,0 @@ * Creates a new `AbortSignal`. |
@@ -8,17 +8,17 @@ import { Node, BoundaryPoint, AbstractRange } from './interfaces'; | ||
abstract _end: BoundaryPoint; | ||
readonly _startNode: Node; | ||
readonly _startOffset: number; | ||
readonly _endNode: Node; | ||
readonly _endOffset: number; | ||
readonly _collapsed: boolean; | ||
get _startNode(): Node; | ||
get _startOffset(): number; | ||
get _endNode(): Node; | ||
get _endOffset(): number; | ||
get _collapsed(): boolean; | ||
/** @inheritdoc */ | ||
readonly startContainer: Node; | ||
get startContainer(): Node; | ||
/** @inheritdoc */ | ||
readonly startOffset: number; | ||
get startOffset(): number; | ||
/** @inheritdoc */ | ||
readonly endContainer: Node; | ||
get endContainer(): Node; | ||
/** @inheritdoc */ | ||
readonly endOffset: number; | ||
get endOffset(): number; | ||
/** @inheritdoc */ | ||
readonly collapsed: boolean; | ||
get collapsed(): boolean; | ||
} |
@@ -22,17 +22,18 @@ import { Element, NodeType, Attr, Document } from "./interfaces"; | ||
/** @inheritdoc */ | ||
readonly ownerElement: Element | null; | ||
get ownerElement(): Element | null; | ||
/** @inheritdoc */ | ||
readonly namespaceURI: string | null; | ||
get namespaceURI(): string | null; | ||
/** @inheritdoc */ | ||
readonly prefix: string | null; | ||
get prefix(): string | null; | ||
/** @inheritdoc */ | ||
readonly localName: string; | ||
get localName(): string; | ||
/** @inheritdoc */ | ||
readonly name: string; | ||
get name(): string; | ||
/** @inheritdoc */ | ||
value: string; | ||
get value(): string; | ||
set value(value: string); | ||
/** | ||
* Returns the qualified name. | ||
*/ | ||
readonly _qualifiedName: string; | ||
get _qualifiedName(): string; | ||
/** | ||
@@ -39,0 +40,0 @@ * Creates a `Attr`. |
@@ -15,5 +15,6 @@ import { Element, Node, CharacterData } from "./interfaces"; | ||
/** @inheritdoc */ | ||
data: string; | ||
get data(): string; | ||
set data(value: string); | ||
/** @inheritdoc */ | ||
readonly length: number; | ||
get length(): number; | ||
/** @inheritdoc */ | ||
@@ -29,4 +30,4 @@ substringData(offset: number, count: number): string; | ||
replaceData(offset: number, count: number, data: string): void; | ||
readonly previousElementSibling: Element | null; | ||
readonly nextElementSibling: Element | null; | ||
get previousElementSibling(): Element | null; | ||
get nextElementSibling(): Element | null; | ||
before(...nodes: (Node | string)[]): void; | ||
@@ -33,0 +34,0 @@ after(...nodes: (Node | string)[]): void; |
@@ -13,5 +13,5 @@ import { CustomEventInit, CustomEvent } from './interfaces'; | ||
/** @inheritdoc */ | ||
readonly detail: any; | ||
get detail(): any; | ||
/** @inheritdoc */ | ||
initCustomEvent(type: string, bubbles?: boolean, cancelable?: boolean, detail?: any): void; | ||
} |
@@ -16,6 +16,6 @@ import { Node, Element, NodeType, HTMLCollection, NodeList, DocumentFragment, Document } from "./interfaces"; | ||
getElementById(elementId: string): Element | null; | ||
readonly children: HTMLCollection; | ||
readonly firstElementChild: Element | null; | ||
readonly lastElementChild: Element | null; | ||
readonly childElementCount: number; | ||
get children(): HTMLCollection; | ||
get firstElementChild(): Element | null; | ||
get lastElementChild(): Element | null; | ||
get childElementCount(): number; | ||
prepend(...nodes: (Node | string)[]): void; | ||
@@ -22,0 +22,0 @@ append(...nodes: (Node | string)[]): void; |
import { DOMImplementation, DocumentType, Element, Text, NodeFilter, NodeType, Node, HTMLCollection, DocumentFragment, NodeList, WhatToShow, Attr, ProcessingInstruction, Comment, CDATASection, NodeIterator, TreeWalker, FilterResult, Range, Event, EventTarget, Origin, Document } from './interfaces'; | ||
import { NodeImpl } from './NodeImpl'; | ||
import { Interfaces as URLInterfaces } from "@oozcitak/url"; | ||
import { Interfaces as URLInterfaces } from '@oozcitak/url'; | ||
/** | ||
@@ -20,3 +20,4 @@ * Represents a document node. | ||
_nodeDocumentOverwrite: Document | null; | ||
_nodeDocument: Document; | ||
get _nodeDocument(): Document; | ||
set _nodeDocument(val: Document); | ||
/** | ||
@@ -27,23 +28,23 @@ * Initializes a new instance of `Document`. | ||
/** @inheritdoc */ | ||
readonly implementation: DOMImplementation; | ||
get implementation(): DOMImplementation; | ||
/** @inheritdoc */ | ||
readonly URL: string; | ||
get URL(): string; | ||
/** @inheritdoc */ | ||
readonly documentURI: string; | ||
get documentURI(): string; | ||
/** @inheritdoc */ | ||
readonly origin: string; | ||
get origin(): string; | ||
/** @inheritdoc */ | ||
readonly compatMode: string; | ||
get compatMode(): string; | ||
/** @inheritdoc */ | ||
readonly characterSet: string; | ||
get characterSet(): string; | ||
/** @inheritdoc */ | ||
readonly charset: string; | ||
get charset(): string; | ||
/** @inheritdoc */ | ||
readonly inputEncoding: string; | ||
get inputEncoding(): string; | ||
/** @inheritdoc */ | ||
readonly contentType: string; | ||
get contentType(): string; | ||
/** @inheritdoc */ | ||
readonly doctype: DocumentType | null; | ||
get doctype(): DocumentType | null; | ||
/** @inheritdoc */ | ||
readonly documentElement: Element | null; | ||
get documentElement(): Element | null; | ||
/** @inheritdoc */ | ||
@@ -96,6 +97,6 @@ getElementsByTagName(qualifiedName: string): HTMLCollection; | ||
getElementById(elementId: string): Element | null; | ||
readonly children: HTMLCollection; | ||
readonly firstElementChild: Element | null; | ||
readonly lastElementChild: Element | null; | ||
readonly childElementCount: number; | ||
get children(): HTMLCollection; | ||
get firstElementChild(): Element | null; | ||
get lastElementChild(): Element | null; | ||
get childElementCount(): number; | ||
prepend(...nodes: (Node | string)[]): void; | ||
@@ -102,0 +103,0 @@ append(...nodes: (Node | string)[]): void; |
@@ -7,2 +7,3 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
const util_2 = require("@oozcitak/util"); | ||
const infra_1 = require("@oozcitak/infra"); | ||
@@ -156,3 +157,3 @@ const url_1 = require("@oozcitak/url"); | ||
if (options !== undefined) { | ||
if (util_1.isString(options)) { | ||
if (util_2.isString(options)) { | ||
is = options; | ||
@@ -324,3 +325,3 @@ } | ||
iterator._iteratorCollection = this._algo.create.nodeList(root); | ||
if (util_1.isFunction(filter)) { | ||
if (util_2.isFunction(filter)) { | ||
iterator._filter = this._algo.create.nodeFilter(); | ||
@@ -345,3 +346,3 @@ iterator._filter.acceptNode = filter; | ||
walker._whatToShow = whatToShow; | ||
if (util_1.isFunction(filter)) { | ||
if (util_2.isFunction(filter)) { | ||
walker._filter = this._algo.create.nodeFilter(); | ||
@@ -348,0 +349,0 @@ walker._filter.acceptNode = filter; |
@@ -21,7 +21,7 @@ import { Node, NodeType, DocumentType, Document } from "./interfaces"; | ||
/** @inheritdoc */ | ||
readonly name: string; | ||
get name(): string; | ||
/** @inheritdoc */ | ||
readonly publicId: string; | ||
get publicId(): string; | ||
/** @inheritdoc */ | ||
readonly systemId: string; | ||
get systemId(): string; | ||
before(...nodes: (Node | string)[]): void; | ||
@@ -28,0 +28,0 @@ after(...nodes: (Node | string)[]): void; |
@@ -18,2 +18,3 @@ "use strict"; | ||
} | ||
exports.DOMException = DOMException; | ||
DOMException.IndexSizeError = new DOMException("IndexSizeError", "The index is not in the allowed range."); | ||
@@ -45,3 +46,2 @@ DOMException.DOMStringSizeError = new DOMException("DOMStringSizeError", ""); | ||
DOMException.NotImplementedError = new DOMException("NotImplementedError", "The DOM method is not implemented by this module."); | ||
exports.DOMException = DOMException; | ||
//# sourceMappingURL=DOMException.js.map |
@@ -19,3 +19,3 @@ import { DOMTokenList, Element, Attr } from "./interfaces"; | ||
/** @inheritdoc */ | ||
readonly length: number; | ||
get length(): number; | ||
/** @inheritdoc */ | ||
@@ -36,3 +36,4 @@ item(index: number): string | null; | ||
/** @inheritdoc */ | ||
value: string; | ||
get value(): string; | ||
set value(value: string); | ||
/** @inheritdoc */ | ||
@@ -39,0 +40,0 @@ [Symbol.iterator](): IterableIterator<string>; |
@@ -26,21 +26,24 @@ import { Attr, NamedNodeMap, DOMTokenList, ShadowRoot, NodeType, Node, Document, Element, HTMLCollection, NodeList, ShadowRootMode, CustomElementDefinition, HTMLSlotElement, Slot } from './interfaces'; | ||
/** @inheritdoc */ | ||
readonly namespaceURI: string | null; | ||
get namespaceURI(): string | null; | ||
/** @inheritdoc */ | ||
readonly prefix: string | null; | ||
get prefix(): string | null; | ||
/** @inheritdoc */ | ||
readonly localName: string; | ||
get localName(): string; | ||
/** @inheritdoc */ | ||
readonly tagName: string; | ||
get tagName(): string; | ||
/** @inheritdoc */ | ||
id: string; | ||
get id(): string; | ||
set id(value: string); | ||
/** @inheritdoc */ | ||
className: string; | ||
get className(): string; | ||
set className(value: string); | ||
/** @inheritdoc */ | ||
readonly classList: DOMTokenList; | ||
get classList(): DOMTokenList; | ||
/** @inheritdoc */ | ||
slot: string; | ||
get slot(): string; | ||
set slot(value: string); | ||
/** @inheritdoc */ | ||
hasAttributes(): boolean; | ||
/** @inheritdoc */ | ||
readonly attributes: NamedNodeMap; | ||
get attributes(): NamedNodeMap; | ||
/** @inheritdoc */ | ||
@@ -81,3 +84,3 @@ getAttributeNames(): string[]; | ||
/** @inheritdoc */ | ||
readonly shadowRoot: ShadowRoot | null; | ||
get shadowRoot(): ShadowRoot | null; | ||
/** @inheritdoc */ | ||
@@ -102,11 +105,11 @@ closest(selectors: string): Element | null; | ||
*/ | ||
readonly _qualifiedName: string; | ||
get _qualifiedName(): string; | ||
/** | ||
* Returns the upper-cased qualified name for a html element. | ||
*/ | ||
readonly _htmlUppercasedQualifiedName: string; | ||
readonly children: HTMLCollection; | ||
readonly firstElementChild: Element | null; | ||
readonly lastElementChild: Element | null; | ||
readonly childElementCount: number; | ||
get _htmlUppercasedQualifiedName(): string; | ||
get children(): HTMLCollection; | ||
get firstElementChild(): Element | null; | ||
get lastElementChild(): Element | null; | ||
get childElementCount(): number; | ||
prepend(...nodes: (Node | string)[]): void; | ||
@@ -116,4 +119,4 @@ append(...nodes: (Node | string)[]): void; | ||
querySelectorAll(selectors: string): NodeList; | ||
readonly previousElementSibling: Element | null; | ||
readonly nextElementSibling: Element | null; | ||
get previousElementSibling(): Element | null; | ||
get nextElementSibling(): Element | null; | ||
before(...nodes: (Node | string)[]): void; | ||
@@ -123,3 +126,3 @@ after(...nodes: (Node | string)[]): void; | ||
remove(): void; | ||
readonly assignedSlot: HTMLSlotElement | null; | ||
get assignedSlot(): HTMLSlotElement | null; | ||
/** | ||
@@ -126,0 +129,0 @@ * Defines attribute change steps to update a slot’s name. |
@@ -35,37 +35,39 @@ import { EventInit, EventTarget, EventPhase, PotentialEventTarget, EventPathItem, Event } from './interfaces'; | ||
/** @inheritdoc */ | ||
readonly type: string; | ||
get type(): string; | ||
/** @inheritdoc */ | ||
readonly target: EventTarget | null; | ||
get target(): EventTarget | null; | ||
/** @inheritdoc */ | ||
readonly srcElement: EventTarget | null; | ||
get srcElement(): EventTarget | null; | ||
/** @inheritdoc */ | ||
readonly currentTarget: EventTarget | null; | ||
get currentTarget(): EventTarget | null; | ||
/** @inheritdoc */ | ||
composedPath(): EventTarget[]; | ||
/** @inheritdoc */ | ||
readonly eventPhase: EventPhase; | ||
get eventPhase(): EventPhase; | ||
/** @inheritdoc */ | ||
stopPropagation(): void; | ||
/** @inheritdoc */ | ||
cancelBubble: boolean; | ||
get cancelBubble(): boolean; | ||
set cancelBubble(value: boolean); | ||
/** @inheritdoc */ | ||
stopImmediatePropagation(): void; | ||
/** @inheritdoc */ | ||
readonly bubbles: boolean; | ||
get bubbles(): boolean; | ||
/** @inheritdoc */ | ||
readonly cancelable: boolean; | ||
get cancelable(): boolean; | ||
/** @inheritdoc */ | ||
returnValue: boolean; | ||
get returnValue(): boolean; | ||
set returnValue(value: boolean); | ||
/** @inheritdoc */ | ||
preventDefault(): void; | ||
/** @inheritdoc */ | ||
readonly defaultPrevented: boolean; | ||
get defaultPrevented(): boolean; | ||
/** @inheritdoc */ | ||
readonly composed: boolean; | ||
get composed(): boolean; | ||
/** @inheritdoc */ | ||
readonly isTrusted: boolean; | ||
get isTrusted(): boolean; | ||
/** @inheritdoc */ | ||
readonly timeStamp: number; | ||
get timeStamp(): number; | ||
/** @inheritdoc */ | ||
initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void; | ||
} |
@@ -246,2 +246,3 @@ "use strict"; | ||
} | ||
exports.EventImpl = EventImpl; | ||
EventImpl.NONE = 0; | ||
@@ -251,3 +252,2 @@ EventImpl.CAPTURING_PHASE = 1; | ||
EventImpl.BUBBLING_PHASE = 3; | ||
exports.EventImpl = EventImpl; | ||
//# sourceMappingURL=EventImpl.js.map |
@@ -18,3 +18,3 @@ import { Node, Element, HTMLCollection } from "./interfaces"; | ||
/** @inheritdoc */ | ||
readonly length: number; | ||
get length(): number; | ||
/** @inheritdoc */ | ||
@@ -21,0 +21,0 @@ item(index: number): Element | null; |
@@ -107,5 +107,5 @@ "use strict"; | ||
} | ||
exports.HTMLCollectionImpl = HTMLCollectionImpl; | ||
HTMLCollectionImpl.reservedNames = ['_root', '_live', '_filter', 'length', | ||
'item', 'namedItem', 'get']; | ||
exports.HTMLCollectionImpl = HTMLCollectionImpl; | ||
//# sourceMappingURL=HTMLCollectionImpl.js.map |
@@ -10,3 +10,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const util_1 = require("../util"); | ||
const util_1 = require("@oozcitak/util"); | ||
// Import implementation classes | ||
@@ -13,0 +13,0 @@ const AbortControllerImpl_1 = require("./AbortControllerImpl"); |
@@ -1,2 +0,2 @@ | ||
import { DOMObjectCache } from "../util/interfaces"; | ||
import { ObjectCache } from "@oozcitak/util"; | ||
import { AttributeChangeStep } from "../algorithm/interfaces"; | ||
@@ -25,4 +25,4 @@ import { Interfaces as URLInterfaces } from "@oozcitak/url"; | ||
_associatedDocument: Document; | ||
_rangeList: DOMObjectCache<Range>; | ||
_iteratorList: DOMObjectCache<NodeIterator>; | ||
_rangeList: ObjectCache<Range>; | ||
_iteratorList: ObjectCache<NodeIterator>; | ||
} | ||
@@ -29,0 +29,0 @@ /** |
@@ -36,19 +36,19 @@ import { Node, NodeList, MutationRecord } from "./interfaces"; | ||
/** @inheritdoc */ | ||
readonly type: "attributes" | "characterData" | "childList"; | ||
get type(): "attributes" | "characterData" | "childList"; | ||
/** @inheritdoc */ | ||
readonly target: Node; | ||
get target(): Node; | ||
/** @inheritdoc */ | ||
readonly addedNodes: NodeList; | ||
get addedNodes(): NodeList; | ||
/** @inheritdoc */ | ||
readonly removedNodes: NodeList; | ||
get removedNodes(): NodeList; | ||
/** @inheritdoc */ | ||
readonly previousSibling: Node | null; | ||
get previousSibling(): Node | null; | ||
/** @inheritdoc */ | ||
readonly nextSibling: Node | null; | ||
get nextSibling(): Node | null; | ||
/** @inheritdoc */ | ||
readonly attributeName: string | null; | ||
get attributeName(): string | null; | ||
/** @inheritdoc */ | ||
readonly attributeNamespace: string | null; | ||
get attributeNamespace(): string | null; | ||
/** @inheritdoc */ | ||
readonly oldValue: string | null; | ||
get oldValue(): string | null; | ||
/** | ||
@@ -55,0 +55,0 @@ * Creates a new `MutationRecord`. |
@@ -16,3 +16,3 @@ import { Element, Attr, NamedNodeMap } from "./interfaces"; | ||
/** @inheritdoc */ | ||
readonly length: number; | ||
get length(): number; | ||
/** @inheritdoc */ | ||
@@ -19,0 +19,0 @@ item(index: number): Attr | null; |
@@ -26,2 +26,3 @@ "use strict"; | ||
} | ||
exports.NodeFilterImpl = NodeFilterImpl; | ||
NodeFilterImpl.FILTER_ACCEPT = 1; | ||
@@ -43,3 +44,2 @@ NodeFilterImpl.FILTER_REJECT = 2; | ||
NodeFilterImpl.SHOW_NOTATION = 0x800; | ||
exports.NodeFilterImpl = NodeFilterImpl; | ||
//# sourceMappingURL=NodeFilterImpl.js.map |
@@ -27,3 +27,4 @@ import { Node, NodeList, Element, Document, NodeType, Position, GetRootNodeOptions, RegisteredObserver, TransientRegisteredObserver, Event, EventTarget } from './interfaces'; | ||
private _nodeDocumentOverride; | ||
_nodeDocument: Document; | ||
get _nodeDocument(): Document; | ||
set _nodeDocument(val: Document); | ||
_registeredObserverList: Array<RegisteredObserver | TransientRegisteredObserver>; | ||
@@ -42,19 +43,19 @@ abstract _nodeType: NodeType; | ||
/** @inheritdoc */ | ||
readonly nodeType: NodeType; | ||
get nodeType(): NodeType; | ||
/** | ||
* Returns a string appropriate for the type of node. | ||
*/ | ||
readonly nodeName: string; | ||
get nodeName(): string; | ||
/** | ||
* Gets the absolute base URL of the node. | ||
*/ | ||
readonly baseURI: string; | ||
get baseURI(): string; | ||
/** | ||
* Returns whether the node is rooted to a document node. | ||
*/ | ||
readonly isConnected: boolean; | ||
get isConnected(): boolean; | ||
/** | ||
* Returns the parent document. | ||
*/ | ||
readonly ownerDocument: Document | null; | ||
get ownerDocument(): Document | null; | ||
/** | ||
@@ -71,7 +72,7 @@ * Returns the root node. | ||
*/ | ||
readonly parentNode: Node | null; | ||
get parentNode(): Node | null; | ||
/** | ||
* Returns the parent element. | ||
*/ | ||
readonly parentElement: Element | null; | ||
get parentElement(): Element | null; | ||
/** | ||
@@ -84,19 +85,19 @@ * Determines whether a node has any children. | ||
*/ | ||
readonly childNodes: NodeList; | ||
get childNodes(): NodeList; | ||
/** | ||
* Returns the first child node. | ||
*/ | ||
readonly firstChild: Node | null; | ||
get firstChild(): Node | null; | ||
/** | ||
* Returns the last child node. | ||
*/ | ||
readonly lastChild: Node | null; | ||
get lastChild(): Node | null; | ||
/** | ||
* Returns the previous sibling node. | ||
*/ | ||
readonly previousSibling: Node | null; | ||
get previousSibling(): Node | null; | ||
/** | ||
* Returns the next sibling node. | ||
*/ | ||
readonly nextSibling: Node | null; | ||
get nextSibling(): Node | null; | ||
/** | ||
@@ -106,3 +107,4 @@ * Gets or sets the data associated with a {@link CharacterData} node or the | ||
*/ | ||
nodeValue: string | null; | ||
get nodeValue(): string | null; | ||
set nodeValue(value: string | null); | ||
/** | ||
@@ -113,3 +115,4 @@ * Returns the concatenation of data of all the {@link Text} | ||
*/ | ||
textContent: string | null; | ||
get textContent(): string | null; | ||
set textContent(value: string | null); | ||
/** | ||
@@ -116,0 +119,0 @@ * Puts all {@link Text} nodes in the full depth of the sub-tree |
@@ -7,3 +7,2 @@ "use strict"; | ||
const DOMException_1 = require("./DOMException"); | ||
const NodeCompareCache_1 = require("../util/NodeCompareCache"); | ||
const url_1 = require("@oozcitak/url"); | ||
@@ -491,3 +490,3 @@ /** | ||
return interfaces_1.Position.Disconnected | interfaces_1.Position.ImplementationSpecific | | ||
(NodeCompareCache_1.NodeCompareCache.instance.check(this, other) ? interfaces_1.Position.Preceding : interfaces_1.Position.Following); | ||
(util_1.globalStore.compareCache.check(this, other) ? interfaces_1.Position.Preceding : interfaces_1.Position.Following); | ||
} | ||
@@ -723,2 +722,3 @@ /** | ||
} | ||
exports.NodeImpl = NodeImpl; | ||
NodeImpl.ELEMENT_NODE = 1; | ||
@@ -742,3 +742,2 @@ NodeImpl.ATTRIBUTE_NODE = 2; | ||
NodeImpl.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; | ||
exports.NodeImpl = NodeImpl; | ||
//# sourceMappingURL=NodeImpl.js.map |
@@ -16,5 +16,5 @@ import { Node, NodeIterator, Collection } from "./interfaces"; | ||
/** @inheritdoc */ | ||
readonly referenceNode: Node; | ||
get referenceNode(): Node; | ||
/** @inheritdoc */ | ||
readonly pointerBeforeReferenceNode: boolean; | ||
get pointerBeforeReferenceNode(): boolean; | ||
/** @inheritdoc */ | ||
@@ -21,0 +21,0 @@ nextNode(): Node | null; |
@@ -17,3 +17,3 @@ import { Node, NodeList } from "./interfaces"; | ||
/** @inheritdoc */ | ||
readonly length: number; | ||
get length(): number; | ||
/** @inheritdoc */ | ||
@@ -20,0 +20,0 @@ item(index: number): Node | null; |
@@ -19,3 +19,3 @@ import { Node, NodeList } from "./interfaces"; | ||
/** @inheritdoc */ | ||
readonly length: number; | ||
get length(): number; | ||
/** @inheritdoc */ | ||
@@ -22,0 +22,0 @@ item(index: number): Node | null; |
@@ -9,5 +9,5 @@ import { Element, NonDocumentTypeChildNode } from './interfaces'; | ||
/** @inheritdoc */ | ||
readonly previousElementSibling: Element | null; | ||
get previousElementSibling(): Element | null; | ||
/** @inheritdoc */ | ||
readonly nextElementSibling: Element | null; | ||
get nextElementSibling(): Element | null; | ||
} |
@@ -9,9 +9,9 @@ import { Node, HTMLCollection, NodeList, Element, ParentNode } from './interfaces'; | ||
/** @inheritdoc */ | ||
readonly children: HTMLCollection; | ||
get children(): HTMLCollection; | ||
/** @inheritdoc */ | ||
readonly firstElementChild: Element | null; | ||
get firstElementChild(): Element | null; | ||
/** @inheritdoc */ | ||
readonly lastElementChild: Element | null; | ||
get lastElementChild(): Element | null; | ||
/** @inheritdoc */ | ||
readonly childElementCount: number; | ||
get childElementCount(): number; | ||
/** @inheritdoc */ | ||
@@ -18,0 +18,0 @@ prepend(...nodes: (Node | string)[]): void; |
@@ -16,3 +16,3 @@ import { NodeType, ProcessingInstruction, Document } from "./interfaces"; | ||
*/ | ||
readonly target: string; | ||
get target(): string; | ||
/** | ||
@@ -19,0 +19,0 @@ * Creates a new `ProcessingInstruction`. |
@@ -20,3 +20,3 @@ import { Node, Range, HowToCompare, DocumentFragment, BoundaryPoint } from './interfaces'; | ||
/** @inheritdoc */ | ||
readonly commonAncestorContainer: Node; | ||
get commonAncestorContainer(): Node; | ||
/** @inheritdoc */ | ||
@@ -23,0 +23,0 @@ setStart(node: Node, offset: number): void; |
@@ -561,2 +561,3 @@ "use strict"; | ||
} | ||
exports.RangeImpl = RangeImpl; | ||
RangeImpl.START_TO_START = 0; | ||
@@ -566,3 +567,2 @@ RangeImpl.START_TO_END = 1; | ||
RangeImpl.END_TO_START = 3; | ||
exports.RangeImpl = RangeImpl; | ||
//# sourceMappingURL=RangeImpl.js.map |
@@ -17,5 +17,5 @@ import { Element, ShadowRootMode, Event, EventTarget, ShadowRoot, Document } from "./interfaces"; | ||
/** @inheritdoc */ | ||
readonly mode: ShadowRootMode; | ||
get mode(): ShadowRootMode; | ||
/** @inheritdoc */ | ||
readonly host: Element; | ||
get host(): Element; | ||
/** | ||
@@ -22,0 +22,0 @@ * Gets the parent event target for the given event. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const DocumentFragmentImpl_1 = require("./DocumentFragmentImpl"); | ||
const util_1 = require("../util"); | ||
const util_1 = require("@oozcitak/util"); | ||
/** | ||
@@ -6,0 +6,0 @@ * Represents a shadow root. |
@@ -10,6 +10,8 @@ import { Slotable, Slot, HTMLSlotElement } from './interfaces'; | ||
__assignedSlot: Slot | null | undefined; | ||
_name: string; | ||
_assignedSlot: Slot | null; | ||
get _name(): string; | ||
set _name(val: string); | ||
get _assignedSlot(): Slot | null; | ||
set _assignedSlot(val: Slot | null); | ||
/** @inheritdoc */ | ||
readonly assignedSlot: HTMLSlotElement | null; | ||
get assignedSlot(): HTMLSlotElement | null; | ||
} |
@@ -17,6 +17,6 @@ import { NodeType, Text, HTMLSlotElement, Document, Slot } from "./interfaces"; | ||
/** @inheritdoc */ | ||
readonly wholeText: string; | ||
get wholeText(): string; | ||
/** @inheritdoc */ | ||
splitText(offset: number): Text; | ||
readonly assignedSlot: HTMLSlotElement | null; | ||
get assignedSlot(): HTMLSlotElement | null; | ||
/** | ||
@@ -23,0 +23,0 @@ * Creates a `Text`. |
@@ -20,7 +20,7 @@ import { Node, NodeFilter, WhatToShow, Traverser } from "./interfaces"; | ||
/** @inheritdoc */ | ||
readonly root: Node; | ||
get root(): Node; | ||
/** @inheritdoc */ | ||
readonly whatToShow: WhatToShow; | ||
get whatToShow(): WhatToShow; | ||
/** @inheritdoc */ | ||
readonly filter: NodeFilter | null; | ||
get filter(): NodeFilter | null; | ||
} |
@@ -13,3 +13,4 @@ import { Node, TreeWalker } from "./interfaces"; | ||
/** @inheritdoc */ | ||
currentNode: Node; | ||
get currentNode(): Node; | ||
set currentNode(value: Node); | ||
/** @inheritdoc */ | ||
@@ -16,0 +17,0 @@ parentNode(): Node | null; |
import { Event, Slot, MutationObserver, Document, Window, Range, NodeIterator } from './interfaces'; | ||
import { EventTargetImpl } from './EventTargetImpl'; | ||
import { DOMObjectCacheImpl } from '../util'; | ||
import { ObjectCache } from '@oozcitak/util'; | ||
/** | ||
@@ -13,4 +13,4 @@ * Represents a window containing a DOM document. | ||
_associatedDocument: Document; | ||
_rangeList: DOMObjectCacheImpl<Range>; | ||
_iteratorList: DOMObjectCacheImpl<NodeIterator>; | ||
_rangeList: ObjectCache<Range>; | ||
_iteratorList: ObjectCache<NodeIterator>; | ||
/** | ||
@@ -21,5 +21,5 @@ * Initializes a new instance of `Window`. | ||
/** @inheritdoc */ | ||
readonly document: Document; | ||
get document(): Document; | ||
/** @inheritdoc */ | ||
readonly event: Event | undefined; | ||
get event(): Event | undefined; | ||
/** | ||
@@ -26,0 +26,0 @@ * Creates a new window with a blank document. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const EventTargetImpl_1 = require("./EventTargetImpl"); | ||
const util_1 = require("../util"); | ||
const util_1 = require("@oozcitak/util"); | ||
/** | ||
@@ -17,4 +17,4 @@ * Represents a window containing a DOM document. | ||
this._mutationObservers = new Set(); | ||
this._rangeList = new util_1.DOMObjectCacheImpl(); | ||
this._iteratorList = new util_1.DOMObjectCacheImpl(); | ||
this._rangeList = new util_1.ObjectCache(); | ||
this._iteratorList = new util_1.ObjectCache(); | ||
this._associatedDocument = this._algo.create.document(); | ||
@@ -21,0 +21,0 @@ } |
@@ -20,7 +20,9 @@ "use strict"; | ||
exports.util = util; | ||
const util_1 = require("@oozcitak/util"); | ||
const algo = new algorithm.DOMAlgorithm(); | ||
util.globalStore.algorithm = algo; | ||
util.globalStore.window = algo.create.window(); | ||
util.globalStore.compareCache = new util_1.CompareCache(); | ||
exports.window = util.globalStore.window; | ||
exports.implementation = exports.window.document.implementation; | ||
//# sourceMappingURL=index.js.map |
@@ -6,2 +6,3 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
const util_2 = require("@oozcitak/util"); | ||
const infra_1 = require("@oozcitak/infra"); | ||
@@ -61,3 +62,3 @@ /** | ||
// attribute | ||
for (let [attName, attValue] of util_1.forEachObject(element.attributes)) { | ||
for (let [attName, attValue] of util_2.forEachObject(element.attributes)) { | ||
if (attName === "xmlns") { | ||
@@ -79,3 +80,3 @@ namespace = attValue; | ||
// assign attributes | ||
for (let [attName, attValue] of util_1.forEachObject(element.attributes)) { | ||
for (let [attName, attValue] of util_2.forEachObject(element.attributes)) { | ||
// skip the default namespace declaration attribute | ||
@@ -82,0 +83,0 @@ if (attName === "xmlns") { |
@@ -30,3 +30,3 @@ import { XMLToken, XMLLexer } from './interfaces'; | ||
*/ | ||
private readonly eof; | ||
private get eof(); | ||
/** | ||
@@ -33,0 +33,0 @@ * Consumes and returns a single character. |
@@ -16,3 +16,3 @@ import { TokenType, XMLToken } from "./interfaces"; | ||
*/ | ||
readonly type: TokenType; | ||
get type(): TokenType; | ||
} | ||
@@ -64,3 +64,3 @@ /** | ||
*/ | ||
readonly isWhitespace: boolean; | ||
get isWhitespace(): boolean; | ||
} | ||
@@ -67,0 +67,0 @@ /** |
@@ -14,3 +14,3 @@ /** | ||
*/ | ||
readonly size: number; | ||
get size(): number; | ||
/** | ||
@@ -17,0 +17,0 @@ * Adds or replaces a tuple. |
@@ -1,3 +0,4 @@ | ||
import { Window } from "../dom/interfaces"; | ||
import { Window, Node } from "../dom/interfaces"; | ||
import { DOMAlgorithm } from "../algorithm/interfaces"; | ||
import { CompareCache } from "@oozcitak/util"; | ||
/** | ||
@@ -10,2 +11,3 @@ * Represents a global data store. | ||
private _window; | ||
private _compareCache; | ||
/** | ||
@@ -18,11 +20,18 @@ * Initializes a new instance of `GlobalStore`. | ||
*/ | ||
algorithm: DOMAlgorithm; | ||
get algorithm(): DOMAlgorithm; | ||
set algorithm(val: DOMAlgorithm); | ||
/** | ||
* Gets or sets the global window object. | ||
*/ | ||
window: Window; | ||
get window(): Window; | ||
set window(val: Window); | ||
/** | ||
* Gets or sets the global window object. | ||
*/ | ||
get compareCache(): CompareCache<Node>; | ||
set compareCache(val: CompareCache<Node>); | ||
/** | ||
* Returns the instance of `GlobalStore`. | ||
*/ | ||
static readonly instance: GlobalStore; | ||
static get instance(): GlobalStore; | ||
} |
@@ -13,2 +13,3 @@ "use strict"; | ||
this._window = null; | ||
this._compareCache = null; | ||
} | ||
@@ -36,2 +37,12 @@ /** | ||
/** | ||
* Gets or sets the global window object. | ||
*/ | ||
get compareCache() { | ||
if (this._compareCache === null) { | ||
throw new Error("Global compare cache instance is null."); | ||
} | ||
return this._compareCache; | ||
} | ||
set compareCache(val) { this._compareCache = val; } | ||
/** | ||
* Returns the instance of `GlobalStore`. | ||
@@ -38,0 +49,0 @@ */ |
import { GlobalStore } from './GlobalStore'; | ||
export { DOMObjectCacheImpl } from './DOMObjectCacheImpl'; | ||
export { GlobalStore }; | ||
export { Cast } from './Cast'; | ||
export { Guard } from './Guard'; | ||
export { NodeCompareCache } from './NodeCompareCache'; | ||
import * as Interfaces from './interfaces'; | ||
export { GlobalStore }; | ||
export { Interfaces }; | ||
/** | ||
@@ -13,138 +9,1 @@ * Stores global variables. | ||
export declare const globalStore: GlobalStore; | ||
/** | ||
* Applies the mixin to a given class. | ||
* | ||
* @param baseClass - class to receive the mixin | ||
* @param mixinClass - mixin class | ||
* @param overrides - an array with names of function overrides. Base class | ||
* functions whose names are in this array will be kept by prepending an | ||
* underscore to their names. | ||
*/ | ||
export declare function applyMixin(baseClass: any, mixinClass: any, ...overrides: string[]): void; | ||
/** | ||
* Applies default values to the given object. | ||
* | ||
* @param obj - an object | ||
* @param defaults - an object with default values | ||
* @param overwrite - if set to `true` defaults object always overwrites object | ||
* values, whether they are `undefined` or not. | ||
*/ | ||
export declare function applyDefaults<T>(obj: { | ||
[key: string]: any; | ||
} | undefined, defaults: { | ||
[key: string]: any; | ||
}, overwrite?: boolean): T; | ||
/** | ||
* Iterates over items pairs of an array. | ||
* | ||
* @param arr - array to iterate | ||
*/ | ||
export declare function forEachArray<T>(arr: Array<T>): IterableIterator<T>; | ||
/** | ||
* Iterates over key/value pairs of a map or object. | ||
* | ||
* @param obj - map or object to iterate | ||
*/ | ||
export declare function forEachObject<T>(obj: Map<string, T> | { | ||
[key: string]: T; | ||
}): IterableIterator<[string, T]>; | ||
/** | ||
* Returns the number of entries in a map or object. | ||
* | ||
* @param obj - map or object | ||
*/ | ||
export declare function objectLength(obj: Map<string, any> | { | ||
[key: string]: any; | ||
}): number; | ||
/** | ||
* Gets the value of a key from a map or object. | ||
* | ||
* @param obj - map or object | ||
* @param key - the key to retrieve | ||
*/ | ||
export declare function getObjectValue<T>(obj: Map<string, T> | { | ||
[key: string]: T; | ||
}, key: string): T | undefined; | ||
/** | ||
* Removes a property from a map or object. | ||
* | ||
* @param obj - map or object | ||
* @param key - the key to remove | ||
*/ | ||
export declare function removeObjectValue<T>(obj: Map<string, T> | { | ||
[key: string]: T; | ||
}, key: string): void; | ||
/** | ||
* Deep clones the given object. | ||
* | ||
* @param obj - an object | ||
*/ | ||
export declare function clone<T extends Function | any[] | Object>(obj: T): T; | ||
/** | ||
* Type guard for boolean types | ||
* | ||
* @param x - a variable to type check | ||
*/ | ||
export declare function isBoolean(x: any): x is boolean; | ||
/** | ||
* Type guard for numeric types | ||
* | ||
* @param x - a variable to type check | ||
*/ | ||
export declare function isNumber(x: any): x is number; | ||
/** | ||
* Type guard for strings | ||
* | ||
* @param x - a variable to type check | ||
*/ | ||
export declare function isString(x: any): x is string; | ||
/** | ||
* Type guard for function objects | ||
* | ||
* @param x - a variable to type check | ||
*/ | ||
export declare function isFunction(x: any): x is Function; | ||
/** | ||
* Type guard for JS objects | ||
* | ||
* _Note:_ Functions are objects too | ||
* | ||
* @param x - a variable to type check | ||
*/ | ||
export declare function isObject(x: any): x is { | ||
[key: string]: any; | ||
}; | ||
/** | ||
* Type guard for arrays | ||
* | ||
* @param x - a variable to type check | ||
*/ | ||
export declare function isArray(x: any): x is any[]; | ||
/** | ||
* Type guard for maps. | ||
* | ||
* @param x - a variable to check | ||
*/ | ||
export declare function isMap(x: any): x is Map<string, any>; | ||
/** | ||
* Determines if `x` is an empty Array or an Object with no own properties. | ||
* | ||
* @param x - a variable to check | ||
*/ | ||
export declare function isEmpty(x: any): boolean; | ||
/** | ||
* Determines if `x` is a plain Object. | ||
* | ||
* @param x - a variable to check | ||
*/ | ||
export declare function isPlainObject(x: any): boolean; | ||
/** | ||
* Determines if `x` is an iterable Object. | ||
* | ||
* @param x - a variable to check | ||
*/ | ||
export declare function isIterable(x: any): boolean; | ||
/** | ||
* Gets the primitive value of an object. | ||
*/ | ||
export declare function getValue(obj: any): any; |
"use strict"; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const GlobalStore_1 = require("./GlobalStore"); | ||
exports.GlobalStore = GlobalStore_1.GlobalStore; | ||
var DOMObjectCacheImpl_1 = require("./DOMObjectCacheImpl"); | ||
exports.DOMObjectCacheImpl = DOMObjectCacheImpl_1.DOMObjectCacheImpl; | ||
var Cast_1 = require("./Cast"); | ||
@@ -18,7 +9,2 @@ exports.Cast = Cast_1.Cast; | ||
exports.Guard = Guard_1.Guard; | ||
var NodeCompareCache_1 = require("./NodeCompareCache"); | ||
exports.NodeCompareCache = NodeCompareCache_1.NodeCompareCache; | ||
// Export interfaces | ||
const Interfaces = __importStar(require("./interfaces")); | ||
exports.Interfaces = Interfaces; | ||
/** | ||
@@ -28,282 +14,2 @@ * Stores global variables. | ||
exports.globalStore = GlobalStore_1.GlobalStore.instance; | ||
/** | ||
* Applies the mixin to a given class. | ||
* | ||
* @param baseClass - class to receive the mixin | ||
* @param mixinClass - mixin class | ||
* @param overrides - an array with names of function overrides. Base class | ||
* functions whose names are in this array will be kept by prepending an | ||
* underscore to their names. | ||
*/ | ||
function applyMixin(baseClass, mixinClass, ...overrides) { | ||
Object.getOwnPropertyNames(mixinClass.prototype).forEach(name => { | ||
if (overrides.includes(name)) { | ||
const orgPropDesc = Object.getOwnPropertyDescriptor(baseClass.prototype, name); | ||
/* istanbul ignore else */ | ||
if (orgPropDesc) { | ||
Object.defineProperty(baseClass.prototype, "_" + name, orgPropDesc); | ||
} | ||
} | ||
const propDesc = Object.getOwnPropertyDescriptor(mixinClass.prototype, name); | ||
/* istanbul ignore else */ | ||
if (propDesc) { | ||
Object.defineProperty(baseClass.prototype, name, propDesc); | ||
} | ||
}); | ||
} | ||
exports.applyMixin = applyMixin; | ||
/** | ||
* Applies default values to the given object. | ||
* | ||
* @param obj - an object | ||
* @param defaults - an object with default values | ||
* @param overwrite - if set to `true` defaults object always overwrites object | ||
* values, whether they are `undefined` or not. | ||
*/ | ||
function applyDefaults(obj, defaults, overwrite = false) { | ||
const result = clone(obj || {}); | ||
for (const [key, val] of Object.entries(defaults)) { | ||
if (!overwrite && result[key] !== undefined) | ||
continue; | ||
if (isObject(val)) { | ||
result[key] = applyDefaults(result[key], val); | ||
} | ||
else { | ||
result[key] = val; | ||
} | ||
} | ||
return result; | ||
} | ||
exports.applyDefaults = applyDefaults; | ||
/** | ||
* Iterates over items pairs of an array. | ||
* | ||
* @param arr - array to iterate | ||
*/ | ||
function* forEachArray(arr) { | ||
for (let i = 0, len = arr.length; i < len; i++) { | ||
yield arr[i]; | ||
} | ||
} | ||
exports.forEachArray = forEachArray; | ||
/** | ||
* Iterates over key/value pairs of a map or object. | ||
* | ||
* @param obj - map or object to iterate | ||
*/ | ||
function* forEachObject(obj) { | ||
if (isMap(obj)) { | ||
for (const [key, val] of obj.entries()) { | ||
yield [key, val]; | ||
} | ||
} | ||
else { | ||
for (const key in obj) { | ||
/* istanbul ignore next */ | ||
if (!obj.hasOwnProperty(key)) | ||
continue; | ||
yield [key, obj[key]]; | ||
} | ||
} | ||
} | ||
exports.forEachObject = forEachObject; | ||
/** | ||
* Returns the number of entries in a map or object. | ||
* | ||
* @param obj - map or object | ||
*/ | ||
function objectLength(obj) { | ||
if (isMap(obj)) { | ||
return obj.size; | ||
} | ||
else { | ||
return Object.keys(obj).length; | ||
} | ||
} | ||
exports.objectLength = objectLength; | ||
/** | ||
* Gets the value of a key from a map or object. | ||
* | ||
* @param obj - map or object | ||
* @param key - the key to retrieve | ||
*/ | ||
function getObjectValue(obj, key) { | ||
if (isMap(obj)) { | ||
return obj.get(key); | ||
} | ||
else { | ||
return obj[key]; | ||
} | ||
} | ||
exports.getObjectValue = getObjectValue; | ||
/** | ||
* Removes a property from a map or object. | ||
* | ||
* @param obj - map or object | ||
* @param key - the key to remove | ||
*/ | ||
function removeObjectValue(obj, key) { | ||
if (isMap(obj)) { | ||
obj.delete(key); | ||
} | ||
else { | ||
delete obj[key]; | ||
} | ||
} | ||
exports.removeObjectValue = removeObjectValue; | ||
/** | ||
* Deep clones the given object. | ||
* | ||
* @param obj - an object | ||
*/ | ||
function clone(obj) { | ||
if (isFunction(obj)) { | ||
return obj; | ||
} | ||
else if (isArray(obj)) { | ||
const result = []; | ||
for (const item of obj) { | ||
result.push(clone(item)); | ||
} | ||
return result; | ||
} | ||
else if (isObject(obj)) { | ||
const result = {}; | ||
for (const key in obj) { | ||
/* istanbul ignore next */ | ||
if (obj.hasOwnProperty(key)) { | ||
const val = obj[key]; | ||
result[key] = clone(val); | ||
} | ||
} | ||
return result; | ||
} | ||
else { | ||
return obj; | ||
} | ||
} | ||
exports.clone = clone; | ||
/** | ||
* Type guard for boolean types | ||
* | ||
* @param x - a variable to type check | ||
*/ | ||
function isBoolean(x) { | ||
return typeof x === "boolean"; | ||
} | ||
exports.isBoolean = isBoolean; | ||
/** | ||
* Type guard for numeric types | ||
* | ||
* @param x - a variable to type check | ||
*/ | ||
function isNumber(x) { | ||
return typeof x === "number"; | ||
} | ||
exports.isNumber = isNumber; | ||
/** | ||
* Type guard for strings | ||
* | ||
* @param x - a variable to type check | ||
*/ | ||
function isString(x) { | ||
return typeof x === "string"; | ||
} | ||
exports.isString = isString; | ||
/** | ||
* Type guard for function objects | ||
* | ||
* @param x - a variable to type check | ||
*/ | ||
function isFunction(x) { | ||
return !!x && Object.prototype.toString.call(x) === '[object Function]'; | ||
} | ||
exports.isFunction = isFunction; | ||
/** | ||
* Type guard for JS objects | ||
* | ||
* _Note:_ Functions are objects too | ||
* | ||
* @param x - a variable to type check | ||
*/ | ||
function isObject(x) { | ||
const type = typeof x; | ||
return !!x && (type === 'function' || type === 'object'); | ||
} | ||
exports.isObject = isObject; | ||
/** | ||
* Type guard for arrays | ||
* | ||
* @param x - a variable to type check | ||
*/ | ||
function isArray(x) { | ||
return Array.isArray(x); | ||
} | ||
exports.isArray = isArray; | ||
/** | ||
* Type guard for maps. | ||
* | ||
* @param x - a variable to check | ||
*/ | ||
function isMap(x) { | ||
return x instanceof Map; | ||
} | ||
exports.isMap = isMap; | ||
/** | ||
* Determines if `x` is an empty Array or an Object with no own properties. | ||
* | ||
* @param x - a variable to check | ||
*/ | ||
function isEmpty(x) { | ||
if (isArray(x)) { | ||
return !x.length; | ||
} | ||
else if (isObject(x)) { | ||
for (const key in x) { | ||
if (x.hasOwnProperty(key)) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
return false; | ||
} | ||
exports.isEmpty = isEmpty; | ||
/** | ||
* Determines if `x` is a plain Object. | ||
* | ||
* @param x - a variable to check | ||
*/ | ||
function isPlainObject(x) { | ||
if (isObject(x)) { | ||
const proto = Object.getPrototypeOf(x); | ||
const ctor = proto.constructor; | ||
return proto && ctor && | ||
(typeof ctor === 'function') && (ctor instanceof ctor) && | ||
(Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object)); | ||
} | ||
return false; | ||
} | ||
exports.isPlainObject = isPlainObject; | ||
/** | ||
* Determines if `x` is an iterable Object. | ||
* | ||
* @param x - a variable to check | ||
*/ | ||
function isIterable(x) { | ||
return x && (typeof x[Symbol.iterator] === 'function'); | ||
} | ||
exports.isIterable = isIterable; | ||
/** | ||
* Gets the primitive value of an object. | ||
*/ | ||
function getValue(obj) { | ||
if (isFunction(obj.valueOf)) { | ||
return obj.valueOf(); | ||
} | ||
else { | ||
return obj; | ||
} | ||
} | ||
exports.getValue = getValue; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@oozcitak/dom", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"keywords": [ | ||
@@ -28,4 +28,5 @@ "dom", | ||
"dependencies": { | ||
"@oozcitak/infra": "1.0.2", | ||
"@oozcitak/url": "0.0.7" | ||
"@oozcitak/util": "1.0.2", | ||
"@oozcitak/infra": "1.0.4", | ||
"@oozcitak/url": "0.0.8" | ||
}, | ||
@@ -53,3 +54,3 @@ "devDependencies": { | ||
"scripts": { | ||
"compile": "rm -rf lib && tsc", | ||
"compile": "rm -rf lib && tsc --version && tsc", | ||
"test": "npm run compile && jest", | ||
@@ -56,0 +57,0 @@ "testChanged": "npm run compile && jest --onlyChanged", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1074300
3
270
21165
+ Added@oozcitak/util@1.0.2
+ Added@oozcitak/infra@1.0.31.0.4(transitive)
+ Added@oozcitak/url@0.0.8(transitive)
+ Added@oozcitak/util@1.0.11.0.2(transitive)
+ Added@oozcitak/uts46@0.0.8(transitive)
- Removed@oozcitak/infra@1.0.2(transitive)
- Removed@oozcitak/url@0.0.7(transitive)
- Removed@oozcitak/uts46@0.0.7(transitive)
Updated@oozcitak/infra@1.0.4
Updated@oozcitak/url@0.0.8