jtlt 0.3.0 → 0.5.0

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.
Files changed (59) hide show
  1. package/CHANGES.md +18 -0
  2. package/README.md +46 -78
  3. package/demo/codemirror.esm.js +28242 -0
  4. package/demo/codemirror.js +94 -0
  5. package/demo/index.css +11 -0
  6. package/demo/index.html +11 -14
  7. package/demo/index.js +210 -26
  8. package/demo/vendor/fontoxpath/dist/fontoxpath.esm.js +600 -0
  9. package/demo/vendor/jamilih/dist/jml.mjs +2341 -0
  10. package/demo/vendor/jhtml/src/SAJJ/SAJJ.ObjectArrayDelegator.js +356 -0
  11. package/demo/vendor/jhtml/src/SAJJ/SAJJ.Stringifier.js +186 -0
  12. package/demo/vendor/jhtml/src/SAJJ/SAJJ.js +746 -0
  13. package/demo/vendor/jhtml/src/SAJJ/testing/SAJJ.html +33 -0
  14. package/demo/vendor/jhtml/src/SAJJ/testing/SAJJ.testing.js +25 -0
  15. package/demo/vendor/jhtml/src/jhtml-browser.js +5 -0
  16. package/demo/vendor/jhtml/src/jhtml-node.cts +3 -0
  17. package/demo/vendor/jhtml/src/jhtml-node.js +8 -0
  18. package/demo/vendor/jhtml/src/jhtml-node.mts +1 -0
  19. package/demo/vendor/jhtml/src/jhtml.cts +3 -0
  20. package/demo/vendor/jhtml/src/jhtml.js +602 -0
  21. package/demo/vendor/jhtml/src/jhtml.mts +1 -0
  22. package/demo/vendor/jsonpath-plus/dist/index-browser-esm.js +2158 -0
  23. package/demo/vendor/prsc/dist/prsc.esm.js +2 -0
  24. package/demo/vendor/simple-get-json/dist/index-es.js +151 -0
  25. package/demo/vendor/whynot/dist/whynot.esm.js +2 -0
  26. package/demo/vendor/xspattern/dist/xspattern.esm.js +2 -0
  27. package/dist/AbstractJoiningTransformer.d.ts +27 -0
  28. package/dist/AbstractJoiningTransformer.d.ts.map +1 -1
  29. package/dist/DOMJoiningTransformer.d.ts +60 -8
  30. package/dist/DOMJoiningTransformer.d.ts.map +1 -1
  31. package/dist/JSONJoiningTransformer.d.ts +8 -9
  32. package/dist/JSONJoiningTransformer.d.ts.map +1 -1
  33. package/dist/JSONPathTransformer.d.ts.map +1 -1
  34. package/dist/JSONPathTransformerContext.d.ts +223 -4
  35. package/dist/JSONPathTransformerContext.d.ts.map +1 -1
  36. package/dist/StringJoiningTransformer.d.ts +7 -7
  37. package/dist/StringJoiningTransformer.d.ts.map +1 -1
  38. package/dist/XPathTransformer.d.ts +2 -2
  39. package/dist/XPathTransformer.d.ts.map +1 -1
  40. package/dist/XPathTransformerContext.d.ts +161 -8
  41. package/dist/XPathTransformerContext.d.ts.map +1 -1
  42. package/dist/index.d.ts +4 -4
  43. package/dist/index.d.ts.map +1 -1
  44. package/docs/API.expanded.md +5 -3
  45. package/docs/API.md +1 -1
  46. package/docs/TO-DO.md +62 -36
  47. package/eslint.config.js +3 -1
  48. package/package.json +28 -4
  49. package/rollup.config.js +13 -0
  50. package/src/AbstractJoiningTransformer.js +42 -0
  51. package/src/DOMJoiningTransformer.js +115 -23
  52. package/src/JSONJoiningTransformer.js +50 -26
  53. package/src/JSONPathTransformer.js +2 -0
  54. package/src/JSONPathTransformerContext.js +936 -5
  55. package/src/StringJoiningTransformer.js +25 -21
  56. package/src/XPathTransformer.js +3 -1
  57. package/src/XPathTransformerContext.js +884 -15
  58. package/src/index.js +16 -7
  59. package/tsconfig.json +5 -2
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;AA4iBG,0BACQ,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,GAC1C,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CACvC;;;;;;AAEE,0BACQ,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,GAC5C,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CACzC;;;;;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;IAEE,oBACQ,gBAAgB,CAAC,MAAM,CAAC,EAClC;;;;;IAEE,oBACQ,gBAAgB,CAAC,QAAQ,CAAC,EACpC;;;;;IAEE,oBACQ,gBAAgB,CAAC,KAAK,CAAC,EACjC;IAMC,0BAA0B;IAC1B,QADW,WAAW,CACI;IA4B5B;;;OAGG;IACH,6BAHa,qBAAqB,GAAC,sBAAsB,GACpD,wBAAwB,CAuE5B;IAED;;;OAGG;IACH,iBAHW,MAAM,GAAC,SAAS,GACd,IAAI,CAYhB;IAED;;;OAGG;IACH,oBAHW,WAAW,GACT,IAAI,CA0JhB;IAED;;;;;;OAMG;IACH,iBANW,MAAM,GACJ,IAAI,CA6ChB;CACF;qCAziBoC,+BAA+B;kCAJlC,4BAA4B;mCAC3B,6BAA6B"}
@@ -85,12 +85,13 @@ Responsibilities:
85
85
  - Sorts by priority (numeric or specificity resolver).
86
86
  - Invokes winning template; falls back to default rules when no match.
87
87
 
88
- ### `XPathTransformer` (experimental)
88
+ ### `XPathTransformer`
89
89
 
90
90
  Same pattern for XML/HTML DOM data using XPath selectors.
91
91
 
92
92
  Config additions:
93
- - `xpathVersion`: `1` (native `XPathEvaluator`), `2` (`xpath2.js`). Default `1`.
93
+ - `xpathVersion`: `1` (native `XPathEvaluator`), `2` (`xpath2.js`), `3.1` (`fontoxpath`).
94
+ Default `1`.
94
95
 
95
96
  ```js
96
97
  import {XPathTransformer, StringJoiningTransformer} from 'jtlt';
@@ -122,7 +123,8 @@ const out = engine.transform('');
122
123
  ```
123
124
 
124
125
  Limitations:
125
- - Version 2 (`xpath2.js`) may lack some XPath 2.0 functions; stick to basic location paths and simple predicates.
126
+ - Versions 2 and 3 (`xpath2.js` and `fontoxpath`) may lack some XPath functions;
127
+ stick to basic location paths and simple predicates.
126
128
  - Namespace resolution not yet exposed (future `namespaceResolver` option).
127
129
 
128
130
  ## Contexts
package/docs/API.md CHANGED
@@ -25,7 +25,7 @@ new JTLT({
25
25
  - JSONPathTransformer: on JSON with JSONPath selectors; resolves
26
26
  priority and falls back to defaults when no template matches.
27
27
  - XPathTransformer (experimental): on XML/HTML DOM. Choose
28
- `engineType: 'xpath'` on JTLT and set `xpathVersion: 1 | 2`.
28
+ `engineType: 'xpath'` on JTLT and set `xpathVersion: 1 | 2 | 3.1`.
29
29
 
30
30
  ## Context basics
31
31
 
package/docs/TO-DO.md CHANGED
@@ -1,6 +1,8 @@
1
1
  ## To-dos
2
2
 
3
- 1. Document and add test cases to cover current features! (Could adapt an XSLT/XQuery test suite)
3
+ 1. Testing: Could adapt an XSLT/XQuery test suite
4
+
5
+ 1. Document
4
6
 
5
7
  1. Implement and demo equivalent to applying and calling templates, and
6
8
  root template
@@ -10,45 +12,41 @@
10
12
  even making aliases so that XQuery's friendlier terms can be used
11
13
  instead of XSLT's.
12
14
 
13
- 2. Support processing of JSON documents with `$jtlt-stylesheet` to let
14
- documents define their own targeted stylesheets.
15
+ 2. Support processing of JSON documents with `$jtlt-stylesheet` to let
16
+ documents define their own targeted stylesheets and make own
17
+ `<?xml-stylesheet type="text/javascript" href="..."?>` for XML
15
18
 
16
- 3. When sufficiently documented, add as example library/tool to
19
+ 3. When sufficiently documented, add as example library/tool to
17
20
  JSONPath wiki.
18
21
 
19
- 4. Allow alternative to `element()`, `array()`, etc. methods by just
22
+ 4. Allow alternative to `element()`, `array()`, etc. methods by just
20
23
  detecting those types from return values (and generic of each
21
24
  type like `dom()` and `json()`).
22
25
 
23
- 5. Allow, depending on mode, containers to contain containers of other
26
+ 5. Allow, depending on mode, containers to contain containers of other
24
27
  types (e.g., a JS container containing DOM objects, or temporary use
25
28
  of a string container, etc.).
26
29
 
27
- 1. Support XML and add [hXML](https://github.com/brettz9/hxml) methods.
28
-
29
- 2. Support [JHTML](https://github.com/brettz9/jhtml).
30
+ 1. Support XML and add [hXML](https://github.com/brettz9/hxml) methods.
30
31
 
31
- 3. Support `appendJSON()`/`appendDOM()` and
32
+ 2. Support `appendJSON()`/`appendDOM()` and
32
33
  `appendType('json', ...)` (allowing type extensions).
33
34
 
34
- 6. Add `appendResult(function () {return result})`.
35
+ 6. Add `appendResult(function () {return result})`.
35
36
 
36
- 7. Add JSON update functions (equivalent to Xquery Update Facility for
37
+ 7. Add JSON update functions (equivalent to Xquery Update Facility for
37
38
  XML ([overview](http://www.xmlplease.com/xquery-update))) and create
38
39
  JSON serialization (as with XSLT expressed itself in declarative XML)
39
40
  so one can submit and evaluate
40
41
  through [HTTPQuery](https://github.com/brettz9/httpquery) (and also
41
42
  supply to JSONEditor, etc.). Utilize updating by reference.
42
43
 
43
- 8. Demo narrowing to subset of JavaScript (as with `jspe`) to make
44
+ 8. Demo narrowing to subset of JavaScript (as with `jsep`) to make
44
45
  JTLT truly "declarative" as far as freedom from scripting
45
46
 
46
- 9. Use [fontoxpath](https://github.com/FontoXML/fontoxpath)
47
- for XPath 3.1 implementation?
48
-
49
47
  ## Possible to-dos
50
48
 
51
- 1. Make schema-aware so that templates could target types. Most reusable
49
+ 1. Make schema-aware so that templates could target types. Most reusable
52
50
  application may be having a type-driven view of a JSON Schema instance
53
51
  (e.g., dates could be shown inside a calendar widget). Perhaps this
54
52
  schema-awareness could also drive a JSON editor (as with other existing
@@ -59,21 +57,18 @@
59
57
  files) could point the way for edited contents to be saved back to the
60
58
  correct JSON file and position in the JSON file.
61
59
 
62
- 2. Add a [non-eval PR for JSONPath](https://github.com/s3u/JSONPath/pull/4).
60
+ 2. ~~Add a [non-eval PR for JSONPath](https://github.com/s3u/JSONPath/pull/4).~~
63
61
  The OR condition (outside of filters) is another important feature as
64
62
  would be schema-aware path results.
65
63
 
66
- 3. Allow hybrid JSON/[Jamilih](https://github.com/brettz9/jamilih) or
64
+ 3. Allow hybrid JSON/[Jamilih](https://github.com/brettz9/jamilih) or
67
65
  JSON/(X)HTML/XML so that one can add
68
66
  XPath or query into HTML in a relevant manner
69
67
 
70
- 4. Support pull parsing/streaming? Pass `done()` function to templates to
68
+ 4. Support pull parsing/streaming? Pass `done()` function to templates to
71
69
  signal completion?
72
70
 
73
- 5. Support Promise API in addition to callbacks (reconcile with
74
- current chaining; see also XQuery FLWOR to-do)
75
-
76
- 6. Add [XQuery Functions](https://code.google.com/p/jsxqueryparser/source/browse/trunk/jsxqueryparser/XQueryParser.js#1768)
71
+ 5. Add [XQuery Functions](https://code.google.com/p/jsxqueryparser/source/browse/trunk/jsxqueryparser/XQueryParser.js#1768)
77
72
  (also supporting DOM and JSON where possible) as plug-in (also any
78
73
  missing from XSLT/XQuery 3.0). Also add, if not present among these
79
74
  functions (or in XQuery), add equivalents to XSLT's
@@ -82,49 +77,76 @@
82
77
  iterating or retrieving IndexedDB, `localStorage`, and cookies
83
78
  (names, keys and values).
84
79
 
85
- 7. Add `outputType` which uses a DOM joiner but allows specialized
80
+ 6. Add `outputType` which uses a DOM joiner but allows specialized
86
81
  serialized output (e.g., pretty-printed HTML) so the users
87
82
  don't need to build it themselves (likewise with stringified
88
83
  JSON output).
89
84
 
90
- 8. See code for other possible to-dos
85
+ 7. See code for other possible to-dos
86
+
87
+ 8. Promise-based templates
91
88
 
92
- 9. Consider implementing the following elements from <https://www.w3.org/TR/xslt20/>
89
+ 9. Consider implementing the following elements from <https://www.w3.org/TR/xslt-30/>
93
90
  which are not yet implemented.
94
91
 
95
- "xsl:analyze-string",
92
+ xsl:accept
93
+ xsl:accumulator
94
+ xsl:accumulator-rule
95
+ ~~"xsl:analyze-string",~~
96
96
  "xsl:apply-imports",
97
97
  ~~"xsl:apply-templates",~~
98
+ xsl:assert
98
99
  ~~"xsl:attribute",~~
99
100
  "xsl:attribute-set",
101
+ xsl:break
100
102
  ~~"xsl:call-template",~~
101
- "xsl:character-map",
103
+ xsl:catch
104
+ ~~"xsl:character-map",~~
102
105
  ~~"xsl:choose",~~
103
106
  ~~"xsl:comment",~~
107
+ xsl:context-item
104
108
  ~~"xsl:copy",~~
105
109
  ~~"xsl:copy-of",~~
106
- "xsl:decimal-format",
110
+ ~~"xsl:decimal-format",~~
107
111
  ~~"xsl:document",~~
108
112
  ~~"xsl:element",~~
113
+ xsl:evaluate
114
+ xsl:expose
109
115
  "xsl:fallback",
110
116
  ~~"xsl:for-each",~~
111
- "xsl:for-each-group",
117
+ ~~"xsl:for-each-group",~~
118
+ xsl:fork
112
119
  "xsl:function",
120
+ xsl:global-context-item
113
121
  ~~"xsl:if",~~
114
122
  "xsl:import",
115
123
  "xsl:import-schema",
116
124
  "xsl:include",
125
+ xsl:iterate
117
126
  ~~"xsl:key",~~
118
- "xsl:matching-substring",
127
+ xsl:map
128
+ xsl:map-entry
129
+ ~~"xsl:matching-substring",~~
130
+ xsl:merge
131
+ xsl:merge-action
132
+ xsl:merge-key
133
+ xsl:merge-source
119
134
  ~~"xsl:message",~~
120
- "xsl:namespace",
135
+ xsl:mode
136
+ ~~"xsl:namespace",~~
121
137
  "xsl:namespace-alias",
138
+ xsl:next-iteration
122
139
  "xsl:next-match",
123
- "xsl:non-matching-substring",
124
- "xsl:number",
140
+ ~~"xsl:non-matching-substring",~~
141
+ ~~"xsl:number",~~
142
+ xsl:on-completion
143
+ xsl:on-empty
144
+ xsl:on-non-empty
125
145
  ~~"xsl:otherwise",~~
126
146
  ~~"xsl:output",~~
127
- "xsl:output-character",
147
+ ~~"xsl:output-character",~~
148
+ xsl:override
149
+ xsl:package
128
150
  "xsl:param",
129
151
  "xsl:perform-sort",
130
152
  "xsl:preserve-space",
@@ -132,13 +154,17 @@
132
154
  ~~"xsl:result-document",~~
133
155
  "xsl:sequence",
134
156
  ~~"xsl:sort",~~
157
+ xsl:source-document
135
158
  "xsl:strip-space",
136
159
  ~~"xsl:stylesheet",~~
137
160
  ~~"xsl:template",~~
138
161
  ~~"xsl:text",~~
139
162
  ~~"xsl:transform",~~
163
+ xsl:try
164
+ xsl:use-package
140
165
  ~~"xsl:value-of",~~
141
166
  ~~"xsl:variable",~~
142
167
  ~~"xsl:when",~~
168
+ xsl:where-populated
143
169
  ~~"xsl:with-param"~~
144
170
 
package/eslint.config.js CHANGED
@@ -4,7 +4,9 @@ export default [
4
4
  {
5
5
  ignores: [
6
6
  'dist',
7
- 'coverage'
7
+ 'coverage',
8
+ 'demo/vendor',
9
+ 'demo/codemirror.esm.js'
8
10
  ]
9
11
  },
10
12
  ...ashNazg(['sauron']),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jtlt",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "author": "Brett Zamir",
6
6
  "contributors": [],
@@ -25,16 +25,28 @@
25
25
  "url": "https://github.com/brettz9/jtlt.git"
26
26
  },
27
27
  "dependencies": {
28
+ "@codemirror/lang-javascript": "^6.2.4",
29
+ "@codemirror/lang-json": "^6.0.2",
30
+ "@codemirror/lang-xml": "^6.1.0",
31
+ "@codemirror/language": "^6.11.3",
32
+ "@codemirror/state": "^6.5.2",
33
+ "@lezer/highlight": "^1.2.3",
34
+ "codemirror": "^6.0.2",
35
+ "fontoxpath": "^3.33.2",
28
36
  "jamilih": "0.62.1",
29
37
  "jhtml": "0.7.1",
30
38
  "jsdom": "27.1.0",
31
39
  "jsonpath-plus": "10.3.0",
40
+ "prsc": "^4.0.0",
32
41
  "simple-get-json": "10.0.0",
33
- "xpath2.js": "1.0.0-alpha-6"
42
+ "whynot": "^5.0.0",
43
+ "xpath2.js": "1.0.0-alpha-6",
44
+ "xspattern": "^3.1.0"
34
45
  },
35
46
  "devDependencies": {
36
47
  "@arethetypeswrong/cli": "^0.18.2",
37
48
  "@node-static/node-static": "^0.8.1",
49
+ "@rollup/plugin-node-resolve": "^16.0.3",
38
50
  "@types/chai": "^5.2.3",
39
51
  "@types/jsdom": "^27.0.0",
40
52
  "@types/mocha": "^10.0.10",
@@ -44,6 +56,7 @@
44
56
  "eslint-config-ash-nazg": "^39.8.0",
45
57
  "mocha": "^11.7.5",
46
58
  "open": "^10.2.0",
59
+ "rollup": "^4.53.2",
47
60
  "typescript": "^5.9.3"
48
61
  },
49
62
  "bugs": "https://github.com/brettz9/jtlt/issues",
@@ -55,12 +68,23 @@
55
68
  "javascript"
56
69
  ],
57
70
  "scripts": {
58
- "start": "open http://localhost:8020/demo/ && static -p 8020",
71
+ "start": "open http://localhost:8021/demo/ && static -p 8021",
59
72
  "attw": "attw --pack",
60
73
  "tsc": "tsc",
61
- "build": "tsc -p tsconfig-prod.json",
74
+ "build": "tsc -p tsconfig-prod.json && npm run rollup",
75
+ "rollup": "rollup -c",
76
+ "copy-simple-get-json": "cp -r node_modules/simple-get-json/dist/index-es.js demo/vendor/simple-get-json/dist/index-es.js",
77
+ "copy-jhtml": "cp -Rf node_modules/jhtml/src demo/vendor/jhtml",
78
+ "copy-jamilih": "cp node_modules/jamilih/dist/jml.mjs demo/vendor/jamilih/dist/jml.mjs",
79
+ "copy-jsonpath-plus": "cp node_modules/jsonpath-plus/dist/index-browser-esm.js demo/vendor/jsonpath-plus/dist/index-browser-esm.js",
80
+ "copy-fontoxpath": "cp node_modules/fontoxpath/dist/fontoxpath.esm.js demo/vendor/fontoxpath/dist/fontoxpath.esm.js",
81
+ "copy-xspattern": "cp node_modules/xspattern/dist/xspattern.esm.js demo/vendor/xspattern/dist/xspattern.esm.js",
82
+ "copy-prsc": "cp node_modules/prsc/dist/prsc.esm.js demo/vendor/prsc/dist/prsc.esm.js",
83
+ "copy-whynot": "cp node_modules/whynot/dist/whynot.esm.js demo/vendor/whynot/dist/whynot.esm.js",
84
+ "copy": "pnpm copy-simple-get-json && pnpm copy-jhtml && pnpm copy-jamilih && pnpm copy-jsonpath-plus && pnpm copy-fontoxpath && pnpm copy-xspattern && pnpm copy-prsc && pnpm copy-whynot",
62
85
  "lint": "eslint .",
63
86
  "mocha": "mocha",
87
+ "test:browser": "open http://localhost:8020/test/browser/ && static -p 8020",
64
88
  "test": "c8 npm run mocha"
65
89
  }
66
90
  }
@@ -0,0 +1,13 @@
1
+ import {nodeResolve} from '@rollup/plugin-node-resolve';
2
+
3
+ export default {
4
+ input: 'demo/codemirror.js',
5
+ output: {
6
+ file: 'demo/codemirror.esm.js',
7
+ format: 'esm',
8
+ banner: '// Do not edit this file; it was auto-generated'
9
+ },
10
+ plugins: [
11
+ nodeResolve()
12
+ ]
13
+ };
@@ -2,6 +2,10 @@
2
2
  // mid-transformation (e.g., building strings with
3
3
  // string transformer but adding as text node in a DOM transformer)
4
4
 
5
+ /**
6
+ * @typedef {{character: string, string: string}[]} OutputCharacters
7
+ */
8
+
5
9
  /**
6
10
  * @typedef {{
7
11
  * requireSameChildren?: boolean,
@@ -66,6 +70,8 @@ class AbstractJoiningTransformer {
66
70
  constructor (cfg) {
67
71
  // Todo: Might set some reasonable defaults across all classes
68
72
  this._cfg = cfg ?? /** @type {JoiningTransformerConfig<T>} */ ({});
73
+ /** @type {Record<string, OutputCharacters>} */
74
+ this._characterMap = {};
69
75
  }
70
76
 
71
77
  /**
@@ -76,6 +82,42 @@ class AbstractJoiningTransformer {
76
82
  this._cfg = cfg;
77
83
  }
78
84
 
85
+ /**
86
+ * @param {import('./StringJoiningTransformer.js').OutputConfig} cfg
87
+ * @returns {this}
88
+ */
89
+ output (cfg) {
90
+ // We wait until first element is set in `element()` to add
91
+ // XML declaration and DOCTYPE as latter depends on root element
92
+ this._outputConfig = cfg;
93
+
94
+ // Use for file extension if making downloadable?
95
+ this.mediaType = cfg.mediaType;
96
+ return this;
97
+ }
98
+
99
+ /**
100
+ * @param {string} name
101
+ * @param {OutputCharacters} outputCharacters
102
+ * @returns {void}
103
+ */
104
+ characterMap (name, outputCharacters) {
105
+ this._characterMap[name] = outputCharacters;
106
+ }
107
+
108
+ /**
109
+ * @param {string} str
110
+ * @returns {string}
111
+ */
112
+ _replaceCharacterMaps (str) {
113
+ this._outputConfig?.useCharacterMaps?.forEach((name) => {
114
+ this._characterMap[name].forEach(({character, string}) => {
115
+ str = str.replaceAll(character, string);
116
+ });
117
+ });
118
+ return str;
119
+ }
120
+
79
121
  /**
80
122
  * @param {string} type - Type name
81
123
  * @param {string} embedType - Embed type name
@@ -182,31 +182,84 @@ class DOMJoiningTransformer extends AbstractJoiningTransformer {
182
182
  }
183
183
 
184
184
  /**
185
- * @param {import('./StringJoiningTransformer.js').OutputConfig} cfg
185
+ * @overload
186
+ * @param {Element|string} elName
187
+ * @param {Record<string, string>} atts
188
+ * @param {(Node|string)[]} childNodes
189
+ * @param {(this: DOMJoiningTransformer) => void} cb
190
+ * @returns {DOMJoiningTransformer}
191
+ */
192
+ /**
193
+ * @overload
194
+ * @param {Element|string} elName
195
+ * @param {Record<string, string>} atts
196
+ * @param {(Node|string)[]} childNodes
197
+ * @returns {DOMJoiningTransformer}
198
+ */
199
+ /**
200
+ * @overload
201
+ * @param {Element|string} elName
202
+ * @param {Record<string, string>} atts
203
+ * @param {(this: DOMJoiningTransformer) => void} cb
204
+ * @returns {DOMJoiningTransformer}
205
+ */
206
+ /**
207
+ * @overload
208
+ * @param {Element|string} elName
209
+ * @param {Record<string, string>} atts
210
+ * @returns {DOMJoiningTransformer}
211
+ */
212
+ /**
213
+ * @overload
214
+ * @param {Element|string} elName
215
+ * @param {(Node|string)[]} childNodes
216
+ * @param {(this: DOMJoiningTransformer) => void} cb
217
+ * @returns {DOMJoiningTransformer}
218
+ */
219
+ /**
220
+ * @overload
221
+ * @param {Element|string} elName
222
+ * @param {(Node|string)[]} childNodes
223
+ * @returns {DOMJoiningTransformer}
224
+ */
225
+ /**
226
+ * @overload
227
+ * @param {Element|string} elName
228
+ * @param {(this: DOMJoiningTransformer) => void} cb
229
+ * @returns {DOMJoiningTransformer}
230
+ */
231
+ /**
232
+ * @overload
233
+ * @param {Element|string} elName
186
234
  * @returns {DOMJoiningTransformer}
187
235
  */
188
- output (cfg) {
189
- // We wait until first element is set in `element()` to add
190
- // XML declaration and DOCTYPE as latter depends on root element
191
- this._outputConfig = cfg;
192
-
193
- // Use for file extension if making downloadable?
194
- this.mediaType = cfg.mediaType;
195
- return this;
196
- }
197
-
198
236
  /**
199
237
  * @param {Element|string} elName - Element name
200
- * @param {Record<string, string>} [atts] - Attributes object
201
- * @param {(this: DOMJoiningTransformer) => void} [cb] - Callback function
238
+ * @param {Record<string, string>|(Node|string)[
239
+ * ]|((this: DOMJoiningTransformer) => void)} [atts] - Attributes,
240
+ * childNodes, or callback
241
+ * @param {(Node|string)[]|((this: DOMJoiningTransformer) => void)
242
+ * } [childNodes] - Child nodes or callback
243
+ * @param {(this: DOMJoiningTransformer) => void} [cb] - Callback
202
244
  * @returns {DOMJoiningTransformer}
203
245
  */
204
- element (elName, atts, cb) {
205
- // Todo: allow third argument to be array following Jamilih (also let
206
- // "atts" follow Jamilih)
207
- // Todo: allow for cfg to produce Jamilih DOM output or hXML
208
- // Todo: allow separate XML DOM one with XML String and hXML conversions
209
- // (HTML to XHTML is inevitably safe?)
246
+ element (elName, atts, childNodes, cb) {
247
+ // Handle argument overloading like other transformers
248
+ if (Array.isArray(atts)) {
249
+ cb = /** @type {(this: DOMJoiningTransformer) => void} */ (
250
+ /** @type {unknown} */ (childNodes)
251
+ );
252
+ childNodes = atts;
253
+ atts = {};
254
+ } else if (typeof atts === 'function') {
255
+ cb = /** @type {(this: DOMJoiningTransformer) => void} */ (atts);
256
+ childNodes = [];
257
+ atts = {};
258
+ }
259
+ if (typeof childNodes === 'function') {
260
+ cb = /** @type {(this: DOMJoiningTransformer) => void} */ (childNodes);
261
+ childNodes = [];
262
+ }
210
263
 
211
264
  if (!this.root && this._outputConfig) {
212
265
  this.root = elName;
@@ -277,13 +330,24 @@ class DOMJoiningTransformer extends AbstractJoiningTransformer {
277
330
 
278
331
  for (const att in atts) {
279
332
  if (Object.hasOwn(atts, att)) {
280
- el.setAttribute(att, atts[att]);
333
+ el.setAttribute(att, this._replaceCharacterMaps(atts[att]));
281
334
  }
282
335
  }
283
336
 
284
337
  const oldDOM = this._dom;
285
338
  this._dom = el;
286
339
 
340
+ // Add childNodes if provided
341
+ if (childNodes && childNodes.length) {
342
+ for (const child of childNodes) {
343
+ if (typeof child === 'string') {
344
+ el.append(this._replaceCharacterMaps(child));
345
+ } else {
346
+ el.append(child);
347
+ }
348
+ }
349
+ }
350
+
287
351
  if (cb) {
288
352
  cb.call(this);
289
353
  }
@@ -301,7 +365,7 @@ class DOMJoiningTransformer extends AbstractJoiningTransformer {
301
365
 
302
366
  for (const att in atts) {
303
367
  if (Object.hasOwn(atts, att)) {
304
- el.setAttribute(att, atts[att]);
368
+ el.setAttribute(att, this._replaceCharacterMaps(atts[att]));
305
369
  }
306
370
  }
307
371
  this.append(el);
@@ -310,6 +374,17 @@ class DOMJoiningTransformer extends AbstractJoiningTransformer {
310
374
 
311
375
  this._dom = el;
312
376
 
377
+ // Add childNodes if provided
378
+ if (childNodes && childNodes.length) {
379
+ for (const child of childNodes) {
380
+ if (typeof child === 'string') {
381
+ el.append(this._replaceCharacterMaps(child));
382
+ } else {
383
+ el.append(child);
384
+ }
385
+ }
386
+ }
387
+
313
388
  if (cb) {
314
389
  cb.call(this);
315
390
  }
@@ -318,6 +393,21 @@ class DOMJoiningTransformer extends AbstractJoiningTransformer {
318
393
  return this;
319
394
  }
320
395
 
396
+ /**
397
+ * @param {string} prefix
398
+ * @param {string} namespaceURI
399
+ * @returns {DOMJoiningTransformer}
400
+ */
401
+ namespace (prefix, namespaceURI) {
402
+ /** @type {Element} */
403
+ (this._dom).setAttributeNS(
404
+ 'http://www.w3.org/2000/xmlns/',
405
+ 'xmlns:' + prefix,
406
+ this._replaceCharacterMaps(namespaceURI)
407
+ );
408
+ return this;
409
+ }
410
+
321
411
  /**
322
412
  * @param {string} name
323
413
  * @param {string} val
@@ -328,7 +418,9 @@ class DOMJoiningTransformer extends AbstractJoiningTransformer {
328
418
  this._dom.nodeType !== 1) {
329
419
  throw new Error('You may only set an attribute on an element');
330
420
  }
331
- (/** @type {Element} */ (this._dom)).setAttribute(name, val);
421
+ (/** @type {Element} */ (this._dom)).setAttribute(
422
+ name, this._replaceCharacterMaps(val)
423
+ );
332
424
  return this;
333
425
  }
334
426
 
@@ -337,7 +429,7 @@ class DOMJoiningTransformer extends AbstractJoiningTransformer {
337
429
  * @returns {DOMJoiningTransformer}
338
430
  */
339
431
  text (txt) {
340
- this.append(txt);
432
+ this.append(this._replaceCharacterMaps(txt));
341
433
  return this;
342
434
  }
343
435