@design-edito/tools 0.1.73 → 0.2.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 (645) hide show
  1. package/agnostic/arrays/index.js +10 -10
  2. package/agnostic/arrays/random-pick/index.js +4 -4
  3. package/agnostic/colors/index.js +11 -11
  4. package/agnostic/colors/lighten-color/index.js +2 -2
  5. package/agnostic/colors/saturate-color/index.js +2 -2
  6. package/agnostic/css/index.js +8 -8
  7. package/agnostic/css/styles-set/index.js +4 -4
  8. package/agnostic/html/hyper-json/cast/index.js +8 -8
  9. package/agnostic/html/hyper-json/index.js +9 -9
  10. package/agnostic/html/hyper-json/smart-tags/coalesced/add/index.js +8 -8
  11. package/agnostic/html/hyper-json/smart-tags/coalesced/addclass/index.js +8 -8
  12. package/agnostic/html/hyper-json/smart-tags/coalesced/and/index.js +8 -8
  13. package/agnostic/html/hyper-json/smart-tags/coalesced/append/index.js +8 -8
  14. package/agnostic/html/hyper-json/smart-tags/coalesced/at/index.js +8 -8
  15. package/agnostic/html/hyper-json/smart-tags/coalesced/call/index.js +8 -8
  16. package/agnostic/html/hyper-json/smart-tags/coalesced/clone/index.js +8 -8
  17. package/agnostic/html/hyper-json/smart-tags/coalesced/deleteproperties/index.js +8 -8
  18. package/agnostic/html/hyper-json/smart-tags/coalesced/equals/index.js +8 -8
  19. package/agnostic/html/hyper-json/smart-tags/coalesced/getattribute/index.js +8 -8
  20. package/agnostic/html/hyper-json/smart-tags/coalesced/getproperties/index.js +8 -8
  21. package/agnostic/html/hyper-json/smart-tags/coalesced/getproperty/index.js +8 -8
  22. package/agnostic/html/hyper-json/smart-tags/coalesced/if/index.js +8 -8
  23. package/agnostic/html/hyper-json/smart-tags/coalesced/initialize/index.js +8 -8
  24. package/agnostic/html/hyper-json/smart-tags/coalesced/join/index.js +8 -8
  25. package/agnostic/html/hyper-json/smart-tags/coalesced/length/index.js +8 -8
  26. package/agnostic/html/hyper-json/smart-tags/coalesced/map/index.js +8 -8
  27. package/agnostic/html/hyper-json/smart-tags/coalesced/negate/index.js +8 -8
  28. package/agnostic/html/hyper-json/smart-tags/coalesced/notrailing/index.js +8 -8
  29. package/agnostic/html/hyper-json/smart-tags/coalesced/or/index.js +8 -8
  30. package/agnostic/html/hyper-json/smart-tags/coalesced/pickrandom/index.js +8 -8
  31. package/agnostic/html/hyper-json/smart-tags/coalesced/populate/index.js +8 -8
  32. package/agnostic/html/hyper-json/smart-tags/coalesced/print/index.js +8 -8
  33. package/agnostic/html/hyper-json/smart-tags/coalesced/push/index.js +8 -8
  34. package/agnostic/html/hyper-json/smart-tags/coalesced/pusheach/index.js +8 -8
  35. package/agnostic/html/hyper-json/smart-tags/coalesced/recordtoarray/index.js +8 -8
  36. package/agnostic/html/hyper-json/smart-tags/coalesced/removeattribute/index.js +8 -8
  37. package/agnostic/html/hyper-json/smart-tags/coalesced/removeclass/index.js +8 -8
  38. package/agnostic/html/hyper-json/smart-tags/coalesced/renameproperty/index.js +8 -8
  39. package/agnostic/html/hyper-json/smart-tags/coalesced/replace/index.js +8 -8
  40. package/agnostic/html/hyper-json/smart-tags/coalesced/select/index.js +8 -8
  41. package/agnostic/html/hyper-json/smart-tags/coalesced/set/index.js +8 -8
  42. package/agnostic/html/hyper-json/smart-tags/coalesced/setattribute/index.js +8 -8
  43. package/agnostic/html/hyper-json/smart-tags/coalesced/setproperty/index.js +8 -8
  44. package/agnostic/html/hyper-json/smart-tags/coalesced/sorton/index.js +8 -8
  45. package/agnostic/html/hyper-json/smart-tags/coalesced/split/index.js +8 -8
  46. package/agnostic/html/hyper-json/smart-tags/coalesced/spread/index.js +8 -8
  47. package/agnostic/html/hyper-json/smart-tags/coalesced/toarray/index.js +8 -8
  48. package/agnostic/html/hyper-json/smart-tags/coalesced/toboolean/index.js +8 -8
  49. package/agnostic/html/hyper-json/smart-tags/coalesced/toelement/index.js +8 -8
  50. package/agnostic/html/hyper-json/smart-tags/coalesced/toggleclass/index.js +8 -8
  51. package/agnostic/html/hyper-json/smart-tags/coalesced/tonodelist/index.js +8 -8
  52. package/agnostic/html/hyper-json/smart-tags/coalesced/tonull/index.js +8 -8
  53. package/agnostic/html/hyper-json/smart-tags/coalesced/tonumber/index.js +8 -8
  54. package/agnostic/html/hyper-json/smart-tags/coalesced/torecord/index.js +8 -8
  55. package/agnostic/html/hyper-json/smart-tags/coalesced/toref/index.js +8 -8
  56. package/agnostic/html/hyper-json/smart-tags/coalesced/tostring/index.js +8 -8
  57. package/agnostic/html/hyper-json/smart-tags/coalesced/totext/index.js +8 -8
  58. package/agnostic/html/hyper-json/smart-tags/coalesced/transformselected/index.js +8 -8
  59. package/agnostic/html/hyper-json/smart-tags/coalesced/trim/index.js +8 -8
  60. package/agnostic/html/hyper-json/smart-tags/isolated/boolean/index.js +8 -8
  61. package/agnostic/html/hyper-json/smart-tags/isolated/element/index.js +8 -8
  62. package/agnostic/html/hyper-json/smart-tags/isolated/get/index.js +8 -8
  63. package/agnostic/html/hyper-json/smart-tags/isolated/global/index.js +8 -8
  64. package/agnostic/html/hyper-json/smart-tags/isolated/guess/index.js +8 -8
  65. package/agnostic/html/hyper-json/smart-tags/isolated/nodelist/index.js +8 -8
  66. package/agnostic/html/hyper-json/smart-tags/isolated/number/index.js +8 -8
  67. package/agnostic/html/hyper-json/smart-tags/isolated/record/index.js +8 -8
  68. package/agnostic/html/hyper-json/smart-tags/isolated/ref/index.js +8 -8
  69. package/agnostic/html/hyper-json/smart-tags/isolated/string/index.js +8 -8
  70. package/agnostic/html/hyper-json/smart-tags/isolated/text/index.js +8 -8
  71. package/agnostic/html/hyper-json/tree/index.js +8 -8
  72. package/agnostic/html/hyper-json/utils/index.js +8 -8
  73. package/agnostic/html/index.js +22 -22
  74. package/agnostic/html/sanitize/index.js +4 -4
  75. package/agnostic/html/selector-to-element/index.js +4 -4
  76. package/agnostic/html/string-to-nodes/index.js +5 -5
  77. package/agnostic/misc/crossenv/index.js +2 -2
  78. package/agnostic/misc/index.js +20 -20
  79. package/agnostic/misc/lorem-ipsum/index.js +11 -11
  80. package/agnostic/numbers/index.js +3 -3
  81. package/agnostic/objects/index.js +14 -14
  82. package/agnostic/strings/index.js +6 -6
  83. package/agnostic/time/index.js +3 -3
  84. package/chunks/chunk-24MJDYQE.js +18 -0
  85. package/chunks/{chunk-7KCMLH6B.js → chunk-2V7TLVCV.js} +6 -6
  86. package/chunks/{chunk-XFMKYZKH.js → chunk-3XRPOHUB.js} +1 -1
  87. package/chunks/chunk-4KNB7WYD.js +19 -0
  88. package/chunks/chunk-4OK2UH4M.js +28 -0
  89. package/chunks/{chunk-3CGRUS5C.js → chunk-4W7NAQMC.js} +1 -1
  90. package/chunks/chunk-5BQFHNTR.js +21 -0
  91. package/chunks/chunk-5KVGIG6J.js +31 -0
  92. package/chunks/chunk-5PAFOSWF.js +16 -0
  93. package/chunks/chunk-5XBCPKNW.js +18 -0
  94. package/chunks/chunk-6FMANHGH.js +15 -0
  95. package/chunks/{chunk-5TRAENM3.js → chunk-6V6SYSHX.js} +7 -7
  96. package/chunks/chunk-74CFPDKM.js +28 -0
  97. package/chunks/{chunk-6SXCNPJ2.js → chunk-7CHYRYXJ.js} +32 -32
  98. package/chunks/{chunk-3CQON3DO.js → chunk-7J2AUDU2.js} +25 -21
  99. package/chunks/chunk-7KSMK42F.js +28 -0
  100. package/chunks/chunk-ABQMMHCL.js +16 -0
  101. package/chunks/chunk-AIC5YAJU.js +28 -0
  102. package/chunks/{chunk-YY6DTDMO.js → chunk-AKCO3SNC.js} +30 -30
  103. package/chunks/{chunk-A5XT7AXP.js → chunk-AU6JLO5B.js} +2 -2
  104. package/chunks/chunk-AW3I75FU.js +79 -0
  105. package/chunks/chunk-B5C6VXNI.js +18 -0
  106. package/chunks/chunk-BN4MCFBZ.js +35 -0
  107. package/chunks/chunk-BP3KL5L2.js +28 -0
  108. package/chunks/chunk-BSLVDJVW.js +32 -0
  109. package/chunks/chunk-BVPHULMY.js +21 -0
  110. package/chunks/{chunk-E3F7QTXR.js → chunk-C2MFLI7A.js} +15 -15
  111. package/chunks/chunk-CGITTQIW.js +42 -0
  112. package/chunks/{chunk-SUWMOLXI.js → chunk-CHKEZ72M.js} +1 -1
  113. package/chunks/chunk-CKENYYWH.js +28 -0
  114. package/chunks/{chunk-QLOMT4DL.js → chunk-CXUWFKJG.js} +6 -6
  115. package/chunks/{chunk-7WYDM5OX.js → chunk-CYBPWE5F.js} +1 -1
  116. package/chunks/chunk-D67AGMZF.js +23 -0
  117. package/chunks/chunk-D7PZ7633.js +42 -0
  118. package/chunks/chunk-ELPQUBKJ.js +30 -0
  119. package/chunks/{chunk-D47ZPEUU.js → chunk-EWQDQMIO.js} +6 -6
  120. package/chunks/chunk-EZ22Z22X.js +28 -0
  121. package/chunks/chunk-F4GFAM6X.js +31 -0
  122. package/chunks/chunk-FCB366FH.js +40 -0
  123. package/chunks/chunk-FI675VZO.js +11609 -0
  124. package/chunks/chunk-FRJBHV4A.js +21 -0
  125. package/chunks/chunk-G4Y2EOVP.js +18 -0
  126. package/chunks/chunk-GGYWRA4A.js +231 -0
  127. package/chunks/chunk-GKCKBPY2.js +16 -0
  128. package/chunks/chunk-GZIEUPBF.js +18 -0
  129. package/chunks/chunk-HX5PHI2P.js +42 -0
  130. package/chunks/chunk-IFZ4CMF4.js +16 -0
  131. package/chunks/chunk-JAENHN5Z.js +42 -0
  132. package/chunks/chunk-JNQPNZTB.js +42 -0
  133. package/chunks/{chunk-476BHNJO.js → chunk-JQAOGZPV.js} +1 -1
  134. package/chunks/chunk-JV6I54AC.js +16 -0
  135. package/chunks/chunk-KOD5LUT3.js +28 -0
  136. package/chunks/{chunk-DABLUUMY.js → chunk-KQCU3AXU.js} +4 -4
  137. package/chunks/{chunk-SX4DSRPU.js → chunk-KRICEY6O.js} +3 -3
  138. package/chunks/chunk-KUT7FQGS.js +16 -0
  139. package/chunks/chunk-LJO4SDD2.js +79 -0
  140. package/chunks/{chunk-46HTGOCE.js → chunk-LQ2H2YVS.js} +25 -21
  141. package/chunks/chunk-LQ3PCG4Z.js +18 -0
  142. package/chunks/chunk-LRBVQNQI.js +40 -0
  143. package/chunks/{chunk-LXZULGNN.js → chunk-LSZVKXDZ.js} +10 -10
  144. package/chunks/chunk-LV4WOREW.js +40 -0
  145. package/chunks/chunk-LVCQ3CSC.js +21 -0
  146. package/chunks/chunk-M32C4GP2.js +15 -0
  147. package/chunks/{chunk-IPLOZP7L.js → chunk-MJFB3YE6.js} +2 -2
  148. package/chunks/chunk-MJMBDBEH.js +69 -0
  149. package/chunks/chunk-NFSRT4ED.js +18 -0
  150. package/chunks/chunk-NHKKX4F7.js +18 -0
  151. package/chunks/{chunk-5B7VSD44.js → chunk-NJVVOZVZ.js} +4 -4
  152. package/chunks/{chunk-F6CB5TEO.js → chunk-NWGNIT4B.js} +2 -2
  153. package/chunks/chunk-O3V5DTNL.js +40 -0
  154. package/chunks/chunk-O6TWC4IK.js +56 -0
  155. package/chunks/{chunk-IH25CV3F.js → chunk-OAGKCS7I.js} +6 -2
  156. package/chunks/chunk-OMLGI3Y2.js +16 -0
  157. package/chunks/chunk-OT4SVHDX.js +11609 -0
  158. package/chunks/{chunk-PDHAMES3.js → chunk-PFYLNAAX.js} +6 -2
  159. package/chunks/{chunk-X4XXZ44B.js → chunk-Q2SKOY7I.js} +11 -11
  160. package/chunks/chunk-QTF7LWGT.js +28 -0
  161. package/chunks/{chunk-YXJXNTCV.js → chunk-QTPSR7ZJ.js} +15 -15
  162. package/chunks/chunk-R4BWUNSM.js +28 -0
  163. package/chunks/chunk-REXT5ZMP.js +32 -0
  164. package/chunks/{chunk-7UDN6KBA.js → chunk-RNLVCCL2.js} +3 -3
  165. package/chunks/chunk-RXBMGIPJ.js +42 -0
  166. package/chunks/chunk-SEYXG56Q.js +23 -0
  167. package/chunks/chunk-SP7EOGMF.js +30 -0
  168. package/chunks/{chunk-2EEVPIJE.js → chunk-SX2M5777.js} +38 -38
  169. package/chunks/chunk-TQHR6A2P.js +40 -0
  170. package/chunks/chunk-TSAR3HF6.js +35 -0
  171. package/chunks/chunk-U2KKX7UV.js +19 -0
  172. package/chunks/{chunk-YMRAUWRW.js → chunk-UEAMPAHK.js} +10 -2
  173. package/chunks/{chunk-6PIGLFM3.js → chunk-UJ5LGWZL.js} +1 -1
  174. package/chunks/chunk-UX2O74SG.js +42 -0
  175. package/chunks/chunk-UXEKCYL7.js +28 -0
  176. package/chunks/{chunk-PLIJVLAB.js → chunk-VEKKX6Z5.js} +1 -1
  177. package/chunks/{chunk-RCWLMVSZ.js → chunk-VJHE6WHS.js} +5 -5
  178. package/chunks/chunk-VSM742EZ.js +40 -0
  179. package/chunks/{chunk-2JKV6KXE.js → chunk-W3G73JUU.js} +3 -3
  180. package/chunks/{chunk-W5LE6YQ5.js → chunk-WG56WT6T.js} +5 -1
  181. package/chunks/{chunk-MAOVZE34.js → chunk-WHLM3KTR.js} +1 -1
  182. package/chunks/chunk-WKGSTVTK.js +28 -0
  183. package/chunks/chunk-WMDZHUBQ.js +56 -0
  184. package/chunks/chunk-WS3JRFP7.js +69 -0
  185. package/chunks/{chunk-FZJUZYTP.js → chunk-XNJYYULL.js} +38 -38
  186. package/chunks/chunk-XNWEMAIP.js +42 -0
  187. package/chunks/{chunk-Z4PVE6SR.js → chunk-XOUITWSM.js} +6 -6
  188. package/chunks/{chunk-4DNPGCIM.js → chunk-XOXH4XNN.js} +3 -3
  189. package/chunks/chunk-XQ4V4LVP.js +28 -0
  190. package/chunks/{chunk-55MT7BMY.js → chunk-Y6EREGHZ.js} +5 -1
  191. package/chunks/{chunk-HGSQCJ55.js → chunk-YB2KZLMN.js} +15 -15
  192. package/chunks/{chunk-7U5NS3AR.js → chunk-YDIFL3IZ.js} +3 -3
  193. package/chunks/chunk-YJE3G6BE.js +16 -0
  194. package/chunks/chunk-YVWQXQTE.js +42 -0
  195. package/chunks/chunk-ZH3QMMVD.js +28 -0
  196. package/chunks/{chunk-JMJZCVSA.js → chunk-ZN6IQRZT.js} +16 -16
  197. package/chunks/chunk-ZQY2MR66.js +42 -0
  198. package/chunks/chunk-ZUQEHFGL.js +42 -0
  199. package/node/@aws-s3/index.js +5 -5
  200. package/node/@aws-s3/storage/file/index.js +4 -4
  201. package/node/@aws-s3/storage/index.js +5 -5
  202. package/node/@google-cloud/index.js +8 -8
  203. package/node/@google-cloud/storage/file/index.js +9 -9
  204. package/node/@google-cloud/storage/index.js +10 -10
  205. package/node/cloud-storage/index.js +16 -16
  206. package/node/cloud-storage/operations/index.js +22 -22
  207. package/node/files/index.js +3 -3
  208. package/node/ftps/file/index.js +4 -4
  209. package/node/ftps/index.js +4 -4
  210. package/node/images/format/index.js +2 -2
  211. package/node/images/index.js +35 -35
  212. package/node/images/prepare/index.js +35 -35
  213. package/node/images/transform/_utils/color-schema/index.js +2 -2
  214. package/node/images/transform/_utils/positions/index.d.ts +8 -22
  215. package/node/images/transform/_utils/positions/index.js +2 -2
  216. package/node/images/transform/blur/index.js +2 -2
  217. package/node/images/transform/brighten/index.js +2 -2
  218. package/node/images/transform/compose/index.js +4 -4
  219. package/node/images/transform/extend/index.js +3 -3
  220. package/node/images/transform/extract/index.js +2 -2
  221. package/node/images/transform/flatten/index.js +3 -3
  222. package/node/images/transform/flip/index.js +2 -2
  223. package/node/images/transform/flop/index.js +2 -2
  224. package/node/images/transform/frame/backgrounds/create-line-background/index.d.ts +34 -127
  225. package/node/images/transform/frame/backgrounds/create-line-background/index.js +2 -2
  226. package/node/images/transform/frame/backgrounds/create-tile-background/index.d.ts +75 -76
  227. package/node/images/transform/frame/backgrounds/create-tile-background/index.js +2 -2
  228. package/node/images/transform/frame/index.js +6 -6
  229. package/node/images/transform/hue-rotate/index.js +2 -2
  230. package/node/images/transform/index.js +33 -33
  231. package/node/images/transform/lighten/index.js +2 -2
  232. package/node/images/transform/lineate-levels/index.js +2 -2
  233. package/node/images/transform/modulate/index.js +2 -2
  234. package/node/images/transform/normalize/index.js +2 -2
  235. package/node/images/transform/operations/_utils/frame/backgrounds/create-line-background/index.js +4 -4
  236. package/node/images/transform/operations/_utils/frame/create-color-palette/index.js +5 -5
  237. package/node/images/transform/operations/_utils/frame/index.js +8 -8
  238. package/node/images/transform/resize/index.js +3 -3
  239. package/node/images/transform/rotate/index.js +2 -2
  240. package/node/images/transform/saturate/index.js +2 -2
  241. package/node/images/transform/scale/index.js +3 -3
  242. package/node/sftp/file/index.js +4 -4
  243. package/node/sftp/index.js +4 -4
  244. package/package.json +9 -7
  245. package/chunks/chunk-26QQ56SS.js +0 -36
  246. package/chunks/chunk-2H5RIOJO.js +0 -16
  247. package/chunks/chunk-2HU2AWWJ.js +0 -35
  248. package/chunks/chunk-2M5P5V6U.js +0 -56
  249. package/chunks/chunk-2PNFMIXN.js +0 -20
  250. package/chunks/chunk-2VXYXVV2.js +0 -164
  251. package/chunks/chunk-32FNUJVW.js +0 -31
  252. package/chunks/chunk-334MFRHI.js +0 -56
  253. package/chunks/chunk-336RBB5E.js +0 -151
  254. package/chunks/chunk-33YK4WOA.js +0 -18
  255. package/chunks/chunk-36CTYZYA.js +0 -28
  256. package/chunks/chunk-3CZNTEF7.js +0 -151
  257. package/chunks/chunk-3KN4IIQU.js +0 -23
  258. package/chunks/chunk-3LPD7IXF.js +0 -56
  259. package/chunks/chunk-3UM5CZA5.js +0 -18
  260. package/chunks/chunk-3XNFVOJF.js +0 -20
  261. package/chunks/chunk-422KBDRV.js +0 -203
  262. package/chunks/chunk-454MZ5UE.js +0 -239
  263. package/chunks/chunk-45WKBXSF.js +0 -39
  264. package/chunks/chunk-4A2IILES.js +0 -16
  265. package/chunks/chunk-4ARTWFW5.js +0 -164
  266. package/chunks/chunk-4CAHGPFA.js +0 -32
  267. package/chunks/chunk-4HLAM4RP.js +0 -191
  268. package/chunks/chunk-4OCP2WZM.js +0 -100
  269. package/chunks/chunk-4PJWXOLA.js +0 -16
  270. package/chunks/chunk-4QHGUANF.js +0 -19
  271. package/chunks/chunk-4TGRV2AB.js +0 -18
  272. package/chunks/chunk-4WM6K5IZ.js +0 -30
  273. package/chunks/chunk-4WZEYD3R.js +0 -56
  274. package/chunks/chunk-55EDDDIA.js +0 -16
  275. package/chunks/chunk-5GBYBDYQ.js +0 -36
  276. package/chunks/chunk-5IPSIDXB.js +0 -31
  277. package/chunks/chunk-5J7H5WYC.js +0 -82
  278. package/chunks/chunk-5JAITHS2.js +0 -48
  279. package/chunks/chunk-5JNJVGDX.js +0 -20
  280. package/chunks/chunk-5M7ZTA56.js +0 -43
  281. package/chunks/chunk-5OBHNGEH.js +0 -20
  282. package/chunks/chunk-5RGHYFQH.js +0 -70
  283. package/chunks/chunk-5SWBMXLR.js +0 -98
  284. package/chunks/chunk-5YIC7NDS.js +0 -18
  285. package/chunks/chunk-662SOZWA.js +0 -19
  286. package/chunks/chunk-6EIF24H5.js +0 -35
  287. package/chunks/chunk-6HPXM6ED.js +0 -20
  288. package/chunks/chunk-6IZ5HUJJ.js +0 -21
  289. package/chunks/chunk-6V7VQ32U.js +0 -56
  290. package/chunks/chunk-6WVNJVBE.js +0 -34
  291. package/chunks/chunk-6Y7RZ5WD.js +0 -48
  292. package/chunks/chunk-6Z6GDMOR.js +0 -28
  293. package/chunks/chunk-6ZBDBWLW.js +0 -164
  294. package/chunks/chunk-76QORXDC.js +0 -19
  295. package/chunks/chunk-7BCQCDGQ.js +0 -31
  296. package/chunks/chunk-7DDXALPH.js +0 -49
  297. package/chunks/chunk-7FJKDVBE.js +0 -49
  298. package/chunks/chunk-7JUKBN7P.js +0 -54
  299. package/chunks/chunk-7N7BJA6C.js +0 -36
  300. package/chunks/chunk-7OK5NZTY.js +0 -18
  301. package/chunks/chunk-7SS2R4B6.js +0 -82
  302. package/chunks/chunk-7SZ3QPTM.js +0 -191
  303. package/chunks/chunk-7YSTZ7GY.js +0 -31
  304. package/chunks/chunk-7Z7CKAOH.js +0 -98
  305. package/chunks/chunk-A6OSVHIK.js +0 -20
  306. package/chunks/chunk-ADTQQNIQ.js +0 -47
  307. package/chunks/chunk-AHSYVIOF.js +0 -18
  308. package/chunks/chunk-AIESW26U.js +0 -47
  309. package/chunks/chunk-AMXIZUFB.js +0 -16
  310. package/chunks/chunk-AUJB3IJD.js +0 -20
  311. package/chunks/chunk-AZLVQV5A.js +0 -39
  312. package/chunks/chunk-AZOSX3LU.js +0 -191
  313. package/chunks/chunk-B446JIN3.js +0 -29
  314. package/chunks/chunk-B4XUXE7E.js +0 -18
  315. package/chunks/chunk-B5XLWFTJ.js +0 -20
  316. package/chunks/chunk-BANYGSW4.js +0 -20
  317. package/chunks/chunk-BGZ5OVVN.js +0 -20
  318. package/chunks/chunk-BONBND7I.js +0 -239
  319. package/chunks/chunk-BPBWY4OT.js +0 -191
  320. package/chunks/chunk-BQMQIW77.js +0 -69
  321. package/chunks/chunk-BWKM2VQJ.js +0 -191
  322. package/chunks/chunk-BWXVJB4I.js +0 -20
  323. package/chunks/chunk-BZHH4R64.js +0 -20
  324. package/chunks/chunk-C3ZKLONL.js +0 -21
  325. package/chunks/chunk-CHA42BGS.js +0 -48
  326. package/chunks/chunk-CHUOCTRP.js +0 -26
  327. package/chunks/chunk-CKCTYZF7.js +0 -48
  328. package/chunks/chunk-CM6AHRTS.js +0 -16
  329. package/chunks/chunk-CMWR77VW.js +0 -54
  330. package/chunks/chunk-CSZFW4R5.js +0 -69
  331. package/chunks/chunk-CYIUZX2T.js +0 -31
  332. package/chunks/chunk-D33KC6NN.js +0 -18
  333. package/chunks/chunk-D5E2CIDK.js +0 -20
  334. package/chunks/chunk-DAOJPBZ6.js +0 -18
  335. package/chunks/chunk-DEQ5N53D.js +0 -21
  336. package/chunks/chunk-DHCDZVLA.js +0 -19
  337. package/chunks/chunk-DPBYDWV3.js +0 -2369
  338. package/chunks/chunk-DTETQT5O.js +0 -15
  339. package/chunks/chunk-DW4ILX77.js +0 -28
  340. package/chunks/chunk-E2BDKTLL.js +0 -48
  341. package/chunks/chunk-E3GK7YZ7.js +0 -65
  342. package/chunks/chunk-E4RVKTMW.js +0 -56
  343. package/chunks/chunk-E6HDM2M4.js +0 -191
  344. package/chunks/chunk-E7J4E6OB.js +0 -65
  345. package/chunks/chunk-EA4L7AGZ.js +0 -48
  346. package/chunks/chunk-EBVYO2TY.js +0 -48
  347. package/chunks/chunk-ECGOI4MT.js +0 -20
  348. package/chunks/chunk-ECWDSMDZ.js +0 -20
  349. package/chunks/chunk-EM37BFXO.js +0 -35
  350. package/chunks/chunk-FCLAFRIW.js +0 -177
  351. package/chunks/chunk-FCMQVBJW.js +0 -20
  352. package/chunks/chunk-FFNIZRZU.js +0 -31
  353. package/chunks/chunk-FHHXI6WC.js +0 -31
  354. package/chunks/chunk-FIVB3FON.js +0 -56
  355. package/chunks/chunk-FJ3NTVCG.js +0 -18
  356. package/chunks/chunk-FMRPJBUC.js +0 -20
  357. package/chunks/chunk-FNJX5BML.js +0 -23
  358. package/chunks/chunk-FRP47Y6H.js +0 -2456
  359. package/chunks/chunk-FTT6ZCCS.js +0 -29
  360. package/chunks/chunk-FVFYLT5T.js +0 -31
  361. package/chunks/chunk-G2M3VECP.js +0 -20
  362. package/chunks/chunk-G3HAKMUB.js +0 -79
  363. package/chunks/chunk-G5UR6736.js +0 -31
  364. package/chunks/chunk-G66DWXF3.js +0 -31
  365. package/chunks/chunk-GCHQD7MH.js +0 -63
  366. package/chunks/chunk-GD6Y5QJV.js +0 -98
  367. package/chunks/chunk-GOTTGEXI.js +0 -23
  368. package/chunks/chunk-GRDFCI63.js +0 -21
  369. package/chunks/chunk-GSZSM3BU.js +0 -37
  370. package/chunks/chunk-GVS2ZPGJ.js +0 -2456
  371. package/chunks/chunk-GXICX4F6.js +0 -31
  372. package/chunks/chunk-H73SGDQI.js +0 -20
  373. package/chunks/chunk-H7LDIXVY.js +0 -48
  374. package/chunks/chunk-HALUZA2X.js +0 -16
  375. package/chunks/chunk-HBKSSDSX.js +0 -20
  376. package/chunks/chunk-HDK7W7GS.js +0 -20
  377. package/chunks/chunk-HFH6DXXC.js +0 -2456
  378. package/chunks/chunk-HFIE4SBE.js +0 -16
  379. package/chunks/chunk-HFV7VACE.js +0 -191
  380. package/chunks/chunk-HGQGQLLC.js +0 -4430
  381. package/chunks/chunk-HNKD4ZRZ.js +0 -177
  382. package/chunks/chunk-HUC2IRGW.js +0 -205
  383. package/chunks/chunk-HUT6SDJH.js +0 -2369
  384. package/chunks/chunk-HV2AHV5R.js +0 -164
  385. package/chunks/chunk-HZGGYNZ5.js +0 -2369
  386. package/chunks/chunk-I37MGRCT.js +0 -20
  387. package/chunks/chunk-IARWH6LC.js +0 -34
  388. package/chunks/chunk-IJAFLBHD.js +0 -16
  389. package/chunks/chunk-ISFXCV7D.js +0 -20
  390. package/chunks/chunk-IUURENUN.js +0 -22
  391. package/chunks/chunk-IWWAMCNR.js +0 -16
  392. package/chunks/chunk-IXM6DCIE.js +0 -151
  393. package/chunks/chunk-IYV3EEYX.js +0 -20
  394. package/chunks/chunk-J35QFU6O.js +0 -21
  395. package/chunks/chunk-JBDWHJ4Q.js +0 -31
  396. package/chunks/chunk-JBUM5Q5C.js +0 -48
  397. package/chunks/chunk-JBZR6R5B.js +0 -15
  398. package/chunks/chunk-JJ7PBKSG.js +0 -37
  399. package/chunks/chunk-JJWKHBXD.js +0 -68
  400. package/chunks/chunk-JLXITDAV.js +0 -48
  401. package/chunks/chunk-JMA64OLZ.js +0 -191
  402. package/chunks/chunk-JQRLQUMJ.js +0 -16
  403. package/chunks/chunk-JR76DLSV.js +0 -151
  404. package/chunks/chunk-JS3NE4VI.js +0 -2456
  405. package/chunks/chunk-JSKVNOTW.js +0 -56
  406. package/chunks/chunk-JUF5GSDE.js +0 -37
  407. package/chunks/chunk-JWF5EKM2.js +0 -127
  408. package/chunks/chunk-JX45LILQ.js +0 -164
  409. package/chunks/chunk-JYYW4KOZ.js +0 -72
  410. package/chunks/chunk-K4Q2MG65.js +0 -56
  411. package/chunks/chunk-K66UXFDQ.js +0 -63
  412. package/chunks/chunk-KBCULP7X.js +0 -177
  413. package/chunks/chunk-KC76PUJY.js +0 -48
  414. package/chunks/chunk-KDTKA3SG.js +0 -31
  415. package/chunks/chunk-KFMYB672.js +0 -31
  416. package/chunks/chunk-KH5JTC2N.js +0 -49
  417. package/chunks/chunk-KL6EJPC3.js +0 -35
  418. package/chunks/chunk-KN23H4CI.js +0 -20
  419. package/chunks/chunk-KTK3BMX2.js +0 -56
  420. package/chunks/chunk-L7EUEQZP.js +0 -0
  421. package/chunks/chunk-LFSYWGO5.js +0 -31
  422. package/chunks/chunk-LH6Z6NJY.js +0 -191
  423. package/chunks/chunk-LMPEBXSU.js +0 -31
  424. package/chunks/chunk-LOAOXFA2.js +0 -2369
  425. package/chunks/chunk-LOY7C5BP.js +0 -151
  426. package/chunks/chunk-LSOHLSF5.js +0 -32
  427. package/chunks/chunk-LVBXPZUO.js +0 -104
  428. package/chunks/chunk-LZ4P3AYG.js +0 -2456
  429. package/chunks/chunk-MAE5XZGF.js +0 -37
  430. package/chunks/chunk-MDVYILPB.js +0 -56
  431. package/chunks/chunk-MFK63FMI.js +0 -31
  432. package/chunks/chunk-MFWKY3DT.js +0 -32
  433. package/chunks/chunk-MOBGB2PH.js +0 -54
  434. package/chunks/chunk-MTGZYBK2.js +0 -129
  435. package/chunks/chunk-MTT7TVR3.js +0 -127
  436. package/chunks/chunk-MV2LDBDF.js +0 -164
  437. package/chunks/chunk-MVNQWIVH.js +0 -151
  438. package/chunks/chunk-MW3KNVTG.js +0 -29
  439. package/chunks/chunk-MXGGOCLX.js +0 -56
  440. package/chunks/chunk-MZKZI6JL.js +0 -37
  441. package/chunks/chunk-MZZOFFFT.js +0 -21
  442. package/chunks/chunk-N32W4UQ6.js +0 -16
  443. package/chunks/chunk-N5QAGJXV.js +0 -49
  444. package/chunks/chunk-NA3M6VUU.js +0 -20
  445. package/chunks/chunk-NA7PT2KE.js +0 -21
  446. package/chunks/chunk-NAP2XNYN.js +0 -23
  447. package/chunks/chunk-NFIEXASV.js +0 -164
  448. package/chunks/chunk-NJ4ANCLV.js +0 -65
  449. package/chunks/chunk-NOBTN4IW.js +0 -4471
  450. package/chunks/chunk-NSM7QLE4.js +0 -20
  451. package/chunks/chunk-NZLE2WMY.js +0 -35
  452. package/chunks/chunk-O7UEQQ6H.js +0 -49
  453. package/chunks/chunk-OD33BN4K.js +0 -32
  454. package/chunks/chunk-OPU4CANL.js +0 -35
  455. package/chunks/chunk-OSCBZIZF.js +0 -28
  456. package/chunks/chunk-OSZ4BWDE.js +0 -32
  457. package/chunks/chunk-OUJTDMHK.js +0 -16
  458. package/chunks/chunk-OWCPJD6O.js +0 -16
  459. package/chunks/chunk-OXV3LVNK.js +0 -191
  460. package/chunks/chunk-P3QFJTAE.js +0 -129
  461. package/chunks/chunk-P5OGBBGM.js +0 -37
  462. package/chunks/chunk-PCTJ7TUG.js +0 -191
  463. package/chunks/chunk-PEUWFUEZ.js +0 -98
  464. package/chunks/chunk-PSP2DKDH.js +0 -151
  465. package/chunks/chunk-Q2ZS3QNB.js +0 -151
  466. package/chunks/chunk-Q4MSGUKR.js +0 -37
  467. package/chunks/chunk-QAE3OWOI.js +0 -79
  468. package/chunks/chunk-QHQPS7EU.js +0 -31
  469. package/chunks/chunk-QN3UAKIU.js +0 -21
  470. package/chunks/chunk-QPHK5QI7.js +0 -4072
  471. package/chunks/chunk-QPT6R6CL.js +0 -100
  472. package/chunks/chunk-QSSQOTGV.js +0 -20
  473. package/chunks/chunk-QUDIXNB2.js +0 -18
  474. package/chunks/chunk-QVIRBFMQ.js +0 -31
  475. package/chunks/chunk-QWFEYLHG.js +0 -79
  476. package/chunks/chunk-R6F2MFZZ.js +0 -173
  477. package/chunks/chunk-R7J7Q2UL.js +0 -20
  478. package/chunks/chunk-RDIF5NJQ.js +0 -151
  479. package/chunks/chunk-REN2I723.js +0 -98
  480. package/chunks/chunk-RGGOIE34.js +0 -20
  481. package/chunks/chunk-RLTBF5FT.js +0 -23
  482. package/chunks/chunk-RPWYARS3.js +0 -18
  483. package/chunks/chunk-RQECU6DI.js +0 -56
  484. package/chunks/chunk-RVZ32GPI.js +0 -55
  485. package/chunks/chunk-S2PB2PLY.js +0 -191
  486. package/chunks/chunk-SA2IY5LN.js +0 -35
  487. package/chunks/chunk-SARTUWB5.js +0 -20
  488. package/chunks/chunk-SC54OKBX.js +0 -43
  489. package/chunks/chunk-SDFTYOAK.js +0 -20
  490. package/chunks/chunk-SJFY537W.js +0 -84
  491. package/chunks/chunk-SLCGLOYM.js +0 -37
  492. package/chunks/chunk-SNRRHDIZ.js +0 -31
  493. package/chunks/chunk-SZQHLC4K.js +0 -31
  494. package/chunks/chunk-T2T5BYTW.js +0 -18
  495. package/chunks/chunk-T55QIYYV.js +0 -32
  496. package/chunks/chunk-T6IC7JVI.js +0 -37
  497. package/chunks/chunk-TC7A4P5S.js +0 -34
  498. package/chunks/chunk-TDOBYMTK.js +0 -56
  499. package/chunks/chunk-TEBR4NTW.js +0 -37
  500. package/chunks/chunk-TP6V6CBV.js +0 -177
  501. package/chunks/chunk-TPMYILTC.js +0 -191
  502. package/chunks/chunk-TU3UWOAE.js +0 -56
  503. package/chunks/chunk-TXGV4KJD.js +0 -31
  504. package/chunks/chunk-TZ7MNWDS.js +0 -20
  505. package/chunks/chunk-U3L3X27Q.js +0 -177
  506. package/chunks/chunk-U4UHXVMV.js +0 -37
  507. package/chunks/chunk-U5WEI3QA.js +0 -18
  508. package/chunks/chunk-U7CF7IDN.js +0 -35
  509. package/chunks/chunk-U7R6TPHR.js +0 -15
  510. package/chunks/chunk-UBCUVSEV.js +0 -35
  511. package/chunks/chunk-UERX6XGZ.js +0 -21
  512. package/chunks/chunk-UFKH5WD2.js +0 -21
  513. package/chunks/chunk-UJN2WZGO.js +0 -32
  514. package/chunks/chunk-UNHNZAVP.js +0 -18
  515. package/chunks/chunk-UODICVLG.js +0 -173
  516. package/chunks/chunk-UUSZJMJB.js +0 -37
  517. package/chunks/chunk-UUU6DWRQ.js +0 -79
  518. package/chunks/chunk-UVSTFYSD.js +0 -28
  519. package/chunks/chunk-UYRX3PTS.js +0 -2456
  520. package/chunks/chunk-UZPXYAJR.js +0 -177
  521. package/chunks/chunk-V4KSJHTU.js +0 -20
  522. package/chunks/chunk-V4S34MIM.js +0 -32
  523. package/chunks/chunk-VDT6ODFV.js +0 -20
  524. package/chunks/chunk-VHAGPTVR.js +0 -37
  525. package/chunks/chunk-VHPX7UA3.js +0 -177
  526. package/chunks/chunk-VLC7LRED.js +0 -191
  527. package/chunks/chunk-VLHSIIPO.js +0 -20
  528. package/chunks/chunk-VQUF2TSY.js +0 -191
  529. package/chunks/chunk-VR5JHUKK.js +0 -32
  530. package/chunks/chunk-VSBRIQPH.js +0 -48
  531. package/chunks/chunk-VWLJ5IEE.js +0 -31
  532. package/chunks/chunk-W6JPRXQ4.js +0 -16
  533. package/chunks/chunk-WC2LQPQP.js +0 -26
  534. package/chunks/chunk-WDXNM5YB.js +0 -20
  535. package/chunks/chunk-WGQHXHXS.js +0 -31
  536. package/chunks/chunk-WH5V6GK7.js +0 -56
  537. package/chunks/chunk-WHAUJMMG.js +0 -32
  538. package/chunks/chunk-WIJBRYJ6.js +0 -20
  539. package/chunks/chunk-WJYMX7SS.js +0 -21
  540. package/chunks/chunk-WLGIDY6A.js +0 -2456
  541. package/chunks/chunk-WMSE5GRO.js +0 -63
  542. package/chunks/chunk-WO2R3QFK.js +0 -20
  543. package/chunks/chunk-WOGRENMM.js +0 -31
  544. package/chunks/chunk-WQKFVIUF.js +0 -37
  545. package/chunks/chunk-WR64YJNW.js +0 -20
  546. package/chunks/chunk-WRRA3BN4.js +0 -31
  547. package/chunks/chunk-WTILPGGX.js +0 -69
  548. package/chunks/chunk-WU3JQC7W.js +0 -164
  549. package/chunks/chunk-WU7NORZV.js +0 -191
  550. package/chunks/chunk-X244JGZD.js +0 -69
  551. package/chunks/chunk-X24BLY5H.js +0 -31
  552. package/chunks/chunk-X34YXAEL.js +0 -31
  553. package/chunks/chunk-X5FAZBWL.js +0 -130
  554. package/chunks/chunk-X6WCMUOP.js +0 -18
  555. package/chunks/chunk-X7KWB2VQ.js +0 -21
  556. package/chunks/chunk-XAZT2MME.js +0 -56
  557. package/chunks/chunk-XB3YCG6I.js +0 -48
  558. package/chunks/chunk-XB3ZOIHH.js +0 -2456
  559. package/chunks/chunk-XEAHMN2T.js +0 -4063
  560. package/chunks/chunk-XEMFIV2W.js +0 -177
  561. package/chunks/chunk-XF5QBETN.js +0 -48
  562. package/chunks/chunk-XN44EWRS.js +0 -21
  563. package/chunks/chunk-XQMUFSLU.js +0 -16
  564. package/chunks/chunk-XRUSQWPJ.js +0 -173
  565. package/chunks/chunk-XSVBWVVC.js +0 -20
  566. package/chunks/chunk-XVYKCWPR.js +0 -48
  567. package/chunks/chunk-XZ7II65Z.js +0 -31
  568. package/chunks/chunk-Y5GGIBPI.js +0 -31
  569. package/chunks/chunk-Y7YEYHRZ.js +0 -69
  570. package/chunks/chunk-YCSC7QNV.js +0 -30
  571. package/chunks/chunk-YE67BQQN.js +0 -4072
  572. package/chunks/chunk-YEYXAV23.js +0 -16
  573. package/chunks/chunk-YLJBKSLO.js +0 -56
  574. package/chunks/chunk-YLKBLE6G.js +0 -30
  575. package/chunks/chunk-YMF7CUJA.js +0 -20
  576. package/chunks/chunk-YMRGCRQ4.js +0 -48
  577. package/chunks/chunk-YRQ7LODK.js +0 -177
  578. package/chunks/chunk-YSDPTGYO.js +0 -31
  579. package/chunks/chunk-YUJJEKYY.js +0 -144
  580. package/chunks/chunk-YVEMIEOT.js +0 -203
  581. package/chunks/chunk-YW5ASSIQ.js +0 -31
  582. package/chunks/chunk-YYA5VRE4.js +0 -177
  583. package/chunks/chunk-YZYA7LFK.js +0 -20
  584. package/chunks/chunk-Z2CU55CF.js +0 -20
  585. package/chunks/chunk-Z6ZTRJ67.js +0 -177
  586. package/chunks/chunk-ZBQEB3X7.js +0 -4430
  587. package/chunks/chunk-ZLNDBNP4.js +0 -31
  588. package/chunks/chunk-ZMMNN3QA.js +0 -16
  589. package/chunks/chunk-ZQ7ZC7TZ.js +0 -56
  590. package/chunks/chunk-ZSPOYMNQ.js +0 -151
  591. package/chunks/chunk-ZVBMPJLH.js +0 -48
  592. package/chunks/chunk-ZVZAGTIT.js +0 -151
  593. package/chunks/chunk-ZZH6RUS3.js +0 -48
  594. package/node/@design-edito/thumbnails/colors/index.d.ts +0 -38
  595. package/node/@design-edito/thumbnails/colors/index.js +0 -33
  596. package/node/@design-edito/thumbnails/common/index.d.ts +0 -5
  597. package/node/@design-edito/thumbnails/common/index.js +0 -15
  598. package/node/@design-edito/thumbnails/easings/index.d.ts +0 -8
  599. package/node/@design-edito/thumbnails/easings/index.js +0 -21
  600. package/node/@design-edito/thumbnails/layout/index.d.ts +0 -63
  601. package/node/@design-edito/thumbnails/layout/index.js +0 -31
  602. package/node/@google-cloud/storage/bucket/list/index.d.ts +0 -17
  603. package/node/@google-cloud/storage/bucket/list/index.js +0 -9
  604. package/node/@google-cloud/storage/file/erase/index.d.ts +0 -20
  605. package/node/@google-cloud/storage/file/erase/index.js +0 -9
  606. package/node/cloud-storage/client/index.d.ts +0 -14
  607. package/node/cloud-storage/client/index.js +0 -20
  608. package/node/cloud-storage/credentials/index.d.ts +0 -39
  609. package/node/cloud-storage/credentials/index.js +0 -18
  610. package/node/cloud-storage/endpoint/index.d.ts +0 -24
  611. package/node/cloud-storage/endpoint/index.js +0 -13
  612. package/node/cloud-storage/operations/download/index.d.ts +0 -5
  613. package/node/cloud-storage/operations/download/index.js +0 -14
  614. package/node/cloud-storage/operations/upload/index.d.ts +0 -5
  615. package/node/cloud-storage/operations/upload/index.js +0 -14
  616. package/node/images/exports/index.d.ts +0 -15
  617. package/node/images/exports/index.js +0 -9
  618. package/node/images/transform/area-composition/index.d.ts +0 -60
  619. package/node/images/transform/area-composition/index.js +0 -15
  620. package/node/images/transform/operations/area-composition/area-line-composition/index.d.ts +0 -19
  621. package/node/images/transform/operations/area-composition/area-line-composition/index.js +0 -14
  622. package/node/images/transform/operations/area-composition/area-tile-composition/index.d.ts +0 -30
  623. package/node/images/transform/operations/area-composition/area-tile-composition/index.js +0 -15
  624. package/node/images/transform/operations/area-composition/index.d.ts +0 -31
  625. package/node/images/transform/operations/area-composition/index.js +0 -15
  626. package/node/images/transform/operations/inner-resize/index.d.ts +0 -25
  627. package/node/images/transform/operations/inner-resize/index.js +0 -13
  628. package/chunks/{chunk-2RUBEK4A.js → chunk-3BSVGWTK.js} +12 -12
  629. package/chunks/{chunk-INGSSBWK.js → chunk-3RLCDQOJ.js} +8 -8
  630. package/chunks/{chunk-3G7KHSKB.js → chunk-4BPSIDYW.js} +15 -15
  631. package/chunks/{chunk-45LGGA3Z.js → chunk-4EFX53Y4.js} +7 -7
  632. package/chunks/{chunk-IWZAUQGO.js → chunk-6LDTWID7.js} +8 -8
  633. package/chunks/{chunk-PENYZ6S7.js → chunk-7HSB4A2G.js} +8 -8
  634. package/chunks/{chunk-6ET4XJLF.js → chunk-AY7SJG3R.js} +7 -7
  635. package/chunks/{chunk-OD7GR6ZF.js → chunk-CAV4FNVR.js} +11 -11
  636. package/chunks/{chunk-KBFSUJ57.js → chunk-HD7QU6D6.js} +6 -6
  637. package/chunks/{chunk-RTUTFCLC.js → chunk-HRWQVASA.js} +6 -6
  638. package/chunks/{chunk-IIMP6YT7.js → chunk-HY4V3SPP.js} +14 -14
  639. package/chunks/{chunk-3DL3U7UR.js → chunk-LNL6TUDC.js} +8 -8
  640. package/chunks/{chunk-4Y5XR6WC.js → chunk-OL4JB46K.js} +14 -14
  641. package/chunks/{chunk-766BSKLU.js → chunk-PGT5NXPS.js} +3 -3
  642. package/chunks/{chunk-YVLZX2JQ.js → chunk-SHXOKSK3.js} +3 -3
  643. package/chunks/{chunk-56OEXCBD.js → chunk-VISMB7RN.js} +11 -11
  644. package/chunks/{chunk-AQTNG5G4.js → chunk-Z4B2Z7QO.js} +18 -18
  645. package/chunks/{chunk-236C4IHT.js → chunk-ZKAK6JOS.js} +6 -6
@@ -1,2456 +0,0 @@
1
- import {
2
- array
3
- } from "./chunk-QAQZEKIF.js";
4
- import {
5
- nullFunc
6
- } from "./chunk-QAVYONH6.js";
7
- import {
8
- Types
9
- } from "./chunk-XEQ2PBT2.js";
10
- import {
11
- any
12
- } from "./chunk-FHLCPVND.js";
13
- import {
14
- SmartTags
15
- } from "./chunk-UT2J62LH.js";
16
- import {
17
- Serialize
18
- } from "./chunk-SXRWMH3U.js";
19
- import {
20
- Transformer
21
- } from "./chunk-BKO7GLC2.js";
22
- import {
23
- Method
24
- } from "./chunk-RW7VAKJW.js";
25
- import {
26
- insertNode
27
- } from "./chunk-XA4HVHJ4.js";
28
- import {
29
- isInEnum
30
- } from "./chunk-E6MSDKON.js";
31
- import {
32
- isRecord
33
- } from "./chunk-YDIBNEGA.js";
34
- import {
35
- recordMap
36
- } from "./chunk-XNF5MLCQ.js";
37
- import {
38
- replaceAll
39
- } from "./chunk-ZTDVUXPR.js";
40
- import {
41
- trimEnd,
42
- trimStart
43
- } from "./chunk-6XL25OZX.js";
44
- import {
45
- Outcome
46
- } from "./chunk-JMU5PDBD.js";
47
- import {
48
- Window
49
- } from "./chunk-RLJOYG64.js";
50
-
51
- // src/agnostic/html/hyper-json/cast/index.ts
52
- var Cast;
53
- ((Cast2) => {
54
- Cast2.toNull = () => null;
55
- Cast2.toBoolean = (input) => {
56
- const { Text: Text2 } = Window.get();
57
- if (input === null) return false;
58
- if (typeof input === "boolean") return input;
59
- if (typeof input === "number") return input !== 0;
60
- if (typeof input === "string" || input instanceof Text2) {
61
- const strInput = (0, Cast2.toString)(input);
62
- if (strInput.trim() === "") return false;
63
- if (strInput.trim().toLowerCase() === "false") return false;
64
- return true;
65
- }
66
- return true;
67
- };
68
- Cast2.toNumber = (input) => {
69
- const { Text: Text2 } = Window.get();
70
- if (typeof input === "boolean") return input ? 1 : 0;
71
- if (typeof input === "number") return input;
72
- if (typeof input === "string") return parseFloat(`${input}`);
73
- if (input instanceof Text2) return parseFloat(`${input.textContent}`);
74
- return 0;
75
- };
76
- Cast2.toString = (input) => {
77
- if (typeof input === "string") return input;
78
- if (typeof input === "number" || typeof input === "boolean" || input === null) return `${input}`;
79
- const { Element: Element2, Text: Text2, NodeList } = Window.get();
80
- if (input instanceof Element2) return input.outerHTML;
81
- if (input instanceof Text2) return input.textContent ?? "";
82
- if (input instanceof NodeList) return Array.from(input).map((e) => {
83
- if (e instanceof Element2) return e.outerHTML;
84
- return e.textContent;
85
- }).join("");
86
- if (Array.isArray(input)) return input.map(Cast2.toString).join("");
87
- if (input instanceof Method) return `[Method:${input.transformer.name}]`;
88
- return `{${Object.entries(input).map(([key, val]) => `${key}:"${(0, Cast2.toString)(val)}"`).join(",")}}`;
89
- };
90
- Cast2.toText = (input) => {
91
- const { Text: Text2, document: document2 } = Window.get();
92
- if (input instanceof Text2) return input.cloneNode(true);
93
- return document2.createTextNode((0, Cast2.toString)(input));
94
- };
95
- Cast2.toElement = (input, tagName) => {
96
- const { Element: Element2, Text: Text2, NodeList, document: document2 } = Window.get();
97
- if (input instanceof Element2) return input.cloneNode(true);
98
- const returned = document2.createElement(tagName ?? "div");
99
- if (input instanceof Text2) {
100
- returned.append(input.cloneNode(true));
101
- return returned;
102
- }
103
- if (input instanceof NodeList) {
104
- returned.append(...Array.from(input).map((e) => e.cloneNode(true)));
105
- return returned;
106
- }
107
- if (Array.isArray(input)) return returned;
108
- if (isRecord(input)) return returned;
109
- returned.innerHTML = `${input}`;
110
- return returned;
111
- };
112
- Cast2.toNodeList = (input) => {
113
- const { Element: Element2, Text: Text2, NodeList, document: document2 } = Window.get();
114
- const parentDiv = document2.createElement("div");
115
- if (input instanceof NodeList) {
116
- parentDiv.append(...Array.from(input).map((i) => i.cloneNode(true)));
117
- return parentDiv.childNodes;
118
- }
119
- if (input instanceof Element2 || input instanceof Text2) {
120
- parentDiv.append(input.cloneNode(true));
121
- return parentDiv.childNodes;
122
- }
123
- if (Array.isArray(input)) {
124
- input.forEach((item) => {
125
- if (typeof item === "number" || typeof item === "boolean" || item === null) parentDiv.append(`${item}`);
126
- else if (typeof item === "string" || item instanceof Text2 || item instanceof Element2) parentDiv.append(item);
127
- else if (item instanceof NodeList) parentDiv.append(...Array.from(item));
128
- else if (Array.isArray(item)) parentDiv.append(...Array.from((0, Cast2.toNodeList)(item)));
129
- else parentDiv.append((0, Cast2.toString)(item));
130
- });
131
- return parentDiv.childNodes;
132
- }
133
- if (isRecord(input)) {
134
- parentDiv.append((0, Cast2.toString)(input));
135
- return parentDiv.childNodes;
136
- }
137
- parentDiv.innerHTML = `${input}`;
138
- return parentDiv.childNodes;
139
- };
140
- Cast2.toArray = (input) => {
141
- const { NodeList } = Window.get();
142
- if (Array.isArray(input)) return [...input];
143
- if (input instanceof NodeList) return Array.from(input);
144
- return [input];
145
- };
146
- Cast2.toRecord = (input) => {
147
- const isRecord2 = Utils.Tree.TypeChecks.typeCheck(input, "record");
148
- if (isRecord2.success) return { ...isRecord2.payload };
149
- return {};
150
- };
151
- })(Cast || (Cast = {}));
152
-
153
- // src/agnostic/html/hyper-json/smart-tags/isolated/element/index.ts
154
- var element = SmartTags.makeSmartTag({
155
- name: "element",
156
- defaultMode: "isolation",
157
- isolationInitType: "array",
158
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "string", "text"),
159
- argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "null", "boolean", "number", "string", "text", "element", "nodelist"),
160
- func: (main, args) => {
161
- const tagName = Cast.toString(main).trim().toLowerCase();
162
- const { document: document2, NodeList } = Window.get();
163
- const elt = document2.createElement(tagName);
164
- for (const argVal of args) {
165
- if (argVal instanceof NodeList) elt.append(...Array.from(argVal));
166
- else if (argVal instanceof Element) elt.append(argVal);
167
- else elt.append(Cast.toText(argVal));
168
- }
169
- return Outcome.makeSuccess(elt);
170
- }
171
- });
172
-
173
- // src/agnostic/html/hyper-json/smart-tags/isolated/get/index.ts
174
- var get = SmartTags.makeSmartTag({
175
- name: "get",
176
- defaultMode: "isolation",
177
- isolationInitType: "array",
178
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "string", "text"),
179
- argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
180
- func: (main, _args, { sourceTree }) => {
181
- const { makeSuccess, makeFailure } = Outcome;
182
- const { makeTransformationError } = Utils.SmartTags;
183
- const strName = Cast.toString(main);
184
- const found = sourceTree.getVariable(strName);
185
- if (found === void 0) return makeFailure(makeTransformationError(`No variable stored under the name '${strName}'`));
186
- return makeSuccess(found);
187
- }
188
- });
189
-
190
- // src/agnostic/html/hyper-json/smart-tags/isolated/global/index.ts
191
- var global = SmartTags.makeSmartTag({
192
- name: "global",
193
- defaultMode: "isolation",
194
- isolationInitType: "array",
195
- mainValueCheck: (m) => Outcome.makeSuccess(m),
196
- argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
197
- func: (_m, _a, { sourceTree }) => {
198
- const globalObject = sourceTree.options.globalObject ?? {};
199
- return Outcome.makeSuccess({ ...globalObject });
200
- }
201
- });
202
-
203
- // src/agnostic/html/hyper-json/smart-tags/isolated/guess/index.ts
204
- var guess = SmartTags.makeSmartTag({
205
- name: "guess",
206
- defaultMode: "isolation",
207
- isolationInitType: "string",
208
- mainValueCheck: (m) => Outcome.makeSuccess(m),
209
- argsValueCheck: (a) => Outcome.makeSuccess(a),
210
- func: (main, args) => {
211
- const { typeCheck } = Utils.Tree.TypeChecks;
212
- const { makeSuccess } = Outcome;
213
- let coalesced = main;
214
- for (const arg of args) coalesced = Utils.coalesceValues(coalesced, 0, arg);
215
- const { Text: Text2, Element: Element2, document: document2 } = Window.get();
216
- if (typeof coalesced !== "string" && !(coalesced instanceof Text2)) return makeSuccess(coalesced);
217
- const strCoalesced = Cast.toString(coalesced);
218
- if (strCoalesced.trim().toLowerCase() === "true") return makeSuccess(true);
219
- if (strCoalesced.trim().toLowerCase() === "false") return makeSuccess(false);
220
- if (strCoalesced.trim().toLowerCase().match(/^\s*-?\s*(\d+(\.\d*)?|\.\d+)\s*$/)) return makeSuccess(parseFloat(strCoalesced));
221
- if (strCoalesced.trim().toLowerCase() === "null") return makeSuccess(null);
222
- try {
223
- const parsed = JSON.parse(strCoalesced);
224
- const arrayChecked = typeCheck(parsed, "array");
225
- const recordChecked = typeCheck(parsed, "record");
226
- if (arrayChecked.success) return makeSuccess(arrayChecked.payload);
227
- if (recordChecked.success) return makeSuccess(recordChecked.payload);
228
- } catch (err) {
229
- }
230
- const div = document2.createElement("div");
231
- div.innerHTML = strCoalesced;
232
- const divChildren = div.childNodes;
233
- if (divChildren.length === 0) return makeSuccess(coalesced);
234
- const validDivChildren = Cast.toNodeList(Array.from(divChildren).filter((e) => {
235
- if (e instanceof Element2) return true;
236
- if (e instanceof Text2) return true;
237
- return false;
238
- }));
239
- if (validDivChildren.length > 1) return makeSuccess(validDivChildren);
240
- const validDivFirstchild = validDivChildren.item(0);
241
- if (validDivChildren.length === 1 && validDivFirstchild instanceof Element2) return makeSuccess(validDivFirstchild);
242
- return makeSuccess(coalesced);
243
- }
244
- });
245
-
246
- // src/agnostic/html/hyper-json/smart-tags/isolated/nodelist/index.ts
247
- var nodelist = SmartTags.makeSmartTag({
248
- name: "nodelist",
249
- defaultMode: "isolation",
250
- isolationInitType: "nodelist",
251
- mainValueCheck: (m) => Outcome.makeSuccess(m),
252
- argsValueCheck: (a) => Outcome.makeSuccess(a),
253
- func: (main, args) => {
254
- const { document: document2 } = Window.get();
255
- const returnedParent = document2.createDocumentFragment();
256
- returnedParent.append(
257
- ...Array.from(Cast.toNodeList(main)),
258
- ...Array.from(Cast.toNodeList(args))
259
- );
260
- const returned = returnedParent.childNodes;
261
- return Outcome.makeSuccess(returned);
262
- }
263
- });
264
-
265
- // src/agnostic/html/hyper-json/smart-tags/isolated/number/index.ts
266
- var number = SmartTags.makeSmartTag({
267
- name: "number",
268
- defaultMode: "isolation",
269
- isolationInitType: "number",
270
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "null", "boolean", "number", "string", "text"),
271
- argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "null", "boolean", "number", "string", "text"),
272
- func: (main, args) => {
273
- const all = [main, ...args];
274
- const reduced = all.reduce((reduced2, curr) => {
275
- return reduced2 + Cast.toNumber(curr);
276
- }, 0);
277
- return Outcome.makeSuccess(reduced);
278
- }
279
- });
280
-
281
- // src/agnostic/html/hyper-json/smart-tags/isolated/record/index.ts
282
- var record = SmartTags.makeSmartTag({
283
- name: "record",
284
- defaultMode: "isolation",
285
- isolationInitType: "record",
286
- mainValueCheck: (i) => Utils.Tree.TypeChecks.typeCheck(i, "record"),
287
- argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "record"),
288
- func: (main, args) => Outcome.makeSuccess(args.reduce((reduced, current) => ({
289
- ...reduced,
290
- ...current
291
- }), main))
292
- });
293
-
294
- // src/agnostic/html/hyper-json/smart-tags/isolated/ref/index.ts
295
- var func = (main, _args, { sourceTree }) => {
296
- const { makeFailure, makeSuccess } = Outcome;
297
- const { makeTransformationError } = Utils.SmartTags;
298
- const strMain = Cast.toString(main);
299
- const resolveFrom = strMain.startsWith("/") ? sourceTree.root : sourceTree;
300
- const splitted = strMain.split("/").filter((e) => e.trim() !== "").map((e) => {
301
- const looksLikeNumber = e.match(/^\d+$/igm);
302
- if (looksLikeNumber === null) return e;
303
- const parsed = parseInt(e);
304
- if (Number.isNaN(parsed)) return e;
305
- return parsed;
306
- });
307
- const resolved = resolveFrom.resolve(splitted);
308
- if (resolved === void 0) return makeFailure(makeTransformationError(`No value was found at path: ${strMain}`));
309
- if (resolved === sourceTree) return makeFailure(makeTransformationError("A ref node cannot reference itself."));
310
- if (resolved.parents.includes(sourceTree)) return makeFailure(makeTransformationError("A ref node cannot reference one of its parents."));
311
- if (sourceTree.parents.includes(resolved)) return makeFailure(makeTransformationError("A ref node cannot reference one of its children."));
312
- const evaluated = resolved.evaluate();
313
- const { getType } = Utils.Tree.TypeChecks;
314
- if (getType(evaluated) === "transformer") {
315
- const transformer = evaluated;
316
- return makeSuccess(transformer.toMethod());
317
- }
318
- return makeSuccess(evaluated);
319
- };
320
- var ref = SmartTags.makeSmartTag({
321
- name: "ref",
322
- defaultMode: "isolation",
323
- isolationInitType: "array",
324
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "string", "text"),
325
- argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
326
- func
327
- });
328
-
329
- // src/agnostic/html/hyper-json/smart-tags/isolated/string/index.ts
330
- var string = SmartTags.makeSmartTag({
331
- name: "string",
332
- defaultMode: "isolation",
333
- isolationInitType: "string",
334
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "null", "boolean", "number", "string", "text", "element", "nodelist"),
335
- argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "null", "boolean", "number", "string", "text", "element", "nodelist"),
336
- func: (main, args) => {
337
- const all = [main, ...args];
338
- const reduced = all.reduce((reduced2, curr) => {
339
- return `${reduced2}${Cast.toString(curr)}`;
340
- }, "");
341
- return Outcome.makeSuccess(reduced);
342
- }
343
- });
344
-
345
- // src/agnostic/html/hyper-json/smart-tags/isolated/text/index.ts
346
- var text = SmartTags.makeSmartTag({
347
- name: "text",
348
- defaultMode: "isolation",
349
- isolationInitType: "text",
350
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "null", "boolean", "number", "string", "text", "element", "nodelist"),
351
- argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "null", "boolean", "number", "string", "text", "element", "nodelist"),
352
- func: (main, args) => {
353
- const all = [main, ...args];
354
- const reduced = all.reduce((reduced2, curr) => {
355
- return Cast.toText(`${reduced2}${Cast.toText(curr)}`);
356
- }, Cast.toText(""));
357
- return Outcome.makeSuccess(reduced);
358
- }
359
- });
360
-
361
- // src/agnostic/html/hyper-json/smart-tags/coalesced/add/index.ts
362
- var add = SmartTags.makeSmartTag({
363
- name: "add",
364
- defaultMode: "coalescion",
365
- isolationInitType: "array",
366
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "number", "string", "text"),
367
- argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "number", "string", "text"),
368
- func: (main, args) => {
369
- const numMain = Cast.toNumber(main);
370
- const numArgs = args.map(Cast.toNumber);
371
- return Outcome.makeSuccess(numArgs.reduce((reduced, arg) => reduced + arg, numMain));
372
- }
373
- });
374
-
375
- // src/agnostic/html/hyper-json/smart-tags/coalesced/addclass/index.ts
376
- var addclass = SmartTags.makeSmartTag({
377
- name: "addclass",
378
- defaultMode: "coalescion",
379
- isolationInitType: "array",
380
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "element", "nodelist"),
381
- argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text"),
382
- func: (main, args) => {
383
- const { Element: Element2 } = Window.get();
384
- if (main instanceof Element2) {
385
- main.classList.add(...args.map((arg) => Cast.toString(arg)));
386
- return Outcome.makeSuccess(main);
387
- }
388
- const children = Array.from(main).map((child) => {
389
- if (child instanceof Element2) {
390
- child.classList.add(...args.map((arg) => Cast.toString(arg)));
391
- return child;
392
- }
393
- return child;
394
- });
395
- const frag = document.createDocumentFragment();
396
- frag.append(...children);
397
- const nodelist2 = frag.childNodes;
398
- return Outcome.makeSuccess(nodelist2);
399
- }
400
- });
401
-
402
- // src/agnostic/html/hyper-json/smart-tags/coalesced/and/index.ts
403
- var and = SmartTags.makeSmartTag({
404
- name: "and",
405
- defaultMode: "coalescion",
406
- isolationInitType: "array",
407
- mainValueCheck: (m) => Outcome.makeSuccess(m),
408
- argsValueCheck: (a) => Outcome.makeSuccess(a),
409
- func: (main, args) => {
410
- const all = [main, ...args];
411
- const returned = all.every(Cast.toBoolean);
412
- return Outcome.makeSuccess(returned);
413
- }
414
- });
415
-
416
- // src/agnostic/html/hyper-json/smart-tags/coalesced/append/index.ts
417
- var append = SmartTags.makeSmartTag({
418
- name: "append",
419
- defaultMode: "coalescion",
420
- isolationInitType: "array",
421
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "string", "text", "nodelist", "element", "array"),
422
- argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text", "nodelist", "element", "array"),
423
- func: (main, args) => {
424
- const { makeSuccess } = Outcome;
425
- const { Text: Text2, Element: Element2, NodeList, document: document2 } = Window.get();
426
- if (Array.isArray(main)) return makeSuccess([...main, ...args]);
427
- if (main instanceof Element2) {
428
- main.append(...Array.from(Cast.toNodeList(args)));
429
- return makeSuccess(main);
430
- }
431
- if (main instanceof NodeList) {
432
- const frag = document2.createDocumentFragment();
433
- frag.append(
434
- ...Array.from(main),
435
- ...Array.from(Cast.toNodeList(args))
436
- );
437
- return makeSuccess(frag.childNodes);
438
- }
439
- if (main instanceof Text2) {
440
- const reducedString = args.reduce((reduced, arg) => {
441
- return `${reduced}${Cast.toString(arg)}`;
442
- }, Cast.toString(main));
443
- return makeSuccess(Cast.toText(reducedString));
444
- }
445
- return makeSuccess(args.reduce((reduced, arg) => {
446
- return `${reduced}${Cast.toString(arg)}`;
447
- }, main));
448
- }
449
- });
450
-
451
- // src/agnostic/html/hyper-json/smart-tags/coalesced/at/index.ts
452
- var at = SmartTags.makeSmartTag({
453
- name: "at",
454
- defaultMode: "coalescion",
455
- isolationInitType: "array",
456
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "string", "text", "array", "nodelist"),
457
- argsValueCheck: (a) => {
458
- const { makeFailure, makeSuccess } = Outcome;
459
- const { makeArgsValueError } = Utils.SmartTags;
460
- const { getType, typeCheckMany } = Utils.Tree.TypeChecks;
461
- if (a.length === 0) return makeFailure(makeArgsValueError("number | string | text", "undefined", 0));
462
- if (a.length > 1) return makeFailure(makeArgsValueError("undefined", getType(a[1]) ?? "undefined", 1));
463
- const checked = typeCheckMany(a, "number", "string", "text");
464
- if (checked.success) return makeSuccess(a);
465
- return checked;
466
- },
467
- func: (main, args) => {
468
- const { makeFailure, makeSuccess } = Outcome;
469
- const { makeTransformationError } = Utils.SmartTags;
470
- const pos = args[0];
471
- const numPos = Cast.toNumber(pos);
472
- let found;
473
- const { NodeList } = Window.get();
474
- if (typeof main === "string" || Array.isArray(main) || main instanceof NodeList) {
475
- found = main[numPos];
476
- } else {
477
- const strMain = Cast.toString(main);
478
- found = strMain[numPos];
479
- }
480
- if (found === void 0) return makeFailure(makeTransformationError({
481
- message: "Property does not exist"
482
- // [WIP] maybe more details here ?
483
- }));
484
- return makeSuccess(found);
485
- }
486
- });
487
-
488
- // src/agnostic/html/hyper-json/smart-tags/coalesced/call/index.ts
489
- var call = SmartTags.makeSmartTag({
490
- name: "call",
491
- defaultMode: "coalescion",
492
- isolationInitType: "array",
493
- mainValueCheck: (m) => {
494
- const { makeFailure } = Outcome;
495
- const { typeCheck, typeCheckMany, getType } = Utils.Tree.TypeChecks;
496
- const { makeMainValueError } = Utils.SmartTags;
497
- const isMethodCheck = typeCheck(m, "method");
498
- if (isMethodCheck.success) return isMethodCheck;
499
- if (!Array.isArray(m)) return makeFailure({
500
- expected: "method[]",
501
- found: getType(m) ?? "undefined"
502
- });
503
- const isMethodsArrayCheck = typeCheckMany(m, "method");
504
- if (isMethodsArrayCheck.success) return isMethodsArrayCheck;
505
- return makeFailure(makeMainValueError("method | method[]", getType(m) ?? "undefined"));
506
- },
507
- argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "array"),
508
- func: (main, args) => {
509
- const { makeFailure, makeSuccess } = Outcome;
510
- const { makeTransformationError } = Utils.SmartTags;
511
- return makeFailure(makeTransformationError({
512
- message: "This smart tag should not be used."
513
- }));
514
- }
515
- });
516
-
517
- // src/agnostic/html/hyper-json/smart-tags/coalesced/clone/index.ts
518
- var clone = SmartTags.makeSmartTag({
519
- name: "clone",
520
- defaultMode: "coalescion",
521
- isolationInitType: "array",
522
- mainValueCheck: (m) => Outcome.makeSuccess(m),
523
- argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
524
- func: (main) => Outcome.makeSuccess(Utils.clone(main))
525
- });
526
-
527
- // src/agnostic/html/hyper-json/smart-tags/coalesced/deleteproperties/index.ts
528
- var deleteproperties = SmartTags.makeSmartTag({
529
- name: "deleteproperties",
530
- defaultMode: "coalescion",
531
- isolationInitType: "array",
532
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "record"),
533
- argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text"),
534
- func: (main, args) => {
535
- const { makeFailure, makeSuccess } = Outcome;
536
- const { makeTransformationError } = Utils.SmartTags;
537
- let returned = Utils.clone(main);
538
- for (const arg of args) {
539
- const strArg = Cast.toString(arg);
540
- try {
541
- returned = deepDeleteProperty(returned, strArg);
542
- } catch (err) {
543
- return makeFailure(makeTransformationError(`Cannot access ${strArg} from input record`));
544
- }
545
- }
546
- return makeSuccess(returned);
547
- }
548
- });
549
- function deepDeleteProperty(record2, pathString) {
550
- const cloned = Utils.clone(record2);
551
- const pathChunks = pathString.split(".");
552
- let currentRecord = cloned;
553
- pathChunks.forEach((chunk, pos) => {
554
- const isLast = pos === pathChunks.length - 1;
555
- if (isLast) delete currentRecord[chunk];
556
- else {
557
- const found = currentRecord[chunk];
558
- if (isRecord(found)) currentRecord = found;
559
- else throw "not a record";
560
- }
561
- });
562
- return cloned;
563
- }
564
-
565
- // src/agnostic/html/hyper-json/smart-tags/coalesced/equals/index.ts
566
- var equals = SmartTags.makeSmartTag({
567
- name: "equals",
568
- defaultMode: "coalescion",
569
- isolationInitType: "array",
570
- mainValueCheck: (m) => Outcome.makeSuccess(m),
571
- argsValueCheck: (a) => {
572
- const [first, ...others] = a;
573
- if (first === void 0) return Outcome.makeFailure(Utils.SmartTags.makeArgsValueError(
574
- "value",
575
- "undefined",
576
- 0
577
- ));
578
- const returned = [first, ...others];
579
- return Outcome.makeSuccess(returned);
580
- },
581
- func: (main, args) => {
582
- const { Text: Text2 } = Window.get();
583
- const normalizedMain = main instanceof Text2 ? Cast.toString(main) : main;
584
- const normalizedArgs = args.map((a) => a instanceof Text2 ? Cast.toString(a) : a);
585
- return Outcome.makeSuccess(normalizedArgs.every((arg) => arg === normalizedMain));
586
- }
587
- });
588
-
589
- // src/agnostic/html/hyper-json/smart-tags/coalesced/getattribute/index.ts
590
- var getattribute = SmartTags.makeSmartTag({
591
- name: "getattribute",
592
- defaultMode: "coalescion",
593
- isolationInitType: "array",
594
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "element"),
595
- argsValueCheck: (a) => {
596
- const { makeFailure, makeSuccess } = Outcome;
597
- const { typeCheckMany, getType } = Utils.Tree.TypeChecks;
598
- const { makeArgsValueError } = Utils.SmartTags;
599
- if (a.length === 0) return makeFailure(makeArgsValueError("string | Text", "undefined", 0));
600
- if (a.length > 1) return makeFailure(makeArgsValueError("undefined", getType(a[2]) ?? "undefined", 1));
601
- const checked = typeCheckMany(a, "string", "text");
602
- if (checked.success) return makeSuccess(checked.payload);
603
- return checked;
604
- },
605
- func: (main, args) => {
606
- const name = Cast.toString(args[0]);
607
- const found = main.getAttribute(name);
608
- return Outcome.makeSuccess(found);
609
- }
610
- });
611
-
612
- // src/agnostic/html/hyper-json/smart-tags/coalesced/getproperties/index.ts
613
- var getproperties = SmartTags.makeSmartTag({
614
- name: "getproperties",
615
- defaultMode: "coalescion",
616
- isolationInitType: "array",
617
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "record"),
618
- argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text"),
619
- func: (main, args) => {
620
- const reduced = args.reduce((reduced2, curr) => {
621
- const key = Cast.toString(curr);
622
- const val = main[key];
623
- if (val === void 0) return { ...reduced2 };
624
- return { ...reduced2, [key]: val };
625
- }, {});
626
- return Outcome.makeSuccess(reduced);
627
- }
628
- });
629
-
630
- // src/agnostic/html/hyper-json/smart-tags/coalesced/getproperty/index.ts
631
- var getproperty = SmartTags.makeSmartTag({
632
- name: "getproperty",
633
- defaultMode: "coalescion",
634
- isolationInitType: "array",
635
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "record"),
636
- argsValueCheck: (a) => {
637
- const { makeFailure, makeSuccess } = Outcome;
638
- const { makeArgsValueError } = Utils.SmartTags;
639
- const { getType, typeCheckMany } = Utils.Tree.TypeChecks;
640
- if (a.length === 0) return makeFailure(makeArgsValueError("string | Text", "undefined", 0));
641
- if (a.length !== 1) return makeFailure(makeArgsValueError("undefined", getType(a.at(1)) ?? "undefined", 1));
642
- const checked = typeCheckMany(a, "string", "text");
643
- if (!checked.success) return checked;
644
- return makeSuccess(checked.payload);
645
- },
646
- func: (main, args) => {
647
- const { getType } = Utils.Tree.TypeChecks;
648
- const { makeTransformationError } = Utils.SmartTags;
649
- const { makeFailure, makeSuccess } = Outcome;
650
- const [propName] = args;
651
- const strPropName = Cast.toString(propName);
652
- try {
653
- const found = deepGetProperty(main, strPropName);
654
- const foundType = getType(found);
655
- if (foundType !== "transformer") return makeSuccess(found);
656
- return makeFailure(makeTransformationError(`Forbidden access to key: '${strPropName}'`));
657
- } catch (err) {
658
- return makeFailure(makeTransformationError(`Impossible to access ${strPropName}`));
659
- }
660
- }
661
- });
662
- function deepGetProperty(record2, pathString) {
663
- const pathChunks = pathString.split(".").map((e) => e.trim()).filter((e) => e !== "");
664
- let currentRecord = record2;
665
- let returned = currentRecord;
666
- pathChunks.forEach((chunk, pos) => {
667
- const isLast = pos === pathChunks.length - 1;
668
- if (isLast) {
669
- const val = currentRecord[chunk];
670
- if (val === void 0) throw "PROP_UNDEFINED";
671
- returned = val;
672
- } else {
673
- const found = currentRecord[chunk];
674
- if (isRecord(found)) currentRecord = found;
675
- else throw "NOT_A_RECORD";
676
- }
677
- });
678
- return returned;
679
- }
680
-
681
- // src/agnostic/html/hyper-json/smart-tags/coalesced/if/index.ts
682
- var ifFunc = SmartTags.makeSmartTag({
683
- name: "if",
684
- defaultMode: "coalescion",
685
- isolationInitType: "array",
686
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "boolean"),
687
- argsValueCheck: (a) => {
688
- const { makeFailure, makeSuccess } = Outcome;
689
- const { makeArgsValueError } = Utils.SmartTags;
690
- if (a.length > 2) return makeFailure(makeArgsValueError("value", "undefined", a.length));
691
- if (a.length < 2) return makeFailure(makeArgsValueError("undefined", "value", 2));
692
- return makeSuccess(a);
693
- },
694
- func: (main, args) => {
695
- const [then, otherwise] = args;
696
- return Outcome.makeSuccess(main ? then : otherwise);
697
- }
698
- });
699
-
700
- // src/agnostic/html/hyper-json/smart-tags/coalesced/initialize/index.ts
701
- var initialize = SmartTags.makeSmartTag({
702
- name: "initialize",
703
- defaultMode: "coalescion",
704
- isolationInitType: "array",
705
- mainValueCheck: (m) => Outcome.makeSuccess(m),
706
- argsValueCheck: (a) => {
707
- const { makeFailure, makeSuccess } = Outcome;
708
- const { getType, typeCheck } = Utils.Tree.TypeChecks;
709
- const { makeArgsValueError } = Utils.SmartTags;
710
- const first = a[0];
711
- if (first === void 0) return makeFailure(makeArgsValueError("string | text", "undefined", 0));
712
- if (a.length > 1) return makeFailure(makeArgsValueError("undefined", getType(a[1]) ?? "undefined", 1));
713
- const firstChecked = typeCheck(first, "string", "text");
714
- if (!firstChecked.success) return makeFailure(makeArgsValueError(firstChecked.error.expected, firstChecked.error.found, 0));
715
- return makeSuccess(a);
716
- },
717
- func: (_main, args) => {
718
- const { makeFailure, makeSuccess } = Outcome;
719
- const { makeTransformationError } = Utils.SmartTags;
720
- const { getInitialValueFromTypeName } = Utils.Tree;
721
- const { isValueTypeName } = Utils.Tree.TypeChecks;
722
- const firstArg = args[0];
723
- const strFirstArg = Cast.toString(firstArg).trim().toLowerCase();
724
- const isValueType = isValueTypeName(strFirstArg);
725
- if (!isValueType || strFirstArg === "transformer" || strFirstArg === "method") return makeFailure(makeTransformationError(`${strFirstArg} is not a valid type`));
726
- const initialized = getInitialValueFromTypeName(strFirstArg);
727
- return makeSuccess(initialized);
728
- }
729
- });
730
-
731
- // src/agnostic/html/hyper-json/smart-tags/coalesced/join/index.ts
732
- var join = SmartTags.makeSmartTag({
733
- name: "join",
734
- defaultMode: "coalescion",
735
- isolationInitType: "array",
736
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "array", "nodelist"),
737
- argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text"),
738
- func: (main, args) => {
739
- const { makeSuccess } = Outcome;
740
- const joiner = Cast.toString(args);
741
- if (Array.isArray(main)) return makeSuccess(main.map(Cast.toString).join(joiner));
742
- return makeSuccess(Array.from(main).map(Cast.toString).join(joiner));
743
- }
744
- });
745
-
746
- // src/agnostic/html/hyper-json/smart-tags/coalesced/length/index.ts
747
- var length = SmartTags.makeSmartTag({
748
- name: "length",
749
- defaultMode: "coalescion",
750
- isolationInitType: "array",
751
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "string", "nodelist"),
752
- argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
753
- func: (main) => {
754
- const { makeSuccess } = Outcome;
755
- const { Text: Text2, NodeList, Element: Element2 } = Window.get();
756
- if (typeof main === "string" || main instanceof NodeList || main instanceof Text2 || Array.isArray(main)) return makeSuccess(main.length);
757
- if (main instanceof Element2) return makeSuccess(main.childNodes.length);
758
- return makeSuccess(Object.keys(main).length);
759
- }
760
- });
761
-
762
- // src/agnostic/html/hyper-json/smart-tags/coalesced/map/index.ts
763
- var map = SmartTags.makeSmartTag({
764
- name: "map",
765
- defaultMode: "coalescion",
766
- isolationInitType: "array",
767
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "array"),
768
- argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "method"),
769
- func: (main, args) => {
770
- const { makeTransformationError } = Utils.SmartTags;
771
- let mapped = [];
772
- for (const val of main) {
773
- let reduced = val;
774
- for (const arg of args) {
775
- const { transformer } = arg;
776
- const applied = transformer.apply(reduced);
777
- if (!applied.success) return Outcome.makeFailure(makeTransformationError({
778
- message: "Subtransformation failure.",
779
- onTransformed: reduced,
780
- transformerAt: args.indexOf(arg),
781
- transformerName: transformer.name,
782
- transformerInput: reduced,
783
- transformerOutput: applied
784
- }));
785
- reduced = applied.payload;
786
- }
787
- mapped.push(reduced);
788
- }
789
- return Outcome.makeSuccess(mapped);
790
- }
791
- });
792
-
793
- // src/agnostic/html/hyper-json/smart-tags/coalesced/negate/index.ts
794
- var negate = SmartTags.makeSmartTag({
795
- name: "negate",
796
- defaultMode: "coalescion",
797
- isolationInitType: "array",
798
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "boolean"),
799
- argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
800
- func: (main) => Outcome.makeSuccess(!main)
801
- });
802
-
803
- // src/agnostic/html/hyper-json/smart-tags/coalesced/notrailing/index.ts
804
- var notrailing = SmartTags.makeSmartTag({
805
- name: "notrailing",
806
- defaultMode: "coalescion",
807
- isolationInitType: "array",
808
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "string", "text"),
809
- argsValueCheck: (a) => {
810
- const { makeSuccess, makeFailure } = Outcome;
811
- const { makeArgsValueError } = Utils.SmartTags;
812
- const { getType, typeCheck } = Utils.Tree.TypeChecks;
813
- if (a.length === 0) return makeSuccess([]);
814
- if (a.length > 1) return makeFailure(makeArgsValueError("undefined", getType(a[1]) ?? "undefined", 1));
815
- const [first] = a;
816
- const firstChecked = typeCheck(first, "string", "text");
817
- if (!firstChecked.success) return makeFailure(makeArgsValueError(
818
- firstChecked.error.expected,
819
- firstChecked.error.found,
820
- 0
821
- ));
822
- return makeSuccess([firstChecked.payload]);
823
- },
824
- func: (main, args) => {
825
- const strMain = Cast.toString(main);
826
- const firstArg = args[0];
827
- const strFirstArg = Cast.toString(firstArg ?? "/");
828
- let strOutput = strMain;
829
- while (strOutput.endsWith(strFirstArg)) strOutput = strOutput.slice(0, -1);
830
- if (typeof main === "string") return Outcome.makeSuccess(strOutput);
831
- return Outcome.makeSuccess(Cast.toText(strOutput));
832
- }
833
- });
834
-
835
- // src/agnostic/html/hyper-json/smart-tags/coalesced/or/index.ts
836
- var or = SmartTags.makeSmartTag({
837
- name: "or",
838
- defaultMode: "coalescion",
839
- isolationInitType: "array",
840
- mainValueCheck: (m) => Outcome.makeSuccess(m),
841
- argsValueCheck: (a) => Outcome.makeSuccess(a),
842
- func: (main, args) => {
843
- const all = [main, ...args];
844
- const returned = all.some(Cast.toBoolean);
845
- return Outcome.makeSuccess(returned);
846
- }
847
- });
848
-
849
- // src/agnostic/html/hyper-json/smart-tags/coalesced/pickrandom/index.ts
850
- var pickrandom = SmartTags.makeSmartTag({
851
- name: "pickrandom",
852
- defaultMode: "coalescion",
853
- isolationInitType: "array",
854
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "array"),
855
- argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
856
- func: (main) => {
857
- const { makeSuccess, makeFailure } = Outcome;
858
- const { makeTransformationError } = Utils.SmartTags;
859
- const pos = Math.floor(Math.random() * main.length);
860
- const found = main[pos];
861
- if (found === void 0) return makeFailure(makeTransformationError("Cannot pick inside empty array"));
862
- return makeSuccess(found);
863
- }
864
- });
865
-
866
- // src/agnostic/html/hyper-json/smart-tags/coalesced/print/index.ts
867
- var print = SmartTags.makeSmartTag({
868
- name: "print",
869
- defaultMode: "coalescion",
870
- isolationInitType: "array",
871
- mainValueCheck: (m) => {
872
- const { getType } = Utils.Tree.TypeChecks;
873
- const { makeSuccess, makeFailure } = Outcome;
874
- const { makeMainValueError } = Utils.SmartTags;
875
- return getType(m) === "transformer" ? makeFailure(makeMainValueError("Exclude<value, transformer>", "transformer")) : makeSuccess(m);
876
- },
877
- argsValueCheck: (a) => Outcome.makeSuccess(a),
878
- func: (main, args, details) => {
879
- console.group("print");
880
- console.log("Main:", main);
881
- console.log("Args:", ...args);
882
- console.log("Tree:", details.sourceTree);
883
- console.groupEnd();
884
- return Outcome.makeSuccess(main);
885
- }
886
- });
887
-
888
- // src/agnostic/html/hyper-json/smart-tags/coalesced/populate/index.ts
889
- var populate = SmartTags.makeSmartTag({
890
- name: "populate",
891
- defaultMode: "coalescion",
892
- isolationInitType: "array",
893
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "record"),
894
- argsValueCheck: (a) => {
895
- const [first, ...others] = a;
896
- const { makeFailure, makeSuccess } = Outcome;
897
- const { makeArgsValueError } = Utils.SmartTags;
898
- const { typeCheck, typeCheckMany, getType } = Utils.Tree.TypeChecks;
899
- const firstChecked = typeCheck(first, "string", "text", "nodelist", "element");
900
- if (!firstChecked.success) return makeFailure(makeArgsValueError(
901
- firstChecked.error.expected,
902
- firstChecked.error.found,
903
- 0
904
- ));
905
- const othersChecked = typeCheckMany(others, "array");
906
- if (!othersChecked.success) return makeFailure(makeArgsValueError(
907
- othersChecked.error.expected,
908
- othersChecked.error.found,
909
- othersChecked.error.position + 1
910
- ));
911
- for (const [argPos, arg] of Object.entries(othersChecked.payload)) {
912
- const argPosNum = parseInt(argPos);
913
- const [first2, second] = arg;
914
- const firstChecked2 = typeCheck(first2, "string", "text");
915
- const secondChecked = typeCheck(second, "string", "text");
916
- if (!firstChecked2.success || !secondChecked.success) return makeFailure(makeArgsValueError(
917
- "[string | Text, string | Text]",
918
- `[${getType(first2)}, ${getType(second)}]`,
919
- argPosNum + 1
920
- ));
921
- }
922
- return makeSuccess(a);
923
- },
924
- func: (main, args) => {
925
- const { makeSuccess, makeFailure } = Outcome;
926
- const { makeTransformationError } = Utils.SmartTags;
927
- const record2 = main;
928
- const [template, ...actions] = args;
929
- let returnedStr = Cast.toString(template);
930
- for (const [propName, toReplace] of actions) {
931
- try {
932
- const value = deepGetProperty(record2, Cast.toString(propName));
933
- const replaced = replaceAll(returnedStr, Cast.toString(toReplace), Cast.toString(value));
934
- returnedStr = replaced;
935
- } catch (err) {
936
- return makeFailure(makeTransformationError({
937
- message: "Something went wrong",
938
- subTransformerError: err
939
- }));
940
- }
941
- }
942
- const { Text: Text2, NodeList } = Window.get();
943
- if (typeof template === "string") return makeSuccess(returnedStr);
944
- if (template instanceof Text2) return makeSuccess(Cast.toText(returnedStr));
945
- if (template instanceof NodeList) return makeSuccess(Cast.toNodeList(returnedStr));
946
- return makeSuccess(Cast.toElement(returnedStr));
947
- }
948
- });
949
-
950
- // src/agnostic/html/hyper-json/smart-tags/coalesced/push/index.ts
951
- var push = SmartTags.makeSmartTag({
952
- name: "push",
953
- defaultMode: "coalescion",
954
- isolationInitType: "array",
955
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "array"),
956
- argsValueCheck: (a) => Outcome.makeSuccess(a),
957
- func: (main, args) => Outcome.makeSuccess([...main, ...args])
958
- });
959
-
960
- // src/agnostic/html/hyper-json/smart-tags/coalesced/pusheach/index.ts
961
- var pusheach = SmartTags.makeSmartTag({
962
- name: "pusheach",
963
- defaultMode: "coalescion",
964
- isolationInitType: "array",
965
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "array"),
966
- argsValueCheck: (a) => {
967
- const { makeSuccess, makeFailure } = Outcome;
968
- const { typeCheck } = Utils.Tree.TypeChecks;
969
- const { makeArgsValueError } = Utils.SmartTags;
970
- for (const [argPos, arg] of Object.entries(a)) {
971
- const numPos = parseInt(argPos);
972
- const checked = typeCheck(arg, "array");
973
- if (!checked.success) return makeFailure(makeArgsValueError(
974
- checked.error.expected,
975
- checked.error.found,
976
- numPos
977
- ));
978
- }
979
- return makeSuccess(a);
980
- },
981
- func: (main, args) => {
982
- const returned = [...main];
983
- for (const arg of args) {
984
- returned.push(...arg);
985
- }
986
- return Outcome.makeSuccess(returned);
987
- }
988
- });
989
-
990
- // src/agnostic/html/hyper-json/smart-tags/coalesced/recordtoarray/index.ts
991
- var recordtoarray = SmartTags.makeSmartTag({
992
- name: "recordtoarray",
993
- defaultMode: "coalescion",
994
- isolationInitType: "array",
995
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "record"),
996
- argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
997
- func: (main) => Outcome.makeSuccess(Object.values(main))
998
- });
999
-
1000
- // src/agnostic/html/hyper-json/smart-tags/coalesced/removeattribute/index.ts
1001
- var removeattribute = SmartTags.makeSmartTag({
1002
- name: "removeattribute",
1003
- defaultMode: "coalescion",
1004
- isolationInitType: "array",
1005
- mainValueCheck: (m) => {
1006
- const { typeCheck, typeCheckMany } = Utils.Tree.TypeChecks;
1007
- if (Array.isArray(m)) return typeCheckMany(m, "element");
1008
- return typeCheck(m, "element", "nodelist");
1009
- },
1010
- argsValueCheck: (a) => {
1011
- const { makeFailure, makeSuccess } = Outcome;
1012
- const { typeCheckMany, getType } = Utils.Tree.TypeChecks;
1013
- const { makeArgsValueError } = Utils.SmartTags;
1014
- if (a.length === 0) return makeFailure(makeArgsValueError("string | Text", "undefined", 0));
1015
- if (a.length > 1) return makeFailure(makeArgsValueError("undefined", getType(a[2]) ?? "undefined", 1));
1016
- const checked = typeCheckMany(a, "string", "text");
1017
- if (checked.success) return makeSuccess(checked.payload);
1018
- return checked;
1019
- },
1020
- func: (main, args) => {
1021
- const argsStr = args.map((e) => Cast.toString(e));
1022
- const [name] = argsStr;
1023
- const { NodeList } = Window.get();
1024
- if (main instanceof NodeList) {
1025
- const children = Array.from(main).map((child) => {
1026
- const cloned = Utils.clone(child);
1027
- if (cloned instanceof Element) cloned.removeAttribute(name);
1028
- return cloned;
1029
- });
1030
- const frag = document.createDocumentFragment();
1031
- frag.append(...children);
1032
- const nodelist2 = frag.childNodes;
1033
- return Outcome.makeSuccess(nodelist2);
1034
- } else {
1035
- const mainArr = Array.isArray(main) ? main : [main];
1036
- const mainArrCloned = mainArr.map((e) => Utils.clone(e));
1037
- mainArrCloned.forEach((e) => e.removeAttribute(name));
1038
- if (Array.isArray(main)) return Outcome.makeSuccess(mainArrCloned);
1039
- return Outcome.makeSuccess(mainArrCloned[0]);
1040
- }
1041
- }
1042
- });
1043
-
1044
- // src/agnostic/html/hyper-json/smart-tags/coalesced/removeclass/index.ts
1045
- var removeclass = SmartTags.makeSmartTag({
1046
- name: "removeclass",
1047
- defaultMode: "coalescion",
1048
- isolationInitType: "array",
1049
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "element", "nodelist"),
1050
- argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text"),
1051
- func: (main, args) => {
1052
- const { Element: Element2 } = Window.get();
1053
- if (main instanceof Element2) {
1054
- main.classList.remove(...args.map((arg) => Cast.toString(arg)));
1055
- return Outcome.makeSuccess(main);
1056
- }
1057
- const children = Array.from(main).map((child) => {
1058
- if (child instanceof Element2) {
1059
- child.classList.remove(...args.map((arg) => Cast.toString(arg)));
1060
- return child;
1061
- }
1062
- return child;
1063
- });
1064
- const frag = document.createDocumentFragment();
1065
- frag.append(...children);
1066
- const nodelist2 = frag.childNodes;
1067
- return Outcome.makeSuccess(nodelist2);
1068
- }
1069
- });
1070
-
1071
- // src/agnostic/html/hyper-json/smart-tags/coalesced/renameproperty/index.ts
1072
- var renameproperty = SmartTags.makeSmartTag({
1073
- name: "renameproperty",
1074
- defaultMode: "coalescion",
1075
- isolationInitType: "array",
1076
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "record"),
1077
- argsValueCheck: (a) => {
1078
- const { makeFailure, makeSuccess } = Outcome;
1079
- const { typeCheck, typeCheckMany } = Utils.Tree.TypeChecks;
1080
- const checked = typeCheckMany(a, "string", "text");
1081
- if (!checked.success) return checked;
1082
- const [first, second] = a;
1083
- const firstChecked = typeCheck(first, "string", "text");
1084
- if (!firstChecked.success) return makeFailure(Utils.SmartTags.makeArgsValueError(
1085
- firstChecked.error.expected,
1086
- firstChecked.error.found,
1087
- 0
1088
- ));
1089
- const secondChecked = typeCheck(second, "string", "text");
1090
- if (!secondChecked.success) return makeFailure(Utils.SmartTags.makeArgsValueError(
1091
- secondChecked.error.expected,
1092
- secondChecked.error.found,
1093
- 0
1094
- ));
1095
- return makeSuccess([firstChecked.payload, secondChecked.payload]);
1096
- },
1097
- func: (main, args) => {
1098
- const [oldKey, newKey] = args.map(Cast.toString);
1099
- const returned = {};
1100
- Object.entries(main).forEach(([key, value]) => {
1101
- const targetKey = key === oldKey ? newKey : key;
1102
- returned[targetKey] = value;
1103
- });
1104
- return Outcome.makeSuccess(returned);
1105
- }
1106
- });
1107
-
1108
- // src/agnostic/html/hyper-json/smart-tags/coalesced/replace/index.ts
1109
- var replace = SmartTags.makeSmartTag({
1110
- name: "replace",
1111
- defaultMode: "coalescion",
1112
- isolationInitType: "array",
1113
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "string", "text", "nodelist", "element"),
1114
- argsValueCheck: (a) => {
1115
- const { makeFailure, makeSuccess } = Outcome;
1116
- const { getType, typeCheckMany } = Utils.Tree.TypeChecks;
1117
- const { makeArgsValueError } = Utils.SmartTags;
1118
- const expectedStr = "string | Text | NodeListOf<Element | Text> | Element";
1119
- if (a.length === 0) return makeFailure(makeArgsValueError(expectedStr, "undefined", 0));
1120
- if (a.length === 1) return makeFailure(makeArgsValueError(expectedStr, "undefined", 1));
1121
- if (a.length > 2) return makeFailure(makeArgsValueError("undefined", getType(a.at(2)) ?? "undefined", 3));
1122
- const checked = typeCheckMany(a, "string", "text", "nodelist", "element");
1123
- if (!checked.success) return checked;
1124
- return makeSuccess(checked.payload);
1125
- },
1126
- func: (main, args) => {
1127
- const [toReplace, replacer] = args;
1128
- const strMain = Cast.toString(main);
1129
- const strToReplace = Cast.toString(toReplace);
1130
- const strReplacer = Cast.toString(replacer);
1131
- const strReplaced = replaceAll(strMain, strToReplace, strReplacer);
1132
- let returned;
1133
- if (typeof main === "string") {
1134
- returned = strReplaced;
1135
- } else if (main instanceof Text) {
1136
- returned = Cast.toText(strReplaced);
1137
- } else if (main instanceof Element) {
1138
- returned = Cast.toElement(strReplaced);
1139
- } else {
1140
- returned = Cast.toNodeList(strReplaced);
1141
- }
1142
- return Outcome.makeSuccess(returned);
1143
- }
1144
- });
1145
-
1146
- // src/agnostic/html/hyper-json/smart-tags/coalesced/select/index.ts
1147
- var select = SmartTags.makeSmartTag({
1148
- name: "select",
1149
- defaultMode: "coalescion",
1150
- isolationInitType: "array",
1151
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "nodelist", "element"),
1152
- argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text"),
1153
- func: (main, args) => {
1154
- const selectedFragment = document.createDocumentFragment();
1155
- if (main instanceof Window.get().Element) {
1156
- for (const arg of args) {
1157
- const selector = Cast.toString(arg);
1158
- const found = main.querySelectorAll(selector);
1159
- selectedFragment.append(...Array.from(found));
1160
- }
1161
- } else {
1162
- const divWrapper = Window.get().document.createElement("div");
1163
- divWrapper.append(...Array.from(main));
1164
- for (const arg of args) {
1165
- const selector = Cast.toString(arg);
1166
- const found = divWrapper.querySelectorAll(selector);
1167
- selectedFragment.append(...Array.from(found));
1168
- }
1169
- }
1170
- const selected = selectedFragment.childNodes;
1171
- return Outcome.makeSuccess(selected);
1172
- }
1173
- });
1174
-
1175
- // src/agnostic/html/hyper-json/smart-tags/coalesced/set/index.ts
1176
- var set = SmartTags.makeSmartTag({
1177
- name: "set",
1178
- defaultMode: "coalescion",
1179
- isolationInitType: "array",
1180
- mainValueCheck: (m) => Outcome.makeSuccess(m),
1181
- argsValueCheck: (a) => {
1182
- const { makeFailure, makeSuccess } = Outcome;
1183
- const { makeArgsValueError } = Utils.SmartTags;
1184
- const { getType, typeCheck } = Utils.Tree.TypeChecks;
1185
- const first = a[0];
1186
- if (first === void 0) return makeFailure(makeArgsValueError("string | text", "undefined", 0));
1187
- if (a.length > 2) return makeFailure(makeArgsValueError("undefined", getType(a[2]) ?? "undefined", 2));
1188
- const firstChecked = typeCheck(first, "string", "text");
1189
- if (!firstChecked.success) return firstChecked;
1190
- else return makeSuccess(a);
1191
- },
1192
- func: (main, args, { sourceTree }) => {
1193
- const [first, second] = args;
1194
- const strFirst = Cast.toString(first);
1195
- sourceTree.setVariable(strFirst, second === void 0 ? main : second);
1196
- return Outcome.makeSuccess(main);
1197
- }
1198
- });
1199
-
1200
- // src/agnostic/html/hyper-json/smart-tags/coalesced/setattribute/index.ts
1201
- var setattribute = SmartTags.makeSmartTag({
1202
- name: "setattribute",
1203
- defaultMode: "coalescion",
1204
- isolationInitType: "array",
1205
- mainValueCheck: (m) => {
1206
- const { typeCheck, typeCheckMany } = Utils.Tree.TypeChecks;
1207
- if (Array.isArray(m)) return typeCheckMany(m, "element");
1208
- return typeCheck(m, "element", "nodelist");
1209
- },
1210
- argsValueCheck: (a) => {
1211
- const { makeFailure, makeSuccess } = Outcome;
1212
- const { typeCheckMany, getType } = Utils.Tree.TypeChecks;
1213
- const { makeArgsValueError } = Utils.SmartTags;
1214
- if (a.length === 0) return makeFailure(makeArgsValueError("string | Text", "undefined", 0));
1215
- if (a.length > 2) return makeFailure(makeArgsValueError("undefined", getType(a[2]) ?? "undefined", 2));
1216
- const checked = typeCheckMany(a, "string", "text");
1217
- if (checked.success) return makeSuccess(checked.payload);
1218
- return checked;
1219
- },
1220
- func: (main, args) => {
1221
- const argsStr = args.map((e) => Cast.toString(e));
1222
- const [name, value = ""] = argsStr;
1223
- const { NodeList } = Window.get();
1224
- if (main instanceof NodeList) {
1225
- const children = Array.from(main).map((child) => {
1226
- const cloned = Utils.clone(child);
1227
- if (cloned instanceof Element) cloned.setAttribute(name, value);
1228
- return cloned;
1229
- });
1230
- const frag = document.createDocumentFragment();
1231
- frag.append(...children);
1232
- const nodelist2 = frag.childNodes;
1233
- return Outcome.makeSuccess(nodelist2);
1234
- } else {
1235
- const mainArr = Array.isArray(main) ? main : [main];
1236
- const mainArrCloned = mainArr.map((e) => Utils.clone(e));
1237
- mainArrCloned.forEach((e) => e.setAttribute(name, value));
1238
- if (Array.isArray(main)) return Outcome.makeSuccess(mainArrCloned);
1239
- return Outcome.makeSuccess(mainArrCloned[0]);
1240
- }
1241
- }
1242
- });
1243
-
1244
- // src/agnostic/html/hyper-json/smart-tags/coalesced/setproperty/index.ts
1245
- var setproperty = SmartTags.makeSmartTag({
1246
- name: "setproperty",
1247
- defaultMode: "coalescion",
1248
- isolationInitType: "array",
1249
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "record"),
1250
- argsValueCheck: (a) => {
1251
- const { makeFailure, makeSuccess } = Outcome;
1252
- const { makeArgsValueError } = Utils.SmartTags;
1253
- const { getType, typeCheck } = Utils.Tree.TypeChecks;
1254
- if (a.length === 0) return makeFailure(makeArgsValueError("string | Text", "undefined", 0));
1255
- if (a.length === 1) return makeFailure(makeArgsValueError("value", "undefined", 1));
1256
- if (a.length !== 2) return makeFailure(makeArgsValueError("undefined", getType(a.at(2)) ?? "undefined", 2));
1257
- const [first, second] = a;
1258
- const firstChecked = typeCheck(first, "string", "text");
1259
- if (!firstChecked.success) return makeFailure(makeArgsValueError(firstChecked.error.expected, firstChecked.error.found, 0));
1260
- return makeSuccess([firstChecked.payload, second]);
1261
- },
1262
- func: (main, args) => {
1263
- const [key, val] = args;
1264
- const { makeSuccess, makeFailure } = Outcome;
1265
- const { makeTransformationError } = Utils.SmartTags;
1266
- try {
1267
- const withPropertySet = deepSetProperty(
1268
- Utils.clone(main),
1269
- Cast.toString(key),
1270
- val
1271
- );
1272
- return makeSuccess(withPropertySet);
1273
- } catch (err) {
1274
- return makeFailure(makeTransformationError(`Impossible to access property :${key}`));
1275
- }
1276
- }
1277
- });
1278
- function deepSetProperty(record2, pathString, value) {
1279
- const pathChunks = pathString.split(".");
1280
- const clone2 = Utils.clone(record2);
1281
- let currentRecord = clone2;
1282
- pathChunks.forEach((chunk, pos) => {
1283
- const isLast = pos === pathChunks.length - 1;
1284
- if (isLast) {
1285
- currentRecord[chunk] = value;
1286
- } else {
1287
- const found = currentRecord[chunk];
1288
- if (isRecord(found)) currentRecord = found;
1289
- else throw "NOT_A_RECORD";
1290
- }
1291
- });
1292
- return clone2;
1293
- }
1294
-
1295
- // src/agnostic/html/hyper-json/smart-tags/coalesced/sorton/index.ts
1296
- var sorton = SmartTags.makeSmartTag({
1297
- name: "sorton",
1298
- defaultMode: "coalescion",
1299
- isolationInitType: "array",
1300
- mainValueCheck: (m) => {
1301
- const { makeMainValueError } = Utils.SmartTags;
1302
- const { getType } = Utils.Tree.TypeChecks;
1303
- const { makeFailure, makeSuccess } = Outcome;
1304
- if (!Array.isArray(m)) return makeFailure(makeMainValueError("array<record>", getType(m) ?? "undefined"));
1305
- for (const [itemPos, itemVal] of Object.entries(m)) {
1306
- if (isRecord(itemVal)) continue;
1307
- return makeFailure(makeMainValueError("record", getType(itemVal), `At position ${parseInt(itemPos)} in main value`));
1308
- }
1309
- return makeSuccess(m);
1310
- },
1311
- argsValueCheck: (a) => {
1312
- const { makeFailure, makeSuccess } = Outcome;
1313
- const { makeArgsValueError } = Utils.SmartTags;
1314
- const { getType, typeCheckMany } = Utils.Tree.TypeChecks;
1315
- if (a.length === 0) return makeFailure(makeArgsValueError("[string | text]", "[]", 0));
1316
- if (a.length > 1) return makeFailure(makeArgsValueError("undefined", getType(a[1]) ?? "undefined", 2));
1317
- const checked = typeCheckMany(a, "string", "text");
1318
- if (checked.success) return makeSuccess(checked.payload);
1319
- return checked;
1320
- },
1321
- func: (main, args) => {
1322
- const { makeFailure, makeSuccess } = Outcome;
1323
- const strPropName = Cast.toString(args[0]);
1324
- const { getType } = Utils.Tree.TypeChecks;
1325
- const { makeTransformationError } = Utils.SmartTags;
1326
- const map2 = main.map((record2) => {
1327
- const prop = record2[strPropName];
1328
- const type = getType(prop);
1329
- return { record: record2, prop, type };
1330
- });
1331
- const firstItem = map2[0];
1332
- if (firstItem === void 0) return makeSuccess([]);
1333
- const firstItemType = firstItem.type;
1334
- if (firstItemType === void 0) return makeFailure(makeTransformationError({
1335
- message: "Invalid property type",
1336
- onItem: 0,
1337
- found: firstItemType
1338
- }));
1339
- for (const [daytumPos, daytumVal] of Object.entries(map2)) {
1340
- if (daytumVal.type !== firstItemType) return makeFailure(makeTransformationError({
1341
- message: "Invalid property type",
1342
- onItem: parseInt(daytumPos),
1343
- expected: firstItemType,
1344
- found: daytumVal.type
1345
- }));
1346
- }
1347
- const sorted = main.sort((a, b) => {
1348
- const { Text: Text2, NodeList } = Window.get();
1349
- const aProp = a[strPropName];
1350
- const bProp = b[strPropName];
1351
- if (aProp === null) return 0;
1352
- if (typeof aProp === "boolean") {
1353
- if (aProp === bProp) return 0;
1354
- if (aProp) return 1;
1355
- return -1;
1356
- }
1357
- if (typeof aProp === "string") return aProp.localeCompare(Cast.toString(bProp));
1358
- if (aProp instanceof Text2) return Cast.toString(aProp).localeCompare(Cast.toString(bProp));
1359
- if (typeof aProp === "number") return aProp - Cast.toNumber(bProp);
1360
- if (Array.isArray(aProp)) return aProp.length - Cast.toArray(bProp).length;
1361
- if (aProp instanceof NodeList) return aProp.length - Cast.toNodeList(bProp).length;
1362
- return 0;
1363
- });
1364
- return makeSuccess(sorted);
1365
- }
1366
- });
1367
-
1368
- // src/agnostic/html/hyper-json/smart-tags/coalesced/split/index.ts
1369
- var split = SmartTags.makeSmartTag({
1370
- name: "split",
1371
- defaultMode: "coalescion",
1372
- isolationInitType: "array",
1373
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "string", "text"),
1374
- argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text"),
1375
- func: (main, args) => {
1376
- let strReturnedArr = [Cast.toString(main)];
1377
- for (const arg of args) {
1378
- strReturnedArr = strReturnedArr.map((e) => e.split(Cast.toString(arg))).flat();
1379
- }
1380
- if (typeof main === "string") return Outcome.makeSuccess(strReturnedArr);
1381
- return Outcome.makeSuccess(strReturnedArr.map(Cast.toText));
1382
- }
1383
- });
1384
-
1385
- // src/agnostic/html/hyper-json/smart-tags/coalesced/spread/index.ts
1386
- var spread = SmartTags.makeSmartTag({
1387
- name: "spread",
1388
- defaultMode: "coalescion",
1389
- isolationInitType: "array",
1390
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "record"),
1391
- argsValueCheck: (a) => {
1392
- const { makeFailure, makeSuccess } = Outcome;
1393
- const { makeArgsValueError } = Utils.SmartTags;
1394
- const { getType, typeCheck } = Utils.Tree.TypeChecks;
1395
- if (a.length === 0) return makeFailure(makeArgsValueError("record", "undefined", 0));
1396
- if (a.length > 1) return makeFailure(makeArgsValueError("undefined", getType(a.at(1)) ?? "undefined", 1));
1397
- const [first] = a;
1398
- const firstChecked = typeCheck(first, "record");
1399
- if (!firstChecked.success) return makeFailure(makeArgsValueError(firstChecked.error.expected, firstChecked.error.found, 0));
1400
- return makeSuccess([firstChecked.payload]);
1401
- },
1402
- func: (main, args) => Outcome.makeSuccess({ ...main, ...args[0] })
1403
- });
1404
-
1405
- // src/agnostic/html/hyper-json/smart-tags/coalesced/toarray/index.ts
1406
- var toarray = SmartTags.makeSmartTag({
1407
- name: "toarray",
1408
- defaultMode: "coalescion",
1409
- isolationInitType: "array",
1410
- mainValueCheck: (m) => Outcome.makeSuccess(m),
1411
- argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
1412
- func: (main) => Outcome.makeSuccess(Cast.toArray(main))
1413
- });
1414
-
1415
- // src/agnostic/html/hyper-json/smart-tags/coalesced/toboolean/index.ts
1416
- var toboolean = SmartTags.makeSmartTag({
1417
- name: "toboolean",
1418
- defaultMode: "coalescion",
1419
- isolationInitType: "array",
1420
- mainValueCheck: (m) => Outcome.makeSuccess(m),
1421
- argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
1422
- func: (m) => Outcome.makeSuccess(Cast.toBoolean(m))
1423
- });
1424
-
1425
- // src/agnostic/html/hyper-json/smart-tags/coalesced/toelement/index.ts
1426
- var toelement = SmartTags.makeSmartTag({
1427
- name: "toelement",
1428
- defaultMode: "coalescion",
1429
- isolationInitType: "array",
1430
- mainValueCheck: (m) => Outcome.makeSuccess(m),
1431
- argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckManyWithLength(a, 0, 1, "string", "text"),
1432
- func: (m, a) => {
1433
- const [rawTagName] = a;
1434
- const castedTagName = rawTagName !== void 0 ? Cast.toString(rawTagName) : void 0;
1435
- const tagName = castedTagName !== "" ? castedTagName : void 0;
1436
- return Outcome.makeSuccess(Cast.toElement(m, tagName?.trim().toLowerCase()));
1437
- }
1438
- });
1439
-
1440
- // src/agnostic/html/hyper-json/smart-tags/coalesced/toggleclass/index.ts
1441
- var toggleclass = SmartTags.makeSmartTag({
1442
- name: "toggleclass",
1443
- defaultMode: "coalescion",
1444
- isolationInitType: "array",
1445
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "element", "nodelist"),
1446
- argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "string", "text"),
1447
- func: (main, args) => {
1448
- const { Element: Element2 } = Window.get();
1449
- if (main instanceof Element2) {
1450
- args.forEach((arg) => main.classList.toggle(Cast.toString(arg)));
1451
- return Outcome.makeSuccess(main);
1452
- }
1453
- const children = Array.from(main).map((child) => {
1454
- if (child instanceof Element2) {
1455
- args.forEach((arg) => child.classList.toggle(Cast.toString(arg)));
1456
- return child;
1457
- }
1458
- return child;
1459
- });
1460
- const frag = document.createDocumentFragment();
1461
- frag.append(...children);
1462
- const nodelist2 = frag.childNodes;
1463
- return Outcome.makeSuccess(nodelist2);
1464
- }
1465
- });
1466
-
1467
- // src/agnostic/html/hyper-json/smart-tags/coalesced/tonodelist/index.ts
1468
- var tonodelist = SmartTags.makeSmartTag({
1469
- name: "tonodelist",
1470
- defaultMode: "coalescion",
1471
- isolationInitType: "array",
1472
- mainValueCheck: (m) => Outcome.makeSuccess(m),
1473
- argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
1474
- func: (m) => Outcome.makeSuccess(Cast.toNodeList(m))
1475
- });
1476
-
1477
- // src/agnostic/html/hyper-json/smart-tags/coalesced/tonull/index.ts
1478
- var tonull = SmartTags.makeSmartTag({
1479
- name: "tonull",
1480
- defaultMode: "coalescion",
1481
- isolationInitType: "array",
1482
- mainValueCheck: (m) => Outcome.makeSuccess(m),
1483
- argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
1484
- func: () => Outcome.makeSuccess(null)
1485
- });
1486
-
1487
- // src/agnostic/html/hyper-json/smart-tags/coalesced/tonumber/index.ts
1488
- var tonumber = SmartTags.makeSmartTag({
1489
- name: "tonumber",
1490
- defaultMode: "coalescion",
1491
- isolationInitType: "array",
1492
- mainValueCheck: (m) => Outcome.makeSuccess(m),
1493
- argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
1494
- func: (m) => Outcome.makeSuccess(Cast.toNumber(m))
1495
- });
1496
-
1497
- // src/agnostic/html/hyper-json/smart-tags/coalesced/torecord/index.ts
1498
- var torecord = SmartTags.makeSmartTag({
1499
- name: "torecord",
1500
- defaultMode: "coalescion",
1501
- isolationInitType: "array",
1502
- mainValueCheck: (m) => Outcome.makeSuccess(m),
1503
- argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
1504
- func: (main) => Outcome.makeSuccess(Cast.toRecord(main))
1505
- });
1506
-
1507
- // src/agnostic/html/hyper-json/smart-tags/coalesced/toref/index.ts
1508
- var toref = SmartTags.makeSmartTag({
1509
- name: "toref",
1510
- defaultMode: "coalescion",
1511
- isolationInitType: "array",
1512
- mainValueCheck: (m) => Outcome.makeSuccess(m),
1513
- argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
1514
- func: (main, args, details) => func(Cast.toString(main), args, details)
1515
- });
1516
-
1517
- // src/agnostic/html/hyper-json/smart-tags/coalesced/tostring/index.ts
1518
- var tostring = SmartTags.makeSmartTag({
1519
- name: "tostring",
1520
- defaultMode: "coalescion",
1521
- isolationInitType: "array",
1522
- mainValueCheck: (m) => Outcome.makeSuccess(m),
1523
- argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
1524
- func: (m) => Outcome.makeSuccess(Cast.toString(m))
1525
- });
1526
-
1527
- // src/agnostic/html/hyper-json/smart-tags/coalesced/totext/index.ts
1528
- var totext = SmartTags.makeSmartTag({
1529
- name: "totext",
1530
- defaultMode: "coalescion",
1531
- isolationInitType: "array",
1532
- mainValueCheck: (m) => Outcome.makeSuccess(m),
1533
- argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
1534
- func: (m) => Outcome.makeSuccess(Cast.toText(m))
1535
- });
1536
-
1537
- // src/agnostic/html/hyper-json/smart-tags/coalesced/transformselected/index.ts
1538
- var transformselected = SmartTags.makeSmartTag({
1539
- name: "transformselected",
1540
- defaultMode: "coalescion",
1541
- isolationInitType: "array",
1542
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "element", "nodelist"),
1543
- argsValueCheck: (a) => {
1544
- const { makeFailure, makeSuccess } = Outcome;
1545
- const { typeCheck, typeCheckMany } = Utils.Tree.TypeChecks;
1546
- const [first, ...others] = a;
1547
- const firstChecked = typeCheck(first, "string", "text");
1548
- if (!firstChecked.success) return makeFailure({ ...firstChecked.error, position: 0 });
1549
- const othersChecked = typeCheckMany(others, "method");
1550
- if (!othersChecked.success) return makeFailure({
1551
- ...othersChecked.error,
1552
- position: othersChecked.error.position + 1
1553
- });
1554
- const returned = [firstChecked.payload, ...othersChecked.payload];
1555
- return makeSuccess(returned);
1556
- },
1557
- func: (main, args) => {
1558
- const { makeFailure, makeSuccess } = Outcome;
1559
- const { makeTransformationError } = Utils.SmartTags;
1560
- const { typeCheck } = Utils.Tree.TypeChecks;
1561
- const mainClone = Cast.toElement(main);
1562
- const [selector, ...methods] = args;
1563
- const selectedElements = Array.from(mainClone.querySelectorAll(Cast.toString(selector)));
1564
- const transformationMap = new Map(selectedElements.map((s) => [s, Utils.clone(s)]));
1565
- for (const method of methods) {
1566
- for (const [selected, value] of Array.from(transformationMap)) {
1567
- const transformer = method.transformer;
1568
- const applied = transformer.apply(value);
1569
- if (!applied.success) return makeFailure(makeTransformationError({
1570
- // [WIP] maybe a custom makeSubTransformationError ?
1571
- message: "Subtransformation failure.",
1572
- onSelected: selected,
1573
- onTransformed: value,
1574
- transformerAt: methods.indexOf(method),
1575
- transformerName: transformer.name,
1576
- transformerOutput: applied
1577
- }));
1578
- transformationMap.set(selected, applied.payload);
1579
- }
1580
- }
1581
- for (const [selected, transformed] of Array.from(transformationMap)) {
1582
- const transformedChecked = typeCheck(transformed, "element", "nodelist", "text", "string", "number", "boolean", "null");
1583
- if (!transformedChecked.success) return makeFailure(makeTransformationError({
1584
- // [WIP] maybe a custom makeBadTransformationOutputError ?
1585
- message: "Bad transformation output",
1586
- onSelected: selected,
1587
- onTransformed: transformed,
1588
- details: { ...transformedChecked.error }
1589
- }));
1590
- const { Element: Element2, NodeList, Text: Text2 } = Window.get();
1591
- const replacer = transformedChecked.payload;
1592
- if (replacer instanceof Element2 || replacer instanceof Text2) {
1593
- insertNode(replacer, "after", selected);
1594
- selected.remove();
1595
- } else if (replacer instanceof NodeList) {
1596
- replacer.forEach((item) => insertNode(item, "before", selected));
1597
- selected.remove();
1598
- } else {
1599
- insertNode(Cast.toText(replacer), "after", selected);
1600
- selected.remove();
1601
- }
1602
- transformedChecked.payload;
1603
- }
1604
- if (main instanceof Element) return makeSuccess(mainClone);
1605
- const safeChildren = Array.from(mainClone.childNodes).filter((e) => e instanceof Element || e instanceof Text);
1606
- return main instanceof Element ? makeSuccess(mainClone) : makeSuccess(Cast.toNodeList(safeChildren));
1607
- }
1608
- });
1609
-
1610
- // src/agnostic/html/hyper-json/smart-tags/coalesced/trim/index.ts
1611
- var trim = SmartTags.makeSmartTag({
1612
- name: "trim",
1613
- defaultMode: "coalescion",
1614
- isolationInitType: "array",
1615
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "string", "text"),
1616
- argsValueCheck: (a) => Utils.SmartTags.expectEmptyArgs(a),
1617
- func: (main) => {
1618
- return typeof main === "string" ? Outcome.makeSuccess(main.trim()) : Outcome.makeSuccess(Cast.toText(`${main}`.trim()));
1619
- }
1620
- });
1621
-
1622
- // src/agnostic/html/hyper-json/tree/index.ts
1623
- var Tree;
1624
- ((_Tree) => {
1625
- class Tree2 {
1626
- node;
1627
- options;
1628
- parent;
1629
- parents;
1630
- pathFromParent;
1631
- root;
1632
- isRoot;
1633
- path;
1634
- pathString;
1635
- attributes;
1636
- isMethod;
1637
- tagName;
1638
- smartTagName;
1639
- smartTagsRegister;
1640
- smartTagData;
1641
- mode;
1642
- isPreserved;
1643
- isLiteral;
1644
- isolationInitType;
1645
- subtrees = /* @__PURE__ */ new Map();
1646
- static actionAttribute = "_action";
1647
- static keyAttribute = "_key";
1648
- static methodAttribute = "_method";
1649
- static initAttribute = "_init";
1650
- static modeAttribute = "_mode";
1651
- static preserveAttribute = "_preserve";
1652
- static literalAttribute = "_literal";
1653
- static defaultOptions = {
1654
- globalObject: {},
1655
- logger: null,
1656
- loggerThread: "hyperjson"
1657
- };
1658
- static from(nodes, options) {
1659
- const merged = Utils.Tree.mergeNodes(nodes);
1660
- return new Tree2(merged, null, null, options);
1661
- }
1662
- constructor(node, parent, pathFromParent, options) {
1663
- const { Element: Element2, Text: Text2, document: document2 } = Window.get();
1664
- this.resolve = this.resolve.bind(this);
1665
- this.setVariable = this.setVariable.bind(this);
1666
- this.getVariable = this.getVariable.bind(this);
1667
- this.performSafetyChecks = this.performSafetyChecks.bind(this);
1668
- this.computeValue = this.computeValue.bind(this);
1669
- this.enforceEvaluation = this.enforceEvaluation.bind(this);
1670
- this.getCachedValue = this.getCachedValue.bind(this);
1671
- this.setCachedValue = this.setCachedValue.bind(this);
1672
- this.evaluate = this.evaluate.bind(this);
1673
- this.node = node;
1674
- this.options = options ?? Tree2.defaultOptions;
1675
- if (parent !== null && pathFromParent !== null) {
1676
- this.isRoot = false;
1677
- this.parent = parent;
1678
- this.parents = [parent, ...parent.parents];
1679
- this.pathFromParent = pathFromParent;
1680
- this.root = this.parent.root;
1681
- } else {
1682
- this.isRoot = true;
1683
- this.parent = null;
1684
- this.parents = [];
1685
- this.pathFromParent = null;
1686
- this.root = this;
1687
- }
1688
- this.path = this.isRoot ? [] : [...this.parent.path, this.pathFromParent];
1689
- this.pathString = `/${this.path.join("/")}`;
1690
- this.attributes = node instanceof Element2 ? Array.from(node.attributes) : null;
1691
- if (node instanceof Element2) {
1692
- const rawTagName = node.tagName.trim().toLowerCase();
1693
- const hasTrailingUnderscore = rawTagName.endsWith("_");
1694
- const hasMethodAttribute = this.attributes?.find((attr) => attr.name === Tree2.methodAttribute) !== void 0;
1695
- const isMethod = hasTrailingUnderscore || hasMethodAttribute;
1696
- this.isMethod = isMethod;
1697
- this.tagName = rawTagName;
1698
- this.smartTagName = hasTrailingUnderscore ? rawTagName.replace(/_+$/g, "") : rawTagName;
1699
- } else {
1700
- this.isMethod = false;
1701
- this.tagName = null;
1702
- this.smartTagName = null;
1703
- }
1704
- this.smartTagsRegister = new Map([
1705
- any,
1706
- array,
1707
- boolean,
1708
- element,
1709
- get,
1710
- global,
1711
- guess,
1712
- nodelist,
1713
- nullFunc,
1714
- number,
1715
- record,
1716
- ref,
1717
- string,
1718
- text,
1719
- add,
1720
- addclass,
1721
- and,
1722
- append,
1723
- at,
1724
- call,
1725
- clone,
1726
- deleteproperties,
1727
- equals,
1728
- getattribute,
1729
- getproperties,
1730
- getproperty,
1731
- ifFunc,
1732
- initialize,
1733
- join,
1734
- length,
1735
- map,
1736
- negate,
1737
- notrailing,
1738
- or,
1739
- pickrandom,
1740
- print,
1741
- populate,
1742
- push,
1743
- pusheach,
1744
- recordtoarray,
1745
- removeattribute,
1746
- removeclass,
1747
- renameproperty,
1748
- replace,
1749
- select,
1750
- set,
1751
- setattribute,
1752
- spread,
1753
- setproperty,
1754
- sorton,
1755
- split,
1756
- toarray,
1757
- toboolean,
1758
- toelement,
1759
- toggleclass,
1760
- tonodelist,
1761
- tonull,
1762
- tonumber,
1763
- toref,
1764
- torecord,
1765
- tostring,
1766
- totext,
1767
- transformselected,
1768
- trim
1769
- ]);
1770
- if (this.smartTagName === null) {
1771
- this.smartTagData = null;
1772
- } else {
1773
- this.smartTagData = this.smartTagsRegister.get(this.smartTagName) ?? null;
1774
- }
1775
- const hasModeAttribute = this.attributes?.find((attr) => {
1776
- return attr.name === Tree2.modeAttribute && Utils.Tree.TypeChecks.isTreeMode(attr.value);
1777
- });
1778
- this.mode = hasModeAttribute?.value ?? this.smartTagData?.defaultMode ?? "isolation";
1779
- const hasLiteralAttribute = this.attributes?.find((attr) => attr.name === Tree2.literalAttribute) !== void 0;
1780
- this.isLiteral = hasLiteralAttribute;
1781
- const hasPreservedAttribute = this.attributes?.find((attr) => attr.name === Tree2.preserveAttribute) !== void 0;
1782
- this.isPreserved = hasPreservedAttribute;
1783
- const hasInitAttribute = this.attributes?.find((attr) => {
1784
- if (attr.name !== Tree2.initAttribute) return false;
1785
- const val = attr.value.trim().toLowerCase();
1786
- if (!Utils.Tree.TypeChecks.isValueTypeName(val)) return false;
1787
- if (val === "transformer") return false;
1788
- if (val === "method") return false;
1789
- return true;
1790
- });
1791
- if (this.mode === "coalescion") {
1792
- this.isolationInitType = "array";
1793
- } else {
1794
- const initAttributeValue = hasInitAttribute?.value;
1795
- if (initAttributeValue !== void 0) {
1796
- this.isolationInitType = initAttributeValue;
1797
- } else if (this.smartTagData !== null) {
1798
- this.isolationInitType = this.smartTagData?.isolationInitType ?? "array";
1799
- } else {
1800
- this.isolationInitType = "nodelist";
1801
- }
1802
- }
1803
- const { childNodes } = node;
1804
- let positionnedChildrenCount = 0;
1805
- const mutableSubtrees = /* @__PURE__ */ new Map();
1806
- Array.from(childNodes).filter((child, _, childNodes2) => {
1807
- if (child instanceof Element2) return true;
1808
- if (child instanceof Text2) return true;
1809
- return false;
1810
- }).reduce((reduced, child) => {
1811
- if (reduced.length === 0) return [child];
1812
- if (child instanceof Element2) return [...reduced, child];
1813
- const lastReducedItem = reduced[reduced.length - 1];
1814
- if (lastReducedItem instanceof Element2) return [...reduced, child];
1815
- const lastReducedTrimmed = trimEnd(lastReducedItem.textContent ?? "");
1816
- const childTrimmed = trimStart(child.textContent ?? "");
1817
- const merged = document2.createTextNode(`${lastReducedTrimmed}${childTrimmed}`);
1818
- const returned = [...reduced];
1819
- returned.pop();
1820
- returned.push(merged);
1821
- return returned;
1822
- }, []).filter((child) => {
1823
- if (child instanceof Element2) return true;
1824
- const textContent = child.textContent ?? "";
1825
- return textContent.trim() !== "";
1826
- }).forEach((childNode) => {
1827
- if (childNode instanceof Text2) {
1828
- const rawTextContent = childNode.textContent ?? "";
1829
- const textContent = rawTextContent.replace(/^\s*\n+\s*/, "").replace(/\s*\n+\s*$/, "");
1830
- const returnedChildNode = document2.createTextNode(textContent);
1831
- mutableSubtrees.set(
1832
- positionnedChildrenCount,
1833
- new Tree2(returnedChildNode, this, positionnedChildrenCount, this.options)
1834
- );
1835
- positionnedChildrenCount += 1;
1836
- } else {
1837
- const propertyName = childNode.getAttribute(Tree2.keyAttribute);
1838
- if (propertyName === null) {
1839
- mutableSubtrees.set(
1840
- positionnedChildrenCount,
1841
- new Tree2(childNode, this, positionnedChildrenCount, this.options)
1842
- );
1843
- positionnedChildrenCount += 1;
1844
- } else {
1845
- mutableSubtrees.set(
1846
- propertyName,
1847
- new Tree2(childNode, this, propertyName, this.options)
1848
- );
1849
- }
1850
- }
1851
- });
1852
- this.subtrees = mutableSubtrees;
1853
- }
1854
- resolve = function(path) {
1855
- let currentTree = this;
1856
- for (const chunk of path) {
1857
- if (chunk === ".") continue;
1858
- if (chunk === "..") {
1859
- currentTree = currentTree.parent ?? this;
1860
- continue;
1861
- }
1862
- const { subtrees } = currentTree;
1863
- const foundSubtree = subtrees.get(chunk);
1864
- if (foundSubtree === void 0) return void 0;
1865
- currentTree = foundSubtree;
1866
- }
1867
- return currentTree;
1868
- };
1869
- // [WIP] variablesStore is actually only used on root Tree
1870
- variablesStore = /* @__PURE__ */ new Map();
1871
- setVariable(name, value) {
1872
- const { root, isRoot, variablesStore } = this;
1873
- if (!isRoot) return root.setVariable(name, value);
1874
- variablesStore.set(name, Serialize.serialize(value));
1875
- }
1876
- getVariable(name) {
1877
- const { root } = this;
1878
- const found = root.variablesStore.get(name);
1879
- if (found === void 0) return void 0;
1880
- const deserialized = Serialize.deserialize(found);
1881
- if (deserialized instanceof Transformer) throw "A transformer should not be stored as a variable, this happening denotes an implementation error.";
1882
- return deserialized;
1883
- }
1884
- performSafetyChecks() {
1885
- const { node, smartTagData, isMethod, mode, isRoot } = this;
1886
- const { Text: Text2 } = Window.get();
1887
- if (node instanceof Text2 || smartTagData === null) {
1888
- if (isMethod) throw new Error(`A Text or HTMLElement node cannot be used as a method @ ${this.pathString}`);
1889
- if (mode === "coalescion") throw new Error(`A Text or HTMLElement node cannot be used in coalescion mode @ ${this.pathString}`);
1890
- }
1891
- if (isRoot && mode === "coalescion") throw new Error(`The root node cannot be used in coalescion mode @ ${this.pathString}`);
1892
- }
1893
- computeValue() {
1894
- const {
1895
- isolationInitType,
1896
- subtrees,
1897
- node,
1898
- smartTagData,
1899
- isMethod,
1900
- mode,
1901
- performSafetyChecks
1902
- } = this;
1903
- performSafetyChecks();
1904
- const { Text: Text2 } = Window.get();
1905
- if (node instanceof Text2) return node.cloneNode(true);
1906
- const initialInnerValue = Utils.Tree.getInitialValueFromTypeName(isolationInitType);
1907
- const innerValue = Array.from(subtrees).reduce((reduced, [subpath, subtree]) => {
1908
- const subvalue = subtree.evaluate();
1909
- const coalesced = Utils.coalesceValues(reduced, subpath, subvalue);
1910
- return coalesced;
1911
- }, initialInnerValue);
1912
- if (smartTagData === null) {
1913
- const nodelist2 = Cast.toNodeList(innerValue);
1914
- const clone2 = node.cloneNode();
1915
- clone2.append(...Array.from(nodelist2));
1916
- return clone2;
1917
- }
1918
- const { transformer, method } = smartTagData.generator(innerValue, mode, this);
1919
- if (isMethod) return method;
1920
- if (mode === "isolation") {
1921
- const applied = transformer.apply(null);
1922
- if (applied.success) return applied.payload;
1923
- throw {
1924
- error: "Transformation error",
1925
- details: applied.error,
1926
- transformer: transformer.name,
1927
- path: this.pathString
1928
- };
1929
- }
1930
- return transformer;
1931
- }
1932
- enforceEvaluation() {
1933
- const { isPreserved, node, computeValue, isLiteral, attributes } = this;
1934
- const { Element: Element2 } = Window.get();
1935
- if (isPreserved) return Utils.clone(node);
1936
- const evaluated = computeValue();
1937
- if (!isLiteral) return evaluated;
1938
- const asLiteral = Utils.toHyperJson(evaluated);
1939
- if (asLiteral instanceof Element2) attributes?.forEach(({ name, value }) => asLiteral.setAttribute(name, value));
1940
- return asLiteral;
1941
- }
1942
- cachedValue = void 0;
1943
- getCachedValue() {
1944
- const { cachedValue } = this;
1945
- if (cachedValue === void 0) return void 0;
1946
- const deserialized = Serialize.deserialize(cachedValue);
1947
- return deserialized;
1948
- }
1949
- setCachedValue(evaluated) {
1950
- this.cachedValue = Serialize.serialize(evaluated);
1951
- }
1952
- evaluate() {
1953
- const start = Date.now();
1954
- const {
1955
- getCachedValue,
1956
- setCachedValue,
1957
- enforceEvaluation
1958
- } = this;
1959
- const cached = getCachedValue();
1960
- if (cached !== void 0) return cached;
1961
- const evaluated = enforceEvaluation();
1962
- setCachedValue(evaluated);
1963
- const end = Date.now();
1964
- const time = end - start;
1965
- if (time > 20) console.warn(`${this.pathString} took ${time}ms to evaluate, maybe there's something wrong here`);
1966
- return evaluated;
1967
- }
1968
- }
1969
- _Tree.Tree = Tree2;
1970
- })(Tree || (Tree = {}));
1971
-
1972
- // src/agnostic/html/hyper-json/utils/index.ts
1973
- var Utils;
1974
- ((Utils2) => {
1975
- function clone2(value) {
1976
- const { Element: Element2, Text: Text2, NodeList, document: document2 } = Window.get();
1977
- if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null) return value;
1978
- if (value instanceof Text2) return value.cloneNode(true);
1979
- if (value instanceof NodeList) {
1980
- const frag = document2.createDocumentFragment();
1981
- const nodes = Array.from(value).map((e) => e.cloneNode(true));
1982
- frag.append(...nodes);
1983
- return frag.childNodes;
1984
- }
1985
- if (value instanceof Element2) return value.cloneNode(true);
1986
- if (value instanceof Transformer) return Transformer.clone(value);
1987
- if (value instanceof Method) return Method.clone(value);
1988
- if (Array.isArray(value)) return [...value.map(clone2)];
1989
- if (isRecord(value)) return recordMap(value, (prop) => clone2(prop));
1990
- throw new Error(`Cannot clone value: ${value}`);
1991
- }
1992
- Utils2.clone = clone2;
1993
- function coalesceValues(currentValue, subpath, subvalue) {
1994
- const { Element: Element2, Text: Text2, NodeList, document: document2 } = Window.get();
1995
- let actualSubvalue = subvalue;
1996
- if (actualSubvalue instanceof Transformer) {
1997
- const transformer = actualSubvalue;
1998
- const transformationResult = transformer.apply(currentValue);
1999
- if (!transformationResult.success) {
2000
- console.warn({ ...transformationResult.error });
2001
- return currentValue;
2002
- }
2003
- const evaluated = transformationResult.payload;
2004
- if (transformer.mode === "isolation") {
2005
- actualSubvalue = evaluated;
2006
- } else {
2007
- return evaluated;
2008
- }
2009
- }
2010
- if (Array.isArray(currentValue)) return [...currentValue, actualSubvalue];
2011
- if (currentValue === null) return actualSubvalue;
2012
- if (typeof currentValue === "boolean") return actualSubvalue;
2013
- if (typeof currentValue === "number") return actualSubvalue;
2014
- if (currentValue instanceof Transformer) return actualSubvalue;
2015
- if (currentValue instanceof Method) return actualSubvalue;
2016
- if (typeof currentValue === "string") {
2017
- if (actualSubvalue === null || typeof actualSubvalue === "boolean" || typeof actualSubvalue === "number" || typeof actualSubvalue === "string") return `${currentValue}${actualSubvalue}`;
2018
- if (actualSubvalue instanceof Text2) return `${currentValue}${actualSubvalue.textContent}`;
2019
- if (actualSubvalue instanceof Element2) {
2020
- const frag = document2.createDocumentFragment();
2021
- frag.append(currentValue, Utils2.clone(actualSubvalue));
2022
- return frag.childNodes;
2023
- }
2024
- if (actualSubvalue instanceof NodeList) {
2025
- const frag = document2.createDocumentFragment();
2026
- frag.append(currentValue, ...Array.from(Utils2.clone(actualSubvalue)));
2027
- return frag.childNodes;
2028
- }
2029
- return actualSubvalue;
2030
- }
2031
- if (currentValue instanceof Text2) {
2032
- if (actualSubvalue === null || typeof actualSubvalue === "boolean" || typeof actualSubvalue === "number" || typeof actualSubvalue === "string") return document2.createTextNode(`${currentValue.textContent}${actualSubvalue}`);
2033
- if (actualSubvalue instanceof Text2) return document2.createTextNode(`${currentValue.textContent}${actualSubvalue.textContent}`);
2034
- if (actualSubvalue instanceof Element2) {
2035
- const frag = document2.createDocumentFragment();
2036
- frag.append(clone2(currentValue), clone2(actualSubvalue));
2037
- return frag.childNodes;
2038
- }
2039
- if (actualSubvalue instanceof NodeList) {
2040
- const frag = document2.createDocumentFragment();
2041
- frag.append(clone2(currentValue), ...Array.from(clone2(actualSubvalue)));
2042
- return frag.childNodes;
2043
- }
2044
- return actualSubvalue;
2045
- }
2046
- if (currentValue instanceof Element2) {
2047
- if (actualSubvalue === null || typeof actualSubvalue === "boolean" || typeof actualSubvalue === "number" || typeof actualSubvalue === "string") {
2048
- const frag = document2.createDocumentFragment();
2049
- frag.append(clone2(currentValue), `${actualSubvalue}`);
2050
- return frag.childNodes;
2051
- }
2052
- if (actualSubvalue instanceof Text2 || actualSubvalue instanceof Element2) {
2053
- const frag = document2.createDocumentFragment();
2054
- frag.append(clone2(currentValue), clone2(actualSubvalue));
2055
- return frag.childNodes;
2056
- }
2057
- if (actualSubvalue instanceof NodeList) {
2058
- const frag = document2.createDocumentFragment();
2059
- frag.append(clone2(currentValue), ...Array.from(clone2(actualSubvalue)));
2060
- return frag.childNodes;
2061
- }
2062
- return actualSubvalue;
2063
- }
2064
- if (currentValue instanceof NodeList) {
2065
- if (actualSubvalue === null || typeof actualSubvalue === "boolean" || typeof actualSubvalue === "number" || typeof actualSubvalue === "string") {
2066
- const frag = document2.createDocumentFragment();
2067
- frag.append(...Array.from(clone2(currentValue)), `${actualSubvalue}`);
2068
- return frag.childNodes;
2069
- }
2070
- if (actualSubvalue instanceof Text2 || actualSubvalue instanceof Element2) {
2071
- const frag = document2.createDocumentFragment();
2072
- frag.append(...Array.from(clone2(currentValue)), clone2(actualSubvalue));
2073
- return frag.childNodes;
2074
- }
2075
- if (actualSubvalue instanceof NodeList) {
2076
- const frag = document2.createDocumentFragment();
2077
- frag.append(...Array.from(clone2(currentValue)), ...Array.from(clone2(actualSubvalue)));
2078
- return frag.childNodes;
2079
- }
2080
- return actualSubvalue;
2081
- }
2082
- if (typeof subpath === "number") return { ...currentValue };
2083
- return {
2084
- ...currentValue,
2085
- [subpath]: actualSubvalue
2086
- };
2087
- }
2088
- Utils2.coalesceValues = coalesceValues;
2089
- Utils2.toHyperJson = (value) => {
2090
- const { document: document2, Element: Element2, Text: Text2, NodeList } = Window.get();
2091
- if (value instanceof Text2) {
2092
- const elt2 = document2.createElement("text");
2093
- elt2.innerHTML = value.textContent ?? "";
2094
- return elt2;
2095
- }
2096
- if (value instanceof Element2) return value.cloneNode(true);
2097
- if (value instanceof NodeList) {
2098
- const elt2 = document2.createElement("nodelist");
2099
- elt2.append(...Array.from(value).map((e) => e.cloneNode(true)));
2100
- return elt2;
2101
- }
2102
- if (value === null) return document2.createElement("null");
2103
- if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
2104
- const elt2 = document2.createElement(typeof value);
2105
- elt2.innerHTML = `${value}`;
2106
- return elt2;
2107
- }
2108
- if (Array.isArray(value)) {
2109
- const elt2 = document2.createElement("array");
2110
- elt2.append(...value.map((e) => (0, Utils2.toHyperJson)(e)));
2111
- return elt2;
2112
- }
2113
- if (value instanceof Transformer) return clone2(value.sourceTree.node);
2114
- if (value instanceof Method) return clone2(value.transformer.sourceTree.node);
2115
- const elt = document2.createElement("record");
2116
- Object.entries(value).forEach(([key, val]) => {
2117
- const hjVal = (0, Utils2.toHyperJson)(val);
2118
- if (hjVal instanceof Text2) return;
2119
- hjVal.setAttribute(Tree.Tree.keyAttribute, key);
2120
- elt.append(hjVal);
2121
- });
2122
- return elt;
2123
- };
2124
- let Transformations;
2125
- ((Transformations2) => {
2126
- let TypeChecks;
2127
- ((TypeChecks2) => {
2128
- function getType(value) {
2129
- if (singleTypeCheck(value, "null")) return "null";
2130
- if (singleTypeCheck(value, "boolean")) return "boolean";
2131
- if (singleTypeCheck(value, "number")) return "number";
2132
- if (singleTypeCheck(value, "string")) return "string";
2133
- if (singleTypeCheck(value, "element")) return "element";
2134
- if (singleTypeCheck(value, "text")) return "text";
2135
- if (singleTypeCheck(value, "nodelist")) return "nodelist";
2136
- if (singleTypeCheck(value, "method")) return "method";
2137
- if (singleTypeCheck(value, "array")) return "array";
2138
- if (singleTypeCheck(value, "record")) return "record";
2139
- return void 0;
2140
- }
2141
- TypeChecks2.getType = getType;
2142
- TypeChecks2.everyTypeName = [
2143
- "null",
2144
- "boolean",
2145
- "number",
2146
- "string",
2147
- "text",
2148
- "nodelist",
2149
- "element",
2150
- "method",
2151
- "array",
2152
- "record"
2153
- ];
2154
- function singleTypeCheck(value, type) {
2155
- const { Element: Element2, Text: Text2, NodeList } = Window.get();
2156
- if (type === "null" && value === null) return true;
2157
- if (type === "boolean" && typeof value === "boolean") return true;
2158
- if (type === "number" && typeof value === "number") return true;
2159
- if (type === "string" && typeof value === "string") return true;
2160
- if (type === "element" && value instanceof Element2) return true;
2161
- if (type === "text" && value instanceof Text2) return true;
2162
- if (type === "nodelist" && value instanceof NodeList) {
2163
- const children = Array.from(value);
2164
- return children.every((child) => child instanceof Element2 || child instanceof Text2);
2165
- }
2166
- if (type === "method" && value instanceof Method) return true;
2167
- if (type === "array" && Array.isArray(value)) {
2168
- const childrenOk = value.every((child) => typeCheck(child, ...TypeChecks2.everyTypeName).success);
2169
- return childrenOk;
2170
- }
2171
- if (type === "record" && isRecord(value)) {
2172
- const childrenOk = Object.values(value).every((child) => typeCheck(child, ...TypeChecks2.everyTypeName).success);
2173
- return childrenOk;
2174
- }
2175
- return false;
2176
- }
2177
- TypeChecks2.singleTypeCheck = singleTypeCheck;
2178
- function typeCheck(value, ...types) {
2179
- const matchesOneType = types.some((type) => singleTypeCheck(value, type));
2180
- if (matchesOneType) return Outcome.makeSuccess(value);
2181
- return Outcome.makeFailure({
2182
- expected: types.join(" | "),
2183
- found: getType(value) ?? "undefined"
2184
- });
2185
- }
2186
- TypeChecks2.typeCheck = typeCheck;
2187
- function typeCheckMany(values, ...types) {
2188
- for (const [pos, val] of Object.entries(values)) {
2189
- const checked = typeCheck(val, ...types);
2190
- if (checked.success) continue;
2191
- return Outcome.makeFailure({ position: parseInt(pos), ...checked.error });
2192
- }
2193
- return Outcome.makeSuccess(values);
2194
- }
2195
- TypeChecks2.typeCheckMany = typeCheckMany;
2196
- })(TypeChecks = Transformations2.TypeChecks || (Transformations2.TypeChecks = {}));
2197
- })(Transformations = Utils2.Transformations || (Utils2.Transformations = {}));
2198
- let Tree2;
2199
- ((Tree3) => {
2200
- function mergeNodes(nodes) {
2201
- const clones = nodes.map((node) => node.cloneNode(true));
2202
- const allChildren = [];
2203
- clones.forEach((node) => {
2204
- const actionAttribute = node.getAttribute(Tree.Tree.actionAttribute)?.trim().toLowerCase();
2205
- const actionAttrIsValid = isInEnum(Types.Tree.Merge.Action, actionAttribute ?? "");
2206
- const nodeAction = actionAttrIsValid ? actionAttribute : Types.Tree.Merge.Action.APPEND;
2207
- const { Element: Element2, Text: Text2 } = Window.get();
2208
- const children = Array.from(node.childNodes).filter((child) => child instanceof Text2 || child instanceof Element2).map((child) => {
2209
- if (child instanceof Text2) return { node: child, key: void 0 };
2210
- const childKey = child.getAttribute(Tree.Tree.keyAttribute) ?? void 0;
2211
- return { node: child, key: childKey };
2212
- });
2213
- if (nodeAction === Types.Tree.Merge.Action.REPLACE) {
2214
- allChildren.splice(0, allChildren.length);
2215
- } else if (nodeAction === Types.Tree.Merge.Action.PREPEND) {
2216
- allChildren.unshift(...children);
2217
- } else {
2218
- allChildren.push(...children);
2219
- }
2220
- });
2221
- const mergedChildren = [];
2222
- allChildren.forEach((childData) => {
2223
- if (childData.key === void 0) mergedChildren.push(childData);
2224
- else {
2225
- const childKey = childData.key;
2226
- const alreadyMerged = mergedChildren.find((dat) => dat.key === childKey);
2227
- if (alreadyMerged) return;
2228
- const toMerge = allChildren.filter((dat) => dat.key === childKey);
2229
- if (toMerge.length === 0) return;
2230
- const merged = mergeNodes(toMerge.map((dat) => dat.node));
2231
- mergedChildren.push({ node: merged, key: childKey });
2232
- }
2233
- });
2234
- const allAttributes = clones.reduce((attributes, node) => [
2235
- ...Array.from(attributes),
2236
- ...Array.from(node.attributes)
2237
- ], []);
2238
- const outWrapper = clones[0]?.cloneNode() ?? document.createElement("div");
2239
- allAttributes.forEach((attr) => outWrapper.setAttribute(attr.name, attr.value));
2240
- outWrapper.append(...mergedChildren.map((e) => e.node));
2241
- return outWrapper;
2242
- }
2243
- Tree3.mergeNodes = mergeNodes;
2244
- function getInitialValueFromTypeName(name) {
2245
- const { document: document2 } = Window.get();
2246
- if (name === "null") return null;
2247
- if (name === "boolean") return false;
2248
- if (name === "number") return 0;
2249
- if (name === "string") return "";
2250
- if (name === "text") return document2.createTextNode("");
2251
- if (name === "nodelist") return document2.createDocumentFragment().childNodes;
2252
- if (name === "element") return document2.createElement("div");
2253
- if (name === "array") return [];
2254
- if (name === "record") return {};
2255
- throw new Error(`Unknown value type name: ${name}`);
2256
- }
2257
- Tree3.getInitialValueFromTypeName = getInitialValueFromTypeName;
2258
- let TypeChecks;
2259
- ((TypeChecks2) => {
2260
- function getType(value) {
2261
- if (singleTypeCheck(value, "null")) return "null";
2262
- if (singleTypeCheck(value, "boolean")) return "boolean";
2263
- if (singleTypeCheck(value, "number")) return "number";
2264
- if (singleTypeCheck(value, "string")) return "string";
2265
- if (singleTypeCheck(value, "element")) return "element";
2266
- if (singleTypeCheck(value, "text")) return "text";
2267
- if (singleTypeCheck(value, "nodelist")) return "nodelist";
2268
- if (singleTypeCheck(value, "transformer")) return "transformer";
2269
- if (singleTypeCheck(value, "method")) return "method";
2270
- if (singleTypeCheck(value, "array")) return "array";
2271
- if (singleTypeCheck(value, "record")) return "record";
2272
- return void 0;
2273
- }
2274
- TypeChecks2.getType = getType;
2275
- TypeChecks2.everyTypeName = [
2276
- "null",
2277
- "boolean",
2278
- "number",
2279
- "string",
2280
- "text",
2281
- "nodelist",
2282
- "element",
2283
- "transformer",
2284
- "method",
2285
- "array",
2286
- "record"
2287
- ];
2288
- function singleTypeCheck(value, type) {
2289
- const { Element: Element2, Text: Text2, NodeList } = Window.get();
2290
- if (type === "null" && value === null) return true;
2291
- if (type === "boolean" && typeof value === "boolean") return true;
2292
- if (type === "number" && typeof value === "number") return true;
2293
- if (type === "string" && typeof value === "string") return true;
2294
- if (type === "element" && value instanceof Element2) return true;
2295
- if (type === "text" && value instanceof Text2) return true;
2296
- if (type === "nodelist" && value instanceof NodeList) {
2297
- const children = Array.from(value);
2298
- return children.every((child) => child instanceof Element2 || child instanceof Text2);
2299
- }
2300
- if (type === "transformer" && value instanceof Transformer) return true;
2301
- if (type === "method" && value instanceof Method) return true;
2302
- if (type === "array" && Array.isArray(value)) {
2303
- const childrenOk = value.every((child) => typeCheck(child, ...TypeChecks2.everyTypeName).success);
2304
- return childrenOk;
2305
- }
2306
- if (type === "record" && isRecord(value)) {
2307
- const childrenOk = Object.values(value).every((child) => typeCheck(child, ...TypeChecks2.everyTypeName).success);
2308
- return childrenOk;
2309
- }
2310
- return false;
2311
- }
2312
- TypeChecks2.singleTypeCheck = singleTypeCheck;
2313
- function typeCheck(value, ...types) {
2314
- const matchesOneType = types.some((type) => singleTypeCheck(value, type));
2315
- if (matchesOneType) return Outcome.makeSuccess(value);
2316
- return Outcome.makeFailure({
2317
- expected: types.join(" | "),
2318
- found: getType(value) ?? "undefined"
2319
- });
2320
- }
2321
- TypeChecks2.typeCheck = typeCheck;
2322
- function typeCheckMany(values, ...types) {
2323
- for (const [pos, val] of Object.entries(values)) {
2324
- const checked = typeCheck(val, ...types);
2325
- if (checked.success) continue;
2326
- return Outcome.makeFailure({ position: parseInt(pos), ...checked.error });
2327
- }
2328
- return Outcome.makeSuccess(values);
2329
- }
2330
- TypeChecks2.typeCheckMany = typeCheckMany;
2331
- function typeCheckManyWithLength(values, minLength, maxLength, ...types) {
2332
- if (minLength !== void 0 && values.length < minLength) return Outcome.makeFailure({
2333
- position: values.length + 1,
2334
- expected: `min length: ${minLength}`,
2335
- found: `length: ${values.length}`
2336
- });
2337
- if (maxLength !== void 0 && values.length > maxLength) return Outcome.makeFailure({
2338
- position: maxLength + 1,
2339
- expected: `max length: ${maxLength}`,
2340
- found: `length: ${values.length}`
2341
- });
2342
- return typeCheckMany(values, ...types);
2343
- }
2344
- TypeChecks2.typeCheckManyWithLength = typeCheckManyWithLength;
2345
- TypeChecks2.isTreeMode = (name) => name === "isolation" || name === "coalescion";
2346
- TypeChecks2.isValueTypeName = (name) => {
2347
- const list = [
2348
- "null",
2349
- "boolean",
2350
- "number",
2351
- "string",
2352
- "text",
2353
- "nodelist",
2354
- "element",
2355
- "transformer",
2356
- "method",
2357
- "array",
2358
- "record"
2359
- ];
2360
- return list.includes(name);
2361
- };
2362
- })(TypeChecks = Tree3.TypeChecks || (Tree3.TypeChecks = {}));
2363
- })(Tree2 = Utils2.Tree || (Utils2.Tree = {}));
2364
- let SmartTags2;
2365
- ((SmartTags3) => {
2366
- SmartTags3.expectEmptyArgs = (args) => {
2367
- if (args.length === 0) return Outcome.makeSuccess([]);
2368
- return Outcome.makeFailure({
2369
- expected: "length: 0",
2370
- found: `length: ${args.length}`
2371
- });
2372
- };
2373
- SmartTags3.makeMainValueError = (expected, found, details) => ({ expected, found, details });
2374
- SmartTags3.makeArgsValueError = (expected, found, position, details) => ({ expected, found, position, details });
2375
- SmartTags3.makeTransformationError = (details) => ({ details });
2376
- })(SmartTags2 = Utils2.SmartTags || (Utils2.SmartTags = {}));
2377
- })(Utils || (Utils = {}));
2378
-
2379
- // src/agnostic/html/hyper-json/smart-tags/isolated/boolean/index.ts
2380
- var boolean = SmartTags.makeSmartTag({
2381
- name: "boolean",
2382
- defaultMode: "isolation",
2383
- isolationInitType: "boolean",
2384
- mainValueCheck: (m) => Utils.Tree.TypeChecks.typeCheck(m, "null", "boolean", "number", "string", "text"),
2385
- argsValueCheck: (a) => Utils.Tree.TypeChecks.typeCheckMany(a, "null", "boolean", "number", "string", "text"),
2386
- func: (main, args) => Outcome.makeSuccess([main, ...args].every((item) => Cast.toBoolean(item)))
2387
- });
2388
-
2389
- export {
2390
- boolean,
2391
- element,
2392
- get,
2393
- global,
2394
- guess,
2395
- nodelist,
2396
- number,
2397
- record,
2398
- func,
2399
- ref,
2400
- string,
2401
- text,
2402
- add,
2403
- addclass,
2404
- and,
2405
- append,
2406
- at,
2407
- call,
2408
- clone,
2409
- deleteproperties,
2410
- equals,
2411
- getattribute,
2412
- getproperties,
2413
- getproperty,
2414
- deepGetProperty,
2415
- ifFunc,
2416
- initialize,
2417
- join,
2418
- length,
2419
- map,
2420
- negate,
2421
- notrailing,
2422
- or,
2423
- pickrandom,
2424
- print,
2425
- populate,
2426
- push,
2427
- pusheach,
2428
- recordtoarray,
2429
- removeattribute,
2430
- removeclass,
2431
- renameproperty,
2432
- replace,
2433
- select,
2434
- set,
2435
- setattribute,
2436
- setproperty,
2437
- sorton,
2438
- split,
2439
- spread,
2440
- toarray,
2441
- toboolean,
2442
- toelement,
2443
- toggleclass,
2444
- tonodelist,
2445
- tonull,
2446
- tonumber,
2447
- torecord,
2448
- toref,
2449
- tostring,
2450
- totext,
2451
- transformselected,
2452
- trim,
2453
- Tree,
2454
- Utils,
2455
- Cast
2456
- };