wj-elements 0.1.48 → 0.1.49
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/custom-elements.json +14058 -0
- package/dist/dark.css +1 -0
- package/dist/light.css +1 -0
- package/dist/localize.js +45 -0
- package/dist/popup.element-CWsSOxs2.js +1072 -0
- package/dist/router-links-FtZbFUto.js +146 -0
- package/dist/styles.css +1 -0
- package/dist/web-types.json +3122 -0
- package/dist/wje-accordion-item.js +88 -0
- package/dist/wje-accordion.js +79 -0
- package/dist/wje-animation.js +121 -0
- package/dist/wje-aside.js +55 -0
- package/dist/wje-avatar.js +77 -0
- package/dist/wje-badge.js +50 -0
- package/dist/wje-breadcrumb.js +148 -0
- package/dist/wje-breadcrumbs.js +67 -0
- package/dist/wje-button-group.js +78 -0
- package/dist/wje-button.js +207 -0
- package/dist/wje-card-content.js +48 -0
- package/dist/wje-card-controls.js +48 -0
- package/dist/wje-card-header.js +47 -0
- package/dist/wje-card-subtitle.js +55 -0
- package/dist/wje-card-title.js +55 -0
- package/dist/wje-card.js +50 -0
- package/dist/wje-carousel-item.js +33 -0
- package/dist/wje-carousel.js +177 -0
- package/dist/wje-checkbox.js +96 -0
- package/dist/wje-chip.js +32 -0
- package/dist/wje-col.js +27 -0
- package/dist/wje-color-picker.js +953 -0
- package/dist/wje-container.js +57 -0
- package/dist/wje-copy-button.js +170 -0
- package/dist/wje-dialog.js +86 -0
- package/dist/wje-divider.js +53 -0
- package/dist/wje-dropdown.js +114 -0
- package/dist/wje-element.js +453 -0
- package/dist/wje-fetchAndParseCSS.js +40 -0
- package/dist/wje-file-upload-item.js +115 -0
- package/dist/wje-file-upload.js +297 -0
- package/dist/wje-footer.js +56 -0
- package/dist/wje-form.js +28 -0
- package/dist/wje-format-digital.js +85 -0
- package/dist/wje-grid.js +28 -0
- package/dist/wje-header.js +58 -0
- package/dist/wje-icon-picker.js +221 -0
- package/dist/wje-icon.js +119 -0
- package/dist/wje-img-comparer.js +111 -0
- package/dist/wje-img.js +58 -0
- package/dist/wje-infinite-scroll.js +201 -0
- package/dist/wje-inline-edit.js +145 -0
- package/dist/wje-input-file.js +85 -0
- package/dist/wje-input.js +334 -0
- package/dist/wje-item.js +45 -0
- package/dist/wje-label.js +67 -0
- package/dist/wje-list.js +53 -0
- package/dist/wje-main.js +56 -0
- package/dist/wje-masonry.js +218 -0
- package/dist/wje-master.js +423 -0
- package/dist/wje-menu-button.js +65 -0
- package/dist/wje-menu-item.js +230 -0
- package/dist/wje-menu-label.js +57 -0
- package/dist/wje-menu.js +74 -0
- package/dist/wje-option.js +99 -0
- package/dist/wje-options.js +63 -0
- package/dist/wje-popup.js +5 -0
- package/dist/wje-progress-bar.js +161 -0
- package/dist/wje-qr-code.js +2332 -0
- package/dist/wje-radio-group.js +101 -0
- package/dist/wje-radio.js +46 -0
- package/dist/wje-rate.js +260 -0
- package/dist/wje-relative-time.js +85 -0
- package/dist/wje-reorder-dropzone.js +27 -0
- package/dist/wje-reorder-handle.js +115 -0
- package/dist/wje-reorder-item.js +32 -0
- package/dist/wje-reorder.js +138 -0
- package/dist/wje-route.js +46 -0
- package/dist/wje-router-link.js +64 -0
- package/dist/wje-router-outlet.js +127 -0
- package/dist/wje-routerx.js +1088 -0
- package/dist/wje-row.js +58 -0
- package/dist/wje-select.js +242 -0
- package/dist/wje-slider.js +177 -0
- package/dist/wje-sliding-container.js +277 -0
- package/dist/wje-split-view.js +112 -0
- package/dist/wje-status.js +54 -0
- package/dist/wje-store.js +192 -0
- package/dist/wje-tab-group.js +107 -0
- package/dist/wje-tab-panel.js +52 -0
- package/dist/wje-tab.js +59 -0
- package/dist/wje-textarea.js +116 -0
- package/dist/wje-thumbnail.js +64 -0
- package/dist/wje-toast.js +76 -0
- package/dist/wje-toggle.js +94 -0
- package/dist/wje-toolbar-action.js +63 -0
- package/dist/wje-toolbar.js +61 -0
- package/dist/wje-tooltip.js +116 -0
- package/dist/wje-visually-hidden.js +56 -0
- package/package.json +1 -1
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
var p = Object.defineProperty;
|
|
2
|
+
var u = (r, n, t) => n in r ? p(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
|
|
3
|
+
var h = (r, n, t) => (u(r, typeof n != "symbol" ? n + "" : n, t), t);
|
|
4
|
+
import f from "./wje-element.js";
|
|
5
|
+
const v = ":host{display:block;overflow:hidden;display:table}";
|
|
6
|
+
class l extends f {
|
|
7
|
+
/**
|
|
8
|
+
* Creates an instance of SlidingContainer.
|
|
9
|
+
*
|
|
10
|
+
* @constructor
|
|
11
|
+
*/
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
h(this, "className", "SlidingContainer");
|
|
15
|
+
/**
|
|
16
|
+
* Triggers the event based on the target element.
|
|
17
|
+
* If the target element is different from the last caller, it refreshes the children by calling the `open` method.
|
|
18
|
+
* If the target element is the same as the last caller, it toggles the state by calling the `toggle` method.
|
|
19
|
+
* @param {Event} e - The event object.
|
|
20
|
+
*/
|
|
21
|
+
h(this, "triggerEvent", (t) => {
|
|
22
|
+
this._lastCaller && this._lastCaller !== t.target ? this.open() : this.toggle(), this._lastCaller = t.target;
|
|
23
|
+
});
|
|
24
|
+
this._isOpen = !1, this._lastCaller = null;
|
|
25
|
+
}
|
|
26
|
+
set maxWidth(t) {
|
|
27
|
+
this.setAttribute("max-width", t);
|
|
28
|
+
}
|
|
29
|
+
get maxWidth() {
|
|
30
|
+
return this.getAttribute("max-width") ?? "auto";
|
|
31
|
+
}
|
|
32
|
+
set maxHeight(t) {
|
|
33
|
+
this.setAttribute("max-height", t);
|
|
34
|
+
}
|
|
35
|
+
get maxHeight() {
|
|
36
|
+
return this.getAttribute("max-height") ?? "auto";
|
|
37
|
+
}
|
|
38
|
+
set trigger(t) {
|
|
39
|
+
this.setAttribute("trigger", t);
|
|
40
|
+
}
|
|
41
|
+
get trigger() {
|
|
42
|
+
return this.getAttribute("trigger") ?? "sliding-container";
|
|
43
|
+
}
|
|
44
|
+
set direction(t) {
|
|
45
|
+
this.setAttribute("direction", t);
|
|
46
|
+
}
|
|
47
|
+
get direction() {
|
|
48
|
+
return this.getAttribute("direction") ?? "right";
|
|
49
|
+
}
|
|
50
|
+
set removeChildAfterClose(t) {
|
|
51
|
+
this.setAttribute("remove-child-after-close", t);
|
|
52
|
+
}
|
|
53
|
+
get removeChildAfterClose() {
|
|
54
|
+
return this.hasAttribute("remove-child-after-close") ?? !1;
|
|
55
|
+
}
|
|
56
|
+
set variant(t) {
|
|
57
|
+
this.setAttribute("variant", t);
|
|
58
|
+
}
|
|
59
|
+
get variant() {
|
|
60
|
+
return this.getAttribute("variant") ?? "in-place";
|
|
61
|
+
}
|
|
62
|
+
get screenBreakPoint() {
|
|
63
|
+
return this.getAttribute("screen-break-point");
|
|
64
|
+
}
|
|
65
|
+
set screenBreakPoint(t) {
|
|
66
|
+
this.setAttribute("screen-break-point", t);
|
|
67
|
+
}
|
|
68
|
+
get animationDuration() {
|
|
69
|
+
return this.getAttribute("animation-duration") ?? "500";
|
|
70
|
+
}
|
|
71
|
+
set animationDuration(t) {
|
|
72
|
+
this.setAttribute("animation-duration", t);
|
|
73
|
+
}
|
|
74
|
+
get animationEasing() {
|
|
75
|
+
return this.getAttribute("animation-easing") ?? "linear";
|
|
76
|
+
}
|
|
77
|
+
set animationEasing(t) {
|
|
78
|
+
this.setAttribute("animation-easing", t);
|
|
79
|
+
}
|
|
80
|
+
get hasOpacity() {
|
|
81
|
+
return this.hasAttribute("has-opacity") ?? !1;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Returns the observed attributes for the component.
|
|
85
|
+
* @returns {string[]}
|
|
86
|
+
*/
|
|
87
|
+
static get observedAttributes() {
|
|
88
|
+
return ["max-width", "max-height", "trigger", "direction", "variant", "screen-break-point", "remove-child-after-close", "animation-duration", "animation-easing", "has-opacity"];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Returns the CSS styles for the component.
|
|
92
|
+
*
|
|
93
|
+
* @static
|
|
94
|
+
* @returns {CSSStyleSheet}
|
|
95
|
+
*/
|
|
96
|
+
static get cssStyleSheet() {
|
|
97
|
+
return v;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Sets up the attributes for the component.
|
|
101
|
+
*/
|
|
102
|
+
setupAttributes() {
|
|
103
|
+
this.isShadowRoot = "open";
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Draws the component.
|
|
107
|
+
*
|
|
108
|
+
* @param {Object} context - The context for drawing.
|
|
109
|
+
* @param {Object} store - The store for drawing.
|
|
110
|
+
* @param {Object} params - The parameters for drawing.
|
|
111
|
+
* @returns {DocumentFragment}
|
|
112
|
+
*/
|
|
113
|
+
draw(t, i, a) {
|
|
114
|
+
let s = document.createDocumentFragment();
|
|
115
|
+
this.style.position = "relative", this.style.height = "100%", this.transparentDiv = document.createElement("div"), this.transparentDiv.classList.add("sliding-container-transparent");
|
|
116
|
+
let e = document.createElement("div");
|
|
117
|
+
e.style.position = "absolute", e.style.width = this.maxWidth, this.hasOpacity && (e.style.opacity = 0), e.style.height = "100%", e.classList.add("native-sliding-container"), e.setAttribute("part", "sliding-container"), this.direction === "right" ? e.style.right = 0 : e.style.left = 0;
|
|
118
|
+
let o = document.createElement("slot");
|
|
119
|
+
return e.appendChild(this.getCloseButton()), e.appendChild(o), s.appendChild(this.transparentDiv), s.appendChild(e), this.nativeElement = e, s;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Creates and returns a close button element.
|
|
123
|
+
* @returns {HTMLElement} The close button element.
|
|
124
|
+
*/
|
|
125
|
+
getCloseButton() {
|
|
126
|
+
let t = document.createElement("wje-button");
|
|
127
|
+
t.setAttribute("part", "close-button"), t.style.position = "absolute", t.style.top = "0", t.style.right = "0", t.style.zIndex = "1000";
|
|
128
|
+
let i = document.createElement("wje-icon");
|
|
129
|
+
return i.setAttribute("slot", "icon-only"), i.setAttribute("name", "x"), t.appendChild(i), t.addEventListener("click", () => {
|
|
130
|
+
this.close();
|
|
131
|
+
}), t;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Executes before drawing the element.
|
|
135
|
+
*/
|
|
136
|
+
beforeDraw() {
|
|
137
|
+
document.removeEventListener(this.trigger, this.triggerEvent);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Performs actions after the element is drawn on the screen.
|
|
141
|
+
* Attaches an event listener to the document based on the specified trigger.
|
|
142
|
+
* Sets the variant to "over" if the document width is smaller than the screen break point.
|
|
143
|
+
* Calls the checkForVariant method with the current variant.
|
|
144
|
+
* @returns {Promise<void>} A promise that resolves after the actions are completed.
|
|
145
|
+
*/
|
|
146
|
+
async afterDraw() {
|
|
147
|
+
document.addEventListener(this.trigger, this.triggerEvent), this.screenBreakPoint && window.innerWidth < this.screenBreakPoint && (this.variant = "over"), this.checkForVariant(this.variant);
|
|
148
|
+
}
|
|
149
|
+
getParentElement() {
|
|
150
|
+
let t = this.parentElement;
|
|
151
|
+
return t || (t = this.getRootNode().host), t;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Checks for a specific variant and applies corresponding styles.
|
|
155
|
+
*
|
|
156
|
+
* @param {string} variant - The variant to check for.
|
|
157
|
+
*/
|
|
158
|
+
checkForVariant(t) {
|
|
159
|
+
var i, a;
|
|
160
|
+
if (t === "over") {
|
|
161
|
+
this.style.position = "fixed";
|
|
162
|
+
let s = window.getComputedStyle(this.getParentElement()), e = this.getParentElement().getBoundingClientRect(), o = parseFloat(s.height), d = parseFloat(s.width), m = parseFloat(s.top);
|
|
163
|
+
this.style.height = o + "px", this.style.top = m + "px";
|
|
164
|
+
let g = this.getParentElement().firstElementChild === this || ((i = this.getParentElement().shadowRoot) == null ? void 0 : i.firstElementChild) === this, c = this.getParentElement().lastElementChild === this || ((a = this.getParentElement().shadowRoot) == null ? void 0 : a.lastElementChild) === this;
|
|
165
|
+
g && (this.direction === "right" ? this.style.left = e.left + "px" : this.style.right = window.innerWidth - (e.left + e.width) + d + "px"), c && (this.style.right = window.innerWidth - (e.left + e.width) + "px");
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Executes before the element is opened.
|
|
170
|
+
*/
|
|
171
|
+
beforeOpen() {
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Callback function called after the element is opened.
|
|
175
|
+
*/
|
|
176
|
+
afterOpen() {
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Executes before closing the element.
|
|
180
|
+
*/
|
|
181
|
+
beforeClose() {
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Callback function that is called after the container is closed.
|
|
185
|
+
*/
|
|
186
|
+
afterClose() {
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Animates the transition of the element's width from 0 to the maximum width or vice versa.
|
|
190
|
+
* @returns {Promise<void>} A promise that resolves when the animation finishes.
|
|
191
|
+
*/
|
|
192
|
+
doAnimateTransition() {
|
|
193
|
+
const t = {
|
|
194
|
+
delay: 0,
|
|
195
|
+
endDelay: 0,
|
|
196
|
+
fill: "both",
|
|
197
|
+
duration: +this.animationDuration,
|
|
198
|
+
iterationStart: 0,
|
|
199
|
+
iterations: 1,
|
|
200
|
+
direction: "normal",
|
|
201
|
+
easing: this.animationEasing
|
|
202
|
+
};
|
|
203
|
+
if (this._isOpen)
|
|
204
|
+
this.animation.reverse(), this.hasOpacity && this.nativeAnimation.reverse();
|
|
205
|
+
else {
|
|
206
|
+
if (this.animation) {
|
|
207
|
+
this.animation.reverse(), this.hasOpacity && this.nativeAnimation.reverse();
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
this.animation = this.transparentDiv.animate([
|
|
211
|
+
{
|
|
212
|
+
width: 0,
|
|
213
|
+
opacity: 0
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
width: this.maxWidth,
|
|
217
|
+
opacity: +this.containerOpacity
|
|
218
|
+
}
|
|
219
|
+
], t), this.hasOpacity && (this.nativeAnimation = this.nativeElement.animate([
|
|
220
|
+
{
|
|
221
|
+
opacity: 0
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
opacity: 1
|
|
225
|
+
}
|
|
226
|
+
], t));
|
|
227
|
+
}
|
|
228
|
+
return new Promise((i, a) => {
|
|
229
|
+
this.animation.onfinish = () => {
|
|
230
|
+
i();
|
|
231
|
+
};
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Opens the container with an animation.
|
|
236
|
+
* @returns {Promise<void>} A promise that resolves when the container is opened.
|
|
237
|
+
*/
|
|
238
|
+
async open() {
|
|
239
|
+
await Promise.resolve(this.beforeOpen()).then(() => {
|
|
240
|
+
Promise.resolve(this._isOpen ? () => {
|
|
241
|
+
} : this.doAnimateTransition()).then(() => {
|
|
242
|
+
Promise.resolve(this.afterOpen()).then(() => {
|
|
243
|
+
this._isOpen = !0;
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Closes the animation container.
|
|
250
|
+
*
|
|
251
|
+
* @returns {Promise<void>} A promise that resolves when the container is closed.
|
|
252
|
+
*/
|
|
253
|
+
async close() {
|
|
254
|
+
await Promise.resolve(this.beforeClose()).then(() => {
|
|
255
|
+
Promise.resolve(this._isOpen ? this.doAnimateTransition() : () => {
|
|
256
|
+
}).then(() => {
|
|
257
|
+
Promise.resolve(this.afterClose()).then(() => {
|
|
258
|
+
this.removeChildAfterClose && this.childNodes.forEach((t) => {
|
|
259
|
+
t.remove();
|
|
260
|
+
}), this._isOpen = !1;
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Toggles the state of the element.
|
|
267
|
+
* If the element is open, it will be closed. If it is closed, it will be opened.
|
|
268
|
+
* @returns {Promise<void>} A promise that resolves when the toggle operation is complete.
|
|
269
|
+
*/
|
|
270
|
+
async toggle() {
|
|
271
|
+
this._isOpen ? await this.close() : await this.open();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
l.define("wje-sliding-container", l);
|
|
275
|
+
export {
|
|
276
|
+
l as default
|
|
277
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
var h = Object.defineProperty;
|
|
2
|
+
var p = (s, e, t) => e in s ? h(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var c = (s, e, t) => (p(s, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import m from "./wje-element.js";
|
|
5
|
+
function u(s, e) {
|
|
6
|
+
function t(n) {
|
|
7
|
+
const r = s.getBoundingClientRect(), i = s.ownerDocument.defaultView, d = r.left + i.pageXOffset, v = r.top + i.pageYOffset, w = n.pageX - d, a = n.pageY - v;
|
|
8
|
+
e != null && e.onMove && e.onMove(w, a);
|
|
9
|
+
}
|
|
10
|
+
function l() {
|
|
11
|
+
document.removeEventListener("pointermove", t), document.removeEventListener("pointerup", l), e != null && e.onStop && e.onStop();
|
|
12
|
+
}
|
|
13
|
+
document.addEventListener("pointermove", t, { passive: !0 }), document.addEventListener("pointerup", l), (e == null ? void 0 : e.initialEvent) instanceof PointerEvent && t(e.initialEvent);
|
|
14
|
+
}
|
|
15
|
+
const j = ':host{--wje-split-view-divider-area: 12px;--wje-split-view-divider-width: 4px;--wje-split-view-min: 0%;--wje-split-view-max: 100%;--wje-split-view-calc-a: 50%;--wje-split-view-calc-b: 50%;--wje-split-view-clamp-a: clamp(var(--wje-split-view-min), var(--wje-split-view-calc-a), var(--wje-split-view-max));--wje-split-view-clamp-b: clamp(var(--wje-split-view-min), var(--wje-split-view-calc-b), var(--wje-split-view-max));--wje-split-view-divider-background: var(--wje-border-color);--wje-split-view-divider-size: 4px;height:100%;width:100%}::slotted([slot=start]),::slotted([slot=end]){width:100%;display:flex;align-items:center;justify-content:center;overflow:hidden}:host(:not([vertical])) ::slotted([slot=start]){width:var(--wje-split-view-clamp-a)}:host(:not([vertical])) ::slotted([slot=end]){width:var(--wje-split-view-clamp-b)}:host([vertical]) ::slotted([slot=start]){height:var(--wje-split-view-clamp-a);width:100%}:host([vertical]) ::slotted([slot=end]){height:var(--wje-split-view-clamp-b);width:100%}.native-split-view{height:100%;width:100%;display:flex;flex-direction:row;overflow:hidden;position:relative}:host([vertical]) .native-split-view{flex-direction:column}.wje-divider{display:flex;position:relative;align-items:center;justify-content:center;z-index:1;background-color:var(--wje-split-view-divider-background);height:100%;width:var(--wje-split-view-divider-size);cursor:col-resize}.wje-divider:after{display:flex;content:"";position:absolute;height:100%;left:calc(var(--wje-split-view-divider-area) / -2 + var(--wje-split-view-divider-width) / 2);width:var(--wje-split-view-divider-area)}:host([vertical]) .wje-divider{height:var(--wje-split-view-divider-size);width:100%;cursor:row-resize}:host([vertical]) .wje-divider:after{width:100%;top:calc(var(--wje-split-view-divider-area) / -2 + var(--wje-split-view-divider-width) / 2);height:var(--wje-split-view-divider-area)}';
|
|
16
|
+
class o extends m {
|
|
17
|
+
/**
|
|
18
|
+
* Creates an instance of SplitView.
|
|
19
|
+
*
|
|
20
|
+
* @constructor
|
|
21
|
+
*/
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
c(this, "className", "SplitView");
|
|
25
|
+
/**
|
|
26
|
+
* Handles the drag event.
|
|
27
|
+
*
|
|
28
|
+
* @param {Event} e - The event object.
|
|
29
|
+
*/
|
|
30
|
+
c(this, "handleDrag", (t) => {
|
|
31
|
+
if (this.hasAttribute("disabled"))
|
|
32
|
+
return !1;
|
|
33
|
+
u(this, {
|
|
34
|
+
onMove: (l, n) => {
|
|
35
|
+
let r = this.hasAttribute("vertical") ? n : l, i = this.pixelsToPercentage(r), d = 100 - this.pixelsToPercentage(r);
|
|
36
|
+
this.style.setProperty("--wje-split-view-calc-a", i + "%"), this.style.setProperty("--wje-split-view-calc-b", d + "%");
|
|
37
|
+
},
|
|
38
|
+
initialEvent: t
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Returns the CSS styles for the component.
|
|
44
|
+
*
|
|
45
|
+
* @static
|
|
46
|
+
* @returns {CSSStyleSheet}
|
|
47
|
+
*/
|
|
48
|
+
static get cssStyleSheet() {
|
|
49
|
+
return j;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Returns the list of attributes to observe for changes.
|
|
53
|
+
*
|
|
54
|
+
* @static
|
|
55
|
+
* @returns {Array<string>}
|
|
56
|
+
*/
|
|
57
|
+
static get observedAttributes() {
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Sets up the attributes for the component.
|
|
62
|
+
*/
|
|
63
|
+
setupAttributes() {
|
|
64
|
+
this.isShadowRoot = "open";
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Draws the component.
|
|
68
|
+
*
|
|
69
|
+
* @param {Object} context - The context for drawing.
|
|
70
|
+
* @param {Object} store - The store for drawing.
|
|
71
|
+
* @param {Object} params - The parameters for drawing.
|
|
72
|
+
* @returns {DocumentFragment}
|
|
73
|
+
*/
|
|
74
|
+
draw(t, l, n) {
|
|
75
|
+
let r = document.createDocumentFragment(), i = document.createElement("div");
|
|
76
|
+
i.classList.add("native-split-view");
|
|
77
|
+
let d = document.createElement("slot");
|
|
78
|
+
d.setAttribute("name", "start");
|
|
79
|
+
let v = document.createElement("slot");
|
|
80
|
+
v.setAttribute("name", "end");
|
|
81
|
+
let w = document.createElement("slot");
|
|
82
|
+
w.setAttribute("name", "divider");
|
|
83
|
+
let a = document.createElement("div");
|
|
84
|
+
return a.classList.add("wje-divider"), a.setAttribute("part", "divider"), a.appendChild(w), a.addEventListener("mousedown", this.handleDrag, !1), i.appendChild(d), i.appendChild(a), i.appendChild(v), r.appendChild(i), r;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Sets up the event listeners after the component is drawn.
|
|
88
|
+
*/
|
|
89
|
+
afterDraw() {
|
|
90
|
+
this.detectSize(), this.min && this.style.setProperty("--wje-split-view-min", this.pixelsToPercentage(this.min) + "%"), this.max && this.style.setProperty("--wje-split-view-max", 100 - this.pixelsToPercentage(this.max) + "%"), this.initial && (this.style.setProperty("--wje-split-view-calc-a", this.pixelsToPercentage(this.initial) + "%"), this.style.setProperty("--wje-split-view-calc-b", 100 - this.pixelsToPercentage(this.initial) + "%")), this.resizeObserver = new ResizeObserver((t) => this.handleResize(t));
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Detects the size of the split view.
|
|
94
|
+
*/
|
|
95
|
+
detectSize() {
|
|
96
|
+
const { width: t, height: l } = this.getBoundingClientRect();
|
|
97
|
+
this.size = this.hasAttribute("vertical") ? l : t;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Converts pixels to a percentage.
|
|
101
|
+
*
|
|
102
|
+
* @param {number} value - The pixel value.
|
|
103
|
+
* @returns {number} The percentage value.
|
|
104
|
+
*/
|
|
105
|
+
pixelsToPercentage(t) {
|
|
106
|
+
return t / this.size * 100;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
o.define("wje-split-view", o);
|
|
110
|
+
export {
|
|
111
|
+
o as default
|
|
112
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var b = (r, e, t) => e in r ? u(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var n = (r, e, t) => (b(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import w from "./wje-element.js";
|
|
5
|
+
const m = '.native-status{display:flex;align-items:center}.bullet{width:var(--wje-status-size);height:var(--wje-status-size);display:flex;align-items:center;justify-content:center;border-width:1px;border-style:solid;border-color:transparent;border-radius:var(--wje-border-radius-circle)}:host ::slotted([slot="start"]){margin-right:var(--wje-spacing-x-small)}:host ::slotted([slot="end"]){margin-left:var(--wje-spacing-x-small)}:host([size=small]){--wje-status-size: var(--wje-size-small)}:host([size=medium]){--wje-status-size: var(--wje-size)}:host([size=large]){--wje-status-size: var(--wje-size-large)}:host([color=primary]) .bullet{background-color:var(--wje-color-primary-9);color:var(--wje-color-contrast-0)}:host([color=complete]) .bullet{background-color:var(--wje-color-complete-9);color:var(--wje-color-contrast-0)}:host([color=success]) .bullet{background-color:var(--wje-color-success-9);color:var(--wje-color-contrast-0)}:host([color=warning]) .bullet{background-color:var(--wje-color-warning-9);color:var(--wje-color-contrast-11)}:host([color=danger]) .bullet{background-color:var(--wje-color-danger-9);color:var(--wje-color-contrast-0)}:host([color=contrast]) .bullet{background-color:var(--wje-color-contrast-2);color:var(--wje-color-contrast-11)}:host([color=contrast-reverse]) .bullet{background-color:var(--wje-color-contrast-11);color:var(--wje-color-contrast-0)}:host([border=primary]) .bullet{border-color:var(--wje-color-primary-9)}:host([border=complete]) .bullet{border-color:var(--wje-color-complete-9)}:host([border=success]) .bullet{border-color:var(--wje-color-success-9)}:host([border=warning]) .bullet{border-color:var(--wje-color-warning-9)}:host([border=danger]) .bullet{border-color:var(--wje-color-danger-9)}:host([border=contrast]) .bullet{border-color:var(--wje-color-contrast-2)}:host([border=contrast-reverse]) .bullet{border-color:var(--wje-color-contrast-11)}';
|
|
6
|
+
class d extends w {
|
|
7
|
+
/**
|
|
8
|
+
* Badge constructor
|
|
9
|
+
* @constructor
|
|
10
|
+
*/
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
/**
|
|
14
|
+
* Class name
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
n(this, "className", "Status");
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get CSS stylesheet
|
|
21
|
+
* @static
|
|
22
|
+
* @returns {Object} styles - The CSS styles
|
|
23
|
+
*/
|
|
24
|
+
static get cssStyleSheet() {
|
|
25
|
+
return m;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Setup attributes
|
|
29
|
+
*/
|
|
30
|
+
setupAttributes() {
|
|
31
|
+
this.isShadowRoot = "open";
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Draw method
|
|
35
|
+
* @param {Object} context - The context
|
|
36
|
+
* @param {Object} store - The store
|
|
37
|
+
* @param {Object} params - The parameters
|
|
38
|
+
* @returns {Object} fragment - The document fragment
|
|
39
|
+
*/
|
|
40
|
+
draw(t, v, j) {
|
|
41
|
+
let s = document.createDocumentFragment(), o = document.createElement("div");
|
|
42
|
+
o.setAttribute("part", "native"), o.classList.add("native-status");
|
|
43
|
+
let l = document.createElement("div");
|
|
44
|
+
l.setAttribute("part", "bullet"), l.classList.add("bullet");
|
|
45
|
+
let i = document.createElement("slot"), a = document.createElement("slot");
|
|
46
|
+
a.setAttribute("name", "start");
|
|
47
|
+
let c = document.createElement("slot");
|
|
48
|
+
return c.setAttribute("name", "end"), l.appendChild(i), o.appendChild(a), o.appendChild(l), o.appendChild(c), s.appendChild(o), s;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
d.define("wje-status", d);
|
|
52
|
+
export {
|
|
53
|
+
d as default
|
|
54
|
+
};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
var h = Object.defineProperty;
|
|
2
|
+
var o = (u, r, e) => r in u ? h(u, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : u[r] = e;
|
|
3
|
+
var n = (u, r, e) => (o(u, typeof r != "symbol" ? r + "" : r, e), e);
|
|
4
|
+
class d {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.events = {};
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Either create a new event instance for passed `event` name
|
|
10
|
+
* or push a new callback into the existing collection
|
|
11
|
+
*
|
|
12
|
+
* @param {string} event
|
|
13
|
+
* @param {function} callback
|
|
14
|
+
* @returns {number} A count of callbacks for this event
|
|
15
|
+
* @memberof PubSub
|
|
16
|
+
*/
|
|
17
|
+
subscribe(r, e) {
|
|
18
|
+
let t = this;
|
|
19
|
+
return t.events.hasOwnProperty(r) || (t.events[r] = []), t.events[r].push(e) - 1, {
|
|
20
|
+
unsubscribe() {
|
|
21
|
+
t.events[r].splice(t.events[r].indexOf(e), 1);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* If the passed event has callbacks attached to it, loop through each one
|
|
27
|
+
* and call it
|
|
28
|
+
*
|
|
29
|
+
* @param {string} event
|
|
30
|
+
* @param {object} [data={}]
|
|
31
|
+
* @returns {array} The callbacks for this event, or an empty array if no event exits
|
|
32
|
+
* @memberof PubSub
|
|
33
|
+
*/
|
|
34
|
+
publish(r, e = {}, t) {
|
|
35
|
+
let s = this;
|
|
36
|
+
return s.events.hasOwnProperty(r) ? s.events[r].map((i) => i(e, t)) : [];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const c = (u) => (r) => ({
|
|
40
|
+
type: `${u}/ADD`,
|
|
41
|
+
payload: r
|
|
42
|
+
}), p = (u) => (r) => ({
|
|
43
|
+
type: `${u}/ADD_MANY`,
|
|
44
|
+
payload: r
|
|
45
|
+
}), l = (u) => (r) => ({
|
|
46
|
+
type: `${u}/UPDATE`,
|
|
47
|
+
payload: r
|
|
48
|
+
}), a = (u) => (r) => ({
|
|
49
|
+
type: `${u}/DELETE`,
|
|
50
|
+
payload: r
|
|
51
|
+
}), f = (u) => (r) => ({
|
|
52
|
+
type: `${u}/LOAD`,
|
|
53
|
+
payload: r
|
|
54
|
+
}), y = {
|
|
55
|
+
addAction: c,
|
|
56
|
+
deleteAction: a,
|
|
57
|
+
loadAction: f,
|
|
58
|
+
updateAction: l,
|
|
59
|
+
addManyAction: p
|
|
60
|
+
};
|
|
61
|
+
class A {
|
|
62
|
+
constructor(r = {}) {
|
|
63
|
+
n(this, "_state");
|
|
64
|
+
n(this, "_reducer");
|
|
65
|
+
n(this, "events");
|
|
66
|
+
n(this, "status");
|
|
67
|
+
this._isPause = !1, this._state = {}, this._reducer = function(t = {}, s) {
|
|
68
|
+
return {};
|
|
69
|
+
}, this.status = "resting", this.events = new d(), r != null && r.hasOwnProperty("reducer") && (this._reducer = r.reducer), this.refreshProxy(r == null ? void 0 : r.state);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A dispatcher for actions that looks in the actions
|
|
73
|
+
* collection and runs the action if it can find it
|
|
74
|
+
*
|
|
75
|
+
* @param {string} actionKey
|
|
76
|
+
* @param {mixed} payload
|
|
77
|
+
* @returns {boolean}
|
|
78
|
+
* @memberof Store
|
|
79
|
+
*/
|
|
80
|
+
dispatch(r) {
|
|
81
|
+
this.status = "action";
|
|
82
|
+
let e = this._reducer(this._state, r);
|
|
83
|
+
return this.status = "mutation", this._state = Object.assign(this._state, e), !0;
|
|
84
|
+
}
|
|
85
|
+
getState() {
|
|
86
|
+
return JSON.parse(JSON.stringify(this._state));
|
|
87
|
+
}
|
|
88
|
+
subscribe(r, e) {
|
|
89
|
+
return this.events.subscribe(r, e);
|
|
90
|
+
}
|
|
91
|
+
unsubscribe(r) {
|
|
92
|
+
delete this.events[r];
|
|
93
|
+
}
|
|
94
|
+
pause() {
|
|
95
|
+
return this._isPause = !0, this;
|
|
96
|
+
}
|
|
97
|
+
play(r) {
|
|
98
|
+
return this._isPause = !1, this;
|
|
99
|
+
}
|
|
100
|
+
mergeReducers(r, e) {
|
|
101
|
+
let t = this._reducer;
|
|
102
|
+
this._reducer = (s, i) => ({
|
|
103
|
+
...t(s, i),
|
|
104
|
+
[r]: e(s[r], i)
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
makeEveryArrayEntryAsStoreState(r, e = [], t = "id") {
|
|
108
|
+
e.forEach((s) => {
|
|
109
|
+
this.getState().hasOwnProperty(`${r}-${s[t]}`) ? this.dispatch(y.updateAction(`${r}-${s[t]}`)(s)) : this.define(`${r}-${s.id || s.source || s[t]}`, s, null, t);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
define(r, e, t, s = "id") {
|
|
113
|
+
if (this._state.hasOwnProperty(r)) {
|
|
114
|
+
console.warn(`STATE už obsahuje premennú ${r},ktorú sa pokúšate pridať`);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
t instanceof Function ? this.mergeReducers(r, t) : e instanceof Array ? this.mergeReducers(r, this.createArrayReducer(r, s)) : this.mergeReducers(r, this.createObjectReducer(r, s)), this.refreshProxy({
|
|
118
|
+
...this._state,
|
|
119
|
+
[r]: e
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
refreshProxy(r) {
|
|
123
|
+
this._state = new Proxy(r || {}, {
|
|
124
|
+
set: (e, t, s) => {
|
|
125
|
+
if (JSON.stringify(e[t]) === JSON.stringify(s))
|
|
126
|
+
return !0;
|
|
127
|
+
let i = e[t];
|
|
128
|
+
return e[t] = s, this._isPause || this.events.publish(t, this._state, i), this.status !== "mutation" && console.warn(`You should use a mutation to set ${t}`), this.status = "resting", !0;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
createObjectReducer(r) {
|
|
133
|
+
return (e = {}, t) => {
|
|
134
|
+
switch (t.type) {
|
|
135
|
+
case `${r}/ADD`:
|
|
136
|
+
return {
|
|
137
|
+
...t.payload
|
|
138
|
+
};
|
|
139
|
+
case `${r}/UPDATE`:
|
|
140
|
+
return {
|
|
141
|
+
...e,
|
|
142
|
+
...t.payload
|
|
143
|
+
};
|
|
144
|
+
case `${r}/DELETE`:
|
|
145
|
+
return {};
|
|
146
|
+
default:
|
|
147
|
+
return e;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
createArrayReducer(r, e) {
|
|
152
|
+
return (t = [], s) => {
|
|
153
|
+
switch (s.type) {
|
|
154
|
+
case `${r}/ADD`:
|
|
155
|
+
return Array.isArray(s.payload) ? [
|
|
156
|
+
...t,
|
|
157
|
+
...s.payload
|
|
158
|
+
] : [
|
|
159
|
+
...t,
|
|
160
|
+
s.payload
|
|
161
|
+
];
|
|
162
|
+
case `${r}/ADD_MANY`:
|
|
163
|
+
return [
|
|
164
|
+
...t,
|
|
165
|
+
...s.payload
|
|
166
|
+
];
|
|
167
|
+
case `${r}/UPDATE`:
|
|
168
|
+
return t.some((i) => i[e] == s.payload[e]) ? [
|
|
169
|
+
...t.map((i) => i[e] == s.payload[e] ? s.payload : i)
|
|
170
|
+
] : [
|
|
171
|
+
...t,
|
|
172
|
+
s.payload
|
|
173
|
+
];
|
|
174
|
+
case `${r}/DELETE`:
|
|
175
|
+
return [
|
|
176
|
+
...t.filter((i) => i.hasOwnProperty(e) && i[e] != s.payload[e] || !i.hasOwnProperty(e) && i != s.payload)
|
|
177
|
+
];
|
|
178
|
+
case `${r}/LOAD`:
|
|
179
|
+
return [
|
|
180
|
+
...s.payload
|
|
181
|
+
];
|
|
182
|
+
default:
|
|
183
|
+
return t;
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
let D = new A();
|
|
189
|
+
export {
|
|
190
|
+
y as defaultStoreActions,
|
|
191
|
+
D as store
|
|
192
|
+
};
|