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-main.js CHANGED
@@ -1,52 +1,28 @@
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
- const styles = "/*\n[ WJ Main ]\n*/\n\n:host {\n display: block;\n flex: 1;\n flex-basis: auto;\n padding: 1.5rem;\n box-sizing: border-box;\n}\n";
6
- class Main extends WJElement {
7
- /**
8
- * Creates an instance of Main.
9
- * @class
10
- */
4
+ import e from "./wje-element.js";
5
+ class t extends e {
11
6
  constructor() {
12
7
  super();
13
8
  __publicField(this, "className", "Main");
14
9
  }
15
- /**
16
- * Returns the CSS styles for the component.
17
- * @static
18
- * @returns {CSSStyleSheet}
19
- */
20
10
  static get cssStyleSheet() {
21
- return styles;
11
+ return ":host{display:block;flex:1;flex-basis:auto;padding:1.5rem;box-sizing:border-box}";
22
12
  }
23
- /**
24
- * Returns the list of attributes to observe for changes.
25
- * @static
26
- * @returns {Array<string>}
27
- */
28
13
  static get observedAttributes() {
29
14
  return [];
30
15
  }
31
- /**
32
- * Sets up the attributes for the component.
33
- */
34
16
  setupAttributes() {
35
17
  this.isShadowRoot = "open";
36
18
  }
37
- /**
38
- * Draws the component for the main section.
39
- * @returns {DocumentFragment}
40
- */
41
19
  draw() {
42
- let fragment = document.createDocumentFragment();
43
- let element = document.createElement("slot");
44
- fragment.appendChild(element);
45
- return fragment;
20
+ let e2 = document.createDocumentFragment(), t2 = document.createElement("slot");
21
+ return e2.appendChild(t2), e2;
46
22
  }
47
23
  }
48
- Main.define("wje-main", Main);
24
+ t.define("wje-main", t);
49
25
  export {
50
- Main as default
26
+ t as default
51
27
  };
52
28
  //# sourceMappingURL=wje-main.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wje-main.js","sources":["../packages/wje-main/main.element.js","../packages/wje-main/main.js"],"sourcesContent":["import { default as WJElement } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Main` is a custom web component that represents a main section.\n * It extends from `WJElement`.\n * @summary This element represents a main section.\n * @documentation https://elements.webjet.sk/components/main\n * @status stable\n * @augments {WJElement}\n * @slot - The default slot for the main section.\n * @tag wje-main\n */\n\nexport default class Main extends WJElement {\n /**\n * Creates an instance of Main.\n * @class\n */\n constructor() {\n super();\n }\n\n className = 'Main';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return [];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draws the component for the main section.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let element = document.createElement('slot');\n fragment.appendChild(element);\n\n return fragment;\n }\n}\n","import Main from './main.element.js';\n\nexport default Main;\n\nMain.define('wje-main', Main);\n"],"names":[],"mappings":";;;;;AAce,MAAM,aAAa,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAKxC,cAAc;AACV,UAAK;AAGT,qCAAY;AAAA,EAFZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,WAAW,gBAAgB;AACvB,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,WAAW,qBAAqB;AAC5B,WAAO,CAAA;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAKA,kBAAkB;AACd,SAAK,eAAe;AAAA,EACxB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAO;AACH,QAAI,WAAW,SAAS,uBAAsB;AAE9C,QAAI,UAAU,SAAS,cAAc,MAAM;AAC3C,aAAS,YAAY,OAAO;AAE5B,WAAO;AAAA,EACX;AACJ;AC1DA,KAAK,OAAO,YAAY,IAAI;"}
1
+ {"version":3,"file":"wje-main.js","sources":["../packages/wje-main/main.element.js","../packages/wje-main/main.js"],"sourcesContent":["import { default as WJElement } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Main` is a custom web component that represents a main section.\n * It extends from `WJElement`.\n * @summary This element represents a main section.\n * @documentation https://elements.webjet.sk/components/main\n * @status stable\n * @augments {WJElement}\n * @slot - The default slot for the main section.\n * @tag wje-main\n */\n\nexport default class Main extends WJElement {\n /**\n * Creates an instance of Main.\n * @class\n */\n constructor() {\n super();\n }\n\n className = 'Main';\n\n /**\n * Returns the CSS styles for the component.\n * @static\n * @returns {CSSStyleSheet}\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Returns the list of attributes to observe for changes.\n * @static\n * @returns {Array<string>}\n */\n static get observedAttributes() {\n return [];\n }\n\n /**\n * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draws the component for the main section.\n * @returns {DocumentFragment}\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let element = document.createElement('slot');\n fragment.appendChild(element);\n\n return fragment;\n }\n}\n","import Main from './main.element.js';\n\nexport default Main;\n\nMain.define('wje-main', Main);\n"],"names":["Main","WJElement","constructor","super","className","cssStyleSheet","setupAttributes","this","isShadowRoot","draw","fragment","document","createDocumentFragment","element","createElement","appendChild","define"],"mappings":";;;;AAce,MAAMA,UAAaC,EAAAA;AAAAA,EAK9B,cAAAC;AACIC,UAAAA;AAGJC,qCAAY;AAAA,EAFZ;AAAA,EASA,2BAAWC;AACP;EACJ;AAAA,EAOA,WAAA;AACI,WAAO,CAAA;AAAA,EACX;AAAA,EAKA,kBAAAC;AACIC,SAAKC,eAAe;AAAA,EACxB;AAAA,EAMA,OAAAC;AACI,QAAIC,KAAWC,SAASC,0BAEpBC,KAAUF,SAASG,cAAc,MAAA;AAGrC,WAFAJ,GAASK,YAAYF,EAAAA,GAEdH;AAAAA,EACX;AAAA;ACzDJV,EAAKgB,OAAO,YAAYhB,CAAAA;"}
@@ -1,267 +1,122 @@
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
- const DEFAULT_DEBOUNCE_MS = 300;
6
- const COL_COUNT_CSS_VAR_NAME = `--wje-masonry-layout-col-count`;
7
- const GAP_CSS_VAR_NAME = `--wje-masonry-layout-gap`;
8
- const ELEMENT_NODE_TYPE = 1;
9
- const DEBOUNCE_MAP = /* @__PURE__ */ new Map();
10
- function getNumberAttribute($elem, name, defaultValue) {
11
- const value = parseFloat($elem.getAttribute(name) || "");
12
- return isNaN(value) ? defaultValue : value;
4
+ import t from "./wje-element.js";
5
+ const e = /* @__PURE__ */ new Map();
6
+ function s(t2, e2, s2) {
7
+ const o2 = parseFloat(t2.getAttribute(e2) || "");
8
+ return isNaN(o2) ? s2 : o2;
13
9
  }
14
- function getColCount(totalWidth, cols, maxColWidth) {
15
- return isNaN(cols) ? Math.max(1, Math.ceil(totalWidth / maxColWidth)) : cols;
10
+ function o(t2, e2, s2) {
11
+ return isNaN(e2) ? Math.max(1, Math.ceil(t2 / s2)) : e2;
16
12
  }
17
- function debounce(cb, ms, id) {
18
- const existingTimeout = DEBOUNCE_MAP.get(id);
19
- if (existingTimeout !== null && existingTimeout !== void 0) window.clearTimeout(existingTimeout);
20
- DEBOUNCE_MAP.set(id, window.setTimeout(cb, ms));
13
+ function i(t2) {
14
+ let e2 = 0, s2 = 1 / 0;
15
+ return t2.forEach((t3, o2) => {
16
+ t3 < s2 && (s2 = t3, e2 = o2);
17
+ }), e2;
21
18
  }
22
- function findSmallestColIndex(colHeights) {
23
- let smallestIndex = 0;
24
- let smallestHeight = Infinity;
25
- colHeights.forEach((height, i) => {
26
- if (height < smallestHeight) {
27
- smallestHeight = height;
28
- smallestIndex = i;
29
- }
30
- });
31
- return smallestIndex;
32
- }
33
- const styles = "/*\n[ WJ Masonry ]\n*/\n\n:host {\n display: flex;\n align-items: flex-start;\n justify-content: stretch;\n width: 100%;\n}\n\n.column {\n max-width: calc(\n (\n 100% / var(--wje-masonry-layout-col-count, 1) -\n (\n (\n var(--wje-masonry-layout-gap, 1rem) * (var(--wje-masonry-layout-col-count, 1) - 1) /\n var(--wje-masonry-layout-col-count, 1)\n )\n )\n )\n );\n width: 100%;\n flex: 1;\n display: flex;\n flex-direction: column;\n}\n\n.column:not(:last-child) {\n margin-inline-end: var(--wje-masonry-layout-gap, 1rem);\n}\n\n.column ::slotted(*) {\n margin-block-end: var(--wje-masonry-layout-gap, 1rem);\n box-sizing: border-box;\n width: 100%;\n}\n\n/* Hide the items that has not yet found the correct slot */\n#unset-items {\n opacity: 0;\n position: absolute;\n pointer-events: none;\n}\n";
34
- class Masonry extends WJElement {
35
- /**
36
- * Constructor for the Masonry class.
37
- */
19
+ class n extends t {
38
20
  constructor() {
39
21
  super();
40
22
  __publicField(this, "debounceId", `layout_${Math.random()}`);
41
23
  __publicField(this, "ro");
42
24
  __publicField(this, "className", "Masonry");
43
- /**
44
- * Called when the slot changes.
45
- */
46
25
  __publicField(this, "onSlotChange", () => {
47
- const $unsetElements = (this.unsetSlot.assignedNodes() || []).filter(
48
- (node) => node.nodeType === ELEMENT_NODE_TYPE
49
- );
50
- if ($unsetElements.length > 0) {
51
- this.layout();
52
- }
26
+ (this.unsetSlot.assignedNodes() || []).filter((t2) => 1 === t2.nodeType).length > 0 && this.layout();
53
27
  });
54
- /**
55
- * Called when the window resizes.
56
- * @param {Array} entries The entries to use.
57
- */
58
- __publicField(this, "onResize", (entries) => {
59
- const { width } = entries !== null && entries !== void 0 && Array.isArray(entries) && entries.length > 0 ? entries[0].contentRect : { width: this.offsetWidth };
60
- const colCount = getColCount(width, this.cols, this.maxColWidth);
61
- if (colCount !== this.columns.length) {
62
- this.scheduleLayout();
63
- }
28
+ __publicField(this, "onResize", (t2) => {
29
+ const { width: e2 } = null != t2 && Array.isArray(t2) && t2.length > 0 ? t2[0].contentRect : { width: this.offsetWidth };
30
+ o(e2, this.cols, this.maxColWidth) !== this.columns.length && this.scheduleLayout();
64
31
  });
65
- /**
66
- * Lays out the element.
67
- */
68
32
  __publicField(this, "layout", () => {
69
- if (this.currentRequestAnimationFrameCallback !== null && this.currentRequestAnimationFrameCallback !== void 0) {
70
- window.cancelAnimationFrame(this.currentRequestAnimationFrameCallback);
71
- }
72
- this.currentRequestAnimationFrameCallback = requestAnimationFrame(() => {
73
- const gap = this.gap;
74
- const $elements = Array.from(this.children).filter((node) => node.nodeType === ELEMENT_NODE_TYPE);
75
- const colCount = getColCount(this.offsetWidth, this.cols, this.maxColWidth);
76
- const colHeights = Array(colCount).fill(0);
77
- const writes = [];
78
- for (const elem of $elements) {
79
- const height = elem.getBoundingClientRect().height;
80
- let smallestColIndex = findSmallestColIndex(colHeights);
81
- colHeights[smallestColIndex] += height + +gap;
82
- const newSlot = smallestColIndex;
83
- if (elem.slot !== newSlot) {
84
- writes.push(() => elem.slot = newSlot);
85
- }
86
- }
87
- for (const write of writes) {
88
- write();
33
+ null !== this.currentRequestAnimationFrameCallback && void 0 !== this.currentRequestAnimationFrameCallback && window.cancelAnimationFrame(this.currentRequestAnimationFrameCallback), this.currentRequestAnimationFrameCallback = requestAnimationFrame(() => {
34
+ const t2 = this.gap, e2 = Array.from(this.children).filter((t3) => 1 === t3.nodeType), s2 = o(this.offsetWidth, this.cols, this.maxColWidth), n2 = Array(s2).fill(0), r = [];
35
+ for (const s3 of e2) {
36
+ const e3 = s3.getBoundingClientRect().height;
37
+ let o2 = i(n2);
38
+ n2[o2] += e3 + +t2;
39
+ const a = o2;
40
+ s3.slot !== a && r.push(() => s3.slot = a);
89
41
  }
90
- this.renderCols(colCount);
42
+ for (const t3 of r) t3();
43
+ this.renderCols(s2);
91
44
  });
92
45
  });
93
- this.debounceId = `layout_${Math.random()}`;
94
- this.ro = void 0;
95
- this.currentRequestAnimationFrameCallback = void 0;
96
- this.unsetSlot = void 0;
46
+ this.debounceId = `layout_${Math.random()}`, this.ro = void 0, this.currentRequestAnimationFrameCallback = void 0, this.unsetSlot = void 0;
97
47
  }
98
- /**
99
- * Setter for the maxColWidth property.
100
- * @param {number} value The maximum column width.
101
- */
102
- set maxColWidth(value) {
103
- this.setAttribute("max-col-width", value);
48
+ set maxColWidth(t2) {
49
+ this.setAttribute("max-col-width", t2);
104
50
  }
105
- /**
106
- * Getter for the maxColWidth property.
107
- * @returns {number} The maximum column width.
108
- */
109
51
  get maxColWidth() {
110
52
  return this.hasAttribute("max-col-width") ? +this.getAttribute("max-col-width") : 500;
111
53
  }
112
- /**
113
- * Setter for the cols property.
114
- * @param {number} value The number of columns.
115
- */
116
- set cols(value) {
117
- if (this.hasAttribute("cols")) this.setAttribute("cols", value);
118
- else this.setAttribute("cols", "auto");
54
+ set cols(t2) {
55
+ this.hasAttribute("cols") ? this.setAttribute("cols", t2) : this.setAttribute("cols", "auto");
119
56
  }
120
- /**
121
- * Getter for the cols property.
122
- * @returns {number} The number of columns.
123
- */
124
57
  get cols() {
125
- return getNumberAttribute(this, "cols", "auto");
58
+ return s(this, "cols", "auto");
126
59
  }
127
- /**
128
- * Setter for the gap property.
129
- * @param {number} value The gap between columns.
130
- */
131
- set gap(value) {
132
- this.setAttribute("gap", value);
60
+ set gap(t2) {
61
+ this.setAttribute("gap", t2);
133
62
  }
134
- /**
135
- * Getter for the gap property.
136
- * @returns {number} The gap between columns.
137
- */
138
63
  get gap() {
139
- return getNumberAttribute(this, "gap", "24");
64
+ return s(this, "gap", "24");
140
65
  }
141
- /**
142
- * Setter for the debounce property.
143
- * @param {number} value The debounce time.
144
- */
145
- set debounce(value) {
146
- this.setAttribute("debounce", value);
66
+ set debounce(t2) {
67
+ this.setAttribute("debounce", t2);
147
68
  }
148
- /**
149
- * Getter for the debounce property.
150
- * @returns {number} The debounce time.
151
- */
152
69
  get debounce() {
153
- return getNumberAttribute(this, "debounce", DEFAULT_DEBOUNCE_MS);
70
+ return s(this, "debounce", 300);
154
71
  }
155
- /**
156
- * Getter for the columns property.
157
- * @returns {Array} An array of all the columns.
158
- */
159
72
  get columns() {
160
- return Array.from(this.shadowRoot.querySelectorAll(`.column`));
73
+ return Array.from(this.shadowRoot.querySelectorAll(".column"));
161
74
  }
162
- /**
163
- * Getter for the cssStyleSheet property.
164
- * @static
165
- * @returns {CSSStyleSheet} The CSS style sheet for the masonry layout.
166
- */
167
75
  static get cssStyleSheet() {
168
- return styles;
76
+ return ":host{display:flex;align-items:flex-start;justify-content:stretch;width:100%}.column{max-width:calc((100% / var(--wje-masonry-layout-col-count, 1) - ((var(--wje-masonry-layout-gap, 1rem) * (var(--wje-masonry-layout-col-count, 1) - 1) / var(--wje-masonry-layout-col-count, 1)))));width:100%;flex:1;display:flex;flex-direction:column}.column:not(:last-child){margin-inline-end:var(--wje-masonry-layout-gap, 1rem)}.column ::slotted(*){margin-block-end:var(--wje-masonry-layout-gap, 1rem);box-sizing:border-box;width:100%}#unset-items{opacity:0;position:absolute;pointer-events:none}";
169
77
  }
170
- /**
171
- * Getter for the observedAttributes property.
172
- * @returns {Array} An array of the observed attributes.
173
- */
174
78
  static get observedAttributes() {
175
79
  return ["max-col-width", "gap", "cols"];
176
80
  }
177
- /**
178
- * Callback for when an attribute changes.
179
- */
180
- attributeChangedCallback(name, old, newName) {
181
- switch (name) {
182
- case "gap":
183
- this.style.setProperty(GAP_CSS_VAR_NAME, `${this.gap}px`);
184
- break;
185
- }
81
+ attributeChangedCallback(t2, e2, s2) {
82
+ if ("gap" === t2) this.style.setProperty("--wje-masonry-layout-gap", `${this.gap}px`);
186
83
  this.scheduleLayout();
187
84
  }
188
- /**
189
- * Callback for when the element is disconnected.
190
- */
191
85
  beforeDisconnect() {
192
- this.unsetSlot.removeEventListener("slotchange", this.onSlotChange);
193
- window.removeEventListener("resize", this.onResize);
194
- if (this.ro !== null && this.ro !== void 0) {
195
- this.ro.unobserve(this);
196
- }
86
+ this.unsetSlot.removeEventListener("slotchange", this.onSlotChange), window.removeEventListener("resize", this.onResize), null !== this.ro && void 0 !== this.ro && this.ro.unobserve(this);
197
87
  }
198
- /**
199
- * Sets up the attributes for the element.
200
- */
201
88
  setupAttributes() {
202
89
  this.isShadowRoot = "open";
203
90
  }
204
- /**
205
- * Draws the element for the masonry layout.
206
- * @returns {DocumentFragment} The drawn element.
207
- */
208
91
  draw() {
209
- let fragment = document.createDocumentFragment();
210
- let native = document.createElement("div");
211
- native.setAttribute("id", "unset-items");
212
- native.setAttribute("part", "native");
213
- let unsetSlot = document.createElement("slot");
214
- native.appendChild(unsetSlot);
215
- this.unsetSlot = unsetSlot;
216
- this.native = native;
217
- fragment.appendChild(native);
218
- return fragment;
92
+ let t2 = document.createDocumentFragment(), e2 = document.createElement("div");
93
+ e2.setAttribute("id", "unset-items"), e2.setAttribute("part", "native");
94
+ let s2 = document.createElement("slot");
95
+ return e2.appendChild(s2), this.unsetSlot = s2, this.native = e2, t2.appendChild(e2), t2;
219
96
  }
220
- /**
221
- * Called after the element is drawn.
222
- */
223
97
  afterDraw() {
224
- this.onSlotChange();
225
- this.onResize();
226
- this.layout();
227
- this.unsetSlot.addEventListener("slotchange", this.onSlotChange);
228
- if ("ResizeObserver" in window) {
229
- this.ro = new ResizeObserver(this.onResize);
230
- this.ro.observe(this);
231
- } else {
232
- window.addEventListener("resize", this.onResize);
233
- }
234
- }
235
- /**
236
- * Renders the columns.
237
- * @param {number} colCount The number of columns to render.
238
- */
239
- renderCols(colCount) {
240
- const columns = this.columns;
241
- if (columns.length === colCount) {
242
- return;
243
- }
244
- for (let i = 0; i < colCount; i++) {
245
- const column = document.createElement("div");
246
- column.classList.add("column");
247
- column.setAttribute("part", `column column-${i}`);
248
- const slot = document.createElement("slot");
249
- slot.setAttribute("name", i);
250
- column.appendChild(slot);
251
- this.context.appendChild(column);
98
+ this.onSlotChange(), this.onResize(), this.layout(), this.unsetSlot.addEventListener("slotchange", this.onSlotChange), "ResizeObserver" in window ? (this.ro = new ResizeObserver(this.onResize), this.ro.observe(this)) : window.addEventListener("resize", this.onResize);
99
+ }
100
+ renderCols(t2) {
101
+ if (this.columns.length !== t2) {
102
+ for (let e2 = 0; e2 < t2; e2++) {
103
+ const t3 = document.createElement("div");
104
+ t3.classList.add("column"), t3.setAttribute("part", `column column-${e2}`);
105
+ const s2 = document.createElement("slot");
106
+ s2.setAttribute("name", e2), t3.appendChild(s2), this.context.appendChild(t3);
107
+ }
108
+ this.style.setProperty("--wje-masonry-layout-col-count", t2);
252
109
  }
253
- this.style.setProperty(COL_COUNT_CSS_VAR_NAME, colCount);
254
110
  }
255
- /**
256
- * Schedules a layout.
257
- * @param {number} ms The number of milliseconds to wait before laying out.
258
- */
259
- scheduleLayout(ms = this.debounce) {
260
- debounce(this.layout, ms, this.debounceId);
111
+ scheduleLayout(t2 = this.debounce) {
112
+ !(function(t3, s2, o2) {
113
+ const i2 = e.get(o2);
114
+ null != i2 && window.clearTimeout(i2), e.set(o2, window.setTimeout(t3, s2));
115
+ })(this.layout, t2, this.debounceId);
261
116
  }
262
117
  }
263
- Masonry.define("wje-masonry", Masonry);
118
+ n.define("wje-masonry", n);
264
119
  export {
265
- Masonry as default
120
+ n as default
266
121
  };
267
122
  //# sourceMappingURL=wje-masonry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wje-masonry.js","sources":["../packages/wje-masonry/service/service.js","../packages/wje-masonry/masonry.element.js","../packages/wje-masonry/masonry.js"],"sourcesContent":["export const DEFAULT_MAX_COL_WIDTH = 500;\nexport const DEFAULT_DEBOUNCE_MS = 300;\n\nexport const COL_COUNT_CSS_VAR_NAME = `--wje-masonry-layout-col-count`;\nexport const GAP_CSS_VAR_NAME = `--wje-masonry-layout-gap`;\n\nexport const ELEMENT_NODE_TYPE = 1;\n\nconst DEBOUNCE_MAP = new Map();\n\n/**\n * Returns a number attribute from an element.\n * @param $elem\n * @param name\n * @param defaultValue\n * @returns {string|number}\n */\nexport function getNumberAttribute($elem, name, defaultValue) {\n const value = parseFloat($elem.getAttribute(name) || '');\n return isNaN(value) ? defaultValue : value;\n}\n\n/**\n * Returns the amount of cols that the masonry grid should have.\n * @param totalWidth\n * @param cols\n * @param maxColWidth\n */\nexport function getColCount(totalWidth, cols, maxColWidth) {\n return isNaN(cols) ? Math.max(1, Math.ceil(totalWidth / maxColWidth)) : cols;\n}\n\n/**\n * Debounces a function.\n * @param cb\n * @param ms\n * @param id\n */\nexport function debounce(cb, ms, id) {\n const existingTimeout = DEBOUNCE_MAP.get(id);\n if (existingTimeout !== null && existingTimeout !== undefined) window.clearTimeout(existingTimeout);\n DEBOUNCE_MAP.set(id, window.setTimeout(cb, ms));\n}\n\n/**\n * Returns the index of the column with the smallest height.\n * @param colHeights\n */\nexport function findSmallestColIndex(colHeights) {\n let smallestIndex = 0;\n let smallestHeight = Infinity;\n\n colHeights.forEach((height, i) => {\n if (height < smallestHeight) {\n smallestHeight = height;\n smallestIndex = i;\n }\n });\n\n return smallestIndex;\n}\n","import { default as WJElement } from '../wje-element/element.js';\nimport {\n COL_COUNT_CSS_VAR_NAME,\n debounce,\n DEFAULT_DEBOUNCE_MS,\n DEFAULT_MAX_COL_WIDTH,\n ELEMENT_NODE_TYPE,\n findSmallestColIndex,\n GAP_CSS_VAR_NAME,\n getColCount,\n getNumberAttribute,\n} from './service/service.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Masonry` is a custom web component that represents a masonry layout.\n * It extends from `WJElement`.\n * @summary This element represents a masonry layout.\n * @documentation https://elements.webjet.sk/components/masonry\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part of the masonry layout.\n * @csspart column - The individual columns in the masonry layout.\n * @slot - The default slot for the masonry layout.\n * @cssproperty [--wje-masonry-layout-gap=1rem] - The gap between items in the masonry layout. Accepts any valid CSS length. Default is 1rem.\n * @cssproperty [--wje-masonry-layout-col-count=1] - The count column in the masonry layout. Accepts any valid CSS length.\n * @tag wje-masonry\n */\nexport default class Masonry extends WJElement {\n /**\n * Constructor for the Masonry class.\n */\n constructor() {\n super();\n\n this.debounceId = `layout_${Math.random()}`;\n this.ro = undefined;\n this.currentRequestAnimationFrameCallback = undefined;\n this.unsetSlot = undefined;\n }\n\n /**\n * Setter for the maxColWidth property.\n * @param {number} value The maximum column width.\n */\n set maxColWidth(value) {\n this.setAttribute('max-col-width', value);\n }\n\n /**\n * Getter for the maxColWidth property.\n * @returns {number} The maximum column width.\n */\n get maxColWidth() {\n return this.hasAttribute('max-col-width') ? +this.getAttribute('max-col-width') : +DEFAULT_MAX_COL_WIDTH;\n }\n\n /**\n * Setter for the cols property.\n * @param {number} value The number of columns.\n */\n set cols(value) {\n if (this.hasAttribute('cols')) this.setAttribute('cols', value);\n else this.setAttribute('cols', 'auto');\n }\n\n /**\n * Getter for the cols property.\n * @returns {number} The number of columns.\n */\n get cols() {\n return getNumberAttribute(this, 'cols', 'auto');\n }\n\n /**\n * Setter for the gap property.\n * @param {number} value The gap between columns.\n */\n set gap(value) {\n this.setAttribute('gap', value);\n }\n\n /**\n * Getter for the gap property.\n * @returns {number} The gap between columns.\n */\n get gap() {\n return getNumberAttribute(this, 'gap', '24');\n }\n\n /**\n * Setter for the debounce property.\n * @param {number} value The debounce time.\n */\n set debounce(value) {\n this.setAttribute('debounce', value);\n }\n\n /**\n * Getter for the debounce property.\n * @returns {number} The debounce time.\n */\n get debounce() {\n return getNumberAttribute(this, 'debounce', DEFAULT_DEBOUNCE_MS);\n }\n\n /**\n * Getter for the columns property.\n * @returns {Array} An array of all the columns.\n */\n get columns() {\n return Array.from(this.shadowRoot.querySelectorAll(`.column`));\n }\n\n debounceId = `layout_${Math.random()}`;\n\n ro = undefined;\n\n className = 'Masonry';\n\n /**\n * Getter for the cssStyleSheet property.\n * @static\n * @returns {CSSStyleSheet} The CSS style sheet for the masonry layout.\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Getter for the observedAttributes property.\n * @returns {Array} An array of the observed attributes.\n */\n static get observedAttributes() {\n return ['max-col-width', 'gap', 'cols'];\n }\n\n /**\n * Callback for when an attribute changes.\n */\n attributeChangedCallback(name, old, newName) {\n switch (name) {\n case 'gap':\n this.style.setProperty(GAP_CSS_VAR_NAME, `${this.gap}px`);\n break;\n }\n\n this.scheduleLayout();\n }\n\n /**\n * Callback for when the element is disconnected.\n */\n beforeDisconnect() {\n this.unsetSlot.removeEventListener('slotchange', this.onSlotChange);\n window.removeEventListener('resize', this.onResize);\n if (this.ro !== null && this.ro !== undefined) {\n this.ro.unobserve(this);\n }\n }\n\n /**\n * Sets up the attributes for the element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draws the element for the masonry layout.\n * @returns {DocumentFragment} The drawn element.\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('id', 'unset-items');\n native.setAttribute('part', 'native');\n\n let unsetSlot = document.createElement('slot');\n\n native.appendChild(unsetSlot);\n\n this.unsetSlot = unsetSlot;\n this.native = native;\n\n fragment.appendChild(native);\n\n return fragment;\n }\n\n /**\n * Called after the element is drawn.\n */\n afterDraw() {\n this.onSlotChange();\n this.onResize();\n this.layout();\n\n this.unsetSlot.addEventListener('slotchange', this.onSlotChange);\n\n if ('ResizeObserver' in window) {\n this.ro = new ResizeObserver(this.onResize);\n this.ro.observe(this);\n } else {\n window.addEventListener('resize', this.onResize);\n }\n }\n\n /**\n * Called when the slot changes.\n */\n onSlotChange = () => {\n const $unsetElements = (this.unsetSlot.assignedNodes() || []).filter(\n (node) => node.nodeType === ELEMENT_NODE_TYPE\n );\n if ($unsetElements.length > 0) {\n this.layout();\n }\n };\n\n /**\n * Called when the window resizes.\n * @param {Array} entries The entries to use.\n */\n onResize = (entries) => {\n const { width } =\n entries !== null && entries !== undefined && Array.isArray(entries) && entries.length > 0\n ? entries[0].contentRect\n : { width: this.offsetWidth };\n const colCount = getColCount(width, this.cols, this.maxColWidth);\n if (colCount !== this.columns.length) {\n this.scheduleLayout();\n }\n };\n\n /**\n * Renders the columns.\n * @param {number} colCount The number of columns to render.\n */\n renderCols(colCount) {\n const columns = this.columns;\n\n if (columns.length === colCount) {\n return;\n }\n\n for (let i = 0; i < colCount; i++) {\n const column = document.createElement('div');\n column.classList.add('column');\n column.setAttribute('part', `column column-${i}`);\n\n const slot = document.createElement('slot');\n slot.setAttribute('name', i);\n\n column.appendChild(slot);\n\n this.context.appendChild(column);\n }\n\n this.style.setProperty(COL_COUNT_CSS_VAR_NAME, colCount);\n }\n\n /**\n * Schedules a layout.\n * @param {number} ms The number of milliseconds to wait before laying out.\n */\n scheduleLayout(ms = this.debounce) {\n debounce(this.layout, ms, this.debounceId);\n }\n\n /**\n * Lays out the element.\n */\n layout = () => {\n if (\n this.currentRequestAnimationFrameCallback !== null &&\n this.currentRequestAnimationFrameCallback !== undefined\n ) {\n window.cancelAnimationFrame(this.currentRequestAnimationFrameCallback);\n }\n\n this.currentRequestAnimationFrameCallback = requestAnimationFrame(() => {\n const gap = this.gap;\n const $elements = Array.from(this.children).filter((node) => node.nodeType === ELEMENT_NODE_TYPE);\n const colCount = getColCount(this.offsetWidth, this.cols, this.maxColWidth);\n const colHeights = Array(colCount).fill(0);\n const writes = [];\n\n for (const elem of $elements) {\n const height = elem.getBoundingClientRect().height;\n let smallestColIndex = findSmallestColIndex(colHeights);\n\n colHeights[smallestColIndex] += height + +gap;\n\n const newSlot = smallestColIndex;\n\n if (elem.slot !== newSlot) {\n writes.push(() => (elem.slot = newSlot));\n }\n }\n\n for (const write of writes) {\n write();\n }\n\n this.renderCols(colCount);\n });\n };\n}\n","import Masonry from './masonry.element.js';\n\nexport default Masonry;\n\nMasonry.define('wje-masonry', Masonry);\n"],"names":[],"mappings":";;;;AACO,MAAM,sBAAsB;AAE5B,MAAM,yBAAyB;AAC/B,MAAM,mBAAmB;AAEzB,MAAM,oBAAoB;AAEjC,MAAM,eAAe,oBAAI,IAAG;AASrB,SAAS,mBAAmB,OAAO,MAAM,cAAc;AAC1D,QAAM,QAAQ,WAAW,MAAM,aAAa,IAAI,KAAK,EAAE;AACvD,SAAO,MAAM,KAAK,IAAI,eAAe;AACzC;AAQO,SAAS,YAAY,YAAY,MAAM,aAAa;AACvD,SAAO,MAAM,IAAI,IAAI,KAAK,IAAI,GAAG,KAAK,KAAK,aAAa,WAAW,CAAC,IAAI;AAC5E;AAQO,SAAS,SAAS,IAAI,IAAI,IAAI;AACjC,QAAM,kBAAkB,aAAa,IAAI,EAAE;AAC3C,MAAI,oBAAoB,QAAQ,oBAAoB,OAAW,QAAO,aAAa,eAAe;AAClG,eAAa,IAAI,IAAI,OAAO,WAAW,IAAI,EAAE,CAAC;AAClD;AAMO,SAAS,qBAAqB,YAAY;AAC7C,MAAI,gBAAgB;AACpB,MAAI,iBAAiB;AAErB,aAAW,QAAQ,CAAC,QAAQ,MAAM;AAC9B,QAAI,SAAS,gBAAgB;AACzB,uBAAiB;AACjB,sBAAgB;AAAA,IACpB;AAAA,EACJ,CAAC;AA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iBAAiB,cAAc,KAAK,YAAY;AAE/D,QAAI,oBAAoB,QAAQ;AAC5B,WAAK,KAAK,IAAI,eAAe,KAAK,QAAQ;AAC1C,WAAK,GAAG,QAAQ,IAAI;AAAA,IACxB,OAAO;AACH,aAAO,iBAAiB,UAAU,KAAK,QAAQ;AAAA,IACnD;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA,EAiCA,WAAW,UAAU;AACjB,UAAM,UAAU,KAAK;AAErB,QAAI,QAAQ,WAAW,UAAU;AAC7B;AAAA,IACJ;AAEA,aAAS,IAAI,GAAG,IAAI,UAAU,KAAK;AAC/B,YAAM,SAAS,SAAS,cAAc,KAAK;AAC3C,aAAO,UAAU,IAAI,QAAQ;AAC7B,aAAO,aAAa,QAAQ,iBAAiB,CAAC,EAAE;AAEhD,YAAM,OAAO,SAAS,cAAc,MAAM;AAC1C,WAAK,aAAa,QAAQ,CAAC;AAE3B,aAAO,YAAY,IAAI;AAEvB,WAAK,QAAQ,YAAY,MAAM;AAAA,IACnC;AAEA,SAAK,MAAM,YAAY,wBAAwB,QAAQ;AAAA,EAC3D;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,eAAe,KAAK,KAAK,UAAU;AAC/B,aAAS,KAAK,QAAQ,IAAI,KAAK,UAAU;AAAA,EAC7C;AAwCJ;ACjTA,QAAQ,OAAO,eAAe,OAAO;"}
1
+ {"version":3,"file":"wje-masonry.js","sources":["../packages/wje-masonry/service/service.js","../packages/wje-masonry/masonry.element.js","../packages/wje-masonry/masonry.js"],"sourcesContent":["export const DEFAULT_MAX_COL_WIDTH = 500;\nexport const DEFAULT_DEBOUNCE_MS = 300;\n\nexport const COL_COUNT_CSS_VAR_NAME = `--wje-masonry-layout-col-count`;\nexport const GAP_CSS_VAR_NAME = `--wje-masonry-layout-gap`;\n\nexport const ELEMENT_NODE_TYPE = 1;\n\nconst DEBOUNCE_MAP = new Map();\n\n/**\n * Returns a number attribute from an element.\n * @param $elem\n * @param name\n * @param defaultValue\n * @returns {string|number}\n */\nexport function getNumberAttribute($elem, name, defaultValue) {\n const value = parseFloat($elem.getAttribute(name) || '');\n return isNaN(value) ? defaultValue : value;\n}\n\n/**\n * Returns the amount of cols that the masonry grid should have.\n * @param totalWidth\n * @param cols\n * @param maxColWidth\n */\nexport function getColCount(totalWidth, cols, maxColWidth) {\n return isNaN(cols) ? Math.max(1, Math.ceil(totalWidth / maxColWidth)) : cols;\n}\n\n/**\n * Debounces a function.\n * @param cb\n * @param ms\n * @param id\n */\nexport function debounce(cb, ms, id) {\n const existingTimeout = DEBOUNCE_MAP.get(id);\n if (existingTimeout !== null && existingTimeout !== undefined) window.clearTimeout(existingTimeout);\n DEBOUNCE_MAP.set(id, window.setTimeout(cb, ms));\n}\n\n/**\n * Returns the index of the column with the smallest height.\n * @param colHeights\n */\nexport function findSmallestColIndex(colHeights) {\n let smallestIndex = 0;\n let smallestHeight = Infinity;\n\n colHeights.forEach((height, i) => {\n if (height < smallestHeight) {\n smallestHeight = height;\n smallestIndex = i;\n }\n });\n\n return smallestIndex;\n}\n","import { default as WJElement } from '../wje-element/element.js';\nimport {\n COL_COUNT_CSS_VAR_NAME,\n debounce,\n DEFAULT_DEBOUNCE_MS,\n DEFAULT_MAX_COL_WIDTH,\n ELEMENT_NODE_TYPE,\n findSmallestColIndex,\n GAP_CSS_VAR_NAME,\n getColCount,\n getNumberAttribute,\n} from './service/service.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Masonry` is a custom web component that represents a masonry layout.\n * It extends from `WJElement`.\n * @summary This element represents a masonry layout.\n * @documentation https://elements.webjet.sk/components/masonry\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part of the masonry layout.\n * @csspart column - The individual columns in the masonry layout.\n * @slot - The default slot for the masonry layout.\n * @cssproperty [--wje-masonry-layout-gap=1rem] - The gap between items in the masonry layout. Accepts any valid CSS length. Default is 1rem.\n * @cssproperty [--wje-masonry-layout-col-count=1] - The count column in the masonry layout. Accepts any valid CSS length.\n * @tag wje-masonry\n */\nexport default class Masonry extends WJElement {\n /**\n * Constructor for the Masonry class.\n */\n constructor() {\n super();\n\n this.debounceId = `layout_${Math.random()}`;\n this.ro = undefined;\n this.currentRequestAnimationFrameCallback = undefined;\n this.unsetSlot = undefined;\n }\n\n /**\n * Setter for the maxColWidth property.\n * @param {number} value The maximum column width.\n */\n set maxColWidth(value) {\n this.setAttribute('max-col-width', value);\n }\n\n /**\n * Getter for the maxColWidth property.\n * @returns {number} The maximum column width.\n */\n get maxColWidth() {\n return this.hasAttribute('max-col-width') ? +this.getAttribute('max-col-width') : +DEFAULT_MAX_COL_WIDTH;\n }\n\n /**\n * Setter for the cols property.\n * @param {number} value The number of columns.\n */\n set cols(value) {\n if (this.hasAttribute('cols')) this.setAttribute('cols', value);\n else this.setAttribute('cols', 'auto');\n }\n\n /**\n * Getter for the cols property.\n * @returns {number} The number of columns.\n */\n get cols() {\n return getNumberAttribute(this, 'cols', 'auto');\n }\n\n /**\n * Setter for the gap property.\n * @param {number} value The gap between columns.\n */\n set gap(value) {\n this.setAttribute('gap', value);\n }\n\n /**\n * Getter for the gap property.\n * @returns {number} The gap between columns.\n */\n get gap() {\n return getNumberAttribute(this, 'gap', '24');\n }\n\n /**\n * Setter for the debounce property.\n * @param {number} value The debounce time.\n */\n set debounce(value) {\n this.setAttribute('debounce', value);\n }\n\n /**\n * Getter for the debounce property.\n * @returns {number} The debounce time.\n */\n get debounce() {\n return getNumberAttribute(this, 'debounce', DEFAULT_DEBOUNCE_MS);\n }\n\n /**\n * Getter for the columns property.\n * @returns {Array} An array of all the columns.\n */\n get columns() {\n return Array.from(this.shadowRoot.querySelectorAll(`.column`));\n }\n\n debounceId = `layout_${Math.random()}`;\n\n ro = undefined;\n\n className = 'Masonry';\n\n /**\n * Getter for the cssStyleSheet property.\n * @static\n * @returns {CSSStyleSheet} The CSS style sheet for the masonry layout.\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Getter for the observedAttributes property.\n * @returns {Array} An array of the observed attributes.\n */\n static get observedAttributes() {\n return ['max-col-width', 'gap', 'cols'];\n }\n\n /**\n * Callback for when an attribute changes.\n */\n attributeChangedCallback(name, old, newName) {\n switch (name) {\n case 'gap':\n this.style.setProperty(GAP_CSS_VAR_NAME, `${this.gap}px`);\n break;\n }\n\n this.scheduleLayout();\n }\n\n /**\n * Callback for when the element is disconnected.\n */\n beforeDisconnect() {\n this.unsetSlot.removeEventListener('slotchange', this.onSlotChange);\n window.removeEventListener('resize', this.onResize);\n if (this.ro !== null && this.ro !== undefined) {\n this.ro.unobserve(this);\n }\n }\n\n /**\n * Sets up the attributes for the element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draws the element for the masonry layout.\n * @returns {DocumentFragment} The drawn element.\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('id', 'unset-items');\n native.setAttribute('part', 'native');\n\n let unsetSlot = document.createElement('slot');\n\n native.appendChild(unsetSlot);\n\n this.unsetSlot = unsetSlot;\n this.native = native;\n\n fragment.appendChild(native);\n\n return fragment;\n }\n\n /**\n * Called after the element is drawn.\n */\n afterDraw() {\n this.onSlotChange();\n this.onResize();\n this.layout();\n\n this.unsetSlot.addEventListener('slotchange', this.onSlotChange);\n\n if ('ResizeObserver' in window) {\n this.ro = new ResizeObserver(this.onResize);\n this.ro.observe(this);\n } else {\n window.addEventListener('resize', this.onResize);\n }\n }\n\n /**\n * Called when the slot changes.\n */\n onSlotChange = () => {\n const $unsetElements = (this.unsetSlot.assignedNodes() || []).filter(\n (node) => node.nodeType === ELEMENT_NODE_TYPE\n );\n if ($unsetElements.length > 0) {\n this.layout();\n }\n };\n\n /**\n * Called when the window resizes.\n * @param {Array} entries The entries to use.\n */\n onResize = (entries) => {\n const { width } =\n entries !== null && entries !== undefined && Array.isArray(entries) && entries.length > 0\n ? entries[0].contentRect\n : { width: this.offsetWidth };\n const colCount = getColCount(width, this.cols, this.maxColWidth);\n if (colCount !== this.columns.length) {\n this.scheduleLayout();\n }\n };\n\n /**\n * Renders the columns.\n * @param {number} colCount The number of columns to render.\n */\n renderCols(colCount) {\n const columns = this.columns;\n\n if (columns.length === colCount) {\n return;\n }\n\n for (let i = 0; i < colCount; i++) {\n const column = document.createElement('div');\n column.classList.add('column');\n column.setAttribute('part', `column column-${i}`);\n\n const slot = document.createElement('slot');\n slot.setAttribute('name', i);\n\n column.appendChild(slot);\n\n this.context.appendChild(column);\n }\n\n this.style.setProperty(COL_COUNT_CSS_VAR_NAME, colCount);\n }\n\n /**\n * Schedules a layout.\n * @param {number} ms The number of milliseconds to wait before laying out.\n */\n scheduleLayout(ms = this.debounce) {\n debounce(this.layout, ms, this.debounceId);\n }\n\n /**\n * Lays out the element.\n */\n layout = () => {\n if (\n this.currentRequestAnimationFrameCallback !== null &&\n this.currentRequestAnimationFrameCallback !== undefined\n ) {\n window.cancelAnimationFrame(this.currentRequestAnimationFrameCallback);\n }\n\n this.currentRequestAnimationFrameCallback = requestAnimationFrame(() => {\n const gap = this.gap;\n const $elements = Array.from(this.children).filter((node) => node.nodeType === ELEMENT_NODE_TYPE);\n const colCount = getColCount(this.offsetWidth, this.cols, this.maxColWidth);\n const colHeights = Array(colCount).fill(0);\n const writes = [];\n\n for (const elem of $elements) {\n const height = elem.getBoundingClientRect().height;\n let smallestColIndex = findSmallestColIndex(colHeights);\n\n colHeights[smallestColIndex] += height + +gap;\n\n const newSlot = smallestColIndex;\n\n if (elem.slot !== newSlot) {\n writes.push(() => (elem.slot = newSlot));\n }\n }\n\n for (const write of writes) {\n write();\n }\n\n this.renderCols(colCount);\n });\n };\n}\n","import Masonry from './masonry.element.js';\n\nexport default Masonry;\n\nMasonry.define('wje-masonry', Masonry);\n"],"names":["DEBOUNCE_MAP","Map","getNumberAttribute","$elem","name","defaultValue","value","parseFloat","getAttribute","isNaN","getColCount","totalWidth","cols","maxColWidth","Math","max","ceil","findSmallestColIndex","colHeights","smallestIndex","smallestHeight","Infinity","forEach","height","i","Masonry","WJElement","constructor","super","debounceId","random","ro","className","onSlotChange","this","unsetSlot","assignedNodes","filter","node","nodeType","length","layout","onResize","entries","width","Array","isArray","contentRect","offsetWidth","columns","scheduleLayout","currentRequestAnimationFrameCallback","window","cancelAnimationFrame","requestAnimationFrame","gap","$elements","from","children","colCount","fill","writes","elem","getBoundingClientRect","smallestColIndex","newSlot","slot","push","write","renderCols","setAttribute","hasAttribute","debounce","shadowRoot","querySelectorAll","cssStyleSheet","observedAttributes","old","newName","style","setProperty","beforeDisconnect","removeEventListener","unobserve","setupAttributes","isShadowRoot","draw","fragment","document","createDocumentFragment","native","createElement","appendChild","afterDraw","addEventListener","ResizeObserver","observe","column","classList","add","context","ms","cb","id","existingTimeout","get","clearTimeout","set","setTimeout","define"],"mappings":";;;;AACO,MAODA,IAAe,oBAAIC;AASlB,SAASC,EAAmBC,IAAOC,IAAMC,IAAAA;AAC5C,QAAMC,KAAQC,WAAWJ,GAAMK,aAAaJ,EAAAA,KAAS,EAAA;AACrD,SAAOK,MAAMH,EAAAA,IAASD,KAAeC;AACzC;AAQO,SAASI,EAAYC,IAAYC,IAAMC,IAAAA;AAC1C,SAAOJ,MAAMG,EAAAA,IAAQE,KAAKC,IAAI,GAAGD,KAAKE,KAAKL,KAAaE,EAAAA,CAAAA,IAAgBD;AAC5E;AAkBO,SAASK,EAAqBC,IAAAA;AACjC,MAAIC,KAAgB,GAChBC,KAAiBC,IAAAA;AASrB,SAPAH,GAAWI,QAAQ,CAACC,IAAQC,OAAAA;AACpBD,IAAAA,KAASH,OACTA,KAAiBG,IACjBJ,KAAgBK;AAAAA,EAAAA,CAAAA,GAIjBL;AACX;AChCe,MAAMM,UAAgBC,EAAAA;AAAAA,EAIjC,cAAAC;AACIC,UAAAA;AAiFJC,sCAAa,UAAUf,KAAKgB,OAAAA,CAAAA;AAE5BC;AAEAC,qCAAY;AA8FZC,wCAAe,MAAA;AAAA,OACaC,KAAKC,UAAUC,cAAAA,KAAmB,CAAA,GAA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