wj-elements 0.1.135 → 0.1.136

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (418) hide show
  1. package/package.json +1 -1
  2. package/dist/dark.css +0 -223
  3. package/dist/infinite-scroll.element-XVJukzjy.js +0 -272
  4. package/dist/infinite-scroll.element-XVJukzjy.js.map +0 -1
  5. package/dist/light.css +0 -530
  6. package/dist/list.element-Ce1vIm1O.js +0 -50
  7. package/dist/list.element-Ce1vIm1O.js.map +0 -1
  8. package/dist/localize.js +0 -70
  9. package/dist/localize.js.map +0 -1
  10. package/dist/packages/index.d.ts +0 -100
  11. package/dist/packages/localize/localize.d.ts +0 -17
  12. package/dist/packages/translations/en-gb.d.ts +0 -13
  13. package/dist/packages/translations/sk-sk.d.ts +0 -13
  14. package/dist/packages/utils/animations.d.ts +0 -2
  15. package/dist/packages/utils/date.d.ts +0 -1
  16. package/dist/packages/utils/element-utils.d.ts +0 -46
  17. package/dist/packages/utils/event.d.ts +0 -67
  18. package/dist/packages/utils/localize.d.ts +0 -4
  19. package/dist/packages/utils/permissions-api.d.ts +0 -34
  20. package/dist/packages/utils/utils.d.ts +0 -1
  21. package/dist/packages/utils/wje-import-firefox.d.ts +0 -0
  22. package/dist/packages/utils/wje-import.d.ts +0 -0
  23. package/dist/packages/wje-accordion/accordion.d.ts +0 -2
  24. package/dist/packages/wje-accordion/accordion.element.d.ts +0 -72
  25. package/dist/packages/wje-accordion-item/accordion-item.d.ts +0 -2
  26. package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +0 -40
  27. package/dist/packages/wje-animation/animation.d.ts +0 -2
  28. package/dist/packages/wje-animation/animation.element.d.ts +0 -153
  29. package/dist/packages/wje-animation/animation.test.d.ts +0 -1
  30. package/dist/packages/wje-aside/aside.d.ts +0 -2
  31. package/dist/packages/wje-aside/aside.element.d.ts +0 -31
  32. package/dist/packages/wje-avatar/avatar.d.ts +0 -2
  33. package/dist/packages/wje-avatar/avatar.element.d.ts +0 -37
  34. package/dist/packages/wje-avatar/service/service.d.ts +0 -40
  35. package/dist/packages/wje-badge/badge.d.ts +0 -2
  36. package/dist/packages/wje-badge/badge.element.d.ts +0 -35
  37. package/dist/packages/wje-badge/badge.test.d.ts +0 -1
  38. package/dist/packages/wje-breadcrumb/breadcrumb.d.ts +0 -2
  39. package/dist/packages/wje-breadcrumb/breadcrumb.element.d.ts +0 -80
  40. package/dist/packages/wje-breadcrumbs/breadcrumbs.d.ts +0 -2
  41. package/dist/packages/wje-breadcrumbs/breadcrumbs.element.d.ts +0 -97
  42. package/dist/packages/wje-breadcrumbs/breadcrumbs.test.d.ts +0 -1
  43. package/dist/packages/wje-button/button.d.ts +0 -2
  44. package/dist/packages/wje-button/button.element.d.ts +0 -173
  45. package/dist/packages/wje-button/button.test.d.ts +0 -1
  46. package/dist/packages/wje-button-group/button-group.d.ts +0 -2
  47. package/dist/packages/wje-button-group/button-group.element.d.ts +0 -39
  48. package/dist/packages/wje-card/card.d.ts +0 -2
  49. package/dist/packages/wje-card/card.element.d.ts +0 -29
  50. package/dist/packages/wje-card-content/card-content.d.ts +0 -2
  51. package/dist/packages/wje-card-content/card-content.element.d.ts +0 -22
  52. package/dist/packages/wje-card-controls/card-controls.d.ts +0 -2
  53. package/dist/packages/wje-card-controls/card-controls.element.d.ts +0 -23
  54. package/dist/packages/wje-card-header/card-header.d.ts +0 -2
  55. package/dist/packages/wje-card-header/card-header.element.d.ts +0 -22
  56. package/dist/packages/wje-card-subtitle/card-subtitle.d.ts +0 -2
  57. package/dist/packages/wje-card-subtitle/card-subtitle.element.d.ts +0 -30
  58. package/dist/packages/wje-card-title/card-title.d.ts +0 -2
  59. package/dist/packages/wje-card-title/card-title.element.d.ts +0 -32
  60. package/dist/packages/wje-carousel/carousel.d.ts +0 -2
  61. package/dist/packages/wje-carousel/carousel.element.d.ts +0 -146
  62. package/dist/packages/wje-carousel-item/carousel-item.d.ts +0 -2
  63. package/dist/packages/wje-carousel-item/carousel-item.element.d.ts +0 -38
  64. package/dist/packages/wje-checkbox/checkbox.d.ts +0 -2
  65. package/dist/packages/wje-checkbox/checkbox.element.d.ts +0 -171
  66. package/dist/packages/wje-chip/chip.d.ts +0 -2
  67. package/dist/packages/wje-chip/chip.element.d.ts +0 -29
  68. package/dist/packages/wje-col/col.d.ts +0 -2
  69. package/dist/packages/wje-col/col.element.d.ts +0 -16
  70. package/dist/packages/wje-color-picker/color-picker.d.ts +0 -2
  71. package/dist/packages/wje-color-picker/color-picker.element.d.ts +0 -187
  72. package/dist/packages/wje-container/container.d.ts +0 -2
  73. package/dist/packages/wje-container/container.element.d.ts +0 -31
  74. package/dist/packages/wje-copy-button/copy-button.d.ts +0 -2
  75. package/dist/packages/wje-copy-button/copy-button.element.d.ts +0 -89
  76. package/dist/packages/wje-copy-button/service/service.d.ts +0 -12
  77. package/dist/packages/wje-dialog/dialog.d.ts +0 -2
  78. package/dist/packages/wje-dialog/dialog.element.d.ts +0 -116
  79. package/dist/packages/wje-divider/divider.d.ts +0 -2
  80. package/dist/packages/wje-divider/divider.element.d.ts +0 -32
  81. package/dist/packages/wje-dropdown/dropdown.d.ts +0 -2
  82. package/dist/packages/wje-dropdown/dropdown.element.d.ts +0 -85
  83. package/dist/packages/wje-element/element.d.ts +0 -313
  84. package/dist/packages/wje-element/service/universal-service.d.ts +0 -18
  85. package/dist/packages/wje-file-upload/file-upload.d.ts +0 -2
  86. package/dist/packages/wje-file-upload/file-upload.element.d.ts +0 -191
  87. package/dist/packages/wje-file-upload/service/service.d.ts +0 -70
  88. package/dist/packages/wje-file-upload-item/file-upload-item.d.ts +0 -2
  89. package/dist/packages/wje-file-upload-item/file-upload-item.element.d.ts +0 -64
  90. package/dist/packages/wje-footer/footer.d.ts +0 -2
  91. package/dist/packages/wje-footer/footer.element.d.ts +0 -28
  92. package/dist/packages/wje-form/form.d.ts +0 -2
  93. package/dist/packages/wje-form/form.element.d.ts +0 -28
  94. package/dist/packages/wje-format-digital/format-digital.d.ts +0 -2
  95. package/dist/packages/wje-format-digital/format-digital.element.d.ts +0 -87
  96. package/dist/packages/wje-format-digital/format-digital.test.d.ts +0 -1
  97. package/dist/packages/wje-grid/grid.d.ts +0 -2
  98. package/dist/packages/wje-grid/grid.element.d.ts +0 -26
  99. package/dist/packages/wje-header/header.d.ts +0 -2
  100. package/dist/packages/wje-header/header.element.d.ts +0 -35
  101. package/dist/packages/wje-icon/icon.d.ts +0 -2
  102. package/dist/packages/wje-icon/icon.element.d.ts +0 -40
  103. package/dist/packages/wje-icon/service/service.d.ts +0 -11
  104. package/dist/packages/wje-icon-picker/icon-picker.d.ts +0 -2
  105. package/dist/packages/wje-icon-picker/icon-picker.element.d.ts +0 -197
  106. package/dist/packages/wje-img/img.d.ts +0 -2
  107. package/dist/packages/wje-img/img.element.d.ts +0 -30
  108. package/dist/packages/wje-img-comparer/img-comparer.d.ts +0 -2
  109. package/dist/packages/wje-img-comparer/img-comparer.element.d.ts +0 -60
  110. package/dist/packages/wje-img-comparer/service/service.d.ts +0 -1
  111. package/dist/packages/wje-infinite-scroll/infinite-scroll.d.ts +0 -2
  112. package/dist/packages/wje-infinite-scroll/infinite-scroll.element.d.ts +0 -134
  113. package/dist/packages/wje-input/input.d.ts +0 -2
  114. package/dist/packages/wje-input/input.element.d.ts +0 -204
  115. package/dist/packages/wje-input-file/input-file.d.ts +0 -2
  116. package/dist/packages/wje-input-file/input-file.element.d.ts +0 -50
  117. package/dist/packages/wje-item/item.d.ts +0 -2
  118. package/dist/packages/wje-item/item.element.d.ts +0 -68
  119. package/dist/packages/wje-kanban/kanban.d.ts +0 -2
  120. package/dist/packages/wje-kanban/kanban.element.d.ts +0 -183
  121. package/dist/packages/wje-label/label.d.ts +0 -2
  122. package/dist/packages/wje-label/label.element.d.ts +0 -34
  123. package/dist/packages/wje-list/list.d.ts +0 -2
  124. package/dist/packages/wje-list/list.element.d.ts +0 -31
  125. package/dist/packages/wje-main/main.d.ts +0 -2
  126. package/dist/packages/wje-main/main.element.d.ts +0 -30
  127. package/dist/packages/wje-masonry/masonry.d.ts +0 -2
  128. package/dist/packages/wje-masonry/masonry.element.d.ts +0 -114
  129. package/dist/packages/wje-masonry/service/service.d.ts +0 -32
  130. package/dist/packages/wje-menu/menu.d.ts +0 -2
  131. package/dist/packages/wje-menu/menu.element.d.ts +0 -47
  132. package/dist/packages/wje-menu-button/menu-button.d.ts +0 -2
  133. package/dist/packages/wje-menu-button/menu-button.element.d.ts +0 -34
  134. package/dist/packages/wje-menu-item/menu-item.d.ts +0 -2
  135. package/dist/packages/wje-menu-item/menu-item.element.d.ts +0 -139
  136. package/dist/packages/wje-menu-label/menu-label.d.ts +0 -2
  137. package/dist/packages/wje-menu-label/menu-label.element.d.ts +0 -39
  138. package/dist/packages/wje-option/option.d.ts +0 -2
  139. package/dist/packages/wje-option/option.element.d.ts +0 -59
  140. package/dist/packages/wje-options/options.d.ts +0 -2
  141. package/dist/packages/wje-options/options.element.d.ts +0 -183
  142. package/dist/packages/wje-orgchart/orgchart.d.ts +0 -2
  143. package/dist/packages/wje-orgchart/orgchart.element.d.ts +0 -24
  144. package/dist/packages/wje-orgchart-group/orgchart-group.d.ts +0 -2
  145. package/dist/packages/wje-orgchart-group/orgchart-group.element.d.ts +0 -28
  146. package/dist/packages/wje-orgchart-item/orgchart-item.d.ts +0 -2
  147. package/dist/packages/wje-orgchart-item/orgchart-item.element.d.ts +0 -49
  148. package/dist/packages/wje-panel/panel.d.ts +0 -2
  149. package/dist/packages/wje-panel/panel.element.d.ts +0 -34
  150. package/dist/packages/wje-popup/popup.d.ts +0 -2
  151. package/dist/packages/wje-popup/popup.element.d.ts +0 -93
  152. package/dist/packages/wje-progress-bar/progress-bar.d.ts +0 -2
  153. package/dist/packages/wje-progress-bar/progress-bar.element.d.ts +0 -96
  154. package/dist/packages/wje-qr-code/qr-code.d.ts +0 -2
  155. package/dist/packages/wje-qr-code/qr-code.element.d.ts +0 -33
  156. package/dist/packages/wje-radio/radio.d.ts +0 -2
  157. package/dist/packages/wje-radio/radio.element.d.ts +0 -53
  158. package/dist/packages/wje-radio-group/radio-group.d.ts +0 -2
  159. package/dist/packages/wje-radio-group/radio-group.element.d.ts +0 -137
  160. package/dist/packages/wje-rate/rate.d.ts +0 -2
  161. package/dist/packages/wje-rate/rate.element.d.ts +0 -156
  162. package/dist/packages/wje-relative-time/relative-time.d.ts +0 -2
  163. package/dist/packages/wje-relative-time/relative-time.element.d.ts +0 -55
  164. package/dist/packages/wje-relative-time/relative-time.test.d.ts +0 -1
  165. package/dist/packages/wje-reorder/reorder.d.ts +0 -2
  166. package/dist/packages/wje-reorder/reorder.element.d.ts +0 -119
  167. package/dist/packages/wje-reorder-dropzone/reorder-dropzone.d.ts +0 -2
  168. package/dist/packages/wje-reorder-dropzone/reorder-dropzone.element.d.ts +0 -23
  169. package/dist/packages/wje-reorder-handle/reorder-handle.d.ts +0 -2
  170. package/dist/packages/wje-reorder-handle/reorder-handle.element.d.ts +0 -75
  171. package/dist/packages/wje-reorder-item/reorder-item.d.ts +0 -2
  172. package/dist/packages/wje-reorder-item/reorder-item.element.d.ts +0 -24
  173. package/dist/packages/wje-route/route.d.ts +0 -2
  174. package/dist/packages/wje-route/route.element.d.ts +0 -22
  175. package/dist/packages/wje-router/router.d.ts +0 -2
  176. package/dist/packages/wje-router/router.element.d.ts +0 -39
  177. package/dist/packages/wje-router-link/router-link.d.ts +0 -2
  178. package/dist/packages/wje-router-link/router-link.element.d.ts +0 -31
  179. package/dist/packages/wje-router-outlet/router-outlet.d.ts +0 -2
  180. package/dist/packages/wje-router-outlet/router-outlet.element.d.ts +0 -15
  181. package/dist/packages/wje-row/row.d.ts +0 -2
  182. package/dist/packages/wje-row/row.element.d.ts +0 -23
  183. package/dist/packages/wje-select/select.d.ts +0 -2
  184. package/dist/packages/wje-select/select.element.d.ts +0 -315
  185. package/dist/packages/wje-slider/slider.d.ts +0 -2
  186. package/dist/packages/wje-slider/slider.element.d.ts +0 -103
  187. package/dist/packages/wje-split-view/service/service.d.ts +0 -1
  188. package/dist/packages/wje-split-view/split-view.d.ts +0 -2
  189. package/dist/packages/wje-split-view/split-view.element.d.ts +0 -66
  190. package/dist/packages/wje-status/status.d.ts +0 -2
  191. package/dist/packages/wje-status/status.element.d.ts +0 -26
  192. package/dist/packages/wje-step/step.d.ts +0 -2
  193. package/dist/packages/wje-step/step.element.d.ts +0 -23
  194. package/dist/packages/wje-stepper/stepper.d.ts +0 -2
  195. package/dist/packages/wje-stepper/stepper.element.d.ts +0 -78
  196. package/dist/packages/wje-store/default-store-actions.d.ts +0 -25
  197. package/dist/packages/wje-store/pubsub.d.ts +0 -21
  198. package/dist/packages/wje-store/store.d.ts +0 -153
  199. package/dist/packages/wje-tab/tab.d.ts +0 -2
  200. package/dist/packages/wje-tab/tab.element.d.ts +0 -41
  201. package/dist/packages/wje-tab-group/tab-group.d.ts +0 -2
  202. package/dist/packages/wje-tab-group/tab-group.element.d.ts +0 -67
  203. package/dist/packages/wje-tab-panel/tab-panel.d.ts +0 -2
  204. package/dist/packages/wje-tab-panel/tab-panel.element.d.ts +0 -23
  205. package/dist/packages/wje-textarea/textarea.d.ts +0 -2
  206. package/dist/packages/wje-textarea/textarea.element.d.ts +0 -176
  207. package/dist/packages/wje-thumbnail/thumbnail.d.ts +0 -2
  208. package/dist/packages/wje-thumbnail/thumbnail.element.d.ts +0 -31
  209. package/dist/packages/wje-timeline/timeline.d.ts +0 -2
  210. package/dist/packages/wje-timeline/timeline.element.d.ts +0 -25
  211. package/dist/packages/wje-timeline-item/timeline-item.d.ts +0 -2
  212. package/dist/packages/wje-timeline-item/timeline-item.element.d.ts +0 -27
  213. package/dist/packages/wje-toast/toast.d.ts +0 -2
  214. package/dist/packages/wje-toast/toast.element.d.ts +0 -173
  215. package/dist/packages/wje-toast/toast.test.d.ts +0 -1
  216. package/dist/packages/wje-toggle/toggle.d.ts +0 -2
  217. package/dist/packages/wje-toggle/toggle.element.d.ts +0 -65
  218. package/dist/packages/wje-toolbar/toolbar.d.ts +0 -2
  219. package/dist/packages/wje-toolbar/toolbar.element.d.ts +0 -39
  220. package/dist/packages/wje-toolbar-action/toolbar-action.d.ts +0 -2
  221. package/dist/packages/wje-toolbar-action/toolbar-action.element.d.ts +0 -35
  222. package/dist/packages/wje-tooltip/tooltip.d.ts +0 -2
  223. package/dist/packages/wje-tooltip/tooltip.element.d.ts +0 -71
  224. package/dist/packages/wje-visually-hidden/visually-hidden.d.ts +0 -2
  225. package/dist/packages/wje-visually-hidden/visually-hidden.element.d.ts +0 -29
  226. package/dist/popup.element-tyYxow0p.js +0 -1623
  227. package/dist/popup.element-tyYxow0p.js.map +0 -1
  228. package/dist/router-links-CJnOdbas.js +0 -150
  229. package/dist/router-links-CJnOdbas.js.map +0 -1
  230. package/dist/styles.css +0 -849
  231. package/dist/wje-accordion-item.js +0 -113
  232. package/dist/wje-accordion-item.js.map +0 -1
  233. package/dist/wje-accordion.js +0 -122
  234. package/dist/wje-accordion.js.map +0 -1
  235. package/dist/wje-animation.js +0 -4324
  236. package/dist/wje-animation.js.map +0 -1
  237. package/dist/wje-aside.js +0 -55
  238. package/dist/wje-aside.js.map +0 -1
  239. package/dist/wje-avatar.js +0 -90
  240. package/dist/wje-avatar.js.map +0 -1
  241. package/dist/wje-badge.js +0 -71
  242. package/dist/wje-badge.js.map +0 -1
  243. package/dist/wje-breadcrumb.js +0 -195
  244. package/dist/wje-breadcrumb.js.map +0 -1
  245. package/dist/wje-breadcrumbs.js +0 -140
  246. package/dist/wje-breadcrumbs.js.map +0 -1
  247. package/dist/wje-button-group.js +0 -85
  248. package/dist/wje-button-group.js.map +0 -1
  249. package/dist/wje-button.js +0 -352
  250. package/dist/wje-button.js.map +0 -1
  251. package/dist/wje-card-content.js +0 -48
  252. package/dist/wje-card-content.js.map +0 -1
  253. package/dist/wje-card-controls.js +0 -48
  254. package/dist/wje-card-controls.js.map +0 -1
  255. package/dist/wje-card-header.js +0 -48
  256. package/dist/wje-card-header.js.map +0 -1
  257. package/dist/wje-card-subtitle.js +0 -55
  258. package/dist/wje-card-subtitle.js.map +0 -1
  259. package/dist/wje-card-title.js +0 -55
  260. package/dist/wje-card-title.js.map +0 -1
  261. package/dist/wje-card.js +0 -56
  262. package/dist/wje-card.js.map +0 -1
  263. package/dist/wje-carousel-item.js +0 -63
  264. package/dist/wje-carousel-item.js.map +0 -1
  265. package/dist/wje-carousel.js +0 -380
  266. package/dist/wje-carousel.js.map +0 -1
  267. package/dist/wje-checkbox.js +0 -540
  268. package/dist/wje-checkbox.js.map +0 -1
  269. package/dist/wje-chip.js +0 -76
  270. package/dist/wje-chip.js.map +0 -1
  271. package/dist/wje-col.js +0 -38
  272. package/dist/wje-col.js.map +0 -1
  273. package/dist/wje-color-picker.js +0 -1339
  274. package/dist/wje-color-picker.js.map +0 -1
  275. package/dist/wje-container.js +0 -56
  276. package/dist/wje-container.js.map +0 -1
  277. package/dist/wje-copy-button.js +0 -218
  278. package/dist/wje-copy-button.js.map +0 -1
  279. package/dist/wje-dialog.js +0 -249
  280. package/dist/wje-dialog.js.map +0 -1
  281. package/dist/wje-divider.js +0 -55
  282. package/dist/wje-divider.js.map +0 -1
  283. package/dist/wje-dropdown.js +0 -194
  284. package/dist/wje-dropdown.js.map +0 -1
  285. package/dist/wje-element.js +0 -967
  286. package/dist/wje-element.js.map +0 -1
  287. package/dist/wje-fetchAndParseCSS.js +0 -60
  288. package/dist/wje-fetchAndParseCSS.js.map +0 -1
  289. package/dist/wje-file-upload-item.js +0 -142
  290. package/dist/wje-file-upload-item.js.map +0 -1
  291. package/dist/wje-file-upload.js +0 -551
  292. package/dist/wje-file-upload.js.map +0 -1
  293. package/dist/wje-footer.js +0 -52
  294. package/dist/wje-footer.js.map +0 -1
  295. package/dist/wje-form.js +0 -53
  296. package/dist/wje-form.js.map +0 -1
  297. package/dist/wje-format-digital.js +0 -146
  298. package/dist/wje-format-digital.js.map +0 -1
  299. package/dist/wje-grid.js +0 -54
  300. package/dist/wje-grid.js.map +0 -1
  301. package/dist/wje-header.js +0 -56
  302. package/dist/wje-header.js.map +0 -1
  303. package/dist/wje-icon-picker.js +0 -349
  304. package/dist/wje-icon-picker.js.map +0 -1
  305. package/dist/wje-icon.js +0 -191
  306. package/dist/wje-icon.js.map +0 -1
  307. package/dist/wje-img-comparer.js +0 -131
  308. package/dist/wje-img-comparer.js.map +0 -1
  309. package/dist/wje-img.js +0 -72
  310. package/dist/wje-img.js.map +0 -1
  311. package/dist/wje-infinite-scroll.js +0 -6
  312. package/dist/wje-infinite-scroll.js.map +0 -1
  313. package/dist/wje-input-file.js +0 -111
  314. package/dist/wje-input-file.js.map +0 -1
  315. package/dist/wje-input.js +0 -452
  316. package/dist/wje-input.js.map +0 -1
  317. package/dist/wje-item.js +0 -88
  318. package/dist/wje-item.js.map +0 -1
  319. package/dist/wje-kanban.js +0 -462
  320. package/dist/wje-kanban.js.map +0 -1
  321. package/dist/wje-label.js +0 -53
  322. package/dist/wje-label.js.map +0 -1
  323. package/dist/wje-list.js +0 -6
  324. package/dist/wje-list.js.map +0 -1
  325. package/dist/wje-main.js +0 -52
  326. package/dist/wje-main.js.map +0 -1
  327. package/dist/wje-masonry.js +0 -267
  328. package/dist/wje-masonry.js.map +0 -1
  329. package/dist/wje-master.js +0 -373
  330. package/dist/wje-master.js.map +0 -1
  331. package/dist/wje-menu-button.js +0 -60
  332. package/dist/wje-menu-button.js.map +0 -1
  333. package/dist/wje-menu-item.js +0 -545
  334. package/dist/wje-menu-item.js.map +0 -1
  335. package/dist/wje-menu-label.js +0 -55
  336. package/dist/wje-menu-label.js.map +0 -1
  337. package/dist/wje-menu.js +0 -72
  338. package/dist/wje-menu.js.map +0 -1
  339. package/dist/wje-option.js +0 -112
  340. package/dist/wje-option.js.map +0 -1
  341. package/dist/wje-options.js +0 -355
  342. package/dist/wje-options.js.map +0 -1
  343. package/dist/wje-orgchart-group.js +0 -72
  344. package/dist/wje-orgchart-group.js.map +0 -1
  345. package/dist/wje-orgchart-item.js +0 -98
  346. package/dist/wje-orgchart-item.js.map +0 -1
  347. package/dist/wje-orgchart.js +0 -49
  348. package/dist/wje-orgchart.js.map +0 -1
  349. package/dist/wje-popup.js +0 -6
  350. package/dist/wje-popup.js.map +0 -1
  351. package/dist/wje-progress-bar.js +0 -213
  352. package/dist/wje-progress-bar.js.map +0 -1
  353. package/dist/wje-qr-code.js +0 -2892
  354. package/dist/wje-qr-code.js.map +0 -1
  355. package/dist/wje-radio-group.js +0 -228
  356. package/dist/wje-radio-group.js.map +0 -1
  357. package/dist/wje-radio.js +0 -106
  358. package/dist/wje-radio.js.map +0 -1
  359. package/dist/wje-rate.js +0 -300
  360. package/dist/wje-rate.js.map +0 -1
  361. package/dist/wje-relative-time.js +0 -115
  362. package/dist/wje-relative-time.js.map +0 -1
  363. package/dist/wje-reorder-dropzone.js +0 -49
  364. package/dist/wje-reorder-dropzone.js.map +0 -1
  365. package/dist/wje-reorder-handle.js +0 -218
  366. package/dist/wje-reorder-handle.js.map +0 -1
  367. package/dist/wje-reorder-item.js +0 -61
  368. package/dist/wje-reorder-item.js.map +0 -1
  369. package/dist/wje-reorder.js +0 -281
  370. package/dist/wje-reorder.js.map +0 -1
  371. package/dist/wje-route.js +0 -43
  372. package/dist/wje-route.js.map +0 -1
  373. package/dist/wje-router-link.js +0 -64
  374. package/dist/wje-router-link.js.map +0 -1
  375. package/dist/wje-router-outlet.js +0 -192
  376. package/dist/wje-router-outlet.js.map +0 -1
  377. package/dist/wje-routerx.js +0 -1437
  378. package/dist/wje-routerx.js.map +0 -1
  379. package/dist/wje-row.js +0 -49
  380. package/dist/wje-row.js.map +0 -1
  381. package/dist/wje-select.js +0 -630
  382. package/dist/wje-select.js.map +0 -1
  383. package/dist/wje-slider.js +0 -221
  384. package/dist/wje-slider.js.map +0 -1
  385. package/dist/wje-sliding-container.js +0 -478
  386. package/dist/wje-sliding-container.js.map +0 -1
  387. package/dist/wje-split-view.js +0 -153
  388. package/dist/wje-split-view.js.map +0 -1
  389. package/dist/wje-status.js +0 -61
  390. package/dist/wje-status.js.map +0 -1
  391. package/dist/wje-step.js +0 -50
  392. package/dist/wje-step.js.map +0 -1
  393. package/dist/wje-stepper.js +0 -231
  394. package/dist/wje-stepper.js.map +0 -1
  395. package/dist/wje-store.js +0 -401
  396. package/dist/wje-store.js.map +0 -1
  397. package/dist/wje-tab-group.js +0 -137
  398. package/dist/wje-tab-group.js.map +0 -1
  399. package/dist/wje-tab-panel.js +0 -46
  400. package/dist/wje-tab-panel.js.map +0 -1
  401. package/dist/wje-tab.js +0 -59
  402. package/dist/wje-tab.js.map +0 -1
  403. package/dist/wje-textarea.js +0 -373
  404. package/dist/wje-textarea.js.map +0 -1
  405. package/dist/wje-thumbnail.js +0 -54
  406. package/dist/wje-thumbnail.js.map +0 -1
  407. package/dist/wje-toast.js +0 -334
  408. package/dist/wje-toast.js.map +0 -1
  409. package/dist/wje-toggle.js +0 -125
  410. package/dist/wje-toggle.js.map +0 -1
  411. package/dist/wje-toolbar-action.js +0 -72
  412. package/dist/wje-toolbar-action.js.map +0 -1
  413. package/dist/wje-toolbar.js +0 -63
  414. package/dist/wje-toolbar.js.map +0 -1
  415. package/dist/wje-tooltip.js +0 -166
  416. package/dist/wje-tooltip.js.map +0 -1
  417. package/dist/wje-visually-hidden.js +0 -55
  418. package/dist/wje-visually-hidden.js.map +0 -1
@@ -1,1437 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { r as routerLinks } from "./router-links-CJnOdbas.js";
5
- import WJElement from "./wje-element.js";
6
- const assoc = (obj, attr, val) => {
7
- obj[attr] = val;
8
- return obj;
9
- };
10
- const isArray = Array.isArray;
11
- const keys = Object.keys;
12
- const clone = (obj) => obj ? isArray(obj) ? obj.slice(0) : extend({}, obj) : obj;
13
- const pick = (obj, attrs) => attrs.reduce((acc, attr) => obj[attr] === void 0 ? acc : assoc(acc, attr, obj[attr]), {});
14
- const isEqual$1 = (obj1, obj2) => {
15
- const keys1 = keys(obj1);
16
- return keys1.length === keys(obj2).length && keys1.every((key) => obj2[key] === obj1[key]);
17
- };
18
- const extend = Object.assign;
19
- function invariant(condition, format, ...args) {
20
- if (!condition) {
21
- let argIndex = 0;
22
- throw new Error("Invariant Violation: " + format.replace(/%s/g, () => args[argIndex++]));
23
- }
24
- }
25
- function functionDsl(callback) {
26
- let ancestors = [];
27
- const matches = {};
28
- const names = {};
29
- callback(function route(name, options, childrenCallback) {
30
- let routes;
31
- invariant(
32
- !names[name],
33
- 'Route names must be unique, but route "%s" is declared multiple times',
34
- name
35
- );
36
- names[name] = true;
37
- if (arguments.length === 1) {
38
- options = {};
39
- }
40
- if (arguments.length === 2 && typeof options === "function") {
41
- childrenCallback = options;
42
- options = {};
43
- }
44
- if (typeof options.path !== "string") {
45
- const parts = name.split(".");
46
- options.path = parts[parts.length - 1];
47
- }
48
- if (childrenCallback) {
49
- ancestors = ancestors.concat(name);
50
- childrenCallback();
51
- routes = pop();
52
- ancestors.splice(-1);
53
- }
54
- push({
55
- name,
56
- path: options.path,
57
- routes: routes || [],
58
- options
59
- });
60
- });
61
- function pop() {
62
- return matches[currentLevel()] || [];
63
- }
64
- function push(route) {
65
- const level = currentLevel();
66
- matches[level] = matches[level] || [];
67
- matches[level].push(route);
68
- }
69
- function currentLevel() {
70
- return ancestors.join(".");
71
- }
72
- return pop();
73
- }
74
- function arrayDsl(routes) {
75
- const result = [];
76
- routes.forEach(({ name, children, ...options }) => {
77
- if (typeof options.path !== "string") {
78
- const parts = name.split(".");
79
- options.path = parts[parts.length - 1];
80
- }
81
- result.push({
82
- name,
83
- path: options.path,
84
- options,
85
- routes: children ? arrayDsl(children) : []
86
- });
87
- });
88
- return result;
89
- }
90
- const paramInjectMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$?]*[?+*]?)/g;
91
- const specialParamChars = /[+*?]$/g;
92
- const queryMatcher = /\?(.+)/;
93
- const _compiledPatterns = {};
94
- function compilePattern(pattern, compiler) {
95
- if (!(pattern in _compiledPatterns)) {
96
- _compiledPatterns[pattern] = compiler(pattern);
97
- }
98
- return _compiledPatterns[pattern];
99
- }
100
- function extractParamNames(pattern, compiler) {
101
- return compilePattern(pattern, compiler).paramNames;
102
- }
103
- function extractParams(pattern, path, compiler) {
104
- const cp = compilePattern(pattern, compiler);
105
- const matcher = cp.matcher;
106
- const paramNames = cp.paramNames;
107
- const match = path.match(matcher);
108
- if (!match) {
109
- return null;
110
- }
111
- const params = {};
112
- paramNames.forEach(function(paramName, index) {
113
- params[paramName] = match[index + 1] && decodeURIComponent(match[index + 1]);
114
- });
115
- return params;
116
- }
117
- function injectParams(pattern, params) {
118
- params = params || {};
119
- return pattern.replace(paramInjectMatcher, function(match, param) {
120
- const paramName = param.replace(specialParamChars, "");
121
- const lastChar = param.slice(-1);
122
- if (lastChar === "?" || lastChar === "*") {
123
- if (params[paramName] == null) {
124
- return "";
125
- }
126
- } else {
127
- invariant(
128
- params[paramName] != null,
129
- "Missing '%s' parameter for path '%s'",
130
- paramName,
131
- pattern
132
- );
133
- }
134
- let paramValue = encodeURIComponent(params[paramName]);
135
- if (lastChar === "*" || lastChar === "+") {
136
- paramValue = paramValue.replace("%2F", "/");
137
- }
138
- return paramValue;
139
- });
140
- }
141
- function extractQuery(qs2, path) {
142
- const match = path.match(queryMatcher);
143
- return match && qs2.parse(match[1]);
144
- }
145
- function withQuery(qs2, path, query) {
146
- const queryString = qs2.stringify(query, { indices: false });
147
- if (queryString) {
148
- return withoutQuery(path) + "?" + queryString;
149
- }
150
- return path;
151
- }
152
- function withoutQuery(path) {
153
- return path.replace(queryMatcher, "");
154
- }
155
- function bindEvent(el, type, fn) {
156
- el.addEventListener(type, fn);
157
- return fn;
158
- }
159
- function unbindEvent(el, type, fn) {
160
- el.removeEventListener(type, fn);
161
- return fn;
162
- }
163
- class History {
164
- constructor() {
165
- this.handlers = [];
166
- this.checkUrl = this.checkUrl.bind(this);
167
- this.location = window.location;
168
- this.history = window.history;
169
- }
170
- // Set up all inheritable **Backbone.History** properties and methods.
171
- // Are we at the app root?
172
- atRoot() {
173
- return this.location.pathname.replace(/[^\/]$/, "$&/") === this.root;
174
- }
175
- // Gets the true hash value. Cannot use location.hash directly due to bug
176
- // in Firefox where location.hash will always be decoded.
177
- getHash() {
178
- const match = this.location.href.match(/#(.*)$/);
179
- return match ? match[1] : "";
180
- }
181
- // Get the cross-browser normalized URL fragment, either from the URL,
182
- // the hash, or the override.
183
- getFragment(fragment, forcePushState) {
184
- if (fragment == null) {
185
- if (this._hasPushState || !this._wantsHashChange || forcePushState) {
186
- fragment = decodeURI(this.location.pathname + this.location.search);
187
- const root = this.root.replace(trailingSlash, "");
188
- if (!fragment.indexOf(root)) fragment = fragment.slice(root.length);
189
- } else {
190
- fragment = this.getHash();
191
- }
192
- }
193
- return fragment.replace(routeStripper, "");
194
- }
195
- // Start the hash change handling, returning `true` if the current URL matches
196
- // an existing route, and `false` otherwise.
197
- start(options = {}) {
198
- this.started = true;
199
- this.options = extend({ root: "/" }, options);
200
- this.location = this.options.location || this.location;
201
- this.history = this.options.history || this.history;
202
- this.root = this.options.root;
203
- this._wantsHashChange = this.options.hashChange !== false;
204
- this._wantsPushState = !!this.options.pushState;
205
- this._hasPushState = this._wantsPushState;
206
- const fragment = this.getFragment();
207
- this.root = `/${this.root}/`.replace(rootStripper, "/");
208
- bindEvent(window, this._hasPushState ? "popstate" : "hashchange", this.checkUrl);
209
- this.fragment = fragment;
210
- const loc = this.location;
211
- if (this._wantsHashChange && this._wantsPushState) {
212
- if (!this._hasPushState && !this.atRoot()) {
213
- this.fragment = this.getFragment(null, true);
214
- this.location.replace(`${this.root}#${this.fragment}`);
215
- return true;
216
- } else if (this._hasPushState && this.atRoot() && loc.hash) {
217
- this.fragment = this.getHash().replace(routeStripper, "");
218
- this.history.replaceState({}, document.title, this.root + this.fragment);
219
- }
220
- }
221
- if (!this.options.silent) return this.loadUrl();
222
- }
223
- // Disable Backbone.history, perhaps temporarily. Not useful in a real app,
224
- // but possibly useful for unit testing Routers.
225
- stop() {
226
- unbindEvent(window, this._hasPushState ? "popstate" : "hashchange", this.checkUrl);
227
- this.started = false;
228
- }
229
- // Add a route to be tested when the fragment changes. Routes added later
230
- // may override previous routes.
231
- route(route, callback) {
232
- this.handlers.unshift({ route, callback });
233
- }
234
- // Checks the current URL to see if it has changed, and if it has,
235
- // calls `loadUrl`.
236
- checkUrl() {
237
- const current = this.getFragment();
238
- if (current === this.fragment) return false;
239
- this.loadUrl();
240
- }
241
- // Attempt to load the current URL fragment. If a route succeeds with a
242
- // match, returns `true`. If no defined routes matches the fragment,
243
- // returns `false`.
244
- loadUrl(fragment) {
245
- fragment = this.fragment = this.getFragment(fragment);
246
- return this.handlers.some((handler) => {
247
- if (handler.route.test(fragment)) {
248
- handler.callback(fragment);
249
- return true;
250
- }
251
- });
252
- }
253
- // Save a fragment into the hash history, or replace the URL state if the
254
- // 'replace' option is passed. You are responsible for properly URL-encoding
255
- // the fragment in advance.
256
- //
257
- // The options object can contain `trigger: true` if you wish to have the
258
- // route callback be fired (not usually desirable), or `replace: true`, if
259
- // you wish to modify the current URL without adding an entry to the history.
260
- update(fragment, options) {
261
- if (!this.started) return false;
262
- if (!options || options === true) options = { trigger: !!options };
263
- let url = this.root + (fragment = this.getFragment(fragment || ""));
264
- fragment = fragment.replace(pathStripper, "");
265
- if (this.fragment === fragment) return;
266
- this.fragment = fragment;
267
- if (fragment === "" && url !== "/") url = url.slice(0, -1);
268
- if (this._hasPushState) {
269
- this.history[options.replace ? "replaceState" : "pushState"]({}, document.title, url);
270
- } else if (this._wantsHashChange) {
271
- this._updateHash(this.location, fragment, options.replace);
272
- } else {
273
- return this.location.assign(url);
274
- }
275
- if (options.trigger) return this.loadUrl(fragment);
276
- }
277
- // Update the hash location, either replacing the current entry, or adding
278
- // a new one to the browser history.
279
- _updateHash(location, fragment, replace) {
280
- if (replace) {
281
- const href = location.href.replace(/(javascript:|#).*$/, "");
282
- location.replace(`${href}#${fragment}`);
283
- } else {
284
- location.hash = `#${fragment}`;
285
- }
286
- }
287
- // add some features to History
288
- // a generic callback for any changes
289
- onChange(callback) {
290
- this.route(/^(.*?)$/, callback);
291
- }
292
- // checks if the browser has pushstate support
293
- hasPushState() {
294
- if (!this.started) {
295
- throw new Error("only available after LocationBar.start()");
296
- }
297
- return this._hasPushState;
298
- }
299
- }
300
- const routeStripper = /^[#\/]|\s+$/g;
301
- const rootStripper = /^\/+|\/+$/g;
302
- const trailingSlash = /\/$/;
303
- const pathStripper = /#.*$/;
304
- class BrowserLocation {
305
- constructor(options = {}) {
306
- this.path = options.path || "";
307
- this.options = extend(
308
- {
309
- pushState: false,
310
- root: "/"
311
- },
312
- options
313
- );
314
- this.locationBar = new History();
315
- this.locationBar.onChange((path) => {
316
- this.handleURL(`/${path || ""}`);
317
- });
318
- this.locationBar.start(options);
319
- }
320
- /**
321
- * Get the current URL
322
- */
323
- getURL() {
324
- return this.path;
325
- }
326
- /**
327
- * Set the current URL without triggering any events
328
- * back to the router. Add a new entry in browser's history.
329
- */
330
- setURL(path, options = {}) {
331
- if (this.path !== path) {
332
- this.path = path;
333
- this.locationBar.update(path, extend({ trigger: true }, options));
334
- }
335
- }
336
- /**
337
- * Set the current URL without triggering any events
338
- * back to the router. Replace the latest entry in broser's history.
339
- */
340
- replaceURL(path, options = {}) {
341
- if (this.path !== path) {
342
- this.path = path;
343
- this.locationBar.update(path, extend({ trigger: true, replace: true }, options));
344
- }
345
- }
346
- /**
347
- * Setup a URL change handler
348
- * @param {Function} callback
349
- */
350
- onChange(callback) {
351
- this.changeCallback = callback;
352
- }
353
- /**
354
- * Given a path, generate a URL appending root
355
- * if pushState is used and # if hash state is used
356
- */
357
- formatURL(path) {
358
- if (this.locationBar.hasPushState()) {
359
- let rootURL = this.options.root;
360
- if (path !== "") {
361
- rootURL = rootURL.replace(/\/$/, "");
362
- }
363
- return rootURL + path;
364
- } else {
365
- if (path[0] === "/") {
366
- path = path.substr(1);
367
- }
368
- return `#${path}`;
369
- }
370
- }
371
- /**
372
- * When we use pushState with a custom root option,
373
- * we need to take care of removingRoot at certain points.
374
- * Specifically
375
- * - browserLocation.update() can be called with the full URL by router
376
- * - LocationBar expects all .update() calls to be called without root
377
- * - this method is public so that we could dispatch URLs without root in router
378
- */
379
- removeRoot(url) {
380
- if (this.options.pushState && this.options.root && this.options.root !== "/") {
381
- return url.replace(this.options.root, "");
382
- } else {
383
- return url;
384
- }
385
- }
386
- /**
387
- * Stop listening to URL changes and link clicks
388
- */
389
- destroy() {
390
- this.locationBar.stop();
391
- }
392
- /**
393
- initially, the changeCallback won't be defined yet, but that's good
394
- because we dont' want to kick off routing right away, the router
395
- does that later by manually calling this handleURL method with the
396
- url it reads of the location. But it's important this is called
397
- first by Backbone, because we wanna set a correct this.path value
398
-
399
- @private
400
- */
401
- handleURL(url) {
402
- this.path = url;
403
- if (this.changeCallback) {
404
- this.changeCallback(url);
405
- }
406
- }
407
- }
408
- class MemoryLocation {
409
- constructor({ path }) {
410
- this.path = path || "";
411
- }
412
- getURL() {
413
- return this.path;
414
- }
415
- setURL(path, options) {
416
- if (this.path !== path) {
417
- this.path = path;
418
- this.handleURL(this.getURL(), options);
419
- }
420
- }
421
- replaceURL(path, options) {
422
- if (this.path !== path) {
423
- this.setURL(path, options);
424
- }
425
- }
426
- onChange(callback) {
427
- this.changeCallback = callback;
428
- }
429
- handleURL(url, options = {}) {
430
- this.path = url;
431
- options = extend({ trigger: true }, options);
432
- if (this.changeCallback && options.trigger) {
433
- this.changeCallback(url);
434
- }
435
- }
436
- removeRoot(url) {
437
- return url;
438
- }
439
- formatURL(url) {
440
- return url;
441
- }
442
- }
443
- const TRANSITION_REDIRECTED = "TransitionRedirected";
444
- const TRANSITION_CANCELLED = "TransitionCancelled";
445
- function runError(router2, transition2, err) {
446
- router2.middleware.forEach((m) => {
447
- m.error && m.error(transition2, err);
448
- });
449
- }
450
- function transition(options) {
451
- options = options || {};
452
- const router2 = options.router;
453
- const log = router2.log;
454
- const logError = router2.logError;
455
- const path = options.path;
456
- const match = options.match;
457
- const routes = match.routes;
458
- const params = match.params;
459
- const pathname = match.pathname;
460
- const query = match.query;
461
- const id = options.id;
462
- const startTime = Date.now();
463
- log("---");
464
- log("Transition #" + id, "to", path);
465
- log(
466
- "Transition #" + id,
467
- "routes:",
468
- routes.map((r) => r.name)
469
- );
470
- log("Transition #" + id, "params:", params);
471
- log("Transition #" + id, "query:", query);
472
- let resolve2, reject;
473
- const promise = new Promise(function(res, rej) {
474
- resolve2 = res;
475
- reject = rej;
476
- });
477
- promise.then(function() {
478
- log("Transition #" + id, "completed in", Date.now() - startTime + "ms");
479
- }).catch(function(err) {
480
- if (err.type !== TRANSITION_REDIRECTED && err.type !== TRANSITION_CANCELLED) {
481
- log("Transition #" + id, "FAILED");
482
- logError(err);
483
- }
484
- });
485
- let cancelled = false;
486
- const transition2 = {
487
- id,
488
- prev: {
489
- routes: clone(router2.state.routes) || [],
490
- path: router2.state.path || "",
491
- pathname: router2.state.pathname || "",
492
- params: clone(router2.state.params) || {},
493
- query: clone(router2.state.query) || {}
494
- },
495
- routes: clone(routes),
496
- path,
497
- pathname,
498
- params: clone(params),
499
- query: clone(query),
500
- redirectTo: function(...args) {
501
- return router2.transitionTo(...args);
502
- },
503
- retry: function() {
504
- return router2.transitionTo(path);
505
- },
506
- cancel: function(err) {
507
- if (router2.state.activeTransition !== transition2) {
508
- return;
509
- }
510
- if (transition2.isCancelled) {
511
- return;
512
- }
513
- router2.state.activeTransition = null;
514
- transition2.isCancelled = true;
515
- cancelled = true;
516
- if (!err) {
517
- err = new Error(TRANSITION_CANCELLED);
518
- err.type = TRANSITION_CANCELLED;
519
- }
520
- if (err.type === TRANSITION_CANCELLED) {
521
- log("Transition #" + id, "cancelled");
522
- }
523
- if (err.type === TRANSITION_REDIRECTED) {
524
- log("Transition #" + id, "redirected");
525
- }
526
- router2.middleware.forEach((m) => {
527
- m.cancel && m.cancel(transition2, err);
528
- });
529
- reject(err);
530
- },
531
- followRedirects: function() {
532
- return promise.catch(function(reason) {
533
- if (router2.state.activeTransition) {
534
- return router2.state.activeTransition.followRedirects();
535
- }
536
- return Promise.reject(reason);
537
- });
538
- },
539
- then: promise.then.bind(promise),
540
- catch: promise.catch.bind(promise)
541
- };
542
- router2.middleware.forEach((m) => {
543
- m.before && m.before(transition2);
544
- });
545
- function callNext(i, prevResult) {
546
- let middleware;
547
- let middlewareName;
548
- if (cancelled) {
549
- return;
550
- }
551
- if (i < router2.middleware.length) {
552
- middleware = router2.middleware[i];
553
- middlewareName = middleware.name || "anonymous";
554
- log("Transition #" + id, "resolving middleware:", middlewareName);
555
- let middlewarePromise;
556
- try {
557
- middlewarePromise = middleware.resolve ? middleware.resolve(transition2, prevResult) : prevResult;
558
- invariant(
559
- transition2 !== middlewarePromise,
560
- "Middleware %s returned a transition which resulted in a deadlock",
561
- middlewareName
562
- );
563
- } catch (err) {
564
- router2.state.activeTransition = null;
565
- runError(router2, transition2, err);
566
- return reject(err);
567
- }
568
- Promise.resolve(middlewarePromise).then(function(result) {
569
- callNext(i + 1, result);
570
- }).catch(function(err) {
571
- log("Transition #" + id, "resolving middleware:", middlewareName, "FAILED");
572
- router2.state.activeTransition = null;
573
- runError(router2, transition2, err);
574
- reject(err);
575
- });
576
- } else {
577
- router2.state = {
578
- activeTransition: null,
579
- routes,
580
- path,
581
- pathname,
582
- params,
583
- query
584
- };
585
- router2.middleware.forEach((m) => {
586
- m.done && m.done(transition2);
587
- });
588
- resolve2();
589
- }
590
- }
591
- if (!options.noop) {
592
- Promise.resolve().then(() => callNext(0));
593
- } else {
594
- resolve2();
595
- }
596
- if (options.noop) {
597
- transition2.noop = true;
598
- }
599
- return transition2;
600
- }
601
- function intercept(el, fn) {
602
- const cb = delegate(el, "click", function(e, el2) {
603
- if (clickable(e, el2)) fn(e, el2);
604
- });
605
- return function dispose() {
606
- unbindEvent(el, "click", cb);
607
- };
608
- }
609
- function delegate(el, type, fn) {
610
- return bindEvent(el, type, function(e) {
611
- const el2 = e.target.closest("a");
612
- if (el2) {
613
- fn(e, el2);
614
- }
615
- });
616
- }
617
- function clickable(e, el) {
618
- if (which(e) !== 1) return;
619
- if (e.metaKey || e.ctrlKey || e.shiftKey) return;
620
- if (e.defaultPrevented) return;
621
- if (el.target) return;
622
- if (el.getAttribute("data-bypass") !== null) return;
623
- const href = el.getAttribute("href");
624
- if (!href || href.length === 0) return;
625
- if (/^(#|https{0,1}:\/\/|mailto|javascript:)/i.test(href)) return;
626
- return true;
627
- }
628
- function which(e) {
629
- e = e || window.event;
630
- return e.which === null ? e.button : e.which;
631
- }
632
- function defineLogger(router2, method, fn) {
633
- if (fn === true) return;
634
- router2[method] = typeof fn === "function" ? fn : () => {
635
- };
636
- }
637
- const qs = {
638
- parse(querystring) {
639
- return querystring.split("&").reduce((acc, pair) => {
640
- const parts = pair.split("=");
641
- acc[parts[0]] = decodeURIComponent(parts[1]);
642
- return acc;
643
- }, {});
644
- },
645
- stringify(params) {
646
- return Object.keys(params).reduce((acc, key) => {
647
- if (params[key] !== void 0) {
648
- acc.push(key + "=" + encodeURIComponent(params[key]));
649
- }
650
- return acc;
651
- }, []).join("&");
652
- }
653
- };
654
- function parse(input, loose) {
655
- if (input instanceof RegExp) return { keys: false, pattern: input };
656
- var c, o, tmp, ext, keys2 = [], pattern = "", arr = input.split("/");
657
- arr[0] || arr.shift();
658
- while (tmp = arr.shift()) {
659
- c = tmp[0];
660
- if (c === "*") {
661
- keys2.push(c);
662
- pattern += tmp[1] === "?" ? "(?:/(.*))?" : "/(.*)";
663
- } else if (c === ":") {
664
- o = tmp.indexOf("?", 1);
665
- ext = tmp.indexOf(".", 1);
666
- keys2.push(tmp.substring(1, !!~o ? o : !!~ext ? ext : tmp.length));
667
- pattern += !!~o && !~ext ? "(?:/([^/]+?))?" : "/([^/]+?)";
668
- if (!!~ext) pattern += (!!~o ? "?" : "") + "\\" + tmp.substring(ext);
669
- } else {
670
- pattern += "/" + tmp;
671
- }
672
- }
673
- return {
674
- keys: keys2,
675
- pattern: new RegExp("^" + pattern + "/?$", "i")
676
- };
677
- }
678
- const splatRegex = /:(\w+)\*/;
679
- function patternCompiler(pattern) {
680
- const splatMatch = splatRegex.exec(pattern);
681
- const normalizedPattern = splatMatch ? pattern.replace(splatRegex, "*") : pattern;
682
- const { pattern: matcher, keys: keys2 } = parse(normalizedPattern);
683
- const paramNames = splatMatch ? keys2.map((key) => key === "*" ? splatMatch[1] : key) : keys2;
684
- return {
685
- matcher,
686
- paramNames
687
- };
688
- }
689
- let Router$1 = class Router {
690
- /**
691
- * @param {RouterOptions} [options]
692
- */
693
- constructor(options = {}) {
694
- this.nextId = 1;
695
- this.state = {};
696
- this.middleware = [];
697
- this.options = extend(
698
- {
699
- location: "browser",
700
- logError: true,
701
- qs,
702
- patternCompiler
703
- },
704
- options
705
- );
706
- defineLogger(this, "log", this.options.log);
707
- defineLogger(this, "logError", this.options.logError);
708
- if (options.routes) {
709
- this.map(options.routes);
710
- }
711
- }
712
- /**
713
- * Add a middleware
714
- * @param {Function} middleware
715
- * @return {Router}
716
- * @api public
717
- */
718
- use(middleware, options = {}) {
719
- const m = typeof middleware === "function" ? { resolve: middleware } : middleware;
720
- typeof options.at === "number" ? this.middleware.splice(options.at, 0, m) : this.middleware.push(m);
721
- m.create && m.create(this);
722
- return this;
723
- }
724
- /**
725
- * Add the route map
726
- * @param {routeCallback | RouteDef[]} routes
727
- * @return {Router}
728
- * @api public
729
- */
730
- map(routes) {
731
- this.routes = Array.isArray(routes) ? arrayDsl(routes) : functionDsl(routes);
732
- const matchers = this.matchers = [];
733
- const dupes = {};
734
- const abstracts = {};
735
- eachBranch({ routes: this.routes }, [], (routes2) => {
736
- let path = routes2.reduce(
737
- (memo, r) => (
738
- // and keep resetting the trailing slash
739
- (r.path[0] === "/" ? r.path : `${memo}/${r.path}`).replace(/\/$/, "")
740
- ),
741
- ""
742
- );
743
- if (path === "") {
744
- path = "/";
745
- }
746
- const lastRoute = routes2[routes2.length - 1];
747
- if (lastRoute.options.abstract) {
748
- abstracts[path] = lastRoute.name;
749
- return;
750
- }
751
- if (lastRoute.path === "") {
752
- let matcher;
753
- matchers.some((m) => {
754
- if (m.path === path) {
755
- matcher = m;
756
- return true;
757
- }
758
- });
759
- if (matcher) {
760
- matcher.routes = routes2;
761
- } else if (abstracts[path]) {
762
- matchers.push({
763
- routes: routes2,
764
- name: abstracts[path],
765
- path
766
- });
767
- }
768
- }
769
- matchers.push({
770
- routes: routes2,
771
- name: lastRoute.name,
772
- path
773
- });
774
- if (dupes[path] && lastRoute.path !== "") {
775
- throw new Error(
776
- `Routes ${dupes[path]} and ${lastRoute.name} have the same url path '${path}'`
777
- );
778
- }
779
- dupes[path] = lastRoute.name;
780
- });
781
- function eachBranch(node, memo, fn) {
782
- node.routes.forEach((route) => {
783
- fn(memo.concat(route));
784
- if (route.routes.length) {
785
- eachBranch(route, memo.concat(route), fn);
786
- }
787
- });
788
- }
789
- return this;
790
- }
791
- /**
792
- * Starts listening to the location changes.
793
- * @param {String} [path]
794
- * @return {Transition} initial transition
795
- *
796
- * @api public
797
- */
798
- listen(path) {
799
- const location = this.location = this.createLocation(path || "");
800
- location.onChange((url) => {
801
- const previousUrl = this.state.path;
802
- this.dispatch(url).catch((err) => {
803
- if (err && err.type === TRANSITION_CANCELLED) {
804
- this.location.replaceURL(previousUrl, { trigger: false });
805
- }
806
- return err;
807
- });
808
- });
809
- return this.dispatch(location.getURL());
810
- }
811
- /**
812
- * Transition to a different route. Passe in url or a route name followed by params and query
813
- * @param {String} name url or route name
814
- * @param {Object} [params] Optional
815
- * @param {Object} [query] Optional
816
- * @return {Transition} transition
817
- *
818
- * @api public
819
- */
820
- transitionTo(name, params, query) {
821
- if (this.state.activeTransition) {
822
- return this.replaceWith(name, params, query);
823
- }
824
- return this.doTransition("setURL", name, params, query);
825
- }
826
- /**
827
- * Like transitionTo, but doesn't leave an entry in the browser's history,
828
- * so clicking back will skip this route
829
- * @param {String} name url or route name followed by params and query
830
- * @param {Record<string, any>} [params]
831
- * @param {Record<string, any>} [query]
832
- * @return {Transition} transition
833
- *
834
- * @api public
835
- */
836
- replaceWith(name, params, query) {
837
- return this.doTransition("replaceURL", name, params, query);
838
- }
839
- /**
840
- * Create an href
841
- * @param {String} name target route name
842
- * @param {Object} [params]
843
- * @param {Object} [query]
844
- * @return {String} href
845
- *
846
- * @api public
847
- */
848
- generate(name, params, query) {
849
- invariant(this.location, "call .listen() before using .generate()");
850
- let matcher;
851
- query = query || {};
852
- this.matchers.forEach((m) => {
853
- if (m.name === name) {
854
- matcher = m;
855
- }
856
- });
857
- if (!matcher) {
858
- throw new Error(`No route is named ${name}`);
859
- }
860
- const url = withQuery(this.options.qs, injectParams(matcher.path, params), query);
861
- return this.location.formatURL(url);
862
- }
863
- /**
864
- * Stop listening to URL changes
865
- * @api public
866
- */
867
- destroy() {
868
- if (this.location && this.location.destroy) {
869
- this.location.destroy();
870
- }
871
- if (this.state.activeTransition) {
872
- this.state.activeTransition.cancel();
873
- }
874
- this.state = {};
875
- this.middleware.forEach((m) => {
876
- m.destroy && m.destroy(this);
877
- });
878
- }
879
- /**
880
- * Check if the given route/params/query combo is active
881
- * @param {String} name target route name
882
- * @param {Record<string, any>} [params]
883
- * @param {Record<string, any>} [query]
884
- * @param {Boolean} [exact]
885
- * @return {Boolean}
886
- *
887
- * @api public
888
- */
889
- isActive(name, params, query, exact) {
890
- const activeRoutes = this.state.routes || [];
891
- const activeParams = this.state.params;
892
- const activeQuery = this.state.query;
893
- let isActive = activeRoutes.some((route) => route.name === name) && (!exact || activeRoutes[activeRoutes.length - 1].name === name);
894
- isActive = isActive && (!params || keys(params).every((key) => activeParams[key] === params[key]));
895
- isActive = isActive && (!query || keys(query).every((key) => activeQuery[key] === query[key]));
896
- return isActive;
897
- }
898
- /**
899
- * @api private
900
- * @param {String} method pushState or replaceState
901
- * @param {String} name target route name
902
- * @param {Object} [params]
903
- * @param {Object} [query]
904
- * @return {Transition} transition
905
- */
906
- doTransition(method, name, params, query) {
907
- const previousUrl = this.location.getURL();
908
- let url = name;
909
- if (url[0] !== "/") {
910
- url = this.generate(name, params, query);
911
- url = url.replace(/^#/, "/");
912
- }
913
- if (this.options.pushState) {
914
- url = this.location.removeRoot(url);
915
- }
916
- const transition2 = this.dispatch(url);
917
- transition2.catch((err) => {
918
- if (err && err.type === TRANSITION_CANCELLED) {
919
- this.location.replaceURL(previousUrl, { trigger: false });
920
- }
921
- return err;
922
- });
923
- this.location[method](url, { trigger: false });
924
- return transition2;
925
- }
926
- /**
927
- * Match the path against the routes
928
- * @param {String} path
929
- * @return {Object} the list of matching routes and params
930
- *
931
- * @api private
932
- */
933
- match(path) {
934
- path = (path || "").replace(/\/$/, "") || "/";
935
- let params;
936
- let routes = [];
937
- const pathWithoutQuery = withoutQuery(path);
938
- const { qs: qs2, patternCompiler: patternCompiler2 } = this.options;
939
- this.matchers.some((matcher) => {
940
- params = extractParams(matcher.path, pathWithoutQuery, patternCompiler2);
941
- if (params) {
942
- routes = matcher.routes;
943
- return true;
944
- }
945
- });
946
- return {
947
- routes: routes.map(descriptor),
948
- params: params || {},
949
- pathname: pathWithoutQuery,
950
- query: extractQuery(qs2, path) || {}
951
- };
952
- function descriptor(route) {
953
- return {
954
- name: route.name,
955
- path: route.path,
956
- params: pick(params, extractParamNames(route.path, patternCompiler2)),
957
- options: clone(route.options)
958
- };
959
- }
960
- }
961
- /**
962
- *
963
- * @param {string} path
964
- * @returns {Transition}
965
- */
966
- dispatch(path) {
967
- const match = this.match(path);
968
- const query = match.query;
969
- const pathname = match.pathname;
970
- const activeTransition = this.state.activeTransition;
971
- if (activeTransition && activeTransition.pathname === pathname && isEqual$1(activeTransition.query, query)) {
972
- return activeTransition;
973
- }
974
- if (activeTransition) {
975
- const err = new Error(TRANSITION_REDIRECTED);
976
- err.type = TRANSITION_REDIRECTED;
977
- err.nextPath = path;
978
- activeTransition.cancel(err);
979
- }
980
- if (!activeTransition) {
981
- if (this.state.pathname === pathname && isEqual$1(this.state.query, query)) {
982
- return transition({
983
- id: this.nextId++,
984
- path,
985
- match,
986
- noop: true,
987
- router: this
988
- });
989
- }
990
- }
991
- const t = transition({
992
- id: this.nextId++,
993
- path,
994
- match,
995
- router: this
996
- });
997
- this.state.activeTransition = t;
998
- return t;
999
- }
1000
- /**
1001
- * Create the default location.
1002
- * This is used when no custom location is passed to
1003
- * the listen call.
1004
- * @param {LocationParam} path
1005
- * @return {Object} location
1006
- *
1007
- * @api private
1008
- */
1009
- createLocation(path) {
1010
- const location = this.options.location;
1011
- if (typeof location !== "string") {
1012
- return location;
1013
- }
1014
- if (location === "browser") {
1015
- return new BrowserLocation(pick(this.options, ["pushState", "root"]));
1016
- } else if (location === "memory") {
1017
- return new MemoryLocation({ path });
1018
- } else {
1019
- throw new Error("Location can be `browser`, `memory` or a custom implementation");
1020
- }
1021
- }
1022
- log(...args) {
1023
- console.info(...args);
1024
- }
1025
- logError(...args) {
1026
- console.error(...args);
1027
- }
1028
- };
1029
- function defaultClickHandler(event, link, router2) {
1030
- event.preventDefault();
1031
- router2.transitionTo(router2.location.removeRoot(link.getAttribute("href")));
1032
- }
1033
- function interceptLinks(router2, el = document, clickHandler = defaultClickHandler) {
1034
- return intercept(el, (event, link) => clickHandler(event, link, router2));
1035
- }
1036
- const resolved = Promise.resolve();
1037
- let routeElMap = /* @__PURE__ */ Object.create(null);
1038
- let routeComponentMap = /* @__PURE__ */ Object.create(null);
1039
- let routePropertiesMap = /* @__PURE__ */ Object.create(null);
1040
- let router, rootOutlet, rootOutletEl;
1041
- function parseNumber(value) {
1042
- const n = parseFloat(value);
1043
- const isNumeric = value == n;
1044
- return isNumeric ? n : value;
1045
- }
1046
- function getFormattedValue(value, format) {
1047
- let v = value;
1048
- if (v !== void 0) {
1049
- if (format === "number") {
1050
- v = parseNumber(value);
1051
- } else if (typeof format === "function") {
1052
- v = format(value);
1053
- }
1054
- }
1055
- return v;
1056
- }
1057
- function fromValue(value) {
1058
- return {
1059
- init(setValue) {
1060
- setValue(value);
1061
- }
1062
- };
1063
- }
1064
- function create(instance) {
1065
- router = instance;
1066
- rootOutlet = instance.options.outlet;
1067
- }
1068
- function destroy() {
1069
- router = null;
1070
- routeElMap = /* @__PURE__ */ Object.create(null);
1071
- routeComponentMap = /* @__PURE__ */ Object.create(null);
1072
- routePropertiesMap = /* @__PURE__ */ Object.create(null);
1073
- rootOutletEl = null;
1074
- }
1075
- function isEqual(obj1, obj2) {
1076
- const keys1 = Object.keys(obj1);
1077
- return keys1.length === Object.keys(obj2).length && keys1.every((key) => obj2[key] === obj1[key]);
1078
- }
1079
- function getOutlet(el) {
1080
- const renderRoot = el.shadowRoot || el;
1081
- return renderRoot.querySelector(el.constructor.outlet || "router-outlet");
1082
- }
1083
- function resolveRootOutlet() {
1084
- if (rootOutletEl) return rootOutletEl;
1085
- if (!rootOutlet) return document.body;
1086
- rootOutletEl = typeof rootOutlet === "string" ? document.querySelector(rootOutlet) : rootOutlet;
1087
- if (!rootOutletEl) {
1088
- throw new Error(`slick-router(wc): Invalid outlet option ${rootOutlet}`);
1089
- }
1090
- return rootOutletEl;
1091
- }
1092
- function getParentEl(transition2, parentIndex) {
1093
- let parent = transition2.routes[parentIndex];
1094
- while (parent) {
1095
- if (parent.options.component) {
1096
- return routeElMap[parent.name];
1097
- }
1098
- parent = transition2.routes[--parentIndex];
1099
- }
1100
- }
1101
- function getChangingIndex(prevRoutes, currentRoutes) {
1102
- let index, prev, current;
1103
- const count = Math.max(prevRoutes.length, currentRoutes.length);
1104
- for (index = 0; index < count; index++) {
1105
- prev = prevRoutes[index];
1106
- current = currentRoutes[index];
1107
- if (!(prev && current) || prev.name !== current.name || !isEqual(prev.params, current.params)) {
1108
- break;
1109
- }
1110
- }
1111
- return index;
1112
- }
1113
- function runPropertyHookMethod(transition2, routes, method) {
1114
- for (let i = 0; i < routes.length; i++) {
1115
- const { route } = routes[i];
1116
- const propertiesData = routePropertiesMap[route.name];
1117
- for (const { hooks, set } of Object.values(propertiesData)) {
1118
- hooks.forEach((hook) => {
1119
- if (typeof hook[method] === "function") {
1120
- hook[method](transition2, set);
1121
- }
1122
- });
1123
- }
1124
- }
1125
- }
1126
- async function runLifeCycle(transition2, routes, prefix, suffix) {
1127
- for (let i = 0; i < routes.length; i++) {
1128
- let result;
1129
- const { route, el } = routes[i];
1130
- const routeMethod = route.options[`${prefix}${suffix}`];
1131
- if (typeof routeMethod === "function") {
1132
- result = await routeMethod(transition2);
1133
- if (result === false) {
1134
- transition2.cancel();
1135
- }
1136
- }
1137
- if (transition2.isCancelled) break;
1138
- const elMethod = el && el[`${prefix}Route${suffix}`];
1139
- if (typeof elMethod === "function") {
1140
- result = await elMethod.call(el, transition2);
1141
- if (result === false) {
1142
- transition2.cancel();
1143
- }
1144
- }
1145
- if (transition2.isCancelled) break;
1146
- }
1147
- }
1148
- function resolveModule(value) {
1149
- return value && value.__esModule ? value.default : value;
1150
- }
1151
- function initPropertyHook(value) {
1152
- if (value && typeof value === "object") return value;
1153
- return fromValue(value);
1154
- }
1155
- function initProperties(route) {
1156
- let propertiesData = routePropertiesMap[route.name];
1157
- if (!propertiesData) {
1158
- propertiesData = routePropertiesMap[route.name] = /* @__PURE__ */ Object.create(null);
1159
- const properties = route.options.properties;
1160
- if (properties) {
1161
- for (const [name, hookOrValue] of Object.entries(properties)) {
1162
- const hooks = Array.isArray(hookOrValue) ? hookOrValue.map(initPropertyHook) : [initPropertyHook(hookOrValue)];
1163
- const set = (v, format) => {
1164
- const propertyData = propertiesData[name];
1165
- const newValue = getFormattedValue(v, format);
1166
- if (propertyData.value === newValue) return;
1167
- propertyData.value = newValue;
1168
- const el = routeElMap[route.name];
1169
- if (el) {
1170
- el[name] = newValue;
1171
- }
1172
- hooks.forEach((hook) => {
1173
- if (typeof hook.update === "function") {
1174
- hook.update(newValue, el);
1175
- }
1176
- });
1177
- };
1178
- propertiesData[name] = { hooks, set };
1179
- hooks.forEach((hook) => {
1180
- if (typeof hook.init === "function") {
1181
- hook.init(set);
1182
- }
1183
- });
1184
- }
1185
- }
1186
- }
1187
- }
1188
- async function resolveRoutes(routes) {
1189
- const result = [];
1190
- for (const route of routes) {
1191
- let el = route.options.reuse ? routeElMap[route.name] : void 0;
1192
- let Component = route.options.component;
1193
- if (!el && Component) {
1194
- if (typeof Component === "function" && !(Component.prototype instanceof HTMLElement)) {
1195
- Component = routeComponentMap[route.name] || (routeComponentMap[route.name] = resolveModule(await Component(route)));
1196
- }
1197
- el = typeof Component === "string" ? document.createElement(Component) : new Component();
1198
- routeElMap[route.name] = el;
1199
- el.$router = router;
1200
- }
1201
- initProperties(route);
1202
- result.push({ el, route });
1203
- }
1204
- return result;
1205
- }
1206
- function applyProperties(el, route) {
1207
- const propertiesData = routePropertiesMap[route.name];
1208
- Object.entries(propertiesData).forEach(([name, { value }]) => {
1209
- el[name] = value;
1210
- });
1211
- }
1212
- const removedEls = /* @__PURE__ */ new WeakSet();
1213
- const outletCurrentEl = /* @__PURE__ */ new WeakMap();
1214
- async function renderElements(transition2, activated, changingIndex) {
1215
- const { path, pathname, routes, params, query } = transition2;
1216
- const routeState = { path, pathname, routes, params, query };
1217
- for (let k = 0; k < changingIndex; k++) {
1218
- const route = transition2.routes[k];
1219
- const el = routeElMap[route.name];
1220
- if (el) {
1221
- el.$route = routeState;
1222
- applyProperties(el, route);
1223
- }
1224
- }
1225
- for (let i = 0; i < activated.length; i++) {
1226
- const { el, route } = activated[i];
1227
- if (el) {
1228
- const parentEl = getParentEl(transition2, changingIndex + i - 1);
1229
- const outletEl = parentEl ? getOutlet(parentEl) : resolveRootOutlet();
1230
- if (outletEl) {
1231
- const currentEl = outletCurrentEl.get(outletEl) || outletEl.firstElementChild;
1232
- if (currentEl) {
1233
- outletEl.removeChild(currentEl);
1234
- removedEls.add(currentEl);
1235
- }
1236
- el.$route = routeState;
1237
- applyProperties(el, route);
1238
- outletEl.appendChild(el);
1239
- outletCurrentEl.set(outletEl, el);
1240
- await (el.updateComplete || resolved);
1241
- }
1242
- }
1243
- }
1244
- }
1245
- function updateDOMTree(activated, deactivated) {
1246
- let parentElRemoved;
1247
- for (let routeIndex = deactivated.length - 1; routeIndex >= 0; routeIndex--) {
1248
- const { route, el } = deactivated[routeIndex];
1249
- if (!activated.some(({ route: activeRoute }) => activeRoute.name === route.name)) {
1250
- if (el) {
1251
- if (!parentElRemoved && !removedEls.has(el)) el.remove();
1252
- parentElRemoved = true;
1253
- }
1254
- routeElMap[route.name] = void 0;
1255
- }
1256
- }
1257
- }
1258
- async function resolve(transition2) {
1259
- const prevRoutes = transition2.prev.routes;
1260
- const changingIndex = getChangingIndex(prevRoutes, transition2.routes);
1261
- const deactivated = [];
1262
- for (let routeIndex = prevRoutes.length - 1; routeIndex >= changingIndex; routeIndex--) {
1263
- const route = prevRoutes[routeIndex];
1264
- deactivated.push({ el: routeElMap[route.name], route });
1265
- }
1266
- await runLifeCycle(transition2, deactivated, "before", "Leave");
1267
- if (transition2.isCancelled) return;
1268
- const activated = await resolveRoutes(transition2.routes.slice(changingIndex));
1269
- await runLifeCycle(transition2, activated, "before", "Enter");
1270
- if (transition2.isCancelled) return;
1271
- runPropertyHookMethod(transition2, activated, "enter");
1272
- await renderElements(transition2, activated, changingIndex);
1273
- updateDOMTree(activated, deactivated);
1274
- transition2.activated = activated;
1275
- transition2.deactivated = deactivated;
1276
- }
1277
- function done(transition2) {
1278
- runPropertyHookMethod(transition2, transition2.deactivated, "leave");
1279
- runLifeCycle(transition2, transition2.deactivated, "after", "Leave");
1280
- runLifeCycle(transition2, transition2.activated, "after", "Enter");
1281
- }
1282
- const wc = {
1283
- create,
1284
- destroy,
1285
- resolve,
1286
- done
1287
- };
1288
- class Router2 extends Router$1 {
1289
- constructor(options) {
1290
- super(options);
1291
- this.use(wc);
1292
- this.use(routerLinks);
1293
- }
1294
- }
1295
- let eventPrefix;
1296
- function trigger(name, detail) {
1297
- window.dispatchEvent(new CustomEvent(`${eventPrefix}${name}`, { detail }));
1298
- }
1299
- const events = {
1300
- create: function(router2) {
1301
- eventPrefix = router2.options.eventPrefix || "router-";
1302
- },
1303
- before: function(transition2) {
1304
- trigger("before:transition", { transition: transition2 });
1305
- },
1306
- done: function(transition2) {
1307
- trigger("transition", { transition: transition2 });
1308
- },
1309
- cancel: function(transition2, error) {
1310
- if (error.type !== "TransitionRedirected") {
1311
- trigger("abort", { transition: transition2, error });
1312
- }
1313
- },
1314
- error: function(transition2, error) {
1315
- trigger("abort", { transition: transition2, error });
1316
- trigger("error", { transition: transition2, error });
1317
- }
1318
- };
1319
- class Routerx extends WJElement {
1320
- /**
1321
- * Creates an instance of Routerx.
1322
- * @class
1323
- */
1324
- constructor() {
1325
- super();
1326
- __publicField(this, "className", "Routerx");
1327
- /**
1328
- * Sets the breadcrumb for the transition.
1329
- * @param {object} transition The transition object.
1330
- */
1331
- __publicField(this, "setBreadcrumb", (transition2) => {
1332
- let breadcrumb = [
1333
- ...transition2.routes.filter((obj) => "breadcrumb" in obj.options).map((b, i) => {
1334
- var _a, _b;
1335
- return {
1336
- name: b.options.breadcrumbPath || b.name,
1337
- text: b.options.breadcrumb instanceof Function ? (_b = (_a = b.options).breadcrumb) == null ? void 0 : _b.call(_a, transition2) : b.options.breadcrumb,
1338
- params: { ...b.params, ...transition2.params },
1339
- path: this.router.generate(b.name, { ...b.params, ...transition2.params })
1340
- };
1341
- })
1342
- ];
1343
- transition2.breadcrumbs = breadcrumb;
1344
- });
1345
- /**
1346
- * Resets the scroll position.
1347
- * @param {object} transition The transition object.
1348
- */
1349
- __publicField(this, "resetScrollPosition", (transition2) => {
1350
- window.scrollTo(0, 0);
1351
- });
1352
- }
1353
- /**
1354
- * Returns the list of attributes to observe for changes.
1355
- * @static
1356
- * @returns {Array<string>}
1357
- */
1358
- static get observedAttributes() {
1359
- return [];
1360
- }
1361
- /**
1362
- * Sets up the attributes for the component.
1363
- */
1364
- setupAttributes() {
1365
- this.isShadowRoot = "open";
1366
- }
1367
- /**
1368
- * Sets up the router after the component is drawn.
1369
- */
1370
- beforeDraw() {
1371
- const htmlString = this.outerHTML;
1372
- const parser = new DOMParser();
1373
- const htmlDocument = parser.parseFromString(htmlString, "text/html");
1374
- const rootElement = htmlDocument.querySelector("wje-router");
1375
- const routes = this.parseElement(rootElement).root;
1376
- this.router = new Router2({
1377
- outlet: this.outlet || "wje-router-outlet",
1378
- log: false,
1379
- logError: true,
1380
- root: this.root || "/",
1381
- pushState: true
1382
- });
1383
- this.router.map(routes);
1384
- this.router.use(this.setBreadcrumb);
1385
- this.router.use(events);
1386
- this.router.use(this.resetScrollPosition);
1387
- this.router.listen();
1388
- this.unbindIntercept = interceptLinks(this.router);
1389
- }
1390
- /**
1391
- * Parses an element and returns an object representation.
1392
- * @param {Element} element The element to parse.
1393
- * @returns {object} The object representation of the element.
1394
- */
1395
- parseElement(element) {
1396
- const obj = {};
1397
- const attributes = element.attributes;
1398
- for (let i = 0; i < attributes.length; i++) {
1399
- const attributeName = attributes[i].name;
1400
- const attributeValue = attributes[i].value;
1401
- if (attributeName === "component" && attributeValue.indexOf(".js") > -1) {
1402
- obj.component = () => import(
1403
- /* @vite-ignore */
1404
- attributeValue
1405
- );
1406
- } else {
1407
- if (attributeName !== "shadow") {
1408
- const camelCase = attributeName.replace(/-([a-z])/g, (g) => g[1].toUpperCase());
1409
- obj[camelCase] = attributeValue;
1410
- }
1411
- }
1412
- }
1413
- const children = [];
1414
- const childElements = Array.from(element.children);
1415
- childElements.forEach((childElement) => {
1416
- children.push(this.parseElement(childElement));
1417
- });
1418
- if (children.length > 0 && element.tagName === "WJE-ROUTE") {
1419
- obj.children = children;
1420
- } else {
1421
- obj.root = children;
1422
- }
1423
- return obj;
1424
- }
1425
- /**
1426
- * Cleans up before the component is disconnected.
1427
- */
1428
- beforeDisconnect() {
1429
- this.unbindIntercept();
1430
- this.router.destroy();
1431
- }
1432
- }
1433
- Routerx.define("wje-router", Routerx);
1434
- export {
1435
- Routerx as default
1436
- };
1437
- //# sourceMappingURL=wje-routerx.js.map