wj-elements 0.1.175 → 0.1.176

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.
@@ -2,7 +2,7 @@ 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
4
  import WJElement from "./wje-element.js";
5
- const styles = "/*\n[ WJ List ]\n*/\n:host {\n margin: 0;\n padding: 0;\n display: block;\n contain: content;\n list-style-type: none;\n}\n\n:host(.wje-inset) {\n background: var(--wje-list-background);\n transform: translateZ(0);\n overflow: hidden;\n padding: var(--wje-list-inset-padding);\n border-radius: var(--wje-list-border-radius);\n}\n\n:host(.wje-lines-none) ::slotted(wje-item) {\n --wje-border-width: 0 !important;\n}";
5
+ const styles = "/*\n[ WJ List ]\n*/\n:host {\n margin: 0;\n padding: 0;\n display: block;\n contain: content;\n list-style-type: none;\n}\n\n:host(.wje-inset) {\n background: var(--wje-list-background);\n transform: translateZ(0);\n overflow: hidden;\n padding: var(--wje-list-inset-padding);\n border-radius: var(--wje-list-border-radius);\n}\n\n:host(.wje-lines-none) ::slotted(wje-item) {\n --wje-border-width: 0 !important;\n --wje-item-border-width: 0!important;\n}";
6
6
  class List extends WJElement {
7
7
  /**
8
8
  * Creates an instance of List.
@@ -47,4 +47,4 @@ class List extends WJElement {
47
47
  export {
48
48
  List as L
49
49
  };
50
- //# sourceMappingURL=list.element-Ce1vIm1O.js.map
50
+ //# sourceMappingURL=list.element-D4-wlFN_.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.element-Ce1vIm1O.js","sources":["../packages/wje-list/list.element.js"],"sourcesContent":["import WJElement from '../wje-element/element.js';\nimport styles from './styles/styles.scss?inline';\n\n/**\n * `List` is a custom web component that represents a list.\n * It extends from `WJElement`.\n * @summary This element represents a list.\n * @documentation https://elements.webjet.sk/components/list\n * @status stable\n * @augments {WJElement}\n * @slot - The default slot for the list.\n * @cssproperty [--wje-list-inset-padding=1rem] - The padding of the list when it is inset.\n * @cssproperty [--wje-list-border-radius=8px] - The border radius of the list. Accepts any valid CSS length.\n * @cssproperty [--wje-list-background=var(--wje-background)] - The background of the list. Accepts any valid CSS color value.\n * @tag wje-list\n */\nexport default class List extends WJElement {\n /**\n * Creates an instance of List.\n * @class\n */\n constructor() {\n super();\n }\n\n className = 'List';\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 * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Returns the list of attributes to observe for changes.\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 /**\n * Called after the component has been drawn.\n */\n afterDraw() {\n this.classList.toggle('wje-lines-' + this.lines, this.hasAttribute('lines'));\n this.classList.toggle('wje-inset', this.hasAttribute('inset'));\n }\n}\n"],"names":[],"mappings":";;;;;AAgBe,MAAM,aAAa,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAKxC,cAAc;AACV,UAAO;AAGX,qCAAY;AAAA,EAFhB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASI,WAAW,gBAAgB;AACvB,WAAO;AAAA,EACf;AAAA;AAAA;AAAA;AAAA,EAKI,kBAAkB;AACd,SAAK,eAAe;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA;AAAA,EAMI,OAAO;AACH,QAAI,WAAW,SAAS,uBAAwB;AAEhD,QAAI,UAAU,SAAS,cAAc,MAAM;AAC3C,aAAS,YAAY,OAAO;AAE5B,WAAO;AAAA,EACf;AAAA;AAAA;AAAA;AAAA,EAKI,YAAY;AACR,SAAK,UAAU,OAAO,eAAe,KAAK,OAAO,KAAK,aAAa,OAAO,CAAC;AAC3E,SAAK,UAAU,OAAO,aAAa,KAAK,aAAa,OAAO,CAAC;AAAA,EACrE;AACA;"}
1
+ {"version":3,"file":"list.element-D4-wlFN_.js","sources":["../packages/wje-list/list.element.js"],"sourcesContent":["import WJElement from '../wje-element/element.js';\nimport styles from './styles/styles.scss?inline';\n\n/**\n * `List` is a custom web component that represents a list.\n * It extends from `WJElement`.\n * @summary This element represents a list.\n * @documentation https://elements.webjet.sk/components/list\n * @status stable\n * @augments {WJElement}\n * @slot - The default slot for the list.\n * @cssproperty [--wje-list-inset-padding=1rem] - The padding of the list when it is inset.\n * @cssproperty [--wje-list-border-radius=8px] - The border radius of the list. Accepts any valid CSS length.\n * @cssproperty [--wje-list-background=var(--wje-background)] - The background of the list. Accepts any valid CSS color value.\n * @tag wje-list\n */\nexport default class List extends WJElement {\n /**\n * Creates an instance of List.\n * @class\n */\n constructor() {\n super();\n }\n\n className = 'List';\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 * Sets up the attributes for the component.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Returns the list of attributes to observe for changes.\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 /**\n * Called after the component has been drawn.\n */\n afterDraw() {\n this.classList.toggle('wje-lines-' + this.lines, this.hasAttribute('lines'));\n this.classList.toggle('wje-inset', this.hasAttribute('inset'));\n }\n}\n"],"names":[],"mappings":";;;;;AAgBe,MAAM,aAAa,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAKxC,cAAc;AACV,UAAO;AAGX,qCAAY;AAAA,EAFhB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASI,WAAW,gBAAgB;AACvB,WAAO;AAAA,EACf;AAAA;AAAA;AAAA;AAAA,EAKI,kBAAkB;AACd,SAAK,eAAe;AAAA,EAC5B;AAAA;AAAA;AAAA;AAAA;AAAA,EAMI,OAAO;AACH,QAAI,WAAW,SAAS,uBAAwB;AAEhD,QAAI,UAAU,SAAS,cAAc,MAAM;AAC3C,aAAS,YAAY,OAAO;AAE5B,WAAO;AAAA,EACf;AAAA;AAAA;AAAA;AAAA,EAKI,YAAY;AACR,SAAK,UAAU,OAAO,eAAe,KAAK,OAAO,KAAK,aAAa,OAAO,CAAC;AAC3E,SAAK,UAAU,OAAO,aAAa,KAAK,aAAa,OAAO,CAAC;AAAA,EACrE;AACA;"}
package/dist/localize.js CHANGED
@@ -18,27 +18,55 @@ class LocalizerDefault {
18
18
  console.error(`Language "${this.lang}" not loaded.`);
19
19
  }
20
20
  }
21
- // Vyhľadávanie prekladu podľa kľúča
21
+ /**
22
+ * Translates a given translation key based on the currently selected language.
23
+ * @param {string} key The key representing the text to be translated.
24
+ * @returns {string} The translated text if available; otherwise, returns the original key.
25
+ */
22
26
  translate(key) {
23
27
  var _a;
24
28
  const langMap = (_a = this.languages) == null ? void 0 : _a.get(this.currentLang);
25
29
  if (!langMap) return key;
26
30
  return langMap ? langMap[key] || key : key;
27
31
  }
28
- // Vyhľadávanie prekladu podľa kľúča a typu čísla
32
+ /**
33
+ * Translates a key into a localized string based on the provided count and pluralization type.
34
+ * @param {string} key The base translation key to be used for fetching the localized string.
35
+ * @param {number} [count=0] The count value used to determine the pluralization form.
36
+ * @param {string} [type='cardinal'] The type of pluralization to use, such as 'cardinal' or 'ordinal'.
37
+ * @returns {string} The translated string, adapted to the pluralization rules and count.
38
+ */
29
39
  translatePlural(key, count = 0, type = "cardinal") {
30
40
  const plural = new Intl.PluralRules(this.lang, { type });
31
41
  if (count !== void 0) key += "." + plural.select(count);
32
42
  return this.translate(key);
33
43
  }
34
- // Formátovanie čísla podľa aktuálneho jazyka
44
+ /**
45
+ * Formats a number according to the specified locale and formatting options.
46
+ * @param {number} number The numeric value to format.
47
+ * @param {object} options An object containing formatting options for the number.
48
+ * @returns {string} The formatted number as a string.
49
+ */
35
50
  formatNumber(number, options) {
36
51
  return new Intl.NumberFormat(this.currentLang, options).format(number);
37
52
  }
38
- // Formátovanie dátumu podľa aktuálneho jazyka
39
- formatDate(date) {
40
- return new Intl.DateTimeFormat(this.currentLang).format(new Date(date));
53
+ /**
54
+ * Formats a given date based on the specified options and the current language setting.
55
+ * @param {string|Date|number} date The date to format. Can be a Date object, a timestamp, or a date string.
56
+ * @param {object} options The formatting options to customize the output, as supported by Intl.DateTimeFormat.
57
+ * @returns {string} The formatted date string based on the specified options and current language.
58
+ */
59
+ formatDate(date, options) {
60
+ return new Intl.DateTimeFormat(this.currentLang, options).format(new Date(date));
41
61
  }
62
+ /**
63
+ * Formats a relative time string based on a given language, value, unit, and formatting options.
64
+ * @param {string} lang The language to use for formatting. Defaults to `this.currentLang` if not provided.
65
+ * @param {number} value The numerical value to format, representing the time difference.
66
+ * @param {string} [unit] The unit of time to use (e.g., "second", "minute", "hour", "day", "week", "month", "year").
67
+ * @param {object} [options] An object containing formatting options, such as the style for the numeric representation.
68
+ * @returns {string} The formatted relative time string in the specified language.
69
+ */
42
70
  relativeTime(lang, value = 0, unit = "day", options = { numeric: "auto" }) {
43
71
  lang = lang || this.currentLang;
44
72
  return new Intl.RelativeTimeFormat(lang, options).format(value, unit);
@@ -1 +1 @@
1
- {"version":3,"file":"localize.js","sources":["../packages/localize/localize.js","../packages/utils/localize.js"],"sourcesContent":["// export const translations = new Map();\n\nexport class LocalizerDefault {\n constructor(element) {\n this.element = element;\n\n this.lang = this.element.lang || document.documentElement.lang || 'en-gb';\n this.dir = this.element.dir || document.documentElement.dir || 'ltr';\n this.currentLang = 'en-gb';\n\n this.setLanguage();\n }\n\n get languages() {\n return window.translations;\n }\n\n // Nastavenie aktuálneho jazyka\n setLanguage() {\n if (this.languages?.has(this.lang)) {\n this.currentLang = this.lang;\n } else {\n console.error(`Language \"${this.lang}\" not loaded.`);\n }\n }\n\n // Vyhľadávanie prekladu podľa kľúča\n translate(key) {\n const langMap = this.languages?.get(this.currentLang);\n if (!langMap) return key;\n return langMap ? langMap[key] || key : key;\n }\n\n // Vyhľadávanie prekladu podľa kľúča a typu čísla\n translatePlural(key, count = 0, type = 'cardinal') {\n const plural = new Intl.PluralRules(this.lang, { type: type });\n\n if (count !== undefined) key += '.' + plural.select(count);\n\n return this.translate(key);\n }\n\n // Formátovanie čísla podľa aktuálneho jazyka\n formatNumber(number, options) {\n return new Intl.NumberFormat(this.currentLang, options).format(number);\n }\n\n // Formátovanie dátumu podľa aktuálneho jazyka\n formatDate(date) {\n return new Intl.DateTimeFormat(this.currentLang).format(new Date(date));\n }\n\n relativeTime(lang, value = 0, unit = 'day', options = { numeric: 'auto' }) {\n lang = lang || this.currentLang;\n return new Intl.RelativeTimeFormat(lang, options).format(value, unit);\n }\n}\n\nexport function registerTranslation(...translation) {\n translation.forEach((t) => {\n if (!t.code) {\n console.error(\"Translation object is missing 'code' property:\", t);\n return;\n }\n\n const code = t.code.toLowerCase();\n if (window.translations.has(code)) {\n window.translations.set(code, { ...window.translations.get(code), ...t });\n } else {\n window.translations.set(code, t);\n }\n });\n}\n","import { LocalizerDefault, registerTranslation } from '../localize/localize.js';\n\nexport class Localizer extends LocalizerDefault {\n constructor(element) {\n super(element);\n }\n static registerTranslation(...translation) {\n registerTranslation(...translation);\n }\n}\n"],"names":[],"mappings":"AAEO,MAAM,iBAAiB;AAAA,EAC1B,YAAY,SAAS;AACjB,SAAK,UAAU;AAEf,SAAK,OAAO,KAAK,QAAQ,QAAQ,SAAS,gBAAgB,QAAQ;AAClE,SAAK,MAAM,KAAK,QAAQ,OAAO,SAAS,gBAAgB,OAAO;AAC/D,SAAK,cAAc;AAEnB,SAAK,YAAa;AAAA,EAC1B;AAAA,EAEI,IAAI,YAAY;AACZ,WAAO,OAAO;AAAA,EACtB;AAAA;AAAA,EAGI,cAAc;AAlBlB;AAmBQ,SAAI,UAAK,cAAL,mBAAgB,IAAI,KA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G,EAAC,CAAE;AAAA,IACpF,OAAe;AACH,aAAO,aAAa,IAAI,MAAM,CAAC;AAAA,IAC3C;AAAA,EACA,CAAK;AACL;ACtEO,MAAM,kBAAkB,iBAAiB;AAAA,EAC5C,YAAY,SAAS;AACjB,UAAM,OAAO;AAAA,EACrB;AAAA,EACI,OAAO,uBAAuB,aAAa;AACvC,wBAAoB,GAAG,WAAW;AAAA,EAC1C;AACA;"}
1
+ {"version":3,"file":"localize.js","sources":["../packages/localize/localize.js","../packages/utils/localize.js"],"sourcesContent":["// export const translations = new Map();\n\nexport class LocalizerDefault {\n constructor(element) {\n this.element = element;\n\n this.lang = this.element.lang || document.documentElement.lang || 'en-gb';\n this.dir = this.element.dir || document.documentElement.dir || 'ltr';\n this.currentLang = 'en-gb';\n\n this.setLanguage();\n }\n\n get languages() {\n return window.translations;\n }\n\n // Nastavenie aktuálneho jazyka\n setLanguage() {\n if (this.languages?.has(this.lang)) {\n this.currentLang = this.lang;\n } else {\n console.error(`Language \"${this.lang}\" not loaded.`);\n }\n }\n\n /**\n * Translates a given translation key based on the currently selected language.\n * @param {string} key The key representing the text to be translated.\n * @returns {string} The translated text if available; otherwise, returns the original key.\n */\n translate(key) {\n const langMap = this.languages?.get(this.currentLang);\n if (!langMap) return key;\n return langMap ? langMap[key] || key : key;\n }\n\n /**\n * Translates a key into a localized string based on the provided count and pluralization type.\n * @param {string} key The base translation key to be used for fetching the localized string.\n * @param {number} [count=0] The count value used to determine the pluralization form.\n * @param {string} [type='cardinal'] The type of pluralization to use, such as 'cardinal' or 'ordinal'.\n * @returns {string} The translated string, adapted to the pluralization rules and count.\n */\n translatePlural(key, count = 0, type = 'cardinal') {\n const plural = new Intl.PluralRules(this.lang, { type: type });\n\n if (count !== undefined) key += '.' + plural.select(count);\n\n return this.translate(key);\n }\n\n /**\n * Formats a number according to the specified locale and formatting options.\n * @param {number} number The numeric value to format.\n * @param {object} options An object containing formatting options for the number.\n * @returns {string} The formatted number as a string.\n */\n formatNumber(number, options) {\n return new Intl.NumberFormat(this.currentLang, options).format(number);\n }\n\n /**\n * Formats a given date based on the specified options and the current language setting.\n * @param {string|Date|number} date The date to format. Can be a Date object, a timestamp, or a date string.\n * @param {object} options The formatting options to customize the output, as supported by Intl.DateTimeFormat.\n * @returns {string} The formatted date string based on the specified options and current language.\n */\n formatDate(date, options) {\n return new Intl.DateTimeFormat(this.currentLang, options).format(new Date(date));\n }\n\n /**\n * Formats a relative time string based on a given language, value, unit, and formatting options.\n * @param {string} lang The language to use for formatting. Defaults to `this.currentLang` if not provided.\n * @param {number} value The numerical value to format, representing the time difference.\n * @param {string} [unit] The unit of time to use (e.g., \"second\", \"minute\", \"hour\", \"day\", \"week\", \"month\", \"year\").\n * @param {object} [options] An object containing formatting options, such as the style for the numeric representation.\n * @returns {string} The formatted relative time string in the specified language.\n */\n relativeTime(lang, value = 0, unit = 'day', options = { numeric: 'auto' }) {\n lang = lang || this.currentLang;\n return new Intl.RelativeTimeFormat(lang, options).format(value, unit);\n }\n}\n\nexport function registerTranslation(...translation) {\n translation.forEach((t) => {\n if (!t.code) {\n console.error(\"Translation object is missing 'code' property:\", t);\n return;\n }\n\n const code = t.code.toLowerCase();\n if (window.translations.has(code)) {\n window.translations.set(code, { ...window.translations.get(code), ...t });\n } else {\n window.translations.set(code, t);\n }\n });\n}\n","import { LocalizerDefault, registerTranslation } from '../localize/localize.js';\n\nexport class Localizer extends LocalizerDefault {\n constructor(element) {\n super(element);\n }\n static registerTranslation(...translation) {\n registerTranslation(...translation);\n }\n}\n"],"names":[],"mappings":"AAEO,MAAM,iBAAiB;AAAA,EAC1B,YAAY,SAAS;AACjB,SAAK,UAAU;AAEf,SAAK,OAAO,KAAK,QAAQ,QAAQ,SAAS,gBAAgB,QAAQ;AAClE,SAAK,MAAM,KAAK,QAAQ,OAAO,SAAS,gBAAgB,OAAO;AAC/D,SAAK,cAAc;AAEnB,SAAK,YAAa;AAAA,EAC1B;AAAA,EAEI,IAAI,YAAY;AACZ,WAA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,aAAa;AAChD,cAAY,QAAQ,CAAC,MAAM;AACvB,QAAI,CAAC,EAAE,MAAM;AACT,cAAQ,MAAM,kDAAkD,CAAC;AACjE;AAAA,IACZ;AAEQ,UAAM,OAAO,EAAE,KAAK,YAAa;AACjC,QAAI,OAAO,aAAa,IAAI,IAAI,GAAG;AAC/B,aAAO,aAAa,IAAI,MAAM,EAAE,GAAG,OAAO,aAAa,IAAI,IAAI,GAAG,GAAG,EAAC,CAAE;AAAA,IACpF,OAAe;AACH,aAAO,aAAa,IAAI,MAAM,CAAC;AAAA,IAC3C;AAAA,EACA,CAAK;AACL;AClGO,MAAM,kBAAkB,iBAAiB;AAAA,EAC5C,YAAY,SAAS;AACjB,UAAM,OAAO;AAAA,EACrB;AAAA,EACI,OAAO,uBAAuB,aAAa;AACvC,wBAAoB,GAAG,WAAW;AAAA,EAC1C;AACA;"}
@@ -7,11 +7,41 @@ export class LocalizerDefault {
7
7
  currentLang: string;
8
8
  get languages(): any;
9
9
  setLanguage(): void;
10
- translate(key: any): any;
11
- translatePlural(key: any, count?: number, type?: string): any;
12
- formatNumber(number: any, options: any): string;
13
- formatDate(date: any): string;
14
- relativeTime(lang: any, value?: number, unit?: string, options?: {
15
- numeric: string;
16
- }): string;
10
+ /**
11
+ * Translates a given translation key based on the currently selected language.
12
+ * @param {string} key The key representing the text to be translated.
13
+ * @returns {string} The translated text if available; otherwise, returns the original key.
14
+ */
15
+ translate(key: string): string;
16
+ /**
17
+ * Translates a key into a localized string based on the provided count and pluralization type.
18
+ * @param {string} key The base translation key to be used for fetching the localized string.
19
+ * @param {number} [count=0] The count value used to determine the pluralization form.
20
+ * @param {string} [type='cardinal'] The type of pluralization to use, such as 'cardinal' or 'ordinal'.
21
+ * @returns {string} The translated string, adapted to the pluralization rules and count.
22
+ */
23
+ translatePlural(key: string, count?: number, type?: string): string;
24
+ /**
25
+ * Formats a number according to the specified locale and formatting options.
26
+ * @param {number} number The numeric value to format.
27
+ * @param {object} options An object containing formatting options for the number.
28
+ * @returns {string} The formatted number as a string.
29
+ */
30
+ formatNumber(number: number, options: object): string;
31
+ /**
32
+ * Formats a given date based on the specified options and the current language setting.
33
+ * @param {string|Date|number} date The date to format. Can be a Date object, a timestamp, or a date string.
34
+ * @param {object} options The formatting options to customize the output, as supported by Intl.DateTimeFormat.
35
+ * @returns {string} The formatted date string based on the specified options and current language.
36
+ */
37
+ formatDate(date: string | Date | number, options: object): string;
38
+ /**
39
+ * Formats a relative time string based on a given language, value, unit, and formatting options.
40
+ * @param {string} lang The language to use for formatting. Defaults to `this.currentLang` if not provided.
41
+ * @param {number} value The numerical value to format, representing the time difference.
42
+ * @param {string} [unit] The unit of time to use (e.g., "second", "minute", "hour", "day", "week", "month", "year").
43
+ * @param {object} [options] An object containing formatting options, such as the style for the numeric representation.
44
+ * @returns {string} The formatted relative time string in the specified language.
45
+ */
46
+ relativeTime(lang: string, value?: number, unit?: string, options?: object): string;
17
47
  }
@@ -248,11 +248,6 @@ export default class WJElement extends HTMLElement {
248
248
  * Lifecycle method invoked when the component is disconnected from the DOM.
249
249
  */
250
250
  disconnectedCallback(): void;
251
- /**
252
- * Enqueues an update for the component.
253
- * This method processes the current render promise and then refreshes the component.
254
- */
255
- enqueueUpdate(): void;
256
251
  /**
257
252
  * Lifecycle method invoked when an observed attribute changes.
258
253
  * @param name The name of the attribute that changed.
@@ -9,7 +9,7 @@ import { default as WJElement } from '../wje-element/element.js';
9
9
  * @csspart native - The native part of the masonry layout.
10
10
  * @csspart column - The individual columns in the masonry layout.
11
11
  * @slot - The default slot for the masonry layout.
12
- * @cssproperty [--wje-masonry-gap=1rem] - The gap between items in the masonry layout. Accepts any valid CSS length. Default is 1rem.
12
+ * @cssproperty [--wje-masonry-layout-gap=1rem] - The gap between items in the masonry layout. Accepts any valid CSS length. Default is 1rem.
13
13
  * @cssproperty [--wje-masonry-layout-col-count=1] - The count column in the masonry layout. Accepts any valid CSS length.
14
14
  * @tag wje-masonry
15
15
  */
@@ -255,6 +255,7 @@ export default class Select extends WJElement {
255
255
  * @returns {Array} The selected value.
256
256
  */
257
257
  get selected(): any[];
258
+ get options(): any[];
258
259
  /**
259
260
  * Sets the trigger value.
260
261
  * @param {string} value The trigger value to set.
@@ -313,10 +314,10 @@ export default class Select extends WJElement {
313
314
  getSelected(): any[];
314
315
  /**
315
316
  * Handles the selection change.
316
- * @param {Element} option The option that changed.
317
+ * @param {Element[]} options The option that changed.
317
318
  * @param {number} length The length of the selected options.
318
319
  */
319
- selectionChanged(option?: Element, length?: number): void;
320
+ selectionChanged(options?: Element[], length?: number): void;
320
321
  /**
321
322
  * Updates the selected options and their corresponding chips.
322
323
  * @param {boolean} [silence] Determines whether to suppress the "wje-select:change" event.
@@ -390,6 +391,7 @@ export default class Select extends WJElement {
390
391
  * @param {boolean} [silent] Whether to trigger the change event or not.
391
392
  */
392
393
  selectOptions(values: any[] | any, silent?: boolean): void;
394
+ htmlSelectedItem(item: any): any;
393
395
  /**
394
396
  * @summary Callback function that is called when the custom element is associated with a form.
395
397
  * This function adds an event listener to the form's submit event, which validates the input and propagates the validation.
@@ -432,4 +434,5 @@ export default class Select extends WJElement {
432
434
  * @returns {boolean} Returns true if all elements in the `elements` array are found within the `options` array, otherwise returns false.
433
435
  */
434
436
  areAllElementsInOptions(elements: any[], options: any[]): boolean;
437
+ #private;
435
438
  }
@@ -9,7 +9,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- var _Event_instances, dispatch_fn, _drawingStatus, _isAttached, _isRendering, _originalVisibility, _pristine, _WJElement_instances, refresh_fn, resolveRender_fn;
12
+ var _Event_instances, dispatch_fn, _drawingStatus, _isAttached, _isRendering, _originalVisibility, _pristine, _WJElement_instances, enqueueUpdate_fn, refresh_fn, resolveRender_fn;
13
13
  import { store, defaultStoreActions } from "./wje-store.js";
14
14
  class UniversalService {
15
15
  constructor(props = {}) {
@@ -699,7 +699,7 @@ const _WJElement = class _WJElement extends HTMLElement {
699
699
  this.setUpAccessors();
700
700
  __privateSet(this, _drawingStatus, this.drawingStatuses.ATTACHED);
701
701
  __privateSet(this, _pristine, false);
702
- this.enqueueUpdate();
702
+ __privateMethod(this, _WJElement_instances, enqueueUpdate_fn).call(this);
703
703
  }
704
704
  }
705
705
  /**
@@ -756,15 +756,6 @@ const _WJElement = class _WJElement extends HTMLElement {
756
756
  __privateSet(this, _drawingStatus, this.drawingStatuses.DISCONNECTED);
757
757
  this.componentCleanup();
758
758
  }
759
- /**
760
- * Enqueues an update for the component.
761
- * This method processes the current render promise and then refreshes the component.
762
- */
763
- enqueueUpdate() {
764
- if (!__privateGet(this, _isRendering)) {
765
- this.rafId = requestAnimationFrame(() => __privateMethod(this, _WJElement_instances, refresh_fn).call(this));
766
- }
767
- }
768
759
  /**
769
760
  * Lifecycle method invoked when an observed attribute changes.
770
761
  * @param name The name of the attribute that changed.
@@ -774,7 +765,7 @@ const _WJElement = class _WJElement extends HTMLElement {
774
765
  attributeChangedCallback(name, old, newName) {
775
766
  if (old !== newName) {
776
767
  __privateSet(this, _pristine, false);
777
- this.enqueueUpdate();
768
+ __privateMethod(this, _WJElement_instances, enqueueUpdate_fn).call(this);
778
769
  }
779
770
  }
780
771
  refresh() {
@@ -783,7 +774,7 @@ const _WJElement = class _WJElement extends HTMLElement {
783
774
  this.rejectPromise = reject;
784
775
  });
785
776
  __privateSet(this, _pristine, false);
786
- this.enqueueUpdate();
777
+ __privateMethod(this, _WJElement_instances, enqueueUpdate_fn).call(this);
787
778
  }
788
779
  stopRenderLoop() {
789
780
  if (this.rafId) {
@@ -915,6 +906,15 @@ _isRendering = new WeakMap();
915
906
  _originalVisibility = new WeakMap();
916
907
  _pristine = new WeakMap();
917
908
  _WJElement_instances = new WeakSet();
909
+ /**
910
+ * Enqueues an update for the component.
911
+ * This method processes the current render promise and then refreshes the component.
912
+ */
913
+ enqueueUpdate_fn = function() {
914
+ if (!__privateGet(this, _isRendering)) {
915
+ this.rafId = requestAnimationFrame(() => __privateMethod(this, _WJElement_instances, refresh_fn).call(this));
916
+ }
917
+ };
918
918
  refresh_fn = async function() {
919
919
  var _a, _b, _c;
920
920
  if (__privateGet(this, _isRendering)) {
@@ -939,7 +939,7 @@ refresh_fn = async function() {
939
939
  __privateSet(this, _isRendering, false);
940
940
  if (!__privateGet(this, _pristine)) {
941
941
  __privateSet(this, _pristine, false);
942
- this.enqueueUpdate();
942
+ __privateMethod(this, _WJElement_instances, enqueueUpdate_fn).call(this);
943
943
  } else {
944
944
  this.finisPromise();
945
945
  this.style.visibility = __privateGet(this, _originalVisibility);
@@ -1 +1 @@
1
- {"version":3,"file":"wje-element.js","sources":["../packages/wje-element/service/universal-service.js","../packages/utils/permissions-api.js","../packages/utils/element-utils.js","../packages/utils/event.js","../packages/wje-element/element.js"],"sourcesContent":["export class UniversalService {\n constructor(props = {}) {\n this._store = props.store;\n }\n\n findByKey = (attrName, key, keyValue) => {\n if (this._store.getState()[attrName] instanceof Array) {\n return this._store.getState()[attrName].find((item) => item[key] === keyValue);\n } else {\n console.warn(` Attribute ${attrName} is not array`);\n return null;\n }\n };\n\n findById = (attrName, id) => {\n if (this._store.getState()[attrName] instanceof Array) {\n return this._store.getState()[attrName].find((item) => item.id === id);\n } else {\n console.warn(` Attribute ${attrName} is not array`);\n return null;\n }\n };\n\n findAttributeValue = (attrName) => {\n return this._store.getState()[attrName];\n };\n\n update = (data, action) => {\n this._store.dispatch(action(data));\n };\n\n add = (data, action) => {\n this._store.dispatch(action(data));\n };\n\n _request(url, data, action, dispatchMethod, method, signal) {\n let promise = fetch(url, {\n method: method,\n ...(data ? { body: JSON.stringify(data) } : {}),\n headers: {\n 'Content-Type': 'application/json',\n },\n ...(signal ? { signal } : {}),\n }).then((response) => {\n if (response.ok) {\n return response.json();\n } else {\n return response.json();\n }\n });\n\n return this.dispatch(promise, dispatchMethod, action);\n }\n\n put(url, data, action, dispatchMethod = true, signal = null) {\n return this._request(url, data, action, dispatchMethod, 'PUT', signal);\n }\n\n post(url, data, action, dispatchMethod = true, signal = null) {\n return this._request(url, data, action, dispatchMethod, 'POST', signal);\n }\n\n delete(url, data, action, dispatchMethod = true, signal = null) {\n return this._request(url, data, action, dispatchMethod, 'DELETE', signal);\n }\n\n //url, action, dispatchMethod, signa\n get(url, action, dispatchMethod = true, signal = null) {\n return this._request(url, null, action, dispatchMethod, 'GET', signal);\n }\n\n patch(url, data, action, dispatchMethod = true, signal = null) {\n return this._request(url, data, action, dispatchMethod, 'PATCH', signal);\n }\n\n dispatch(promise, dispatchMethod, action) {\n if (dispatchMethod) {\n return promise\n .then((data) => {\n this._store.dispatch(action(data.data));\n return data;\n })\n .catch((error) => {\n console.error(error);\n });\n }\n return promise;\n }\n\n loadPromise = (\n url,\n action,\n method = 'GET',\n data = '',\n permissionCallBack = () => {\n //\n // No empty function\n }\n ) => {\n return fetch(url, {\n method: method,\n body: data,\n headers: {\n 'Content-Type': 'application/json',\n },\n async: true,\n })\n .then((response, e) => {\n let permissions = response.headers.get('permissions')?.split(',');\n permissionCallBack(permissions);\n\n if (response.ok) {\n return response.json();\n } else {\n throw response.json();\n }\n })\n .then((responseData) => {\n this._store.dispatch(action(responseData));\n return responseData;\n });\n };\n\n loadOnePromise = (url, action) => {\n return fetch(url, {\n headers: {\n 'Content-Type': 'application/json',\n },\n }).then((response) => {\n const responseData = response.json();\n if (action) {\n this._store.dispatch(action(responseData));\n }\n return responseData;\n });\n };\n}\n","export class WjePermissionsApi {\n static _permissionKey = 'permissions';\n\n /**\n * Sets the permission key.\n * @param value\n */\n static set permissionKey(value) {\n WjePermissionsApi._permissionKey = value || 'permissions';\n }\n\n /**\n * Returns the permission key.\n * @returns {*|string}\n */\n static get permissionKey() {\n return WjePermissionsApi._permissionKey;\n }\n\n /**\n * Sets the permissions.\n * @param value\n */\n static set permissions(value) {\n window.localStorage.setItem(WjePermissionsApi.permissionKey, JSON.stringify(value));\n }\n\n /**\n * Returns the permissions.\n * @returns {string[]}\n */\n static get permissions() {\n return JSON.parse(window.localStorage.getItem(WjePermissionsApi.permissionKey)) || [];\n }\n\n /**\n * Checks if the permission is included.\n * @param key\n * @returns {boolean}\n */\n static includesKey(key) {\n return WjePermissionsApi.permissions.includes(key);\n }\n\n /**\n * Checks if the permission is fulfilled.\n * @returns {boolean}\n */\n static isPermissionFulfilled(permissions) {\n return permissions.some((perm) => WjePermissionsApi.permissions.includes(perm));\n }\n}\n","export class WjElementUtils {\n /**\n * This function creates an element.\n * @param element : HTMLElement - The element value.\n * @param object : Object - The object value.\n */\n static setAttributesToElement(element, object) {\n Object.entries(object).forEach(([key, value]) => {\n element.setAttribute(key, value);\n });\n }\n\n /**\n * This function gets the attributes from an element.\n * @param {string|HTMLElement} el The element or selector to retrieve attributes from.\n * @returns {object} - An object containing the element's attributes as key-value pairs.\n */\n static getAttributes(el) {\n if (typeof el === 'string') el = document.querySelector(el);\n\n return Array.from(el.attributes)\n .filter((a) => !a.name.startsWith('@'))\n .map((a) => [\n a.name\n .split('-')\n .map((s, i) => {\n if (i !== 0) {\n return s.charAt(0).toUpperCase() + s.slice(1);\n } else {\n return s;\n }\n })\n .join(''),\n a.value,\n ])\n .reduce((acc, attr) => {\n acc[attr[0]] = attr[1];\n return acc;\n }, {});\n }\n\n /**\n * This function gets the events from an element.\n * @param {string|HTMLElement} el The element or selector to retrieve events from.\n * @returns {Map<any, any>} - The map value.\n */\n static getEvents(el) {\n if (typeof el === 'string') el = document.querySelector(el);\n\n return Array.from(el.attributes)\n .filter((a) => a.name.startsWith('@wje'))\n .map((a) => [a.name.substring(3).split('-').join(''), a.value])\n .reduce((acc, attr) => {\n acc.set(attr[0], attr[1]);\n return acc;\n }, new Map());\n }\n\n /**\n * This function converts an object to a string.\n * @param {object} object The object to convert.\n * @returns {string} - The string value.\n */\n static attributesToString(object) {\n return Object.entries(object)\n .map(([key, value]) => {\n return `${key}=\"${value}\"`;\n })\n .join(' ');\n }\n\n /**\n * This function checks if the slot exists.\n * @param {string|HTMLElement} el The element or selector to check for slots.\n * @param slotName The slot name to check for.\n * @returns {boolean} - The boolean value.\n */\n static hasSlot(el, slotName = null) {\n let selector = slotName ? `[slot=\"${slotName}\"]` : '[slot]';\n\n return el.querySelectorAll(selector).length > 0 ? true : false;\n }\n\n /**\n * This function checks if the slot has content.\n * @param {string|HTMLElement} el The element or selector to check for slot content\n * @param slotName The slot name to check for.\n * @returns {boolean} - The boolean value.\n */\n static hasSlotContent(el, slotName = null) {\n let slotElement = el.querySelector(`slot`);\n if (slotName) {\n slotElement = el.querySelector(`slot[name=\"${slotName}\"]`);\n }\n\n if (slotElement) {\n const assignedElements = slotElement.assignedElements();\n return assignedElements.length > 0;\n }\n\n return false;\n }\n\n /**\n * This function converts a string to a boolean.\n * @param {string | object} value The value to convert to a boolean. If the value is a boolean, it will be returned as is.\n * @returns {boolean} - The boolean value.\n */\n static stringToBoolean(value) {\n if (typeof value === 'boolean') return value;\n\n return !['false', '0', 0].includes(value);\n }\n}\n","var self; // eslint-disable-line no-var\n\nclass Event {\n constructor() {\n this.customEventWeakMap = new WeakMap();\n self = this;\n }\n\n /**\n * Dispatch event to the element and trigger the listener.\n * @param e\n */\n #dispatch(e) {\n let element = this;\n // let record = self.findRecordByElement(element);\n let record = self.customEventWeakMap.get(this);\n\n if (!record) return;\n\n let listeners = record[e.type];\n\n listeners.forEach((listener) => {\n self.dispatchCustomEvent(element, listener.event, {\n originalEvent: e?.type || null,\n context: element,\n event: self,\n });\n\n if (listener.options && listener.options.stopPropagation === true) {\n e.stopPropagation();\n e.stopImmediatePropagation();\n e.preventDefault();\n }\n });\n }\n\n /**\n * Dispatch custom event to the element with the specified event name and detail.\n * @param element\n * @param event\n * @param detail\n */\n dispatchCustomEvent(element, event, detail) {\n element.dispatchEvent(\n new CustomEvent(event, {\n detail: detail || {\n context: element,\n event: self,\n },\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n }\n\n /**\n * Find record by element in the storage.\n * @param element\n * @returns {*}\n */\n\n findRecordByElement(element) {\n return this.customEventWeakMap.get(element);\n }\n\n /**\n * Add listener to the element. If the element is an array, the listener will be added to all elements in the array.\n * @param element\n * @param originalEvent\n * @param event\n * @param listener\n * @param options\n */\n addListener(element, originalEvent, event, listener, options) {\n if (!element) return;\n\n if (!Array.isArray(element)) element = [element];\n\n element.forEach((el) => {\n this.writeRecord(el, originalEvent, event, listener, options);\n });\n }\n\n /**\n * Write record to the storage.\n * @param element\n * @param originalEvent\n * @param event\n * @param listener\n * @param options\n */\n writeRecord(element, originalEvent, event, listener, options) {\n let recordListeners = this.findRecordByElement(element);\n\n if (!recordListeners) {\n this.customEventWeakMap.set(element, {\n [originalEvent]: [],\n });\n\n recordListeners = this.findRecordByElement(element);\n } else {\n recordListeners[originalEvent] = recordListeners[originalEvent] || [];\n }\n\n listener = listener || this.#dispatch;\n let obj = {\n listener: listener,\n options: options,\n event: event,\n };\n\n // skontrolujeme ci uz tento listener neexistuje\n if (!this.isRecordExists(recordListeners[originalEvent], obj)) {\n if (!this.listenerExists(recordListeners[originalEvent], obj)) {\n element.addEventListener(originalEvent, listener, options);\n obj.unbind = () => {\n element.removeEventListener(originalEvent, listener, options);\n };\n }\n\n recordListeners[originalEvent].push(obj);\n\n } else {\n // in case we want to add the same listener multiple times trigger a warning for a better debugging\n //console.info(\"Listener already exists\", element, originalEvent);\n }\n }\n\n /**\n * Performs a deep equality check between two objects.\n * @param x The first object to compare.\n * @param y The second object to compare.\n * @returns - Returns `true` if the objects are deeply equal, `false` otherwise.\n */\n deepEqual(x, y) {\n return x && y && typeof x === 'object' && typeof x === typeof y\n ? Object.keys(x).length === Object.keys(y).length &&\n Object.keys(x).every((key) => this.deepEqual(x[key], y[key]))\n : x === y;\n }\n\n /**\n * Check if the listener already exists on the element.\n * @param records\n * @param eventObj\n * @returns\n */\n listenerExists(records, eventObj) {\n return records.some((e) => e.listener === eventObj.listener);\n }\n\n isRecordExists(records, eventObj) {\n return records.some((e) => this.deepEqual(e, eventObj))\n }\n\n /**\n * Remove listener from the element and delete the listener from the custom event storage.\n * @param element\n * @param originalEvent\n * @param event\n * @param listener\n * @param options\n */\n removeListener(element, originalEvent, event, listener, options) {\n let records = this.findRecordByElement(element);\n let listeners = records?.[originalEvent];\n listener = listener || this.#dispatch;\n\n if (listeners) {\n let listenerOfWeakMap = listeners.find((e) => e.listener === listener);\n\n if (listenerOfWeakMap) {\n listeners.splice(listeners.indexOf(listenerOfWeakMap), 1);\n }\n\n if (!listeners.length) {\n delete records[originalEvent];\n element?.removeEventListener(originalEvent, listener, options);\n }\n }\n }\n\n /**\n * Remove all event listeners from the specified element and delete the element from the custom event storage.\n * @param {HTMLElement} element The element from which all listeners will be removed.\n */\n removeElement(element) {\n // remove all listeners from the element\n let listeners = this.customEventWeakMap.get(element);\n if (listeners) {\n queueMicrotask(() => {\n for (let event in listeners) {\n listeners[event].forEach((e) => {\n element.removeEventListener(event, e.listener, e.options);\n e.unbind();\n });\n }\n\n this.customEventWeakMap.delete(element);\n });\n }\n }\n\n // TODO\n createPromiseFromEvent(element, event) {\n return new Promise((resolve) => {\n let success = () => {\n element.removeEventListener(event, success);\n resolve();\n };\n\n element.addEventListener(event, success);\n });\n }\n}\n\nlet event = new Event();\nexport { event };\n","import { UniversalService } from './service/universal-service.js';\nimport { defaultStoreActions, store } from '../wje-store/store.js';\nimport { WjePermissionsApi } from '../utils/permissions-api.js';\nimport { WjElementUtils } from '../utils/element-utils.js';\nimport { event } from '../utils/event.js';\n\nconst template = document.createElement('template');\ntemplate.innerHTML = ``;\nexport default class WJElement extends HTMLElement {\n\t#drawingStatus;\n\t#isAttached;\n\t#isRendering;\n\t#originalVisibility;\n\t#pristine;\n\n\t/**\n\t * Initializes a new instance of the WJElement class.\n\t */\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.#isAttached = false;\n\t\tthis.service = new UniversalService({\n\t\t\tstore: store,\n\t\t});\n\n\t\t// definujeme vsetky zavislosti.\n\t\t// Do zavislosti patria len komponenty, ktore su zavisle od ktoreho je zavisly tento komponent\n\t\tthis.defineDependencies();\n\n\t\tthis.#isRendering = false;\n\t\tthis._dependencies = {};\n\n\t\t/**\n\t\t * @typedef {object} DrawingStatuses\n\t\t * @property {number} CREATED - The component has been created.\n\t\t * @property {number} ATTACHED - The component has been attached to the DOM.\n\t\t * @property {number} BEGINING - The component is beginning to draw.\n\t\t * @property {number} START - The component has started drawing.\n\t\t * @property {number} DRAWING - The component is drawing.\n\t\t * @property {number} DONE - The component has finished drawing.\n\t\t * @property {number} DISCONNECTED - The component has been disconnected from the DOM.\n\t\t */\n\n\t\t/**\n\t\t * WJElement is a base class for custom web components with managed lifecycle, attribute/property sync,\n\t\t * permission-based visibility, and extensibility hooks.\n\t\t * @property {boolean} isAttached - True if the component is currently attached to the DOM.\n\t\t * @property {DrawingStatuses} drawingStatuses - Enum of possible drawing states.\n\t\t * @property {number} drawingStatus - Current drawing status (see drawingStatuses).\n\t\t * @property {boolean} _pristine - True if the component has not been updated since last render.\n\t\t * @property {boolean} isRendering - True if a render is currently in progress.\n\t\t * @property {number|null} rafId - ID of the scheduled animation frame for rendering, or null.\n\t\t * @property {string|null} originalVisibility - Stores the original CSS visibility before rendering.\n\t\t * @property {object} params - Stores the current attributes/properties for rendering.\n\t\t * @property {Promise<void>} updateComplete - Promise resolved when the current update/render is complete.\n\t\t * @property {string[]} permission - List of required permissions (from 'permission' attribute).\n\t\t * @property {boolean} isPermissionCheck - Whether permission checking is enabled (from 'permission-check' attribute).\n\t\t * @property {boolean} noShow - Whether the element should be hidden (from 'no-show' attribute).\n\t\t * @property {string|undefined} isShadowRoot - Value of the 'shadow' attribute, if present.\n\t\t * @property {boolean} hasShadowRoot - True if the 'shadow' attribute is present.\n\t\t * @property {string} shadowType - Type of shadow root ('open' by default).\n\t\t * @property {object} store - Reference to the global store instance.\n\t\t * @property {object} defaultStoreActions - Default store actions for arrays and objects.\n\t\t * @property {string[]|undefined} removeClassAfterConnect - Classes to remove after connect (from 'remove-class-after-connect' attribute).\n\t\t * @property {object} dependencies - Registered component dependencies.\n\t\t * @property {HTMLElement|ShadowRoot} context - The rendering context (shadow root or element itself).\n\t\t */\n\t\tthis.drawingStatuses = {\n\t\t\tCREATED: 0,\n\t\t\tATTACHED: 1,\n\t\t\tBEGINING: 2,\n\t\t\tSTART: 3,\n\t\t\tDRAWING: 4,\n\t\t\tDONE: 5,\n\t\t\tDISCONNECTED: 6,\n\t\t};\n\n\t\tthis.#drawingStatus = this.drawingStatuses.CREATED;\n\n\t\tthis.#pristine = true;\n\t\tthis.#isRendering = false;\n\t\tthis.rafId = null;\n\t\tthis.#originalVisibility = null;\n\t\tthis.params = {};\n\n\t\tthis.updateComplete = new Promise((resolve, reject) => {\n\t\t\tthis.finisPromise = resolve;\n\t\t\tthis.rejectPromise = reject;\n\t\t});\n\t}\n\n\tget drawingStatus() {\n\t\treturn this.#drawingStatus;\n\t}\n\n\t/**\n\t * Sets the value of the 'permission' attribute.\n\t * @param {string[]} value The value to set for the 'permission' attribute.\n\t */\n\tset permission(value) {\n\t\tthis.setAttribute('permission', value.join(','));\n\t}\n\n\t/**\n\t * Gets the value of the 'permission-check' attribute.\n\t * @returns {string[]} The value of the 'permission' attribute.\n\t */\n\tget permission() {\n\t\treturn this.getAttribute('permission')?.split(',') || [];\n\t}\n\n\t/**\n\t * Sets the 'permission-check' attribute.\n\t * @param {boolean} value The value to set for the 'permission-check' attribute.\n\t */\n\tset isPermissionCheck(value) {\n\t\tif (value) this.setAttribute('permission-check', '');\n\t\telse this.removeAttribute('permission-check');\n\t}\n\n\t/**\n\t * Checks if the 'permission-check' attribute is present.\n\t * @returns {boolean} True if the 'permission-check' attribute is present.\n\t */\n\tget isPermissionCheck() {\n\t\treturn this.hasAttribute('permission-check');\n\t}\n\n\tset noShow(value) {\n\t\tif (value) this.setAttribute('no-show', '');\n\t\telse this.removeAttribute('no-show');\n\t}\n\n\t/**\n\t * Checks if the 'show' attribute is present.\n\t * @returns {boolean} True if the 'show' attribute is present.\n\t */\n\tget noShow() {\n\t\treturn this.hasAttribute('no-show');\n\t}\n\n\t/**\n\t * Sets the 'shadow' attribute.\n\t * @param {string} value The value to set for the 'shadow' attribute.\n\t */\n\tset isShadowRoot(value) {\n\t\treturn this.setAttribute('shadow', value);\n\t}\n\n\tget isShadowRoot() {\n\t\treturn this.getAttribute('shadow');\n\t}\n\n\t/**\n\t * Checks if the 'shadow' attribute is present.\n\t * @returns {boolean} True if the 'shadow' attribute is present.\n\t */\n\tget hasShadowRoot() {\n\t\treturn this.hasAttribute('shadow');\n\t}\n\n\t/**\n\t * Gets the value of the 'shadow' attribute or 'open' if not set.\n\t * @returns {string} The value of the 'shadow' attribute or 'open'.\n\t */\n\tget shadowType() {\n\t\treturn this.getAttribute('shadow') || 'open';\n\t}\n\n\t/**\n\t * Gets the rendering context, either the shadow root or the component itself.\n\t * @returns The rendering context.\n\t */\n\tget context() {\n\t\tif (this.hasShadowRoot) {\n\t\t\treturn this.shadowRoot;\n\t\t} else {\n\t\t\treturn this;\n\t\t}\n\t}\n\n\t/**\n\t * Gets the store instance.\n\t * @returns {object} The store instance.\n\t */\n\tget store() {\n\t\treturn store;\n\t}\n\n\t/**\n\t * @typedef {object} ArrayActions\n\t * @property {Function} addAction - Adds an item to the array.\n\t * @property {Function} deleteAction - Deletes an item from the array.\n\t * @property {Function} loadAction - Loads an array.\n\t * @property {Function} updateAction - Updates an item in the array.\n\t * @property {Function} addManyAction - Adds many items to the array.\n\t */\n\n\t/**\n\t * @typedef {object} ObjectActions\n\t * @property {Function} addAction - Replace old object with new object\n\t * @property {Function} deleteAction - Delete item based on key\n\t * @property {Function} updateAction - Update item based on key\n\t */\n\n\t/**\n\t * Gets the default store actions.\n\t * @returns The default store actions for arrays and objects.\n\t */\n\tget defaultStoreActions() {\n\t\treturn defaultStoreActions;\n\t}\n\n\t/**\n\t * Gets the classes to be removed after the component is connected.\n\t * @returns An array of class names to remove.\n\t */\n\tget removeClassAfterConnect() {\n\t\treturn this.getAttribute('remove-class-after-connect')?.split(' ');\n\t}\n\n\t/**\n\t * Sets the component dependencies.\n\t * @param value The dependencies to set.\n\t */\n\tset dependencies(value) {\n\t\tthis._dependencies = value;\n\t}\n\n\t/**\n\t * Gets the component dependencies.\n\t * @returns The component dependencies.\n\t */\n\tget dependencies() {\n\t\treturn this._dependencies;\n\t}\n\n\t/**\n\t * Processes and combines two templates into one.\n\t * @param pTemplate The primary template.\n\t * @param inputTemplate The secondary template.\n\t * @returns The combined template.\n\t */\n\tstatic processTemplates = (pTemplate, inputTemplate) => {\n\t\tconst newTemplate = document.createElement('template');\n\t\tnewTemplate.innerHTML = [inputTemplate.innerHTML, pTemplate?.innerHTML || ''].join('');\n\t\treturn newTemplate;\n\t};\n\n\t/**\n\t * Defines a custom element if not already defined.\n\t * @param name The name of the custom element.\n\t * @param [elementConstructor] The constructor for the custom element.\n\t * @param [options] Additional options for defining the element.\n\t */\n\tstatic define(name, elementConstructor = this, options = {}) {\n\t\tconst definedElement = customElements.get(name);\n\n\t\tif (!definedElement) {\n\t\t\tcustomElements.define(name, elementConstructor, options);\n\t\t}\n\t}\n\n\t/**\n\t * Defines component dependencies by registering custom elements.\n\t */\n\tdefineDependencies() {\n\t\tif (this.dependencies)\n\t\t\tObject.entries(this.dependencies).forEach((name, component) => WJElement.define(name, component));\n\t}\n\n\t/**\n\t * Hook for extending behavior before drawing the component.\n\t * @param context The rendering context, usually the element's shadow root or main DOM element.\n\t * @param appStoreObj The global application store for managing state.\n\t * @param params Additional parameters or attributes for rendering the component.\n\t */\n\tbeforeDraw(context, appStoreObj, params) {\n\t\t// Hook for extending behavior before drawing\n\t}\n\n\t/**\n\t * Renders the component within the provided context.\n\t * @param context The rendering context, usually the element's shadow root or main DOM element.\n\t * @param appStoreObj\n\t * @param params Additional parameters or attributes for rendering the component.\n\t * @returns This implementation does not render anything and returns `null`.\n\t * @description\n\t * The `draw` method is responsible for rendering the component's content.\n\t * Override this method in subclasses to define custom rendering logic.\n\t * @example\n\t * class MyComponent extends WJElement {\n\t * draw(context, appStoreObj, params) {\n\t * const div = document.createElement('div');\n\t * div.textContent = 'Hello, world!';\n\t * context.appendChild(div);\n\t * }\n\t * }\n\t */\n\tdraw(context, appStoreObj, params) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Hook for extending behavior after drawing the component.\n\t * @param context The rendering context, usually the element's shadow root or main DOM element.\n\t * @param appStoreObj The global application store for managing state.\n\t * @param params Additional parameters or attributes for rendering the component.\n\t */\n\tafterDraw(context, appStoreObj, params) {\n\t\t// Hook for extending behavior after drawing\n\t}\n\n\t/**\n\t * Lifecycle method invoked when the component is connected to the DOM.\n\t */\n\tconnectedCallback() {\n\t\tif (!this.#isRendering) {\n\t\t\tthis.#originalVisibility = this.#originalVisibility ?? this.style.visibility;\n\t\t\tthis.style.visibility = 'hidden';\n\n\t\t\tthis.setupAttributes?.();\n\t\t\tthis.setUpAccessors();\n\n\t\t\tthis.#drawingStatus = this.drawingStatuses.ATTACHED;\n\t\t\tthis.#pristine = false;\n\t\t\tthis.enqueueUpdate();\n\t\t}\n\t}\n\n\t/**\n\t * Initializes the component, setting up attributes and rendering.\n\t * @param [force] Whether to force initialization.\n\t * @returns A promise that resolves when initialization is complete.\n\t */\n\tinitWjElement = (force = false) => {\n\t\treturn new Promise(async (resolve, reject) => {\n\t\t\tthis.#drawingStatus = this.drawingStatuses.BEGINING;\n\n\t\t\tthis.setupAttributes?.();\n\t\t\tif (this.hasShadowRoot) {\n\t\t\t\tif (!this.shadowRoot) this.attachShadow({ mode: this.shadowType || 'open' });\n\t\t\t}\n\t\t\tthis.setUpAccessors();\n\n\t\t\tthis.#drawingStatus = this.drawingStatuses.START;\n\t\t\tawait this.display(force);\n\n\t\t\tconst sheet = new CSSStyleSheet();\n\t\t\tsheet.replaceSync(this.constructor.cssStyleSheet);\n\n\t\t\tthis.context.adoptedStyleSheets = [sheet];\n\n\t\t\tresolve();\n\t\t});\n\t};\n\n\t/**\n\t * Sets up attributes and event listeners for the component.\n\t * This method retrieves all custom events defined for the component\n\t * and adds event listeners for each of them. When an event is triggered,\n\t * it calls the corresponding method on the host element.\n\t */\n\tsetupAttributes() {\n\t\t// Keď neaký element si zadefinuje funkciu \"setupAttributes\" tak sa obsah tejto funkcie nezavolá\n\n\t\tlet allEvents = WjElementUtils.getEvents(this);\n\t\tallEvents.forEach((customEvent, domEvent) => {\n\t\t\tthis.addEventListener(domEvent, (e) => {\n\t\t\t\tthis.getRootNode().host[customEvent]?.();\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Hook for extending behavior before disconnecting the component.\n\t */\n\tbeforeDisconnect() {\n\t\t// Hook for extending behavior before disconnecting\n\t}\n\n\t/**\n\t * Hook for extending behavior after disconnecting the component.\n\t */\n\tafterDisconnect() {\n\t\t// Hook for extending behavior after disconnecting\n\t}\n\n\t/**\n\t * Hook for extending behavior before redrawing the component.\n\t */\n\tbeforeRedraw() {\n\t\t// Hook for extending behavior before redrawing\n\t}\n\n\t/**\n\t * Cleans up resources and event listeners for the component.\n\t */\n\tcomponentCleanup() {\n\t\t// Hook for cleaning up the component\n\t}\n\n\t/**\n\t * Lifecycle method invoked when the component is disconnected from the DOM.\n\t */\n\tdisconnectedCallback() {\n\t\tif (this.#isAttached) {\n\t\t\tthis.beforeDisconnect?.();\n\t\t\tthis.context.innerHTML = '';\n\t\t\tthis.afterDisconnect?.();\n\t\t\tthis.#isAttached = false;\n\t\t\tthis.style.visibility = this.#originalVisibility;\n\t\t\tthis.#originalVisibility = null;\n\t\t}\n\n\t\tif (this.#isRendering) {\n\t\t\tthis.stopRenderLoop();\n\t\t}\n\n\t\tthis.#drawingStatus = this.drawingStatuses.DISCONNECTED;\n\n\t\tthis.componentCleanup();\n\t}\n\n\t/**\n\t * Enqueues an update for the component.\n\t * This method processes the current render promise and then refreshes the component.\n\t */\n\tenqueueUpdate() {\n\t\tif (!this.#isRendering) {\n\t\t\tthis.rafId = requestAnimationFrame(() => this.#refresh());\n\t\t}\n\t}\n\n\t/**\n\t * Lifecycle method invoked when an observed attribute changes.\n\t * @param name The name of the attribute that changed.\n\t * @param old The old value of the attribute.\n\t * @param newName The new value of the attribute.\n\t */\n\tattributeChangedCallback(name, old, newName) {\n\t\tif (old !== newName) {\n\t\t\tthis.#pristine = false;\n\t\t\tthis.enqueueUpdate();\n\t\t}\n\t}\n\n\trefresh() {\n\t\tthis.updateComplete = new Promise((resolve, reject) => {\n\t\t\tthis.finisPromise = resolve;\n\t\t\tthis.rejectPromise = reject;\n\t\t});\n\n\t\tthis.#pristine = false;\n\t\tthis.enqueueUpdate();\n\t}\n\n\t/**\n\t * Refreshes the component by reinitializing it if it is in a drawing state.\n\t * This method checks if the component's drawing status is at least in the START state.\n\t * If so, it performs the following steps:\n\t * 1. Calls the `beforeRedraw` hook if defined.\n\t * 2. Calls the `beforeDisconnect` hook if defined.\n\t * 3. Refreshes the update promise to manage the rendering lifecycle.\n\t * 4. Calls the `afterDisconnect` hook if defined.\n\t * 5. Reinitializes the component by calling `initWjElement` with `true` to force initialization.\n\t * If the component is not in a drawing state, it simply returns a resolved promise.\n\t */\n\tasync #refresh() {\n\t\tif (this.#isRendering) {\n\t\t\tthis.rafId = requestAnimationFrame(() => this.#refresh());\n\t\t\treturn; // Skip if async render is still processing\n\t\t}\n\n\t\tif (!this.#pristine) {\n\t\t\tthis.#pristine = true;\n\t\t\tthis.#isRendering = true;\n\n\t\t\tif (this.#isAttached) {\n\t\t\t\tthis.beforeRedraw?.();\n\t\t\t\tthis.beforeDisconnect?.();\n\t\t\t\tthis.afterDisconnect?.();\n\t\t\t} else {\n\t\t\t\tthis.stopRenderLoop();\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tawait this.initWjElement(true);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('Render error:', error);\n\t\t\t} finally {\n\t\t\t\tthis.#isRendering = false;\n\n\t\t\t\tif (!this.#pristine) {\n\t\t\t\t\tthis.#pristine = false;\n\t\t\t\t\tthis.enqueueUpdate();\n\t\t\t\t} else {\n\t\t\t\t\tthis.finisPromise();\n\t\t\t\t\tthis.style.visibility = this.#originalVisibility;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tstopRenderLoop() {\n\t\tif (this.rafId) {\n\t\t\tcancelAnimationFrame(this.rafId);\n\t\t\tthis.rafId = null;\n\t\t}\n\t}\n\n\t/**\n\t * Renders the component within the provided context.\n\t * @param context The rendering context, usually the element's shadow root or main DOM element.\n\t * @param appStore The global application store for managing state.\n\t * @param params Additional parameters or attributes for rendering the component.\n\t * @returns This implementation does not render anything and returns `null`.\n\t * @description\n\t * The `draw` method is responsible for rendering the component's content.\n\t * Override this method in subclasses to define custom rendering logic.\n\t * @example\n\t * class MyComponent extends WJElement {\n\t * draw(context, appStore, params) {\n\t * const div = document.createElement('div');\n\t * div.textContent = 'Hello, world!';\n\t * context.appendChild(div);\n\t * }\n\t * }\n\t */\n\tdraw(context, appStore, params) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Displays the component's content, optionally forcing a re-render.\n\t * @param [force] Whether to force a re-render.\n\t * @returns A promise that resolves when the display is complete.\n\t */\n\tdisplay(force = false) {\n\t\tthis.template = this.constructor.customTemplate || document.createElement('template');\n\n\t\tif (force) {\n\t\t\t[...this.context.childNodes].forEach(this.context.removeChild.bind(this.context));\n\t\t}\n\n\t\tthis.context.append(this.template.content.cloneNode(true));\n\n\t\tif (this.noShow || (this.isPermissionCheck && !WjePermissionsApi.isPermissionFulfilled(this.permission))) {\n\t\t\tthis.remove();\n\t\t\treturn Promise.resolve();\n\t\t}\n\n\t\treturn this.#resolveRender();\n\t}\n\n\t/**\n\t * Renders the component's content.\n\t */\n\tasync render() {\n\t\tthis.#drawingStatus = this.drawingStatuses.DRAWING;\n\n\t\tlet _draw = this.draw(this.context, this.store, WjElementUtils.getAttributes(this));\n\n\t\tif (_draw instanceof Promise || _draw?.constructor.name === 'Promise') {\n\t\t\t_draw = await _draw;\n\t\t}\n\n\t\tlet rend = _draw;\n\t\tlet element;\n\n\t\tif (rend instanceof HTMLElement || rend instanceof DocumentFragment) {\n\t\t\telement = rend;\n\t\t} else {\n\t\t\tlet inputTemplate = document.createElement('template');\n\t\t\tinputTemplate.innerHTML = rend;\n\t\t\telement = inputTemplate.content.cloneNode(true);\n\t\t}\n\n\t\tlet rendered = element;\n\n\t\tthis.context.appendChild(rendered);\n\t}\n\n\t/**\n\t * Sanitizes a given name by converting it from kebab-case to camelCase.\n\t * @param {string} name The name in kebab-case format (e.g., \"example-name\").\n\t * @returns {string} The sanitized name in camelCase format (e.g., \"exampleName\").\n\t * @example\n\t * sanitizeName('example-name');\n\t * @example\n\t * sanitizeName('my-custom-component');\n\t */\n\tsanitizeName(name) {\n\t\tlet parts = name.split('-');\n\t\treturn [parts.shift(), ...parts.map((n) => n[0].toUpperCase() + n.slice(1))].join('');\n\t}\n\n\t/**\n\t * Checks if a property on an object has a getter or setter method defined.\n\t * @param {object} obj The object on which the property is defined.\n\t * @param {string} property The name of the property to check.\n\t * @returns {object} An object indicating the presence of getter and setter methods.\n\t * @property {Function|null} hasGetter The getter function if it exists, otherwise `null`.\n\t * @property {Function|null} hasSetter The setter function if it exists, otherwise `null`.\n\t * @example\n\t * const obj = {\n\t * get name() { return 'value'; },\n\t * set name(val) { console.log(val); }\n\t * };\n\t * checkGetterSetter(obj, 'name');\n\t * @example\n\t * const obj = { prop: 42 };\n\t * checkGetterSetter(obj, 'prop');\n\t */\n\tcheckGetterSetter(obj, property) {\n\t\tlet descriptor = Object.getOwnPropertyDescriptor(obj, property);\n\n\t\t// Check if the descriptor is found on the object itself\n\t\tif (descriptor) {\n\t\t\treturn {\n\t\t\t\thasGetter: typeof descriptor.get === 'function' ? descriptor.get : null,\n\t\t\t\thasSetter: typeof descriptor.set === 'function' ? descriptor.set : null,\n\t\t\t};\n\t\t}\n\n\t\t// Otherwise, check the prototype chain\n\t\tlet proto = Object.getPrototypeOf(obj);\n\t\tif (proto) {\n\t\t\treturn this.checkGetterSetter(proto, property);\n\t\t}\n\n\t\t// If the property doesn't exist at all\n\t\treturn { hasGetter: null, hasSetter: null };\n\t}\n\n\t/**\n\t * Sets up property accessors for the component's attributes.\n\t */\n\tsetUpAccessors() {\n\t\tlet attrs = this.getAttributeNames();\n\t\tattrs.forEach((name) => {\n\t\t\tconst sanitizedName = this.sanitizeName(name);\n\n\t\t\tconst { hasGetter, hasSetter } = this.checkGetterSetter(this, sanitizedName);\n\n\t\t\tObject.defineProperty(this, sanitizedName, {\n\t\t\t\tset: hasSetter ?? ((value) => this.setAttribute(name, value)),\n\t\t\t\tget: hasGetter ?? (() => this.getAttribute(name)),\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Resolves the rendering process of the component.\n\t * @returns A promise that resolves when rendering is complete.\n\t * @private\n\t */\n\t#resolveRender() {\n\t\tthis.params = WjElementUtils.getAttributes(this);\n\n\t\treturn new Promise(async (resolve, reject) => {\n\t\t\tconst __beforeDraw = this.beforeDraw(this.context, this.store, WjElementUtils.getAttributes(this));\n\n\t\t\tif (__beforeDraw instanceof Promise || __beforeDraw?.constructor.name === 'Promise') {\n\t\t\t\tawait __beforeDraw;\n\t\t\t}\n\n\t\t\tawait this.render();\n\n\t\t\tconst __afterDraw = this.afterDraw?.(this.context, this.store, WjElementUtils.getAttributes(this));\n\n\t\t\tif (__afterDraw instanceof Promise || __afterDraw?.constructor.name === 'Promise') {\n\t\t\t\tawait __afterDraw;\n\t\t\t}\n\n\t\t\t// RHR toto je bicykel pre slickRouter pretože routovanie nieje vykonané pokiaľ sa nezavolá updateComplete promise,\n\t\t\t// toto bude treba rozšíriť aby sme lepšie vedeli kontrolovať vykreslovanie elementov, a flow hookov.\n\t\t\tthis.#isRendering = false;\n\t\t\tthis.#isAttached = true;\n\n\t\t\tif (this.removeClassAfterConnect) {\n\t\t\t\tthis.classList.remove(...this.removeClassAfterConnect);\n\t\t\t}\n\n\t\t\tthis.#drawingStatus = this.drawingStatuses.DONE;\n\n\t\t\tresolve();\n\t\t}).catch((e) => {\n\t\t\tconsole.log(e);\n\t\t});\n\t}\n}\n\nlet __esModule = 'true';\nexport { __esModule, WjePermissionsApi, WjElementUtils, event };\n"],"names":["event"],"mappings":";;;;;;;;;;;;;AAAO,MAAM,iBAAiB;AAAA,EAC1B,YAAY,QAAQ,IAAI;AAIxB,qCAAY,CAAC,UAAU,KAAK,aAAa;AACrC,UAAI,KAAK,OAAO,SAAU,EAAC,QAAQ,aAAa,OAAO;AACnD,eAAO,KAAK,OAAO,SAAQ,EAAG,QAAQ,EAAE,KAAK,CAAC,SAAS,KAAK,GAAG,MAAM,QAAQ;AAAA,MACzF,OAAe;AACH,gBAAQ,KAAK,cAAc,QAAQ,eAAe;AAClD,eAAO;AAAA,MACnB;AAAA,IACK;AAED,oCAAW,CAAC,UAAU,OAAO;AACzB,UAAI,KAAK,OAAO,SAAU,EAAC,QAAQ,aAAa,OAAO;AACnD,eAAO,KAAK,OAAO,SAAQ,EAAG,QAAQ,EAAE,KAAK,CAAC,SAAS,KAAK,OAAO,EAAE;AAAA,MACjF,OAAe;AACH,gBAAQ,KAAK,cAAc,QAAQ,eAAe;AAClD,eAAO;AAAA,MACnB;AAAA,IACK;AAED,8CAAqB,CAAC,aAAa;AAC/B,aAAO,KAAK,OAAO,SAAQ,EAAG,QAAQ;AAAA,IACzC;AAED,kCAAS,CAAC,MAAM,WAAW;AACvB,WAAK,OAAO,SAAS,OAAO,IAAI,CAAC;AAAA,IACpC;AAED,+BAAM,CAAC,MAAM,WAAW;AACpB,WAAK,OAAO,SAAS,OAAO,IAAI,CAAC;AAAA,IACpC;AAwDD,uCAAc,CACV,KACA,QACA,SAAS,OACT,OAAO,IACP,qBAAqB,MAAM;AAAA,IAGnC,M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":3,"file":"wje-element.js","sources":["../packages/wje-element/service/universal-service.js","../packages/utils/permissions-api.js","../packages/utils/element-utils.js","../packages/utils/event.js","../packages/wje-element/element.js"],"sourcesContent":["export class UniversalService {\n constructor(props = {}) {\n this._store = props.store;\n }\n\n findByKey = (attrName, key, keyValue) => {\n if (this._store.getState()[attrName] instanceof Array) {\n return this._store.getState()[attrName].find((item) => item[key] === keyValue);\n } else {\n console.warn(` Attribute ${attrName} is not array`);\n return null;\n }\n };\n\n findById = (attrName, id) => {\n if (this._store.getState()[attrName] instanceof Array) {\n return this._store.getState()[attrName].find((item) => item.id === id);\n } else {\n console.warn(` Attribute ${attrName} is not array`);\n return null;\n }\n };\n\n findAttributeValue = (attrName) => {\n return this._store.getState()[attrName];\n };\n\n update = (data, action) => {\n this._store.dispatch(action(data));\n };\n\n add = (data, action) => {\n this._store.dispatch(action(data));\n };\n\n _request(url, data, action, dispatchMethod, method, signal) {\n let promise = fetch(url, {\n method: method,\n ...(data ? { body: JSON.stringify(data) } : {}),\n headers: {\n 'Content-Type': 'application/json',\n },\n ...(signal ? { signal } : {}),\n }).then((response) => {\n if (response.ok) {\n return response.json();\n } else {\n return response.json();\n }\n });\n\n return this.dispatch(promise, dispatchMethod, action);\n }\n\n put(url, data, action, dispatchMethod = true, signal = null) {\n return this._request(url, data, action, dispatchMethod, 'PUT', signal);\n }\n\n post(url, data, action, dispatchMethod = true, signal = null) {\n return this._request(url, data, action, dispatchMethod, 'POST', signal);\n }\n\n delete(url, data, action, dispatchMethod = true, signal = null) {\n return this._request(url, data, action, dispatchMethod, 'DELETE', signal);\n }\n\n //url, action, dispatchMethod, signa\n get(url, action, dispatchMethod = true, signal = null) {\n return this._request(url, null, action, dispatchMethod, 'GET', signal);\n }\n\n patch(url, data, action, dispatchMethod = true, signal = null) {\n return this._request(url, data, action, dispatchMethod, 'PATCH', signal);\n }\n\n dispatch(promise, dispatchMethod, action) {\n if (dispatchMethod) {\n return promise\n .then((data) => {\n this._store.dispatch(action(data.data));\n return data;\n })\n .catch((error) => {\n console.error(error);\n });\n }\n return promise;\n }\n\n loadPromise = (\n url,\n action,\n method = 'GET',\n data = '',\n permissionCallBack = () => {\n //\n // No empty function\n }\n ) => {\n return fetch(url, {\n method: method,\n body: data,\n headers: {\n 'Content-Type': 'application/json',\n },\n async: true,\n })\n .then((response, e) => {\n let permissions = response.headers.get('permissions')?.split(',');\n permissionCallBack(permissions);\n\n if (response.ok) {\n return response.json();\n } else {\n throw response.json();\n }\n })\n .then((responseData) => {\n this._store.dispatch(action(responseData));\n return responseData;\n });\n };\n\n loadOnePromise = (url, action) => {\n return fetch(url, {\n headers: {\n 'Content-Type': 'application/json',\n },\n }).then((response) => {\n const responseData = response.json();\n if (action) {\n this._store.dispatch(action(responseData));\n }\n return responseData;\n });\n };\n}\n","export class WjePermissionsApi {\n static _permissionKey = 'permissions';\n\n /**\n * Sets the permission key.\n * @param value\n */\n static set permissionKey(value) {\n WjePermissionsApi._permissionKey = value || 'permissions';\n }\n\n /**\n * Returns the permission key.\n * @returns {*|string}\n */\n static get permissionKey() {\n return WjePermissionsApi._permissionKey;\n }\n\n /**\n * Sets the permissions.\n * @param value\n */\n static set permissions(value) {\n window.localStorage.setItem(WjePermissionsApi.permissionKey, JSON.stringify(value));\n }\n\n /**\n * Returns the permissions.\n * @returns {string[]}\n */\n static get permissions() {\n return JSON.parse(window.localStorage.getItem(WjePermissionsApi.permissionKey)) || [];\n }\n\n /**\n * Checks if the permission is included.\n * @param key\n * @returns {boolean}\n */\n static includesKey(key) {\n return WjePermissionsApi.permissions.includes(key);\n }\n\n /**\n * Checks if the permission is fulfilled.\n * @returns {boolean}\n */\n static isPermissionFulfilled(permissions) {\n return permissions.some((perm) => WjePermissionsApi.permissions.includes(perm));\n }\n}\n","export class WjElementUtils {\n /**\n * This function creates an element.\n * @param element : HTMLElement - The element value.\n * @param object : Object - The object value.\n */\n static setAttributesToElement(element, object) {\n Object.entries(object).forEach(([key, value]) => {\n element.setAttribute(key, value);\n });\n }\n\n /**\n * This function gets the attributes from an element.\n * @param {string|HTMLElement} el The element or selector to retrieve attributes from.\n * @returns {object} - An object containing the element's attributes as key-value pairs.\n */\n static getAttributes(el) {\n if (typeof el === 'string') el = document.querySelector(el);\n\n return Array.from(el.attributes)\n .filter((a) => !a.name.startsWith('@'))\n .map((a) => [\n a.name\n .split('-')\n .map((s, i) => {\n if (i !== 0) {\n return s.charAt(0).toUpperCase() + s.slice(1);\n } else {\n return s;\n }\n })\n .join(''),\n a.value,\n ])\n .reduce((acc, attr) => {\n acc[attr[0]] = attr[1];\n return acc;\n }, {});\n }\n\n /**\n * This function gets the events from an element.\n * @param {string|HTMLElement} el The element or selector to retrieve events from.\n * @returns {Map<any, any>} - The map value.\n */\n static getEvents(el) {\n if (typeof el === 'string') el = document.querySelector(el);\n\n return Array.from(el.attributes)\n .filter((a) => a.name.startsWith('@wje'))\n .map((a) => [a.name.substring(3).split('-').join(''), a.value])\n .reduce((acc, attr) => {\n acc.set(attr[0], attr[1]);\n return acc;\n }, new Map());\n }\n\n /**\n * This function converts an object to a string.\n * @param {object} object The object to convert.\n * @returns {string} - The string value.\n */\n static attributesToString(object) {\n return Object.entries(object)\n .map(([key, value]) => {\n return `${key}=\"${value}\"`;\n })\n .join(' ');\n }\n\n /**\n * This function checks if the slot exists.\n * @param {string|HTMLElement} el The element or selector to check for slots.\n * @param slotName The slot name to check for.\n * @returns {boolean} - The boolean value.\n */\n static hasSlot(el, slotName = null) {\n let selector = slotName ? `[slot=\"${slotName}\"]` : '[slot]';\n\n return el.querySelectorAll(selector).length > 0 ? true : false;\n }\n\n /**\n * This function checks if the slot has content.\n * @param {string|HTMLElement} el The element or selector to check for slot content\n * @param slotName The slot name to check for.\n * @returns {boolean} - The boolean value.\n */\n static hasSlotContent(el, slotName = null) {\n let slotElement = el.querySelector(`slot`);\n if (slotName) {\n slotElement = el.querySelector(`slot[name=\"${slotName}\"]`);\n }\n\n if (slotElement) {\n const assignedElements = slotElement.assignedElements();\n return assignedElements.length > 0;\n }\n\n return false;\n }\n\n /**\n * This function converts a string to a boolean.\n * @param {string | object} value The value to convert to a boolean. If the value is a boolean, it will be returned as is.\n * @returns {boolean} - The boolean value.\n */\n static stringToBoolean(value) {\n if (typeof value === 'boolean') return value;\n\n return !['false', '0', 0].includes(value);\n }\n}\n","var self; // eslint-disable-line no-var\n\nclass Event {\n constructor() {\n this.customEventWeakMap = new WeakMap();\n self = this;\n }\n\n /**\n * Dispatch event to the element and trigger the listener.\n * @param e\n */\n #dispatch(e) {\n let element = this;\n // let record = self.findRecordByElement(element);\n let record = self.customEventWeakMap.get(this);\n\n if (!record) return;\n\n let listeners = record[e.type];\n\n listeners.forEach((listener) => {\n self.dispatchCustomEvent(element, listener.event, {\n originalEvent: e?.type || null,\n context: element,\n event: self,\n });\n\n if (listener.options && listener.options.stopPropagation === true) {\n e.stopPropagation();\n e.stopImmediatePropagation();\n e.preventDefault();\n }\n });\n }\n\n /**\n * Dispatch custom event to the element with the specified event name and detail.\n * @param element\n * @param event\n * @param detail\n */\n dispatchCustomEvent(element, event, detail) {\n element.dispatchEvent(\n new CustomEvent(event, {\n detail: detail || {\n context: element,\n event: self,\n },\n bubbles: true,\n composed: true,\n cancelable: true,\n })\n );\n }\n\n /**\n * Find record by element in the storage.\n * @param element\n * @returns {*}\n */\n\n findRecordByElement(element) {\n return this.customEventWeakMap.get(element);\n }\n\n /**\n * Add listener to the element. If the element is an array, the listener will be added to all elements in the array.\n * @param element\n * @param originalEvent\n * @param event\n * @param listener\n * @param options\n */\n addListener(element, originalEvent, event, listener, options) {\n if (!element) return;\n\n if (!Array.isArray(element)) element = [element];\n\n element.forEach((el) => {\n this.writeRecord(el, originalEvent, event, listener, options);\n });\n }\n\n /**\n * Write record to the storage.\n * @param element\n * @param originalEvent\n * @param event\n * @param listener\n * @param options\n */\n writeRecord(element, originalEvent, event, listener, options) {\n let recordListeners = this.findRecordByElement(element);\n\n if (!recordListeners) {\n this.customEventWeakMap.set(element, {\n [originalEvent]: [],\n });\n\n recordListeners = this.findRecordByElement(element);\n } else {\n recordListeners[originalEvent] = recordListeners[originalEvent] || [];\n }\n\n listener = listener || this.#dispatch;\n let obj = {\n listener: listener,\n options: options,\n event: event,\n };\n\n // skontrolujeme ci uz tento listener neexistuje\n if (!this.isRecordExists(recordListeners[originalEvent], obj)) {\n if (!this.listenerExists(recordListeners[originalEvent], obj)) {\n element.addEventListener(originalEvent, listener, options);\n obj.unbind = () => {\n element.removeEventListener(originalEvent, listener, options);\n };\n }\n\n recordListeners[originalEvent].push(obj);\n\n } else {\n // in case we want to add the same listener multiple times trigger a warning for a better debugging\n //console.info(\"Listener already exists\", element, originalEvent);\n }\n }\n\n /**\n * Performs a deep equality check between two objects.\n * @param x The first object to compare.\n * @param y The second object to compare.\n * @returns - Returns `true` if the objects are deeply equal, `false` otherwise.\n */\n deepEqual(x, y) {\n return x && y && typeof x === 'object' && typeof x === typeof y\n ? Object.keys(x).length === Object.keys(y).length &&\n Object.keys(x).every((key) => this.deepEqual(x[key], y[key]))\n : x === y;\n }\n\n /**\n * Check if the listener already exists on the element.\n * @param records\n * @param eventObj\n * @returns\n */\n listenerExists(records, eventObj) {\n return records.some((e) => e.listener === eventObj.listener);\n }\n\n isRecordExists(records, eventObj) {\n return records.some((e) => this.deepEqual(e, eventObj))\n }\n\n /**\n * Remove listener from the element and delete the listener from the custom event storage.\n * @param element\n * @param originalEvent\n * @param event\n * @param listener\n * @param options\n */\n removeListener(element, originalEvent, event, listener, options) {\n let records = this.findRecordByElement(element);\n let listeners = records?.[originalEvent];\n listener = listener || this.#dispatch;\n\n if (listeners) {\n let listenerOfWeakMap = listeners.find((e) => e.listener === listener);\n\n if (listenerOfWeakMap) {\n listeners.splice(listeners.indexOf(listenerOfWeakMap), 1);\n }\n\n if (!listeners.length) {\n delete records[originalEvent];\n element?.removeEventListener(originalEvent, listener, options);\n }\n }\n }\n\n /**\n * Remove all event listeners from the specified element and delete the element from the custom event storage.\n * @param {HTMLElement} element The element from which all listeners will be removed.\n */\n removeElement(element) {\n // remove all listeners from the element\n let listeners = this.customEventWeakMap.get(element);\n if (listeners) {\n queueMicrotask(() => {\n for (let event in listeners) {\n listeners[event].forEach((e) => {\n element.removeEventListener(event, e.listener, e.options);\n e.unbind();\n });\n }\n\n this.customEventWeakMap.delete(element);\n });\n }\n }\n\n // TODO\n createPromiseFromEvent(element, event) {\n return new Promise((resolve) => {\n let success = () => {\n element.removeEventListener(event, success);\n resolve();\n };\n\n element.addEventListener(event, success);\n });\n }\n}\n\nlet event = new Event();\nexport { event };\n","import { UniversalService } from './service/universal-service.js';\nimport { defaultStoreActions, store } from '../wje-store/store.js';\nimport { WjePermissionsApi } from '../utils/permissions-api.js';\nimport { WjElementUtils } from '../utils/element-utils.js';\nimport { event } from '../utils/event.js';\n\nconst template = document.createElement('template');\ntemplate.innerHTML = ``;\nexport default class WJElement extends HTMLElement {\n\t#drawingStatus;\n\t#isAttached;\n\t#isRendering;\n\t#originalVisibility;\n\t#pristine;\n\n\t/**\n\t * Initializes a new instance of the WJElement class.\n\t */\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.#isAttached = false;\n\t\tthis.service = new UniversalService({\n\t\t\tstore: store,\n\t\t});\n\n\t\t// definujeme vsetky zavislosti.\n\t\t// Do zavislosti patria len komponenty, ktore su zavisle od ktoreho je zavisly tento komponent\n\t\tthis.defineDependencies();\n\n\t\tthis.#isRendering = false;\n\t\tthis._dependencies = {};\n\n\t\t/**\n\t\t * @typedef {object} DrawingStatuses\n\t\t * @property {number} CREATED - The component has been created.\n\t\t * @property {number} ATTACHED - The component has been attached to the DOM.\n\t\t * @property {number} BEGINING - The component is beginning to draw.\n\t\t * @property {number} START - The component has started drawing.\n\t\t * @property {number} DRAWING - The component is drawing.\n\t\t * @property {number} DONE - The component has finished drawing.\n\t\t * @property {number} DISCONNECTED - The component has been disconnected from the DOM.\n\t\t */\n\n\t\t/**\n\t\t * WJElement is a base class for custom web components with managed lifecycle, attribute/property sync,\n\t\t * permission-based visibility, and extensibility hooks.\n\t\t * @property {boolean} isAttached - True if the component is currently attached to the DOM.\n\t\t * @property {DrawingStatuses} drawingStatuses - Enum of possible drawing states.\n\t\t * @property {number} drawingStatus - Current drawing status (see drawingStatuses).\n\t\t * @property {boolean} _pristine - True if the component has not been updated since last render.\n\t\t * @property {boolean} isRendering - True if a render is currently in progress.\n\t\t * @property {number|null} rafId - ID of the scheduled animation frame for rendering, or null.\n\t\t * @property {string|null} originalVisibility - Stores the original CSS visibility before rendering.\n\t\t * @property {object} params - Stores the current attributes/properties for rendering.\n\t\t * @property {Promise<void>} updateComplete - Promise resolved when the current update/render is complete.\n\t\t * @property {string[]} permission - List of required permissions (from 'permission' attribute).\n\t\t * @property {boolean} isPermissionCheck - Whether permission checking is enabled (from 'permission-check' attribute).\n\t\t * @property {boolean} noShow - Whether the element should be hidden (from 'no-show' attribute).\n\t\t * @property {string|undefined} isShadowRoot - Value of the 'shadow' attribute, if present.\n\t\t * @property {boolean} hasShadowRoot - True if the 'shadow' attribute is present.\n\t\t * @property {string} shadowType - Type of shadow root ('open' by default).\n\t\t * @property {object} store - Reference to the global store instance.\n\t\t * @property {object} defaultStoreActions - Default store actions for arrays and objects.\n\t\t * @property {string[]|undefined} removeClassAfterConnect - Classes to remove after connect (from 'remove-class-after-connect' attribute).\n\t\t * @property {object} dependencies - Registered component dependencies.\n\t\t * @property {HTMLElement|ShadowRoot} context - The rendering context (shadow root or element itself).\n\t\t */\n\t\tthis.drawingStatuses = {\n\t\t\tCREATED: 0,\n\t\t\tATTACHED: 1,\n\t\t\tBEGINING: 2,\n\t\t\tSTART: 3,\n\t\t\tDRAWING: 4,\n\t\t\tDONE: 5,\n\t\t\tDISCONNECTED: 6,\n\t\t};\n\n\t\tthis.#drawingStatus = this.drawingStatuses.CREATED;\n\n\t\tthis.#pristine = true;\n\t\tthis.#isRendering = false;\n\t\tthis.rafId = null;\n\t\tthis.#originalVisibility = null;\n\t\tthis.params = {};\n\n\t\tthis.updateComplete = new Promise((resolve, reject) => {\n\t\t\tthis.finisPromise = resolve;\n\t\t\tthis.rejectPromise = reject;\n\t\t});\n\t}\n\n\tget drawingStatus() {\n\t\treturn this.#drawingStatus;\n\t}\n\n\t/**\n\t * Sets the value of the 'permission' attribute.\n\t * @param {string[]} value The value to set for the 'permission' attribute.\n\t */\n\tset permission(value) {\n\t\tthis.setAttribute('permission', value.join(','));\n\t}\n\n\t/**\n\t * Gets the value of the 'permission-check' attribute.\n\t * @returns {string[]} The value of the 'permission' attribute.\n\t */\n\tget permission() {\n\t\treturn this.getAttribute('permission')?.split(',') || [];\n\t}\n\n\t/**\n\t * Sets the 'permission-check' attribute.\n\t * @param {boolean} value The value to set for the 'permission-check' attribute.\n\t */\n\tset isPermissionCheck(value) {\n\t\tif (value) this.setAttribute('permission-check', '');\n\t\telse this.removeAttribute('permission-check');\n\t}\n\n\t/**\n\t * Checks if the 'permission-check' attribute is present.\n\t * @returns {boolean} True if the 'permission-check' attribute is present.\n\t */\n\tget isPermissionCheck() {\n\t\treturn this.hasAttribute('permission-check');\n\t}\n\n\tset noShow(value) {\n\t\tif (value) this.setAttribute('no-show', '');\n\t\telse this.removeAttribute('no-show');\n\t}\n\n\t/**\n\t * Checks if the 'show' attribute is present.\n\t * @returns {boolean} True if the 'show' attribute is present.\n\t */\n\tget noShow() {\n\t\treturn this.hasAttribute('no-show');\n\t}\n\n\t/**\n\t * Sets the 'shadow' attribute.\n\t * @param {string} value The value to set for the 'shadow' attribute.\n\t */\n\tset isShadowRoot(value) {\n\t\treturn this.setAttribute('shadow', value);\n\t}\n\n\tget isShadowRoot() {\n\t\treturn this.getAttribute('shadow');\n\t}\n\n\t/**\n\t * Checks if the 'shadow' attribute is present.\n\t * @returns {boolean} True if the 'shadow' attribute is present.\n\t */\n\tget hasShadowRoot() {\n\t\treturn this.hasAttribute('shadow');\n\t}\n\n\t/**\n\t * Gets the value of the 'shadow' attribute or 'open' if not set.\n\t * @returns {string} The value of the 'shadow' attribute or 'open'.\n\t */\n\tget shadowType() {\n\t\treturn this.getAttribute('shadow') || 'open';\n\t}\n\n\t/**\n\t * Gets the rendering context, either the shadow root or the component itself.\n\t * @returns The rendering context.\n\t */\n\tget context() {\n\t\tif (this.hasShadowRoot) {\n\t\t\treturn this.shadowRoot;\n\t\t} else {\n\t\t\treturn this;\n\t\t}\n\t}\n\n\t/**\n\t * Gets the store instance.\n\t * @returns {object} The store instance.\n\t */\n\tget store() {\n\t\treturn store;\n\t}\n\n\t/**\n\t * @typedef {object} ArrayActions\n\t * @property {Function} addAction - Adds an item to the array.\n\t * @property {Function} deleteAction - Deletes an item from the array.\n\t * @property {Function} loadAction - Loads an array.\n\t * @property {Function} updateAction - Updates an item in the array.\n\t * @property {Function} addManyAction - Adds many items to the array.\n\t */\n\n\t/**\n\t * @typedef {object} ObjectActions\n\t * @property {Function} addAction - Replace old object with new object\n\t * @property {Function} deleteAction - Delete item based on key\n\t * @property {Function} updateAction - Update item based on key\n\t */\n\n\t/**\n\t * Gets the default store actions.\n\t * @returns The default store actions for arrays and objects.\n\t */\n\tget defaultStoreActions() {\n\t\treturn defaultStoreActions;\n\t}\n\n\t/**\n\t * Gets the classes to be removed after the component is connected.\n\t * @returns An array of class names to remove.\n\t */\n\tget removeClassAfterConnect() {\n\t\treturn this.getAttribute('remove-class-after-connect')?.split(' ');\n\t}\n\n\t/**\n\t * Sets the component dependencies.\n\t * @param value The dependencies to set.\n\t */\n\tset dependencies(value) {\n\t\tthis._dependencies = value;\n\t}\n\n\t/**\n\t * Gets the component dependencies.\n\t * @returns The component dependencies.\n\t */\n\tget dependencies() {\n\t\treturn this._dependencies;\n\t}\n\n\t/**\n\t * Processes and combines two templates into one.\n\t * @param pTemplate The primary template.\n\t * @param inputTemplate The secondary template.\n\t * @returns The combined template.\n\t */\n\tstatic processTemplates = (pTemplate, inputTemplate) => {\n\t\tconst newTemplate = document.createElement('template');\n\t\tnewTemplate.innerHTML = [inputTemplate.innerHTML, pTemplate?.innerHTML || ''].join('');\n\t\treturn newTemplate;\n\t};\n\n\t/**\n\t * Defines a custom element if not already defined.\n\t * @param name The name of the custom element.\n\t * @param [elementConstructor] The constructor for the custom element.\n\t * @param [options] Additional options for defining the element.\n\t */\n\tstatic define(name, elementConstructor = this, options = {}) {\n\t\tconst definedElement = customElements.get(name);\n\n\t\tif (!definedElement) {\n\t\t\tcustomElements.define(name, elementConstructor, options);\n\t\t}\n\t}\n\n\t/**\n\t * Defines component dependencies by registering custom elements.\n\t */\n\tdefineDependencies() {\n\t\tif (this.dependencies)\n\t\t\tObject.entries(this.dependencies).forEach((name, component) => WJElement.define(name, component));\n\t}\n\n\t/**\n\t * Hook for extending behavior before drawing the component.\n\t * @param context The rendering context, usually the element's shadow root or main DOM element.\n\t * @param appStoreObj The global application store for managing state.\n\t * @param params Additional parameters or attributes for rendering the component.\n\t */\n\tbeforeDraw(context, appStoreObj, params) {\n\t\t// Hook for extending behavior before drawing\n\t}\n\n\t/**\n\t * Renders the component within the provided context.\n\t * @param context The rendering context, usually the element's shadow root or main DOM element.\n\t * @param appStoreObj\n\t * @param params Additional parameters or attributes for rendering the component.\n\t * @returns This implementation does not render anything and returns `null`.\n\t * @description\n\t * The `draw` method is responsible for rendering the component's content.\n\t * Override this method in subclasses to define custom rendering logic.\n\t * @example\n\t * class MyComponent extends WJElement {\n\t * draw(context, appStoreObj, params) {\n\t * const div = document.createElement('div');\n\t * div.textContent = 'Hello, world!';\n\t * context.appendChild(div);\n\t * }\n\t * }\n\t */\n\tdraw(context, appStoreObj, params) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Hook for extending behavior after drawing the component.\n\t * @param context The rendering context, usually the element's shadow root or main DOM element.\n\t * @param appStoreObj The global application store for managing state.\n\t * @param params Additional parameters or attributes for rendering the component.\n\t */\n\tafterDraw(context, appStoreObj, params) {\n\t\t// Hook for extending behavior after drawing\n\t}\n\n\t/**\n\t * Lifecycle method invoked when the component is connected to the DOM.\n\t */\n\tconnectedCallback() {\n\t\tif (!this.#isRendering) {\n\t\t\tthis.#originalVisibility = this.#originalVisibility ?? this.style.visibility;\n\t\t\tthis.style.visibility = 'hidden';\n\n\t\t\tthis.setupAttributes?.();\n\t\t\tthis.setUpAccessors();\n\n\t\t\tthis.#drawingStatus = this.drawingStatuses.ATTACHED;\n\t\t\tthis.#pristine = false;\n\t\t\tthis.#enqueueUpdate();\n\t\t}\n\t}\n\n\t/**\n\t * Initializes the component, setting up attributes and rendering.\n\t * @param [force] Whether to force initialization.\n\t * @returns A promise that resolves when initialization is complete.\n\t */\n\tinitWjElement = (force = false) => {\n\t\treturn new Promise(async (resolve, reject) => {\n\t\t\tthis.#drawingStatus = this.drawingStatuses.BEGINING;\n\n\t\t\tthis.setupAttributes?.();\n\t\t\tif (this.hasShadowRoot) {\n\t\t\t\tif (!this.shadowRoot) this.attachShadow({ mode: this.shadowType || 'open' });\n\t\t\t}\n\t\t\tthis.setUpAccessors();\n\n\t\t\tthis.#drawingStatus = this.drawingStatuses.START;\n\t\t\tawait this.display(force);\n\n\t\t\tconst sheet = new CSSStyleSheet();\n\t\t\tsheet.replaceSync(this.constructor.cssStyleSheet);\n\n\t\t\tthis.context.adoptedStyleSheets = [sheet];\n\n\t\t\tresolve();\n\t\t});\n\t};\n\n\t/**\n\t * Sets up attributes and event listeners for the component.\n\t * This method retrieves all custom events defined for the component\n\t * and adds event listeners for each of them. When an event is triggered,\n\t * it calls the corresponding method on the host element.\n\t */\n\tsetupAttributes() {\n\t\t// Keď neaký element si zadefinuje funkciu \"setupAttributes\" tak sa obsah tejto funkcie nezavolá\n\n\t\tlet allEvents = WjElementUtils.getEvents(this);\n\t\tallEvents.forEach((customEvent, domEvent) => {\n\t\t\tthis.addEventListener(domEvent, (e) => {\n\t\t\t\tthis.getRootNode().host[customEvent]?.();\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Hook for extending behavior before disconnecting the component.\n\t */\n\tbeforeDisconnect() {\n\t\t// Hook for extending behavior before disconnecting\n\t}\n\n\t/**\n\t * Hook for extending behavior after disconnecting the component.\n\t */\n\tafterDisconnect() {\n\t\t// Hook for extending behavior after disconnecting\n\t}\n\n\t/**\n\t * Hook for extending behavior before redrawing the component.\n\t */\n\tbeforeRedraw() {\n\t\t// Hook for extending behavior before redrawing\n\t}\n\n\t/**\n\t * Cleans up resources and event listeners for the component.\n\t */\n\tcomponentCleanup() {\n\t\t// Hook for cleaning up the component\n\t}\n\n\t/**\n\t * Lifecycle method invoked when the component is disconnected from the DOM.\n\t */\n\tdisconnectedCallback() {\n\t\tif (this.#isAttached) {\n\t\t\tthis.beforeDisconnect?.();\n\t\t\tthis.context.innerHTML = '';\n\t\t\tthis.afterDisconnect?.();\n\t\t\tthis.#isAttached = false;\n\t\t\tthis.style.visibility = this.#originalVisibility;\n\t\t\tthis.#originalVisibility = null;\n\t\t}\n\n\t\tif (this.#isRendering) {\n\t\t\tthis.stopRenderLoop();\n\t\t}\n\n\t\tthis.#drawingStatus = this.drawingStatuses.DISCONNECTED;\n\n\t\tthis.componentCleanup();\n\t}\n\n\t/**\n\t * Enqueues an update for the component.\n\t * This method processes the current render promise and then refreshes the component.\n\t */\n\t#enqueueUpdate() {\n\t\tif (!this.#isRendering) {\n\t\t\tthis.rafId = requestAnimationFrame(() => this.#refresh());\n\t\t}\n\t}\n\n\t/**\n\t * Lifecycle method invoked when an observed attribute changes.\n\t * @param name The name of the attribute that changed.\n\t * @param old The old value of the attribute.\n\t * @param newName The new value of the attribute.\n\t */\n\tattributeChangedCallback(name, old, newName) {\n\t\tif (old !== newName) {\n\t\t\tthis.#pristine = false;\n\t\t\tthis.#enqueueUpdate();\n\t\t}\n\t}\n\n\trefresh() {\n\t\tthis.updateComplete = new Promise((resolve, reject) => {\n\t\t\tthis.finisPromise = resolve;\n\t\t\tthis.rejectPromise = reject;\n\t\t});\n\n\t\tthis.#pristine = false;\n\t\tthis.#enqueueUpdate();\n\t}\n\n\t/**\n\t * Refreshes the component by reinitializing it if it is in a drawing state.\n\t * This method checks if the component's drawing status is at least in the START state.\n\t * If so, it performs the following steps:\n\t * 1. Calls the `beforeRedraw` hook if defined.\n\t * 2. Calls the `beforeDisconnect` hook if defined.\n\t * 3. Refreshes the update promise to manage the rendering lifecycle.\n\t * 4. Calls the `afterDisconnect` hook if defined.\n\t * 5. Reinitializes the component by calling `initWjElement` with `true` to force initialization.\n\t * If the component is not in a drawing state, it simply returns a resolved promise.\n\t */\n\tasync #refresh() {\n\t\tif (this.#isRendering) {\n\t\t\tthis.rafId = requestAnimationFrame(() => this.#refresh());\n\t\t\treturn; // Skip if async render is still processing\n\t\t}\n\n\t\tif (!this.#pristine) {\n\t\t\tthis.#pristine = true;\n\t\t\tthis.#isRendering = true;\n\n\t\t\tif (this.#isAttached) {\n\t\t\t\tthis.beforeRedraw?.();\n\t\t\t\tthis.beforeDisconnect?.();\n\t\t\t\tthis.afterDisconnect?.();\n\t\t\t} else {\n\t\t\t\tthis.stopRenderLoop();\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tawait this.initWjElement(true);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('Render error:', error);\n\t\t\t} finally {\n\t\t\t\tthis.#isRendering = false;\n\n\t\t\t\tif (!this.#pristine) {\n\t\t\t\t\tthis.#pristine = false;\n\t\t\t\t\tthis.#enqueueUpdate();\n\t\t\t\t} else {\n\t\t\t\t\tthis.finisPromise();\n\t\t\t\t\tthis.style.visibility = this.#originalVisibility;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tstopRenderLoop() {\n\t\tif (this.rafId) {\n\t\t\tcancelAnimationFrame(this.rafId);\n\t\t\tthis.rafId = null;\n\t\t}\n\t}\n\n\t/**\n\t * Renders the component within the provided context.\n\t * @param context The rendering context, usually the element's shadow root or main DOM element.\n\t * @param appStore The global application store for managing state.\n\t * @param params Additional parameters or attributes for rendering the component.\n\t * @returns This implementation does not render anything and returns `null`.\n\t * @description\n\t * The `draw` method is responsible for rendering the component's content.\n\t * Override this method in subclasses to define custom rendering logic.\n\t * @example\n\t * class MyComponent extends WJElement {\n\t * draw(context, appStore, params) {\n\t * const div = document.createElement('div');\n\t * div.textContent = 'Hello, world!';\n\t * context.appendChild(div);\n\t * }\n\t * }\n\t */\n\tdraw(context, appStore, params) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Displays the component's content, optionally forcing a re-render.\n\t * @param [force] Whether to force a re-render.\n\t * @returns A promise that resolves when the display is complete.\n\t */\n\tdisplay(force = false) {\n\t\tthis.template = this.constructor.customTemplate || document.createElement('template');\n\n\t\tif (force) {\n\t\t\t[...this.context.childNodes].forEach(this.context.removeChild.bind(this.context));\n\t\t}\n\n\t\tthis.context.append(this.template.content.cloneNode(true));\n\n\t\tif (this.noShow || (this.isPermissionCheck && !WjePermissionsApi.isPermissionFulfilled(this.permission))) {\n\t\t\tthis.remove();\n\t\t\treturn Promise.resolve();\n\t\t}\n\n\t\treturn this.#resolveRender();\n\t}\n\n\t/**\n\t * Renders the component's content.\n\t */\n\tasync render() {\n\t\tthis.#drawingStatus = this.drawingStatuses.DRAWING;\n\n\t\tlet _draw = this.draw(this.context, this.store, WjElementUtils.getAttributes(this));\n\n\t\tif (_draw instanceof Promise || _draw?.constructor.name === 'Promise') {\n\t\t\t_draw = await _draw;\n\t\t}\n\n\t\tlet rend = _draw;\n\t\tlet element;\n\n\t\tif (rend instanceof HTMLElement || rend instanceof DocumentFragment) {\n\t\t\telement = rend;\n\t\t} else {\n\t\t\tlet inputTemplate = document.createElement('template');\n\t\t\tinputTemplate.innerHTML = rend;\n\t\t\telement = inputTemplate.content.cloneNode(true);\n\t\t}\n\n\t\tlet rendered = element;\n\n\t\tthis.context.appendChild(rendered);\n\t}\n\n\t/**\n\t * Sanitizes a given name by converting it from kebab-case to camelCase.\n\t * @param {string} name The name in kebab-case format (e.g., \"example-name\").\n\t * @returns {string} The sanitized name in camelCase format (e.g., \"exampleName\").\n\t * @example\n\t * sanitizeName('example-name');\n\t * @example\n\t * sanitizeName('my-custom-component');\n\t */\n\tsanitizeName(name) {\n\t\tlet parts = name.split('-');\n\t\treturn [parts.shift(), ...parts.map((n) => n[0].toUpperCase() + n.slice(1))].join('');\n\t}\n\n\t/**\n\t * Checks if a property on an object has a getter or setter method defined.\n\t * @param {object} obj The object on which the property is defined.\n\t * @param {string} property The name of the property to check.\n\t * @returns {object} An object indicating the presence of getter and setter methods.\n\t * @property {Function|null} hasGetter The getter function if it exists, otherwise `null`.\n\t * @property {Function|null} hasSetter The setter function if it exists, otherwise `null`.\n\t * @example\n\t * const obj = {\n\t * get name() { return 'value'; },\n\t * set name(val) { console.log(val); }\n\t * };\n\t * checkGetterSetter(obj, 'name');\n\t * @example\n\t * const obj = { prop: 42 };\n\t * checkGetterSetter(obj, 'prop');\n\t */\n\tcheckGetterSetter(obj, property) {\n\t\tlet descriptor = Object.getOwnPropertyDescriptor(obj, property);\n\n\t\t// Check if the descriptor is found on the object itself\n\t\tif (descriptor) {\n\t\t\treturn {\n\t\t\t\thasGetter: typeof descriptor.get === 'function' ? descriptor.get : null,\n\t\t\t\thasSetter: typeof descriptor.set === 'function' ? descriptor.set : null,\n\t\t\t};\n\t\t}\n\n\t\t// Otherwise, check the prototype chain\n\t\tlet proto = Object.getPrototypeOf(obj);\n\t\tif (proto) {\n\t\t\treturn this.checkGetterSetter(proto, property);\n\t\t}\n\n\t\t// If the property doesn't exist at all\n\t\treturn { hasGetter: null, hasSetter: null };\n\t}\n\n\t/**\n\t * Sets up property accessors for the component's attributes.\n\t */\n\tsetUpAccessors() {\n\t\tlet attrs = this.getAttributeNames();\n\t\tattrs.forEach((name) => {\n\t\t\tconst sanitizedName = this.sanitizeName(name);\n\n\t\t\tconst { hasGetter, hasSetter } = this.checkGetterSetter(this, sanitizedName);\n\n\t\t\tObject.defineProperty(this, sanitizedName, {\n\t\t\t\tset: hasSetter ?? ((value) => this.setAttribute(name, value)),\n\t\t\t\tget: hasGetter ?? (() => this.getAttribute(name)),\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Resolves the rendering process of the component.\n\t * @returns A promise that resolves when rendering is complete.\n\t * @private\n\t */\n\t#resolveRender() {\n\t\tthis.params = WjElementUtils.getAttributes(this);\n\n\t\treturn new Promise(async (resolve, reject) => {\n\t\t\tconst __beforeDraw = this.beforeDraw(this.context, this.store, WjElementUtils.getAttributes(this));\n\n\t\t\tif (__beforeDraw instanceof Promise || __beforeDraw?.constructor.name === 'Promise') {\n\t\t\t\tawait __beforeDraw;\n\t\t\t}\n\n\t\t\tawait this.render();\n\n\t\t\tconst __afterDraw = this.afterDraw?.(this.context, this.store, WjElementUtils.getAttributes(this));\n\n\t\t\tif (__afterDraw instanceof Promise || __afterDraw?.constructor.name === 'Promise') {\n\t\t\t\tawait __afterDraw;\n\t\t\t}\n\n\t\t\t// RHR toto je bicykel pre slickRouter pretože routovanie nieje vykonané pokiaľ sa nezavolá updateComplete promise,\n\t\t\t// toto bude treba rozšíriť aby sme lepšie vedeli kontrolovať vykreslovanie elementov, a flow hookov.\n\t\t\tthis.#isRendering = false;\n\t\t\tthis.#isAttached = true;\n\n\t\t\tif (this.removeClassAfterConnect) {\n\t\t\t\tthis.classList.remove(...this.removeClassAfterConnect);\n\t\t\t}\n\n\t\t\tthis.#drawingStatus = this.drawingStatuses.DONE;\n\n\t\t\tresolve();\n\t\t}).catch((e) => {\n\t\t\tconsole.log(e);\n\t\t});\n\t}\n}\n\nlet __esModule = 'true';\nexport { __esModule, WjePermissionsApi, WjElementUtils, event };\n"],"names":["event"],"mappings":";;;;;;;;;;;;;AAAO,MAAM,iBAAiB;AAAA,EAC1B,YAAY,QAAQ,IAAI;AAIxB,qCAAY,CAAC,UAAU,KAAK,aAAa;AACrC,UAAI,KAAK,OAAO,SAAU,EAAC,QAAQ,aAAa,OAAO;AACnD,eAAO,KAAK,OAAO,SAAQ,EAAG,QAAQ,EAAE,KAAK,CAAC,SAAS,KAAK,GAAG,MAAM,QAAQ;AAAA,MACzF,OAAe;AACH,gBAAQ,KAAK,cAAc,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,SAAS,KAAK,OAAO,eAAe,cAAc,IAAI;AAEhG,QAAI,uBAAuB,YAAW,2CAAa,YAAY,UAAS,WAAW;AAClF,YAAM;AAAA,IACV;AAIG,uBAAK,cAAe;AACpB,uBAAK,aAAc;AAEnB,QAAI,KAAK,yBAAyB;AACjC,WAAK,UAAU,OAAO,GAAG,KAAK,uBAAuB;AAAA,IACzD;AAEG,uBAAK,gBAAiB,KAAK,gBAAgB;AAE3C,YAAS;AAAA,EACZ,CAAG,EAAE,MAAM,CAAC,MAAM;AACf,YAAQ,IAAI,CAAC;AAAA,EAChB,CAAG;AACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA/bC,cA7OoB,YA6Ob,oBAAmB,CAAC,WAAW,kBAAkB;AACvD,QAAM,cAAc,SAAS,cAAc,UAAU;AACrD,cAAY,YAAY,CAAC,cAAc,YAAW,uCAAW,cAAa,EAAE,EAAE,KAAK,EAAE;AACrF,SAAO;AACP;AAjPa,IAAM,YAAN;AA+qBZ,IAAC,aAAa;"}
package/dist/wje-list.js CHANGED
@@ -1,4 +1,4 @@
1
- import { L as List } from "./list.element-Ce1vIm1O.js";
1
+ import { L as List } from "./list.element-D4-wlFN_.js";
2
2
  List.define("wje-list", List);
3
3
  export {
4
4
  List as default
@@ -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-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,IAAK;AASvB,SAAS,mBAAmB,OAAO,MAAM,cAAc;AAC1D,QAAM,QAAQ,WAAW,MAAM,aAAa,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,SAAK,MAAM,YAAY,wBAAwB,QAAQ;AAAA,EAC/D;AAAA;AAAA;AAAA;AAAA;AAAA,EAMI,eAAe,KAAK,KAAK,UAAU;AAC/B,aAAS,KAAK,QAAQ,IAAI,KAAK,UAAU;AAAA,EACjD;AAwCA;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":[],"mappings":";;;;AACO,MAAM,sBAAsB;AAE5B,MAAM,yBAAyB;AAC/B,MAAM,mBAAmB;AAEzB,MAAM,oBAAoB;AAEjC,MAAM,eAAe,oBAAI,IAAK;AASvB,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,IAC5B;AAAA,EACA,CAAK;AAED,SAA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U,iBAAiB,cAAc,KAAK,YAAY;AAE/D,QAAI,oBAAoB,QAAQ;AAC5B,WAAK,KAAK,IAAI,eAAe,KAAK,QAAQ;AAC1C,WAAK,GAAG,QAAQ,IAAI;AAAA,IAChC,OAAe;AACH,aAAO,iBAAiB,UAAU,KAAK,QAAQ;AAAA,IAC3D;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiCI,WAAW,UAAU;AACjB,UAAM,UAAU,KAAK;AAErB,QAAI,QAAQ,WAAW,UAAU;AAC7B;AAAA,IACZ;AAEQ,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,IAC3C;AAEQ,SAAK,MAAM,YAAY,wBAAwB,QAAQ;AAAA,EAC/D;AAAA;AAAA;AAAA;AAAA;AAAA,EAMI,eAAe,KAAK,KAAK,UAAU;AAC/B,aAAS,KAAK,QAAQ,IAAI,KAAK,UAAU;AAAA,EACjD;AAwCA;ACjTA,QAAQ,OAAO,eAAe,OAAO;"}
@@ -101,7 +101,7 @@ import { default as default89 } from "./wje-tree.js";
101
101
  import { default as default90 } from "./wje-tree-item.js";
102
102
  import { default as default91 } from "./wje-visually-hidden.js";
103
103
  import { I } from "./infinite-scroll.element-CasKXuGZ.js";
104
- import { L } from "./list.element-Ce1vIm1O.js";
104
+ import { L } from "./list.element-D4-wlFN_.js";
105
105
  import { P } from "./popup.element-AaduHP2r.js";
106
106
  function formatDate(input, format) {
107
107
  let date;
@@ -11,7 +11,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
11
11
  var _loadedOptions, _drawPreloadedElements;
12
12
  import WJElement, { event } from "./wje-element.js";
13
13
  import { I as InfiniteScroll } from "./infinite-scroll.element-CasKXuGZ.js";
14
- import { L as List } from "./list.element-Ce1vIm1O.js";
14
+ import { L as List } from "./list.element-D4-wlFN_.js";
15
15
  import Option from "./wje-option.js";
16
16
  class Options extends WJElement {
17
17
  /**
@@ -1,6 +1,15 @@
1
1
  var __defProp = Object.defineProperty;
2
+ var __typeError = (msg) => {
3
+ throw TypeError(msg);
4
+ };
2
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
6
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
8
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
9
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
+ var _addedOptions, _htmlOptions, _Select_instances, htmlSelectedItem_fn;
4
13
  import WJElement, { event } from "./wje-element.js";
5
14
  import Button from "./wje-button.js";
6
15
  import "./wje-popup.js";
@@ -11,7 +20,7 @@ import Input from "./wje-input.js";
11
20
  import Option from "./wje-option.js";
12
21
  import Options from "./wje-options.js";
13
22
  import { P as Popup } from "./popup.element-AaduHP2r.js";
14
- const styles = "/*\n[ WJ Select ]\n*/\n\n:host {\n margin-bottom: var(--wje-select-margin-bottom);\n\n width: 100%;\n display: block;\n [slot='arrow'] {\n transform: rotate(0deg);\n transition: all 0.2s ease-in;\n }\n}\n\n.native-select {\n &.default {\n .wrapper {\n display: block;\n border-width: var(--wje-select-border-width);\n border-style: var(--wje-select-border-style);\n border-color: var(--wje-select-border-color);\n border-radius: var(--wje-select-border-radius);\n padding-inline: 0.5rem;\n padding-top: 0.125rem;\n padding-bottom: 0.125rem;\n }\n .input-wrapper {\n padding: 0;\n min-height: 28px;\n margin-top: -4px;\n }\n &.focused {\n wje-label {\n opacity: 0.67;\n font-size: 12px;\n letter-spacing: normal;\n }\n }\n wje-label {\n margin: 0;\n display: block;\n opacity: 1;\n cursor: text;\n transition: opacity 0.2s ease 0s;\n line-height: var(--wje-select-line-height);\n &.fade {\n opacity: 0.5;\n font-size: 12px;\n letter-spacing: normal;\n }\n }\n }\n &.standard {\n .wrapper {\n background-color: var(--wje-select-background);\n border-width: var(--wje-select-border-width);\n border-style: var(--wje-select-border-style);\n border-color: var(--wje-select-border-color);\n border-radius: var(--wje-select-border-radius);\n }\n .input-wrapper {\n background: transparent;\n width: 100%;\n }\n }\n}\n\n.wrapper {\n display: flex;\n width: 100%;\n}\n\n.input-wrapper {\n display: grid;\n grid-template-columns: auto 1fr auto auto auto;\n align-items: center;\n background-color: var(--wje-select-background);\n min-height: 28px;\n color: var(--wje-select-color);\n line-height: var(--wje-select-line-height);\n appearance: none;\n padding: 2px 0.5rem;\n font-size: 14px !important;\n font-weight: normal;\n vertical-align: middle;\n}\n\ninput {\n color: var(--wje-select-color);\n line-height: var(--wje-select-line-height);\n font-size: 14px !important;\n font-weight: 400;\n letter-spacing: 0.01em;\n border: medium;\n height: 25px;\n min-height: 25px;\n padding: 0;\n background: none;\n box-shadow: none;\n width: 100%;\n outline: 0;\n font-size: 14px !important;\n}\n\n::placeholder {\n opacity: 1;\n}\n\n:host [active] {\n .wrapper {\n border-radius: var(--wje-select-border-radius) var(--wje-select-border-radius) 0 0;\n }\n [slot='arrow'] {\n transform: rotate(180deg);\n transition: all 0.2s ease-in;\n }\n}\n\n.options-wrapper {\n border-width: var(--wje-select-options-border-width);\n border-style: var(--wje-select-options-border-style);\n border-color: var(--wje-select-options-border-color);\n border-radius: 0 0 var(--wje-select-border-radius) var(--wje-select-border-radius);\n margin-top: calc(0px - var(--wje-select-border-width));\n background: var(--wje-select-background);\n overflow: hidden;\n}\n\n.find {\n --wje-input-border-radius: 0;\n --wje-input-border-width: 0 0 1px 0;\n}\n\n.list {\n overflow: auto;\n height: 100%;\n}\n\n.options-wrapper:has(.find) .list {\n height: calc(100% - 32px - 0.5rem);\n}\n\n:host([multiple]) input {\n position: absolute;\n z-index: -1;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n opacity: 0;\n}\n\n:host([multiple]) .chips {\n display: flex;\n flex: 1;\n align-items: center;\n flex-wrap: wrap;\n gap: var(--wje-spacing-3x-small);\n}\n\n:host([disabled]) .input-wrapper {\n opacity: 0.5;\n pointer-events: none;\n cursor: not-allowed;\n}\n\n.counter {\n padding-inline: 0.5rem;\n}\n\nwje-chip {\n --wje-chip-margin: 0 0.25rem 0 0;\n}\n\nwje-button {\n --wje-padding-top: 0.25rem;\n --wje-padding-start: 0.25rem;\n --wje-padding-end: 0.25rem;\n --wje-padding-bottom: 0.25rem;\n --wje-button-margin-inline: 0 0.25rem;\n}\n\n.slot-start,\n.slot-end {\n &:not(:empty) {\n margin-right: 0.5rem;\n }\n}\n";
23
+ const styles = "/*\n[ WJ Select ]\n*/\n\n:host {\n margin-bottom: var(--wje-select-margin-bottom);\n\n width: 100%;\n display: block;\n [slot='arrow'] {\n transform: rotate(0deg);\n transition: all 0.2s ease-in;\n }\n}\n\n.native-select {\n &.default {\n .wrapper {\n display: block;\n background-color: var(--wje-select-background);\n border-width: var(--wje-select-border-width);\n border-style: var(--wje-select-border-style);\n border-color: var(--wje-select-border-color);\n border-radius: var(--wje-select-border-radius);\n padding-inline: 0.5rem;\n padding-top: 0.125rem;\n padding-bottom: 0.125rem;\n }\n .input-wrapper {\n padding: 0;\n min-height: 28px;\n margin-top: -4px;\n }\n &.focused {\n wje-label {\n opacity: 0.67;\n font-size: 12px;\n letter-spacing: normal;\n }\n }\n wje-label {\n margin: 0;\n display: block;\n opacity: 1;\n cursor: text;\n transition: opacity 0.2s ease 0s;\n line-height: var(--wje-select-line-height);\n &.fade {\n opacity: 0.5;\n font-size: 12px;\n letter-spacing: normal;\n }\n }\n }\n &.standard {\n .wrapper {\n background-color: var(--wje-select-background);\n border-width: var(--wje-select-border-width);\n border-style: var(--wje-select-border-style);\n border-color: var(--wje-select-border-color);\n border-radius: var(--wje-select-border-radius);\n }\n .input-wrapper {\n background: transparent;\n width: 100%;\n }\n }\n}\n\n.wrapper {\n display: flex;\n width: 100%;\n}\n\n.input-wrapper {\n display: grid;\n grid-template-columns: auto 1fr auto auto auto;\n align-items: center;\n background-color: var(--wje-select-background);\n min-height: 28px;\n color: var(--wje-select-color);\n line-height: var(--wje-select-line-height);\n appearance: none;\n padding: 2px 0.5rem;\n font-size: 14px !important;\n font-weight: normal;\n vertical-align: middle;\n}\n\ninput {\n color: var(--wje-select-color);\n line-height: var(--wje-select-line-height);\n font-size: 14px !important;\n font-weight: 400;\n letter-spacing: 0.01em;\n border: medium;\n height: 25px;\n min-height: 25px;\n padding: 0;\n background: none;\n box-shadow: none;\n width: 100%;\n outline: 0;\n font-size: 14px !important;\n}\n\n::placeholder {\n opacity: 1;\n}\n\n:host [active] {\n .wrapper {\n border-radius: var(--wje-select-border-radius) var(--wje-select-border-radius) 0 0;\n }\n [slot='arrow'] {\n transform: rotate(180deg);\n transition: all 0.2s ease-in;\n }\n}\n\n.options-wrapper {\n border-width: var(--wje-select-options-border-width);\n border-style: var(--wje-select-options-border-style);\n border-color: var(--wje-select-options-border-color);\n border-radius: 0 0 var(--wje-select-border-radius) var(--wje-select-border-radius);\n margin-top: calc(0px - var(--wje-select-border-width));\n background: var(--wje-select-background);\n overflow: hidden;\n}\n\n.find {\n --wje-input-border-radius: 0;\n --wje-input-border-width: 0 0 1px 0;\n}\n\n.list {\n overflow: auto;\n height: 100%;\n}\n\n.options-wrapper:has(.find) .list {\n height: calc(100% - 32px - 0.5rem);\n}\n\n:host([multiple]) input {\n position: absolute;\n z-index: -1;\n top: 0;\n left: 0;\n width: 0;\n height: 0;\n opacity: 0;\n}\n\n:host([multiple]) .chips {\n display: flex;\n flex: 1;\n align-items: center;\n flex-wrap: wrap;\n gap: var(--wje-spacing-3x-small);\n}\n\n:host([disabled]) .input-wrapper {\n opacity: 0.5;\n pointer-events: none;\n cursor: not-allowed;\n}\n\n.counter {\n padding-inline: 0.5rem;\n}\n\nwje-chip {\n --wje-chip-margin: 0 0.25rem 0 0;\n}\n\nwje-button {\n --wje-padding-top: 0.25rem;\n --wje-padding-start: 0.25rem;\n --wje-padding-end: 0.25rem;\n --wje-padding-bottom: 0.25rem;\n --wje-button-margin-inline: 0 0.25rem;\n}\n\n.slot-start,\n.slot-end {\n &:not(:empty) {\n margin-right: 0.5rem;\n }\n}\n";
15
24
  class Select extends WJElement {
16
25
  /**
17
26
  * Constructor for the Select class.
@@ -25,6 +34,9 @@ class Select extends WJElement {
25
34
  */
26
35
  constructor() {
27
36
  super();
37
+ __privateAdd(this, _Select_instances);
38
+ __privateAdd(this, _addedOptions, []);
39
+ __privateAdd(this, _htmlOptions, []);
28
40
  /**
29
41
  * An object representing component dependencies with their respective classes.
30
42
  * Each property in the object maps a custom component name (as a string key)
@@ -273,6 +285,17 @@ class Select extends WJElement {
273
285
  get selected() {
274
286
  return this.getSelected();
275
287
  }
288
+ get options() {
289
+ if (this.querySelector("wje-options")) {
290
+ const allOptions = [...this.querySelector("wje-options").loadedOptions, ...__privateGet(this, _addedOptions), ...__privateGet(this, _htmlOptions)];
291
+ return allOptions;
292
+ } else {
293
+ const allOptions = [...__privateGet(this, _addedOptions), ...__privateGet(this, _htmlOptions)];
294
+ return Array.from(
295
+ new Map(allOptions.reverse().map((obj) => [obj.value, obj])).values()
296
+ ).reverse();
297
+ }
298
+ }
276
299
  /**
277
300
  * Sets the trigger value.
278
301
  * @param {string} value The trigger value to set.
@@ -421,6 +444,12 @@ class Select extends WJElement {
421
444
  */
422
445
  afterDraw() {
423
446
  var _a;
447
+ __privateSet(this, _htmlOptions, Array.from(this.querySelectorAll(":scope > wje-option")).map((option) => {
448
+ return {
449
+ value: option.value,
450
+ text: option.textContent.trim()
451
+ };
452
+ }));
424
453
  this.input.addEventListener("focus", (e) => {
425
454
  var _a2;
426
455
  (_a2 = this.labelElement) == null ? void 0 : _a2.classList.add("fade");
@@ -493,16 +522,17 @@ class Select extends WJElement {
493
522
  return this.selectedOptions.map((option) => {
494
523
  return {
495
524
  value: option.value,
496
- text: option.textContent.trim()
525
+ text: __privateMethod(this, _Select_instances, htmlSelectedItem_fn).call(this, option.value)
526
+ // option.textContent.trim(),
497
527
  };
498
528
  });
499
529
  }
500
530
  /**
501
531
  * Handles the selection change.
502
- * @param {Element} option The option that changed.
532
+ * @param {Element[]} options The option that changed.
503
533
  * @param {number} length The length of the selected options.
504
534
  */
505
- selectionChanged(option = null, length = 0) {
535
+ selectionChanged(options = null, length = 0) {
506
536
  var _a, _b;
507
537
  if (this.hasAttribute("multiple")) {
508
538
  this.value = this.selectedOptions.map((el) => el.value).reverse();
@@ -510,13 +540,14 @@ class Select extends WJElement {
510
540
  this.chips.innerHTML = this.placeholder;
511
541
  this.input.value = "";
512
542
  } else {
513
- if (option !== null) this.chips.appendChild(this.getChip(option));
543
+ if (options !== null) Array.from(options).slice(0, +this.maxOptions).forEach((option) => this.chips.appendChild(this.getChip(option)));
514
544
  if (this.counterEl instanceof HTMLElement || !this.maxOptions || length > +this.maxOptions) {
515
545
  this.counter();
516
546
  }
517
547
  }
518
548
  } else {
519
- let value = (option == null ? void 0 : option.textContent.trim()) || "";
549
+ let option = options == null ? void 0 : options.at(0);
550
+ let value = (option && __privateMethod(this, _Select_instances, htmlSelectedItem_fn).call(this, option.value)) ?? "";
520
551
  this.value = (_b = (_a = this.selectedOptions) == null ? void 0 : _a.map((el) => el.value)) == null ? void 0 : _b.at(0);
521
552
  this.input.value = value;
522
553
  if (option && option instanceof HTMLElement) {
@@ -558,7 +589,7 @@ class Select extends WJElement {
558
589
  this.chips.innerHTML = "";
559
590
  }
560
591
  if (this.selectedOptions.length > 0) {
561
- this.selectionChanged(this.selectedOptions.at(0), this.selectedOptions.length);
592
+ this.selectionChanged(this.selectedOptions, this.selectedOptions.length);
562
593
  } else {
563
594
  this.selectionChanged();
564
595
  }
@@ -596,7 +627,7 @@ class Select extends WJElement {
596
627
  chip.addEventListener("wje:chip-remove", this.removeChip);
597
628
  chip.option = option;
598
629
  let label = document.createElement("wje-label");
599
- label.innerText = option.textContent.trim();
630
+ label.innerHTML = __privateMethod(this, _Select_instances, htmlSelectedItem_fn).call(this, option.value);
600
631
  chip.appendChild(label);
601
632
  return chip;
602
633
  }
@@ -618,6 +649,7 @@ class Select extends WJElement {
618
649
  }
619
650
  option.setAttribute("value", item[map.value] ?? "");
620
651
  option.innerText = item[map.text] ?? "";
652
+ __privateGet(this, _addedOptions).push({ [map.value]: item[map.value], [map.text]: item[map.text] });
621
653
  return option;
622
654
  }
623
655
  /**
@@ -683,6 +715,11 @@ class Select extends WJElement {
683
715
  });
684
716
  }
685
717
  }
718
+ htmlSelectedItem(item) {
719
+ var _a;
720
+ const textValue = ((_a = this.querySelector("wje-options")) == null ? void 0 : _a.itemText) ?? "text";
721
+ return (item == null ? void 0 : item[textValue]) ?? "";
722
+ }
686
723
  /**
687
724
  * @summary Callback function that is called when the custom element is associated with a form.
688
725
  * This function adds an event listener to the form's submit event, which validates the input and propagates the validation.
@@ -752,6 +789,15 @@ class Select extends WJElement {
752
789
  );
753
790
  }
754
791
  }
792
+ _addedOptions = new WeakMap();
793
+ _htmlOptions = new WeakMap();
794
+ _Select_instances = new WeakSet();
795
+ htmlSelectedItem_fn = function(item) {
796
+ var _a;
797
+ const keyValue = ((_a = this.querySelector("wje-options")) == null ? void 0 : _a.itemValue) ?? "value";
798
+ const value = this.options.find((option) => option[keyValue] === item);
799
+ return this.htmlSelectedItem(value);
800
+ };
755
801
  /**
756
802
  * Whether the input is associated with a form.
757
803
  * @type {boolean}
@@ -1 +1 @@
1
- {"version":3,"file":"wje-select.js","sources":["../packages/wje-select/select.element.js","../packages/wje-select/select.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport Button from '../wje-button/button.js';\nimport Popup from '../wje-popup/popup.js';\nimport Icon from '../wje-icon/icon.js';\nimport Label from '../wje-label/label.js';\nimport Chip from '../wje-chip/chip.js';\nimport Input from '../wje-input/input.js';\nimport Option from '../wje-option/option.js';\nimport Options from '../wje-options/options.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Select` is a custom web component that represents a select input.\n * @summary This element represents a select input.\n * @documentation https://elements.webjet.sk/components/select\n * @status stable\n * @augments {WJElement}\n * @slot - The default slot for the select.\n * @slot anchor - The slot for the anchor.\n * @slot arrow - The slot for the arrow.\n * @csspart native - The native select wrapper.\n * @csspart input - The input field.\n * @csspart clear - The clear button.\n * @property {Array} _selected - An array to store selected items.\n * @property {HTMLElement|null} counterEl - A reference to the counter element, initially null.\n * @property {ElementInternals} internals - The internal element API for managing state and attributes.\n * @property {number} maxOptions - The maximum number of options allowed.\n * @property {boolean} _wasOppened - Tracks whether the select element was previously opened, initially false.\n * @cssproperty [--wje-select-border-width=1px] - Specifies the width of the border around the select component. Accepts any valid CSS length unit (e.g., `px`, `rem`, `em`).\n * @cssproperty [--wje-select-border-style=solid] - Defines the style of the border for the select component. Accepts standard CSS border styles, such as `solid`, `dashed`, or `dotted`.\n * @cssproperty [--wje-select-border-color=var(--wje-border-color)] - Sets the color of the border for the select component. Accepts any valid CSS color value, including color variables, named colors, and hex values.\n * @cssproperty [--wje-select-options-border-width=1px] - Specifies the width of the border for the select options dropdown. Accepts any valid CSS length unit.\n * @cssproperty [--wje-select-options-border-style=var(--wje-border-style)] - Defines the border style for the select options dropdown. Inherits from a defined CSS variable for consistency.\n * @cssproperty [--wje-select-options-border-color=var(--wje-border-color)] - Sets the border color for the select options dropdown. Accepts any valid CSS color value.\n * @cssproperty [--wje-select-background=var(--wje-background)] - Specifies the background color of the select component. Accepts any valid CSS color value.\n * @cssproperty [--wje-select-line-height=20px] - Defines the line height for the text within the select component. Accepts any valid CSS length value, ensuring consistent vertical alignment.\n * @cssproperty [--wje-select-color=var(--wje-color)] - Sets the text color for the select component. Accepts any valid CSS color value.\n * @cssproperty [--wje-select-border-radius=var(--wje-border-radius-medium)] - Specifies the border radius for the select component.Determines the roundness of the corners and accepts any valid CSS length unit or variable.\n * @tag wje-select\n */\n\nexport default class Select extends WJElement {\n\t/**\n\t * Constructor for the Select class.\n\t * @class\n\t * @description Initializes the Select component.\n\t * This constructor sets up the initial state of the component, including selected items, counter element, and internal element API.\n\t * It also tracks whether the select element was previously opened.\n\t * @class\n\t * @augments {WJElement}\n\t * @memberof Select\n\t */\n\tconstructor() {\n\t\tsuper();\n\n\t\t/**\n\t\t * @type {Array}\n\t\t * @description An array to store selected items.\n\t\t */\n\t\tthis._selected = [];\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the counter element, initially null.\n\t\t * @private\n\t\t */\n\t\tthis.counterEl = null;\n\n\t\t/**\n\t\t * @type {ElementInternals}\n\t\t * @description The internal element API for managing state and attributes.\n\t\t * @private\n\t\t * @readonly\n\t\t * @constant\n\t\t * @default {ElementInternals} this.attachInternals()\n\t\t * @description Attaches the internals to the element.\n\t\t */\n\t\tthis.internals = this.attachInternals();\n\n\t\t/**\n\t\t * @type {boolean}\n\t\t * @description Tracks whether the select element was previously opened, initially false.\n\t\t * @private\n\t\t * @default {boolean} false\n\t\t */\n\t\tthis._wasOppened = false;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the native select element, initially null.\n\t\t */\n\t\tthis.native = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the popup element, initially null.\n\t\t */\n\t\tthis.popup = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the label element, initially null.\n\t\t */\n\t\tthis.labelElement = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the slot start element, initially null.\n\t\t */\n\t\tthis.slotStart = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the slot end element, initially null.\n\t\t */\n\t\tthis.slotEnd = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the input element, initially null.\n\t\t */\n\t\tthis.input = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the options wrapper element, initially null.\n\t\t */\n\t\tthis.optionsWrapper = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the chips element, initially null.\n\t\t */\n\t\tthis.chips = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the clear button element, initially null.\n\t\t */\n\t\tthis.clear = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the list element, initially null.\n\t\t */\n\t\tthis.list = null;\n\n\t\tthis.selectedOptions = []\n\t}\n\n\t/**\n\t * An object representing component dependencies with their respective classes.\n\t * Each property in the object maps a custom component name (as a string key)\n\t * to its corresponding class or constructor.\n\t * @typedef {{[key: string]: Function}} Dependencies\n\t * @property {Function} 'wje-button' Represents the Button component class.\n\t * @property {Function} 'wje-popup' Represents the Popup component class.\n\t * @property {Function} 'wje-icon' Represents the Icon component class.\n\t * @property {Function} 'wje-label' Represents the Label component class.\n\t * @property {Function} 'wje-chip' Represents the Chip component class.\n\t * @property {Function} 'wje-input' Represents the Input component class.\n\t * @property {Function} 'wje-option' Represents the Option component class.\n\t * @property {Function} 'wje-options' Represents the Options component class.\n\t */\n\tdependencies = {\n\t\t'wje-button': Button,\n\t\t'wje-popup': Popup,\n\t\t'wje-icon': Icon,\n\t\t'wje-label': Label,\n\t\t'wje-chip': Chip,\n\t\t'wje-input': Input,\n\t\t'wje-option': Option,\n\t\t'wje-options': Options,\n\t};\n\n\t/**\n\t * Setter for the value attribute.\n\t * @param {string} value The value to set.\n\t */\n\tset value(value) {\n\t\tif (this.hasAttribute('multiple')) {\n\t\t\tconst formData = new FormData();\n\t\t\tvalue.forEach(v => formData.append(this.name, v));\n\t\t\tthis.internals.setFormValue(formData);\n\t\t} else {\n\t\t\tthis.internals.setFormValue(value);\n\t\t}\n\t}\n\n\t/**\n\t * Getter for the value attribute.\n\t * @returns {object} The value of the attribute.\n\t */\n\tget value() {\n\t\treturn this.selected;\n\t}\n\n\t/**\n\t * Getter for the customErrorDisplay attribute.\n\t * @returns {boolean} Whether the attribute is present.\n\t */\n\tget customErrorDisplay() {\n\t\treturn this.hasAttribute('custom-error-display');\n\t}\n\n\t/**\n\t * Getter for the validateOnChange attribute.\n\t * @returns {boolean} Whether the attribute is present.\n\t */\n\tget validateOnChange() {\n\t\treturn this.hasAttribute('validate-on-change');\n\t}\n\n\t/**\n\t * Getter for the invalid attribute.\n\t * @returns {boolean} Whether the attribute is present.\n\t */\n\tget invalid() {\n\t\treturn this.hasAttribute('invalid');\n\t}\n\n\t/**\n\t * Setter for the invalid attribute.\n\t * @param {boolean} isInvalid Whether the input is invalid.\n\t */\n\tset invalid(isInvalid) {\n\t\tif (isInvalid) this.setAttribute('invalid', '');\n\t\telse this.removeAttribute('invalid');\n\t}\n\n\t/**\n\t * Sets the maximum number of options allowed.\n\t * @param {string | number | null} value The value to set as the maximum number of options.\n\t * If null, the 'max-options' attribute will be removed.\n\t */\n\tset maxOptions(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('max-options', value);\n\t\t} else {\n\t\t\tthis.removeAttribute('max-options');\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the maximum number of options allowed.\n\t * Parses the value of the 'max-options' attribute from the element and converts it to a number.\n\t * If the attribute is not present or cannot be converted to a valid number, defaults to 1.\n\t * @returns {number} The maximum number of options, or 0 if the attribute is not set or invalid.\n\t */\n\tget maxOptions() {\n\t\treturn +this.getAttribute('max-options') || 1;\n\t}\n\n\t/**\n\t * Getter for the form attribute.\n\t * @returns {HTMLFormElement} The form the input is associated with.\n\t */\n\tget form() {\n\t\treturn this.internals.form;\n\t}\n\n\t/**\n\t * Getter for the name attribute.\n\t * @returns {string} The name of the input.\n\t */\n\tget name() {\n\t\treturn this.getAttribute('name');\n\t}\n\n\t/**\n\t * Getter for the type attribute.\n\t * @returns {string} The type of the input.\n\t */\n\tget type() {\n\t\treturn this.localName;\n\t}\n\n\t/**\n\t * Getter for the validity attribute.\n\t * @returns {ValidityState} The validity state of the input.\n\t */\n\tget validity() {\n\t\treturn this.internals.validity;\n\t}\n\n\t/**\n\t * Getter for the validationMessage attribute.\n\t * @returns {string} The validation message of the input.\n\t */\n\tget validationMessage() {\n\t\treturn this.internals.validationMessage;\n\t}\n\n\t/**\n\t * Getter for the willValidate attribute.\n\t * @returns {boolean} Whether the input will be validated.\n\t */\n\tget willValidate() {\n\t\treturn this.internals.willValidate;\n\t}\n\n\t/**\n\t * @summary Getter for the defaultValue attribute.\n\t * This method retrieves the 'value' attribute of the custom input element.\n\t * The 'value' attribute represents the default value of the input element.\n\t * If the 'value' attribute is not set, it returns an empty string.\n\t * @returns {string} The default value of the input element.\n\t */\n\tget defaultValue() {\n\t\treturn this.getAttribute('value') ?? '';\n\t}\n\n\t/**\n\t * @summary Setter for the defaultValue attribute.\n\t * This method sets the 'value' attribute of the custom input element to the provided value.\n\t * The 'value' attribute represents the default value of the input element.\n\t * @param {string} value The value to set as the default value.\n\t */\n\tset defaultValue(value) {\n\t\tthis.setAttribute('value', value);\n\t}\n\n\t/**\n\t * Sets the label value.\n\t * @param {Array} value The selected value to set.\n\t */\n\tset selected(value) {\n\t\tthis._selected = value;\n\t}\n\n\t/**\n\t * Returns the selected value.\n\t * @returns {Array} The selected value.\n\t */\n\tget selected() {\n\t\treturn this.getSelected();\n\t}\n\n\t/**\n\t * Sets the trigger value.\n\t * @param {string} value The trigger value to set.\n\t */\n\tset trigger(value) {\n\t\tthis.setAttribute('trigger', value);\n\t}\n\n\t/**\n\t * Returns the trigger value.\n\t * @returns {string} The trigger value.\n\t */\n\tget trigger() {\n\t\treturn this.getAttribute('trigger') || 'click';\n\t}\n\n\tclassName = 'Select';\n\n\t/**\n\t * Returns the CSS styles for the component.\n\t * @static\n\t * @returns {CSSStyleSheet}\n\t */\n\tstatic get cssStyleSheet() {\n\t\treturn styles;\n\t}\n\n\t/**\n\t * Returns the list of attributes to observe for changes.\n\t * @static\n\t * @returns {Array<string>}\n\t */\n\tstatic get observedAttributes() {\n\t\treturn ['active', 'value', 'disabled', 'multiple', 'label', 'placeholder', 'max-height', 'max-options', 'variant', 'placement'];\n\t}\n\n\t/**\n\t * Whether the input is associated with a form.\n\t * @type {boolean}\n\t */\n\tstatic formAssociated = true;\n\n\t/**\n\t * Sets up the attributes for the component.\n\t */\n\tsetupAttributes() {\n\t\tthis.isShadowRoot = 'open';\n\t}\n\n\t/**\n\t * Draws the component for the select.\n\t * @returns {DocumentFragment}\n\t */\n\tdraw() {\n\t\tlet fragment = document.createDocumentFragment();\n\n\t\tthis.classList.add('wje-placement', this.placement ? 'wje-' + this.placement : 'wje-start');\n\n\t\t// zakladny obalovac\n\t\tlet native = document.createElement('div');\n\t\tnative.setAttribute('part', 'native');\n\t\tnative.classList.add('native-select', this.variant || 'default');\n\n\t\t// wrapper pre label a inputWrapper\n\t\tlet wrapper = document.createElement('div');\n\t\twrapper.classList.add('wrapper');\n\t\twrapper.setAttribute('slot', 'anchor');\n\n\t\t// label\n\t\tlet label = document.createElement('wje-label');\n\t\tlabel.setAttribute('part', 'label');\n\t\tlabel.innerText = this.label || '';\n\n\t\t// obalovac pre input\n\t\tlet inputWrapper = document.createElement('div');\n\t\tinputWrapper.setAttribute('part', 'input-wrapper');\n\t\tinputWrapper.classList.add('input-wrapper');\n\n\t\tlet slotStart = document.createElement('div');\n\t\tslotStart.classList.add('slot-start');\n\n\t\tlet input = document.createElement('input');\n\t\tinput.setAttribute('type', 'text');\n\t\tinput.setAttribute('part', 'input');\n\t\tinput.setAttribute('autocomplete', 'off');\n\t\tinput.setAttribute('readonly', '');\n\t\tinput.setAttribute('placeholder', this.placeholder || '');\n\n\t\tlet slotEnd = document.createElement('div');\n\t\tslotEnd.classList.add('slot-end');\n\n\t\tlet arrow = document.createElement('wje-icon');\n\t\tarrow.setAttribute('name', 'chevron-down');\n\t\tarrow.setAttribute('slot', 'arrow');\n\n\t\tlet chips = document.createElement('div');\n\t\tchips.classList.add('chips');\n\t\tchips.innerText = this.placeholder || '';\n\n\t\t// obalovac pre option a find\n\t\tlet optionsWrapper = document.createElement('div');\n\t\toptionsWrapper.setAttribute('part', 'options-wrapper');\n\t\toptionsWrapper.classList.add('options-wrapper');\n\t\toptionsWrapper.style.setProperty('height', this.maxHeight || 'auto');\n\n\t\tlet list = document.createElement('div');\n\t\tlist.classList.add('list');\n\n\t\tlet slot = document.createElement('slot');\n\n\t\tlet clear = document.createElement('wje-button');\n\t\tclear.setAttribute('fill', 'link');\n\t\tclear.setAttribute('part', 'clear');\n\t\tclear.setAttribute('stop-propagation', '');\n\n\t\tlet clearIcon = document.createElement('wje-icon');\n\t\tclearIcon.setAttribute('name', 'x');\n\n\t\tclear.appendChild(clearIcon);\n\n\t\t// vytvorime popup\n\t\tlet popup = document.createElement('wje-popup');\n\t\tpopup.setAttribute('placement', 'bottom-start');\n\t\tpopup.setAttribute('manual', '');\n\t\tpopup.setAttribute('size', '');\n\t\tpopup.setAttribute('part', 'popup');\n\n\t\tif (this.hasAttribute('disabled')) popup.setAttribute('disabled', '');\n\n\t\tif (this.variant === 'standard') {\n\t\t\tif (this.hasAttribute('label')) native.appendChild(label);\n\t\t} else {\n\t\t\twrapper.appendChild(label);\n\t\t}\n\n\t\tinputWrapper.appendChild(slotStart);\n\t\tinputWrapper.appendChild(input);\n\t\tif (this.hasAttribute('multiple')) inputWrapper.appendChild(chips);\n\n\t\tif (this.hasAttribute('clearable')) inputWrapper.appendChild(clear);\n\n\t\tinputWrapper.appendChild(slotEnd);\n\t\tinputWrapper.appendChild(arrow);\n\n\t\tlist.appendChild(slot);\n\n\t\tif (this.hasAttribute('find')) {\n\t\t\tlet find = document.createElement('wje-input');\n\t\t\tfind.setAttribute('variant', 'standard');\n\t\t\tfind.setAttribute('placeholder', 'Hľadať');\n\t\t\tfind.setAttribute('part', 'find');\n\t\t\tfind.classList.add('find');\n\n\t\t\toptionsWrapper.appendChild(find);\n\n\t\t\tthis.findEl = find;\n\t\t}\n\n\t\tif (this.hasAttribute('lazy')) {\n\t\t\tevent.addListener(popup, 'wje-popup:show', null, (e) => {\n\t\t\t\tif (this._wasOppened) return;\n\t\t\t\tthis._wasOppened = true;\n\n\t\t\t\tconst optionsElement = this.querySelector('wje-options');\n\t\t\t\toptionsElement.setAttribute('lazy', '');\n\t\t\t\toptionsElement.setAttribute('attached', '');\n\t\t\t});\n\t\t} else {\n\t\t\tconst optionsElement = this.querySelector('wje-options');\n\t\t\toptionsElement?.setAttribute('attached', '');\n\t\t}\n\n\t\toptionsWrapper.appendChild(list);\n\n\t\twrapper.appendChild(inputWrapper);\n\t\tpopup.appendChild(optionsWrapper);\n\t\tpopup.appendChild(wrapper);\n\n\t\tif (this.trigger === 'click') popup.setAttribute('manual', '');\n\n\t\tnative.appendChild(popup);\n\n\t\tthis.native = native;\n\t\tthis.popup = popup;\n\t\tthis.labelElement = label;\n\t\tthis.slotStart = slotStart;\n\t\tthis.slotEnd = slotEnd;\n\t\tthis.input = input;\n\t\tthis.optionsWrapper = optionsWrapper;\n\t\tthis.chips = chips;\n\t\tthis.clear = clear;\n\t\tthis.list = list;\n\n\t\tfragment.appendChild(native);\n\n\t\treturn fragment;\n\t}\n\n\t/**\n\t * Sets up the event listeners after the component is drawn.\n\t */\n\tafterDraw() {\n\t\tthis.input.addEventListener('focus', (e) => {\n\t\t\tthis.labelElement?.classList.add('fade');\n\t\t\tthis.native.classList.add('focused');\n\t\t});\n\n\t\tthis.input.addEventListener('blur', (e) => {\n\t\t\tthis.native.classList.remove('focused');\n\t\t\tif (!e.target.value) this.labelElement?.classList.remove('fade');\n\t\t});\n\n\t\tthis.addEventListener('wje-option:change', this.optionChange);\n\n\t\tthis.clear?.addEventListener('wje-button:click', (e) => {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tthis.selectedOptions = [];\n\n\t\t\tthis.getAllOptions().forEach((option) => {\n\t\t\t\toption.selected = false;\n\t\t\t\toption.removeAttribute('selected');\n\t\t\t});\n\t\t\tthis.selections();\n\n\t\t\te.stopPropagation();\n\t\t});\n\n\t\tthis.selectedOptions = this.getSelectedOptions();\n\t\tthis.selections(true);\n\n\t\tthis.list.addEventListener('wje-options:load', (e) => {\n\t\t\t// todo select options from this.selectedOptions\n\t\t\tthis.selectedOptions.forEach((option) => {\n\t\t\t\tthis.getAllOptions().forEach((el) => {\n\t\t\t\t\tif (el.value === option.value) {\n\t\t\t\t\t\tel.selected = true;\n\t\t\t\t\t\tel.setAttribute('selected', '');\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t})\n\n\t\t\tthis.list.scrollTo(0, 0);\n\t\t});\n\n\t\t// skontrolujeme ci ma select atribut find\n\t\tif (this.hasAttribute('find') && this.findEl instanceof HTMLElement) {\n\t\t\tevent.addListener(this.findEl, 'keyup', '', (e) => {\n\t\t\t\t// contains wj-options element with options\n\t\t\t\tconst optionsElement = this.querySelector('wje-options');\n\t\t\t\tif (optionsElement && optionsElement.hasAttribute('lazy')) {\n\t\t\t\t\t// pass search value to wj-options element and infinite scroll will handle the rest\n\t\t\t\t\toptionsElement.setAttribute('search', e.target.value);\n\t\t\t\t} else {\n\t\t\t\t\tlet value = e.target.value.trim().toLowerCase();\n\n\t\t\t\t\tthis.getAllOptions().forEach((option) => {\n\t\t\t\t\t\tif (option.textContent.trim().toLowerCase().includes(value)) option.style.display = 'block';\n\t\t\t\t\t\telse option.style.display = 'none';\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Handles the option change event.\n\t * @param {Event} e The event.\n\t */\n\toptionChange = (e) => {\n\t\te.stopPropagation()\n\t\te.stopImmediatePropagation()\n\n\t\tlet allOptions = this.getAllOptions();\n\n\t\tif (!this.hasAttribute('multiple')) {\n\t\t\tallOptions.forEach((option) => {\n\t\t\t\tif (option.value === e.target.value) {\n\t\t\t\t\tthis.processClickedOption(option);\n\t\t\t\t} else {\n\t\t\t\t\toption.selected = false;\n\t\t\t\t\toption.removeAttribute('selected');\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.popup.hide(false);\n\t\t} else {\n\t\t\tthis.processClickedOption(e.target, true);\n\t\t}\n\n\t\tthis.selections();\n\t};\n\n\t/**\n\t * Handles the selection and deselection of an option element.\n\t * @param {HTMLElement} option The option element that was clicked.\n\t * @param {boolean} [multiple] Indicates whether multiple selection is allowed.\n\t */\n\tprocessClickedOption = (option, multiple = false) => {\n\t\tconst isSelected = option.hasAttribute(\"selected\")\n\t\toption.selected = !isSelected;\n\n\t\tif (isSelected) {\n\t\t\toption.removeAttribute('selected');\n\t\t\tthis.filterOutOption(option);\n\t\t} else {\n\t\t\toption.setAttribute('selected', '');\n\t\t\tthis.selectedOptions = multiple ? [...this.selectedOptions, option] : [option];\n\t\t}\n\t}\n\n\t/**\n\t * Filters out a specified option from the `selectedOptions` array.\n\t * This function removes an option from the `selectedOptions` array if its value\n\t * matches the value of the option provided as an argument. It allows for dynamically\n\t * updating the selected options by excluding the specified option.\n\t * @param {object} option The option to be removed from the `selectedOptions` array.\n\t * Should be an object containing a `value` property that is compared to the\n\t * `value` property of objects in the `selectedOptions` array.\n\t */\n\tfilterOutOption = (option) => {\n\t\tthis.selectedOptions = this.selectedOptions.filter((sOption) => {\n\t\t\treturn sOption.value !== option.value;\n\t\t});\n\t}\n\n\t/**\n\t * Returns all the options as HTML.\n\t * @returns {NodeList} The options as HTML.\n\t */\n\tgetAllOptions() {\n\t\treturn this.querySelectorAll('wje-option');\n\t}\n\n\t/**\n\t * Returns the selected options as HTML.\n\t * @returns {NodeList} The selected options as HTML.\n\t */\n\tgetSelectedOptions() {\n\t\treturn Array.from(this.querySelectorAll('wje-option[selected]'));\n\t}\n\n\t/**\n\t * Returns the selected options.\n\t * @returns {Array} The selected options.\n\t */\n\tgetSelected() {\n\t\treturn this.selectedOptions.map((option) => {\n\t\t\treturn {\n\t\t\t\tvalue: option.value,\n\t\t\t\ttext: option.textContent.trim(),\n\t\t\t};\n\t\t});\n\t}\n\n\t/**\n\t * Handles the selection change.\n\t * @param {Element} option The option that changed.\n\t * @param {number} length The length of the selected options.\n\t */\n\tselectionChanged(option = null, length = 0) {\n\t\tif (this.hasAttribute('multiple')) {\n\t\t\tthis.value = this.selectedOptions.map((el) => el.value).reverse();\n\n\t\t\tif (this.placeholder && length === 0) {\n\t\t\t\tthis.chips.innerHTML = this.placeholder;\n\t\t\t\tthis.input.value = '';\n\t\t\t} else {\n\t\t\t\tif (option !== null) this.chips.appendChild(this.getChip(option));\n\t\t\t\tif (this.counterEl instanceof HTMLElement || !this.maxOptions || length > +this.maxOptions) {\n\t\t\t\t\tthis.counter();\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tlet value = option?.textContent.trim() || '';\n\t\t\tthis.value = this.selectedOptions?.map((el) => el.value)?.at(0);\n\t\t\tthis.input.value = value;\n\n\t\t\tif (option && option instanceof HTMLElement) {\n\t\t\t\tthis.slotStart.innerHTML = '';\n\n\t\t\t\tlet optionSlotStart = option?.querySelector('wje-option > [slot=start]');\n\t\t\t\tif (optionSlotStart) {\n\t\t\t\t\tthis.slotStart.appendChild(optionSlotStart.cloneNode(true));\n\t\t\t\t}\n\n\t\t\t\tthis.slotEnd.innerHTML = '';\n\n\t\t\t\tlet optionSlotEnd = option?.querySelector('wje-option > [slot=end]');\n\t\t\t\tif (optionSlotEnd) {\n\t\t\t\t\tthis.slotEnd.appendChild(optionSlotEnd.cloneNode(true));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Updates the selected options and their corresponding chips.\n\t * @param {boolean} [silence] Determines whether to suppress the \"wje-select:change\" event.\n\t * @returns {void}\n\t * @description\n\t * This method fetches the currently selected options and updates the `selectedOptions` array.\n\t * It clears and rebuilds the chips representing the selected items in the UI.\n\t * If the number of selected options reaches the maximum allowed (`maxOptions`), it stops updating the counter.\n\t * Optionally, it dispatches a custom event when the selection changes unless `silence` is set to `true`.\n\t * //@fires wje-select:change - Dispatched when the selection changes, unless `silence` is `true`.\n\t * @example\n\t * // Call the method and allow event dispatch\n\t * selections();\n\t * @example\n\t * // Call the method without dispatching the event\n\t * selections(true);\n\t */\n\tselections(silence = false) {\n\t\tif (this.selectedOptions.length >= +this.maxOptions) {\n\t\t\tthis.counterEl = null;\n\t\t}\n\n\t\tif (this.chips) {\n\t\t\tthis.chips.innerHTML = '';\n\t\t}\n\n\t\tif (this.selectedOptions.length > 0) {\n\t\t\tthis.selectionChanged(this.selectedOptions.at(0), this.selectedOptions.length);\n\n\t\t} else {\n\t\t\tthis.selectionChanged();\n\t\t}\n\n\t\tif (silence) return;\n\t\tevent.dispatchCustomEvent(this, 'wje-select:change');\n\t}\n\n\t/**\n\t * Manages the display of a counter element to indicate the number of items exceeding the maximum allowed options.\n\t * - If the number of selected items equals the maximum allowed, the counter element is removed.\n\t * - If the counter element doesn't exist and the number of items exceeds the maximum, it is created and updated.\n\t */\n\tcounter() {\n\t\t// zmazanie counter (span)\n\t\tif (this.counterEl && this.value.length === +this.maxOptions) {\n\t\t\tthis.counterEl.remove();\n\t\t\tthis.counterEl = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// ak counter nie je, tak ho vytvorime\n\t\tif (!this.counterEl) {\n\t\t\tthis.counterEl = document.createElement('span');\n\t\t\tthis.counterEl.classList.add('counter');\n\n\t\t\tthis.chips.appendChild(this.counterEl);\n\t\t}\n\n\t\t// nastavime hodnotu counter\n\t\tthis.counterEl.innerText = `+${this.value.length - +this.maxOptions}`;\n\t}\n\n\t/**\n\t * Returns a chip element.\n\t * @param {Element} option The option to get the chip for.\n\t * @returns {Element} The chip element.\n\t */\n\tgetChip(option) {\n\t\tlet chip = document.createElement('wje-chip');\n\t\tchip.size = 'small';\n\t\tchip.removable = true;\n\t\tchip.round = true;\n\t\tchip.addEventListener('wje:chip-remove', this.removeChip);\n\t\tchip.option = option;\n\n\t\tlet label = document.createElement('wje-label');\n\t\tlabel.innerText = option.textContent.trim();\n\n\t\tchip.appendChild(label);\n\n\t\treturn chip;\n\t}\n\n\t/**\n\t * Handles the chip remove event.\n\t * @param {Event} e The event.\n\t */\n\tremoveChip = (e) => {\n\t\te.target.parentNode.removeChild(e.target);\n\t\tthis.processClickedOption(e.target.option, true);\n\t\tthis.selections();\n\t};\n\n\t/**\n\t * Generates an HTML option element based on the provided item and mapping.\n\t * @param {object} item The item to generate the option for.\n\t * @param {object} [map] The mapping object that specifies the properties of the item to use for the option's value and text.\n\t * @param {string} [map.value] The property of the item to use for the option's value.\n\t * @param {string} [map.text] The property of the item to use for the option's text.\n\t * @returns {HTMLElement} The generated HTML option element.\n\t */\n\thtmlOption(item, map = { value: 'value', text: 'text' }) {\n\t\tlet option = document.createElement('wje-option');\n\n\t\tif (item[map.value] === null) {\n\t\t\tconsole.warn(`The item ${JSON.stringify(item)} does not have the property ${map.value}`);\n\t\t}\n\n\t\tif (item[map.text] === null) {\n\t\t\tconsole.warn(`The item ${JSON.stringify(item)} does not have the property ${map.text}`);\n\t\t}\n\n\t\toption.setAttribute('value', item[map.value] ?? '');\n\t\toption.innerText = item[map.text] ?? '';\n\t\treturn option;\n\t}\n\n\t/**\n\t * Adds an option to the select element.\n\t * @param {any} optionData The data for the option to be added.\n\t * @param {boolean} [silent] Whether to suppress any events triggered by the addition of the option.\n\t * @param {object} [map] The mapping object specifying the properties of the option data to be used for the value and text of the option.\n\t */\n\taddOption(optionData, silent = false, map = { value: 'value', text: 'text' }) {\n\t\tif (!optionData) return;\n\n\t\tconst optionsElement = this.querySelector('wje-options');\n\t\tif (optionsElement) {\n\t\t\toptionsElement.addOption(optionData, silent, map);\n\t\t\treturn;\n\t\t}\n\n\t\tlet option = this.htmlOption(optionData, map);\n\t\tthis.appendChild(option);\n\t}\n\n\t/**\n\t * Adds options to the select element.\n\t * @param {Array | object} optionsData The options data to be added. Can be an array of objects or a single object.\n\t * @param {boolean} [silent] Indicates whether to trigger events when adding options. Default is false.\n\t * @param {object} [map] The mapping object that specifies the properties of the options data object. Default is { value: \"value\", text: \"text\" }.\n\t */\n\taddOptions(optionsData, silent = false, map = { value: 'value', text: 'text' }) {\n\t\tif (!Array.isArray(optionsData)) {\n\t\t\tthis.addOption(optionsData, silent, map);\n\t\t} else {\n\t\t\tconst optionsElement = this.querySelector('wje-options');\n\t\t\tif (optionsElement) {\n\t\t\t\toptionsElement.addOptions(optionsData, silent, map);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\toptionsData.forEach((item) => {\n\t\t\t\tthis.addOption(item, silent, map);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Selects an option with the specified value.\n\t * @param {string} value The value of the option to be selected.\n\t * @param {boolean} [silent] Whether to suppress firing events.\n\t */\n\tselectOption(value, silent = false) {\n\t\tif (!value) return;\n\n\t\tlet option = this.querySelector(`wje-option[value=\"${value}\"]`);\n\n\t\tif (option) {\n\t\t\tthis.processClickedOption(option, this.hasAttribute('multiple'));\n\t\t}\n\n\t\tif (this.drawingStatus > this.drawingStatuses.START) this.selections(silent);\n\t}\n\n\t/**\n\t * Selects one or multiple options in the select element.\n\t * @param {Array|any} values The value(s) of the option(s) to be selected.\n\t * @param {boolean} [silent] Whether to trigger the change event or not.\n\t */\n\tselectOptions(values, silent = false) {\n\t\tif (!Array.isArray(values)) {\n\t\t\tthis.selectOption(values, silent);\n\t\t} else {\n\t\t\tvalues.forEach((value) => {\n\t\t\t\tthis.selectOption(value, silent);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * @summary Callback function that is called when the custom element is associated with a form.\n\t * This function adds an event listener to the form's submit event, which validates the input and propagates the validation.\n\t * @param {HTMLFormElement} form The form the custom element is associated with.\n\t */\n\tformAssociatedCallback(form) {\n\t\tif (form) {\n\t\t\tthis.internals.setFormValue(this.value);\n\t\t}\n\t}\n\n\t/**\n\t * The formResetCallback method is a built-in lifecycle callback that gets called when a form gets reset.\n\t * This method is responsible for resetting the value of the custom input element to its default value.\n\t * It also resets the form value and validity state in the form internals.\n\t * @function\n\t */\n\tformResetCallback() {\n\t\t// Set the value of the custom input element to its default value\n\t\tthis.value = this.defaultValue;\n\t\t// Reset the form value in the form internals to the default value\n\t\tthis.internals.setFormValue(this.defaultValue);\n\t\t// Reset the validity state in the form internals\n\t\tthis.internals.setValidity({});\n\t}\n\n\t/**\n\t * The formStateRestoreCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is restored.\n\t * This method is responsible for restoring the value of the custom input element to its saved state.\n\t * It also restores the form value and validity state in the form internals to their saved states.\n\t * @param {object} state The saved state of the custom input element.\n\t * @function\n\t */\n\tformStateRestoreCallback(state) {\n\t\t// Set the value of the custom input element to its saved value\n\t\tthis.value = state.value;\n\t\t// Restore the form value in the form internals to the saved value\n\t\tthis.internals.setFormValue(state.value);\n\t\t// Restore the validity state in the form internals to the saved state\n\t\tthis.internals.setValidity({});\n\t}\n\n\t/**\n\t * The formStateSaveCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is saved.\n\t * This method is responsible for saving the value of the custom input element.\n\t * @returns {object} The saved state of the custom input element.\n\t * @function\n\t */\n\tformStateSaveCallback() {\n\t\treturn {\n\t\t\tvalue: this.value,\n\t\t};\n\t}\n\n\t/**\n\t * The formDisabledCallback method is a built-in lifecycle callback that gets called when the disabled state of a form-associated custom element changes.\n\t * This method is not implemented yet.\n\t * @param {boolean} disabled The new disabled state of the custom input element.\n\t * @function\n\t */\n\tformDisabledCallback(disabled) {\n\t\tconsole.warn('formDisabledCallback not implemented yet');\n\t\tthis.native?.classList.toggle('disabled', disabled);\n\t\tthis.toggleAttribute('disabled', disabled);\n\t}\n\n\t/**\n\t * Checks if all elements in the `elements` array are present in the `options` array based on their `option` property.\n\t * @param {Array} elements The array of elements to check. Each element should have an `option` property.\n\t * @param {Array} options The array of options to verify against.\n\t * @returns {boolean} Returns true if all elements in the `elements` array are found within the `options` array, otherwise returns false.\n\t */\n\tareAllElementsInOptions(elements, options) {\n\t\tif (elements.length === 0) return false;\n\n\t\treturn elements.every(el =>\n\t\t\toptions.some(opt => JSON.stringify(opt) === JSON.stringify(el.option))\n\t\t);\n\t}\n}\n","import Select from './select.element.js';\n\nexport default Select;\n\nSelect.define('wje-select', Select);\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;AAyCe,MAAM,eAAe,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAW7C,cAAc;AACb,UAAO;AA+GR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wCAAe;AAAA,MACd,cAAc;AAAA,MACd,aAAa;AAAA,MACb,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,cAAc;AAAA,MACd,eAAe;AAAA,IACf;AAqLD,qCAAY;AA6PZ;AAAA;AAAA;AAAA;AAAA,wCAAe,CAAC,MAAM;AACrB,QAAE,gBAAe;AACjB,QAAE,yBAAwB;AAE1B,UAAI,aAAa,KAAK,cAAe;AAErC,UAAI,CAAC,KAAK,aAAa,UAAU,GAAG;AACnC,mBAAW,QAAQ,CAAC,WAAW;AAC9B,cAAI,OAAO,UAAU,EAAE,OAAO,OAAO;AACpC,iBAAK,qBAAqB,MAAM;AAAA,UACrC,OAAW;AACN,mBAAO,WAAW;AAClB,mBAAO,gBAAgB,UAAU;AAAA,UACtC;AAAA,QACA,CAAI;AACD,aAAK,MAAM,KAAK,KAAK;AAAA,MACxB,OAAS;AACN,aAAK,qBAAqB,EAAE,QAAQ,IAAI;AAAA,MAC3C;AAEE,WA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D,eAAK,WAAL,mBAAa,UAAU,OAAO,YAAY;AAC1C,SAAK,gBAAgB,YAAY,QAAQ;AAAA,EAC3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQC,wBAAwB,UAAU,SAAS;AAC1C,QAAI,SAAS,WAAW,EAAG,QAAO;AAElC,WAAO,SAAS;AAAA,MAAM,QACrB,QAAQ,KAAK,SAAO,KAAK,UAAU,GAAG,MAAM,KAAK,UAAU,GAAG,MAAM,CAAC;AAAA,IACrE;AAAA,EACH;AACA;AAAA;AAAA;AAAA;AAAA;AAhnBC,cAjVoB,QAiVb,kBAAiB;ACtXzB,OAAO,OAAO,cAAc,MAAM;"}
1
+ {"version":3,"file":"wje-select.js","sources":["../packages/wje-select/select.element.js","../packages/wje-select/select.js"],"sourcesContent":["import { default as WJElement, event } from '../wje-element/element.js';\nimport Button from '../wje-button/button.js';\nimport Popup from '../wje-popup/popup.js';\nimport Icon from '../wje-icon/icon.js';\nimport Label from '../wje-label/label.js';\nimport Chip from '../wje-chip/chip.js';\nimport Input from '../wje-input/input.js';\nimport Option from '../wje-option/option.js';\nimport Options from '../wje-options/options.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Select` is a custom web component that represents a select input.\n * @summary This element represents a select input.\n * @documentation https://elements.webjet.sk/components/select\n * @status stable\n * @augments {WJElement}\n * @slot - The default slot for the select.\n * @slot anchor - The slot for the anchor.\n * @slot arrow - The slot for the arrow.\n * @csspart native - The native select wrapper.\n * @csspart input - The input field.\n * @csspart clear - The clear button.\n * @property {Array} _selected - An array to store selected items.\n * @property {HTMLElement|null} counterEl - A reference to the counter element, initially null.\n * @property {ElementInternals} internals - The internal element API for managing state and attributes.\n * @property {number} maxOptions - The maximum number of options allowed.\n * @property {boolean} _wasOppened - Tracks whether the select element was previously opened, initially false.\n * @cssproperty [--wje-select-border-width=1px] - Specifies the width of the border around the select component. Accepts any valid CSS length unit (e.g., `px`, `rem`, `em`).\n * @cssproperty [--wje-select-border-style=solid] - Defines the style of the border for the select component. Accepts standard CSS border styles, such as `solid`, `dashed`, or `dotted`.\n * @cssproperty [--wje-select-border-color=var(--wje-border-color)] - Sets the color of the border for the select component. Accepts any valid CSS color value, including color variables, named colors, and hex values.\n * @cssproperty [--wje-select-options-border-width=1px] - Specifies the width of the border for the select options dropdown. Accepts any valid CSS length unit.\n * @cssproperty [--wje-select-options-border-style=var(--wje-border-style)] - Defines the border style for the select options dropdown. Inherits from a defined CSS variable for consistency.\n * @cssproperty [--wje-select-options-border-color=var(--wje-border-color)] - Sets the border color for the select options dropdown. Accepts any valid CSS color value.\n * @cssproperty [--wje-select-background=var(--wje-background)] - Specifies the background color of the select component. Accepts any valid CSS color value.\n * @cssproperty [--wje-select-line-height=20px] - Defines the line height for the text within the select component. Accepts any valid CSS length value, ensuring consistent vertical alignment.\n * @cssproperty [--wje-select-color=var(--wje-color)] - Sets the text color for the select component. Accepts any valid CSS color value.\n * @cssproperty [--wje-select-border-radius=var(--wje-border-radius-medium)] - Specifies the border radius for the select component.Determines the roundness of the corners and accepts any valid CSS length unit or variable.\n * @tag wje-select\n */\n\nexport default class Select extends WJElement {\n\t#addedOptions = []\n\t#htmlOptions = []\n\t/**\n\t * Constructor for the Select class.\n\t * @class\n\t * @description Initializes the Select component.\n\t * This constructor sets up the initial state of the component, including selected items, counter element, and internal element API.\n\t * It also tracks whether the select element was previously opened.\n\t * @class\n\t * @augments {WJElement}\n\t * @memberof Select\n\t */\n\tconstructor() {\n\t\tsuper();\n\n\t\t/**\n\t\t * @type {Array}\n\t\t * @description An array to store selected items.\n\t\t */\n\t\tthis._selected = [];\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the counter element, initially null.\n\t\t * @private\n\t\t */\n\t\tthis.counterEl = null;\n\n\t\t/**\n\t\t * @type {ElementInternals}\n\t\t * @description The internal element API for managing state and attributes.\n\t\t * @private\n\t\t * @readonly\n\t\t * @constant\n\t\t * @default {ElementInternals} this.attachInternals()\n\t\t * @description Attaches the internals to the element.\n\t\t */\n\t\tthis.internals = this.attachInternals();\n\n\t\t/**\n\t\t * @type {boolean}\n\t\t * @description Tracks whether the select element was previously opened, initially false.\n\t\t * @private\n\t\t * @default {boolean} false\n\t\t */\n\t\tthis._wasOppened = false;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the native select element, initially null.\n\t\t */\n\t\tthis.native = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the popup element, initially null.\n\t\t */\n\t\tthis.popup = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the label element, initially null.\n\t\t */\n\t\tthis.labelElement = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the slot start element, initially null.\n\t\t */\n\t\tthis.slotStart = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the slot end element, initially null.\n\t\t */\n\t\tthis.slotEnd = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the input element, initially null.\n\t\t */\n\t\tthis.input = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the options wrapper element, initially null.\n\t\t */\n\t\tthis.optionsWrapper = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the chips element, initially null.\n\t\t */\n\t\tthis.chips = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the clear button element, initially null.\n\t\t */\n\t\tthis.clear = null;\n\n\t\t/**\n\t\t * @type {HTMLElement|null}\n\t\t * @description A reference to the list element, initially null.\n\t\t */\n\t\tthis.list = null;\n\n\t\tthis.selectedOptions = []\n\t}\n\n\t/**\n\t * An object representing component dependencies with their respective classes.\n\t * Each property in the object maps a custom component name (as a string key)\n\t * to its corresponding class or constructor.\n\t * @typedef {{[key: string]: Function}} Dependencies\n\t * @property {Function} 'wje-button' Represents the Button component class.\n\t * @property {Function} 'wje-popup' Represents the Popup component class.\n\t * @property {Function} 'wje-icon' Represents the Icon component class.\n\t * @property {Function} 'wje-label' Represents the Label component class.\n\t * @property {Function} 'wje-chip' Represents the Chip component class.\n\t * @property {Function} 'wje-input' Represents the Input component class.\n\t * @property {Function} 'wje-option' Represents the Option component class.\n\t * @property {Function} 'wje-options' Represents the Options component class.\n\t */\n\tdependencies = {\n\t\t'wje-button': Button,\n\t\t'wje-popup': Popup,\n\t\t'wje-icon': Icon,\n\t\t'wje-label': Label,\n\t\t'wje-chip': Chip,\n\t\t'wje-input': Input,\n\t\t'wje-option': Option,\n\t\t'wje-options': Options,\n\t};\n\n\t/**\n\t * Setter for the value attribute.\n\t * @param {string} value The value to set.\n\t */\n\tset value(value) {\n\t\tif (this.hasAttribute('multiple')) {\n\t\t\tconst formData = new FormData();\n\t\t\tvalue.forEach(v => formData.append(this.name, v));\n\t\t\tthis.internals.setFormValue(formData);\n\t\t} else {\n\t\t\tthis.internals.setFormValue(value);\n\t\t}\n\t}\n\n\t/**\n\t * Getter for the value attribute.\n\t * @returns {object} The value of the attribute.\n\t */\n\tget value() {\n\t\treturn this.selected;\n\t}\n\n\t/**\n\t * Getter for the customErrorDisplay attribute.\n\t * @returns {boolean} Whether the attribute is present.\n\t */\n\tget customErrorDisplay() {\n\t\treturn this.hasAttribute('custom-error-display');\n\t}\n\n\t/**\n\t * Getter for the validateOnChange attribute.\n\t * @returns {boolean} Whether the attribute is present.\n\t */\n\tget validateOnChange() {\n\t\treturn this.hasAttribute('validate-on-change');\n\t}\n\n\t/**\n\t * Getter for the invalid attribute.\n\t * @returns {boolean} Whether the attribute is present.\n\t */\n\tget invalid() {\n\t\treturn this.hasAttribute('invalid');\n\t}\n\n\t/**\n\t * Setter for the invalid attribute.\n\t * @param {boolean} isInvalid Whether the input is invalid.\n\t */\n\tset invalid(isInvalid) {\n\t\tif (isInvalid) this.setAttribute('invalid', '');\n\t\telse this.removeAttribute('invalid');\n\t}\n\n\t/**\n\t * Sets the maximum number of options allowed.\n\t * @param {string | number | null} value The value to set as the maximum number of options.\n\t * If null, the 'max-options' attribute will be removed.\n\t */\n\tset maxOptions(value) {\n\t\tif (value) {\n\t\t\tthis.setAttribute('max-options', value);\n\t\t} else {\n\t\t\tthis.removeAttribute('max-options');\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves the maximum number of options allowed.\n\t * Parses the value of the 'max-options' attribute from the element and converts it to a number.\n\t * If the attribute is not present or cannot be converted to a valid number, defaults to 1.\n\t * @returns {number} The maximum number of options, or 0 if the attribute is not set or invalid.\n\t */\n\tget maxOptions() {\n\t\treturn +this.getAttribute('max-options') || 1;\n\t}\n\n\t/**\n\t * Getter for the form attribute.\n\t * @returns {HTMLFormElement} The form the input is associated with.\n\t */\n\tget form() {\n\t\treturn this.internals.form;\n\t}\n\n\t/**\n\t * Getter for the name attribute.\n\t * @returns {string} The name of the input.\n\t */\n\tget name() {\n\t\treturn this.getAttribute('name');\n\t}\n\n\t/**\n\t * Getter for the type attribute.\n\t * @returns {string} The type of the input.\n\t */\n\tget type() {\n\t\treturn this.localName;\n\t}\n\n\t/**\n\t * Getter for the validity attribute.\n\t * @returns {ValidityState} The validity state of the input.\n\t */\n\tget validity() {\n\t\treturn this.internals.validity;\n\t}\n\n\t/**\n\t * Getter for the validationMessage attribute.\n\t * @returns {string} The validation message of the input.\n\t */\n\tget validationMessage() {\n\t\treturn this.internals.validationMessage;\n\t}\n\n\t/**\n\t * Getter for the willValidate attribute.\n\t * @returns {boolean} Whether the input will be validated.\n\t */\n\tget willValidate() {\n\t\treturn this.internals.willValidate;\n\t}\n\n\t/**\n\t * @summary Getter for the defaultValue attribute.\n\t * This method retrieves the 'value' attribute of the custom input element.\n\t * The 'value' attribute represents the default value of the input element.\n\t * If the 'value' attribute is not set, it returns an empty string.\n\t * @returns {string} The default value of the input element.\n\t */\n\tget defaultValue() {\n\t\treturn this.getAttribute('value') ?? '';\n\t}\n\n\t/**\n\t * @summary Setter for the defaultValue attribute.\n\t * This method sets the 'value' attribute of the custom input element to the provided value.\n\t * The 'value' attribute represents the default value of the input element.\n\t * @param {string} value The value to set as the default value.\n\t */\n\tset defaultValue(value) {\n\t\tthis.setAttribute('value', value);\n\t}\n\n\t/**\n\t * Sets the label value.\n\t * @param {Array} value The selected value to set.\n\t */\n\tset selected(value) {\n\t\tthis._selected = value;\n\t}\n\n\t/**\n\t * Returns the selected value.\n\t * @returns {Array} The selected value.\n\t */\n\tget selected() {\n\t\treturn this.getSelected();\n\t}\n\n\tget options() {\n\t\tif (this.querySelector('wje-options')) {\n\t\t\tconst allOptions = [...this.querySelector('wje-options').loadedOptions, ...this.#addedOptions, ...this.#htmlOptions]\n\n\t\t\treturn allOptions\n\t\t} else {\n\t\t\tconst allOptions = [...this.#addedOptions, ...this.#htmlOptions]\n\n\t\t\treturn Array.from(\n\t\t\t\tnew Map(allOptions.reverse().map(obj => [obj.value, obj])).values()\n\t\t\t).reverse();\n\t\t}\n\t}\n\n\t/**\n\t * Sets the trigger value.\n\t * @param {string} value The trigger value to set.\n\t */\n\tset trigger(value) {\n\t\tthis.setAttribute('trigger', value);\n\t}\n\n\t/**\n\t * Returns the trigger value.\n\t * @returns {string} The trigger value.\n\t */\n\tget trigger() {\n\t\treturn this.getAttribute('trigger') || 'click';\n\t}\n\n\tclassName = 'Select';\n\n\t/**\n\t * Returns the CSS styles for the component.\n\t * @static\n\t * @returns {CSSStyleSheet}\n\t */\n\tstatic get cssStyleSheet() {\n\t\treturn styles;\n\t}\n\n\t/**\n\t * Returns the list of attributes to observe for changes.\n\t * @static\n\t * @returns {Array<string>}\n\t */\n\tstatic get observedAttributes() {\n\t\treturn ['active', 'value', 'disabled', 'multiple', 'label', 'placeholder', 'max-height', 'max-options', 'variant', 'placement'];\n\t}\n\n\t/**\n\t * Whether the input is associated with a form.\n\t * @type {boolean}\n\t */\n\tstatic formAssociated = true;\n\n\t/**\n\t * Sets up the attributes for the component.\n\t */\n\tsetupAttributes() {\n\t\tthis.isShadowRoot = 'open';\n\t}\n\n\t/**\n\t * Draws the component for the select.\n\t * @returns {DocumentFragment}\n\t */\n\tdraw() {\n\t\tlet fragment = document.createDocumentFragment();\n\n\t\tthis.classList.add('wje-placement', this.placement ? 'wje-' + this.placement : 'wje-start');\n\n\t\t// zakladny obalovac\n\t\tlet native = document.createElement('div');\n\t\tnative.setAttribute('part', 'native');\n\t\tnative.classList.add('native-select', this.variant || 'default');\n\n\t\t// wrapper pre label a inputWrapper\n\t\tlet wrapper = document.createElement('div');\n\t\twrapper.classList.add('wrapper');\n\t\twrapper.setAttribute('slot', 'anchor');\n\n\t\t// label\n\t\tlet label = document.createElement('wje-label');\n\t\tlabel.setAttribute('part', 'label');\n\t\tlabel.innerText = this.label || '';\n\n\t\t// obalovac pre input\n\t\tlet inputWrapper = document.createElement('div');\n\t\tinputWrapper.setAttribute('part', 'input-wrapper');\n\t\tinputWrapper.classList.add('input-wrapper');\n\n\t\tlet slotStart = document.createElement('div');\n\t\tslotStart.classList.add('slot-start');\n\n\t\tlet input = document.createElement('input');\n\t\tinput.setAttribute('type', 'text');\n\t\tinput.setAttribute('part', 'input');\n\t\tinput.setAttribute('autocomplete', 'off');\n\t\tinput.setAttribute('readonly', '');\n\t\tinput.setAttribute('placeholder', this.placeholder || '');\n\n\t\tlet slotEnd = document.createElement('div');\n\t\tslotEnd.classList.add('slot-end');\n\n\t\tlet arrow = document.createElement('wje-icon');\n\t\tarrow.setAttribute('name', 'chevron-down');\n\t\tarrow.setAttribute('slot', 'arrow');\n\n\t\tlet chips = document.createElement('div');\n\t\tchips.classList.add('chips');\n\t\tchips.innerText = this.placeholder || '';\n\n\t\t// obalovac pre option a find\n\t\tlet optionsWrapper = document.createElement('div');\n\t\toptionsWrapper.setAttribute('part', 'options-wrapper');\n\t\toptionsWrapper.classList.add('options-wrapper');\n\t\toptionsWrapper.style.setProperty('height', this.maxHeight || 'auto');\n\n\t\tlet list = document.createElement('div');\n\t\tlist.classList.add('list');\n\n\t\tlet slot = document.createElement('slot');\n\n\t\tlet clear = document.createElement('wje-button');\n\t\tclear.setAttribute('fill', 'link');\n\t\tclear.setAttribute('part', 'clear');\n\t\tclear.setAttribute('stop-propagation', '');\n\n\t\tlet clearIcon = document.createElement('wje-icon');\n\t\tclearIcon.setAttribute('name', 'x');\n\n\t\tclear.appendChild(clearIcon);\n\n\t\t// vytvorime popup\n\t\tlet popup = document.createElement('wje-popup');\n\t\tpopup.setAttribute('placement', 'bottom-start');\n\t\tpopup.setAttribute('manual', '');\n\t\tpopup.setAttribute('size', '');\n\t\tpopup.setAttribute('part', 'popup');\n\n\t\tif (this.hasAttribute('disabled')) popup.setAttribute('disabled', '');\n\n\t\tif (this.variant === 'standard') {\n\t\t\tif (this.hasAttribute('label')) native.appendChild(label);\n\t\t} else {\n\t\t\twrapper.appendChild(label);\n\t\t}\n\n\t\tinputWrapper.appendChild(slotStart);\n\t\tinputWrapper.appendChild(input);\n\t\tif (this.hasAttribute('multiple')) inputWrapper.appendChild(chips);\n\n\t\tif (this.hasAttribute('clearable')) inputWrapper.appendChild(clear);\n\n\t\tinputWrapper.appendChild(slotEnd);\n\t\tinputWrapper.appendChild(arrow);\n\n\t\tlist.appendChild(slot);\n\n\t\tif (this.hasAttribute('find')) {\n\t\t\tlet find = document.createElement('wje-input');\n\t\t\tfind.setAttribute('variant', 'standard');\n\t\t\tfind.setAttribute('placeholder', 'Hľadať');\n\t\t\tfind.setAttribute('part', 'find');\n\t\t\tfind.classList.add('find');\n\n\t\t\toptionsWrapper.appendChild(find);\n\n\t\t\tthis.findEl = find;\n\t\t}\n\n\t\tif (this.hasAttribute('lazy')) {\n\t\t\tevent.addListener(popup, 'wje-popup:show', null, (e) => {\n\t\t\t\tif (this._wasOppened) return;\n\t\t\t\tthis._wasOppened = true;\n\n\t\t\t\tconst optionsElement = this.querySelector('wje-options');\n\t\t\t\toptionsElement.setAttribute('lazy', '');\n\t\t\t\toptionsElement.setAttribute('attached', '');\n\t\t\t});\n\t\t} else {\n\t\t\tconst optionsElement = this.querySelector('wje-options');\n\t\t\toptionsElement?.setAttribute('attached', '');\n\t\t}\n\n\t\toptionsWrapper.appendChild(list);\n\n\t\twrapper.appendChild(inputWrapper);\n\t\tpopup.appendChild(optionsWrapper);\n\t\tpopup.appendChild(wrapper);\n\n\t\tif (this.trigger === 'click') popup.setAttribute('manual', '');\n\n\t\tnative.appendChild(popup);\n\n\t\tthis.native = native;\n\t\tthis.popup = popup;\n\t\tthis.labelElement = label;\n\t\tthis.slotStart = slotStart;\n\t\tthis.slotEnd = slotEnd;\n\t\tthis.input = input;\n\t\tthis.optionsWrapper = optionsWrapper;\n\t\tthis.chips = chips;\n\t\tthis.clear = clear;\n\t\tthis.list = list;\n\n\t\tfragment.appendChild(native);\n\n\t\treturn fragment;\n\t}\n\n\t/**\n\t * Sets up the event listeners after the component is drawn.\n\t */\n\tafterDraw() {\n\t\tthis.#htmlOptions = Array.from(this.querySelectorAll(':scope > wje-option')).map((option) => {\n\t\t\treturn {\n\t\t\t\tvalue: option.value,\n\t\t\t\ttext: option.textContent.trim(),\n\t\t\t};\n\t\t})\n\n\t\tthis.input.addEventListener('focus', (e) => {\n\t\t\tthis.labelElement?.classList.add('fade');\n\t\t\tthis.native.classList.add('focused');\n\t\t});\n\n\t\tthis.input.addEventListener('blur', (e) => {\n\t\t\tthis.native.classList.remove('focused');\n\t\t\tif (!e.target.value) this.labelElement?.classList.remove('fade');\n\t\t});\n\n\t\tthis.addEventListener('wje-option:change', this.optionChange);\n\n\t\tthis.clear?.addEventListener('wje-button:click', (e) => {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tthis.selectedOptions = [];\n\n\t\t\tthis.getAllOptions().forEach((option) => {\n\t\t\t\toption.selected = false;\n\t\t\t\toption.removeAttribute('selected');\n\t\t\t});\n\t\t\tthis.selections();\n\n\t\t\te.stopPropagation();\n\t\t});\n\n\t\tthis.selectedOptions = this.getSelectedOptions();\n\t\tthis.selections(true);\n\n\t\tthis.list.addEventListener('wje-options:load', (e) => {\n\t\t\t// todo select options from this.selectedOptions\n\t\t\tthis.selectedOptions.forEach((option) => {\n\t\t\t\tthis.getAllOptions().forEach((el) => {\n\t\t\t\t\tif (el.value === option.value) {\n\t\t\t\t\t\tel.selected = true;\n\t\t\t\t\t\tel.setAttribute('selected', '');\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t})\n\n\t\t\tthis.list.scrollTo(0, 0);\n\t\t});\n\n\t\t// skontrolujeme ci ma select atribut find\n\t\tif (this.hasAttribute('find') && this.findEl instanceof HTMLElement) {\n\t\t\tevent.addListener(this.findEl, 'keyup', '', (e) => {\n\t\t\t\t// contains wj-options element with options\n\t\t\t\tconst optionsElement = this.querySelector('wje-options');\n\t\t\t\tif (optionsElement && optionsElement.hasAttribute('lazy')) {\n\t\t\t\t\t// pass search value to wj-options element and infinite scroll will handle the rest\n\t\t\t\t\toptionsElement.setAttribute('search', e.target.value);\n\t\t\t\t} else {\n\t\t\t\t\tlet value = e.target.value.trim().toLowerCase();\n\n\t\t\t\t\tthis.getAllOptions().forEach((option) => {\n\t\t\t\t\t\tif (option.textContent.trim().toLowerCase().includes(value)) option.style.display = 'block';\n\t\t\t\t\t\telse option.style.display = 'none';\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Handles the option change event.\n\t * @param {Event} e The event.\n\t */\n\toptionChange = (e) => {\n\t\te.stopPropagation()\n\t\te.stopImmediatePropagation()\n\n\t\tlet allOptions = this.getAllOptions();\n\n\t\tif (!this.hasAttribute('multiple')) {\n\t\t\tallOptions.forEach((option) => {\n\t\t\t\tif (option.value === e.target.value) {\n\t\t\t\t\tthis.processClickedOption(option);\n\t\t\t\t} else {\n\t\t\t\t\toption.selected = false;\n\t\t\t\t\toption.removeAttribute('selected');\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.popup.hide(false);\n\t\t} else {\n\t\t\tthis.processClickedOption(e.target, true);\n\t\t}\n\n\t\tthis.selections();\n\t};\n\n\t/**\n\t * Handles the selection and deselection of an option element.\n\t * @param {HTMLElement} option The option element that was clicked.\n\t * @param {boolean} [multiple] Indicates whether multiple selection is allowed.\n\t */\n\tprocessClickedOption = (option, multiple = false) => {\n\t\tconst isSelected = option.hasAttribute(\"selected\")\n\t\toption.selected = !isSelected;\n\n\t\tif (isSelected) {\n\t\t\toption.removeAttribute('selected');\n\t\t\tthis.filterOutOption(option);\n\t\t} else {\n\t\t\toption.setAttribute('selected', '');\n\t\t\tthis.selectedOptions = multiple ? [...this.selectedOptions, option] : [option];\n\t\t}\n\t}\n\n\t/**\n\t * Filters out a specified option from the `selectedOptions` array.\n\t * This function removes an option from the `selectedOptions` array if its value\n\t * matches the value of the option provided as an argument. It allows for dynamically\n\t * updating the selected options by excluding the specified option.\n\t * @param {object} option The option to be removed from the `selectedOptions` array.\n\t * Should be an object containing a `value` property that is compared to the\n\t * `value` property of objects in the `selectedOptions` array.\n\t */\n\tfilterOutOption = (option) => {\n\t\tthis.selectedOptions = this.selectedOptions.filter((sOption) => {\n\t\t\treturn sOption.value !== option.value;\n\t\t});\n\t}\n\n\t/**\n\t * Returns all the options as HTML.\n\t * @returns {NodeList} The options as HTML.\n\t */\n\tgetAllOptions() {\n\t\treturn this.querySelectorAll('wje-option');\n\t}\n\n\t/**\n\t * Returns the selected options as HTML.\n\t * @returns {NodeList} The selected options as HTML.\n\t */\n\tgetSelectedOptions() {\n\t\treturn Array.from(this.querySelectorAll('wje-option[selected]'));\n\t}\n\n\t/**\n\t * Returns the selected options.\n\t * @returns {Array} The selected options.\n\t */\n\tgetSelected() {\n\t\treturn this.selectedOptions.map((option) => {\n\t\t\treturn {\n\t\t\t\tvalue: option.value,\n\t\t\t\ttext: this.#htmlSelectedItem(option.value) // option.textContent.trim(),\n\t\t\t};\n\t\t});\n\t}\n\n\t/**\n\t * Handles the selection change.\n\t * @param {Element[]} options The option that changed.\n\t * @param {number} length The length of the selected options.\n\t */\n\tselectionChanged(options = null, length = 0) {\n\t\tif (this.hasAttribute('multiple')) {\n\n\t\t\tthis.value = this.selectedOptions.map((el) => el.value).reverse();\n\n\t\t\tif (this.placeholder && length === 0) {\n\t\t\t\tthis.chips.innerHTML = this.placeholder;\n\t\t\t\tthis.input.value = '';\n\t\t\t} else {\n\t\t\t\tif (options !== null) Array.from(options).slice(0, +this.maxOptions).forEach(option => this.chips.appendChild(this.getChip(option)));\n\t\t\t\tif (this.counterEl instanceof HTMLElement || !this.maxOptions || length > +this.maxOptions) {\n\t\t\t\t\tthis.counter();\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tlet option = options?.at(0);\n\t\t\tlet value = (option && this.#htmlSelectedItem(option.value)) ?? \"\" // option?.textContent.trim() || '';\n\t\t\tthis.value = this.selectedOptions?.map((el) => el.value)?.at(0);\n\t\t\tthis.input.value = value;\n\n\t\t\tif (option && option instanceof HTMLElement) {\n\t\t\t\tthis.slotStart.innerHTML = '';\n\n\t\t\t\tlet optionSlotStart = option?.querySelector('wje-option > [slot=start]');\n\t\t\t\tif (optionSlotStart) {\n\t\t\t\t\tthis.slotStart.appendChild(optionSlotStart.cloneNode(true));\n\t\t\t\t}\n\n\t\t\t\tthis.slotEnd.innerHTML = '';\n\n\t\t\t\tlet optionSlotEnd = option?.querySelector('wje-option > [slot=end]');\n\t\t\t\tif (optionSlotEnd) {\n\t\t\t\t\tthis.slotEnd.appendChild(optionSlotEnd.cloneNode(true));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Updates the selected options and their corresponding chips.\n\t * @param {boolean} [silence] Determines whether to suppress the \"wje-select:change\" event.\n\t * @returns {void}\n\t * @description\n\t * This method fetches the currently selected options and updates the `selectedOptions` array.\n\t * It clears and rebuilds the chips representing the selected items in the UI.\n\t * If the number of selected options reaches the maximum allowed (`maxOptions`), it stops updating the counter.\n\t * Optionally, it dispatches a custom event when the selection changes unless `silence` is set to `true`.\n\t * //@fires wje-select:change - Dispatched when the selection changes, unless `silence` is `true`.\n\t * @example\n\t * // Call the method and allow event dispatch\n\t * selections();\n\t * @example\n\t * // Call the method without dispatching the event\n\t * selections(true);\n\t */\n\tselections(silence = false) {\n\t\tif (this.selectedOptions.length >= +this.maxOptions) {\n\t\t\tthis.counterEl = null;\n\t\t}\n\n\t\tif (this.chips) {\n\t\t\tthis.chips.innerHTML = '';\n\t\t}\n\n\t\tif (this.selectedOptions.length > 0) {\n\t\t\tthis.selectionChanged(this.selectedOptions, this.selectedOptions.length);\n\n\t\t} else {\n\t\t\tthis.selectionChanged();\n\t\t}\n\n\t\tif (silence) return;\n\t\tevent.dispatchCustomEvent(this, 'wje-select:change');\n\t}\n\n\t/**\n\t * Manages the display of a counter element to indicate the number of items exceeding the maximum allowed options.\n\t * - If the number of selected items equals the maximum allowed, the counter element is removed.\n\t * - If the counter element doesn't exist and the number of items exceeds the maximum, it is created and updated.\n\t */\n\tcounter() {\n\t\t// zmazanie counter (span)\n\t\tif (this.counterEl && this.value.length === +this.maxOptions) {\n\t\t\tthis.counterEl.remove();\n\t\t\tthis.counterEl = null;\n\t\t\treturn;\n\t\t}\n\n\t\t// ak counter nie je, tak ho vytvorime\n\t\tif (!this.counterEl) {\n\t\t\tthis.counterEl = document.createElement('span');\n\t\t\tthis.counterEl.classList.add('counter');\n\n\t\t\tthis.chips.appendChild(this.counterEl);\n\t\t}\n\n\t\t// nastavime hodnotu counter\n\t\tthis.counterEl.innerText = `+${this.value.length - +this.maxOptions}`;\n\t}\n\n\t/**\n\t * Returns a chip element.\n\t * @param {Element} option The option to get the chip for.\n\t * @returns {Element} The chip element.\n\t */\n\tgetChip(option) {\n\t\tlet chip = document.createElement('wje-chip');\n\t\tchip.size = 'small';\n\t\tchip.removable = true;\n\t\tchip.round = true;\n\t\tchip.addEventListener('wje:chip-remove', this.removeChip);\n\t\tchip.option = option;\n\n\t\tlet label = document.createElement('wje-label');\n\t\tlabel.innerHTML = this.#htmlSelectedItem(option.value) // option.textContent.trim();\n\n\t\tchip.appendChild(label);\n\n\t\treturn chip;\n\t}\n\n\t/**\n\t * Handles the chip remove event.\n\t * @param {Event} e The event.\n\t */\n\tremoveChip = (e) => {\n\t\te.target.parentNode.removeChild(e.target);\n\t\tthis.processClickedOption(e.target.option, true);\n\t\tthis.selections();\n\t};\n\n\t/**\n\t * Generates an HTML option element based on the provided item and mapping.\n\t * @param {object} item The item to generate the option for.\n\t * @param {object} [map] The mapping object that specifies the properties of the item to use for the option's value and text.\n\t * @param {string} [map.value] The property of the item to use for the option's value.\n\t * @param {string} [map.text] The property of the item to use for the option's text.\n\t * @returns {HTMLElement} The generated HTML option element.\n\t */\n\thtmlOption(item, map = { value: 'value', text: 'text' }) {\n\t\tlet option = document.createElement('wje-option');\n\n\t\tif (item[map.value] === null) {\n\t\t\tconsole.warn(`The item ${JSON.stringify(item)} does not have the property ${map.value}`);\n\t\t}\n\n\t\tif (item[map.text] === null) {\n\t\t\tconsole.warn(`The item ${JSON.stringify(item)} does not have the property ${map.text}`);\n\t\t}\n\n\t\toption.setAttribute('value', item[map.value] ?? '');\n\t\toption.innerText = item[map.text] ?? '';\n\n\t\tthis.#addedOptions.push({ [map.value]: item[map.value], [map.text]: item[map.text] });\n\t\treturn option;\n\t}\n\n\t/**\n\t * Adds an option to the select element.\n\t * @param {any} optionData The data for the option to be added.\n\t * @param {boolean} [silent] Whether to suppress any events triggered by the addition of the option.\n\t * @param {object} [map] The mapping object specifying the properties of the option data to be used for the value and text of the option.\n\t */\n\taddOption(optionData, silent = false, map = { value: 'value', text: 'text' }) {\n\t\tif (!optionData) return;\n\n\t\tconst optionsElement = this.querySelector('wje-options');\n\t\tif (optionsElement) {\n\t\t\toptionsElement.addOption(optionData, silent, map);\n\t\t\treturn;\n\t\t}\n\t\tlet option = this.htmlOption(optionData, map);\n\t\tthis.appendChild(option);\n\t}\n\n\t/**\n\t * Adds options to the select element.\n\t * @param {Array | object} optionsData The options data to be added. Can be an array of objects or a single object.\n\t * @param {boolean} [silent] Indicates whether to trigger events when adding options. Default is false.\n\t * @param {object} [map] The mapping object that specifies the properties of the options data object. Default is { value: \"value\", text: \"text\" }.\n\t */\n\taddOptions(optionsData, silent = false, map = { value: 'value', text: 'text' }) {\n\t\tif (!Array.isArray(optionsData)) {\n\t\t\tthis.addOption(optionsData, silent, map);\n\t\t} else {\n\t\t\tconst optionsElement = this.querySelector('wje-options');\n\t\t\tif (optionsElement) {\n\t\t\t\toptionsElement.addOptions(optionsData, silent, map);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\toptionsData.forEach((item) => {\n\t\t\t\tthis.addOption(item, silent, map);\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Selects an option with the specified value.\n\t * @param {string} value The value of the option to be selected.\n\t * @param {boolean} [silent] Whether to suppress firing events.\n\t */\n\tselectOption(value, silent = false) {\n\t\tif (!value) return;\n\n\t\tlet option = this.querySelector(`wje-option[value=\"${value}\"]`);\n\n\t\tif (option) {\n\t\t\tthis.processClickedOption(option, this.hasAttribute('multiple'));\n\t\t}\n\n\t\tif (this.drawingStatus > this.drawingStatuses.START) this.selections(silent);\n\t}\n\n\t/**\n\t * Selects one or multiple options in the select element.\n\t * @param {Array|any} values The value(s) of the option(s) to be selected.\n\t * @param {boolean} [silent] Whether to trigger the change event or not.\n\t */\n\tselectOptions(values, silent = false) {\n\t\tif (!Array.isArray(values)) {\n\t\t\tthis.selectOption(values, silent);\n\t\t} else {\n\t\t\tvalues.forEach((value) => {\n\t\t\t\tthis.selectOption(value, silent);\n\t\t\t});\n\t\t}\n\t}\n\n\t#htmlSelectedItem(item) {\n\t\tconst keyValue = this.querySelector(\"wje-options\")?.itemValue ?? \"value\"\n\n\t\tconst value = this.options\n\t\t\t.find((option) => option[keyValue] === item)\n\n\t\treturn this.htmlSelectedItem(value);\n\t}\n\n\thtmlSelectedItem(item) {\n\t\tconst textValue = this.querySelector(\"wje-options\")?.itemText ?? \"text\"\n\n\t\treturn item?.[textValue] ?? \"\";\n\t}\n\n\t/**\n\t * @summary Callback function that is called when the custom element is associated with a form.\n\t * This function adds an event listener to the form's submit event, which validates the input and propagates the validation.\n\t * @param {HTMLFormElement} form The form the custom element is associated with.\n\t */\n\tformAssociatedCallback(form) {\n\t\tif (form) {\n\t\t\tthis.internals.setFormValue(this.value);\n\t\t}\n\t}\n\n\t/**\n\t * The formResetCallback method is a built-in lifecycle callback that gets called when a form gets reset.\n\t * This method is responsible for resetting the value of the custom input element to its default value.\n\t * It also resets the form value and validity state in the form internals.\n\t * @function\n\t */\n\tformResetCallback() {\n\t\t// Set the value of the custom input element to its default value\n\t\tthis.value = this.defaultValue;\n\t\t// Reset the form value in the form internals to the default value\n\t\tthis.internals.setFormValue(this.defaultValue);\n\t\t// Reset the validity state in the form internals\n\t\tthis.internals.setValidity({});\n\t}\n\n\t/**\n\t * The formStateRestoreCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is restored.\n\t * This method is responsible for restoring the value of the custom input element to its saved state.\n\t * It also restores the form value and validity state in the form internals to their saved states.\n\t * @param {object} state The saved state of the custom input element.\n\t * @function\n\t */\n\tformStateRestoreCallback(state) {\n\t\t// Set the value of the custom input element to its saved value\n\t\tthis.value = state.value;\n\t\t// Restore the form value in the form internals to the saved value\n\t\tthis.internals.setFormValue(state.value);\n\t\t// Restore the validity state in the form internals to the saved state\n\t\tthis.internals.setValidity({});\n\t}\n\n\t/**\n\t * The formStateSaveCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is saved.\n\t * This method is responsible for saving the value of the custom input element.\n\t * @returns {object} The saved state of the custom input element.\n\t * @function\n\t */\n\tformStateSaveCallback() {\n\t\treturn {\n\t\t\tvalue: this.value,\n\t\t};\n\t}\n\n\t/**\n\t * The formDisabledCallback method is a built-in lifecycle callback that gets called when the disabled state of a form-associated custom element changes.\n\t * This method is not implemented yet.\n\t * @param {boolean} disabled The new disabled state of the custom input element.\n\t * @function\n\t */\n\tformDisabledCallback(disabled) {\n\t\tconsole.warn('formDisabledCallback not implemented yet');\n\t\tthis.native?.classList.toggle('disabled', disabled);\n\t\tthis.toggleAttribute('disabled', disabled);\n\t}\n\n\t/**\n\t * Checks if all elements in the `elements` array are present in the `options` array based on their `option` property.\n\t * @param {Array} elements The array of elements to check. Each element should have an `option` property.\n\t * @param {Array} options The array of options to verify against.\n\t * @returns {boolean} Returns true if all elements in the `elements` array are found within the `options` array, otherwise returns false.\n\t */\n\tareAllElementsInOptions(elements, options) {\n\t\tif (elements.length === 0) return false;\n\n\t\treturn elements.every(el =>\n\t\t\toptions.some(opt => JSON.stringify(opt) === JSON.stringify(el.option))\n\t\t);\n\t}\n}\n","import Select from './select.element.js';\n\nexport default Select;\n\nSelect.define('wje-select', Select);\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyCe,MAAM,eAAe,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAa7C,cAAc;AACb,UAAO;AAdM;AACd,sCAAgB,CAAA;AAChB,qCAAe,CAAA;AA2Hf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wCAAe;AAAA,MACd,cAAc;AAAA,MACd,aAAa;AAAA,MACb,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,cAAc;AAAA,MACd,eAAe;AAAA,IACf;AAmMD,qCAAY;AAoQZ;AAAA;AAAA;AAAA;AAAA,wCAAe,CAAC,MAAM;AACrB,QAAE,gBAAe;AACjB,QAAE,yBAAwB;AAE1B,UAAI,aAAa,KAAK,cAAe;AAErC,UAAI,CAAC,KAAK,aAAa,UAAU,GAAG;AACnC,mBAAW,QAAQ,CAAC,WAAW;AAC9B,cAAI,OAAO,UAAU,EAAE,OAAO,OAAO;AACpC,iBAAK,qBAAqB,MAAM;AAAA,UACrC,OAAW;AACN,mBAAO,WAAW;AAClB,mBAAO,gBAAgB,UAA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AAA;AAAA;AAAA;AAAA,EAQC,wBAAwB,UAAU,SAAS;AAC1C,QAAI,SAAS,WAAW,EAAG,QAAO;AAElC,WAAO,SAAS;AAAA,MAAM,QACrB,QAAQ,KAAK,SAAO,KAAK,UAAU,GAAG,MAAM,KAAK,UAAU,GAAG,MAAM,CAAC;AAAA,IACrE;AAAA,EACH;AACA;AAz+BC;AACA;AAFc;AA44Bd,sBAAiB,SAAC,MAAM;;AACvB,QAAM,aAAW,UAAK,cAAc,aAAa,MAAhC,mBAAmC,cAAa;AAEjE,QAAM,QAAQ,KAAK,QACjB,KAAK,CAAC,WAAW,OAAO,QAAQ,MAAM,IAAI;AAE5C,SAAO,KAAK,iBAAiB,KAAK;AACpC;AAAA;AAAA;AAAA;AAAA;AAljBC,cAjWoB,QAiWb,kBAAiB;ACtYzB,OAAO,OAAO,cAAc,MAAM;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wj-elements",
3
3
  "description": "WebJET Elements is a modern set of user interface tools harnessing the power of web components designed to simplify web application development.",
4
- "version": "0.1.175",
4
+ "version": "0.1.176",
5
5
  "homepage": "https://github.com/lencys/wj-elements",
6
6
  "author": "Lukáš Ondrejček <lukas.ondrejcek@gmail.com>",
7
7
  "license": "MIT",