wj-elements 0.7.7 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animations.js +28 -51
- package/dist/animations.js.map +1 -1
- package/dist/base-path.js +19 -31
- package/dist/base-path.js.map +1 -1
- package/dist/custom-elements.json +11504 -11499
- package/dist/dark.css +1 -302
- package/dist/date.js +16 -36
- package/dist/date.js.map +1 -1
- package/dist/element-utils.js +20 -81
- package/dist/element-utils.js.map +1 -1
- package/dist/event.js +49 -165
- package/dist/event.js.map +1 -1
- package/dist/form-associated-element-BjeJn7j8.js +101 -0
- package/dist/{form-associated-element-DEQ4y-jn.js.map → form-associated-element-BjeJn7j8.js.map} +1 -1
- package/dist/icon-DmsqtDpL.js +102 -0
- package/dist/{icon-CReYMzAK.js.map → icon-DmsqtDpL.js.map} +1 -1
- package/dist/light.css +1 -731
- package/dist/localize.js +36 -111
- package/dist/localize.js.map +1 -1
- package/dist/packages/wje-accordion-item/accordion-item.element.d.ts +3 -2
- package/dist/permissions.js +14 -41
- package/dist/permissions.js.map +1 -1
- package/dist/popup.element-CbkhthPP.js +806 -0
- package/dist/{popup.element-CwXvVFK7.js.map → popup.element-CbkhthPP.js.map} +1 -1
- package/dist/router-links-CNsJ-elb.js +105 -0
- package/dist/{router-links-wjqCnncc.js.map → router-links-CNsJ-elb.js.map} +1 -1
- package/dist/skeleton.css +1 -197
- package/dist/styles.css +1 -866
- package/dist/universal-service.js +48 -109
- package/dist/universal-service.js.map +1 -1
- package/dist/utils.js +11 -18
- package/dist/utils.js.map +1 -1
- package/dist/web-types.json +760 -760
- package/dist/wje-accordion-item.js +33 -106
- package/dist/wje-accordion-item.js.map +1 -1
- package/dist/wje-accordion.js +19 -84
- package/dist/wje-accordion.js.map +1 -1
- package/dist/wje-animation.js +37 -4258
- package/dist/wje-animation.js.map +1 -1
- package/dist/wje-aside.js +9 -34
- package/dist/wje-aside.js.map +1 -1
- package/dist/wje-avatar.js +36 -126
- package/dist/wje-avatar.js.map +1 -1
- package/dist/wje-badge.js +10 -52
- package/dist/wje-badge.js.map +1 -1
- package/dist/wje-breadcrumb.js +205 -672
- package/dist/wje-breadcrumb.js.map +1 -1
- package/dist/wje-breadcrumbs.js +177 -633
- package/dist/wje-breadcrumbs.js.map +1 -1
- package/dist/wje-button-group.js +48 -153
- package/dist/wje-button-group.js.map +1 -1
- package/dist/wje-button.js +92 -413
- package/dist/wje-button.js.map +1 -1
- package/dist/wje-card-content.js +7 -30
- package/dist/wje-card-content.js.map +1 -1
- package/dist/wje-card-controls.js +7 -30
- package/dist/wje-card-controls.js.map +1 -1
- package/dist/wje-card-header.js +7 -30
- package/dist/wje-card-header.js.map +1 -1
- package/dist/wje-card-subtitle.js +7 -34
- package/dist/wje-card-subtitle.js.map +1 -1
- package/dist/wje-card-title.js +7 -34
- package/dist/wje-card-title.js.map +1 -1
- package/dist/wje-card.js +15 -71
- package/dist/wje-card.js.map +1 -1
- package/dist/wje-carousel-item.js +12 -56
- package/dist/wje-carousel-item.js.map +1 -1
- package/dist/wje-carousel.js +154 -509
- package/dist/wje-carousel.js.map +1 -1
- package/dist/wje-checkbox.js +50 -227
- package/dist/wje-checkbox.js.map +1 -1
- package/dist/wje-chip.js +43 -160
- package/dist/wje-chip.js.map +1 -1
- package/dist/wje-col.js +7 -20
- package/dist/wje-col.js.map +1 -1
- package/dist/wje-color-picker.js +445 -1464
- package/dist/wje-color-picker.js.map +1 -1
- package/dist/wje-container.js +9 -35
- package/dist/wje-container.js.map +1 -1
- package/dist/wje-copy-button.js +64 -204
- package/dist/wje-copy-button.js.map +1 -1
- package/dist/wje-dialog.js +85 -553
- package/dist/wje-dialog.js.map +1 -1
- package/dist/wje-divider.js +7 -34
- package/dist/wje-divider.js.map +1 -1
- package/dist/wje-dropdown.js +78 -305
- package/dist/wje-dropdown.js.map +1 -1
- package/dist/wje-element.js +191 -700
- package/dist/wje-element.js.map +1 -1
- package/dist/wje-file-upload-item.js +51 -156
- package/dist/wje-file-upload-item.js.map +1 -1
- package/dist/wje-file-upload.js +181 -619
- package/dist/wje-file-upload.js.map +1 -1
- package/dist/wje-footer.js +7 -31
- package/dist/wje-footer.js.map +1 -1
- package/dist/wje-form.js +7 -32
- package/dist/wje-form.js.map +1 -1
- package/dist/wje-format-digital.js +26 -118
- package/dist/wje-format-digital.js.map +1 -1
- package/dist/wje-grid.js +7 -33
- package/dist/wje-grid.js.map +1 -1
- package/dist/wje-header.js +9 -35
- package/dist/wje-header.js.map +1 -1
- package/dist/wje-icon-library.js +12 -18
- package/dist/wje-icon-library.js.map +1 -1
- package/dist/wje-icon-picker.js +65 -320
- package/dist/wje-icon-picker.js.map +1 -1
- package/dist/wje-icon.js +1 -1
- package/dist/wje-img-comparer.js +37 -114
- package/dist/wje-img-comparer.js.map +1 -1
- package/dist/wje-img.js +50 -198
- package/dist/wje-img.js.map +1 -1
- package/dist/wje-infinite-scroll.js +94 -346
- package/dist/wje-infinite-scroll.js.map +1 -1
- package/dist/wje-input-file.js +23 -84
- package/dist/wje-input-file.js.map +1 -1
- package/dist/wje-input.js +78 -392
- package/dist/wje-input.js.map +1 -1
- package/dist/wje-item.js +11 -64
- package/dist/wje-item.js.map +1 -1
- package/dist/wje-kanban.js +124 -401
- package/dist/wje-kanban.js.map +1 -1
- package/dist/wje-label.js +9 -32
- package/dist/wje-label.js.map +1 -1
- package/dist/wje-level-indicator.js +38 -157
- package/dist/wje-level-indicator.js.map +1 -1
- package/dist/wje-list.js +10 -40
- package/dist/wje-list.js.map +1 -1
- package/dist/wje-main.js +7 -31
- package/dist/wje-main.js.map +1 -1
- package/dist/wje-masonry.js +66 -211
- package/dist/wje-masonry.js.map +1 -1
- package/dist/wje-master.js +45 -161
- package/dist/wje-master.js.map +1 -1
- package/dist/wje-menu-button.js +10 -38
- package/dist/wje-menu-button.js.map +1 -1
- package/dist/wje-menu-item.js +127 -577
- package/dist/wje-menu-item.js.map +1 -1
- package/dist/wje-menu-label.js +9 -35
- package/dist/wje-menu-label.js.map +1 -1
- package/dist/wje-menu.js +14 -49
- package/dist/wje-menu.js.map +1 -1
- package/dist/wje-option.js +48 -279
- package/dist/wje-option.js.map +1 -1
- package/dist/wje-options.js +130 -384
- package/dist/wje-options.js.map +1 -1
- package/dist/wje-orgchart-group.js +16 -52
- package/dist/wje-orgchart-group.js.map +1 -1
- package/dist/wje-orgchart-item.js +24 -93
- package/dist/wje-orgchart-item.js.map +1 -1
- package/dist/wje-orgchart.js +18 -68
- package/dist/wje-orgchart.js.map +1 -1
- package/dist/wje-pagination.js +113 -397
- package/dist/wje-pagination.js.map +1 -1
- package/dist/wje-popup.js +3 -3
- package/dist/wje-popup.js.map +1 -1
- package/dist/wje-progress-bar.js +53 -205
- package/dist/wje-progress-bar.js.map +1 -1
- package/dist/wje-qr-code.js +398 -2980
- package/dist/wje-qr-code.js.map +1 -1
- package/dist/wje-radio-group.js +52 -190
- package/dist/wje-radio-group.js.map +1 -1
- package/dist/wje-radio.js +24 -118
- package/dist/wje-radio.js.map +1 -1
- package/dist/wje-rate.js +62 -266
- package/dist/wje-rate.js.map +1 -1
- package/dist/wje-relative-time.js +24 -99
- package/dist/wje-relative-time.js.map +1 -1
- package/dist/wje-reorder-dropzone.js +9 -31
- package/dist/wje-reorder-dropzone.js.map +1 -1
- package/dist/wje-reorder-handle.js +67 -204
- package/dist/wje-reorder-handle.js.map +1 -1
- package/dist/wje-reorder-item.js +14 -44
- package/dist/wje-reorder-item.js.map +1 -1
- package/dist/wje-reorder.js +61 -246
- package/dist/wje-reorder.js.map +1 -1
- package/dist/wje-route.js +6 -24
- package/dist/wje-route.js.map +1 -1
- package/dist/wje-router-link.js +11 -39
- package/dist/wje-router-link.js.map +1 -1
- package/dist/wje-router-outlet.js +76 -172
- package/dist/wje-router-outlet.js.map +1 -1
- package/dist/wje-routerx.js +537 -1331
- package/dist/wje-routerx.js.map +1 -1
- package/dist/wje-row.js +9 -31
- package/dist/wje-row.js.map +1 -1
- package/dist/wje-select.js +326 -1152
- package/dist/wje-select.js.map +1 -1
- package/dist/wje-slider.js +44 -225
- package/dist/wje-slider.js.map +1 -1
- package/dist/wje-sliding-container.js +295 -1319
- package/dist/wje-sliding-container.js.map +1 -1
- package/dist/wje-split-view.js +35 -121
- package/dist/wje-split-view.js.map +1 -1
- package/dist/wje-status.js +14 -45
- package/dist/wje-status.js.map +1 -1
- package/dist/wje-step.js +9 -32
- package/dist/wje-step.js.map +1 -1
- package/dist/wje-stepper.js +109 -357
- package/dist/wje-stepper.js.map +1 -1
- package/dist/wje-store.js +67 -360
- package/dist/wje-store.js.map +1 -1
- package/dist/wje-tab-group.js +85 -314
- package/dist/wje-tab-group.js.map +1 -1
- package/dist/wje-tab-panel.js +7 -28
- package/dist/wje-tab-panel.js.map +1 -1
- package/dist/wje-tab.js +21 -198
- package/dist/wje-tab.js.map +1 -1
- package/dist/wje-textarea.js +64 -264
- package/dist/wje-textarea.js.map +1 -1
- package/dist/wje-thumbnail.js +10 -51
- package/dist/wje-thumbnail.js.map +1 -1
- package/dist/wje-toast.js +127 -632
- package/dist/wje-toast.js.map +1 -1
- package/dist/wje-toggle.js +52 -177
- package/dist/wje-toggle.js.map +1 -1
- package/dist/wje-toolbar-action.js +128 -456
- package/dist/wje-toolbar-action.js.map +1 -1
- package/dist/wje-toolbar.js +75 -270
- package/dist/wje-toolbar.js.map +1 -1
- package/dist/wje-tooltip.js +50 -161
- package/dist/wje-tooltip.js.map +1 -1
- package/dist/wje-tree-item.js +70 -301
- package/dist/wje-tree-item.js.map +1 -1
- package/dist/wje-tree.js +145 -489
- package/dist/wje-tree.js.map +1 -1
- package/dist/wje-visually-hidden.js +7 -34
- package/dist/wje-visually-hidden.js.map +1 -1
- package/package.json +3 -2
- package/dist/form-associated-element-DEQ4y-jn.js +0 -245
- package/dist/icon-CReYMzAK.js +0 -245
- package/dist/popup.element-CwXvVFK7.js +0 -2133
- package/dist/router-links-wjqCnncc.js +0 -156
package/dist/wje-element.js
CHANGED
|
@@ -9,827 +9,318 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
9
9
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
10
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
11
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
12
|
-
var
|
|
13
|
-
import { UniversalService } from "./universal-service.js";
|
|
14
|
-
import { Permissions } from "./permissions.js";
|
|
15
|
-
import { WjElementUtils } from "./element-utils.js";
|
|
12
|
+
var _e, _t, _i, _s, _n, _r_instances, r_fn, o_fn, a_fn;
|
|
13
|
+
import { UniversalService as e } from "./universal-service.js";
|
|
14
|
+
import { Permissions as t } from "./permissions.js";
|
|
15
|
+
import { WjElementUtils as i } from "./element-utils.js";
|
|
16
16
|
import { event } from "./event.js";
|
|
17
|
-
import { store, defaultStoreActions } from "./wje-store.js";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const _WJElement = class _WJElement extends HTMLElement {
|
|
21
|
-
/**
|
|
22
|
-
* Initializes a new instance of the WJElement class.
|
|
23
|
-
*/
|
|
17
|
+
import { store as s, defaultStoreActions as n } from "./wje-store.js";
|
|
18
|
+
document.createElement("template").innerHTML = "";
|
|
19
|
+
const _r = class _r extends HTMLElement {
|
|
24
20
|
constructor() {
|
|
25
21
|
super();
|
|
26
|
-
__privateAdd(this,
|
|
27
|
-
__privateAdd(this,
|
|
28
|
-
__privateAdd(this,
|
|
29
|
-
__privateAdd(this,
|
|
30
|
-
__privateAdd(this,
|
|
31
|
-
__privateAdd(this,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
this.setUpAccessors();
|
|
46
|
-
__privateSet(this, _drawingStatus, this.drawingStatuses.START);
|
|
47
|
-
const sheet = new CSSStyleSheet();
|
|
48
|
-
sheet.replaceSync(this.constructor.cssStyleSheet);
|
|
49
|
-
if (this.shadowRoot) {
|
|
50
|
-
const existing = this.shadowRoot.adoptedStyleSheets || [];
|
|
51
|
-
const next = [...existing];
|
|
52
|
-
if (!next.includes(sheet)) next.push(sheet);
|
|
53
|
-
this.shadowRoot.adoptedStyleSheets = next;
|
|
54
|
-
}
|
|
55
|
-
await this.display(force);
|
|
56
|
-
resolve();
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
if (typeof this.attachInternals === "function") {
|
|
60
|
-
this.internals = this.attachInternals();
|
|
61
|
-
}
|
|
62
|
-
__privateSet(this, _isAttached, false);
|
|
63
|
-
this.service = new UniversalService({
|
|
64
|
-
store
|
|
65
|
-
});
|
|
66
|
-
this.defineDependencies();
|
|
67
|
-
__privateSet(this, _isRendering, false);
|
|
68
|
-
this._dependencies = {};
|
|
69
|
-
this.drawingStatuses = {
|
|
70
|
-
CREATED: 0,
|
|
71
|
-
ATTACHED: 1,
|
|
72
|
-
BEGINING: 2,
|
|
73
|
-
START: 3,
|
|
74
|
-
DRAWING: 4,
|
|
75
|
-
DONE: 5,
|
|
76
|
-
DISCONNECTED: 6
|
|
77
|
-
};
|
|
78
|
-
__privateSet(this, _drawingStatus, this.drawingStatuses.CREATED);
|
|
79
|
-
__privateSet(this, _pristine, true);
|
|
80
|
-
__privateSet(this, _isRendering, false);
|
|
81
|
-
this.rafId = null;
|
|
82
|
-
__privateSet(this, _originalVisibility, null);
|
|
83
|
-
this.params = {};
|
|
84
|
-
this.updateComplete = new Promise((resolve, reject) => {
|
|
85
|
-
this.finisPromise = resolve;
|
|
86
|
-
this.rejectPromise = reject;
|
|
22
|
+
__privateAdd(this, _r_instances);
|
|
23
|
+
__privateAdd(this, _e);
|
|
24
|
+
__privateAdd(this, _t);
|
|
25
|
+
__privateAdd(this, _i);
|
|
26
|
+
__privateAdd(this, _s);
|
|
27
|
+
__privateAdd(this, _n);
|
|
28
|
+
__publicField(this, "initWjElement", (e2 = false) => new Promise(async (t2, i2) => {
|
|
29
|
+
var _a;
|
|
30
|
+
__privateSet(this, _e, this.drawingStatuses.BEGINING), (_a = this.setupAttributes) == null ? void 0 : _a.call(this), this.hasShadowRoot && (this.shadowRoot || this.attachShadow({ mode: this.shadowType || "open", delegatesFocus: true })), this.setUpAccessors(), __privateSet(this, _e, this.drawingStatuses.START);
|
|
31
|
+
const s2 = new CSSStyleSheet();
|
|
32
|
+
if (s2.replaceSync(this.constructor.cssStyleSheet), this.shadowRoot) {
|
|
33
|
+
const e3 = [...this.shadowRoot.adoptedStyleSheets || []];
|
|
34
|
+
e3.includes(s2) || e3.push(s2), this.shadowRoot.adoptedStyleSheets = e3;
|
|
35
|
+
}
|
|
36
|
+
await this.display(e2), t2();
|
|
37
|
+
}));
|
|
38
|
+
"function" == typeof this.attachInternals && (this.internals = this.attachInternals()), __privateSet(this, _t, false), this.service = new e({ store: s }), this.defineDependencies(), __privateSet(this, _i, false), this._dependencies = {}, this.drawingStatuses = { CREATED: 0, ATTACHED: 1, BEGINING: 2, START: 3, DRAWING: 4, DONE: 5, DISCONNECTED: 6 }, __privateSet(this, _e, this.drawingStatuses.CREATED), __privateSet(this, _n, true), __privateSet(this, _i, false), this.rafId = null, __privateSet(this, _s, null), this.params = {}, this.updateComplete = new Promise((e2, t2) => {
|
|
39
|
+
this.finisPromise = e2, this.rejectPromise = t2;
|
|
87
40
|
});
|
|
88
41
|
}
|
|
89
42
|
get drawingStatus() {
|
|
90
|
-
return __privateGet(this,
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
*/
|
|
96
|
-
set permission(value) {
|
|
97
|
-
this.setAttribute("permission", value.join(","));
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Gets the value of the 'permission-check' attribute.
|
|
101
|
-
* @returns {string[]} The value of the 'permission' attribute.
|
|
102
|
-
*/
|
|
43
|
+
return __privateGet(this, _e);
|
|
44
|
+
}
|
|
45
|
+
set permission(e2) {
|
|
46
|
+
this.setAttribute("permission", e2.join(","));
|
|
47
|
+
}
|
|
103
48
|
get permission() {
|
|
104
49
|
var _a;
|
|
105
50
|
return ((_a = this.getAttribute("permission")) == null ? void 0 : _a.split(",")) || [];
|
|
106
51
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
*/
|
|
111
|
-
set isPermissionCheck(value) {
|
|
112
|
-
if (value) this.setAttribute("permission-check", "");
|
|
113
|
-
else this.removeAttribute("permission-check");
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Checks if the 'permission-check' attribute is present.
|
|
117
|
-
* @returns {boolean} True if the 'permission-check' attribute is present.
|
|
118
|
-
*/
|
|
52
|
+
set isPermissionCheck(e2) {
|
|
53
|
+
e2 ? this.setAttribute("permission-check", "") : this.removeAttribute("permission-check");
|
|
54
|
+
}
|
|
119
55
|
get isPermissionCheck() {
|
|
120
56
|
return this.hasAttribute("permission-check");
|
|
121
57
|
}
|
|
122
|
-
set noShow(
|
|
123
|
-
|
|
124
|
-
else this.removeAttribute("no-show");
|
|
58
|
+
set noShow(e2) {
|
|
59
|
+
e2 ? this.setAttribute("no-show", "") : this.removeAttribute("no-show");
|
|
125
60
|
}
|
|
126
|
-
/**
|
|
127
|
-
* Checks if the 'show' attribute is present.
|
|
128
|
-
* @returns {boolean} True if the 'show' attribute is present.
|
|
129
|
-
*/
|
|
130
61
|
get noShow() {
|
|
131
62
|
return this.hasAttribute("no-show");
|
|
132
63
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
* @param {string} value The value to set for the 'shadow' attribute.
|
|
136
|
-
*/
|
|
137
|
-
set isShadowRoot(value) {
|
|
138
|
-
return this.setAttribute("shadow", value);
|
|
64
|
+
set isShadowRoot(e2) {
|
|
65
|
+
return this.setAttribute("shadow", e2);
|
|
139
66
|
}
|
|
140
67
|
get isShadowRoot() {
|
|
141
68
|
return this.getAttribute("shadow");
|
|
142
69
|
}
|
|
143
|
-
/**
|
|
144
|
-
* Checks if the 'shadow' attribute is present.
|
|
145
|
-
* @returns {boolean} True if the 'shadow' attribute is present.
|
|
146
|
-
*/
|
|
147
70
|
get hasShadowRoot() {
|
|
148
71
|
return this.hasAttribute("shadow");
|
|
149
72
|
}
|
|
150
|
-
/**
|
|
151
|
-
* Gets the value of the 'shadow' attribute or 'open' if not set.
|
|
152
|
-
* @returns {string} The value of the 'shadow' attribute or 'open'.
|
|
153
|
-
*/
|
|
154
73
|
get shadowType() {
|
|
155
74
|
return this.getAttribute("shadow") || "open";
|
|
156
75
|
}
|
|
157
|
-
/**
|
|
158
|
-
* Gets the rendering context, either the shadow root or the component itself.
|
|
159
|
-
* @returns The rendering context.
|
|
160
|
-
*/
|
|
161
76
|
get context() {
|
|
162
|
-
|
|
163
|
-
return this.shadowRoot;
|
|
164
|
-
} else {
|
|
165
|
-
return this;
|
|
166
|
-
}
|
|
77
|
+
return this.hasShadowRoot ? this.shadowRoot : this;
|
|
167
78
|
}
|
|
168
|
-
/**
|
|
169
|
-
* Gets the store instance.
|
|
170
|
-
* @returns {object} The store instance.
|
|
171
|
-
*/
|
|
172
79
|
get store() {
|
|
173
|
-
return
|
|
80
|
+
return s;
|
|
174
81
|
}
|
|
175
|
-
/**
|
|
176
|
-
* Returns ElementInternals when available.
|
|
177
|
-
* @returns {ElementInternals|null}
|
|
178
|
-
*/
|
|
179
82
|
getInternals() {
|
|
180
83
|
return this.internals || null;
|
|
181
84
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
Object.entries(state).forEach(([key, value]) => {
|
|
191
|
-
if (value === void 0 || value === null) return;
|
|
192
|
-
if (key === "role") {
|
|
193
|
-
this.setAttribute("role", value);
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
let attr;
|
|
197
|
-
if (key === "labelledBy") attr = "aria-labelledby";
|
|
198
|
-
else if (key === "describedBy") attr = "aria-describedby";
|
|
199
|
-
else attr = `aria-${key.replace(/([A-Z])/g, "-$1").toLowerCase()}`;
|
|
200
|
-
const normalized = typeof value === "boolean" ? value ? "true" : "false" : value;
|
|
201
|
-
this.setAttribute(attr, normalized);
|
|
85
|
+
setAriaState(e2 = {}) {
|
|
86
|
+
e2 && "object" == typeof e2 && Object.entries(e2).forEach(([e3, t2]) => {
|
|
87
|
+
if (null == t2) return;
|
|
88
|
+
if ("role" === e3) return void this.setAttribute("role", t2);
|
|
89
|
+
let i2;
|
|
90
|
+
i2 = "labelledBy" === e3 ? "aria-labelledby" : "describedBy" === e3 ? "aria-describedby" : `aria-${e3.replace(/([A-Z])/g, "-$1").toLowerCase()}`;
|
|
91
|
+
const s2 = "boolean" == typeof t2 ? t2 ? "true" : "false" : t2;
|
|
92
|
+
this.setAttribute(i2, s2);
|
|
202
93
|
});
|
|
203
94
|
}
|
|
204
|
-
/**
|
|
205
|
-
* @typedef {object} ArrayActions
|
|
206
|
-
* @property {Function} addAction - Adds an item to the array.
|
|
207
|
-
* @property {Function} deleteAction - Deletes an item from the array.
|
|
208
|
-
* @property {Function} loadAction - Loads an array.
|
|
209
|
-
* @property {Function} updateAction - Updates an item in the array.
|
|
210
|
-
* @property {Function} addManyAction - Adds many items to the array.
|
|
211
|
-
*/
|
|
212
|
-
/**
|
|
213
|
-
* @typedef {object} ObjectActions
|
|
214
|
-
* @property {Function} addAction - Replace old object with new object
|
|
215
|
-
* @property {Function} deleteAction - Delete item based on key
|
|
216
|
-
* @property {Function} updateAction - Update item based on key
|
|
217
|
-
*/
|
|
218
|
-
/**
|
|
219
|
-
* Gets the default store actions.
|
|
220
|
-
* @returns The default store actions for arrays and objects.
|
|
221
|
-
*/
|
|
222
95
|
get defaultStoreActions() {
|
|
223
|
-
return
|
|
96
|
+
return n;
|
|
224
97
|
}
|
|
225
|
-
/**
|
|
226
|
-
* Gets the classes to be removed after the component is connected.
|
|
227
|
-
* @returns An array of class names to remove.
|
|
228
|
-
*/
|
|
229
98
|
get removeClassAfterConnect() {
|
|
230
99
|
var _a;
|
|
231
100
|
return (_a = this.getAttribute("remove-class-after-connect")) == null ? void 0 : _a.split(" ");
|
|
232
101
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
*/
|
|
237
|
-
set dependencies(value) {
|
|
238
|
-
this._dependencies = value;
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Gets the component dependencies.
|
|
242
|
-
* @returns The component dependencies.
|
|
243
|
-
*/
|
|
102
|
+
set dependencies(e2) {
|
|
103
|
+
this._dependencies = e2;
|
|
104
|
+
}
|
|
244
105
|
get dependencies() {
|
|
245
106
|
return this._dependencies;
|
|
246
107
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
* @param name The name of the custom element.
|
|
250
|
-
* @param [elementConstructor] The constructor for the custom element.
|
|
251
|
-
* @param [options] Additional options for defining the element.
|
|
252
|
-
*/
|
|
253
|
-
static define(name, elementConstructor = this, options = {}) {
|
|
254
|
-
const definedElement = customElements.get(name);
|
|
255
|
-
if (!definedElement) {
|
|
256
|
-
customElements.define(name, elementConstructor, options);
|
|
257
|
-
}
|
|
108
|
+
static define(e2, t2 = this, i2 = {}) {
|
|
109
|
+
customElements.get(e2) || customElements.define(e2, t2, i2);
|
|
258
110
|
}
|
|
259
|
-
/**
|
|
260
|
-
* Defines component dependencies by registering custom elements.
|
|
261
|
-
*/
|
|
262
111
|
defineDependencies() {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
112
|
+
this.dependencies && Object.entries(this.dependencies).forEach(([e2, t2]) => _r.define(e2, t2));
|
|
113
|
+
}
|
|
114
|
+
beforeDraw(e2, t2, i2) {
|
|
266
115
|
}
|
|
267
|
-
|
|
268
|
-
* Hook for extending behavior before drawing the component.
|
|
269
|
-
* @param context The rendering context, usually the element's shadow root or main DOM element.
|
|
270
|
-
* @param appStoreObj The global application store for managing state.
|
|
271
|
-
* @param params Additional parameters or attributes for rendering the component.
|
|
272
|
-
*/
|
|
273
|
-
beforeDraw(context, appStoreObj, params) {
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Renders the component within the provided context.
|
|
277
|
-
* @param context The rendering context, usually the element's shadow root or main DOM element.
|
|
278
|
-
* @param appStoreObj
|
|
279
|
-
* @param params Additional parameters or attributes for rendering the component.
|
|
280
|
-
* @returns This implementation does not render anything and returns `null`.
|
|
281
|
-
* @description
|
|
282
|
-
* The `draw` method is responsible for rendering the component's content.
|
|
283
|
-
* Override this method in subclasses to define custom rendering logic.
|
|
284
|
-
* @example
|
|
285
|
-
* class MyComponent extends WJElement {
|
|
286
|
-
* draw(context, appStoreObj, params) {
|
|
287
|
-
* const div = document.createElement('div');
|
|
288
|
-
* div.textContent = 'Hello, world!';
|
|
289
|
-
* context.appendChild(div);
|
|
290
|
-
* }
|
|
291
|
-
* }
|
|
292
|
-
*/
|
|
293
|
-
draw(context, appStoreObj, params) {
|
|
116
|
+
draw(e2, t2, i2) {
|
|
294
117
|
return null;
|
|
295
118
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
* @param appStoreObj The global application store for managing state.
|
|
300
|
-
* @param params Additional parameters or attributes for rendering the component.
|
|
301
|
-
*/
|
|
302
|
-
afterDraw(context, appStoreObj, params) {
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Optional hook: return skeleton markup used while async draw is in progress.
|
|
306
|
-
* Prefer declarative skeleton via `<div slot="skeleton">...</div>`.
|
|
307
|
-
* Return: string | Node | DocumentFragment | null | Promise of those.
|
|
308
|
-
*/
|
|
309
|
-
renderSkeleton(params) {
|
|
119
|
+
afterDraw(e2, t2, i2) {
|
|
120
|
+
}
|
|
121
|
+
renderSkeleton(e2) {
|
|
310
122
|
return null;
|
|
311
123
|
}
|
|
312
|
-
/**
|
|
313
|
-
* Retrieves the delay duration for the skeleton display, determining the value based on a hierarchy of overrides and defaults.
|
|
314
|
-
* The method prioritizes in the following order:
|
|
315
|
-
* 1. A finite number set as the `_wjSkeletonDelayOverride` property.
|
|
316
|
-
* 2. A valid numeric value from the `skeleton-delay` attribute.
|
|
317
|
-
* 3. The `skeletonDelayMs` property, if defined with a finite number.
|
|
318
|
-
* 4. A default value of 150 if none of the above are set.
|
|
319
|
-
* @returns {number} The delay in milliseconds before the skeleton is displayed.
|
|
320
|
-
*/
|
|
321
124
|
get skeletonDelay() {
|
|
322
125
|
if (Number.isFinite(this._wjSkeletonDelayOverride)) return this._wjSkeletonDelayOverride;
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
if (Number.isFinite(this.skeletonDelayMs)) return this.skeletonDelayMs;
|
|
327
|
-
return 150;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Retrieves the minimum duration for the skeleton animation.
|
|
331
|
-
* The method checks for an internally stored finite value. If unavailable,
|
|
332
|
-
* it retrieves the value from the 'skeleton-min-duration' attribute,
|
|
333
|
-
* converts it to a number if possible, and uses it. If neither is valid,
|
|
334
|
-
* a default duration of 300 is returned.
|
|
335
|
-
* @returns {number} The minimum duration for the skeleton animation in milliseconds.
|
|
336
|
-
*/
|
|
126
|
+
const e2 = this.getAttribute("skeleton-delay"), t2 = null == e2 ? NaN : Number(e2);
|
|
127
|
+
return Number.isFinite(t2) ? t2 : Number.isFinite(this.skeletonDelayMs) ? this.skeletonDelayMs : 150;
|
|
128
|
+
}
|
|
337
129
|
get skeletonMinDuration() {
|
|
338
130
|
if (Number.isFinite(this._wjSkeletonMinDurationOverride)) return this._wjSkeletonMinDurationOverride;
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
set skeletonMinDuration(value) {
|
|
350
|
-
if (value === null || value === void 0 || value === "") {
|
|
351
|
-
delete this._wjSkeletonMinDurationOverride;
|
|
352
|
-
this.removeAttribute("skeleton-min-duration");
|
|
353
|
-
return;
|
|
354
|
-
}
|
|
355
|
-
const n = Number(value);
|
|
356
|
-
if (Number.isFinite(n)) {
|
|
357
|
-
this._wjSkeletonMinDurationOverride = n;
|
|
358
|
-
this.setAttribute("skeleton-min-duration", String(n));
|
|
359
|
-
}
|
|
131
|
+
const e2 = this.getAttribute("skeleton-min-duration"), t2 = null == e2 ? NaN : Number(e2);
|
|
132
|
+
return Number.isFinite(t2) ? t2 : 300;
|
|
133
|
+
}
|
|
134
|
+
set skeletonMinDuration(e2) {
|
|
135
|
+
if (null == e2 || "" === e2) return delete this._wjSkeletonMinDurationOverride, void this.removeAttribute("skeleton-min-duration");
|
|
136
|
+
const t2 = Number(e2);
|
|
137
|
+
Number.isFinite(t2) && (this._wjSkeletonMinDurationOverride = t2, this.setAttribute("skeleton-min-duration", String(t2)));
|
|
138
|
+
}
|
|
139
|
+
set skeleton(e2) {
|
|
140
|
+
e2 ? this.setAttribute("skeleton", "") : this.removeAttribute("skeleton");
|
|
360
141
|
}
|
|
361
|
-
/**
|
|
362
|
-
* Sets or removes the 'skeleton' attribute based on the provided value.
|
|
363
|
-
* @param {boolean} value A boolean value indicating whether to set ('true') or remove ('false') the 'skeleton' attribute.
|
|
364
|
-
*/
|
|
365
|
-
set skeleton(value) {
|
|
366
|
-
if (value) this.setAttribute("skeleton", "");
|
|
367
|
-
else this.removeAttribute("skeleton");
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Checks if the 'skeleton' attribute is present on the element.
|
|
371
|
-
* @returns {boolean} True if the 'skeleton' attribute exists, false otherwise.
|
|
372
|
-
*/
|
|
373
142
|
get skeleton() {
|
|
374
143
|
return this.hasAttribute("skeleton");
|
|
375
144
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
* If null or undefined is provided, the skeleton delay will be cleared.
|
|
381
|
-
*/
|
|
382
|
-
set skeletonDelay(value) {
|
|
383
|
-
if (value === null || value === void 0 || value === "") {
|
|
384
|
-
delete this._wjSkeletonDelayOverride;
|
|
385
|
-
this.removeAttribute("skeleton-delay");
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
const n = Number(value);
|
|
389
|
-
if (Number.isFinite(n)) {
|
|
390
|
-
this._wjSkeletonDelayOverride = n;
|
|
391
|
-
this.setAttribute("skeleton-delay", String(n));
|
|
392
|
-
}
|
|
145
|
+
set skeletonDelay(e2) {
|
|
146
|
+
if (null == e2 || "" === e2) return delete this._wjSkeletonDelayOverride, void this.removeAttribute("skeleton-delay");
|
|
147
|
+
const t2 = Number(e2);
|
|
148
|
+
Number.isFinite(t2) && (this._wjSkeletonDelayOverride = t2, this.setAttribute("skeleton-delay", String(t2)));
|
|
393
149
|
}
|
|
394
|
-
/**
|
|
395
|
-
* Retrieves the delay value used for skeleton loading.
|
|
396
|
-
* @returns {number} The delay value for the skeleton loader.
|
|
397
|
-
*/
|
|
398
150
|
get skeletonDelayValue() {
|
|
399
151
|
return this.skeletonDelay;
|
|
400
152
|
}
|
|
401
|
-
/**
|
|
402
|
-
* Lifecycle method invoked when the component is connected to the DOM.
|
|
403
|
-
*/
|
|
404
153
|
connectedCallback() {
|
|
405
154
|
var _a;
|
|
406
|
-
|
|
407
|
-
__privateSet(this, _originalVisibility, __privateGet(this, _originalVisibility) ?? this.style.visibility);
|
|
408
|
-
this.style.visibility = "hidden";
|
|
409
|
-
(_a = this.setupAttributes) == null ? void 0 : _a.call(this);
|
|
410
|
-
this.setUpAccessors();
|
|
411
|
-
__privateSet(this, _drawingStatus, this.drawingStatuses.ATTACHED);
|
|
412
|
-
__privateSet(this, _pristine, false);
|
|
413
|
-
__privateMethod(this, _WJElement_instances, enqueueUpdate_fn).call(this);
|
|
414
|
-
}
|
|
155
|
+
__privateGet(this, _i) || (__privateSet(this, _s, __privateGet(this, _s) ?? this.style.visibility), this.style.visibility = "hidden", (_a = this.setupAttributes) == null ? void 0 : _a.call(this), this.setUpAccessors(), __privateSet(this, _e, this.drawingStatuses.ATTACHED), __privateSet(this, _n, false), __privateMethod(this, _r_instances, r_fn).call(this));
|
|
415
156
|
}
|
|
416
|
-
/**
|
|
417
|
-
* Sets up attributes and event listeners for the component.
|
|
418
|
-
* This method retrieves all custom events defined for the component
|
|
419
|
-
* and adds event listeners for each of them. When an event is triggered,
|
|
420
|
-
* it calls the corresponding method on the host element.
|
|
421
|
-
*/
|
|
422
157
|
setupAttributes() {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
this.addEventListener(domEvent, (e) => {
|
|
158
|
+
i.getEvents(this).forEach((e2, t2) => {
|
|
159
|
+
this.addEventListener(t2, (t3) => {
|
|
426
160
|
var _a, _b;
|
|
427
|
-
(_b = (_a = this.getRootNode().host)[
|
|
161
|
+
(_b = (_a = this.getRootNode().host)[e2]) == null ? void 0 : _b.call(_a);
|
|
428
162
|
});
|
|
429
163
|
});
|
|
430
164
|
}
|
|
431
|
-
/**
|
|
432
|
-
* Hook for extending behavior before disconnecting the component.
|
|
433
|
-
*/
|
|
434
165
|
beforeDisconnect() {
|
|
435
166
|
}
|
|
436
|
-
/**
|
|
437
|
-
* Hook for extending behavior after disconnecting the component.
|
|
438
|
-
*/
|
|
439
167
|
afterDisconnect() {
|
|
440
168
|
}
|
|
441
|
-
/**
|
|
442
|
-
* Hook for extending behavior before redrawing the component.
|
|
443
|
-
*/
|
|
444
169
|
beforeRedraw() {
|
|
445
170
|
}
|
|
446
|
-
/**
|
|
447
|
-
* Cleans up resources and event listeners for the component.
|
|
448
|
-
*/
|
|
449
171
|
componentCleanup() {
|
|
450
172
|
}
|
|
451
|
-
/**
|
|
452
|
-
* Lifecycle method invoked when the component is disconnected from the DOM.
|
|
453
|
-
*/
|
|
454
173
|
disconnectedCallback() {
|
|
455
174
|
var _a, _b;
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
__privateSet(this, _isAttached, false);
|
|
461
|
-
this.style.visibility = __privateGet(this, _originalVisibility);
|
|
462
|
-
__privateSet(this, _originalVisibility, null);
|
|
463
|
-
}
|
|
464
|
-
if (__privateGet(this, _isRendering)) {
|
|
465
|
-
this.stopRenderLoop();
|
|
466
|
-
}
|
|
467
|
-
__privateSet(this, _drawingStatus, this.drawingStatuses.DISCONNECTED);
|
|
468
|
-
this.componentCleanup();
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* Lifecycle method invoked when an observed attribute changes.
|
|
472
|
-
* @param name The name of the attribute that changed.
|
|
473
|
-
* @param old The old value of the attribute.
|
|
474
|
-
* @param newName The new value of the attribute.
|
|
475
|
-
*/
|
|
476
|
-
attributeChangedCallback(name, old, newName) {
|
|
477
|
-
if (old !== newName) {
|
|
478
|
-
__privateSet(this, _pristine, false);
|
|
479
|
-
__privateMethod(this, _WJElement_instances, enqueueUpdate_fn).call(this);
|
|
480
|
-
}
|
|
175
|
+
__privateGet(this, _t) && ((_a = this.beforeDisconnect) == null ? void 0 : _a.call(this), this.context.innerHTML = "", (_b = this.afterDisconnect) == null ? void 0 : _b.call(this), __privateSet(this, _t, false), this.style.visibility = __privateGet(this, _s), __privateSet(this, _s, null)), __privateGet(this, _i) && this.stopRenderLoop(), __privateSet(this, _e, this.drawingStatuses.DISCONNECTED), this.componentCleanup();
|
|
176
|
+
}
|
|
177
|
+
attributeChangedCallback(e2, t2, i2) {
|
|
178
|
+
t2 !== i2 && (__privateSet(this, _n, false), __privateMethod(this, _r_instances, r_fn).call(this));
|
|
481
179
|
}
|
|
482
|
-
/**
|
|
483
|
-
* Triggers a refresh operation by initializing the update lifecycle and setting up promises
|
|
484
|
-
* to track its completion or failure status. Marks the instance as not pristine and queues
|
|
485
|
-
* an update.
|
|
486
|
-
* @returns {void} Does not return a value.
|
|
487
|
-
*/
|
|
488
180
|
refresh() {
|
|
489
|
-
this.updateComplete = new Promise((
|
|
490
|
-
this.finisPromise =
|
|
491
|
-
|
|
492
|
-
});
|
|
493
|
-
__privateSet(this, _pristine, false);
|
|
494
|
-
__privateMethod(this, _WJElement_instances, enqueueUpdate_fn).call(this);
|
|
181
|
+
this.updateComplete = new Promise((e2, t2) => {
|
|
182
|
+
this.finisPromise = e2, this.rejectPromise = t2;
|
|
183
|
+
}), __privateSet(this, _n, false), __privateMethod(this, _r_instances, r_fn).call(this);
|
|
495
184
|
}
|
|
496
|
-
/**
|
|
497
|
-
* Stops the current render loop if it is running by canceling the requestAnimationFrame.
|
|
498
|
-
* @returns {void} This method does not return a value.
|
|
499
|
-
*/
|
|
500
185
|
stopRenderLoop() {
|
|
501
|
-
|
|
502
|
-
cancelAnimationFrame(this.rafId);
|
|
503
|
-
this.rafId = null;
|
|
504
|
-
}
|
|
186
|
+
this.rafId && (cancelAnimationFrame(this.rafId), this.rafId = null);
|
|
505
187
|
}
|
|
506
|
-
|
|
507
|
-
* Displays the component's content, optionally forcing a re-render.
|
|
508
|
-
* @param [force] Whether to force a re-render.
|
|
509
|
-
* @returns A promise that resolves when the display is complete.
|
|
510
|
-
*/
|
|
511
|
-
display(force = false) {
|
|
188
|
+
display(e2 = false) {
|
|
512
189
|
this.template = this.constructor.customTemplate || document.createElement("template");
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
}
|
|
519
|
-
let skeletonTimer = null;
|
|
520
|
-
let renderFinished = false;
|
|
521
|
-
let skeletonShownAt = null;
|
|
522
|
-
const clearSkeletonTimer = () => {
|
|
523
|
-
if (skeletonTimer) {
|
|
524
|
-
clearTimeout(skeletonTimer);
|
|
525
|
-
skeletonTimer = null;
|
|
526
|
-
}
|
|
527
|
-
};
|
|
528
|
-
const buildSkeletonFragment = async () => {
|
|
190
|
+
const s2 = document.createDocumentFragment();
|
|
191
|
+
if (s2.append(this.template.content.cloneNode(true)), this.noShow || this.isPermissionCheck && !t.isPermissionFulfilled(this.permission)) return this.remove(), Promise.resolve();
|
|
192
|
+
let n2 = null, r2 = false, o2 = null;
|
|
193
|
+
const a = () => {
|
|
194
|
+
n2 && (clearTimeout(n2), n2 = null);
|
|
195
|
+
}, h = async () => {
|
|
529
196
|
var _a, _b;
|
|
530
|
-
const
|
|
531
|
-
if (
|
|
197
|
+
const e3 = this.querySelector('[slot="skeleton"]');
|
|
198
|
+
if (e3) {
|
|
532
199
|
if (this.hasShadowRoot) {
|
|
533
|
-
const
|
|
534
|
-
|
|
535
|
-
slot.name = "skeleton";
|
|
536
|
-
frag3.append(slot);
|
|
537
|
-
return frag3;
|
|
200
|
+
const e4 = document.createDocumentFragment(), t4 = document.createElement("slot");
|
|
201
|
+
return t4.name = "skeleton", e4.append(t4), e4;
|
|
538
202
|
}
|
|
539
|
-
const
|
|
540
|
-
|
|
541
|
-
return frag2;
|
|
203
|
+
const t3 = document.createDocumentFragment();
|
|
204
|
+
return t3.append(e3.cloneNode(true)), t3;
|
|
542
205
|
}
|
|
543
|
-
const
|
|
544
|
-
let
|
|
545
|
-
if (
|
|
546
|
-
|
|
206
|
+
const t2 = document.createDocumentFragment();
|
|
207
|
+
let s3, n3 = (_a = this.renderSkeleton) == null ? void 0 : _a.call(this, i.getAttributes(this));
|
|
208
|
+
if ((n3 instanceof Promise || "Promise" === ((_b = n3 == null ? void 0 : n3.constructor) == null ? void 0 : _b.name)) && (n3 = await n3), null == n3) return null;
|
|
209
|
+
if (n3 instanceof HTMLElement || n3 instanceof DocumentFragment) s3 = n3;
|
|
210
|
+
else {
|
|
211
|
+
const e4 = document.createElement("template");
|
|
212
|
+
e4.innerHTML = n3, s3 = e4.content.cloneNode(true);
|
|
547
213
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
if (
|
|
551
|
-
node = skel;
|
|
552
|
-
} else {
|
|
553
|
-
const t = document.createElement("template");
|
|
554
|
-
t.innerHTML = skel;
|
|
555
|
-
node = t.content.cloneNode(true);
|
|
556
|
-
}
|
|
557
|
-
frag.append(node);
|
|
558
|
-
return frag;
|
|
559
|
-
};
|
|
560
|
-
const showSkeleton = async () => {
|
|
561
|
-
if (renderFinished) return;
|
|
214
|
+
return t2.append(s3), t2;
|
|
215
|
+
}, l = async () => {
|
|
216
|
+
if (r2) return;
|
|
562
217
|
if (!this.hasAttribute("skeleton")) return;
|
|
563
|
-
const
|
|
564
|
-
if (
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
if (this.hasShadowRoot) {
|
|
572
|
-
this.shadowRoot.replaceChildren(frag);
|
|
573
|
-
} else {
|
|
574
|
-
this.replaceChildren(frag);
|
|
575
|
-
}
|
|
576
|
-
skeletonShownAt = performance.now();
|
|
577
|
-
this.dispatchEvent(new CustomEvent("wj-skeleton:show", {
|
|
578
|
-
detail: { delay: this.skeletonDelay },
|
|
579
|
-
bubbles: true,
|
|
580
|
-
composed: true
|
|
581
|
-
}));
|
|
582
|
-
if (this.hasAttribute("debug-skeleton")) {
|
|
583
|
-
debugger;
|
|
218
|
+
const e3 = await h();
|
|
219
|
+
if (e3) {
|
|
220
|
+
try {
|
|
221
|
+
const e4 = getComputedStyle(this);
|
|
222
|
+
"inline" === e4.display && (this.style.display = "block"), "0px" === e4.width && (this.style.width = "100%");
|
|
223
|
+
} catch (e4) {
|
|
224
|
+
}
|
|
225
|
+
this.hasShadowRoot ? this.shadowRoot.replaceChildren(e3) : this.replaceChildren(e3), o2 = performance.now(), this.dispatchEvent(new CustomEvent("wj-skeleton:show", { detail: { delay: this.skeletonDelay }, bubbles: true, composed: true })), this.hasAttribute("debug-skeleton");
|
|
584
226
|
}
|
|
585
227
|
};
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
if (this.hasAttribute("skeleton")) {
|
|
591
|
-
skeletonPlannedAt = performance.now();
|
|
592
|
-
skeletonTimer = setTimeout(() => {
|
|
593
|
-
showSkeleton();
|
|
594
|
-
}, this.skeletonDelay);
|
|
595
|
-
}
|
|
596
|
-
return __privateMethod(this, _WJElement_instances, resolveRender_fn).call(this, nextContext, { skipAfterDraw: true }).then(async () => {
|
|
228
|
+
let c;
|
|
229
|
+
return this.hasAttribute("skeleton") && "hidden" === this.style.visibility && (this.style.visibility = __privateGet(this, _s) ?? "visible"), this.hasAttribute("skeleton") && (c = performance.now(), n2 = setTimeout(() => {
|
|
230
|
+
l();
|
|
231
|
+
}, this.skeletonDelay)), __privateMethod(this, _r_instances, a_fn).call(this, s2, { skipAfterDraw: true }).then(async () => {
|
|
597
232
|
var _a;
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
const elapsed = skeletonPlannedAt ? performance.now() - skeletonPlannedAt : 0;
|
|
602
|
-
this.dispatchEvent(new CustomEvent("wj-skeleton:skip", {
|
|
603
|
-
detail: { reason: "render-finished-fast", elapsedMs: elapsed, delay: this.skeletonDelay },
|
|
604
|
-
bubbles: true,
|
|
605
|
-
composed: true
|
|
606
|
-
}));
|
|
233
|
+
if (r2 = true, a(), null === o2) {
|
|
234
|
+
const e4 = c ? performance.now() - c : 0;
|
|
235
|
+
this.dispatchEvent(new CustomEvent("wj-skeleton:skip", { detail: { reason: "render-finished-fast", elapsedMs: e4, delay: this.skeletonDelay }, bubbles: true, composed: true }));
|
|
607
236
|
} else {
|
|
608
|
-
const
|
|
609
|
-
|
|
610
|
-
const remaining = this.skeletonMinDuration - visibleFor;
|
|
611
|
-
if (remaining > 0) {
|
|
612
|
-
await new Promise((r) => setTimeout(r, remaining));
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
if (this.hasShadowRoot) {
|
|
616
|
-
this.shadowRoot.replaceChildren(nextContext);
|
|
617
|
-
} else {
|
|
618
|
-
this.replaceChildren(nextContext);
|
|
619
|
-
}
|
|
620
|
-
if (skeletonShownAt !== null) {
|
|
621
|
-
this.dispatchEvent(new CustomEvent("wj-skeleton:hide", {
|
|
622
|
-
detail: {
|
|
623
|
-
reason: "render-finished",
|
|
624
|
-
visibleMs: Math.max(this.skeletonMinDuration, performance.now() - skeletonShownAt),
|
|
625
|
-
delay: this.skeletonDelay,
|
|
626
|
-
minDuration: this.skeletonMinDuration
|
|
627
|
-
},
|
|
628
|
-
bubbles: true,
|
|
629
|
-
composed: true
|
|
630
|
-
}));
|
|
631
|
-
}
|
|
632
|
-
const liveContext = this.hasShadowRoot ? this.shadowRoot : this;
|
|
633
|
-
const _afterDraw = (_a = this.afterDraw) == null ? void 0 : _a.call(this, liveContext, this.store, WjElementUtils.getAttributes(this));
|
|
634
|
-
if (_afterDraw instanceof Promise || (_afterDraw == null ? void 0 : _afterDraw.constructor.name) === "Promise") {
|
|
635
|
-
await _afterDraw;
|
|
237
|
+
const e4 = performance.now() - o2, t3 = this.skeletonMinDuration - e4;
|
|
238
|
+
t3 > 0 && await new Promise((e5) => setTimeout(e5, t3));
|
|
636
239
|
}
|
|
240
|
+
this.hasShadowRoot ? this.shadowRoot.replaceChildren(s2) : this.replaceChildren(s2), null !== o2 && this.dispatchEvent(new CustomEvent("wj-skeleton:hide", { detail: { reason: "render-finished", visibleMs: Math.max(this.skeletonMinDuration, performance.now() - o2), delay: this.skeletonDelay, minDuration: this.skeletonMinDuration }, bubbles: true, composed: true }));
|
|
241
|
+
const e3 = this.hasShadowRoot ? this.shadowRoot : this, t2 = (_a = this.afterDraw) == null ? void 0 : _a.call(this, e3, this.store, i.getAttributes(this));
|
|
242
|
+
(t2 instanceof Promise || "Promise" === (t2 == null ? void 0 : t2.constructor.name)) && await t2;
|
|
637
243
|
}).finally(() => {
|
|
638
|
-
|
|
639
|
-
clearSkeletonTimer();
|
|
640
|
-
if (!__privateGet(this, _isRendering)) {
|
|
641
|
-
this.dispatchEvent(new CustomEvent("wj-skeleton:hide", {
|
|
642
|
-
detail: { reason: "finally" },
|
|
643
|
-
bubbles: true,
|
|
644
|
-
composed: true
|
|
645
|
-
}));
|
|
646
|
-
}
|
|
244
|
+
r2 = true, a(), __privateGet(this, _i) || this.dispatchEvent(new CustomEvent("wj-skeleton:hide", { detail: { reason: "finally" }, bubbles: true, composed: true }));
|
|
647
245
|
});
|
|
648
246
|
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
let _draw = this.draw(targetContext, this.store, WjElementUtils.getAttributes(this));
|
|
659
|
-
if (_draw instanceof Promise || (_draw == null ? void 0 : _draw.constructor.name) === "Promise") {
|
|
660
|
-
_draw = await _draw;
|
|
661
|
-
}
|
|
662
|
-
let rend = _draw;
|
|
663
|
-
let element;
|
|
664
|
-
if (rend instanceof HTMLElement || rend instanceof DocumentFragment) {
|
|
665
|
-
element = rend;
|
|
666
|
-
} else {
|
|
667
|
-
let inputTemplate = document.createElement("template");
|
|
668
|
-
inputTemplate.innerHTML = rend;
|
|
669
|
-
element = inputTemplate.content.cloneNode(true);
|
|
670
|
-
}
|
|
671
|
-
let rendered = element;
|
|
672
|
-
targetContext.appendChild(rendered);
|
|
673
|
-
}
|
|
674
|
-
/**
|
|
675
|
-
* Sanitizes a given name by converting it from kebab-case to camelCase.
|
|
676
|
-
* @param {string} name The name in kebab-case format (e.g., "example-name").
|
|
677
|
-
* @returns {string} The sanitized name in camelCase format (e.g., "exampleName").
|
|
678
|
-
* @example
|
|
679
|
-
* sanitizeName('example-name');
|
|
680
|
-
* @example
|
|
681
|
-
* sanitizeName('my-custom-component');
|
|
682
|
-
*/
|
|
683
|
-
sanitizeName(name) {
|
|
684
|
-
let parts = name.split("-");
|
|
685
|
-
return [parts.shift(), ...parts.map((n) => n[0].toUpperCase() + n.slice(1))].join("");
|
|
686
|
-
}
|
|
687
|
-
/**
|
|
688
|
-
* Checks if a property on an object has a getter or setter method defined.
|
|
689
|
-
* @param {object} obj The object on which the property is defined.
|
|
690
|
-
* @param {string} property The name of the property to check.
|
|
691
|
-
* @returns {object} An object indicating the presence of getter and setter methods.
|
|
692
|
-
* @property {Function|null} hasGetter The getter function if it exists, otherwise `null`.
|
|
693
|
-
* @property {Function|null} hasSetter The setter function if it exists, otherwise `null`.
|
|
694
|
-
* @example
|
|
695
|
-
* const obj = {
|
|
696
|
-
* get name() { return 'value'; },
|
|
697
|
-
* set name(val) { console.log(val); }
|
|
698
|
-
* };
|
|
699
|
-
* checkGetterSetter(obj, 'name');
|
|
700
|
-
* @example
|
|
701
|
-
* const obj = { prop: 42 };
|
|
702
|
-
* checkGetterSetter(obj, 'prop');
|
|
703
|
-
*/
|
|
704
|
-
checkGetterSetter(obj, property) {
|
|
705
|
-
let descriptor = Object.getOwnPropertyDescriptor(obj, property);
|
|
706
|
-
if (descriptor) {
|
|
707
|
-
return {
|
|
708
|
-
hasGetter: typeof descriptor.get === "function" ? descriptor.get : null,
|
|
709
|
-
hasSetter: typeof descriptor.set === "function" ? descriptor.set : null
|
|
710
|
-
};
|
|
247
|
+
async render(e2 = this.context) {
|
|
248
|
+
__privateSet(this, _e, this.drawingStatuses.DRAWING);
|
|
249
|
+
let t2 = this.draw(e2, this.store, i.getAttributes(this));
|
|
250
|
+
(t2 instanceof Promise || "Promise" === (t2 == null ? void 0 : t2.constructor.name)) && (t2 = await t2);
|
|
251
|
+
let s2, n2 = t2;
|
|
252
|
+
if (n2 instanceof HTMLElement || n2 instanceof DocumentFragment) s2 = n2;
|
|
253
|
+
else {
|
|
254
|
+
let e3 = document.createElement("template");
|
|
255
|
+
e3.innerHTML = n2, s2 = e3.content.cloneNode(true);
|
|
711
256
|
}
|
|
712
|
-
let
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
257
|
+
let r2 = s2;
|
|
258
|
+
e2.appendChild(r2);
|
|
259
|
+
}
|
|
260
|
+
sanitizeName(e2) {
|
|
261
|
+
let t2 = e2.split("-");
|
|
262
|
+
return [t2.shift(), ...t2.map((e3) => e3[0].toUpperCase() + e3.slice(1))].join("");
|
|
263
|
+
}
|
|
264
|
+
checkGetterSetter(e2, t2) {
|
|
265
|
+
let i2 = Object.getOwnPropertyDescriptor(e2, t2);
|
|
266
|
+
if (i2) return { hasGetter: "function" == typeof i2.get ? i2.get : null, hasSetter: "function" == typeof i2.set ? i2.set : null };
|
|
267
|
+
let s2 = Object.getPrototypeOf(e2);
|
|
268
|
+
return s2 ? this.checkGetterSetter(s2, t2) : { hasGetter: null, hasSetter: null };
|
|
269
|
+
}
|
|
724
270
|
setUpAccessors() {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
const { hasGetter, hasSetter } = this.checkGetterSetter(this, sanitizedName);
|
|
729
|
-
Object.defineProperty(this, sanitizedName, {
|
|
730
|
-
set: hasSetter ?? ((value) => this.setAttribute(name, value)),
|
|
731
|
-
get: hasGetter ?? (() => this.getAttribute(name))
|
|
732
|
-
});
|
|
271
|
+
this.getAttributeNames().forEach((e2) => {
|
|
272
|
+
const t2 = this.sanitizeName(e2), { hasGetter: i2, hasSetter: s2 } = this.checkGetterSetter(this, t2);
|
|
273
|
+
Object.defineProperty(this, t2, { set: s2 ?? ((t3) => this.setAttribute(e2, t3)), get: i2 ?? (() => this.getAttribute(e2)) });
|
|
733
274
|
});
|
|
734
275
|
}
|
|
735
276
|
};
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
* This method processes the current render promise and then refreshes the component.
|
|
745
|
-
*/
|
|
746
|
-
enqueueUpdate_fn = function() {
|
|
747
|
-
if (!__privateGet(this, _isRendering)) {
|
|
748
|
-
this.rafId = requestAnimationFrame(() => __privateMethod(this, _WJElement_instances, refresh_fn).call(this));
|
|
749
|
-
}
|
|
277
|
+
_e = new WeakMap();
|
|
278
|
+
_t = new WeakMap();
|
|
279
|
+
_i = new WeakMap();
|
|
280
|
+
_s = new WeakMap();
|
|
281
|
+
_n = new WeakMap();
|
|
282
|
+
_r_instances = new WeakSet();
|
|
283
|
+
r_fn = function() {
|
|
284
|
+
__privateGet(this, _i) || (this.rafId = requestAnimationFrame(() => __privateMethod(this, _r_instances, o_fn).call(this)));
|
|
750
285
|
};
|
|
751
|
-
|
|
286
|
+
o_fn = async function() {
|
|
752
287
|
var _a, _b, _c;
|
|
753
|
-
if (__privateGet(this,
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
}
|
|
757
|
-
if (!__privateGet(this, _pristine)) {
|
|
758
|
-
__privateSet(this, _pristine, true);
|
|
759
|
-
__privateSet(this, _isRendering, true);
|
|
760
|
-
if (__privateGet(this, _isAttached)) {
|
|
761
|
-
(_a = this.beforeRedraw) == null ? void 0 : _a.call(this);
|
|
762
|
-
(_b = this.beforeDisconnect) == null ? void 0 : _b.call(this);
|
|
763
|
-
(_c = this.afterDisconnect) == null ? void 0 : _c.call(this);
|
|
764
|
-
} else {
|
|
765
|
-
this.stopRenderLoop();
|
|
766
|
-
}
|
|
288
|
+
if (__privateGet(this, _i)) this.rafId = requestAnimationFrame(() => __privateMethod(this, _r_instances, o_fn).call(this));
|
|
289
|
+
else if (!__privateGet(this, _n)) {
|
|
290
|
+
__privateSet(this, _n, true), __privateSet(this, _i, true), __privateGet(this, _t) ? ((_a = this.beforeRedraw) == null ? void 0 : _a.call(this), (_b = this.beforeDisconnect) == null ? void 0 : _b.call(this), (_c = this.afterDisconnect) == null ? void 0 : _c.call(this)) : this.stopRenderLoop();
|
|
767
291
|
try {
|
|
768
292
|
await this.initWjElement(true);
|
|
769
|
-
} catch (
|
|
770
|
-
console.error("Render error:",
|
|
293
|
+
} catch (e2) {
|
|
294
|
+
console.error("Render error:", e2);
|
|
771
295
|
} finally {
|
|
772
|
-
__privateSet(this,
|
|
773
|
-
if (!__privateGet(this, _pristine)) {
|
|
774
|
-
__privateSet(this, _pristine, false);
|
|
775
|
-
__privateMethod(this, _WJElement_instances, enqueueUpdate_fn).call(this);
|
|
776
|
-
} else {
|
|
777
|
-
this.finisPromise();
|
|
778
|
-
this.style.visibility = __privateGet(this, _originalVisibility);
|
|
779
|
-
}
|
|
296
|
+
__privateSet(this, _i, false), __privateGet(this, _n) ? (this.finisPromise(), this.style.visibility = __privateGet(this, _s)) : (__privateSet(this, _n, false), __privateMethod(this, _r_instances, r_fn).call(this));
|
|
780
297
|
}
|
|
781
298
|
}
|
|
782
299
|
};
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
* @param {HTMLElement|ShadowRoot|DocumentFragment} targetContext Target for rendering (defaults to this.context)
|
|
786
|
-
* @returns A promise that resolves when rendering is complete.
|
|
787
|
-
* @private
|
|
788
|
-
*/
|
|
789
|
-
resolveRender_fn = function(targetContext = this.context, { skipAfterDraw = false } = {}) {
|
|
790
|
-
this.params = WjElementUtils.getAttributes(this);
|
|
791
|
-
return new Promise(async (resolve, reject) => {
|
|
300
|
+
a_fn = function(e2 = this.context, { skipAfterDraw: t2 = false } = {}) {
|
|
301
|
+
return this.params = i.getAttributes(this), new Promise(async (s2, n2) => {
|
|
792
302
|
var _a;
|
|
793
|
-
const
|
|
794
|
-
if (
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
await this.render(targetContext);
|
|
798
|
-
if (!skipAfterDraw) {
|
|
799
|
-
const _afterDraw = (_a = this.afterDraw) == null ? void 0 : _a.call(this, targetContext, this.store, WjElementUtils.getAttributes(this));
|
|
800
|
-
if (_afterDraw instanceof Promise || (_afterDraw == null ? void 0 : _afterDraw.constructor.name) === "Promise") {
|
|
801
|
-
await _afterDraw;
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
__privateSet(this, _isRendering, false);
|
|
805
|
-
__privateSet(this, _isAttached, true);
|
|
806
|
-
if (this.removeClassAfterConnect) {
|
|
807
|
-
this.classList.remove(...this.removeClassAfterConnect);
|
|
303
|
+
const r2 = this.beforeDraw(e2, this.store, i.getAttributes(this));
|
|
304
|
+
if ((r2 instanceof Promise || "Promise" === (r2 == null ? void 0 : r2.constructor.name)) && await r2, await this.render(e2), !t2) {
|
|
305
|
+
const t3 = (_a = this.afterDraw) == null ? void 0 : _a.call(this, e2, this.store, i.getAttributes(this));
|
|
306
|
+
(t3 instanceof Promise || "Promise" === (t3 == null ? void 0 : t3.constructor.name)) && await t3;
|
|
808
307
|
}
|
|
809
|
-
__privateSet(this,
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
console.error(e);
|
|
308
|
+
__privateSet(this, _i, false), __privateSet(this, _t, true), this.removeClassAfterConnect && this.classList.remove(...this.removeClassAfterConnect), __privateSet(this, _e, this.drawingStatuses.DONE), s2();
|
|
309
|
+
}).catch((e3) => {
|
|
310
|
+
console.error(e3);
|
|
813
311
|
});
|
|
814
312
|
};
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
* @param inputTemplate The secondary template.
|
|
819
|
-
* @returns The combined template.
|
|
820
|
-
*/
|
|
821
|
-
__publicField(_WJElement, "processTemplates", (pTemplate, inputTemplate) => {
|
|
822
|
-
const newTemplate = document.createElement("template");
|
|
823
|
-
newTemplate.innerHTML = [inputTemplate.innerHTML, (pTemplate == null ? void 0 : pTemplate.innerHTML) || ""].join("");
|
|
824
|
-
return newTemplate;
|
|
313
|
+
__publicField(_r, "processTemplates", (e2, t2) => {
|
|
314
|
+
const i2 = document.createElement("template");
|
|
315
|
+
return i2.innerHTML = [t2.innerHTML, (e2 == null ? void 0 : e2.innerHTML) || ""].join(""), i2;
|
|
825
316
|
});
|
|
826
|
-
let
|
|
827
|
-
let
|
|
317
|
+
let r = _r;
|
|
318
|
+
let o = "true";
|
|
828
319
|
export {
|
|
829
|
-
Permissions,
|
|
830
|
-
WjElementUtils,
|
|
831
|
-
__esModule,
|
|
832
|
-
|
|
320
|
+
t as Permissions,
|
|
321
|
+
i as WjElementUtils,
|
|
322
|
+
o as __esModule,
|
|
323
|
+
r as default,
|
|
833
324
|
event
|
|
834
325
|
};
|
|
835
326
|
//# sourceMappingURL=wje-element.js.map
|