wj-elements 0.2.0-alpha.12 → 0.2.0-alpha.14
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/dark.css +6 -0
- package/dist/light.css +4 -0
- package/dist/localize.js +8 -5
- package/dist/localize.js.map +1 -1
- package/dist/packages/wje-card/card.element.d.ts +0 -8
- package/dist/packages/wje-element/element.d.ts +42 -24
- package/dist/{popup.element-DeajFyOQ.js → popup.element-Cl6QeG8M.js} +2 -2
- package/dist/{popup.element-DeajFyOQ.js.map → popup.element-Cl6QeG8M.js.map} +1 -1
- package/dist/skeleton.css +187 -0
- package/dist/wje-dialog.js +1 -0
- package/dist/wje-dialog.js.map +1 -1
- package/dist/wje-dropdown.js +1 -1
- package/dist/wje-element.js +55 -241
- package/dist/wje-element.js.map +1 -1
- package/dist/wje-file-upload.js +3 -0
- package/dist/wje-file-upload.js.map +1 -1
- package/dist/wje-master.js +1 -1
- package/dist/wje-popup.js +1 -1
- package/dist/wje-select.js +1 -1
- package/dist/wje-tooltip.js +1 -1
- package/package.json +1 -1
package/dist/dark.css
CHANGED
|
@@ -165,6 +165,9 @@
|
|
|
165
165
|
--wje-card-color: var(--wje-color-white);
|
|
166
166
|
--wje-card-border-color: transparent;
|
|
167
167
|
|
|
168
|
+
/* Dialog */
|
|
169
|
+
--wje-dialog-background: var(--wje-color-contrast-1);
|
|
170
|
+
|
|
168
171
|
/* Divider */
|
|
169
172
|
--wje-divider-border-color: var(--wje-border-color);
|
|
170
173
|
|
|
@@ -232,6 +235,9 @@
|
|
|
232
235
|
--wje-orgchart-item-boss-border: 1px solid var(--wje-border-color);
|
|
233
236
|
--wje-orgchart-item-hover-border: 1px solid var(--wje-color-danger-3);
|
|
234
237
|
|
|
238
|
+
/* Popup */
|
|
239
|
+
--wje-popup-overlay-background: var(--wje-color-contrast-0);
|
|
240
|
+
|
|
235
241
|
/* Rate */
|
|
236
242
|
--wje-rate-color: var(--wje-color-contrast-11);
|
|
237
243
|
--wje-rate-selected-color: var(--wje-color-danger-6);
|
package/dist/light.css
CHANGED
|
@@ -359,6 +359,7 @@
|
|
|
359
359
|
--wje-chip-padding-inline: var(--wje-spacing-small);
|
|
360
360
|
|
|
361
361
|
/* Dialog */
|
|
362
|
+
--wje-dialog-background: var(--wje-color-contrast-1);
|
|
362
363
|
--wje-dialog-width: 600px;
|
|
363
364
|
--wje-dialog-height: 600px;
|
|
364
365
|
--wje-dialog-border-radius: var(--wje-border-radius-medium);
|
|
@@ -563,6 +564,9 @@
|
|
|
563
564
|
--wje-orgchart-group-height-line: 10px;
|
|
564
565
|
--wje-orgchart-group-padding: 0.25rem 0;
|
|
565
566
|
|
|
567
|
+
/* Popup */
|
|
568
|
+
--wje-popup-overlay-background: var(--wje-color-contrast-0);
|
|
569
|
+
|
|
566
570
|
/* Radio */
|
|
567
571
|
--wje-radio-margin-top: 0;
|
|
568
572
|
--wje-radio-margin-bottom: 0.5rem;
|
package/dist/localize.js
CHANGED
|
@@ -4,9 +4,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4
4
|
class LocalizerDefault {
|
|
5
5
|
constructor(element) {
|
|
6
6
|
__publicField(this, "convertLangCode", (lang) => lang.replace("-", "_").replace(/_([a-z]{2})$/, (_, code) => `_${code.toUpperCase()}`));
|
|
7
|
+
var _a, _b, _c, _d;
|
|
7
8
|
this.element = element;
|
|
8
|
-
this.lang = this.element.lang || document.documentElement.lang || "en-GB";
|
|
9
|
-
this.dir = this.element.dir || document.documentElement.dir || "ltr";
|
|
9
|
+
this.lang = ((_a = this.element) == null ? void 0 : _a.lang) || ((_b = document.documentElement) == null ? void 0 : _b.lang) || "en-GB";
|
|
10
|
+
this.dir = ((_c = this.element) == null ? void 0 : _c.dir) || ((_d = document.documentElement) == null ? void 0 : _d.dir) || "ltr";
|
|
10
11
|
this.currentLang = "en-GB";
|
|
11
12
|
this.setLanguage();
|
|
12
13
|
}
|
|
@@ -41,9 +42,11 @@ class LocalizerDefault {
|
|
|
41
42
|
* @returns {string} The translated string, adapted to the pluralization rules and count.
|
|
42
43
|
*/
|
|
43
44
|
translatePlural(key, count = 0, type = "cardinal") {
|
|
44
|
-
const plural = new Intl.PluralRules(this.
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const plural = new Intl.PluralRules(this.currentLang, { type });
|
|
46
|
+
const k = `${key}.${plural.select(count)}`;
|
|
47
|
+
const t = this.translate(k);
|
|
48
|
+
if (t !== k) return t;
|
|
49
|
+
return this.translate(`${key}.other`);
|
|
47
50
|
}
|
|
48
51
|
/**
|
|
49
52
|
* Formats a number according to the specified locale and formatting options.
|
package/dist/localize.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localize.js","sources":["../packages/localize/localize.js","../packages/utils/localize.js"],"sourcesContent":["// export const translations = new Map();\n\nexport class LocalizerDefault {\n constructor(element) {\n this.element = element;\n\n this.lang = this.element
|
|
1
|
+
{"version":3,"file":"localize.js","sources":["../packages/localize/localize.js","../packages/utils/localize.js"],"sourcesContent":["// export const translations = new Map();\n\nexport class LocalizerDefault {\n constructor(element) {\n this.element = element;\n\n this.lang = this.element?.lang || document.documentElement?.lang || 'en-GB';\n this.dir = this.element?.dir || document.documentElement?.dir || 'ltr';\n this.currentLang = 'en-GB';\n\n this.setLanguage();\n }\n\n get languages() {\n return window.translations;\n }\n\n // Nastavenie aktuálneho jazyka\n setLanguage() {\n if (this.languages?.has(this.lang)) {\n this.currentLang = this.lang;\n } else {\n console.error(`Language \"${this.lang}\" not loaded.`);\n }\n }\n\n convertLangCode = (lang) => lang.replace(\"-\", \"_\").replace(/_([a-z]{2})$/, (_, code) => `_${code.toUpperCase()}`);\n\n /**\n * Translates a given translation key based on the currently selected language.\n * @param {string} key The key representing the text to be translated.\n * @returns {string} The translated text if available; otherwise, returns the original key.\n */\n translate(key) {\n const langMap = this.languages?.get(this.currentLang);\n if (!langMap) return key;\n return langMap ? langMap[key] || key : key;\n }\n\n /**\n * Translates a key into a localized string based on the provided count and pluralization type.\n * @param {string} key The base translation key to be used for fetching the localized string.\n * @param {number} [count=0] The count value used to determine the pluralization form.\n * @param {string} [type='cardinal'] The type of pluralization to use, such as 'cardinal' or 'ordinal'.\n * @returns {string} The translated string, adapted to the pluralization rules and count.\n */\n translatePlural(key, count = 0, type = 'cardinal') {\n const plural = new Intl.PluralRules(this.currentLang, { type });\n const k = `${key}.${plural.select(count)}`;\n const t = this.translate(k);\n if (t !== k) return t;\n return this.translate(`${key}.other`);\n }\n\n /**\n * Formats a number according to the specified locale and formatting options.\n * @param {number} number The numeric value to format.\n * @param {object} options An object containing formatting options for the number.\n * @returns {string} The formatted number as a string.\n */\n formatNumber(number, options) {\n return new Intl.NumberFormat(this.currentLang, options).format(number);\n }\n\n /**\n * Formats a given date based on the specified options and the current language setting.\n * @param {string|Date|number} date The date to format. Can be a Date object, a timestamp, or a date string.\n * @param {object} options The formatting options to customize the output, as supported by Intl.DateTimeFormat.\n * @returns {string} The formatted date string based on the specified options and current language.\n */\n formatDate(date, options) {\n return new Intl.DateTimeFormat(this.currentLang, options).format(new Date(date));\n }\n\n /**\n * Formats a relative time string based on a given language, value, unit, and formatting options.\n * @param {string} lang The language to use for formatting. Defaults to `this.currentLang` if not provided.\n * @param {number} value The numerical value to format, representing the time difference.\n * @param {string} [unit] The unit of time to use (e.g., \"second\", \"minute\", \"hour\", \"day\", \"week\", \"month\", \"year\").\n * @param {object} [options] An object containing formatting options, such as the style for the numeric representation.\n * @returns {string} The formatted relative time string in the specified language.\n */\n relativeTime(lang, value = 0, unit = 'day', options = { numeric: 'auto' }) {\n lang = lang || this.currentLang;\n return new Intl.RelativeTimeFormat(lang, options).format(value, unit);\n }\n}\n\nexport function registerTranslation(...translation) {\n translation.forEach((t) => {\n if (!t.code) {\n console.error(\"Translation object is missing 'code' property:\", t);\n return;\n }\n\n const code = t.code.toLowerCase();\n if (window.translations.has(code)) {\n window.translations.set(code, { ...window.translations.get(code), ...t });\n } else {\n window.translations.set(code, t);\n }\n });\n}\n","import { LocalizerDefault, registerTranslation } from '../localize/localize.js';\n\nexport class Localizer extends LocalizerDefault {\n constructor(element) {\n super(element);\n }\n static registerTranslation(...translation) {\n registerTranslation(...translation);\n }\n}\n"],"names":[],"mappings":";;;AAEO,MAAM,iBAAiB;AAAA,EAC1B,YAAY,SAAS;AAuBrB,2CAAkB,CAAC,SAAS,KAAK,QAAQ,KAAK,GAAG,EAAE,QAAQ,gBAAgB,CAAC,GAAG,SAAS,IAAI,KAAK,YAAa,CAAA,EAAE;AA1BpH;AAIQ,SAAK,UAAU;AAEf,SAAK,SAAO,UAAK,YAAL,mBAAc,WAAQ,cAAS,oBAAT,mBAA0B,SAAQ;AACpE,SAAK,QAAM,UAAK,YAAL,mBAAc,UAAO,cAAS,oBAAT,mBAA0B,QAAO;AACjE,SAAK,cAAc;AAEnB,SAAK,YAAa;AAAA,EAC1B;AAAA,EAEI,IAAI,YAAY;AACZ,WAAO,OAAO;AAAA,EACtB;AAAA;AAAA,EAGI,cAAc;AAlBlB;AAmBQ,SAAI,UAAK,cAAL,mBAAgB,IAAI,KAAK,OAAO;AAChC,WAAK,cAAc,KAAK;AAAA,IACpC,OAAe;AACH,cAAQ,MAAM,aAAa,KAAK,IAAI,eAAe;AAAA,IAC/D;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASI,UAAU,KAAK;AAjCnB;AAkCQ,UAAM,WAAU,UAAK,cAAL,mBAAgB,IAAI,KAAK;AACzC,QAAI,CAAC,QAAS,QAAO;AACrB,WAAO,UAAU,QAAQ,GAAG,KAAK,MAAM;AAAA,EAC/C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASI,gBAAgB,KAAK,QAAQ,GAAG,OAAO,YAAY;AAC/C,UAAM,SAAS,IAAI,KAAK,YAAY,KAAK,aAAa,EAAE,MAAM;AAC9D,UAAM,IAAI,GAAG,GAAG,IAAI,OAAO,OAAO,KAA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A;"}
|
|
@@ -20,12 +20,4 @@ export default class Card extends WJElement {
|
|
|
20
20
|
* @returns {object} styles - The CSS styles
|
|
21
21
|
*/
|
|
22
22
|
static get cssStyleSheet(): object;
|
|
23
|
-
/**
|
|
24
|
-
* Draw method for the Card element.
|
|
25
|
-
* @param {object} context The context object
|
|
26
|
-
* @param {object} store The store object
|
|
27
|
-
* @param {object} params The parameters
|
|
28
|
-
* @returns {object} fragment - The document fragment
|
|
29
|
-
*/
|
|
30
|
-
draw(context: object, store: object, params: object): object;
|
|
31
23
|
}
|
|
@@ -185,25 +185,6 @@ export default class WJElement extends HTMLElement {
|
|
|
185
185
|
* }
|
|
186
186
|
*/
|
|
187
187
|
draw(context: any, appStoreObj: any, params: any): any;
|
|
188
|
-
/**
|
|
189
|
-
* Renders the component within the provided context.
|
|
190
|
-
* @param context The rendering context, usually the element's shadow root or main DOM element.
|
|
191
|
-
* @param appStore The global application store for managing state.
|
|
192
|
-
* @param params Additional parameters or attributes for rendering the component.
|
|
193
|
-
* @returns This implementation does not render anything and returns `null`.
|
|
194
|
-
* @description
|
|
195
|
-
* The `draw` method is responsible for rendering the component's content.
|
|
196
|
-
* Override this method in subclasses to define custom rendering logic.
|
|
197
|
-
* @example
|
|
198
|
-
* class MyComponent extends WJElement {
|
|
199
|
-
* draw(context, appStore, params) {
|
|
200
|
-
* const div = document.createElement('div');
|
|
201
|
-
* div.textContent = 'Hello, world!';
|
|
202
|
-
* context.appendChild(div);
|
|
203
|
-
* }
|
|
204
|
-
* }
|
|
205
|
-
*/
|
|
206
|
-
draw(context: any, appStore: any, params: any): any;
|
|
207
188
|
/**
|
|
208
189
|
* Hook for extending behavior after drawing the component.
|
|
209
190
|
* @param context The rendering context, usually the element's shadow root or main DOM element.
|
|
@@ -217,18 +198,29 @@ export default class WJElement extends HTMLElement {
|
|
|
217
198
|
* Return: string | Node | DocumentFragment | null | Promise of those.
|
|
218
199
|
*/
|
|
219
200
|
renderSkeleton(params: any): any;
|
|
220
|
-
|
|
201
|
+
/**
|
|
202
|
+
* Sets the delay for the skeleton loading indicator.
|
|
203
|
+
* @param {string|number|null|undefined} value The delay value to be set. Accepts a numerical value,
|
|
204
|
+
* a string that can be converted to a number, null, or undefined.
|
|
205
|
+
* If null or undefined is provided, the skeleton delay will be cleared.
|
|
206
|
+
*/
|
|
207
|
+
set skeletonDelay(value: string | number | null | undefined);
|
|
221
208
|
/**
|
|
222
209
|
* Retrieves the delay duration for the skeleton display, determining the value based on a hierarchy of overrides and defaults.
|
|
223
210
|
* The method prioritizes in the following order:
|
|
224
|
-
* 1. A finite number set as the `
|
|
211
|
+
* 1. A finite number set as the `_wjSkeletonDelayOverride` property.
|
|
225
212
|
* 2. A valid numeric value from the `skeleton-delay` attribute.
|
|
226
213
|
* 3. The `skeletonDelayMs` property, if defined with a finite number.
|
|
227
214
|
* 4. A default value of 150 if none of the above are set.
|
|
228
215
|
* @returns {number} The delay in milliseconds before the skeleton is displayed.
|
|
229
216
|
*/
|
|
230
217
|
get skeletonDelay(): number;
|
|
231
|
-
|
|
218
|
+
/**
|
|
219
|
+
* Sets the minimum duration for the skeleton state. If the provided value is null, undefined, or an empty string,
|
|
220
|
+
* the override for the minimum duration is removed.
|
|
221
|
+
* @param {string|number|null|undefined} value The minimum duration to be set for the skeleton state. It can be a numeric value, string representation of a number, or null/undefined to reset the value.
|
|
222
|
+
*/
|
|
223
|
+
set skeletonMinDuration(value: string | number | null | undefined);
|
|
232
224
|
/**
|
|
233
225
|
* Retrieves the minimum duration for the skeleton animation.
|
|
234
226
|
* The method checks for an internally stored finite value. If unavailable,
|
|
@@ -238,9 +230,22 @@ export default class WJElement extends HTMLElement {
|
|
|
238
230
|
* @returns {number} The minimum duration for the skeleton animation in milliseconds.
|
|
239
231
|
*/
|
|
240
232
|
get skeletonMinDuration(): number;
|
|
241
|
-
|
|
233
|
+
_wjSkeletonMinDurationOverride: number;
|
|
234
|
+
/**
|
|
235
|
+
* Sets or removes the 'skeleton' attribute based on the provided value.
|
|
236
|
+
* @param {boolean} value A boolean value indicating whether to set ('true') or remove ('false') the 'skeleton' attribute.
|
|
237
|
+
*/
|
|
242
238
|
set skeleton(value: boolean);
|
|
239
|
+
/**
|
|
240
|
+
* Checks if the 'skeleton' attribute is present on the element.
|
|
241
|
+
* @returns {boolean} True if the 'skeleton' attribute exists, false otherwise.
|
|
242
|
+
*/
|
|
243
243
|
get skeleton(): boolean;
|
|
244
|
+
_wjSkeletonDelayOverride: number;
|
|
245
|
+
/**
|
|
246
|
+
* Retrieves the delay value used for skeleton loading.
|
|
247
|
+
* @returns {number} The delay value for the skeleton loader.
|
|
248
|
+
*/
|
|
244
249
|
get skeletonDelayValue(): number;
|
|
245
250
|
/**
|
|
246
251
|
* Lifecycle method invoked when the component is connected to the DOM.
|
|
@@ -286,7 +291,17 @@ export default class WJElement extends HTMLElement {
|
|
|
286
291
|
* @param newName The new value of the attribute.
|
|
287
292
|
*/
|
|
288
293
|
attributeChangedCallback(name: any, old: any, newName: any): void;
|
|
294
|
+
/**
|
|
295
|
+
* Triggers a refresh operation by initializing the update lifecycle and setting up promises
|
|
296
|
+
* to track its completion or failure status. Marks the instance as not pristine and queues
|
|
297
|
+
* an update.
|
|
298
|
+
* @returns {void} Does not return a value.
|
|
299
|
+
*/
|
|
289
300
|
refresh(): void;
|
|
301
|
+
/**
|
|
302
|
+
* Stops the current render loop if it is running by canceling the requestAnimationFrame.
|
|
303
|
+
* @returns {void} This method does not return a value.
|
|
304
|
+
*/
|
|
290
305
|
stopRenderLoop(): void;
|
|
291
306
|
/**
|
|
292
307
|
* Displays the component's content, optionally forcing a re-render.
|
|
@@ -332,7 +347,10 @@ export default class WJElement extends HTMLElement {
|
|
|
332
347
|
*/
|
|
333
348
|
checkGetterSetter(obj: object, property: string): object;
|
|
334
349
|
/**
|
|
335
|
-
* Sets up
|
|
350
|
+
* Sets up accessors (getter and setter) for all attributes of the current object.
|
|
351
|
+
* This method retrieves the attribute names, sanitizes them, and dynamically defines
|
|
352
|
+
* property accessors for each attribute using `Object.defineProperty`.
|
|
353
|
+
* @returns {void} This method does not return any value.
|
|
336
354
|
*/
|
|
337
355
|
setUpAccessors(): void;
|
|
338
356
|
#private;
|
|
@@ -1371,7 +1371,7 @@ const computePosition = (reference, floating, options) => {
|
|
|
1371
1371
|
platform: platformWithCache
|
|
1372
1372
|
});
|
|
1373
1373
|
};
|
|
1374
|
-
const styles = "/*\n[ WJ Popup ]\n*/\n\n:host {\n --wje-popup-top: auto;\n --wje-popup-left: auto;\n display: flex; /* zmenene z contents na flex kvoli breadcrumbs v a jeho trom bodkam */\n}\n\n.native-popup {\n position: absolute;\n isolation: isolate;\n z-index: 999;\n left: var(--wje-popup-left);\n top: var(--wje-popup-top);\n}\n.native-popup:not(.popup-active) {\n display: none;\n}\n\n.popup-loader.overlay {\n position: absolute;\n inset: 1px;\n background:
|
|
1374
|
+
const styles = "/*\n[ WJ Popup ]\n*/\n\n:host {\n --wje-popup-top: auto;\n --wje-popup-left: auto;\n\n display: flex; /* zmenene z contents na flex kvoli breadcrumbs v a jeho trom bodkam */\n}\n\n.native-popup {\n position: absolute;\n isolation: isolate;\n z-index: 999;\n left: var(--wje-popup-left);\n top: var(--wje-popup-top);\n}\n.native-popup:not(.popup-active) {\n display: none;\n}\n\n.popup-loader.overlay {\n position: absolute;\n inset: 1px;\n background: var(--wje-popup-overlay-background);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 1;\n}\n.popup-loader.fade-out {\n opacity: 0;\n transition: opacity 0.3s ease;\n pointer-events: none;\n}";
|
|
1375
1375
|
class Popup extends WJElement {
|
|
1376
1376
|
/**
|
|
1377
1377
|
* Creates an instance of Popup.
|
|
@@ -1865,4 +1865,4 @@ class Popup extends WJElement {
|
|
|
1865
1865
|
export {
|
|
1866
1866
|
Popup as P
|
|
1867
1867
|
};
|
|
1868
|
-
//# sourceMappingURL=popup.element-
|
|
1868
|
+
//# sourceMappingURL=popup.element-Cl6QeG8M.js.map
|