@getodk/xpath 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/defaults.d.ts +3 -6
- package/dist/adapter/interface/XPathNodeKindAdapter.d.ts +1 -0
- package/dist/adapter/interface/XPathTraversalAdapter.d.ts +2 -2
- package/dist/evaluator/NamespaceResolver.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/static/grammar/type-names.d.ts +1 -4
- package/package.json +15 -13
|
@@ -2,13 +2,10 @@ import { WHATAttribute, WHATChildNode, WHATComment, WHATDocument, WHATElement, W
|
|
|
2
2
|
import { WHATDOMAdapter } from './WHAT/whatDOMAdapter.ts';
|
|
3
3
|
import { XPathDOMProvider } from './xpathDOMProvider.ts';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* sites, internally but especially at the package boundary.
|
|
5
|
+
* This is for clarity at usage and reference sites,
|
|
6
|
+
* internally but especially at the package boundary.
|
|
8
7
|
*/
|
|
9
|
-
type AsDefault<T> = T
|
|
10
|
-
readonly _?: never;
|
|
11
|
-
});
|
|
8
|
+
type AsDefault<T> = T;
|
|
12
9
|
type DefaultDOMAdapter = AsDefault<WHATDOMAdapter>;
|
|
13
10
|
type DefaultDOMProvider = AsDefault<XPathDOMProvider<WHATNode>>;
|
|
14
11
|
export declare const DEFAULT_DOM_ADAPTER: DefaultDOMAdapter;
|
|
@@ -6,6 +6,7 @@ export type AdapterAttribute<T extends XPathNode> = Extract<T, XPathAttribute>;
|
|
|
6
6
|
export type AdapterText<T extends XPathNode> = Extract<T, XPathText>;
|
|
7
7
|
export type AdapterComment<T extends XPathNode> = Extract<T, XPathComment>;
|
|
8
8
|
export type AdapterProcessingInstruction<T extends XPathNode> = Extract<T, XPathProcessingInstruction>;
|
|
9
|
+
export type AdapterNode<T extends XPathNode> = AdapterChildNode<T> | AdapterParentNode<T>;
|
|
9
10
|
export type AdapterParentNode<T extends XPathNode> = AdapterDocument<T> | AdapterElement<T>;
|
|
10
11
|
export type AdapterChildNode<T extends XPathNode> = AdapterElement<T> | AdapterText<T> | AdapterComment<T> | AdapterAttribute<T> | AdapterProcessingInstruction<T>;
|
|
11
12
|
export type AdapterQualifiedNamedNode<T extends XPathNode> = AdapterElement<T> | AdapterAttribute<T>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { XPathNode } from './XPathNode.ts';
|
|
2
|
-
import { AdapterAttribute, AdapterChildNode, AdapterDocument, AdapterElement, AdapterNamespaceDeclaration,
|
|
2
|
+
import { AdapterAttribute, AdapterChildNode, AdapterDocument, AdapterElement, AdapterNamespaceDeclaration, AdapterNode } from './XPathNodeKindAdapter.ts';
|
|
3
3
|
export type DocumentOrderComparison = -1 | 0 | 1;
|
|
4
4
|
export interface XPathTraversalAdapter<T extends XPathNode> {
|
|
5
5
|
/**
|
|
@@ -14,7 +14,7 @@ export interface XPathTraversalAdapter<T extends XPathNode> {
|
|
|
14
14
|
readonly getContainingDocument: (node: T) => AdapterDocument<T>;
|
|
15
15
|
readonly getNamespaceDeclarations: (node: T) => ReadonlyArray<AdapterNamespaceDeclaration<T>>;
|
|
16
16
|
readonly getAttributes: (node: T) => ReadonlyArray<AdapterAttribute<T>>;
|
|
17
|
-
readonly getParentNode: (node: T) =>
|
|
17
|
+
readonly getParentNode: (node: T) => AdapterNode<T> | null;
|
|
18
18
|
readonly getChildNodes: (node: T) => ReadonlyArray<AdapterChildNode<T>>;
|
|
19
19
|
readonly getChildElements: (node: T) => ReadonlyArray<AdapterElement<T>>;
|
|
20
20
|
readonly getPreviousSiblingNode: (node: T) => AdapterChildNode<T> | null;
|
|
@@ -7,7 +7,7 @@ export { ENKETO_NAMESPACE_URI, ENKETO_PREFIX, FN_NAMESPACE_URI, FN_PREFIX, HTML_
|
|
|
7
7
|
export interface StaticNamespaces<DefaultPrefix extends string, DefaultURI extends string, Mapping extends Record<string, string>> {
|
|
8
8
|
get<Key extends string | null>(key: Key): Key extends null ? DefaultURI : Key extends DefaultPrefix ? DefaultURI : Key extends keyof Mapping ? Mapping[Key] : undefined;
|
|
9
9
|
has(key: null): true;
|
|
10
|
-
has(key: DefaultPrefix
|
|
10
|
+
has(key: DefaultPrefix): true;
|
|
11
11
|
has(key: keyof Mapping): true;
|
|
12
12
|
has(key: string): false;
|
|
13
13
|
}
|