@schukai/monster 1.31.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (365) hide show
  1. package/CHANGELOG +11 -0
  2. package/README.md +55 -58
  3. package/example/constraints/andoperator.mjs +17 -0
  4. package/example/constraints/invalid.mjs +6 -0
  5. package/example/constraints/isarray.mjs +11 -0
  6. package/example/constraints/isobject.mjs +12 -0
  7. package/example/constraints/oroperator.mjs +15 -0
  8. package/example/constraints/valid.mjs +6 -0
  9. package/example/data/buildmap.mjs +67 -0
  10. package/example/data/datasource.mjs +7 -0
  11. package/example/data/diff.mjs +39 -0
  12. package/example/data/pathfinder-1.mjs +23 -0
  13. package/example/data/pathfinder-2.mjs +19 -0
  14. package/example/data/pipe.mjs +14 -0
  15. package/example/data/storage/restapi.mjs +11 -0
  16. package/example/data/transformer.mjs +9 -0
  17. package/example/dom/customelement.mjs +13 -0
  18. package/example/dom/theme.mjs +5 -0
  19. package/example/dom/updater.mjs +23 -0
  20. package/example/i18n/formatter.mjs +10 -0
  21. package/example/i18n/providers/fetch.mjs +5 -0
  22. package/example/i18n/translations.mjs +20 -0
  23. package/example/types/basewithoptions.mjs +10 -0
  24. package/example/types/is-1.mjs +5 -0
  25. package/example/types/is-10.mjs +6 -0
  26. package/example/types/is-2.mjs +4 -0
  27. package/example/types/is-3.mjs +4 -0
  28. package/example/types/is-4.mjs +5 -0
  29. package/example/types/is-5.mjs +4 -0
  30. package/example/types/is-6.mjs +4 -0
  31. package/example/types/is-7.mjs +4 -0
  32. package/example/types/is-8.mjs +4 -0
  33. package/example/types/is-9.mjs +6 -0
  34. package/example/types/noderecursiveiterator.mjs +32 -0
  35. package/example/types/observer.mjs +9 -0
  36. package/example/types/proxyobserver.mjs +25 -0
  37. package/example/types/queue.mjs +20 -0
  38. package/example/types/tokenlist-1.mjs +4 -0
  39. package/example/types/tokenlist-2.mjs +7 -0
  40. package/example/types/tokenlist-3.mjs +5 -0
  41. package/example/types/tokenlist-4.mjs +5 -0
  42. package/example/types/tokenlist-5.mjs +5 -0
  43. package/example/types/typeof.mjs +9 -0
  44. package/example/types/version-1.mjs +6 -0
  45. package/example/types/version-2.mjs +3 -0
  46. package/example/util/comparator.mjs +10 -0
  47. package/example/util/deadmansswitch.mjs +9 -0
  48. package/example/util/processing.mjs +17 -0
  49. package/package.json +5 -59
  50. package/source/{constants.js → constants.mjs} +7 -10
  51. package/source/constraints/{abstract.js → abstract.mjs} +8 -9
  52. package/source/constraints/{abstractoperator.js → abstractoperator.mjs} +11 -8
  53. package/source/constraints/andoperator.mjs +38 -0
  54. package/source/constraints/invalid.mjs +38 -0
  55. package/source/constraints/isarray.mjs +41 -0
  56. package/source/constraints/isobject.mjs +41 -0
  57. package/source/constraints/{namespace.js → namespace.mjs} +3 -8
  58. package/source/constraints/{oroperator.js → oroperator.mjs} +10 -42
  59. package/source/constraints/valid.mjs +38 -0
  60. package/source/data/{buildmap.js → buildmap.mjs} +18 -104
  61. package/source/data/{buildtree.js → buildtree.mjs} +11 -31
  62. package/source/data/datasource/{namespace.js → namespace.mjs} +1 -9
  63. package/source/data/datasource/restapi/namespace.mjs +8 -0
  64. package/source/data/datasource/restapi/{writeerror.js → writeerror.mjs} +8 -9
  65. package/source/data/datasource/{restapi.js → restapi.mjs} +15 -45
  66. package/source/data/datasource/storage/localstorage.mjs +45 -0
  67. package/source/data/datasource/storage/{namespace.js → namespace.mjs} +1 -9
  68. package/source/data/datasource/storage/sessionstorage.mjs +45 -0
  69. package/source/data/datasource/{storage.js → storage.mjs} +12 -35
  70. package/source/data/{datasource.js → datasource.mjs} +17 -45
  71. package/source/data/{diff.js → diff.mjs} +10 -69
  72. package/source/data/{extend.js → extend.mjs} +10 -28
  73. package/source/data/{namespace.js → namespace.mjs} +2 -8
  74. package/source/data/{pathfinder.js → pathfinder.mjs} +18 -77
  75. package/source/data/{pipe.js → pipe.mjs} +14 -46
  76. package/source/data/{transformer.js → transformer.mjs} +18 -43
  77. package/source/dom/{assembler.js → assembler.mjs} +12 -28
  78. package/source/dom/{attributes.js → attributes.mjs} +42 -253
  79. package/source/dom/{constants.js → constants.mjs} +110 -61
  80. package/source/dom/{customcontrol.js → customcontrol.mjs} +10 -17
  81. package/source/dom/{customelement.js → customelement.mjs} +28 -52
  82. package/source/dom/{events.js → events.mjs} +15 -64
  83. package/source/dom/{focusmanager.js → focusmanager.mjs} +13 -34
  84. package/source/dom/{locale.js → locale.mjs} +11 -26
  85. package/source/dom/{namespace.js → namespace.mjs} +1 -8
  86. package/source/dom/{ready.js → ready.mjs} +12 -30
  87. package/source/dom/resource/{data.js → data.mjs} +11 -31
  88. package/source/dom/resource/link/namespace.mjs +10 -0
  89. package/source/dom/resource/link/stylesheet.mjs +35 -0
  90. package/source/dom/resource/{link.js → link.mjs} +9 -29
  91. package/source/dom/resource/namespace.mjs +8 -0
  92. package/source/dom/resource/{script.js → script.mjs} +9 -29
  93. package/source/dom/{resource.js → resource.mjs} +19 -39
  94. package/source/dom/{resourcemanager.js → resourcemanager.mjs} +17 -35
  95. package/source/dom/{template.js → template.mjs} +18 -43
  96. package/source/dom/{theme.js → theme.mjs} +14 -36
  97. package/source/dom/{updater.js → updater.mjs} +34 -68
  98. package/source/dom/{util.js → util.mjs} +17 -66
  99. package/source/dom/worker/{factory.js → factory.mjs} +13 -34
  100. package/source/dom/worker/namespace.mjs +8 -0
  101. package/source/i18n/{formatter.js → formatter.mjs} +14 -45
  102. package/source/i18n/{locale.js → locale.mjs} +15 -30
  103. package/source/i18n/{namespace.js → namespace.mjs} +1 -9
  104. package/source/i18n/provider.mjs +40 -0
  105. package/source/i18n/providers/{fetch.js → fetch.mjs} +18 -43
  106. package/source/i18n/providers/namespace.mjs +8 -0
  107. package/source/i18n/{translations.js → translations.mjs} +12 -52
  108. package/source/logging/handler/console.mjs +50 -0
  109. package/source/logging/handler/namespace.mjs +6 -0
  110. package/source/logging/{handler.js → handler.mjs} +13 -30
  111. package/source/logging/logentry.mjs +51 -0
  112. package/source/logging/{logger.js → logger.mjs} +12 -28
  113. package/source/logging/{namespace.js → namespace.mjs} +1 -9
  114. package/source/math/{namespace.js → namespace.mjs} +1 -9
  115. package/source/math/{random.js → random.mjs} +8 -34
  116. package/source/monster.mjs +114 -0
  117. package/source/text/{formatter.js → formatter.mjs} +17 -33
  118. package/source/text/{namespace.js → namespace.mjs} +1 -9
  119. package/source/types/base.mjs +31 -0
  120. package/source/types/{basewithoptions.js → basewithoptions.mjs} +17 -46
  121. package/source/types/{binary.js → binary.mjs} +10 -42
  122. package/source/types/{dataurl.js → dataurl.mjs} +12 -46
  123. package/source/types/{global.js → global.mjs} +20 -12
  124. package/source/types/{id.js → id.mjs} +10 -27
  125. package/source/types/is.mjs +225 -0
  126. package/source/types/{mediatype.js → mediatype.mjs} +13 -29
  127. package/source/types/{namespace.js → namespace.mjs} +1 -8
  128. package/source/types/{node.js → node.mjs} +11 -28
  129. package/source/types/{nodelist.js → nodelist.mjs} +17 -32
  130. package/source/types/{noderecursiveiterator.js → noderecursiveiterator.mjs} +14 -65
  131. package/source/types/{observer.js → observer.mjs} +15 -42
  132. package/source/types/{observerlist.js → observerlist.mjs} +12 -29
  133. package/source/types/{proxyobserver.js → proxyobserver.mjs} +19 -62
  134. package/source/types/{queue.js → queue.mjs} +10 -47
  135. package/source/types/randomid.mjs +45 -0
  136. package/source/types/regex.mjs +27 -0
  137. package/source/types/{stack.js → stack.mjs} +8 -24
  138. package/source/types/{tokenlist.js → tokenlist.mjs} +20 -64
  139. package/source/types/typeof.mjs +37 -0
  140. package/source/types/{uniquequeue.js → uniquequeue.mjs} +11 -27
  141. package/source/types/{uuid.js → uuid.mjs} +15 -33
  142. package/source/types/{validate.js → validate.mjs} +38 -155
  143. package/source/types/{version.js → version.mjs} +19 -62
  144. package/source/util/{clone.js → clone.mjs} +10 -28
  145. package/source/util/{comparator.js → comparator.mjs} +13 -43
  146. package/source/util/{deadmansswitch.js → deadmansswitch.mjs} +15 -40
  147. package/source/util/freeze.mjs +39 -0
  148. package/source/util/{namespace.js → namespace.mjs} +1 -9
  149. package/source/util/{processing.js → processing.mjs} +13 -51
  150. package/source/util/{trimspaces.js → trimspaces.mjs} +14 -21
  151. package/test/cases/constraint/{andoperator.js → andoperator.mjs} +3 -3
  152. package/test/cases/constraint/{invalid.js → invalid.mjs} +1 -1
  153. package/test/cases/constraint/{isarray.js → isarray.mjs} +1 -1
  154. package/test/cases/constraint/{isobject.js → isobject.mjs} +1 -1
  155. package/test/cases/constraint/{oroperator.js → oroperator.mjs} +3 -3
  156. package/test/cases/constraint/{valid.js → valid.mjs} +1 -1
  157. package/test/cases/data/{buildmap.js → buildmap.mjs} +1 -1
  158. package/test/cases/data/{buildtree.js → buildtree.mjs} +2 -2
  159. package/test/cases/data/datasource/{restapi.js → restapi.mjs} +5 -5
  160. package/test/cases/data/datasource/storage/{localstorage.js → localstorage.mjs} +5 -5
  161. package/test/cases/data/datasource/storage/{sessionstorage.js → sessionstorage.mjs} +5 -5
  162. package/test/cases/data/{datasource.js → datasource.mjs} +1 -1
  163. package/test/cases/data/{diff.js → diff.mjs} +2 -2
  164. package/test/cases/data/{extend.js → extend.mjs} +1 -1
  165. package/test/cases/data/{pathfinder.js → pathfinder.mjs} +1 -1
  166. package/test/cases/data/{pipe.js → pipe.mjs} +19 -5
  167. package/test/cases/data/{transformer.js → transformer.mjs} +14 -10
  168. package/test/cases/dom/{assembler.js → assembler.mjs} +2 -2
  169. package/test/cases/dom/{attributes.js → attributes.mjs} +2 -2
  170. package/test/cases/dom/{customcontrol.js → customcontrol.mjs} +6 -6
  171. package/test/cases/dom/{customelement.js → customelement.mjs} +6 -6
  172. package/test/cases/dom/{events.js → events.mjs} +2 -2
  173. package/test/cases/dom/{focusmanager.js → focusmanager.mjs} +3 -3
  174. package/test/cases/dom/{locale.js → locale.mjs} +2 -2
  175. package/test/cases/dom/{ready.js → ready.mjs} +2 -2
  176. package/test/cases/dom/resource/{data.js → data.mjs} +9 -9
  177. package/test/cases/dom/resource/link/{stylesheet.js → stylesheet.mjs} +6 -6
  178. package/test/cases/dom/resource/{link.js → link.mjs} +6 -6
  179. package/test/cases/dom/resource/{script.js → script.mjs} +6 -6
  180. package/test/cases/dom/{resourcemanager.js → resourcemanager.mjs} +6 -6
  181. package/test/cases/dom/{template.js → template.mjs} +3 -3
  182. package/test/cases/dom/{theme.js → theme.mjs} +3 -3
  183. package/test/cases/dom/{updater.js → updater.mjs} +6 -6
  184. package/test/cases/dom/{util.js → util.mjs} +2 -2
  185. package/test/cases/dom/worker/{factory.js → factory.mjs} +4 -4
  186. package/test/cases/i18n/{formatter.js → formatter.mjs} +2 -2
  187. package/test/cases/i18n/{locale.js → locale.mjs} +1 -1
  188. package/test/cases/i18n/{provider.js → provider.mjs} +1 -1
  189. package/test/cases/i18n/providers/{fetch.js → fetch.mjs} +3 -3
  190. package/test/cases/i18n/{translations.js → translations.mjs} +2 -2
  191. package/test/cases/logging/handler/{console.js → console.mjs} +3 -3
  192. package/test/cases/logging/{handler.js → handler.mjs} +3 -3
  193. package/test/cases/logging/{logentry.js → logentry.mjs} +1 -1
  194. package/test/cases/logging/{logger.js → logger.mjs} +1 -1
  195. package/test/cases/math/random.mjs +101 -0
  196. package/test/cases/monster.mjs +20 -0
  197. package/test/cases/text/{formatter.js → formatter.mjs} +1 -1
  198. package/test/cases/types/{base.js → base.mjs} +1 -1
  199. package/test/cases/types/{basewithoptions.js → basewithoptions.mjs} +1 -1
  200. package/test/cases/types/{binary.js → binary.mjs} +1 -1
  201. package/test/cases/types/{dataurl.js → dataurl.mjs} +1 -1
  202. package/test/cases/types/{global.js → global.mjs} +1 -1
  203. package/test/cases/types/{id.js → id.mjs} +17 -6
  204. package/test/cases/types/{is.js → is.mjs} +20 -8
  205. package/test/cases/types/{mediatype.js → mediatype.mjs} +1 -1
  206. package/test/cases/types/{node.js → node.mjs} +3 -3
  207. package/test/cases/types/{nodelist.js → nodelist.mjs} +2 -2
  208. package/test/cases/types/{noderecursiveiterator.js → noderecursiveiterator.mjs} +3 -3
  209. package/test/cases/types/{observer.js → observer.mjs} +1 -1
  210. package/test/cases/types/{observerlist.js → observerlist.mjs} +2 -2
  211. package/test/cases/types/{proxyobserver.js → proxyobserver.mjs} +4 -4
  212. package/test/cases/types/{queue.js → queue.mjs} +1 -1
  213. package/test/cases/types/randomid.mjs +39 -0
  214. package/test/cases/types/regex.mjs +46 -0
  215. package/test/cases/types/{stack.js → stack.mjs} +1 -1
  216. package/test/cases/types/{tokenlist.js → tokenlist.mjs} +1 -1
  217. package/test/cases/types/{typeof.js → typeof.mjs} +3 -4
  218. package/test/cases/types/{uniquequeue.js → uniquequeue.mjs} +1 -1
  219. package/test/cases/types/{uuid.js → uuid.mjs} +30 -10
  220. package/test/cases/types/{validate.js → validate.mjs} +3 -4
  221. package/test/cases/types/{version.js → version.mjs} +1 -2
  222. package/test/cases/util/{clone.js → clone.mjs} +1 -1
  223. package/test/cases/util/{comparator.js → comparator.mjs} +1 -1
  224. package/test/cases/util/{deadmansswitch.js → deadmansswitch.mjs} +1 -1
  225. package/test/cases/util/{freeze.js → freeze.mjs} +1 -1
  226. package/test/cases/util/{processing.js → processing.mjs} +1 -1
  227. package/test/cases/util/{trimspaces.js → trimspaces.mjs} +1 -1
  228. package/test/util/{chai-dom.js → chai-dom.mjs} +0 -0
  229. package/test/util/{cleanupdom.js → cleanupdom.mjs} +0 -0
  230. package/test/util/{jsdom.js → jsdom.mjs} +2 -2
  231. package/test/util/{localstorage.js → localstorage.mjs} +0 -0
  232. package/test/web/import.js +77 -78
  233. package/test/web/prepare.js +0 -8
  234. package/test/web/test.html +5 -4
  235. package/test/web/tests.js +25731 -587
  236. package/dist/modules/constants.js +0 -2
  237. package/dist/modules/constraints/abstract.js +0 -2
  238. package/dist/modules/constraints/abstractoperator.js +0 -2
  239. package/dist/modules/constraints/andoperator.js +0 -2
  240. package/dist/modules/constraints/invalid.js +0 -2
  241. package/dist/modules/constraints/isarray.js +0 -2
  242. package/dist/modules/constraints/isobject.js +0 -2
  243. package/dist/modules/constraints/namespace.js +0 -2
  244. package/dist/modules/constraints/oroperator.js +0 -2
  245. package/dist/modules/constraints/valid.js +0 -2
  246. package/dist/modules/data/buildmap.js +0 -2
  247. package/dist/modules/data/buildtree.js +0 -2
  248. package/dist/modules/data/datasource/namespace.js +0 -2
  249. package/dist/modules/data/datasource/restapi/writeerror.js +0 -2
  250. package/dist/modules/data/datasource/restapi.js +0 -2
  251. package/dist/modules/data/datasource/storage/localstorage.js +0 -2
  252. package/dist/modules/data/datasource/storage/namespace.js +0 -2
  253. package/dist/modules/data/datasource/storage/sessionstorage.js +0 -2
  254. package/dist/modules/data/datasource/storage.js +0 -2
  255. package/dist/modules/data/datasource.js +0 -2
  256. package/dist/modules/data/diff.js +0 -2
  257. package/dist/modules/data/extend.js +0 -2
  258. package/dist/modules/data/namespace.js +0 -2
  259. package/dist/modules/data/pathfinder.js +0 -2
  260. package/dist/modules/data/pipe.js +0 -2
  261. package/dist/modules/data/transformer.js +0 -2
  262. package/dist/modules/dom/assembler.js +0 -2
  263. package/dist/modules/dom/attributes.js +0 -2
  264. package/dist/modules/dom/constants.js +0 -2
  265. package/dist/modules/dom/customcontrol.js +0 -2
  266. package/dist/modules/dom/customelement.js +0 -2
  267. package/dist/modules/dom/events.js +0 -2
  268. package/dist/modules/dom/focusmanager.js +0 -2
  269. package/dist/modules/dom/locale.js +0 -2
  270. package/dist/modules/dom/namespace.js +0 -2
  271. package/dist/modules/dom/ready.js +0 -2
  272. package/dist/modules/dom/resource/data.js +0 -2
  273. package/dist/modules/dom/resource/link/stylesheet.js +0 -2
  274. package/dist/modules/dom/resource/link.js +0 -2
  275. package/dist/modules/dom/resource/script.js +0 -2
  276. package/dist/modules/dom/resource.js +0 -2
  277. package/dist/modules/dom/resourcemanager.js +0 -2
  278. package/dist/modules/dom/template.js +0 -2
  279. package/dist/modules/dom/theme.js +0 -2
  280. package/dist/modules/dom/updater.js +0 -2
  281. package/dist/modules/dom/util.js +0 -2
  282. package/dist/modules/dom/worker/factory.js +0 -2
  283. package/dist/modules/i18n/formatter.js +0 -2
  284. package/dist/modules/i18n/locale.js +0 -2
  285. package/dist/modules/i18n/namespace.js +0 -2
  286. package/dist/modules/i18n/provider.js +0 -2
  287. package/dist/modules/i18n/providers/fetch.js +0 -2
  288. package/dist/modules/i18n/providers/namespace.js +0 -2
  289. package/dist/modules/i18n/translations.js +0 -2
  290. package/dist/modules/logging/handler/console.js +0 -2
  291. package/dist/modules/logging/handler/namespace.js +0 -2
  292. package/dist/modules/logging/handler.js +0 -2
  293. package/dist/modules/logging/logentry.js +0 -2
  294. package/dist/modules/logging/logger.js +0 -2
  295. package/dist/modules/logging/namespace.js +0 -2
  296. package/dist/modules/math/namespace.js +0 -2
  297. package/dist/modules/math/random.js +0 -2
  298. package/dist/modules/monster.js +0 -2
  299. package/dist/modules/namespace.js +0 -2
  300. package/dist/modules/text/formatter.js +0 -2
  301. package/dist/modules/text/namespace.js +0 -2
  302. package/dist/modules/types/base.js +0 -2
  303. package/dist/modules/types/basewithoptions.js +0 -2
  304. package/dist/modules/types/binary.js +0 -2
  305. package/dist/modules/types/dataurl.js +0 -2
  306. package/dist/modules/types/global.js +0 -2
  307. package/dist/modules/types/id.js +0 -2
  308. package/dist/modules/types/is.js +0 -2
  309. package/dist/modules/types/mediatype.js +0 -2
  310. package/dist/modules/types/namespace.js +0 -2
  311. package/dist/modules/types/node.js +0 -2
  312. package/dist/modules/types/nodelist.js +0 -2
  313. package/dist/modules/types/noderecursiveiterator.js +0 -2
  314. package/dist/modules/types/observer.js +0 -2
  315. package/dist/modules/types/observerlist.js +0 -2
  316. package/dist/modules/types/proxyobserver.js +0 -2
  317. package/dist/modules/types/queue.js +0 -2
  318. package/dist/modules/types/randomid.js +0 -2
  319. package/dist/modules/types/regex.js +0 -2
  320. package/dist/modules/types/stack.js +0 -2
  321. package/dist/modules/types/tokenlist.js +0 -2
  322. package/dist/modules/types/typeof.js +0 -2
  323. package/dist/modules/types/uniquequeue.js +0 -2
  324. package/dist/modules/types/uuid.js +0 -2
  325. package/dist/modules/types/validate.js +0 -2
  326. package/dist/modules/types/version.js +0 -2
  327. package/dist/modules/util/clone.js +0 -2
  328. package/dist/modules/util/comparator.js +0 -2
  329. package/dist/modules/util/deadmansswitch.js +0 -2
  330. package/dist/modules/util/freeze.js +0 -2
  331. package/dist/modules/util/namespace.js +0 -2
  332. package/dist/modules/util/processing.js +0 -2
  333. package/dist/modules/util/trimspaces.js +0 -2
  334. package/dist/monster.dev.js +0 -15490
  335. package/dist/monster.dev.js.map +0 -1
  336. package/dist/monster.js +0 -2
  337. package/source/constraints/andoperator.js +0 -71
  338. package/source/constraints/invalid.js +0 -63
  339. package/source/constraints/isarray.js +0 -71
  340. package/source/constraints/isobject.js +0 -72
  341. package/source/constraints/valid.js +0 -63
  342. package/source/data/datasource/storage/localstorage.js +0 -64
  343. package/source/data/datasource/storage/sessionstorage.js +0 -61
  344. package/source/dom/resource/link/stylesheet.js +0 -54
  345. package/source/i18n/provider.js +0 -58
  346. package/source/i18n/providers/namespace.js +0 -16
  347. package/source/logging/handler/console.js +0 -66
  348. package/source/logging/handler/namespace.js +0 -14
  349. package/source/logging/logentry.js +0 -68
  350. package/source/monster.js +0 -80
  351. package/source/namespace.js +0 -171
  352. package/source/types/base.js +0 -50
  353. package/source/types/is.js +0 -429
  354. package/source/types/package.d.ts +0 -1
  355. package/source/types/randomid.js +0 -60
  356. package/source/types/regex.js +0 -49
  357. package/source/types/typeof.js +0 -63
  358. package/source/util/freeze.js +0 -57
  359. package/test/cases/math/random.js +0 -82
  360. package/test/cases/monster.js +0 -23
  361. package/test/cases/namespace.js +0 -93
  362. package/test/cases/types/randomid.js +0 -24
  363. package/test/cases/types/regex.js +0 -32
  364. package/test/web/monster-dev.html +0 -22
  365. package/test/web/monster.html +0 -21
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster}from"./namespace.js";const internalSymbol=Symbol("internalData"),internalStateSymbol=Symbol("state");export{Monster,internalSymbol,internalStateSymbol};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";class AbstractConstraint extends Base{constructor(){super()}isValid(s){return Promise.reject(s)}}assignToNamespace("Monster.Constraints",AbstractConstraint);export{Monster,AbstractConstraint};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{AbstractConstraint}from"./abstract.js";class AbstractOperator extends AbstractConstraint{constructor(t,r){if(super(),!(t instanceof AbstractConstraint&&r instanceof AbstractConstraint))throw new TypeError("parameters must be from type AbstractConstraint");this.operantA=t,this.operantB=r}}assignToNamespace("Monster.Constraints",AbstractOperator);export{Monster,AbstractOperator};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{AbstractOperator}from"./abstractoperator.js";class AndOperator extends AbstractOperator{isValid(r){return Promise.all([this.operantA.isValid(r),this.operantB.isValid(r)])}}assignToNamespace("Monster.Constraints",AndOperator);export{Monster,AndOperator};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{AbstractConstraint}from"./abstract.js";class Invalid extends AbstractConstraint{isValid(s){return Promise.reject(s)}}assignToNamespace("Monster.Constraints",Invalid);export{Monster,Invalid};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isArray}from"../types/is.js";import{AbstractConstraint}from"./abstract.js";class IsArray extends AbstractConstraint{isValid(s){return isArray(s)?Promise.resolve(s):Promise.reject(s)}}assignToNamespace("Monster.Constraints",IsArray);export{Monster,IsArray};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isObject}from"../types/is.js";import{AbstractConstraint}from"./abstract.js";class IsObject extends AbstractConstraint{isValid(s){return isObject(s)?Promise.resolve(s):Promise.reject(s)}}assignToNamespace("Monster.Constraints",IsObject);export{Monster,IsObject};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";const namespace="Monster.Constraints";export{namespace};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{AbstractOperator}from"./abstractoperator.js";class OrOperator extends AbstractOperator{isValid(s){var o=this;return new Promise(function(t,r){let a,e;o.operantA.isValid(s).then(function(){t()}).catch(function(){(a=!1)===e&&r()}),o.operantB.isValid(s).then(function(){t()}).catch(function(){(e=!1)===a&&r()})})}}assignToNamespace("Monster.Constraints",OrOperator);export{Monster,OrOperator};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{AbstractConstraint}from"./abstract.js";class Valid extends AbstractConstraint{isValid(s){return Promise.resolve(s)}}assignToNamespace("Monster.Constraints",Valid);export{Monster,Valid};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isFunction,isObject,isString}from"../types/is.js";import{validateString}from"../types/validate.js";import{clone}from"../util/clone.js";import{DELIMITER,Pathfinder,WILDCARD}from"./pathfinder.js";const PARENT="^";function buildMap(t,e,a,n,i){return assembleParts(t,e,i,function(t,e,i){e=build(t,n,e),t=build(t,a),this.set(e,t)})}function assembleParts(t,e,a,n){const r=new Map;let i;if(isFunction(e)){if(i=e(t),!(i instanceof Map))throw new TypeError("the selector callback must return a map")}else{if(!isString(e))throw new TypeError("selector is neither a string nor a function");i=new Map,buildFlatMap.call(i,t,e)}return i instanceof Map&&i.forEach((t,e,i)=>{isFunction(a)&&!0!==a.call(i,t,e)||n.call(r,t,e,i)}),r}function buildFlatMap(i,e,a,n){var r=this;const s=new Map;var f=r.size;void 0===a&&(a=[]);let o=e.split(DELIMITER),t,l=[];do{if(t=o.shift(),l.push(t),t===WILDCARD){let t=new Pathfinder(i),e;try{e=t.getVia(l.join(DELIMITER))}catch(t){e=new Map}for(const[c,p]of e){let e=clone(a);l.map(t=>{e.push(t===WILDCARD?c:t)});var u=e.join(DELIMITER);let t=buildFlatMap.call(r,p,o.join(DELIMITER),e,p);isObject(t)&&void 0!==n&&(t[PARENT]=n),s.set(u,t)}}}while(0<o.length);if(f===r.size)for(var[d,h]of s)r.set(d,h);return i}function build(t,a,n){if(void 0===a)return n||t;validateString(a);const e=[...a.matchAll(/(?<placeholder>\${(?<path>[a-z\^A-Z.\-_0-9]*)})/gm)];let r=new Pathfinder(t);return 0===e.length?r.getVia(a):(e.forEach(e=>{var e=e?.groups,i=e?.placeholder;if(void 0!==i){e=e?.path;let t=r.getVia(e);void 0===t&&(t=n),a=a.replaceAll(i,t)}}),a)}assignToNamespace("Monster.Data",buildMap);export{PARENT,Monster,buildMap,assembleParts};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isArray,isObject}from"../types/is.js";import{Node}from"../types/node.js";import{NodeList}from"../types/nodelist.js";import{assembleParts}from"./buildmap.js";import{extend}from"./extend.js";const parentSymbol=Symbol("parent"),rootSymbol=Symbol("root");function buildTree(e,o,i,a,t){const n=new Map;isObject(t)||(t={});var s=(t=extend({},{rootReferences:[null,void 0],filter:void 0},t))?.filter;let d=t.rootReferences;isArray(d)||(d=[d]);const r=assembleParts(e,o,s,function(e,o,t){var s=e?.[i];let r=e?.[a];if(-1!==d.indexOf(r)&&(r=rootSymbol),void 0===s)throw new Error("the object has no value for the specified id");e[parentSymbol]=r;e=new Node(e);this.has(r)?this.get(r).add(e):this.set(r,(new NodeList).add(e)),n.set(s,e)}),m=(n.forEach(e=>{var o=e?.value?.[i];r.has(o)&&(e.childNodes=r.get(o),r.delete(o))}),new NodeList);return r.forEach(e=>{e instanceof Set&&e.forEach(e=>{m.add(e)})}),m}assignToNamespace("Monster.Data",buildTree);export{Monster,buildTree};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";const namespace="Monster.Data.Datasource";export{namespace};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{internalSymbol}from"../../../constants.js";import{assignToNamespace,Monster}from"../../../namespace.js";class WriteError extends Error{constructor(r,e,t){super(r),this[internalSymbol]={response:e,validation:t}}getResponse(){return this[internalSymbol].response}getValidation(){return this[internalSymbol].validation}}assignToNamespace("Monster.Data.Datasource.RestAPI",WriteError);export{Monster,WriteError};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{internalSymbol}from"../../constants.js";import{assignToNamespace,Monster}from"../../namespace.js";import{isObject}from"../../types/is.js";import{Datasource}from"../datasource.js";import{Pathfinder}from"../pathfinder.js";import{Pipe}from"../pipe.js";import{WriteError}from"./restapi/writeerror.js";class RestAPI extends Datasource{constructor(t,e){super();const r={};isObject(t)&&(r.read=t),isObject(e)&&(r.write=e),this.setOptions(r)}get defaults(){return Object.assign({},super.defaults,{write:{init:{method:"POST"},acceptedStatus:[200,201],url:void 0,mapping:{transformer:void 0,callbacks:[]},report:{path:void 0}},read:{init:{method:"GET"},acceptedStatus:[200],url:void 0,mapping:{transformer:void 0,callbacks:[]}}})}read(){const s=this;let n,t=s.getOption("read.init");return isObject(t)||(t={}),fetch(s.getOption("read.url"),t).then(t=>{n=t;const e=s.getOption("read.acceptedStatus",[200]);if(-1===e.indexOf(t.status))throw Error("the data cannot be read (response "+t.status+")");return t.text()}).then(e=>{let t;try{t=JSON.parse(e)}catch(t){throw 100<e.length&&(e=e.substring(0,97)+"..."),new Error("the response does not contain a valid json (actual: "+e+").")}e=s.getOption("read.mapping.transformer");if(void 0!==e){const r=new Pipe(e);t=r.run(t)}return s.set(t),n})}write(){const e=this;let t=e.getOption("write.init"),r=(isObject(t)||(t={}),"object"!=typeof t.headers&&(t.headers={"Content-Type":"application/json"}),e.get());var s=e.getOption("write.mapping.transformer");if(void 0!==s){const a=new Pipe(s);r=a.run(r)}var n,s=e.getOption("write.sheathing.object"),i=e.getOption("write.sheathing.path");let o=e.getOption("write.report.path");return s&&i&&(n=r,r=s,new Pathfinder(r).setVia(i,n)),t.body=JSON.stringify(r),fetch(e.getOption("write.url"),t).then(s=>{const t=e.getOption("write.acceptedStatus",[200,2001]);return-1===t.indexOf(s.status)?s.text().then(e=>{let t,r;try{t=JSON.parse(e),r=new Pathfinder(t).getVia(o)}catch(t){throw 100<e.length&&(e=e.substring(0,97)+"..."),new Error("the response does not contain a valid json (actual: "+e+").")}throw new WriteError("the data cannot be written (response "+s.status+")",s,r)}):s})}getClone(){return new RestAPI(this[internalSymbol].getRealSubject().options.read,this[internalSymbol].getRealSubject().options.write)}}assignToNamespace("Monster.Data.Datasource",RestAPI);export{Monster,RestAPI};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{internalSymbol}from"../../../constants.js";import{assignToNamespace,Monster}from"../../../namespace.js";import{getGlobalObject}from"../../../types/global.js";import{Datasource}from"../../datasource.js";import{Storage,storageObjectSymbol}from"../storage.js";class LocalStorage extends Storage{[storageObjectSymbol](){return getGlobalObject("localStorage")}getClone(){return new LocalStorage(this[internalSymbol].getRealSubject().options.key)}}assignToNamespace("Monster.Data.Datasource.Storage",LocalStorage);export{Monster,LocalStorage};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";const namespace="Monster.Data.Datasource.Storage";export{namespace};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{internalSymbol}from"../../../constants.js";import{assignToNamespace,Monster}from"../../../namespace.js";import{getGlobalObject}from"../../../types/global.js";import{Datasource}from"../../datasource.js";import{Storage,storageObjectSymbol}from"../storage.js";class SessionStorage extends Storage{[storageObjectSymbol](){return getGlobalObject("sessionStorage")}getClone(){return new SessionStorage(this[internalSymbol].getRealSubject().options.key)}}assignToNamespace("Monster.Data.Datasource.Storage",SessionStorage);export{Monster,SessionStorage};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{internalSymbol}from"../../constants.js";import{assignToNamespace,Monster}from"../../namespace.js";import{validateString}from"../../types/validate.js";import{Datasource}from"../datasource.js";const storageObjectSymbol=Symbol("storageObject");class Storage extends Datasource{constructor(e){super(),this.setOption("key",validateString(e))}get defaults(){return Object.assign({},super.defaults,{key:void 0})}[storageObjectSymbol](){throw new Error("this method must be implemented by derived classes")}read(){const o=this,s=o[storageObjectSymbol]();return new Promise(function(e){var t=JSON.parse(s.getItem(o.getOption("key")));o.set(t??{}),e()})}write(){const o=this,s=o[storageObjectSymbol]();return new Promise(function(e){var t=o.get();void 0===t?s.removeItem(o.getOption("key")):s.setItem(o.getOption("key"),JSON.stringify(t)),e()})}getClone(){return new Storage(this[internalSymbol].getRealSubject().options.key)}}assignToNamespace("Monster.Data.Datasource",Storage);export{Monster,Storage,storageObjectSymbol};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{internalSymbol}from"../constants.js";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{parseDataURL}from"../types/dataurl.js";import{isString}from"../types/is.js";import{ProxyObserver}from"../types/proxyobserver.js";import{validateObject}from"../types/validate.js";import{extend}from"./extend.js";import{Pathfinder}from"./pathfinder.js";const internalDataSymbol=Symbol("internalData");class Datasource extends Base{constructor(){super(),this[internalSymbol]=new ProxyObserver({options:extend({},this.defaults)}),this[internalDataSymbol]=new ProxyObserver({})}attachObserver(t){return this[internalDataSymbol].attachObserver(t),this}detachObserver(t){return this[internalDataSymbol].detachObserver(t),this}containsObserver(t){return this[internalDataSymbol].containsObserver(t)}get defaults(){return{}}setOption(t,e){return new Pathfinder(this[internalSymbol].getSubject().options).setVia(t,e),this}setOptions(t){isString(t)&&(t=parseOptionsJSON(t));var e=this;return extend(e[internalSymbol].getSubject().options,e.defaults,t),e}getOption(t,e){let r;try{r=new Pathfinder(this[internalSymbol].getRealSubject().options).getVia(t)}catch(t){}return void 0===r?e:r}read(){throw new Error("this method must be implemented by derived classes")}write(){throw new Error("this method must be implemented by derived classes")}get(){return this[internalDataSymbol].getRealSubject()}set(t){return this[internalDataSymbol].setSubject(t),this}}function parseOptionsJSON(e){if(isString(e)){try{e=parseDataURL(e).content}catch(t){}try{var t=JSON.parse(e);return validateObject(t),t}catch(t){throw new Error("the options does not contain a valid json definition (actual: "+e+").")}}return{}}assignToNamespace("Monster.Data",Datasource);export{Monster,Datasource};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isArray,isObject}from"../types/is.js";import{typeOf}from"../types/typeof.js";function diff(e,t){return doDiff(e,t)}function getKeys(e,t,n){if(isArray(n)){const o=e.length>t.length?new Array(e.length):new Array(t.length);return o.fill(0),new Set(o.map((e,t)=>t))}return new Set(Object.keys(e).concat(Object.keys(t)))}function doDiff(t,n,e,o){var r=typeOf(t),s=typeOf(n);const a=e||[],i=o||[];return r!==s||"object"!==r&&"array"!==r?void 0!==(o=getOperator(t,n,r,s))&&i.push(buildResult(t,n,o,e)):getKeys(t,n,r).forEach(e=>{Object.prototype.hasOwnProperty.call(t,e)?Object.prototype.hasOwnProperty.call(n,e)?doDiff(t[e],n[e],a.concat(e),i):i.push(buildResult(t[e],n[e],"delete",a.concat(e))):i.push(buildResult(t[e],n[e],"add",a.concat(e)))}),i}function buildResult(e,t,n,o){const r={operator:n,path:o};return"add"!==n&&(r.first={value:e,type:typeof e},!isObject(e)||void 0!==(o=Object.getPrototypeOf(e)?.constructor?.name)&&(r.first.instance=o)),"add"!==n&&"update"!==n||(r.second={value:t,type:typeof t},!isObject(t)||void 0!==(e=Object.getPrototypeOf(t)?.constructor?.name)&&(r.second.instance=e)),r}function isNotEqual(e,t){return typeof e!=typeof t||(e instanceof Date&&t instanceof Date?e.getTime()!==t.getTime():e!==t)}function getOperator(e,t){let n;var o=typeof e,r=typeof t;return"undefined"==o&&"undefined"!=r?n="add":"undefined"!=o&&"undefined"==r?n="delete":isNotEqual(e,t)&&(n="update"),n}assignToNamespace("Monster.Data",diff);export{Monster,diff};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isArray,isObject}from"../types/is.js";import{typeOf}from"../types/typeof.js";function extend(){let e,t;for(t=0;t<arguments.length;t++){var r=arguments[t];if(!isObject(r)&&!isArray(r))throw new Error("unsupported argument "+JSON.stringify(r));if(void 0!==e)for(var s in r){var i=r?.[s];if(i!==e?.[s])if(isObject(i)&&"object"===typeOf(i)||isArray(i)){if(void 0===e[s])isArray(i)?e[s]=[]:e[s]={};else if(typeOf(e[s])!==typeOf(i))throw new Error("type mismatch: "+JSON.stringify(e[s])+"("+typeOf(e[s])+") != "+JSON.stringify(i)+"("+typeOf(i)+")");e[s]=extend(e[s],i)}else e[s]=i}else e=r}return e}assignToNamespace("Monster.Data",extend);export{Monster,extend};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";const namespace="Monster.Data";export{namespace};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{isArray,isInteger,isObject,isPrimitive}from"../types/is.js";import{Stack}from"../types/stack.js";import{validateInteger,validateString}from"../types/validate.js";const DELIMITER=".",WILDCARD="*";class Pathfinder extends Base{constructor(t){if(super(),isPrimitive(t))throw new Error("the parameter must not be a simple type");this.object=t,this.wildCard=WILDCARD}setWildCard(t){return validateString(t),this.wildCard=t,this}getVia(t){return getValueViaPath.call(this,this.object,validateString(t))}setVia(t,e){return validateString(t),setValueViaPath.call(this,this.object,t,e),this}deleteVia(t){return validateString(t),deleteValueViaPath.call(this,this.object,t),this}exists(t){validateString(t);try{return getValueViaPath.call(this,this.object,t,!0),!0}catch(t){}return!1}}function iterate(t,e,a){const i=new Map;if(isObject(t)||isArray(t))for(var[r,s]of Object.entries(t))i.set(r,getValueViaPath.call(this,s,e,a));else{var n=e.split(DELIMITER).shift();i.set(n,getValueViaPath.call(this,t,e,a))}return i}function getValueViaPath(e,a,i){if(""===a)return e;let r=a.split(DELIMITER),s=r.shift();if(s===this.wildCard)return iterate.call(this,e,r.join(DELIMITER),i);if(isObject(e)||isArray(e)){let t;if(e instanceof Map||e instanceof WeakMap)t=e.get(s);else if(e instanceof Set||e instanceof WeakSet)s=parseInt(s),validateInteger(s),t=[...e][s];else{if("function"==typeof WeakRef&&e instanceof WeakRef)throw Error("unsupported action for this data type");t=(isArray(e)&&(s=parseInt(s),validateInteger(s)),e?.[s])}if(isObject(t)||isArray(t))return getValueViaPath.call(this,t,r.join(DELIMITER),i);if(0<r.length)throw Error("the journey is not at its end ("+r.join(DELIMITER)+")");if(!0===i){a=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),s);if(!e.hasOwnProperty(s)&&void 0===a)throw Error("unknown value")}return t}throw TypeError("unsupported type "+typeof e)}function setValueViaPath(e,t,a){validateString(t);let i=t.split(DELIMITER),r=i.pop();var s,t=i.join(DELIMITER);let n=new Stack,o=t;for(;;){try{getValueViaPath.call(this,e,o,!0);break}catch(t){}if(n.push(o),i.pop(),o=i.join(DELIMITER),""===o)break}for(;!n.isEmpty();){o=n.pop();let t={};n.isEmpty()||(s=n.peek().split(DELIMITER).pop(),isInteger(parseInt(s))&&(t=[])),setValueViaPath.call(this,e,o,t)}let l=getValueViaPath.call(this,e,t);if(!isObject(e)&&!isArray(e))throw TypeError("unsupported type: "+typeof e);if(l instanceof Map||l instanceof WeakMap)l.set(r,a);else if(l instanceof Set||l instanceof WeakSet)l.append(a);else{if("function"==typeof WeakRef&&l instanceof WeakRef)throw Error("unsupported action for this data type");isArray(l)&&(r=parseInt(r),validateInteger(r)),assignProperty(l,r,a)}}function assignProperty(t,e,a){t.hasOwnProperty(e)&&void 0===a&&delete t[e],t[e]=a}function deleteValueViaPath(t,e){const a=e.split(DELIMITER);let i=a.pop();e=a.join(DELIMITER);const r=getValueViaPath.call(this,t,e);if(r instanceof Map)r.delete(i);else{if(r instanceof Set||r instanceof WeakMap||r instanceof WeakSet||"function"==typeof WeakRef&&r instanceof WeakRef)throw Error("unsupported action for this data type");isArray(r)&&(i=parseInt(i),validateInteger(i)),delete r[i]}}assignToNamespace("Monster.Data",Pathfinder);export{DELIMITER,WILDCARD,Monster,Pathfinder};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{validateString}from"../types/validate.js";import{Transformer}from"./transformer.js";const DELIMITER="|";class Pipe extends Base{constructor(e){super(),validateString(e),this.pipe=e.split(DELIMITER).map(e=>new Transformer(e))}setCallback(e,s,r){for(var[,t]of Object.entries(this.pipe))t.setCallback(e,s,r);return this}run(e){return this.pipe.reduce((e,s,r,t)=>s.run(e),e)}}assignToNamespace("Monster.Data",Pipe);export{Monster,Pipe};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{getGlobal,getGlobalObject}from"../types/global.js";import{ID}from"../types/id.js";import{isArray,isObject,isString}from"../types/is.js";import{validateFunction,validateInteger,validateObject,validatePrimitive,validateString}from"../types/validate.js";import{clone}from"../util/clone.js";import{Pathfinder}from"./pathfinder.js";class Transformer extends Base{constructor(e){super(),this.args=disassemble(e),this.command=this.args.shift(),this.callbacks=new Map}setCallback(e,t,r){return validateString(e),validateFunction(t),void 0!==r&&validateObject(r),this.callbacks.set(e,{callback:t,context:r}),this}run(e){return transform.apply(this,[e])}}function disassemble(e){validateString(e);let a=new Map;var t;for(t of e.matchAll(/((?<pattern>\\(?<char>.)){1})/gim)){var r,s,n=t?.groups;isObject(n)&&(r=n?.pattern,n=n?.char,r&&n&&(s="__"+(new ID).toString()+"__",a.set(s,n),e=e.replace(r,s)))}let i=e.split(":");return i=i.map(function(e){let t=e.trim();for(var r of a)t=t.replace(r[0],r[1]);return t}),i}function convertToString(e){return isObject(e)&&e.hasOwnProperty("toString")&&(e=e.toString()),validateString(e),e}function transform(i){const o=getGlobalObject("console");let c=clone(this.args),l,u;switch(this.command){case"static":return this.args.join(":");case"tolower":case"strtolower":case"tolowercase":return validateString(i),i.toLowerCase();case"toupper":case"strtoupper":case"touppercase":return validateString(i),i.toUpperCase();case"tostring":return""+i;case"tointeger":var p=parseInt(i);return validateInteger(p),p;case"tojson":return JSON.stringify(i);case"fromjson":return JSON.parse(i);case"trim":return validateString(i),i.trim();case"rawurlencode":return validateString(i),encodeURIComponent(i).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A");case"call":let e;p=c.shift();let t=getGlobal();return isObject(i)&&i.hasOwnProperty(p)?e=i[p]:this.callbacks.has(p)?(d=this.callbacks.get(p),e=d?.callback,t=d?.context):"object"==typeof window&&window.hasOwnProperty(p)&&(e=window[p]),validateFunction(e),c.unshift(i),e.call(t,...c);case"plain":case"plaintext":return validateString(i),(new DOMParser).parseFromString(i,"text/html").body.textContent||"";case"if":case"?":validatePrimitive(i);let r=c.shift()||void 0,a=c.shift()||void 0;return"value"===r&&(r=i),"\\value"===r&&(r="value"),"value"===a&&(a=i),"\\value"===a&&(a="value"),void 0!==i&&""!==i&&"off"!==i&&"false"!==i&&!1!==i||"on"===i||"true"===i||!0===i?r:a;case"ucfirst":return validateString(i),i.charAt(0).toUpperCase()+i.substr(1);case"ucwords":return validateString(i),i.replace(/^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g,function(e){return e.toUpperCase()});case"count":case"length":if((isString(i)||isObject(i)||isArray(i))&&i.hasOwnProperty("length"))return i.length;throw new TypeError("unsupported type "+typeof i);case"to-base64":case"btoa":case"base64":return btoa(convertToString(i));case"atob":case"from-base64":return atob(convertToString(i));case"empty":return"";case"undefined":return;case"debug":return isObject(o)&&o.log(i),i;case"prefix":return validateString(i),c?.[0]+i;case"suffix":return validateString(i),i+c?.[0];case"uniqid":return(new ID).toString();case"first-key":case"last-key":case"nth-last-key":case"nth-key":if(!isObject(i))throw new Error("type not supported");var d=Object.keys(i).sort(),p=("first-key"===this.command?l=0:"last-key"===this.command?l=d.length-1:(l=validateInteger(parseInt(c.shift())),"nth-last-key"===this.command&&(l=d.length-l-1)),u=c.shift()||"",d?.[l]);return i?.[p]?i?.[p]:u;case"key":case"property":case"index":if(l=c.shift()||void 0,void 0===l)throw new Error("missing key parameter");if(u=c.shift()||void 0,i instanceof Map)return i.has(l)?i.get(l):u;if(isObject(i)||isArray(i))return i?.[l]||u;throw new Error("type not supported");case"path-exists":if(l=c.shift(),void 0===l)throw new Error("missing key parameter");return new Pathfinder(i).exists(l);case"path":if(l=c.shift(),void 0===l)throw new Error("missing key parameter");let s=new Pathfinder(i);return s.exists(l)?s.getVia(l):void 0;case"substring":validateString(i);d=parseInt(c[0])||0,p=(parseInt(c[1])||0)+d;return i.substring(d,p);case"nop":return i;case"??":case"default":if(null!=i)return i;u=c.shift();let n=c.shift();switch(void 0===n&&(n="string"),n){case"int":case"integer":return parseInt(u);case"float":return parseFloat(u);case"undefined":return;case"bool":case"boolean":return u=u.toLowerCase(),"undefined"!==u&&""!==u&&"off"!==u&&"false"!==u&&"false"!==u||"on"===u||"true"===u||"true"===u;case"string":return""+u;case"object":return JSON.parse(atob(u))}throw new Error("type not supported");default:throw new Error("unknown command "+this.command)}return i}assignToNamespace("Monster.Data",Transformer);export{Monster,Transformer};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{getGlobalFunction}from"../types/global.js";import{ProxyObserver}from"../types/proxyobserver.js";import{validateInstance,validateString}from"../types/validate.js";const ATTRIBUTEPREFIX="data-monster-";class Assembler extends Base{constructor(e){super(),this.attributePrefix=ATTRIBUTEPREFIX,validateInstance(e,getGlobalFunction("DocumentFragment")),this.fragment=e}setAttributePrefix(e){return validateString(e),this.attributePrefix=e,this}getAttributePrefix(){return this.attributePrefix}createDocumentFragment(e){return void 0===e&&(e=new ProxyObserver({})),validateInstance(e,ProxyObserver),this.fragment.cloneNode(!0)}}assignToNamespace("Monster.DOM",Assembler);export{Monster,ATTRIBUTEPREFIX,Assembler};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{getGlobalFunction}from"../types/global.js";import{TokenList}from"../types/tokenlist.js";import{validateInstance,validateString,validateSymbol}from"../types/validate.js";import{ATTRIBUTE_OBJECTLINK}from"./constants.js";function findClosestObjectLink(t){return findClosestByAttribute(t,ATTRIBUTE_OBJECTLINK)}function addToObjectLink(t,e,n){return validateInstance(t,HTMLElement),validateSymbol(e),void 0===t?.[e]&&(t[e]=new Set),addAttributeToken(t,ATTRIBUTE_OBJECTLINK,e.toString()),t[e].add(n),t}function removeObjectLink(t,e){return validateInstance(t,HTMLElement),validateSymbol(e),void 0===t?.[e]||(removeAttributeToken(t,ATTRIBUTE_OBJECTLINK,e.toString()),delete t[e]),t}function hasObjectLink(t,e){return validateInstance(t,HTMLElement),validateSymbol(e),void 0!==t?.[e]&&containsAttributeToken(t,ATTRIBUTE_OBJECTLINK,e.toString())}function getLinkedObjects(t,e){if(validateInstance(t,HTMLElement),validateSymbol(e),void 0===t?.[e])throw new Error("there is no object link for "+e.toString());return t?.[e][Symbol.iterator]()}function toggleAttributeToken(t,e,n){return validateInstance(t,HTMLElement),validateString(n),validateString(e),t.hasAttribute(e)?t.setAttribute(e,new TokenList(t.getAttribute(e)).toggle(n).toString()):t.setAttribute(e,n),t}function addAttributeToken(t,e,n){return validateInstance(t,HTMLElement),validateString(n),validateString(e),t.hasAttribute(e)?t.setAttribute(e,new TokenList(t.getAttribute(e)).add(n).toString()):t.setAttribute(e,n),t}function removeAttributeToken(t,e,n){return validateInstance(t,HTMLElement),validateString(n),validateString(e),t.hasAttribute(e)&&t.setAttribute(e,new TokenList(t.getAttribute(e)).remove(n).toString()),t}function containsAttributeToken(t,e,n){return validateInstance(t,HTMLElement),validateString(n),validateString(e),!!t.hasAttribute(e)&&new TokenList(t.getAttribute(e)).contains(n)}function replaceAttributeToken(t,e,n,i){return validateInstance(t,HTMLElement),validateString(n),validateString(i),validateString(e),t.hasAttribute(e)&&t.setAttribute(e,new TokenList(t.getAttribute(e)).replace(n,i).toString()),t}function clearAttributeTokens(t,e){return validateInstance(t,HTMLElement),validateString(e),t.hasAttribute(e)&&t.setAttribute(e,""),t}function findClosestByAttribute(t,e,n){if(validateInstance(t,getGlobalFunction("HTMLElement")),t.hasAttribute(e)){if(void 0===n)return t;if(t.getAttribute(e)===n)return t}let i=validateString(e);void 0!==n&&(i+="="+validateString(n));e=t.closest("["+i+"]");if(e instanceof HTMLElement)return e}function findClosestByClass(t,e){if(validateInstance(t,getGlobalFunction("HTMLElement")),t?.classList?.contains(validateString(e)))return t;t=t.closest("."+e);return t instanceof HTMLElement?t:void 0}assignToNamespace("Monster.DOM",findClosestByClass,getLinkedObjects,addToObjectLink,removeObjectLink,findClosestByAttribute,hasObjectLink,clearAttributeTokens,replaceAttributeToken,containsAttributeToken,removeAttributeToken,addAttributeToken,toggleAttributeToken);export{Monster,addToObjectLink,removeObjectLink,hasObjectLink,findClosestByAttribute,clearAttributeTokens,replaceAttributeToken,containsAttributeToken,removeAttributeToken,addAttributeToken,toggleAttributeToken,getLinkedObjects,findClosestObjectLink,findClosestByClass};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster}from"../namespace.js";const DEFAULT_THEME="monster",ATTRIBUTE_PREFIX="data-monster-",ATTRIBUTE_OPTIONS=ATTRIBUTE_PREFIX+"options",ATTRIBUTE_OPTIONS_SELECTOR=ATTRIBUTE_PREFIX+"options-selector",ATTRIBUTE_THEME_PREFIX=ATTRIBUTE_PREFIX+"theme-",ATTRIBUTE_THEME_NAME=ATTRIBUTE_THEME_PREFIX+"name",ATTRIBUTE_UPDATER_ATTRIBUTES=ATTRIBUTE_PREFIX+"attributes",ATTRIBUTE_UPDATER_SELECT_THIS=ATTRIBUTE_PREFIX+"select-this",ATTRIBUTE_UPDATER_REPLACE=ATTRIBUTE_PREFIX+"replace",ATTRIBUTE_UPDATER_INSERT=ATTRIBUTE_PREFIX+"insert",ATTRIBUTE_UPDATER_INSERT_REFERENCE=ATTRIBUTE_PREFIX+"insert-reference",ATTRIBUTE_UPDATER_REMOVE=ATTRIBUTE_PREFIX+"remove",ATTRIBUTE_UPDATER_BIND=ATTRIBUTE_PREFIX+"bind",ATTRIBUTE_TEMPLATE_PREFIX=ATTRIBUTE_PREFIX+"template-prefix",ATTRIBUTE_ROLE=ATTRIBUTE_PREFIX+"role",ATTRIBUTE_DISABLED="disabled",ATTRIBUTE_VALUE="value",ATTRIBUTE_OBJECTLINK=ATTRIBUTE_PREFIX+"objectlink",ATTRIBUTE_ERRORMESSAGE=ATTRIBUTE_PREFIX+"error",objectUpdaterLinkSymbol=Symbol("monsterUpdater"),TAG_SCRIPT="script",TAG_STYLE="style",TAG_LINK="link",ATTRIBUTE_ID="id",ATTRIBUTE_CLASS="class",ATTRIBUTE_TITLE="title",ATTRIBUTE_SRC="src",ATTRIBUTE_HREF="href",ATTRIBUTE_TYPE="type",ATTRIBUTE_NONCE="nonce",ATTRIBUTE_TRANSLATE="translate",ATTRIBUTE_TABINDEX="tabindex",ATTRIBUTE_SPELLCHECK="spellcheck",ATTRIBUTE_SLOT="slot",ATTRIBUTE_PART="part",ATTRIBUTE_LANG="lang",ATTRIBUTE_ITEMTYPE="itemtype",ATTRIBUTE_ITEMSCOPE="itemscope",ATTRIBUTE_ITEMREF="itemref",ATTRIBUTE_ITEMID="itemid",ATTRIBUTE_ITEMPROP="itemprop",ATTRIBUTE_IS="is",ATTRIBUTE_INPUTMODE="inputmode",ATTRIBUTE_ACCESSKEY="accesskey",ATTRIBUTE_AUTOCAPITALIZE="autocapitalize",ATTRIBUTE_AUTOFOCUS="autofocus",ATTRIBUTE_CONTENTEDITABLE="contenteditable",ATTRIBUTE_DIR="dir",ATTRIBUTE_DRAGGABLE="draggable",ATTRIBUTE_ENTERKEYHINT="enterkeyhint",ATTRIBUTE_EXPORTPARTS="exportparts",ATTRIBUTE_HIDDEN="hidden";export{Monster,ATTRIBUTE_HIDDEN,ATTRIBUTE_EXPORTPARTS,ATTRIBUTE_ENTERKEYHINT,ATTRIBUTE_DRAGGABLE,ATTRIBUTE_DIR,ATTRIBUTE_CONTENTEDITABLE,ATTRIBUTE_AUTOFOCUS,ATTRIBUTE_AUTOCAPITALIZE,ATTRIBUTE_ACCESSKEY,TAG_SCRIPT,TAG_LINK,ATTRIBUTE_INPUTMODE,ATTRIBUTE_IS,ATTRIBUTE_ITEMPROP,ATTRIBUTE_ITEMID,ATTRIBUTE_ITEMREF,ATTRIBUTE_ITEMSCOPE,TAG_STYLE,ATTRIBUTE_ITEMTYPE,ATTRIBUTE_HREF,ATTRIBUTE_LANG,ATTRIBUTE_PART,ATTRIBUTE_SLOT,ATTRIBUTE_SPELLCHECK,ATTRIBUTE_SRC,ATTRIBUTE_TABINDEX,ATTRIBUTE_TRANSLATE,ATTRIBUTE_NONCE,ATTRIBUTE_TYPE,ATTRIBUTE_TITLE,ATTRIBUTE_CLASS,ATTRIBUTE_ID,ATTRIBUTE_PREFIX,ATTRIBUTE_OPTIONS,DEFAULT_THEME,ATTRIBUTE_THEME_PREFIX,ATTRIBUTE_ROLE,ATTRIBUTE_THEME_NAME,ATTRIBUTE_UPDATER_ATTRIBUTES,ATTRIBUTE_UPDATER_REPLACE,ATTRIBUTE_UPDATER_INSERT,ATTRIBUTE_UPDATER_INSERT_REFERENCE,ATTRIBUTE_UPDATER_REMOVE,ATTRIBUTE_UPDATER_BIND,ATTRIBUTE_OBJECTLINK,ATTRIBUTE_DISABLED,ATTRIBUTE_ERRORMESSAGE,ATTRIBUTE_VALUE,objectUpdaterLinkSymbol,ATTRIBUTE_TEMPLATE_PREFIX,ATTRIBUTE_UPDATER_SELECT_THIS,ATTRIBUTE_OPTIONS_SELECTOR};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{extend}from"../data/extend.js";import{assignToNamespace,Monster}from"../namespace.js";import{ATTRIBUTE_VALUE}from"./constants.js";import{CustomElement,attributeObserverSymbol}from"./customelement.js";const attachedInternalSymbol=Symbol("attachedInternal");class CustomControl extends CustomElement{constructor(){super(),"function"==typeof this.attachInternals&&(this[attachedInternalSymbol]=this.attachInternals()),initObserver.call(this)}static get observedAttributes(){const t=super.observedAttributes;return t.push(ATTRIBUTE_VALUE),t}static get formAssociated(){return!0}get defaults(){return extend({},super.defaults)}get value(){throw Error("the value getter must be overwritten by the derived class")}set value(t){throw Error("the value setter must be overwritten by the derived class")}get labels(){return getInternal.call(this)?.labels}get name(){return this.getAttribute("name")}get type(){return this.constructor.getTag()}get validity(){return getInternal.call(this)?.validity}get validationMessage(){return getInternal.call(this)?.validationMessage}get willValidate(){return getInternal.call(this)?.willValidate}get states(){return getInternal.call(this)?.states}get form(){return getInternal.call(this)?.form}setFormValue(t,e){getInternal.call(this).setFormValue(t,e)}setValidity(t,e,r){getInternal.call(this).setValidity(t,e,r)}checkValidity(){return getInternal.call(this)?.checkValidity()}reportValidity(){return getInternal.call(this)?.reportValidity()}}function getInternal(){if(!(attachedInternalSymbol in this))throw new Error("ElementInternals is not supported and a polyfill is necessary");return this[attachedInternalSymbol]}function initObserver(){const t=this;t[attributeObserverSymbol].value=()=>{t.setOption("value",t.getAttribute("value"))}}assignToNamespace("Monster.DOM",CustomControl);export{Monster,CustomControl};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{internalSymbol}from"../constants.js";import{extend}from"../data/extend.js";import{Pathfinder}from"../data/pathfinder.js";import{assignToNamespace,Monster}from"../namespace.js";import{parseDataURL}from"../types/dataurl.js";import{getGlobalObject}from"../types/global.js";import{isArray,isFunction,isObject,isString}from"../types/is.js";import{Observer}from"../types/observer.js";import{ProxyObserver}from"../types/proxyobserver.js";import{validateFunction,validateInstance,validateObject,validateString}from"../types/validate.js";import{clone}from"../util/clone.js";import{addAttributeToken,addToObjectLink,getLinkedObjects,hasObjectLink}from"./attributes.js";import{ATTRIBUTE_DISABLED,ATTRIBUTE_ERRORMESSAGE,ATTRIBUTE_OPTIONS,ATTRIBUTE_OPTIONS_SELECTOR,objectUpdaterLinkSymbol}from"./constants.js";import{findDocumentTemplate,Template}from"./template.js";import{Updater}from"./updater.js";const initMethodSymbol=Symbol("initMethodSymbol"),assembleMethodSymbol=Symbol("assembleMethodSymbol"),attributeObserverSymbol=Symbol("attributeObserver");class CustomElement extends HTMLElement{constructor(){super(),this[internalSymbol]=new ProxyObserver({options:extend({},this.defaults)}),this[attributeObserverSymbol]={},initOptionObserver.call(this),this[initMethodSymbol]()}static get observedAttributes(){return[ATTRIBUTE_OPTIONS,ATTRIBUTE_DISABLED]}get defaults(){return{ATTRIBUTE_DISABLED:this.getAttribute(ATTRIBUTE_DISABLED),shadowMode:"open",delegatesFocus:!0,templates:{main:void 0}}}static getTag(){throw new Error("the method getTag must be overwritten by the derived class.")}static getCSSStyleSheet(){}attachObserver(t){return this[internalSymbol].attachObserver(t),this}detachObserver(t){return this[internalSymbol].detachObserver(t),this}containsObserver(t){return this[internalSymbol].containsObserver(t)}getOption(t,e){let o;try{o=new Pathfinder(this[internalSymbol].getRealSubject().options).getVia(t)}catch(t){}return void 0===o?e:o}setOption(t,e){return new Pathfinder(this[internalSymbol].getSubject().options).setVia(t,e),this}setOptions(t){isString(t)&&(t=parseOptionsJSON.call(this,t));var e=this;return extend(e[internalSymbol].getSubject().options,e.defaults,t),e}[initMethodSymbol](){return this}[assembleMethodSymbol](){var e=this;let o,n;var t=getOptionsFromAttributes.call(e),t=(isObject(t)&&0<Object.keys(t).length&&e.setOptions(t),getOptionsFromScriptTag.call(e));if(isObject(t)&&0<Object.keys(t).length&&e.setOptions(t),!1!==e.getOption("shadowMode",!1)){try{initShadowRoot.call(e),o=e.shadowRoot.childNodes}catch(t){}try{initCSSStylesheet.call(this)}catch(t){addAttributeToken(e,ATTRIBUTE_ERRORMESSAGE,t.toString())}}o instanceof NodeList||o instanceof NodeList||(initHtmlContent.call(this),o=this.childNodes);try{n=new Set([...o,...getSlottedElements.call(e)])}catch(t){n=o}return assignUpdaterToElement.call(e,n,clone(e[internalSymbol].getRealSubject().options)),e}connectedCallback(){hasObjectLink(this,objectUpdaterLinkSymbol)||this[assembleMethodSymbol]()}disconnectedCallback(){}adoptedCallback(){}attributeChangedCallback(t,e,o){const n=this[attributeObserverSymbol]?.[t];isFunction(n)&&n.call(this,o,e)}hasNode(t){var e=this;return!!containChildNode.call(e,validateInstance(t,Node))||e.shadowRoot instanceof ShadowRoot&&containChildNode.call(e.shadowRoot,t)}}function getSlottedElements(e,t){const o=new Set;if(!(this.shadowRoot instanceof ShadowRoot))return o;let n="slot";void 0!==t&&(n+=null===t?":not([name])":"[name="+validateString(t)+"]");var i,t=this.shadowRoot.querySelectorAll(n);for([,i]of Object.entries(t))i.assignedElements().forEach(function(t){if(t instanceof HTMLElement)if(isString(e))t.querySelectorAll(e).forEach(function(t){o.add(t)}),t.matches(e)&&o.add(t);else{if(void 0!==e)throw new Error("query must be a string");o.add(t)}});return o}function containChildNode(t){var e;if(this.contains(t))return!0;for([,e]of Object.entries(this.childNodes)){if(e.contains(t))return!0;containChildNode.call(e,t)}return!1}function initOptionObserver(){const s=this;let e=void 0;s.attachObserver(new Observer(function(){var t=s.getOption("disabled");if(t!==e&&(e=t,s.shadowRoot instanceof ShadowRoot)){var o="button, command, fieldset, keygen, optgroup, option, select, textarea, input, [data-monster-objectlink]",n=s.shadowRoot.querySelectorAll(o);let e;try{e=new Set([...n,...getSlottedElements.call(s,o)])}catch(t){e=n}for(const i of[...e])!0===t?i.setAttribute(ATTRIBUTE_DISABLED,""):i.removeAttribute(ATTRIBUTE_DISABLED)}})),s.attachObserver(new Observer(function(){if(hasObjectLink(s,objectUpdaterLinkSymbol))for(const e of getLinkedObjects(s,objectUpdaterLinkSymbol))for(const o of e){var t=clone(s[internalSymbol].getRealSubject().options);Object.assign(o.getSubject(),t)}})),s[attributeObserverSymbol][ATTRIBUTE_DISABLED]=()=>{s.hasAttribute(ATTRIBUTE_DISABLED)?s.setOption(ATTRIBUTE_DISABLED,!0):s.setOption(ATTRIBUTE_DISABLED,void 0)},s[attributeObserverSymbol][ATTRIBUTE_OPTIONS]=()=>{var t=getOptionsFromAttributes.call(s);isObject(t)&&0<Object.keys(t).length&&s.setOptions(t)},s[attributeObserverSymbol][ATTRIBUTE_OPTIONS_SELECTOR]=()=>{var t=getOptionsFromScriptTag.call(s);isObject(t)&&0<Object.keys(t).length&&s.setOptions(t)}}function getOptionsFromScriptTag(){var e=this;if(!e.hasAttribute(ATTRIBUTE_OPTIONS_SELECTOR))return{};const t=document.querySelector(e.getAttribute(ATTRIBUTE_OPTIONS_SELECTOR));if(!(t instanceof HTMLScriptElement))return addAttributeToken(e,ATTRIBUTE_ERRORMESSAGE,"the selector "+ATTRIBUTE_OPTIONS_SELECTOR+" for options was specified ("+e.getAttribute(ATTRIBUTE_OPTIONS_SELECTOR)+") but not found."),{};let o={};try{o=parseOptionsJSON.call(this,t.textContent.trim())}catch(t){addAttributeToken(e,ATTRIBUTE_ERRORMESSAGE,"when analyzing the configuration from the script tag there was an error. "+t)}return o}function getOptionsFromAttributes(){if(this.hasAttribute(ATTRIBUTE_OPTIONS))try{return parseOptionsJSON.call(this,this.getAttribute(ATTRIBUTE_OPTIONS))}catch(t){addAttributeToken(this,ATTRIBUTE_ERRORMESSAGE,"the options attribute "+ATTRIBUTE_OPTIONS+" does not contain a valid json definition (actual: "+this.getAttribute(ATTRIBUTE_OPTIONS)+")."+t)}return{}}function parseOptionsJSON(t){var e={};if(!isString(t))return e;try{t=parseDataURL(t).content}catch(t){}try{var o=JSON.parse(t);return validateObject(o)}catch(t){throw t}return e}function initHtmlContent(){try{let t=findDocumentTemplate(this.constructor.getTag());this.appendChild(t.createDocumentFragment())}catch(t){var e=this.getOption("templates.main","");isString(e)&&0<e.length&&(this.innerHTML=e)}return this}function initCSSStylesheet(){if(!(this.shadowRoot instanceof ShadowRoot))return this;const t=this.constructor.getCSSStyleSheet();if(t instanceof CSSStyleSheet)0<t.cssRules.length&&(this.shadowRoot.adoptedStyleSheets=[t]);else if(isArray(t)){const n=[];for(var e of t)if(isString(e)){var o=e.trim();if(""!==o){const i=document.createElement("style");i.innerHTML=o,this.shadowRoot.prepend(i)}}else validateInstance(e,CSSStyleSheet),0<e.cssRules.length&&n.push(e);0<n.length&&(this.shadowRoot.adoptedStyleSheets=n)}else if(isString(t))if(""!==t.trim()){const s=document.createElement("style");s.innerHTML=t,this.shadowRoot.prepend(s)}return this}function initShadowRoot(){let t,e;try{t=findDocumentTemplate(this.constructor.getTag())}catch(t){if(e=this.getOption("templates.main",""),!isString(e)||void 0===e||""===e)throw new Error("html is not set.")}return this.attachShadow({mode:this.getOption("shadowMode","open"),delegatesFocus:this.getOption("delegatesFocus",!0)}),t instanceof Template?this.shadowRoot.appendChild(t.createDocumentFragment()):this.shadowRoot.innerHTML=e,this}function registerCustomElement(t){validateFunction(t),getGlobalObject("customElements").define(t.getTag(),t)}function assignUpdaterToElement(t,o){const n=new Set;t instanceof NodeList&&(t=new Set([...t]));let i=[];return t.forEach(t=>{if(t instanceof HTMLElement&&!(t instanceof HTMLTemplateElement)){const e=new Updater(t,o);n.add(e),i.push(e.run().then(()=>e.enableEventProcessing()))}}),0<n.size&&addToObjectLink(this,objectUpdaterLinkSymbol,n),i}assignToNamespace("Monster.DOM",CustomElement,registerCustomElement,assignUpdaterToElement);export{Monster,registerCustomElement,CustomElement,initMethodSymbol,assembleMethodSymbol,assignUpdaterToElement,attributeObserverSymbol,getSlottedElements};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isArray,isObject}from"../types/is.js";import{validateInstance,validateString}from"../types/validate.js";import{getDocument}from"./util.js";function fireEvent(e,t){var n;getDocument();if(e instanceof HTMLElement)"click"!==t?(n=new Event(validateString(t),{bubbles:!0,cancelable:!0}),e.dispatchEvent(n)):e.click();else{if(!(e instanceof HTMLCollection||e instanceof NodeList))throw new TypeError("value is not an instance of HTMLElement or HTMLCollection");for(var o of e)fireEvent(o,t)}}function fireCustomEvent(e,t,n){getDocument();if(e instanceof HTMLElement){isObject(n)||(n={detail:n});var o=new CustomEvent(validateString(t),{bubbles:!0,cancelable:!0,detail:n});e.dispatchEvent(o)}else{if(!(e instanceof HTMLCollection||e instanceof NodeList))throw new TypeError("value is not an instance of HTMLElement or HTMLCollection");for(var i of e)fireCustomEvent(i,t,n)}}function findTargetElementFromEvent(e,t,n){if(validateInstance(e,Event),"function"!=typeof e.composedPath)throw new Error("unsupported event");var o=e.composedPath();if(isArray(o))for(let e=0;e<o.length;e++){const i=o[e];if(i instanceof HTMLElement&&i.hasAttribute(t)&&(void 0===n||i.getAttribute(t)===n))return i}}assignToNamespace("Monster.DOM",findTargetElementFromEvent,fireEvent,fireCustomEvent);export{Monster,findTargetElementFromEvent,fireEvent,fireCustomEvent};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{extend}from"../data/extend.js";import{assignToNamespace}from"../namespace.js";import{BaseWithOptions}from"../types/basewithoptions.js";import{getGlobalObject}from"../types/global.js";import{isArray}from"../types/is.js";import{Stack}from"../types/stack.js";import{validateInstance,validateString}from"../types/validate.js";const KEY_DOCUMENT="document",KEY_CONTEXT="context",stackSymbol=Symbol("stack");class FocusManager extends BaseWithOptions{constructor(t){super(t),validateInstance(this.getOption(KEY_DOCUMENT),HTMLDocument),this[stackSymbol]=new Stack}get defaults(){return extend({},super.defaults,{[KEY_DOCUMENT]:getGlobalObject("document"),[KEY_CONTEXT]:void 0})}storeFocus(){var t=this.getActive();return t instanceof Node&&this[stackSymbol].push(t),this}restoreFocus(){var t=this[stackSymbol].pop();return t instanceof Node&&this.focus(t),this}focus(t,e){return validateInstance(t,Node),t.focus({preventScroll:e??!1}),this}getActive(){return this.getOption(KEY_DOCUMENT).activeElement}getFocusable(e){let t=this.getOption(KEY_CONTEXT);return void 0===t&&(t=this.getOption(KEY_DOCUMENT)),validateInstance(t,Node),void 0!==e&&validateString(e),[...t.querySelectorAll('details, button, input, [tabindex]:not([tabindex="-1"]), select, textarea, a[href], body')].filter(t=>{if(void 0!==e&&!t.matches(e))return!1;if(t.hasAttribute("disabled"))return!1;if("true"===t.getAttribute("aria-hidden"))return!1;t=t.getBoundingClientRect();return 0!==t.width&&0!==t.height})}focusNext(t){var e,s=this.getActive();const i=this.getFocusable(t);return isArray(i)&&0!==i.length&&(s instanceof Node&&-1<(e=i.indexOf(s))?this.focus(i[e+1]||i[0]):this.focus(i[0])),this}focusPrev(t){var e,s=this.getActive();const i=this.getFocusable(t);return isArray(i)&&0!==i.length&&(s instanceof Node&&-1<(e=i.indexOf(s))?this.focus(i[e-1]||i[i.length-1]):this.focus(i[i.length-1])),this}}assignToNamespace("Monster.DOM",FocusManager);export{FocusManager};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{parseLocale}from"../i18n/locale.js";import{assignToNamespace,Monster}from"../namespace.js";import{getDocument}from"./util.js";const DEFAULT_LANGUAGE="en";function getLocaleOfDocument(){const e=getDocument();let t=e.querySelector("html");if(t instanceof HTMLElement&&t.hasAttribute("lang")){var o=t.getAttribute("lang");if(o)return new parseLocale(o)}return parseLocale(DEFAULT_LANGUAGE)}assignToNamespace("Monster.DOM",getLocaleOfDocument);export{Monster,getLocaleOfDocument};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";const namespace="Monster.DOM";export{namespace};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster}from"../namespace.js";import{getDocument,getWindow}from"./util.js";const domReady=new Promise(e=>{const t=getDocument();"loading"===t.readyState?t.addEventListener("DOMContentLoaded",e):e()}),windowReady=new Promise(e=>{var t=getDocument();const o=getWindow();"complete"===t.readyState?e():o.addEventListener("load",e)});export{Monster,windowReady,domReady};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{internalStateSymbol}from"../../constants.js";import{extend}from"../../data/extend.js";import{assignToNamespace,Monster}from"../../namespace.js";import{getGlobalFunction}from"../../types/global.js";import{ATTRIBUTE_CLASS,ATTRIBUTE_ERRORMESSAGE,ATTRIBUTE_ID,ATTRIBUTE_SRC,ATTRIBUTE_TITLE,ATTRIBUTE_TYPE,TAG_SCRIPT}from"../constants.js";import{KEY_DOCUMENT,KEY_QUERY,referenceSymbol,Resource}from"../resource.js";class Data extends Resource{get defaults(){return extend({},super.defaults,{mode:"cors",credentials:"same-origin",type:"application/json"})}create(){return createElement.call(this),this}connect(){return this[referenceSymbol]instanceof HTMLElement||this.create(),appendToDocument.call(this),this}static getURLAttribute(){return ATTRIBUTE_SRC}}function createElement(){var e,t=this;const o=t.getOption(KEY_DOCUMENT);t[referenceSymbol]=o.createElement(TAG_SCRIPT);for(e of[ATTRIBUTE_TYPE,ATTRIBUTE_ID,ATTRIBUTE_CLASS,ATTRIBUTE_TITLE])void 0!==t.getOption(e)&&(t[referenceSymbol][e]=t.getOption(e));return t}function appendToDocument(){const t=this,o=document.querySelector(t.getOption(KEY_QUERY,"head"));if(!(o instanceof HTMLElement))throw new Error("target not found");return o.appendChild(t[referenceSymbol]),getGlobalFunction("fetch")(t.getOption(ATTRIBUTE_SRC),{method:"GET",mode:t.getOption("mode","cors"),cache:"no-cache",credentials:t.getOption("credentials","same-origin"),headers:{Accept:t.getOption("type","application/json")},redirect:"follow",referrerPolicy:"no-referrer"}).then(e=>e.text()).then(e=>{e=document.createTextNode(e);t[referenceSymbol].appendChild(e),t[internalStateSymbol].getSubject().loaded=!0}).catch(e=>{t[internalStateSymbol].setSubject({loaded:!0,error:e.toString()}),o.setAttribute(ATTRIBUTE_ERRORMESSAGE,e.toString())}),t}assignToNamespace("Monster.DOM.Resource",Data);export{Monster,Data};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{extend}from"../../../data/extend.js";import{assignToNamespace,Monster}from"../../../namespace.js";import{Link}from"../link.js";class Stylesheet extends Link{get defaults(){return extend({},super.defaults,{rel:"stylesheet"})}}assignToNamespace("Monster.DOM.Resource.Link",Stylesheet);export{Monster,Stylesheet};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{extend}from"../../data/extend.js";import{assignToNamespace,Monster}from"../../namespace.js";import{ATTRIBUTE_CLASS,ATTRIBUTE_HREF,ATTRIBUTE_ID,ATTRIBUTE_NONCE,ATTRIBUTE_SRC,ATTRIBUTE_TITLE,ATTRIBUTE_TYPE,TAG_LINK}from"../constants.js";import{KEY_DOCUMENT,referenceSymbol,Resource}from"../resource.js";class Link extends Resource{get defaults(){return extend({},super.defaults,{as:void 0,crossOrigin:"anonymous",disabled:void 0,href:void 0,hreflang:void 0,imagesizes:void 0,imagesrcset:void 0,integrity:void 0,media:void 0,prefetch:void 0,referrerpolicy:void 0,rel:void 0,sizes:void 0,type:void 0,nonce:void 0})}create(){return createElement.call(this),this}static getURLAttribute(){return ATTRIBUTE_HREF}}function createElement(){var e,r=this;const t=r.getOption(KEY_DOCUMENT);r[referenceSymbol]=t.createElement(TAG_LINK);for(e of["as","crossOrigin","disabled","href","hreflang","imagesizes","imagesrcset","integrity","media","prefetch","referrerpolicy","sizes","rel","type",ATTRIBUTE_HREF,ATTRIBUTE_ID,ATTRIBUTE_CLASS,ATTRIBUTE_TITLE,ATTRIBUTE_NONCE])void 0!==r.getOption(e)&&(r[referenceSymbol][e]=r.getOption(e));return r}assignToNamespace("Monster.DOM.Resource",Link);export{Monster,Link};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{extend}from"../../data/extend.js";import{assignToNamespace,Monster}from"../../namespace.js";import{ATTRIBUTE_CLASS,ATTRIBUTE_ID,ATTRIBUTE_NONCE,ATTRIBUTE_SRC,ATTRIBUTE_TITLE,ATTRIBUTE_TYPE,TAG_SCRIPT}from"../constants.js";import{KEY_DOCUMENT,referenceSymbol,Resource}from"../resource.js";class Script extends Resource{get defaults(){return extend({},super.defaults,{async:!0,crossOrigin:"anonymous",defer:!1,integrity:void 0,nomodule:!1,nonce:void 0,referrerpolicy:void 0,type:"text/javascript"})}create(){return createElement.call(this),this}static getURLAttribute(){return ATTRIBUTE_SRC}}function createElement(){var e,r=this;const t=r.getOption(KEY_DOCUMENT);r[referenceSymbol]=t.createElement(TAG_SCRIPT);for(e of["crossOrigin","defer","async","integrity","nomodule",ATTRIBUTE_NONCE,"referrerpolicy",ATTRIBUTE_TYPE,ATTRIBUTE_SRC,ATTRIBUTE_ID,ATTRIBUTE_CLASS,ATTRIBUTE_TITLE])void 0!==r.getOption(e)&&(r[referenceSymbol][e]=r.getOption(e));return r}assignToNamespace("Monster.DOM.Resource",Script);export{Monster,Script};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{internalStateSymbol,internalSymbol}from"../constants.js";import{extend}from"../data/extend.js";import{assignToNamespace,Monster}from"../namespace.js";import{BaseWithOptions}from"../types/basewithoptions.js";import{getGlobalObject}from"../types/global.js";import{ID}from"../types/id.js";import{isString}from"../types/is.js";import{Observer}from"../types/observer.js";import{ProxyObserver}from"../types/proxyobserver.js";import{ATTRIBUTE_CLASS,ATTRIBUTE_ID,ATTRIBUTE_TITLE}from"./constants.js";const KEY_DOCUMENT="document",KEY_QUERY="query",KEY_TIMEOUT="timeout",referenceSymbol=Symbol("reference");class Resource extends BaseWithOptions{constructor(e){super(e);let t=this.getOption(this.constructor.getURLAttribute());if(void 0===t)throw new Error("missing source");if(t instanceof URL)t=t.toString();else if(!isString(t))throw new Error("unsupported url type");this[internalSymbol][this.constructor.getURLAttribute()]=t,this[internalStateSymbol]=new ProxyObserver({loaded:!1,error:void 0}),this[referenceSymbol]=void 0}isConnected(){return this[referenceSymbol]instanceof HTMLElement&&this[referenceSymbol].isConnected}create(){throw new Error("this method must be implemented by derived classes")}connect(){return this[referenceSymbol]instanceof HTMLElement||this.create(),appendToDocument.call(this),this}get defaults(){return extend({},super.defaults,{[this.constructor.getURLAttribute()]:void 0,[KEY_DOCUMENT]:getGlobalObject("document"),[KEY_QUERY]:"head",[KEY_TIMEOUT]:1e4,[ATTRIBUTE_ID]:new ID("resource").toString(),[ATTRIBUTE_CLASS]:void 0,[ATTRIBUTE_TITLE]:void 0})}available(){const n=this;return n[referenceSymbol]instanceof HTMLElement?n.isConnected()?!0===n[internalStateSymbol].getSubject().loaded?void 0!==n[internalStateSymbol].getSubject().error?Promise.reject(n[internalStateSymbol].getSubject().error):Promise.resolve():new Promise(function(e,t){const r=setTimeout(()=>{t("timeout")},n.getOption("timeout")),o=new Observer(()=>{clearTimeout(r),n[internalStateSymbol].detachObserver(o),e()});n[internalStateSymbol].attachObserver(o)}):Promise.reject("element not connected"):Promise.reject("no element")}static getURLAttribute(){throw new Error("this method must be implemented by derived classes")}}function appendToDocument(){var e=this;const t=document.querySelector(e.getOption(KEY_QUERY,"head"));if(!(t instanceof HTMLElement))throw new Error("target not found");return addEvents.call(e),t.appendChild(e[referenceSymbol]),e}function addEvents(){const e=this,t=()=>{e[referenceSymbol].removeEventListener("error",t),e[referenceSymbol].removeEventListener("load",r),e[internalStateSymbol].setSubject({loaded:!0,error:e[referenceSymbol][e.constructor.getURLAttribute()]+" is not available"})},r=()=>{e[referenceSymbol].removeEventListener("error",t),e[referenceSymbol].removeEventListener("load",r),e[internalStateSymbol].getSubject().loaded=!0};return e[referenceSymbol].addEventListener("load",r,!1),e[referenceSymbol].addEventListener("error",t,!1),e}assignToNamespace("Monster.DOM",Resource);export{KEY_DOCUMENT,KEY_QUERY,KEY_TIMEOUT,referenceSymbol,Monster,Resource};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{extend}from"../data/extend.js";import{assignToNamespace,Monster}from"../namespace.js";import{BaseWithOptions}from"../types/basewithoptions.js";import{getGlobalObject}from"../types/global.js";import{isArray}from"../types/is.js";import{ATTRIBUTE_HREF,ATTRIBUTE_SRC}from"./constants.js";import{Resource}from"./resource.js";import{Data}from"./resource/data.js";import{Stylesheet}from"./resource/link/stylesheet.js";import{Script}from"./resource/script.js";class ResourceManager extends BaseWithOptions{constructor(e){if(super(e),!(this.getOption("document")instanceof Document))throw new Error("unsupported document type")}getBaseURL(){this.getOption("document")?.baseURL}get defaults(){return Object.assign({},super.defaults,{document:getGlobalObject("document"),resources:{scripts:[],stylesheets:[],data:[]}})}connect(){return runResourceMethod.call(this,"connect"),this}available(){return Promise.all(runResourceMethod.call(this,"available"))}addScript(e,t){return addResource.call(this,"scripts",e,t)}addStylesheet(e,t){return addResource.call(this,"stylesheets",e,t)}addData(e,t){return addResource.call(this,"data",e,t)}}function runResourceMethod(e){const t=[];for(const r of["scripts","stylesheets","data"]){var s=this.getOption("resources."+r);if(isArray(s))for(const o of s){if(!(o instanceof Resource))throw new Error("unsupported resource definition");t.push(o[e]())}}return t}function addResource(e,t,s){t instanceof URL&&(t=t.toString()),s=s||{};let r;switch(e){case"scripts":r=new Script(extend({},s,{[ATTRIBUTE_SRC]:t}));break;case"stylesheets":r=new Stylesheet(extend({},s,{[ATTRIBUTE_HREF]:t}));break;case"data":r=new Data(extend({},s,{[ATTRIBUTE_SRC]:t}));break;default:throw new Error("unsupported type "+e)}return(this.getOption("resources")?.[e]).push(r),this}assignToNamespace("Monster.DOM",ResourceManager);export{Monster,ResourceManager};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{getGlobalFunction,getGlobalObject}from"../types/global.js";import{validateInstance,validateString}from"../types/validate.js";import{ATTRIBUTE_TEMPLATE_PREFIX}from"./constants.js";import{getDocumentTheme}from"./theme.js";class Template extends Base{constructor(e){super();var t=getGlobalFunction("HTMLTemplateElement");validateInstance(e,t),this.template=e}getTemplateElement(){return this.template}createDocumentFragment(){return this.template.content.cloneNode(!0)}}function findDocumentTemplate(e,t){validateString(e);const n=getGlobalObject("document");var a=getGlobalFunction("HTMLTemplateElement"),o=getGlobalFunction("DocumentFragment"),m=getGlobalFunction("Document");let l;t instanceof m||t instanceof o||(t instanceof Node&&(t.hasAttribute(ATTRIBUTE_TEMPLATE_PREFIX)&&(l=t.getAttribute(ATTRIBUTE_TEMPLATE_PREFIX)),(t=t.getRootNode())instanceof m||t instanceof o||(t=t.ownerDocument)),t instanceof m||t instanceof o||(t=n));let s,i=getDocumentTheme();if(l){m=l+"-"+e+"-"+i.getName();if(s=t.getElementById(m),s instanceof a)return new Template(s);if(s=n.getElementById(m),s instanceof a)return new Template(s)}o=e+"-"+i.getName();if(s=t.getElementById(o),s instanceof a)return new Template(s);if(s=n.getElementById(o),s instanceof a)return new Template(s);if(s=t.getElementById(e),s instanceof a)return new Template(s);if(s=n.getElementById(e),s instanceof a)return new Template(s);throw new Error("template "+e+" not found.")}assignToNamespace("Monster.DOM",Template,findDocumentTemplate);export{Monster,Template,findDocumentTemplate};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{getGlobalObject}from"../types/global.js";import{validateString}from"../types/validate.js";import{ATTRIBUTE_THEME_NAME,DEFAULT_THEME}from"./constants.js";class Theme extends Base{constructor(e){super(),validateString(e),this.name=e}getName(){return this.name}}function getDocumentTheme(){let e=getGlobalObject("document"),t=DEFAULT_THEME,s=e.querySelector("html");var m;return s instanceof HTMLElement&&((m=s.getAttribute(ATTRIBUTE_THEME_NAME))&&(t=m)),new Theme(t)}assignToNamespace("Monster.DOM",Theme,getDocumentTheme);export{Monster,Theme,getDocumentTheme};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{internalSymbol}from"../constants.js";import{diff}from"../data/diff.js";import{Pathfinder}from"../data/pathfinder.js";import{Pipe}from"../data/pipe.js";import{ATTRIBUTE_ERRORMESSAGE,ATTRIBUTE_UPDATER_ATTRIBUTES,ATTRIBUTE_UPDATER_BIND,ATTRIBUTE_UPDATER_INSERT,ATTRIBUTE_UPDATER_INSERT_REFERENCE,ATTRIBUTE_UPDATER_REMOVE,ATTRIBUTE_UPDATER_REPLACE,ATTRIBUTE_UPDATER_SELECT_THIS}from"../dom/constants.js";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{isArray,isInstance,isIterable}from"../types/is.js";import{Observer}from"../types/observer.js";import{ProxyObserver}from"../types/proxyobserver.js";import{validateArray,validateInstance}from"../types/validate.js";import{clone}from"../util/clone.js";import{trimSpaces}from"../util/trimspaces.js";import{findTargetElementFromEvent}from"./events.js";import{findDocumentTemplate}from"./template.js";import{getDocument}from"./util.js";class Updater extends Base{constructor(e,t){super(),isInstance(t=void 0===t?{}:t,ProxyObserver)||(t=new ProxyObserver(t)),this[internalSymbol]={element:validateInstance(e,HTMLElement),last:{},callbacks:new Map,eventTypes:["keyup","click","change","drop","touchend","input"],subject:t},this[internalSymbol].callbacks.set("checkstate",getCheckStateCallback.call(this)),this[internalSymbol].subject.attachObserver(new Observer(()=>{var e,t=this[internalSymbol].subject.getRealSubject(),r=diff(this[internalSymbol].last,t);this[internalSymbol].last=clone(t);for([,e]of Object.entries(r))removeElement.call(this,e),insertElement.call(this,e),updateContent.call(this,e),updateAttributes.call(this,e)}))}setEventTypes(e){return this[internalSymbol].eventTypes=validateArray(e),this}enableEventProcessing(){this.disableEventProcessing();for(const e of this[internalSymbol].eventTypes)this[internalSymbol].element.addEventListener(e,getControlEventHandler.call(this),{capture:!0,passive:!0});return this}disableEventProcessing(){for(const e of this[internalSymbol].eventTypes)this[internalSymbol].element.removeEventListener(e,getControlEventHandler.call(this));return this}run(){return this[internalSymbol].last={__init__:!0},this[internalSymbol].subject.notifyObservers()}retrieve(){return retrieveFromBindings.call(this),this}getSubject(){return this[internalSymbol].subject.getSubject()}setCallback(e,t){return this[internalSymbol].callbacks.set(e,t),this}}function getCheckStateCallback(){return function(e){if(this instanceof HTMLInputElement){if(-1!==["radio","checkbox"].indexOf(this.type))return this.value+""==e+""?"true":void 0}else if(this instanceof HTMLOptionElement&&isArray(e)&&-1!==e.indexOf(this.value))return"true"}}const symbol=Symbol("EventHandler");function getControlEventHandler(){const t=this;return t[symbol]||(t[symbol]=e=>{e=findTargetElementFromEvent(e,ATTRIBUTE_UPDATER_BIND);void 0!==e&&retrieveAndSetValue.call(t,e)},t[symbol])}function retrieveAndSetValue(t){var e=this;const r=new Pathfinder(e[internalSymbol].subject.getSubject());let n=t.getAttribute(ATTRIBUTE_UPDATER_BIND);if(0!==n.indexOf("path:"))throw new Error("the bind argument must start as a value with a path");n=n.substr(5);let i;if(t instanceof HTMLInputElement)i="checkbox"!==t.type||t.checked?t.value:void 0;else if(t instanceof HTMLTextAreaElement)i=t.value;else if(t instanceof HTMLSelectElement)switch(t.type){case"select-one":i=t.value;break;case"select-multiple":i=t.value;let e=t?.selectedOptions;void 0===e&&(e=t.querySelectorAll(":scope option:checked")),i=Array.from(e).map(({value:e})=>e)}else{if(!(t?.constructor?.prototype&&Object.getOwnPropertyDescriptor(t.constructor.prototype,"value")?.get||t.hasOwnProperty("value")))throw new Error("unsupported object");i=t?.value}var a=clone(e[internalSymbol].subject.getRealSubject());const l=new Pathfinder(a);l.setVia(n,i),0<diff(a,e[internalSymbol].subject.getRealSubject()).length&&r.setVia(n,i)}function retrieveFromBindings(){var e=this;e[internalSymbol].element.matches("["+ATTRIBUTE_UPDATER_BIND+"]")&&retrieveAndSetValue.call(e,element);for(const[,element]of e[internalSymbol].element.querySelectorAll("["+ATTRIBUTE_UPDATER_BIND+"]").entries())retrieveAndSetValue.call(e,element)}function removeElement(e){var t;for([,t]of this[internalSymbol].element.querySelectorAll(":scope ["+ATTRIBUTE_UPDATER_REMOVE+"]").entries())t.parentNode.removeChild(t)}function insertElement(i){var s=this,A=s[internalSymbol].subject.getRealSubject();getDocument();let o=new WeakSet,e=0;const r=s[internalSymbol].element;for(;;){let l=!1,t=(e++,clone(i?.path));if(!isArray(t))return s;for(;0<t.length;){var n=t.join(".");let e=new Set;var c,n="["+ATTRIBUTE_UPDATER_INSERT+'*="path:'+n+'"]',a=r.querySelectorAll(n);0<a.length&&(e=new Set([...a])),r.matches(n)&&e.add(r);for([,c]of e.entries())if(!o.has(c)){o.add(c),l=!0;var T=c.getAttribute(ATTRIBUTE_UPDATER_INSERT);let e=trimSpaces(T);var T=e.indexOf(" "),R=trimSpaces(e.substr(0,T)),b=R+"-";let t=trimSpaces(e.substr(T));if(0<t.indexOf("|"))throw new Error("pipes are not allowed when cloning a node.");let r=new Pipe(t);s[internalSymbol].callbacks.forEach((e,t)=>{r.setCallback(t,e)});let n;try{c.removeAttribute(ATTRIBUTE_ERRORMESSAGE),n=r.run(A)}catch(e){c.setAttribute(ATTRIBUTE_ERRORMESSAGE,e.message)}var E,p,f=t.split(":").pop();let i;if(c.hasChildNodes()&&(i=c.lastChild),!isIterable(n))throw new Error("the value is not iterable");let a=new Set;for([E,p]of Object.entries(n)){var u=b+E,h=f+"."+E,d=(a.add(u),c.querySelector("["+ATTRIBUTE_UPDATER_INSERT_REFERENCE+'="'+u+'"]'));d instanceof HTMLElement?i=d:appendNewDocumentFragment(c,R,u,h)}var m,T=c.querySelectorAll("["+ATTRIBUTE_UPDATER_INSERT_REFERENCE+'*="'+b+'"]');for([,m]of Object.entries(T))if(!a.has(m.getAttribute(ATTRIBUTE_UPDATER_INSERT_REFERENCE)))try{c.removeChild(m)}catch(e){c.setAttribute(ATTRIBUTE_ERRORMESSAGE,(c.getAttribute(ATTRIBUTE_ERRORMESSAGE)+", "+e.message).trim())}}t.pop()}if(!1===l)break;if(200<e++)throw new Error("the maximum depth for the recursion is reached.")}}function appendNewDocumentFragment(e,t,r,n){let i=findDocumentTemplate(t,e);var a,l=i.createDocumentFragment();for([,a]of Object.entries(l.childNodes))a instanceof HTMLElement&&(applyRecursive(a,t,n),a.setAttribute(ATTRIBUTE_UPDATER_INSERT_REFERENCE,r)),e.appendChild(a)}function applyRecursive(t,r,n){if(t instanceof HTMLElement){if(t.hasAttribute(ATTRIBUTE_UPDATER_REPLACE)){let e=t.getAttribute(ATTRIBUTE_UPDATER_REPLACE);t.setAttribute(ATTRIBUTE_UPDATER_REPLACE,e.replaceAll("path:"+r,"path:"+n))}if(t.hasAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES)){let e=t.getAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES);t.setAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES,e.replaceAll("path:"+r,"path:"+n))}for(var[,e]of Object.entries(t.childNodes))applyRecursive(e,r,n)}}function updateContent(e){var t=this[internalSymbol].subject.getRealSubject(),r=clone(e?.path),e=(runUpdateContent.call(this,this[internalSymbol].element,r,t),this[internalSymbol].element.querySelectorAll("slot"));if(0<e.length)for(var[,n]of Object.entries(e))for(var[,i]of Object.entries(n.assignedNodes()))runUpdateContent.call(this,i,r,t)}function runUpdateContent(e,r,n){if(isArray(r)&&e instanceof HTMLElement){r=clone(r);let t=new WeakSet;for(;0<r.length;){var i,a=r.join("."),a=(r.pop(),"["+ATTRIBUTE_UPDATER_REPLACE+'^="path:'+a+'"], ['+ATTRIBUTE_UPDATER_REPLACE+'^="static:"]'),l=e.querySelectorAll(a);const o=new Set([...l]);e.matches(a)&&o.add(e);for([i]of o.entries()){if(t.has(i))return;t.add(i);var s=i.getAttribute(ATTRIBUTE_UPDATER_REPLACE),s=trimSpaces(s);let r=new Pipe(s);this[internalSymbol].callbacks.forEach((e,t)=>{r.setCallback(t,e)});let e;try{i.removeAttribute(ATTRIBUTE_ERRORMESSAGE),e=r.run(n)}catch(e){i.setAttribute(ATTRIBUTE_ERRORMESSAGE,e.message)}if(e instanceof HTMLElement){for(;i.firstChild;)i.removeChild(i.firstChild);try{i.appendChild(e)}catch(e){i.setAttribute(ATTRIBUTE_ERRORMESSAGE,(i.getAttribute(ATTRIBUTE_ERRORMESSAGE)+", "+e.message).trim())}}else i.innerHTML=e}}}}function updateAttributes(e){var t=this[internalSymbol].subject.getRealSubject(),e=clone(e?.path);runUpdateAttributes.call(this,this[internalSymbol].element,e,t)}function runUpdateAttributes(r,n,i){if(isArray(n)){n=clone(n);let t=new WeakSet;for(;0<n.length;){var a=n.join(".");n.pop();let e=new Set;var a="["+ATTRIBUTE_UPDATER_SELECT_THIS+"], ["+ATTRIBUTE_UPDATER_ATTRIBUTES+'*="path:'+a+'"], ['+ATTRIBUTE_UPDATER_ATTRIBUTES+'^="static:"]',l=r.querySelectorAll(a);0<l.length&&(e=new Set([...l])),r.matches(a)&&e.add(r);for(const[T]of e.entries()){if(t.has(T))return;t.add(T);const E=T.getAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES);for(var[,s]of Object.entries(E.split(","))){s=trimSpaces(s);var o=s.indexOf(" "),c=trimSpaces(s.substr(0,o)),s=trimSpaces(s.substr(o));let r=new Pipe(s);this[internalSymbol].callbacks.forEach((e,t)=>{r.setCallback(t,e,T)});let e;try{T.removeAttribute(ATTRIBUTE_ERRORMESSAGE),e=r.run(i)}catch(e){T.setAttribute(ATTRIBUTE_ERRORMESSAGE,e.message)}void 0===e?T.removeAttribute(c):T.getAttribute(c)!==e&&T.setAttribute(c,e),handleInputControlAttributeUpdate.call(this,T,c,e)}}}}}function handleInputControlAttributeUpdate(e,t,r){if(e instanceof HTMLSelectElement)switch(e.type){case"select-multiple":for(var[n,i]of Object.entries(e.options))-1!==r.indexOf(i.value)?i.selected=!0:i.selected=!1;break;case"select-one":for(var[a,l]of Object.entries(e.options))if(l.value===r){e.selectedIndex=a;break}}else if(e instanceof HTMLInputElement)switch(e.type){case"radio":case"checkbox":"checked"===t&&(e.checked=void 0!==r);break;default:"value"===t&&(e.value=void 0===r?"":r)}else e instanceof HTMLTextAreaElement&&"value"===t&&(e.value=void 0===r?"":r)}assignToNamespace("Monster.DOM",Updater);export{Monster,Updater};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{getGlobal}from"../types/global.js";import{validateString}from"../types/validate.js";function getDocument(){var t=getGlobal()?.document;if("object"!=typeof t)throw new Error("not supported environment");return t}function getWindow(){var t=getGlobal()?.window;if("object"!=typeof t)throw new Error("not supported environment");return t}function getDocumentFragmentFromString(t){validateString(t);const e=getDocument(),n=e.createElement("template");return n.innerHTML=t,n.content}assignToNamespace("Monster.DOM",getWindow,getDocument,getDocumentFragmentFromString);export{Monster,getWindow,getDocument,getDocumentFragmentFromString};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{internalSymbol}from"../../constants.js";import{assignToNamespace,Monster}from"../../namespace.js";import{Base}from"../../types/base.js";import{getGlobal,getGlobalFunction}from"../../types/global.js";import{isFunction}from"../../types/is.js";import{validateInstance,validateString}from"../../types/validate.js";class Factory extends Base{constructor(){super(),this[internalSymbol]={worker:new WeakMap}}createFromURL=function(t,e,r){t instanceof URL&&(t=t.toString());const o=getGlobalFunction("Worker");var n=new o(validateString(t));return isFunction(e)&&(n.onmessage=t=>{e.call(n,t)}),isFunction(r)&&(n.onerror=t=>{r.call(n,t)}),n};createFromScript=function(t,e,r){const o=new getGlobalFunction("Blob");t=new o([validateString(t)],{type:"script/javascript"}),t=getGlobalFunction("URL").createObjectURL(t),e=this.createFromURL(t,e,r);return this[internalSymbol].worker.set(e,t),e};terminate(t){var e=getGlobalFunction("Worker");return validateInstance(t,e),t.terminate(),this[internalSymbol].worker.has(t)&&(e=this[internalSymbol].worker.get(t),URL.revokeObjectURL(e)),this}}assignToNamespace("Monster.DOM.Worker",Factory);export{Monster,Factory};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{internalSymbol}from"../constants.js";import{extend}from"../data/extend.js";import{assignToNamespace,Monster}from"../namespace.js";import{Formatter as TextFormatter}from"../text/formatter.js";import{validateInstance,validateString}from"../types/validate.js";import{Translations}from"./translations.js";const internalTranslationSymbol=Symbol("internalTranslation");class Formatter extends TextFormatter{constructor(t,r,e){super(t,e),this[internalTranslationSymbol]=validateInstance(r,Translations)}get defaults(){const r=this;return extend({},super.defaults,{callbacks:{i18n:t=>r[internalTranslationSymbol].getText(validateString(t))},marker:{open:["i18n{","${"],close:["}"]}})}format(t){validateString(t);var r=this[internalSymbol].marker.open?.[0],e=this[internalSymbol].marker.close?.[0];if(0===t.indexOf(r)){if((t=t.substring(r.length)).indexOf(e)!==t.length-e.length)throw new Error("the closing marker is missing");t=t.substring(0,t.length-e.length)}const n=validateString(t).split("::");var t=n.shift().trim(),a=n.join("::").trim();let s=r+"static:"+t+" | call:i18n";return 0<a.length&&(s+="::"+a),s+=e,super.format(s)}}assignToNamespace("Monster.I18n",Formatter);export{Monster,Formatter};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{validateString}from"../types/validate.js";import{clone}from"../util/clone.js";const propertiesSymbol=Symbol("properties"),localeStringSymbol=Symbol("localeString");class Locale extends Base{constructor(e,i,t,o,a,r){super(),this[propertiesSymbol]={language:void 0===e?void 0:validateString(e),script:void 0===t?void 0:validateString(t),region:void 0===i?void 0:validateString(i),variants:void 0===o?void 0:validateString(o),extlang:void 0===a?void 0:validateString(a),privateUse:void 0===r?void 0:validateString(r)};let n=[];if(void 0!==e&&n.push(e),void 0!==t&&n.push(t),void 0!==i&&n.push(i),void 0!==o&&n.push(o),void 0!==a&&n.push(a),void 0!==r&&n.push(r),0===n.length)throw new Error("unsupported locale");this[localeStringSymbol]=n.join("-")}get localeString(){return this[localeStringSymbol]}get language(){return this[propertiesSymbol].language}get region(){return this[propertiesSymbol].region}get script(){return this[propertiesSymbol].script}get variants(){return this[propertiesSymbol].variants}get extlang(){return this[propertiesSymbol].extlang}get privateUse(){return this[propertiesSymbol].privateValue}toString(){return""+this.localeString}getMap(){return clone(this[propertiesSymbol])}}function parseLocale(e){e=validateString(e).replace(/_/g,"-");let i,t,o,a,r,n,l=new RegExp("^(((en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((([A-Za-z]{2,3}(-([A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-([A-Za-z]{4}))?(-([A-Za-z]{2}|[0-9]{3}))?(-([A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-([0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(x(-[A-Za-z0-9]{1,8})+))?)|(x(-[A-Za-z0-9]{1,8})+))$"),s;if(null!==(s=l.exec(e))&&s.index===l.lastIndex&&l.lastIndex++,null==s)throw new Error("unsupported locale");return void 0!==s[6]&&(i=s[6],1<(a=i.split("-")).length&&(i=a[0],n=a[1])),void 0!==s[14]&&(t=s[14]),void 0!==s[12]&&(r=s[12]),void 0!==s[16]&&(o=s[16]),new Locale(i,t,r,o,n)}assignToNamespace("Monster.I18n",Locale,parseLocale);export{Monster,Locale,parseLocale};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";const namespace="Monster.I18n";export{namespace};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{BaseWithOptions}from"../types/basewithoptions.js";import{Locale}from"./locale.js";import{Translations}from"./translations.js";class Provider extends BaseWithOptions{getTranslations(e){return new Promise((s,o)=>{try{s(new Translations(e))}catch(s){o(s)}})}}assignToNamespace("Monster.I18n",Provider);export{Monster,Provider};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{internalSymbol}from"../../constants.js";import{extend}from"../../data/extend.js";import{assignToNamespace,Monster}from"../../namespace.js";import{Formatter}from"../../text/formatter.js";import{getGlobalFunction}from"../../types/global.js";import{isInstance,isString}from"../../types/is.js";import{validateObject,validateString}from"../../types/validate.js";import{parseLocale}from"../locale.js";import{Provider}from"../provider.js";import{Translations}from"../translations.js";class Fetch extends Provider{constructor(t,e){super(e),isInstance(t,URL)&&(t=t.toString()),void 0===e&&(e={}),validateString(t),this.url=t,this[internalSymbol]=extend({},super.defaults,this.defaults,validateObject(e))}get defaults(){return{fetch:{method:"GET",mode:"cors",cache:"no-cache",credentials:"omit",redirect:"follow",referrerPolicy:"no-referrer"}}}getTranslations(e){isString(e)&&(e=parseLocale(e));let t=new Formatter(e.getMap());return getGlobalFunction("fetch")(t.format(this.url),this.getOption("fetch",{})).then(t=>t.json()).then(t=>new Translations(e).assignTranslations(t))}}assignToNamespace("Monster.I18n.Providers",Fetch);export{Monster,Fetch};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";const namespace="Monster.I18n.Providers";export{namespace};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{isObject,isString}from"../types/is.js";import{validateInstance,validateInteger,validateObject,validateString}from"../types/validate.js";import{Locale,parseLocale}from"./locale.js";class Translations extends Base{constructor(t){super(),isString(t)&&(t=parseLocale(t)),this.locale=validateInstance(t,Locale),this.storage=new Map}getText(t,e){if(!this.storage.has(t)){if(void 0===e)throw new Error("key "+t+" not found");return validateString(e)}var r=this.storage.get(t);return isObject(r)?this.getPluralRuleText(t,"other",e):this.storage.get(t)}getPluralRuleText(t,e,r){if(!this.storage.has(t))return validateString(r);let a=validateObject(this.storage.get(t)),s;if(isString(e))s=e.toLocaleString();else{if(0===(e=validateInteger(e))&&a.hasOwnProperty("zero"))return validateString(a.zero);s=new Intl.PluralRules(this.locale.toString()).select(validateInteger(e))}return a.hasOwnProperty(s)?validateString(a[s]):a.hasOwnProperty(DEFAULT_KEY)?validateString(a[DEFAULT_KEY]):validateString(r)}setText(t,e){if(isString(e)||isObject(e))return this.storage.set(validateString(t),e),this;throw new TypeError("value is not a string or object")}assignTranslations(t){validateObject(t);for(var[e,r]of Object.entries(t))this.setText(e,r);return this}}assignToNamespace("Monster.I18n",Translations);export{Monster,Translations};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../../namespace.js";import{Base}from"../../types/base.js";import{getGlobalObject}from"../../types/global.js";import{Handler}from"../handler.js";import{LogEntry}from"../logentry.js";class ConsoleHandler extends Handler{constructor(){super()}log(o){if(super.log(o)){let e=getGlobalObject("console");return e?(e.log(o.toString()),!0):!1}return!1}}assignToNamespace("Monster.Logging.Handler",ConsoleHandler);export{Monster,ConsoleHandler};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";const namespace="Monster.Logging.Handler";export{namespace};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{validateInstance,validateInteger}from"../types/validate.js";import{LogEntry}from"./logentry.js";import{ALL,DEBUG,ERROR,FATAL,INFO,OFF,TRACE,WARN}from"./logger.js";class Handler extends Base{constructor(){super(),this.loglevel=OFF}log(e){return validateInstance(e,LogEntry),!(this.loglevel<e.getLogLevel())}setLogLevel(e){return validateInteger(e),this.loglevel=e,this}getLogLevel(){return this.loglevel}setAll(){return this.setLogLevel(ALL),this}setTrace(){return this.setLogLevel(TRACE),this}setDebug(){return this.setLogLevel(DEBUG),this}setInfo(){return this.setLogLevel(INFO),this}setWarn(){return this.setLogLevel(WARN),this}setError(){return this.setLogLevel(ERROR),this}setFatal(){return this.setLogLevel(FATAL),this}setOff(){return this.setLogLevel(OFF),this}}assignToNamespace("Monster.Logging",Handler);export{Monster,Handler};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{validateInteger}from"../types/validate.js";class LogEntry extends Base{constructor(e,...t){super(),validateInteger(e),this.loglevel=e,this.arguments=t}getLogLevel(){return this.loglevel}getArguments(){return this.arguments}}assignToNamespace("Monster.Logging",LogEntry);export{Monster,LogEntry};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Handler}from"../logging/handler.js";import{LogEntry}from"../logging/logentry.js";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{validateInteger,validateObject,validateString}from"../types/validate.js";const ALL=255,TRACE=64,DEBUG=32,INFO=16,WARN=8,ERROR=4,FATAL=2,OFF=0;class Logger extends Base{constructor(){super(),this.handler=new Set}addHandler(e){if(validateObject(e),!(e instanceof Handler))throw new Error("the handler must be an instance of Handler");return this.handler.add(e),this}removeHandler(e){if(validateObject(e),!(e instanceof Handler))throw new Error("the handler must be an instance of Handler");return this.handler.delete(e),this}logTrace(){return triggerLog.apply(this,[TRACE,...arguments]),this}logDebug(){return triggerLog.apply(this,[DEBUG,...arguments]),this}logInfo(){return triggerLog.apply(this,[INFO,...arguments]),this}logWarn(){return triggerLog.apply(this,[WARN,...arguments]),this}logError(){return triggerLog.apply(this,[ERROR,...arguments]),this}logFatal(){return triggerLog.apply(this,[FATAL,...arguments]),this}getLabel(e){return validateInteger(e),e===ALL?"ALL":e===TRACE?"TRACE":e===DEBUG?"DEBUG":e===INFO?"INFO":e===WARN?"WARN":e===ERROR?"ERROR":e===FATAL?"FATAL":e===OFF?"OFF":"unknown"}getLevel(e){return validateString(e),"ALL"===e?ALL:"TRACE"===e?TRACE:"DEBUG"===e?DEBUG:"INFO"===e?INFO:"WARN"===e?WARN:"ERROR"===e?ERROR:"FATAL"===e?FATAL:"OFF"===e?OFF:0}}function triggerLog(e,...r){var t;for(t of this.handler)t.log(new LogEntry(e,r));return this}assignToNamespace("Monster.Logging",Logger);export{Monster,Logger,ALL,TRACE,DEBUG,INFO,WARN,ERROR,FATAL,OFF};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";const namespace="Monster.Logging";export{namespace};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";const namespace="Monster.Math";export{namespace};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{getGlobal}from"../types/global.js";function random(r,t){if((t=void 0===t?MAX:t)<(r=void 0===r?0:r))throw new Error("max must be greater than min");return Math.round(create(r,t))}var MAX=1e9;function create(r,t){let e;var o=getGlobal();if(e=o?.crypto||o?.msCrypto||o?.crypto||void 0,void 0===e)throw new Error("missing crypt");let a=0;o=t-r;if(o<2)throw new Error("the distance is too small to create a random number.");var n=Math.ceil(Math.log2(o));if(53<n)throw new Error("we cannot generate numbers larger than 53 bits.");var i=Math.ceil(n/8),n=Math.pow(2,n)-1,s=new Uint8Array(i);e.getRandomValues(s);let l=8*(i-1);for(var m=0;m<i;m++)a+=s[m]*Math.pow(2,l),l-=8;return a&=n,a>=o?create(r,t):(a<r&&(a+=r),a)}Math.log2=Math.log2||function(r){return Math.log(r)/Math.log(2)},assignToNamespace("Monster.Math",random);export{Monster,random};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import"./constants.js";import"./constraints/abstract.js";import"./constraints/abstractoperator.js";import"./constraints/andoperator.js";import"./constraints/invalid.js";import"./constraints/isarray.js";import"./constraints/isobject.js";import"./constraints/oroperator.js";import"./constraints/valid.js";import"./data/buildmap.js";import"./data/diff.js";import"./data/extend.js";import"./data/pathfinder.js";import"./data/pipe.js";import"./data/transformer.js";import"./dom/assembler.js";import"./dom/attributes.js";import"./dom/constants.js";import"./dom/customcontrol.js";import"./dom/customelement.js";import"./dom/events.js";import"./dom/locale.js";import"./dom/template.js";import"./dom/theme.js";import"./dom/updater.js";import"./dom/util.js";import"./i18n/locale.js";import"./i18n/provider.js";import"./i18n/providers/fetch.js";import"./i18n/translations.js";import"./logging/handler.js";import"./logging/handler/console.js";import"./logging/logentry.js";import"./logging/logger.js";import"./math/random.js";import{Monster}from"./namespace.js";import"./text/formatter.js";import"./types/base.js";import"./types/basewithoptions.js";import"./types/global.js";import"./types/id.js";import"./types/is.js";import"./types/observer.js";import"./types/observerlist.js";import"./types/proxyobserver.js";import"./types/queue.js";import"./types/randomid.js";import"./types/stack.js";import"./types/tokenlist.js";import"./types/typeof.js";import"./types/uniquequeue.js";import"./types/validate.js";import"./types/version.js";import"./util/clone.js";import"./util/comparator.js";import"./util/freeze.js";let rootName;try{rootName=Monster.Types.getGlobalObject("__MonsterRootName__")}catch(t){}rootName=rootName||"Monster",Monster.Types.getGlobal()[rootName]=Monster;export{Monster};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";class Namespace{constructor(e){if(void 0===e||"string"!=typeof e)throw new Error("namespace is not a string");this.namespace=e}getNamespace(){return this.namespace}toString(){return this.getNamespace()}}const Monster=new Namespace("Monster");function assignToNamespace(e,...r){let n=namespaceFor(e.split("."));if(0===r.length)throw new Error("no functions have been passed.");for(let e=0,t=r.length;e<t;e++)n[objectName(r[e])]=r[e];return n}function objectName(t){try{if("function"!=typeof t)throw new Error("the first argument is not a function or class.");if(t.hasOwnProperty("name"))return t.name;if("function"==typeof t.toString){let e=t.toString();var r=e.match(/^\s*function\s+([^\s(]+)/);if(Array.isArray(r)&&"string"==typeof r[1])return r[1];var n=e.match(/^\s*class\s+([^\s(]+)/);if(Array.isArray(n)&&"string"==typeof n[1])return n[1]}}catch(e){throw new Error("exception "+e)}throw new Error("the name of the class or function cannot be resolved.")}function namespaceFor(t){let r=Monster,n="Monster";for(let e=0;e<t.length;e++)"Monster"!==t[e]&&(n+="."+t[e],r.hasOwnProperty(t[e])||(r[t[e]]=new Namespace(n)),r=r[t[e]]);return r}assignToNamespace("Monster",assignToNamespace,Namespace);export{Monster,assignToNamespace};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{internalSymbol}from"../constants.js";import{extend}from"../data/extend.js";import{Pipe}from"../data/pipe.js";import{assignToNamespace,Monster}from"../namespace.js";import{BaseWithOptions}from"../types/basewithoptions.js";import{isObject,isString}from"../types/is.js";import{validateArray,validateString}from"../types/validate.js";const internalObjectSymbol=Symbol("internalObject"),watchdogSymbol=Symbol("watchdog"),markerOpenIndexSymbol=Symbol("markerOpenIndex"),markerCloseIndexSymbol=Symbol("markercloseIndex"),workingDataSymbol=Symbol("workingData");class Formatter extends BaseWithOptions{constructor(t,e){super(e),this[internalObjectSymbol]=t||{},this[markerOpenIndexSymbol]=0,this[markerCloseIndexSymbol]=0}get defaults(){return extend({},super.defaults,{marker:{open:["${"],close:["}"]},parameter:{delimiter:"::",assignment:"="},callbacks:{}})}setParameterChars(t,e){return void 0!==t&&(this[internalSymbol].parameter.delimiter=validateString(t)),void 0!==e&&(this[internalSymbol].parameter.assignment=validateString(e)),this}setMarker(t,e){return void 0===e&&(e=t),isString(t)&&(t=[t]),isString(e)&&(e=[e]),this[internalSymbol].marker.open=validateArray(t),this[internalSymbol].marker.close=validateArray(e),this}format(t){return this[watchdogSymbol]=0,this[markerOpenIndexSymbol]=0,this[markerCloseIndexSymbol]=0,this[workingDataSymbol]={},format.call(this,t)}}function format(t){var e=this;if(e[watchdogSymbol]++,20<this[watchdogSymbol])throw new Error("too deep nesting");var r=e[internalSymbol].marker.open?.[this[markerOpenIndexSymbol]],n=e[internalSymbol].marker.close?.[this[markerCloseIndexSymbol]];if(-1===t.indexOf(r)||-1===t.indexOf(n))return t;t=tokenize.call(this,validateString(t),r,n);return e[internalSymbol].marker.open?.[this[markerOpenIndexSymbol]+1]&&this[markerOpenIndexSymbol]++,e[internalSymbol].marker.close?.[this[markerCloseIndexSymbol]+1]&&this[markerCloseIndexSymbol]++,format.call(e,t)}function tokenize(a,i,o){var s=this;let l=[];for(var S=s[internalSymbol].parameter.assignment,y=s[internalSymbol].parameter.delimiter,m=s[internalSymbol].callbacks;;){var b=a.indexOf(i);if(-1===b){l.push(a);break}0<b&&(l.push(a.substring(0,b)),a=a.substring(b));let t=a.substring(i.length).indexOf(o);-1!==t&&(t+=i.length);b=a.substring(i.length).indexOf(i);if(-1!==b&&(b+=i.length)<t&&(d=tokenize.call(s,a.substring(b),i,o),a=a.substring(0,b)+d,t=a.substring(i.length).indexOf(o),-1!==t&&(t+=i.length)),-1===t)throw new Error("syntax error in formatter template");let e=a.substring(i.length,t),r=e.split(y);b=r.shift();s[workingDataSymbol]=extend({},s[internalObjectSymbol],s[workingDataSymbol]);for(const O of r){var[g,c]=O.split(S);s[workingDataSymbol][g]=c}const x=e.split("|").shift().trim(),u=x.split("::").shift().trim();var d=u.split(".").shift().trim(),h=s[workingDataSymbol]?.[d]?"path:":"static:";let n="";h&&0!==e.indexOf(h)&&0!==e.indexOf("path:")&&0!==e.indexOf("static:")&&(n=h),n+=b;const p=new Pipe(n);if(isObject(m))for(var[f,k]of Object.entries(m))p.setCallback(f,k);l.push(validateString(p.run(s[workingDataSymbol]))),a=a.substring(t+o.length)}return l.join("")}assignToNamespace("Monster.Text",Formatter);export{Monster,Formatter};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";const namespace="Monster.Text";export{namespace};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";class Base extends Object{toString(){return JSON.stringify(this)}}assignToNamespace("Monster.Types",Base);export{Monster,Base};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{internalSymbol}from"../constants.js";import{extend}from"../data/extend.js";import{Pathfinder}from"../data/pathfinder.js";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"./base.js";import{validateObject}from"./validate.js";class BaseWithOptions extends Base{constructor(t){super(),this[internalSymbol]=extend({},this.defaults,validateObject(t=void 0===t?{}:t))}get defaults(){return{}}getOption(t,e){let s;try{s=new Pathfinder(this[internalSymbol]).getVia(t)}catch(t){}return void 0===s?e:s}}assignToNamespace("Monster.Types",BaseWithOptions);export{Monster,BaseWithOptions};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace}from"../namespace.js";import{Monster,validateString}from"./validate.js";function toBinary(t){const e=new Uint16Array(validateString(t).length);for(let r=0;r<e.length;r++)e[r]=t.charCodeAt(r);var n=new Uint8Array(e.buffer);let a="";for(let r=0;r<n.byteLength;r++)a+=String.fromCharCode(n[r]);return a}function fromBinary(t){const e=new Uint8Array(validateString(t).length);for(let r=0;r<e.length;r++)e[r]=t.charCodeAt(r);var n=new Uint16Array(e.buffer);let a="";for(let r=0;r<n.length;r++)a+=String.fromCharCode(n[r]);return a}assignToNamespace("Monster.Types",toBinary,fromBinary);export{Monster,toBinary,fromBinary};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace}from"../namespace.js";import{Base,Monster}from"./base.js";import{isString}from"./is.js";import{MediaType,parseMediaType}from"./mediatype.js";import{validateBoolean,validateInstance,validateString}from"./validate.js";const internal=Symbol("internal");class DataUrl extends Base{constructor(t,e,a){super(),isString(e)&&(e=parseMediaType(e)),this[internal]={content:validateString(t),mediatype:validateInstance(e,MediaType),base64:validateBoolean(void 0===a||a)}}get content(){return this[internal].base64?atob(this[internal].content):this[internal].content}get mediatype(){return this[internal].mediatype}toString(){let t=this[internal].content;return t=!0===this[internal].base64?";base64,"+t:","+encodeURIComponent(t),"data:"+this[internal].mediatype.toString()+t}}function parseDataURL(t){if(validateString(t),"data:"!==(t=t.trim()).substring(0,5))throw new TypeError("incorrect or missing data protocol");var e=(t=t.substring(5)).indexOf(",");if(-1===e)throw new TypeError("malformed data url");let a=t.substring(e+1),n=t.substring(0,e).trim(),r="text/plain;charset=US-ASCII",i=!1;return""!==n?(r=n,n.endsWith("base64")?(t=n.lastIndexOf(";"),r=n.substring(0,t),i=!0):a=decodeURIComponent(a),r=parseMediaType(r)):a=decodeURIComponent(a),new DataUrl(a,r,i)}assignToNamespace("Monster.Types",parseDataURL,DataUrl);export{Monster,parseDataURL,DataUrl};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{validateFunction,validateObject,validateString}from"./validate.js";let globalReference;function getGlobal(){return globalReference}function getGlobalObject(e){validateString(e);var t=globalReference?.[e];if(void 0===t)throw new Error("the object "+e+" is not defined");return validateObject(t),t}function getGlobalFunction(e){validateString(e);var t=globalReference?.[e];if(void 0===t)throw new Error("the function "+e+" is not defined");return validateFunction(t),t}!function(){if("object"!=typeof globalThis)if("undefined"==typeof self){if("undefined"==typeof window){if(Object.defineProperty(Object.prototype,"__monster__",{get:function(){return this},configurable:!0}),"object"==typeof __monster__)return __monster__.globalThis=__monster__,delete Object.prototype.__monster__,globalReference=globalThis;try{globalReference=Function("return this")()}catch(e){}throw new Error("unsupported environment.")}globalReference=window}else globalReference=self;else globalReference=globalThis}(),assignToNamespace("Monster.Types",getGlobal,getGlobalObject,getGlobalFunction);export{Monster,getGlobal,getGlobalObject,getGlobalFunction};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"./base.js";import{validateString}from"./validate.js";let internalCounter=new Map;class ID extends Base{constructor(e){super(),validateString(e=void 0===e?"id":e),internalCounter.has(e)||internalCounter.set(e,1);var t=internalCounter.get(e);this.id=e+t,internalCounter.set(e,++t)}toString(){return this.id}}assignToNamespace("Monster.Types",ID);export{Monster,ID};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";function isIterable(i){return void 0!==i&&(null!==i&&"function"==typeof i?.[Symbol.iterator])}function isPrimitive(i){return null==i||("string"==(i=typeof i)||"number"==i||"boolean"==i||"symbol"==i)}function isSymbol(i){return"symbol"==typeof i}function isBoolean(i){return!0===i||!1===i}function isString(i){return void 0!==i&&"string"==typeof i}function isObject(i){return!isArray(i)&&(!isPrimitive(i)&&"object"==typeof i)}function isInstance(i,n){return!!isObject(i)&&(!!isFunction(n)&&(!!n.hasOwnProperty("prototype")&&i instanceof n))}function isArray(i){return Array.isArray(i)}function isFunction(i){return!isArray(i)&&(!isPrimitive(i)&&"function"==typeof i)}function isInteger(i){return Number.isInteger(i)}assignToNamespace("Monster.Types",isPrimitive,isBoolean,isString,isObject,isArray,isFunction,isIterable,isInteger,isSymbol);export{Monster,isPrimitive,isBoolean,isString,isObject,isInstance,isArray,isFunction,isIterable,isInteger,isSymbol};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace}from"../namespace.js";import{Base,Monster}from"./base.js";import{isString}from"./is.js";import{validateArray,validateString}from"./validate.js";const internal=Symbol("internal");class MediaType extends Base{constructor(e,t,r){super(),this[internal]={type:validateString(e).toLowerCase(),subtype:validateString(t).toLowerCase(),parameter:[]},void 0!==r&&(this[internal].parameter=validateArray(r))}get type(){return this[internal].type}get subtype(){return this[internal].subtype}get parameter(){return this[internal].parameter}get parameter(){const r=new Map;return this[internal].parameter.forEach(e=>{let t=e.value;t.startsWith('"')&&t.endsWith('"')&&(t=t.substring(1,t.length-1)),r.set(e.key,t)}),r}toString(){let e=[];for(var t of this[internal].parameter)e.push(t.key+"="+t.value);return this[internal].type+"/"+this[internal].subtype+(0<e.length?";"+e.join(";"):"")}}function parseMediaType(e){e=/(?<type>[A-Za-z]+|\*)\/(?<subtype>([a-zA-Z0-9.\+_\-]+)|\*|)(?<parameter>\s*;\s*([a-zA-Z0-9]+)\s*(=\s*("?[A-Za-z0-9_\-]+"?))?)*/g.exec(validateString(e))?.groups;if(void 0===e)throw new TypeError("the mimetype can not be parsed");var t=e?.type,r=e?.subtype,e=e?.parameter;if(""===r||""===t)throw new TypeError("blank value is not allowed");return new MediaType(t,r,parseParameter(e))}function parseParameter(e){if(isString(e)){let r=[];return e.split(";").forEach(e=>{var t;""!==(e=e.trim())&&(e=e.split("="),t=validateString(e?.[0]).trim(),e=validateString(e?.[1]).trim(),r.push({key:t,value:e}))}),r}}assignToNamespace("Monster.Types",parseMediaType,MediaType);export{Monster,parseMediaType,MediaType};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";const namespace="Monster.Types";export{namespace};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"./base.js";import{isPrimitive}from"./is.js";import{NodeList}from"./nodelist.js";import{validateInstance}from"./validate.js";const internalValueSymbol=Symbol("internalData"),treeStructureSymbol=Symbol("treeStructure");class Node extends Base{constructor(e){super(),this[internalValueSymbol]=e,this[treeStructureSymbol]={parent:null,childNodes:new NodeList,level:0}}get value(){return this[internalValueSymbol]}set value(e){this[internalValueSymbol]=e}get parent(){return this[treeStructureSymbol].parent}get level(){return this[treeStructureSymbol].level}get childNodes(){return this[treeStructureSymbol].childNodes}set childNodes(e){this[treeStructureSymbol].childNodes=validateInstance(e,NodeList),setChildLevelAndParent.call(this,this,1)}appendChild(e){return this[treeStructureSymbol].childNodes.add(validateInstance(e,Node)),e[treeStructureSymbol].parent=this,e[treeStructureSymbol].level=this.level+1,setChildLevelAndParent.call(this,e,1),this}removeChild(e){return this[treeStructureSymbol].childNodes.remove(validateInstance(e,Node)),e[treeStructureSymbol].parent=null,e[treeStructureSymbol].level=0,setChildLevelAndParent.call(this,e,-1),this}hasChildNodes(){return 0<this[treeStructureSymbol].childNodes.length}hasChild(e){return this[treeStructureSymbol].childNodes.has(validateInstance(e,Node))}toString(){let t=[];if(this[internalValueSymbol]){let e=this[internalValueSymbol];isPrimitive(e)||(e=JSON.stringify(this[internalValueSymbol])),t.push(e)}if(!this.hasChildNodes())return t.join("\n");let e=this.childNodes.length,r=0;for(const s of this.childNodes){r++;var l=(e===r?"└":"├").padStart(2*s.level," |");t.push(l+s.toString())}return t.join("\n")}}function setChildLevelAndParent(t,r){const l=this;return t!==this&&(t[treeStructureSymbol].parent=this),t[treeStructureSymbol].childNodes.forEach(function(e){e[treeStructureSymbol].parent=t,e[treeStructureSymbol].level=t[treeStructureSymbol].level+r,setChildLevelAndParent.call(l,e,r)}),this}assignToNamespace("Monster.Types",Node);export{Monster,Node};
@@ -1,2 +0,0 @@
1
- /** Monster 1.31.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isArray,isInstance}from"./is.js";import{Node}from"./node.js";import{validateInstance}from"./validate.js";class NodeList extends Set{constructor(e){super();const r=this;if(void 0!==e)if(isArray(e))e.forEach(e=>r.add(e));else if(isInstance(e,NodeList))e.forEach(e=>r.add(e));else{if(!isInstance(e,Node))throw new Error("invalid value type");r.add(e)}}add(e){return super.add(validateInstance(e,Node)),this}remove(e){return super.delete(validateInstance(e,Node)),this}has(e){return super.has(validateInstance(e,Node))}clear(){return super.clear(),this}toArray(){return Array.from(this)}toJSON(){return this.toArray()}toString(){let e=[];for(const r of this.toArray())e.push(r.toString());return e.join("\n")}get length(){return super.size}}assignToNamespace("Monster.Types",NodeList);export{Monster,NodeList};