wj-elements 0.7.7 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/dist/animations.js +28 -51
  2. package/dist/animations.js.map +1 -1
  3. package/dist/base-path.js +19 -31
  4. package/dist/base-path.js.map +1 -1
  5. package/dist/custom-elements.json +11504 -11499
  6. package/dist/dark.css +1 -302
  7. package/dist/date.js +16 -36
  8. package/dist/date.js.map +1 -1
  9. package/dist/element-utils.js +20 -81
  10. package/dist/element-utils.js.map +1 -1
  11. package/dist/event.js +49 -165
  12. package/dist/event.js.map +1 -1
  13. package/dist/form-associated-element-BjeJn7j8.js +101 -0
  14. package/dist/{form-associated-element-DEQ4y-jn.js.map → form-associated-element-BjeJn7j8.js.map} +1 -1
  15. package/dist/icon-DmsqtDpL.js +102 -0
  16. package/dist/{icon-CReYMzAK.js.map → icon-DmsqtDpL.js.map} +1 -1
  17. package/dist/light.css +1 -731
  18. package/dist/localize.js +36 -111
  19. package/dist/localize.js.map +1 -1
  20. package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +3 -2
  21. package/dist/permissions.js +14 -41
  22. package/dist/permissions.js.map +1 -1
  23. package/dist/popup.element-CbkhthPP.js +806 -0
  24. package/dist/{popup.element-CwXvVFK7.js.map → popup.element-CbkhthPP.js.map} +1 -1
  25. package/dist/router-links-CNsJ-elb.js +105 -0
  26. package/dist/{router-links-wjqCnncc.js.map → router-links-CNsJ-elb.js.map} +1 -1
  27. package/dist/skeleton.css +1 -197
  28. package/dist/styles.css +1 -866
  29. package/dist/universal-service.js +48 -109
  30. package/dist/universal-service.js.map +1 -1
  31. package/dist/utils.js +11 -18
  32. package/dist/utils.js.map +1 -1
  33. package/dist/web-types.json +760 -760
  34. package/dist/wje-accordion-item.js +33 -106
  35. package/dist/wje-accordion-item.js.map +1 -1
  36. package/dist/wje-accordion.js +19 -84
  37. package/dist/wje-accordion.js.map +1 -1
  38. package/dist/wje-animation.js +37 -4258
  39. package/dist/wje-animation.js.map +1 -1
  40. package/dist/wje-aside.js +9 -34
  41. package/dist/wje-aside.js.map +1 -1
  42. package/dist/wje-avatar.js +36 -126
  43. package/dist/wje-avatar.js.map +1 -1
  44. package/dist/wje-badge.js +10 -52
  45. package/dist/wje-badge.js.map +1 -1
  46. package/dist/wje-breadcrumb.js +205 -672
  47. package/dist/wje-breadcrumb.js.map +1 -1
  48. package/dist/wje-breadcrumbs.js +177 -633
  49. package/dist/wje-breadcrumbs.js.map +1 -1
  50. package/dist/wje-button-group.js +48 -153
  51. package/dist/wje-button-group.js.map +1 -1
  52. package/dist/wje-button.js +92 -413
  53. package/dist/wje-button.js.map +1 -1
  54. package/dist/wje-card-content.js +7 -30
  55. package/dist/wje-card-content.js.map +1 -1
  56. package/dist/wje-card-controls.js +7 -30
  57. package/dist/wje-card-controls.js.map +1 -1
  58. package/dist/wje-card-header.js +7 -30
  59. package/dist/wje-card-header.js.map +1 -1
  60. package/dist/wje-card-subtitle.js +7 -34
  61. package/dist/wje-card-subtitle.js.map +1 -1
  62. package/dist/wje-card-title.js +7 -34
  63. package/dist/wje-card-title.js.map +1 -1
  64. package/dist/wje-card.js +15 -71
  65. package/dist/wje-card.js.map +1 -1
  66. package/dist/wje-carousel-item.js +12 -56
  67. package/dist/wje-carousel-item.js.map +1 -1
  68. package/dist/wje-carousel.js +154 -509
  69. package/dist/wje-carousel.js.map +1 -1
  70. package/dist/wje-checkbox.js +50 -227
  71. package/dist/wje-checkbox.js.map +1 -1
  72. package/dist/wje-chip.js +43 -160
  73. package/dist/wje-chip.js.map +1 -1
  74. package/dist/wje-col.js +7 -20
  75. package/dist/wje-col.js.map +1 -1
  76. package/dist/wje-color-picker.js +445 -1464
  77. package/dist/wje-color-picker.js.map +1 -1
  78. package/dist/wje-container.js +9 -35
  79. package/dist/wje-container.js.map +1 -1
  80. package/dist/wje-copy-button.js +64 -204
  81. package/dist/wje-copy-button.js.map +1 -1
  82. package/dist/wje-dialog.js +85 -553
  83. package/dist/wje-dialog.js.map +1 -1
  84. package/dist/wje-divider.js +7 -34
  85. package/dist/wje-divider.js.map +1 -1
  86. package/dist/wje-dropdown.js +78 -305
  87. package/dist/wje-dropdown.js.map +1 -1
  88. package/dist/wje-element.js +191 -700
  89. package/dist/wje-element.js.map +1 -1
  90. package/dist/wje-file-upload-item.js +51 -156
  91. package/dist/wje-file-upload-item.js.map +1 -1
  92. package/dist/wje-file-upload.js +181 -619
  93. package/dist/wje-file-upload.js.map +1 -1
  94. package/dist/wje-footer.js +7 -31
  95. package/dist/wje-footer.js.map +1 -1
  96. package/dist/wje-form.js +7 -32
  97. package/dist/wje-form.js.map +1 -1
  98. package/dist/wje-format-digital.js +26 -118
  99. package/dist/wje-format-digital.js.map +1 -1
  100. package/dist/wje-grid.js +7 -33
  101. package/dist/wje-grid.js.map +1 -1
  102. package/dist/wje-header.js +9 -35
  103. package/dist/wje-header.js.map +1 -1
  104. package/dist/wje-icon-library.js +12 -18
  105. package/dist/wje-icon-library.js.map +1 -1
  106. package/dist/wje-icon-picker.js +65 -320
  107. package/dist/wje-icon-picker.js.map +1 -1
  108. package/dist/wje-icon.js +1 -1
  109. package/dist/wje-img-comparer.js +37 -114
  110. package/dist/wje-img-comparer.js.map +1 -1
  111. package/dist/wje-img.js +50 -198
  112. package/dist/wje-img.js.map +1 -1
  113. package/dist/wje-infinite-scroll.js +94 -346
  114. package/dist/wje-infinite-scroll.js.map +1 -1
  115. package/dist/wje-input-file.js +23 -84
  116. package/dist/wje-input-file.js.map +1 -1
  117. package/dist/wje-input.js +78 -392
  118. package/dist/wje-input.js.map +1 -1
  119. package/dist/wje-item.js +11 -64
  120. package/dist/wje-item.js.map +1 -1
  121. package/dist/wje-kanban.js +124 -401
  122. package/dist/wje-kanban.js.map +1 -1
  123. package/dist/wje-label.js +9 -32
  124. package/dist/wje-label.js.map +1 -1
  125. package/dist/wje-level-indicator.js +38 -157
  126. package/dist/wje-level-indicator.js.map +1 -1
  127. package/dist/wje-list.js +10 -40
  128. package/dist/wje-list.js.map +1 -1
  129. package/dist/wje-main.js +7 -31
  130. package/dist/wje-main.js.map +1 -1
  131. package/dist/wje-masonry.js +66 -211
  132. package/dist/wje-masonry.js.map +1 -1
  133. package/dist/wje-master.js +45 -161
  134. package/dist/wje-master.js.map +1 -1
  135. package/dist/wje-menu-button.js +10 -38
  136. package/dist/wje-menu-button.js.map +1 -1
  137. package/dist/wje-menu-item.js +127 -577
  138. package/dist/wje-menu-item.js.map +1 -1
  139. package/dist/wje-menu-label.js +9 -35
  140. package/dist/wje-menu-label.js.map +1 -1
  141. package/dist/wje-menu.js +14 -49
  142. package/dist/wje-menu.js.map +1 -1
  143. package/dist/wje-option.js +48 -279
  144. package/dist/wje-option.js.map +1 -1
  145. package/dist/wje-options.js +130 -384
  146. package/dist/wje-options.js.map +1 -1
  147. package/dist/wje-orgchart-group.js +16 -52
  148. package/dist/wje-orgchart-group.js.map +1 -1
  149. package/dist/wje-orgchart-item.js +24 -93
  150. package/dist/wje-orgchart-item.js.map +1 -1
  151. package/dist/wje-orgchart.js +18 -68
  152. package/dist/wje-orgchart.js.map +1 -1
  153. package/dist/wje-pagination.js +113 -397
  154. package/dist/wje-pagination.js.map +1 -1
  155. package/dist/wje-popup.js +3 -3
  156. package/dist/wje-popup.js.map +1 -1
  157. package/dist/wje-progress-bar.js +53 -205
  158. package/dist/wje-progress-bar.js.map +1 -1
  159. package/dist/wje-qr-code.js +398 -2980
  160. package/dist/wje-qr-code.js.map +1 -1
  161. package/dist/wje-radio-group.js +52 -190
  162. package/dist/wje-radio-group.js.map +1 -1
  163. package/dist/wje-radio.js +24 -118
  164. package/dist/wje-radio.js.map +1 -1
  165. package/dist/wje-rate.js +62 -266
  166. package/dist/wje-rate.js.map +1 -1
  167. package/dist/wje-relative-time.js +24 -99
  168. package/dist/wje-relative-time.js.map +1 -1
  169. package/dist/wje-reorder-dropzone.js +9 -31
  170. package/dist/wje-reorder-dropzone.js.map +1 -1
  171. package/dist/wje-reorder-handle.js +67 -204
  172. package/dist/wje-reorder-handle.js.map +1 -1
  173. package/dist/wje-reorder-item.js +14 -44
  174. package/dist/wje-reorder-item.js.map +1 -1
  175. package/dist/wje-reorder.js +61 -246
  176. package/dist/wje-reorder.js.map +1 -1
  177. package/dist/wje-route.js +6 -24
  178. package/dist/wje-route.js.map +1 -1
  179. package/dist/wje-router-link.js +11 -39
  180. package/dist/wje-router-link.js.map +1 -1
  181. package/dist/wje-router-outlet.js +76 -172
  182. package/dist/wje-router-outlet.js.map +1 -1
  183. package/dist/wje-routerx.js +537 -1331
  184. package/dist/wje-routerx.js.map +1 -1
  185. package/dist/wje-row.js +9 -31
  186. package/dist/wje-row.js.map +1 -1
  187. package/dist/wje-select.js +326 -1152
  188. package/dist/wje-select.js.map +1 -1
  189. package/dist/wje-slider.js +44 -225
  190. package/dist/wje-slider.js.map +1 -1
  191. package/dist/wje-sliding-container.js +295 -1319
  192. package/dist/wje-sliding-container.js.map +1 -1
  193. package/dist/wje-split-view.js +35 -121
  194. package/dist/wje-split-view.js.map +1 -1
  195. package/dist/wje-status.js +14 -45
  196. package/dist/wje-status.js.map +1 -1
  197. package/dist/wje-step.js +9 -32
  198. package/dist/wje-step.js.map +1 -1
  199. package/dist/wje-stepper.js +109 -357
  200. package/dist/wje-stepper.js.map +1 -1
  201. package/dist/wje-store.js +67 -360
  202. package/dist/wje-store.js.map +1 -1
  203. package/dist/wje-tab-group.js +85 -314
  204. package/dist/wje-tab-group.js.map +1 -1
  205. package/dist/wje-tab-panel.js +7 -28
  206. package/dist/wje-tab-panel.js.map +1 -1
  207. package/dist/wje-tab.js +21 -198
  208. package/dist/wje-tab.js.map +1 -1
  209. package/dist/wje-textarea.js +64 -264
  210. package/dist/wje-textarea.js.map +1 -1
  211. package/dist/wje-thumbnail.js +10 -51
  212. package/dist/wje-thumbnail.js.map +1 -1
  213. package/dist/wje-toast.js +127 -632
  214. package/dist/wje-toast.js.map +1 -1
  215. package/dist/wje-toggle.js +52 -177
  216. package/dist/wje-toggle.js.map +1 -1
  217. package/dist/wje-toolbar-action.js +128 -456
  218. package/dist/wje-toolbar-action.js.map +1 -1
  219. package/dist/wje-toolbar.js +75 -270
  220. package/dist/wje-toolbar.js.map +1 -1
  221. package/dist/wje-tooltip.js +50 -161
  222. package/dist/wje-tooltip.js.map +1 -1
  223. package/dist/wje-tree-item.js +70 -301
  224. package/dist/wje-tree-item.js.map +1 -1
  225. package/dist/wje-tree.js +145 -489
  226. package/dist/wje-tree.js.map +1 -1
  227. package/dist/wje-visually-hidden.js +7 -34
  228. package/dist/wje-visually-hidden.js.map +1 -1
  229. package/package.json +3 -2
  230. package/dist/form-associated-element-DEQ4y-jn.js +0 -245
  231. package/dist/icon-CReYMzAK.js +0 -245
  232. package/dist/popup.element-CwXvVFK7.js +0 -2133
  233. package/dist/router-links-wjqCnncc.js +0 -156
package/dist/wje-toast.js CHANGED
@@ -1,713 +1,208 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import WJElement from "./wje-element.js";
5
- import { WjElementUtils } from "./element-utils.js";
6
- import { event } from "./event.js";
7
- const styles = "/*\n[ WJ Toast ]\n*/\n\n:host {\n --wje-toast-stack-z: 9999;\n --wje-toast-stack-host-margin-top: 0.5rem;\n --wje-toast-stack-host-margin-bottom: 0.5rem;\n --wje-toast-stack-layout-duration: 0.2s;\n --wje-toast-stack-visual-duration: 0.2s;\n --wje-toast-stack-opacity: 1;\n --wje-toast-stack-shift: 0px;\n --wje-toast-enter-offset: 0px;\n --wje-toast-stack-scale: 1;\n --wje-toast-stack-origin: center top;\n position: relative;\n z-index: var(--wje-toast-stack-z);\n width: 300px;\n max-width: min(100%, calc(100vw - 1rem));\n margin: var(--wje-toast-stack-host-margin-top) 0 var(--wje-toast-stack-host-margin-bottom);\n display: none;\n transition:\n margin-top var(--wje-toast-stack-layout-duration) ease,\n margin-bottom var(--wje-toast-stack-layout-duration) ease;\n}\n\n:host([open]) {\n display: block;\n}\n\n.native-toast {\n display: flex;\n align-items: center;\n padding: 1rem;\n overflow: hidden;\n margin: 0;\n border-width: 1px;\n border-style: solid;\n border-radius: var(--wje-border-radius-large);\n position: relative;\n opacity: var(--wje-toast-stack-opacity);\n transform: translateY(calc(var(--wje-toast-stack-shift) + var(--wje-toast-enter-offset))) scale(var(--wje-toast-stack-scale));\n transform-origin: var(--wje-toast-stack-origin);\n transition:\n transform var(--wje-toast-stack-visual-duration) ease,\n opacity var(--wje-toast-stack-visual-duration) ease;\n\n &.has-media slot[name='media'] {\n flex: 0 0 1.5rem;\n width: 1.5rem;\n display: flex;\n margin-right: 0.5rem;\n justify-content: center;\n }\n\n .content {\n font-size: var(--wje-font-size-small);\n .headline {\n font-size: var(--wje-font-size);\n font-weight: var(--wje-font-weight-bold);\n }\n }\n\n wje-button {\n --wje-button-margin-inline: auto 0;\n margin-left: auto !important;\n }\n\n .countdown {\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n height: 4px;\n .countdown-bar {\n height: 100%;\n }\n }\n}\n\n:host([position='top']) {\n animation: slideDown 0.3s ease-out forwards;\n top: 1rem;\n left: auto;\n right: auto;\n}\n\n:host::part(icon) {\n margin-right: 0.5rem;\n}\n\n@keyframes slideDown {\n 0% {\n transform: translateY(-100%);\n }\n 100% {\n transform: translateY(0);\n }\n}\n\n/*PRIMARY*/\n:host([color='primary']) .native-toast {\n background-color: var(--wje-color-primary-1);\n color: var(--wje-color-primary-9);\n border-color: var(--wje-color-primary-3);\n}\n\n/*COMPLETE*/\n:host([color='complete']) .native-toast {\n background-color: var(--wje-color-complete-1);\n color: var(--wje-color-complete-9);\n border-color: var(--wje-color-complete-3);\n}\n\n/*SUCCESS*/\n:host([color='success']) .native-toast {\n background-color: var(--wje-color-success-1);\n color: var(--wje-color-success-9);\n border-color: var(--wje-color-success-3);\n}\n\n/*WARNING*/\n:host([color='warning']) .native-toast {\n background-color: var(--wje-color-warning-1);\n color: var(--wje-color-warning-11);\n border-color: var(--wje-color-warning-3);\n}\n\n/*DANGER*/\n:host([color='danger']) .native-toast {\n background-color: var(--wje-color-danger-1);\n color: var(--wje-color-danger-9);\n border-color: var(--wje-color-danger-3);\n}\n\n/*INFO*/\n:host([color='info']) .native-toast {\n background-color: var(--wje-color-info-1);\n color: var(--wje-color-info-11);\n border-color: var(--wje-color-info-4);\n}\n\n/*CONTRAST*/\n:host([color='contrast']) .native-toast {\n background-color: var(--wje-color-contrast-2);\n color: var(--wje-color-contrast-9);\n border-color: var(--wje-color-contrast-3);\n}\n\n/*PRIMARY*/\n:host([color='primary']) .countdown-bar {\n background-color: var(--wje-color-primary-9);\n}\n\n/*COMPLETE*/\n:host([color='complete']) .countdown-bar {\n background-color: var(--wje-color-complete-9);\n}\n\n/*SUCCESS*/\n:host([color='success']) .countdown-bar {\n background-color: var(--wje-color-success-9);\n}\n\n/*WARNING*/\n:host([color='warning']) .countdown-bar {\n background-color: var(--wje-color-warning-9);\n}\n\n/*DANGER*/\n:host([color='danger']) .countdown-bar {\n background-color: var(--wje-color-danger-9);\n}\n\n/*INFO*/\n:host([color='info']) .countdown-bar {\n background-color: var(--wje-color-info-9);\n}\n\n/*CONTRAST*/\n:host([color='contrast']) .countdown-bar {\n background-color: var(--wje-color-contrast-9);\n}\n";
8
- const DEFAULT_STACK_POSITION = "top-end";
9
- const DEFAULT_STACK_DEPTH = 3;
10
- const VALID_STACK_POSITIONS = /* @__PURE__ */ new Set([
11
- "top-start",
12
- "top-center",
13
- "top-end",
14
- "bottom-start",
15
- "bottom-center",
16
- "bottom-end"
17
- ]);
18
- const STACKED_SCALE_STEP = 0.04;
19
- const STACKED_MIN_SCALE = 0.88;
20
- const STACKED_MIN_OPACITY = 0.72;
21
- const STACKED_VISIBLE_SLICE = 16;
22
- const STACKED_EXPANDED_MARGIN = "0.5rem";
23
- const STACKED_PADDING = "1rem";
24
- const STACKED_ENTER_OFFSET = 24;
25
- const toggleStackExpanded = (stack, expanded) => {
26
- if (expanded) {
27
- stack.dataset.expanded = "true";
28
- return;
29
- }
30
- delete stack.dataset.expanded;
31
- };
32
- const syncExpandedStackToasts = (stack, expanded) => {
33
- Array.from(stack.children).filter((child) => child.tagName === "WJE-TOAST").forEach((toast) => {
34
- var _a, _b;
35
- if (expanded) {
36
- (_a = toast.pause) == null ? void 0 : _a.call(toast);
37
- return;
38
- }
39
- (_b = toast.resume) == null ? void 0 : _b.call(toast);
40
- });
41
- };
42
- const setStackExpandedState = (stack, expanded) => {
4
+ import t from "./wje-element.js";
5
+ import { WjElementUtils as e } from "./element-utils.js";
6
+ import { event as o } from "./event.js";
7
+ const s = "top-end", a = /* @__PURE__ */ new Set(["top-start", "top-center", "top-end", "bottom-start", "bottom-center", "bottom-end"]), r = "0.5rem", i = "1rem", n = (t2, e2) => {
43
8
  var _a;
44
- let shouldExpand = stack.dataset.stacked === "true" && expanded;
45
- let isExpanded = stack.dataset.expanded === "true";
46
- if (shouldExpand === isExpanded) {
47
- return;
48
- }
49
- toggleStackExpanded(stack, shouldExpand);
50
- syncExpandedStackToasts(stack, shouldExpand);
51
- (_a = stack.updateToastLayout) == null ? void 0 : _a.call(stack);
52
- };
53
- const syncStackExpandedState = (stack) => {
54
- setStackExpandedState(stack, stack.matches(":hover") || stack.matches(":focus-within"));
9
+ let o2 = "true" === t2.dataset.stacked && e2;
10
+ o2 !== ("true" === t2.dataset.expanded) && (((t3, e3) => {
11
+ e3 ? t3.dataset.expanded = "true" : delete t3.dataset.expanded;
12
+ })(t2, o2), ((t3, e3) => {
13
+ Array.from(t3.children).filter((t4) => "WJE-TOAST" === t4.tagName).forEach((t4) => {
14
+ var _a2, _b;
15
+ e3 ? (_a2 = t4.pause) == null ? void 0 : _a2.call(t4) : (_b = t4.resume) == null ? void 0 : _b.call(t4);
16
+ });
17
+ })(t2, o2), (_a = t2.updateToastLayout) == null ? void 0 : _a.call(t2));
18
+ }, c = (t2) => {
19
+ n(t2, t2.matches(":hover") || t2.matches(":focus-within"));
55
20
  };
56
- class Toast extends WJElement {
57
- /**
58
- * Creates an instance of Toast.
59
- */
21
+ class l extends t {
60
22
  constructor() {
61
23
  super();
62
- /**
63
- * The class name for the component.
64
- * @type {string}
65
- */
66
24
  __publicField(this, "className", "Toast");
67
- /**
68
- * Asynchronously shows the toast notification.
69
- * This method sets the `open` property to `true` and dispatches the
70
- * `wje-toast:after-show` custom event. If the toast is already open,
71
- * the method returns `undefined`.
72
- */
73
25
  __publicField(this, "show", () => {
74
- if (this.open) {
75
- return;
76
- }
77
- this.open = true;
78
- event.dispatchCustomEvent(this, "wje-toast:after-show");
26
+ this.open || (this.open = true, o.dispatchCustomEvent(this, "wje-toast:after-show"));
79
27
  });
80
- /**
81
- * Asynchronously hides the toast notification.
82
- * This method sets the `open` property to `false` and dispatches the
83
- * `wje-toast:after-hide` custom event. If the toast is already hidden,
84
- * the method returns `undefined`.
85
- */
86
28
  __publicField(this, "hide", () => {
87
- if (!this.open) {
88
- return;
89
- }
90
- this.open = false;
91
- event.dispatchCustomEvent(this, "wje-toast:after-hide");
29
+ this.open && (this.open = false, o.dispatchCustomEvent(this, "wje-toast:after-hide"));
92
30
  });
93
- /**
94
- * Pauses the countdown animation and stops the timer.
95
- */
96
31
  __publicField(this, "pause", () => {
97
32
  var _a;
98
- (_a = this.countdownAnimation) == null ? void 0 : _a.pause();
99
- this.stopTimer();
33
+ (_a = this.countdownAnimation) == null ? void 0 : _a.pause(), this.stopTimer();
100
34
  });
101
- /**
102
- * Resumes the countdown animation and resumes the timer.
103
- */
104
35
  __publicField(this, "resume", () => {
105
36
  var _a, _b;
106
- if (((_a = this.toastStack) == null ? void 0 : _a.dataset.expanded) === "true") {
107
- return;
108
- }
109
- (_b = this.countdownAnimation) == null ? void 0 : _b.play();
110
- this.resumeTimer();
111
- });
112
- /**
113
- * Asynchronously starts the toast notification.
114
- * This method appends the toast notification to the document body and
115
- * shows the toast notification. The method returns a promise that
116
- * resolves when the toast notification is shown.
117
- * @returns {Promise<unknown>}
118
- */
119
- __publicField(this, "start", () => {
120
- return new Promise((resolve) => {
121
- var _a;
122
- let stack = document.body.querySelector(`.wje-toast-stack[data-stack-key="${this.getToastStackKey()}"]`);
123
- if (stack) {
124
- this.toastStack = stack;
125
- } else {
126
- this.toastStack = this.createToastStack();
127
- }
128
- this.syncToastStack(this.toastStack);
129
- if (this.toastStack.parentElement === null) {
130
- document.body.append(this.toastStack);
131
- }
132
- this.toastStack.append(this);
133
- if (this.stacked) {
134
- this.toastStack.style.setProperty("--wje-toast-stack-layout-duration", "0s");
135
- this.toastStack.style.setProperty("--wje-toast-stack-visual-duration", "0s");
136
- this.style.setProperty(
137
- "--wje-toast-enter-offset",
138
- this.stackPosition.startsWith("bottom") ? `${STACKED_ENTER_OFFSET}px` : `-${STACKED_ENTER_OFFSET}px`
139
- );
140
- this.style.visibility = "hidden";
141
- this.show();
142
- this.updateToastStack(this.toastStack);
143
- } else {
144
- this.updateToastStack(this.toastStack);
145
- this.show();
146
- }
147
- if (this.toastStack.dataset.expanded === "true") {
148
- this.pause();
149
- }
150
- requestAnimationFrame(() => {
151
- this.updateToastStack(this.toastStack);
152
- if (this.stacked) {
153
- this.style.removeProperty("visibility");
154
- this.toastStack.style.removeProperty("--wje-toast-stack-layout-duration");
155
- this.toastStack.style.removeProperty("--wje-toast-stack-visual-duration");
156
- requestAnimationFrame(() => this.style.setProperty("--wje-toast-enter-offset", "0px"));
157
- }
158
- });
159
- (_a = this.updateComplete) == null ? void 0 : _a.then(() => this.updateToastStack(this.toastStack));
160
- this.addEventListener("wje-toast:after-hide", this.removeChildAndStack);
161
- resolve(this);
162
- });
37
+ "true" !== ((_a = this.toastStack) == null ? void 0 : _a.dataset.expanded) && ((_b = this.countdownAnimation) == null ? void 0 : _b.play(), this.resumeTimer());
163
38
  });
39
+ __publicField(this, "start", () => new Promise((t2) => {
40
+ var _a;
41
+ let e2 = document.body.querySelector(`.wje-toast-stack[data-stack-key="${this.getToastStackKey()}"]`);
42
+ this.toastStack = e2 || this.createToastStack(), this.syncToastStack(this.toastStack), null === this.toastStack.parentElement && document.body.append(this.toastStack), this.toastStack.append(this), this.stacked ? (this.toastStack.style.setProperty("--wje-toast-stack-layout-duration", "0s"), this.toastStack.style.setProperty("--wje-toast-stack-visual-duration", "0s"), this.style.setProperty("--wje-toast-enter-offset", this.stackPosition.startsWith("bottom") ? "24px" : "-24px"), this.style.visibility = "hidden", this.show(), this.updateToastStack(this.toastStack)) : (this.updateToastStack(this.toastStack), this.show()), "true" === this.toastStack.dataset.expanded && this.pause(), requestAnimationFrame(() => {
43
+ this.updateToastStack(this.toastStack), this.stacked && (this.style.removeProperty("visibility"), this.toastStack.style.removeProperty("--wje-toast-stack-layout-duration"), this.toastStack.style.removeProperty("--wje-toast-stack-visual-duration"), requestAnimationFrame(() => this.style.setProperty("--wje-toast-enter-offset", "0px")));
44
+ }), (_a = this.updateComplete) == null ? void 0 : _a.then(() => this.updateToastStack(this.toastStack)), this.addEventListener("wje-toast:after-hide", this.removeChildAndStack), t2(this);
45
+ }));
164
46
  this.toastStack = this.createToastStack();
165
47
  }
166
- /**
167
- * Set headline value of the toast.
168
- * @param value
169
- */
170
- set headline(value) {
171
- this.setAttribute("headline", value);
172
- }
173
- /**
174
- * Get headline value of the toast.
175
- * @returns {string}
176
- */
48
+ set headline(t2) {
49
+ this.setAttribute("headline", t2);
50
+ }
177
51
  get headline() {
178
52
  return this.getAttribute("headline");
179
53
  }
180
- /**
181
- * Set open value of the toast.
182
- * @param value
183
- */
184
- set open(value) {
185
- this.removeAttribute("open");
186
- if (WjElementUtils.stringToBoolean(value)) this.setAttribute("open", value);
187
- }
188
- /**
189
- * Get open value of the toast.
190
- * @returns {boolean}
191
- */
54
+ set open(t2) {
55
+ this.removeAttribute("open"), e.stringToBoolean(t2) && this.setAttribute("open", t2);
56
+ }
192
57
  get open() {
193
58
  return this.hasAttribute("open");
194
59
  }
195
- /**
196
- * Set duration value of the toast.
197
- * @param value
198
- */
199
- set duration(value) {
200
- this.setAttribute("duration", value);
201
- }
202
- /**
203
- * Get duration value of the toast.
204
- * @returns {number}
205
- */
60
+ set duration(t2) {
61
+ this.setAttribute("duration", t2);
62
+ }
206
63
  get duration() {
207
64
  return +this.getAttribute("duration");
208
65
  }
209
- /**
210
- * Set closable value of the toast.
211
- * @param value
212
- */
213
- set closable(value) {
214
- this.setAttribute("closable", value || "");
215
- }
216
- /**
217
- * Get closable value of the toast.
218
- * @returns {boolean}
219
- */
66
+ set closable(t2) {
67
+ this.setAttribute("closable", t2 || "");
68
+ }
220
69
  get closable() {
221
70
  return this.hasAttribute("closable");
222
71
  }
223
- /**
224
- * Set color value of the toast.
225
- * @param value
226
- */
227
- set color(value) {
228
- this.setAttribute("color", value);
229
- }
230
- /**
231
- * Get color value of the toast.
232
- * @returns {string}
233
- */
72
+ set color(t2) {
73
+ this.setAttribute("color", t2);
74
+ }
234
75
  get color() {
235
76
  return this.getAttribute("color");
236
77
  }
237
- /**
238
- * Set countdown value of the toast.
239
- * @param value
240
- */
241
- set countdown(value) {
242
- if (value) this.setAttribute("countdown", value);
243
- }
244
- /**
245
- * Get countdown value of the toast.
246
- * @returns {boolean}
247
- */
78
+ set countdown(t2) {
79
+ t2 && this.setAttribute("countdown", t2);
80
+ }
248
81
  get countdown() {
249
82
  return this.hasAttribute("countdown");
250
83
  }
251
- /**
252
- * Set stacked value of the toast.
253
- * @param value
254
- */
255
- set stacked(value) {
256
- this.toggleAttribute("stacked", WjElementUtils.stringToBoolean(value));
257
- }
258
- /**
259
- * Get stacked value of the toast.
260
- * @returns {boolean}
261
- */
84
+ set stacked(t2) {
85
+ this.toggleAttribute("stacked", e.stringToBoolean(t2));
86
+ }
262
87
  get stacked() {
263
88
  return this.hasAttribute("stacked");
264
89
  }
265
- /**
266
- * Set stack depth of the toast.
267
- * @param value
268
- */
269
- set stackDepth(value) {
270
- if (value === null || value === void 0 || value === "") {
271
- this.removeAttribute("stack-depth");
272
- return;
273
- }
274
- this.setAttribute("stack-depth", value);
90
+ set stackDepth(t2) {
91
+ null != t2 && "" !== t2 ? this.setAttribute("stack-depth", t2) : this.removeAttribute("stack-depth");
275
92
  }
276
- /**
277
- * Get stack depth of the toast.
278
- * @returns {number}
279
- */
280
93
  get stackDepth() {
281
- let value = Number.parseInt(this.getAttribute("stack-depth"), 10);
282
- if (Number.isFinite(value) && value > 0) {
283
- return value;
284
- }
285
- return DEFAULT_STACK_DEPTH;
286
- }
287
- /**
288
- * Set stack position of the toast.
289
- * @param value
290
- */
291
- set stackPosition(value) {
292
- if (!value) {
293
- this.removeAttribute("stack-position");
294
- return;
295
- }
296
- this.setAttribute("stack-position", value);
94
+ let t2 = Number.parseInt(this.getAttribute("stack-depth"), 10);
95
+ return Number.isFinite(t2) && t2 > 0 ? t2 : 3;
96
+ }
97
+ set stackPosition(t2) {
98
+ t2 ? this.setAttribute("stack-position", t2) : this.removeAttribute("stack-position");
297
99
  }
298
- /**
299
- * Get stack position of the toast.
300
- * @returns {string}
301
- */
302
100
  get stackPosition() {
303
- let value = this.getAttribute("stack-position");
304
- if (VALID_STACK_POSITIONS.has(value)) {
305
- return value;
306
- }
307
- if (this.getAttribute("position") === "bottom") {
308
- return "bottom-end";
309
- }
310
- return DEFAULT_STACK_POSITION;
311
- }
312
- /**
313
- * Set icon value of the toast.
314
- * @param value
315
- */
316
- set icon(value) {
317
- this.setAttribute("icon", value);
318
- }
319
- /**
320
- * Get icon value of the toast.
321
- * @returns {string}
322
- */
101
+ let t2 = this.getAttribute("stack-position");
102
+ return a.has(t2) ? t2 : "bottom" === this.getAttribute("position") ? "bottom-end" : s;
103
+ }
104
+ set icon(t2) {
105
+ this.setAttribute("icon", t2);
106
+ }
323
107
  get icon() {
324
108
  return this.getAttribute("icon");
325
109
  }
326
- /**
327
- * Creates a toast stack container.
328
- * @returns {HTMLDivElement}
329
- */
330
110
  createToastStack() {
331
- let stack = Object.assign(document.createElement("div"), { className: "wje-toast-stack" });
332
- stack.addEventListener("mouseenter", () => setStackExpandedState(stack, true));
333
- stack.addEventListener("mouseleave", () => requestAnimationFrame(() => syncStackExpandedState(stack)));
334
- stack.addEventListener("focusin", () => setStackExpandedState(stack, true));
335
- stack.addEventListener("focusout", () => requestAnimationFrame(() => syncStackExpandedState(stack)));
336
- this.syncToastStack(stack);
337
- return stack;
338
- }
339
- /**
340
- * Returns the key of the toast stack.
341
- * @returns {string}
342
- */
111
+ let t2 = Object.assign(document.createElement("div"), { className: "wje-toast-stack" });
112
+ return t2.addEventListener("mouseenter", () => n(t2, true)), t2.addEventListener("mouseleave", () => requestAnimationFrame(() => c(t2))), t2.addEventListener("focusin", () => n(t2, true)), t2.addEventListener("focusout", () => requestAnimationFrame(() => c(t2))), this.syncToastStack(t2), t2;
113
+ }
343
114
  getToastStackKey() {
344
115
  return `${this.stackPosition}:${this.stacked ? `stacked:${this.stackDepth}` : "default"}`;
345
116
  }
346
- /**
347
- * Applies the stack placement directly on the element so demo/app layout CSS cannot override it accidentally.
348
- * @param {HTMLDivElement} stack
349
- */
350
- applyToastStackPlacement(stack = this.toastStack) {
351
- const positions = {
352
- "top-start": {
353
- top: "0",
354
- bottom: "auto",
355
- left: "0",
356
- right: "auto",
357
- transform: "none",
358
- margin: "0.5rem"
359
- },
360
- "top-center": {
361
- top: "0",
362
- bottom: "auto",
363
- left: "50%",
364
- right: "auto",
365
- transform: "translateX(-50%)",
366
- margin: "0.5rem 0 0"
367
- },
368
- "top-end": {
369
- top: "0",
370
- bottom: "auto",
371
- left: "auto",
372
- right: "0",
373
- transform: "none",
374
- margin: "0.5rem"
375
- },
376
- "bottom-start": {
377
- top: "auto",
378
- bottom: "0",
379
- left: "0",
380
- right: "auto",
381
- transform: "none",
382
- margin: "0 0.5rem 0.5rem"
383
- },
384
- "bottom-center": {
385
- top: "auto",
386
- bottom: "0",
387
- left: "50%",
388
- right: "auto",
389
- transform: "translateX(-50%)",
390
- margin: "0 0 0.5rem"
391
- },
392
- "bottom-end": {
393
- top: "auto",
394
- bottom: "0",
395
- left: "auto",
396
- right: "0",
397
- transform: "none",
398
- margin: "0 0.5rem 0.5rem"
399
- }
400
- };
401
- stack.style.removeProperty("inset-inline");
402
- stack.style.removeProperty("inset-inline-start");
403
- stack.style.removeProperty("inset-inline-end");
404
- Object.assign(stack.style, positions[this.stackPosition] || positions[DEFAULT_STACK_POSITION]);
405
- }
406
- /**
407
- * Applies the current toast stack configuration to a stack element.
408
- * @param {HTMLDivElement} stack
409
- */
410
- syncToastStack(stack = this.toastStack) {
411
- stack.dataset.position = this.stackPosition;
412
- stack.dataset.stackKey = this.getToastStackKey();
413
- stack.updateToastLayout = () => this.updateToastStack(stack);
414
- stack.style.display = "flex";
415
- stack.style.alignItems = "stretch";
416
- stack.style.width = "min(var(--wje-toast-stack-width, 300px), calc(100vw - 1rem))";
417
- stack.style.maxWidth = "calc(100vw - 1rem)";
418
- stack.style.maxHeight = "calc(100vh - 1rem)";
419
- stack.style.zIndex = "9999";
420
- this.applyToastStackPlacement(stack);
421
- if (this.stacked) {
422
- stack.dataset.stacked = "true";
423
- stack.dataset.stackDepth = String(this.stackDepth);
424
- } else {
425
- delete stack.dataset.stacked;
426
- delete stack.dataset.stackDepth;
427
- delete stack.dataset.expanded;
428
- }
117
+ applyToastStackPlacement(t2 = this.toastStack) {
118
+ const e2 = { "top-start": { top: "0", bottom: "auto", left: "0", right: "auto", transform: "none", margin: "0.5rem" }, "top-center": { top: "0", bottom: "auto", left: "50%", right: "auto", transform: "translateX(-50%)", margin: "0.5rem 0 0" }, "top-end": { top: "0", bottom: "auto", left: "auto", right: "0", transform: "none", margin: "0.5rem" }, "bottom-start": { top: "auto", bottom: "0", left: "0", right: "auto", transform: "none", margin: "0 0.5rem 0.5rem" }, "bottom-center": { top: "auto", bottom: "0", left: "50%", right: "auto", transform: "translateX(-50%)", margin: "0 0 0.5rem" }, "bottom-end": { top: "auto", bottom: "0", left: "auto", right: "0", transform: "none", margin: "0 0.5rem 0.5rem" } };
119
+ t2.style.removeProperty("inset-inline"), t2.style.removeProperty("inset-inline-start"), t2.style.removeProperty("inset-inline-end"), Object.assign(t2.style, e2[this.stackPosition] || e2[s]);
429
120
  }
430
- /**
431
- * Clears transient stack styling from a toast.
432
- * @param {Toast} toast
433
- */
434
- clearStackItemStyles(toast) {
435
- [
436
- "--wje-toast-stack-scale",
437
- "--wje-toast-stack-shift",
438
- "--wje-toast-stack-opacity",
439
- "--wje-toast-stack-z",
440
- "--wje-toast-stack-origin",
441
- "--wje-toast-stack-host-margin-top",
442
- "--wje-toast-stack-host-margin-bottom",
443
- "order",
444
- "position",
445
- "top",
446
- "left",
447
- "right",
448
- "width",
449
- "margin",
450
- "margin-top",
451
- "margin-bottom"
452
- ].forEach((property) => toast.style.removeProperty(property));
453
- }
454
- /**
455
- * Measures the rendered height of a toast for stack overlap calculations.
456
- * @param {Toast} toast
457
- * @returns {number}
458
- */
459
- getToastVisualHeight(toast) {
121
+ syncToastStack(t2 = this.toastStack) {
122
+ t2.dataset.position = this.stackPosition, t2.dataset.stackKey = this.getToastStackKey(), t2.updateToastLayout = () => this.updateToastStack(t2), t2.style.display = "flex", t2.style.alignItems = "stretch", t2.style.width = "min(var(--wje-toast-stack-width, 300px), calc(100vw - 1rem))", t2.style.maxWidth = "calc(100vw - 1rem)", t2.style.maxHeight = "calc(100vh - 1rem)", t2.style.zIndex = "9999", this.applyToastStackPlacement(t2), this.stacked ? (t2.dataset.stacked = "true", t2.dataset.stackDepth = String(this.stackDepth)) : (delete t2.dataset.stacked, delete t2.dataset.stackDepth, delete t2.dataset.expanded);
123
+ }
124
+ clearStackItemStyles(t2) {
125
+ ["--wje-toast-stack-scale", "--wje-toast-stack-shift", "--wje-toast-stack-opacity", "--wje-toast-stack-z", "--wje-toast-stack-origin", "--wje-toast-stack-host-margin-top", "--wje-toast-stack-host-margin-bottom", "order", "position", "top", "left", "right", "width", "margin", "margin-top", "margin-bottom"].forEach((e2) => t2.style.removeProperty(e2));
126
+ }
127
+ getToastVisualHeight(t2) {
460
128
  var _a, _b;
461
- let hostHeight = toast.getBoundingClientRect().height;
462
- let nativeHeight = ((_b = (_a = toast.shadowRoot) == null ? void 0 : _a.querySelector(".native-toast")) == null ? void 0 : _b.getBoundingClientRect().height) || 0;
463
- return Math.max(hostHeight, nativeHeight, toast.offsetHeight || 0);
464
- }
465
- /**
466
- * Recomputes the visual order of toasts inside the stack.
467
- * @param {HTMLDivElement} stack
468
- */
469
- updateToastStack(stack = this.toastStack) {
129
+ let e2 = t2.getBoundingClientRect().height, o2 = ((_b = (_a = t2.shadowRoot) == null ? void 0 : _a.querySelector(".native-toast")) == null ? void 0 : _b.getBoundingClientRect().height) || 0;
130
+ return Math.max(e2, o2, t2.offsetHeight || 0);
131
+ }
132
+ updateToastStack(t2 = this.toastStack) {
470
133
  var _a, _b;
471
- let toasts = Array.from(stack.children).filter((child) => child.tagName === "WJE-TOAST");
472
- let isStacked = stack.dataset.stacked === "true";
473
- let isExpanded = stack.dataset.expanded === "true";
474
- let isBottomStack = (_a = stack.dataset.position) == null ? void 0 : _a.startsWith("bottom");
475
- let transformOrigin = ((_b = stack.dataset.position) == null ? void 0 : _b.startsWith("bottom")) ? "center bottom" : "center top";
476
- let stackHeight = 0;
477
- stack.dataset.count = String(toasts.length);
478
- stack.style.gap = "var(--wje-spacing-x-small)";
479
- stack.style.flexDirection = "column";
480
- stack.style.overflow = isStacked ? isExpanded ? "auto" : "visible" : "auto";
481
- if (isStacked) {
482
- stack.style.paddingTop = isExpanded ? isBottomStack ? STACKED_PADDING : "0px" : STACKED_PADDING;
483
- stack.style.paddingBottom = isExpanded ? isBottomStack ? "0px" : STACKED_PADDING : STACKED_PADDING;
484
- } else {
485
- stack.style.removeProperty("padding-top");
486
- stack.style.removeProperty("padding-bottom");
487
- }
488
- if (!isStacked || isExpanded) {
489
- stack.style.removeProperty("height");
490
- }
491
- toasts.forEach((toast, index) => {
492
- this.clearStackItemStyles(toast);
493
- toast.style.setProperty("--wje-toast-stack-z", String(index + 1));
494
- if (!isStacked) {
495
- return;
496
- }
497
- if (isExpanded) {
498
- let visualOrder = isBottomStack ? index : toasts.length - index - 1;
499
- let isVisualFirst = visualOrder === 0;
500
- let isVisualLast = visualOrder === toasts.length - 1;
501
- toast.style.setProperty("--wje-toast-stack-scale", "1.000");
502
- toast.style.setProperty("--wje-toast-stack-shift", "0px");
503
- toast.style.setProperty("--wje-toast-stack-opacity", "1.000");
504
- toast.style.setProperty("--wje-toast-stack-origin", transformOrigin);
505
- toast.style.order = String(visualOrder);
506
- toast.style.width = "100%";
507
- toast.style.setProperty(
508
- "--wje-toast-stack-host-margin-top",
509
- isBottomStack && !isVisualFirst ? STACKED_EXPANDED_MARGIN : "0px"
510
- );
511
- toast.style.setProperty(
512
- "--wje-toast-stack-host-margin-bottom",
513
- !isBottomStack && !isVisualLast ? STACKED_EXPANDED_MARGIN : "0px"
514
- );
515
- return;
134
+ let e2 = Array.from(t2.children).filter((t3) => "WJE-TOAST" === t3.tagName), o2 = "true" === t2.dataset.stacked, s2 = "true" === t2.dataset.expanded, a2 = (_a = t2.dataset.position) == null ? void 0 : _a.startsWith("bottom"), n2 = ((_b = t2.dataset.position) == null ? void 0 : _b.startsWith("bottom")) ? "center bottom" : "center top", c2 = 0;
135
+ t2.dataset.count = String(e2.length), t2.style.gap = "var(--wje-spacing-x-small)", t2.style.flexDirection = "column", t2.style.overflow = o2 ? s2 ? "auto" : "visible" : "auto", o2 ? (t2.style.paddingTop = s2 ? a2 ? i : "0px" : i, t2.style.paddingBottom = s2 && a2 ? "0px" : i) : (t2.style.removeProperty("padding-top"), t2.style.removeProperty("padding-bottom")), o2 && !s2 || t2.style.removeProperty("height"), e2.forEach((t3, i2) => {
136
+ if (this.clearStackItemStyles(t3), t3.style.setProperty("--wje-toast-stack-z", String(i2 + 1)), !o2) return;
137
+ if (s2) {
138
+ let o3 = a2 ? i2 : e2.length - i2 - 1, s3 = 0 === o3, c3 = o3 === e2.length - 1;
139
+ return t3.style.setProperty("--wje-toast-stack-scale", "1.000"), t3.style.setProperty("--wje-toast-stack-shift", "0px"), t3.style.setProperty("--wje-toast-stack-opacity", "1.000"), t3.style.setProperty("--wje-toast-stack-origin", n2), t3.style.order = String(o3), t3.style.width = "100%", t3.style.setProperty("--wje-toast-stack-host-margin-top", a2 && !s3 ? r : "0px"), void t3.style.setProperty("--wje-toast-stack-host-margin-bottom", a2 || c3 ? "0px" : r);
516
140
  }
517
- let toastHeight = this.getToastVisualHeight(toast);
518
- let maxDepth = Math.max(0, this.stackDepth - 1);
519
- let visibleLevels = Math.min(toasts.length, this.stackDepth);
520
- let depth = Math.min(toasts.length - index - 1, maxDepth);
521
- let visibleIndex = Math.max(0, index - Math.max(0, toasts.length - this.stackDepth));
522
- let targetTop = isBottomStack ? visibleIndex * STACKED_VISIBLE_SLICE : (visibleLevels - 1 - visibleIndex) * STACKED_VISIBLE_SLICE;
523
- let scale = Math.max(STACKED_MIN_SCALE, 1 - depth * STACKED_SCALE_STEP);
524
- let opacity = Math.max(STACKED_MIN_OPACITY, 1 - depth * 0.08);
525
- toast.style.setProperty("--wje-toast-stack-scale", scale.toFixed(3));
526
- toast.style.setProperty("--wje-toast-stack-shift", "0px");
527
- toast.style.setProperty("--wje-toast-stack-opacity", opacity.toFixed(3));
528
- toast.style.setProperty("--wje-toast-stack-origin", transformOrigin);
529
- toast.style.position = "absolute";
530
- toast.style.top = `${targetTop}px`;
531
- toast.style.left = "0";
532
- toast.style.right = "0";
533
- toast.style.width = "100%";
534
- toast.style.setProperty("--wje-toast-stack-host-margin-top", "0px");
535
- toast.style.setProperty("--wje-toast-stack-host-margin-bottom", "0px");
536
- stackHeight = Math.max(stackHeight, targetTop + toastHeight);
537
- });
538
- if (isStacked && !isExpanded) {
539
- stack.style.height = `${stackHeight}px`;
540
- }
141
+ let l2 = this.getToastVisualHeight(t3), h = Math.max(0, this.stackDepth - 1), d = Math.min(e2.length, this.stackDepth), m = Math.min(e2.length - i2 - 1, h), u = Math.max(0, i2 - Math.max(0, e2.length - this.stackDepth)), p = a2 ? 16 * u : 16 * (d - 1 - u), w = Math.max(0.88, 1 - 0.04 * m), k = Math.max(0.72, 1 - 0.08 * m);
142
+ t3.style.setProperty("--wje-toast-stack-scale", w.toFixed(3)), t3.style.setProperty("--wje-toast-stack-shift", "0px"), t3.style.setProperty("--wje-toast-stack-opacity", k.toFixed(3)), t3.style.setProperty("--wje-toast-stack-origin", n2), t3.style.position = "absolute", t3.style.top = `${p}px`, t3.style.left = "0", t3.style.right = "0", t3.style.width = "100%", t3.style.setProperty("--wje-toast-stack-host-margin-top", "0px"), t3.style.setProperty("--wje-toast-stack-host-margin-bottom", "0px"), c2 = Math.max(c2, p + l2);
143
+ }), o2 && !s2 && (t2.style.height = `${c2}px`);
541
144
  }
542
- /**
543
- * Returns the CSS stylesheet for the component.
544
- * @static
545
- * @returns {CSSStyleSheet} The CSS stylesheet
546
- */
547
145
  static get cssStyleSheet() {
548
- return styles;
146
+ return ':host{--wje-toast-stack-z: 9999;--wje-toast-stack-host-margin-top: .5rem;--wje-toast-stack-host-margin-bottom: .5rem;--wje-toast-stack-layout-duration: .2s;--wje-toast-stack-visual-duration: .2s;--wje-toast-stack-opacity: 1;--wje-toast-stack-shift: 0px;--wje-toast-enter-offset: 0px;--wje-toast-stack-scale: 1;--wje-toast-stack-origin: center top;position:relative;z-index:var(--wje-toast-stack-z);width:300px;max-width:min(100%,calc(100vw - 1rem));margin:var(--wje-toast-stack-host-margin-top) 0 var(--wje-toast-stack-host-margin-bottom);display:none;transition:margin-top var(--wje-toast-stack-layout-duration) ease,margin-bottom var(--wje-toast-stack-layout-duration) ease}:host([open]){display:block}.native-toast{display:flex;align-items:center;padding:1rem;overflow:hidden;margin:0;border-width:1px;border-style:solid;border-radius:var(--wje-border-radius-large);position:relative;opacity:var(--wje-toast-stack-opacity);transform:translateY(calc(var(--wje-toast-stack-shift) + var(--wje-toast-enter-offset))) scale(var(--wje-toast-stack-scale));transform-origin:var(--wje-toast-stack-origin);transition:transform var(--wje-toast-stack-visual-duration) ease,opacity var(--wje-toast-stack-visual-duration) ease}.native-toast.has-media slot[name=media]{flex:0 0 1.5rem;width:1.5rem;display:flex;margin-right:.5rem;justify-content:center}.native-toast .content{font-size:var(--wje-font-size-small)}.native-toast .content .headline{font-size:var(--wje-font-size);font-weight:var(--wje-font-weight-bold)}.native-toast wje-button{--wje-button-margin-inline: auto 0;margin-left:auto!important}.native-toast .countdown{position:absolute;left:0;bottom:0;width:100%;height:4px}.native-toast .countdown .countdown-bar{height:100%}:host([position="top"]){animation:slideDown .3s ease-out forwards;top:1rem;left:auto;right:auto}:host::part(icon){margin-right:.5rem}@keyframes slideDown{0%{transform:translateY(-100%)}to{transform:translateY(0)}}:host([color="primary"]) .native-toast{background-color:var(--wje-color-primary-1);color:var(--wje-color-primary-9);border-color:var(--wje-color-primary-3)}:host([color="complete"]) .native-toast{background-color:var(--wje-color-complete-1);color:var(--wje-color-complete-9);border-color:var(--wje-color-complete-3)}:host([color="success"]) .native-toast{background-color:var(--wje-color-success-1);color:var(--wje-color-success-9);border-color:var(--wje-color-success-3)}:host([color="warning"]) .native-toast{background-color:var(--wje-color-warning-1);color:var(--wje-color-warning-11);border-color:var(--wje-color-warning-3)}:host([color="danger"]) .native-toast{background-color:var(--wje-color-danger-1);color:var(--wje-color-danger-9);border-color:var(--wje-color-danger-3)}:host([color="info"]) .native-toast{background-color:var(--wje-color-info-1);color:var(--wje-color-info-11);border-color:var(--wje-color-info-4)}:host([color="contrast"]) .native-toast{background-color:var(--wje-color-contrast-2);color:var(--wje-color-contrast-9);border-color:var(--wje-color-contrast-3)}:host([color="primary"]) .countdown-bar{background-color:var(--wje-color-primary-9)}:host([color="complete"]) .countdown-bar{background-color:var(--wje-color-complete-9)}:host([color="success"]) .countdown-bar{background-color:var(--wje-color-success-9)}:host([color="warning"]) .countdown-bar{background-color:var(--wje-color-warning-9)}:host([color="danger"]) .countdown-bar{background-color:var(--wje-color-danger-9)}:host([color="info"]) .countdown-bar{background-color:var(--wje-color-info-9)}:host([color="contrast"]) .countdown-bar{background-color:var(--wje-color-contrast-9)}';
549
147
  }
550
- /**
551
- * Setup attributes for the Button element.
552
- */
553
148
  setupAttributes() {
554
- this.isShadowRoot = "open";
555
- this.setAriaState({
556
- role: "status"
557
- });
149
+ this.isShadowRoot = "open", this.setAriaState({ role: "status" });
558
150
  }
559
- /**
560
- * Draw method for the toast notification.
561
- * @returns {object} Document fragment
562
- */
563
151
  draw() {
564
- let fragment = document.createDocumentFragment();
565
- let native = document.createElement("div");
566
- native.setAttribute("part", "native");
567
- native.classList.add("native-toast");
568
- let mediaSlot = document.createElement("slot");
569
- mediaSlot.setAttribute("name", "media");
570
- mediaSlot.classList.add("media");
571
- mediaSlot.addEventListener("slotchange", () => {
572
- if (WjElementUtils.hasSlotContent(this.context, "media")) {
573
- mediaSlot.parentElement.classList.add("has-media");
574
- } else {
575
- mediaSlot.parentElement.classList.remove("has-media");
576
- }
152
+ let t2 = document.createDocumentFragment(), o2 = document.createElement("div");
153
+ o2.setAttribute("part", "native"), o2.classList.add("native-toast");
154
+ let s2 = document.createElement("slot");
155
+ s2.setAttribute("name", "media"), s2.classList.add("media"), s2.addEventListener("slotchange", () => {
156
+ e.hasSlotContent(this.context, "media") ? s2.parentElement.classList.add("has-media") : s2.parentElement.classList.remove("has-media");
577
157
  });
578
- let content = document.createElement("div");
579
- content.classList.add("content");
580
- content.innerHTML = `<div class="headline">${this.headline}</div><div class="message"><slot></slot></div>`;
581
- let iconX = document.createElement("wje-icon");
582
- iconX.setAttribute("name", "x");
583
- let closeBtn = document.createElement("wje-button");
584
- closeBtn.setAttribute("fill", "link");
585
- closeBtn.setAttribute("color", this.color);
586
- closeBtn.setAttribute("size", "small");
587
- closeBtn.classList.add("close");
588
- closeBtn.setAttribute("label", "Close");
589
- let countdownEl = document.createElement("div");
590
- countdownEl.classList.add("countdown");
591
- let countdownBar = document.createElement("div");
592
- countdownBar.classList.add("countdown-bar");
593
- closeBtn.appendChild(iconX);
594
- countdownEl.appendChild(countdownBar);
595
- if (this.hasAttribute("icon") && this.icon) {
596
- let icon = document.createElement("wje-icon");
597
- icon.setAttribute("name", this.icon);
598
- icon.setAttribute("color", this.color);
599
- icon.setAttribute("slot", "media");
600
- icon.setAttribute("part", "icon");
601
- this.appendChild(icon);
602
- }
603
- native.appendChild(mediaSlot);
604
- native.appendChild(content);
605
- if (this.closable) native.appendChild(closeBtn);
606
- if (this.hasAttribute("countdown")) native.appendChild(countdownEl);
607
- fragment.appendChild(native);
608
- this.closeBtn = closeBtn;
609
- this.countdownBar = countdownBar;
610
- return fragment;
611
- }
612
- /**
613
- * After draw method for the toast notification.
614
- */
158
+ let a2 = document.createElement("div");
159
+ a2.classList.add("content"), a2.innerHTML = `<div class="headline">${this.headline}</div><div class="message"><slot></slot></div>`;
160
+ let r2 = document.createElement("wje-icon");
161
+ r2.setAttribute("name", "x");
162
+ let i2 = document.createElement("wje-button");
163
+ i2.setAttribute("fill", "link"), i2.setAttribute("color", this.color), i2.setAttribute("size", "small"), i2.classList.add("close"), i2.setAttribute("label", "Close");
164
+ let n2 = document.createElement("div");
165
+ n2.classList.add("countdown");
166
+ let c2 = document.createElement("div");
167
+ if (c2.classList.add("countdown-bar"), i2.appendChild(r2), n2.appendChild(c2), this.hasAttribute("icon") && this.icon) {
168
+ let t3 = document.createElement("wje-icon");
169
+ t3.setAttribute("name", this.icon), t3.setAttribute("color", this.color), t3.setAttribute("slot", "media"), t3.setAttribute("part", "icon"), this.appendChild(t3);
170
+ }
171
+ return o2.appendChild(s2), o2.appendChild(a2), this.closable && o2.appendChild(i2), this.hasAttribute("countdown") && o2.appendChild(n2), t2.appendChild(o2), this.closeBtn = i2, this.countdownBar = c2, t2;
172
+ }
615
173
  afterDraw() {
616
- this.closeBtn.addEventListener("wje-button:click", this.hide);
617
- this.addEventListener("mouseenter", this.pause);
618
- this.addEventListener("mouseleave", this.resume);
619
- if (this.hasAttribute("countdown")) {
620
- const startWidth = "100%";
621
- const endWidth = "0";
622
- this.countdownAnimation = this.countdownBar.animate([{ width: startWidth }, { width: endWidth }], {
623
- duration: this.duration,
624
- easing: "linear"
625
- });
626
- }
627
- if (this.duration > 0) {
628
- this.remainingTime = this.duration;
629
- this.startTimer();
174
+ if (this.closeBtn.addEventListener("wje-button:click", this.hide), this.addEventListener("mouseenter", this.pause), this.addEventListener("mouseleave", this.resume), this.hasAttribute("countdown")) {
175
+ const t2 = "100%", e2 = "0";
176
+ this.countdownAnimation = this.countdownBar.animate([{ width: t2 }, { width: e2 }], { duration: this.duration, easing: "linear" });
630
177
  }
178
+ this.duration > 0 && (this.remainingTime = this.duration, this.startTimer());
631
179
  }
632
- /**
633
- * Before disconnect method
634
- * This method is called before the element is disconnected from the document.
635
- */
636
180
  beforeDisconnect() {
637
181
  var _a;
638
- (_a = this.closeBtn) == null ? void 0 : _a.removeEventListener("wje-button:click", this.hide);
639
- this.removeEventListener("wje-toast:after-hide", this.removeChildAndStack);
640
- this.removeEventListener("mouseenter", this.pause);
641
- this.removeEventListener("mouseleave", this.resume);
642
- clearTimeout(this.timeoutID);
643
- }
644
- /**
645
- * Starts the timer.
646
- * This method sets the `startTime` property to the current time and sets
647
- * the `timeoutID` property to the ID of the timeout. The method also
648
- * dispatches the `wje-toast:after-hide` custom event when the timeout
649
- * expires.
650
- */
182
+ (_a = this.closeBtn) == null ? void 0 : _a.removeEventListener("wje-button:click", this.hide), this.removeEventListener("wje-toast:after-hide", this.removeChildAndStack), this.removeEventListener("mouseenter", this.pause), this.removeEventListener("mouseleave", this.resume), clearTimeout(this.timeoutID);
183
+ }
651
184
  startTimer() {
652
- this.startTime = Date.now();
653
- if (this.timeoutID) {
654
- clearTimeout(this.timeoutID);
655
- }
656
- this.isTimerPaused = false;
657
- this.timeoutID = window.setTimeout(() => {
185
+ this.startTime = Date.now(), this.timeoutID && clearTimeout(this.timeoutID), this.isTimerPaused = false, this.timeoutID = window.setTimeout(() => {
658
186
  this.hide();
659
187
  }, this.remainingTime);
660
188
  }
661
- /**
662
- * Stops the timer.
663
- * This method clears the timeout and calculates the remaining time.
664
- * The method is called when the toast notification is paused.
665
- */
666
189
  stopTimer() {
667
- if (!this.timeoutID || this.isTimerPaused) {
668
- return;
669
- }
670
- window.clearTimeout(this.timeoutID);
671
- this.timeoutID = null;
672
- const elapsedTime = Date.now() - this.startTime;
673
- this.remainingTime = Math.max(0, this.remainingTime - elapsedTime);
674
- this.isTimerPaused = true;
675
- }
676
- /**
677
- * Resumes the timer.
678
- * This method resumes the timer if the remaining time is greater
679
- * than zero. The method is called when the toast notification is resumed.
680
- */
190
+ if (!this.timeoutID || this.isTimerPaused) return;
191
+ window.clearTimeout(this.timeoutID), this.timeoutID = null;
192
+ const t2 = Date.now() - this.startTime;
193
+ this.remainingTime = Math.max(0, this.remainingTime - t2), this.isTimerPaused = true;
194
+ }
681
195
  resumeTimer() {
682
- if (this.isTimerPaused && this.remainingTime > 0) {
683
- this.startTimer();
684
- }
196
+ this.isTimerPaused && this.remainingTime > 0 && this.startTimer();
685
197
  }
686
- /**
687
- * Removes the toast notification and the toast stack.
688
- *
689
- * This method removes the toast notification from the toast stack and
690
- * removes the toast stack from the document body if the toast stack is
691
- * empty.
692
- */
693
198
  removeChildAndStack() {
694
- if (this.parentElement === this.toastStack) {
695
- this.toastStack.removeChild(this);
696
- }
697
- this.toastStack.style.setProperty("--wje-toast-stack-layout-duration", "0s");
698
- this.toastStack.style.setProperty("--wje-toast-stack-visual-duration", "0s");
699
- this.updateToastStack(this.toastStack);
700
- requestAnimationFrame(() => {
701
- this.toastStack.style.removeProperty("--wje-toast-stack-layout-duration");
702
- this.toastStack.style.removeProperty("--wje-toast-stack-visual-duration");
703
- });
704
- if (this.toastStack.querySelector("wje-toast") === null) {
705
- this.toastStack.remove();
706
- }
199
+ this.parentElement === this.toastStack && this.toastStack.removeChild(this), this.toastStack.style.setProperty("--wje-toast-stack-layout-duration", "0s"), this.toastStack.style.setProperty("--wje-toast-stack-visual-duration", "0s"), this.updateToastStack(this.toastStack), requestAnimationFrame(() => {
200
+ this.toastStack.style.removeProperty("--wje-toast-stack-layout-duration"), this.toastStack.style.removeProperty("--wje-toast-stack-visual-duration");
201
+ }), null === this.toastStack.querySelector("wje-toast") && this.toastStack.remove();
707
202
  }
708
203
  }
709
- Toast.define("wje-toast", Toast);
204
+ l.define("wje-toast", l);
710
205
  export {
711
- Toast as default
206
+ l as default
712
207
  };
713
208
  //# sourceMappingURL=wje-toast.js.map