@mak-98/xml-dirvi-app 0.11.0-beta.2 → 0.11.0-beta.24
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/README.md +122 -0
- package/dist/domain/xml-doc.d.ts +73 -0
- package/dist/domain/xml-doc.d.ts.map +1 -0
- package/dist/domain/xml-doc.js +15 -0
- package/dist/domain/xml-tree.d.ts +83 -249
- package/dist/domain/xml-tree.d.ts.map +1 -1
- package/dist/domain/xml-tree.js +63 -96
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/infrastructure/create-xml-dom.d.ts +6 -0
- package/dist/infrastructure/create-xml-dom.d.ts.map +1 -0
- package/dist/infrastructure/create-xml-dom.js +166 -0
- package/dist/infrastructure/create-xml-file-resync.d.ts +2 -0
- package/dist/infrastructure/create-xml-file-resync.d.ts.map +1 -0
- package/dist/infrastructure/create-xml-file-resync.js +68 -0
- package/dist/infrastructure/get-xml-entries.d.ts +1 -18
- package/dist/infrastructure/get-xml-entries.d.ts.map +1 -1
- package/dist/infrastructure/get-xml-entries.js +118 -44
- package/dist/infrastructure/load-node-xml-app-api.d.ts +1 -0
- package/dist/infrastructure/load-node-xml-app-api.d.ts.map +1 -1
- package/dist/infrastructure/load-node-xml-app-api.js +7 -3
- package/dist/infrastructure/parse-xml-document.d.ts +6 -4
- package/dist/infrastructure/parse-xml-document.d.ts.map +1 -1
- package/dist/infrastructure/parse-xml-document.js +9 -12
- package/dist/services/xml-dom.d.ts +16 -0
- package/dist/services/xml-dom.d.ts.map +1 -0
- package/dist/services/xml-dom.js +1 -0
- package/dist/xml-dirvi-app.d.ts +2 -5
- package/dist/xml-dirvi-app.d.ts.map +1 -1
- package/dist/xml-dirvi-app.js +53 -13
- package/package.json +4 -3
package/README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# XML dirvi app plugin
|
|
2
|
+
|
|
3
|
+
The XML dirvi app plugin lets dirvi load, browse and edit XML data as interactive tree srtuctures.
|
|
4
|
+
|
|
5
|
+
## Default view
|
|
6
|
+
|
|
7
|
+
By default, shows the document structure without applying specialized leaf rules.
|
|
8
|
+
|
|
9
|
+
Elements can be expanded to reveal their child nodes, including text, CDATA,
|
|
10
|
+
comments, and processing instructions. Whitespace-only text nodes are visible,
|
|
11
|
+
including what would be considered newlines for formatting:
|
|
12
|
+
|
|
13
|
+
```xml
|
|
14
|
+
<library>
|
|
15
|
+
<book>My book</book>
|
|
16
|
+
</library>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
would give by default:
|
|
20
|
+
|
|
21
|
+
```txt
|
|
22
|
+
library
|
|
23
|
+
text
|
|
24
|
+
book
|
|
25
|
+
text
|
|
26
|
+
text
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
This is usually not desirable, and a way to filter the nodes to only show such
|
|
30
|
+
whitespace formatting in subtrees with `xml:space="preserve"` is provided.
|
|
31
|
+
|
|
32
|
+
Attributes are not child nodes of elements, but are inspectable and changeable.
|
|
33
|
+
|
|
34
|
+
## View options
|
|
35
|
+
|
|
36
|
+
### Filter whitespace-only text
|
|
37
|
+
|
|
38
|
+
- Default: off.
|
|
39
|
+
- Hide text nodes containing only XML whitespace.
|
|
40
|
+
- Do not hide whitespace where `xml:space="preserve"` applies.
|
|
41
|
+
|
|
42
|
+
### Treat text-only elements as leaves
|
|
43
|
+
|
|
44
|
+
- Default: off.
|
|
45
|
+
- Treat an element as a leaf when all of its children are text or CDATA.
|
|
46
|
+
- An empty element also qualifies.
|
|
47
|
+
- Edit its contents as plain text.
|
|
48
|
+
|
|
49
|
+
Saving plain text replaces the element's contents with text. Markup typed into
|
|
50
|
+
the editor is text, not a request to create XML elements. CDATA boundaries
|
|
51
|
+
need not be retained.
|
|
52
|
+
|
|
53
|
+
### Treat extension-marked elements as leaves
|
|
54
|
+
|
|
55
|
+
- Default: off.
|
|
56
|
+
- Configure the attribute name used to specify a file extension.
|
|
57
|
+
- An element with that attribute is a leaf, edited as plain text.
|
|
58
|
+
- Open the editor with a temporary filename using the specified extension, so
|
|
59
|
+
the editor can choose syntax highlighting.
|
|
60
|
+
- The extension rule takes precedence over the other leaf rules.
|
|
61
|
+
|
|
62
|
+
For example, assuming the configured attribute is `extension`:
|
|
63
|
+
|
|
64
|
+
```xml
|
|
65
|
+
<snippet extension="tsx">const App = () => <div>Hello</div>;</snippet>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The editor receives:
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
const App = () => <div>Hello</div>;
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
After saving, the contents are still text, and the element remains a leaf.
|
|
75
|
+
If an extension-marked element contains child elements or other non-text
|
|
76
|
+
content, report an error rather than silently flattening or discarding it.
|
|
77
|
+
|
|
78
|
+
Treat the extension as data, not as a path or shell command. Reject unsafe
|
|
79
|
+
values before constructing a temporary filename.
|
|
80
|
+
|
|
81
|
+
### Treat `xml:space="preserve"` elements as leaves
|
|
82
|
+
|
|
83
|
+
- Default: off.
|
|
84
|
+
- An element with `xml:space="preserve"` directly on it is a leaf.
|
|
85
|
+
- Edit its contents as **inner XML**, including any nested markup.
|
|
86
|
+
- Parse the edited contents as XML on save.
|
|
87
|
+
|
|
88
|
+
For example, the editor for this element:
|
|
89
|
+
|
|
90
|
+
```xml
|
|
91
|
+
<note xml:space="preserve">Hello <em>world</em>.</note>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
receives:
|
|
95
|
+
|
|
96
|
+
```xml
|
|
97
|
+
Hello <em>world</em>.
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The extension rule takes precedence if both rules apply.
|
|
101
|
+
|
|
102
|
+
`xml:space` can be inherited in XML. For this view option, however, only the
|
|
103
|
+
element that directly declares `xml:space="preserve"` becomes a leaf.
|
|
104
|
+
|
|
105
|
+
## Editing and saving
|
|
106
|
+
|
|
107
|
+
- Open editable content in an external editor through a temporary file.
|
|
108
|
+
- Distinguish plain-text editing from inner-XML editing. Never parse plain-text
|
|
109
|
+
edits as XML markup.
|
|
110
|
+
- For inner-XML edits, support multiple child nodes and namespace declarations
|
|
111
|
+
inherited from ancestors.
|
|
112
|
+
- Reject invalid edits without overwriting the original file.
|
|
113
|
+
- Detect if the original file changed while the editor was open; do not
|
|
114
|
+
silently overwrite those changes.
|
|
115
|
+
- Clean up temporary files after editing.
|
|
116
|
+
- Preserve document content not intentionally edited, even if its serialized
|
|
117
|
+
formatting changes. In particular, do not add or remove meaningful
|
|
118
|
+
whitespace while formatting.
|
|
119
|
+
- Report unsupported XML features instead of silently losing content.
|
|
120
|
+
|
|
121
|
+
Creating or restructuring branches should be a separate, intentional user
|
|
122
|
+
operation, not a side effect of saving plain text.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An XML document contains one root element and may also contain an XML
|
|
3
|
+
* declaration, a doctype, comments, and processing instructions. Elements
|
|
4
|
+
* have attributes and ordered children; their children may include elements,
|
|
5
|
+
* text, CDATA, comments, and processing instructions.
|
|
6
|
+
*
|
|
7
|
+
* These types model the document as a tree. Attributes belong to elements
|
|
8
|
+
* rather than appearing as child nodes. Text and CDATA remain distinct node
|
|
9
|
+
* kinds, and child order preserves mixed content.
|
|
10
|
+
*
|
|
11
|
+
* A document or element with `children` undefined has not had its children
|
|
12
|
+
* loaded. An empty array means its children have been loaded and it has none.
|
|
13
|
+
* These types describe the tree but do not enforce every XML validity rule.
|
|
14
|
+
*/
|
|
15
|
+
export type XmlNodePath = readonly number[];
|
|
16
|
+
/**
|
|
17
|
+
* Used by both XML attributes and elements.
|
|
18
|
+
*/
|
|
19
|
+
export type XmlName = {
|
|
20
|
+
qualifiedName: string;
|
|
21
|
+
localName: string;
|
|
22
|
+
prefix: string | null;
|
|
23
|
+
namespaceUri: string | null;
|
|
24
|
+
};
|
|
25
|
+
export type XmlDocument = {
|
|
26
|
+
kind: 'document';
|
|
27
|
+
children?: readonly XmlDocumentChild[];
|
|
28
|
+
};
|
|
29
|
+
export type XmlDeclaration = {
|
|
30
|
+
kind: 'declaration';
|
|
31
|
+
version: string;
|
|
32
|
+
encoding: string | null;
|
|
33
|
+
standalone: 'yes' | 'no' | null;
|
|
34
|
+
};
|
|
35
|
+
export type XmlDoctype = {
|
|
36
|
+
kind: 'doctype';
|
|
37
|
+
name: string;
|
|
38
|
+
publicId: string | null;
|
|
39
|
+
systemId: string | null;
|
|
40
|
+
internalSubset: string | null;
|
|
41
|
+
};
|
|
42
|
+
export type XmlAttribute = {
|
|
43
|
+
name: XmlName;
|
|
44
|
+
value: string;
|
|
45
|
+
};
|
|
46
|
+
export type XmlElement = {
|
|
47
|
+
kind: 'element';
|
|
48
|
+
name: XmlName;
|
|
49
|
+
attributes: readonly XmlAttribute[];
|
|
50
|
+
children?: readonly XmlElementChild[];
|
|
51
|
+
};
|
|
52
|
+
export type XmlText = {
|
|
53
|
+
kind: 'text';
|
|
54
|
+
text: string;
|
|
55
|
+
};
|
|
56
|
+
export type XmlCdata = {
|
|
57
|
+
kind: 'cdata';
|
|
58
|
+
text: string;
|
|
59
|
+
};
|
|
60
|
+
export type XmlComment = {
|
|
61
|
+
kind: 'comment';
|
|
62
|
+
text: string;
|
|
63
|
+
};
|
|
64
|
+
export type XmlProcessingInstruction = {
|
|
65
|
+
kind: 'processing-instruction';
|
|
66
|
+
target: string;
|
|
67
|
+
data: string;
|
|
68
|
+
};
|
|
69
|
+
export type XmlDocumentChild = XmlDeclaration | XmlDoctype | XmlElement | XmlText | XmlComment | XmlProcessingInstruction;
|
|
70
|
+
export type XmlElementChild = XmlElement | XmlText | XmlCdata | XmlComment | XmlProcessingInstruction;
|
|
71
|
+
export type XmlChildNode = XmlDocumentChild | XmlElementChild;
|
|
72
|
+
export type XmlNode = XmlDocument | XmlChildNode;
|
|
73
|
+
//# sourceMappingURL=xml-doc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml-doc.d.ts","sourceRoot":"","sources":["../../src/domain/xml-doc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,WAAW,GAAG,SAAS,MAAM,EAAE,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B,CAAC;AAMF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,SAAS,YAAY,EAAE,CAAC;IACpC,QAAQ,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,GACxB,cAAc,GACd,UAAU,GACV,UAAU,GACV,OAAO,GACP,UAAU,GACV,wBAAwB,CAAC;AAE7B,MAAM,MAAM,eAAe,GACvB,UAAU,GACV,OAAO,GACP,QAAQ,GACR,UAAU,GACV,wBAAwB,CAAC;AAE7B,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG,eAAe,CAAC;AAC9D,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG,YAAY,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An XML document contains one root element and may also contain an XML
|
|
3
|
+
* declaration, a doctype, comments, and processing instructions. Elements
|
|
4
|
+
* have attributes and ordered children; their children may include elements,
|
|
5
|
+
* text, CDATA, comments, and processing instructions.
|
|
6
|
+
*
|
|
7
|
+
* These types model the document as a tree. Attributes belong to elements
|
|
8
|
+
* rather than appearing as child nodes. Text and CDATA remain distinct node
|
|
9
|
+
* kinds, and child order preserves mixed content.
|
|
10
|
+
*
|
|
11
|
+
* A document or element with `children` undefined has not had its children
|
|
12
|
+
* loaded. An empty array means its children have been loaded and it has none.
|
|
13
|
+
* These types describe the tree but do not enforce every XML validity rule.
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
@@ -1,271 +1,105 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import type { TreeNode } from 'dirvi-lib';
|
|
3
|
+
declare const xmlIdBrand: unique symbol;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Position is an identity, not XML document order. XML sibling order is held
|
|
8
|
-
* by the source TreeNode child sequence.
|
|
5
|
+
* An opaque, reference-identity ID for a node in the current XML document.
|
|
9
6
|
*/
|
|
10
|
-
export type
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export
|
|
17
|
-
readonly kind: 'document';
|
|
18
|
-
}>;
|
|
19
|
-
export type XmlDeclarationValue = Readonly<{
|
|
20
|
-
readonly kind: 'declaration';
|
|
21
|
-
readonly version: string;
|
|
22
|
-
readonly encoding: string | null;
|
|
23
|
-
readonly standalone: 'yes' | 'no' | null;
|
|
24
|
-
}>;
|
|
25
|
-
export type XmlDoctypeValue = Readonly<{
|
|
26
|
-
readonly kind: 'doctype';
|
|
27
|
-
readonly name: string;
|
|
28
|
-
readonly publicId: string | null;
|
|
29
|
-
readonly systemId: string | null;
|
|
30
|
-
readonly internalSubset: string | null;
|
|
31
|
-
}>;
|
|
32
|
-
export type XmlElementValue = Readonly<{
|
|
33
|
-
readonly kind: 'element';
|
|
34
|
-
readonly name: string;
|
|
35
|
-
readonly attributes: readonly XmlAttribute[];
|
|
36
|
-
}>;
|
|
37
|
-
export type XmlTextValue = Readonly<{
|
|
38
|
-
readonly kind: 'text';
|
|
39
|
-
readonly text: string;
|
|
40
|
-
}>;
|
|
41
|
-
export type XmlCommentValue = Readonly<{
|
|
42
|
-
readonly kind: 'comment';
|
|
43
|
-
readonly text: string;
|
|
44
|
-
}>;
|
|
45
|
-
export type XmlCdataValue = Readonly<{
|
|
46
|
-
readonly kind: 'cdata';
|
|
47
|
-
readonly text: string;
|
|
48
|
-
}>;
|
|
49
|
-
export type XmlProcessingInstructionValue = Readonly<{
|
|
50
|
-
readonly kind: 'processing-instruction';
|
|
51
|
-
readonly target: string;
|
|
52
|
-
readonly data: string;
|
|
53
|
-
}>;
|
|
54
|
-
/**
|
|
55
|
-
* XML semantics carried by a generic tree node.
|
|
56
|
-
*
|
|
57
|
-
* Child ordering is deliberately not represented here.
|
|
58
|
-
*/
|
|
59
|
-
export type XmlNodeValue = XmlDocumentValue | XmlDeclarationValue | XmlDoctypeValue | XmlElementValue | XmlTextValue | XmlCommentValue | XmlCdataValue | XmlProcessingInstructionValue;
|
|
60
|
-
export declare const XmlAttributeSchema: z.ZodObject<{
|
|
61
|
-
name: z.ZodString;
|
|
62
|
-
value: z.ZodString;
|
|
63
|
-
}, z.core.$strip>;
|
|
64
|
-
export declare const XmlDocumentValueSchema: z.ZodObject<{
|
|
7
|
+
export type XmlId = object & {
|
|
8
|
+
readonly [xmlIdBrand]: true;
|
|
9
|
+
};
|
|
10
|
+
import type { XmlElementChild, XmlNode } from './xml-doc.js';
|
|
11
|
+
export type XmlNodeValue = XmlNode;
|
|
12
|
+
export type XmlTreeNode = TreeNode<XmlId, XmlNodeValue>;
|
|
13
|
+
export declare const xmlValueSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
65
14
|
kind: z.ZodLiteral<"document">;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
15
|
+
children: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
16
|
+
kind: z.ZodLiteral<"declaration">;
|
|
17
|
+
version: z.ZodString;
|
|
18
|
+
encoding: z.ZodNullable<z.ZodString>;
|
|
19
|
+
standalone: z.ZodNullable<z.ZodEnum<{
|
|
20
|
+
yes: "yes";
|
|
21
|
+
no: "no";
|
|
22
|
+
}>>;
|
|
23
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
24
|
+
kind: z.ZodLiteral<"doctype">;
|
|
71
25
|
name: z.ZodString;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}, z.core.$strip>;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}, z.core.$strip
|
|
92
|
-
|
|
93
|
-
|
|
26
|
+
publicId: z.ZodNullable<z.ZodString>;
|
|
27
|
+
systemId: z.ZodNullable<z.ZodString>;
|
|
28
|
+
internalSubset: z.ZodNullable<z.ZodString>;
|
|
29
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
30
|
+
kind: z.ZodLiteral<"element">;
|
|
31
|
+
name: z.ZodObject<{
|
|
32
|
+
qualifiedName: z.ZodString;
|
|
33
|
+
localName: z.ZodString;
|
|
34
|
+
prefix: z.ZodNullable<z.ZodString>;
|
|
35
|
+
namespaceUri: z.ZodNullable<z.ZodString>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
attributes: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
38
|
+
name: z.ZodObject<{
|
|
39
|
+
qualifiedName: z.ZodString;
|
|
40
|
+
localName: z.ZodString;
|
|
41
|
+
prefix: z.ZodNullable<z.ZodString>;
|
|
42
|
+
namespaceUri: z.ZodNullable<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
value: z.ZodString;
|
|
45
|
+
}, z.core.$strip>>>;
|
|
46
|
+
children: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodType<XmlElementChild>>>>;
|
|
47
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
48
|
+
kind: z.ZodLiteral<"text">;
|
|
49
|
+
text: z.ZodString;
|
|
50
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
51
|
+
kind: z.ZodLiteral<"comment">;
|
|
52
|
+
text: z.ZodString;
|
|
53
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
54
|
+
kind: z.ZodLiteral<"processing-instruction">;
|
|
55
|
+
target: z.ZodString;
|
|
56
|
+
data: z.ZodString;
|
|
57
|
+
}, z.core.$strip>]>>>>;
|
|
94
58
|
}, z.core.$strip>, z.ZodObject<{
|
|
95
|
-
kind: z.ZodLiteral<"
|
|
59
|
+
kind: z.ZodLiteral<"declaration">;
|
|
60
|
+
version: z.ZodString;
|
|
61
|
+
encoding: z.ZodNullable<z.ZodString>;
|
|
62
|
+
standalone: z.ZodNullable<z.ZodEnum<{
|
|
63
|
+
yes: "yes";
|
|
64
|
+
no: "no";
|
|
65
|
+
}>>;
|
|
66
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
67
|
+
kind: z.ZodLiteral<"doctype">;
|
|
96
68
|
name: z.ZodString;
|
|
69
|
+
publicId: z.ZodNullable<z.ZodString>;
|
|
70
|
+
systemId: z.ZodNullable<z.ZodString>;
|
|
71
|
+
internalSubset: z.ZodNullable<z.ZodString>;
|
|
72
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
73
|
+
kind: z.ZodLiteral<"element">;
|
|
74
|
+
name: z.ZodObject<{
|
|
75
|
+
qualifiedName: z.ZodString;
|
|
76
|
+
localName: z.ZodString;
|
|
77
|
+
prefix: z.ZodNullable<z.ZodString>;
|
|
78
|
+
namespaceUri: z.ZodNullable<z.ZodString>;
|
|
79
|
+
}, z.core.$strip>;
|
|
97
80
|
attributes: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
98
|
-
name: z.
|
|
81
|
+
name: z.ZodObject<{
|
|
82
|
+
qualifiedName: z.ZodString;
|
|
83
|
+
localName: z.ZodString;
|
|
84
|
+
prefix: z.ZodNullable<z.ZodString>;
|
|
85
|
+
namespaceUri: z.ZodNullable<z.ZodString>;
|
|
86
|
+
}, z.core.$strip>;
|
|
99
87
|
value: z.ZodString;
|
|
100
88
|
}, z.core.$strip>>>;
|
|
89
|
+
children: z.ZodExactOptional<z.ZodReadonly<z.ZodArray<z.ZodType<XmlElementChild>>>>;
|
|
101
90
|
}, z.core.$strip>, z.ZodObject<{
|
|
102
91
|
kind: z.ZodLiteral<"text">;
|
|
103
92
|
text: z.ZodString;
|
|
104
93
|
}, z.core.$strip>, z.ZodObject<{
|
|
105
|
-
kind: z.ZodLiteral<"
|
|
94
|
+
kind: z.ZodLiteral<"cdata">;
|
|
106
95
|
text: z.ZodString;
|
|
107
96
|
}, z.core.$strip>, z.ZodObject<{
|
|
108
|
-
kind: z.ZodLiteral<"
|
|
97
|
+
kind: z.ZodLiteral<"comment">;
|
|
109
98
|
text: z.ZodString;
|
|
110
99
|
}, z.core.$strip>, z.ZodObject<{
|
|
111
100
|
kind: z.ZodLiteral<"processing-instruction">;
|
|
112
101
|
target: z.ZodString;
|
|
113
102
|
data: z.ZodString;
|
|
114
|
-
}, z.core.$strip>]
|
|
115
|
-
|
|
116
|
-
* An opaque tree whose IDs are parser-assigned positions and whose values
|
|
117
|
-
* describe XML node semantics.
|
|
118
|
-
*/
|
|
119
|
-
export type XmlTreeNode = TreeNode<Position, XmlNodeValue>;
|
|
120
|
-
export declare const xmlTreeNodeApi: Readonly<{
|
|
121
|
-
createLeaf(id: number, value: XmlNodeValue): TreeNode<number, XmlNodeValue>;
|
|
122
|
-
createUnloadedBranch(id: number, value: XmlNodeValue): TreeNode<number, XmlNodeValue>;
|
|
123
|
-
createLoadedBranch(id: number, value: XmlNodeValue, children: Iterable<TreeNode<number, XmlNodeValue>>): TreeNode<number, XmlNodeValue> | undefined;
|
|
124
|
-
id(node: TreeNode<number, XmlNodeValue>): number;
|
|
125
|
-
value(node: TreeNode<number, XmlNodeValue>): XmlNodeValue;
|
|
126
|
-
kind(node: TreeNode<number, XmlNodeValue>): import("dirvi-lib").TreeNodeKind;
|
|
127
|
-
matchByKind<Result>(node: TreeNode<number, XmlNodeValue>, handlers: Readonly<{
|
|
128
|
-
leaf: (node: Readonly<{
|
|
129
|
-
id: number;
|
|
130
|
-
value: XmlNodeValue;
|
|
131
|
-
}>) => Result;
|
|
132
|
-
unloadedBranch: (node: Readonly<{
|
|
133
|
-
id: number;
|
|
134
|
-
value: XmlNodeValue;
|
|
135
|
-
}>) => Result;
|
|
136
|
-
loadedBranch: (node: Readonly<{
|
|
137
|
-
id: number;
|
|
138
|
-
value: XmlNodeValue;
|
|
139
|
-
children: Iterable<TreeNode<number, XmlNodeValue>>;
|
|
140
|
-
}>) => Result;
|
|
141
|
-
}>): Result;
|
|
142
|
-
getLoadedChildren(node: TreeNode<number, XmlNodeValue>): Iterable<TreeNode<number, XmlNodeValue>> | undefined;
|
|
143
|
-
findChildById(node: TreeNode<number, XmlNodeValue>, id: number): TreeNode<number, XmlNodeValue> | undefined;
|
|
144
|
-
withValue(node: TreeNode<number, XmlNodeValue>, value: XmlNodeValue): TreeNode<number, XmlNodeValue>;
|
|
145
|
-
toLeaf(node: TreeNode<number, XmlNodeValue>): TreeNode<number, XmlNodeValue>;
|
|
146
|
-
toUnloadedBranch(node: TreeNode<number, XmlNodeValue>): TreeNode<number, XmlNodeValue>;
|
|
147
|
-
withLoadedChildren(node: TreeNode<number, XmlNodeValue>, children: Iterable<TreeNode<number, XmlNodeValue>>): TreeNode<number, XmlNodeValue> | undefined;
|
|
148
|
-
findAtPath(root: TreeNode<number, XmlNodeValue>, path: readonly number[]): TreeNode<number, XmlNodeValue> | undefined;
|
|
149
|
-
selectAtPath<Result>(root: TreeNode<number, XmlNodeValue>, path: readonly number[], selector: (node: TreeNode<number, XmlNodeValue>) => Result): Result | undefined;
|
|
150
|
-
updateAtPath(root: TreeNode<number, XmlNodeValue>, path: readonly number[], update: (node: TreeNode<number, XmlNodeValue>) => TreeNode<number, XmlNodeValue> | undefined): TreeNode<number, XmlNodeValue> | undefined;
|
|
151
|
-
toModel(node: TreeNode<number, XmlNodeValue>): TreeNodeModel<number, XmlNodeValue>;
|
|
152
|
-
fromModel(model: TreeNodeModel<number, XmlNodeValue>): TreeNode<number, XmlNodeValue> | undefined;
|
|
153
|
-
}>;
|
|
154
|
-
export declare const XmlTreeNode: {
|
|
155
|
-
readonly document: (id: Position, children: Iterable<XmlTreeNode>) => XmlTreeNode | undefined;
|
|
156
|
-
readonly declaration: (id: Position, version: string, encoding: string | null, standalone: "yes" | "no" | null) => XmlTreeNode;
|
|
157
|
-
readonly doctype: (id: Position, name: string, publicId: string | null, systemId: string | null, internalSubset: string | null) => XmlTreeNode;
|
|
158
|
-
readonly element: (id: Position, name: string, attributes: readonly XmlAttribute[], children: Iterable<XmlTreeNode>) => XmlTreeNode | undefined;
|
|
159
|
-
readonly text: (id: Position, text: string) => XmlTreeNode;
|
|
160
|
-
readonly comment: (id: Position, text: string) => XmlTreeNode;
|
|
161
|
-
readonly cdata: (id: Position, text: string) => XmlTreeNode;
|
|
162
|
-
readonly processingInstruction: (id: Position, target: string, data: string) => XmlTreeNode;
|
|
163
|
-
};
|
|
164
|
-
export type XmlFolds = Folds<Position>;
|
|
165
|
-
export declare const xmlFoldsApi: Readonly<{
|
|
166
|
-
create(rootId: number, initialPrimaryInfo: Readonly<{
|
|
167
|
-
name: string;
|
|
168
|
-
description: string | null;
|
|
169
|
-
}>): Folds<number>;
|
|
170
|
-
getIndexByName(folds: Folds<number>, name: string): import("dirvi-lib").FoldIndex | undefined;
|
|
171
|
-
getInfoAtIndex(folds: Folds<number>, index: import("dirvi-lib").FoldIndex): Readonly<{
|
|
172
|
-
name: string;
|
|
173
|
-
description: string | null;
|
|
174
|
-
}> | undefined;
|
|
175
|
-
isActiveAtIndex(folds: Folds<number>, index: import("dirvi-lib").FoldIndex): boolean | undefined;
|
|
176
|
-
hasAtIndex(folds: Folds<number>, index: import("dirvi-lib").FoldIndex): boolean;
|
|
177
|
-
indexes(folds: Folds<number>): Iterable<import("dirvi-lib").FoldIndex>;
|
|
178
|
-
setAtIndex(folds: Folds<number>, index: import("dirvi-lib").FoldIndex, foldData: Readonly<{
|
|
179
|
-
name: string;
|
|
180
|
-
description: string | null;
|
|
181
|
-
active: boolean;
|
|
182
|
-
tree: Readonly<{
|
|
183
|
-
id: number;
|
|
184
|
-
hiddenEntryIds: readonly number[];
|
|
185
|
-
children: readonly Readonly</*elided*/ any>[];
|
|
186
|
-
}>;
|
|
187
|
-
}>): Folds<number> | undefined;
|
|
188
|
-
setAdditionalFoldAtIndex(folds: Folds<number>, index: import("dirvi-lib").FoldIndex, rootId: number, info: Readonly<{
|
|
189
|
-
name: string;
|
|
190
|
-
description: string | null;
|
|
191
|
-
}>): Folds<number> | undefined;
|
|
192
|
-
removeAdditionalFoldAtIndex(folds: Folds<number>, index: import("dirvi-lib").FoldIndex): Folds<number> | undefined;
|
|
193
|
-
updateInfoAtIndex(folds: Folds<number>, index: import("dirvi-lib").FoldIndex, update: Readonly<{
|
|
194
|
-
name?: string;
|
|
195
|
-
description?: string | null;
|
|
196
|
-
}>): Folds<number> | undefined;
|
|
197
|
-
activateAtIndex(folds: Folds<number>, index: import("dirvi-lib").FoldIndex): Folds<number> | undefined;
|
|
198
|
-
deactivateAtIndex(folds: Folds<number>, index: import("dirvi-lib").FoldIndex): Folds<number> | undefined;
|
|
199
|
-
toggleActiveAtIndex(folds: Folds<number>, index: import("dirvi-lib").FoldIndex): Folds<number> | undefined;
|
|
200
|
-
isEntryHiddenInFoldAtPath(folds: Folds<number>, index: import("dirvi-lib").FoldIndex, path: readonly number[], entryId: number): boolean;
|
|
201
|
-
isEntryHiddenAtPath(folds: Folds<number>, path: readonly number[], entryId: number): boolean;
|
|
202
|
-
hiddenEntryIdsAtPath(folds: Folds<number>, index: import("dirvi-lib").FoldIndex, path: readonly number[]): Iterable<number> | undefined;
|
|
203
|
-
hideEntryAtPath(folds: Folds<number>, index: import("dirvi-lib").FoldIndex, path: readonly number[], entryId: number): Folds<number> | undefined;
|
|
204
|
-
showEntryAtPath(folds: Folds<number>, index: import("dirvi-lib").FoldIndex, path: readonly number[], entryId: number): Folds<number> | undefined;
|
|
205
|
-
showAllHiddenEntriesAtPath(folds: Folds<number>, index: import("dirvi-lib").FoldIndex, path: readonly number[]): Folds<number> | undefined;
|
|
206
|
-
toModel(folds: Folds<number>): Readonly<{
|
|
207
|
-
slots: readonly [Readonly<{
|
|
208
|
-
name: string;
|
|
209
|
-
description: string | null;
|
|
210
|
-
active: boolean;
|
|
211
|
-
tree: Readonly<{
|
|
212
|
-
id: number;
|
|
213
|
-
hiddenEntryIds: readonly number[];
|
|
214
|
-
children: readonly Readonly</*elided*/ any>[];
|
|
215
|
-
}>;
|
|
216
|
-
}>, ...(Readonly<{
|
|
217
|
-
name: string;
|
|
218
|
-
description: string | null;
|
|
219
|
-
active: boolean;
|
|
220
|
-
tree: Readonly<{
|
|
221
|
-
id: number;
|
|
222
|
-
hiddenEntryIds: readonly number[];
|
|
223
|
-
children: readonly Readonly</*elided*/ any>[];
|
|
224
|
-
}>;
|
|
225
|
-
}> | null)[]];
|
|
226
|
-
}>;
|
|
227
|
-
fromModel(model: Readonly<{
|
|
228
|
-
slots: readonly [Readonly<{
|
|
229
|
-
name: string;
|
|
230
|
-
description: string | null;
|
|
231
|
-
active: boolean;
|
|
232
|
-
tree: Readonly<{
|
|
233
|
-
id: number;
|
|
234
|
-
hiddenEntryIds: readonly number[];
|
|
235
|
-
children: readonly Readonly</*elided*/ any>[];
|
|
236
|
-
}>;
|
|
237
|
-
}>, ...(Readonly<{
|
|
238
|
-
name: string;
|
|
239
|
-
description: string | null;
|
|
240
|
-
active: boolean;
|
|
241
|
-
tree: Readonly<{
|
|
242
|
-
id: number;
|
|
243
|
-
hiddenEntryIds: readonly number[];
|
|
244
|
-
children: readonly Readonly</*elided*/ any>[];
|
|
245
|
-
}>;
|
|
246
|
-
}> | null)[]];
|
|
247
|
-
}>): Folds<number> | undefined;
|
|
248
|
-
}>;
|
|
249
|
-
export declare const xmlCursorSchema: z.ZodType<XmlCursor>;
|
|
250
|
-
export type XmlCursor = Cursor<Position>;
|
|
251
|
-
export declare const xmlCursorApi: import("dirvi-lib").CursorApi<number>;
|
|
252
|
-
export type XmlNavNode = NavNode<Position>;
|
|
253
|
-
export declare const xmlNavApi: import("dirvi-lib").NavNodeApi<number, XmlNodeValue>;
|
|
254
|
-
export type XmlState = State<Position, XmlNodeValue>;
|
|
255
|
-
export declare const xmlStateApi: Readonly<{
|
|
256
|
-
getNodeAtCursor(state: Readonly<{
|
|
257
|
-
root: TreeNode<number, XmlNodeValue>;
|
|
258
|
-
folds: Folds<number>;
|
|
259
|
-
cursor: Cursor<number>;
|
|
260
|
-
}>): TreeNode<number, XmlNodeValue> | undefined;
|
|
261
|
-
resync(oldState: Readonly<{
|
|
262
|
-
root: TreeNode<number, XmlNodeValue>;
|
|
263
|
-
folds: Folds<number>;
|
|
264
|
-
cursor: Cursor<number>;
|
|
265
|
-
}>, loadBranches: (path: readonly number[]) => Promise<readonly TreeNode<number, XmlNodeValue>[]>): Promise<Readonly<{
|
|
266
|
-
root: TreeNode<number, XmlNodeValue>;
|
|
267
|
-
folds: Folds<number>;
|
|
268
|
-
cursor: Cursor<number>;
|
|
269
|
-
}>>;
|
|
270
|
-
}>;
|
|
103
|
+
}, z.core.$strip>]>;
|
|
104
|
+
export {};
|
|
271
105
|
//# sourceMappingURL=xml-tree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xml-tree.d.ts","sourceRoot":"","sources":["../../src/domain/xml-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"xml-tree.d.ts","sourceRoot":"","sources":["../../src/domain/xml-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAM1C,OAAO,CAAC,MAAM,UAAU,EAAE,OAAO,MAAM,CAAC;AAExC;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,UAAU,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAM7D,OAAO,KAAK,EAAc,eAAe,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEzE,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC;AACnC,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;AAqFxD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA7BT,CAAC,CAAC,gBAAgB,CAChC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CACtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAFe,CAAC,CAAC,gBAAgB,CAChC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CACtD;;;;;;;;;;;;;;mBAoCiC,CAAC"}
|