@design-edito/tools 0.2.30 → 0.2.37

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 (156) hide show
  1. package/agnostic/arrays/index.js +6 -6
  2. package/agnostic/colors/index.js +10 -10
  3. package/agnostic/css/index.js +3 -3
  4. package/agnostic/html/hyper-json/cast/index.js +6 -5
  5. package/agnostic/html/hyper-json/index.js +7 -6
  6. package/agnostic/html/hyper-json/smart-tags/coalesced/add/index.js +6 -5
  7. package/agnostic/html/hyper-json/smart-tags/coalesced/addclass/index.js +6 -5
  8. package/agnostic/html/hyper-json/smart-tags/coalesced/and/index.js +6 -5
  9. package/agnostic/html/hyper-json/smart-tags/coalesced/append/index.js +6 -5
  10. package/agnostic/html/hyper-json/smart-tags/coalesced/at/index.js +6 -5
  11. package/agnostic/html/hyper-json/smart-tags/coalesced/call/index.js +6 -5
  12. package/agnostic/html/hyper-json/smart-tags/coalesced/clone/index.js +6 -5
  13. package/agnostic/html/hyper-json/smart-tags/coalesced/deleteproperties/index.js +6 -5
  14. package/agnostic/html/hyper-json/smart-tags/coalesced/equals/index.js +6 -5
  15. package/agnostic/html/hyper-json/smart-tags/coalesced/getattribute/index.js +6 -5
  16. package/agnostic/html/hyper-json/smart-tags/coalesced/getproperties/index.js +6 -5
  17. package/agnostic/html/hyper-json/smart-tags/coalesced/getproperty/index.js +6 -5
  18. package/agnostic/html/hyper-json/smart-tags/coalesced/hjparse/index.js +6 -5
  19. package/agnostic/html/hyper-json/smart-tags/coalesced/hjstringify/index.d.ts +2 -3
  20. package/agnostic/html/hyper-json/smart-tags/coalesced/hjstringify/index.js +10 -11
  21. package/agnostic/html/hyper-json/smart-tags/coalesced/if/index.js +6 -5
  22. package/agnostic/html/hyper-json/smart-tags/coalesced/initialize/index.js +6 -5
  23. package/agnostic/html/hyper-json/smart-tags/coalesced/join/index.js +6 -5
  24. package/agnostic/html/hyper-json/smart-tags/coalesced/length/index.js +6 -5
  25. package/agnostic/html/hyper-json/smart-tags/coalesced/map/index.js +6 -5
  26. package/agnostic/html/hyper-json/smart-tags/coalesced/negate/index.js +6 -5
  27. package/agnostic/html/hyper-json/smart-tags/coalesced/notrailing/index.js +6 -5
  28. package/agnostic/html/hyper-json/smart-tags/coalesced/or/index.js +6 -5
  29. package/agnostic/html/hyper-json/smart-tags/coalesced/pickrandom/index.js +6 -5
  30. package/agnostic/html/hyper-json/smart-tags/coalesced/populate/index.js +6 -5
  31. package/agnostic/html/hyper-json/smart-tags/coalesced/print/index.js +6 -5
  32. package/agnostic/html/hyper-json/smart-tags/coalesced/push/index.js +6 -5
  33. package/agnostic/html/hyper-json/smart-tags/coalesced/pusheach/index.js +6 -5
  34. package/agnostic/html/hyper-json/smart-tags/coalesced/recordtoarray/index.js +6 -5
  35. package/agnostic/html/hyper-json/smart-tags/coalesced/removeattribute/index.js +6 -5
  36. package/agnostic/html/hyper-json/smart-tags/coalesced/removeclass/index.js +6 -5
  37. package/agnostic/html/hyper-json/smart-tags/coalesced/renameproperty/index.js +6 -5
  38. package/agnostic/html/hyper-json/smart-tags/coalesced/replace/index.js +6 -5
  39. package/agnostic/html/hyper-json/smart-tags/coalesced/select/index.js +6 -5
  40. package/agnostic/html/hyper-json/smart-tags/coalesced/set/index.js +6 -5
  41. package/agnostic/html/hyper-json/smart-tags/coalesced/setattribute/index.js +6 -5
  42. package/agnostic/html/hyper-json/smart-tags/coalesced/setproperty/index.d.ts +4 -1
  43. package/agnostic/html/hyper-json/smart-tags/coalesced/setproperty/index.js +8 -5
  44. package/agnostic/html/hyper-json/smart-tags/coalesced/sorton/index.js +6 -5
  45. package/agnostic/html/hyper-json/smart-tags/coalesced/split/index.js +6 -5
  46. package/agnostic/html/hyper-json/smart-tags/coalesced/spread/index.js +6 -5
  47. package/agnostic/html/hyper-json/smart-tags/coalesced/toarray/index.js +6 -5
  48. package/agnostic/html/hyper-json/smart-tags/coalesced/toboolean/index.js +6 -5
  49. package/agnostic/html/hyper-json/smart-tags/coalesced/toelement/index.js +6 -5
  50. package/agnostic/html/hyper-json/smart-tags/coalesced/toggleclass/index.js +6 -5
  51. package/agnostic/html/hyper-json/smart-tags/coalesced/tonodelist/index.js +6 -5
  52. package/agnostic/html/hyper-json/smart-tags/coalesced/tonull/index.js +6 -5
  53. package/agnostic/html/hyper-json/smart-tags/coalesced/tonumber/index.js +6 -5
  54. package/agnostic/html/hyper-json/smart-tags/coalesced/torecord/index.js +6 -5
  55. package/agnostic/html/hyper-json/smart-tags/coalesced/toref/index.js +6 -5
  56. package/agnostic/html/hyper-json/smart-tags/coalesced/tostring/index.js +6 -5
  57. package/agnostic/html/hyper-json/smart-tags/coalesced/totext/index.js +6 -5
  58. package/agnostic/html/hyper-json/smart-tags/coalesced/transformselected/index.js +6 -5
  59. package/agnostic/html/hyper-json/smart-tags/coalesced/trim/index.js +6 -5
  60. package/agnostic/html/hyper-json/smart-tags/isolated/boolean/index.js +6 -5
  61. package/agnostic/html/hyper-json/smart-tags/isolated/element/index.js +6 -5
  62. package/agnostic/html/hyper-json/smart-tags/isolated/get/index.js +6 -5
  63. package/agnostic/html/hyper-json/smart-tags/isolated/global/index.js +6 -5
  64. package/agnostic/html/hyper-json/smart-tags/isolated/guess/index.js +6 -5
  65. package/agnostic/html/hyper-json/smart-tags/isolated/nodelist/index.js +6 -5
  66. package/agnostic/html/hyper-json/smart-tags/isolated/number/index.js +6 -5
  67. package/agnostic/html/hyper-json/smart-tags/isolated/record/index.js +6 -5
  68. package/agnostic/html/hyper-json/smart-tags/isolated/ref/index.js +6 -5
  69. package/agnostic/html/hyper-json/smart-tags/isolated/string/index.js +6 -5
  70. package/agnostic/html/hyper-json/smart-tags/isolated/text/index.js +6 -5
  71. package/agnostic/html/hyper-json/tree/index.js +6 -5
  72. package/agnostic/html/hyper-json/utils/index.js +6 -5
  73. package/agnostic/html/index.js +10 -9
  74. package/agnostic/index.js +39 -39
  75. package/agnostic/misc/index.js +12 -12
  76. package/agnostic/misc/lorem-ipsum/index.js +7 -7
  77. package/agnostic/numbers/index.js +2 -2
  78. package/agnostic/objects/index.js +4 -4
  79. package/agnostic/strings/index.js +5 -5
  80. package/agnostic/time/index.js +3 -3
  81. package/chunks/{chunk-CETXQIKG.js → chunk-63J76ST6.js} +1 -1
  82. package/chunks/{chunk-CWHEFT5K.js → chunk-7NLDR53D.js} +1 -1
  83. package/chunks/{chunk-AR7P6OF2.js → chunk-ALFP7OQ3.js} +4 -4
  84. package/chunks/{chunk-5EDT4OIT.js → chunk-BPYICFMX.js} +1 -1
  85. package/chunks/{chunk-IITZAB23.js → chunk-FLE22O3O.js} +17 -17
  86. package/chunks/{chunk-B4NUIZ4A.js → chunk-FNGETPCZ.js} +9 -9
  87. package/chunks/{chunk-EYC3K2XK.js → chunk-GXOIVZUI.js} +9 -9
  88. package/chunks/{chunk-JJNO7JMG.js → chunk-NGIZKJDJ.js} +252 -155
  89. package/chunks/{chunk-B7J4OIAB.js → chunk-NUPAV2JX.js} +3 -3
  90. package/chunks/{chunk-7QOFWH7A.js → chunk-OYDCT5KK.js} +4 -4
  91. package/chunks/{chunk-QLXY57GL.js → chunk-TAUQZCR6.js} +6 -6
  92. package/chunks/{chunk-TDHN4EQG.js → chunk-TGDJWP5U.js} +1 -1
  93. package/chunks/{chunk-7YMA54J2.js → chunk-WJBQ2BO4.js} +1 -1
  94. package/chunks/{chunk-RGNGA6RE.js → chunk-YFBIPMXD.js} +1 -1
  95. package/chunks/{chunk-KURXDZ55.js → chunk-YRZFKMR4.js} +3 -3
  96. package/node/@aws-s3/index.js +6 -6
  97. package/node/@aws-s3/storage/file/index.js +4 -4
  98. package/node/@aws-s3/storage/index.js +5 -5
  99. package/node/@google-cloud/index.js +9 -9
  100. package/node/@google-cloud/storage/file/index.js +10 -10
  101. package/node/@google-cloud/storage/file/revoke-signed-urls/index.js +2 -2
  102. package/node/@google-cloud/storage/index.js +10 -10
  103. package/node/cloud-storage/index.js +34 -34
  104. package/node/cloud-storage/operations/copy-dir/index.js +2 -2
  105. package/node/cloud-storage/operations/copy-file/index.js +2 -2
  106. package/node/cloud-storage/operations/download-file/index.js +2 -2
  107. package/node/cloud-storage/operations/exists-file/index.js +2 -2
  108. package/node/cloud-storage/operations/index.js +39 -39
  109. package/node/cloud-storage/operations/list-dir/index.js +2 -2
  110. package/node/cloud-storage/operations/move-dir/index.js +2 -2
  111. package/node/cloud-storage/operations/move-file/index.js +2 -2
  112. package/node/cloud-storage/operations/remove-dir/index.js +2 -2
  113. package/node/cloud-storage/operations/remove-file/index.js +2 -2
  114. package/node/cloud-storage/operations/stat-file/index.js +2 -2
  115. package/node/cloud-storage/operations/upload-file/index.js +2 -2
  116. package/node/files/index.js +3 -3
  117. package/node/ftps/file/index.js +4 -4
  118. package/node/ftps/index.js +7 -7
  119. package/node/images/create/index.js +4 -4
  120. package/node/images/format/index.js +4 -4
  121. package/node/images/index.js +16 -16
  122. package/node/images/metadata/index.js +4 -4
  123. package/node/images/transform/index.js +12 -12
  124. package/node/images/transform/operations/extend/index.js +4 -4
  125. package/node/images/transform/operations/flatten/index.js +4 -4
  126. package/node/images/transform/operations/overlay/index.js +4 -4
  127. package/node/images/transform/operations/resize/index.js +4 -4
  128. package/node/images/transform/operations/rotate/index.js +4 -4
  129. package/node/images/utils/index.js +4 -4
  130. package/node/index.js +72 -72
  131. package/node/sftp/file/index.js +4 -4
  132. package/node/sftp/index.js +7 -7
  133. package/package.json +3 -1
  134. package/chunks/{chunk-XXRTRR5D.js → chunk-5ZPVE6NR.js} +3 -3
  135. package/chunks/{chunk-66S3WWJV.js → chunk-6UXES4W7.js} +3 -3
  136. package/chunks/{chunk-NBCX6DDO.js → chunk-73UGWJYI.js} +8 -8
  137. package/chunks/{chunk-ILJ4JFBY.js → chunk-AL7ESVX4.js} +3 -3
  138. package/chunks/{chunk-6RLNUMTZ.js → chunk-ALAGBHFV.js} +3 -3
  139. package/chunks/{chunk-6F6DZTWX.js → chunk-BDGFY3GP.js} +3 -3
  140. package/chunks/{chunk-SVA7LOGY.js → chunk-DFDH7MGI.js} +23 -23
  141. package/chunks/{chunk-CDWXM5CV.js → chunk-GL42Q643.js} +3 -3
  142. package/chunks/{chunk-TEUD5ZTM.js → chunk-GYEO7JZV.js} +9 -9
  143. package/chunks/{chunk-LYEZ5IRT.js → chunk-LGBQWEXH.js} +3 -3
  144. package/chunks/{chunk-LRVADTRM.js → chunk-MVYH3CSJ.js} +3 -3
  145. package/chunks/{chunk-OUDBOP46.js → chunk-NK62JYTD.js} +5 -5
  146. package/chunks/{chunk-4S7EBSJA.js → chunk-OC4VIF3N.js} +3 -3
  147. package/chunks/{chunk-MFJZS4CY.js → chunk-QHAB6XYD.js} +4 -4
  148. package/chunks/{chunk-WRRGMVRR.js → chunk-QKE2IYT5.js} +3 -3
  149. package/chunks/{chunk-KQENQXZ3.js → chunk-R4DZKWSR.js} +3 -3
  150. package/chunks/{chunk-G5RRNREY.js → chunk-S4VO4PFZ.js} +3 -3
  151. package/chunks/{chunk-7B7JP3CE.js → chunk-V3NHCEO5.js} +7 -7
  152. package/chunks/{chunk-UKD6DFES.js → chunk-WOYF3N4A.js} +3 -3
  153. package/chunks/{chunk-33LF74BE.js → chunk-X53BGT33.js} +3 -3
  154. package/chunks/{chunk-WK5Y34IN.js → chunk-XBA26Z7E.js} +3 -3
  155. package/chunks/{chunk-AZ4MJXUR.js → chunk-XPPOIKJL.js} +11 -11
  156. package/chunks/{chunk-BHDVARLW.js → chunk-XR2LNUGW.js} +3 -3
@@ -1,12 +1,12 @@
1
1
  import {
2
- nullFunc
3
- } from "./chunk-QAVYONH6.js";
2
+ array
3
+ } from "./chunk-QAQZEKIF.js";
4
4
  import {
5
5
  any
6
6
  } from "./chunk-FHLCPVND.js";
7
7
  import {
8
- array
9
- } from "./chunk-QAQZEKIF.js";
8
+ nullFunc
9
+ } from "./chunk-QAVYONH6.js";
10
10
  import {
11
11
  Serialize
12
12
  } from "./chunk-SXRWMH3U.js";
@@ -35,15 +35,18 @@ import {
35
35
  recordMap
36
36
  } from "./chunk-XNF5MLCQ.js";
37
37
  import {
38
- trimEnd,
39
- trimStart
40
- } from "./chunk-6XL25OZX.js";
38
+ replaceAll
39
+ } from "./chunk-ZTDVUXPR.js";
41
40
  import {
42
41
  Outcome
43
42
  } from "./chunk-JMU5PDBD.js";
44
43
  import {
45
- replaceAll
46
- } from "./chunk-ZTDVUXPR.js";
44
+ trimEnd,
45
+ trimStart
46
+ } from "./chunk-6XL25OZX.js";
47
+ import {
48
+ isNonNullObject
49
+ } from "./chunk-HQLRJ7XW.js";
47
50
  import {
48
51
  Window
49
52
  } from "./chunk-RLJOYG64.js";
@@ -91,14 +94,14 @@ var Cast;
91
94
  return `{${Object.entries(input).map(([key, val]) => `${key}:"${(0, Cast2.toString)(val)}"`).join(",")}}`;
92
95
  };
93
96
  Cast2.toText = (input) => {
94
- const { Text: Text2, document: document2 } = Window.get();
97
+ const { Text: Text2, document } = Window.get();
95
98
  if (input instanceof Text2) return input.cloneNode(true);
96
- return document2.createTextNode((0, Cast2.toString)(input));
99
+ return document.createTextNode((0, Cast2.toString)(input));
97
100
  };
98
101
  Cast2.toElement = (input, tagName) => {
99
- const { Element: Element2, Text: Text2, NodeList: NodeList2, document: document2 } = Window.get();
102
+ const { Element: Element2, Text: Text2, NodeList: NodeList2, document } = Window.get();
100
103
  if (input instanceof Element2) return input.cloneNode(true);
101
- const returned = document2.createElement(tagName ?? "div");
104
+ const returned = document.createElement(tagName ?? "div");
102
105
  if (input instanceof Text2) {
103
106
  returned.append(input.cloneNode(true));
104
107
  return returned;
@@ -113,8 +116,8 @@ var Cast;
113
116
  return returned;
114
117
  };
115
118
  Cast2.toNodeList = (input) => {
116
- const { Element: Element2, Text: Text2, NodeList: NodeList2, document: document2 } = Window.get();
117
- const parentDiv = document2.createElement("div");
119
+ const { Element: Element2, Text: Text2, NodeList: NodeList2, document } = Window.get();
120
+ const parentDiv = document.createElement("div");
118
121
  if (input instanceof NodeList2) {
119
122
  parentDiv.append(...Array.from(input).map((i) => i.cloneNode(true)));
120
123
  return parentDiv.childNodes;
@@ -162,8 +165,8 @@ var element = SmartTags.makeSmartTag({
162
165
  argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "null", "boolean", "number", "string", "text", "element", "nodelist"),
163
166
  func: (main, args) => {
164
167
  const tagName = Cast.toString(main).trim().toLowerCase();
165
- const { document: document2, NodeList: NodeList2 } = Window.get();
166
- const elt = document2.createElement(tagName);
168
+ const { document, NodeList: NodeList2 } = Window.get();
169
+ const elt = document.createElement(tagName);
167
170
  for (const argVal of args) {
168
171
  if (argVal instanceof NodeList2) elt.append(...Array.from(argVal));
169
172
  else if (argVal instanceof Element) elt.append(argVal);
@@ -215,7 +218,7 @@ var guess = SmartTags.makeSmartTag({
215
218
  const { makeSuccess } = Outcome;
216
219
  let coalesced = main;
217
220
  for (const arg of args) coalesced = Utils.coalesceValues(coalesced, 0, arg);
218
- const { Text: Text2, Element: Element2, document: document2 } = Window.get();
221
+ const { Text: Text2, Element: Element2, document } = Window.get();
219
222
  if (typeof coalesced !== "string" && !(coalesced instanceof Text2)) return makeSuccess(coalesced);
220
223
  const strCoalesced = Cast.toString(coalesced);
221
224
  if (strCoalesced.trim().toLowerCase() === "true") return makeSuccess(true);
@@ -230,7 +233,7 @@ var guess = SmartTags.makeSmartTag({
230
233
  if (recordChecked.success) return makeSuccess(recordChecked.payload);
231
234
  } catch (err) {
232
235
  }
233
- const div = document2.createElement("div");
236
+ const div = document.createElement("div");
234
237
  div.innerHTML = strCoalesced;
235
238
  const divChildren = div.childNodes;
236
239
  if (divChildren.length === 0) return makeSuccess(coalesced);
@@ -254,8 +257,8 @@ var nodelist = SmartTags.makeSmartTag({
254
257
  mainValueCheck: (m) => Outcome.makeSuccess(m),
255
258
  argsValueCheck: (a) => Outcome.makeSuccess(a),
256
259
  func: (main, args) => {
257
- const { document: document2 } = Window.get();
258
- const returnedParent = document2.createDocumentFragment();
260
+ const { document } = Window.get();
261
+ const returnedParent = document.createDocumentFragment();
259
262
  returnedParent.append(
260
263
  ...Array.from(Cast.toNodeList(main)),
261
264
  ...Array.from(Cast.toNodeList(args))
@@ -383,7 +386,7 @@ var addclass = SmartTags.makeSmartTag({
383
386
  mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "element", "nodelist"),
384
387
  argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text"),
385
388
  func: (main, args) => {
386
- const { Element: Element2 } = Window.get();
389
+ const { Element: Element2, document } = Window.get();
387
390
  if (main instanceof Element2) {
388
391
  main.classList.add(...args.map((arg) => Cast.toString(arg)));
389
392
  return Outcome.makeSuccess(main);
@@ -425,14 +428,14 @@ var append = SmartTags.makeSmartTag({
425
428
  argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text", "nodelist", "element", "array"),
426
429
  func: (main, args) => {
427
430
  const { makeSuccess } = Outcome;
428
- const { Text: Text2, Element: Element2, NodeList: NodeList2, document: document2 } = Window.get();
431
+ const { Text: Text2, Element: Element2, NodeList: NodeList2, document } = Window.get();
429
432
  if (Array.isArray(main)) return makeSuccess([...main, ...args]);
430
433
  if (main instanceof Element2) {
431
434
  main.append(...Array.from(Cast.toNodeList(args)));
432
435
  return makeSuccess(main);
433
436
  }
434
437
  if (main instanceof NodeList2) {
435
- const frag = document2.createDocumentFragment();
438
+ const frag = document.createDocumentFragment();
436
439
  frag.append(
437
440
  ...Array.from(main),
438
441
  ...Array.from(Cast.toNodeList(args))
@@ -685,23 +688,53 @@ function deepGetProperty(record2, pathString) {
685
688
  var textItemSymbol = "%%-hyperjson-text-%%";
686
689
  var nodelistItemSymbol = "%%-hyperjson-nodelist-%%";
687
690
  var elementItemSymbol = "%%-hyperjson-element-%%";
688
- function stringifier(val) {
691
+ function stringify(val) {
692
+ const { Text: Text2, Element: Element2, NodeList: NodeList2 } = Window.get();
689
693
  if (typeof val === "string" || typeof val === "number" || typeof val === "boolean" || val === null) return JSON.stringify(val);
690
- if (val instanceof Text) return JSON.stringify(`${textItemSymbol}${val.textContent}`);
691
- if (val instanceof Element) return JSON.stringify(`${elementItemSymbol}${val.outerHTML}`);
692
- if (val instanceof NodeList) {
693
- const wrapperdiv = document.createElement("div");
694
- wrapperdiv.append(...Array.from(val));
695
- return JSON.stringify(`${nodelistItemSymbol}${wrapperdiv.innerHTML}`);
694
+ if (val instanceof Text2) return JSON.stringify(`${textItemSymbol}${val.textContent}`);
695
+ if (val instanceof Element2) return JSON.stringify(`${elementItemSymbol}${val.outerHTML}`);
696
+ if (val instanceof NodeList2) {
697
+ const stringifiedItems = JSON.stringify(Array.from(val).map(stringify));
698
+ return JSON.stringify(`${nodelistItemSymbol}${stringifiedItems}`);
696
699
  }
697
- if (val instanceof Method) return JSON.stringify(`[Method object: ${val.transformer.name}`);
698
- if (Array.isArray(val)) return JSON.stringify(val.map(stringifier));
700
+ if (val instanceof Method) return JSON.stringify(`[Method object: ${val.transformer.name}]`);
701
+ if (Array.isArray(val)) return JSON.stringify(val.map(stringify));
699
702
  return JSON.stringify(
700
- Object.entries(val).reduce((acc, [key, val2]) => {
701
- return { ...acc, [key]: stringifier(val2) };
702
- }, {})
703
+ Object.entries(val).reduce((acc, [key, val2]) => ({
704
+ ...acc,
705
+ [key]: stringify(val2)
706
+ }), {})
703
707
  );
704
708
  }
709
+ function parse(val) {
710
+ const { document } = Window.get();
711
+ const jsonParsed = JSON.parse(val);
712
+ if (typeof jsonParsed === "number" || typeof jsonParsed === "boolean" || jsonParsed === null) return jsonParsed;
713
+ if (Array.isArray(jsonParsed)) return jsonParsed.map((e) => typeof e === "string" ? parse(e) : e);
714
+ if (isNonNullObject(jsonParsed)) return Object.entries(jsonParsed).reduce((acc, [key, val2]) => ({
715
+ ...acc,
716
+ [key]: typeof val2 === "string" ? parse(val2) : val2
717
+ }), {});
718
+ if (jsonParsed.startsWith(textItemSymbol)) return document.createTextNode(jsonParsed.slice(textItemSymbol.length));
719
+ if (jsonParsed.startsWith(elementItemSymbol)) {
720
+ const wrapperDiv = document.createElement("div");
721
+ wrapperDiv.innerHTML = jsonParsed.slice(elementItemSymbol.length);
722
+ return wrapperDiv.firstChild;
723
+ }
724
+ if (jsonParsed.startsWith(nodelistItemSymbol)) {
725
+ const stringifiedItems = jsonParsed.slice(nodelistItemSymbol.length);
726
+ const jsonParsedItems = JSON.parse(stringifiedItems);
727
+ const hjParsedItems = jsonParsedItems.map((e) => typeof e === "string" ? parse(e) : e);
728
+ const wrapperDiv = document.createElement("div");
729
+ hjParsedItems.forEach((item) => {
730
+ if (typeof item === "number" || typeof item === "boolean" || item === null) return wrapperDiv.append(`${item}`);
731
+ if (typeof item === "string" || item instanceof Text || item instanceof Element) return wrapperDiv.append(item);
732
+ if (item instanceof NodeList) return wrapperDiv.append(...Array.from(item));
733
+ });
734
+ return wrapperDiv.childNodes;
735
+ }
736
+ return jsonParsed;
737
+ }
705
738
  var hjstringify = SmartTags.makeSmartTag({
706
739
  name: "hjstringify",
707
740
  defaultMode: "coalescion",
@@ -709,73 +742,12 @@ var hjstringify = SmartTags.makeSmartTag({
709
742
  mainValueCheck: (m) => Outcome.makeSuccess(m),
710
743
  argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
711
744
  func: (main) => {
712
- const stringified = stringifier(main);
745
+ const stringified = stringify(main);
713
746
  return Outcome.makeSuccess(stringified);
714
747
  }
715
748
  });
716
749
 
717
750
  // src/agnostic/html/hyper-json/smart-tags/coalesced/hjparse/index.ts
718
- function isJson(value) {
719
- if (value === void 0) return false;
720
- if (typeof value === "string") return true;
721
- if (typeof value === "number") return true;
722
- if (typeof value === "boolean") return true;
723
- if (value === null) return true;
724
- if (Array.isArray(value)) return value.every(isJson);
725
- return Object.entries(value).every(([name, val]) => {
726
- if (typeof name !== "string") return false;
727
- return isJson(val);
728
- });
729
- }
730
- function parse(val) {
731
- const strInput = Cast.toString(val);
732
- try {
733
- const jsonParsed = JSON.parse(strInput);
734
- if (!isJson(jsonParsed)) return new Error(`Invalid JSON.parse output from ${strInput}`);
735
- return jsonParsed;
736
- } catch (err) {
737
- if (err instanceof Error) return err;
738
- const errStr = unknownToString(err);
739
- return new Error(errStr);
740
- }
741
- }
742
- function unescapeHyperJsonString(val) {
743
- if (val.startsWith(textItemSymbol)) {
744
- const trimmed = val.slice(textItemSymbol.length);
745
- const textItem = document.createTextNode(trimmed);
746
- return textItem;
747
- }
748
- if (val.startsWith(elementItemSymbol)) {
749
- const trimmed = val.slice(elementItemSymbol.length);
750
- const div = document.createElement("div");
751
- div.innerHTML = trimmed;
752
- const firstChild = div.firstChild;
753
- if (firstChild instanceof Element) return firstChild;
754
- return trimmed;
755
- }
756
- if (val.startsWith(nodelistItemSymbol)) {
757
- const trimmed = val.slice(nodelistItemSymbol.length);
758
- const div = document.createElement("div");
759
- div.innerHTML = trimmed;
760
- const childNodesArr = Array.from(div.childNodes);
761
- const frag = document.createDocumentFragment();
762
- Array.from(childNodesArr).forEach((childNode) => {
763
- if (childNode instanceof Text) frag.append(childNode);
764
- else if (childNode instanceof Element) frag.append(childNode);
765
- });
766
- return frag.childNodes;
767
- }
768
- return val;
769
- }
770
- function unescapeHyperJson(val) {
771
- if (typeof val === "number" || typeof val === "boolean" || val === null) return val;
772
- if (typeof val === "string") return unescapeHyperJsonString(val);
773
- if (Array.isArray(val)) return val.map(unescapeHyperJson);
774
- return Object.entries(val).reduce((acc, [currKey, currVal]) => ({
775
- ...acc,
776
- [currKey]: unescapeHyperJson(currVal)
777
- }), {});
778
- }
779
751
  var hjparse = SmartTags.makeSmartTag({
780
752
  name: "hjparse",
781
753
  defaultMode: "coalescion",
@@ -783,13 +755,13 @@ var hjparse = SmartTags.makeSmartTag({
783
755
  mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "string", "text"),
784
756
  argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
785
757
  func: (main) => {
786
- const parsed = parse(main);
787
- if (parsed instanceof Error) return Outcome.makeFailure({ details: parsed });
788
758
  try {
789
- const unescaped = unescapeHyperJson(parsed);
790
- return Outcome.makeSuccess(unescaped);
759
+ const parsed = parse(`${main}`);
760
+ return Outcome.makeSuccess(parsed);
791
761
  } catch (err) {
792
- return Outcome.makeFailure({ details: err });
762
+ return Outcome.makeFailure({
763
+ details: unknownToString(err)
764
+ });
793
765
  }
794
766
  }
795
767
  });
@@ -1136,11 +1108,11 @@ var removeattribute = SmartTags.makeSmartTag({
1136
1108
  func: (main, args) => {
1137
1109
  const argsStr = args.map((e) => Cast.toString(e));
1138
1110
  const [name] = argsStr;
1139
- const { NodeList: NodeList2 } = Window.get();
1111
+ const { Element: Element2, NodeList: NodeList2, document } = Window.get();
1140
1112
  if (main instanceof NodeList2) {
1141
1113
  const children = Array.from(main).map((child) => {
1142
1114
  const cloned = Utils.clone(child);
1143
- if (cloned instanceof Element) cloned.removeAttribute(name);
1115
+ if (cloned instanceof Element2) cloned.removeAttribute(name);
1144
1116
  return cloned;
1145
1117
  });
1146
1118
  const frag = document.createDocumentFragment();
@@ -1165,7 +1137,7 @@ var removeclass = SmartTags.makeSmartTag({
1165
1137
  mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "element", "nodelist"),
1166
1138
  argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text"),
1167
1139
  func: (main, args) => {
1168
- const { Element: Element2 } = Window.get();
1140
+ const { Element: Element2, document } = Window.get();
1169
1141
  if (main instanceof Element2) {
1170
1142
  main.classList.remove(...args.map((arg) => Cast.toString(arg)));
1171
1143
  return Outcome.makeSuccess(main);
@@ -1267,15 +1239,16 @@ var select = SmartTags.makeSmartTag({
1267
1239
  mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "nodelist", "element"),
1268
1240
  argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text"),
1269
1241
  func: (main, args) => {
1242
+ const { document, Element: Element2 } = Window.get();
1270
1243
  const selectedFragment = document.createDocumentFragment();
1271
- if (main instanceof Window.get().Element) {
1244
+ if (main instanceof Element2) {
1272
1245
  for (const arg of args) {
1273
1246
  const selector = Cast.toString(arg);
1274
1247
  const found = main.querySelectorAll(selector);
1275
1248
  selectedFragment.append(...Array.from(found));
1276
1249
  }
1277
1250
  } else {
1278
- const divWrapper = Window.get().document.createElement("div");
1251
+ const divWrapper = document.createElement("div");
1279
1252
  divWrapper.append(...Array.from(main));
1280
1253
  for (const arg of args) {
1281
1254
  const selector = Cast.toString(arg);
@@ -1336,8 +1309,8 @@ var setattribute = SmartTags.makeSmartTag({
1336
1309
  func: (main, args) => {
1337
1310
  const argsStr = args.map((e) => Cast.toString(e));
1338
1311
  const [name, value = ""] = argsStr;
1339
- const { NodeList: NodeList2 } = Window.get();
1340
- if (main instanceof NodeList2) {
1312
+ if (main instanceof NodeList) {
1313
+ const { document } = Window.get();
1341
1314
  const children = Array.from(main).map((child) => {
1342
1315
  const cloned = Utils.clone(child);
1343
1316
  if (cloned instanceof Element) cloned.setAttribute(name, value);
@@ -1362,7 +1335,18 @@ var setproperty = SmartTags.makeSmartTag({
1362
1335
  name: "setproperty",
1363
1336
  defaultMode: "coalescion",
1364
1337
  isolationInitType: "array",
1365
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "record"),
1338
+ mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(
1339
+ m,
1340
+ "string",
1341
+ "number",
1342
+ "boolean",
1343
+ "null",
1344
+ "text",
1345
+ "element",
1346
+ "nodelist",
1347
+ "record",
1348
+ "array"
1349
+ ),
1366
1350
  argsValueCheck: (a) => {
1367
1351
  const { makeFailure, makeSuccess } = Outcome;
1368
1352
  const { makeArgsValueError } = Utils.SmartTags;
@@ -1391,18 +1375,120 @@ var setproperty = SmartTags.makeSmartTag({
1391
1375
  }
1392
1376
  }
1393
1377
  });
1394
- function deepSetProperty(record2, pathString, value) {
1378
+ function deepSetProperty(input, pathString, value) {
1395
1379
  const pathChunks = pathString.split(".");
1396
- const clone2 = Utils.clone(record2);
1397
- let currentRecord = clone2;
1380
+ let clone2 = Utils.clone(input);
1381
+ let currentItemParent = void 0;
1382
+ let currentItemPathFromParent = void 0;
1383
+ let currentItem = clone2;
1384
+ const { Text: Text2, Element: Element2, NodeList: NodeList2, document } = Window.get();
1398
1385
  pathChunks.forEach((chunk, pos) => {
1399
1386
  const isLast = pos === pathChunks.length - 1;
1387
+ const numChunk = parseInt(chunk);
1400
1388
  if (isLast) {
1401
- currentRecord[chunk] = value;
1389
+ if (typeof currentItem === "number" || typeof currentItem === "boolean" || currentItem === null || currentItem instanceof Method) throw `DEAD_END: Cannot set properties on a string, number, boolean, null or Method item`;
1390
+ else if (typeof currentItem === "string") {
1391
+ if (currentItemParent !== void 0 && currentItemPathFromParent === void 0) throw `INVALID_PROP: Could not access item's child at ${currentItemPathFromParent} found at pos ${pos - 1} in path ${pathChunks.join(".")}`;
1392
+ if (Number.isNaN(numChunk) || numChunk < 0 || numChunk > currentItem.length) throw `INVALID_PROP: Could not access item's child at ${numChunk} found at pos ${pos} in path ${pathChunks.join(".")}`;
1393
+ const newString = currentItem.slice(0, numChunk) + Cast.toString(value) + currentItem.slice(numChunk + 1);
1394
+ if (currentItemParent === void 0) {
1395
+ clone2 = newString;
1396
+ }
1397
+ if (Array.isArray(currentItemParent)) {
1398
+ if (typeof currentItemPathFromParent !== "number") throw `IMPOSSIBLE_OPERATION: non-number path from an Array parent, this is a bug`;
1399
+ currentItemParent[currentItemPathFromParent] = newString;
1400
+ } else if (isRecord(currentItemParent)) {
1401
+ if (typeof currentItemPathFromParent !== "string") throw `IMPOSSIBLE_OPERATION: non-string path from an Record parent, this is a bug`;
1402
+ currentItemParent[currentItemPathFromParent] = newString;
1403
+ } else throw `IMPOSSIBLE_OPERATION: a string item should not be a child of anything else than Array or Record, cannot mutate. At ${currentItemPathFromParent} found at pos ${pos - 1} in path ${pathChunks.join(".")}`;
1404
+ } else if (Array.isArray(currentItem)) {
1405
+ if (Number.isNaN(numChunk) || numChunk < 0 || numChunk > currentItem.length) throw `INVALID_PROP: Could not access item's child at ${numChunk} found at pos ${pos} in path ${pathChunks.join(".")}`;
1406
+ if (numChunk === currentItem.length) currentItem.push(Utils.clone(value));
1407
+ else {
1408
+ currentItem[numChunk] = Utils.clone(value);
1409
+ }
1410
+ } else if (currentItem instanceof Text2) {
1411
+ const currContent = currentItem.textContent;
1412
+ if (Number.isNaN(numChunk) || numChunk < 0 || numChunk > currContent.length) throw `INVALID_PROP: Could not access item's child at ${numChunk} found at pos ${pos} in path ${pathChunks.join(".")}`;
1413
+ const newContent = [
1414
+ ...currContent.slice(0, numChunk),
1415
+ ...Cast.toString(value),
1416
+ ...currContent.slice(numChunk)
1417
+ ].join("");
1418
+ currentItem.textContent = newContent;
1419
+ } else if (currentItem instanceof Element2) {
1420
+ const currChildren = Array.from(currentItem.childNodes).filter((e) => e instanceof Text2 || e instanceof Element2);
1421
+ if (Number.isNaN(numChunk) || numChunk < 0 || numChunk > currChildren.length) throw `INVALID_PROP: Could not access item's child at ${numChunk} found at pos ${pos} in path ${pathChunks.join(".")}`;
1422
+ let newValue;
1423
+ if (value instanceof NodeList2 || value instanceof Element2 || value instanceof Text2) {
1424
+ newValue = Utils.clone(value);
1425
+ } else {
1426
+ newValue = Cast.toText(value);
1427
+ }
1428
+ const newChildren = [...currChildren.slice(0, numChunk)];
1429
+ if (newValue instanceof NodeList2) newChildren.push(...Array.from(newValue));
1430
+ else newChildren.push(newValue);
1431
+ newChildren.push(...currChildren.slice(numChunk + 1));
1432
+ currentItem.textContent = "";
1433
+ currentItem.append(...newChildren);
1434
+ } else if (currentItem instanceof NodeList2) {
1435
+ const currChildren = Array.from(currentItem);
1436
+ if (Number.isNaN(numChunk) || numChunk < 0 || numChunk > currChildren.length) throw `INVALID_PROP: Could not access item's child at ${numChunk} found at pos ${pos} in path ${pathChunks.join(".")}`;
1437
+ let newValue;
1438
+ if (value instanceof NodeList2 || value instanceof Element2 || value instanceof Text2) {
1439
+ newValue = Utils.clone(value);
1440
+ } else {
1441
+ newValue = Cast.toText(value);
1442
+ }
1443
+ const newChildren = [...currChildren.slice(0, numChunk)];
1444
+ if (newValue instanceof NodeList2) newChildren.push(...Array.from(newValue));
1445
+ else newChildren.push(newValue);
1446
+ newChildren.push(...currChildren.slice(numChunk + 1));
1447
+ const newNodelistFragment = document.createDocumentFragment();
1448
+ newNodelistFragment.append(...newChildren);
1449
+ const newNodelist = newNodelistFragment.childNodes;
1450
+ if (currentItemParent === void 0) {
1451
+ clone2 = newNodelist;
1452
+ }
1453
+ if (Array.isArray(currentItemParent)) {
1454
+ if (typeof currentItemPathFromParent !== "number") throw `IMPOSSIBLE_OPERATION: non-number path from an Array parent, this is a bug`;
1455
+ currentItemParent[currentItemPathFromParent] = newNodelist;
1456
+ } else if (isRecord(currentItemParent)) {
1457
+ if (typeof currentItemPathFromParent !== "string") throw `IMPOSSIBLE_OPERATION: non-string path from an Record parent, this is a bug`;
1458
+ currentItemParent[currentItemPathFromParent] = newNodelist;
1459
+ } else throw `IMPOSSIBLE_OPERATION: a Nodelist item should not be a child of anything else than Array or Record, cannot mutate. At ${currentItemPathFromParent} found at pos ${pos - 1} in path ${pathChunks.join(".")}`;
1460
+ } else {
1461
+ currentItem[chunk] = Utils.clone(value);
1462
+ }
1402
1463
  } else {
1403
- const found = currentRecord[chunk];
1404
- if (isRecord(found)) currentRecord = found;
1405
- else throw "NOT_A_RECORD";
1464
+ if (typeof currentItem === "string" || typeof currentItem === "number" || typeof currentItem === "boolean" || currentItem === null || currentItem instanceof Text2 || currentItem instanceof Method) throw `DEAD_END: Cannot go deeper when a string, number, boolean, null, Text or Method item is reached`;
1465
+ if (currentItem instanceof Element2) {
1466
+ const children = Array.from(currentItem.childNodes).filter((e) => e instanceof Text2 || e instanceof Element2);
1467
+ const found = children[numChunk];
1468
+ if (found === void 0) throw `INVALID_PROP: Could not access item's child at ${numChunk} found at pos ${pos} in path ${pathChunks.join(".")}`;
1469
+ currentItemParent = currentItem;
1470
+ currentItemPathFromParent = numChunk;
1471
+ currentItem = found;
1472
+ } else if (currentItem instanceof NodeList2) {
1473
+ const children = Array.from(currentItem);
1474
+ const found = children[numChunk];
1475
+ if (found === void 0) throw `INVALID_PROP: Could not access item's child at ${numChunk} found at pos ${pos} in path ${pathChunks.join(".")}`;
1476
+ currentItemParent = currentItem;
1477
+ currentItemPathFromParent = numChunk;
1478
+ currentItem = found;
1479
+ } else if (Array.isArray(currentItem)) {
1480
+ const found = currentItem[numChunk];
1481
+ if (found === void 0) throw `INVALID_PROP: Could not access item's child at ${numChunk} found at pos ${pos} in path ${pathChunks.join(".")}`;
1482
+ currentItemParent = currentItem;
1483
+ currentItemPathFromParent = numChunk;
1484
+ currentItem = found;
1485
+ } else {
1486
+ const found = currentItem[chunk];
1487
+ if (found === void 0) throw `INVALID_PROP: Could not access item's child at ${chunk} found at pos ${pos} in path ${pathChunks.join(".")}`;
1488
+ currentItemParent = currentItem;
1489
+ currentItemPathFromParent = chunk;
1490
+ currentItem = found;
1491
+ }
1406
1492
  }
1407
1493
  });
1408
1494
  return clone2;
@@ -1561,7 +1647,7 @@ var toggleclass = SmartTags.makeSmartTag({
1561
1647
  mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "element", "nodelist"),
1562
1648
  argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text"),
1563
1649
  func: (main, args) => {
1564
- const { Element: Element2 } = Window.get();
1650
+ const { Element: Element2, document } = Window.get();
1565
1651
  if (main instanceof Element2) {
1566
1652
  args.forEach((arg) => main.classList.toggle(Cast.toString(arg)));
1567
1653
  return Outcome.makeSuccess(main);
@@ -1776,7 +1862,7 @@ var Tree;
1776
1862
  return new Tree2(merged, null, null, options);
1777
1863
  }
1778
1864
  constructor(node, parent, pathFromParent, options) {
1779
- const { Element: Element2, Text: Text2, document: document2 } = Window.get();
1865
+ const { Element: Element2, Text: Text2, document } = Window.get();
1780
1866
  this.resolve = this.resolve.bind(this);
1781
1867
  this.setVariable = this.setVariable.bind(this);
1782
1868
  this.getVariable = this.getVariable.bind(this);
@@ -1932,7 +2018,7 @@ var Tree;
1932
2018
  if (lastReducedItem instanceof Element2) return [...reduced, child];
1933
2019
  const lastReducedTrimmed = trimEnd(lastReducedItem.textContent ?? "");
1934
2020
  const childTrimmed = trimStart(child.textContent ?? "");
1935
- const merged = document2.createTextNode(`${lastReducedTrimmed}${childTrimmed}`);
2021
+ const merged = document.createTextNode(`${lastReducedTrimmed}${childTrimmed}`);
1936
2022
  const returned = [...reduced];
1937
2023
  returned.pop();
1938
2024
  returned.push(merged);
@@ -1945,7 +2031,7 @@ var Tree;
1945
2031
  if (childNode instanceof Text2) {
1946
2032
  const rawTextContent = childNode.textContent ?? "";
1947
2033
  const textContent = rawTextContent.replace(/^\s*\n+\s*/, "").replace(/\s*\n+\s*$/, "");
1948
- const returnedChildNode = document2.createTextNode(textContent);
2034
+ const returnedChildNode = document.createTextNode(textContent);
1949
2035
  mutableSubtrees.set(
1950
2036
  positionnedChildrenCount,
1951
2037
  new Tree2(returnedChildNode, this, positionnedChildrenCount, this.options)
@@ -2091,11 +2177,11 @@ var Tree;
2091
2177
  var Utils;
2092
2178
  ((Utils2) => {
2093
2179
  function clone2(value) {
2094
- const { Element: Element2, Text: Text2, NodeList: NodeList2, document: document2 } = Window.get();
2180
+ const { Element: Element2, Text: Text2, NodeList: NodeList2, document } = Window.get();
2095
2181
  if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null) return value;
2096
2182
  if (value instanceof Text2) return value.cloneNode(true);
2097
2183
  if (value instanceof NodeList2) {
2098
- const frag = document2.createDocumentFragment();
2184
+ const frag = document.createDocumentFragment();
2099
2185
  const nodes = Array.from(value).map((e) => e.cloneNode(true));
2100
2186
  frag.append(...nodes);
2101
2187
  return frag.childNodes;
@@ -2109,7 +2195,7 @@ var Utils;
2109
2195
  }
2110
2196
  Utils2.clone = clone2;
2111
2197
  function coalesceValues(currentValue, subpath, subvalue) {
2112
- const { Element: Element2, Text: Text2, NodeList: NodeList2, document: document2 } = Window.get();
2198
+ const { Element: Element2, Text: Text2, NodeList: NodeList2, document } = Window.get();
2113
2199
  let actualSubvalue = subvalue;
2114
2200
  if (actualSubvalue instanceof Transformer) {
2115
2201
  const transformer = actualSubvalue;
@@ -2135,27 +2221,27 @@ var Utils;
2135
2221
  if (actualSubvalue === null || typeof actualSubvalue === "boolean" || typeof actualSubvalue === "number" || typeof actualSubvalue === "string") return `${currentValue}${actualSubvalue}`;
2136
2222
  if (actualSubvalue instanceof Text2) return `${currentValue}${actualSubvalue.textContent}`;
2137
2223
  if (actualSubvalue instanceof Element2) {
2138
- const frag = document2.createDocumentFragment();
2224
+ const frag = document.createDocumentFragment();
2139
2225
  frag.append(currentValue, Utils2.clone(actualSubvalue));
2140
2226
  return frag.childNodes;
2141
2227
  }
2142
2228
  if (actualSubvalue instanceof NodeList2) {
2143
- const frag = document2.createDocumentFragment();
2229
+ const frag = document.createDocumentFragment();
2144
2230
  frag.append(currentValue, ...Array.from(Utils2.clone(actualSubvalue)));
2145
2231
  return frag.childNodes;
2146
2232
  }
2147
2233
  return actualSubvalue;
2148
2234
  }
2149
2235
  if (currentValue instanceof Text2) {
2150
- if (actualSubvalue === null || typeof actualSubvalue === "boolean" || typeof actualSubvalue === "number" || typeof actualSubvalue === "string") return document2.createTextNode(`${currentValue.textContent}${actualSubvalue}`);
2151
- if (actualSubvalue instanceof Text2) return document2.createTextNode(`${currentValue.textContent}${actualSubvalue.textContent}`);
2236
+ if (actualSubvalue === null || typeof actualSubvalue === "boolean" || typeof actualSubvalue === "number" || typeof actualSubvalue === "string") return document.createTextNode(`${currentValue.textContent}${actualSubvalue}`);
2237
+ if (actualSubvalue instanceof Text2) return document.createTextNode(`${currentValue.textContent}${actualSubvalue.textContent}`);
2152
2238
  if (actualSubvalue instanceof Element2) {
2153
- const frag = document2.createDocumentFragment();
2239
+ const frag = document.createDocumentFragment();
2154
2240
  frag.append(clone2(currentValue), clone2(actualSubvalue));
2155
2241
  return frag.childNodes;
2156
2242
  }
2157
2243
  if (actualSubvalue instanceof NodeList2) {
2158
- const frag = document2.createDocumentFragment();
2244
+ const frag = document.createDocumentFragment();
2159
2245
  frag.append(clone2(currentValue), ...Array.from(clone2(actualSubvalue)));
2160
2246
  return frag.childNodes;
2161
2247
  }
@@ -2163,17 +2249,17 @@ var Utils;
2163
2249
  }
2164
2250
  if (currentValue instanceof Element2) {
2165
2251
  if (actualSubvalue === null || typeof actualSubvalue === "boolean" || typeof actualSubvalue === "number" || typeof actualSubvalue === "string") {
2166
- const frag = document2.createDocumentFragment();
2252
+ const frag = document.createDocumentFragment();
2167
2253
  frag.append(clone2(currentValue), `${actualSubvalue}`);
2168
2254
  return frag.childNodes;
2169
2255
  }
2170
2256
  if (actualSubvalue instanceof Text2 || actualSubvalue instanceof Element2) {
2171
- const frag = document2.createDocumentFragment();
2257
+ const frag = document.createDocumentFragment();
2172
2258
  frag.append(clone2(currentValue), clone2(actualSubvalue));
2173
2259
  return frag.childNodes;
2174
2260
  }
2175
2261
  if (actualSubvalue instanceof NodeList2) {
2176
- const frag = document2.createDocumentFragment();
2262
+ const frag = document.createDocumentFragment();
2177
2263
  frag.append(clone2(currentValue), ...Array.from(clone2(actualSubvalue)));
2178
2264
  return frag.childNodes;
2179
2265
  }
@@ -2181,17 +2267,17 @@ var Utils;
2181
2267
  }
2182
2268
  if (currentValue instanceof NodeList2) {
2183
2269
  if (actualSubvalue === null || typeof actualSubvalue === "boolean" || typeof actualSubvalue === "number" || typeof actualSubvalue === "string") {
2184
- const frag = document2.createDocumentFragment();
2270
+ const frag = document.createDocumentFragment();
2185
2271
  frag.append(...Array.from(clone2(currentValue)), `${actualSubvalue}`);
2186
2272
  return frag.childNodes;
2187
2273
  }
2188
2274
  if (actualSubvalue instanceof Text2 || actualSubvalue instanceof Element2) {
2189
- const frag = document2.createDocumentFragment();
2275
+ const frag = document.createDocumentFragment();
2190
2276
  frag.append(...Array.from(clone2(currentValue)), clone2(actualSubvalue));
2191
2277
  return frag.childNodes;
2192
2278
  }
2193
2279
  if (actualSubvalue instanceof NodeList2) {
2194
- const frag = document2.createDocumentFragment();
2280
+ const frag = document.createDocumentFragment();
2195
2281
  frag.append(...Array.from(clone2(currentValue)), ...Array.from(clone2(actualSubvalue)));
2196
2282
  return frag.childNodes;
2197
2283
  }
@@ -2205,32 +2291,32 @@ var Utils;
2205
2291
  }
2206
2292
  Utils2.coalesceValues = coalesceValues;
2207
2293
  Utils2.toHyperJson = (value) => {
2208
- const { document: document2, Element: Element2, Text: Text2, NodeList: NodeList2 } = Window.get();
2294
+ const { document, Element: Element2, Text: Text2, NodeList: NodeList2 } = Window.get();
2209
2295
  if (value instanceof Text2) {
2210
- const elt2 = document2.createElement("text");
2296
+ const elt2 = document.createElement("text");
2211
2297
  elt2.innerHTML = value.textContent ?? "";
2212
2298
  return elt2;
2213
2299
  }
2214
2300
  if (value instanceof Element2) return value.cloneNode(true);
2215
2301
  if (value instanceof NodeList2) {
2216
- const elt2 = document2.createElement("nodelist");
2302
+ const elt2 = document.createElement("nodelist");
2217
2303
  elt2.append(...Array.from(value).map((e) => e.cloneNode(true)));
2218
2304
  return elt2;
2219
2305
  }
2220
- if (value === null) return document2.createElement("null");
2306
+ if (value === null) return document.createElement("null");
2221
2307
  if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
2222
- const elt2 = document2.createElement(typeof value);
2308
+ const elt2 = document.createElement(typeof value);
2223
2309
  elt2.innerHTML = `${value}`;
2224
2310
  return elt2;
2225
2311
  }
2226
2312
  if (Array.isArray(value)) {
2227
- const elt2 = document2.createElement("array");
2313
+ const elt2 = document.createElement("array");
2228
2314
  elt2.append(...value.map((e) => (0, Utils2.toHyperJson)(e)));
2229
2315
  return elt2;
2230
2316
  }
2231
2317
  if (value instanceof Transformer) return clone2(value.sourceTree.node);
2232
2318
  if (value instanceof Method) return clone2(value.transformer.sourceTree.node);
2233
- const elt = document2.createElement("record");
2319
+ const elt = document.createElement("record");
2234
2320
  Object.entries(value).forEach(([key, val]) => {
2235
2321
  const hjVal = (0, Utils2.toHyperJson)(val);
2236
2322
  if (hjVal instanceof Text2) return;
@@ -2316,13 +2402,13 @@ var Utils;
2316
2402
  let Tree2;
2317
2403
  ((Tree3) => {
2318
2404
  function mergeNodes(nodes) {
2405
+ const { document, Text: Text2, Element: Element2 } = Window.get();
2319
2406
  const clones = nodes.map((node) => node.cloneNode(true));
2320
2407
  const allChildren = [];
2321
2408
  clones.forEach((node) => {
2322
2409
  const actionAttribute = node.getAttribute(Tree.Tree.actionAttribute)?.trim().toLowerCase();
2323
2410
  const actionAttrIsValid = isInEnum(Types.Tree.Merge.Action, actionAttribute ?? "");
2324
2411
  const nodeAction = actionAttrIsValid ? actionAttribute : Types.Tree.Merge.Action.APPEND;
2325
- const { Element: Element2, Text: Text2 } = Window.get();
2326
2412
  const children = Array.from(node.childNodes).filter((child) => child instanceof Text2 || child instanceof Element2).map((child) => {
2327
2413
  if (child instanceof Text2) return { node: child, key: void 0 };
2328
2414
  const childKey = child.getAttribute(Tree.Tree.keyAttribute) ?? void 0;
@@ -2360,14 +2446,14 @@ var Utils;
2360
2446
  }
2361
2447
  Tree3.mergeNodes = mergeNodes;
2362
2448
  function getInitialValueFromTypeName(name) {
2363
- const { document: document2 } = Window.get();
2449
+ const { document } = Window.get();
2364
2450
  if (name === "null") return null;
2365
2451
  if (name === "boolean") return false;
2366
2452
  if (name === "number") return 0;
2367
2453
  if (name === "string") return "";
2368
- if (name === "text") return document2.createTextNode("");
2369
- if (name === "nodelist") return document2.createDocumentFragment().childNodes;
2370
- if (name === "element") return document2.createElement("div");
2454
+ if (name === "text") return document.createTextNode("");
2455
+ if (name === "nodelist") return document.createDocumentFragment().childNodes;
2456
+ if (name === "element") return document.createElement("div");
2371
2457
  if (name === "array") return [];
2372
2458
  if (name === "record") return {};
2373
2459
  throw new Error(`Unknown value type name: ${name}`);
@@ -2488,9 +2574,20 @@ var Utils;
2488
2574
  found: `length: ${args.length}`
2489
2575
  });
2490
2576
  };
2491
- SmartTags3.makeMainValueError = (expected, found, details) => ({ expected, found, details });
2492
- SmartTags3.makeArgsValueError = (expected, found, position, details) => ({ expected, found, position, details });
2493
- SmartTags3.makeTransformationError = (details) => ({ details });
2577
+ SmartTags3.makeMainValueError = (expected, found, details) => ({
2578
+ expected,
2579
+ found,
2580
+ details
2581
+ });
2582
+ SmartTags3.makeArgsValueError = (expected, found, position, details) => ({
2583
+ expected,
2584
+ found,
2585
+ position,
2586
+ details
2587
+ });
2588
+ SmartTags3.makeTransformationError = (details) => ({
2589
+ details
2590
+ });
2494
2591
  })(SmartTags2 = Utils2.SmartTags || (Utils2.SmartTags = {}));
2495
2592
  })(Utils || (Utils = {}));
2496
2593
 
@@ -2530,9 +2627,8 @@ export {
2530
2627
  getproperties,
2531
2628
  getproperty,
2532
2629
  deepGetProperty,
2533
- textItemSymbol,
2534
- nodelistItemSymbol,
2535
- elementItemSymbol,
2630
+ stringify,
2631
+ parse,
2536
2632
  hjstringify,
2537
2633
  hjparse,
2538
2634
  ifFunc,
@@ -2557,6 +2653,7 @@ export {
2557
2653
  set,
2558
2654
  setattribute,
2559
2655
  setproperty,
2656
+ deepSetProperty,
2560
2657
  sorton,
2561
2658
  split,
2562
2659
  spread,