wj-elements 0.1.128 → 0.1.130
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/README.md +8 -4
- package/dist/assets/tags.json +3252 -22012
- package/dist/dark.css +211 -203
- package/dist/{infinite-scroll.element-DcO1E5Es.js → infinite-scroll.element-BmojLp3Z.js} +54 -44
- package/dist/light.css +511 -496
- package/dist/{list.element-TZXMx1rt.js → list.element-Ce1vIm1O.js} +3 -9
- package/dist/localize.js +4 -4
- package/dist/{popup.element-l8v-dMoK.js → popup.element-4DNn6DjX.js} +44 -53
- package/dist/{router-links-I2vcmVCs.js → router-links-CJnOdbas.js} +30 -77
- package/dist/styles.css +485 -473
- package/dist/wje-accordion-item.js +13 -11
- package/dist/wje-accordion.js +51 -14
- package/dist/wje-animation.js +149 -25
- package/dist/wje-aside.js +7 -12
- package/dist/wje-avatar.js +12 -15
- package/dist/wje-badge.js +24 -19
- package/dist/wje-breadcrumb.js +36 -44
- package/dist/wje-breadcrumbs.js +84 -27
- package/dist/wje-button-group.js +17 -23
- package/dist/wje-button.js +117 -66
- package/dist/wje-card-content.js +10 -13
- package/dist/wje-card-controls.js +10 -13
- package/dist/wje-card-header.js +5 -9
- package/dist/wje-card-subtitle.js +5 -8
- package/dist/wje-card-title.js +5 -8
- package/dist/wje-card.js +13 -14
- package/dist/wje-carousel-item.js +26 -1
- package/dist/wje-carousel.js +141 -24
- package/dist/wje-checkbox.js +300 -51
- package/dist/wje-chip.js +31 -12
- package/dist/wje-col.js +11 -15
- package/dist/wje-color-picker.js +92 -64
- package/dist/wje-container.js +6 -10
- package/dist/wje-copy-button.js +14 -18
- package/dist/wje-dialog.js +89 -5
- package/dist/wje-divider.js +2 -5
- package/dist/wje-dropdown.js +57 -24
- package/dist/wje-element.js +393 -218
- package/dist/wje-fetchAndParseCSS.js +2 -1
- package/dist/wje-file-upload-item.js +12 -19
- package/dist/wje-file-upload.js +117 -68
- package/dist/wje-footer.js +3 -10
- package/dist/wje-form.js +23 -1
- package/dist/wje-format-digital.js +5 -13
- package/dist/wje-grid.js +24 -3
- package/dist/wje-header.js +3 -10
- package/dist/wje-icon-picker.js +15 -31
- package/dist/wje-icon.js +10 -10
- package/dist/wje-img-comparer.js +8 -18
- package/dist/wje-img.js +5 -11
- package/dist/wje-infinite-scroll.js +1 -1
- package/dist/wje-input-file.js +20 -17
- package/dist/wje-input.js +51 -62
- package/dist/wje-item.js +31 -4
- package/dist/wje-kanban.js +37 -53
- package/dist/wje-label.js +4 -21
- package/dist/wje-list.js +1 -1
- package/dist/wje-main.js +4 -11
- package/dist/wje-masonry.js +21 -26
- package/dist/wje-master.js +201 -348
- package/dist/wje-menu-button.js +5 -13
- package/dist/wje-menu-item.js +211 -30
- package/dist/wje-menu-label.js +4 -11
- package/dist/wje-menu.js +6 -15
- package/dist/wje-option.js +19 -26
- package/dist/wje-options.js +148 -48
- package/dist/wje-orgchart-group.js +10 -17
- package/dist/wje-orgchart-item.js +13 -157
- package/dist/wje-orgchart.js +4 -10
- package/dist/wje-popup.js +1 -1
- package/dist/wje-progress-bar.js +17 -27
- package/dist/wje-qr-code.js +29 -13
- package/dist/wje-radio-group.js +21 -43
- package/dist/wje-radio.js +46 -8
- package/dist/wje-rate.js +38 -58
- package/dist/wje-relative-time.js +51 -43
- package/dist/wje-reorder-dropzone.js +20 -2
- package/dist/wje-reorder-handle.js +62 -3
- package/dist/wje-reorder-item.js +20 -2
- package/dist/wje-reorder.js +93 -36
- package/dist/wje-route.js +3 -9
- package/dist/wje-router-link.js +10 -14
- package/dist/wje-router-outlet.js +35 -37
- package/dist/wje-routerx.js +231 -338
- package/dist/wje-row.js +8 -20
- package/dist/wje-select.js +80 -104
- package/dist/wje-slider.js +17 -33
- package/dist/wje-sliding-container.js +127 -55
- package/dist/wje-split-view.js +15 -21
- package/dist/wje-status.js +9 -13
- package/dist/wje-step.js +18 -0
- package/dist/wje-stepper.js +65 -4734
- package/dist/wje-store.js +193 -90
- package/dist/wje-tab-group.js +7 -16
- package/dist/wje-tab-panel.js +4 -13
- package/dist/wje-tab.js +6 -14
- package/dist/wje-textarea.js +128 -42
- package/dist/wje-thumbnail.js +10 -23
- package/dist/wje-toast.js +38 -74
- package/dist/wje-toggle.js +24 -29
- package/dist/wje-toolbar-action.js +11 -15
- package/dist/wje-toolbar.js +11 -16
- package/dist/wje-tooltip.js +35 -23
- package/dist/wje-visually-hidden.js +10 -14
- package/package.json +22 -4
package/dist/wje-reorder.js
CHANGED
|
@@ -2,15 +2,18 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import WJElement from "./wje-element.js";
|
|
5
|
-
const styles = ".container {\n
|
|
5
|
+
const styles = ".container {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: auto;\n flex-direction: var(--flex-direction);\n}\n\n.container-w-dropzones {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: row;\n}\n\n.reversed {\n --flex-direction: column-reverse;\n}\n\n.basic {\n --flex-direction: column;\n}\n\n.dragging {\n position: absolute;\n pointer-events: none;\n z-index: 1000;\n}\n\n.reorder-item {\n transition:\n top 0.3s ease,\n left 0.3s ease;\n}\n";
|
|
6
6
|
class Reorder extends WJElement {
|
|
7
7
|
/**
|
|
8
8
|
* Creates an instance of Select.
|
|
9
|
-
*
|
|
10
|
-
* @constructor
|
|
9
|
+
* @class
|
|
11
10
|
*/
|
|
12
11
|
constructor() {
|
|
13
12
|
super();
|
|
13
|
+
/**
|
|
14
|
+
* The class name for the component.
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
14
17
|
__publicField(this, "className", "Select");
|
|
15
18
|
this.dragEl = null;
|
|
16
19
|
this.items = [];
|
|
@@ -22,7 +25,6 @@ class Reorder extends WJElement {
|
|
|
22
25
|
}
|
|
23
26
|
/**
|
|
24
27
|
* Returns the CSS styles for the component.
|
|
25
|
-
*
|
|
26
28
|
* @static
|
|
27
29
|
* @returns {CSSStyleSheet}
|
|
28
30
|
*/
|
|
@@ -31,7 +33,6 @@ class Reorder extends WJElement {
|
|
|
31
33
|
}
|
|
32
34
|
/**
|
|
33
35
|
* Returns the list of attributes to observe for changes.
|
|
34
|
-
*
|
|
35
36
|
* @static
|
|
36
37
|
* @returns {Array<string>}
|
|
37
38
|
*/
|
|
@@ -44,7 +45,11 @@ class Reorder extends WJElement {
|
|
|
44
45
|
setupAttributes() {
|
|
45
46
|
this.isShadowRoot = "open";
|
|
46
47
|
}
|
|
47
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Draws the component after it is connected to the DOM.
|
|
50
|
+
* @returns {DocumentFragment}
|
|
51
|
+
*/
|
|
52
|
+
draw() {
|
|
48
53
|
const fragment = document.createDocumentFragment();
|
|
49
54
|
const container = document.createElement("div");
|
|
50
55
|
container.classList.add("container");
|
|
@@ -56,7 +61,10 @@ class Reorder extends WJElement {
|
|
|
56
61
|
this.container = container;
|
|
57
62
|
return fragment;
|
|
58
63
|
}
|
|
59
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Adds event listeners after the component is drawn.
|
|
66
|
+
*/
|
|
67
|
+
afterDraw() {
|
|
60
68
|
const items = this.querySelectorAll("wje-reorder-item");
|
|
61
69
|
const dropZones = this.querySelectorAll("wje-reorder-dropzone");
|
|
62
70
|
this.container.classList.add(this.hasAttribute("reverse") ? "reversed" : "basic");
|
|
@@ -76,26 +84,42 @@ class Reorder extends WJElement {
|
|
|
76
84
|
});
|
|
77
85
|
}
|
|
78
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Attaches event listeners to the element.
|
|
89
|
+
* @param element
|
|
90
|
+
*/
|
|
79
91
|
attachEventListeners(element) {
|
|
80
|
-
element.addEventListener("mousedown", this.
|
|
81
|
-
element.addEventListener("touchstart", this.
|
|
82
|
-
element.addEventListener("dragstart", this.
|
|
92
|
+
element.addEventListener("mousedown", this.mouseDown.bind(this), false);
|
|
93
|
+
element.addEventListener("touchstart", this.touchStart.bind(this), false);
|
|
94
|
+
element.addEventListener("dragstart", this.dragStart.bind(this), false);
|
|
83
95
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
96
|
+
/**
|
|
97
|
+
* Handles the mouse down event.
|
|
98
|
+
* @param {object} e
|
|
99
|
+
*/
|
|
100
|
+
mouseDown(e) {
|
|
87
101
|
this.startDragging(e.clientX, e.clientY, e.currentTarget);
|
|
88
|
-
document.addEventListener("mousemove", this.
|
|
89
|
-
document.addEventListener("mouseup", this.
|
|
102
|
+
document.addEventListener("mousemove", this.mouseMove.bind(this), false);
|
|
103
|
+
document.addEventListener("mouseup", this.mouseUp.bind(this), false);
|
|
90
104
|
document.body.style.userSelect = "none";
|
|
91
105
|
}
|
|
92
|
-
|
|
106
|
+
/**
|
|
107
|
+
* Handles the touch start event.
|
|
108
|
+
* @param e
|
|
109
|
+
*/
|
|
110
|
+
touchStart(e) {
|
|
93
111
|
const touch = e.touches[0];
|
|
94
112
|
this.startDragging(touch.clientX, touch.clientY, e.currentTarget);
|
|
95
|
-
document.addEventListener("touchmove", this.
|
|
96
|
-
document.addEventListener("touchend", this.
|
|
113
|
+
document.addEventListener("touchmove", this.touchMove.bind(this), false);
|
|
114
|
+
document.addEventListener("touchend", this.touchEnd.bind(this), false);
|
|
97
115
|
document.body.style.userSelect = "none";
|
|
98
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Initializes the dragging process for a reorderable item.
|
|
119
|
+
* @param {number} clientX The x-coordinate of the mouse pointer when the drag starts.
|
|
120
|
+
* @param {number} clientY The y-coordinate of the mouse pointer when the drag starts.
|
|
121
|
+
* @param {HTMLElement} target The target element where the drag event originated.
|
|
122
|
+
*/
|
|
99
123
|
startDragging(clientX, clientY, target) {
|
|
100
124
|
if (this.hasAttribute("disabled")) {
|
|
101
125
|
return;
|
|
@@ -111,9 +135,11 @@ class Reorder extends WJElement {
|
|
|
111
135
|
this.originalIndex = [...this.dragEl.parentNode.children].indexOf(this.dragEl);
|
|
112
136
|
this.originalParent = this.dragEl.parentNode;
|
|
113
137
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
138
|
+
/**
|
|
139
|
+
* Handles the mouse move event.
|
|
140
|
+
* @param e
|
|
141
|
+
*/
|
|
142
|
+
mouseMove(e) {
|
|
117
143
|
if (!this.isDragging) return;
|
|
118
144
|
this.moveElement(e.pageX, e.pageY);
|
|
119
145
|
if (this.cloneEl) {
|
|
@@ -121,11 +147,20 @@ class Reorder extends WJElement {
|
|
|
121
147
|
this.cloneEl.style.top = `${e.pageY - this.offsetY}px`;
|
|
122
148
|
}
|
|
123
149
|
}
|
|
124
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Handles the `touchmove` event and updates the position of the dragged element.
|
|
152
|
+
* @param {TouchEvent} e The touch event containing touch position data.
|
|
153
|
+
*/
|
|
154
|
+
touchMove(e) {
|
|
125
155
|
if (!this.isDragging) return;
|
|
126
156
|
const touch = e.touches[0];
|
|
127
157
|
this.moveElement(touch.pageX, touch.pageY);
|
|
128
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Updates the position of the dragged element and handles reordering logic based on the mouse position.
|
|
161
|
+
* @param {number} pageX The x-coordinate of the mouse pointer relative to the viewport during the move event.
|
|
162
|
+
* @param {number} pageY The y-coordinate of the mouse pointer relative to the viewport during the move event.
|
|
163
|
+
*/
|
|
129
164
|
moveElement(pageX, pageY) {
|
|
130
165
|
const scrollX = window.scrollX || document.documentElement.scrollLeft;
|
|
131
166
|
const scrollY = window.scrollY || document.documentElement.scrollTop;
|
|
@@ -150,12 +185,13 @@ class Reorder extends WJElement {
|
|
|
150
185
|
}
|
|
151
186
|
});
|
|
152
187
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
188
|
+
/**
|
|
189
|
+
* Handles the mouse up event.
|
|
190
|
+
*/
|
|
191
|
+
mouseUp() {
|
|
156
192
|
this.stopDragging();
|
|
157
|
-
document.removeEventListener("mousemove", this.
|
|
158
|
-
document.removeEventListener("mouseup", this.
|
|
193
|
+
document.removeEventListener("mousemove", this.mouseMove.bind(this), false);
|
|
194
|
+
document.removeEventListener("mouseup", this.mouseUp.bind(this), false);
|
|
159
195
|
if (this.cloneEl) {
|
|
160
196
|
this.cloneEl.remove();
|
|
161
197
|
this.cloneEl = null;
|
|
@@ -164,11 +200,17 @@ class Reorder extends WJElement {
|
|
|
164
200
|
this.dragEl.style.opacity = "1";
|
|
165
201
|
}
|
|
166
202
|
}
|
|
167
|
-
|
|
203
|
+
/**
|
|
204
|
+
* Handles the touch end event.
|
|
205
|
+
*/
|
|
206
|
+
touchEnd() {
|
|
168
207
|
this.stopDragging();
|
|
169
|
-
document.removeEventListener("touchmove", this.
|
|
170
|
-
document.removeEventListener("touchend", this.
|
|
208
|
+
document.removeEventListener("touchmove", this.touchMove.bind(this), false);
|
|
209
|
+
document.removeEventListener("touchend", this.touchEnd.bind(this), false);
|
|
171
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* Stops dragging the element.
|
|
213
|
+
*/
|
|
172
214
|
stopDragging() {
|
|
173
215
|
if (!this.isDragging) return;
|
|
174
216
|
this.isDragging = false;
|
|
@@ -188,11 +230,16 @@ class Reorder extends WJElement {
|
|
|
188
230
|
this.dispatchChange(this.originalIndex, newIndex, newOrder);
|
|
189
231
|
document.body.style.userSelect = "";
|
|
190
232
|
}
|
|
191
|
-
|
|
233
|
+
/**
|
|
234
|
+
* Prevents the default behavior of the `dragstart` event.
|
|
235
|
+
* @param {DragEvent} e The drag event triggered when a drag operation starts.
|
|
236
|
+
*/
|
|
237
|
+
dragStart(e) {
|
|
192
238
|
e.preventDefault();
|
|
193
239
|
}
|
|
194
|
-
|
|
195
|
-
|
|
240
|
+
/**
|
|
241
|
+
* Creates a clone of the element.
|
|
242
|
+
*/
|
|
196
243
|
createClone() {
|
|
197
244
|
this.cloneEl = this.dragEl.cloneNode(true);
|
|
198
245
|
this.cloneEl.style.position = "absolute";
|
|
@@ -200,16 +247,26 @@ class Reorder extends WJElement {
|
|
|
200
247
|
this.cloneEl.style.visibility = "visible";
|
|
201
248
|
document.body.appendChild(this.cloneEl);
|
|
202
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* Checks if the dragged element is moving down.
|
|
252
|
+
* @param droppedElement
|
|
253
|
+
* @returns {boolean}
|
|
254
|
+
*/
|
|
203
255
|
isMovingDown(droppedElement) {
|
|
204
256
|
const parent = droppedElement.parentNode;
|
|
205
257
|
const dragIndex = Array.from(parent.children).indexOf(this.dragEl);
|
|
206
258
|
const dropIndex = Array.from(parent.children).indexOf(droppedElement);
|
|
207
259
|
return dragIndex < dropIndex;
|
|
208
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Dispatches a custom event to signal that a reordering operation has occurred.
|
|
263
|
+
* @param {number} from The original index of the dragged item.
|
|
264
|
+
* @param {number} to The new index of the dragged item after reordering.
|
|
265
|
+
* @param {Array<number>} order The updated order of items after the reordering.
|
|
266
|
+
* // @fires wje-reorder:change - Dispatched when the reordering is completed.
|
|
267
|
+
* The event includes details about the initial position, the new position, and the new order.
|
|
268
|
+
*/
|
|
209
269
|
dispatchChange(from, to, order) {
|
|
210
|
-
console.log("FROM:", from);
|
|
211
|
-
console.log("TO:", to);
|
|
212
|
-
console.log("ORDER:", order);
|
|
213
270
|
this.dispatchEvent(
|
|
214
271
|
new CustomEvent("wje-reorder:change", {
|
|
215
272
|
detail: { from, to, order }
|
package/dist/wje-route.js
CHANGED
|
@@ -5,8 +5,7 @@ import WJElement from "./wje-element.js";
|
|
|
5
5
|
class Route extends WJElement {
|
|
6
6
|
/**
|
|
7
7
|
* Creates an instance of Route.
|
|
8
|
-
*
|
|
9
|
-
* @constructor
|
|
8
|
+
* @class
|
|
10
9
|
*/
|
|
11
10
|
constructor() {
|
|
12
11
|
super();
|
|
@@ -14,7 +13,6 @@ class Route extends WJElement {
|
|
|
14
13
|
}
|
|
15
14
|
/**
|
|
16
15
|
* Returns the list of attributes to observe for changes.
|
|
17
|
-
*
|
|
18
16
|
* @static
|
|
19
17
|
* @returns {Array<string>}
|
|
20
18
|
*/
|
|
@@ -28,14 +26,10 @@ class Route extends WJElement {
|
|
|
28
26
|
this.isShadowRoot = "open";
|
|
29
27
|
}
|
|
30
28
|
/**
|
|
31
|
-
* Draws the component.
|
|
32
|
-
*
|
|
33
|
-
* @param {Object} context - The context for drawing.
|
|
34
|
-
* @param {Object} store - The store for drawing.
|
|
35
|
-
* @param {Object} params - The parameters for drawing.
|
|
29
|
+
* Draws the component for the route.
|
|
36
30
|
* @returns {DocumentFragment}
|
|
37
31
|
*/
|
|
38
|
-
draw(
|
|
32
|
+
draw() {
|
|
39
33
|
let fragment = document.createDocumentFragment();
|
|
40
34
|
let slot = document.createElement("slot");
|
|
41
35
|
fragment.appendChild(slot);
|
package/dist/wje-router-link.js
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import { b as bindRouterLinks } from "./router-links-CJnOdbas.js";
|
|
4
5
|
import WJElement from "./wje-element.js";
|
|
5
|
-
|
|
6
|
-
const styles = "/*\n[ WJ Router Link ]\n*/\n\n:host{\n display: block;\n background: transparent !important;\n}\n\n:host(.active){\n cursor: pointer;\n font-weight: bold;\n}";
|
|
6
|
+
const styles = "/*\n[ WJ Router Link ]\n*/\n\n:host {\n display: block;\n background: transparent !important;\n}\n\n:host(.active) {\n cursor: pointer;\n font-weight: bold;\n}\n";
|
|
7
7
|
class RouterLink extends WJElement {
|
|
8
8
|
/**
|
|
9
9
|
* Creates an instance of RouterLink.
|
|
10
|
-
*
|
|
11
|
-
* @constructor
|
|
10
|
+
* @class
|
|
12
11
|
*/
|
|
13
12
|
constructor() {
|
|
14
13
|
super();
|
|
15
14
|
__publicField(this, "className", "RouterLink");
|
|
16
|
-
this.unbindRouterLinks = bindRouterLinks(this, { selector: false });
|
|
17
15
|
}
|
|
18
16
|
/**
|
|
19
17
|
* Returns the CSS styles for the component.
|
|
20
|
-
*
|
|
21
18
|
* @static
|
|
22
19
|
* @returns {CSSStyleSheet}
|
|
23
20
|
*/
|
|
@@ -26,7 +23,6 @@ class RouterLink extends WJElement {
|
|
|
26
23
|
}
|
|
27
24
|
/**
|
|
28
25
|
* Returns the list of attributes to observe for changes.
|
|
29
|
-
*
|
|
30
26
|
* @static
|
|
31
27
|
* @returns {Array<string>}
|
|
32
28
|
*/
|
|
@@ -41,24 +37,24 @@ class RouterLink extends WJElement {
|
|
|
41
37
|
this.setAttribute("active-class", "active");
|
|
42
38
|
}
|
|
43
39
|
/**
|
|
44
|
-
* Draws the component.
|
|
45
|
-
*
|
|
46
|
-
* @param {Object} context - The context for drawing.
|
|
47
|
-
* @param {Object} store - The store for drawing.
|
|
48
|
-
* @param {Object} params - The parameters for drawing.
|
|
40
|
+
* Draws the component for the router link.
|
|
49
41
|
* @returns {DocumentFragment}
|
|
50
42
|
*/
|
|
51
|
-
draw(
|
|
43
|
+
draw() {
|
|
52
44
|
let fragment = document.createDocumentFragment();
|
|
53
45
|
let element = document.createElement("slot");
|
|
54
46
|
fragment.appendChild(element);
|
|
55
47
|
return fragment;
|
|
56
48
|
}
|
|
49
|
+
afterDraw(context, appStore, attributes) {
|
|
50
|
+
this.unbindRouterLinks = bindRouterLinks(this.parentElement, { selector: false });
|
|
51
|
+
}
|
|
57
52
|
/**
|
|
58
53
|
* Cleans up before the component is disconnected.
|
|
59
54
|
*/
|
|
60
55
|
beforeDisconnect() {
|
|
61
|
-
|
|
56
|
+
var _a;
|
|
57
|
+
(_a = this.unbindRouterLinks) == null ? void 0 : _a.call(this);
|
|
62
58
|
}
|
|
63
59
|
}
|
|
64
60
|
RouterLink.define("wje-router-link", RouterLink);
|
|
@@ -23,35 +23,33 @@ class AnimationHook {
|
|
|
23
23
|
done();
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
const raf = window.requestAnimationFrame;
|
|
27
|
+
const TRANSITION = "transition";
|
|
28
|
+
const ANIMATION = "animation";
|
|
29
|
+
const transitionProp = "transition";
|
|
30
|
+
const transitionEndEvent = "transitionend";
|
|
31
|
+
const animationProp = "animation";
|
|
32
|
+
const animationEndEvent = "animationend";
|
|
33
33
|
function nextFrame(fn) {
|
|
34
|
-
window.scrollTo(0, 0);
|
|
35
34
|
raf(function() {
|
|
36
|
-
window.scrollTo(0, 0);
|
|
37
35
|
raf(fn);
|
|
38
36
|
});
|
|
39
37
|
}
|
|
40
38
|
function whenTransitionEnds(el, cb) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
const ref = getTransitionInfo(el);
|
|
40
|
+
const type = ref.type;
|
|
41
|
+
const timeout = ref.timeout;
|
|
42
|
+
const propCount = ref.propCount;
|
|
45
43
|
if (!type) {
|
|
46
44
|
return cb();
|
|
47
45
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
const event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
|
|
47
|
+
let ended = 0;
|
|
48
|
+
const end = function() {
|
|
51
49
|
el.removeEventListener(event, onEnd);
|
|
52
50
|
cb();
|
|
53
51
|
};
|
|
54
|
-
|
|
52
|
+
const onEnd = function(e) {
|
|
55
53
|
if (e.target === el) {
|
|
56
54
|
if (++ended >= propCount) {
|
|
57
55
|
end();
|
|
@@ -66,19 +64,16 @@ function whenTransitionEnds(el, cb) {
|
|
|
66
64
|
el.addEventListener(event, onEnd);
|
|
67
65
|
}
|
|
68
66
|
function getTransitionInfo(el) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
timeout = Math.max(transitionTimeout, animationTimeout);
|
|
80
|
-
type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
|
|
81
|
-
propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
|
|
67
|
+
const styles = window.getComputedStyle(el);
|
|
68
|
+
const transitionDelays = (styles[transitionProp + "Delay"] || "").split(", ");
|
|
69
|
+
const transitionDurations = (styles[transitionProp + "Duration"] || "").split(", ");
|
|
70
|
+
const transitionTimeout = getTimeout(transitionDelays, transitionDurations);
|
|
71
|
+
const animationDelays = (styles[animationProp + "Delay"] || "").split(", ");
|
|
72
|
+
const animationDurations = (styles[animationProp + "Duration"] || "").split(", ");
|
|
73
|
+
const animationTimeout = getTimeout(animationDelays, animationDurations);
|
|
74
|
+
const timeout = Math.max(transitionTimeout, animationTimeout);
|
|
75
|
+
const type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION : ANIMATION : null;
|
|
76
|
+
const propCount = type ? type === TRANSITION ? transitionDurations.length : animationDurations.length : 0;
|
|
82
77
|
return {
|
|
83
78
|
type,
|
|
84
79
|
timeout,
|
|
@@ -89,9 +84,12 @@ function getTimeout(delays, durations) {
|
|
|
89
84
|
while (delays.length < durations.length) {
|
|
90
85
|
delays = delays.concat(delays);
|
|
91
86
|
}
|
|
92
|
-
return Math.max.apply(
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
return Math.max.apply(
|
|
88
|
+
null,
|
|
89
|
+
durations.map(function(d, i) {
|
|
90
|
+
return toMs(d) + toMs(delays[i]);
|
|
91
|
+
})
|
|
92
|
+
);
|
|
95
93
|
}
|
|
96
94
|
function toMs(s) {
|
|
97
95
|
return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
|
|
@@ -99,7 +97,6 @@ function toMs(s) {
|
|
|
99
97
|
function runTransition(el, name, type, cb) {
|
|
100
98
|
el.classList.add(`${name}-${type}-active`);
|
|
101
99
|
nextFrame(function() {
|
|
102
|
-
window.scrollTo(0, 0);
|
|
103
100
|
el.classList.remove(`${name}-${type}`);
|
|
104
101
|
el.classList.add(`${name}-${type}-to`);
|
|
105
102
|
whenTransitionEnds(el, function() {
|
|
@@ -120,7 +117,6 @@ class GenericCSS extends AnimationHook {
|
|
|
120
117
|
leave(outlet, el, done) {
|
|
121
118
|
const name = outlet.getAttribute("animation") || "outlet";
|
|
122
119
|
el.classList.add(`${name}-leave`);
|
|
123
|
-
el.style.display = "none";
|
|
124
120
|
runTransition(el, name, "leave", done);
|
|
125
121
|
}
|
|
126
122
|
}
|
|
@@ -179,11 +175,13 @@ setDefaultAnimation(GenericCSS);
|
|
|
179
175
|
class RouterOutlet extends AnimatedOutlet {
|
|
180
176
|
/**
|
|
181
177
|
* Creates an instance of Route.
|
|
182
|
-
*
|
|
183
|
-
* @constructor
|
|
184
178
|
*/
|
|
185
179
|
constructor() {
|
|
186
180
|
super();
|
|
181
|
+
/**
|
|
182
|
+
* The class name for the component.
|
|
183
|
+
* @type {string}
|
|
184
|
+
*/
|
|
187
185
|
__publicField(this, "className", "RouterOutlet");
|
|
188
186
|
}
|
|
189
187
|
}
|