@sitevision/api 1.0.8 → 1.0.9

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.
@@ -0,0 +1,3 @@
1
+ interface Collection {}
2
+
3
+ export default Collection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitevision/api",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "author": "Sitevision AB",
5
5
  "license": "MIT",
6
6
  "types": "index.d.ts",
@@ -26,5 +26,5 @@
26
26
  "access": "public",
27
27
  "directory": "dist"
28
28
  },
29
- "gitHead": "fc06935bd25748d28b264ee2b919d301536204d4"
29
+ "gitHead": "2b76525fb1911135b26fcb3930552ae3756862d2"
30
30
  }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The offline version (i.e. the version used when editing in the Sitevision editor) marker
3
+ */
4
+ export const OFFLINE_VERSION: number;
5
+ /**
6
+ * The online version (i.e. the published version that visitors can access) marker
7
+ */
8
+ export const ONLINE_VERSION: number;
9
+
10
+ /**
11
+ * Gets current version
12
+ *
13
+ * @return {@link #OFFLINE_VERSION} or {@link #ONLINE_VERSION}. If current version is undeterminable, -1 is returned.
14
+ */
15
+ export function getCurrentVersion(): number;
16
+
17
+ declare namespace versionUtil {
18
+ export { OFFLINE_VERSION, ONLINE_VERSION, getCurrentVersion };
19
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _default = {
8
+ OFFLINE_VERSION: 0,
9
+ ONLINE_VERSION: 1,
10
+ getCurrentVersion: function getCurrentVersion() {}
11
+ };
12
+ exports["default"] = _default;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Gets the default XSL template for cleanup of HTML sources.
3
+ *
4
+ * <p>
5
+ * The template strips all &lt;div&gt;'s, &lt;spans&gt;'s and removes all inline styling, classes and attributes
6
+ * that is not mandatory or needed for WCAG purposes.
7
+ * </p>
8
+ * <p>
9
+ * <em>Note!</em> The template supports a <em>sub-set</em> of HTML elements (the presumed most commonly used elements).
10
+ * All unsupported elements are completely discarded (i.e. they will not be included at all in the transformation result).
11
+ * </p>
12
+ *
13
+ * @return {string} the default cleanup template for HTML sources
14
+ */
15
+ export function getDefaultCleanHtmlTemplate(): string;
16
+
17
+ /**
18
+ * Transforms a HTML/XML source using a XSL template.
19
+ *
20
+ * <p>
21
+ * <em>Note!</em> The contents of the XSL Template is always handled as UTF-8.
22
+ * </p>
23
+ *
24
+ * @param {string} aSource the source that should be transformed, HTML, XHTML or XML. Must not be null
25
+ * @param {any} aXslTemplate the UTF-8 XSL template;
26
+ * a sv:file Node, a sv:temporaryFile Node, a sv:link Node that targets a sv:file, a char array or a CharSequence
27
+ * (typically a String). Must not be null
28
+ * @return {string} the transformation result
29
+ * @throws IOException if the transformation fails (e.g. the aSource is really bad/interpretable HTML or aXslTemplate is invalid XSL)
30
+ * @throws RepositoryException if aNode-operation on aXslTemplate fails
31
+ */
32
+ export function transform(aSource: string, aXslTemplate: any): string;
33
+
34
+ declare namespace xsltUtil {
35
+ export { getDefaultCleanHtmlTemplate, transform };
36
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _default = {
8
+ getDefaultCleanHtmlTemplate: function getDefaultCleanHtmlTemplate() {},
9
+ transform: function transform() {}
10
+ };
11
+ exports["default"] = _default;
@@ -0,0 +1,117 @@
1
+ import Node from '../builtins/Node';
2
+ import Collection from '../builtins/Collection';
3
+
4
+ interface XmlElement {
5
+ /**
6
+ * Gets the name of the element
7
+ *
8
+ * @return {string} the element name
9
+ */
10
+ getName(): string;
11
+
12
+ /**
13
+ * Gets the text content of the element.
14
+ *
15
+ * @return {string} the text content of the element or null if no text content is available.
16
+ */
17
+ getText(): string;
18
+
19
+ /**
20
+ * Gets an attribute value of the element.
21
+ *
22
+ * @param {string} aName the attribute name
23
+ * @return {string} the attribute value or null if no value is associated with attribute
24
+ */
25
+ getAttribute(aName: string): string;
26
+
27
+ /**
28
+ * Check if a sub element with a specific name is available in the element.
29
+ *
30
+ * @param {string} aName name of the sub element of this element, must be non-null.
31
+ * @return {boolean} true if one or more sub elements with the specific name is available
32
+ */
33
+ hasElement(aName: string): boolean;
34
+
35
+ /**
36
+ * Gets the first sub element with a specific name of the element.
37
+ *
38
+ * @param {string} aName name of the sub element of this element, must be non-null.
39
+ * @return {XmlElement} the sub element or null if no sub element is found.
40
+ */
41
+ getElement(aName: string): XmlElement;
42
+
43
+ /**
44
+ * Gets all sub element with a specific name of the element.
45
+ *
46
+ * @param {string} aName name of the sub element of this element, must be non-null.
47
+ * @return {Collection<XmlElement>}the sub elements or an empty collection if no sub elements are available
48
+ */
49
+ getElements(aName: string): Collection<XmlElement>;
50
+
51
+ /**
52
+ * Gets all sub elements of the element.
53
+ *
54
+ * @return {Collection<XmlElement>} a list of all sub elements
55
+ */
56
+ getElements(): Collection<XmlElement>;
57
+ }
58
+
59
+ interface XmlElementHandler {
60
+ /**
61
+ * Called when a element matching the selection has been parsed.
62
+ *
63
+ * @param {XmlElement} aXmlElement the element
64
+ */
65
+ handleElement(aXmlElement: XmlElement): void;
66
+ }
67
+
68
+ /**
69
+ * Parse a XML string.
70
+ *
71
+ * @param {string} aElementSelection the elements in the XML that should be passed to the XmlElementHandler
72
+ * @param {string} aXml the UTF-8 XML string
73
+ * @param {XmlElementHandler} aXmlElementHandler the XmlElementHandler
74
+ * @throws XmlParserException if an error occurs while parsing the XML
75
+ */
76
+ export function parse(
77
+ aElementSelection: string,
78
+ aXml: string,
79
+ aXmlElementHandler: XmlElementHandler
80
+ ): void;
81
+
82
+ /**
83
+ * Parse a file containing XML encoded using UTF-8.
84
+ *
85
+ * @param {string} aElementSelection the elements in the XML that should be passed to the XmlElementHandler
86
+ * @param {Node} aXmlFile the file containing XML encoded using UTF-8 (sv:file or sv:temporaryFile)
87
+ * @param {XmlElementHandler} aXmlElementHandler the XmlElementHandler
88
+ * @throws RepositoryException if an error occurs while accessing the file
89
+ * @throws XmlParserException if an error occurs while parsing the XML
90
+ */
91
+ export function parse(
92
+ aElementSelection: string,
93
+ aXmlFile: Node,
94
+ aXmlElementHandler: XmlElementHandler
95
+ ): void;
96
+
97
+ /**
98
+ * Parse a file containing XML encoded with the supplied charset.
99
+ *
100
+ * @param {string} aElementSelection the elements in the XML that should be passed to the XmlElementHandler
101
+ * @param {Node} aXmlFile the file containing XML encoded using supplied encoding (sv:file or sv:temporaryFile)
102
+ * @param {string} aCharset the character encoding of the the file content
103
+ * (an IllegalArgument will be thrown if aCharset can not be resolved as a java.nio.charset.Charset)
104
+ * @param {XmlElementHandler} aXmlElementHandler the XmlElementHandler
105
+ * @throws RepositoryException if an error occurs while accessing the file
106
+ * @throws XmlParserException if an error occurs while parsing the XML
107
+ */
108
+ export function parse(
109
+ aElementSelection: string,
110
+ aXmlFile: Node,
111
+ aCharset: string,
112
+ aXmlElementHandler: XmlElementHandler
113
+ ): void;
114
+
115
+ declare namespace xmlParserUtil {
116
+ export { parse };
117
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _default = {
8
+ parse: function parse() {}
9
+ };
10
+ exports["default"] = _default;