wj-elements 0.1.156 → 0.1.157
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.
- package/dist/packages/utils/event.d.ts +0 -1
- package/dist/wje-element.js +10 -32
- package/dist/wje-element.js.map +1 -1
- package/dist/wje-toast.js +2 -1
- package/dist/wje-toast.js.map +1 -1
- package/package.json +1 -1
package/dist/wje-element.js
CHANGED
|
@@ -275,7 +275,6 @@ var self;
|
|
|
275
275
|
class Event {
|
|
276
276
|
constructor() {
|
|
277
277
|
__privateAdd(this, _Event_instances);
|
|
278
|
-
this.customEventStorage = [];
|
|
279
278
|
this.customEventWeakMap = /* @__PURE__ */ new WeakMap();
|
|
280
279
|
self = this;
|
|
281
280
|
}
|
|
@@ -304,7 +303,7 @@ class Event {
|
|
|
304
303
|
* @returns {*}
|
|
305
304
|
*/
|
|
306
305
|
findRecordByElement(element) {
|
|
307
|
-
return this.
|
|
306
|
+
return this.customEventWeakMap.get(element);
|
|
308
307
|
}
|
|
309
308
|
/**
|
|
310
309
|
* Add listener to the element. If the element is an array, the listener will be added to all elements in the array.
|
|
@@ -330,26 +329,15 @@ class Event {
|
|
|
330
329
|
* @param options
|
|
331
330
|
*/
|
|
332
331
|
writeRecord(element, originalEvent, event2, listener, options) {
|
|
333
|
-
let
|
|
334
|
-
let recordListeners = this.customEventWeakMap.get(element);
|
|
332
|
+
let recordListeners = this.findRecordByElement(element);
|
|
335
333
|
if (!recordListeners) {
|
|
336
334
|
this.customEventWeakMap.set(element, {
|
|
337
335
|
[originalEvent]: []
|
|
338
336
|
});
|
|
339
|
-
recordListeners = this.
|
|
337
|
+
recordListeners = this.findRecordByElement(element);
|
|
340
338
|
} else {
|
|
341
339
|
recordListeners[originalEvent] = recordListeners[originalEvent] || [];
|
|
342
340
|
}
|
|
343
|
-
if (record) {
|
|
344
|
-
record.listeners[originalEvent] = record.listeners[originalEvent] || [];
|
|
345
|
-
} else {
|
|
346
|
-
record = {
|
|
347
|
-
element,
|
|
348
|
-
listeners: {}
|
|
349
|
-
};
|
|
350
|
-
record.listeners[originalEvent] = [];
|
|
351
|
-
this.customEventStorage.push(record);
|
|
352
|
-
}
|
|
353
341
|
listener = listener || __privateMethod(this, _Event_instances, dispatch_fn);
|
|
354
342
|
let obj = {
|
|
355
343
|
listener,
|
|
@@ -358,8 +346,10 @@ class Event {
|
|
|
358
346
|
};
|
|
359
347
|
if (!this.listenerExists(element, originalEvent, obj)) {
|
|
360
348
|
recordListeners[originalEvent].push(obj);
|
|
361
|
-
record.listeners[originalEvent].push(obj);
|
|
362
349
|
element.addEventListener(originalEvent, listener, options);
|
|
350
|
+
obj.unbind = () => {
|
|
351
|
+
element.removeEventListener(originalEvent, listener, options);
|
|
352
|
+
};
|
|
363
353
|
}
|
|
364
354
|
}
|
|
365
355
|
/**
|
|
@@ -380,7 +370,7 @@ class Event {
|
|
|
380
370
|
*/
|
|
381
371
|
listenerExists(element, event2, listener) {
|
|
382
372
|
let record = this.findRecordByElement(element);
|
|
383
|
-
return record
|
|
373
|
+
return record[event2].some((e) => this.deepEqual(e, listener));
|
|
384
374
|
}
|
|
385
375
|
/**
|
|
386
376
|
* Remove listener from the element and delete the listener from the custom event storage.
|
|
@@ -391,18 +381,9 @@ class Event {
|
|
|
391
381
|
* @param options
|
|
392
382
|
*/
|
|
393
383
|
removeListener(element, originalEvent, event2, listener, options) {
|
|
394
|
-
let
|
|
395
|
-
if (record && originalEvent in record.listeners) {
|
|
396
|
-
let listenerOfRecord = record.listeners[originalEvent].find((e) => e.listener === listener);
|
|
397
|
-
if (listenerOfRecord) {
|
|
398
|
-
record.listeners[originalEvent].splice(record.listeners[originalEvent].indexOf(listenerOfRecord), 1);
|
|
399
|
-
}
|
|
400
|
-
if (!record.listeners[originalEvent].length) {
|
|
401
|
-
delete record.listeners[originalEvent];
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
let records = this.customEventWeakMap.get(element);
|
|
384
|
+
let records = this.findRecordByElement(element);
|
|
405
385
|
let listeners = records == null ? void 0 : records[originalEvent];
|
|
386
|
+
listener = listener || __privateMethod(this, _Event_instances, dispatch_fn);
|
|
406
387
|
if (listeners) {
|
|
407
388
|
let listenerOfWeakMap = listeners.find((e) => e.listener === listener);
|
|
408
389
|
if (listenerOfWeakMap) {
|
|
@@ -412,7 +393,6 @@ class Event {
|
|
|
412
393
|
delete records[originalEvent];
|
|
413
394
|
}
|
|
414
395
|
}
|
|
415
|
-
listener = listener || __privateMethod(this, _Event_instances, dispatch_fn);
|
|
416
396
|
element == null ? void 0 : element.removeEventListener(originalEvent, listener, options);
|
|
417
397
|
}
|
|
418
398
|
/**
|
|
@@ -428,11 +408,9 @@ class Event {
|
|
|
428
408
|
element.removeEventListener(event2, e.listener, e.options);
|
|
429
409
|
});
|
|
430
410
|
}
|
|
411
|
+
this.customEventWeakMap.delete(element);
|
|
431
412
|
});
|
|
432
413
|
}
|
|
433
|
-
this.customEventStorage = this.customEventStorage.filter((e) => {
|
|
434
|
-
return e.element !== element;
|
|
435
|
-
});
|
|
436
414
|
}
|
|
437
415
|
// TODO
|
|
438
416
|
createPromiseFromEvent(element, event2) {
|
package/dist/wje-element.js.map
CHANGED
|
@@ -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 _save(url, data, action, dispatchMethod, method) {\n let promise = fetch(url, {\n method: method,\n body: JSON.stringify(data),\n headers: {\n 'Content-Type': 'application/json',\n },\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 _get(url, action, dispatchMethod, signal) {\n let promise = fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n ...(signal ? { signal } : {}),\n }).then(async (response) => {\n let responseText;\n try {\n responseText = await response.text();\n return JSON.parse(responseText);\n } catch (err) {\n console.error(err);\n return responseText;\n }\n });\n\n return this.dispatch(promise, dispatchMethod, action);\n }\n\n put(url, data, action, dispatchMethod = true) {\n return this._save(url, data, action, dispatchMethod, 'PUT');\n }\n\n post(url, data, action, dispatchMethod = true) {\n return this._save(url, data, action, dispatchMethod, 'POST');\n }\n\n delete(url, data, action, dispatchMethod = true) {\n return this._save(url, data, action, dispatchMethod, 'DELETE');\n }\n\n get(url, action, dispatchMethod = true) {\n return this._get(url, action, dispatchMethod);\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.customEventStorage = [];\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.customEventStorage.find((e) => e.element === 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 record = this.findRecordByElement(element);\n let recordListeners = this.customEventWeakMap.get(element);\n\n if (!recordListeners) {\n this.customEventWeakMap.set(element, {\n [originalEvent]: [],\n });\n\n recordListeners = this.customEventWeakMap.get(element);\n } else {\n recordListeners[originalEvent] = recordListeners[originalEvent] || [];\n }\n\n if (record) {\n record.listeners[originalEvent] = record.listeners[originalEvent] || [];\n } else {\n record = {\n element: element,\n listeners: {},\n };\n\n // vytvorime object listeners pre kazdy original event zvlast\n record.listeners[originalEvent] = [];\n\n this.customEventStorage.push(record);\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.listenerExists(element, originalEvent, obj)) {\n recordListeners[originalEvent].push(obj);\n record.listeners[originalEvent].push(obj);\n\n element.addEventListener(originalEvent, listener, options);\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 element\n * @param event\n * @param listener\n * @returns\n */\n listenerExists(element, event, listener) {\n let record = this.findRecordByElement(element);\n return record.listeners[event].some((e) => this.deepEqual(e, listener));\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 record = this.findRecordByElement(element);\n\n if (record && originalEvent in record.listeners) {\n let listenerOfRecord = record.listeners[originalEvent].find((e) => e.listener === listener);\n\n if (listenerOfRecord) {\n record.listeners[originalEvent].splice(record.listeners[originalEvent].indexOf(listenerOfRecord), 1);\n }\n\n if (!record.listeners[originalEvent].length) {\n delete record.listeners[originalEvent];\n }\n }\n\n let records = this.customEventWeakMap.get(element);\n let listeners = records?.[originalEvent];\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 }\n }\n\n listener = listener || this.#dispatch;\n\n element?.removeEventListener(originalEvent, listener, options);\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 });\n }\n });\n }\n\n this.customEventStorage = this.customEventStorage.filter((e) => {\n return e.element !== element;\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 /**\n * Initializes a new instance of the WJElement class.\n */\n\n constructor() {\n super();\n\n this.isAttached = false;\n this.service = new UniversalService({\n store: store,\n });\n\n // definujeme vsetky zavislosti.\n // Do zavislosti patria len komponenty, ktore su zavisle od ktoreho je zavisly tento komponent\n this.defineDependencies();\n\n this.rendering = false;\n this._dependencies = {};\n\n /**\n * @typedef {CREATED | ATTACHED | BEGINING | START | DRAWING | DONE | DISCONNECTED} DrawingStatus\n * @property {number} CREATED - The component has been created.\n * @property {number} ATTACHED - The component has been attached to the DOM.\n * @property {number} BEGINING - The component is beginning to draw.\n * @property {number} START - The component has started drawing.\n * @property {number} DRAWING - The component is drawing.\n * @property {number} DONE - The component has finished drawing.\n * @property {number} DISCONNECTED - The component has been disconnected from the DOM.\n */\n this.drawingStatuses = {\n CREATED: 0,\n ATTACHED: 1,\n BEGINING: 2,\n START: 3,\n DRAWING: 4,\n DONE: 5,\n DISCONNECTED: 6,\n };\n\n this.drawingStatus = this.drawingStatuses.CREATED;\n\n this.refreshUpdatePromise();\n\n this._pristine = true;\n this._pristineCauseWeakMap = new WeakMap();\n\n this.isRendering = false;\n this.rafId = null;\n }\n\n /**\n * Sets the value of the 'permission' attribute.\n * @param {string[]} value The value to set for the 'permission' attribute.\n */\n set permission(value) {\n this.setAttribute('permission', value.join(','));\n }\n\n /**\n * Gets the value of the 'permission-check' attribute.\n * @returns {string[]} The value of the 'permission' attribute.\n */\n get permission() {\n return this.getAttribute('permission')?.split(',') || [];\n }\n\n /**\n * Sets the 'permission-check' attribute.\n * @param {boolean} value The value to set for the 'permission-check' attribute.\n */\n set isPermissionCheck(value) {\n if (value) this.setAttribute('permission-check', '');\n else this.removeAttribute('permission-check');\n }\n\n /**\n * Checks if the 'permission-check' attribute is present.\n * @returns {boolean} True if the 'permission-check' attribute is present.\n */\n get isPermissionCheck() {\n return this.hasAttribute('permission-check');\n }\n\n set noShow(value) {\n if (value) this.setAttribute('no-show', '');\n else this.removeAttribute('no-show');\n }\n\n /**\n * Checks if the 'show' attribute is present.\n * @returns {boolean} True if the 'show' attribute is present.\n */\n get noShow() {\n return this.hasAttribute('no-show');\n }\n\n /**\n * Sets the 'shadow' attribute.\n * @param {string} value The value to set for the 'shadow' attribute.\n */\n set isShadowRoot(value) {\n return this.setAttribute('shadow', value);\n }\n\n get isShadowRoot() {\n return this.getAttribute('shadow');\n }\n\n /**\n * Checks if the 'shadow' attribute is present.\n * @returns {boolean} True if the 'shadow' attribute is present.\n */\n get hasShadowRoot() {\n return this.hasAttribute('shadow');\n }\n\n /**\n * Gets the value of the 'shadow' attribute or 'open' if not set.\n * @returns {string} The value of the 'shadow' attribute or 'open'.\n */\n get shadowType() {\n return this.getAttribute('shadow') || 'open';\n }\n\n /**\n * Gets the rendering context, either the shadow root or the component itself.\n * @returns The rendering context.\n */\n get context() {\n if (this.hasShadowRoot) {\n return this.shadowRoot;\n } else {\n return this;\n }\n }\n\n /**\n * Gets the store instance.\n * @returns {object} The store instance.\n */\n get store() {\n return store;\n }\n\n /**\n * @typedef {object} ArrayActions\n * @property {Function} addAction - Adds an item to the array.\n * @property {Function} deleteAction - Deletes an item from the array.\n * @property {Function} loadAction - Loads an array.\n * @property {Function} updateAction - Updates an item in the array.\n * @property {Function} addManyAction - Adds many items to the array.\n */\n\n /**\n * @typedef {object} ObjectActions\n * @property {Function} addAction - Replace old object with new object\n * @property {Function} deleteAction - Delete item based on key\n * @property {Function} updateAction - Update item based on key\n */\n\n /**\n * Gets the default store actions.\n * @returns The default store actions for arrays and objects.\n */\n get defaultStoreActions() {\n return defaultStoreActions;\n }\n\n /**\n * Gets the classes to be removed after the component is connected.\n * @returns An array of class names to remove.\n */\n get removeClassAfterConnect() {\n return this.getAttribute('remove-class-after-connect')?.split(' ');\n }\n\n /**\n * Sets the component dependencies.\n * @param value The dependencies to set.\n */\n set dependencies(value) {\n this._dependencies = value;\n }\n\n /**\n * Gets the component dependencies.\n * @returns The component dependencies.\n */\n get dependencies() {\n return this._dependencies;\n }\n\n /**\n * Processes and combines two templates into one.\n * @param pTemplate The primary template.\n * @param inputTemplate The secondary template.\n * @returns The combined template.\n */\n static processTemplates = (pTemplate, inputTemplate) => {\n const newTemplate = document.createElement('template');\n newTemplate.innerHTML = [inputTemplate.innerHTML, pTemplate?.innerHTML || ''].join('');\n return newTemplate;\n };\n\n /**\n * Defines a custom element if not already defined.\n * @param name The name of the custom element.\n * @param [elementConstructor] The constructor for the custom element.\n * @param [options] Additional options for defining the element.\n */\n static define(name, elementConstructor = this, options = {}) {\n const definedElement = customElements.get(name);\n\n if (!definedElement) {\n customElements.define(name, elementConstructor, options);\n }\n }\n\n /**\n * Defines component dependencies by registering custom elements.\n */\n defineDependencies() {\n if (this.dependencies)\n Object.entries(this.dependencies).forEach((name, component) => WJElement.define(name, component));\n }\n\n /**\n * Hook for extending behavior before drawing the component.\n * @param context The rendering context, usually the element's shadow root or main DOM element.\n * @param appStoreObj The global application store for managing state.\n * @param params Additional parameters or attributes for rendering the component.\n */\n beforeDraw(context, appStoreObj, params) {\n // Hook for extending behavior before drawing\n }\n\n /**\n * Renders the component within the provided context.\n * @param context The rendering context, usually the element's shadow root or main DOM element.\n * @param appStoreObj\n * @param params Additional parameters or attributes for rendering the component.\n * @returns This implementation does not render anything and returns `null`.\n * @description\n * The `draw` method is responsible for rendering the component's content.\n * Override this method in subclasses to define custom rendering logic.\n * @example\n * class MyComponent extends WJElement {\n * draw(context, appStoreObj, params) {\n * const div = document.createElement('div');\n * div.textContent = 'Hello, world!';\n * context.appendChild(div);\n * }\n * }\n */\n draw(context, appStoreObj, params) {\n return null;\n }\n\n /**\n * Hook for extending behavior after drawing the component.\n * @param context The rendering context, usually the element's shadow root or main DOM element.\n * @param appStoreObj The global application store for managing state.\n * @param params Additional parameters or attributes for rendering the component.\n */\n afterDraw(context, appStoreObj, params) {\n // Hook for extending behavior after drawing\n }\n\n /**\n * Refreshes the update promise for rendering lifecycle management.\n */\n refreshUpdatePromise() {\n // TODO handle reject of promise when update is cancelled\n // if (this.updateComplete) {\n // this.rejectPromise('Update cancelled');\n // }\n\n this.updateComplete = new Promise((resolve, reject) => {\n this.finisPromise = resolve;\n this.rejectPromise = reject;\n }).catch((e) => {\n // console.log(e);\n });\n }\n\n /**\n * Lifecycle method invoked when the component is connected to the DOM.\n */\n connectedCallback() {\n this.originalVisibility = this.style.visibility;\n this.style.visibility = 'hidden';\n\n this.setupAttributes?.();\n this.setUpAccessors();\n\n this.drawingStatus = this.drawingStatuses.ATTACHED;\n\n if (!this.isRendering) {\n this._pristine = false;\n this.enqueueUpdate();\n }\n }\n\n /**\n * Initializes the component, setting up attributes and rendering.\n * @param [force] Whether to force initialization.\n * @returns A promise that resolves when initialization is complete.\n */\n initWjElement = (force = false) => {\n return new Promise(async (resolve, reject) => {\n this.drawingStatus = this.drawingStatuses.BEGINING;\n\n this.setupAttributes?.();\n if (this.hasShadowRoot) {\n if (!this.shadowRoot) this.attachShadow({ mode: this.shadowType || 'open' });\n }\n this.setUpAccessors();\n\n this.drawingStatus = this.drawingStatuses.START;\n await this.display(force);\n\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(this.constructor.cssStyleSheet);\n\n this.context.adoptedStyleSheets = [sheet];\n\n resolve();\n });\n };\n\n /**\n * Sets up attributes and event listeners for the component.\n * This method retrieves all custom events defined for the component\n * and adds event listeners for each of them. When an event is triggered,\n * it calls the corresponding method on the host element.\n */\n setupAttributes() {\n // Keď neaký element si zadefinuje funkciu \"setupAttributes\" tak sa obsah tejto funkcie nezavolá\n\n let allEvents = WjElementUtils.getEvents(this);\n allEvents.forEach((customEvent, domEvent) => {\n this.addEventListener(domEvent, (e) => {\n this.getRootNode().host[customEvent]?.();\n });\n });\n }\n\n /**\n * Hook for extending behavior before disconnecting the component.\n */\n beforeDisconnect() {\n // Hook for extending behavior before disconnecting\n }\n\n /**\n * Hook for extending behavior after disconnecting the component.\n */\n afterDisconnect() {\n // Hook for extending behavior after disconnecting\n }\n\n /**\n * Hook for extending behavior before redrawing the component.\n */\n beforeRedraw() {\n // Hook for extending behavior before redrawing\n }\n\n /**\n * Cleans up resources and event listeners for the component.\n */\n componentCleanup() {\n // Hook for cleaning up the component\n }\n\n /**\n * Lifecycle method invoked when the component is disconnected from the DOM.\n */\n disconnectedCallback() {\n this.stopRenderLoop();\n\n this.beforeDisconnect?.();\n\n if (this.isAttached) this.context.innerHTML = '';\n this.isAttached = false;\n\n this.afterDisconnect?.();\n\n this.drawingStatus = this.drawingStatuses.DISCONNECTED;\n\n this.componentCleanup();\n }\n\n /**\n * Enqueues an update for the component.\n * This method processes the current render promise and then refreshes the component.\n */\n enqueueUpdate() {\n if (!this.rafId) {\n this.rafId = requestAnimationFrame(() => this._refresh());\n }\n }\n\n /**\n * Lifecycle method invoked when an observed attribute changes.\n * @param name The name of the attribute that changed.\n * @param old The old value of the attribute.\n * @param newName The new value of the attribute.\n */\n attributeChangedCallback(name, old, newName) {\n if (old !== newName) {\n this._pristine = false;\n this.enqueueUpdate();\n }\n }\n\n refresh() {\n this._pristine = false;\n this.enqueueUpdate();\n }\n\n /**\n * Refreshes the component by reinitializing it if it is in a drawing state.\n * This method checks if the component's drawing status is at least in the START state.\n * If so, it performs the following steps:\n * 1. Calls the `beforeRedraw` hook if defined.\n * 2. Calls the `beforeDisconnect` hook if defined.\n * 3. Refreshes the update promise to manage the rendering lifecycle.\n * 4. Calls the `afterDisconnect` hook if defined.\n * 5. Reinitializes the component by calling `initWjElement` with `true` to force initialization.\n * If the component is not in a drawing state, it simply returns a resolved promise.\n */\n async _refresh() {\n if (this.isRendering) {\n this.rafId = requestAnimationFrame(() => this._refresh());\n return; // Skip if async render is still processing\n }\n\n if (!this._pristine) {\n this._pristine = true;\n this.isRendering = true;\n\n if (this.isAttached) {\n this.beforeRedraw?.();\n this.beforeDisconnect?.();\n this.refreshUpdatePromise();\n this.afterDisconnect?.();\n } else {\n this.stopRenderLoop();\n }\n\n try {\n await this.initWjElement(true);\n } catch (error) {\n console.error('Render error:', error);\n } finally {\n this.isRendering = false;\n\n if (!this._pristine) {\n this._pristine = false;\n this.enqueueUpdate();\n } else {\n this.style.visibility = this.originalVisibility;\n }\n }\n }\n\n if (this.isAttached && !this.isRendering) {\n this.rafId = requestAnimationFrame(() => this._refresh());\n }\n }\n\n stopRenderLoop() {\n if (this.rafId) {\n cancelAnimationFrame(this.rafId);\n this.rafId = null;\n }\n }\n\n /**\n * Renders the component within the provided context.\n * @param context The rendering context, usually the element's shadow root or main DOM element.\n * @param appStore The global application store for managing state.\n * @param params Additional parameters or attributes for rendering the component.\n * @returns This implementation does not render anything and returns `null`.\n * @description\n * The `draw` method is responsible for rendering the component's content.\n * Override this method in subclasses to define custom rendering logic.\n * @example\n * class MyComponent extends WJElement {\n * draw(context, appStore, params) {\n * const div = document.createElement('div');\n * div.textContent = 'Hello, world!';\n * context.appendChild(div);\n * }\n * }\n */\n draw(context, appStore, params) {\n return null;\n }\n\n /**\n * Displays the component's content, optionally forcing a re-render.\n * @param [force] Whether to force a re-render.\n * @returns A promise that resolves when the display is complete.\n */\n display(force = false) {\n this.template = this.constructor.customTemplate || document.createElement('template');\n\n if (force) {\n [...this.context.childNodes].forEach(this.context.removeChild.bind(this.context));\n //this.isAttached = false;\n }\n\n this.context.append(this.template.content.cloneNode(true));\n\n if (this.noShow || (this.isPermissionCheck && !WjePermissionsApi.isPermissionFulfilled(this.permission))) {\n this.remove();\n return Promise.resolve();\n }\n\n return this._resolveRender();\n }\n\n /**\n * Renders the component's content.\n */\n async render() {\n this.drawingStatus = this.drawingStatuses.DRAWING;\n\n let _draw = this.draw(this.context, this.store, WjElementUtils.getAttributes(this));\n\n if (_draw instanceof Promise) {\n _draw = await _draw;\n }\n\n let rend = _draw;\n let element;\n\n if (rend instanceof HTMLElement || rend instanceof DocumentFragment) {\n element = rend;\n } else {\n let inputTemplate = document.createElement('template');\n inputTemplate.innerHTML = rend;\n element = inputTemplate.content.cloneNode(true);\n }\n\n let rendered = element;\n\n this.context.appendChild(rendered);\n }\n\n /**\n * Sanitizes a given name by converting it from kebab-case to camelCase.\n * @param {string} name The name in kebab-case format (e.g., \"example-name\").\n * @returns {string} The sanitized name in camelCase format (e.g., \"exampleName\").\n * @example\n * // Returns 'exampleName'\n * sanitizeName('example-name');\n * @example\n * // Returns 'myCustomComponent'\n * sanitizeName('my-custom-component');\n */\n sanitizeName(name) {\n let parts = name.split('-');\n return [parts.shift(), ...parts.map((n) => n[0].toUpperCase() + n.slice(1))].join('');\n }\n\n /**\n * Checks if a property on an object has a getter or setter method defined.\n * @param {object} obj The object on which the property is defined.\n * @param {string} property The name of the property to check.\n * @returns {object} An object indicating the presence of getter and setter methods.\n * @property {Function|null} hasGetter The getter function if it exists, otherwise `null`.\n * @property {Function|null} hasSetter The setter function if it exists, otherwise `null`.\n * @example\n * const obj = {\n * get name() { return 'value'; },\n * set name(val) { console.log(val); }\n * };\n * // Returns { hasGetter: [Function: get name], hasSetter: [Function: set name] }\n * checkGetterSetter(obj, 'name');\n * @example\n * const obj = { prop: 42 };\n * // Returns { hasGetter: null, hasSetter: null }\n * checkGetterSetter(obj, 'prop');\n */\n checkGetterSetter(obj, property) {\n let descriptor = Object.getOwnPropertyDescriptor(obj, property);\n\n // Check if the descriptor is found on the object itself\n if (descriptor) {\n return {\n hasGetter: typeof descriptor.get === 'function' ? descriptor.get : null,\n hasSetter: typeof descriptor.set === 'function' ? descriptor.set : null,\n };\n }\n\n // Otherwise, check the prototype chain\n let proto = Object.getPrototypeOf(obj);\n if (proto) {\n return this.checkGetterSetter(proto, property);\n }\n\n // If the property doesn't exist at all\n return { hasGetter: null, hasSetter: null };\n }\n\n /**\n * Sets up property accessors for the component's attributes.\n */\n setUpAccessors() {\n let attrs = this.getAttributeNames();\n attrs.forEach((name) => {\n const sanitizedName = this.sanitizeName(name);\n\n const { hasGetter, hasSetter } = this.checkGetterSetter(this, sanitizedName);\n\n Object.defineProperty(this, sanitizedName, {\n set: hasSetter ?? ((value) => this.setAttribute(name, value)),\n get: hasGetter ?? (() => this.getAttribute(name)),\n });\n });\n }\n\n /**\n * Resolves the rendering process of the component.\n * @returns A promise that resolves when rendering is complete.\n * @private\n */\n _resolveRender() {\n this.params = WjElementUtils.getAttributes(this);\n\n return new Promise(async (resolve, reject) => {\n const __beforeDraw = this.beforeDraw(this.context, this.store, WjElementUtils.getAttributes(this));\n\n if (__beforeDraw instanceof Promise) {\n await __beforeDraw;\n }\n\n await this.render();\n\n const __afterDraw = this.afterDraw?.(this.context, this.store, WjElementUtils.getAttributes(this));\n\n if (__afterDraw instanceof Promise) {\n await __afterDraw;\n }\n\n // RHR toto je bicykel pre slickRouter pretože routovanie nieje vykonané pokiaľ sa nezavolá updateComplete promise,\n // toto bude treba rozšíriť aby sme lepšie vedeli kontrolovať vykreslovanie elementov, a flow hookov.\n this.finisPromise();\n\n this.rendering = false;\n this.isAttached = true;\n\n if (this.removeClassAfterConnect) {\n this.classList.remove(...this.removeClassAfterConnect);\n }\n\n this.drawingStatus = this.drawingStatuses.DONE;\n\n resolve();\n }).catch((e) => {\n console.log(e);\n });\n }\n}\n\nlet __esModule = 'true';\nexport { __esModule, WjePermissionsApi, WjElementUtils, event };\n"],"names":["event"],"mappings":";;;;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E,MAAM,CAAC,MAAM;AACZ,cAAQ,IAAI,CAAC;AAAA,IACzB,CAAS;AAAA,EACT;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AApdI,cAvMiB,YAuMV,oBAAmB,CAAC,WAAW,kBAAkB;AACpD,QAAM,cAAc,SAAS,cAAc,UAAU;AACrD,cAAY,YAAY,CAAC,cAAc,YAAW,uCAAW,cAAa,EAAE,EAAE,KAAK,EAAE;AACrF,SAAO;AACV;AA3MU,IAAM,YAAN;AA6pBZ,IAAC,aAAa;"}
|
|
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 _save(url, data, action, dispatchMethod, method) {\n let promise = fetch(url, {\n method: method,\n body: JSON.stringify(data),\n headers: {\n 'Content-Type': 'application/json',\n },\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 _get(url, action, dispatchMethod, signal) {\n let promise = fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n ...(signal ? { signal } : {}),\n }).then(async (response) => {\n let responseText;\n try {\n responseText = await response.text();\n return JSON.parse(responseText);\n } catch (err) {\n console.error(err);\n return responseText;\n }\n });\n\n return this.dispatch(promise, dispatchMethod, action);\n }\n\n put(url, data, action, dispatchMethod = true) {\n return this._save(url, data, action, dispatchMethod, 'PUT');\n }\n\n post(url, data, action, dispatchMethod = true) {\n return this._save(url, data, action, dispatchMethod, 'POST');\n }\n\n delete(url, data, action, dispatchMethod = true) {\n return this._save(url, data, action, dispatchMethod, 'DELETE');\n }\n\n get(url, action, dispatchMethod = true) {\n return this._get(url, action, dispatchMethod);\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.listenerExists(element, originalEvent, obj)) {\n recordListeners[originalEvent].push(obj);\n element.addEventListener(originalEvent, listener, options);\n obj.unbind = () => {\n element.removeEventListener(originalEvent, listener, options);\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 element\n * @param event\n * @param listener\n * @returns\n */\n listenerExists(element, event, listener) {\n let record = this.findRecordByElement(element);\n return record[event].some((e) => this.deepEqual(e, listener));\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 }\n }\n\n element?.removeEventListener(originalEvent, listener, options);\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 });\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 /**\n * Initializes a new instance of the WJElement class.\n */\n\n constructor() {\n super();\n\n this.isAttached = false;\n this.service = new UniversalService({\n store: store,\n });\n\n // definujeme vsetky zavislosti.\n // Do zavislosti patria len komponenty, ktore su zavisle od ktoreho je zavisly tento komponent\n this.defineDependencies();\n\n this.rendering = false;\n this._dependencies = {};\n\n /**\n * @typedef {CREATED | ATTACHED | BEGINING | START | DRAWING | DONE | DISCONNECTED} DrawingStatus\n * @property {number} CREATED - The component has been created.\n * @property {number} ATTACHED - The component has been attached to the DOM.\n * @property {number} BEGINING - The component is beginning to draw.\n * @property {number} START - The component has started drawing.\n * @property {number} DRAWING - The component is drawing.\n * @property {number} DONE - The component has finished drawing.\n * @property {number} DISCONNECTED - The component has been disconnected from the DOM.\n */\n this.drawingStatuses = {\n CREATED: 0,\n ATTACHED: 1,\n BEGINING: 2,\n START: 3,\n DRAWING: 4,\n DONE: 5,\n DISCONNECTED: 6,\n };\n\n this.drawingStatus = this.drawingStatuses.CREATED;\n\n this.refreshUpdatePromise();\n\n this._pristine = true;\n this._pristineCauseWeakMap = new WeakMap();\n\n this.isRendering = false;\n this.rafId = null;\n }\n\n /**\n * Sets the value of the 'permission' attribute.\n * @param {string[]} value The value to set for the 'permission' attribute.\n */\n set permission(value) {\n this.setAttribute('permission', value.join(','));\n }\n\n /**\n * Gets the value of the 'permission-check' attribute.\n * @returns {string[]} The value of the 'permission' attribute.\n */\n get permission() {\n return this.getAttribute('permission')?.split(',') || [];\n }\n\n /**\n * Sets the 'permission-check' attribute.\n * @param {boolean} value The value to set for the 'permission-check' attribute.\n */\n set isPermissionCheck(value) {\n if (value) this.setAttribute('permission-check', '');\n else this.removeAttribute('permission-check');\n }\n\n /**\n * Checks if the 'permission-check' attribute is present.\n * @returns {boolean} True if the 'permission-check' attribute is present.\n */\n get isPermissionCheck() {\n return this.hasAttribute('permission-check');\n }\n\n set noShow(value) {\n if (value) this.setAttribute('no-show', '');\n else this.removeAttribute('no-show');\n }\n\n /**\n * Checks if the 'show' attribute is present.\n * @returns {boolean} True if the 'show' attribute is present.\n */\n get noShow() {\n return this.hasAttribute('no-show');\n }\n\n /**\n * Sets the 'shadow' attribute.\n * @param {string} value The value to set for the 'shadow' attribute.\n */\n set isShadowRoot(value) {\n return this.setAttribute('shadow', value);\n }\n\n get isShadowRoot() {\n return this.getAttribute('shadow');\n }\n\n /**\n * Checks if the 'shadow' attribute is present.\n * @returns {boolean} True if the 'shadow' attribute is present.\n */\n get hasShadowRoot() {\n return this.hasAttribute('shadow');\n }\n\n /**\n * Gets the value of the 'shadow' attribute or 'open' if not set.\n * @returns {string} The value of the 'shadow' attribute or 'open'.\n */\n get shadowType() {\n return this.getAttribute('shadow') || 'open';\n }\n\n /**\n * Gets the rendering context, either the shadow root or the component itself.\n * @returns The rendering context.\n */\n get context() {\n if (this.hasShadowRoot) {\n return this.shadowRoot;\n } else {\n return this;\n }\n }\n\n /**\n * Gets the store instance.\n * @returns {object} The store instance.\n */\n get store() {\n return store;\n }\n\n /**\n * @typedef {object} ArrayActions\n * @property {Function} addAction - Adds an item to the array.\n * @property {Function} deleteAction - Deletes an item from the array.\n * @property {Function} loadAction - Loads an array.\n * @property {Function} updateAction - Updates an item in the array.\n * @property {Function} addManyAction - Adds many items to the array.\n */\n\n /**\n * @typedef {object} ObjectActions\n * @property {Function} addAction - Replace old object with new object\n * @property {Function} deleteAction - Delete item based on key\n * @property {Function} updateAction - Update item based on key\n */\n\n /**\n * Gets the default store actions.\n * @returns The default store actions for arrays and objects.\n */\n get defaultStoreActions() {\n return defaultStoreActions;\n }\n\n /**\n * Gets the classes to be removed after the component is connected.\n * @returns An array of class names to remove.\n */\n get removeClassAfterConnect() {\n return this.getAttribute('remove-class-after-connect')?.split(' ');\n }\n\n /**\n * Sets the component dependencies.\n * @param value The dependencies to set.\n */\n set dependencies(value) {\n this._dependencies = value;\n }\n\n /**\n * Gets the component dependencies.\n * @returns The component dependencies.\n */\n get dependencies() {\n return this._dependencies;\n }\n\n /**\n * Processes and combines two templates into one.\n * @param pTemplate The primary template.\n * @param inputTemplate The secondary template.\n * @returns The combined template.\n */\n static processTemplates = (pTemplate, inputTemplate) => {\n const newTemplate = document.createElement('template');\n newTemplate.innerHTML = [inputTemplate.innerHTML, pTemplate?.innerHTML || ''].join('');\n return newTemplate;\n };\n\n /**\n * Defines a custom element if not already defined.\n * @param name The name of the custom element.\n * @param [elementConstructor] The constructor for the custom element.\n * @param [options] Additional options for defining the element.\n */\n static define(name, elementConstructor = this, options = {}) {\n const definedElement = customElements.get(name);\n\n if (!definedElement) {\n customElements.define(name, elementConstructor, options);\n }\n }\n\n /**\n * Defines component dependencies by registering custom elements.\n */\n defineDependencies() {\n if (this.dependencies)\n Object.entries(this.dependencies).forEach((name, component) => WJElement.define(name, component));\n }\n\n /**\n * Hook for extending behavior before drawing the component.\n * @param context The rendering context, usually the element's shadow root or main DOM element.\n * @param appStoreObj The global application store for managing state.\n * @param params Additional parameters or attributes for rendering the component.\n */\n beforeDraw(context, appStoreObj, params) {\n // Hook for extending behavior before drawing\n }\n\n /**\n * Renders the component within the provided context.\n * @param context The rendering context, usually the element's shadow root or main DOM element.\n * @param appStoreObj\n * @param params Additional parameters or attributes for rendering the component.\n * @returns This implementation does not render anything and returns `null`.\n * @description\n * The `draw` method is responsible for rendering the component's content.\n * Override this method in subclasses to define custom rendering logic.\n * @example\n * class MyComponent extends WJElement {\n * draw(context, appStoreObj, params) {\n * const div = document.createElement('div');\n * div.textContent = 'Hello, world!';\n * context.appendChild(div);\n * }\n * }\n */\n draw(context, appStoreObj, params) {\n return null;\n }\n\n /**\n * Hook for extending behavior after drawing the component.\n * @param context The rendering context, usually the element's shadow root or main DOM element.\n * @param appStoreObj The global application store for managing state.\n * @param params Additional parameters or attributes for rendering the component.\n */\n afterDraw(context, appStoreObj, params) {\n // Hook for extending behavior after drawing\n }\n\n /**\n * Refreshes the update promise for rendering lifecycle management.\n */\n refreshUpdatePromise() {\n // TODO handle reject of promise when update is cancelled\n // if (this.updateComplete) {\n // this.rejectPromise('Update cancelled');\n // }\n\n this.updateComplete = new Promise((resolve, reject) => {\n this.finisPromise = resolve;\n this.rejectPromise = reject;\n }).catch((e) => {\n // console.log(e);\n });\n }\n\n /**\n * Lifecycle method invoked when the component is connected to the DOM.\n */\n connectedCallback() {\n this.originalVisibility = this.style.visibility;\n this.style.visibility = 'hidden';\n\n this.setupAttributes?.();\n this.setUpAccessors();\n\n this.drawingStatus = this.drawingStatuses.ATTACHED;\n\n if (!this.isRendering) {\n this._pristine = false;\n this.enqueueUpdate();\n }\n }\n\n /**\n * Initializes the component, setting up attributes and rendering.\n * @param [force] Whether to force initialization.\n * @returns A promise that resolves when initialization is complete.\n */\n initWjElement = (force = false) => {\n return new Promise(async (resolve, reject) => {\n this.drawingStatus = this.drawingStatuses.BEGINING;\n\n this.setupAttributes?.();\n if (this.hasShadowRoot) {\n if (!this.shadowRoot) this.attachShadow({ mode: this.shadowType || 'open' });\n }\n this.setUpAccessors();\n\n this.drawingStatus = this.drawingStatuses.START;\n await this.display(force);\n\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(this.constructor.cssStyleSheet);\n\n this.context.adoptedStyleSheets = [sheet];\n\n resolve();\n });\n };\n\n /**\n * Sets up attributes and event listeners for the component.\n * This method retrieves all custom events defined for the component\n * and adds event listeners for each of them. When an event is triggered,\n * it calls the corresponding method on the host element.\n */\n setupAttributes() {\n // Keď neaký element si zadefinuje funkciu \"setupAttributes\" tak sa obsah tejto funkcie nezavolá\n\n let allEvents = WjElementUtils.getEvents(this);\n allEvents.forEach((customEvent, domEvent) => {\n this.addEventListener(domEvent, (e) => {\n this.getRootNode().host[customEvent]?.();\n });\n });\n }\n\n /**\n * Hook for extending behavior before disconnecting the component.\n */\n beforeDisconnect() {\n // Hook for extending behavior before disconnecting\n }\n\n /**\n * Hook for extending behavior after disconnecting the component.\n */\n afterDisconnect() {\n // Hook for extending behavior after disconnecting\n }\n\n /**\n * Hook for extending behavior before redrawing the component.\n */\n beforeRedraw() {\n // Hook for extending behavior before redrawing\n }\n\n /**\n * Cleans up resources and event listeners for the component.\n */\n componentCleanup() {\n // Hook for cleaning up the component\n }\n\n /**\n * Lifecycle method invoked when the component is disconnected from the DOM.\n */\n disconnectedCallback() {\n this.stopRenderLoop();\n\n this.beforeDisconnect?.();\n\n if (this.isAttached) this.context.innerHTML = '';\n this.isAttached = false;\n\n this.afterDisconnect?.();\n\n this.drawingStatus = this.drawingStatuses.DISCONNECTED;\n\n this.componentCleanup();\n }\n\n /**\n * Enqueues an update for the component.\n * This method processes the current render promise and then refreshes the component.\n */\n enqueueUpdate() {\n if (!this.rafId) {\n this.rafId = requestAnimationFrame(() => this._refresh());\n }\n }\n\n /**\n * Lifecycle method invoked when an observed attribute changes.\n * @param name The name of the attribute that changed.\n * @param old The old value of the attribute.\n * @param newName The new value of the attribute.\n */\n attributeChangedCallback(name, old, newName) {\n if (old !== newName) {\n this._pristine = false;\n this.enqueueUpdate();\n }\n }\n\n refresh() {\n this._pristine = false;\n this.enqueueUpdate();\n }\n\n /**\n * Refreshes the component by reinitializing it if it is in a drawing state.\n * This method checks if the component's drawing status is at least in the START state.\n * If so, it performs the following steps:\n * 1. Calls the `beforeRedraw` hook if defined.\n * 2. Calls the `beforeDisconnect` hook if defined.\n * 3. Refreshes the update promise to manage the rendering lifecycle.\n * 4. Calls the `afterDisconnect` hook if defined.\n * 5. Reinitializes the component by calling `initWjElement` with `true` to force initialization.\n * If the component is not in a drawing state, it simply returns a resolved promise.\n */\n async _refresh() {\n if (this.isRendering) {\n this.rafId = requestAnimationFrame(() => this._refresh());\n return; // Skip if async render is still processing\n }\n\n if (!this._pristine) {\n this._pristine = true;\n this.isRendering = true;\n\n if (this.isAttached) {\n this.beforeRedraw?.();\n this.beforeDisconnect?.();\n this.refreshUpdatePromise();\n this.afterDisconnect?.();\n } else {\n this.stopRenderLoop();\n }\n\n try {\n await this.initWjElement(true);\n } catch (error) {\n console.error('Render error:', error);\n } finally {\n this.isRendering = false;\n\n if (!this._pristine) {\n this._pristine = false;\n this.enqueueUpdate();\n } else {\n this.style.visibility = this.originalVisibility;\n }\n }\n }\n\n if (this.isAttached && !this.isRendering) {\n this.rafId = requestAnimationFrame(() => this._refresh());\n }\n }\n\n stopRenderLoop() {\n if (this.rafId) {\n cancelAnimationFrame(this.rafId);\n this.rafId = null;\n }\n }\n\n /**\n * Renders the component within the provided context.\n * @param context The rendering context, usually the element's shadow root or main DOM element.\n * @param appStore The global application store for managing state.\n * @param params Additional parameters or attributes for rendering the component.\n * @returns This implementation does not render anything and returns `null`.\n * @description\n * The `draw` method is responsible for rendering the component's content.\n * Override this method in subclasses to define custom rendering logic.\n * @example\n * class MyComponent extends WJElement {\n * draw(context, appStore, params) {\n * const div = document.createElement('div');\n * div.textContent = 'Hello, world!';\n * context.appendChild(div);\n * }\n * }\n */\n draw(context, appStore, params) {\n return null;\n }\n\n /**\n * Displays the component's content, optionally forcing a re-render.\n * @param [force] Whether to force a re-render.\n * @returns A promise that resolves when the display is complete.\n */\n display(force = false) {\n this.template = this.constructor.customTemplate || document.createElement('template');\n\n if (force) {\n [...this.context.childNodes].forEach(this.context.removeChild.bind(this.context));\n //this.isAttached = false;\n }\n\n this.context.append(this.template.content.cloneNode(true));\n\n if (this.noShow || (this.isPermissionCheck && !WjePermissionsApi.isPermissionFulfilled(this.permission))) {\n this.remove();\n return Promise.resolve();\n }\n\n return this._resolveRender();\n }\n\n /**\n * Renders the component's content.\n */\n async render() {\n this.drawingStatus = this.drawingStatuses.DRAWING;\n\n let _draw = this.draw(this.context, this.store, WjElementUtils.getAttributes(this));\n\n if (_draw instanceof Promise) {\n _draw = await _draw;\n }\n\n let rend = _draw;\n let element;\n\n if (rend instanceof HTMLElement || rend instanceof DocumentFragment) {\n element = rend;\n } else {\n let inputTemplate = document.createElement('template');\n inputTemplate.innerHTML = rend;\n element = inputTemplate.content.cloneNode(true);\n }\n\n let rendered = element;\n\n this.context.appendChild(rendered);\n }\n\n /**\n * Sanitizes a given name by converting it from kebab-case to camelCase.\n * @param {string} name The name in kebab-case format (e.g., \"example-name\").\n * @returns {string} The sanitized name in camelCase format (e.g., \"exampleName\").\n * @example\n * // Returns 'exampleName'\n * sanitizeName('example-name');\n * @example\n * // Returns 'myCustomComponent'\n * sanitizeName('my-custom-component');\n */\n sanitizeName(name) {\n let parts = name.split('-');\n return [parts.shift(), ...parts.map((n) => n[0].toUpperCase() + n.slice(1))].join('');\n }\n\n /**\n * Checks if a property on an object has a getter or setter method defined.\n * @param {object} obj The object on which the property is defined.\n * @param {string} property The name of the property to check.\n * @returns {object} An object indicating the presence of getter and setter methods.\n * @property {Function|null} hasGetter The getter function if it exists, otherwise `null`.\n * @property {Function|null} hasSetter The setter function if it exists, otherwise `null`.\n * @example\n * const obj = {\n * get name() { return 'value'; },\n * set name(val) { console.log(val); }\n * };\n * // Returns { hasGetter: [Function: get name], hasSetter: [Function: set name] }\n * checkGetterSetter(obj, 'name');\n * @example\n * const obj = { prop: 42 };\n * // Returns { hasGetter: null, hasSetter: null }\n * checkGetterSetter(obj, 'prop');\n */\n checkGetterSetter(obj, property) {\n let descriptor = Object.getOwnPropertyDescriptor(obj, property);\n\n // Check if the descriptor is found on the object itself\n if (descriptor) {\n return {\n hasGetter: typeof descriptor.get === 'function' ? descriptor.get : null,\n hasSetter: typeof descriptor.set === 'function' ? descriptor.set : null,\n };\n }\n\n // Otherwise, check the prototype chain\n let proto = Object.getPrototypeOf(obj);\n if (proto) {\n return this.checkGetterSetter(proto, property);\n }\n\n // If the property doesn't exist at all\n return { hasGetter: null, hasSetter: null };\n }\n\n /**\n * Sets up property accessors for the component's attributes.\n */\n setUpAccessors() {\n let attrs = this.getAttributeNames();\n attrs.forEach((name) => {\n const sanitizedName = this.sanitizeName(name);\n\n const { hasGetter, hasSetter } = this.checkGetterSetter(this, sanitizedName);\n\n Object.defineProperty(this, sanitizedName, {\n set: hasSetter ?? ((value) => this.setAttribute(name, value)),\n get: hasGetter ?? (() => this.getAttribute(name)),\n });\n });\n }\n\n /**\n * Resolves the rendering process of the component.\n * @returns A promise that resolves when rendering is complete.\n * @private\n */\n _resolveRender() {\n this.params = WjElementUtils.getAttributes(this);\n\n return new Promise(async (resolve, reject) => {\n const __beforeDraw = this.beforeDraw(this.context, this.store, WjElementUtils.getAttributes(this));\n\n if (__beforeDraw instanceof Promise) {\n await __beforeDraw;\n }\n\n await this.render();\n\n const __afterDraw = this.afterDraw?.(this.context, this.store, WjElementUtils.getAttributes(this));\n\n if (__afterDraw instanceof Promise) {\n await __afterDraw;\n }\n\n // RHR toto je bicykel pre slickRouter pretože routovanie nieje vykonané pokiaľ sa nezavolá updateComplete promise,\n // toto bude treba rozšíriť aby sme lepšie vedeli kontrolovať vykreslovanie elementov, a flow hookov.\n this.finisPromise();\n\n this.rendering = false;\n this.isAttached = true;\n\n if (this.removeClassAfterConnect) {\n this.classList.remove(...this.removeClassAfterConnect);\n }\n\n this.drawingStatus = this.drawingStatuses.DONE;\n\n resolve();\n }).catch((e) => {\n console.log(e);\n });\n }\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;AAuED,uCAAc,CACV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
269
269
|
* This method is called before the element is disconnected from the document.
|
|
270
270
|
*/
|
|
271
271
|
beforeDisconnect() {
|
|
272
|
-
|
|
272
|
+
var _a;
|
|
273
|
+
(_a = this.closeBtn) == null ? void 0 : _a.removeEventListener("wje-button:click", this.hide);
|
|
273
274
|
this.removeEventListener("wje-toast:after-hide", this.removeChildAndStack);
|
|
274
275
|
this.removeEventListener("mouseenter", this.pause);
|
|
275
276
|
this.removeEventListener("mouseleave", this.resume);
|
package/dist/wje-toast.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wje-toast.js","sources":["../packages/wje-toast/toast.element.js","../packages/wje-toast/toast.js"],"sourcesContent":["import { default as WJElement, WjElementUtils, event } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Toast` is a custom web component that represents a toast notification.\n * @summary This element represents a toast notification.\n * @documentation https://elements.webjet.sk/components/toast\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part\n * @cssproperty {string} headline - Specifies the headline text of the toast. Represents the main title or heading displayed in the toast.\n * @cssproperty {boolean} open - Indicates whether the toast is currently open (visible). A value of `true` shows the toast, while `false` hides it.\n * @cssproperty {number} duration - Determines the duration (in milliseconds) for which the toast is displayed. After this time, the toast will automatically close unless it is manually closed.\n * @cssproperty {boolean} closable - Specifies whether the toast can be manually closed by the user. If `true`, the toast will include a close button or mechanism.\n * @cssproperty {string} color - Defines the color of the toast. Accepts any valid CSS color value such as `hex`, `RGB`, or named colors.\n * @cssproperty {boolean} countdown - Indicates whether a countdown is displayed in the toast. When `true`, a visual countdown timer is shown to indicate the remaining time before the toast closes.\n * @slot - The content of the toast.\n * @slot media - The media of the toast.\n * // @fires wje-toast:after-show - Fired after the toast is shown.\n * // @fires wje-toast:after-hide - Fired after the toast is hidden.\n */\n\nexport default class Toast extends WJElement {\n /**\n * Creates an instance of Toast.\n */\n constructor() {\n super();\n\n this.toastStack = Object.assign(document.createElement('div'), { className: 'wje-toast-stack' });\n }\n\n /**\n * Set headline value of the toast.\n * @param value\n */\n set headline(value) {\n this.setAttribute('headline', value);\n }\n\n /**\n * Get headline value of the toast.\n * @returns {string}\n */\n get headline() {\n return this.getAttribute('headline');\n }\n\n /**\n * Set open value of the toast.\n * @param value\n */\n set open(value) {\n this.removeAttribute('open');\n\n if (WjElementUtils.stringToBoolean(value)) this.setAttribute('open', value);\n }\n\n /**\n * Get open value of the toast.\n * @returns {boolean}\n */\n get open() {\n return this.hasAttribute('open');\n }\n\n /**\n * Set duration value of the toast.\n * @param value\n */\n set duration(value) {\n this.setAttribute('duration', value);\n }\n\n /**\n * Get duration value of the toast.\n * @returns {number}\n */\n get duration() {\n return +this.getAttribute('duration');\n }\n\n /**\n * Set closable value of the toast.\n * @param value\n */\n set closable(value) {\n this.setAttribute('closable', value || '');\n }\n\n /**\n * Get closable value of the toast.\n * @returns {boolean}\n */\n get closable() {\n return this.hasAttribute('closable');\n }\n\n /**\n * Set color value of the toast.\n * @param value\n */\n set color(value) {\n this.setAttribute('color', value);\n }\n\n /**\n * Get color value of the toast.\n * @returns {string}\n */\n get color() {\n return this.getAttribute('color');\n }\n\n /**\n * Set countdown value of the toast.\n * @param value\n */\n set countdown(value) {\n if (value) this.setAttribute('countdown', value);\n }\n\n /**\n * Get countdown value of the toast.\n * @returns {boolean}\n */\n get countdown() {\n return this.hasAttribute('countdown');\n }\n\n /**\n * Set icon value of the toast.\n * @param value\n */\n set icon(value) {\n this.setAttribute('icon', value);\n }\n\n /**\n * Get icon value of the toast.\n * @returns {string}\n */\n get icon() {\n return this.getAttribute('icon');\n }\n\n /**\n * The class name for the component.\n * @type {string}\n */\n className = 'Toast';\n\n /**\n * Returns the CSS stylesheet for the component.\n * @static\n * @returns {CSSStyleSheet} The CSS stylesheet\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Setup attributes for the Button element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draw method for the toast notification.\n * @returns {object} Document fragment\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-toast');\n\n let mediaSlot = document.createElement('slot');\n mediaSlot.setAttribute('name', 'media');\n mediaSlot.classList.add('media');\n mediaSlot.addEventListener('slotchange', () => {\n if (WjElementUtils.hasSlotContent(this.context, 'media')) {\n mediaSlot.parentElement.classList.add('has-media');\n } else {\n mediaSlot.parentElement.classList.remove('has-media');\n }\n });\n\n let content = document.createElement('div');\n content.classList.add('content');\n content.innerHTML = `<div class=\"headline\">${this.headline}</div><div class=\"message\"><slot></slot></div>`;\n\n let iconX = document.createElement('wje-icon');\n iconX.setAttribute('name', 'x');\n\n let closeBtn = document.createElement('wje-button');\n closeBtn.setAttribute('fill', 'link');\n closeBtn.setAttribute('color', this.color);\n closeBtn.setAttribute('size', 'small');\n closeBtn.classList.add('close');\n\n let countdownEl = document.createElement('div');\n countdownEl.classList.add('countdown');\n\n let countdownBar = document.createElement('div');\n countdownBar.classList.add('countdown-bar');\n\n closeBtn.appendChild(iconX);\n countdownEl.appendChild(countdownBar);\n\n if (this.hasAttribute('icon') && this.icon) {\n let icon = document.createElement('wje-icon');\n icon.setAttribute('name', this.icon);\n icon.setAttribute('color', this.color);\n icon.setAttribute('slot', 'media');\n icon.setAttribute('part', 'icon');\n\n this.appendChild(icon);\n }\n\n native.appendChild(mediaSlot);\n native.appendChild(content);\n\n if (this.closable) native.appendChild(closeBtn);\n\n if (this.hasAttribute('countdown')) native.appendChild(countdownEl);\n\n fragment.appendChild(native);\n\n this.closeBtn = closeBtn;\n this.countdownBar = countdownBar;\n\n return fragment;\n }\n\n /**\n * After draw method for the toast notification.\n */\n afterDraw() {\n this.closeBtn.addEventListener('wje-button:click', this.hide);\n this.addEventListener('mouseenter', this.pause);\n this.addEventListener('mouseleave', this.resume);\n\n if (this.hasAttribute('countdown')) {\n const startWidth = '100%';\n const endWidth = '0';\n\n this.countdownAnimation = this.countdownBar.animate([{ width: startWidth }, { width: endWidth }], {\n duration: this.duration,\n easing: 'linear',\n });\n }\n\n if (this.duration > 0) {\n this.remainingTime = this.duration;\n this.startTimer();\n }\n }\n\n /**\n * Before disconnect method\n * This method is called before the element is disconnected from the document.\n */\n beforeDisconnect() {\n this.closeBtn.removeEventListener('wje-button:click', this.hide);\n this.removeEventListener('wje-toast:after-hide', this.removeChildAndStack);\n this.removeEventListener('mouseenter', this.pause);\n this.removeEventListener('mouseleave', this.resume);\n\n clearTimeout(this.timeoutID);\n }\n\n /**\n * Starts the timer.\n * This method sets the `startTime` property to the current time and sets\n * the `timeoutID` property to the ID of the timeout. The method also\n * dispatches the `wje-toast:after-hide` custom event when the timeout\n * expires.\n */\n startTimer() {\n this.startTime = Date.now();\n if (this.timeoutID) {\n clearTimeout(this.timeoutID);\n }\n this.timeoutID = window.setTimeout(() => {\n this.hide();\n }, this.remainingTime);\n }\n\n /**\n * Stops the timer.\n * This method clears the timeout and calculates the remaining time.\n * The method is called when the toast notification is paused.\n */\n stopTimer() {\n if (this.timeoutID) {\n window.clearTimeout(this.timeoutID);\n }\n const elapsedTime = Date.now() - this.startTime;\n this.remainingTime -= elapsedTime;\n }\n\n /**\n * Resumes the timer.\n * This method resumes the timer if the remaining time is greater\n * than zero. The method is called when the toast notification is resumed.\n */\n resumeTimer() {\n if (this.remainingTime > 0) {\n this.startTimer();\n }\n }\n\n /**\n * Asynchronously shows the toast notification.\n * This method sets the `open` property to `true` and dispatches the\n * `wje-toast:after-show` custom event. If the toast is already open,\n * the method returns `undefined`.\n */\n show = () => {\n if (this.open) {\n return;\n }\n\n this.open = true;\n event.dispatchCustomEvent(this, 'wje-toast:after-show');\n };\n\n /**\n * Asynchronously hides the toast notification.\n * This method sets the `open` property to `false` and dispatches the\n * `wje-toast:after-hide` custom event. If the toast is already hidden,\n * the method returns `undefined`.\n */\n hide = () => {\n if (!this.open) {\n return;\n }\n\n this.open = false;\n event.dispatchCustomEvent(this, 'wje-toast:after-hide');\n };\n\n /**\n * Pauses the countdown animation and stops the timer.\n */\n pause = () => {\n this.countdownAnimation?.pause();\n this.stopTimer();\n };\n\n /**\n * Resumes the countdown animation and resumes the timer.\n */\n resume = () => {\n this.countdownAnimation?.play();\n this.resumeTimer();\n };\n\n /**\n * Removes the toast notification and the toast stack.\n *\n * This method removes the toast notification from the toast stack and\n * removes the toast stack from the document body if the toast stack is\n * empty.\n */\n removeChildAndStack() {\n this.toastStack.removeChild(this);\n\n if (this.toastStack.querySelector('wje-toast') === null) {\n this.toastStack.remove();\n }\n }\n\n /**\n * Asynchronously starts the toast notification.\n * This method appends the toast notification to the document body and\n * shows the toast notification. The method returns a promise that\n * resolves when the toast notification is shown.\n * @returns {Promise<unknown>}\n */\n start = () => {\n return new Promise((resolve) => {\n let stack = document.body.querySelector('.wje-toast-stack');\n if (stack) {\n this.toastStack = stack;\n }\n\n if (this.toastStack.parentElement === null) {\n document.body.append(this.toastStack);\n }\n\n this.toastStack.append(this);\n\n this.show();\n\n this.addEventListener('wje-toast:after-hide', this.removeChildAndStack);\n });\n };\n}\n","import Toast from './toast.element.js';\n\nexport default Toast;\n\nToast.define('wje-toast', Toast);\n"],"names":[],"mappings":";;;;;AAsBe,MAAM,cAAc,UAAU;AAAA;AAAA;AAAA;AAAA,EAIzC,cAAc;AACV,UAAO;AA2HX;AAAA;AAAA;AAAA;AAAA,qCAAY;AA2KZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAAO,MAAM;AACT,UAAI,KAAK,MAAM;AACX;AAAA,MACZ;AAEQ,WAAK,OAAO;AACZ,YAAM,oBAAoB,MAAM,sBAAsB;AAAA,IACzD;AAQD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAAO,MAAM;AACT,UAAI,CAAC,KAAK,MAAM;AACZ;AAAA,MACZ;AAEQ,WAAK,OAAO;AACZ,YAAM,oBAAoB,MAAM,sBAAsB;AAAA,IACzD;AAKD;AAAA;AAAA;AAAA,iCAAQ,MAAM;;AACV,iBAAK,uBAAL,mBA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,KAAK,gBAAgB,GAAG;AACxB,WAAK,WAAY;AAAA,IAC7B;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuDI,sBAAsB;AAClB,SAAK,WAAW,YAAY,IAAI;AAEhC,QAAI,KAAK,WAAW,cAAc,WAAW,MAAM,MAAM;AACrD,WAAK,WAAW,OAAQ;AAAA,IACpC;AAAA,EACA;AA2BA;AC7YA,MAAM,OAAO,aAAa,KAAK;"}
|
|
1
|
+
{"version":3,"file":"wje-toast.js","sources":["../packages/wje-toast/toast.element.js","../packages/wje-toast/toast.js"],"sourcesContent":["import { default as WJElement, WjElementUtils, event } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Toast` is a custom web component that represents a toast notification.\n * @summary This element represents a toast notification.\n * @documentation https://elements.webjet.sk/components/toast\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native part\n * @cssproperty {string} headline - Specifies the headline text of the toast. Represents the main title or heading displayed in the toast.\n * @cssproperty {boolean} open - Indicates whether the toast is currently open (visible). A value of `true` shows the toast, while `false` hides it.\n * @cssproperty {number} duration - Determines the duration (in milliseconds) for which the toast is displayed. After this time, the toast will automatically close unless it is manually closed.\n * @cssproperty {boolean} closable - Specifies whether the toast can be manually closed by the user. If `true`, the toast will include a close button or mechanism.\n * @cssproperty {string} color - Defines the color of the toast. Accepts any valid CSS color value such as `hex`, `RGB`, or named colors.\n * @cssproperty {boolean} countdown - Indicates whether a countdown is displayed in the toast. When `true`, a visual countdown timer is shown to indicate the remaining time before the toast closes.\n * @slot - The content of the toast.\n * @slot media - The media of the toast.\n * // @fires wje-toast:after-show - Fired after the toast is shown.\n * // @fires wje-toast:after-hide - Fired after the toast is hidden.\n */\n\nexport default class Toast extends WJElement {\n /**\n * Creates an instance of Toast.\n */\n constructor() {\n super();\n\n this.toastStack = Object.assign(document.createElement('div'), { className: 'wje-toast-stack' });\n }\n\n /**\n * Set headline value of the toast.\n * @param value\n */\n set headline(value) {\n this.setAttribute('headline', value);\n }\n\n /**\n * Get headline value of the toast.\n * @returns {string}\n */\n get headline() {\n return this.getAttribute('headline');\n }\n\n /**\n * Set open value of the toast.\n * @param value\n */\n set open(value) {\n this.removeAttribute('open');\n\n if (WjElementUtils.stringToBoolean(value)) this.setAttribute('open', value);\n }\n\n /**\n * Get open value of the toast.\n * @returns {boolean}\n */\n get open() {\n return this.hasAttribute('open');\n }\n\n /**\n * Set duration value of the toast.\n * @param value\n */\n set duration(value) {\n this.setAttribute('duration', value);\n }\n\n /**\n * Get duration value of the toast.\n * @returns {number}\n */\n get duration() {\n return +this.getAttribute('duration');\n }\n\n /**\n * Set closable value of the toast.\n * @param value\n */\n set closable(value) {\n this.setAttribute('closable', value || '');\n }\n\n /**\n * Get closable value of the toast.\n * @returns {boolean}\n */\n get closable() {\n return this.hasAttribute('closable');\n }\n\n /**\n * Set color value of the toast.\n * @param value\n */\n set color(value) {\n this.setAttribute('color', value);\n }\n\n /**\n * Get color value of the toast.\n * @returns {string}\n */\n get color() {\n return this.getAttribute('color');\n }\n\n /**\n * Set countdown value of the toast.\n * @param value\n */\n set countdown(value) {\n if (value) this.setAttribute('countdown', value);\n }\n\n /**\n * Get countdown value of the toast.\n * @returns {boolean}\n */\n get countdown() {\n return this.hasAttribute('countdown');\n }\n\n /**\n * Set icon value of the toast.\n * @param value\n */\n set icon(value) {\n this.setAttribute('icon', value);\n }\n\n /**\n * Get icon value of the toast.\n * @returns {string}\n */\n get icon() {\n return this.getAttribute('icon');\n }\n\n /**\n * The class name for the component.\n * @type {string}\n */\n className = 'Toast';\n\n /**\n * Returns the CSS stylesheet for the component.\n * @static\n * @returns {CSSStyleSheet} The CSS stylesheet\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Setup attributes for the Button element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n }\n\n /**\n * Draw method for the toast notification.\n * @returns {object} Document fragment\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-toast');\n\n let mediaSlot = document.createElement('slot');\n mediaSlot.setAttribute('name', 'media');\n mediaSlot.classList.add('media');\n mediaSlot.addEventListener('slotchange', () => {\n if (WjElementUtils.hasSlotContent(this.context, 'media')) {\n mediaSlot.parentElement.classList.add('has-media');\n } else {\n mediaSlot.parentElement.classList.remove('has-media');\n }\n });\n\n let content = document.createElement('div');\n content.classList.add('content');\n content.innerHTML = `<div class=\"headline\">${this.headline}</div><div class=\"message\"><slot></slot></div>`;\n\n let iconX = document.createElement('wje-icon');\n iconX.setAttribute('name', 'x');\n\n let closeBtn = document.createElement('wje-button');\n closeBtn.setAttribute('fill', 'link');\n closeBtn.setAttribute('color', this.color);\n closeBtn.setAttribute('size', 'small');\n closeBtn.classList.add('close');\n\n let countdownEl = document.createElement('div');\n countdownEl.classList.add('countdown');\n\n let countdownBar = document.createElement('div');\n countdownBar.classList.add('countdown-bar');\n\n closeBtn.appendChild(iconX);\n countdownEl.appendChild(countdownBar);\n\n if (this.hasAttribute('icon') && this.icon) {\n let icon = document.createElement('wje-icon');\n icon.setAttribute('name', this.icon);\n icon.setAttribute('color', this.color);\n icon.setAttribute('slot', 'media');\n icon.setAttribute('part', 'icon');\n\n this.appendChild(icon);\n }\n\n native.appendChild(mediaSlot);\n native.appendChild(content);\n\n if (this.closable) native.appendChild(closeBtn);\n\n if (this.hasAttribute('countdown')) native.appendChild(countdownEl);\n\n fragment.appendChild(native);\n\n this.closeBtn = closeBtn;\n this.countdownBar = countdownBar;\n\n return fragment;\n }\n\n /**\n * After draw method for the toast notification.\n */\n afterDraw() {\n this.closeBtn.addEventListener('wje-button:click', this.hide);\n this.addEventListener('mouseenter', this.pause);\n this.addEventListener('mouseleave', this.resume);\n\n if (this.hasAttribute('countdown')) {\n const startWidth = '100%';\n const endWidth = '0';\n\n this.countdownAnimation = this.countdownBar.animate([{ width: startWidth }, { width: endWidth }], {\n duration: this.duration,\n easing: 'linear',\n });\n }\n\n if (this.duration > 0) {\n this.remainingTime = this.duration;\n this.startTimer();\n }\n }\n\n /**\n * Before disconnect method\n * This method is called before the element is disconnected from the document.\n */\n beforeDisconnect() {\n this.closeBtn?.removeEventListener('wje-button:click', this.hide);\n this.removeEventListener('wje-toast:after-hide', this.removeChildAndStack);\n this.removeEventListener('mouseenter', this.pause);\n this.removeEventListener('mouseleave', this.resume);\n\n clearTimeout(this.timeoutID);\n }\n\n /**\n * Starts the timer.\n * This method sets the `startTime` property to the current time and sets\n * the `timeoutID` property to the ID of the timeout. The method also\n * dispatches the `wje-toast:after-hide` custom event when the timeout\n * expires.\n */\n startTimer() {\n this.startTime = Date.now();\n if (this.timeoutID) {\n clearTimeout(this.timeoutID);\n }\n this.timeoutID = window.setTimeout(() => {\n this.hide();\n }, this.remainingTime);\n }\n\n /**\n * Stops the timer.\n * This method clears the timeout and calculates the remaining time.\n * The method is called when the toast notification is paused.\n */\n stopTimer() {\n if (this.timeoutID) {\n window.clearTimeout(this.timeoutID);\n }\n const elapsedTime = Date.now() - this.startTime;\n this.remainingTime -= elapsedTime;\n }\n\n /**\n * Resumes the timer.\n * This method resumes the timer if the remaining time is greater\n * than zero. The method is called when the toast notification is resumed.\n */\n resumeTimer() {\n if (this.remainingTime > 0) {\n this.startTimer();\n }\n }\n\n /**\n * Asynchronously shows the toast notification.\n * This method sets the `open` property to `true` and dispatches the\n * `wje-toast:after-show` custom event. If the toast is already open,\n * the method returns `undefined`.\n */\n show = () => {\n if (this.open) {\n return;\n }\n\n this.open = true;\n event.dispatchCustomEvent(this, 'wje-toast:after-show');\n };\n\n /**\n * Asynchronously hides the toast notification.\n * This method sets the `open` property to `false` and dispatches the\n * `wje-toast:after-hide` custom event. If the toast is already hidden,\n * the method returns `undefined`.\n */\n hide = () => {\n if (!this.open) {\n return;\n }\n\n this.open = false;\n event.dispatchCustomEvent(this, 'wje-toast:after-hide');\n };\n\n /**\n * Pauses the countdown animation and stops the timer.\n */\n pause = () => {\n this.countdownAnimation?.pause();\n this.stopTimer();\n };\n\n /**\n * Resumes the countdown animation and resumes the timer.\n */\n resume = () => {\n this.countdownAnimation?.play();\n this.resumeTimer();\n };\n\n /**\n * Removes the toast notification and the toast stack.\n *\n * This method removes the toast notification from the toast stack and\n * removes the toast stack from the document body if the toast stack is\n * empty.\n */\n removeChildAndStack() {\n this.toastStack.removeChild(this);\n\n if (this.toastStack.querySelector('wje-toast') === null) {\n this.toastStack.remove();\n }\n }\n\n /**\n * Asynchronously starts the toast notification.\n * This method appends the toast notification to the document body and\n * shows the toast notification. The method returns a promise that\n * resolves when the toast notification is shown.\n * @returns {Promise<unknown>}\n */\n start = () => {\n return new Promise((resolve) => {\n let stack = document.body.querySelector('.wje-toast-stack');\n if (stack) {\n this.toastStack = stack;\n }\n\n if (this.toastStack.parentElement === null) {\n document.body.append(this.toastStack);\n }\n\n this.toastStack.append(this);\n\n this.show();\n\n this.addEventListener('wje-toast:after-hide', this.removeChildAndStack);\n });\n };\n}\n","import Toast from './toast.element.js';\n\nexport default Toast;\n\nToast.define('wje-toast', Toast);\n"],"names":[],"mappings":";;;;;AAsBe,MAAM,cAAc,UAAU;AAAA;AAAA;AAAA;AAAA,EAIzC,cAAc;AACV,UAAO;AA2HX;AAAA;AAAA;AAAA;AAAA,qCAAY;AA2KZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAAO,MAAM;AACT,UAAI,KAAK,MAAM;AACX;AAAA,MACZ;AAEQ,WAAK,OAAO;AACZ,YAAM,oBAAoB,MAAM,sBAAsB;AAAA,IACzD;AAQD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAAO,MAAM;AACT,UAAI,CAAC,KAAK,MAAM;AACZ;AAAA,MACZ;AAEQ,WAAK,OAAO;AACZ,YAAM,oBAAoB,MAAM,sBAAsB;AAAA,IACzD;AAKD;AAAA;AAAA;AAAA,iCAAQ,MAAM;;AACV,iBAAK,uBAAL,mBAAyB;AACzB,WAAK,UAAW;AAAA,IACnB;AAKD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Y;AAAA,IAC7B;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuDI,sBAAsB;AAClB,SAAK,WAAW,YAAY,IAAI;AAEhC,QAAI,KAAK,WAAW,cAAc,WAAW,MAAM,MAAM;AACrD,WAAK,WAAW,OAAQ;AAAA,IACpC;AAAA,EACA;AA2BA;AC7YA,MAAM,OAAO,aAAa,KAAK;"}
|
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.
|
|
4
|
+
"version": "0.1.157",
|
|
5
5
|
"homepage": "https://github.com/lencys/wj-elements",
|
|
6
6
|
"author": "Lukáš Ondrejček <lukas.ondrejcek@gmail.com>",
|
|
7
7
|
"license": "MIT",
|