wj-elements 0.1.53 → 0.1.55

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.
@@ -4,14 +4,14 @@ var a = (h, e, t) => (A(h, typeof e != "symbol" ? e + "" : e, t), t), P = (h, e,
4
4
  if (!e.has(h))
5
5
  throw TypeError("Cannot " + t);
6
6
  };
7
- var w = (h, e, t) => {
7
+ var y = (h, e, t) => {
8
8
  if (e.has(h))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
10
  e instanceof WeakSet ? e.add(h) : e.set(h, t);
11
11
  };
12
12
  var p = (h, e, t) => (P(h, e, "access private method"), t);
13
- import { store as b, defaultStoreActions as C } from "./wje-store.js";
14
- class j {
13
+ import { store as w, defaultStoreActions as j } from "./wje-store.js";
14
+ class C {
15
15
  constructor(e = {}) {
16
16
  a(this, "findByKey", (e, t, s) => {
17
17
  if (this._store.getState()[e] instanceof Array)
@@ -41,8 +41,8 @@ class j {
41
41
  async: !0,
42
42
  referrerPolicy: "same-origin"
43
43
  }).then((n, o) => {
44
- var y;
45
- let m = (y = n.headers.get("permissions")) == null ? void 0 : y.split(",");
44
+ var b;
45
+ let m = (b = n.headers.get("permissions")) == null ? void 0 : b.split(",");
46
46
  if (r(m), n.ok)
47
47
  return n.json();
48
48
  throw n.json();
@@ -171,7 +171,7 @@ class u {
171
171
  var l, d, g;
172
172
  class T {
173
173
  constructor() {
174
- w(this, d);
174
+ y(this, d);
175
175
  this.customEventStorage = [], l = this;
176
176
  }
177
177
  dispatchCustomEvent(e, t, s) {
@@ -210,10 +210,20 @@ class T {
210
210
  options: r,
211
211
  event: s
212
212
  };
213
- this.listenerExists(e, t, o) || (n.listeners[t].push(o), e.addEventListener(t, i, r));
213
+ this.listenerExists(e, t, o) ? console.warn("Listener already exists", e, t, i) : (n.listeners[t].push(o), e.addEventListener(t, i, r));
214
+ }
215
+ /**
216
+ * Performs a deep equality check between two objects.
217
+ *
218
+ * @param {any} x - The first object to compare.
219
+ * @param {any} y - The second object to compare.
220
+ * @returns {boolean} - Returns `true` if the objects are deeply equal, `false` otherwise.
221
+ */
222
+ deepEqual(e, t) {
223
+ return e && t && typeof e == "object" && typeof e == typeof t ? Object.keys(e).length === Object.keys(t).length && Object.keys(e).every((s) => this.deepEqual(e[s], t[s])) : e === t;
214
224
  }
215
225
  listenerExists(e, t, s) {
216
- return this.findRecordByElement(e).listeners[t].some((r) => JSON.stringify(r) === JSON.stringify(s));
226
+ return this.findRecordByElement(e).listeners[t].some((r) => this.deepEqual(r, s));
217
227
  }
218
228
  removeListener(e, t, s, i, r) {
219
229
  let n = this.findRecordByElement(e);
@@ -250,8 +260,8 @@ d = new WeakSet(), g = function(e) {
250
260
  });
251
261
  };
252
262
  let _ = new T();
253
- const E = document.createElement("template");
254
- E.innerHTML = "";
263
+ const S = document.createElement("template");
264
+ S.innerHTML = "";
255
265
  const f = class f extends HTMLElement {
256
266
  constructor(t) {
257
267
  super();
@@ -263,8 +273,8 @@ const f = class f extends HTMLElement {
263
273
  const i = new CSSStyleSheet();
264
274
  i.replaceSync(this.constructor.cssStyleSheet), this.context.adoptedStyleSheets = [i];
265
275
  });
266
- this.template = t || E, this.isAttached = !1, this.service = new j({
267
- store: b
276
+ this.template = t || S, this.isAttached = !1, this.service = new C({
277
+ store: w
268
278
  }), this.defineDepandencies(), this.rendering = !1, this.runtimeTimeout = null, this.count = 0, this.functionStack = [], this.scheludedRefresh = !1, this._depandencies = {};
269
279
  }
270
280
  get permission() {
@@ -292,7 +302,7 @@ const f = class f extends HTMLElement {
292
302
  return this.isShadowRoot ? this.shadowRoot : this;
293
303
  }
294
304
  get store() {
295
- return b;
305
+ return w;
296
306
  }
297
307
  // addAction,
298
308
  // deleteAction,
@@ -316,7 +326,7 @@ const f = class f extends HTMLElement {
316
326
  * @return {ArrayActions, ObjectActions}
317
327
  */
318
328
  get defaultStoreActions() {
319
- return C;
329
+ return j;
320
330
  }
321
331
  get removeClassAfterConnect() {
322
332
  var t;
@@ -443,11 +453,11 @@ a(f, "processTemplates", (t, s) => {
443
453
  const i = document.createElement("template");
444
454
  return i.innerHTML = [s.innerHTML, (t == null ? void 0 : t.innerHTML) || ""].join(""), i;
445
455
  });
446
- let S = f, k = "true";
456
+ let E = f, L = "true";
447
457
  export {
448
458
  u as WjElementUtils,
449
459
  c as WjePermissionsApi,
450
- k as __esModule,
451
- S as default,
460
+ L as __esModule,
461
+ E as default,
452
462
  _ as event
453
463
  };
@@ -93,7 +93,32 @@ import { default as Qr } from "./wje-tooltip.js";
93
93
  import { default as Kr } from "./wje-visually-hidden.js";
94
94
  import { default as Zr } from "./wje-sliding-container.js";
95
95
  import { P as ea } from "./popup.element-CWsSOxs2.js";
96
- const A = {
96
+ function A(o, l) {
97
+ let e;
98
+ if (typeof o == "string")
99
+ e = new Date(o);
100
+ else if (typeof o == "number")
101
+ e = new Date(o);
102
+ else if (o instanceof Date)
103
+ e = o;
104
+ else
105
+ throw new Error("Invalid date input");
106
+ const r = {
107
+ yyyy: e.getFullYear(),
108
+ MM: String(e.getMonth() + 1).padStart(2, "0"),
109
+ // Mesiace sú indexované od 0
110
+ dd: String(e.getDate()).padStart(2, "0"),
111
+ HH: String(e.getHours()).padStart(2, "0"),
112
+ mm: String(e.getMinutes()).padStart(2, "0"),
113
+ ss: String(e.getSeconds()).padStart(2, "0"),
114
+ MMMM: e.toLocaleString("en-US", { month: "long" }),
115
+ // Full month name
116
+ MMM: e.toLocaleString("en-US", { month: "short" })
117
+ // Short month name
118
+ };
119
+ return l.replace(/yyyy|MM|dd|HH|mm|ss|MMMM|MMM/g, (s) => r[s]);
120
+ }
121
+ const E = {
97
122
  code: "sk",
98
123
  name: "Slovak",
99
124
  dir: "ltr",
@@ -102,8 +127,8 @@ const A = {
102
127
  "wj.file.upload.uploaded": "Nahraných: ",
103
128
  "wj.file.upload.from": "z"
104
129
  };
105
- j.registerTranslation(A);
106
- const E = {
130
+ j.registerTranslation(E);
131
+ const L = {
107
132
  code: "en",
108
133
  name: "English",
109
134
  dir: "ltr",
@@ -112,15 +137,15 @@ const E = {
112
137
  "wj.file.upload.uploaded": "Uploaded: ",
113
138
  "wj.file.upload.from": "from"
114
139
  };
115
- j.registerTranslation(E);
116
- const L = "";
140
+ j.registerTranslation(L);
141
+ const M = "";
117
142
  class v extends g {
118
143
  constructor() {
119
144
  super();
120
145
  f(this, "className", "Step");
121
146
  }
122
147
  static get cssStyleSheet() {
123
- return L;
148
+ return M;
124
149
  }
125
150
  setupAttributes() {
126
151
  this.isShadowRoot = "open";
@@ -132,7 +157,7 @@ class v extends g {
132
157
  }
133
158
  }
134
159
  v.define("wje-step", v);
135
- const M = ".stepper-container{display:flex;flex-direction:column}.step-headers{display:flex;justify-content:space-between;margin-bottom:var(--wje-spacing-medium)}.step-header{display:flex;padding:var(--wje-spacing-medium);gap:var(--wje-spacing-x-small);color:var(--wje-color-contrast-5);flex-grow:1;text-align:center}.pointer{cursor:pointer}.active{color:var(--wje-color-contrast-11)}.steps-content{margin-bottom:var(--wje-spacing-medium)}.arrow-icon{margin-top:var(--wje-stepper-margin)}.step{padding:var(--wje-spacing-medium);text-align:center}.done{color:var(--wje-color-contrast-11)}.nav-buttons{display:flex;justify-content:space-between}";
160
+ const R = ".stepper-container{display:flex;flex-direction:column}.step-headers{display:flex;justify-content:space-between;margin-bottom:var(--wje-spacing-medium)}.step-header{display:flex;padding:var(--wje-spacing-medium);gap:var(--wje-spacing-x-small);color:var(--wje-color-contrast-5);flex-grow:1;text-align:center}.pointer{cursor:pointer}.active{color:var(--wje-color-contrast-11)}.steps-content{margin-bottom:var(--wje-spacing-medium)}.arrow-icon{margin-top:var(--wje-stepper-margin)}.step{padding:var(--wje-spacing-medium);text-align:center}.done{color:var(--wje-color-contrast-11)}.nav-buttons{display:flex;justify-content:space-between}";
136
161
  class w extends g {
137
162
  constructor() {
138
163
  super();
@@ -140,7 +165,7 @@ class w extends g {
140
165
  this.currentStep = 0, this.completedSteps = [];
141
166
  }
142
167
  static get cssStyleSheet() {
143
- return M;
168
+ return R;
144
169
  }
145
170
  setupAttributes() {
146
171
  this.isShadowRoot = "open";
@@ -204,7 +229,7 @@ class w extends g {
204
229
  }
205
230
  }
206
231
  w.define("wje-stepper", w);
207
- const R = ".native-timeline{position:relative}.vertical-line{position:absolute;margin-left:calc(var(--wje-spacing-x-large) + 1px);top:0;bottom:0;width:1px;background-color:var(--wje-color-info-3)}";
232
+ const T = ".native-timeline{position:relative}.vertical-line{position:absolute;margin-left:calc(var(--wje-spacing-x-large) + 1px);top:0;bottom:0;width:1px;background-color:var(--wje-color-info-3)}";
208
233
  class b extends g {
209
234
  constructor() {
210
235
  super();
@@ -222,7 +247,7 @@ class b extends g {
222
247
  * @returns {CSSStyleSheet}
223
248
  */
224
249
  static get cssStyleSheet() {
225
- return R;
250
+ return T;
226
251
  }
227
252
  /**
228
253
  * Sets up the attributes for the component.
@@ -249,31 +274,6 @@ class b extends g {
249
274
  }
250
275
  }
251
276
  b.define("wje-timeline", b);
252
- function T(o, l) {
253
- let e;
254
- if (typeof o == "string")
255
- e = new Date(o);
256
- else if (typeof o == "number")
257
- e = new Date(o);
258
- else if (o instanceof Date)
259
- e = o;
260
- else
261
- throw new Error("Invalid date input");
262
- const r = {
263
- yyyy: e.getFullYear(),
264
- MM: String(e.getMonth() + 1).padStart(2, "0"),
265
- // Mesiace sú indexované od 0
266
- dd: String(e.getDate()).padStart(2, "0"),
267
- HH: String(e.getHours()).padStart(2, "0"),
268
- mm: String(e.getMinutes()).padStart(2, "0"),
269
- ss: String(e.getSeconds()).padStart(2, "0"),
270
- MMMM: e.toLocaleString("en-US", { month: "long" }),
271
- // Full month name
272
- MMM: e.toLocaleString("en-US", { month: "short" })
273
- // Short month name
274
- };
275
- return l.replace(/yyyy|MM|dd|HH|mm|ss|MMMM|MMM/g, (s) => r[s]);
276
- }
277
277
  const k = ":host{--wje-card-content-padding: var(--wje-spacing-medium);margin-bottom:.5rem;display:block}.native-timeline-item>wje-icon{color:var(--wje-color-contrast-5)!important}.timeline-items{display:flex;flex-direction:column}.native-timeline-item{display:flex;position:relative;padding:var(--wje-spacing-medium) var(--wje-spacing-medium) var(--wje-spacing-medium) var(--wje-spacing-large);gap:var(--wje-spacing-medium);border-width:1px;border-style:solid;border-color:transparent;border-radius:var(--wje-border-radius-large)}:host .native-timeline-item:hover{background-color:var(--wje-color-contrast-1);border-color:var(--wje-color-contrast-3)}:host([active]) .native-timeline-item{background-color:var(--wje-color-primary-1);border-color:var(--wje-color-primary-3)}:host([active]) .native-timeline-item:hover{background-color:var(--wje-color-primary-2)}.icon-container{position:absolute;display:flex;width:var(--wje-size-small);height:var(--wje-size-small);padding:var(--wje-spacing-2x-small);border-radius:var(--wje-border-radius-circle);opacity:0}.content-container{height:fit-content;gap:var(--wje-spacing-small)}.event{margin:0;font-size:var(--wje-font-size-large);font-weight:var(--wje-font-weight-bold);line-height:var(--wje-line-height-dense);letter-spacing:var(--wje-spacing-4x-small)}.additional-content{font-size:var(--wje-font-size-medium);margin-top:1rem}wje-status{position:relative;z-index:1}wje-relative-time{display:block;margin-bottom:var(--wje-spacing-2x-small)}";
278
278
  class S extends g {
279
279
  constructor() {
@@ -314,7 +314,7 @@ class S extends g {
314
314
  let i = document.createElement("div");
315
315
  i.classList.add("content-container");
316
316
  let d = document.createElement("wje-tooltip");
317
- d.setAttribute("text", this.getAttribute("tooltip") || ""), d.setAttribute("position", "top"), d.setAttribute("content", T(this.datetime, "dd.MM.yyyy HH:mm"));
317
+ d.setAttribute("text", this.getAttribute("tooltip") || ""), d.setAttribute("position", "top"), d.setAttribute("content", A(this.datetime, "dd.MM.yyyy HH:mm"));
318
318
  let p = document.createElement("wje-relative-time");
319
319
  p.setAttribute("date", this.datetime || ""), p.setAttribute("format", this.getAttribute("format") || ""), d.appendChild(p);
320
320
  let c = document.createElement("h3");
@@ -420,6 +420,7 @@ export {
420
420
  P as defaultStoreActions,
421
421
  q as event,
422
422
  W as fetchAndParseCSS,
423
+ A as formatDate,
423
424
  O as store,
424
425
  V as withRouterLinks
425
426
  };
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.53",
4
+ "version": "0.1.55",
5
5
  "homepage": "https://github.com/lencys/wj-elements",
6
6
  "author": "Lukáš Ondrejček <lukas.ondrejcek@gmail.com>",
7
7
  "license": "MIT",
@@ -1,4 +0,0 @@
1
- import { default as o } from "./wje-orgchart-item.js";
2
- export {
3
- o as default
4
- };